@stokelp/ui 2.119.1 → 2.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.cjs.map +1 -1
- package/dist/components/select/Select.d.ts +12 -0
- package/dist/components/select/Select.js +93 -69
- package/dist/components/select/Select.js.map +1 -1
- package/dist/theme/recipes/tag.cjs +1 -1
- package/dist/theme/recipes/tag.cjs.map +1 -1
- package/dist/theme/recipes/tag.js +8 -0
- package/dist/theme/recipes/tag.js.map +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../utils/slots.cjs"),t=require("../tooltip/Tooltip.cjs"),n=require("../text/Text.cjs"),r=require("../../shared/ConditionalWrapper.cjs");let i=require("@ark-ui/react"),a=require("@stokelp/styled-system/jsx"),o=require("@stokelp/styled-system/recipes"),s=require("react"),c=require("react/jsx-runtime"),l=require("@stokelp/styled-system/css"),u=require("react-window");var{withProvider:d,withContext:f}=e.createStyleContext(o.select),p=d((0,a.styled)(i.Select.Root),`root`,{defaultProps:{loopFocus:!0}}),m=f((0,a.styled)(i.Select.ClearTrigger),`clearTrigger`),h=f((0,a.styled)(i.Select.Content),`content`),g=f((0,a.styled)(i.Select.Control),`control`),_=f((0,a.styled)(i.Select.Indicator),`indicator`),v=f((0,a.styled)(i.Select.Item),`item`),y=f((0,a.styled)(i.Select.ItemText),`itemText`),
|
|
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 i=require("@ark-ui/react"),a=require("@stokelp/styled-system/jsx"),o=require("@stokelp/styled-system/recipes"),s=require("react"),c=require("react/jsx-runtime"),l=require("@stokelp/styled-system/css"),u=require("react-window");var{withProvider:d,withContext:f}=e.createStyleContext(o.select),p=d((0,a.styled)(i.Select.Root),`root`,{defaultProps:{loopFocus:!0}}),m=f((0,a.styled)(i.Select.ClearTrigger),`clearTrigger`),h=f((0,a.styled)(i.Select.Content),`content`),g=f((0,a.styled)(i.Select.Control),`control`),_=f((0,a.styled)(i.Select.Indicator),`indicator`),v=f((0,a.styled)(i.Select.Item),`item`),y=f((0,a.styled)(i.Select.ItemGroup),`itemGroup`),b=f((0,a.styled)(i.Select.ItemGroupLabel),`itemGroupLabel`),x=f((0,a.styled)(i.Select.ItemText),`itemText`),S=f((0,a.styled)(i.Select.Positioner),`positioner`),C=f((0,a.styled)(i.Select.Trigger),`trigger`),w=f((0,a.styled)(i.Select.ValueText),`valueText`),T=()=>(0,c.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,c.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,l.css)({stroke:`grey.100`})})]}),E=()=>(0,c.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,l.css)({fill:`primary.500`})}),(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z`,fill:`white`})]});function D({placeholder:e,allSelectedLabel:t}){let n=(0,i.useSelectContext)(),r=n.collection.items,a=n.selectedItems;return n.multiple&&a.filter(e=>!e.disabled).length>=r.filter(e=>!e.disabled).length&&t?(0,c.jsx)(w,{className:`custom`,truncate:!0,children:t}):(0,c.jsx)(w,{truncate:!0,placeholder:e})}function O({renderTrigger:e,placeholder:t,allSelectedLabel:n}){let r=(0,i.useSelectContext)(),a=r.value&&r.value.length>0?r.collection.findMany(r.value):[];if(a.length===0)return(0,c.jsx)(w,{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,c.jsx)(w,{className:`custom`,truncate:!0,children:n}):(0,c.jsx)(w,{className:`custom`,placeholder:t,children:a.map(t=>(0,c.jsx)(`span`,{children:e(t)},t.value))})}function k({item:e,isMultiple:t,renderItem:n}){let r=(0,i.useSelectItemContext)();return(0,c.jsxs)(c.Fragment,{children:[t?r.selected?(0,c.jsx)(E,{}):(0,c.jsx)(T,{}):null,n?n(e):(0,c.jsx)(x,{truncate:!0,children:e.label})]})}function A(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 j({items:e,placeholder:a,emptyLabel:o,usePortal:d=!0,positioning:f,renderItem:x,renderTrigger:w,virtualized:T,rowHeight:E=34,...j}){let M=(0,i.createListCollection)({items:e}),N=(0,s.useRef)(null),P=e=>(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(r.ConditionalWrapper,{when:!!e.tooltip,wrapper:n=>(0,c.jsx)(t.Tooltip,{label:e.tooltip,children:n}),children:(0,c.jsx)(v,{item:e,children:(0,c.jsx)(k,{renderItem:x,item:e,isMultiple:j.multiple})},e.value)},e.value),e.separatorAfter&&(0,c.jsx)(`div`,{role:`separator`,className:(0,l.css)({height:`1px`,flexShrink:0,backgroundColor:`grey.100`,marginY:`space-4`,marginX:`space-8`})})]},e.value);return(0,c.jsxs)(p,{lazyMount:!0,unmountOnExit:!0,collection:M,positioning:{sameWidth:!0,gutter:0,...f},"data-recipe":`select`,...j,ref:e=>{e&&(N.current=e.closest(`[role="dialog"]`))},children:[(0,c.jsxs)(g,{children:[(0,c.jsxs)(C,{children:[w?(0,c.jsx)(O,{renderTrigger:w,placeholder:a,allSelectedLabel:j.allSelectedLabel}):(0,c.jsx)(D,{placeholder:a,allSelectedLabel:j.allSelectedLabel}),(0,c.jsx)(_,{asChild:!0,children:(0,c.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.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,c.jsx)(m,{disabled:j.readOnly,asChild:!0,children:(0,c.jsx)(`button`,{children:(0,c.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.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,c.jsx)(r.ConditionalWrapper,{when:d,wrapper:e=>(0,c.jsx)(i.Portal,{container:N,children:e}),children:(0,c.jsx)(S,{children:(0,c.jsx)(h,{children:e.length===0?(0,c.jsx)(n.Text,{px:`space-8`,textAlign:`center`,children:o??`Aucun résultat`}):T?(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(u.FixedSizeList,{height:Math.min(E*e.length,180),itemCount:e.length,itemSize:E,width:`100%`,children:({index:n,style:i})=>(0,c.jsx)(r.ConditionalWrapper,{when:!!e[n].tooltip,wrapper:r=>(0,c.jsx)(t.Tooltip,{label:e[n].tooltip,children:r}),children:(0,c.jsx)(v,{item:e[n],style:i,children:(0,c.jsx)(k,{renderItem:x,item:e[n]})},e[n].value)},e[n].value)})}):A(e).map((e,t)=>e.label===void 0?(0,c.jsx)(s.Fragment,{children:e.items.map(P)},`group-${t}`):(0,c.jsxs)(y,{children:[(0,c.jsx)(b,{children:e.label}),e.items.map(P)]},`group-${t}`))})})}),(0,c.jsx)(i.Select.HiddenSelect,{})]})}exports.Select=j;
|
|
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, 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 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\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\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 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 items.map((item: Item) => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={props.multiple} />\n </Item>\n </ConditionalWrapper>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":"gZAqBA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,MAAM,EAGzD,EAAO,GAAA,EAAA,EAAA,QAAoB,EAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EACzE,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAY,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,SAAS,EAAG,WAAW,EAChE,EAAO,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,IAAI,EAAG,MAAM,EACjD,EAAW,GA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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 { 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":"gZAqBA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,MAAM,EAGzD,EAAO,GAAA,EAAA,EAAA,QAAoB,EAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EACzE,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAY,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,SAAS,EAAG,WAAW,EAChE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9
|
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Renders a thin divider line after this item, separating option groups.
|
|
12
|
+
* Ignored by the virtualized list (fixed row heights).
|
|
13
|
+
*/
|
|
14
|
+
separatorAfter?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Heading for the group this item belongs to. Consecutive items sharing a label are
|
|
17
|
+
* wrapped in one labelled group, so the heading is announced by screen readers instead
|
|
18
|
+
* of being faked with a decorative row inside `renderItem`. Items without a label stay
|
|
19
|
+
* ungrouped. Ignored by the virtualized list (fixed row heights).
|
|
20
|
+
*/
|
|
21
|
+
groupLabel?: string;
|
|
10
22
|
}
|
|
11
23
|
export type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {
|
|
12
24
|
items: Item[] | readonly Item[];
|
|
@@ -6,136 +6,174 @@ import { ConditionalWrapper as r } from "../../shared/ConditionalWrapper.js";
|
|
|
6
6
|
import { Portal as i, Select as a, createListCollection as o, useSelectContext as s, useSelectItemContext as c } from "@ark-ui/react";
|
|
7
7
|
import { styled as l } from "@stokelp/styled-system/jsx";
|
|
8
8
|
import { select as u } from "@stokelp/styled-system/recipes";
|
|
9
|
-
import {
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { css as
|
|
12
|
-
import { FixedSizeList as
|
|
9
|
+
import { Fragment as d, useRef as f } from "react";
|
|
10
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { css as g } from "@stokelp/styled-system/css";
|
|
12
|
+
import { FixedSizeList as _ } from "react-window";
|
|
13
13
|
//#region src/components/select/Select.tsx
|
|
14
|
-
var { withProvider:
|
|
14
|
+
var { withProvider: v, withContext: y } = e(u), b = v(l(a.Root), "root", { defaultProps: { loopFocus: !0 } }), x = y(l(a.ClearTrigger), "clearTrigger"), S = y(l(a.Content), "content"), C = y(l(a.Control), "control"), w = y(l(a.Indicator), "indicator"), T = y(l(a.Item), "item"), E = y(l(a.ItemGroup), "itemGroup"), D = y(l(a.ItemGroupLabel), "itemGroupLabel"), O = y(l(a.ItemText), "itemText"), k = y(l(a.Positioner), "positioner"), A = y(l(a.Trigger), "trigger"), j = y(l(a.ValueText), "valueText"), M = () => /* @__PURE__ */ h("svg", {
|
|
15
15
|
width: "16",
|
|
16
16
|
height: "17",
|
|
17
17
|
viewBox: "0 0 16 17",
|
|
18
18
|
fill: "none",
|
|
19
19
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ m("rect", {
|
|
21
21
|
x: "0.5",
|
|
22
22
|
y: "1",
|
|
23
23
|
width: "15",
|
|
24
24
|
height: "15",
|
|
25
25
|
rx: "3.5",
|
|
26
26
|
fill: "white"
|
|
27
|
-
}), /* @__PURE__ */
|
|
27
|
+
}), /* @__PURE__ */ m("rect", {
|
|
28
28
|
x: "0.5",
|
|
29
29
|
y: "1",
|
|
30
30
|
width: "15",
|
|
31
31
|
height: "15",
|
|
32
32
|
rx: "3.5",
|
|
33
|
-
className:
|
|
33
|
+
className: g({ stroke: "grey.100" })
|
|
34
34
|
})]
|
|
35
|
-
}),
|
|
35
|
+
}), N = () => /* @__PURE__ */ h("svg", {
|
|
36
36
|
width: "16",
|
|
37
37
|
height: "17",
|
|
38
38
|
viewBox: "0 0 16 17",
|
|
39
39
|
fill: "none",
|
|
40
40
|
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
-
children: [/* @__PURE__ */
|
|
41
|
+
children: [/* @__PURE__ */ m("rect", {
|
|
42
42
|
y: "0.5",
|
|
43
43
|
width: "16",
|
|
44
44
|
height: "16",
|
|
45
45
|
rx: "4",
|
|
46
|
-
className:
|
|
47
|
-
}), /* @__PURE__ */
|
|
46
|
+
className: g({ fill: "primary.500" })
|
|
47
|
+
}), /* @__PURE__ */ m("path", {
|
|
48
48
|
fillRule: "evenodd",
|
|
49
49
|
clipRule: "evenodd",
|
|
50
50
|
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
51
|
fill: "white"
|
|
52
52
|
})]
|
|
53
53
|
});
|
|
54
|
-
function
|
|
54
|
+
function P({ placeholder: e, allSelectedLabel: t }) {
|
|
55
55
|
let n = s(), r = n.collection.items, i = n.selectedItems;
|
|
56
|
-
return n.multiple && i.filter((e) => !e.disabled).length >= r.filter((e) => !e.disabled).length && t ? /* @__PURE__ */
|
|
56
|
+
return n.multiple && i.filter((e) => !e.disabled).length >= r.filter((e) => !e.disabled).length && t ? /* @__PURE__ */ m(j, {
|
|
57
57
|
className: "custom",
|
|
58
58
|
truncate: !0,
|
|
59
59
|
children: t
|
|
60
|
-
}) : /* @__PURE__ */
|
|
60
|
+
}) : /* @__PURE__ */ m(j, {
|
|
61
61
|
truncate: !0,
|
|
62
62
|
placeholder: e
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function F({ renderTrigger: e, placeholder: t, allSelectedLabel: n }) {
|
|
66
66
|
let r = s(), i = r.value && r.value.length > 0 ? r.collection.findMany(r.value) : [];
|
|
67
|
-
if (i.length === 0) return /* @__PURE__ */
|
|
67
|
+
if (i.length === 0) return /* @__PURE__ */ m(j, {
|
|
68
68
|
className: "custom",
|
|
69
69
|
truncate: !0,
|
|
70
70
|
placeholder: t
|
|
71
71
|
});
|
|
72
72
|
let a = r.selectedItems;
|
|
73
|
-
return r.multiple && a.filter((e) => !e.disabled).length >= r.collection.items.filter((e) => !e.disabled).length && n ? /* @__PURE__ */
|
|
73
|
+
return r.multiple && a.filter((e) => !e.disabled).length >= r.collection.items.filter((e) => !e.disabled).length && n ? /* @__PURE__ */ m(j, {
|
|
74
74
|
className: "custom",
|
|
75
75
|
truncate: !0,
|
|
76
76
|
children: n
|
|
77
|
-
}) : /* @__PURE__ */
|
|
77
|
+
}) : /* @__PURE__ */ m(j, {
|
|
78
78
|
className: "custom",
|
|
79
79
|
placeholder: t,
|
|
80
|
-
children: i.map((t) => /* @__PURE__ */
|
|
80
|
+
children: i.map((t) => /* @__PURE__ */ m("span", { children: e(t) }, t.value))
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function I({ item: e, isMultiple: t, renderItem: n }) {
|
|
84
84
|
let r = c();
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ h(p, { children: [t ? r.selected ? /* @__PURE__ */ m(N, {}) : /* @__PURE__ */ m(M, {}) : null, n ? n(e) : /* @__PURE__ */ m(O, {
|
|
86
86
|
truncate: !0,
|
|
87
87
|
children: e.label
|
|
88
88
|
})] });
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
let
|
|
92
|
-
|
|
90
|
+
function L(e) {
|
|
91
|
+
let t = [];
|
|
92
|
+
for (let n of e) {
|
|
93
|
+
let e = t[t.length - 1];
|
|
94
|
+
if (e && e.label === n.groupLabel) {
|
|
95
|
+
e.items.push(n);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
t.push({
|
|
99
|
+
label: n.groupLabel,
|
|
100
|
+
items: [n]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return t;
|
|
104
|
+
}
|
|
105
|
+
function R({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positioning: u, renderItem: v, renderTrigger: y, virtualized: O, rowHeight: j = 34, ...M }) {
|
|
106
|
+
let N = o({ items: e }), R = f(null), z = (e) => /* @__PURE__ */ h(d, { children: [/* @__PURE__ */ m(r, {
|
|
107
|
+
when: !!e.tooltip,
|
|
108
|
+
wrapper: (n) => /* @__PURE__ */ m(t, {
|
|
109
|
+
label: e.tooltip,
|
|
110
|
+
children: n
|
|
111
|
+
}),
|
|
112
|
+
children: /* @__PURE__ */ m(T, {
|
|
113
|
+
item: e,
|
|
114
|
+
children: /* @__PURE__ */ m(I, {
|
|
115
|
+
renderItem: v,
|
|
116
|
+
item: e,
|
|
117
|
+
isMultiple: M.multiple
|
|
118
|
+
})
|
|
119
|
+
}, e.value)
|
|
120
|
+
}, e.value), e.separatorAfter && /* @__PURE__ */ m("div", {
|
|
121
|
+
role: "separator",
|
|
122
|
+
className: g({
|
|
123
|
+
height: "1px",
|
|
124
|
+
flexShrink: 0,
|
|
125
|
+
backgroundColor: "grey.100",
|
|
126
|
+
marginY: "space-4",
|
|
127
|
+
marginX: "space-8"
|
|
128
|
+
})
|
|
129
|
+
})] }, e.value);
|
|
130
|
+
return /* @__PURE__ */ h(b, {
|
|
93
131
|
lazyMount: !0,
|
|
94
132
|
unmountOnExit: !0,
|
|
95
|
-
collection:
|
|
133
|
+
collection: N,
|
|
96
134
|
positioning: {
|
|
97
135
|
sameWidth: !0,
|
|
98
136
|
gutter: 0,
|
|
99
137
|
...u
|
|
100
138
|
},
|
|
101
139
|
"data-recipe": "select",
|
|
102
|
-
...
|
|
140
|
+
...M,
|
|
103
141
|
ref: (e) => {
|
|
104
|
-
e && (
|
|
142
|
+
e && (R.current = e.closest("[role=\"dialog\"]"));
|
|
105
143
|
},
|
|
106
144
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
renderTrigger:
|
|
145
|
+
/* @__PURE__ */ h(C, { children: [/* @__PURE__ */ h(A, { children: [y ? /* @__PURE__ */ m(F, {
|
|
146
|
+
renderTrigger: y,
|
|
109
147
|
placeholder: s,
|
|
110
|
-
allSelectedLabel:
|
|
111
|
-
}) : /* @__PURE__ */
|
|
148
|
+
allSelectedLabel: M.allSelectedLabel
|
|
149
|
+
}) : /* @__PURE__ */ m(P, {
|
|
112
150
|
placeholder: s,
|
|
113
|
-
allSelectedLabel:
|
|
114
|
-
}), /* @__PURE__ */
|
|
151
|
+
allSelectedLabel: M.allSelectedLabel
|
|
152
|
+
}), /* @__PURE__ */ m(w, {
|
|
115
153
|
asChild: !0,
|
|
116
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ m("svg", {
|
|
117
155
|
width: "24",
|
|
118
156
|
height: "24",
|
|
119
157
|
viewBox: "0 0 24 24",
|
|
120
158
|
fill: "none",
|
|
121
159
|
xmlns: "http://www.w3.org/2000/svg",
|
|
122
|
-
children: /* @__PURE__ */
|
|
160
|
+
children: /* @__PURE__ */ m("path", {
|
|
123
161
|
fillRule: "evenodd",
|
|
124
162
|
clipRule: "evenodd",
|
|
125
163
|
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",
|
|
126
164
|
fill: "currentColor"
|
|
127
165
|
})
|
|
128
166
|
})
|
|
129
|
-
})] }), /* @__PURE__ */
|
|
130
|
-
disabled:
|
|
167
|
+
})] }), /* @__PURE__ */ m(x, {
|
|
168
|
+
disabled: M.readOnly,
|
|
131
169
|
asChild: !0,
|
|
132
|
-
children: /* @__PURE__ */
|
|
170
|
+
children: /* @__PURE__ */ m("button", { children: /* @__PURE__ */ m("svg", {
|
|
133
171
|
width: "20",
|
|
134
172
|
height: "20",
|
|
135
173
|
viewBox: "0 0 20 20",
|
|
136
174
|
fill: "none",
|
|
137
175
|
xmlns: "http://www.w3.org/2000/svg",
|
|
138
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ m("path", {
|
|
139
177
|
fillRule: "evenodd",
|
|
140
178
|
clipRule: "evenodd",
|
|
141
179
|
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",
|
|
@@ -143,57 +181,43 @@ function P({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positio
|
|
|
143
181
|
})
|
|
144
182
|
}) })
|
|
145
183
|
})] }),
|
|
146
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ m(r, {
|
|
147
185
|
when: l,
|
|
148
|
-
wrapper: (e) => /* @__PURE__ */
|
|
149
|
-
container:
|
|
186
|
+
wrapper: (e) => /* @__PURE__ */ m(i, {
|
|
187
|
+
container: R,
|
|
150
188
|
children: e
|
|
151
189
|
}),
|
|
152
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ m(k, { children: /* @__PURE__ */ m(S, { children: e.length === 0 ? /* @__PURE__ */ m(n, {
|
|
153
191
|
px: "space-8",
|
|
154
192
|
textAlign: "center",
|
|
155
193
|
children: c ?? "Aucun résultat"
|
|
156
|
-
}) :
|
|
157
|
-
height: Math.min(
|
|
194
|
+
}) : O ? /* @__PURE__ */ m(p, { children: /* @__PURE__ */ m(_, {
|
|
195
|
+
height: Math.min(j * e.length, 180),
|
|
158
196
|
itemCount: e.length,
|
|
159
|
-
itemSize:
|
|
197
|
+
itemSize: j,
|
|
160
198
|
width: "100%",
|
|
161
|
-
children: ({ index: n, style: i }) => /* @__PURE__ */
|
|
199
|
+
children: ({ index: n, style: i }) => /* @__PURE__ */ m(r, {
|
|
162
200
|
when: !!e[n].tooltip,
|
|
163
|
-
wrapper: (r) => /* @__PURE__ */
|
|
201
|
+
wrapper: (r) => /* @__PURE__ */ m(t, {
|
|
164
202
|
label: e[n].tooltip,
|
|
165
203
|
children: r
|
|
166
204
|
}),
|
|
167
|
-
children: /* @__PURE__ */
|
|
205
|
+
children: /* @__PURE__ */ m(T, {
|
|
168
206
|
item: e[n],
|
|
169
207
|
style: i,
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
renderItem:
|
|
208
|
+
children: /* @__PURE__ */ m(I, {
|
|
209
|
+
renderItem: v,
|
|
172
210
|
item: e[n]
|
|
173
211
|
})
|
|
174
212
|
}, e[n].value)
|
|
175
213
|
}, e[n].value)
|
|
176
|
-
}) }) : e.map((e) => /* @__PURE__ */
|
|
177
|
-
when: !!e.tooltip,
|
|
178
|
-
wrapper: (n) => /* @__PURE__ */ p(t, {
|
|
179
|
-
label: e.tooltip,
|
|
180
|
-
children: n
|
|
181
|
-
}),
|
|
182
|
-
children: /* @__PURE__ */ p(w, {
|
|
183
|
-
item: e,
|
|
184
|
-
children: /* @__PURE__ */ p(N, {
|
|
185
|
-
renderItem: h,
|
|
186
|
-
item: e,
|
|
187
|
-
isMultiple: O.multiple
|
|
188
|
-
})
|
|
189
|
-
}, e.value)
|
|
190
|
-
}, e.value)) }) })
|
|
214
|
+
}) }) : L(e).map((e, t) => e.label === void 0 ? /* @__PURE__ */ m(d, { children: e.items.map(z) }, `group-${t}`) : /* @__PURE__ */ h(E, { children: [/* @__PURE__ */ m(D, { children: e.label }), e.items.map(z)] }, `group-${t}`)) }) })
|
|
191
215
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ m(a.HiddenSelect, {})
|
|
193
217
|
]
|
|
194
218
|
});
|
|
195
219
|
}
|
|
196
220
|
//#endregion
|
|
197
|
-
export {
|
|
221
|
+
export { R as Select };
|
|
198
222
|
|
|
199
223
|
//# 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, 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 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\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\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 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 items.map((item: Item) => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={props.multiple} />\n </Item>\n </ConditionalWrapper>\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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B,kBAAC,GAAD;KAAM,IAAG;KAAU,WAAU;eAC1B,KAAc;IACX,CAAA,IACJ,IACF,kBAAA,GAAA,EAAA,UACE,kBAAC,GAAD;KACE,QAAQ,KAAK,IAAI,IAAY,EAAM,QAAQ,GAAG;KAC9C,WAAW,EAAM;KACjB,UAAU;KACV,OAAM;gBAEJ,EAAE,UAAO,eACT,kBAAC,GAAD;MAEE,MAAM,CAAC,CAAC,EAAM,GAAO;MACrB,UAAS,MAAY,kBAAC,GAAD;OAAS,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,EAAM,KAAK,MACT,kBAAC,GAAD;KAEE,MAAM,CAAC,CAAC,EAAK;KACb,UAAS,MAAY,kBAAC,GAAD;MAAS,OAAO,EAAK;MAAU;KAAkB,CAAA;eAEtE,kBAAC,GAAD;MAA6B;gBAC3B,kBAAC,GAAD;OAA6B;OAAkB;OAAM,YAAY,EAAM;MAAW,CAAA;KAC9E,GAFK,EAAK,KAEV;IACY,GAPb,EAAK,KAOQ,CACrB,EAEI,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 { 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,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IAAY,EAAY,EAAO,EAAU,SAAS,GAAG,WAAW,GAChE,IAAO,EAAY,EAAO,EAAU,IAAI,GAAG,MAAM,GACjD,IAAY,EAAY,EAAO,EAAU,SAAS,GAAG,WAAW,GAChE,IAAiB,EAAY,EAAO,EAAU,cAAc,GAAG,gBAAgB,GAC/E,IAAW,EAAY,EAAO,EAAU,QAAQ,GAAG,UAAU,GAC7D,IAAa,EAAY,EAAO,EAAU,UAAU,GAAG,YAAY,GACnE,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IAAY,EAAY,EAAO,EAAU,SAAS,GAAG,WAAW,GAkChE,UACJ,kBAAC,OAAD;CAAK,OAAM;CAAK,QAAO;CAAK,SAAQ;CAAY,MAAK;CAAO,OAAM;WAAlE,CACE,kBAAC,QAAD;EAAM,GAAE;EAAM,GAAE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S,MAAY,kBAAC,GAAD;KAAQ,WAAW;KAAiB;IAAiB,CAAA;cAC7G,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UACG,EAAM,WAAW,IAChB,kBAAC,GAAD;KAAM,IAAG;KAAU,WAAU;eAC1B,KAAc;IACX,CAAA,IACJ,IACF,kBAAA,GAAA,EAAA,UACE,kBAAC,GAAD;KACE,QAAQ,KAAK,IAAI,IAAY,EAAM,QAAQ,GAAG;KAC9C,WAAW,EAAM;KACjB,UAAU;KACV,OAAM;gBAEJ,EAAE,UAAO,eACT,kBAAC,GAAD;MAEE,MAAM,CAAC,CAAC,EAAM,GAAO;MACrB,UAAS,MAAY,kBAAC,GAAD;OAAS,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";var e=(0,require("@pandacss/dev").defineSlotRecipe)({base:{root:{fontFamily:`satoshi`,borderStyle:`solid`,display:`inline-flex`,flexDirection:`row`,alignItems:`center`,borderRadius:`radius-28`}},slots:[`root`,`badge`],className:`tag`,defaultVariants:{size:`md`,severity:`neutral`},description:`The styles for the Tag component`,jsx:[`Tag`],variants:{size:{lg:{root:{borderWidth:2,textStyle:`body.lg`,fontWeight:`bold`,py:`space-8`,px:`space-16`,gap:`space-8`},badge:{width:`size-8`,height:`size-8`}},md:{root:{borderWidth:1,textStyle:`body.md`,fontWeight:`bold`,py:`space-6`,px:`space-12`,gap:`space-8`},badge:{width:`size-6`,height:`size-6`}},sm:{root:{borderWidth:1,textStyle:`body.sm`,fontWeight:`bold`,py:`space-4`,px:`space-8`,gap:`space-4`},badge:{width:`size-4`,height:`size-4`}}},severity:{success:{root:{bg:`success.100`,borderColor:`success.500`,color:`success.500`},badge:{bg:`success.500`}},warning:{root:{bg:`warning.100`,borderColor:`warning.500`,color:`warning.500`},badge:{bg:`warning.500`}},error:{root:{bg:`error.100`,borderColor:`error.500`,color:`error.500`},badge:{bg:`error.500`}},neutral:{root:{bg:`grey.50`,borderColor:`grey.400`,color:`grey.400`},badge:{bg:`grey.400`}},info:{root:{bg:`secondary.100`,borderColor:`secondary.500`,color:`secondary.500`},badge:{bg:`secondary.500`}}}}});exports.tagRecipe=e;
|
|
1
|
+
"use client";var e=(0,require("@pandacss/dev").defineSlotRecipe)({base:{root:{fontFamily:`satoshi`,borderStyle:`solid`,display:`inline-flex`,flexDirection:`row`,alignItems:`center`,borderRadius:`radius-28`}},slots:[`root`,`badge`],className:`tag`,defaultVariants:{size:`md`,severity:`neutral`},description:`The styles for the Tag component`,jsx:[`Tag`],variants:{size:{lg:{root:{borderWidth:2,textStyle:`body.lg`,fontWeight:`bold`,py:`space-8`,px:`space-16`,gap:`space-8`},badge:{width:`size-8`,height:`size-8`}},md:{root:{borderWidth:1,textStyle:`body.md`,fontWeight:`bold`,py:`space-6`,px:`space-12`,gap:`space-8`},badge:{width:`size-6`,height:`size-6`}},sm:{root:{borderWidth:1,textStyle:`body.sm`,fontWeight:`bold`,py:`space-4`,px:`space-8`,gap:`space-4`},badge:{width:`size-4`,height:`size-4`}}},severity:{success:{root:{bg:`success.100`,borderColor:`success.500`,color:`success.500`},badge:{bg:`success.500`}},warning:{root:{bg:`warning.100`,borderColor:`warning.500`,color:`warning.500`},badge:{bg:`warning.500`}},error:{root:{bg:`error.100`,borderColor:`error.500`,color:`error.500`},badge:{bg:`error.500`}},neutral:{root:{bg:`grey.50`,borderColor:`grey.400`,color:`grey.400`},badge:{bg:`grey.400`}},info:{root:{bg:`secondary.100`,borderColor:`secondary.500`,color:`secondary.500`},badge:{bg:`secondary.500`}},primary:{root:{bg:`primary.100`,borderColor:`primary.500`,color:`primary.500`},badge:{bg:`primary.500`}}}}});exports.tagRecipe=e;
|
|
2
2
|
//# sourceMappingURL=tag.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.cjs","names":[],"sources":["../../../src/theme/recipes/tag.ts"],"sourcesContent":["import { defineSlotRecipe } from '@pandacss/dev'\n\nexport const tagRecipe = defineSlotRecipe({\n base: {\n root: {\n fontFamily: 'satoshi',\n borderStyle: 'solid',\n display: 'inline-flex',\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 'radius-28',\n },\n },\n slots: ['root', 'badge'],\n className: 'tag',\n defaultVariants: {\n size: 'md',\n severity: 'neutral',\n },\n description: 'The styles for the Tag component',\n jsx: ['Tag'],\n variants: {\n size: {\n lg: {\n root: {\n borderWidth: 2,\n textStyle: 'body.lg',\n fontWeight: 'bold',\n py: 'space-8',\n px: 'space-16',\n gap: 'space-8',\n },\n badge: {\n width: 'size-8',\n height: 'size-8',\n },\n },\n md: {\n root: {\n borderWidth: 1,\n textStyle: 'body.md',\n fontWeight: 'bold',\n py: 'space-6',\n px: 'space-12',\n gap: 'space-8',\n },\n badge: {\n width: 'size-6',\n height: 'size-6',\n },\n },\n sm: {\n root: {\n borderWidth: 1,\n textStyle: 'body.sm',\n fontWeight: 'bold',\n py: 'space-4',\n px: 'space-8',\n gap: 'space-4',\n },\n badge: {\n width: 'size-4',\n height: 'size-4',\n },\n },\n },\n severity: {\n success: {\n root: {\n bg: 'success.100',\n borderColor: 'success.500',\n color: 'success.500',\n },\n badge: {\n bg: 'success.500',\n },\n },\n warning: {\n root: {\n bg: 'warning.100',\n borderColor: 'warning.500',\n color: 'warning.500',\n },\n badge: {\n bg: 'warning.500',\n },\n },\n error: {\n root: {\n bg: 'error.100',\n borderColor: 'error.500',\n color: 'error.500',\n },\n badge: {\n bg: 'error.500',\n },\n },\n neutral: {\n root: {\n bg: 'grey.50',\n borderColor: 'grey.400',\n color: 'grey.400',\n },\n badge: {\n bg: 'grey.400',\n },\n },\n info: {\n root: {\n bg: 'secondary.100',\n borderColor: 'secondary.500',\n color: 'secondary.500',\n },\n badge: {\n bg: 'secondary.500',\n },\n },\n },\n },\n})\n"],"mappings":"aAEA,IAAa,GAAA,yBAAA,EAAA,kBAA6B,CACxC,KAAM,CACJ,KAAM,CACJ,WAAY,UACZ,YAAa,QACb,QAAS,cACT,cAAe,MACf,WAAY,SACZ,aAAc,WAChB,CACF,EACA,MAAO,CAAC,OAAQ,OAAO,EACvB,UAAW,MACX,gBAAiB,CACf,KAAM,KACN,SAAU,SACZ,EACA,YAAa,mCACb,IAAK,CAAC,KAAK,EACX,SAAU,CACR,KAAM,CACJ,GAAI,CACF,KAAM,CACJ,YAAa,EACb,UAAW,UACX,WAAY,OACZ,GAAI,UACJ,GAAI,WACJ,IAAK,SACP,EACA,MAAO,CACL,MAAO,SACP,OAAQ,QACV,CACF,EACA,GAAI,CACF,KAAM,CACJ,YAAa,EACb,UAAW,UACX,WAAY,OACZ,GAAI,UACJ,GAAI,WACJ,IAAK,SACP,EACA,MAAO,CACL,MAAO,SACP,OAAQ,QACV,CACF,EACA,GAAI,CACF,KAAM,CACJ,YAAa,EACb,UAAW,UACX,WAAY,OACZ,GAAI,UACJ,GAAI,UACJ,IAAK,SACP,EACA,MAAO,CACL,MAAO,SACP,OAAQ,QACV,CACF,CACF,EACA,SAAU,CACR,QAAS,CACP,KAAM,CACJ,GAAI,cACJ,YAAa,cACb,MAAO,aACT,EACA,MAAO,CACL,GAAI,aACN,CACF,EACA,QAAS,CACP,KAAM,CACJ,GAAI,cACJ,YAAa,cACb,MAAO,aACT,EACA,MAAO,CACL,GAAI,aACN,CACF,EACA,MAAO,CACL,KAAM,CACJ,GAAI,YACJ,YAAa,YACb,MAAO,WACT,EACA,MAAO,CACL,GAAI,WACN,CACF,EACA,QAAS,CACP,KAAM,CACJ,GAAI,UACJ,YAAa,WACb,MAAO,UACT,EACA,MAAO,CACL,GAAI,UACN,CACF,EACA,KAAM,CACJ,KAAM,CACJ,GAAI,gBACJ,YAAa,gBACb,MAAO,eACT,EACA,MAAO,CACL,GAAI,eACN,CACF,CACF,CACF,CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"tag.cjs","names":[],"sources":["../../../src/theme/recipes/tag.ts"],"sourcesContent":["import { defineSlotRecipe } from '@pandacss/dev'\n\nexport const tagRecipe = defineSlotRecipe({\n base: {\n root: {\n fontFamily: 'satoshi',\n borderStyle: 'solid',\n display: 'inline-flex',\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 'radius-28',\n },\n },\n slots: ['root', 'badge'],\n className: 'tag',\n defaultVariants: {\n size: 'md',\n severity: 'neutral',\n },\n description: 'The styles for the Tag component',\n jsx: ['Tag'],\n variants: {\n size: {\n lg: {\n root: {\n borderWidth: 2,\n textStyle: 'body.lg',\n fontWeight: 'bold',\n py: 'space-8',\n px: 'space-16',\n gap: 'space-8',\n },\n badge: {\n width: 'size-8',\n height: 'size-8',\n },\n },\n md: {\n root: {\n borderWidth: 1,\n textStyle: 'body.md',\n fontWeight: 'bold',\n py: 'space-6',\n px: 'space-12',\n gap: 'space-8',\n },\n badge: {\n width: 'size-6',\n height: 'size-6',\n },\n },\n sm: {\n root: {\n borderWidth: 1,\n textStyle: 'body.sm',\n fontWeight: 'bold',\n py: 'space-4',\n px: 'space-8',\n gap: 'space-4',\n },\n badge: {\n width: 'size-4',\n height: 'size-4',\n },\n },\n },\n severity: {\n success: {\n root: {\n bg: 'success.100',\n borderColor: 'success.500',\n color: 'success.500',\n },\n badge: {\n bg: 'success.500',\n },\n },\n warning: {\n root: {\n bg: 'warning.100',\n borderColor: 'warning.500',\n color: 'warning.500',\n },\n badge: {\n bg: 'warning.500',\n },\n },\n error: {\n root: {\n bg: 'error.100',\n borderColor: 'error.500',\n color: 'error.500',\n },\n badge: {\n bg: 'error.500',\n },\n },\n neutral: {\n root: {\n bg: 'grey.50',\n borderColor: 'grey.400',\n color: 'grey.400',\n },\n badge: {\n bg: 'grey.400',\n },\n },\n info: {\n root: {\n bg: 'secondary.100',\n borderColor: 'secondary.500',\n color: 'secondary.500',\n },\n badge: {\n bg: 'secondary.500',\n },\n },\n // For states that are neither an alert nor an absence: a legitimate in-progress\n // situation the user is meant to act on, in the product's own colour. Without it,\n // such states get dressed as a warning or overridden from outside — and an outside\n // override only reaches the root, leaving the badge and border grey.\n primary: {\n root: {\n bg: 'primary.100',\n borderColor: 'primary.500',\n color: 'primary.500',\n },\n badge: {\n bg: 'primary.500',\n },\n },\n },\n },\n})\n"],"mappings":"aAEA,IAAa,GAAA,yBAAA,EAAA,kBAA6B,CACxC,KAAM,CACJ,KAAM,CACJ,WAAY,UACZ,YAAa,QACb,QAAS,cACT,cAAe,MACf,WAAY,SACZ,aAAc,WAChB,CACF,EACA,MAAO,CAAC,OAAQ,OAAO,EACvB,UAAW,MACX,gBAAiB,CACf,KAAM,KACN,SAAU,SACZ,EACA,YAAa,mCACb,IAAK,CAAC,KAAK,EACX,SAAU,CACR,KAAM,CACJ,GAAI,CACF,KAAM,CACJ,YAAa,EACb,UAAW,UACX,WAAY,OACZ,GAAI,UACJ,GAAI,WACJ,IAAK,SACP,EACA,MAAO,CACL,MAAO,SACP,OAAQ,QACV,CACF,EACA,GAAI,CACF,KAAM,CACJ,YAAa,EACb,UAAW,UACX,WAAY,OACZ,GAAI,UACJ,GAAI,WACJ,IAAK,SACP,EACA,MAAO,CACL,MAAO,SACP,OAAQ,QACV,CACF,EACA,GAAI,CACF,KAAM,CACJ,YAAa,EACb,UAAW,UACX,WAAY,OACZ,GAAI,UACJ,GAAI,UACJ,IAAK,SACP,EACA,MAAO,CACL,MAAO,SACP,OAAQ,QACV,CACF,CACF,EACA,SAAU,CACR,QAAS,CACP,KAAM,CACJ,GAAI,cACJ,YAAa,cACb,MAAO,aACT,EACA,MAAO,CACL,GAAI,aACN,CACF,EACA,QAAS,CACP,KAAM,CACJ,GAAI,cACJ,YAAa,cACb,MAAO,aACT,EACA,MAAO,CACL,GAAI,aACN,CACF,EACA,MAAO,CACL,KAAM,CACJ,GAAI,YACJ,YAAa,YACb,MAAO,WACT,EACA,MAAO,CACL,GAAI,WACN,CACF,EACA,QAAS,CACP,KAAM,CACJ,GAAI,UACJ,YAAa,WACb,MAAO,UACT,EACA,MAAO,CACL,GAAI,UACN,CACF,EACA,KAAM,CACJ,KAAM,CACJ,GAAI,gBACJ,YAAa,gBACb,MAAO,eACT,EACA,MAAO,CACL,GAAI,eACN,CACF,EAKA,QAAS,CACP,KAAM,CACJ,GAAI,cACJ,YAAa,cACb,MAAO,aACT,EACA,MAAO,CACL,GAAI,aACN,CACF,CACF,CACF,CACF,CAAC"}
|
|
@@ -103,6 +103,14 @@ var t = e({
|
|
|
103
103
|
color: "secondary.500"
|
|
104
104
|
},
|
|
105
105
|
badge: { bg: "secondary.500" }
|
|
106
|
+
},
|
|
107
|
+
primary: {
|
|
108
|
+
root: {
|
|
109
|
+
bg: "primary.100",
|
|
110
|
+
borderColor: "primary.500",
|
|
111
|
+
color: "primary.500"
|
|
112
|
+
},
|
|
113
|
+
badge: { bg: "primary.500" }
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","names":[],"sources":["../../../src/theme/recipes/tag.ts"],"sourcesContent":["import { defineSlotRecipe } from '@pandacss/dev'\n\nexport const tagRecipe = defineSlotRecipe({\n base: {\n root: {\n fontFamily: 'satoshi',\n borderStyle: 'solid',\n display: 'inline-flex',\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 'radius-28',\n },\n },\n slots: ['root', 'badge'],\n className: 'tag',\n defaultVariants: {\n size: 'md',\n severity: 'neutral',\n },\n description: 'The styles for the Tag component',\n jsx: ['Tag'],\n variants: {\n size: {\n lg: {\n root: {\n borderWidth: 2,\n textStyle: 'body.lg',\n fontWeight: 'bold',\n py: 'space-8',\n px: 'space-16',\n gap: 'space-8',\n },\n badge: {\n width: 'size-8',\n height: 'size-8',\n },\n },\n md: {\n root: {\n borderWidth: 1,\n textStyle: 'body.md',\n fontWeight: 'bold',\n py: 'space-6',\n px: 'space-12',\n gap: 'space-8',\n },\n badge: {\n width: 'size-6',\n height: 'size-6',\n },\n },\n sm: {\n root: {\n borderWidth: 1,\n textStyle: 'body.sm',\n fontWeight: 'bold',\n py: 'space-4',\n px: 'space-8',\n gap: 'space-4',\n },\n badge: {\n width: 'size-4',\n height: 'size-4',\n },\n },\n },\n severity: {\n success: {\n root: {\n bg: 'success.100',\n borderColor: 'success.500',\n color: 'success.500',\n },\n badge: {\n bg: 'success.500',\n },\n },\n warning: {\n root: {\n bg: 'warning.100',\n borderColor: 'warning.500',\n color: 'warning.500',\n },\n badge: {\n bg: 'warning.500',\n },\n },\n error: {\n root: {\n bg: 'error.100',\n borderColor: 'error.500',\n color: 'error.500',\n },\n badge: {\n bg: 'error.500',\n },\n },\n neutral: {\n root: {\n bg: 'grey.50',\n borderColor: 'grey.400',\n color: 'grey.400',\n },\n badge: {\n bg: 'grey.400',\n },\n },\n info: {\n root: {\n bg: 'secondary.100',\n borderColor: 'secondary.500',\n color: 'secondary.500',\n },\n badge: {\n bg: 'secondary.500',\n },\n },\n },\n },\n})\n"],"mappings":";;;AAEA,IAAa,IAAY,EAAiB;CACxC,MAAM,EACJ,MAAM;EACJ,YAAY;EACZ,aAAa;EACb,SAAS;EACT,eAAe;EACf,YAAY;EACZ,cAAc;CAChB,EACF;CACA,OAAO,CAAC,QAAQ,OAAO;CACvB,WAAW;CACX,iBAAiB;EACf,MAAM;EACN,UAAU;CACZ;CACA,aAAa;CACb,KAAK,CAAC,KAAK;CACX,UAAU;EACR,MAAM;GACJ,IAAI;IACF,MAAM;KACJ,aAAa;KACb,WAAW;KACX,YAAY;KACZ,IAAI;KACJ,IAAI;KACJ,KAAK;IACP;IACA,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;GACA,IAAI;IACF,MAAM;KACJ,aAAa;KACb,WAAW;KACX,YAAY;KACZ,IAAI;KACJ,IAAI;KACJ,KAAK;IACP;IACA,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;GACA,IAAI;IACF,MAAM;KACJ,aAAa;KACb,WAAW;KACX,YAAY;KACZ,IAAI;KACJ,IAAI;KACJ,KAAK;IACP;IACA,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;EACF;EACA,UAAU;GACR,SAAS;IACP,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,cACN;GACF;GACA,SAAS;IACP,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,cACN;GACF;GACA,OAAO;IACL,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,YACN;GACF;GACA,SAAS;IACP,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,WACN;GACF;GACA,MAAM;IACJ,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,gBACN;GACF;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"tag.js","names":[],"sources":["../../../src/theme/recipes/tag.ts"],"sourcesContent":["import { defineSlotRecipe } from '@pandacss/dev'\n\nexport const tagRecipe = defineSlotRecipe({\n base: {\n root: {\n fontFamily: 'satoshi',\n borderStyle: 'solid',\n display: 'inline-flex',\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 'radius-28',\n },\n },\n slots: ['root', 'badge'],\n className: 'tag',\n defaultVariants: {\n size: 'md',\n severity: 'neutral',\n },\n description: 'The styles for the Tag component',\n jsx: ['Tag'],\n variants: {\n size: {\n lg: {\n root: {\n borderWidth: 2,\n textStyle: 'body.lg',\n fontWeight: 'bold',\n py: 'space-8',\n px: 'space-16',\n gap: 'space-8',\n },\n badge: {\n width: 'size-8',\n height: 'size-8',\n },\n },\n md: {\n root: {\n borderWidth: 1,\n textStyle: 'body.md',\n fontWeight: 'bold',\n py: 'space-6',\n px: 'space-12',\n gap: 'space-8',\n },\n badge: {\n width: 'size-6',\n height: 'size-6',\n },\n },\n sm: {\n root: {\n borderWidth: 1,\n textStyle: 'body.sm',\n fontWeight: 'bold',\n py: 'space-4',\n px: 'space-8',\n gap: 'space-4',\n },\n badge: {\n width: 'size-4',\n height: 'size-4',\n },\n },\n },\n severity: {\n success: {\n root: {\n bg: 'success.100',\n borderColor: 'success.500',\n color: 'success.500',\n },\n badge: {\n bg: 'success.500',\n },\n },\n warning: {\n root: {\n bg: 'warning.100',\n borderColor: 'warning.500',\n color: 'warning.500',\n },\n badge: {\n bg: 'warning.500',\n },\n },\n error: {\n root: {\n bg: 'error.100',\n borderColor: 'error.500',\n color: 'error.500',\n },\n badge: {\n bg: 'error.500',\n },\n },\n neutral: {\n root: {\n bg: 'grey.50',\n borderColor: 'grey.400',\n color: 'grey.400',\n },\n badge: {\n bg: 'grey.400',\n },\n },\n info: {\n root: {\n bg: 'secondary.100',\n borderColor: 'secondary.500',\n color: 'secondary.500',\n },\n badge: {\n bg: 'secondary.500',\n },\n },\n // For states that are neither an alert nor an absence: a legitimate in-progress\n // situation the user is meant to act on, in the product's own colour. Without it,\n // such states get dressed as a warning or overridden from outside — and an outside\n // override only reaches the root, leaving the badge and border grey.\n primary: {\n root: {\n bg: 'primary.100',\n borderColor: 'primary.500',\n color: 'primary.500',\n },\n badge: {\n bg: 'primary.500',\n },\n },\n },\n },\n})\n"],"mappings":";;;AAEA,IAAa,IAAY,EAAiB;CACxC,MAAM,EACJ,MAAM;EACJ,YAAY;EACZ,aAAa;EACb,SAAS;EACT,eAAe;EACf,YAAY;EACZ,cAAc;CAChB,EACF;CACA,OAAO,CAAC,QAAQ,OAAO;CACvB,WAAW;CACX,iBAAiB;EACf,MAAM;EACN,UAAU;CACZ;CACA,aAAa;CACb,KAAK,CAAC,KAAK;CACX,UAAU;EACR,MAAM;GACJ,IAAI;IACF,MAAM;KACJ,aAAa;KACb,WAAW;KACX,YAAY;KACZ,IAAI;KACJ,IAAI;KACJ,KAAK;IACP;IACA,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;GACA,IAAI;IACF,MAAM;KACJ,aAAa;KACb,WAAW;KACX,YAAY;KACZ,IAAI;KACJ,IAAI;KACJ,KAAK;IACP;IACA,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;GACA,IAAI;IACF,MAAM;KACJ,aAAa;KACb,WAAW;KACX,YAAY;KACZ,IAAI;KACJ,IAAI;KACJ,KAAK;IACP;IACA,OAAO;KACL,OAAO;KACP,QAAQ;IACV;GACF;EACF;EACA,UAAU;GACR,SAAS;IACP,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,cACN;GACF;GACA,SAAS;IACP,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,cACN;GACF;GACA,OAAO;IACL,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,YACN;GACF;GACA,SAAS;IACP,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI,WACN;GACF;GACA,MAAM;IACJ,MAAM;KACJ,IAAI;KACJ,aAAa;KACb,OAAO;IACT;IACA,OAAO,EACL,IAAI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