@stokelp/ui 2.116.0 → 2.117.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../utils/slots.cjs"),t=require("../tooltip/Tooltip.cjs"),n=require("../text/Text.cjs"),r=require("../../shared/ConditionalWrapper.cjs"),i=require("../input/Input.cjs");let a=require("@ark-ui/react"),o=require("@stokelp/styled-system/jsx"),s=require("@stokelp/styled-system/recipes"),c=require("react"),l=require("react/jsx-runtime"),u=require("@stokelp/styled-system/css"),d=require("react-window"),f=require("lodash");var{withProvider:p,withContext:m}=e.createStyleContext(s.combobox),h=p((0,o.styled)(a.Combobox.Root),`root`,{defaultProps:{loopFocus:!0}}),g=m((0,o.styled)(a.Combobox.ClearTrigger),`clearTrigger`),_=m((0,o.styled)(a.Combobox.Content),`content`),v=m((0,o.styled)(a.Combobox.Input),`input`),y=m((0,o.styled)(a.Combobox.Control),`control`),b=m((0,o.styled)(a.Combobox.Item),`item`),x=m((0,o.styled)(a.Combobox.ItemText),`itemText`),S=m((0,o.styled)(a.Combobox.Positioner),`positioner`),C=m((0,o.styled)(a.Combobox.Trigger),`trigger`),w=()=>(0,l.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,l.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,u.css)({stroke:`grey.100`})})]}),T=()=>(0,l.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,u.css)({fill:`primary.500`})}),(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z`,fill:`white`})]});function E({item:e,isMultiple:t,renderItem:n}){let r=(0,a.useComboboxItemContext)();return(0,l.jsxs)(l.Fragment,{children:[t?r.selected?(0,l.jsx)(T,{}):(0,l.jsx)(w,{}):null,n?n(e):(0,l.jsx)(x,{truncate:!0,children:e.label})]})}var D=({items:e=[],initialItems:o,debounceMs:s=0,placeholder:u,emptyLabel:p,loadingLabel:m,usePortal:x=!0,withAutoFilter:w=!0,positioning:T,loadItems:D,renderItem:O,onResetInitialItems:k,isLoading:A,value:j,openDropdownOnFocus:M=!0,clearValueWhenEmpty:N=!0,virtualized:P,rowHeight:F=34,returnItemsOnEmpty:I,...L})=>{let[R,z]=(0,c.useState)(()=>e),[B,V]=(0,c.useState)(!1),[H,U]=(0,c.useState)(!1),W=typeof D==`function`,G=(0,c.useMemo)(()=>D?(0,f.debounce)(async e=>{try{U(!0),V(!0),z(await D(e))}catch(e){console.error(e),z([])}finally{V(!1)}},s):null,[D,s]),K=[...R,...o??[]],q=(0,c.useCallback)(async t=>{o&&o.length>0&&!o.find(e=>e.label===t.inputValue)&&k?.();let{inputValue:n}=t;if(G)G(n);else{let t=w&&n!==``?e.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())):e;if(t.length===0&&I)return z(e);z(t)}},[G,e,w]);(0,c.useEffect)(()=>{!w&&!G&&z(e)},[e,w,G]);let J=(0,c.useMemo)(()=>(0,a.createListCollection)({items:K}),[K]),Y=A??B,X=m??(0,l.jsx)(n.Text,{p:`space-8`,textAlign:`center`,children:`Chargement...`}),Z=p??(0,l.jsx)(n.Text,{p:`space-8`,textAlign:`center`,children:`Aucun résultat`});return(0,l.jsxs)(h,{lazyMount:!0,unmountOnExit:!0,collection:J,positioning:{sameWidth:!0,gutter:0,...T},"data-recipe":`combobox`,onInputValueChange:q,value:j,...L,multiple:!1,children:[(0,l.jsxs)(y,{children:[(0,l.jsx)(a.Combobox.Context,{children:e=>(0,l.jsx)(v,{asChild:!0,placeholder:u,onInput:t=>{let n=t.currentTarget.value;N&&n===``&&e.clearValue()},onFocus:()=>{!M||W||e.setOpen(!0)},children:(0,l.jsx)(i.Input,{})})}),(0,l.jsx)(C,{asChild:!0,hidden:W&&(!o||o.length===0),children:(0,l.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z`,fill:`currentColor`})})}),(0,l.jsx)(g,{disabled:L.readOnly,onClick:k,asChild:!0,children:(0,l.jsx)(`button`,{children:(0,l.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z`,fill:`currentColor`})})})})]}),(0,l.jsx)(r.ConditionalWrapper,{when:x,wrapper:e=>(0,l.jsx)(a.Portal,{children:e}),children:(0,l.jsx)(S,{children:(0,l.jsx)(_,{children:Y?X:K.length===0?(0,l.jsx)(l.Fragment,{children:W?H?Z:X:Z}):P?(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(d.FixedSizeList,{height:Math.min(F*K.length,180),itemCount:K.length,itemSize:F,width:`100%`,children:({index:e,style:n})=>(0,l.jsx)(r.ConditionalWrapper,{when:!!K[e].tooltip,wrapper:n=>(0,l.jsx)(t.Tooltip,{label:K[e].tooltip,children:n}),children:(0,l.jsx)(b,{item:K[e],style:n,children:(0,l.jsx)(E,{renderItem:O,item:K[e],isMultiple:!1})},K[e].value)},K[e].value)})}):K.map(e=>(0,l.jsx)(r.ConditionalWrapper,{when:!!e.tooltip,wrapper:n=>(0,l.jsx)(t.Tooltip,{label:e.tooltip,children:n}),children:(0,l.jsx)(b,{item:e,children:(0,l.jsx)(E,{renderItem:O,item:e,isMultiple:!1})},e.value)},e.value))})})})]})};exports.Combobox=D;
1
+ "use client";const e=require("../../utils/slots.cjs"),t=require("../tooltip/Tooltip.cjs"),n=require("../text/Text.cjs"),r=require("../../shared/ConditionalWrapper.cjs"),i=require("../input/Input.cjs"),a=require("../chip/Chip.cjs");let o=require("@ark-ui/react"),s=require("@stokelp/styled-system/jsx"),c=require("@stokelp/styled-system/recipes"),l=require("react"),u=require("react/jsx-runtime"),d=require("@stokelp/styled-system/css"),f=require("react-window"),p=require("lodash");var{withProvider:m,withContext:h}=e.createStyleContext(c.combobox),g=m((0,s.styled)(o.Combobox.Root),`root`,{defaultProps:{loopFocus:!0}}),_=h((0,s.styled)(o.Combobox.ClearTrigger),`clearTrigger`),v=h((0,s.styled)(o.Combobox.Content),`content`),y=h((0,s.styled)(o.Combobox.Input),`input`),b=h((0,s.styled)(o.Combobox.Control),`control`),x=h((0,s.styled)(o.Combobox.Item),`item`),S=h((0,s.styled)(o.Combobox.ItemText),`itemText`),C=h((0,s.styled)(o.Combobox.Positioner),`positioner`),w=h((0,s.styled)(o.Combobox.Trigger),`trigger`),T=()=>(0,u.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,u.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,u.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,d.css)({stroke:`grey.100`})})]}),E=()=>(0,u.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,u.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,d.css)({fill:`primary.500`})}),(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z`,fill:`white`})]});function D({item:e,isMultiple:t,renderItem:n}){let r=(0,o.useComboboxItemContext)();return(0,u.jsxs)(u.Fragment,{children:[t?r.selected?(0,u.jsx)(E,{}):(0,u.jsx)(T,{}):null,n?n(e):(0,u.jsx)(S,{truncate:!0,children:e.label})]})}var O=({items:e=[],initialItems:s,debounceMs:c=0,placeholder:m,emptyLabel:h,loadingLabel:S,usePortal:T=!0,withAutoFilter:E=!0,positioning:O,loadItems:k,renderItem:A,renderValue:j,onResetInitialItems:M,isLoading:N,value:P,openDropdownOnFocus:F=!0,clearValueWhenEmpty:ee=!0,virtualized:te,rowHeight:I=34,returnItemsOnEmpty:L,multiple:R=!1,...z})=>{let[B,V]=(0,l.useState)(()=>e),[H,U]=(0,l.useState)(!1),[W,G]=(0,l.useState)(!1),K=typeof k==`function`,q=(0,l.useMemo)(()=>k?(0,p.debounce)(async e=>{try{G(!0),U(!0),V(await k(e))}catch(e){console.error(e),V([])}finally{U(!1)}},c):null,[k,c]),J=[...B,...s??[]],Y=(0,l.useCallback)(async t=>{s&&s.length>0&&!s.find(e=>e.label===t.inputValue)&&M?.();let{inputValue:n}=t;if(q)q(n);else{let t=E&&n!==``?e.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())):e;if(t.length===0&&L)return V(e);V(t)}},[q,e,E]);(0,l.useEffect)(()=>{!E&&!q&&V(e)},[e,E,q]);let X=(0,l.useMemo)(()=>(0,o.createListCollection)({items:J}),[J]),Z=N??H,Q=S??(0,u.jsx)(n.Text,{p:`space-8`,textAlign:`center`,children:`Chargement...`}),$=h??(0,u.jsx)(n.Text,{p:`space-8`,textAlign:`center`,children:`Aucun résultat`});return(0,u.jsxs)(g,{lazyMount:!0,unmountOnExit:!0,collection:X,positioning:{sameWidth:!0,gutter:0,...O},"data-recipe":`combobox`,onInputValueChange:Y,value:P,...z,multiple:R,children:[R?(0,u.jsx)(o.Combobox.Context,{children:e=>(0,u.jsxs)(b,{css:{display:`flex`,alignItems:`center`,gap:`space-4`,minHeight:`40px`,paddingBlock:`space-4`,paddingLeft:`space-8`,paddingRight:`space-48`,border:`1px solid {colors.grey.100}`,borderRadius:`radius-8`,cursor:`text`,transitionProperty:`border-color`,transitionDuration:`normal`,_focusWithin:{borderColor:`primary.500`},...e.open?{borderColor:`primary.500`,borderBottomColor:`grey.100`,borderBottomLeftRadius:`radius-0`,borderBottomRightRadius:`radius-0`}:{},_disabled:{cursor:`not-allowed`,background:`grey.50`}},children:[(0,u.jsxs)(`div`,{className:(0,d.css)({display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`space-4`,flex:`1`,minWidth:`0`}),children:[e.selectedItems.map(t=>(0,u.jsxs)(a.Chip,{size:`sm`,children:[j?j(t):(0,u.jsx)(a.ChipLabel,{children:t.label}),!z.readOnly&&!z.disabled&&(0,u.jsx)(a.ChipClearTrigger,{"aria-label":`Retirer ${t.label}`,onClick:()=>e.setValue(e.value.filter(e=>String(e)!==String(t.value)))})]},t.value)),(0,u.jsx)(o.Combobox.Input,{asChild:!0,placeholder:e.hasSelectedItems?void 0:m,onFocus:()=>{!F||K||e.setOpen(!0)},children:(0,u.jsx)(i.Input,{css:{border:`none`,minHeight:`auto`,height:`auto`,width:`auto`,flex:`1 1 90px`,minWidth:`90px`,paddingBlock:`space-2`,paddingInline:`space-0`,background:`transparent`,_hover:{borderColor:`transparent`},_focus:{borderColor:`transparent`}}})})]}),(0,u.jsx)(w,{asChild:!0,hidden:K&&(!s||s.length===0),children:(0,u.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z`,fill:`currentColor`})})})]})}):(0,u.jsxs)(b,{children:[(0,u.jsx)(o.Combobox.Context,{children:e=>(0,u.jsx)(y,{asChild:!0,placeholder:m,onInput:t=>{let n=t.currentTarget.value;ee&&n===``&&e.clearValue()},onFocus:()=>{!F||K||e.setOpen(!0)},children:(0,u.jsx)(i.Input,{})})}),(0,u.jsx)(w,{asChild:!0,hidden:K&&(!s||s.length===0),children:(0,u.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z`,fill:`currentColor`})})}),(0,u.jsx)(_,{disabled:z.readOnly,onClick:M,asChild:!0,children:(0,u.jsx)(`button`,{children:(0,u.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z`,fill:`currentColor`})})})})]}),(0,u.jsx)(r.ConditionalWrapper,{when:T,wrapper:e=>(0,u.jsx)(o.Portal,{children:e}),children:(0,u.jsx)(C,{children:(0,u.jsx)(v,{children:Z?Q:J.length===0?(0,u.jsx)(u.Fragment,{children:K?W?$:Q:$}):te?(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(f.FixedSizeList,{height:Math.min(I*J.length,180),itemCount:J.length,itemSize:I,width:`100%`,children:({index:e,style:n})=>(0,u.jsx)(r.ConditionalWrapper,{when:!!J[e].tooltip,wrapper:n=>(0,u.jsx)(t.Tooltip,{label:J[e].tooltip,children:n}),children:(0,u.jsx)(x,{item:J[e],style:n,children:(0,u.jsx)(D,{renderItem:A,item:J[e],isMultiple:R})},J[e].value)},J[e].value)})}):J.map(e=>(0,u.jsx)(r.ConditionalWrapper,{when:!!e.tooltip,wrapper:n=>(0,u.jsx)(t.Tooltip,{label:e.tooltip,children:n}),children:(0,u.jsx)(x,{item:e,children:(0,u.jsx)(D,{renderItem:A,item:e,isMultiple:R})},e.value)},e.value))})})})]})};exports.Combobox=O;
2
2
  //# sourceMappingURL=Combobox.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.cjs","names":[],"sources":["../../../src/components/combobox/Combobox.tsx"],"sourcesContent":["import {\n Combobox as ArkCombobox,\n type ComboboxRootProps,\n createListCollection,\n Portal,\n useComboboxItemContext,\n} from '@ark-ui/react'\nimport { FC, ReactNode, useCallback, useEffect, useMemo, useState } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { debounce } from 'lodash'\n\nimport { combobox } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { Input as UIInput } from '~/components/input'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(combobox)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkCombobox.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkCombobox.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkCombobox.Content), 'content')\nconst Input = withContext(styled(ArkCombobox.Input), 'input')\nconst Control = withContext(styled(ArkCombobox.Control), 'control')\nconst Item = withContext(styled(ArkCombobox.Item), 'item')\nconst ItemText = withContext(styled(ArkCombobox.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkCombobox.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkCombobox.Trigger), 'trigger')\n\nexport type ComboboxItem = {\n value: string | number\n label: string\n disabled?: boolean\n tooltip?: ReactNode\n}\n\nexport type ComboboxProps<T extends ComboboxItem> = Omit<ComboboxRootProps<T>, 'collection' | 'value'> & {\n value?: Array<string | number>\n items?: T[]\n initialItems?: T[]\n renderItem?: (item: T) => ReactNode\n loadItems?: (inputValue: string) => Promise<T[]>\n debounceMs?: number\n emptyLabel?: ReactNode\n loadingLabel?: ReactNode\n placeholder?: string\n usePortal?: boolean\n isLoading?: boolean\n withAutoFilter?: boolean\n onResetInitialItems?: () => void\n openDropdownOnFocus?: boolean\n clearValueWhenEmpty?: boolean\n virtualized?: boolean\n rowHeight?: number\n returnItemsOnEmpty?: boolean\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof combobox>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends ComboboxItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\nfunction CustomInnerItem<Item extends ComboboxItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useComboboxItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\nexport const Combobox = <T extends ComboboxItem>({\n items: itemsFromUsers = [],\n initialItems,\n debounceMs = 0,\n placeholder,\n emptyLabel,\n loadingLabel,\n usePortal = true,\n withAutoFilter = true,\n positioning,\n loadItems,\n renderItem,\n onResetInitialItems,\n isLoading: controlledIsLoading,\n value,\n openDropdownOnFocus = true,\n clearValueWhenEmpty = true,\n virtualized,\n rowHeight = 34,\n returnItemsOnEmpty,\n ...props\n}: ComboboxProps<T>) => {\n const [items, setItems] = useState(() => itemsFromUsers)\n const [isLoading, setIsLoading] = useState(false)\n const [firstQueryTriggered, setFirstQueryTriggered] = useState(false)\n const asyncMode = typeof loadItems === 'function'\n\n const debouncedLoadItems = useMemo(\n () =>\n loadItems\n ? debounce(async (value: string) => {\n try {\n setFirstQueryTriggered(true)\n setIsLoading(true)\n const newItems = await loadItems(value)\n setItems(newItems)\n } catch (error) {\n console.error(error)\n setItems([])\n } finally {\n setIsLoading(false)\n }\n }, debounceMs)\n : null,\n [loadItems, debounceMs],\n )\n\n const allItems = [...items, ...(initialItems ?? [])]\n\n const handleInputChange = useCallback(\n async (details: ArkCombobox.InputValueChangeDetails) => {\n if (\n initialItems &&\n initialItems.length > 0 &&\n !initialItems.find((item: ComboboxItem) => item.label === details.inputValue)\n ) {\n onResetInitialItems?.()\n }\n const { inputValue } = details\n\n if (debouncedLoadItems) {\n debouncedLoadItems(inputValue)\n } else {\n const items =\n withAutoFilter && inputValue !== ''\n ? itemsFromUsers.filter((item: ComboboxItem) => item.label.toLowerCase().includes(inputValue.toLowerCase()))\n : itemsFromUsers\n\n if (items.length === 0 && returnItemsOnEmpty) {\n return setItems(itemsFromUsers)\n }\n setItems(items)\n }\n },\n [debouncedLoadItems, itemsFromUsers, withAutoFilter],\n )\n\n useEffect(() => {\n if (!withAutoFilter && !debouncedLoadItems) {\n setItems(itemsFromUsers)\n }\n }, [itemsFromUsers, withAutoFilter, debouncedLoadItems])\n\n const collection = useMemo(() => createListCollection({ items: allItems }), [allItems])\n\n const effectiveIsLoading = controlledIsLoading ?? isLoading\n\n const loadingContent = loadingLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n Chargement...\n </Text>\n )\n const emptyContent = emptyLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n Aucun résultat\n </Text>\n )\n // TODO: const multiple = props.multiple\n // TODO: multiple design, using input chips https://ark-ui.com/reat/examples/combobox-with-tags-input\n const multiple = false\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"combobox\"\n onInputValueChange={handleInputChange}\n value={value as string[] | undefined}\n {...props}\n // TODO: multiple design\n multiple={multiple}\n >\n <Control>\n <ArkCombobox.Context>\n {api => (\n <Input\n asChild\n placeholder={placeholder}\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\n )}\n </ArkCombobox.Context>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} onClick={onResetInitialItems} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal>{children}</Portal>}>\n <Positioner>\n <Content>\n {effectiveIsLoading ? (\n loadingContent\n ) : allItems.length === 0 ? (\n <>{asyncMode ? (firstQueryTriggered ? emptyContent : loadingContent) : emptyContent}</>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * allItems.length, 180)}\n itemCount={allItems.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={allItems[index].value}\n when={!!allItems[index].tooltip}\n wrapper={children => <Tooltip label={allItems[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={allItems[index].value} item={allItems[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={allItems[index]} isMultiple={multiple} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n allItems.map(item => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={multiple} />\n </Item>\n </ConditionalWrapper>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n </Root>\n )\n}\n"],"mappings":"ocAsBA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,QAAQ,EAG3D,EAAO,GAAA,EAAA,EAAA,QAAoB,EAAA,SAAY,IAAS,EAAG,OAAQ,CAC/D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,YAAY,EAAG,cAAc,EAC3E,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,OAAO,EAAG,SAAS,EAC5D,EAAQ,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,KAAK,EAAG,OAAO,EACtD,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,OAAO,EAAG,SAAS,EAC5D,EAAO,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,IAAI,EAAG,MAAM,EACnD,EAAW,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,QAAQ,EAAG,UAAU,EAC/D,EAAa,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,UAAU,EAAG,YAAY,EACrE,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,OAAO,EAAG,SAAS,EA+B5D,OACJ,EAAA,EAAA,MAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,sCAAlE,EACE,EAAA,EAAA,KAAC,OAAD,CAAM,EAAE,MAAM,EAAE,IAAI,MAAM,KAAK,OAAO,KAAK,GAAG,MAAM,KAAK,OAAS,CAAA,GAClE,EAAA,EAAA,KAAC,OAAD,CAAM,EAAE,MAAM,EAAE,IAAI,MAAM,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ox as ArkCombobox,\n type ComboboxRootProps,\n createListCollection,\n Portal,\n useComboboxItemContext,\n} from '@ark-ui/react'\nimport { FC, ReactNode, useCallback, useEffect, useMemo, useState } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { debounce } from 'lodash'\n\nimport { combobox } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { Input as UIInput } from '~/components/input'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { Chip, ChipClearTrigger, ChipLabel } from '~/components/chip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(combobox)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkCombobox.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkCombobox.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkCombobox.Content), 'content')\nconst Input = withContext(styled(ArkCombobox.Input), 'input')\nconst Control = withContext(styled(ArkCombobox.Control), 'control')\nconst Item = withContext(styled(ArkCombobox.Item), 'item')\nconst ItemText = withContext(styled(ArkCombobox.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkCombobox.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkCombobox.Trigger), 'trigger')\n\nexport type ComboboxItem = {\n value: string | number\n label: string\n disabled?: boolean\n tooltip?: ReactNode\n}\n\nexport type ComboboxProps<T extends ComboboxItem> = Omit<ComboboxRootProps<T>, 'collection' | 'value'> & {\n value?: Array<string | number>\n items?: T[]\n initialItems?: T[]\n renderItem?: (item: T) => ReactNode\n /**\n * Renders the inner content of each selected chip in `multiple` mode.\n * Receives the selected item and should return the chip body (the removable\n * clear button is appended automatically). Defaults to the item label.\n */\n renderValue?: (item: T) => ReactNode\n loadItems?: (inputValue: string) => Promise<T[]>\n debounceMs?: number\n emptyLabel?: ReactNode\n loadingLabel?: ReactNode\n placeholder?: string\n usePortal?: boolean\n isLoading?: boolean\n withAutoFilter?: boolean\n onResetInitialItems?: () => void\n openDropdownOnFocus?: boolean\n clearValueWhenEmpty?: boolean\n virtualized?: boolean\n rowHeight?: number\n returnItemsOnEmpty?: boolean\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof combobox>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends ComboboxItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\nfunction CustomInnerItem<Item extends ComboboxItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useComboboxItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\nexport const Combobox = <T extends ComboboxItem>({\n items: itemsFromUsers = [],\n initialItems,\n debounceMs = 0,\n placeholder,\n emptyLabel,\n loadingLabel,\n usePortal = true,\n withAutoFilter = true,\n positioning,\n loadItems,\n renderItem,\n renderValue,\n onResetInitialItems,\n isLoading: controlledIsLoading,\n value,\n openDropdownOnFocus = true,\n clearValueWhenEmpty = true,\n virtualized,\n rowHeight = 34,\n returnItemsOnEmpty,\n multiple = false,\n ...props\n}: ComboboxProps<T>) => {\n const [items, setItems] = useState(() => itemsFromUsers)\n const [isLoading, setIsLoading] = useState(false)\n const [firstQueryTriggered, setFirstQueryTriggered] = useState(false)\n const asyncMode = typeof loadItems === 'function'\n\n const debouncedLoadItems = useMemo(\n () =>\n loadItems\n ? debounce(async (value: string) => {\n try {\n setFirstQueryTriggered(true)\n setIsLoading(true)\n const newItems = await loadItems(value)\n setItems(newItems)\n } catch (error) {\n console.error(error)\n setItems([])\n } finally {\n setIsLoading(false)\n }\n }, debounceMs)\n : null,\n [loadItems, debounceMs],\n )\n\n const allItems = [...items, ...(initialItems ?? [])]\n\n const handleInputChange = useCallback(\n async (details: ArkCombobox.InputValueChangeDetails) => {\n if (\n initialItems &&\n initialItems.length > 0 &&\n !initialItems.find((item: ComboboxItem) => item.label === details.inputValue)\n ) {\n onResetInitialItems?.()\n }\n const { inputValue } = details\n\n if (debouncedLoadItems) {\n debouncedLoadItems(inputValue)\n } else {\n const items =\n withAutoFilter && inputValue !== ''\n ? itemsFromUsers.filter((item: ComboboxItem) => item.label.toLowerCase().includes(inputValue.toLowerCase()))\n : itemsFromUsers\n\n if (items.length === 0 && returnItemsOnEmpty) {\n return setItems(itemsFromUsers)\n }\n setItems(items)\n }\n },\n [debouncedLoadItems, itemsFromUsers, withAutoFilter],\n )\n\n useEffect(() => {\n if (!withAutoFilter && !debouncedLoadItems) {\n setItems(itemsFromUsers)\n }\n }, [itemsFromUsers, withAutoFilter, debouncedLoadItems])\n\n const collection = useMemo(() => createListCollection({ items: allItems }), [allItems])\n\n const effectiveIsLoading = controlledIsLoading ?? isLoading\n\n const loadingContent = loadingLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n Chargement...\n </Text>\n )\n const emptyContent = emptyLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n Aucun résultat\n </Text>\n )\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"combobox\"\n onInputValueChange={handleInputChange}\n value={value as string[] | undefined}\n {...props}\n multiple={multiple}\n >\n {multiple ? (\n // Tags-input layout: the control is the bordered box, holding the\n // selected chips and a borderless growing input, with a flat bottom\n // while open so the dropdown attaches seamlessly.\n <ArkCombobox.Context>\n {api => (\n <Control\n css={{\n display: 'flex',\n alignItems: 'center',\n gap: 'space-4',\n minHeight: '40px',\n paddingBlock: 'space-4',\n paddingLeft: 'space-8',\n paddingRight: 'space-48',\n border: '1px solid {colors.grey.100}',\n borderRadius: 'radius-8',\n cursor: 'text',\n transitionProperty: 'border-color',\n transitionDuration: 'normal',\n _focusWithin: { borderColor: 'primary.500' },\n ...(api.open\n ? {\n borderColor: 'primary.500',\n borderBottomColor: 'grey.100',\n borderBottomLeftRadius: 'radius-0',\n borderBottomRightRadius: 'radius-0',\n }\n : {}),\n _disabled: { cursor: 'not-allowed', background: 'grey.50' },\n }}\n >\n <div\n className={css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n gap: 'space-4',\n flex: '1',\n minWidth: '0',\n })}\n >\n {(api.selectedItems as T[]).map(item => (\n <Chip key={item.value} size=\"sm\">\n {renderValue ? renderValue(item) : <ChipLabel>{item.label}</ChipLabel>}\n {!props.readOnly && !props.disabled && (\n <ChipClearTrigger\n aria-label={`Retirer ${item.label}`}\n // Remove by strict-equality-safe filter: stored values may\n // be numbers while item.value is compared as a string.\n onClick={() => api.setValue(api.value.filter(v => String(v) !== String(item.value)))}\n />\n )}\n </Chip>\n ))}\n <ArkCombobox.Input\n asChild\n placeholder={api.hasSelectedItems ? undefined : placeholder}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput\n css={{\n border: 'none',\n minHeight: 'auto',\n height: 'auto',\n width: 'auto',\n flex: '1 1 90px',\n minWidth: '90px',\n paddingBlock: 'space-2',\n paddingInline: 'space-0',\n background: 'transparent',\n _hover: { borderColor: 'transparent' },\n _focus: { borderColor: 'transparent' },\n }}\n />\n </ArkCombobox.Input>\n </div>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n </Control>\n )}\n </ArkCombobox.Context>\n ) : (\n <Control>\n <ArkCombobox.Context>\n {api => (\n <Input\n asChild\n placeholder={placeholder}\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\n )}\n </ArkCombobox.Context>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} onClick={onResetInitialItems} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n )}\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal>{children}</Portal>}>\n <Positioner>\n <Content>\n {effectiveIsLoading ? (\n loadingContent\n ) : allItems.length === 0 ? (\n <>{asyncMode ? (firstQueryTriggered ? emptyContent : loadingContent) : emptyContent}</>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * allItems.length, 180)}\n itemCount={allItems.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={allItems[index].value}\n when={!!allItems[index].tooltip}\n wrapper={children => <Tooltip label={allItems[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={allItems[index].value} item={allItems[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={allItems[index]} isMultiple={multiple} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n allItems.map(item => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={multiple} />\n </Item>\n </ConditionalWrapper>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n </Root>\n )\n}\n"],"mappings":"keAuBA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,QAAQ,EAG3D,EAAO,GAAA,EAAA,EAAA,QAAoB,EAAA,SAAY,IAAS,EAAG,OAAQ,CAC/D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,YAAY,EAAG,cAAc,EAC3E,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,OAAO,EAAG,SAAS,EAC5D,EAAQ,GAAA,EAAA,EAAA,QAAmB,EAAA,SAAY,KAAK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,SAAA,CAAA,SAAG,EAAa,EAAsB,EAAe,EAAkB,CAAe,CAAA,EACpF,IACF,EAAA,EAAA,KAAA,EAAA,SAAA,CAAA,UACE,EAAA,EAAA,KAAC,EAAA,cAAD,CACE,OAAQ,KAAK,IAAI,EAAY,EAAS,OAAQ,GAAG,EACjD,UAAW,EAAS,OACpB,SAAU,EACV,MAAM,iBAEJ,CAAE,QAAO,YACT,EAAA,EAAA,KAAC,EAAA,mBAAD,CAEE,KAAM,CAAC,CAAC,EAAS,GAAO,QACxB,QAAS,IAAY,EAAA,EAAA,KAAC,EAAA,QAAD,CAAS,MAAO,EAAS,GAAO,QAAU,UAAkB,CAAA,YAEjF,EAAA,EAAA,KAAC,EAAD,CAAkC,KAAM,EAAS,GAAe,kBAC9D,EAAA,EAAA,KAAC,EAAD,CAA6B,aAAY,KAAM,EAAS,GAAQ,WAAY,CAAW,CAAA,CACnF,EAFK,EAAS,GAAO,KAErB,CACY,EAPb,EAAS,GAAO,KAOH,CAET,CAAA,CACf,CAAA,EAEF,EAAS,IAAI,IACX,EAAA,EAAA,KAAC,EAAA,mBAAD,CAEE,KAAM,CAAC,CAAC,EAAK,QACb,QAAS,IAAY,EAAA,EAAA,KAAC,EAAA,QAAD,CAAS,MAAO,EAAK,QAAU,UAAkB,CAAA,YAEtE,EAAA,EAAA,KAAC,EAAD,CAA6B,iBAC3B,EAAA,EAAA,KAAC,EAAD,CAA6B,aAAkB,OAAM,WAAY,CAAW,CAAA,CACxE,EAFK,EAAK,KAEV,CACY,EAPb,EAAK,KAOQ,CACrB,CAEI,CAAA,CACC,CAAA,CACM,CAAA,CAChB,GAEV"}
