@stokelp/ui 2.117.0 → 2.117.2
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 +114 -155
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","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":";;;;;;;;;;;;;;;;AAuBA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAQ,GAG3D,KAAO,EAAa,EAAO,EAAY,IAAS,GAAG,QAAQ,EAC/D,cAAc,EACZ,WAAW,GACb,EACF,CAAC,GAEK,KAAe,EAAY,EAAO,EAAY,YAAY,GAAG,cAAc,GAC3E,IAAU,EAAY,EAAO,EAAY,OAAO,GAAG,SAAS,GAC5D,IAAQ,EAAY,EAAO,EAAY,KAAK,GAAG,OAAO,GACtD,IAAU,EAAY,EAAO,EAAY,OAAO,GAAG,SAAS,GAC5D,IAAO,EAAY,EAAO,EAAY,IAAI,GAAG,MAAM,GACnD,IAAW,EAAY,EAAO,EAAY,QAAQ,GAAG,UAAU,GAC/D,IAAa,EAAY,EAAO,EAAY,UAAU,GAAG,YAAY,GACrE,IAAU,EAAY,EAAO,EAAY,OAAO,GAAG,SAAS,GAqC5D,UACJ,kBAAC,OAAD;CAAK,OAAM;CAAK,QAAO;CAAK,SAAQ;CAAY,MAAK;CAAO,OAAM;WAAlE,CACE,kBAAC,QAAD;EAAM,GAAE;EAAM,GAAE;EAAI,OAAM;EAAK,QAAO;EAAK,IAAG;EAAM,MAAK;CAAS,CAAA,GAClE,kBAAC,QAAD;EAAM,GAAE;EAAM,GAAE;EAAI,OAAM;EAAK,QAAO;EAAK,IAAG;EAAM,WAAW,EAAI,EAAE,QAAQ,WAAW,CAAC;CAAI,CAAA,CAC1F;IAGD,UACJ,kBAAC,OAAD;CAAK,OAAM;CAAK,QAAO;CAAK,SAAQ;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,UAAU;IACV,OAAM;eAEJ,EAAE,UAAO,eACT,kBAAC,GAAD;KAEE,MAAM,CAAC,CAAC,EAAS,GAAO;KACxB,UAAS,MAAY,kBAAC,GAAD;MAAS,OAAO,EAAS,GAAO;MAAU;KAAkB,CAAA;eAEjF,kBAAC,GAAD;MAAkC,MAAM,EAAS;MAAe;gBAC9D,kBAAC,GAAD;OAA6B;OAAY,MAAM,EAAS;OAAQ,YAAY;MAAW,CAAA;KACnF,GAFK,EAAS,GAAO,KAErB;IACY,GAPb,EAAS,GAAO,KAOH;GAET,CAAA,EACf,CAAA,IAEF,EAAS,KAAI,MACX,kBAAC,GAAD;IAEE,MAAM,CAAC,CAAC,EAAK;IACb,UAAS,MAAY,kBAAC,GAAD;KAAS,OAAO,EAAK;KAAU;IAAkB,CAAA;cAEtE,kBAAC,GAAD;KAA6B;eAC3B,kBAAC,GAAD;MAA6B;MAAkB;MAAM,YAAY;KAAW,CAAA;IACxE,GAFK,EAAK,KAEV;GACY,GAPb,EAAK,KAOQ,CACrB,EAEI,CAAA,EACC,CAAA;EACM,CAAA,CAChB;;AAEV"}
|
|
1
|
+
{"version":3,"file":"Combobox.js","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 // Keep the visible items in sync with the source list whenever it changes\n // (e.g. options that load asynchronously after mount). Without this, an empty\n // input shows a stale/empty list (\"Aucun résultat\") until the user types.\n // Consumers memoize `items`, so this only fires on real data changes, not on\n // every keystroke.\n useEffect(() => {\n if (!debouncedLoadItems) {\n setItems(itemsFromUsers)\n }\n }, [itemsFromUsers, 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 {/* Resolve chips from the current value against the full source\n list rather than ark's cached `selectedItems`: the cache is only\n re-derived on value changes, so async-loaded defaults would show\n 0 chips until the user selects something. Looking up in\n itemsFromUsers (never the filtered list) also keeps chips visible\n while the user is typing to filter. */}\n {api.value.map(v => {\n const item = itemsFromUsers.find((i: T) => String(i.value) === String(v))\n if (!item) return null\n return (\n <Chip key={v} 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(x => String(x) !== String(v)))}\n />\n )}\n </Chip>\n )\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 </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
|
|
|
1
|
-
"use client";const e=require("../text/Text.cjs"),t=require("../chip/Chip.cjs"),n=require("../combobox/Combobox.cjs"),r=require("../flag/styled.cjs");let i=require("react/jsx-runtime");var a=e=>{if(!e)return;let t=e.toLowerCase();return r.FlagCountryCodes.includes(t)?t:void 0},o=o=>(0,i.jsx)(n.Combobox,{...o,renderItem:t=>{let n=a(t.countryCode);return(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(r.Flag,{countryCode:n
|
|
1
|
+
"use client";const e=require("../text/Text.cjs"),t=require("../chip/Chip.cjs"),n=require("../combobox/Combobox.cjs"),r=require("../flag/styled.cjs");let i=require("react/jsx-runtime");var a=e=>{if(!e)return;let t=e.toLowerCase();return r.FlagCountryCodes.includes(t)?t:void 0},o=o=>(0,i.jsx)(n.Combobox,{...o,renderItem:t=>{let n=a(t.countryCode);return(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(r.Flag,{countryCode:n}),(0,i.jsx)(e.Text,{truncate:!0,children:t.label})]})},renderValue:e=>{let n=a(e.countryCode);return(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(r.Flag,{countryCode:n}),(0,i.jsx)(t.ChipLabel,{children:e.label})]})}});exports.OriginSelect=o;
|
|
2
2
|
//# sourceMappingURL=OriginSelect.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OriginSelect.cjs","names":[],"sources":["../../../src/components/origin-select/OriginSelect.tsx"],"sourcesContent":["import { Combobox, type ComboboxItem, type ComboboxProps } from '~/components/combobox'\nimport { ChipLabel } from '~/components/chip'\nimport { Flag, FlagCountryCodes, type FlagCountryCode } from '~/components/flag'\nimport { Text } from '~/components/text'\n\nexport type OriginSelectItem = ComboboxItem & {\n /**\n * ISO-3166 alpha-2 country code (case-insensitive). When it maps to a known\n * flag it is rendered next to the label, both in the list and in the selected\n * chips. Origins without a country code (e.g. FAO fishing areas) render label\n * only.\n */\n countryCode?: string\n}\n\n/**\n * A searchable (optionally multiple) origin picker built on top of `Combobox`.\n * Options are countries: each row shows the flag + name, and in `multiple` mode\n * the selection is displayed as removable flag chips. Search, keyboard nav and\n * chip removal come from `Combobox` for free.\n */\nexport type OriginSelectProps = Omit<ComboboxProps<OriginSelectItem>, 'renderItem' | 'renderValue'>\n\nconst toFlagCode = (countryCode?: string): FlagCountryCode | undefined => {\n if (!countryCode) return undefined\n const code = countryCode.toLowerCase()\n return (FlagCountryCodes as string[]).includes(code) ? (code as FlagCountryCode) : undefined\n}\n\nexport const OriginSelect = (props: OriginSelectProps) => (\n <Combobox<OriginSelectItem>\n {...props}\n renderItem={(item: OriginSelectItem) => {\n const code = toFlagCode(item.countryCode)\n return (\n <>\n {code && <Flag countryCode={code}
|
|
1
|
+
{"version":3,"file":"OriginSelect.cjs","names":[],"sources":["../../../src/components/origin-select/OriginSelect.tsx"],"sourcesContent":["import { Combobox, type ComboboxItem, type ComboboxProps } from '~/components/combobox'\nimport { ChipLabel } from '~/components/chip'\nimport { Flag, FlagCountryCodes, type FlagCountryCode } from '~/components/flag'\nimport { Text } from '~/components/text'\n\nexport type OriginSelectItem = ComboboxItem & {\n /**\n * ISO-3166 alpha-2 country code (case-insensitive). When it maps to a known\n * flag it is rendered next to the label, both in the list and in the selected\n * chips. Origins without a country code (e.g. FAO fishing areas) render label\n * only.\n */\n countryCode?: string\n}\n\n/**\n * A searchable (optionally multiple) origin picker built on top of `Combobox`.\n * Options are countries: each row shows the flag + name, and in `multiple` mode\n * the selection is displayed as removable flag chips. Search, keyboard nav and\n * chip removal come from `Combobox` for free.\n */\nexport type OriginSelectProps = Omit<ComboboxProps<OriginSelectItem>, 'renderItem' | 'renderValue'>\n\nconst toFlagCode = (countryCode?: string): FlagCountryCode | undefined => {\n if (!countryCode) return undefined\n const code = countryCode.toLowerCase()\n return (FlagCountryCodes as string[]).includes(code) ? (code as FlagCountryCode) : undefined\n}\n\nexport const OriginSelect = (props: OriginSelectProps) => (\n <Combobox<OriginSelectItem>\n {...props}\n renderItem={(item: OriginSelectItem) => {\n const code = toFlagCode(item.countryCode)\n return (\n <>\n {code && <Flag countryCode={code} />}\n <Text truncate>{item.label}</Text>\n </>\n )\n }}\n renderValue={(item: OriginSelectItem) => {\n const code = toFlagCode(item.countryCode)\n return (\n <>\n {code && <Flag countryCode={code} />}\n <ChipLabel>{item.label}</ChipLabel>\n </>\n )\n }}\n />\n)\n"],"mappings":"wLAuBA,IAAM,EAAc,GAAsD,CACxE,GAAI,CAAC,EAAa,OAClB,IAAM,EAAO,EAAY,YAAY,EACrC,OAAQ,EAAA,iBAA8B,SAAS,CAAI,EAAK,EAA2B,IAAA,EACrF,EAEa,EAAgB,IAC3B,EAAA,EAAA,KAAC,EAAA,SAAD,CACE,GAAI,EACJ,WAAa,GAA2B,CACtC,IAAM,EAAO,EAAW,EAAK,WAAW,EACxC,OACE,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,CACG,IAAQ,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,YAAa,CAAO,CAAA,GACnC,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,SAAA,YAAU,EAAK,KAAY,CAAA,CACjC,CAAA,CAAA,CAEN,EACA,YAAc,GAA2B,CACvC,IAAM,EAAO,EAAW,EAAK,WAAW,EACxC,OACE,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,CACG,IAAQ,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,YAAa,CAAO,CAAA,GACnC,EAAA,EAAA,KAAC,EAAA,UAAD,CAAA,SAAY,EAAK,KAAiB,CAAA,CAClC,CAAA,CAAA,CAEN,CACD,CAAA"}
|
|
@@ -13,22 +13,14 @@ var c = (e) => {
|
|
|
13
13
|
...i,
|
|
14
14
|
renderItem: (t) => {
|
|
15
15
|
let n = c(t.countryCode);
|
|
16
|
-
return /* @__PURE__ */ s(a, { children: [n && /* @__PURE__ */ o(r, {
|
|
17
|
-
countryCode: n,
|
|
18
|
-
w: "21px",
|
|
19
|
-
h: "15px"
|
|
20
|
-
}), /* @__PURE__ */ o(e, {
|
|
16
|
+
return /* @__PURE__ */ s(a, { children: [n && /* @__PURE__ */ o(r, { countryCode: n }), /* @__PURE__ */ o(e, {
|
|
21
17
|
truncate: !0,
|
|
22
18
|
children: t.label
|
|
23
19
|
})] });
|
|
24
20
|
},
|
|
25
21
|
renderValue: (e) => {
|
|
26
22
|
let n = c(e.countryCode);
|
|
27
|
-
return /* @__PURE__ */ s(a, { children: [n && /* @__PURE__ */ o(r, {
|
|
28
|
-
countryCode: n,
|
|
29
|
-
w: "18px",
|
|
30
|
-
h: "13px"
|
|
31
|
-
}), /* @__PURE__ */ o(t, { children: e.label })] });
|
|
23
|
+
return /* @__PURE__ */ s(a, { children: [n && /* @__PURE__ */ o(r, { countryCode: n }), /* @__PURE__ */ o(t, { children: e.label })] });
|
|
32
24
|
}
|
|
33
25
|
});
|
|
34
26
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OriginSelect.js","names":[],"sources":["../../../src/components/origin-select/OriginSelect.tsx"],"sourcesContent":["import { Combobox, type ComboboxItem, type ComboboxProps } from '~/components/combobox'\nimport { ChipLabel } from '~/components/chip'\nimport { Flag, FlagCountryCodes, type FlagCountryCode } from '~/components/flag'\nimport { Text } from '~/components/text'\n\nexport type OriginSelectItem = ComboboxItem & {\n /**\n * ISO-3166 alpha-2 country code (case-insensitive). When it maps to a known\n * flag it is rendered next to the label, both in the list and in the selected\n * chips. Origins without a country code (e.g. FAO fishing areas) render label\n * only.\n */\n countryCode?: string\n}\n\n/**\n * A searchable (optionally multiple) origin picker built on top of `Combobox`.\n * Options are countries: each row shows the flag + name, and in `multiple` mode\n * the selection is displayed as removable flag chips. Search, keyboard nav and\n * chip removal come from `Combobox` for free.\n */\nexport type OriginSelectProps = Omit<ComboboxProps<OriginSelectItem>, 'renderItem' | 'renderValue'>\n\nconst toFlagCode = (countryCode?: string): FlagCountryCode | undefined => {\n if (!countryCode) return undefined\n const code = countryCode.toLowerCase()\n return (FlagCountryCodes as string[]).includes(code) ? (code as FlagCountryCode) : undefined\n}\n\nexport const OriginSelect = (props: OriginSelectProps) => (\n <Combobox<OriginSelectItem>\n {...props}\n renderItem={(item: OriginSelectItem) => {\n const code = toFlagCode(item.countryCode)\n return (\n <>\n {code && <Flag countryCode={code}
|
|
1
|
+
{"version":3,"file":"OriginSelect.js","names":[],"sources":["../../../src/components/origin-select/OriginSelect.tsx"],"sourcesContent":["import { Combobox, type ComboboxItem, type ComboboxProps } from '~/components/combobox'\nimport { ChipLabel } from '~/components/chip'\nimport { Flag, FlagCountryCodes, type FlagCountryCode } from '~/components/flag'\nimport { Text } from '~/components/text'\n\nexport type OriginSelectItem = ComboboxItem & {\n /**\n * ISO-3166 alpha-2 country code (case-insensitive). When it maps to a known\n * flag it is rendered next to the label, both in the list and in the selected\n * chips. Origins without a country code (e.g. FAO fishing areas) render label\n * only.\n */\n countryCode?: string\n}\n\n/**\n * A searchable (optionally multiple) origin picker built on top of `Combobox`.\n * Options are countries: each row shows the flag + name, and in `multiple` mode\n * the selection is displayed as removable flag chips. Search, keyboard nav and\n * chip removal come from `Combobox` for free.\n */\nexport type OriginSelectProps = Omit<ComboboxProps<OriginSelectItem>, 'renderItem' | 'renderValue'>\n\nconst toFlagCode = (countryCode?: string): FlagCountryCode | undefined => {\n if (!countryCode) return undefined\n const code = countryCode.toLowerCase()\n return (FlagCountryCodes as string[]).includes(code) ? (code as FlagCountryCode) : undefined\n}\n\nexport const OriginSelect = (props: OriginSelectProps) => (\n <Combobox<OriginSelectItem>\n {...props}\n renderItem={(item: OriginSelectItem) => {\n const code = toFlagCode(item.countryCode)\n return (\n <>\n {code && <Flag countryCode={code} />}\n <Text truncate>{item.label}</Text>\n </>\n )\n }}\n renderValue={(item: OriginSelectItem) => {\n const code = toFlagCode(item.countryCode)\n return (\n <>\n {code && <Flag countryCode={code} />}\n <ChipLabel>{item.label}</ChipLabel>\n </>\n )\n }}\n />\n)\n"],"mappings":";;;;;;;AAuBA,IAAM,KAAc,MAAsD;CACxE,IAAI,CAAC,GAAa;CAClB,IAAM,IAAO,EAAY,YAAY;CACrC,OAAQ,EAA8B,SAAS,CAAI,IAAK,IAA2B,KAAA;AACrF,GAEa,KAAgB,MAC3B,kBAAC,GAAD;CACE,GAAI;CACJ,aAAa,MAA2B;EACtC,IAAM,IAAO,EAAW,EAAK,WAAW;EACxC,OACE,kBAAA,GAAA,EAAA,UAAA,CACG,KAAQ,kBAAC,GAAD,EAAM,aAAa,EAAO,CAAA,GACnC,kBAAC,GAAD;GAAM,UAAA;aAAU,EAAK;EAAY,CAAA,CACjC,EAAA,CAAA;CAEN;CACA,cAAc,MAA2B;EACvC,IAAM,IAAO,EAAW,EAAK,WAAW;EACxC,OACE,kBAAA,GAAA,EAAA,UAAA,CACG,KAAQ,kBAAC,GAAD,EAAM,aAAa,EAAO,CAAA,GACnC,kBAAC,GAAD,EAAA,UAAY,EAAK,MAAiB,CAAA,CAClC,EAAA,CAAA;CAEN;AACD,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";let e=require("@ark-ui/react");var t=(0,require("@pandacss/dev").defineSlotRecipe)({base:{control:{fontFamily:`satoshi`,position:`relative`,'&:has(> [data-part="trigger"][hidden])':{'& > [data-part="clear-trigger"]':{right:`space-16!`}},_disabled:{cursor:`not-allowed`}},content:{fontFamily:`satoshi`,background:`background`,borderWidth:1,borderColor:`primary.500`,borderStyle:`solid`,borderTopStyle:`none`,borderBottomLeftRadius:`radius-8`,borderBottomRightRadius:`radius-8`,display:`flex`,flexDirection:`column`,outline:0,zIndex:`modal`,maxHeight:`180px`,overflow:`auto`},clearTrigger:{position:`absolute`,cursor:`pointer`,right:`space-48`,top:`10px`,color:`secondary.900`,_disabled:{color:`grey.300`,pointerEvents:`none`}},trigger:{position:`absolute`,cursor:`pointer`,right:`space-16`,top:`9px`,color:{base:`secondary.900`,_disabled:`grey.300`},_disabled:{_focus:{border:`none`},pointerEvents:`none`,userSelect:`none`,cursor:`not-allowed`}},item:{_disabled:{cursor:`not-allowed`},alignItems:`center`,background:{_disabled:{_hover:`grey.100!`,_selected:`grey.50!`,_checked:`grey.50!`,base:`grey.100!`},_selected:`primary.500`,_checked:`primary.500`,_highlighted:`primary.200`,_hover:`primary.200`,base:`background`},color:{_disabled:{_hover:`grey.300!`,_selected:`grey.300!`,_checked:`grey.300!`,base:`grey.300!`},_selected:`white`,_checked:`white`},cursor:`pointer`,display:`flex`,gap:`space-4`,transitionDuration:`fast`,transitionProperty:`background, color`,transitionTimingFunction:`default`,"& p":{color:`inherit!`}},itemGroupLabel:{textStyle:`body.sm`},root:{display:`flex`,flexDirection:`column`,gap:`space-4`,width:`full`,_disabled:{cursor:`not-allowed`}},input:{_disabled:{pointerEvents:`none`},_placeholderShown:{color:{base:`grey.400`,_disabled:`grey.300`}},_open:{border:`1px solid {colors.primary.500}`,_open:{borderBottomLeftRadius:`radius-0!`,borderBottomRightRadius:`radius-0!`}},alignItems:`center`,borderBottomColor:{_open:`grey.100`},paddingRight:{base:`space-60!`,'&[value]:not([value=""])':`90px!`},position:`relative
|
|
1
|
+
"use client";let e=require("@ark-ui/react");var t=(0,require("@pandacss/dev").defineSlotRecipe)({base:{control:{fontFamily:`satoshi`,position:`relative`,'&:has(> [data-part="trigger"][hidden])':{'& > [data-part="clear-trigger"]':{right:`space-16!`}},_disabled:{cursor:`not-allowed`},'&[data-multiple="true"]':{display:`flex`,alignItems:`center`,flexWrap:`wrap`,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`}},'&[data-multiple="true"][data-open]':{borderColor:`primary.500`,borderBottomColor:`grey.100`,borderBottomLeftRadius:`radius-0`,borderBottomRightRadius:`radius-0`}},content:{fontFamily:`satoshi`,background:`background`,borderWidth:1,borderColor:`primary.500`,borderStyle:`solid`,borderTopStyle:`none`,borderBottomLeftRadius:`radius-8`,borderBottomRightRadius:`radius-8`,display:`flex`,flexDirection:`column`,outline:0,zIndex:`modal`,maxHeight:`180px`,overflow:`auto`},clearTrigger:{position:`absolute`,cursor:`pointer`,right:`space-48`,top:`10px`,color:`secondary.900`,_disabled:{color:`grey.300`,pointerEvents:`none`}},trigger:{position:`absolute`,cursor:`pointer`,right:`space-16`,top:`9px`,color:{base:`secondary.900`,_disabled:`grey.300`},_disabled:{_focus:{border:`none`},pointerEvents:`none`,userSelect:`none`,cursor:`not-allowed`}},item:{_disabled:{cursor:`not-allowed`},alignItems:`center`,background:{_disabled:{_hover:`grey.100!`,_selected:`grey.50!`,_checked:`grey.50!`,base:`grey.100!`},_selected:`primary.500`,_checked:`primary.500`,_highlighted:`primary.200`,_hover:`primary.200`,base:`background`},color:{_disabled:{_hover:`grey.300!`,_selected:`grey.300!`,_checked:`grey.300!`,base:`grey.300!`},_selected:`white`,_checked:`white`},cursor:`pointer`,display:`flex`,gap:`space-4`,transitionDuration:`fast`,transitionProperty:`background, color`,transitionTimingFunction:`default`,"& p":{color:`inherit!`}},itemGroupLabel:{textStyle:`body.sm`},root:{display:`flex`,flexDirection:`column`,gap:`space-4`,width:`full`,_disabled:{cursor:`not-allowed`}},input:{_disabled:{pointerEvents:`none`},_placeholderShown:{color:{base:`grey.400`,_disabled:`grey.300`}},_open:{border:`1px solid {colors.primary.500}`,_open:{borderBottomLeftRadius:`radius-0!`,borderBottomRightRadius:`radius-0!`}},alignItems:`center`,borderBottomColor:{_open:`grey.100`},paddingRight:{base:`space-60!`,'&[value]:not([value=""])':`90px!`},position:`relative`,'&[data-multiple="true"]':{border:`none!`,background:`transparent`,minHeight:`auto!`,height:`auto`,width:`auto!`,minWidth:`90px`,flex:`1 1 90px`,paddingBlock:`space-2!`,paddingLeft:`space-0!`,paddingRight:`space-0!`,_open:{border:`none!`}}}},className:`combobox`,defaultVariants:{size:`md`},jsx:[`Combobox`],slots:e.comboboxAnatomy.keys(),variants:{hideClearTrigger:{true:{input:{paddingRight:{base:`space-60!`,'&[value]:not([value=""])':`space-60!`}},clearTrigger:{display:`none`}}},size:{md:{item:{px:`space-16`,py:`space-8`,textStyle:`body.md`},input:{gap:`space-8`,minH:`40px`,minW:`size-16`,py:`space-8`,px:`space-16`,textStyle:`body.md`}}}}});exports.comboboxRecipe=t;
|
|
2
2
|
//# sourceMappingURL=combobox.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.cjs","names":[],"sources":["../../../src/theme/recipes/combobox.ts"],"sourcesContent":["import { comboboxAnatomy } from '@ark-ui/react'\nimport { defineSlotRecipe } from '@pandacss/dev'\n\nexport const comboboxRecipe = defineSlotRecipe({\n base: {\n control: {\n fontFamily: 'satoshi',\n position: 'relative',\n '&:has(> [data-part=\"trigger\"][hidden])': {\n '& > [data-part=\"clear-trigger\"]': {\n right: 'space-16!',\n },\n },\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n content: {\n fontFamily: 'satoshi',\n background: 'background',\n borderWidth: 1,\n borderColor: 'primary.500',\n borderStyle: 'solid',\n borderTopStyle: 'none',\n borderBottomLeftRadius: 'radius-8',\n borderBottomRightRadius: 'radius-8',\n display: 'flex',\n flexDirection: 'column',\n outline: 0,\n zIndex: 'modal',\n maxHeight: '180px',\n overflow: 'auto',\n },\n clearTrigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-48',\n top: '10px',\n color: 'secondary.900',\n _disabled: {\n color: 'grey.300',\n pointerEvents: 'none',\n },\n },\n trigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-16',\n top: '9px',\n color: {\n base: 'secondary.900',\n _disabled: 'grey.300',\n },\n _disabled: {\n _focus: {\n border: 'none',\n },\n pointerEvents: 'none',\n userSelect: 'none',\n cursor: 'not-allowed',\n },\n },\n item: {\n _disabled: {\n cursor: 'not-allowed',\n },\n alignItems: 'center',\n background: {\n _disabled: {\n _hover: 'grey.100!',\n _selected: 'grey.50!',\n _checked: 'grey.50!',\n base: 'grey.100!',\n },\n _selected: 'primary.500',\n _checked: 'primary.500',\n _highlighted: 'primary.200',\n _hover: 'primary.200',\n base: 'background',\n },\n color: {\n _disabled: {\n _hover: 'grey.300!',\n _selected: 'grey.300!',\n _checked: 'grey.300!',\n base: 'grey.300!',\n },\n _selected: 'white',\n _checked: 'white',\n },\n cursor: 'pointer',\n display: 'flex',\n gap: 'space-4',\n transitionDuration: 'fast',\n transitionProperty: 'background, color',\n transitionTimingFunction: 'default',\n '& p': {\n color: 'inherit!',\n },\n },\n itemGroupLabel: {\n textStyle: 'body.sm',\n },\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 'space-4',\n width: 'full',\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n input: {\n _disabled: {\n pointerEvents: 'none',\n },\n _placeholderShown: {\n color: {\n base: 'grey.400',\n _disabled: 'grey.300',\n },\n },\n _open: {\n border: '1px solid {colors.primary.500}',\n _open: {\n borderBottomLeftRadius: 'radius-0!',\n borderBottomRightRadius: 'radius-0!',\n },\n },\n alignItems: 'center',\n borderBottomColor: {\n _open: 'grey.100',\n },\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': '90px!',\n },\n position: 'relative',\n },\n },\n className: 'combobox',\n defaultVariants: {\n size: 'md',\n },\n jsx: ['Combobox'],\n slots: comboboxAnatomy.keys(),\n variants: {\n hideClearTrigger: {\n true: {\n input: {\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': 'space-60!',\n },\n },\n clearTrigger: {\n display: 'none',\n },\n },\n },\n size: {\n md: {\n item: { px: 'space-16', py: 'space-8', textStyle: 'body.md' },\n input: {\n gap: 'space-8',\n minH: '40px',\n minW: 'size-16',\n py: 'space-8',\n px: 'space-16',\n textStyle: 'body.md',\n },\n },\n },\n },\n})\n"],"mappings":"4CAGA,IAAa,GAAA,yBAAA,EAAA,kBAAkC,CAC7C,KA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L,uBAAwB,YACxB,wBAAyB,WAC3B,CACF,EACA,WAAY,SACZ,kBAAmB,CACjB,MAAO,UACT,EACA,aAAc,CACZ,KAAM,YACN,2BAA4B,OAC9B,EACA,SAAU,
|
|
1
|
+
{"version":3,"file":"combobox.cjs","names":[],"sources":["../../../src/theme/recipes/combobox.ts"],"sourcesContent":["import { comboboxAnatomy } from '@ark-ui/react'\nimport { defineSlotRecipe } from '@pandacss/dev'\n\nexport const comboboxRecipe = defineSlotRecipe({\n base: {\n control: {\n fontFamily: 'satoshi',\n position: 'relative',\n '&:has(> [data-part=\"trigger\"][hidden])': {\n '& > [data-part=\"clear-trigger\"]': {\n right: 'space-16!',\n },\n },\n _disabled: {\n cursor: 'not-allowed',\n },\n // Tags-input layout (multiple mode): the control becomes the bordered box\n // holding the selected chips + a borderless input. Styled via a self\n // attribute (`&[data-multiple]`) — panda drops ancestor-combinator nested\n // selectors from slot recipes, but keeps `&`-first ones. Ships via the\n // recipe (inline css() does not reach consumer apps).\n '&[data-multiple=\"true\"]': {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\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 },\n // Flatten the bottom edge while the dropdown is open so it merges cleanly.\n '&[data-multiple=\"true\"][data-open]': {\n borderColor: 'primary.500',\n borderBottomColor: 'grey.100',\n borderBottomLeftRadius: 'radius-0',\n borderBottomRightRadius: 'radius-0',\n },\n },\n content: {\n fontFamily: 'satoshi',\n background: 'background',\n borderWidth: 1,\n borderColor: 'primary.500',\n borderStyle: 'solid',\n borderTopStyle: 'none',\n borderBottomLeftRadius: 'radius-8',\n borderBottomRightRadius: 'radius-8',\n display: 'flex',\n flexDirection: 'column',\n outline: 0,\n zIndex: 'modal',\n maxHeight: '180px',\n overflow: 'auto',\n },\n clearTrigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-48',\n top: '10px',\n color: 'secondary.900',\n _disabled: {\n color: 'grey.300',\n pointerEvents: 'none',\n },\n },\n trigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-16',\n top: '9px',\n color: {\n base: 'secondary.900',\n _disabled: 'grey.300',\n },\n _disabled: {\n _focus: {\n border: 'none',\n },\n pointerEvents: 'none',\n userSelect: 'none',\n cursor: 'not-allowed',\n },\n },\n item: {\n _disabled: {\n cursor: 'not-allowed',\n },\n alignItems: 'center',\n background: {\n _disabled: {\n _hover: 'grey.100!',\n _selected: 'grey.50!',\n _checked: 'grey.50!',\n base: 'grey.100!',\n },\n _selected: 'primary.500',\n _checked: 'primary.500',\n _highlighted: 'primary.200',\n _hover: 'primary.200',\n base: 'background',\n },\n color: {\n _disabled: {\n _hover: 'grey.300!',\n _selected: 'grey.300!',\n _checked: 'grey.300!',\n base: 'grey.300!',\n },\n _selected: 'white',\n _checked: 'white',\n },\n cursor: 'pointer',\n display: 'flex',\n gap: 'space-4',\n transitionDuration: 'fast',\n transitionProperty: 'background, color',\n transitionTimingFunction: 'default',\n '& p': {\n color: 'inherit!',\n },\n },\n itemGroupLabel: {\n textStyle: 'body.sm',\n },\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 'space-4',\n width: 'full',\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n input: {\n _disabled: {\n pointerEvents: 'none',\n },\n _placeholderShown: {\n color: {\n base: 'grey.400',\n _disabled: 'grey.300',\n },\n },\n _open: {\n border: '1px solid {colors.primary.500}',\n _open: {\n borderBottomLeftRadius: 'radius-0!',\n borderBottomRightRadius: 'radius-0!',\n },\n },\n alignItems: 'center',\n borderBottomColor: {\n _open: 'grey.100',\n },\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': '90px!',\n },\n position: 'relative',\n // In tags-input (multiple) mode the input sits inline inside the control\n // box, so it must be borderless, auto-width and flush (! beats the base\n // important paddingRight and the _open border). Self-attribute selector so\n // panda keeps it (see the control slot note above).\n '&[data-multiple=\"true\"]': {\n border: 'none!',\n background: 'transparent',\n minHeight: 'auto!',\n height: 'auto',\n width: 'auto!',\n minWidth: '90px',\n flex: '1 1 90px',\n paddingBlock: 'space-2!',\n paddingLeft: 'space-0!',\n paddingRight: 'space-0!',\n _open: { border: 'none!' },\n },\n },\n },\n className: 'combobox',\n defaultVariants: {\n size: 'md',\n },\n jsx: ['Combobox'],\n slots: comboboxAnatomy.keys(),\n variants: {\n hideClearTrigger: {\n true: {\n input: {\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': 'space-60!',\n },\n },\n clearTrigger: {\n display: 'none',\n },\n },\n },\n size: {\n md: {\n item: { px: 'space-16', py: 'space-8', textStyle: 'body.md' },\n input: {\n gap: 'space-8',\n minH: '40px',\n minW: 'size-16',\n py: 'space-8',\n px: 'space-16',\n textStyle: 'body.md',\n },\n },\n },\n },\n})\n"],"mappings":"4CAGA,IAAa,GAAA,yBAAA,EAAA,kBAAkC,CAC7C,KAAM,CACJ,QAAS,CACP,WAAY,UACZ,SAAU,WACV,yCAA0C,CACxC,kCAAmC,CACjC,MAAO,WACT,CACF,EACA,UAAW,CACT,OAAQ,aACV,EAMA,0BAA2B,CACzB,QAAS,OACT,WAAY,SACZ,SAAU,OACV,IAAK,UACL,UAAW,OACX,aAAc,UACd,YAAa,UACb,aAAc,WACd,OAAQ,8BACR,aAAc,WACd,OAAQ,OACR,mBAAoB,eACpB,mBAAoB,SACpB,aAAc,CAAE,YAAa,aAAc,CAC7C,EAEA,qCAAsC,CACpC,YAAa,cACb,kBAAmB,WACnB,uBAAwB,WACxB,wBAAyB,UAC3B,CACF,EACA,QAAS,CACP,WAAY,UACZ,WAAY,aACZ,YAAa,EACb,YAAa,cACb,YAAa,QACb,eAAgB,OAChB,uBAAwB,WACxB,wBAAyB,WACzB,QAAS,OACT,cAAe,SACf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aAAc,WACd,MAAO,CAAE,OAAQ,OAAQ,CAC3B,CACF,CACF,EACA,UAAW,WACX,gBAAiB,CACf,KAAM,IACR,EACA,IAAK,CAAC,UAAU,EAChB,MAAO,EAAA,gBAAgB,KAAK,EAC5B,SAAU,CACR,iBAAkB,CAChB,KAAM,CACJ,MAAO,CACL,aAAc,CACZ,KAAM,YACN,2BAA4B,WAC9B,CACF,EACA,aAAc,CACZ,QAAS,MACX,CACF,CACF,EACA,KAAM,CACJ,GAAI,CACF,KAAM,CAAE,GAAI,WAAY,GAAI,UAAW,UAAW,SAAU,EAC5D,MAAO,CACL,IAAK,UACL,KAAM,OACN,KAAM,UACN,GAAI,UACJ,GAAI,WACJ,UAAW,SACb,CACF,CACF,CACF,CACF,CAAC"}
|
|
@@ -8,7 +8,29 @@ var n = t({
|
|
|
8
8
|
fontFamily: "satoshi",
|
|
9
9
|
position: "relative",
|
|
10
10
|
"&:has(> [data-part=\"trigger\"][hidden])": { "& > [data-part=\"clear-trigger\"]": { right: "space-16!" } },
|
|
11
|
-
_disabled: { cursor: "not-allowed" }
|
|
11
|
+
_disabled: { cursor: "not-allowed" },
|
|
12
|
+
"&[data-multiple=\"true\"]": {
|
|
13
|
+
display: "flex",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
flexWrap: "wrap",
|
|
16
|
+
gap: "space-4",
|
|
17
|
+
minHeight: "40px",
|
|
18
|
+
paddingBlock: "space-4",
|
|
19
|
+
paddingLeft: "space-8",
|
|
20
|
+
paddingRight: "space-48",
|
|
21
|
+
border: "1px solid {colors.grey.100}",
|
|
22
|
+
borderRadius: "radius-8",
|
|
23
|
+
cursor: "text",
|
|
24
|
+
transitionProperty: "border-color",
|
|
25
|
+
transitionDuration: "normal",
|
|
26
|
+
_focusWithin: { borderColor: "primary.500" }
|
|
27
|
+
},
|
|
28
|
+
"&[data-multiple=\"true\"][data-open]": {
|
|
29
|
+
borderColor: "primary.500",
|
|
30
|
+
borderBottomColor: "grey.100",
|
|
31
|
+
borderBottomLeftRadius: "radius-0",
|
|
32
|
+
borderBottomRightRadius: "radius-0"
|
|
33
|
+
}
|
|
12
34
|
},
|
|
13
35
|
content: {
|
|
14
36
|
fontFamily: "satoshi",
|
|
@@ -114,7 +136,20 @@ var n = t({
|
|
|
114
136
|
base: "space-60!",
|
|
115
137
|
"&[value]:not([value=\"\"])": "90px!"
|
|
116
138
|
},
|
|
117
|
-
position: "relative"
|
|
139
|
+
position: "relative",
|
|
140
|
+
"&[data-multiple=\"true\"]": {
|
|
141
|
+
border: "none!",
|
|
142
|
+
background: "transparent",
|
|
143
|
+
minHeight: "auto!",
|
|
144
|
+
height: "auto",
|
|
145
|
+
width: "auto!",
|
|
146
|
+
minWidth: "90px",
|
|
147
|
+
flex: "1 1 90px",
|
|
148
|
+
paddingBlock: "space-2!",
|
|
149
|
+
paddingLeft: "space-0!",
|
|
150
|
+
paddingRight: "space-0!",
|
|
151
|
+
_open: { border: "none!" }
|
|
152
|
+
}
|
|
118
153
|
}
|
|
119
154
|
},
|
|
120
155
|
className: "combobox",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../../../src/theme/recipes/combobox.ts"],"sourcesContent":["import { comboboxAnatomy } from '@ark-ui/react'\nimport { defineSlotRecipe } from '@pandacss/dev'\n\nexport const comboboxRecipe = defineSlotRecipe({\n base: {\n control: {\n fontFamily: 'satoshi',\n position: 'relative',\n '&:has(> [data-part=\"trigger\"][hidden])': {\n '& > [data-part=\"clear-trigger\"]': {\n right: 'space-16!',\n },\n },\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n content: {\n fontFamily: 'satoshi',\n background: 'background',\n borderWidth: 1,\n borderColor: 'primary.500',\n borderStyle: 'solid',\n borderTopStyle: 'none',\n borderBottomLeftRadius: 'radius-8',\n borderBottomRightRadius: 'radius-8',\n display: 'flex',\n flexDirection: 'column',\n outline: 0,\n zIndex: 'modal',\n maxHeight: '180px',\n overflow: 'auto',\n },\n clearTrigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-48',\n top: '10px',\n color: 'secondary.900',\n _disabled: {\n color: 'grey.300',\n pointerEvents: 'none',\n },\n },\n trigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-16',\n top: '9px',\n color: {\n base: 'secondary.900',\n _disabled: 'grey.300',\n },\n _disabled: {\n _focus: {\n border: 'none',\n },\n pointerEvents: 'none',\n userSelect: 'none',\n cursor: 'not-allowed',\n },\n },\n item: {\n _disabled: {\n cursor: 'not-allowed',\n },\n alignItems: 'center',\n background: {\n _disabled: {\n _hover: 'grey.100!',\n _selected: 'grey.50!',\n _checked: 'grey.50!',\n base: 'grey.100!',\n },\n _selected: 'primary.500',\n _checked: 'primary.500',\n _highlighted: 'primary.200',\n _hover: 'primary.200',\n base: 'background',\n },\n color: {\n _disabled: {\n _hover: 'grey.300!',\n _selected: 'grey.300!',\n _checked: 'grey.300!',\n base: 'grey.300!',\n },\n _selected: 'white',\n _checked: 'white',\n },\n cursor: 'pointer',\n display: 'flex',\n gap: 'space-4',\n transitionDuration: 'fast',\n transitionProperty: 'background, color',\n transitionTimingFunction: 'default',\n '& p': {\n color: 'inherit!',\n },\n },\n itemGroupLabel: {\n textStyle: 'body.sm',\n },\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 'space-4',\n width: 'full',\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n input: {\n _disabled: {\n pointerEvents: 'none',\n },\n _placeholderShown: {\n color: {\n base: 'grey.400',\n _disabled: 'grey.300',\n },\n },\n _open: {\n border: '1px solid {colors.primary.500}',\n _open: {\n borderBottomLeftRadius: 'radius-0!',\n borderBottomRightRadius: 'radius-0!',\n },\n },\n alignItems: 'center',\n borderBottomColor: {\n _open: 'grey.100',\n },\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': '90px!',\n },\n position: 'relative',\n },\n },\n className: 'combobox',\n defaultVariants: {\n size: 'md',\n },\n jsx: ['Combobox'],\n slots: comboboxAnatomy.keys(),\n variants: {\n hideClearTrigger: {\n true: {\n input: {\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': 'space-60!',\n },\n },\n clearTrigger: {\n display: 'none',\n },\n },\n },\n size: {\n md: {\n item: { px: 'space-16', py: 'space-8', textStyle: 'body.md' },\n input: {\n gap: 'space-8',\n minH: '40px',\n minW: 'size-16',\n py: 'space-8',\n px: 'space-16',\n textStyle: 'body.md',\n },\n },\n },\n },\n})\n"],"mappings":";;;;AAGA,IAAa,IAAiB,EAAiB;CAC7C,MAAM;EACJ,SAAS;GACP,YAAY;GACZ,UAAU;GACV,4CAA0C,EACxC,qCAAmC,EACjC,OAAO,YACT,EACF;GACA,WAAW,EACT,QAAQ,cACV;EACF;EACA,SAAS;GACP,YAAY;GACZ,YAAY;GACZ,aAAa;GACb,aAAa;GACb,aAAa;GACb,gBAAgB;GAChB,wBAAwB;GACxB,yBAAyB;GACzB,SAAS;GACT,eAAe;GACf,SAAS;GACT,QAAQ;GACR,WAAW;GACX,UAAU;EACZ;EACA,cAAc;GACZ,UAAU;GACV,QAAQ;GACR,OAAO;GACP,KAAK;GACL,OAAO;GACP,WAAW;IACT,OAAO;IACP,eAAe;GACjB;EACF;EACA,SAAS;GACP,UAAU;GACV,QAAQ;GACR,OAAO;GACP,KAAK;GACL,OAAO;IACL,MAAM;IACN,WAAW;GACb;GACA,WAAW;IACT,QAAQ,EACN,QAAQ,OACV;IACA,eAAe;IACf,YAAY;IACZ,QAAQ;GACV;EACF;EACA,MAAM;GACJ,WAAW,EACT,QAAQ,cACV;GACA,YAAY;GACZ,YAAY;IACV,WAAW;KACT,QAAQ;KACR,WAAW;KACX,UAAU;KACV,MAAM;IACR;IACA,WAAW;IACX,UAAU;IACV,cAAc;IACd,QAAQ;IACR,MAAM;GACR;GACA,OAAO;IACL,WAAW;KACT,QAAQ;KACR,WAAW;KACX,UAAU;KACV,MAAM;IACR;IACA,WAAW;IACX,UAAU;GACZ;GACA,QAAQ;GACR,SAAS;GACT,KAAK;GACL,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,OAAO,EACL,OAAO,WACT;EACF;EACA,gBAAgB,EACd,WAAW,UACb;EACA,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACL,OAAO;GACP,WAAW,EACT,QAAQ,cACV;EACF;EACA,OAAO;GACL,WAAW,EACT,eAAe,OACjB;GACA,mBAAmB,EACjB,OAAO;IACL,MAAM;IACN,WAAW;GACb,EACF;GACA,OAAO;IACL,QAAQ;IACR,OAAO;KACL,wBAAwB;KACxB,yBAAyB;IAC3B;GACF;GACA,YAAY;GACZ,mBAAmB,EACjB,OAAO,WACT;GACA,cAAc;IACZ,MAAM;IACN,8BAA4B;GAC9B;GACA,UAAU;
|
|
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../../../src/theme/recipes/combobox.ts"],"sourcesContent":["import { comboboxAnatomy } from '@ark-ui/react'\nimport { defineSlotRecipe } from '@pandacss/dev'\n\nexport const comboboxRecipe = defineSlotRecipe({\n base: {\n control: {\n fontFamily: 'satoshi',\n position: 'relative',\n '&:has(> [data-part=\"trigger\"][hidden])': {\n '& > [data-part=\"clear-trigger\"]': {\n right: 'space-16!',\n },\n },\n _disabled: {\n cursor: 'not-allowed',\n },\n // Tags-input layout (multiple mode): the control becomes the bordered box\n // holding the selected chips + a borderless input. Styled via a self\n // attribute (`&[data-multiple]`) — panda drops ancestor-combinator nested\n // selectors from slot recipes, but keeps `&`-first ones. Ships via the\n // recipe (inline css() does not reach consumer apps).\n '&[data-multiple=\"true\"]': {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\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 },\n // Flatten the bottom edge while the dropdown is open so it merges cleanly.\n '&[data-multiple=\"true\"][data-open]': {\n borderColor: 'primary.500',\n borderBottomColor: 'grey.100',\n borderBottomLeftRadius: 'radius-0',\n borderBottomRightRadius: 'radius-0',\n },\n },\n content: {\n fontFamily: 'satoshi',\n background: 'background',\n borderWidth: 1,\n borderColor: 'primary.500',\n borderStyle: 'solid',\n borderTopStyle: 'none',\n borderBottomLeftRadius: 'radius-8',\n borderBottomRightRadius: 'radius-8',\n display: 'flex',\n flexDirection: 'column',\n outline: 0,\n zIndex: 'modal',\n maxHeight: '180px',\n overflow: 'auto',\n },\n clearTrigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-48',\n top: '10px',\n color: 'secondary.900',\n _disabled: {\n color: 'grey.300',\n pointerEvents: 'none',\n },\n },\n trigger: {\n position: 'absolute',\n cursor: 'pointer',\n right: 'space-16',\n top: '9px',\n color: {\n base: 'secondary.900',\n _disabled: 'grey.300',\n },\n _disabled: {\n _focus: {\n border: 'none',\n },\n pointerEvents: 'none',\n userSelect: 'none',\n cursor: 'not-allowed',\n },\n },\n item: {\n _disabled: {\n cursor: 'not-allowed',\n },\n alignItems: 'center',\n background: {\n _disabled: {\n _hover: 'grey.100!',\n _selected: 'grey.50!',\n _checked: 'grey.50!',\n base: 'grey.100!',\n },\n _selected: 'primary.500',\n _checked: 'primary.500',\n _highlighted: 'primary.200',\n _hover: 'primary.200',\n base: 'background',\n },\n color: {\n _disabled: {\n _hover: 'grey.300!',\n _selected: 'grey.300!',\n _checked: 'grey.300!',\n base: 'grey.300!',\n },\n _selected: 'white',\n _checked: 'white',\n },\n cursor: 'pointer',\n display: 'flex',\n gap: 'space-4',\n transitionDuration: 'fast',\n transitionProperty: 'background, color',\n transitionTimingFunction: 'default',\n '& p': {\n color: 'inherit!',\n },\n },\n itemGroupLabel: {\n textStyle: 'body.sm',\n },\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 'space-4',\n width: 'full',\n _disabled: {\n cursor: 'not-allowed',\n },\n },\n input: {\n _disabled: {\n pointerEvents: 'none',\n },\n _placeholderShown: {\n color: {\n base: 'grey.400',\n _disabled: 'grey.300',\n },\n },\n _open: {\n border: '1px solid {colors.primary.500}',\n _open: {\n borderBottomLeftRadius: 'radius-0!',\n borderBottomRightRadius: 'radius-0!',\n },\n },\n alignItems: 'center',\n borderBottomColor: {\n _open: 'grey.100',\n },\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': '90px!',\n },\n position: 'relative',\n // In tags-input (multiple) mode the input sits inline inside the control\n // box, so it must be borderless, auto-width and flush (! beats the base\n // important paddingRight and the _open border). Self-attribute selector so\n // panda keeps it (see the control slot note above).\n '&[data-multiple=\"true\"]': {\n border: 'none!',\n background: 'transparent',\n minHeight: 'auto!',\n height: 'auto',\n width: 'auto!',\n minWidth: '90px',\n flex: '1 1 90px',\n paddingBlock: 'space-2!',\n paddingLeft: 'space-0!',\n paddingRight: 'space-0!',\n _open: { border: 'none!' },\n },\n },\n },\n className: 'combobox',\n defaultVariants: {\n size: 'md',\n },\n jsx: ['Combobox'],\n slots: comboboxAnatomy.keys(),\n variants: {\n hideClearTrigger: {\n true: {\n input: {\n paddingRight: {\n base: 'space-60!',\n '&[value]:not([value=\"\"])': 'space-60!',\n },\n },\n clearTrigger: {\n display: 'none',\n },\n },\n },\n size: {\n md: {\n item: { px: 'space-16', py: 'space-8', textStyle: 'body.md' },\n input: {\n gap: 'space-8',\n minH: '40px',\n minW: 'size-16',\n py: 'space-8',\n px: 'space-16',\n textStyle: 'body.md',\n },\n },\n },\n },\n})\n"],"mappings":";;;;AAGA,IAAa,IAAiB,EAAiB;CAC7C,MAAM;EACJ,SAAS;GACP,YAAY;GACZ,UAAU;GACV,4CAA0C,EACxC,qCAAmC,EACjC,OAAO,YACT,EACF;GACA,WAAW,EACT,QAAQ,cACV;GAMA,6BAA2B;IACzB,SAAS;IACT,YAAY;IACZ,UAAU;IACV,KAAK;IACL,WAAW;IACX,cAAc;IACd,aAAa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