@stokelp/ui 2.117.0 → 2.117.1
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.
- package/dist/components/combobox/Combobox.cjs +1 -1
- package/dist/components/combobox/Combobox.cjs.map +1 -1
- package/dist/components/combobox/Combobox.js +108 -148
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/origin-select/OriginSelect.cjs +1 -1
- package/dist/components/origin-select/OriginSelect.cjs.map +1 -1
- package/dist/components/origin-select/OriginSelect.js +2 -10
- package/dist/components/origin-select/OriginSelect.js.map +1 -1
- package/dist/theme/recipes/combobox.cjs +1 -1
- package/dist/theme/recipes/combobox.cjs.map +1 -1
- package/dist/theme/recipes/combobox.js +37 -2
- package/dist/theme/recipes/combobox.js.map +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
|
@@ -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"),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:
|
|
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:d,emptyLabel:m,loadingLabel:h,usePortal:S=!0,withAutoFilter:T=!0,positioning:E,loadItems:O,renderItem:k,renderValue:A,onResetInitialItems:j,isLoading:M,value:N,openDropdownOnFocus:P=!0,clearValueWhenEmpty:F=!0,virtualized:ee,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 O==`function`,q=(0,l.useMemo)(()=>O?(0,p.debounce)(async e=>{try{G(!0),U(!0),V(await O(e))}catch(e){console.error(e),V([])}finally{U(!1)}},c):null,[O,c]),J=[...B,...s??[]],Y=(0,l.useCallback)(async t=>{s&&s.length>0&&!s.find(e=>e.label===t.inputValue)&&j?.();let{inputValue:n}=t;if(q)q(n);else{let t=T&&n!==``?e.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())):e;if(t.length===0&&L)return V(e);V(t)}},[q,e,T]);(0,l.useEffect)(()=>{!T&&!q&&V(e)},[e,T,q]);let X=(0,l.useMemo)(()=>(0,o.createListCollection)({items:J}),[J]),Z=M??H,Q=h??(0,u.jsx)(n.Text,{p:`space-8`,textAlign:`center`,children:`Chargement...`}),$=m??(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,...E},"data-recipe":`combobox`,onInputValueChange:Y,value:N,...z,multiple:R,children:[R?(0,u.jsx)(o.Combobox.Context,{children:e=>(0,u.jsxs)(b,{"data-multiple":`true`,"data-open":e.open||void 0,children:[e.selectedItems.map(t=>(0,u.jsxs)(a.Chip,{size:`sm`,children:[A?A(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)(y,{asChild:!0,"data-multiple":`true`,placeholder:e.hasSelectedItems?void 0:d,onFocus:()=>{!P||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.jsxs)(b,{children:[(0,u.jsx)(o.Combobox.Context,{children:e=>(0,u.jsx)(y,{asChild:!0,placeholder:d,onInput:t=>{let n=t.currentTarget.value;F&&n===``&&e.clearValue()},onFocus:()=>{!P||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:j,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:S,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:$}):ee?(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:k,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:k,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 { 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,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,EAqC5D,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,KAAK,OAAO,KAAK,GAAG,MAAM,WAAA,EAAA,EAAA,KAAe,CAAE,OAAQ,UAAW,CAAC,CAAI,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S,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"}
|
|
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 { 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 (styled via the recipe's `&[data-multiple]`\n // selectors) is the bordered box holding the selected chips and a\n // borderless growing input.\n <ArkCombobox.Context>\n {api => (\n <Control data-multiple=\"true\" data-open={api.open || undefined}>\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 <Input\n asChild\n data-multiple=\"true\"\n placeholder={api.hasSelectedItems ? undefined : placeholder}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\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,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,SA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B,aAAkB,OAAM,WAAY,CAAW,CAAA,CACxE,EAFK,EAAK,KAEV,CACY,EAPb,EAAK,KAOQ,CACrB,CAEI,CAAA,CACC,CAAA,CACM,CAAA,CAChB,GAEV"}
|
|
@@ -4,50 +4,50 @@ 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
6
|
import { Input as i } from "../input/Input.js";
|
|
7
|
-
import { Chip as ee, ChipClearTrigger as
|
|
7
|
+
import { Chip as ee, ChipClearTrigger as te, ChipLabel as a } from "../chip/Chip.js";
|
|
8
8
|
import { Combobox as o, Portal as s, createListCollection as c, useComboboxItemContext as l } from "@ark-ui/react";
|
|
9
9
|
import { styled as u } from "@stokelp/styled-system/jsx";
|
|
10
10
|
import { combobox as d } from "@stokelp/styled-system/recipes";
|
|
11
|
-
import { useCallback as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import { css as
|
|
14
|
-
import { FixedSizeList as
|
|
15
|
-
import { debounce as
|
|
11
|
+
import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
|
|
12
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import { css as y } from "@stokelp/styled-system/css";
|
|
14
|
+
import { FixedSizeList as ne } from "react-window";
|
|
15
|
+
import { debounce as re } from "lodash";
|
|
16
16
|
//#region src/components/combobox/Combobox.tsx
|
|
17
|
-
var { withProvider: b, withContext: x } = e(d), ie = b(u(o.Root), "root", { defaultProps: { loopFocus: !0 } }),
|
|
17
|
+
var { withProvider: b, withContext: x } = e(d), ie = b(u(o.Root), "root", { defaultProps: { loopFocus: !0 } }), S = x(u(o.ClearTrigger), "clearTrigger"), C = x(u(o.Content), "content"), w = x(u(o.Input), "input"), T = x(u(o.Control), "control"), E = x(u(o.Item), "item"), D = x(u(o.ItemText), "itemText"), ae = x(u(o.Positioner), "positioner"), O = x(u(o.Trigger), "trigger"), k = () => /* @__PURE__ */ v("svg", {
|
|
18
18
|
width: "16",
|
|
19
19
|
height: "17",
|
|
20
20
|
viewBox: "0 0 16 17",
|
|
21
21
|
fill: "none",
|
|
22
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ _("rect", {
|
|
24
24
|
x: "0.5",
|
|
25
25
|
y: "1",
|
|
26
26
|
width: "15",
|
|
27
27
|
height: "15",
|
|
28
28
|
rx: "3.5",
|
|
29
29
|
fill: "white"
|
|
30
|
-
}), /* @__PURE__ */
|
|
30
|
+
}), /* @__PURE__ */ _("rect", {
|
|
31
31
|
x: "0.5",
|
|
32
32
|
y: "1",
|
|
33
33
|
width: "15",
|
|
34
34
|
height: "15",
|
|
35
35
|
rx: "3.5",
|
|
36
|
-
className:
|
|
36
|
+
className: y({ stroke: "grey.100" })
|
|
37
37
|
})]
|
|
38
|
-
}), A = () => /* @__PURE__ */
|
|
38
|
+
}), A = () => /* @__PURE__ */ v("svg", {
|
|
39
39
|
width: "16",
|
|
40
40
|
height: "17",
|
|
41
41
|
viewBox: "0 0 16 17",
|
|
42
42
|
fill: "none",
|
|
43
43
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
-
children: [/* @__PURE__ */
|
|
44
|
+
children: [/* @__PURE__ */ _("rect", {
|
|
45
45
|
y: "0.5",
|
|
46
46
|
width: "16",
|
|
47
47
|
height: "16",
|
|
48
48
|
rx: "4",
|
|
49
|
-
className:
|
|
50
|
-
}), /* @__PURE__ */
|
|
49
|
+
className: y({ fill: "primary.500" })
|
|
50
|
+
}), /* @__PURE__ */ _("path", {
|
|
51
51
|
fillRule: "evenodd",
|
|
52
52
|
clipRule: "evenodd",
|
|
53
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",
|
|
@@ -56,165 +56,125 @@ var { withProvider: b, withContext: x } = e(d), ie = b(u(o.Root), "root", { defa
|
|
|
56
56
|
});
|
|
57
57
|
function j({ item: e, isMultiple: t, renderItem: n }) {
|
|
58
58
|
let r = l();
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ v(g, { children: [t ? r.selected ? /* @__PURE__ */ _(A, {}) : /* @__PURE__ */ _(k, {}) : null, n ? n(e) : /* @__PURE__ */ _(D, {
|
|
60
60
|
truncate: !0,
|
|
61
61
|
children: e.label
|
|
62
62
|
})] });
|
|
63
63
|
}
|
|
64
|
-
var M = ({ items: e = [], initialItems: l, debounceMs: u = 0, placeholder: d, emptyLabel:
|
|
65
|
-
let [
|
|
64
|
+
var M = ({ items: e = [], initialItems: l, debounceMs: u = 0, placeholder: d, emptyLabel: y, loadingLabel: b, usePortal: x = !0, withAutoFilter: D = !0, positioning: k, loadItems: A, renderItem: M, renderValue: N, onResetInitialItems: P, isLoading: F, value: I, openDropdownOnFocus: L = !0, clearValueWhenEmpty: R = !0, virtualized: z, rowHeight: B = 34, returnItemsOnEmpty: V, multiple: H = !1, ...U }) => {
|
|
65
|
+
let [W, G] = h(() => e), [K, q] = h(!1), [oe, se] = h(!1), J = typeof A == "function", Y = m(() => A ? re(async (e) => {
|
|
66
66
|
try {
|
|
67
|
-
se(!0),
|
|
67
|
+
se(!0), q(!0), G(await A(e));
|
|
68
68
|
} catch (e) {
|
|
69
|
-
console.error(e),
|
|
69
|
+
console.error(e), G([]);
|
|
70
70
|
} finally {
|
|
71
|
-
|
|
71
|
+
q(!1);
|
|
72
72
|
}
|
|
73
|
-
}, u) : null, [
|
|
74
|
-
l && l.length > 0 && !l.find((e) => e.label === t.inputValue) &&
|
|
73
|
+
}, u) : null, [A, u]), X = [...W, ...l ?? []], Z = f(async (t) => {
|
|
74
|
+
l && l.length > 0 && !l.find((e) => e.label === t.inputValue) && P?.();
|
|
75
75
|
let { inputValue: n } = t;
|
|
76
|
-
if (
|
|
76
|
+
if (Y) Y(n);
|
|
77
77
|
else {
|
|
78
|
-
let t =
|
|
79
|
-
if (t.length === 0 &&
|
|
80
|
-
|
|
78
|
+
let t = D && n !== "" ? e.filter((e) => e.label.toLowerCase().includes(n.toLowerCase())) : e;
|
|
79
|
+
if (t.length === 0 && V) return G(e);
|
|
80
|
+
G(t);
|
|
81
81
|
}
|
|
82
82
|
}, [
|
|
83
|
-
|
|
83
|
+
Y,
|
|
84
84
|
e,
|
|
85
|
-
|
|
85
|
+
D
|
|
86
86
|
]);
|
|
87
|
-
|
|
88
|
-
!
|
|
87
|
+
p(() => {
|
|
88
|
+
!D && !Y && G(e);
|
|
89
89
|
}, [
|
|
90
90
|
e,
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
D,
|
|
92
|
+
Y
|
|
93
93
|
]);
|
|
94
|
-
let
|
|
94
|
+
let ce = m(() => c({ items: X }), [X]), le = F ?? K, Q = b ?? /* @__PURE__ */ _(n, {
|
|
95
95
|
p: "space-8",
|
|
96
96
|
textAlign: "center",
|
|
97
97
|
children: "Chargement..."
|
|
98
|
-
}), $ =
|
|
98
|
+
}), $ = y ?? /* @__PURE__ */ _(n, {
|
|
99
99
|
p: "space-8",
|
|
100
100
|
textAlign: "center",
|
|
101
101
|
children: "Aucun résultat"
|
|
102
102
|
});
|
|
103
|
-
return /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ v(ie, {
|
|
104
104
|
lazyMount: !0,
|
|
105
105
|
unmountOnExit: !0,
|
|
106
|
-
collection:
|
|
106
|
+
collection: ce,
|
|
107
107
|
positioning: {
|
|
108
108
|
sameWidth: !0,
|
|
109
109
|
gutter: 0,
|
|
110
|
-
...
|
|
110
|
+
...k
|
|
111
111
|
},
|
|
112
112
|
"data-recipe": "combobox",
|
|
113
|
-
onInputValueChange:
|
|
114
|
-
value:
|
|
115
|
-
...
|
|
116
|
-
multiple:
|
|
117
|
-
children: [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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, {
|
|
113
|
+
onInputValueChange: Z,
|
|
114
|
+
value: I,
|
|
115
|
+
...U,
|
|
116
|
+
multiple: H,
|
|
117
|
+
children: [H ? /* @__PURE__ */ _(o.Context, { children: (e) => /* @__PURE__ */ v(T, {
|
|
118
|
+
"data-multiple": "true",
|
|
119
|
+
"data-open": e.open || void 0,
|
|
120
|
+
children: [
|
|
121
|
+
e.selectedItems.map((t) => /* @__PURE__ */ v(ee, {
|
|
153
122
|
size: "sm",
|
|
154
|
-
children: [
|
|
123
|
+
children: [N ? N(t) : /* @__PURE__ */ _(a, { children: t.label }), !U.readOnly && !U.disabled && /* @__PURE__ */ _(te, {
|
|
155
124
|
"aria-label": `Retirer ${t.label}`,
|
|
156
125
|
onClick: () => e.setValue(e.value.filter((e) => String(e) !== String(t.value)))
|
|
157
126
|
})]
|
|
158
|
-
}, t.value)),
|
|
127
|
+
}, t.value)),
|
|
128
|
+
/* @__PURE__ */ _(w, {
|
|
159
129
|
asChild: !0,
|
|
130
|
+
"data-multiple": "true",
|
|
160
131
|
placeholder: e.hasSelectedItems ? void 0 : d,
|
|
161
132
|
onFocus: () => {
|
|
162
|
-
!
|
|
133
|
+
!L || J || e.setOpen(!0);
|
|
163
134
|
},
|
|
164
|
-
children: /* @__PURE__ */
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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"
|
|
135
|
+
children: /* @__PURE__ */ _(i, {})
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ _(O, {
|
|
138
|
+
asChild: !0,
|
|
139
|
+
hidden: J && (!l || l.length === 0),
|
|
140
|
+
children: /* @__PURE__ */ _("svg", {
|
|
141
|
+
width: "24",
|
|
142
|
+
height: "24",
|
|
143
|
+
viewBox: "0 0 24 24",
|
|
144
|
+
fill: "none",
|
|
145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
+
children: /* @__PURE__ */ _("path", {
|
|
147
|
+
fillRule: "evenodd",
|
|
148
|
+
clipRule: "evenodd",
|
|
149
|
+
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",
|
|
150
|
+
fill: "currentColor"
|
|
151
|
+
})
|
|
192
152
|
})
|
|
193
153
|
})
|
|
194
|
-
|
|
195
|
-
}) }) : /* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */
|
|
154
|
+
]
|
|
155
|
+
}) }) : /* @__PURE__ */ v(T, { children: [
|
|
156
|
+
/* @__PURE__ */ _(o.Context, { children: (e) => /* @__PURE__ */ _(w, {
|
|
197
157
|
asChild: !0,
|
|
198
158
|
placeholder: d,
|
|
199
159
|
onInput: (t) => {
|
|
200
160
|
let n = t.currentTarget.value;
|
|
201
|
-
|
|
161
|
+
R && n === "" && e.clearValue();
|
|
202
162
|
},
|
|
203
163
|
onFocus: () => {
|
|
204
|
-
!
|
|
164
|
+
!L || J || e.setOpen(!0);
|
|
205
165
|
},
|
|
206
|
-
children: /* @__PURE__ */
|
|
166
|
+
children: /* @__PURE__ */ _(i, {})
|
|
207
167
|
}) }),
|
|
208
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ _(O, {
|
|
209
169
|
asChild: !0,
|
|
210
|
-
hidden:
|
|
211
|
-
children: /* @__PURE__ */
|
|
170
|
+
hidden: J && (!l || l.length === 0),
|
|
171
|
+
children: /* @__PURE__ */ _("svg", {
|
|
212
172
|
width: "24",
|
|
213
173
|
height: "24",
|
|
214
174
|
viewBox: "0 0 24 24",
|
|
215
175
|
fill: "none",
|
|
216
176
|
xmlns: "http://www.w3.org/2000/svg",
|
|
217
|
-
children: /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ _("path", {
|
|
218
178
|
fillRule: "evenodd",
|
|
219
179
|
clipRule: "evenodd",
|
|
220
180
|
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",
|
|
@@ -222,17 +182,17 @@ var M = ({ items: e = [], initialItems: l, debounceMs: u = 0, placeholder: d, em
|
|
|
222
182
|
})
|
|
223
183
|
})
|
|
224
184
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
disabled:
|
|
227
|
-
onClick:
|
|
185
|
+
/* @__PURE__ */ _(S, {
|
|
186
|
+
disabled: U.readOnly,
|
|
187
|
+
onClick: P,
|
|
228
188
|
asChild: !0,
|
|
229
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ _("button", { children: /* @__PURE__ */ _("svg", {
|
|
230
190
|
width: "20",
|
|
231
191
|
height: "20",
|
|
232
192
|
viewBox: "0 0 20 20",
|
|
233
193
|
fill: "none",
|
|
234
194
|
xmlns: "http://www.w3.org/2000/svg",
|
|
235
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ _("path", {
|
|
236
196
|
fillRule: "evenodd",
|
|
237
197
|
clipRule: "evenodd",
|
|
238
198
|
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",
|
|
@@ -240,42 +200,42 @@ var M = ({ items: e = [], initialItems: l, debounceMs: u = 0, placeholder: d, em
|
|
|
240
200
|
})
|
|
241
201
|
}) })
|
|
242
202
|
})
|
|
243
|
-
] }), /* @__PURE__ */
|
|
244
|
-
when:
|
|
245
|
-
wrapper: (e) => /* @__PURE__ */
|
|
246
|
-
children: /* @__PURE__ */
|
|
247
|
-
height: Math.min(
|
|
248
|
-
itemCount:
|
|
249
|
-
itemSize:
|
|
203
|
+
] }), /* @__PURE__ */ _(r, {
|
|
204
|
+
when: x,
|
|
205
|
+
wrapper: (e) => /* @__PURE__ */ _(s, { children: e }),
|
|
206
|
+
children: /* @__PURE__ */ _(ae, { children: /* @__PURE__ */ _(C, { children: le ? Q : X.length === 0 ? /* @__PURE__ */ _(g, { children: J ? oe ? $ : Q : $ }) : z ? /* @__PURE__ */ _(g, { children: /* @__PURE__ */ _(ne, {
|
|
207
|
+
height: Math.min(B * X.length, 180),
|
|
208
|
+
itemCount: X.length,
|
|
209
|
+
itemSize: B,
|
|
250
210
|
width: "100%",
|
|
251
|
-
children: ({ index: e, style: n }) => /* @__PURE__ */
|
|
252
|
-
when: !!
|
|
253
|
-
wrapper: (n) => /* @__PURE__ */
|
|
254
|
-
label:
|
|
211
|
+
children: ({ index: e, style: n }) => /* @__PURE__ */ _(r, {
|
|
212
|
+
when: !!X[e].tooltip,
|
|
213
|
+
wrapper: (n) => /* @__PURE__ */ _(t, {
|
|
214
|
+
label: X[e].tooltip,
|
|
255
215
|
children: n
|
|
256
216
|
}),
|
|
257
|
-
children: /* @__PURE__ */
|
|
258
|
-
item:
|
|
217
|
+
children: /* @__PURE__ */ _(E, {
|
|
218
|
+
item: X[e],
|
|
259
219
|
style: n,
|
|
260
|
-
children: /* @__PURE__ */
|
|
261
|
-
renderItem:
|
|
262
|
-
item:
|
|
263
|
-
isMultiple:
|
|
220
|
+
children: /* @__PURE__ */ _(j, {
|
|
221
|
+
renderItem: M,
|
|
222
|
+
item: X[e],
|
|
223
|
+
isMultiple: H
|
|
264
224
|
})
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
}) }) :
|
|
225
|
+
}, X[e].value)
|
|
226
|
+
}, X[e].value)
|
|
227
|
+
}) }) : X.map((e) => /* @__PURE__ */ _(r, {
|
|
268
228
|
when: !!e.tooltip,
|
|
269
|
-
wrapper: (n) => /* @__PURE__ */
|
|
229
|
+
wrapper: (n) => /* @__PURE__ */ _(t, {
|
|
270
230
|
label: e.tooltip,
|
|
271
231
|
children: n
|
|
272
232
|
}),
|
|
273
|
-
children: /* @__PURE__ */
|
|
233
|
+
children: /* @__PURE__ */ _(E, {
|
|
274
234
|
item: e,
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
renderItem:
|
|
235
|
+
children: /* @__PURE__ */ _(j, {
|
|
236
|
+
renderItem: M,
|
|
277
237
|
item: e,
|
|
278
|
-
isMultiple:
|
|
238
|
+
isMultiple: H
|
|
279
239
|
})
|
|
280
240
|
}, e.value)
|
|
281
241
|
}, e.value)) }) })
|