@stokelp/ui 4.0.0 → 4.0.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.
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../utils/slots.cjs"),t=require("../tooltip/Tooltip.cjs"),n=require("../text/Text.cjs"),r=require("../../shared/ConditionalWrapper.cjs"),i=require("../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({index:e,style:n,ariaAttributes:i,items:a,renderItem:o}){let s=a[e];return(0,l.jsx)(r.ConditionalWrapper,{when:!!s.tooltip,wrapper:e=>(0,l.jsx)(t.Tooltip,{label:s.tooltip,children:e}),children:(0,l.jsx)(y,{item:s,style:n,"aria-posinset":i[`aria-posinset`],"aria-setsize":i[`aria-setsize`],children:(0,l.jsx)(A,{renderItem:o,item:s})})})}function M(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.label===n.groupLabel?e.items.push(n):t.push({label:n.groupLabel,items:[n]})}return t}function N({items:e,placeholder:o,emptyLabel:s,usePortal:f=!0,positioning:p,renderItem:S,renderTrigger:T,virtualized:E,rowHeight:D=34,...N}){let P=i.useUiLabels(),F=(0,a.createListCollection)({items:e}),I=(0,c.useRef)(null),L=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:N.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:F,positioning:{sameWidth:!0,gutter:0,...p},"data-recipe":`select`,...N,ref:e=>{e&&(I.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:N.allSelectedLabel}):(0,l.jsx)(O,{placeholder:o,allSelectedLabel:N.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:N.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:I,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??P.noResults}):E?(0,l.jsx)(d.List,{role:`presentation`,rowComponent:j,rowProps:{items:e,renderItem:S},rowCount:e.length,rowHeight:D,style:{height:Math.min(D*e.length,180)}}):M(e).map((e,t)=>e.label===void 0?(0,l.jsx)(c.Fragment,{children:e.items.map(L)},`group-${t}`):(0,l.jsxs)(b,{children:[(0,l.jsx)(x,{children:e.label}),e.items.map(L)]},`group-${t}`))})})}),(0,l.jsx)(a.Select.HiddenSelect,{})]})}exports.Select=N;
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({index:e,style:n,ariaAttributes:i,items:a,isMultiple:o,renderItem:s}){let c=a[e];return(0,l.jsx)(r.ConditionalWrapper,{when:!!c.tooltip,wrapper:e=>(0,l.jsx)(t.Tooltip,{label:c.tooltip,children:e}),children:(0,l.jsx)(y,{item:c,style:n,"aria-posinset":i[`aria-posinset`],"aria-setsize":i[`aria-setsize`],children:(0,l.jsx)(A,{renderItem:s,item:c,isMultiple:o})})})}function M(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.label===n.groupLabel?e.items.push(n):t.push({label:n.groupLabel,items:[n]})}return t}function N({items:e,placeholder:o,emptyLabel:s,usePortal:f=!0,positioning:p,renderItem:S,renderTrigger:T,virtualized:E,rowHeight:D=34,...N}){let P=i.useUiLabels(),F=(0,a.createListCollection)({items:e}),I=(0,c.useRef)(null),L=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:N.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:F,positioning:{sameWidth:!0,gutter:0,...p},"data-recipe":`select`,...N,ref:e=>{e&&(I.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:N.allSelectedLabel}):(0,l.jsx)(O,{placeholder:o,allSelectedLabel:N.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:N.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:I,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??P.noResults}):E?(0,l.jsx)(d.List,{role:`presentation`,rowComponent:j,rowProps:{items:e,isMultiple:N.multiple,renderItem:S},rowCount:e.length,rowHeight:D,style:{height:Math.min(D*e.length,180)}}):M(e).map((e,t)=>e.label===void 0?(0,l.jsx)(c.Fragment,{children:e.items.map(L)},`group-${t}`):(0,l.jsxs)(b,{children:[(0,l.jsx)(x,{children:e.label}),e.items.map(L)]},`group-${t}`))})})}),(0,l.jsx)(a.Select.HiddenSelect,{})]})}exports.Select=N;
2
2
  //# sourceMappingURL=Select.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","names":["createStyleContext","select","styled","ArkSelect","css","useSelectContext","useSelectItemContext","_Fragment","ConditionalWrapper","Tooltip","useUiLabels","createListCollection","useRef","Fragment","Portal","Text","List","require_slots","require_Tooltip","require_Text","require_ConditionalWrapper","require_UiLabelsProvider","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","_stokelp_styled_system_css","react_window","Root","withProvider","ClearTrigger","withContext","Content","Control","Indicator","Item","ItemGroup","ItemGroupLabel","ItemText","Positioner","Trigger","ValueText","MultipleUncheckedIndicator","MultipleCheckedIndicator","DefaultInnerTrigger","context","items","selectedItems","item","allSelectedLabel","CustomInnerTrigger","renderTrigger","CustomInnerItem","isMultiple","renderItem","VirtualRow","index","ariaAttributes","toGroupRuns","runs","current","Select","props","uiLabels","collection","$dialogContent","renderOption","positioning","node","usePortal","emptyLabel","virtualized","rowHeight","run","runIndex"],"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 { List, type RowComponentProps } 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\ninterface VirtualRowProps<Item extends SelectItem> {\n items: readonly Item[]\n renderItem?: (item: Item) => ReactNode\n}\n\n// Declared at module level: react-window memoizes the row component by identity, so a\n// component created during render would remount every visible row on each render.\nfunction VirtualRow<Item extends SelectItem>({\n index,\n style,\n ariaAttributes,\n items,\n renderItem,\n}: RowComponentProps<VirtualRowProps<Item>>) {\n const item = items[index]\n\n return (\n <ConditionalWrapper when={!!item.tooltip} wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}>\n {/* Only the position attributes: the option keeps its role from Ark, not react-window's listitem. */}\n <Item\n item={item}\n style={style}\n aria-posinset={ariaAttributes['aria-posinset']}\n aria-setsize={ariaAttributes['aria-setsize']}\n >\n <CustomInnerItem renderItem={renderItem} item={item} />\n </Item>\n </ConditionalWrapper>\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 // role=\"presentation\" overrides the list's own role=\"list\": the options must stay\n // owned by the listbox.\n <List\n role=\"presentation\"\n rowComponent={VirtualRow<Item>}\n rowProps={{ items, renderItem }}\n rowCount={items.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * items.length, 180) }}\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":"A,+bAsBA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,MAAM,EAGzD4B,EAAOC,GAAA,EAAa5B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK4B,EAAeC,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,YAAY,EAAG,cAAc,EACzE8B,EAAUD,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,OAAO,EAAG,SAAS,EAC1D+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EAAW,QAAS,IAAY,EAAA5C,EAAA,IAAA,CAACZ,EAAAA,OAAD,CAAQ,UAAWoD,EAAiB,UAAiB,CAAA,EAC7G,UAAA,EAAAxC,EAAA,IAAA,CAACc,EAAD,CAAA,UACE,EAAAd,EAAA,IAAA,CAACO,EAAD,CAAA,SACGc,EAAM,SAAW,GAChB,EAAArB,EAAA,IAAA,CAACX,EAAAA,KAAD,CAAM,GAAG,UAAU,UAAU,SAC1B,SAAAwD,GAAcP,EAAS,SACpB,CAAA,EACJQ,GAGF,EAAA9C,EAAA,IAAA,CAACV,EAAAA,KAAD,CACE,KAAK,eACL,aAAcwC,EACd,SAAU,CAAE,QAAO,YAAW,EAC9B,SAAUT,EAAM,OACL,YACX,MAAO,CAAE,OAAQ,KAAK,IAAI0B,EAAY1B,EAAM,OAAQ,GAAG,CAAE,CAC1D,CAAA,EAEDY,EAAkBZ,CAAK,CAAC,CAAC,KAAK,EAAK,IACjC2B,EAAI,QAAU,IAAA,IACZ,EAAAhD,EAAA,IAAA,CAACb,EAAAA,SAAD,CAAA,SAAqC6D,EAAI,MAAM,IAAIP,CAAY,CAAY,EAA5D,SAASQ,GAAmD,GAE3E,EAAAjD,EAAA,KAAA,CAACW,EAAD,CAAA,SAAA,EACE,EAAAX,EAAA,IAAA,CAACY,EAAD,CAAA,SAAiBoC,EAAI,KAAsB,CAAA,EAC1CA,EAAI,MAAM,IAAIP,CAAY,CAClB,CAAA,EAHK,SAASQ,GAGd,CAEf,CAEK,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAAjD,EAAA,IAAA,CAACvB,EAAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,C,EAEV,C"}
