@stokelp/ui 2.123.0 → 2.124.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/app/navigation/language-select/AppNavigationLanguageSelect.cjs +1 -1
- package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.cjs.map +1 -1
- package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.d.ts +13 -0
- package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.js +85 -165
- package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.js.map +1 -1
- package/dist/components/combobox/Combobox.cjs +1 -1
- package/dist/components/combobox/Combobox.cjs.map +1 -1
- package/dist/components/combobox/Combobox.js +71 -70
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/flag/styled.cjs +1 -1
- package/dist/components/flag/styled.cjs.map +1 -1
- package/dist/components/flag/styled.js +5 -5
- package/dist/components/flag/styled.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.cjs.map +1 -1
- package/dist/components/select/Select.js +75 -74
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.js +10 -9
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.js.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.d.ts +5 -43
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js +69 -101
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js.map +1 -1
- package/dist/components/supplier-rating-badge/labels.cjs +2 -0
- package/dist/components/supplier-rating-badge/labels.cjs.map +1 -0
- package/dist/components/supplier-rating-badge/labels.d.ts +42 -0
- package/dist/components/supplier-rating-badge/labels.js +49 -0
- package/dist/components/supplier-rating-badge/labels.js.map +1 -0
- package/dist/components/ui-labels/UiLabelsProvider.cjs +2 -0
- package/dist/components/ui-labels/UiLabelsProvider.cjs.map +1 -0
- package/dist/components/ui-labels/UiLabelsProvider.d.ts +27 -0
- package/dist/components/ui-labels/UiLabelsProvider.js +28 -0
- package/dist/components/ui-labels/UiLabelsProvider.js.map +1 -0
- package/dist/components/ui-labels/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +57 -55
- 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");let
|
|
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("../ui-labels/UiLabelsProvider.cjs");let a=require("@ark-ui/react"),o=require("@stokelp/styled-system/jsx"),s=require("@stokelp/styled-system/recipes"),c=require("react"),l=require("react/jsx-runtime"),u=require("@stokelp/styled-system/css"),d=require("react-window");var{withProvider:f,withContext:p}=e.createStyleContext(s.select),m=f((0,o.styled)(a.Select.Root),`root`,{defaultProps:{loopFocus:!0}}),h=p((0,o.styled)(a.Select.ClearTrigger),`clearTrigger`),g=p((0,o.styled)(a.Select.Content),`content`),_=p((0,o.styled)(a.Select.Control),`control`),v=p((0,o.styled)(a.Select.Indicator),`indicator`),y=p((0,o.styled)(a.Select.Item),`item`),b=p((0,o.styled)(a.Select.ItemGroup),`itemGroup`),x=p((0,o.styled)(a.Select.ItemGroupLabel),`itemGroupLabel`),S=p((0,o.styled)(a.Select.ItemText),`itemText`),C=p((0,o.styled)(a.Select.Positioner),`positioner`),w=p((0,o.styled)(a.Select.Trigger),`trigger`),T=p((0,o.styled)(a.Select.ValueText),`valueText`),E=()=>(0,l.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,l.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,u.css)({stroke:`grey.100`})})]}),D=()=>(0,l.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,u.css)({fill:`primary.500`})}),(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z`,fill:`white`})]});function O({placeholder:e,allSelectedLabel:t}){let n=(0,a.useSelectContext)(),r=n.collection.items,i=n.selectedItems;return n.multiple&&i.filter(e=>!e.disabled).length>=r.filter(e=>!e.disabled).length&&t?(0,l.jsx)(T,{className:`custom`,truncate:!0,children:t}):(0,l.jsx)(T,{truncate:!0,placeholder:e})}function k({renderTrigger:e,placeholder:t,allSelectedLabel:n}){let r=(0,a.useSelectContext)(),i=r.value&&r.value.length>0?r.collection.findMany(r.value):[];if(i.length===0)return(0,l.jsx)(T,{className:`custom`,truncate:!0,placeholder:t});let o=r.selectedItems;return r.multiple&&o.filter(e=>!e.disabled).length>=r.collection.items.filter(e=>!e.disabled).length&&n?(0,l.jsx)(T,{className:`custom`,truncate:!0,children:n}):(0,l.jsx)(T,{className:`custom`,placeholder:t,children:i.map(t=>(0,l.jsx)(`span`,{children:e(t)},t.value))})}function A({item:e,isMultiple:t,renderItem:n}){let r=(0,a.useSelectItemContext)();return(0,l.jsxs)(l.Fragment,{children:[t?r.selected?(0,l.jsx)(D,{}):(0,l.jsx)(E,{}):null,n?n(e):(0,l.jsx)(S,{truncate:!0,children:e.label})]})}function j(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.label===n.groupLabel){e.items.push(n);continue}t.push({label:n.groupLabel,items:[n]})}return t}function M({items:e,placeholder:o,emptyLabel:s,usePortal:f=!0,positioning:p,renderItem:S,renderTrigger:T,virtualized:E,rowHeight:D=34,...M}){let N=i.useUiLabels(),P=(0,a.createListCollection)({items:e}),F=(0,c.useRef)(null),I=e=>(0,l.jsxs)(c.Fragment,{children:[(0,l.jsx)(r.ConditionalWrapper,{when:!!e.tooltip,wrapper:n=>(0,l.jsx)(t.Tooltip,{label:e.tooltip,children:n}),children:(0,l.jsx)(y,{item:e,children:(0,l.jsx)(A,{renderItem:S,item:e,isMultiple:M.multiple})},e.value)},e.value),e.separatorAfter&&(0,l.jsx)(`div`,{role:`separator`,className:(0,u.css)({height:`1px`,flexShrink:0,backgroundColor:`grey.100`,marginY:`space-4`,marginX:`space-8`})})]},e.value);return(0,l.jsxs)(m,{lazyMount:!0,unmountOnExit:!0,collection:P,positioning:{sameWidth:!0,gutter:0,...p},"data-recipe":`select`,...M,ref:e=>{e&&(F.current=e.closest(`[role="dialog"]`))},children:[(0,l.jsxs)(_,{children:[(0,l.jsxs)(w,{children:[T?(0,l.jsx)(k,{renderTrigger:T,placeholder:o,allSelectedLabel:M.allSelectedLabel}):(0,l.jsx)(O,{placeholder:o,allSelectedLabel:M.allSelectedLabel}),(0,l.jsx)(v,{asChild:!0,children:(0,l.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z`,fill:`currentColor`})})})]}),(0,l.jsx)(h,{disabled:M.readOnly,asChild:!0,children:(0,l.jsx)(`button`,{children:(0,l.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z`,fill:`currentColor`})})})})]}),(0,l.jsx)(r.ConditionalWrapper,{when:f,wrapper:e=>(0,l.jsx)(a.Portal,{container:F,children:e}),children:(0,l.jsx)(C,{children:(0,l.jsx)(g,{children:e.length===0?(0,l.jsx)(n.Text,{px:`space-8`,textAlign:`center`,children:s??N.noResults}):E?(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(d.FixedSizeList,{height:Math.min(D*e.length,180),itemCount:e.length,itemSize:D,width:`100%`,children:({index:n,style:i})=>(0,l.jsx)(r.ConditionalWrapper,{when:!!e[n].tooltip,wrapper:r=>(0,l.jsx)(t.Tooltip,{label:e[n].tooltip,children:r}),children:(0,l.jsx)(y,{item:e[n],style:i,children:(0,l.jsx)(A,{renderItem:S,item:e[n]})},e[n].value)},e[n].value)})}):j(e).map((e,t)=>e.label===void 0?(0,l.jsx)(c.Fragment,{children:e.items.map(I)},`group-${t}`):(0,l.jsxs)(b,{children:[(0,l.jsx)(x,{children:e.label}),e.items.map(I)]},`group-${t}`))})})}),(0,l.jsx)(a.Select.HiddenSelect,{})]})}exports.Select=M;
|
|
2
2
|
//# sourceMappingURL=Select.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemGroup = withContext(styled(ArkSelect.ItemGroup), 'itemGroup')\nconst ItemGroupLabel = withContext(styled(ArkSelect.ItemGroupLabel), 'itemGroupLabel')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n /**\n * Heading for the group this item belongs to. Consecutive items sharing a label are\n * wrapped in one labelled group, so the heading is announced by screen readers instead\n * of being faked with a decorative row inside `renderItem`. Items without a label stay\n * ungrouped. Ignored by the virtualized list (fixed row heights).\n */\n groupLabel?: string\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\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 SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\n/**\n * Splits the flat item list into consecutive runs sharing a `groupLabel`. Runs are built\n * from adjacency rather than by collecting every item with the same label, so the caller\n * keeps full control of the order: sorting is the caller's business, grouping is ours.\n */\nfunction toGroupRuns<Item extends SelectItem>(items: readonly Item[]) {\n const runs: Array<{ label?: string; items: Item[] }> = []\n\n for (const item of items) {\n const current = runs[runs.length - 1]\n if (current && current.label === item.groupLabel) {\n current.items.push(item)\n continue\n }\n runs.push({ label: item.groupLabel, items: [item] })\n }\n\n return runs\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n const renderOption = (item: Item) => (\n <Fragment key={item.value}>\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={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n )\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\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 </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? 'Aucun résultat'}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n toGroupRuns<Item>(items).map((run, runIndex) =>\n run.label === undefined ? (\n <Fragment key={`group-${runIndex}`}>{run.items.map(renderOption)}</Fragment>\n ) : (\n <ItemGroup key={`group-${runIndex}`}>\n <ItemGroupLabel>{run.label}</ItemGroupLabel>\n {run.items.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,GAAO,KAOA,CAET,CAAA,CACf,CAAA,EAEF,EAAkB,CAAK,EAAE,KAAK,EAAK,IACjC,EAAI,QAAU,IAAA,IACZ,EAAA,EAAA,KAAC,EAAA,SAAD,CAAA,SAAqC,EAAI,MAAM,IAAI,CAAY,CAAY,EAA5D,SAAS,GAAmD,GAE3E,EAAA,EAAA,MAAC,EAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,EAAD,CAAA,SAAiB,EAAI,KAAsB,CAAA,EAC1C,EAAI,MAAM,IAAI,CAAY,CAClB,CAAA,EAHK,SAAS,GAGd,CAEf,CAEK,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAA,EAAA,KAAC,EAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,GAEV"}
|
|
1
|
+
{"version":3,"file":"Select.cjs","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\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(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemGroup = withContext(styled(ArkSelect.ItemGroup), 'itemGroup')\nconst ItemGroupLabel = withContext(styled(ArkSelect.ItemGroupLabel), 'itemGroupLabel')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n /**\n * Heading for the group this item belongs to. Consecutive items sharing a label are\n * wrapped in one labelled group, so the heading is announced by screen readers instead\n * of being faked with a decorative row inside `renderItem`. Items without a label stay\n * ungrouped. Ignored by the virtualized list (fixed row heights).\n */\n groupLabel?: string\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\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 SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\n/**\n * Splits the flat item list into consecutive runs sharing a `groupLabel`. Runs are built\n * from adjacency rather than by collecting every item with the same label, so the caller\n * keeps full control of the order: sorting is the caller's business, grouping is ours.\n */\nfunction toGroupRuns<Item extends SelectItem>(items: readonly Item[]) {\n const runs: Array<{ label?: string; items: Item[] }> = []\n\n for (const item of items) {\n const current = runs[runs.length - 1]\n if (current && current.label === item.groupLabel) {\n current.items.push(item)\n continue\n }\n runs.push({ label: item.groupLabel, items: [item] })\n }\n\n return runs\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const uiLabels = useUiLabels()\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n const renderOption = (item: Item) => (\n <Fragment key={item.value}>\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={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n )\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\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 </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? uiLabels.noResults}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n toGroupRuns<Item>(items).map((run, runIndex) =>\n run.label === undefined ? (\n <Fragment key={`group-${runIndex}`}>{run.items.map(renderOption)}</Fragment>\n ) : (\n <ItemGroup key={`group-${runIndex}`}>\n <ItemGroupLabel>{run.label}</ItemGroupLabel>\n {run.items.map(renderOption)}\n </ItemGroup>\n ),\n )\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\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KAAK,EAAK,IACjC,EAAI,QAAU,IAAA,IACZ,EAAA,EAAA,KAAC,EAAA,SAAD,CAAA,SAAqC,EAAI,MAAM,IAAI,CAAY,CAAY,EAA5D,SAAS,GAAmD,GAE3E,EAAA,EAAA,MAAC,EAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,EAAD,CAAA,SAAiB,EAAI,KAAsB,CAAA,EAC1C,EAAI,MAAM,IAAI,CAAY,CAClB,CAAA,EAHK,SAAS,GAGd,CAEf,CAEK,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAA,EAAA,KAAC,EAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,GAEV"}
|
|
@@ -3,91 +3,92 @@ import { createStyleContext as e } from "../../utils/slots.js";
|
|
|
3
3
|
import { Tooltip as t } from "../tooltip/Tooltip.js";
|
|
4
4
|
import { Text as n } from "../text/Text.js";
|
|
5
5
|
import { ConditionalWrapper as r } from "../../shared/ConditionalWrapper.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import { useUiLabels as i } from "../ui-labels/UiLabelsProvider.js";
|
|
7
|
+
import { Portal as a, Select as o, createListCollection as s, useSelectContext as c, useSelectItemContext as l } from "@ark-ui/react";
|
|
8
|
+
import { styled as u } from "@stokelp/styled-system/jsx";
|
|
9
|
+
import { select as d } from "@stokelp/styled-system/recipes";
|
|
10
|
+
import { Fragment as f, useRef as p } from "react";
|
|
11
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { css as _ } from "@stokelp/styled-system/css";
|
|
13
|
+
import { FixedSizeList as v } from "react-window";
|
|
13
14
|
//#region src/components/select/Select.tsx
|
|
14
|
-
var { withProvider:
|
|
15
|
+
var { withProvider: y, withContext: b } = e(d), x = y(u(o.Root), "root", { defaultProps: { loopFocus: !0 } }), S = b(u(o.ClearTrigger), "clearTrigger"), C = b(u(o.Content), "content"), w = b(u(o.Control), "control"), T = b(u(o.Indicator), "indicator"), E = b(u(o.Item), "item"), D = b(u(o.ItemGroup), "itemGroup"), O = b(u(o.ItemGroupLabel), "itemGroupLabel"), k = b(u(o.ItemText), "itemText"), A = b(u(o.Positioner), "positioner"), j = b(u(o.Trigger), "trigger"), M = b(u(o.ValueText), "valueText"), N = () => /* @__PURE__ */ g("svg", {
|
|
15
16
|
width: "16",
|
|
16
17
|
height: "17",
|
|
17
18
|
viewBox: "0 0 16 17",
|
|
18
19
|
fill: "none",
|
|
19
20
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ h("rect", {
|
|
21
22
|
x: "0.5",
|
|
22
23
|
y: "1",
|
|
23
24
|
width: "15",
|
|
24
25
|
height: "15",
|
|
25
26
|
rx: "3.5",
|
|
26
27
|
fill: "white"
|
|
27
|
-
}), /* @__PURE__ */
|
|
28
|
+
}), /* @__PURE__ */ h("rect", {
|
|
28
29
|
x: "0.5",
|
|
29
30
|
y: "1",
|
|
30
31
|
width: "15",
|
|
31
32
|
height: "15",
|
|
32
33
|
rx: "3.5",
|
|
33
|
-
className:
|
|
34
|
+
className: _({ stroke: "grey.100" })
|
|
34
35
|
})]
|
|
35
|
-
}),
|
|
36
|
+
}), P = () => /* @__PURE__ */ g("svg", {
|
|
36
37
|
width: "16",
|
|
37
38
|
height: "17",
|
|
38
39
|
viewBox: "0 0 16 17",
|
|
39
40
|
fill: "none",
|
|
40
41
|
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ h("rect", {
|
|
42
43
|
y: "0.5",
|
|
43
44
|
width: "16",
|
|
44
45
|
height: "16",
|
|
45
46
|
rx: "4",
|
|
46
|
-
className:
|
|
47
|
-
}), /* @__PURE__ */
|
|
47
|
+
className: _({ fill: "primary.500" })
|
|
48
|
+
}), /* @__PURE__ */ h("path", {
|
|
48
49
|
fillRule: "evenodd",
|
|
49
50
|
clipRule: "evenodd",
|
|
50
51
|
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",
|
|
51
52
|
fill: "white"
|
|
52
53
|
})]
|
|
53
54
|
});
|
|
54
|
-
function
|
|
55
|
-
let n =
|
|
56
|
-
return n.multiple && i.filter((e) => !e.disabled).length >= r.filter((e) => !e.disabled).length && t ? /* @__PURE__ */
|
|
55
|
+
function F({ placeholder: e, allSelectedLabel: t }) {
|
|
56
|
+
let n = c(), r = n.collection.items, i = n.selectedItems;
|
|
57
|
+
return n.multiple && i.filter((e) => !e.disabled).length >= r.filter((e) => !e.disabled).length && t ? /* @__PURE__ */ h(M, {
|
|
57
58
|
className: "custom",
|
|
58
59
|
truncate: !0,
|
|
59
60
|
children: t
|
|
60
|
-
}) : /* @__PURE__ */
|
|
61
|
+
}) : /* @__PURE__ */ h(M, {
|
|
61
62
|
truncate: !0,
|
|
62
63
|
placeholder: e
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
-
let r =
|
|
67
|
-
if (i.length === 0) return /* @__PURE__ */
|
|
66
|
+
function I({ renderTrigger: e, placeholder: t, allSelectedLabel: n }) {
|
|
67
|
+
let r = c(), i = r.value && r.value.length > 0 ? r.collection.findMany(r.value) : [];
|
|
68
|
+
if (i.length === 0) return /* @__PURE__ */ h(M, {
|
|
68
69
|
className: "custom",
|
|
69
70
|
truncate: !0,
|
|
70
71
|
placeholder: t
|
|
71
72
|
});
|
|
72
73
|
let a = r.selectedItems;
|
|
73
|
-
return r.multiple && a.filter((e) => !e.disabled).length >= r.collection.items.filter((e) => !e.disabled).length && n ? /* @__PURE__ */
|
|
74
|
+
return r.multiple && a.filter((e) => !e.disabled).length >= r.collection.items.filter((e) => !e.disabled).length && n ? /* @__PURE__ */ h(M, {
|
|
74
75
|
className: "custom",
|
|
75
76
|
truncate: !0,
|
|
76
77
|
children: n
|
|
77
|
-
}) : /* @__PURE__ */
|
|
78
|
+
}) : /* @__PURE__ */ h(M, {
|
|
78
79
|
className: "custom",
|
|
79
80
|
placeholder: t,
|
|
80
|
-
children: i.map((t) => /* @__PURE__ */
|
|
81
|
+
children: i.map((t) => /* @__PURE__ */ h("span", { children: e(t) }, t.value))
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
-
let r =
|
|
85
|
-
return /* @__PURE__ */
|
|
84
|
+
function L({ item: e, isMultiple: t, renderItem: n }) {
|
|
85
|
+
let r = l();
|
|
86
|
+
return /* @__PURE__ */ g(m, { children: [t ? r.selected ? /* @__PURE__ */ h(P, {}) : /* @__PURE__ */ h(N, {}) : null, n ? n(e) : /* @__PURE__ */ h(k, {
|
|
86
87
|
truncate: !0,
|
|
87
88
|
children: e.label
|
|
88
89
|
})] });
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function R(e) {
|
|
91
92
|
let t = [];
|
|
92
93
|
for (let n of e) {
|
|
93
94
|
let e = t[t.length - 1];
|
|
@@ -102,24 +103,24 @@ function L(e) {
|
|
|
102
103
|
}
|
|
103
104
|
return t;
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
-
let
|
|
106
|
+
function z({ items: e, placeholder: c, emptyLabel: l, usePortal: u = !0, positioning: d, renderItem: y, renderTrigger: b, virtualized: k, rowHeight: M = 34, ...N }) {
|
|
107
|
+
let P = i(), z = s({ items: e }), B = p(null), V = (e) => /* @__PURE__ */ g(f, { children: [/* @__PURE__ */ h(r, {
|
|
107
108
|
when: !!e.tooltip,
|
|
108
|
-
wrapper: (n) => /* @__PURE__ */
|
|
109
|
+
wrapper: (n) => /* @__PURE__ */ h(t, {
|
|
109
110
|
label: e.tooltip,
|
|
110
111
|
children: n
|
|
111
112
|
}),
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ h(E, {
|
|
113
114
|
item: e,
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
-
renderItem:
|
|
115
|
+
children: /* @__PURE__ */ h(L, {
|
|
116
|
+
renderItem: y,
|
|
116
117
|
item: e,
|
|
117
|
-
isMultiple:
|
|
118
|
+
isMultiple: N.multiple
|
|
118
119
|
})
|
|
119
120
|
}, e.value)
|
|
120
|
-
}, e.value), e.separatorAfter && /* @__PURE__ */
|
|
121
|
+
}, e.value), e.separatorAfter && /* @__PURE__ */ h("div", {
|
|
121
122
|
role: "separator",
|
|
122
|
-
className:
|
|
123
|
+
className: _({
|
|
123
124
|
height: "1px",
|
|
124
125
|
flexShrink: 0,
|
|
125
126
|
backgroundColor: "grey.100",
|
|
@@ -127,53 +128,53 @@ function R({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positio
|
|
|
127
128
|
marginX: "space-8"
|
|
128
129
|
})
|
|
129
130
|
})] }, e.value);
|
|
130
|
-
return /* @__PURE__ */
|
|
131
|
+
return /* @__PURE__ */ g(x, {
|
|
131
132
|
lazyMount: !0,
|
|
132
133
|
unmountOnExit: !0,
|
|
133
|
-
collection:
|
|
134
|
+
collection: z,
|
|
134
135
|
positioning: {
|
|
135
136
|
sameWidth: !0,
|
|
136
137
|
gutter: 0,
|
|
137
|
-
...
|
|
138
|
+
...d
|
|
138
139
|
},
|
|
139
140
|
"data-recipe": "select",
|
|
140
|
-
...
|
|
141
|
+
...N,
|
|
141
142
|
ref: (e) => {
|
|
142
|
-
e && (
|
|
143
|
+
e && (B.current = e.closest("[role=\"dialog\"]"));
|
|
143
144
|
},
|
|
144
145
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
renderTrigger:
|
|
147
|
-
placeholder:
|
|
148
|
-
allSelectedLabel:
|
|
149
|
-
}) : /* @__PURE__ */
|
|
150
|
-
placeholder:
|
|
151
|
-
allSelectedLabel:
|
|
152
|
-
}), /* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ g(w, { children: [/* @__PURE__ */ g(j, { children: [b ? /* @__PURE__ */ h(I, {
|
|
147
|
+
renderTrigger: b,
|
|
148
|
+
placeholder: c,
|
|
149
|
+
allSelectedLabel: N.allSelectedLabel
|
|
150
|
+
}) : /* @__PURE__ */ h(F, {
|
|
151
|
+
placeholder: c,
|
|
152
|
+
allSelectedLabel: N.allSelectedLabel
|
|
153
|
+
}), /* @__PURE__ */ h(T, {
|
|
153
154
|
asChild: !0,
|
|
154
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ h("svg", {
|
|
155
156
|
width: "24",
|
|
156
157
|
height: "24",
|
|
157
158
|
viewBox: "0 0 24 24",
|
|
158
159
|
fill: "none",
|
|
159
160
|
xmlns: "http://www.w3.org/2000/svg",
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
+
children: /* @__PURE__ */ h("path", {
|
|
161
162
|
fillRule: "evenodd",
|
|
162
163
|
clipRule: "evenodd",
|
|
163
164
|
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",
|
|
164
165
|
fill: "currentColor"
|
|
165
166
|
})
|
|
166
167
|
})
|
|
167
|
-
})] }), /* @__PURE__ */
|
|
168
|
-
disabled:
|
|
168
|
+
})] }), /* @__PURE__ */ h(S, {
|
|
169
|
+
disabled: N.readOnly,
|
|
169
170
|
asChild: !0,
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
+
children: /* @__PURE__ */ h("button", { children: /* @__PURE__ */ h("svg", {
|
|
171
172
|
width: "20",
|
|
172
173
|
height: "20",
|
|
173
174
|
viewBox: "0 0 20 20",
|
|
174
175
|
fill: "none",
|
|
175
176
|
xmlns: "http://www.w3.org/2000/svg",
|
|
176
|
-
children: /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ h("path", {
|
|
177
178
|
fillRule: "evenodd",
|
|
178
179
|
clipRule: "evenodd",
|
|
179
180
|
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",
|
|
@@ -181,43 +182,43 @@ function R({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positio
|
|
|
181
182
|
})
|
|
182
183
|
}) })
|
|
183
184
|
})] }),
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
when:
|
|
186
|
-
wrapper: (e) => /* @__PURE__ */
|
|
187
|
-
container:
|
|
185
|
+
/* @__PURE__ */ h(r, {
|
|
186
|
+
when: u,
|
|
187
|
+
wrapper: (e) => /* @__PURE__ */ h(a, {
|
|
188
|
+
container: B,
|
|
188
189
|
children: e
|
|
189
190
|
}),
|
|
190
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ h(A, { children: /* @__PURE__ */ h(C, { children: e.length === 0 ? /* @__PURE__ */ h(n, {
|
|
191
192
|
px: "space-8",
|
|
192
193
|
textAlign: "center",
|
|
193
|
-
children:
|
|
194
|
-
}) :
|
|
195
|
-
height: Math.min(
|
|
194
|
+
children: l ?? P.noResults
|
|
195
|
+
}) : k ? /* @__PURE__ */ h(m, { children: /* @__PURE__ */ h(v, {
|
|
196
|
+
height: Math.min(M * e.length, 180),
|
|
196
197
|
itemCount: e.length,
|
|
197
|
-
itemSize:
|
|
198
|
+
itemSize: M,
|
|
198
199
|
width: "100%",
|
|
199
|
-
children: ({ index: n, style: i }) => /* @__PURE__ */
|
|
200
|
+
children: ({ index: n, style: i }) => /* @__PURE__ */ h(r, {
|
|
200
201
|
when: !!e[n].tooltip,
|
|
201
|
-
wrapper: (r) => /* @__PURE__ */
|
|
202
|
+
wrapper: (r) => /* @__PURE__ */ h(t, {
|
|
202
203
|
label: e[n].tooltip,
|
|
203
204
|
children: r
|
|
204
205
|
}),
|
|
205
|
-
children: /* @__PURE__ */
|
|
206
|
+
children: /* @__PURE__ */ h(E, {
|
|
206
207
|
item: e[n],
|
|
207
208
|
style: i,
|
|
208
|
-
children: /* @__PURE__ */
|
|
209
|
-
renderItem:
|
|
209
|
+
children: /* @__PURE__ */ h(L, {
|
|
210
|
+
renderItem: y,
|
|
210
211
|
item: e[n]
|
|
211
212
|
})
|
|
212
213
|
}, e[n].value)
|
|
213
214
|
}, e[n].value)
|
|
214
|
-
}) }) :
|
|
215
|
+
}) }) : R(e).map((e, t) => e.label === void 0 ? /* @__PURE__ */ h(f, { children: e.items.map(V) }, `group-${t}`) : /* @__PURE__ */ g(D, { children: [/* @__PURE__ */ h(O, { children: e.label }), e.items.map(V)] }, `group-${t}`)) }) })
|
|
215
216
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ h(o.HiddenSelect, {})
|
|
217
218
|
]
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
221
|
//#endregion
|
|
221
|
-
export {
|
|
222
|
+
export { z as Select };
|
|
222
223
|
|
|
223
224
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemGroup = withContext(styled(ArkSelect.ItemGroup), 'itemGroup')\nconst ItemGroupLabel = withContext(styled(ArkSelect.ItemGroupLabel), 'itemGroupLabel')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n /**\n * Heading for the group this item belongs to. Consecutive items sharing a label are\n * wrapped in one labelled group, so the heading is announced by screen readers instead\n * of being faked with a decorative row inside `renderItem`. Items without a label stay\n * ungrouped. Ignored by the virtualized list (fixed row heights).\n */\n groupLabel?: string\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\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 SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\n/**\n * Splits the flat item list into consecutive runs sharing a `groupLabel`. Runs are built\n * from adjacency rather than by collecting every item with the same label, so the caller\n * keeps full control of the order: sorting is the caller's business, grouping is ours.\n */\nfunction toGroupRuns<Item extends SelectItem>(items: readonly Item[]) {\n const runs: Array<{ label?: string; items: Item[] }> = []\n\n for (const item of items) {\n const current = runs[runs.length - 1]\n if (current && current.label === item.groupLabel) {\n current.items.push(item)\n continue\n }\n runs.push({ label: item.groupLabel, items: [item] })\n }\n\n return runs\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n const renderOption = (item: Item) => (\n <Fragment key={item.value}>\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={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n )\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\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 </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? 'Aucun résultat'}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n toGroupRuns<Item>(items).map((run, runIndex) =>\n run.label === undefined ? (\n <Fragment key={`group-${runIndex}`}>{run.items.map(renderOption)}</Fragment>\n ) : (\n <ItemGroup key={`group-${runIndex}`}>\n <ItemGroupLabel>{run.label}</ItemGroupLabel>\n {run.items.map(renderOption)}\n </ItemGroup>\n ),\n )\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAM,GAGzD,IAAO,EAAa,EAAO,EAAU,IAAS,GAAG,QAAQ,EAC7D,cAAc,EACZ,WAAW,GACb,EACF,CAAC,GAEK,IAAe,EAAY,EAAO,EAAU,YAAY,GAAG,cAAc,GACzE,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IA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AA,IAEF,EAAkB,CAAK,EAAE,KAAK,GAAK,MACjC,EAAI,UAAU,KAAA,IACZ,kBAAC,GAAD,EAAA,UAAqC,EAAI,MAAM,IAAI,CAAY,EAAY,GAA5D,SAAS,GAAmD,IAE3E,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAiB,EAAI,MAAsB,CAAA,GAC1C,EAAI,MAAM,IAAI,CAAY,CAClB,EAAA,GAHK,SAAS,GAGd,CAEf,EAEK,CAAA,EACC,CAAA;GACM,CAAA;GACpB,kBAAC,EAAU,cAAX,CAAyB,CAAA;EACrB;;AAEV"}
|
|
1
|
+
{"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\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(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemGroup = withContext(styled(ArkSelect.ItemGroup), 'itemGroup')\nconst ItemGroupLabel = withContext(styled(ArkSelect.ItemGroupLabel), 'itemGroupLabel')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n /**\n * Heading for the group this item belongs to. Consecutive items sharing a label are\n * wrapped in one labelled group, so the heading is announced by screen readers instead\n * of being faked with a decorative row inside `renderItem`. Items without a label stay\n * ungrouped. Ignored by the virtualized list (fixed row heights).\n */\n groupLabel?: string\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\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 SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\n/**\n * Splits the flat item list into consecutive runs sharing a `groupLabel`. Runs are built\n * from adjacency rather than by collecting every item with the same label, so the caller\n * keeps full control of the order: sorting is the caller's business, grouping is ours.\n */\nfunction toGroupRuns<Item extends SelectItem>(items: readonly Item[]) {\n const runs: Array<{ label?: string; items: Item[] }> = []\n\n for (const item of items) {\n const current = runs[runs.length - 1]\n if (current && current.label === item.groupLabel) {\n current.items.push(item)\n continue\n }\n runs.push({ label: item.groupLabel, items: [item] })\n }\n\n return runs\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const uiLabels = useUiLabels()\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n const renderOption = (item: Item) => (\n <Fragment key={item.value}>\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={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n )\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\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 </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? uiLabels.noResults}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n toGroupRuns<Item>(items).map((run, runIndex) =>\n run.label === undefined ? (\n <Fragment key={`group-${runIndex}`}>{run.items.map(renderOption)}</Fragment>\n ) : (\n <ItemGroup key={`group-${runIndex}`}>\n <ItemGroupLabel>{run.label}</ItemGroupLabel>\n {run.items.map(renderOption)}\n </ItemGroup>\n ),\n )\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAM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AS,OAAO,EAAM,GAAO;OAAU;MAAkB,CAAA;gBAE9E,kBAAC,GAAD;OAA+B,MAAM,EAAM;OAAe;iBACxD,kBAAC,GAAD;QAA6B;QAAY,MAAM,EAAM;OAAS,CAAA;MAC1D,GAFK,EAAM,GAAO,KAElB;KACY,GAPb,EAAM,GAAO,KAOA;IAET,CAAA,EACf,CAAA,IAEF,EAAkB,CAAK,EAAE,KAAK,GAAK,MACjC,EAAI,UAAU,KAAA,IACZ,kBAAC,GAAD,EAAA,UAAqC,EAAI,MAAM,IAAI,CAAY,EAAY,GAA5D,SAAS,GAAmD,IAE3E,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAiB,EAAI,MAAsB,CAAA,GAC1C,EAAI,MAAM,IAAI,CAAY,CAClB,EAAA,GAHK,SAAS,GAGd,CAEf,EAEK,CAAA,EACC,CAAA;GACM,CAAA;GACpB,kBAAC,EAAU,cAAX,CAAyB,CAAA;EACrB;;AAEV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../text/Text.cjs"),t=require("../popover/Popover.cjs"),
|
|
1
|
+
"use client";const e=require("../text/Text.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../popover/Popover.cjs"),r=require("./SupplierRatingBreakdown.cjs");let i=require("@stokelp/styled-system/jsx"),a=require("react"),o=require("react/jsx-runtime");function s(e){let t=e/5;return t>=.8?{bg:`#E6F3D9`,color:`#3B6D11`}:t>=.6?{bg:`#FBF1CC`,color:`#92750C`}:t>=.4?{bg:`#FDF0E0`,color:`#C2740C`}:{bg:`#FCEBEB`,color:`#A32D2D`}}function c({rating:c,responseRate:l,labels:u}){let[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),m=(0,a.useCallback)(()=>{p.current&&=(clearTimeout(p.current),null)},[]),h=(0,a.useCallback)(()=>{m(),p.current=setTimeout(()=>f(!1),120)},[m]);(0,a.useEffect)(()=>m,[m]);let g=e=>{e.pointerType===`mouse`&&(m(),f(!0))},_=e=>{e.pointerType===`mouse`&&h()},v=c.insufficientData||c.overall==null,y=t.useUiLabels(),b=u?.insufficientData??y.supplierRating.insufficientData,x=v?{bg:`#F1F2F4`,color:`#5B6472`}:s(c.overall);return(0,o.jsxs)(n.Popover,{open:d,onOpenChange:e=>f(e.open),positioning:{placement:`top-end`,gutter:8},autoFocus:!1,restoreFocus:!1,lazyMount:!0,unmountOnExit:!0,children:[(0,o.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(i.Box,{display:`inline-flex`,alignItems:`center`,w:`fit-content`,maxW:`100%`,px:`space-8`,py:`space-2`,borderRadius:`full`,tabIndex:0,cursor:`default`,style:{backgroundColor:x.bg},onPointerEnter:g,onPointerLeave:_,onFocus:()=>{m(),f(!0)},onBlur:()=>f(!1),children:(0,o.jsx)(e.Text,{size:`sm`,bold:!0,whiteSpace:`nowrap`,style:{color:x.color},children:v?b:`${r.formatOverall(c.overall,y.locale)} ★`})})}),(0,o.jsx)(n.PopoverContent,{className:`panda-preflight-enabled`,zIndex:1e4,p:`0`,bg:`transparent`,border:`none`,borderRadius:`radius-8`,boxShadow:`0px 8px 16px 4px #1624861A`,onPointerEnter:g,onPointerLeave:_,children:(0,o.jsx)(r.SupplierRatingBreakdown,{rating:c,responseRate:l,labels:u})})]})}exports.SupplierRatingBadge=c;
|
|
2
2
|
//# sourceMappingURL=SupplierRatingBadge.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupplierRatingBadge.cjs","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBadge.tsx"],"sourcesContent":["import { Box } from '@stokelp/styled-system/jsx'\nimport { PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\n\nimport { Popover, PopoverContent, PopoverTrigger, Text } from '~/components'\n\nimport {\n
|
|
1
|
+
{"version":3,"file":"SupplierRatingBadge.cjs","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBadge.tsx"],"sourcesContent":["import { Box } from '@stokelp/styled-system/jsx'\nimport { PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\n\nimport { Popover, PopoverContent, PopoverTrigger, Text } from '~/components'\n\nimport {\n formatOverall,\n SUPPLIER_RATING_MAX,\n SupplierRatingBreakdown,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './SupplierRatingBreakdown'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\n\nexport type SupplierRatingBadgeProps = {\n rating: SupplierRating\n /** Optional original response rate (0..100) reminded inside the breakdown. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nfunction getBadgeColors(overall: number): { bg: string; color: string } {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.8) return { bg: '#E6F3D9', color: '#3B6D11' }\n if (ratio >= 0.6) return { bg: '#FBF1CC', color: '#92750C' }\n if (ratio >= 0.4) return { bg: '#FDF0E0', color: '#C2740C' }\n return { bg: '#FCEBEB', color: '#A32D2D' }\n}\n\n/** Compact supplier-rating pill (note /5) with an accessible, keyboard-openable breakdown popover. */\nexport function SupplierRatingBadge({ rating, responseRate, labels }: SupplierRatingBadgeProps) {\n const [open, setOpen] = useState(false)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const scheduleClose = useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setOpen(false), 120)\n }, [cancelClose])\n\n useEffect(() => cancelClose, [cancelClose])\n\n const openOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n cancelClose()\n setOpen(true)\n }\n const closeOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n scheduleClose()\n }\n\n const insufficient = rating.insufficientData || rating.overall == null\n const uiLabels = useUiLabels()\n const insufficientLabel = labels?.insufficientData ?? uiLabels.supplierRating.insufficientData\n const colors = insufficient ? { bg: '#F1F2F4', color: '#5B6472' } : getBadgeColors(rating.overall as number)\n\n return (\n <Popover\n open={open}\n onOpenChange={e => setOpen(e.open)}\n positioning={{ placement: 'top-end', gutter: 8 }}\n autoFocus={false}\n restoreFocus={false}\n lazyMount\n unmountOnExit\n >\n <PopoverTrigger asChild>\n <Box\n display=\"inline-flex\"\n alignItems=\"center\"\n w=\"fit-content\"\n maxW=\"100%\"\n px=\"space-8\"\n py=\"space-2\"\n borderRadius=\"full\"\n tabIndex={0}\n cursor=\"default\"\n style={{ backgroundColor: colors.bg }}\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n onFocus={() => {\n cancelClose()\n setOpen(true)\n }}\n onBlur={() => setOpen(false)}\n >\n <Text size=\"sm\" bold whiteSpace=\"nowrap\" style={{ color: colors.color }}>\n {insufficient ? insufficientLabel : `${formatOverall(rating.overall as number, uiLabels.locale)} ★`}\n </Text>\n </Box>\n </PopoverTrigger>\n <PopoverContent\n className=\"panda-preflight-enabled\"\n zIndex={10000}\n p=\"0\"\n bg=\"transparent\"\n border=\"none\"\n borderRadius=\"radius-8\"\n boxShadow=\"0px 8px 16px 4px #1624861A\"\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n >\n <SupplierRatingBreakdown rating={rating} responseRate={responseRate} labels={labels} />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":"6QAqBA,SAAS,EAAe,EAAgD,CACtE,IAAM,EAAQ,EAAA,EAId,OAHI,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvD,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvD,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACpD,CAAE,GAAI,UAAW,MAAO,SAAU,CAC3C,CAGA,SAAgB,EAAoB,CAAE,SAAQ,eAAc,UAAoC,CAC9F,GAAM,CAAC,EAAM,IAAA,EAAA,EAAA,UAAoB,EAAK,EAChC,GAAA,EAAA,EAAA,QAA0D,I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