@stokelp/ui 4.0.2 → 4.1.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/alert/Alert.cjs +1 -1
- package/dist/components/alert/Alert.cjs.map +1 -1
- package/dist/components/alert/Alert.d.ts +1 -1
- package/dist/components/alert/Alert.js +57 -53
- package/dist/components/alert/Alert.js.map +1 -1
- package/dist/components/app/navigation/AppNavigation.cjs.map +1 -1
- package/dist/components/app/navigation/AppNavigation.d.ts +2 -1
- package/dist/components/app/navigation/AppNavigation.js.map +1 -1
- package/dist/components/chat/ChatDocumentMessage.cjs.map +1 -1
- package/dist/components/chat/ChatDocumentMessage.js.map +1 -1
- package/dist/components/chat/ChatProfileAvatar.cjs.map +1 -1
- package/dist/components/chat/ChatProfileAvatar.js.map +1 -1
- package/dist/components/chat/ChatScoreBreakdown.cjs.map +1 -1
- package/dist/components/chat/ChatScoreBreakdown.js.map +1 -1
- package/dist/components/chat/ChatTextInput.cjs.map +1 -1
- package/dist/components/chat/ChatTextInput.d.ts +1 -1
- package/dist/components/chat/ChatTextInput.js.map +1 -1
- package/dist/components/combobox/Combobox.cjs +2 -2
- package/dist/components/combobox/Combobox.cjs.map +1 -1
- package/dist/components/combobox/Combobox.js +17 -17
- package/dist/components/date-picker/DatePicker.cjs +1 -1
- package/dist/components/date-picker/DatePicker.cjs.map +1 -1
- package/dist/components/date-picker/DatePicker.js +68 -53
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/dialog/styled.cjs +1 -1
- package/dist/components/dialog/styled.cjs.map +1 -1
- package/dist/components/dialog/styled.js +58 -54
- package/dist/components/dialog/styled.js.map +1 -1
- package/dist/components/drawer/Drawer.cjs +1 -1
- package/dist/components/drawer/Drawer.cjs.map +1 -1
- package/dist/components/drawer/Drawer.js +46 -42
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/input/HighlightedInput.cjs.map +1 -1
- package/dist/components/input/HighlightedInput.js.map +1 -1
- package/dist/components/pagination/Pagination.cjs +1 -1
- package/dist/components/pagination/Pagination.cjs.map +1 -1
- package/dist/components/pagination/Pagination.js +37 -36
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.cjs.map +1 -1
- package/dist/components/select/Select.js +15 -15
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.js +4 -4
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.js.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js +33 -33
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js.map +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.cjs +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.cjs.map +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.d.ts +34 -2
- package/dist/components/ui-labels/UiLabelsProvider.js +32 -7
- package/dist/components/ui-labels/UiLabelsProvider.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -69
- package/package.json +20 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatScoreBreakdown.js","names":["_Fragment","PACKAGING_TYPOLOGY_ID","ATTRIBUTE_ORDER","FOOD_ONLY_KEYS","PACKAGING_ONLY_KEYS","LEVEL_COLORS","getHeadlineColor","percent","getBarColor","ratioPercent","hasLevel","detail","isFraction","isComparable","ChatScoreBreakdown","isPackaging","typologyId","key","hiddenKeys","visibleKeys","compared","notSpecified","labels","Box","HStack","Text","VStack","entry","level","colors","matched","total","Fragment"],"sources":["../../../src/components/chat/ChatScoreBreakdown.tsx"],"sourcesContent":["import { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\nimport { Text } from '~/components'\n\nexport type ScoreSetAttributeKey =\n 'origin' | 'rawMaterialOrigin' | 'temperature' | 'cutting' | 'cooking' | 'treatment' | 'label' | 'packaging'\n\nexport type ScoreNumericAttributeKey = 'grammageGsm' | 'recycledPct' | 'thicknessMicron'\n\nexport type ScoreAttributeKey = ScoreSetAttributeKey | ScoreNumericAttributeKey\n\n/** Proximity bucket for free numeric packaging specs: egal (equal) → non_correspondant (no match). */\nexport type ScoreLevel = 'egal' | 'proche' | 'eloigne' | 'non_correspondant'\n\nexport type ScoreAttributeDetail = {\n matched: number | null\n total: number | null\n level?: ScoreLevel | null\n}\n\nexport type ChatScoreBreakdownLabels = {\n title: string\n compared: string\n notSpecified: string\n attributes: Record<ScoreSetAttributeKey, string> & Partial<Record<ScoreNumericAttributeKey, string>>\n levels?: Record<ScoreLevel, string>\n footer?: string\n}\n\nexport type ChatScoreBreakdownProps = {\n percent: number\n detail: Record<string, ScoreAttributeDetail>\n labels: ChatScoreBreakdownLabels\n /** Typology id of the AO product (1 = packaging). When provided, drives which attribute family is shown; falls back to inferring from the numeric specs when absent. */\n typologyId?: number\n}\n\nconst PACKAGING_TYPOLOGY_ID = 1\n\nconst ATTRIBUTE_ORDER: ScoreAttributeKey[] = [\n 'origin',\n 'rawMaterialOrigin',\n 'temperature',\n 'cutting',\n 'cooking',\n 'treatment',\n 'label',\n 'packaging',\n 'grammageGsm',\n 'recycledPct',\n 'thicknessMicron',\n]\n\n// Attributes that only exist for food products; hidden for packaging products.\nconst FOOD_ONLY_KEYS: ScoreAttributeKey[] = ['temperature', 'cutting', 'cooking']\n// Free numeric specs that only exist for packaging products; hidden for food products.\nconst PACKAGING_ONLY_KEYS: ScoreNumericAttributeKey[] = ['grammageGsm', 'recycledPct', 'thicknessMicron']\n\nconst LEVEL_COLORS: Record<ScoreLevel, { bg: string; color: string }> = {\n egal: { bg: '#E6F3D9', color: '#3B6D11' },\n proche: { bg: '#F0F6DC', color: '#5E8516' },\n eloigne: { bg: '#FDF0E0', color: '#C2740C' },\n non_correspondant: { bg: '#FCEBEB', color: '#A32D2D' },\n}\n\nfunction getHeadlineColor(percent: number): string {\n if (percent >= 70) return '#3B6D11'\n if (percent >= 40) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\nfunction hasLevel(detail?: ScoreAttributeDetail): boolean {\n return detail?.level != null\n}\n\nfunction isFraction(detail?: ScoreAttributeDetail): boolean {\n return detail?.matched != null && detail?.total != null\n}\n\nfunction isComparable(detail?: ScoreAttributeDetail): boolean {\n return hasLevel(detail) || isFraction(detail)\n}\n\nexport const ChatScoreBreakdown = ({ percent, detail, labels, typologyId }: ChatScoreBreakdownProps) => {\n // A packaging product hides food attributes (temperature/cutting/cooking) and shows the\n // numeric specs, and vice versa. Two independent signals mark a packaging product, combined\n // so neither can wrongly override the other: the AO product typology (authoritative, and the\n // only signal when no numeric spec is comparable), and the presence of a comparable numeric\n // spec (covers cases where the typology is absent or not sent as the expected value).\n const isPackaging =\n Number(typologyId) === PACKAGING_TYPOLOGY_ID || PACKAGING_ONLY_KEYS.some(key => detail[key]?.level != null)\n const hiddenKeys = new Set<ScoreAttributeKey>(isPackaging ? FOOD_ONLY_KEYS : PACKAGING_ONLY_KEYS)\n const visibleKeys = ATTRIBUTE_ORDER.filter(key => !hiddenKeys.has(key))\n\n const compared = visibleKeys.filter(key => isComparable(detail[key]))\n const notSpecified = visibleKeys.filter(key => !isComparable(detail[key]) && labels.attributes[key] != null)\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"220px\"\n maxW=\"240px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(percent) }}>\n {Math.round(percent)} %\n </Text>\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n {compared.length > 0 && (\n <VStack alignItems=\"stretch\" gap=\"space-4\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.compared}\n </Text>\n {compared.map(key => {\n const entry = detail[key]\n if (hasLevel(entry)) {\n const level = entry.level as ScoreLevel\n const colors = LEVEL_COLORS[level]\n return (\n <HStack key={key} h=\"18px\" alignItems=\"center\" gap=\"space-8\" justify=\"space-between\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\" minW=\"80px\">\n {labels.attributes[key]}\n </Text>\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n h=\"100%\"\n px=\"space-6\"\n borderRadius=\"full\"\n flexShrink=\"0\"\n style={{ backgroundColor: colors.bg }}\n >\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n style={{ color: colors.color, whiteSpace: 'nowrap', lineHeight: 1 }}\n >\n {labels.levels?.[level] ?? level}\n </Text>\n </Box>\n </HStack>\n )\n }\n\n const matched = entry.matched as number\n const total = entry.total as number\n const ratioPercent = total > 0 ? (matched / total) * 100 : 0\n return (\n <HStack key={key} h=\"18px\" alignItems=\"center\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\" minW=\"80px\">\n {labels.attributes[key]}\n </Text>\n <Box flex=\"1\" h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{ width: `${ratioPercent}%`, background: getBarColor(ratioPercent) }}\n />\n </Box>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n minW=\"40px\"\n textAlign=\"right\"\n style={{ color: getBarColor(ratioPercent), lineHeight: 1 }}\n >\n {matched}/{total}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n )}\n\n {compared.length > 0 && notSpecified.length > 0 && <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />}\n\n {notSpecified.length > 0 && (\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.notSpecified}\n </Text>\n <HStack flexWrap=\"wrap\" gap=\"space-4\">\n {notSpecified.map(key => (\n <Text\n key={key}\n as=\"span\"\n fontSize=\"body.sm\"\n color=\"grey.400\"\n border=\"1px solid\"\n borderColor=\"grey.100\"\n px=\"space-8\"\n py=\"2px\"\n borderRadius=\"full\"\n >\n {labels.attributes[key]}\n </Text>\n ))}\n </HStack>\n </VStack>\n )}\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;AAoCA,IAAMC,IAAwB,GAExBC,IAAuC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAGMC,IAAsC;CAAC;CAAe;CAAW;AAAS,GAE1EC,IAAkD;CAAC;CAAe;CAAe;AAAiB,GAElGC,IAAkE;CACtE,MAAM;EAAE,IAAI;EAAW,OAAO;CAAU;CACxC,QAAQ;EAAE,IAAI;EAAW,OAAO;CAAU;CAC1C,SAAS;EAAE,IAAI;EAAW,OAAO;CAAU;CAC3C,mBAAmB;EAAE,IAAI;EAAW,OAAO;CAAU;AACvD;AAEA,SAASC,EAAiB,GAAyB;CAGjD,OAFIC,KAAW,KAAW,YACtBA,KAAW,KAAW,YACnB;AACT;AAEA,SAASC,EAAY,GAA8B;CAGjD,OAFIC,KAAgB,KAAW,YAC3B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LY_KEYS","LEVEL_COLORS","getHeadlineColor","percent","getBarColor","ratioPercent","hasLevel","detail","isFraction","isComparable","ChatScoreBreakdown","isPackaging","typologyId","key","hiddenKeys","visibleKeys","compared","notSpecified","labels","Box","HStack","Text","VStack","entry","level","colors","matched","total","Fragment"],"sources":["../../../src/components/chat/ChatScoreBreakdown.tsx"],"sourcesContent":["import { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\nimport { Text } from '~/components/text/Text'\n\nexport type ScoreSetAttributeKey =\n 'origin' | 'rawMaterialOrigin' | 'temperature' | 'cutting' | 'cooking' | 'treatment' | 'label' | 'packaging'\n\nexport type ScoreNumericAttributeKey = 'grammageGsm' | 'recycledPct' | 'thicknessMicron'\n\nexport type ScoreAttributeKey = ScoreSetAttributeKey | ScoreNumericAttributeKey\n\n/** Proximity bucket for free numeric packaging specs: egal (equal) → non_correspondant (no match). */\nexport type ScoreLevel = 'egal' | 'proche' | 'eloigne' | 'non_correspondant'\n\nexport type ScoreAttributeDetail = {\n matched: number | null\n total: number | null\n level?: ScoreLevel | null\n}\n\nexport type ChatScoreBreakdownLabels = {\n title: string\n compared: string\n notSpecified: string\n attributes: Record<ScoreSetAttributeKey, string> & Partial<Record<ScoreNumericAttributeKey, string>>\n levels?: Record<ScoreLevel, string>\n footer?: string\n}\n\nexport type ChatScoreBreakdownProps = {\n percent: number\n detail: Record<string, ScoreAttributeDetail>\n labels: ChatScoreBreakdownLabels\n /** Typology id of the AO product (1 = packaging). When provided, drives which attribute family is shown; falls back to inferring from the numeric specs when absent. */\n typologyId?: number\n}\n\nconst PACKAGING_TYPOLOGY_ID = 1\n\nconst ATTRIBUTE_ORDER: ScoreAttributeKey[] = [\n 'origin',\n 'rawMaterialOrigin',\n 'temperature',\n 'cutting',\n 'cooking',\n 'treatment',\n 'label',\n 'packaging',\n 'grammageGsm',\n 'recycledPct',\n 'thicknessMicron',\n]\n\n// Attributes that only exist for food products; hidden for packaging products.\nconst FOOD_ONLY_KEYS: ScoreAttributeKey[] = ['temperature', 'cutting', 'cooking']\n// Free numeric specs that only exist for packaging products; hidden for food products.\nconst PACKAGING_ONLY_KEYS: ScoreNumericAttributeKey[] = ['grammageGsm', 'recycledPct', 'thicknessMicron']\n\nconst LEVEL_COLORS: Record<ScoreLevel, { bg: string; color: string }> = {\n egal: { bg: '#E6F3D9', color: '#3B6D11' },\n proche: { bg: '#F0F6DC', color: '#5E8516' },\n eloigne: { bg: '#FDF0E0', color: '#C2740C' },\n non_correspondant: { bg: '#FCEBEB', color: '#A32D2D' },\n}\n\nfunction getHeadlineColor(percent: number): string {\n if (percent >= 70) return '#3B6D11'\n if (percent >= 40) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\nfunction hasLevel(detail?: ScoreAttributeDetail): boolean {\n return detail?.level != null\n}\n\nfunction isFraction(detail?: ScoreAttributeDetail): boolean {\n return detail?.matched != null && detail?.total != null\n}\n\nfunction isComparable(detail?: ScoreAttributeDetail): boolean {\n return hasLevel(detail) || isFraction(detail)\n}\n\nexport const ChatScoreBreakdown = ({ percent, detail, labels, typologyId }: ChatScoreBreakdownProps) => {\n // A packaging product hides food attributes (temperature/cutting/cooking) and shows the\n // numeric specs, and vice versa. Two independent signals mark a packaging product, combined\n // so neither can wrongly override the other: the AO product typology (authoritative, and the\n // only signal when no numeric spec is comparable), and the presence of a comparable numeric\n // spec (covers cases where the typology is absent or not sent as the expected value).\n const isPackaging =\n Number(typologyId) === PACKAGING_TYPOLOGY_ID || PACKAGING_ONLY_KEYS.some(key => detail[key]?.level != null)\n const hiddenKeys = new Set<ScoreAttributeKey>(isPackaging ? FOOD_ONLY_KEYS : PACKAGING_ONLY_KEYS)\n const visibleKeys = ATTRIBUTE_ORDER.filter(key => !hiddenKeys.has(key))\n\n const compared = visibleKeys.filter(key => isComparable(detail[key]))\n const notSpecified = visibleKeys.filter(key => !isComparable(detail[key]) && labels.attributes[key] != null)\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"220px\"\n maxW=\"240px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(percent) }}>\n {Math.round(percent)} %\n </Text>\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n {compared.length > 0 && (\n <VStack alignItems=\"stretch\" gap=\"space-4\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.compared}\n </Text>\n {compared.map(key => {\n const entry = detail[key]\n if (hasLevel(entry)) {\n const level = entry.level as ScoreLevel\n const colors = LEVEL_COLORS[level]\n return (\n <HStack key={key} h=\"18px\" alignItems=\"center\" gap=\"space-8\" justify=\"space-between\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\" minW=\"80px\">\n {labels.attributes[key]}\n </Text>\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n h=\"100%\"\n px=\"space-6\"\n borderRadius=\"full\"\n flexShrink=\"0\"\n style={{ backgroundColor: colors.bg }}\n >\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n style={{ color: colors.color, whiteSpace: 'nowrap', lineHeight: 1 }}\n >\n {labels.levels?.[level] ?? level}\n </Text>\n </Box>\n </HStack>\n )\n }\n\n const matched = entry.matched as number\n const total = entry.total as number\n const ratioPercent = total > 0 ? (matched / total) * 100 : 0\n return (\n <HStack key={key} h=\"18px\" alignItems=\"center\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\" minW=\"80px\">\n {labels.attributes[key]}\n </Text>\n <Box flex=\"1\" h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{ width: `${ratioPercent}%`, background: getBarColor(ratioPercent) }}\n />\n </Box>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n minW=\"40px\"\n textAlign=\"right\"\n style={{ color: getBarColor(ratioPercent), lineHeight: 1 }}\n >\n {matched}/{total}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n )}\n\n {compared.length > 0 && notSpecified.length > 0 && <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />}\n\n {notSpecified.length > 0 && (\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.notSpecified}\n </Text>\n <HStack flexWrap=\"wrap\" gap=\"space-4\">\n {notSpecified.map(key => (\n <Text\n key={key}\n as=\"span\"\n fontSize=\"body.sm\"\n color=\"grey.400\"\n border=\"1px solid\"\n borderColor=\"grey.100\"\n px=\"space-8\"\n py=\"2px\"\n borderRadius=\"full\"\n >\n {labels.attributes[key]}\n </Text>\n ))}\n </HStack>\n </VStack>\n )}\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;AAoCA,IAAMC,IAAwB,GAExBC,IAAuC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAGMC,IAAsC;CAAC;CAAe;CAAW;AAAS,GAE1EC,IAAkD;CAAC;CAAe;CAAe;AAAiB,GAElGC,IAAkE;CACtE,MAAM;EAAE,IAAI;EAAW,OAAO;CAAU;CACxC,QAAQ;EAAE,IAAI;E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AAD;IAAM,IAAG;IAAO,UAAS;IAAM,OAAM;IAAW,OAAO,EAAE,YAAY,EAAE;IACpE,UAAAH,EAAO;GACJ,CAAA,CACN,EAAA,CAAA;EAED;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatTextInput.cjs","names":["styled","Textarea","chatTextInput","useRef","useState","require_Textarea","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","StyledTextarea","ChatTextInput","props","textareaRef","value","setValue","resize","el","computed","lineHeight","paddingTop","paddingBottom","minHeight","minRows","maxHeightPx","maxRows","scrollHeight","newHeight","onResize","onChange","text","onSend"],"sources":["../../../src/components/chat/ChatTextInput.tsx"],"sourcesContent":["import { useRef, useEffect, useState, KeyboardEvent, ChangeEvent } from 'react'\nimport { Textarea, TextareaProps } from '~/components'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { chatTextInput } from '@stokelp/styled-system/recipes'\n\ntype ChatTextInputProps = TextareaProps & {\n minRows?: number\n maxRows?: number\n onSend?: (message: string) => void\n}\n\nconst StyledTextarea = styled(Textarea, chatTextInput)\n\nexport const ChatTextInput: React.FC<ChatTextInputProps> = ({\n minRows = 1,\n maxRows = 6,\n onSend,\n onChange,\n ...props\n}) => {\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [value, setValue] = useState('')\n\n const resize = () => {\n const el = textareaRef.current\n if (!el) return\n\n el.style.height = 'auto'\n\n const computed = window.getComputedStyle(el)\n const lineHeight = parseFloat(computed.lineHeight) || 20\n const paddingTop = parseFloat(computed.paddingTop)\n const paddingBottom = parseFloat(computed.paddingBottom)\n\n const minHeight = lineHeight * minRows + paddingTop + paddingBottom\n const maxHeightPx = lineHeight * maxRows + paddingTop + paddingBottom\n\n const scrollHeight = el.scrollHeight\n\n const newHeight = Math.min(scrollHeight, maxHeightPx)\n el.style.height = Math.max(newHeight, minHeight) + 'px'\n\n el.style.overflowY = scrollHeight > maxHeightPx ? 'auto' : 'hidden'\n el.style.scrollPaddingBottom = `${paddingBottom}px`\n }\n\n useEffect(() => {\n resize()\n const onResize = () => resize()\n window.addEventListener('resize', onResize)\n return () => window.removeEventListener('resize', onResize)\n }, [value])\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n const text = value.trim()\n if (!text) {\n setValue('')\n resize()\n return\n }\n onSend?.(text)\n setValue('')\n requestAnimationFrame(() => {\n if (textareaRef.current) textareaRef.current.style.height = 'auto'\n resize()\n })\n }\n }\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (!props?.maxLength || e.target.value.length < props?.maxLength) {\n setValue(e.target.value)\n onChange?.(e)\n }\n }\n\n return (\n <StyledTextarea\n ref={textareaRef}\n value={value}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n rows={minRows}\n {...props}\n />\n )\n}\n"],"mappings":"A,mMAWA,IAAMU,GAAA,EAAiBV,EAAAA,OAAAA,CAAOC,EAAAA,SAAUC,EAAAA,aAAa,EAExCS,GAA+C,CAC1D,UAAU,EACV,UAAU,EACV,SACA,WACA,GAAGC,KACC,CACJ,IAAMC,GAAA,EAAcV,EAAAA,OAAAA,CAAmC,IAAI,EACrD,CAACW,EAAOC,IAAA,EAAYX,EAAAA,SAAAA,CAAS,EAAE,EAE/BY,MAAe,CACnB,IAAMC,EAAKJ,EAAY,QACvB,GAAI,CAACI,EAAI,OAET,EAAG,MAAM,OAAS,OAElB,IAAMC,EAAW,OAAO,iBAAiBD,CAAE,EACrCE,EAAa,WAAWD,EAAS,UAAU,GAAK,GAChDE,EAAa,WAAWF,EAAS,UAAU,EAC3CG,EAAgB,WAAWH,EAAS,aAAa,EAEjDI,EAAYH,EAAaI,EAAUH,EAAaC,EAChDG,EAAcL,EAAaM,EAAUL,EAAaC,EAElDK,EAAeT,EAAG,aAElBU,EAAY,KAAK,IAAID,EAAcF,CAAW,EACpD,EAAG,MAAM,OAAS,KAAK,IAAIG,EAAWL,CAAS,EAAI,KAEnD,EAAG,MAAM,UAAYI,EAAeF,EAAc,OAAS,SAC3D,EAAG,MAAM,oBAAsB,GAAGH,EAAc,GAClD,EAkCA,OAhCA,EAAAb,EAAA,UAAA,KAAgB,CACdQ,EAAO,EACP,IAAMY,MAAiBZ,EAAO,EAE9B,OADA,OAAO,iBAAiB,SAAUY,CAAQ,MAC7B,OAAO,oBAAoB,SAAUA,CAAQ,CAC5D,EAAG,CAACd,CAAK,CAAC,GA4BR,EAAAL,EAAA,IAAA,CAACC,EAAD,CACE,IAAKG,EACE,QACP,SAXkB,GAAwC,EACxD,CAACD,GAAO,WAAa,EAAE,OAAO,MAAM,OAASA,GAAO,aACtDG,EAAS,EAAE,OAAO,KAAK,EACvBc,IAAW,CAAC,EAEhB,EAOI,UA9BmB,GAA0C,CAC/D,GAAI,EAAE,MAAQ,SAAW,CAAC,EAAE,SAAU,CACpC,EAAE,eAAe,EACjB,IAAMC,EAAOhB,EAAM,KAAK,EACxB,GAAI,CAACgB,EAAM,CACTf,EAAS,EAAE,EACXC,EAAO,EACP,MACF,CACAe,IAASD,CAAI,EACbf,EAAS,EAAE,EACX,0BAA4B,CACtBF,EAAY,UAAS,EAAY,QAAQ,MAAM,OAAS,QAC5DG,EAAO,CACT,CAAC,CACH,CACF,EAeI,KAAMO,EACN,GAAIX,CACL,CAAA,CAEL,E"}
|
|
1
|
+
{"version":3,"file":"ChatTextInput.cjs","names":["styled","Textarea","chatTextInput","useRef","useState","require_Textarea","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","StyledTextarea","ChatTextInput","props","textareaRef","value","setValue","resize","el","computed","lineHeight","paddingTop","paddingBottom","minHeight","minRows","maxHeightPx","maxRows","scrollHeight","newHeight","onResize","onChange","text","onSend"],"sources":["../../../src/components/chat/ChatTextInput.tsx"],"sourcesContent":["import { useRef, useEffect, useState, KeyboardEvent, ChangeEvent } from 'react'\nimport { Textarea, TextareaProps } from '~/components/textarea/Textarea'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { chatTextInput } from '@stokelp/styled-system/recipes'\n\ntype ChatTextInputProps = TextareaProps & {\n minRows?: number\n maxRows?: number\n onSend?: (message: string) => void\n}\n\nconst StyledTextarea = styled(Textarea, chatTextInput)\n\nexport const ChatTextInput: React.FC<ChatTextInputProps> = ({\n minRows = 1,\n maxRows = 6,\n onSend,\n onChange,\n ...props\n}) => {\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [value, setValue] = useState('')\n\n const resize = () => {\n const el = textareaRef.current\n if (!el) return\n\n el.style.height = 'auto'\n\n const computed = window.getComputedStyle(el)\n const lineHeight = parseFloat(computed.lineHeight) || 20\n const paddingTop = parseFloat(computed.paddingTop)\n const paddingBottom = parseFloat(computed.paddingBottom)\n\n const minHeight = lineHeight * minRows + paddingTop + paddingBottom\n const maxHeightPx = lineHeight * maxRows + paddingTop + paddingBottom\n\n const scrollHeight = el.scrollHeight\n\n const newHeight = Math.min(scrollHeight, maxHeightPx)\n el.style.height = Math.max(newHeight, minHeight) + 'px'\n\n el.style.overflowY = scrollHeight > maxHeightPx ? 'auto' : 'hidden'\n el.style.scrollPaddingBottom = `${paddingBottom}px`\n }\n\n useEffect(() => {\n resize()\n const onResize = () => resize()\n window.addEventListener('resize', onResize)\n return () => window.removeEventListener('resize', onResize)\n }, [value])\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n const text = value.trim()\n if (!text) {\n setValue('')\n resize()\n return\n }\n onSend?.(text)\n setValue('')\n requestAnimationFrame(() => {\n if (textareaRef.current) textareaRef.current.style.height = 'auto'\n resize()\n })\n }\n }\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (!props?.maxLength || e.target.value.length < props?.maxLength) {\n setValue(e.target.value)\n onChange?.(e)\n }\n }\n\n return (\n <StyledTextarea\n ref={textareaRef}\n value={value}\n onChange={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B,GAA0C,CAC/D,GAAI,EAAE,MAAQ,SAAW,CAAC,EAAE,SAAU,CACpC,EAAE,eAAe,EACjB,IAAMC,EAAOhB,EAAM,KAAK,EACxB,GAAI,CAACgB,EAAM,CACTf,EAAS,EAAE,EACXC,EAAO,EACP,MACF,CACAe,IAASD,CAAI,EACbf,EAAS,EAAE,EACX,0BAA4B,CACtBF,EAAY,UAAS,EAAY,QAAQ,MAAM,OAAS,QAC5DG,EAAO,CACT,CAAC,CACH,CACF,EAeI,KAAMO,EACN,GAAIX,CACL,CAAA,CAEL,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatTextInput.js","names":["StyledTextarea","styled","Textarea","chatTextInput","ChatTextInput","props","textareaRef","useRef","value","setValue","useState","resize","el","computed","lineHeight","paddingTop","paddingBottom","minHeight","minRows","maxHeightPx","maxRows","scrollHeight","newHeight","useEffect","onResize","onChange","text","onSend"],"sources":["../../../src/components/chat/ChatTextInput.tsx"],"sourcesContent":["import { useRef, useEffect, useState, KeyboardEvent, ChangeEvent } from 'react'\nimport { Textarea, TextareaProps } from '~/components'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { chatTextInput } from '@stokelp/styled-system/recipes'\n\ntype ChatTextInputProps = TextareaProps & {\n minRows?: number\n maxRows?: number\n onSend?: (message: string) => void\n}\n\nconst StyledTextarea = styled(Textarea, chatTextInput)\n\nexport const ChatTextInput: React.FC<ChatTextInputProps> = ({\n minRows = 1,\n maxRows = 6,\n onSend,\n onChange,\n ...props\n}) => {\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [value, setValue] = useState('')\n\n const resize = () => {\n const el = textareaRef.current\n if (!el) return\n\n el.style.height = 'auto'\n\n const computed = window.getComputedStyle(el)\n const lineHeight = parseFloat(computed.lineHeight) || 20\n const paddingTop = parseFloat(computed.paddingTop)\n const paddingBottom = parseFloat(computed.paddingBottom)\n\n const minHeight = lineHeight * minRows + paddingTop + paddingBottom\n const maxHeightPx = lineHeight * maxRows + paddingTop + paddingBottom\n\n const scrollHeight = el.scrollHeight\n\n const newHeight = Math.min(scrollHeight, maxHeightPx)\n el.style.height = Math.max(newHeight, minHeight) + 'px'\n\n el.style.overflowY = scrollHeight > maxHeightPx ? 'auto' : 'hidden'\n el.style.scrollPaddingBottom = `${paddingBottom}px`\n }\n\n useEffect(() => {\n resize()\n const onResize = () => resize()\n window.addEventListener('resize', onResize)\n return () => window.removeEventListener('resize', onResize)\n }, [value])\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n const text = value.trim()\n if (!text) {\n setValue('')\n resize()\n return\n }\n onSend?.(text)\n setValue('')\n requestAnimationFrame(() => {\n if (textareaRef.current) textareaRef.current.style.height = 'auto'\n resize()\n })\n }\n }\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (!props?.maxLength || e.target.value.length < props?.maxLength) {\n setValue(e.target.value)\n onChange?.(e)\n }\n }\n\n return (\n <StyledTextarea\n ref={textareaRef}\n value={value}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n rows={minRows}\n {...props}\n />\n )\n}\n"],"mappings":";;;;;;;AAWA,IAAMA,IAAiBC,EAAOC,GAAUC,CAAa,GAExCC,KAA+C,EAC1D,aAAU,GACV,aAAU,GACV,WACA,aACA,GAAGC,QACC;CACJ,IAAMC,IAAcC,EAAmC,IAAI,GACrD,CAACC,GAAOC,KAAYC,EAAS,EAAE,GAE/BC,UAAe;EACnB,IAAMC,IAAKN,EAAY;EACvB,IAAI,CAACM,GAAI;EAET,EAAG,MAAM,SAAS;EAElB,IAAMC,IAAW,OAAO,iBAAiBD,CAAE,GACrCE,IAAa,WAAWD,EAAS,UAAU,KAAK,IAChDE,IAAa,WAAWF,EAAS,UAAU,GAC3CG,IAAgB,WAAWH,EAAS,aAAa,GAEjDI,IAAYH,IAAaI,IAAUH,IAAaC,GAChDG,IAAcL,IAAaM,IAAUL,IAAaC,GAElDK,IAAeT,EAAG,cAElBU,IAAY,KAAK,IAAID,GAAcF,CAAW;EAIpD,AAHA,EAAG,MAAM,SAAS,KAAK,IAAIG,GAAWL,CAAS,IAAI,MAEnD,EAAG,MAAM,YAAYI,IAAeF,IAAc,SAAS,UAC3D,EAAG,MAAM,sBAAsB,GAAGH,EAAc;CAClD;CAkCA,OAhCAO,QAAgB;EACd,EAAO;EACP,IAAMC,UAAiBb,EAAO;EAE9B,OADA,OAAO,iBAAiB,UAAUa,CAAQ,SAC7B,OAAO,oBAAoB,UAAUA,CAAQ;CAC5D,GAAG,CAAChB,CAAK,CAAC,GA4BR,kBAACR,GAAD;EACE,KAAKM;EACE;EACP,WAXkB,MAAwC;GAC5D,CAAI,CAACD,GAAO,aAAa,EAAE,OAAO,MAAM,SAASA,GAAO,eACtDI,EAAS,EAAE,OAAO,KAAK,GACvBgB,IAAW,CAAC;EAEhB;EAOI,YA9BmB,MAA0C;GAC/D,IAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;IACpC,EAAE,eAAe;IACjB,IAAMC,IAAOlB,EAAM,KAAK;IACxB,IAAI,CAACkB,GAAM;KAET,AADAjB,EAAS,EAAE,GACXE,EAAO;KACP;IACF;IAGA,AAFAgB,IAASD,CAAI,GACbjB,EAAS,EAAE,GACX,4BAA4B;KAE1B,AADIH,EAAY,YAAS,EAAY,QAAQ,MAAM,SAAS,SAC5DK,EAAO;IACT,CAAC;GACH;EACF;EAeI,MAAMO;EACN,GAAIb;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"ChatTextInput.js","names":["StyledTextarea","styled","Textarea","chatTextInput","ChatTextInput","props","textareaRef","useRef","value","setValue","useState","resize","el","computed","lineHeight","paddingTop","paddingBottom","minHeight","minRows","maxHeightPx","maxRows","scrollHeight","newHeight","useEffect","onResize","onChange","text","onSend"],"sources":["../../../src/components/chat/ChatTextInput.tsx"],"sourcesContent":["import { useRef, useEffect, useState, KeyboardEvent, ChangeEvent } from 'react'\nimport { Textarea, TextareaProps } from '~/components/textarea/Textarea'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { chatTextInput } from '@stokelp/styled-system/recipes'\n\ntype ChatTextInputProps = TextareaProps & {\n minRows?: number\n maxRows?: number\n onSend?: (message: string) => void\n}\n\nconst StyledTextarea = styled(Textarea, chatTextInput)\n\nexport const ChatTextInput: React.FC<ChatTextInputProps> = ({\n minRows = 1,\n maxRows = 6,\n onSend,\n onChange,\n ...props\n}) => {\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [value, setValue] = useState('')\n\n const resize = () => {\n const el = textareaRef.current\n if (!el) return\n\n el.style.height = 'auto'\n\n const computed = window.getComputedStyle(el)\n const lineHeight = parseFloat(computed.lineHeight) || 20\n const paddingTop = parseFloat(computed.paddingTop)\n const paddingBottom = parseFloat(computed.paddingBottom)\n\n const minHeight = lineHeight * minRows + paddingTop + paddingBottom\n const maxHeightPx = lineHeight * maxRows + paddingTop + paddingBottom\n\n const scrollHeight = el.scrollHeight\n\n const newHeight = Math.min(scrollHeight, maxHeightPx)\n el.style.height = Math.max(newHeight, minHeight) + 'px'\n\n el.style.overflowY = scrollHeight > maxHeightPx ? 'auto' : 'hidden'\n el.style.scrollPaddingBottom = `${paddingBottom}px`\n }\n\n useEffect(() => {\n resize()\n const onResize = () => resize()\n window.addEventListener('resize', onResize)\n return () => window.removeEventListener('resize', onResize)\n }, [value])\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n const text = value.trim()\n if (!text) {\n setValue('')\n resize()\n return\n }\n onSend?.(text)\n setValue('')\n requestAnimationFrame(() => {\n if (textareaRef.current) textareaRef.current.style.height = 'auto'\n resize()\n })\n }\n }\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n if (!props?.maxLength || e.target.value.length < props?.maxLength) {\n setValue(e.target.value)\n onChange?.(e)\n }\n }\n\n return (\n <StyledTextarea\n ref={textareaRef}\n value={value}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n rows={minRows}\n {...props}\n />\n )\n}\n"],"mappings":";;;;;;;AAWA,IAAMA,IAAiBC,EAAOC,GAAUC,CAAa,GAExCC,KAA+C,EAC1D,aAAU,GACV,aAAU,GACV,WACA,aACA,GAAGC,QACC;CACJ,IAAMC,IAAcC,EAAmC,IAAI,GACrD,CAACC,GAAOC,KAAYC,EAAS,EAAE,GAE/BC,UAAe;EACnB,IAAMC,IAAKN,EAAY;EACvB,IAAI,CAACM,GAAI;EAET,EAAG,MAAM,SAAS;EAElB,IAAMC,IAAW,OAAO,iBAAiBD,CAAE,GACrCE,IAAa,WAAWD,EAAS,UAAU,KAAK,IAChDE,IAAa,WAAWF,EAAS,UAAU,GAC3CG,IAAgB,WAAWH,EAAS,aAAa,GAEjDI,IAAYH,IAAaI,IAAUH,IAAaC,GAChDG,IAAcL,IAAaM,IAAUL,IAAaC,GAElDK,IAAeT,EAAG,cAElBU,IAAY,KAAK,IAAID,GAAcF,CAAW;EAIpD,AAHA,EAAG,MAAM,SAAS,KAAK,IAAIG,GAAWL,CAAS,IAAI,MAEnD,EAAG,MAAM,YAAYI,IAAeF,IAAc,SAAS,UAC3D,EAAG,MAAM,sBAAsB,GAAGH,EAAc;CAClD;CAkCA,OAhCAO,QAAgB;EACd,EAAO;EACP,IAAMC,UAAiBb,EAAO;EAE9B,OADA,OAAO,iBAAiB,UAAUa,CAAQ,SAC7B,OAAO,oBAAoB,UAAUA,CAAQ;CAC5D,GAAG,CAAChB,CAAK,CAAC,GA4BR,kBAACR,GAAD;EACE,KAAKM;EACE;EACP,WAXkB,MAAwC;GAC5D,CAAI,CAACD,GAAO,aAAa,EAAE,OAAO,MAAM,SAASA,GAAO,eACtDI,EAAS,EAAE,OAAO,KAAK,GACvBgB,IAAW,CAAC;EAEhB;EAOI,YA9BmB,MAA0C;GAC/D,IAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;IACpC,EAAE,eAAe;IACjB,IAAMC,IAAOlB,EAAM,KAAK;IACxB,IAAI,CAACkB,GAAM;KAET,AADAjB,EAAS,EAAE,GACXE,EAAO;KACP;IACF;IAGA,AAFAgB,IAASD,CAAI,GACbjB,EAAS,EAAE,GACX,4BAA4B;KAE1B,AADIH,EAAY,YAAS,EAAY,QAAQ,MAAM,SAAS,SAC5DK,EAAO;IACT,CAAC;GACH;EACF;EAeI,MAAMO;EACN,GAAIb;CACL,CAAA;AAEL"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";const e=require("../../utils/slots.cjs"),t=require("../
|
|
2
|
-
`),[Z,le]=(0,u.useState)(X);if(X!==Z){le(X);let e=new Set(Y.map(e=>String(e.value)));!K&&W!==``&&A?.some(t=>!e.has(String(t)))&&G(``)}let ue=e=>{c&&c.length>0&&!c.find(t=>t.label===e.inputValue)&&O?.(),q?q(e.inputValue):S&&G(e.inputValue),se?.(e)},de=(0,u.useMemo)(()=>(0,s.createListCollection)({items:Y}),[Y]),fe=k??B,Q=h??(0,d.jsx)(
|
|
1
|
+
"use client";const e=require("../../utils/slots.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../tooltip/Tooltip.cjs"),r=require("../text/Text.cjs"),i=require("../../shared/ConditionalWrapper.cjs"),a=require("../input/Input.cjs"),o=require("../chip/Chip.cjs");let s=require("@ark-ui/react"),c=require("@stokelp/styled-system/jsx"),l=require("@stokelp/styled-system/recipes"),u=require("react"),d=require("react/jsx-runtime"),f=require("@stokelp/styled-system/css"),ee=require("react-window"),p=require("@zag-js/utils");var{withProvider:m,withContext:h}=e.createStyleContext(l.combobox),g=m((0,c.styled)(s.Combobox.Root),`root`,{defaultProps:{loopFocus:!0}}),te=h((0,c.styled)(s.Combobox.ClearTrigger),`clearTrigger`),ne=h((0,c.styled)(s.Combobox.Content),`content`),_=h((0,c.styled)(s.Combobox.Input),`input`),v=h((0,c.styled)(s.Combobox.Control),`control`),y=h((0,c.styled)(s.Combobox.Item),`item`),b=h((0,c.styled)(s.Combobox.ItemText),`itemText`),re=h((0,c.styled)(s.Combobox.Positioner),`positioner`),x=h((0,c.styled)(s.Combobox.Trigger),`trigger`),S=()=>(0,d.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,d.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,f.css)({stroke:`grey.100`})})]}),C=()=>(0,d.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,f.css)({fill:`primary.500`})}),(0,d.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 w({item:e,isMultiple:t,renderItem:n}){let r=(0,s.useComboboxItemContext)();return(0,d.jsxs)(d.Fragment,{children:[t?r.selected?(0,d.jsx)(C,{}):(0,d.jsx)(S,{}):null,n?n(e):(0,d.jsx)(b,{truncate:!0,children:e.label})]})}function ie({index:e,style:t,ariaAttributes:r,items:a,isMultiple:o,renderItem:s}){let c=a[e];return(0,d.jsx)(i.ConditionalWrapper,{when:!!c.tooltip,wrapper:e=>(0,d.jsx)(n.Tooltip,{label:c.tooltip,children:e}),children:(0,d.jsx)(y,{item:c,style:t,"aria-posinset":r[`aria-posinset`],"aria-setsize":r[`aria-setsize`],children:(0,d.jsx)(w,{renderItem:s,item:c,isMultiple:o})})})}var T=({items:e=[],initialItems:c,debounceMs:l=0,placeholder:f,emptyLabel:m,loadingLabel:h,usePortal:b=!0,withAutoFilter:S=!0,positioning:C,loadItems:T,renderItem:E,renderValue:D,onResetInitialItems:O,isLoading:k,value:A,defaultValue:j,openDropdownOnFocus:M=!0,clearValueWhenEmpty:ae=!0,virtualized:oe,rowHeight:N=34,returnItemsOnEmpty:P,multiple:F=!1,onInputValueChange:se,...I})=>{let L=t.useUiLabels(),[R,z]=(0,u.useState)(()=>e),[B,V]=(0,u.useState)(!1),[H,U]=(0,u.useState)(!1),[W,G]=(0,u.useState)(``),K=typeof T==`function`,q=(0,u.useMemo)(()=>T?(0,p.debounce)(async e=>{try{U(!0),V(!0);let t=await T(e);z(t)}catch(e){console.error(e),z([])}finally{V(!1)}},l):null,[T,l]),ce=(0,u.useMemo)(()=>{if(!S||W===``)return e;let t=W.toLowerCase(),n=e.filter(e=>e.label.toLowerCase().includes(t));return n.length===0&&P?e:n},[e,S,W,P]),J=K?R:ce,Y=(0,u.useMemo)(()=>[...J,...c??[]],[J,c]),X=A?.map(String).join(`
|
|
2
|
+
`),[Z,le]=(0,u.useState)(X);if(X!==Z){le(X);let e=new Set(Y.map(e=>String(e.value)));!K&&W!==``&&A?.some(t=>!e.has(String(t)))&&G(``)}let ue=e=>{c&&c.length>0&&!c.find(t=>t.label===e.inputValue)&&O?.(),q?q(e.inputValue):S&&G(e.inputValue),se?.(e)},de=(0,u.useMemo)(()=>(0,s.createListCollection)({items:Y}),[Y]),fe=k??B,Q=h??(0,d.jsx)(r.Text,{p:`space-8`,textAlign:`center`,children:L.loading}),$=m??(0,d.jsx)(r.Text,{p:`space-8`,textAlign:`center`,children:L.noResults});return(0,d.jsxs)(g,{lazyMount:!0,unmountOnExit:!0,collection:de,positioning:{sameWidth:!0,gutter:0,...C},"data-recipe":`combobox`,onInputValueChange:ue,value:A,defaultValue:j,...I,multiple:F,children:[F?(0,d.jsx)(s.Combobox.Context,{children:t=>(0,d.jsxs)(v,{"data-multiple":`true`,"data-open":t.open||void 0,children:[t.value.map(n=>{let r=e.find(e=>String(e.value)===String(n));return r?(0,d.jsxs)(o.Chip,{size:`sm`,children:[D?D(r):(0,d.jsx)(o.ChipLabel,{children:r.label}),!I.readOnly&&!I.disabled&&(0,d.jsx)(o.ChipClearTrigger,{"aria-label":`Retirer ${r.label}`,onClick:()=>t.setValue(t.value.filter(e=>String(e)!==String(n)))})]},n):null}),(0,d.jsx)(_,{asChild:!0,"data-multiple":`true`,placeholder:t.hasSelectedItems?void 0:f,onFocus:()=>{M&&!K&&t.setOpen(!0)},children:(0,d.jsx)(a.Input,{})}),(0,d.jsx)(x,{asChild:!0,hidden:K&&(!c||c.length===0),children:(0,d.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,d.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,d.jsxs)(v,{children:[(0,d.jsx)(s.Combobox.Context,{children:e=>(0,d.jsx)(_,{asChild:!0,placeholder:f,onInput:t=>{let n=t.currentTarget.value;ae&&n===``&&e.clearValue()},onFocus:()=>{M&&!K&&e.setOpen(!0)},children:(0,d.jsx)(a.Input,{})})}),(0,d.jsx)(x,{asChild:!0,hidden:K&&(!c||c.length===0),children:(0,d.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,d.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,d.jsx)(te,{disabled:I.readOnly,onClick:O,asChild:!0,children:(0,d.jsx)(`button`,{children:(0,d.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,d.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,d.jsx)(i.ConditionalWrapper,{when:b,wrapper:e=>(0,d.jsx)(s.Portal,{children:e}),children:(0,d.jsx)(re,{children:(0,d.jsx)(ne,{children:fe?Q:Y.length===0?(0,d.jsx)(d.Fragment,{children:K?H?$:Q:$}):oe?(0,d.jsx)(ee.List,{role:`presentation`,rowComponent:ie,rowProps:{items:Y,isMultiple:F,renderItem:E},rowCount:Y.length,rowHeight:N,style:{height:Math.min(N*Y.length,180)}}):Y.map(e=>(0,d.jsx)(i.ConditionalWrapper,{when:!!e.tooltip,wrapper:t=>(0,d.jsx)(n.Tooltip,{label:e.tooltip,children:t}),children:(0,d.jsx)(y,{item:e,children:(0,d.jsx)(w,{renderItem:E,item:e,isMultiple:F})},e.value)},e.value))})})})]})};exports.Combobox=T;
|
|
3
3
|
//# sourceMappingURL=Combobox.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.cjs","names":["createStyleContext","combobox","styled","ArkCombobox","css","useComboboxItemContext","_Fragment","ConditionalWrapper","Tooltip","useUiLabels","useState","useMemo","debounce","createListCollection","Text","Chip","ChipLabel","ChipClearTrigger","UIInput","Portal","List","require_slots","require_Tooltip","require_Text","require_ConditionalWrapper","require_UiLabelsProvider","require_Input","require_Chip","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","_stokelp_styled_system_css","react_window","_zag_js_utils","Root","withProvider","ClearTrigger","withContext","Content","Input","Control","Item","ItemText","Positioner","Trigger","MultipleUncheckedIndicator","MultipleCheckedIndicator","CustomInnerItem","context","isMultiple","renderItem","item","VirtualRow","items","index","ariaAttributes","Combobox","itemsFromUsers","controlledIsLoading","props","uiLabels","loadedItems","setLoadedItems","isLoading","setIsLoading","firstQueryTriggered","setFirstQueryTriggered","filterText","setFilterText","asyncMode","loadItems","debouncedLoadItems","newItems","value","error","debounceMs","filteredItems","withAutoFilter","text","matching","returnItemsOnEmpty","sourceItems","allItems","initialItems","valueKey","valueKeyOfFilter","setValueKeyOfFilter","listed","v","handleInputChange","details","onResetInitialItems","onInputValueChange","collection","effectiveIsLoading","loadingContent","loadingLabel","emptyContent","emptyLabel","positioning","multiple","api","i","renderValue","x","placeholder","openDropdownOnFocus","e","clearValueWhenEmpty","usePortal","virtualized","rowHeight"],"sources":["../../../src/components/combobox/Combobox.tsx"],"sourcesContent":["import {\n Combobox as ArkCombobox,\n type ComboboxRootProps,\n createListCollection,\n Portal,\n useComboboxItemContext,\n} from '@ark-ui/react'\nimport { FC, ReactNode, useMemo, useState } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { debounce } from '@zag-js/utils'\n\nimport { combobox } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { Input as UIInput } from '~/components/input'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { Chip, ChipClearTrigger, ChipLabel } from '~/components/chip'\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(combobox)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkCombobox.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkCombobox.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkCombobox.Content), 'content')\nconst Input = withContext(styled(ArkCombobox.Input), 'input')\nconst Control = withContext(styled(ArkCombobox.Control), 'control')\nconst Item = withContext(styled(ArkCombobox.Item), 'item')\nconst ItemText = withContext(styled(ArkCombobox.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkCombobox.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkCombobox.Trigger), 'trigger')\n\nexport type ComboboxItem = {\n value: string | number\n label: string\n disabled?: boolean\n tooltip?: ReactNode\n}\n\nexport type ComboboxProps<T extends ComboboxItem> = Omit<\n ComboboxRootProps<T>,\n 'collection' | 'value' | 'defaultValue'\n> & {\n // Item values may be numbers: the chips compare them as strings.\n value?: Array<string | number>\n defaultValue?: Array<string | number>\n items?: T[]\n initialItems?: T[]\n renderItem?: (item: T) => ReactNode\n /**\n * Renders the inner content of each selected chip in `multiple` mode.\n * Receives the selected item and should return the chip body (the removable\n * clear button is appended automatically). Defaults to the item label.\n */\n renderValue?: (item: T) => ReactNode\n loadItems?: (inputValue: string) => Promise<T[]>\n debounceMs?: number\n emptyLabel?: ReactNode\n loadingLabel?: ReactNode\n placeholder?: string\n usePortal?: boolean\n isLoading?: boolean\n withAutoFilter?: boolean\n onResetInitialItems?: () => void\n openDropdownOnFocus?: boolean\n clearValueWhenEmpty?: boolean\n virtualized?: boolean\n rowHeight?: number\n returnItemsOnEmpty?: boolean\n} & Omit<HTMLStyledProps<'div'>, 'defaultValue'> &\n RecipeVariantProps<typeof combobox>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends ComboboxItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\nfunction CustomInnerItem<Item extends ComboboxItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useComboboxItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\ninterface VirtualRowProps<Item extends ComboboxItem> {\n items: 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 ComboboxItem>({\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\nexport const Combobox = <T extends ComboboxItem>({\n items: itemsFromUsers = [],\n initialItems,\n debounceMs = 0,\n placeholder,\n emptyLabel,\n loadingLabel,\n usePortal = true,\n withAutoFilter = true,\n positioning,\n loadItems,\n renderItem,\n renderValue,\n onResetInitialItems,\n isLoading: controlledIsLoading,\n value,\n defaultValue,\n openDropdownOnFocus = true,\n clearValueWhenEmpty = true,\n virtualized,\n rowHeight = 34,\n returnItemsOnEmpty,\n multiple = false,\n onInputValueChange,\n ...props\n}: ComboboxProps<T>) => {\n const uiLabels = useUiLabels()\n // With `loadItems`, the list is what it returned last; the `items` prop only seeds it.\n const [loadedItems, setLoadedItems] = useState(() => itemsFromUsers)\n const [isLoading, setIsLoading] = useState(false)\n const [firstQueryTriggered, setFirstQueryTriggered] = useState(false)\n // Without `loadItems`, the text the list is filtered on: the input's, as zag reports it.\n const [filterText, setFilterText] = useState('')\n const asyncMode = typeof loadItems === 'function'\n\n const debouncedLoadItems = useMemo(\n () =>\n loadItems\n ? debounce(async (value: string) => {\n try {\n setFirstQueryTriggered(true)\n setIsLoading(true)\n const newItems = await loadItems(value)\n setLoadedItems(newItems)\n } catch (error) {\n console.error(error)\n setLoadedItems([])\n } finally {\n setIsLoading(false)\n }\n }, debounceMs)\n : null,\n [loadItems, debounceMs],\n )\n\n // The list is derived from the `items` of this very render, never mirrored into state: zag\n // re-derives the input text from the collection as soon as `value` changes, so a value set in\n // the same render as the item that carries it must find that item in the collection already.\n // A mirror caught up one render late, and the input went blank.\n const filteredItems = useMemo(() => {\n if (!withAutoFilter || filterText === '') return itemsFromUsers\n const text = filterText.toLowerCase()\n const matching = itemsFromUsers.filter((item: ComboboxItem) => item.label.toLowerCase().includes(text))\n return matching.length === 0 && returnItemsOnEmpty ? itemsFromUsers : matching\n }, [itemsFromUsers, withAutoFilter, filterText, returnItemsOnEmpty])\n\n const sourceItems = asyncMode ? loadedItems : filteredItems\n const allItems = useMemo(() => [...sourceItems, ...(initialItems ?? [])], [sourceItems, initialItems])\n\n // A new `value` the typed text filters out (an item created from the empty state under\n // another name, a value the app sets) would still be stringified to nothing: drop the\n // filter for that render. zag then writes the label in the input, and the filter follows it.\n const valueKey = value?.map(String).join('\\n')\n const [valueKeyOfFilter, setValueKeyOfFilter] = useState(valueKey)\n if (valueKey !== valueKeyOfFilter) {\n setValueKeyOfFilter(valueKey)\n const listed = new Set(allItems.map(item => String(item.value)))\n if (!asyncMode && filterText !== '' && value?.some(v => !listed.has(String(v)))) {\n setFilterText('')\n }\n }\n\n // A caller's onInputValueChange runs as well: it no longer replaces the filter.\n const handleInputChange = (details: ArkCombobox.InputValueChangeDetails) => {\n if (\n initialItems &&\n initialItems.length > 0 &&\n !initialItems.find((item: ComboboxItem) => item.label === details.inputValue)\n ) {\n onResetInitialItems?.()\n }\n\n if (debouncedLoadItems) {\n debouncedLoadItems(details.inputValue)\n } else if (withAutoFilter) {\n setFilterText(details.inputValue)\n }\n onInputValueChange?.(details)\n }\n\n const collection = useMemo(() => createListCollection({ items: allItems }), [allItems])\n\n const effectiveIsLoading = controlledIsLoading ?? isLoading\n\n const loadingContent = loadingLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n {uiLabels.loading}\n </Text>\n )\n const emptyContent = emptyLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n {uiLabels.noResults}\n </Text>\n )\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"combobox\"\n onInputValueChange={handleInputChange}\n value={value as string[] | undefined}\n defaultValue={defaultValue as string[] | undefined}\n {...props}\n multiple={multiple}\n >\n {multiple ? (\n // Tags-input layout: the control (styled via the recipe's `&[data-multiple]`\n // selectors) is the bordered box holding the selected chips and a\n // borderless growing input.\n <ArkCombobox.Context>\n {api => (\n <Control data-multiple=\"true\" data-open={api.open || undefined}>\n {/* Resolve chips from the current value against the full source\n list rather than ark's cached `selectedItems`: the cache is only\n re-derived on value changes, so async-loaded defaults would show\n 0 chips until the user selects something. Looking up in\n itemsFromUsers (never the filtered list) also keeps chips visible\n while the user is typing to filter. */}\n {api.value.map(v => {\n const item = itemsFromUsers.find((i: T) => String(i.value) === String(v))\n if (!item) return null\n return (\n <Chip key={v} size=\"sm\">\n {renderValue ? renderValue(item) : <ChipLabel>{item.label}</ChipLabel>}\n {!props.readOnly && !props.disabled && (\n <ChipClearTrigger\n aria-label={`Retirer ${item.label}`}\n // Remove by strict-equality-safe filter: stored values may\n // be numbers while item.value is compared as a string.\n onClick={() => api.setValue(api.value.filter(x => String(x) !== String(v)))}\n />\n )}\n </Chip>\n )\n })}\n <Input\n asChild\n data-multiple=\"true\"\n placeholder={api.hasSelectedItems ? undefined : placeholder}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n </Control>\n )}\n </ArkCombobox.Context>\n ) : (\n <Control>\n <ArkCombobox.Context>\n {api => (\n <Input\n asChild\n placeholder={placeholder}\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\n )}\n </ArkCombobox.Context>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} onClick={onResetInitialItems} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n )}\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal>{children}</Portal>}>\n <Positioner>\n <Content>\n {effectiveIsLoading ? (\n loadingContent\n ) : allItems.length === 0 ? (\n <>{asyncMode ? (firstQueryTriggered ? emptyContent : loadingContent) : emptyContent}</>\n ) : virtualized ? (\n // 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<T>}\n rowProps={{ items: allItems, isMultiple: multiple, renderItem }}\n rowCount={allItems.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * allItems.length, 180) }}\n />\n ) : (\n allItems.map(item => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={multiple} />\n </Item>\n </ConditionalWrapper>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n </Root>\n )\n}\n"],"mappings":"A,yhBAwBA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,QAAQ,EAG3DmC,EAAOC,GAAA,EAAanC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,IAAS,EAAG,OAAQ,CAC/D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEKmC,GAAeC,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,YAAY,EAAG,cAAc,EAC3EqC,GAAUD,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,OAAO,EAAG,SAAS,EAC5DsC,EAAQF,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,KAAK,EAAG,OAAO,EACtDuC,EAAUH,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,OAAO,EAAG,SAAS,EAC5DwC,EAAOJ,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,IAAI,EAAG,MAAM,EACnDyC,EAAWL,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,QA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ACE,KAAK,eACL,aAAckC,GACd,SAAU,CAAE,MAAO8B,EAAU,WAAYkB,EAAU,YAAW,EAC9D,SAAUlB,EAAS,OACR,YACX,MAAO,CAAE,OAAQ,KAAK,IAAI6B,EAAY7B,EAAS,OAAQ,GAAG,CAAE,CAC7D,CAAA,EAEDA,EAAS,IAAI,IACX,EAAApD,EAAA,IAAA,CAACzB,EAAAA,mBAAD,CAEE,KAAM,CAAC,CAAC8C,EAAK,QACb,QAAS,IAAY,EAAArB,EAAA,IAAA,CAACxB,EAAAA,QAAD,CAAS,MAAO6C,EAAK,QAAU,UAAkB,CAAA,EAEtE,UAAA,EAAArB,EAAA,IAAA,CAACW,EAAD,CAA6B,OAC3B,UAAA,EAAAX,EAAA,IAAA,CAACiB,EAAD,CAA6B,aAAkB,OAAM,WAAYqD,CAAW,CAAA,CACxE,EAFKjD,EAAK,KAEV,CACY,EAPbA,EAAK,KAOQ,CACrB,CAEI,CAAA,CACC,CAAA,CACM,CAAA,CAChB,C,EAEV,E"}
|
|
1
|
+
{"version":3,"file":"Combobox.cjs","names":["createStyleContext","combobox","styled","ArkCombobox","css","useComboboxItemContext","_Fragment","ConditionalWrapper","Tooltip","useUiLabels","useState","useMemo","debounce","createListCollection","Text","Chip","ChipLabel","ChipClearTrigger","UIInput","Portal","List","require_slots","require_UiLabelsProvider","require_Tooltip","require_Text","require_ConditionalWrapper","require_Input","require_Chip","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","_stokelp_styled_system_css","react_window","_zag_js_utils","Root","withProvider","ClearTrigger","withContext","Content","Input","Control","Item","ItemText","Positioner","Trigger","MultipleUncheckedIndicator","MultipleCheckedIndicator","CustomInnerItem","context","isMultiple","renderItem","item","VirtualRow","items","index","ariaAttributes","Combobox","itemsFromUsers","controlledIsLoading","props","uiLabels","loadedItems","setLoadedItems","isLoading","setIsLoading","firstQueryTriggered","setFirstQueryTriggered","filterText","setFilterText","asyncMode","loadItems","debouncedLoadItems","newItems","value","error","debounceMs","filteredItems","withAutoFilter","text","matching","returnItemsOnEmpty","sourceItems","allItems","initialItems","valueKey","valueKeyOfFilter","setValueKeyOfFilter","listed","v","handleInputChange","details","onResetInitialItems","onInputValueChange","collection","effectiveIsLoading","loadingContent","loadingLabel","emptyContent","emptyLabel","positioning","multiple","api","i","renderValue","x","placeholder","openDropdownOnFocus","e","clearValueWhenEmpty","usePortal","virtualized","rowHeight"],"sources":["../../../src/components/combobox/Combobox.tsx"],"sourcesContent":["import {\n Combobox as ArkCombobox,\n type ComboboxRootProps,\n createListCollection,\n Portal,\n useComboboxItemContext,\n} from '@ark-ui/react'\nimport { FC, ReactNode, useMemo, useState } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { debounce } from '@zag-js/utils'\n\nimport { combobox } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { Input as UIInput } from '~/components/input'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { Chip, ChipClearTrigger, ChipLabel } from '~/components/chip'\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(combobox)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkCombobox.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkCombobox.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkCombobox.Content), 'content')\nconst Input = withContext(styled(ArkCombobox.Input), 'input')\nconst Control = withContext(styled(ArkCombobox.Control), 'control')\nconst Item = withContext(styled(ArkCombobox.Item), 'item')\nconst ItemText = withContext(styled(ArkCombobox.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkCombobox.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkCombobox.Trigger), 'trigger')\n\nexport type ComboboxItem = {\n value: string | number\n label: string\n disabled?: boolean\n tooltip?: ReactNode\n}\n\nexport type ComboboxProps<T extends ComboboxItem> = Omit<\n ComboboxRootProps<T>,\n 'collection' | 'value' | 'defaultValue'\n> & {\n // Item values may be numbers: the chips compare them as strings.\n value?: Array<string | number>\n defaultValue?: Array<string | number>\n items?: T[]\n initialItems?: T[]\n renderItem?: (item: T) => ReactNode\n /**\n * Renders the inner content of each selected chip in `multiple` mode.\n * Receives the selected item and should return the chip body (the removable\n * clear button is appended automatically). Defaults to the item label.\n */\n renderValue?: (item: T) => ReactNode\n loadItems?: (inputValue: string) => Promise<T[]>\n debounceMs?: number\n emptyLabel?: ReactNode\n loadingLabel?: ReactNode\n placeholder?: string\n usePortal?: boolean\n isLoading?: boolean\n withAutoFilter?: boolean\n onResetInitialItems?: () => void\n openDropdownOnFocus?: boolean\n clearValueWhenEmpty?: boolean\n virtualized?: boolean\n rowHeight?: number\n returnItemsOnEmpty?: boolean\n} & Omit<HTMLStyledProps<'div'>, 'defaultValue'> &\n RecipeVariantProps<typeof combobox>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends ComboboxItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\nfunction CustomInnerItem<Item extends ComboboxItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useComboboxItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\ninterface VirtualRowProps<Item extends ComboboxItem> {\n items: 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 ComboboxItem>({\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\nexport const Combobox = <T extends ComboboxItem>({\n items: itemsFromUsers = [],\n initialItems,\n debounceMs = 0,\n placeholder,\n emptyLabel,\n loadingLabel,\n usePortal = true,\n withAutoFilter = true,\n positioning,\n loadItems,\n renderItem,\n renderValue,\n onResetInitialItems,\n isLoading: controlledIsLoading,\n value,\n defaultValue,\n openDropdownOnFocus = true,\n clearValueWhenEmpty = true,\n virtualized,\n rowHeight = 34,\n returnItemsOnEmpty,\n multiple = false,\n onInputValueChange,\n ...props\n}: ComboboxProps<T>) => {\n const uiLabels = useUiLabels()\n // With `loadItems`, the list is what it returned last; the `items` prop only seeds it.\n const [loadedItems, setLoadedItems] = useState(() => itemsFromUsers)\n const [isLoading, setIsLoading] = useState(false)\n const [firstQueryTriggered, setFirstQueryTriggered] = useState(false)\n // Without `loadItems`, the text the list is filtered on: the input's, as zag reports it.\n const [filterText, setFilterText] = useState('')\n const asyncMode = typeof loadItems === 'function'\n\n const debouncedLoadItems = useMemo(\n () =>\n loadItems\n ? debounce(async (value: string) => {\n try {\n setFirstQueryTriggered(true)\n setIsLoading(true)\n const newItems = await loadItems(value)\n setLoadedItems(newItems)\n } catch (error) {\n console.error(error)\n setLoadedItems([])\n } finally {\n setIsLoading(false)\n }\n }, debounceMs)\n : null,\n [loadItems, debounceMs],\n )\n\n // The list is derived from the `items` of this very render, never mirrored into state: zag\n // re-derives the input text from the collection as soon as `value` changes, so a value set in\n // the same render as the item that carries it must find that item in the collection already.\n // A mirror caught up one render late, and the input went blank.\n const filteredItems = useMemo(() => {\n if (!withAutoFilter || filterText === '') return itemsFromUsers\n const text = filterText.toLowerCase()\n const matching = itemsFromUsers.filter((item: ComboboxItem) => item.label.toLowerCase().includes(text))\n return matching.length === 0 && returnItemsOnEmpty ? itemsFromUsers : matching\n }, [itemsFromUsers, withAutoFilter, filterText, returnItemsOnEmpty])\n\n const sourceItems = asyncMode ? loadedItems : filteredItems\n const allItems = useMemo(() => [...sourceItems, ...(initialItems ?? [])], [sourceItems, initialItems])\n\n // A new `value` the typed text filters out (an item created from the empty state under\n // another name, a value the app sets) would still be stringified to nothing: drop the\n // filter for that render. zag then writes the label in the input, and the filter follows it.\n const valueKey = value?.map(String).join('\\n')\n const [valueKeyOfFilter, setValueKeyOfFilter] = useState(valueKey)\n if (valueKey !== valueKeyOfFilter) {\n setValueKeyOfFilter(valueKey)\n const listed = new Set(allItems.map(item => String(item.value)))\n if (!asyncMode && filterText !== '' && value?.some(v => !listed.has(String(v)))) {\n setFilterText('')\n }\n }\n\n // A caller's onInputValueChange runs as well: it no longer replaces the filter.\n const handleInputChange = (details: ArkCombobox.InputValueChangeDetails) => {\n if (\n initialItems &&\n initialItems.length > 0 &&\n !initialItems.find((item: ComboboxItem) => item.label === details.inputValue)\n ) {\n onResetInitialItems?.()\n }\n\n if (debouncedLoadItems) {\n debouncedLoadItems(details.inputValue)\n } else if (withAutoFilter) {\n setFilterText(details.inputValue)\n }\n onInputValueChange?.(details)\n }\n\n const collection = useMemo(() => createListCollection({ items: allItems }), [allItems])\n\n const effectiveIsLoading = controlledIsLoading ?? isLoading\n\n const loadingContent = loadingLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n {uiLabels.loading}\n </Text>\n )\n const emptyContent = emptyLabel ?? (\n <Text p=\"space-8\" textAlign=\"center\">\n {uiLabels.noResults}\n </Text>\n )\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"combobox\"\n onInputValueChange={handleInputChange}\n value={value as string[] | undefined}\n defaultValue={defaultValue as string[] | undefined}\n {...props}\n multiple={multiple}\n >\n {multiple ? (\n // Tags-input layout: the control (styled via the recipe's `&[data-multiple]`\n // selectors) is the bordered box holding the selected chips and a\n // borderless growing input.\n <ArkCombobox.Context>\n {api => (\n <Control data-multiple=\"true\" data-open={api.open || undefined}>\n {/* Resolve chips from the current value against the full source\n list rather than ark's cached `selectedItems`: the cache is only\n re-derived on value changes, so async-loaded defaults would show\n 0 chips until the user selects something. Looking up in\n itemsFromUsers (never the filtered list) also keeps chips visible\n while the user is typing to filter. */}\n {api.value.map(v => {\n const item = itemsFromUsers.find((i: T) => String(i.value) === String(v))\n if (!item) return null\n return (\n <Chip key={v} size=\"sm\">\n {renderValue ? renderValue(item) : <ChipLabel>{item.label}</ChipLabel>}\n {!props.readOnly && !props.disabled && (\n <ChipClearTrigger\n aria-label={`Retirer ${item.label}`}\n // Remove by strict-equality-safe filter: stored values may\n // be numbers while item.value is compared as a string.\n onClick={() => api.setValue(api.value.filter(x => String(x) !== String(v)))}\n />\n )}\n </Chip>\n )\n })}\n <Input\n asChild\n data-multiple=\"true\"\n placeholder={api.hasSelectedItems ? undefined : placeholder}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n </Control>\n )}\n </ArkCombobox.Context>\n ) : (\n <Control>\n <ArkCombobox.Context>\n {api => (\n <Input\n asChild\n placeholder={placeholder}\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n onFocus={() => {\n if (!openDropdownOnFocus || asyncMode) return\n api.setOpen(true)\n }}\n >\n <UIInput />\n </Input>\n )}\n </ArkCombobox.Context>\n <Trigger asChild hidden={asyncMode && (!initialItems || initialItems.length === 0)}>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} onClick={onResetInitialItems} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n )}\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal>{children}</Portal>}>\n <Positioner>\n <Content>\n {effectiveIsLoading ? (\n loadingContent\n ) : allItems.length === 0 ? (\n <>{asyncMode ? (firstQueryTriggered ? emptyContent : loadingContent) : emptyContent}</>\n ) : virtualized ? (\n // 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<T>}\n rowProps={{ items: allItems, isMultiple: multiple, renderItem }}\n rowCount={allItems.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * allItems.length, 180) }}\n />\n ) : (\n allItems.map(item => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={multiple} />\n </Item>\n </ConditionalWrapper>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n </Root>\n )\n}\n"],"mappings":"A,yhBAwBA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,QAAQ,EAG3DmC,EAAOC,GAAA,EAAanC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,IAAS,EAAG,OAAQ,CAC/D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEKmC,GAAeC,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,YAAY,EAAG,cAAc,EAC3EqC,GAAUD,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,OAAO,EAAG,SAAS,EAC5DsC,EAAQF,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,KAAK,EAAG,OAAO,EACtDuC,EAAUH,GAAA,EAAYrC,EAAAA,OAAAA,CAAOC,EAAAA,SAAY,OAAO,EAAG,SAAS,EAC5DwC,EAAOJ,G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A1B,EAAAA,SAAA,CAAA,SAAGiE,EAAaJ,EAAsBgC,EAAeF,EAAkBE,CAAe,CAAA,EACpFa,IAGF,EAAAhF,EAAA,IAAA,CAACZ,GAAAA,KAAD,CACE,KAAK,eACL,aAAckC,GACd,SAAU,CAAE,MAAO8B,EAAU,WAAYkB,EAAU,YAAW,EAC9D,SAAUlB,EAAS,OACR,YACX,MAAO,CAAE,OAAQ,KAAK,IAAI6B,EAAY7B,EAAS,OAAQ,GAAG,CAAE,CAC7D,CAAA,EAEDA,EAAS,IAAI,IACX,EAAApD,EAAA,IAAA,CAACzB,EAAAA,mBAAD,CAEE,KAAM,CAAC,CAAC8C,EAAK,QACb,QAAS,IAAY,EAAArB,EAAA,IAAA,CAACxB,EAAAA,QAAD,CAAS,MAAO6C,EAAK,QAAU,UAAkB,CAAA,EAEtE,UAAA,EAAArB,EAAA,IAAA,CAACW,EAAD,CAA6B,OAC3B,UAAA,EAAAX,EAAA,IAAA,CAACiB,EAAD,CAA6B,aAAkB,OAAM,WAAYqD,CAAW,CAAA,CACxE,EAFKjD,EAAK,KAEV,CACY,EAPbA,EAAK,KAOQ,CACrB,CAEI,CAAA,CACC,CAAA,CACM,CAAA,CAChB,C,EAEV,E"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createStyleContext as e } from "../../utils/slots.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useUiLabels as t } from "../ui-labels/UiLabelsProvider.js";
|
|
4
|
+
import { Tooltip as n } from "../tooltip/Tooltip.js";
|
|
5
|
+
import { Text as r } from "../text/Text.js";
|
|
6
|
+
import { ConditionalWrapper as i } from "../../shared/ConditionalWrapper.js";
|
|
7
7
|
import { Input as a } from "../input/Input.js";
|
|
8
8
|
import { Chip as o, ChipClearTrigger as s, ChipLabel as c } from "../chip/Chip.js";
|
|
9
9
|
import { Combobox as l, Portal as u, createListCollection as ee, useComboboxItemContext as d } from "@ark-ui/react";
|
|
@@ -62,19 +62,19 @@ function k({ item: e, isMultiple: t, renderItem: n }) {
|
|
|
62
62
|
children: e.label
|
|
63
63
|
})] });
|
|
64
64
|
}
|
|
65
|
-
function se({ index: e, style:
|
|
65
|
+
function se({ index: e, style: t, ariaAttributes: r, items: a, isMultiple: o, renderItem: s }) {
|
|
66
66
|
let c = a[e];
|
|
67
|
-
return /* @__PURE__ */ _(
|
|
67
|
+
return /* @__PURE__ */ _(i, {
|
|
68
68
|
when: !!c.tooltip,
|
|
69
|
-
wrapper: (e) => /* @__PURE__ */ _(
|
|
69
|
+
wrapper: (e) => /* @__PURE__ */ _(n, {
|
|
70
70
|
label: c.tooltip,
|
|
71
71
|
children: e
|
|
72
72
|
}),
|
|
73
73
|
children: /* @__PURE__ */ _(w, {
|
|
74
74
|
item: c,
|
|
75
|
-
style:
|
|
76
|
-
"aria-posinset":
|
|
77
|
-
"aria-setsize":
|
|
75
|
+
style: t,
|
|
76
|
+
"aria-posinset": r["aria-posinset"],
|
|
77
|
+
"aria-setsize": r["aria-setsize"],
|
|
78
78
|
children: /* @__PURE__ */ _(k, {
|
|
79
79
|
renderItem: s,
|
|
80
80
|
item: c,
|
|
@@ -84,7 +84,7 @@ function se({ index: e, style: n, ariaAttributes: i, items: a, isMultiple: o, re
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
var A = ({ items: e = [], initialItems: d, debounceMs: f = 0, placeholder: p, emptyLabel: y, loadingLabel: b, usePortal: x = !0, withAutoFilter: T = !0, positioning: D, loadItems: O, renderItem: A, renderValue: j, onResetInitialItems: M, isLoading: N, value: P, defaultValue: ce, openDropdownOnFocus: F = !0, clearValueWhenEmpty: le = !0, virtualized: ue, rowHeight: I = 34, returnItemsOnEmpty: L, multiple: R = !1, onInputValueChange: z, ...B }) => {
|
|
87
|
-
let V =
|
|
87
|
+
let V = t(), [H, U] = h(() => e), [de, W] = h(!1), [fe, pe] = h(!1), [G, K] = h(""), q = typeof O == "function", J = m(() => O ? ne(async (e) => {
|
|
88
88
|
try {
|
|
89
89
|
pe(!0), W(!0);
|
|
90
90
|
let t = await O(e);
|
|
@@ -111,11 +111,11 @@ var A = ({ items: e = [], initialItems: d, debounceMs: f = 0, placeholder: p, em
|
|
|
111
111
|
}
|
|
112
112
|
let _e = (e) => {
|
|
113
113
|
d && d.length > 0 && !d.find((t) => t.label === e.inputValue) && M?.(), J ? J(e.inputValue) : T && K(e.inputValue), z?.(e);
|
|
114
|
-
}, ve = m(() => ee({ items: X }), [X]), ye = N ?? de, Q = b ?? /* @__PURE__ */ _(
|
|
114
|
+
}, ve = m(() => ee({ items: X }), [X]), ye = N ?? de, Q = b ?? /* @__PURE__ */ _(r, {
|
|
115
115
|
p: "space-8",
|
|
116
116
|
textAlign: "center",
|
|
117
117
|
children: V.loading
|
|
118
|
-
}), $ = y ?? /* @__PURE__ */ _(
|
|
118
|
+
}), $ = y ?? /* @__PURE__ */ _(r, {
|
|
119
119
|
p: "space-8",
|
|
120
120
|
textAlign: "center",
|
|
121
121
|
children: V.noResults
|
|
@@ -224,7 +224,7 @@ var A = ({ items: e = [], initialItems: d, debounceMs: f = 0, placeholder: p, em
|
|
|
224
224
|
})
|
|
225
225
|
}) })
|
|
226
226
|
})
|
|
227
|
-
] }), /* @__PURE__ */ _(
|
|
227
|
+
] }), /* @__PURE__ */ _(i, {
|
|
228
228
|
when: x,
|
|
229
229
|
wrapper: (e) => /* @__PURE__ */ _(u, { children: e }),
|
|
230
230
|
children: /* @__PURE__ */ _(oe, { children: /* @__PURE__ */ _(ae, { children: ye ? Q : X.length === 0 ? /* @__PURE__ */ _(g, { children: q ? fe ? $ : Q : $ }) : ue ? /* @__PURE__ */ _(te, {
|
|
@@ -238,11 +238,11 @@ var A = ({ items: e = [], initialItems: d, debounceMs: f = 0, placeholder: p, em
|
|
|
238
238
|
rowCount: X.length,
|
|
239
239
|
rowHeight: I,
|
|
240
240
|
style: { height: Math.min(I * X.length, 180) }
|
|
241
|
-
}) : X.map((e) => /* @__PURE__ */ _(
|
|
241
|
+
}) : X.map((e) => /* @__PURE__ */ _(i, {
|
|
242
242
|
when: !!e.tooltip,
|
|
243
|
-
wrapper: (
|
|
243
|
+
wrapper: (t) => /* @__PURE__ */ _(n, {
|
|
244
244
|
label: e.tooltip,
|
|
245
|
-
children:
|
|
245
|
+
children: t
|
|
246
246
|
}),
|
|
247
247
|
children: /* @__PURE__ */ _(w, {
|
|
248
248
|
item: e,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../utils/slots.cjs"),t=require("../icon-button/IconButton.cjs"),n=require("../input/Input.cjs"),r=require("../input/InputAddon.cjs"),i=require("../input/InputGroup.cjs");let a=require("@ark-ui/react"),o=require("@stokelp/styled-system/jsx"),s=require("@stokelp/styled-system/recipes"),c=require("react/jsx-runtime");var{withProvider:l,withContext:u}=e.createStyleContext(s.datepicker),d=l(a.DatePicker.Root,`root`,{defaultProps:{positioning:{placement:`bottom-start`},view:`day`,locale:`fr`,unmountOnExit:!0,lazyMount:!0,startOfWeek:6}}),f=u(a.DatePicker.Content,`content`),p=u(a.DatePicker.Control,`control`),m=u(a.DatePicker.Input,`input`),h=u(a.DatePicker.MonthSelect,`monthSelect`),g=u(a.DatePicker.NextTrigger,`nextTrigger`),_=u(a.DatePicker.Positioner,`positioner`),v=u(a.DatePicker.PrevTrigger,`prevTrigger`),y=u(a.DatePicker.TableBody,`tableBody`),b=u(a.DatePicker.TableCell,`tableCell`),x=u(a.DatePicker.TableCellTrigger,`tableCellTrigger`),S=u(a.DatePicker.TableHead,`tableHead`),C=u(a.DatePicker.TableHeader,`tableHeader`),w=u(a.DatePicker.Table,`table`),T=u(a.DatePicker.TableRow,`tableRow`),E=u(a.DatePicker.Trigger,`trigger`),D=u(a.DatePicker.ViewControl,`viewControl`),O=u(a.DatePicker.View,`view`),k=u(a.DatePicker.YearSelect,`yearSelect`),A=u((0,o.styled)(a.DatePicker.ClearTrigger),`clearTrigger`),j=()=>(0,c.jsx)(`svg`,{width:`23`,height:`24`,viewBox:`0 0 23 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6.46875 2.25C6.8657 2.25 7.1875 2.58579 7.1875 3V4.5H15.8125V3C15.8125 2.58579 16.1343 2.25 16.5312 2.25C16.9282 2.25 17.25 2.58579 17.25 3V4.5H17.9688C19.5566 4.5 20.8438 5.84315 20.8438 7.5V18.75C20.8438 20.4069 19.5566 21.75 17.9688 21.75H5.03125C3.44343 21.75 2.15625 20.4069 2.15625 18.75V7.5C2.15625 5.84315 3.44343 4.5 5.03125 4.5H5.75V3C5.75 2.58579 6.0718 2.25 6.46875 2.25ZM5.03125 6C4.23734 6 3.59375 6.67157 3.59375 7.5V8.65135C4.01662 8.39609 4.50759 8.25 5.03125 8.25H17.9688C18.4924 8.25 18.9834 8.39609 19.4062 8.65135V7.5C19.4062 6.67157 18.7627 6 17.9688 6H5.03125ZM19.4062 11.25C19.4062 10.4216 18.7627 9.75 17.9688 9.75H5.03125C4.23734 9.75 3.59375 10.4216 3.59375 11.25V18.75C3.59375 19.5784 4.23734 20.25 5.03125 20.25H17.9688C18.7627 20.25 19.4062 19.5784 19.4062 18.75V11.25ZM10.7812 12.75C10.7812 12.3358 11.103 12 11.5 12H11.5072C11.9041 12 12.2259 12.3358 12.2259 12.75V12.7575C12.2259 13.1717 11.9041 13.5075 11.5072 13.5075H11.5C11.103 13.5075 10.7812 13.1717 10.7812 12.7575V12.75ZM12.9375 12.75C12.9375 12.3358 13.2593 12 13.6562 12H13.6634C14.0604 12 14.3822 12.3358 14.3822 12.75V12.7575C14.3822 13.1717 14.0604 13.5075 13.6634 13.5075H13.6562C13.2593 13.5075 12.9375 13.1717 12.9375 12.7575V12.75ZM15.0938 12.75C15.0938 12.3358 15.4155 12 15.8125 12H15.8197C16.2166 12 16.5384 12.3358 16.5384 12.75V12.7575C16.5384 13.1717 16.2166 13.5075 15.8197 13.5075H15.8125C15.4155 13.5075 15.0938 13.1717 15.0938 12.7575V12.75ZM6.46875 15C6.46875 14.5858 6.79054 14.25 7.1875 14.25H7.19469C7.59164 14.25 7.91344 14.5858 7.91344 15V15.0075C7.91344 15.4217 7.59164 15.7575 7.19469 15.7575H7.1875C6.79054 15.7575 6.46875 15.4217 6.46875 15.0075V15ZM8.625 15C8.625 14.5858 8.94679 14.25 9.34375 14.25H9.35094C9.74789 14.25 10.0697 14.5858 10.0697 15V15.0075C10.0697 15.4217 9.74789 15.7575 9.35094 15.7575H9.34375C8.94679 15.7575 8.625 15.4217 8.625 15.0075V15ZM10.7812 15C10.7812 14.5858 11.103 14.25 11.5 14.25H11.5072C11.9041 14.25 12.2259 14.5858 12.2259 15V15.0075C12.2259 15.4217 11.9041 15.7575 11.5072 15.7575H11.5C11.103 15.7575 10.7812 15.4217 10.7812 15.0075V15ZM12.9375 15C12.9375 14.5858 13.2593 14.25 13.6562 14.25H13.6634C14.0604 14.25 14.3822 14.5858 14.3822 15V15.0075C14.3822 15.4217 14.0604 15.7575 13.6634 15.7575H13.6562C13.2593 15.7575 12.9375 15.4217 12.9375 15.0075V15ZM15.0938 15C15.0938 14.5858 15.4155 14.25 15.8125 14.25H15.8197C16.2166 14.25 16.5384 14.5858 16.5384 15V15.0075C16.5384 15.4217 16.2166 15.7575 15.8197 15.7575H15.8125C15.4155 15.7575 15.0938 15.4217 15.0938 15.0075V15ZM6.46875 17.25C6.46875 16.8358 6.79054 16.5 7.1875 16.5H7.19469C7.59164 16.5 7.91344 16.8358 7.91344 17.25V17.2575C7.91344 17.6717 7.59164 18.0075 7.19469 18.0075H7.1875C6.79054 18.0075 6.46875 17.6717 6.46875 17.2575V17.25ZM8.625 17.25C8.625 16.8358 8.94679 16.5 9.34375 16.5H9.35094C9.74789 16.5 10.0697 16.8358 10.0697 17.25V17.2575C10.0697 17.6717 9.74789 18.0075 9.35094 18.0075H9.34375C8.94679 18.0075 8.625 17.6717 8.625 17.2575V17.25ZM10.7812 17.25C10.7812 16.8358 11.103 16.5 11.5 16.5H11.5072C11.9041 16.5 12.2259 16.8358 12.2259 17.25V17.2575C12.2259 17.6717 11.9041 18.0075 11.5072 18.0075H11.5C11.103 18.0075 10.7812 17.6717 10.7812 17.2575V17.25ZM12.9375 17.25C12.9375 16.8358 13.2593 16.5 13.6562 16.5H13.6634C14.0604 16.5 14.3822 16.8358 14.3822 17.25V17.2575C14.3822 17.6717 14.0604 18.0075 13.6634 18.0075H13.6562C13.2593 18.0075 12.9375 17.6717 12.9375 17.2575V17.25Z`,fill:`currentColor`})}),M=()=>(0,c.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z`,fill:`currentColor`})}),N=()=>(0,c.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z`,fill:`currentColor`})}),P=({placeholder:e,preflightClassName:o,selectionMode:s,clearValueWhenEmpty:l=!0,...u})=>{let P=s===`range`;return(0,c.jsxs)(d,{startOfWeek:1,...u,selectionMode:s,onValueChange:e=>u.onValueChange?.({...e,valueAsString:e.value.length?[e.value.toString()]:[]}),children:[(0,c.jsx)(a.DatePicker.Context,{children:t=>(0,c.jsxs)(p,{children:[(0,c.jsxs)(i.InputGroup,{children:[(0,c.jsx)(m,{asChild:!0,index:0,placeholder:e,children:(0,c.jsx)(n.Input,{onInput:e=>{let n=e.currentTarget.value;l&&n===``&&t.clearValue()}})}),(0,c.jsxs)(r.InputAddon,{children:[(0,c.jsx)(A,{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)(E,{style:{cursor:`pointer`},children:(0,c.jsx)(j,{})})]})]}),P?(0,c.jsxs)(i.InputGroup,{children:[(0,c.jsx)(m,{asChild:!0,index:1,placeholder:e,children:(0,c.jsx)(n.Input,{onInput:e=>{let n=e.currentTarget.value;l&&n===``&&t.clearValue()}})}),(0,c.jsxs)(r.InputAddon,{children:[t.value.length===2?(0,c.jsx)(A,{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`})})})}):null,(0,c.jsx)(E,{children:(0,c.jsx)(j,{})})]})]}):null]})}),(0,c.jsx)(a.Portal,{children:(0,c.jsx)(_,{className:o,children:(0,c.jsx)(f,{children:(0,c.jsx)(O,{view:`day`,children:(0,c.jsx)(a.DatePicker.Context,{children:e=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(D,{children:[(0,c.jsx)(v,{asChild:!0,children:(0,c.jsx)(t.IconButton,{"aria-label":`prev`,variant:`secondary`,size:`md`,children:(0,c.jsx)(M,{})})}),(0,c.jsx)(h,{}),(0,c.jsx)(k,{}),(0,c.jsx)(g,{asChild:!0,children:(0,c.jsx)(t.IconButton,{"aria-label":`next`,variant:`secondary`,size:`md`,children:(0,c.jsx)(N,{})})})]}),(0,c.jsxs)(w,{children:[(0,c.jsx)(S,{children:(0,c.jsx)(T,{children:e.weekDays.map((e,t)=>(0,c.jsx)(C,{children:e.short},t))})}),(0,c.jsx)(y,{children:e.weeks.map((e,t)=>(0,c.jsx)(T,{children:e.map((e,t)=>(0,c.jsx)(b,{value:e,children:(0,c.jsx)(x,{asChild:!0,children:(0,c.jsx)(`button`,{children:e.day})})},t))},t))})]})]})})})})})})]})};exports.DatePicker=P;
|
|
1
|
+
"use client";const e=require("../../utils/slots.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../icon-button/IconButton.cjs"),r=require("../input/Input.cjs"),i=require("../input/InputAddon.cjs"),a=require("../input/InputGroup.cjs");let o=require("@ark-ui/react"),s=require("@stokelp/styled-system/jsx"),c=require("@stokelp/styled-system/recipes"),l=require("react/jsx-runtime");var{withProvider:u,withContext:d}=e.createStyleContext(c.datepicker),f=u(o.DatePicker.Root,`root`,{defaultProps:{positioning:{placement:`bottom-start`},view:`day`,locale:`fr`,unmountOnExit:!0,lazyMount:!0,startOfWeek:6}}),p=d(o.DatePicker.Content,`content`),m=d(o.DatePicker.Control,`control`),h=d(o.DatePicker.Input,`input`),g=d(o.DatePicker.MonthSelect,`monthSelect`),_=d(o.DatePicker.NextTrigger,`nextTrigger`),v=d(o.DatePicker.Positioner,`positioner`),y=d(o.DatePicker.PrevTrigger,`prevTrigger`),b=d(o.DatePicker.TableBody,`tableBody`),x=d(o.DatePicker.TableCell,`tableCell`),S=d(o.DatePicker.TableCellTrigger,`tableCellTrigger`),C=d(o.DatePicker.TableHead,`tableHead`),w=d(o.DatePicker.TableHeader,`tableHeader`),T=d(o.DatePicker.Table,`table`),E=d(o.DatePicker.TableRow,`tableRow`),D=d(o.DatePicker.Trigger,`trigger`),O=d(o.DatePicker.ViewControl,`viewControl`),k=d(o.DatePicker.View,`view`),A=d(o.DatePicker.YearSelect,`yearSelect`),j=d((0,s.styled)(o.DatePicker.ClearTrigger),`clearTrigger`),M=()=>(0,l.jsx)(`svg`,{width:`23`,height:`24`,viewBox:`0 0 23 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6.46875 2.25C6.8657 2.25 7.1875 2.58579 7.1875 3V4.5H15.8125V3C15.8125 2.58579 16.1343 2.25 16.5312 2.25C16.9282 2.25 17.25 2.58579 17.25 3V4.5H17.9688C19.5566 4.5 20.8438 5.84315 20.8438 7.5V18.75C20.8438 20.4069 19.5566 21.75 17.9688 21.75H5.03125C3.44343 21.75 2.15625 20.4069 2.15625 18.75V7.5C2.15625 5.84315 3.44343 4.5 5.03125 4.5H5.75V3C5.75 2.58579 6.0718 2.25 6.46875 2.25ZM5.03125 6C4.23734 6 3.59375 6.67157 3.59375 7.5V8.65135C4.01662 8.39609 4.50759 8.25 5.03125 8.25H17.9688C18.4924 8.25 18.9834 8.39609 19.4062 8.65135V7.5C19.4062 6.67157 18.7627 6 17.9688 6H5.03125ZM19.4062 11.25C19.4062 10.4216 18.7627 9.75 17.9688 9.75H5.03125C4.23734 9.75 3.59375 10.4216 3.59375 11.25V18.75C3.59375 19.5784 4.23734 20.25 5.03125 20.25H17.9688C18.7627 20.25 19.4062 19.5784 19.4062 18.75V11.25ZM10.7812 12.75C10.7812 12.3358 11.103 12 11.5 12H11.5072C11.9041 12 12.2259 12.3358 12.2259 12.75V12.7575C12.2259 13.1717 11.9041 13.5075 11.5072 13.5075H11.5C11.103 13.5075 10.7812 13.1717 10.7812 12.7575V12.75ZM12.9375 12.75C12.9375 12.3358 13.2593 12 13.6562 12H13.6634C14.0604 12 14.3822 12.3358 14.3822 12.75V12.7575C14.3822 13.1717 14.0604 13.5075 13.6634 13.5075H13.6562C13.2593 13.5075 12.9375 13.1717 12.9375 12.7575V12.75ZM15.0938 12.75C15.0938 12.3358 15.4155 12 15.8125 12H15.8197C16.2166 12 16.5384 12.3358 16.5384 12.75V12.7575C16.5384 13.1717 16.2166 13.5075 15.8197 13.5075H15.8125C15.4155 13.5075 15.0938 13.1717 15.0938 12.7575V12.75ZM6.46875 15C6.46875 14.5858 6.79054 14.25 7.1875 14.25H7.19469C7.59164 14.25 7.91344 14.5858 7.91344 15V15.0075C7.91344 15.4217 7.59164 15.7575 7.19469 15.7575H7.1875C6.79054 15.7575 6.46875 15.4217 6.46875 15.0075V15ZM8.625 15C8.625 14.5858 8.94679 14.25 9.34375 14.25H9.35094C9.74789 14.25 10.0697 14.5858 10.0697 15V15.0075C10.0697 15.4217 9.74789 15.7575 9.35094 15.7575H9.34375C8.94679 15.7575 8.625 15.4217 8.625 15.0075V15ZM10.7812 15C10.7812 14.5858 11.103 14.25 11.5 14.25H11.5072C11.9041 14.25 12.2259 14.5858 12.2259 15V15.0075C12.2259 15.4217 11.9041 15.7575 11.5072 15.7575H11.5C11.103 15.7575 10.7812 15.4217 10.7812 15.0075V15ZM12.9375 15C12.9375 14.5858 13.2593 14.25 13.6562 14.25H13.6634C14.0604 14.25 14.3822 14.5858 14.3822 15V15.0075C14.3822 15.4217 14.0604 15.7575 13.6634 15.7575H13.6562C13.2593 15.7575 12.9375 15.4217 12.9375 15.0075V15ZM15.0938 15C15.0938 14.5858 15.4155 14.25 15.8125 14.25H15.8197C16.2166 14.25 16.5384 14.5858 16.5384 15V15.0075C16.5384 15.4217 16.2166 15.7575 15.8197 15.7575H15.8125C15.4155 15.7575 15.0938 15.4217 15.0938 15.0075V15ZM6.46875 17.25C6.46875 16.8358 6.79054 16.5 7.1875 16.5H7.19469C7.59164 16.5 7.91344 16.8358 7.91344 17.25V17.2575C7.91344 17.6717 7.59164 18.0075 7.19469 18.0075H7.1875C6.79054 18.0075 6.46875 17.6717 6.46875 17.2575V17.25ZM8.625 17.25C8.625 16.8358 8.94679 16.5 9.34375 16.5H9.35094C9.74789 16.5 10.0697 16.8358 10.0697 17.25V17.2575C10.0697 17.6717 9.74789 18.0075 9.35094 18.0075H9.34375C8.94679 18.0075 8.625 17.6717 8.625 17.2575V17.25ZM10.7812 17.25C10.7812 16.8358 11.103 16.5 11.5 16.5H11.5072C11.9041 16.5 12.2259 16.8358 12.2259 17.25V17.2575C12.2259 17.6717 11.9041 18.0075 11.5072 18.0075H11.5C11.103 18.0075 10.7812 17.6717 10.7812 17.2575V17.25ZM12.9375 17.25C12.9375 16.8358 13.2593 16.5 13.6562 16.5H13.6634C14.0604 16.5 14.3822 16.8358 14.3822 17.25V17.2575C14.3822 17.6717 14.0604 18.0075 13.6634 18.0075H13.6562C13.2593 18.0075 12.9375 17.6717 12.9375 17.2575V17.25Z`,fill:`currentColor`})}),N=()=>(0,l.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z`,fill:`currentColor`})}),P=()=>(0,l.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z`,fill:`currentColor`})}),F=e=>({trigger:t=>t?e.closeCalendar:e.openCalendar,content:e.calendar,prevTrigger:t=>t===`year`?e.previousDecade:t===`month`?e.previousYear:e.previousMonth,nextTrigger:t=>t===`year`?e.nextDecade:t===`month`?e.nextYear:e.nextMonth,monthSelect:e.selectMonth,yearSelect:e.selectYear,clearTrigger:e.clear,dayCell:t=>t.unavailable||t.disabled?e.unavailableDate(t.valueText):t.selected||t.inRange?e.selectedDate(t.valueText):e.chooseDate(t.valueText)}),I=({placeholder:e,preflightClassName:s,selectionMode:c,clearValueWhenEmpty:u=!0,...d})=>{let I=c===`range`,L=t.useUiLabels();return(0,l.jsxs)(f,{startOfWeek:1,locale:L.locale,...d,translations:{...F(L.datePicker),...d.translations},selectionMode:c,onValueChange:e=>d.onValueChange?.({...e,valueAsString:e.value.length?[e.value.toString()]:[]}),children:[(0,l.jsx)(o.DatePicker.Context,{children:t=>(0,l.jsxs)(m,{children:[(0,l.jsxs)(a.InputGroup,{children:[(0,l.jsx)(h,{asChild:!0,index:0,placeholder:e,children:(0,l.jsx)(r.Input,{onInput:e=>{let n=e.currentTarget.value;u&&n===``&&t.clearValue()}})}),(0,l.jsxs)(i.InputAddon,{children:[(0,l.jsx)(j,{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)(D,{style:{cursor:`pointer`},children:(0,l.jsx)(M,{})})]})]}),I?(0,l.jsxs)(a.InputGroup,{children:[(0,l.jsx)(h,{asChild:!0,index:1,placeholder:e,children:(0,l.jsx)(r.Input,{onInput:e=>{let n=e.currentTarget.value;u&&n===``&&t.clearValue()}})}),(0,l.jsxs)(i.InputAddon,{children:[t.value.length===2?(0,l.jsx)(j,{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`})})})}):null,(0,l.jsx)(D,{children:(0,l.jsx)(M,{})})]})]}):null]})}),(0,l.jsx)(o.Portal,{children:(0,l.jsx)(v,{className:s,children:(0,l.jsx)(p,{children:(0,l.jsx)(k,{view:`day`,children:(0,l.jsx)(o.DatePicker.Context,{children:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(O,{children:[(0,l.jsx)(y,{asChild:!0,children:(0,l.jsx)(n.IconButton,{"aria-label":L.datePicker.previousMonth,variant:`secondary`,size:`md`,children:(0,l.jsx)(N,{})})}),(0,l.jsx)(g,{}),(0,l.jsx)(A,{}),(0,l.jsx)(_,{asChild:!0,children:(0,l.jsx)(n.IconButton,{"aria-label":L.datePicker.nextMonth,variant:`secondary`,size:`md`,children:(0,l.jsx)(P,{})})})]}),(0,l.jsxs)(T,{children:[(0,l.jsx)(C,{children:(0,l.jsx)(E,{children:e.weekDays.map((e,t)=>(0,l.jsx)(w,{children:e.short},t))})}),(0,l.jsx)(b,{children:e.weeks.map((e,t)=>(0,l.jsx)(E,{children:e.map((e,t)=>(0,l.jsx)(x,{value:e,children:(0,l.jsx)(S,{asChild:!0,children:(0,l.jsx)(`button`,{children:e.day})})},t))},t))})]})]})})})})})})]})};exports.DatePicker=I;
|
|
2
2
|
//# sourceMappingURL=DatePicker.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.cjs","names":["createStyleContext","datepicker","ArkDatePicker","styled","InputGroup","Input","InputAddon","Portal","_Fragment","IconButton","require_slots","require_IconButton","require_Input","require_InputAddon","require_InputGroup","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react_jsx_runtime","DatePickerRoot","withProvider","DatePickerContent","withContext","DatePickerControl","DatePickerInput","DatePickerMonthSelect","DatePickerNextTrigger","DatePickerPositioner","DatePickerPrevTrigger","DatePickerTableBody","DatePickerTableCell","DatePickerTableCellTrigger","DatePickerTableHead","DatePickerTableHeader","DatePickerTable","DatePickerTableRow","DatePickerTrigger","DatePickerViewControl","DatePickerView","DatePickerYearSelect","ClearTrigger","DateIcon","ChevronLeftIcon","ChevronRightIcon","DatePicker","props","isRange","selectionMode","value","clearValueWhenEmpty","api","preflightClassName","weekDay","id","week","day"],"sources":["../../../src/components/date-picker/DatePicker.tsx"],"sourcesContent":["import { datepicker } from '@stokelp/styled-system/recipes'\nimport { DatePicker as ArkDatePicker, Portal } from '@ark-ui/react'\nimport { createStyleContext } from '~/utils/slots'\nimport { ComponentProps, FC } from 'react'\nimport { IconButton, Input, InputAddon, InputGroup } from '~/components'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nconst { withProvider, withContext } = createStyleContext(datepicker)\n\nconst DatePickerRoot = withProvider(ArkDatePicker.Root, 'root', {\n defaultProps: {\n positioning: {\n placement: 'bottom-start',\n },\n view: 'day',\n locale: 'fr',\n unmountOnExit: true,\n lazyMount: true,\n startOfWeek: 6,\n },\n})\nconst DatePickerContent = withContext(ArkDatePicker.Content, 'content')\nconst DatePickerControl = withContext(ArkDatePicker.Control, 'control')\nconst DatePickerInput = withContext(ArkDatePicker.Input, 'input')\nconst DatePickerMonthSelect = withContext(ArkDatePicker.MonthSelect, 'monthSelect')\nconst DatePickerNextTrigger = withContext(ArkDatePicker.NextTrigger, 'nextTrigger')\nconst DatePickerPositioner = withContext(ArkDatePicker.Positioner, 'positioner')\nconst DatePickerPrevTrigger = withContext(ArkDatePicker.PrevTrigger, 'prevTrigger')\nconst DatePickerTableBody = withContext(ArkDatePicker.TableBody, 'tableBody')\nconst DatePickerTableCell = withContext(ArkDatePicker.TableCell, 'tableCell')\nconst DatePickerTableCellTrigger = withContext(ArkDatePicker.TableCellTrigger, 'tableCellTrigger')\nconst DatePickerTableHead = withContext(ArkDatePicker.TableHead, 'tableHead')\nconst DatePickerTableHeader = withContext(ArkDatePicker.TableHeader, 'tableHeader')\nconst DatePickerTable = withContext(ArkDatePicker.Table, 'table')\nconst DatePickerTableRow = withContext(ArkDatePicker.TableRow, 'tableRow')\nconst DatePickerTrigger = withContext(ArkDatePicker.Trigger, 'trigger')\nconst DatePickerViewControl = withContext(ArkDatePicker.ViewControl, 'viewControl')\nconst DatePickerView = withContext(ArkDatePicker.View, 'view')\nconst DatePickerYearSelect = withContext(ArkDatePicker.YearSelect, 'yearSelect')\nconst ClearTrigger = withContext(styled(ArkDatePicker.ClearTrigger), 'clearTrigger')\n\nexport type DatePickerProps = ComponentProps<typeof DatePickerRoot> & {\n placeholder?: string\n clearValueWhenEmpty?: boolean\n preflightClassName?: string\n}\n\nconst DateIcon = () => (\n <svg width=\"23\" height=\"24\" viewBox=\"0 0 23 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6.46875 2.25C6.8657 2.25 7.1875 2.58579 7.1875 3V4.5H15.8125V3C15.8125 2.58579 16.1343 2.25 16.5312 2.25C16.9282 2.25 17.25 2.58579 17.25 3V4.5H17.9688C19.5566 4.5 20.8438 5.84315 20.8438 7.5V18.75C20.8438 20.4069 19.5566 21.75 17.9688 21.75H5.03125C3.44343 21.75 2.15625 20.4069 2.15625 18.75V7.5C2.15625 5.84315 3.44343 4.5 5.03125 4.5H5.75V3C5.75 2.58579 6.0718 2.25 6.46875 2.25ZM5.03125 6C4.23734 6 3.59375 6.67157 3.59375 7.5V8.65135C4.01662 8.39609 4.50759 8.25 5.03125 8.25H17.9688C18.4924 8.25 18.9834 8.39609 19.4062 8.65135V7.5C19.4062 6.67157 18.7627 6 17.9688 6H5.03125ZM19.4062 11.25C19.4062 10.4216 18.7627 9.75 17.9688 9.75H5.03125C4.23734 9.75 3.59375 10.4216 3.59375 11.25V18.75C3.59375 19.5784 4.23734 20.25 5.03125 20.25H17.9688C18.7627 20.25 19.4062 19.5784 19.4062 18.75V11.25ZM10.7812 12.75C10.7812 12.3358 11.103 12 11.5 12H11.5072C11.9041 12 12.2259 12.3358 12.2259 12.75V12.7575C12.2259 13.1717 11.9041 13.5075 11.5072 13.5075H11.5C11.103 13.5075 10.7812 13.1717 10.7812 12.7575V12.75ZM12.9375 12.75C12.9375 12.3358 13.2593 12 13.6562 12H13.6634C14.0604 12 14.3822 12.3358 14.3822 12.75V12.7575C14.3822 13.1717 14.0604 13.5075 13.6634 13.5075H13.6562C13.2593 13.5075 12.9375 13.1717 12.9375 12.7575V12.75ZM15.0938 12.75C15.0938 12.3358 15.4155 12 15.8125 12H15.8197C16.2166 12 16.5384 12.3358 16.5384 12.75V12.7575C16.5384 13.1717 16.2166 13.5075 15.8197 13.5075H15.8125C15.4155 13.5075 15.0938 13.1717 15.0938 12.7575V12.75ZM6.46875 15C6.46875 14.5858 6.79054 14.25 7.1875 14.25H7.19469C7.59164 14.25 7.91344 14.5858 7.91344 15V15.0075C7.91344 15.4217 7.59164 15.7575 7.19469 15.7575H7.1875C6.79054 15.7575 6.46875 15.4217 6.46875 15.0075V15ZM8.625 15C8.625 14.5858 8.94679 14.25 9.34375 14.25H9.35094C9.74789 14.25 10.0697 14.5858 10.0697 15V15.0075C10.0697 15.4217 9.74789 15.7575 9.35094 15.7575H9.34375C8.94679 15.7575 8.625 15.4217 8.625 15.0075V15ZM10.7812 15C10.7812 14.5858 11.103 14.25 11.5 14.25H11.5072C11.9041 14.25 12.2259 14.5858 12.2259 15V15.0075C12.2259 15.4217 11.9041 15.7575 11.5072 15.7575H11.5C11.103 15.7575 10.7812 15.4217 10.7812 15.0075V15ZM12.9375 15C12.9375 14.5858 13.2593 14.25 13.6562 14.25H13.6634C14.0604 14.25 14.3822 14.5858 14.3822 15V15.0075C14.3822 15.4217 14.0604 15.7575 13.6634 15.7575H13.6562C13.2593 15.7575 12.9375 15.4217 12.9375 15.0075V15ZM15.0938 15C15.0938 14.5858 15.4155 14.25 15.8125 14.25H15.8197C16.2166 14.25 16.5384 14.5858 16.5384 15V15.0075C16.5384 15.4217 16.2166 15.7575 15.8197 15.7575H15.8125C15.4155 15.7575 15.0938 15.4217 15.0938 15.0075V15ZM6.46875 17.25C6.46875 16.8358 6.79054 16.5 7.1875 16.5H7.19469C7.59164 16.5 7.91344 16.8358 7.91344 17.25V17.2575C7.91344 17.6717 7.59164 18.0075 7.19469 18.0075H7.1875C6.79054 18.0075 6.46875 17.6717 6.46875 17.2575V17.25ZM8.625 17.25C8.625 16.8358 8.94679 16.5 9.34375 16.5H9.35094C9.74789 16.5 10.0697 16.8358 10.0697 17.25V17.2575C10.0697 17.6717 9.74789 18.0075 9.35094 18.0075H9.34375C8.94679 18.0075 8.625 17.6717 8.625 17.2575V17.25ZM10.7812 17.25C10.7812 16.8358 11.103 16.5 11.5 16.5H11.5072C11.9041 16.5 12.2259 16.8358 12.2259 17.25V17.2575C12.2259 17.6717 11.9041 18.0075 11.5072 18.0075H11.5C11.103 18.0075 10.7812 17.6717 10.7812 17.2575V17.25ZM12.9375 17.25C12.9375 16.8358 13.2593 16.5 13.6562 16.5H13.6634C14.0604 16.5 14.3822 16.8358 14.3822 17.25V17.2575C14.3822 17.6717 14.0604 18.0075 13.6634 18.0075H13.6562C13.2593 18.0075 12.9375 17.6717 12.9375 17.2575V17.25Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nconst ChevronLeftIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nconst ChevronRightIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nexport const DatePicker: FC<DatePickerProps> = ({\n placeholder,\n preflightClassName,\n selectionMode,\n clearValueWhenEmpty = true,\n ...props\n}) => {\n const isRange = selectionMode === 'range'\n\n return (\n <DatePickerRoot\n startOfWeek={1}\n {...props}\n selectionMode={selectionMode}\n onValueChange={value =>\n props.onValueChange?.({ ...value, valueAsString: value.value.length ? [value.value.toString()] : [] })\n }\n >\n <ArkDatePicker.Context>\n {api => (\n <DatePickerControl>\n <InputGroup>\n <DatePickerInput asChild index={0} placeholder={placeholder}>\n <Input\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n />\n </DatePickerInput>\n <InputAddon>\n <ClearTrigger 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\n <DatePickerTrigger style={{ cursor: 'pointer' }}>\n <DateIcon />\n </DatePickerTrigger>\n </InputAddon>\n </InputGroup>\n {isRange ? (\n <InputGroup>\n <DatePickerInput asChild index={1} placeholder={placeholder}>\n <Input\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n />\n </DatePickerInput>\n <InputAddon>\n {api.value.length === 2 ? (\n <ClearTrigger 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 ) : null}\n <DatePickerTrigger>\n <DateIcon />\n </DatePickerTrigger>\n </InputAddon>\n </InputGroup>\n ) : null}\n </DatePickerControl>\n )}\n </ArkDatePicker.Context>\n <Portal>\n <DatePickerPositioner className={preflightClassName}>\n <DatePickerContent>\n <DatePickerView view=\"day\">\n <ArkDatePicker.Context>\n {api => (\n <>\n <DatePickerViewControl>\n <DatePickerPrevTrigger asChild>\n <IconButton aria-label=\"prev\" variant=\"secondary\" size=\"md\">\n <ChevronLeftIcon />\n </IconButton>\n </DatePickerPrevTrigger>\n <DatePickerMonthSelect />\n <DatePickerYearSelect />\n <DatePickerNextTrigger asChild>\n <IconButton aria-label=\"next\" variant=\"secondary\" size=\"md\">\n <ChevronRightIcon />\n </IconButton>\n </DatePickerNextTrigger>\n </DatePickerViewControl>\n <DatePickerTable>\n <DatePickerTableHead>\n <DatePickerTableRow>\n {api.weekDays.map((weekDay, id) => (\n <DatePickerTableHeader key={id}>{weekDay.short}</DatePickerTableHeader>\n ))}\n </DatePickerTableRow>\n </DatePickerTableHead>\n <DatePickerTableBody>\n {api.weeks.map((week, id) => (\n <DatePickerTableRow key={id}>\n {week.map((day, id) => (\n <DatePickerTableCell key={id} value={day}>\n <DatePickerTableCellTrigger asChild>\n <button>{day.day}</button>\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </DatePickerTableRow>\n ))}\n </DatePickerTableBody>\n </DatePickerTable>\n </>\n )}\n </ArkDatePicker.Context>\n </DatePickerView>\n </DatePickerContent>\n </DatePickerPositioner>\n </Portal>\n </DatePickerRoot>\n )\n}\n"],"mappings":"A,6VAOA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,UAAU,EAE7DkB,EAAiBC,EAAalB,EAAAA,WAAc,KAAM,OAAQ,CAC9D,aAAc,CACZ,YAAa,CACX,UAAW,cACb,EACA,KAAM,MACN,OAAQ,KACR,cAAe,GACf,UAAW,GACX,YAAa,CACf,CACF,CAAC,EACKmB,EAAoBC,EAAYpB,EAAAA,WAAc,QAAS,SAAS,EAChEqB,EAAoBD,EAAYpB,EAAAA,WAAc,QAAS,SAAS,EAChEsB,EAAkBF,EAAYpB,EAAAA,WAAc,MAAO,OAAO,EAC1DuB,EAAwBH,EAAYpB,EAAAA,WAAc,YAAa,aAAa,EAC5EwB,EAAwBJ,EAAYpB,EAAAA,WAAc,YAAa,aAAa,EAC5EyB,EAAuBL,EAAYpB,EAAAA,WAAc,WAAY,YAAY,EACzE0B,EAAwBN,EAAYpB,EAAAA,WAAc,YAAa,aAAa,EAC5E2B,EAAsBP,EAAYpB,EAAAA,WAAc,UAAW,WAAW,EACtE4B,EAAsBR,EAAYpB,EAAAA,WAAc,UAAW,WAAW,EACtE6B,EAA6BT,EAAYpB,EAAAA,WAAc,iBAAkB,kBAAkB,EAC3F8B,EAAsBV,EAAYpB,EAAAA,WAAc,UAAW,WAAW,EACtE+B,EAAwBX,EAAYpB,EAAAA,WAAc,YAAa,aAAa,EAC5EgC,EAAkBZ,EAAYpB,EAAAA,WAAc,MAAO,OAAO,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|
1
|
+
{"version":3,"file":"DatePicker.cjs","names":["createStyleContext","datepicker","ArkDatePicker","styled","useUiLabels","InputGroup","Input","InputAddon","Portal","_Fragment","IconButton","require_slots","require_UiLabelsProvider","require_IconButton","require_Input","require_InputAddon","require_InputGroup","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react_jsx_runtime","DatePickerRoot","withProvider","DatePickerContent","withContext","DatePickerControl","DatePickerInput","DatePickerMonthSelect","DatePickerNextTrigger","DatePickerPositioner","DatePickerPrevTrigger","DatePickerTableBody","DatePickerTableCell","DatePickerTableCellTrigger","DatePickerTableHead","DatePickerTableHeader","DatePickerTable","DatePickerTableRow","DatePickerTrigger","DatePickerViewControl","DatePickerView","DatePickerYearSelect","ClearTrigger","DateIcon","ChevronLeftIcon","ChevronRightIcon","datePickerTranslations","open","labels","view","state","DatePicker","props","isRange","selectionMode","value","clearValueWhenEmpty","api","preflightClassName","weekDay","id","week","day"],"sources":["../../../src/components/date-picker/DatePicker.tsx"],"sourcesContent":["import { datepicker } from '@stokelp/styled-system/recipes'\nimport { DatePicker as ArkDatePicker, Portal } from '@ark-ui/react'\nimport { createStyleContext } from '~/utils/slots'\nimport { ComponentProps, FC } from 'react'\nimport { IconButton } from '~/components/icon-button/IconButton'\nimport { Input } from '~/components/input/Input'\nimport { InputAddon } from '~/components/input/InputAddon'\nimport { InputGroup } from '~/components/input/InputGroup'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { type DatePickerLabels, useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\n\nconst { withProvider, withContext } = createStyleContext(datepicker)\n\nconst DatePickerRoot = withProvider(ArkDatePicker.Root, 'root', {\n defaultProps: {\n positioning: {\n placement: 'bottom-start',\n },\n view: 'day',\n locale: 'fr',\n unmountOnExit: true,\n lazyMount: true,\n startOfWeek: 6,\n },\n})\nconst DatePickerContent = withContext(ArkDatePicker.Content, 'content')\nconst DatePickerControl = withContext(ArkDatePicker.Control, 'control')\nconst DatePickerInput = withContext(ArkDatePicker.Input, 'input')\nconst DatePickerMonthSelect = withContext(ArkDatePicker.MonthSelect, 'monthSelect')\nconst DatePickerNextTrigger = withContext(ArkDatePicker.NextTrigger, 'nextTrigger')\nconst DatePickerPositioner = withContext(ArkDatePicker.Positioner, 'positioner')\nconst DatePickerPrevTrigger = withContext(ArkDatePicker.PrevTrigger, 'prevTrigger')\nconst DatePickerTableBody = withContext(ArkDatePicker.TableBody, 'tableBody')\nconst DatePickerTableCell = withContext(ArkDatePicker.TableCell, 'tableCell')\nconst DatePickerTableCellTrigger = withContext(ArkDatePicker.TableCellTrigger, 'tableCellTrigger')\nconst DatePickerTableHead = withContext(ArkDatePicker.TableHead, 'tableHead')\nconst DatePickerTableHeader = withContext(ArkDatePicker.TableHeader, 'tableHeader')\nconst DatePickerTable = withContext(ArkDatePicker.Table, 'table')\nconst DatePickerTableRow = withContext(ArkDatePicker.TableRow, 'tableRow')\nconst DatePickerTrigger = withContext(ArkDatePicker.Trigger, 'trigger')\nconst DatePickerViewControl = withContext(ArkDatePicker.ViewControl, 'viewControl')\nconst DatePickerView = withContext(ArkDatePicker.View, 'view')\nconst DatePickerYearSelect = withContext(ArkDatePicker.YearSelect, 'yearSelect')\nconst ClearTrigger = withContext(styled(ArkDatePicker.ClearTrigger), 'clearTrigger')\n\nexport type DatePickerProps = ComponentProps<typeof DatePickerRoot> & {\n placeholder?: string\n clearValueWhenEmpty?: boolean\n preflightClassName?: string\n}\n\nconst DateIcon = () => (\n <svg width=\"23\" height=\"24\" viewBox=\"0 0 23 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6.46875 2.25C6.8657 2.25 7.1875 2.58579 7.1875 3V4.5H15.8125V3C15.8125 2.58579 16.1343 2.25 16.5312 2.25C16.9282 2.25 17.25 2.58579 17.25 3V4.5H17.9688C19.5566 4.5 20.8438 5.84315 20.8438 7.5V18.75C20.8438 20.4069 19.5566 21.75 17.9688 21.75H5.03125C3.44343 21.75 2.15625 20.4069 2.15625 18.75V7.5C2.15625 5.84315 3.44343 4.5 5.03125 4.5H5.75V3C5.75 2.58579 6.0718 2.25 6.46875 2.25ZM5.03125 6C4.23734 6 3.59375 6.67157 3.59375 7.5V8.65135C4.01662 8.39609 4.50759 8.25 5.03125 8.25H17.9688C18.4924 8.25 18.9834 8.39609 19.4062 8.65135V7.5C19.4062 6.67157 18.7627 6 17.9688 6H5.03125ZM19.4062 11.25C19.4062 10.4216 18.7627 9.75 17.9688 9.75H5.03125C4.23734 9.75 3.59375 10.4216 3.59375 11.25V18.75C3.59375 19.5784 4.23734 20.25 5.03125 20.25H17.9688C18.7627 20.25 19.4062 19.5784 19.4062 18.75V11.25ZM10.7812 12.75C10.7812 12.3358 11.103 12 11.5 12H11.5072C11.9041 12 12.2259 12.3358 12.2259 12.75V12.7575C12.2259 13.1717 11.9041 13.5075 11.5072 13.5075H11.5C11.103 13.5075 10.7812 13.1717 10.7812 12.7575V12.75ZM12.9375 12.75C12.9375 12.3358 13.2593 12 13.6562 12H13.6634C14.0604 12 14.3822 12.3358 14.3822 12.75V12.7575C14.3822 13.1717 14.0604 13.5075 13.6634 13.5075H13.6562C13.2593 13.5075 12.9375 13.1717 12.9375 12.7575V12.75ZM15.0938 12.75C15.0938 12.3358 15.4155 12 15.8125 12H15.8197C16.2166 12 16.5384 12.3358 16.5384 12.75V12.7575C16.5384 13.1717 16.2166 13.5075 15.8197 13.5075H15.8125C15.4155 13.5075 15.0938 13.1717 15.0938 12.7575V12.75ZM6.46875 15C6.46875 14.5858 6.79054 14.25 7.1875 14.25H7.19469C7.59164 14.25 7.91344 14.5858 7.91344 15V15.0075C7.91344 15.4217 7.59164 15.7575 7.19469 15.7575H7.1875C6.79054 15.7575 6.46875 15.4217 6.46875 15.0075V15ZM8.625 15C8.625 14.5858 8.94679 14.25 9.34375 14.25H9.35094C9.74789 14.25 10.0697 14.5858 10.0697 15V15.0075C10.0697 15.4217 9.74789 15.7575 9.35094 15.7575H9.34375C8.94679 15.7575 8.625 15.4217 8.625 15.0075V15ZM10.7812 15C10.7812 14.5858 11.103 14.25 11.5 14.25H11.5072C11.9041 14.25 12.2259 14.5858 12.2259 15V15.0075C12.2259 15.4217 11.9041 15.7575 11.5072 15.7575H11.5C11.103 15.7575 10.7812 15.4217 10.7812 15.0075V15ZM12.9375 15C12.9375 14.5858 13.2593 14.25 13.6562 14.25H13.6634C14.0604 14.25 14.3822 14.5858 14.3822 15V15.0075C14.3822 15.4217 14.0604 15.7575 13.6634 15.7575H13.6562C13.2593 15.7575 12.9375 15.4217 12.9375 15.0075V15ZM15.0938 15C15.0938 14.5858 15.4155 14.25 15.8125 14.25H15.8197C16.2166 14.25 16.5384 14.5858 16.5384 15V15.0075C16.5384 15.4217 16.2166 15.7575 15.8197 15.7575H15.8125C15.4155 15.7575 15.0938 15.4217 15.0938 15.0075V15ZM6.46875 17.25C6.46875 16.8358 6.79054 16.5 7.1875 16.5H7.19469C7.59164 16.5 7.91344 16.8358 7.91344 17.25V17.2575C7.91344 17.6717 7.59164 18.0075 7.19469 18.0075H7.1875C6.79054 18.0075 6.46875 17.6717 6.46875 17.2575V17.25ZM8.625 17.25C8.625 16.8358 8.94679 16.5 9.34375 16.5H9.35094C9.74789 16.5 10.0697 16.8358 10.0697 17.25V17.2575C10.0697 17.6717 9.74789 18.0075 9.35094 18.0075H9.34375C8.94679 18.0075 8.625 17.6717 8.625 17.2575V17.25ZM10.7812 17.25C10.7812 16.8358 11.103 16.5 11.5 16.5H11.5072C11.9041 16.5 12.2259 16.8358 12.2259 17.25V17.2575C12.2259 17.6717 11.9041 18.0075 11.5072 18.0075H11.5C11.103 18.0075 10.7812 17.6717 10.7812 17.2575V17.25ZM12.9375 17.25C12.9375 16.8358 13.2593 16.5 13.6562 16.5H13.6634C14.0604 16.5 14.3822 16.8358 14.3822 17.25V17.2575C14.3822 17.6717 14.0604 18.0075 13.6634 18.0075H13.6562C13.2593 18.0075 12.9375 17.6717 12.9375 17.2575V17.25Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nconst ChevronLeftIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nconst ChevronRightIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\ntype DatePickerTranslations = NonNullable<ComponentProps<typeof ArkDatePicker.Root>['translations']>\n\n/**\n * Zag's own accessible names are English (\"Open calendar\", \"Choose ...\"): they are replaced by the\n * app's labels. A day that cannot be picked says so, where Zag would still invite to choose it.\n */\nconst datePickerTranslations = (labels: DatePickerLabels): DatePickerTranslations => ({\n trigger: open => (open ? labels.closeCalendar : labels.openCalendar),\n content: labels.calendar,\n prevTrigger: view =>\n view === 'year' ? labels.previousDecade : view === 'month' ? labels.previousYear : labels.previousMonth,\n nextTrigger: view => (view === 'year' ? labels.nextDecade : view === 'month' ? labels.nextYear : labels.nextMonth),\n monthSelect: labels.selectMonth,\n yearSelect: labels.selectYear,\n clearTrigger: labels.clear,\n dayCell: state => {\n if (state.unavailable || state.disabled) return labels.unavailableDate(state.valueText)\n if (state.selected || state.inRange) return labels.selectedDate(state.valueText)\n return labels.chooseDate(state.valueText)\n },\n})\n\nexport const DatePicker: FC<DatePickerProps> = ({\n placeholder,\n preflightClassName,\n selectionMode,\n clearValueWhenEmpty = true,\n ...props\n}) => {\n const isRange = selectionMode === 'range'\n const labels = useUiLabels()\n\n return (\n <DatePickerRoot\n startOfWeek={1}\n locale={labels.locale}\n {...props}\n translations={{ ...datePickerTranslations(labels.datePicker), ...props.translations }}\n selectionMode={selectionMode}\n onValueChange={value =>\n props.onValueChange?.({ ...value, valueAsString: value.value.length ? [value.value.toString()] : [] })\n }\n >\n <ArkDatePicker.Context>\n {api => (\n <DatePickerControl>\n <InputGroup>\n <DatePickerInput asChild index={0} placeholder={placeholder}>\n <Input\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n />\n </DatePickerInput>\n <InputAddon>\n <ClearTrigger 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\n <DatePickerTrigger style={{ cursor: 'pointer' }}>\n <DateIcon />\n </DatePickerTrigger>\n </InputAddon>\n </InputGroup>\n {isRange ? (\n <InputGroup>\n <DatePickerInput asChild index={1} placeholder={placeholder}>\n <Input\n onInput={(e: React.FormEvent<HTMLInputElement>) => {\n const value = e.currentTarget.value\n\n if (clearValueWhenEmpty && value === '') {\n api.clearValue()\n }\n }}\n />\n </DatePickerInput>\n <InputAddon>\n {api.value.length === 2 ? (\n <ClearTrigger 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 ) : null}\n <DatePickerTrigger>\n <DateIcon />\n </DatePickerTrigger>\n </InputAddon>\n </InputGroup>\n ) : null}\n </DatePickerControl>\n )}\n </ArkDatePicker.Context>\n <Portal>\n <DatePickerPositioner className={preflightClassName}>\n <DatePickerContent>\n <DatePickerView view=\"day\">\n <ArkDatePicker.Context>\n {api => (\n <>\n <DatePickerViewControl>\n <DatePickerPrevTrigger asChild>\n <IconButton aria-label={labels.datePicker.previousMonth} variant=\"secondary\" size=\"md\">\n <ChevronLeftIcon />\n </IconButton>\n </DatePickerPrevTrigger>\n <DatePickerMonthSelect />\n <DatePickerYearSelect />\n <DatePickerNextTrigger asChild>\n <IconButton aria-label={labels.datePicker.nextMonth} variant=\"secondary\" size=\"md\">\n <ChevronRightIcon />\n </IconButton>\n </DatePickerNextTrigger>\n </DatePickerViewControl>\n <DatePickerTable>\n <DatePickerTableHead>\n <DatePickerTableRow>\n {api.weekDays.map((weekDay, id) => (\n <DatePickerTableHeader key={id}>{weekDay.short}</DatePickerTableHeader>\n ))}\n </DatePickerTableRow>\n </DatePickerTableHead>\n <DatePickerTableBody>\n {api.weeks.map((week, id) => (\n <DatePickerTableRow key={id}>\n {week.map((day, id) => (\n <DatePickerTableCell key={id} value={day}>\n <DatePickerTableCellTrigger asChild>\n <button>{day.day}</button>\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </DatePickerTableRow>\n ))}\n </DatePickerTableBody>\n </DatePickerTable>\n </>\n )}\n </ArkDatePicker.Context>\n </DatePickerView>\n </DatePickerContent>\n </DatePickerPositioner>\n </Portal>\n </DatePickerRoot>\n )\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