1
+ {"version":3,"file":"Select.cjs","names":["createStyleContext","select","styled","ArkSelect","css","useSelectContext","useSelectItemContext","_Fragment","ConditionalWrapper","Tooltip","useUiLabels","createListCollection","useRef","Fragment","Portal","Text","List","require_slots","require_Tooltip","require_Text","require_ConditionalWrapper","require_UiLabelsProvider","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","_stokelp_styled_system_css","react_window","Root","withProvider","ClearTrigger","withContext","Content","Control","Indicator","Item","ItemGroup","ItemGroupLabel","ItemText","Positioner","Trigger","ValueText","MultipleUncheckedIndicator","MultipleCheckedIndicator","DefaultInnerTrigger","context","items","selectedItems","item","allSelectedLabel","CustomInnerTrigger","renderTrigger","CustomInnerItem","isMultiple","renderItem","VirtualRow","index","ariaAttributes","toGroupRuns","runs","current","Select","props","uiLabels","collection","$dialogContent","renderOption","positioning","node","usePortal","emptyLabel","virtualized","rowHeight","run","runIndex"],"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 { List, type RowComponentProps } 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\ninterface VirtualRowProps<Item extends SelectItem> {\n items: readonly Item[]\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\n// Declared at module level: react-window memoizes the row component by identity, so a\n// component created during render would remount every visible row on each render.\nfunction VirtualRow<Item extends SelectItem>({\n index,\n style,\n ariaAttributes,\n items,\n isMultiple,\n renderItem,\n}: RowComponentProps<VirtualRowProps<Item>>) {\n const item = items[index]\n\n return (\n <ConditionalWrapper when={!!item.tooltip} wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}>\n {/* Only the position attributes: the option keeps its role from Ark, not react-window's listitem. */}\n <Item\n item={item}\n style={style}\n aria-posinset={ariaAttributes['aria-posinset']}\n aria-setsize={ariaAttributes['aria-setsize']}\n >\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={isMultiple} />\n </Item>\n </ConditionalWrapper>\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 // role=\"presentation\" overrides the list's own role=\"list\": the options must stay\n // owned by the listbox.\n <List\n role=\"presentation\"\n rowComponent={VirtualRow<Item>}\n rowProps={{ items, isMultiple: props.multiple, renderItem }}\n rowCount={items.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * items.length, 180) }}\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":"A,+bAsBA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,MAAM,EAGzD4B,EAAOC,GAAA,EAAa5B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK4B,EAAeC,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,YAAY,EAAG,cAAc,EACzE8B,EAAUD,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,OAAO,EAAG,SAAS,EAC1D+B,EAAUF,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,OAAO,EAAG,SAAS,EAC1DgC,EAAYH,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,SAAS,EAAG,WAAW,EAChEiC,EAAOJ,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,IAAI,EAAG,MAAM,EACjDkC,EAAYL,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,SAAS,EAAG,WAAW,EAChEmC,EAAiBN,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,cAAc,EAAG,gBAAgB,EAC/EoC,EAAWP,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,QAAQ,EAAG,UAAU,EAC7DqC,EAAaR,GAAA,EAAY9B,EA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,OAAQ,GAAG,CAAE,CAC1D,CAAA,EAEDY,EAAkBZ,CAAK,CAAC,CAAC,KAAK,EAAK,IACjC2B,EAAI,QAAU,IAAA,IACZ,EAAAhD,EAAA,IAAA,CAACb,EAAAA,SAAD,CAAA,SAAqC6D,EAAI,MAAM,IAAIP,CAAY,CAAY,EAA5D,SAASQ,GAAmD,GAE3E,EAAAjD,EAAA,KAAA,CAACW,EAAD,CAAA,SAAA,EACE,EAAAX,EAAA,IAAA,CAACY,EAAD,CAAA,SAAiBoC,EAAI,KAAsB,CAAA,EAC1CA,EAAI,MAAM,IAAIP,CAAY,CAClB,CAAA,EAHK,SAASQ,GAGd,CAEf,CAEK,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAAjD,EAAA,IAAA,CAACvB,EAAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,C,EAEV,C"}
@@ -88,22 +88,23 @@ function L({ item: e, isMultiple: t, renderItem: n }) {
88
88
  children: e.label
89
89
  })] });
