import{j as e}from"./jsx-runtime-CnH95YSl.js";import{O as Ee}from"./OdysseyStorybookThemeDecorator-BuDiOG2V.js";import{f as I}from"./fieldComponentPropsMetaData-BqbNLw6V.js";import{a as Re,O as oe,b as ne,c as ae,d as We,e as k,p as He}from"./pickerComponentPropsMetadata-D10GkMIO.js";import{P as d}from"./PlaceholderLogo-JfVvgA23.js";import{u as ie,h as Be}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{r as f}from"./index-NdkWRN8K.js";import{M as qe}from"./Box-1mvP3NLW.js";import{M as Ge}from"./Tag-DwH0t814.js";import{p as _e}from"./pxToRem-BrMhKUxS.js";import{j as re}from"./Typography-Cz6D417Y.js";import{M as Ne}from"./Sync-BbqTDeWk.js";import{M as D}from"./Folder-e-po0U54.js";import{M as y}from"./Globe-B83Xmd05.js";import{M as C}from"./Settings-2rTKyez8.js";import{M as $e}from"./Video-DWT3WylB.js";import"./index-BJTM6NaI.js";import"./OdysseyProvider-qIn9QVYS.js";import"./useAutocomplete-BRetTkpF.js";import"./index.esm-CBOWgn41.js";import"./assertThisInitialized-B9jnkVVz.js";import"./inheritsLoose-CJ6Ie9dp.js";import"./Field-DH3L8v09.js";import"./List-CmjR1pNu.js";import"./ListItem-C0ExFtXb.js";import"./utils-iop7lDec.js";import"./useFormControl-BMISTZuX.js";import"./FormLabel-CiGre9wK.js";import"./useIsFocusVisible-DH0qxT5e.js";import"./isHostComponent-DVu5iVWx.js";import"./ButtonBase-BNqa2TMD.js";import"./TransitionGroupContext-DAL84N7p.js";import"./ScreenReaderText-CebALBsG.js";import"./Box-BcMTQ_R2.js";import"./createBox-Dxawkfow.js";import"./visuallyHidden-Dan1xhjv.js";import"./FormHelperText-CsNAE1E3.js";import"./FieldHint-B3Jif_Up.js";import"./useUniqueId-Bsgqe1tm.js";import"./createUniqueId-ByTaVY63.js";import"./inputUtils-Dbi8XkA6.js";import"./InputBase-DeB4_faH.js";import"./ownerWindow-HkKU3E4x.js";import"./ownerDocument-DW-IO8s5.js";import"./debounce-Be36O1Ab.js";import"./Autocomplete-CxtGbb8j.js";import"./ArrowDropDown-DdemyKZU.js";import"./createSvgIcon-ClUWwDzL.js";import"./Close-OXBt1nIe.js";import"./Paper-D-_O-EjU.js";import"./Popper-BARIxJrI.js";import"./popper-BVOCD5jc.js";import"./_commonjsHelpers-gnU0ypJ3.js";import"./Portal-C6D59xAE.js";import"./index-B5xazMy1.js";import"./index-DieBXP3Z.js";import"./getReactElementRef-DsIevm5t.js";import"./resolveComponentProps-DXQ8X87i.js";import"./useControlled-NQulfz4l.js";import"./Chip-CXnMieIl.js";import"./IconButton-5qShmnSr.js";import"./ListSubheader-CQJAAOsd.js";import"./MuiPropsContext-DhRylJZk.js";import"./Typography-ClQ35Rr-.js";/*!
 * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */const T=Be("div",{shouldForwardProp:t=>t!=="odysseyDesignTokens"&&t!=="adornmentSize"&&t!=="isTagContainer"})(({adornmentSize:t="small",isTagContainer:n=!1,odysseyDesignTokens:o})=>({position:"relative",bottom:"1px",alignSelf:"flex-start",width:o.Spacing5,height:o.Spacing5,overflow:"hidden",marginInlineEnd:o.Spacing3,flexShrink:0,svg:{width:"100%",height:"auto"},img:{position:"absolute",top:"50%",left:"50%",width:"100%",transform:"translate(-50%, -50%)"},...t==="large"&&!n&&{bottom:0,width:o.Spacing8,height:o.Spacing8},...n&&{bottom:0,alignSelf:"center",width:o.Spacing4,height:"auto",maxHeight:o.Spacing4,marginInlineEnd:o.Spacing2,"&:has(> img)":{height:`${_e(16)}rem`},svg:{display:"flex",width:"100%",height:"auto"}}})),se=({adornment:t,adornmentSize:n,odysseyDesignTokens:o})=>typeof t=="string"?e.jsx(T,{adornmentSize:n,odysseyDesignTokens:o,children:e.jsx("img",{alt:"",role:"presentation",src:t})}):e.jsx(T,{adornmentSize:n,odysseyDesignTokens:o,children:t}),Je=({adornmentSize:t,muiProps:n,odysseyDesignTokens:o,option:i})=>{const{adornment:r,description:s,label:l,value:m}=i;return e.jsxs(oe,{hasAdornment:!0,muiProps:n,children:[e.jsx(se,{adornment:r,adornmentSize:t,odysseyDesignTokens:o}),e.jsxs(ne,{odysseyDesignTokens:o,children:[e.jsx(re,{component:"p",children:l}),e.jsx(ae,{description:s,odysseyDesignTokens:o})]})]},m)},Ke=({adornmentSize:t,muiProps:n,odysseyDesignTokens:o,option:i})=>{const{adornment:r,description:s,label:l,metaData:m,value:O}=i;return e.jsxs(oe,{hasAdornment:!0,muiProps:n,children:[e.jsx(se,{adornment:r,adornmentSize:t,odysseyDesignTokens:o}),e.jsxs("div",{children:[e.jsxs(ne,{odysseyDesignTokens:o,children:[e.jsx(re,{component:"p",children:l}),e.jsx(ae,{description:s,odysseyDesignTokens:o})]}),e.jsx(We,{metaData:m,odysseyDesignTokens:o})]})]},O)},Qe=({adornment:t})=>{const n=ie();return typeof t=="string"?e.jsx(T,{isTagContainer:!0,odysseyDesignTokens:n,children:e.jsx("img",{alt:"",role:"presentation",src:t})}):e.jsx(T,{isTagContainer:!0,odysseyDesignTokens:n,children:t})},Ue=({adornmentSize:t="small",ariaDescribedBy:n,defaultValue:o,emptyOptionsText:i,errorMessage:r,errorMessageList:s,getIsOptionEqualToValue:l,groupOptionsBy:m,hasMultipleChoices:O,id:me,inputValue:pe,isCustomValueAllowed:de,isDisabled:ce,isFullWidth:ue=!1,isLoading:ge,isOptional:he=!1,isReadOnly:xe,isVirtualized:Se=!1,hint:be,HintLinkComponent:je,label:ve,name:Me,onBlur:fe,onChange:Te,onInputChange:Oe,onFocus:Ae,options:De,value:ye,testId:Ce,translate:ze})=>{const p=ie(),Ie=f.useCallback((u,a)=>u.map((A,Le)=>{const{key:we,onDelete:Pe}=a({index:Le}),{adornment:Fe,label:Ve}=A;return e.jsx(qe,{sx:{margin:p.Spacing1,marginInlineEnd:0},children:e.jsx(Ge,{icon:e.jsx(Qe,{adornment:Fe}),label:Ve,onRemove:Pe})},we)}),[p]),ke=f.useCallback((u,a)=>{const A="metaData"in a&&a.metaData;return e.jsx(f.Fragment,{children:A?e.jsx(Ke,{adornmentSize:t,muiProps:u,odysseyDesignTokens:p,option:a}):e.jsx(Je,{adornmentSize:t,muiProps:u,odysseyDesignTokens:p,option:a})},a.value)},[t,p]);return e.jsx(Re,{ariaDescribedBy:n,defaultValue:o,emptyOptionsText:i,errorMessage:r,errorMessageList:s,getIsOptionEqualToValue:l,groupOptionsBy:m,hasMultipleChoices:O,hint:be,HintLinkComponent:je,id:me,inputValue:pe,isCustomValueAllowed:de,isDisabled:ce,isFullWidth:ue,isLoading:ge,isOptional:he,isReadOnly:xe,isVirtualized:Se,label:ve,name:Me,onBlur:fe,onChange:Te,onFocus:Ae,onInputChange:Oe,options:De,renderOption:ke,renderTags:Ie,testId:Ce,translate:ze,value:ye})},le=f.memo(Ue);le.displayName="PickerWithOptionAdornment";const c=[{value:"an",label:"An Option label",description:"Some optional descriptive text",adornment:e.jsx(D,{})},{value:"the",label:"The Option label",description:"Some optional descriptive text that in this particular case is really quite long and verbose and if this were real should probably be shortened.",adornment:e.jsx(y,{})},{value:"another",label:"Another Option label",description:"Some optional descriptive text",adornment:e.jsx(C,{})},{value:"this",label:"This Option label",description:"Some optional descriptive text",adornment:e.jsx(Ne,{})},{value:"last",label:"The last Option label",description:"Some optional descriptive text.",adornment:e.jsx($e,{})},{value:"image",label:"This adornment is an image",description:"Some optional descriptive text.",adornment:"https://placehold.co/400x600"}],z=[{value:"an",label:"An Option label",description:"Some optional descriptive text",adornment:e.jsx(d.One,{})},{value:"the",label:"The Option label",description:"Some optional descriptive text",adornment:e.jsx(d.Two,{})},{value:"another",label:"Another Option label",description:"Some optional descriptive text that in this particular case is really quite long and verbose and if this were real should probably be shortened.",adornment:e.jsx(d.Three,{})},{value:"this",label:"This Option label",description:"Some optional descriptive text",adornment:e.jsx(d.Four,{})},{value:"last",label:"The last Option label",description:"Some optional descriptive text.",adornment:e.jsx(d.Five,{})},{value:"image",label:"This adornment is an image",description:"Some optional descriptive text.",adornment:"https://placehold.co/400x600"}],so={component:le,decorators:[Ee],tags:["autodocs"],argTypes:{...He,adornmentSize:{control:"radio",options:k,description:"Choose the size for the leading adornment. 'small' or 'large'",table:{type:{summary:k.join(" | ")}}},hint:I.hint,HintLinkComponent:I.HintLinkComponent},args:{label:"Picker with option adornment label",hint:"Optional hint text for picker",options:c}},g={},h={args:{options:c.map(t=>({...t,metaData:[{icon:e.jsx(C,{}),detailText:"10"},{icon:e.jsx(y,{}),detailText:"1"},{icon:e.jsx(D,{}),detailText:40}]}))}},x={args:{adornmentSize:"large",options:z}},S={args:{adornmentSize:"large",options:z.map(t=>({...t,metaData:[{icon:e.jsx(C,{}),detailText:"10"},{icon:e.jsx(y,{}),detailText:"1"},{icon:e.jsx(D,{}),detailText:40}]}))}},b={args:{isDisabled:!0,value:c[0]}},j={args:{hasMultipleChoices:!0}},v={args:{hasMultipleChoices:!0,adornmentSize:"large",options:z}},M={args:{isDisabled:!0,hasMultipleChoices:!0,value:[c[0],c[1]]}};var L,w,P;g.parameters={...g.parameters,docs:{...(L=g.parameters)==null?void 0:L.docs,source:{originalSource:"{}",...(P=(w=g.parameters)==null?void 0:w.docs)==null?void 0:P.source}}};var F,V,E;h.parameters={...h.parameters,docs:{...(F=h.parameters)==null?void 0:F.docs,source:{originalSource:`{
  args: {
    options: optionsSmall.map(option => ({
      ...option,
      metaData: [{
        icon: <SettingsIcon />,
        detailText: "10"
      }, {
        icon: <GlobeIcon />,
        detailText: "1"
      }, {
        icon: <FolderIcon />,
        detailText: 40
      }]
    }))
  }
}`,...(E=(V=h.parameters)==null?void 0:V.docs)==null?void 0:E.source}}};var R,W,H;x.parameters={...x.parameters,docs:{...(R=x.parameters)==null?void 0:R.docs,source:{originalSource:`{
  args: {
    adornmentSize: "large",
    options: optionsLarge
  }
}`,...(H=(W=x.parameters)==null?void 0:W.docs)==null?void 0:H.source}}};var B,q,G;S.parameters={...S.parameters,docs:{...(B=S.parameters)==null?void 0:B.docs,source:{originalSource:`{
  args: {
    adornmentSize: "large",
    options: optionsLarge.map(option => ({
      ...option,
      metaData: [{
        icon: <SettingsIcon />,
        detailText: "10"
      }, {
        icon: <GlobeIcon />,
        detailText: "1"
      }, {
        icon: <FolderIcon />,
        detailText: 40
      }]
    }))
  }
}`,...(G=(q=S.parameters)==null?void 0:q.docs)==null?void 0:G.source}}};var _,N,$;b.parameters={...b.parameters,docs:{...(_=b.parameters)==null?void 0:_.docs,source:{originalSource:`{
  args: {
    isDisabled: true,
    value: optionsSmall[0]
  }
}`,...($=(N=b.parameters)==null?void 0:N.docs)==null?void 0:$.source}}};var J,K,Q;j.parameters={...j.parameters,docs:{...(J=j.parameters)==null?void 0:J.docs,source:{originalSource:`{
  args: {
    hasMultipleChoices: true
  }
}`,...(Q=(K=j.parameters)==null?void 0:K.docs)==null?void 0:Q.source}}};var U,X,Y;v.parameters={...v.parameters,docs:{...(U=v.parameters)==null?void 0:U.docs,source:{originalSource:`{
  args: {
    hasMultipleChoices: true,
    adornmentSize: "large",
    options: optionsLarge
  }
}`,...(Y=(X=v.parameters)==null?void 0:X.docs)==null?void 0:Y.source}}};var Z,ee,te;M.parameters={...M.parameters,docs:{...(Z=M.parameters)==null?void 0:Z.docs,source:{originalSource:`{
  args: {
    isDisabled: true,
    hasMultipleChoices: true,
    value: [optionsSmall[0], optionsSmall[1]]
  }
}`,...(te=(ee=M.parameters)==null?void 0:ee.docs)==null?void 0:te.source}}};const lo=["SmallAdornment","SmallAdornmentAndMetaData","LargeAdornment","LargeAdornmentAndMetaData","Disabled","SmallAdornmentMultiSelect","LargeAdornmentMultiSelect","MultiSelectDisabled"];export{b as Disabled,x as LargeAdornment,S as LargeAdornmentAndMetaData,v as LargeAdornmentMultiSelect,M as MultiSelectDisabled,g as SmallAdornment,h as SmallAdornmentAndMetaData,j as SmallAdornmentMultiSelect,lo as __namedExportsOrder,so as default};