@@ -13,6 +13,12 @@ export type ComboboxProps<T extends ComboboxItem> = Omit<ComboboxRootProps<T>, '
13
13
  items?: T[];
14
14
  initialItems?: T[];
15
15
  renderItem?: (item: T) => ReactNode;
16
+ /**
17
+ * Renders the inner content of each selected chip in `multiple` mode.
18
+ * Receives the selected item and should return the chip body (the removable
19
+ * clear button is appended automatically). Defaults to the item label.
20
+ */
21
+ renderValue?: (item: T) => ReactNode;
16
22
  loadItems?: (inputValue: string) => Promise<T[]>;
17
23
  debounceMs?: number;
18
24
  emptyLabel?: ReactNode;
@@ -28,4 +34,4 @@ export type ComboboxProps<T extends ComboboxItem> = Omit<ComboboxRootProps<T>, '
28
34
  rowHeight?: number;
29
35
  returnItemsOnEmpty?: boolean;
30
36
  } & HTMLStyledProps<'div'> & RecipeVariantProps<typeof combobox>;
31
- export declare const Combobox: <T extends ComboboxItem>({ items: itemsFromUsers, initialItems, debounceMs, placeholder, emptyLabel, loadingLabel, usePortal, withAutoFilter, positioning, loadItems, renderItem, onResetInitialItems, isLoading: controlledIsLoading, value, openDropdownOnFocus, clearValueWhenEmpty, virtualized, rowHeight, returnItemsOnEmpty, ...props }: ComboboxProps<T>) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const Combobox: <T extends ComboboxItem>({ items: itemsFromUsers, initialItems, debounceMs, placeholder, emptyLabel, loadingLabel, usePortal, withAutoFilter, positioning, loadItems, renderItem, renderValue, onResetInitialItems, isLoading: controlledIsLoading, value, openDropdownOnFocus, clearValueWhenEmpty, virtualized, rowHeight, returnItemsOnEmpty, multiple, ...props }: ComboboxProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -3,139 +3,218 @@ import { createStyleContext as e } from "../../utils/slots.js";
3
3
  import { Tooltip as t } from "../tooltip/Tooltip.js";
4
4
  import { Text as n } from "../text/Text.js";
5
5
  import { ConditionalWrapper as r } from "../../shared/ConditionalWrapper.js";
6
- import { Input as ee } from "../input/Input.js";
7
- import { Combobox as i, Portal as a, createListCollection as o, useComboboxItemContext as s } from "@ark-ui/react";
8
- import { styled as c } from "@stokelp/styled-system/jsx";
9
- import { combobox as l } from "@stokelp/styled-system/recipes";
10
- import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
11
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
12
- import { css as _ } from "@stokelp/styled-system/css";
13
- import { FixedSizeList as v } from "react-window";
6
+ import { Input as i } from "../input/Input.js";
7
+ import { Chip as ee, ChipClearTrigger as a, ChipLabel as te } from "../chip/Chip.js";
8
+ import { Combobox as o, Portal as s, createListCollection as c, useComboboxItemContext as l } from "@ark-ui/react";
9
+ import { styled as u } from "@stokelp/styled-system/jsx";
10
+ import { combobox as d } from "@stokelp/styled-system/recipes";
11
+ import { useCallback as ne, useEffect as f, useMemo as p, useState as m } from "react";
12
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
13
+ import { css as v } from "@stokelp/styled-system/css";
14
+ import { FixedSizeList as re } from "react-window";
14
15
  import { debounce as y } from "lodash";
15
16
  //#region src/components/combobox/Combobox.tsx
16
- var { withProvider: b, withContext: x } = e(l), S = b(c(i.Root), "root", { defaultProps: { loopFocus: !0 } }), te = x(c(i.ClearTrigger), "clearTrigger"), C = x(c(i.Content), "content"), w = x(c(i.Input), "input"), T = x(c(i.Control), "control"), E = x(c(i.Item), "item"), D = x(c(i.ItemText), "itemText"), O = x(c(i.Positioner), "positioner"), k = x(c(i.Trigger), "trigger"), A = () => /* @__PURE__ */ g("svg", {
17
+ var { withProvider: b, withContext: x } = e(d), ie = b(u(o.Root), "root", { defaultProps: { loopFocus: !0 } }), ae = x(u(o.ClearTrigger), "clearTrigger"), S = x(u(o.Content), "content"), C = x(u(o.Input), "input"), w = x(u(o.Control), "control"), T = x(u(o.Item), "item"), E = x(u(o.ItemText), "itemText"), D = x(u(o.Positioner), "positioner"), O = x(u(o.Trigger), "trigger"), k = () => /* @__PURE__ */ _("svg", {
17
18
  width: "16",
18
19
  height: "17",
19
20
  viewBox: "0 0 16 17",
20
21
  fill: "none",
21
22
  xmlns: "http://www.w3.org/2000/svg",
22
- children: [/* @__PURE__ */ h("rect", {
23
+ children: [/* @__PURE__ */ g("rect", {
23
24
  x: "0.5",
24
25
  y: "1",
25
26
  width: "15",
26
27
  height: "15",
27
28
  rx: "3.5",
28
29
  fill: "white"
29
- }), /* @__PURE__ */ h("rect", {
30
+ }), /* @__PURE__ */ g("rect", {
30
31
  x: "0.5",
31
32
  y: "1",
32
33
  width: "15",
33
34
  height: "15",
34
35
  rx: "3.5",
35
- className: _({ stroke: "grey.100" })
36
+ className: v({ stroke: "grey.100" })
36
37
  })]
37
- }), j = () => /* @__PURE__ */ g("svg", {
38
+ }), A = () => /* @__PURE__ */ _("svg", {
38
39
  width: "16",
39
40
  height: "17",
40
41
  viewBox: "0 0 16 17",
41
42
  fill: "none",
42
43
  xmlns: "http://www.w3.org/2000/svg",
43
- children: [/* @__PURE__ */ h("rect", {
44
+ children: [/* @__PURE__ */ g("rect", {
44
45
  y: "0.5",
45
46
  width: "16",
46
47
  height: "16",
47
48
  rx: "4",
48
- className: _({ fill: "primary.500" })
49
- }), /* @__PURE__ */ h("path", {
49
+ className: v({ fill: "primary.500" })
50
+ }), /* @__PURE__ */ g("path", {
50
51
  fillRule: "evenodd",
51
52
  clipRule: "evenodd",
52
53
  d: "M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z",
53
54
  fill: "white"
54
55
  })]
55
56
  });
56
- function M({ item: e, isMultiple: t, renderItem: n }) {
57
- let r = s();
58
- return /* @__PURE__ */ g(m, { children: [t ? r.selected ? /* @__PURE__ */ h(j, {}) : /* @__PURE__ */ h(A, {}) : null, n ? n(e) : /* @__PURE__ */ h(D, {
57
+ function j({ item: e, isMultiple: t, renderItem: n }) {
58
+ let r = l();
59
+ return /* @__PURE__ */ _(h, { children: [t ? r.selected ? /* @__PURE__ */ g(A, {}) : /* @__PURE__ */ g(k, {}) : null, n ? n(e) : /* @__PURE__ */ g(E, {
59
60
  truncate: !0,
60
61
  children: e.label
61
62
  })] });
62
63
  }
63
- var N = ({ items: e = [], initialItems: s, debounceMs: c = 0, placeholder: l, emptyLabel: _, loadingLabel: b, usePortal: x = !0, withAutoFilter: D = !0, positioning: A, loadItems: j, renderItem: N, onResetInitialItems: P, isLoading: F, value: I, openDropdownOnFocus: L = !0, clearValueWhenEmpty: R = !0, virtualized: z, rowHeight: B = 34, returnItemsOnEmpty: V, ...H }) => {
64
- let [U, W] = p(() => e), [G, K] = p(!1), [q, J] = p(!1), Y = typeof j == "function", X = f(() => j ? y(async (e) => {
64
+ var M = ({ items: e = [], initialItems: l, debounceMs: u = 0, placeholder: d, emptyLabel: b, loadingLabel: x, usePortal: E = !0, withAutoFilter: k = !0, positioning: A, loadItems: M, renderItem: N, renderValue: P, onResetInitialItems: F, isLoading: I, value: L, openDropdownOnFocus: R = !0, clearValueWhenEmpty: z = !0, virtualized: B, rowHeight: V = 34, returnItemsOnEmpty: H, multiple: U = !1, ...W }) => {
65
+ let [G, K] = m(() => e), [q, J] = m(!1), [oe, se] = m(!1), Y = typeof M == "function", X = p(() => M ? y(async (e) => {
65
66
  try {
66
- J(!0), K(!0), W(await j(e));
67
+ se(!0), J(!0), K(await M(e));
67
68
  } catch (e) {
68
- console.error(e), W([]);
69
+ console.error(e), K([]);
69
70
  } finally {
70
- K(!1);
71
+ J(!1);
71
72
  }
72
- }, c) : null, [j, c]), Z = [...U, ...s ?? []], ne = u(async (t) => {
73
- s && s.length > 0 && !s.find((e) => e.label === t.inputValue) && P?.();
73
+ }, u) : null, [M, u]), Z = [...G, ...l ?? []], ce = ne(async (t) => {
74
+ l && l.length > 0 && !l.find((e) => e.label === t.inputValue) && F?.();
74
75
  let { inputValue: n } = t;
75
76
  if (X) X(n);
76
77
  else {
77
- let t = D && n !== "" ? e.filter((e) => e.label.toLowerCase().includes(n.toLowerCase())) : e;
78
- if (t.length === 0 && V) return W(e);
79
- W(t);
78
+ let t = k && n !== "" ? e.filter((e) => e.label.toLowerCase().includes(n.toLowerCase())) : e;
79
+ if (t.length === 0 && H) return K(e);
80
+ K(t);
80
81
  }
81
82
  }, [
82
83
  X,
83
84
  e,
84
- D
85
+ k
85
86
  ]);
86
- d(() => {
87
- !D && !X && W(e);
87
+ f(() => {
88
+ !k && !X && K(e);
88
89
  }, [
89
90
  e,
90
- D,
91
+ k,
91
92
  X
92
93
  ]);
93
- let re = f(() => o({ items: Z }), [Z]), ie = F ?? G, Q = b ?? /* @__PURE__ */ h(n, {
94
+ let le = p(() => c({ items: Z }), [Z]), ue = I ?? q, Q = x ?? /* @__PURE__ */ g(n, {
94
95
  p: "space-8",
95
96
  textAlign: "center",
96
97
  children: "Chargement..."
97
- }), $ = _ ?? /* @__PURE__ */ h(n, {
98
+ }), $ = b ?? /* @__PURE__ */ g(n, {
98
99
  p: "space-8",
99
100
  textAlign: "center",
100
101
  children: "Aucun résultat"
101
102
  });
102
- return /* @__PURE__ */ g(S, {
103
+ return /* @__PURE__ */ _(ie, {
103
104
  lazyMount: !0,
104
105
  unmountOnExit: !0,
105
- collection: re,
106
+ collection: le,
106
107
  positioning: {
107
108
  sameWidth: !0,
108
109
  gutter: 0,
109
110
  ...A
110
111
  },
111
112
  "data-recipe": "combobox",
112
- onInputValueChange: ne,
113
- value: I,
114
- ...H,
115
- multiple: !1,
116
- children: [/* @__PURE__ */ g(T, { children: [
117
- /* @__PURE__ */ h(i.Context, { children: (e) => /* @__PURE__ */ h(w, {
113
+ onInputValueChange: ce,
114
+ value: L,
115
+ ...W,
116
+ multiple: U,
117
+ children: [U ? /* @__PURE__ */ g(o.Context, { children: (e) => /* @__PURE__ */ _(w, {
118
+ css: {
119
+ display: "flex",
120
+ alignItems: "center",
121
+ gap: "space-4",
122
+ minHeight: "40px",
123
+ paddingBlock: "space-4",
124
+ paddingLeft: "space-8",
125
+ paddingRight: "space-48",
126
+ border: "1px solid {colors.grey.100}",
127
+ borderRadius: "radius-8",
128
+ cursor: "text",
129
+ transitionProperty: "border-color",
130
+ transitionDuration: "normal",
131
+ _focusWithin: { borderColor: "primary.500" },
132
+ ...e.open ? {
133
+ borderColor: "primary.500",
134
+ borderBottomColor: "grey.100",
135
+ borderBottomLeftRadius: "radius-0",
136
+ borderBottomRightRadius: "radius-0"
137
+ } : {},
138
+ _disabled: {
139
+ cursor: "not-allowed",
140
+ background: "grey.50"
141
+ }
142
+ },
143
+ children: [/* @__PURE__ */ _("div", {
144
+ className: v({
145
+ display: "flex",
146
+ flexWrap: "wrap",
147
+ alignItems: "center",
148
+ gap: "space-4",
149
+ flex: "1",
150
+ minWidth: "0"
151
+ }),
152
+ children: [e.selectedItems.map((t) => /* @__PURE__ */ _(ee, {
153
+ size: "sm",
154
+ children: [P ? P(t) : /* @__PURE__ */ g(te, { children: t.label }), !W.readOnly && !W.disabled && /* @__PURE__ */ g(a, {
155
+ "aria-label": `Retirer ${t.label}`,
156
+ onClick: () => e.setValue(e.value.filter((e) => String(e) !== String(t.value)))
157
+ })]
158
+ }, t.value)), /* @__PURE__ */ g(o.Input, {
159
+ asChild: !0,
160
+ placeholder: e.hasSelectedItems ? void 0 : d,
161
+ onFocus: () => {
162
+ !R || Y || e.setOpen(!0);
163
+ },
164
+ children: /* @__PURE__ */ g(i, { css: {
165
+ border: "none",
166
+ minHeight: "auto",
167
+ height: "auto",
168
+ width: "auto",
169
+ flex: "1 1 90px",
170
+ minWidth: "90px",
171
+ paddingBlock: "space-2",
172
+ paddingInline: "space-0",
173
+ background: "transparent",
174
+ _hover: { borderColor: "transparent" },
175
+ _focus: { borderColor: "transparent" }
176
+ } })
177
+ })]
178
+ }), /* @__PURE__ */ g(O, {
179
+ asChild: !0,
180
+ hidden: Y && (!l || l.length === 0),
181
+ children: /* @__PURE__ */ g("svg", {
182
+ width: "24",
183
+ height: "24",
184
+ viewBox: "0 0 24 24",
185
+ fill: "none",
186
+ xmlns: "http://www.w3.org/2000/svg",
187
+ children: /* @__PURE__ */ g("path", {
188
+ fillRule: "evenodd",
189
+ clipRule: "evenodd",
190
+ d: "M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z",
191
+ fill: "currentColor"
192
+ })
193
+ })
194
+ })]
195
+ }) }) : /* @__PURE__ */ _(w, { children: [
196
+ /* @__PURE__ */ g(o.Context, { children: (e) => /* @__PURE__ */ g(C, {
118
197
  asChild: !0,
119
- placeholder: l,
198
+ placeholder: d,
120
199
  onInput: (t) => {
121
200
  let n = t.currentTarget.value;
122
- R && n === "" && e.clearValue();
201
+ z && n === "" && e.clearValue();
123
202
  },
124
203
  onFocus: () => {
125
- !L || Y || e.setOpen(!0);
204
+ !R || Y || e.setOpen(!0);
126
205
  },
127
- children: /* @__PURE__ */ h(ee, {})
206
+ children: /* @__PURE__ */ g(i, {})
128
207
  }) }),
129
- /* @__PURE__ */ h(k, {
208
+ /* @__PURE__ */ g(O, {
130
209
  asChild: !0,
131
- hidden: Y && (!s || s.length === 0),
132
- children: /* @__PURE__ */ h("svg", {
210
+ hidden: Y && (!l || l.length === 0),
211
+ children: /* @__PURE__ */ g("svg", {
133
212
  width: "24",
134
213
  height: "24",
135
214
  viewBox: "0 0 24 24",
136
215
  fill: "none",
137
216
  xmlns: "http://www.w3.org/2000/svg",
138
- children: /* @__PURE__ */ h("path", {
217
+ children: /* @__PURE__ */ g("path", {
139
218
  fillRule: "evenodd",
140
219
  clipRule: "evenodd",
141
220
  d: "M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z",
@@ -143,17 +222,17 @@ var N = ({ items: e = [], initialItems: s, debounceMs: c = 0, placeholder: l, em
143
222
  })
144
223
  })
145
224
  }),
146
- /* @__PURE__ */ h(te, {
147
- disabled: H.readOnly,
148
- onClick: P,
225
+ /* @__PURE__ */ g(ae, {
226
+ disabled: W.readOnly,
227
+ onClick: F,
149
228
  asChild: !0,
150
- children: /* @__PURE__ */ h("button", { children: /* @__PURE__ */ h("svg", {
229
+ children: /* @__PURE__ */ g("button", { children: /* @__PURE__ */ g("svg", {
151
230
  width: "20",
152
231
  height: "20",
153
232
  viewBox: "0 0 20 20",
154
233
  fill: "none",
155
234
  xmlns: "http://www.w3.org/2000/svg",
156
- children: /* @__PURE__ */ h("path", {
235
+ children: /* @__PURE__ */ g("path", {
157
236
  fillRule: "evenodd",
158
237
  clipRule: "evenodd",
159
238
  d: "M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z",
@@ -161,42 +240,42 @@ var N = ({ items: e = [], initialItems: s, debounceMs: c = 0, placeholder: l, em
161
240
  })
162
241
  }) })
163
242
  })
164
- ] }), /* @__PURE__ */ h(r, {
165
- when: x,
166
- wrapper: (e) => /* @__PURE__ */ h(a, { children: e }),
167
- children: /* @__PURE__ */ h(O, { children: /* @__PURE__ */ h(C, { children: ie ? Q : Z.length === 0 ? /* @__PURE__ */ h(m, { children: Y ? q ? $ : Q : $ }) : z ? /* @__PURE__ */ h(m, { children: /* @__PURE__ */ h(v, {
168
- height: Math.min(B * Z.length, 180),
243
+ ] }), /* @__PURE__ */ g(r, {
244
+ when: E,
245
+ wrapper: (e) => /* @__PURE__ */ g(s, { children: e }),
246
+ children: /* @__PURE__ */ g(D, { children: /* @__PURE__ */ g(S, { children: ue ? Q : Z.length === 0 ? /* @__PURE__ */ g(h, { children: Y ? oe ? $ : Q : $ }) : B ? /* @__PURE__ */ g(h, { children: /* @__PURE__ */ g(re, {
247
+ height: Math.min(V * Z.length, 180),
169
248
  itemCount: Z.length,
170
- itemSize: B,
249
+ itemSize: V,
171
250
  width: "100%",
172
- children: ({ index: e, style: n }) => /* @__PURE__ */ h(r, {
251
+ children: ({ index: e, style: n }) => /* @__PURE__ */ g(r, {
173
252
  when: !!Z[e].tooltip,
174
- wrapper: (n) => /* @__PURE__ */ h(t, {
253
+ wrapper: (n) => /* @__PURE__ */ g(t, {
175
254
  label: Z[e].tooltip,
176
255
  children: n
177
256
  }),
178
- children: /* @__PURE__ */ h(E, {
257
+ children: /* @__PURE__ */ g(T, {
179
258
  item: Z[e],
180
259
  style: n,
181
- children: /* @__PURE__ */ h(M, {
260
+ children: /* @__PURE__ */ g(j, {
182
261
  renderItem: N,
183
262
  item: Z[e],
184
- isMultiple: !1
263
+ isMultiple: U
185
264
  })
186
265
  }, Z[e].value)
187
266
  }, Z[e].value)
188
- }) }) : Z.map((e) => /* @__PURE__ */ h(r, {
267
+ }) }) : Z.map((e) => /* @__PURE__ */ g(r, {
189
268
  when: !!e.tooltip,
190
- wrapper: (n) => /* @__PURE__ */ h(t, {
269
+ wrapper: (n) => /* @__PURE__ */ g(t, {
191
270
  label: e.tooltip,
192
271
  children: n
193
272
  }),
194
- children: /* @__PURE__ */ h(E, {
273
+ children: /* @__PURE__ */ g(T, {
195
274
  item: e,
196
- children: /* @__PURE__ */ h(M, {
275
+ children: /* @__PURE__ */ g(j, {
197
276
  renderItem: N,
198
277
  item: e,
199
- isMultiple: !1
278
+ isMultiple: U
200
279
  })
201
280
  }, e.value)
202
281
  }, e.value)) }) })
@@ -204,6 +283,6 @@ var N = ({ items: e = [], initialItems: s, debounceMs: c = 0, placeholder: l, em
204
283
  });
205
284
  };
206
285
  //#endregion
207
- export { N as Combobox };
286
+ export { M as Combobox };
208
287
 
209
288
  //# sourceMappingURL=Combobox.js.map