90
90
  }
91
- function R({ index: e, style: n, ariaAttributes: i, items: a, renderItem: o }) {
92
- let s = a[e];
91
+ function R({ index: e, style: n, ariaAttributes: i, items: a, isMultiple: o, renderItem: s }) {
92
+ let c = a[e];
93
93
  return /* @__PURE__ */ h(r, {
94
- when: !!s.tooltip,
94
+ when: !!c.tooltip,
95
95
  wrapper: (e) => /* @__PURE__ */ h(t, {
96
- label: s.tooltip,
96
+ label: c.tooltip,
97
97
  children: e
98
98
  }),
99
99
  children: /* @__PURE__ */ h(E, {
100
- item: s,
100
+ item: c,
101
101
  style: n,
102
102
  "aria-posinset": i["aria-posinset"],
103
103
  "aria-setsize": i["aria-setsize"],
104
104
  children: /* @__PURE__ */ h(L, {
105
- renderItem: o,
106
- item: s
105
+ renderItem: s,
106
+ item: c,
107
+ isMultiple: o
107
108
  })
108
109
  })
109
110
  });
@@ -213,6 +214,7 @@ function B({ items: e, placeholder: c, emptyLabel: l, usePortal: u = !0, positio
213
214
  rowComponent: R,
214
215
  rowProps: {
215
216
  items: e,
217
+ isMultiple: M.multiple,
216
218
  renderItem: m
217
219
  },
218
220
  rowCount: e.length,
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["ArkSelect","_Fragment","Tooltip","Select","Tooltip$1","Fragment$1","createStyleContext","select","Root","withProvider","styled","Select","ClearTrigger","withContext","Content","Control","Indicator","Item","ItemGroup","ItemGroupLabel","ItemText","Positioner","Trigger","ValueText","MultipleUncheckedIndicator","css","MultipleCheckedIndicator","DefaultInnerTrigger","context","useSelectContext","items","selectedItems","item","allSelectedLabel","CustomInnerTrigger","renderTrigger","CustomInnerItem","useSelectItemContext","isMultiple","renderItem","VirtualRow","index","ConditionalWrapper","ariaAttributes","toGroupRuns","runs","current","Select$1","props","uiLabels","useUiLabels","collection","createListCollection","$dialogContent","useRef","renderOption","Fragment","positioning","node","usePortal","Portal","Text","emptyLabel","virtualized","List","rowHeight","run","runIndex"],"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 { List, type RowComponentProps } 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\ninterface VirtualRowProps<Item extends SelectItem> {\n items: readonly Item[]\n renderItem?: (item: Item) => ReactNode\n}\n\n// Declared at module level: react-window memoizes the row component by identity, so a\n// component created during render would remount every visible row on each render.\nfunction VirtualRow<Item extends SelectItem>({\n index,\n style,\n ariaAttributes,\n items,\n renderItem,\n}: RowComponentProps<VirtualRowProps<Item>>) {\n const item = items[index]\n\n return (\n <ConditionalWrapper when={!!item.tooltip} wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}>\n {/* Only the position attributes: the option keeps its role from Ark, not react-window's listitem. */}\n <Item\n item={item}\n style={style}\n aria-posinset={ariaAttributes['aria-posinset']}\n aria-setsize={ariaAttributes['aria-setsize']}\n >\n <CustomInnerItem renderItem={renderItem} item={item} />\n </Item>\n </ConditionalWrapper>\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 // role=\"presentation\" overrides the list's own role=\"list\": the options must stay\n // owned by the listbox.\n <List\n role=\"presentation\"\n rowComponent={VirtualRow<Item>}\n rowProps={{ items, renderItem }}\n rowCount={items.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * items.length, 180) }}\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,mBAAgBM,EAAmBC,CAAM,GAGzDC,IAAOC,EAAaC,EAAOV,EAAU,IAAS,GAAG,QAAQ,EAC7D,cAAc,EACZ,WAAW,GACb,EACF,CAAC,GAEKY,IAAeC,EAAYH,EAAOV,EAAU,YAAY,GAAG,cAAc,GACzEc,IAAUD,EAAYH,EAAOV,EAAU,OAAO,GAAG,SAAS,GAC1De,IAAUF,EAAYH,EAAOV,EAAU,OAAO,GAAG,SAAS,GAC1DgB,IAAYH,EAAYH,EAAOV,EAAU,SAAS,GAAG,WAAW,GAChEiB,IAAOJ,EAAYH,EAAOV,EAAU,IAAI,GAAG,MAAM,GACjDkB,IAAYL,EAAYH,EAAOV,EAAU,SAAS,GAAG,WAAW,GAChEmB,IAAiBN,EAAYH,EAAOV,EAAU,cAAc,GAAG,gBAAgB,GAC/EoB,IAAWP,EAAYH,EAAOV,EAAU,QAAQ,GAAG,UAAU,GAC7DqB,IAAaR,EAAYH,EAAOV,EAAU,UAAU,GAAG,YAAY,GACnEsB,IAAUT,EAAYH,EAAOV,EAAU,OAAO,GAAG,SAAS,GAC1DuB,IAAYV,EAAYH,EAAOV,EAAU,SAAS,GAAG,WAAW,GAkChEwB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AAA,UAAqCU,EAAI,MAAM,IAAIX,CAAY,EAAY,GAA5D,SAASY,GAAmD,IAE3E,kBAACjD,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAiB+C,EAAI,MAAsB,CAAA,GAC1CA,EAAI,MAAM,IAAIX,CAAY,CAClB,EAAA,GAHK,SAASY,GAGd,CAEf,EAEK,CAAA,EACC,CAAA;GACM,CAAA;GACpB,kBAACnE,EAAU,cAAX,CAAyB,CAAA;EACrB;;AAEV"}
1
+ {"version":3,"file":"Select.js","names":["ArkSelect","_Fragment","Tooltip","Select","Tooltip$1","Fragment$1","createStyleContext","select","Root","withProvider","styled","Select","ClearTrigger","withContext","Content","Control","Indicator","Item","ItemGroup","ItemGroupLabel","ItemText","Positioner","Trigger","ValueText","MultipleUncheckedIndicator","css","MultipleCheckedIndicator","DefaultInnerTrigger","context","useSelectContext","items","selectedItems","item","allSelectedLabel","CustomInnerTrigger","renderTrigger","CustomInnerItem","useSelectItemContext","isMultiple","renderItem","VirtualRow","index","ConditionalWrapper","ariaAttributes","toGroupRuns","runs","current","Select$1","props","uiLabels","useUiLabels","collection","createListCollection","$dialogContent","useRef","renderOption","Fragment","positioning","node","usePortal","Portal","Text","emptyLabel","virtualized","List","rowHeight","run","runIndex"],"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 { List, type RowComponentProps } 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\ninterface VirtualRowProps<Item extends SelectItem> {\n items: readonly Item[]\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\n// Declared at module level: react-window memoizes the row component by identity, so a\n// component created during render would remount every visible row on each render.\nfunction VirtualRow<Item extends SelectItem>({\n index,\n style,\n ariaAttributes,\n items,\n isMultiple,\n renderItem,\n}: RowComponentProps<VirtualRowProps<Item>>) {\n const item = items[index]\n\n return (\n <ConditionalWrapper when={!!item.tooltip} wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}>\n {/* Only the position attributes: the option keeps its role from Ark, not react-window's listitem. */}\n <Item\n item={item}\n style={style}\n aria-posinset={ariaAttributes['aria-posinset']}\n aria-setsize={ariaAttributes['aria-setsize']}\n >\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={isMultiple} />\n </Item>\n </ConditionalWrapper>\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 // role=\"presentation\" overrides the list's own role=\"list\": the options must stay\n // owned by the listbox.\n <List\n role=\"presentation\"\n rowComponent={VirtualRow<Item>}\n rowProps={{ items, isMultiple: props.multiple, renderItem }}\n rowCount={items.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * items.length, 180) }}\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,mBAAgBM,EAAmBC,CAAM,GAGzDC,IAAOC,EAAaC,EAAOV,EAAU,IAAS,GAAG,QAAQ,EAC7D,cAAc,EACZ,WAAW,GACb,EACF,CAAC,GAEKY,IAAeC,EAAYH,EAAOV,EAAU,YAAY,GAAG,cAAc,GACzEc,IAAUD,EAAYH,EAAOV,EAAU,OAAO,GAAG,SAAS,GAC1De,IAAUF,EAAYH,EAAOV,EAAU,OAAO,GAAG,SAAS,GAC1DgB,IAAYH,EAAYH,EAAOV,EAAU,SAAS,GAAG,WAAW,GAChEiB,IAAOJ,EAAYH,EAAOV,EAAU,IAAI,GAAG,MAAM,GACjDkB,IAAYL,EAAYH,EAAOV,EAAU,SAAS,GAAG,WAAW,GAChEmB,IAAi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B,CAAA,IACJc,IAGF,kBAACC,GAAD;KACE,MAAK;KACL,cAAcxB;KACd,UAAU;MAAE;MAAO,YAAYQ,EAAM;MAAU;KAAW;KAC1D,UAAUlB,EAAM;KACL;KACX,OAAO,EAAE,QAAQ,KAAK,IAAImC,IAAYnC,EAAM,QAAQ,GAAG,EAAE;IAC1D,CAAA,IAEDc,EAAkBd,CAAK,CAAC,CAAC,KAAK,GAAK,MACjCoC,EAAI,UAAU,KAAA,IACZ,kBAACV,GAAD,EAAA,UAAqCU,EAAI,MAAM,IAAIX,CAAY,EAAY,GAA5D,SAASY,GAAmD,IAE3E,kBAACjD,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAiB+C,EAAI,MAAsB,CAAA,GAC1CA,EAAI,MAAM,IAAIX,CAAY,CAClB,EAAA,GAHK,SAASY,GAGd,CAEf,EAEK,CAAA,EACC,CAAA;GACM,CAAA;GACpB,kBAACnE,EAAU,cAAX,CAAyB,CAAA;EACrB;;AAEV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokelp/ui",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Stokelp UI React",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",