import{_ as _extends}from"./_rollupPluginBabelHelpers-B5fk9IVe.js";import React__default,{useContext,useEffect,Fragment}from"react";import PropTypes from"prop-types";import{a as SelectContext,I as It}from"./Select.component-H9Siw7mx.js";import{I as Icon}from"./Icon.component-BVkaZqpA.js";const optionStyles=`
  jn-flex
  jn-pt-[0.6875rem]
  jn-pb-[0.5rem]
  jn-pr-[0.875rem]
  jn-select-none
  data-[headlessui-state=active]:jn-outline-none
  data-[headlessui-state=active]:jn-ring-2
  data-[headlessui-state=active]:jn-ring-inset
  data-[headlessui-state=active]:jn-ring-theme-focus
  data-[headlessui-state=active]:jn-bg-theme-background-lvl-3
`,unselectedOptionStyles=`
  jn-text-theme-default
  jn-pl-[2.375rem]
`,selectedOptionStyles=`
  jn-text-theme-accent
  jn-pl-3.5
`,selectedIconStyles=`
  jn-inline-block
  jn-mr-1.5
  jn-overflow-auto
`,disabledOptionLabelStyles=`
  jn-opacity-50
  jn-cursor-not-allowed
`,truncateOptionStyles=`
  jn-block
  jn-h-6
  jn-overflow-hidden
  jn-text-ellipsis
  jn-whitespace-nowrap
`,SelectOption=a=>{let{children:b,className:e="",disabled:f=!1,value:g="",label:c,...d}=a;const h=useContext(SelectContext),{truncateOptions:i,addOptionValueAndLabel:j}=h||{};return useEffect(()=>{j(g,c,b)},[g,c,b]),React__default.createElement(It.Option,{as:Fragment,disabled:f,value:g||b},a=>{let{selected:h}=a;return React__default.createElement("li",_extends({className:`
          juno-select-option 
          jn-min-h-[2.5rem]
          ${optionStyles}
          ${h?"juno-select-option-selected "+selectedOptionStyles:unselectedOptionStyles}
          ${f?"juno-select-option-disabled jn-opacity-50 jn-cursor-not-allowed":""}
          ${i?"juno-select-option-truncate":""}
          ${e}
        `},d),h?React__default.createElement(Icon,{icon:"check",size:"18",className:`${selectedIconStyles}`}):"",React__default.createElement("span",{className:`
            ${f?disabledOptionLabelStyles:""}
            ${i?truncateOptionStyles:""}
          `},b||c||g))})};SelectOption.propTypes={children:PropTypes.string,className:PropTypes.string,disabled:PropTypes.bool,value:PropTypes.string,label:PropTypes.string};export{SelectOption as S};