@42-central/ui-react 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PAFS7TED.js → chunk-2HIX6DKN.js} +3 -3
- package/dist/{chunk-PAFS7TED.js.map → chunk-2HIX6DKN.js.map} +1 -1
- package/dist/{chunk-Z5WYYDG2.js → chunk-2MXWEIMD.js} +7 -4
- package/dist/chunk-2MXWEIMD.js.map +1 -0
- package/dist/{chunk-JYK6JVR3.js → chunk-3BXKTWWD.js} +8 -8
- package/dist/{chunk-JYK6JVR3.js.map → chunk-3BXKTWWD.js.map} +1 -1
- package/dist/{chunk-7R4CDHBK.js → chunk-45QRQKRC.js} +4 -4
- package/dist/{chunk-7R4CDHBK.js.map → chunk-45QRQKRC.js.map} +1 -1
- package/dist/{chunk-MKJKCBRE.js → chunk-47LEAR6G.js} +6 -6
- package/dist/{chunk-MKJKCBRE.js.map → chunk-47LEAR6G.js.map} +1 -1
- package/dist/chunk-4ASNIDV7.js +17 -0
- package/dist/chunk-4ASNIDV7.js.map +1 -0
- package/dist/{chunk-ZN3WYGIQ.js → chunk-5HUEBSIS.js} +3 -3
- package/dist/{chunk-ZN3WYGIQ.js.map → chunk-5HUEBSIS.js.map} +1 -1
- package/dist/{chunk-2TM7UVM2.js → chunk-6M6YZ3PQ.js} +4 -4
- package/dist/{chunk-2TM7UVM2.js.map → chunk-6M6YZ3PQ.js.map} +1 -1
- package/dist/{chunk-4BGU2UQB.js → chunk-6VYGK3Q3.js} +6 -6
- package/dist/{chunk-4BGU2UQB.js.map → chunk-6VYGK3Q3.js.map} +1 -1
- package/dist/{chunk-ZFUTGBJC.js → chunk-6YNLRQ25.js} +3 -3
- package/dist/{chunk-ZFUTGBJC.js.map → chunk-6YNLRQ25.js.map} +1 -1
- package/dist/{chunk-6OV6EJQ2.js → chunk-7AQ4MN4M.js} +6 -6
- package/dist/{chunk-6OV6EJQ2.js.map → chunk-7AQ4MN4M.js.map} +1 -1
- package/dist/{chunk-5337N3FE.js → chunk-7BOSX65U.js} +3 -3
- package/dist/{chunk-5337N3FE.js.map → chunk-7BOSX65U.js.map} +1 -1
- package/dist/{chunk-THLMW5IU.js → chunk-7CNDZZZ6.js} +4 -4
- package/dist/{chunk-THLMW5IU.js.map → chunk-7CNDZZZ6.js.map} +1 -1
- package/dist/{chunk-LJ3GHC4V.js → chunk-BE2LWUHY.js} +5 -5
- package/dist/{chunk-LJ3GHC4V.js.map → chunk-BE2LWUHY.js.map} +1 -1
- package/dist/{chunk-LSIX2PVU.js → chunk-BNWQ7IAZ.js} +7 -7
- package/dist/{chunk-LSIX2PVU.js.map → chunk-BNWQ7IAZ.js.map} +1 -1
- package/dist/{chunk-2KN3MI7I.js → chunk-C4NFRSOR.js} +4 -4
- package/dist/{chunk-2KN3MI7I.js.map → chunk-C4NFRSOR.js.map} +1 -1
- package/dist/{chunk-3REFDGOM.js → chunk-C6NVU4F7.js} +3 -3
- package/dist/{chunk-3REFDGOM.js.map → chunk-C6NVU4F7.js.map} +1 -1
- package/dist/{chunk-HVOEVB4E.js → chunk-D2QIPQ74.js} +3 -3
- package/dist/{chunk-HVOEVB4E.js.map → chunk-D2QIPQ74.js.map} +1 -1
- package/dist/{chunk-4EU6FGGB.js → chunk-DA4QII2N.js} +4 -4
- package/dist/{chunk-4EU6FGGB.js.map → chunk-DA4QII2N.js.map} +1 -1
- package/dist/{chunk-LZWA7V62.js → chunk-DJLNGWMM.js} +5 -5
- package/dist/{chunk-LZWA7V62.js.map → chunk-DJLNGWMM.js.map} +1 -1
- package/dist/{chunk-HEQ2H6VO.js → chunk-DT6LKNZF.js} +4 -4
- package/dist/{chunk-HEQ2H6VO.js.map → chunk-DT6LKNZF.js.map} +1 -1
- package/dist/{chunk-BUFALAEK.js → chunk-E5H3YWZV.js} +4 -4
- package/dist/{chunk-BUFALAEK.js.map → chunk-E5H3YWZV.js.map} +1 -1
- package/dist/{chunk-WR444JRU.js → chunk-E63VD25L.js} +7 -7
- package/dist/{chunk-WR444JRU.js.map → chunk-E63VD25L.js.map} +1 -1
- package/dist/{chunk-H7INUXZD.js → chunk-F342ZT7O.js} +4 -4
- package/dist/{chunk-H7INUXZD.js.map → chunk-F342ZT7O.js.map} +1 -1
- package/dist/{chunk-VALQ2XVA.js → chunk-H3PYSAWN.js} +3 -3
- package/dist/{chunk-VALQ2XVA.js.map → chunk-H3PYSAWN.js.map} +1 -1
- package/dist/{chunk-Q5ZO2O25.js → chunk-HRNWWL3Y.js} +6 -6
- package/dist/{chunk-Q5ZO2O25.js.map → chunk-HRNWWL3Y.js.map} +1 -1
- package/dist/{chunk-DHTSVJ4G.js → chunk-IOYZC7SA.js} +9 -9
- package/dist/{chunk-DHTSVJ4G.js.map → chunk-IOYZC7SA.js.map} +1 -1
- package/dist/{chunk-HBFN5W7Q.js → chunk-JVG5ISPT.js} +4 -4
- package/dist/{chunk-HBFN5W7Q.js.map → chunk-JVG5ISPT.js.map} +1 -1
- package/dist/{chunk-6KER77RS.js → chunk-KMZENCEP.js} +7 -7
- package/dist/{chunk-6KER77RS.js.map → chunk-KMZENCEP.js.map} +1 -1
- package/dist/{chunk-VVM7JMZS.js → chunk-LBAE6FP6.js} +8 -8
- package/dist/{chunk-VVM7JMZS.js.map → chunk-LBAE6FP6.js.map} +1 -1
- package/dist/{chunk-U2PNMMDB.js → chunk-LKFHUDEW.js} +7 -7
- package/dist/{chunk-U2PNMMDB.js.map → chunk-LKFHUDEW.js.map} +1 -1
- package/dist/{chunk-P276SCCV.js → chunk-MKKQE3TM.js} +6 -6
- package/dist/{chunk-P276SCCV.js.map → chunk-MKKQE3TM.js.map} +1 -1
- package/dist/{chunk-2SVX3MQQ.js → chunk-MW42XVPD.js} +3 -3
- package/dist/{chunk-2SVX3MQQ.js.map → chunk-MW42XVPD.js.map} +1 -1
- package/dist/{chunk-S4TRYMCU.js → chunk-MXAACRWE.js} +6 -6
- package/dist/{chunk-S4TRYMCU.js.map → chunk-MXAACRWE.js.map} +1 -1
- package/dist/{chunk-WFHY6NRQ.js → chunk-NJPHZBLI.js} +11 -11
- package/dist/{chunk-WFHY6NRQ.js.map → chunk-NJPHZBLI.js.map} +1 -1
- package/dist/{chunk-DUPE2CRU.js → chunk-NKOTA5TM.js} +3 -3
- package/dist/{chunk-DUPE2CRU.js.map → chunk-NKOTA5TM.js.map} +1 -1
- package/dist/{chunk-RGLNH7A5.js → chunk-NLOBBJAA.js} +3 -3
- package/dist/{chunk-RGLNH7A5.js.map → chunk-NLOBBJAA.js.map} +1 -1
- package/dist/{chunk-FXDLS23K.js → chunk-NS6RGPWR.js} +3 -3
- package/dist/{chunk-FXDLS23K.js.map → chunk-NS6RGPWR.js.map} +1 -1
- package/dist/{chunk-ZWOZL4XX.js → chunk-O5W3QWJ6.js} +5 -5
- package/dist/{chunk-ZWOZL4XX.js.map → chunk-O5W3QWJ6.js.map} +1 -1
- package/dist/{chunk-PD4FX34E.js → chunk-O7LS6OZR.js} +4 -4
- package/dist/{chunk-PD4FX34E.js.map → chunk-O7LS6OZR.js.map} +1 -1
- package/dist/{chunk-JL4QMM46.js → chunk-POKLPMSB.js} +5 -5
- package/dist/{chunk-JL4QMM46.js.map → chunk-POKLPMSB.js.map} +1 -1
- package/dist/{chunk-K6BHDFX3.js → chunk-QKSLDQM2.js} +3 -3
- package/dist/{chunk-K6BHDFX3.js.map → chunk-QKSLDQM2.js.map} +1 -1
- package/dist/{chunk-CDHIF2NV.js → chunk-QNKD2SQM.js} +8 -8
- package/dist/{chunk-CDHIF2NV.js.map → chunk-QNKD2SQM.js.map} +1 -1
- package/dist/{chunk-KOT4PWGE.js → chunk-RCF7HTG5.js} +5 -5
- package/dist/{chunk-KOT4PWGE.js.map → chunk-RCF7HTG5.js.map} +1 -1
- package/dist/{chunk-SE3CGQRO.js → chunk-RLOWPCGG.js} +3 -3
- package/dist/{chunk-SE3CGQRO.js.map → chunk-RLOWPCGG.js.map} +1 -1
- package/dist/{chunk-R57QP43T.js → chunk-SVKN5ZHX.js} +4 -4
- package/dist/{chunk-R57QP43T.js.map → chunk-SVKN5ZHX.js.map} +1 -1
- package/dist/{chunk-NJ4RO3CT.js → chunk-SWVUXEBT.js} +5 -5
- package/dist/{chunk-NJ4RO3CT.js.map → chunk-SWVUXEBT.js.map} +1 -1
- package/dist/{chunk-FZNPJAGJ.js → chunk-SXNAUSEB.js} +5 -5
- package/dist/{chunk-FZNPJAGJ.js.map → chunk-SXNAUSEB.js.map} +1 -1
- package/dist/{chunk-7AWOMWCQ.js → chunk-TWLJQE75.js} +7 -7
- package/dist/{chunk-7AWOMWCQ.js.map → chunk-TWLJQE75.js.map} +1 -1
- package/dist/{chunk-GGT4GJD6.js → chunk-TWNIAF7K.js} +3 -3
- package/dist/{chunk-GGT4GJD6.js.map → chunk-TWNIAF7K.js.map} +1 -1
- package/dist/{chunk-4TCTMRR5.js → chunk-UAYENYS2.js} +5 -5
- package/dist/{chunk-4TCTMRR5.js.map → chunk-UAYENYS2.js.map} +1 -1
- package/dist/{chunk-HDRC6ITF.js → chunk-UT3TOV2Q.js} +3 -3
- package/dist/{chunk-HDRC6ITF.js.map → chunk-UT3TOV2Q.js.map} +1 -1
- package/dist/{chunk-R52P43LZ.js → chunk-UXPINIDN.js} +3 -3
- package/dist/{chunk-R52P43LZ.js.map → chunk-UXPINIDN.js.map} +1 -1
- package/dist/{chunk-45DFYIK5.js → chunk-VD6PB3VA.js} +3 -3
- package/dist/{chunk-45DFYIK5.js.map → chunk-VD6PB3VA.js.map} +1 -1
- package/dist/{chunk-2OQP7UY4.js → chunk-VTDBWU6H.js} +4 -4
- package/dist/{chunk-2OQP7UY4.js.map → chunk-VTDBWU6H.js.map} +1 -1
- package/dist/{chunk-IMP5VHEN.js → chunk-XKDL4QS6.js} +3 -3
- package/dist/{chunk-IMP5VHEN.js.map → chunk-XKDL4QS6.js.map} +1 -1
- package/dist/{chunk-H26K66EU.js → chunk-Y57NW6G7.js} +3 -3
- package/dist/{chunk-H26K66EU.js.map → chunk-Y57NW6G7.js.map} +1 -1
- package/dist/components/accordion/index.js +5 -5
- package/dist/components/action-icon/index.js +4 -4
- package/dist/components/alert/index.js +6 -6
- package/dist/components/ambient-background/index.js +1 -1
- package/dist/components/app-shell/index.js +6 -6
- package/dist/components/aspect-ratio/index.js +1 -1
- package/dist/components/autocomplete/index.js +6 -6
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/badge/index.js +3 -3
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/button/index.js +4 -4
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-multi-select/index.js +7 -7
- package/dist/components/button-select/index.js +7 -7
- package/dist/components/calendar/index.js +6 -6
- package/dist/components/camera/index.js +14 -14
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/index.js +2 -2
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/chart/index.js +1 -1
- package/dist/components/checkbox/index.js +6 -6
- package/dist/components/choice-card-group/index.js +5 -5
- package/dist/components/circular-progress/index.js +1 -1
- package/dist/components/clipboard/index.js +6 -6
- package/dist/components/code/index.js +2 -2
- package/dist/components/code-block/chrome.js +6 -6
- package/dist/components/code-block/index.js +7 -7
- package/dist/components/code-block/static.js +4 -1
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/collapse/index.js +2 -2
- package/dist/components/combobox/index.js +6 -6
- package/dist/components/combobox-list/index.js +8 -8
- package/dist/components/compare/index.js +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/data-table/index.js +32 -32
- package/dist/components/date-picker/index.js +15 -15
- package/dist/components/divider/index.js +2 -2
- package/dist/components/download-button/index.js +5 -5
- package/dist/components/drawer/index.js +6 -6
- package/dist/components/field/index.js +2 -2
- package/dist/components/figure/index.js +2 -2
- package/dist/components/file-item/index.js +8 -8
- package/dist/components/file-preview/index.js +6 -6
- package/dist/components/file-queue-summary/index.js +2 -2
- package/dist/components/file-trigger/index.js +5 -5
- package/dist/components/file-upload/index.js +10 -10
- package/dist/components/flex/index.js +2 -2
- package/dist/components/gallery/index.js +4 -4
- package/dist/components/grid/index.js +1 -1
- package/dist/components/hover-card/index.js +2 -2
- package/dist/components/image/index.js +2 -2
- package/dist/components/image-cropper/index.js +7 -7
- package/dist/components/indicator/index.js +1 -1
- package/dist/components/input/index.js +3 -3
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/lightbox/index.js +9 -9
- package/dist/components/mark/index.js +2 -2
- package/dist/components/menu/index.js +4 -4
- package/dist/components/modal/index.js +6 -6
- package/dist/components/multi-combobox-list/index.js +10 -10
- package/dist/components/multi-select/index.js +9 -9
- package/dist/components/nav-link/index.js +5 -5
- package/dist/components/nav-link/tanstack.js +5 -5
- package/dist/components/notification/index.js +7 -7
- package/dist/components/number-input/index.js +6 -6
- package/dist/components/overlays/index.js +8 -8
- package/dist/components/password-input/index.js +4 -4
- package/dist/components/photo-capture/index.js +17 -17
- package/dist/components/pill/index.js +3 -3
- package/dist/components/pills-input/index.js +6 -6
- package/dist/components/pin-input/index.js +3 -3
- package/dist/components/popover/index.js +2 -2
- package/dist/components/progress/index.js +2 -2
- package/dist/components/radio-group/index.js +4 -4
- package/dist/components/rating/index.js +3 -3
- package/dist/components/schedule/index.js +9 -9
- package/dist/components/segment-group/index.js +3 -3
- package/dist/components/select/index.js +7 -7
- package/dist/components/skeleton/index.js +2 -2
- package/dist/components/slider/index.js +4 -4
- package/dist/components/spinner/index.js +2 -2
- package/dist/components/spotlight/index.js +15 -15
- package/dist/components/switch/index.js +3 -3
- package/dist/components/table/index.js +3 -3
- package/dist/components/tabs/index.js +3 -3
- package/dist/components/tags-input/index.js +8 -8
- package/dist/components/text/index.js +2 -2
- package/dist/components/text-input/index.js +3 -3
- package/dist/components/textarea/index.js +3 -3
- package/dist/components/theme-icon/index.js +3 -3
- package/dist/components/time-input/index.js +8 -8
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/title/index.js +2 -2
- package/dist/components/tooltip/index.js +3 -3
- package/dist/components/tree-multi-select/index.js +10 -10
- package/dist/components/tree-select/index.js +7 -7
- package/dist/index.js +2 -2
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +1 -1
- package/package.json +1 -1
- package/src/components/card/card.test.tsx +10 -0
- package/src/components/card/card.tsx +4 -1
- package/src/lib/cn.test.ts +9 -0
- package/src/lib/cn.ts +9 -1
- package/dist/chunk-QP4I37PA.js +0 -14
- package/dist/chunk-QP4I37PA.js.map +0 -1
- package/dist/chunk-Z5WYYDG2.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MEDIA_RADIUS } from './chunk-J43LSYQO.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
3
|
import { TYPOGRAPHY_SHADE_CLASSES } from './chunk-GIPQUKCN.js';
|
|
4
|
-
import { cn } from './chunk-
|
|
4
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
5
5
|
import { ark } from '@ark-ui/react';
|
|
6
6
|
import { match } from 'ts-pattern';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -81,5 +81,5 @@ var FigureComponent = ({
|
|
|
81
81
|
var Figure = Object.assign(FigureComponent, { Caption: FigureCaption });
|
|
82
82
|
|
|
83
83
|
export { Figure };
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-2HIX6DKN.js.map
|
|
85
|
+
//# sourceMappingURL=chunk-2HIX6DKN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/figure/figure.tsx"],"names":[],"mappings":";;;;;;;;AA+BA,IAAM,cAAA,GAAiB;AAAA,EACrB,oBAAA;AAAA,EACA,wBAAA,CAAyB,KAAA;AAAA;AAAA,EAEzB,qBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,gGAAA;AAAA,EACA,2FAAA;AAAA,EACA,yFAAA;AAAA,EACA,kDAAA;AAA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{ ReactNode } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Figure — media with a caption, as a real `<figure>` and `<figcaption>`.\n *\n * <Figure caption=\"Our first morning in the mountains.\">\n * <Image src={photo.url} alt=\"Snow-capped peaks above the clouds\" width={640} height={427} />\n * </Figure>\n *\n * The caption goes below the media, above it, or over its bottom edge on a\n * scrim (`placement`). The figure hugs its media: the caption has\n * `contain: inline-size`, so it never widens the figure and wraps to the\n * media's width instead. A fluid image needs the figure sized for it\n * (`className=\"w-full\"`), since a fluid box inside a shrink-to-fit one has\n * no width to fill.\n *\n * `Figure.Caption` is the part on its own, for a caption with its own\n * structure. It reads the placement from the root's `data-placement`\n * through a CSS group, so the overlay works without context and the whole\n * component stays a Server Component.\n *\n * The root has no `asChild`: it renders the caption beside its children.\n */\nconst captionClasses = [\n \"text-start text-sm\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n // Contributes no width of its own, so it wraps to the media's.\n \"contain-inline-size\",\n // Over the media: white on a dark scrim, the same in both themes since it\n // sits on the photo, not the page. The band under the text is at least\n // 60% black, which keeps white text above 4.5:1 even over a white image;\n // the gradient only fades that band in above it.\n \"group-data-[placement=overlay]/figure:absolute group-data-[placement=overlay]/figure:inset-x-0\",\n \"group-data-[placement=overlay]/figure:bottom-0 group-data-[placement=overlay]/figure:px-3\",\n \"group-data-[placement=overlay]/figure:pt-1 group-data-[placement=overlay]/figure:pb-2.5\",\n \"group-data-[placement=overlay]/figure:text-white\",\n \"group-data-[placement=overlay]/figure:bg-linear-to-t\",\n \"group-data-[placement=overlay]/figure:from-black/75 group-data-[placement=overlay]/figure:to-black/60\",\n \"group-data-[placement=overlay]/figure:before:absolute group-data-[placement=overlay]/figure:before:inset-x-0\",\n \"group-data-[placement=overlay]/figure:before:bottom-full group-data-[placement=overlay]/figure:before:h-10\",\n \"group-data-[placement=overlay]/figure:before:bg-linear-to-t\",\n \"group-data-[placement=overlay]/figure:before:from-black/60 group-data-[placement=overlay]/figure:before:to-transparent\",\n // Forced colors drop the scrim: a system surface keeps the text legible.\n \"group-data-[placement=overlay]/figure:forced-colors:bg-[Canvas]\",\n \"group-data-[placement=overlay]/figure:forced-colors:text-[CanvasText]\",\n \"group-data-[placement=overlay]/figure:forced-colors:before:hidden\",\n]\n\nexport type FigurePlacement = \"bottom\" | \"top\" | \"overlay\"\n\ntype FigureClassNames = {\n root?: string\n caption?: string\n}\n\nexport type FigureCaptionProps = HTMLArkProps<\"figcaption\"> & WithTestId\n\nexport type FigureProps = NoAsChild<HTMLArkProps<\"figure\">> &\n WithTestId & {\n /** Caption content. Adds context to the media; it isn't its alt text. */\n caption?: ReactNode\n /** Below the media, above it, or over its bottom edge on a scrim. */\n placement?: FigurePlacement\n /** Corner radius, on `Image`'s scale. Match the media's: an overlay caption is clipped to it. */\n radius?: MediaRadius\n classNames?: FigureClassNames\n }\n\nconst FigureCaption = ({ className, testId, ...rest }: FigureCaptionProps) => (\n <ark.figcaption\n data-part=\"caption\"\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(captionClasses, className)}\n />\n)\n\nconst FigureComponent = ({\n caption: content,\n placement = \"bottom\",\n radius = \"xs\",\n className,\n classNames,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: FigureProps) => {\n const own =\n content === undefined ? null : (\n <FigureCaption className={classNames?.caption}>{content}</FigureCaption>\n )\n return (\n <ark.figure\n data-part=\"root\"\n data-placement={placement}\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n // Hugs its media on both axes: a stretched figure would detach an overlay\n // caption from the media's bottom edge.\n \"group/figure relative flex h-fit w-fit max-w-full flex-col gap-2\",\n MEDIA_RADIUS[radius],\n // The overlay caption is clipped to the media's corners.\n \"data-[placement=overlay]:overflow-clip\",\n classNames?.root,\n className,\n )}\n >\n {/* Reading order follows the visual one: a caption on top comes first. */}\n {match(placement)\n .with(\"top\", () => (\n <>\n {own}\n {children}\n </>\n ))\n .with(\"bottom\", \"overlay\", () => (\n <>\n {children}\n {own}\n </>\n ))\n .exhaustive()}\n </ark.figure>\n )\n}\n\nexport const Figure = Object.assign(FigureComponent, { Caption: FigureCaption })\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GRADIENT_DIR_BEFORE_CLASS, buildGradientVars } from './chunk-SKPM2FRX.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
3
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
4
|
-
import { cn } from './chunk-
|
|
4
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
5
5
|
import { ark } from '@ark-ui/react';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -31,10 +31,13 @@ var cardVariants = cva("flex flex-col rounded-card border", {
|
|
|
31
31
|
outline: "bg-white/4 text-(--c-text) border-(--c-solid)",
|
|
32
32
|
// from-(--card-gradient-from) / to-(--card-gradient-to) read CSS vars
|
|
33
33
|
// cascaded from the card element's inline style via buildGradientVars().
|
|
34
|
+
// The ring inherits the host's radius per corner, so a `className`
|
|
35
|
+
// radius reshapes it too. `-inset-px` spans the transparent border, so
|
|
36
|
+
// the ring covers the border box, the box that radius shapes.
|
|
34
37
|
gradient: [
|
|
35
38
|
"relative isolate border-transparent bg-white/4",
|
|
36
39
|
TEXT_COLOR_CLASSES.primary,
|
|
37
|
-
"before:absolute before:-inset-px before:-z-10 before:rounded-
|
|
40
|
+
"before:absolute before:-inset-px before:-z-10 before:rounded-[inherit] before:p-px",
|
|
38
41
|
"before:bg-linear-to-r",
|
|
39
42
|
"before:from-(--card-gradient-from) before:to-(--card-gradient-to)",
|
|
40
43
|
"before:mask before:mask-exclude"
|
|
@@ -152,5 +155,5 @@ var Card = Object.assign(CardComponent, {
|
|
|
152
155
|
});
|
|
153
156
|
|
|
154
157
|
export { Card };
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
158
|
+
//# sourceMappingURL=chunk-2MXWEIMD.js.map
|
|
159
|
+
//# sourceMappingURL=chunk-2MXWEIMD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/card/card.tsx"],"names":[],"mappings":";;;;;;;;AAcA,IAAM,YAAA,GAAe,IAAI,mCAAA,EAAqC;AAAA,EAC5D,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAcP,OAAA,EAAS;AAAA,QACP,+CAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,MAAA,EAAQ,uDAAA;AAAA,MACR,KAAA,EAAO,iDAAA;AAAA,MACP,OAAA,EAAS,+CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,QAAA,EAAU;AAAA,QACR,gDAAA;AAAA,QACA,kBAAA,CAAmB,OAAA;AAAA,QACnB,oFAAA;AAAA,QACA,uBAAA;AAAA,QACA,mEAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,KAAA;AAAA,MACN,EAAA,EAAI,KAAA;AAAA,MACJ,EAAA,EAAI,KAAA;AAAA,MACJ,EAAA,EAAI,KAAA;AAAA,MACJ,EAAA,EAAI,KAAA;AAAA,MACJ,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS,SAAA;AAAA,IACT,OAAA,EAAS;AAAA;AAEb,CAAC,CAAA;AA0CD,IAAM,gBAAgB,CAAC;AAAA,EACrB,SAAA;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e,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAGK,IAAM,IAAA,GAAO,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe;AAAA,EAC/C,MAAA,EAAQ,UAAA;AAAA,EACR,KAAA,EAAO,SAAA;AAAA,EACP,WAAA,EAAa,eAAA;AAAA,EACb,OAAA,EAAS,WAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAC","file":"chunk-2MXWEIMD.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport {\n buildGradientVars,\n GRADIENT_DIR_BEFORE_CLASS,\n type GradientDir,\n type GradientProps,\n} from \"../../lib/gradient\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\nconst cardVariants = cva(\"flex flex-col rounded-card border\", {\n variants: {\n variant: {\n // Matches the 42 UI Kit Figma's card chrome — navy text in light\n // theme, white text in dark theme (a straight inversion, confirmed\n // against Figma's own light-mode test frame). The 4% white overlay\n // (Figma's own bg-primary token) is Figma's dark-theme elevation\n // tint — meant to sit on an already-dark page, lightening whatever's\n // behind it rather than imposing a flat hue — used here in both\n // themes for a consistently subtle surface.\n //\n // The border is the kit's hairline, `border-brand-900/20\n // dark:border-white/15` — the same pair `Input`'s shell,\n // `SegmentGroup` and `ChoiceCardGroup` draw. It used to sit at\n // /30 ÷ /10, brand-tinted but off by an opacity step from everything\n // else, left over from an earlier partial alignment pass.\n default: [\n \"bg-white/4 text-brand-950 border-brand-900/20\",\n \"dark:text-white dark:border-white/15\",\n ],\n filled: \"bg-(--c-solid) text-(--c-on-solid) border-(--c-solid)\",\n light: \"bg-(--c-soft) text-(--c-text) border-(--c-soft)\",\n outline: \"bg-white/4 text-(--c-text) border-(--c-solid)\",\n // from-(--card-gradient-from) / to-(--card-gradient-to) read CSS vars\n // cascaded from the card element's inline style via buildGradientVars().\n // The ring inherits the host's radius per corner, so a `className`\n // radius reshapes it too. `-inset-px` spans the transparent border, so\n // the ring covers the border box, the box that radius shapes.\n gradient: [\n \"relative isolate border-transparent bg-white/4\",\n TEXT_COLOR_CLASSES.primary,\n \"before:absolute before:-inset-px before:-z-10 before:rounded-[inherit] before:p-px\",\n \"before:bg-linear-to-r\",\n \"before:from-(--card-gradient-from) before:to-(--card-gradient-to)\",\n \"before:mask before:mask-exclude\",\n ],\n },\n padding: {\n none: \"p-0\",\n xs: \"p-2\",\n sm: \"p-3\",\n md: \"p-4\",\n lg: \"p-6\",\n xl: \"p-8\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n padding: \"md\",\n },\n})\n\nexport type CardVariant = NonNullable<VariantProps<typeof cardVariants>[\"variant\"]>\n\nexport type { GradientDir, GradientProps }\n\nexport type CardProps = HTMLArkProps<\"div\"> &\n VariantProps<typeof cardVariants> &\n WithTestId & {\n color?: Color\n /**\n * Gradient config. Only applied when `variant=\"gradient\"`.\n * Mirrors Tailwind's from-* / to-* / via-* utilities via CSS vars so\n * the ::before pseudo-element gradient is fully controlled from props.\n * Unset fields fall back to purple-300 → pink-400, to-r.\n */\n gradient?: GradientProps\n }\n\n/**\n * Card — a bordered content surface. Combines a `variant` (shape) with a\n * `color` (palette) like the rest of the kit, and exposes its regions as\n * namespaced parts: `Card.Header`, `Card.Title`, `Card.Description`,\n * `Card.Content`, `Card.Footer`. Use `padding=\"none\"` when composing the parts\n * so they own the spacing.\n *\n * <Card variant=\"light\" color=\"green\" padding=\"none\">\n * <Card.Header>\n * <Card.Title>Title</Card.Title>\n * <Card.Description>Supporting text.</Card.Description>\n * </Card.Header>\n * <Card.Content>Body</Card.Content>\n * <Card.Footer><Button size=\"sm\">Action</Button></Card.Footer>\n * </Card>\n *\n * `Card.Header`, `Card.Description`, and `Card.Footer` each take a `withBorder`\n * boolean (default `false`) that draws a separator on the edge facing the\n * content — bottom for `Header`, top for `Description` / `Footer` — for when\n * a section needs visual separation from its neighbor. `Card.Content` has no\n * `withBorder`: it sits between the two, so `Header` / `Footer` already own\n * that edge.\n */\nconst CardComponent = ({\n className,\n variant,\n padding,\n color,\n gradient,\n style,\n testId,\n ...rest\n}: CardProps) => {\n const isGradient = variant === \"gradient\"\n\n return (\n <ark.div\n data-color={isGradient ? undefined : color}\n style={\n isGradient\n ? {\n ...buildGradientVars(gradient, {\n fromVar: \"--card-gradient-from\",\n toVar: \"--card-gradient-to\",\n viaVar: \"--card-gradient-via\",\n fromDefault: \"var(--color-purple-300)\",\n toDefault: \"var(--color-pink-400)\",\n }),\n ...style,\n }\n : style\n }\n className={cn(\n cardVariants({ variant, padding }),\n isGradient && gradient?.dir && GRADIENT_DIR_BEFORE_CLASS[gradient.dir],\n isGradient && gradient?.via && \"before:via-(--card-gradient-via)\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type CardHeaderProps = HTMLArkProps<\"div\"> & WithTestId & { withBorder?: boolean }\n\nconst CardHeader = ({ className, withBorder, testId, ...rest }: CardHeaderProps) => (\n <ark.div\n className={cn(\n \"flex flex-col gap-1 px-4 py-3\",\n { \"border-b border-brand-900/20 dark:border-white/15\": withBorder },\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardTitleProps = HTMLArkProps<\"h3\"> & WithTestId\n\nconst CardTitle = ({ className, testId, ...rest }: CardTitleProps) => (\n <ark.h3\n className={cn(\"font-semibold tracking-normal\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardDescriptionProps = HTMLArkProps<\"p\"> & WithTestId & { withBorder?: boolean }\n\nconst CardDescription = ({ className, withBorder, testId, ...rest }: CardDescriptionProps) => (\n <ark.p\n className={cn(\n \"text-sm\",\n TEXT_COLOR_CLASSES.muted,\n { \"border-t border-brand-900/20 dark:border-white/15\": withBorder },\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardContentProps = HTMLArkProps<\"div\"> & WithTestId\n\nconst CardContent = ({ className, testId, ...rest }: CardContentProps) => (\n <ark.div\n className={cn(\"flex-1 px-4 py-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardFooterProps = HTMLArkProps<\"div\"> & WithTestId & { withBorder?: boolean }\n\nconst CardFooter = ({ className, withBorder, testId, ...rest }: CardFooterProps) => (\n <ark.div\n className={cn(\n \"flex items-center justify-end gap-2 px-4 py-3\",\n { \"border-t border-brand-900/20 dark:border-white/15\": withBorder },\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Card = Object.assign(CardComponent, {\n Header: CardHeader,\n Title: CardTitle,\n Description: CardDescription,\n Content: CardContent,\n Footer: CardFooter,\n})\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { normalizeSelectData } from './chunk-7TDHT3QD.js';
|
|
2
2
|
import { controlOpenProps } from './chunk-5FDOOG4J.js';
|
|
3
|
-
import { COMBOBOX_DEFAULT_TRANSLATIONS } from './chunk-
|
|
4
|
-
import { inputSlot, placeholderColor, shellGap, inputShell } from './chunk-
|
|
5
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
3
|
+
import { COMBOBOX_DEFAULT_TRANSLATIONS } from './chunk-MKKQE3TM.js';
|
|
4
|
+
import { inputSlot, placeholderColor, shellGap, inputShell } from './chunk-45QRQKRC.js';
|
|
5
|
+
import { FieldShell, fieldA11yProps } from './chunk-VD6PB3VA.js';
|
|
6
6
|
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
7
|
-
import { scrollHighlightedIntoView, popoverClearTrigger, popoverChevron, popoverGroupLabel, popoverList, popoverContent, popoverIndicator, popoverOption } from './chunk-
|
|
7
|
+
import { scrollHighlightedIntoView, popoverClearTrigger, popoverChevron, popoverGroupLabel, popoverList, popoverContent, popoverIndicator, popoverOption } from './chunk-5HUEBSIS.js';
|
|
8
8
|
import { useOverlayContainer } from './chunk-7P32XCEU.js';
|
|
9
9
|
import { NestedLayer } from './chunk-H7WOMZXO.js';
|
|
10
|
-
import { CloseIcon, ChevronIcon, CheckIcon } from './chunk-
|
|
10
|
+
import { CloseIcon, ChevronIcon, CheckIcon } from './chunk-6YNLRQ25.js';
|
|
11
11
|
import { props } from './chunk-WYCMIIRR.js';
|
|
12
|
-
import { cn } from './chunk-
|
|
12
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
13
13
|
import { useFieldContext } from '@ark-ui/react/field';
|
|
14
14
|
import { Portal } from '@ark-ui/react/portal';
|
|
15
15
|
import { Select as Select$1 } from '@ark-ui/react/select';
|
|
@@ -217,5 +217,5 @@ var Select = ({
|
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
export { Select };
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-3BXKTWWD.js.map
|
|
221
|
+
//# sourceMappingURL=chunk-3BXKTWWD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/select/select.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;AAgJA,IAAM,UAAA,GAAa,CAAC,CAAA,KAClB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,CAAA,KAAM,IAAA,GAAO,EAAC,GAAI,CAAC,CAAC,CAAA;AAQpD,IAAM,gBAAgB,CAAC;AAAA,EACrB,GAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAMmB;AACjB,EAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAI,OAAA;AAAA,IAAJ;AAAA,MACC,GAAA;AAAA,MACA,MAAA;AAAA,MACC,GAAG,KAAA,CAAM,EAAE,gBA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AC5B,gBAAM,KAAA,EACT,CAAA;AAAA,UACC,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,YAAY;AAAA,SAAA,EAAA,EAJX,KAAA,CAAM,KAK1B,CACD,CAAA,GACD,KAAA,CAAM,IAAI,YAAY,CAAA,EAC5B,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,wBAEA,GAAA,CAACA,QAAA,CAAI,YAAA,EAAJ,EAAkB,GAAG,WAAA,EAAa;AAAA;AAAA;AAAA,GACrC;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MACvB,UAAA,EAAY,EAAE,KAAA,EAAO,UAAA,EAAY,KAAA,EAAM;AAAA,MAEtC,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-JYK6JVR3.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Select as Ark } from \"@ark-ui/react/select\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type ReactNode,\n type Ref,\n useMemo,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { NestedLayer } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { COMBOBOX_DEFAULT_TRANSLATIONS, type ComboboxTranslations } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputShell,\n inputSlot,\n placeholderColor,\n shellGap,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverGroupLabel,\n popoverIndicator,\n popoverList,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Select — data-driven single-value picker on Ark UI's Select machine. Pass\n * `data` and it renders: a styled trigger, a popover of options, native form\n * submission (hidden `<select>`), typeahead, and full keyboard / RTL / ARIA from\n * Ark. For a *searchable* picker use `Autocomplete`; for multiple values use\n * `MultiSelect`.\n *\n * - `data` accepts `string[]`, `{ value, label?, disabled? }[]`, or grouped\n * `{ group, items }[]` (see `SelectData`).\n * - Value is a single `string | null`; the machine's array contract is hidden.\n * - Label / description / error come from the built-in `Field` wrapper, so a\n * `Select` is accessible and complete on its own.\n * - `clearable` swaps the chevron for a clear button once a value is set.\n *\n * Palette rides on `data-color`; the trigger reuses the shared input shell and\n * the popover the shared option styling, so Select and Combobox look identical.\n */\n\ntype SelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with a sibling element for a visible label\n * placed elsewhere in the layout). */\n label?: string\n control?: string\n option?: string\n popover?: string\n}\n\nexport type SelectProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled value. */\n value?: SelectValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SelectValue<Data> | null\n /** Fires with the selected value (or `null` when cleared). */\n onChange?: (value: SelectValue<Data> | null) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including any check\n * affordance. Omit it to render the label + selected check.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder shown while no value is selected. */\n placeholder?: string\n /** Show a clear button (and allow deselecting) once a value is set. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the chevron / clear button. */\n endSlot?: ReactNode\n size?: InputSize\n variant?: InputVariant\n color?: Color\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Wires the hidden `<select>` into native form submission. */\n name?: string\n /** Forwarded to the trigger; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n /** Lands on the trigger `<button>` for focus-on-error. */\n ref?: Ref<HTMLButtonElement>\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n className?: string\n classNames?: SelectClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names — the same keys as\n * the rest of the combobox family. A partial override keeps the other default. */\n translations?: SelectTranslations\n }\n\n/** Ark's own Select `translations` type (its `clearTriggerLabel`), derived structurally rather\n * than imported from `@zag-js/select`, plus the combobox family's `triggerLabel` for the\n * kit's own chevron button. */\nexport type SelectTranslations = NonNullable<Ark.RootProps<NormalizedItem>[\"translations\"]> &\n Pick<ComboboxTranslations, \"triggerLabel\">\n\n/** Wrap a scalar value into Ark's array contract (or clear with `[]`). */\nconst toArkValue = (v: string | null | undefined): string[] | undefined =>\n v === undefined ? undefined : v === null ? [] : [v]\n\n/**\n * The real, focusable `<button role=\"combobox\">`, split out so it reads the\n * `Field` context from *inside* the wrapping `FieldShell` — `Select` itself\n * renders that shell, so calling `useFieldContext()` at its own top level\n * would run too early.\n */\nconst SelectTrigger = ({\n ref,\n onBlur,\n invalid,\n testId,\n className,\n children,\n}: {\n ref?: Ref<HTMLButtonElement>\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n invalid: boolean\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n return (\n <Ark.Trigger\n ref={ref}\n onBlur={onBlur}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Trigger>\n )\n}\n\nexport const Select = <const Data extends SelectData = SelectData>({\n withinPortal = true,\n container,\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Pick a value\",\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n size = \"md\",\n variant = \"default\",\n color,\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n ...selectProps\n}: SelectProps<Data> & Omit<ComponentProps<\"select\">, keyof SelectProps>) => {\n const resolvedTranslations = { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...translations }\n const portalContainer = useOverlayContainer(container)\n const { collection, items, groups } = useMemo(() => normalizeSelectData(data), [data])\n const controlRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const mergedTriggerRef = useMergedRefs(triggerRef, ref)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const selected = items.find(({ value: iv }) => value === iv)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Ark.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(popoverOption({ size }), classNames?.option)}\n >\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item, {\n selected: ctx.selected,\n highlighted: ctx.highlighted,\n })\n }\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{item.label}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n\n const control = (\n <Ark.Root\n collection={collection}\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n // The machine's collection is typed by value (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's value union.\n onValueChange={\n onChange ? (d) => onChange((d.value[0] ?? null) as SelectValue<Data> | null) : undefined\n }\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n deselectable={clearable}\n translations={resolvedTranslations}\n // Ark anchors Select's positioner to the Trigger, which sits inside the\n // padded `inputShell` Control — so `sameWidth` would inset the panel. Anchor\n // to the full Control instead (matching Combobox), so the panel aligns with\n // and matches the trigger's width.\n positioning={{\n sameWidth: true,\n getAnchorRect: () => controlRef.current?.getBoundingClientRect() ?? null,\n }}\n // Content is an `overflow-hidden` clip wrapper, so the machine's native\n // auto-scroll (which needs Content scrollable) no-ops; route scrolling to\n // the inner List scroller instead.\n scrollToIndexFn={scrollHighlightedIntoView}\n data-color={color}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n const showClear = Boolean(clearable) && api.hasSelectedItems && !disabled && !readOnly\n const showChevron = clearSectionMode === \"both\" || !showClear\n return (\n <Ark.Control\n ref={controlRef}\n {...props({\n \"data-invalid\": isInvalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron / clear control.\n \"data-with-end-slot\": true,\n })}\n // Tablet affordance: a tap on the shell's dead zones (padding) opens\n // the menu too, not just the trigger. The trigger, clear and chevron\n // are all buttons, so the helper skips them and they self-handle.\n // Inert when disabled / readOnly, so it never opens where the trigger won't.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n className={cn(inputShell({ size, variant }), \"cursor-pointer\", classNames?.control)}\n >\n <SelectTrigger\n ref={mergedTriggerRef}\n onBlur={onBlur}\n invalid={isInvalid}\n testId={testId}\n className={cn(\n \"flex min-w-0 flex-1 cursor-pointer items-center bg-transparent text-start outline-none disabled:cursor-not-allowed\",\n // Slots live inside the trigger (not the shell), so re-apply the\n // shell's per-size gap here to space the icon from the value.\n shellGap[size],\n )}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-start\">\n {api.hasSelectedItems ? (\n renderItem && selected ? (\n renderItem(selected, {\n selected: false,\n highlighted: false,\n })\n ) : (\n api.valueAsString\n )\n ) : (\n <span className={placeholderColor}>{placeholder}</span>\n )}\n </span>\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </SelectTrigger>\n {showClear && (\n <Ark.ClearTrigger className={popoverClearTrigger}>\n <CloseIcon />\n </Ark.ClearTrigger>\n )}\n {showChevron && (\n // A sibling toggle button (the value `Ark.Trigger` can't nest it\n // next to the clear button), so the chevron sits at the far edge\n // like the rest of the family. Focus the trigger first so keyboard\n // nav stays on the combobox; `preventDefault` stops the tap from\n // stealing focus to this button. `tabIndex=-1`: the trigger is the\n // tab stop.\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={resolvedTranslations.triggerLabel}\n data-chevron\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm data-disabled:cursor-not-allowed\",\n api.open && \"rotate-180\",\n )}\n {...props({\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n })}\n onPointerDown={(event) => event.preventDefault()}\n {...(!(disabled || readOnly) && {\n onClick: () => {\n triggerRef.current?.focus()\n api.setOpen(!api.open)\n },\n })}\n >\n <ChevronIcon />\n </button>\n )}\n </Ark.Control>\n )\n }}\n </Ark.Context>\n\n {/* Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content data-color={color} className={cn(popoverContent, classNames?.popover)}>\n <Ark.List className={popoverList({ withPaddingTop: true })}>\n {groups\n ? groups.map((group) => (\n <Ark.ItemGroup key={group.group}>\n <Ark.ItemGroupLabel className={popoverGroupLabel}>\n {group.group}\n </Ark.ItemGroupLabel>\n {group.items.map(renderOption)}\n </Ark.ItemGroup>\n ))\n : items.map(renderOption)}\n </Ark.List>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n\n <Ark.HiddenSelect {...selectProps} />\n </Ark.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/select/select.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;AAgJA,IAAM,UAAA,GAAa,CAAC,CAAA,KAClB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,CAAA,KAAM,IAAA,GAAO,EAAC,GAAI,CAAC,CAAC,CAAA;AAQpD,IAAM,gBAAgB,CAAC;AAAA,EACrB,GAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAMmB;AACjB,EAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAI,OAAA;AAAA,IAAJ;AAAA,MACC,GAAA;AAAA,MACA,MAAA;AAAA,MACC,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,aAAA,EAAe,QAAQ,CAAA;AAAA,MAC3D,GAAG,eAAe,KAAK,CAAA;AAAA,MACxB,SAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAA;AAEO,IAAM,SAAS,CAA6C;AA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AAA,EAC5B,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,wBAEA,GAAA,CAACA,QAAA,CAAI,YAAA,EAAJ,EAAkB,GAAG,WAAA,EAAa;AAAA;AAAA;AAAA,GACrC;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MACvB,UAAA,EAAY,EAAE,KAAA,EAAO,UAAA,EAAY,KAAA,EAAM;AAAA,MAEtC,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-3BXKTWWD.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Select as Ark } from \"@ark-ui/react/select\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type ReactNode,\n type Ref,\n useMemo,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { NestedLayer } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { COMBOBOX_DEFAULT_TRANSLATIONS, type ComboboxTranslations } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputShell,\n inputSlot,\n placeholderColor,\n shellGap,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverGroupLabel,\n popoverIndicator,\n popoverList,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Select — data-driven single-value picker on Ark UI's Select machine. Pass\n * `data` and it renders: a styled trigger, a popover of options, native form\n * submission (hidden `<select>`), typeahead, and full keyboard / RTL / ARIA from\n * Ark. For a *searchable* picker use `Autocomplete`; for multiple values use\n * `MultiSelect`.\n *\n * - `data` accepts `string[]`, `{ value, label?, disabled? }[]`, or grouped\n * `{ group, items }[]` (see `SelectData`).\n * - Value is a single `string | null`; the machine's array contract is hidden.\n * - Label / description / error come from the built-in `Field` wrapper, so a\n * `Select` is accessible and complete on its own.\n * - `clearable` swaps the chevron for a clear button once a value is set.\n *\n * Palette rides on `data-color`; the trigger reuses the shared input shell and\n * the popover the shared option styling, so Select and Combobox look identical.\n */\n\ntype SelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with a sibling element for a visible label\n * placed elsewhere in the layout). */\n label?: string\n control?: string\n option?: string\n popover?: string\n}\n\nexport type SelectProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled value. */\n value?: SelectValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SelectValue<Data> | null\n /** Fires with the selected value (or `null` when cleared). */\n onChange?: (value: SelectValue<Data> | null) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including any check\n * affordance. Omit it to render the label + selected check.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder shown while no value is selected. */\n placeholder?: string\n /** Show a clear button (and allow deselecting) once a value is set. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the chevron / clear button. */\n endSlot?: ReactNode\n size?: InputSize\n variant?: InputVariant\n color?: Color\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Wires the hidden `<select>` into native form submission. */\n name?: string\n /** Forwarded to the trigger; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n /** Lands on the trigger `<button>` for focus-on-error. */\n ref?: Ref<HTMLButtonElement>\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n className?: string\n classNames?: SelectClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names — the same keys as\n * the rest of the combobox family. A partial override keeps the other default. */\n translations?: SelectTranslations\n }\n\n/** Ark's own Select `translations` type (its `clearTriggerLabel`), derived structurally rather\n * than imported from `@zag-js/select`, plus the combobox family's `triggerLabel` for the\n * kit's own chevron button. */\nexport type SelectTranslations = NonNullable<Ark.RootProps<NormalizedItem>[\"translations\"]> &\n Pick<ComboboxTranslations, \"triggerLabel\">\n\n/** Wrap a scalar value into Ark's array contract (or clear with `[]`). */\nconst toArkValue = (v: string | null | undefined): string[] | undefined =>\n v === undefined ? undefined : v === null ? [] : [v]\n\n/**\n * The real, focusable `<button role=\"combobox\">`, split out so it reads the\n * `Field` context from *inside* the wrapping `FieldShell` — `Select` itself\n * renders that shell, so calling `useFieldContext()` at its own top level\n * would run too early.\n */\nconst SelectTrigger = ({\n ref,\n onBlur,\n invalid,\n testId,\n className,\n children,\n}: {\n ref?: Ref<HTMLButtonElement>\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n invalid: boolean\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n return (\n <Ark.Trigger\n ref={ref}\n onBlur={onBlur}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Trigger>\n )\n}\n\nexport const Select = <const Data extends SelectData = SelectData>({\n withinPortal = true,\n container,\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Pick a value\",\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n size = \"md\",\n variant = \"default\",\n color,\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n ...selectProps\n}: SelectProps<Data> & Omit<ComponentProps<\"select\">, keyof SelectProps>) => {\n const resolvedTranslations = { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...translations }\n const portalContainer = useOverlayContainer(container)\n const { collection, items, groups } = useMemo(() => normalizeSelectData(data), [data])\n const controlRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const mergedTriggerRef = useMergedRefs(triggerRef, ref)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const selected = items.find(({ value: iv }) => value === iv)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Ark.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(popoverOption({ size }), classNames?.option)}\n >\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item, {\n selected: ctx.selected,\n highlighted: ctx.highlighted,\n })\n }\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{item.label}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n\n const control = (\n <Ark.Root\n collection={collection}\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n // The machine's collection is typed by value (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's value union.\n onValueChange={\n onChange ? (d) => onChange((d.value[0] ?? null) as SelectValue<Data> | null) : undefined\n }\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n deselectable={clearable}\n translations={resolvedTranslations}\n // Ark anchors Select's positioner to the Trigger, which sits inside the\n // padded `inputShell` Control — so `sameWidth` would inset the panel. Anchor\n // to the full Control instead (matching Combobox), so the panel aligns with\n // and matches the trigger's width.\n positioning={{\n sameWidth: true,\n getAnchorRect: () => controlRef.current?.getBoundingClientRect() ?? null,\n }}\n // Content is an `overflow-hidden` clip wrapper, so the machine's native\n // auto-scroll (which needs Content scrollable) no-ops; route scrolling to\n // the inner List scroller instead.\n scrollToIndexFn={scrollHighlightedIntoView}\n data-color={color}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n const showClear = Boolean(clearable) && api.hasSelectedItems && !disabled && !readOnly\n const showChevron = clearSectionMode === \"both\" || !showClear\n return (\n <Ark.Control\n ref={controlRef}\n {...props({\n \"data-invalid\": isInvalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron / clear control.\n \"data-with-end-slot\": true,\n })}\n // Tablet affordance: a tap on the shell's dead zones (padding) opens\n // the menu too, not just the trigger. The trigger, clear and chevron\n // are all buttons, so the helper skips them and they self-handle.\n // Inert when disabled / readOnly, so it never opens where the trigger won't.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n className={cn(inputShell({ size, variant }), \"cursor-pointer\", classNames?.control)}\n >\n <SelectTrigger\n ref={mergedTriggerRef}\n onBlur={onBlur}\n invalid={isInvalid}\n testId={testId}\n className={cn(\n \"flex min-w-0 flex-1 cursor-pointer items-center bg-transparent text-start outline-none disabled:cursor-not-allowed\",\n // Slots live inside the trigger (not the shell), so re-apply the\n // shell's per-size gap here to space the icon from the value.\n shellGap[size],\n )}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-start\">\n {api.hasSelectedItems ? (\n renderItem && selected ? (\n renderItem(selected, {\n selected: false,\n highlighted: false,\n })\n ) : (\n api.valueAsString\n )\n ) : (\n <span className={placeholderColor}>{placeholder}</span>\n )}\n </span>\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </SelectTrigger>\n {showClear && (\n <Ark.ClearTrigger className={popoverClearTrigger}>\n <CloseIcon />\n </Ark.ClearTrigger>\n )}\n {showChevron && (\n // A sibling toggle button (the value `Ark.Trigger` can't nest it\n // next to the clear button), so the chevron sits at the far edge\n // like the rest of the family. Focus the trigger first so keyboard\n // nav stays on the combobox; `preventDefault` stops the tap from\n // stealing focus to this button. `tabIndex=-1`: the trigger is the\n // tab stop.\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={resolvedTranslations.triggerLabel}\n data-chevron\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm data-disabled:cursor-not-allowed\",\n api.open && \"rotate-180\",\n )}\n {...props({\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n })}\n onPointerDown={(event) => event.preventDefault()}\n {...(!(disabled || readOnly) && {\n onClick: () => {\n triggerRef.current?.focus()\n api.setOpen(!api.open)\n },\n })}\n >\n <ChevronIcon />\n </button>\n )}\n </Ark.Control>\n )\n }}\n </Ark.Context>\n\n {/* Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content data-color={color} className={cn(popoverContent, classNames?.popover)}>\n <Ark.List className={popoverList({ withPaddingTop: true })}>\n {groups\n ? groups.map((group) => (\n <Ark.ItemGroup key={group.group}>\n <Ark.ItemGroupLabel className={popoverGroupLabel}>\n {group.group}\n </Ark.ItemGroupLabel>\n {group.items.map(renderOption)}\n </Ark.ItemGroup>\n ))\n : items.map(renderOption)}\n </Ark.List>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n\n <Ark.HiddenSelect {...selectProps} />\n </Ark.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { fieldA11yProps } from './chunk-
|
|
1
|
+
import { fieldA11yProps } from './chunk-VD6PB3VA.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
3
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
4
|
-
import { cn } from './chunk-
|
|
4
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
5
5
|
import { ark } from '@ark-ui/react';
|
|
6
6
|
import { useFieldContext } from '@ark-ui/react/field';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
@@ -205,5 +205,5 @@ var Input = ({
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
export { Input, InputBase, inputControlClasses, inputShell, inputSlot, placeholderColor, shellChrome, shellGap, shellVariants };
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-45QRQKRC.js.map
|
|
209
|
+
//# sourceMappingURL=chunk-45QRQKRC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/input/input.tsx"],"names":[],"mappings":";;;;;;;;;AAwCO,IAAM,mBAAA,GAAsB,EAAA;AAAA,EACjC,uEAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,6BAAA;AAAA,E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,YAAY,KAAA,EAAO;AAAA,OAC9B,CAAA;AAAA,MAED,QAAA,kBAAA,GAAA;AAAA,QAAC,GAAA,CAAI,KAAA;AAAA,QAAJ;AAAA,UACE,GAAG,eAAA;AAAA,UACH,GAAG,eAAe,KAAK,CAAA;AAAA,UACvB,GAAG,KAAA,CAAM;AAAA,YACR,QAAA,EAAU,YAAY,KAAA,EAAO,QAAA;AAAA,YAC7B,cAAA,EAAgB,WAAW,KAAA,EAAO,OAAA;AAAA,YAClC,QAAA,EAAU,YAAY,KAAA,EAAO,QAAA;AAAA,YAC7B,aAAA,EAAe;AAAA,WAChB,CAAA;AAAA,UACD,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,UAAA,EAAY,KAAK,CAAA;AAAA,UACnD,GAAG;AAAA;AAAA;AACN;AAAA,GACF;AAEJ","file":"chunk-7R4CDHBK.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ReactNode, Ref } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps } from \"../field/field\"\n\n/**\n * Input / InputBase — the styled input *shell* the whole form family renders\n * into (Select trigger, Combobox/Autocomplete search field, PillsInput, and\n * `TextInput`). It is deliberately the lowest layer: label / description /\n * error live in `Field`, not here — reach for `TextInput` when you want them\n * built in, which is the common case, and for `Input` when you're composing\n * the shell yourself or the control needs no accessible name of its own.\n *\n * - `InputBase` is the polymorphic shell. It draws the bordered box, the\n * focus-visible ring, the disabled / invalid states, and lays out\n * an optional `startSlot` / `endSlot` around a single control child. The\n * child can be anything — an `<input>`, a `<button>` (Select trigger), or a\n * `<div>` of pills (PillsInput). Style your control with the exported\n * `inputControlClasses` so it sits flush inside the shell.\n * - `Input` is `InputBase` wrapping a real `<input>`. Native\n * input props (`value`, `onChange`, `placeholder`, `name`, `type`, `ref`, …)\n * are forwarded straight to the element; `className` styles the shell root\n * (matching the kit's other components), and `classNames` overrides parts.\n *\n * The shell is palette-independent, so there is no `color` prop: the focus halo\n * and border are a fixed `brand-500` per the 42 UI Kit Figma (see `shellChrome`),\n * and `de33dee` removed both `color` and the `filled` variant. `invalid` swaps\n * the border / ring to red.\n */\n\n/** Inner-control reset — apply to whatever element you nest inside `InputBase`\n * (input, button, …) so it inherits the shell's font and fills the row. */\nexport const inputControlClasses = cn(\n \"w-full flex-1 min-w-0 appearance-none border-0 bg-transparent p-0 m-0\",\n // `font: inherit` is the canonical form-control reset — without it the UA\n // forces its own font-size and the shell's `size` text scale is ignored.\n // No `text-trim`: a native `<input>`'s text renders inside the UA's own\n // form-control internals, not a normal CSS line box, so `text-box-trim`\n // computes an inconsistent (content-dependent) box height there — Chrome\n // was scrolling the text vertically once its computed box stopped matching\n // the element's actual rendered height.\n \"font-[inherit] text-inherit\",\n \"outline-none focus:outline-none\",\n \"placeholder:text-black/50 dark:placeholder:text-white/50\",\n \"disabled:cursor-not-allowed\",\n)\n\n/**\n * Shared shell chrome — surface, border, focus ring, and state styling. The\n * single-line `Input` shell and the multi-line `PillsInput` shell both build on\n * these; only the layout (row vs wrap) and the sizing differ, so the visual\n * treatment (incl. the invalid red halo) lives in exactly one place.\n */\nexport const shellChrome = [\n \"group/input relative rounded-input border outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"transition-[color,box-shadow,border-color]\",\n // Fixed brand-500 focus halo + border, per the 42 UI Kit Figma — independent\n // of the instance's own `color`. The combined selector matches either shape\n // in the family: a shell wrapping a real focusable descendant (Input,\n // Select, Combobox, MultiSelect, ComboboxList, MultiComboboxList, PinInput's\n // per-cell shell) or a shell that IS the tabbable element itself (TreeSelect,\n // TreeMultiSelect). `:has()` alone only matches the former.\n \"[&:is(:focus-visible,:has(:focus-visible))]:border-brand-500 [&:is(:focus-visible,:has(:focus-visible))]:ring-[3px] [&:is(:focus-visible,:has(:focus-visible))]:ring-brand-500/15\",\n // Invalid wins over the palette: red border + red halo. Same combined\n // selector as the rule above so the two can't drift out of sync.\n \"data-invalid:border-red-500 data-invalid:[&:is(:focus-visible,:has(:focus-visible))]:border-red-500 data-invalid:[&:is(:focus-visible,:has(:focus-visible))]:ring-red-500/15\",\n // Disabled affordances on the shell.\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"data-disabled:bg-white/8\",\n \"data-pointer:cursor-pointer\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n]\n\n/** Surface treatment per `variant`, shared across the input shells. */\nexport const shellVariants = {\n // Translucent border to go with the translucent fill: at `bg-white/4` the\n // shell has no ground of its own, so a fixed opaque hairline can vanish (on\n // a light-gray card) or over-assert (on a mid-tone host page). Same hue\n // language as Card's `default` (navy-tinted light / white-tinted dark), one\n // alpha step tighter — these render within a shade of the opaque colors\n // they replace, so the hairline keeps its weight and only gains\n // background-adaptivity.\n default: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n // Escape hatch: strip the chrome but keep the layout (height / slots). Same\n // combined selector as `shellChrome`'s \"on\" rule so the cancel can't drift.\n unstyled: [\n \"border-transparent bg-transparent\",\n \"rounded-none [&:is(:focus-visible,:has(:focus-visible))]:ring-0\",\n ],\n}\n\n/**\n * Inline gap between the shell's slots and control, per `size`. The single\n * source for this spacing: `inputShell` applies it to the shell row, and any\n * control that lays out its *own* slots inside a nested flex (e.g. the Select\n * trigger) reuses it so adornments sit identically across the family.\n */\nexport const shellGap = {\n xs: \"gap-1.5\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-2.5\",\n xl: \"gap-3\",\n} as const\n\n/** Single-line input shell. Reused by the family's button / input controls. */\nexport const inputShell = cva([...shellChrome, \"flex w-full items-center gap-y-0.5\"], {\n variants: {\n variant: shellVariants,\n // Padding is slot-aware: the base is the tight, no-adornment inset, and each\n // side gains a step of inline padding only when `InputBase` flags an\n // adornment there (`data-with-start-slot` / `data-with-end-slot`). These are\n // self-referential `data-*` variants — the attributes live on this same\n // shell element, so a `group-*` variant (which targets descendants) wouldn't\n // match.\n size: {\n xs: [\n \"ps-1.5 pe-1.5\",\n \"data-with-start-slot:ps-2 data-with-end-slot:pe-2\",\n `min-h-7 ${shellGap.xs} text-xs [&_svg]:size-3`,\n ],\n sm: [\n \"ps-2 pe-2\",\n \"data-with-start-slot:ps-2.5 data-with-end-slot:pe-2.5\",\n `min-h-8 ${shellGap.sm} text-sm [&_svg]:size-3.5`,\n ],\n md: [\n \"ps-2 pe-2\",\n \"data-with-start-slot:ps-2.5 data-with-end-slot:pe-2.5\",\n `min-h-9 ${shellGap.md} text-md [&_svg]:size-4`,\n ],\n lg: [\n \"ps-3 pe-3\",\n \"data-with-start-slot:ps-3.5 data-with-end-slot:pe-3.5\",\n `min-h-10 ${shellGap.lg} text-lg [&_svg]:size-5`,\n ],\n xl: [\n \"ps-3.5 pe-3.5\",\n \"data-with-start-slot:ps-4 data-with-end-slot:pe-4\",\n `min-h-12 ${shellGap.xl} text-xl [&_svg]:size-6`,\n ],\n },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n})\n\n/** Start/end adornment slot — the shared visual contract for the inline-start /\n * inline-end content the whole form family lays out (icon, chevron, clear).\n * Exported so Select / Combobox / the pills controls slot their adornments\n * identically to `InputBase` instead of re-deriving the layout. */\nexport const inputSlot = cn(\n \"inline-flex shrink-0 items-center justify-center\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Muted color for a component's own custom-rendered placeholder / empty-state text — a\n * `<span>` standing in for a native `::placeholder` wherever the value display isn't a real\n * `<input>` (Select's trigger, MultiSelect's non-searchable mode, TreeSelect / TreeMultiSelect's\n * trigger, DatePicker's range-mode trigger). Same color pairing as `inputControlClasses`'s native\n * `::placeholder` rule above. Kept as its own export, not folded into `inputSlot` — `inputSlot`'s\n * `inline-flex items-center justify-center shrink-0` are icon-slot layout rules; forced onto a\n * run of text they'd center it and block it from shrinking, silently breaking truncation on the\n * call sites where this color sits on the same span as `flex-1`/`truncate`. */\nexport const placeholderColor = TEXT_COLOR_CLASSES.muted\n\nexport type InputVariant = NonNullable<VariantProps<typeof inputShell>[\"variant\"]>\nexport type InputSize = NonNullable<VariantProps<typeof inputShell>[\"size\"]>\n\ntype ShellClassNames = {\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n startSlot?: string\n endSlot?: string\n}\n\n/** Props shared by the shell and the convenience `Input`. */\ntype ShellOwnProps = VariantProps<typeof inputShell> & {\n /** Red border + ring; also wires `aria-invalid` on `Input`. */\n invalid?: boolean\n /** Dims the shell and (on `Input`) disables the element. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits (on `Input`). */\n readOnly?: boolean\n /** `cursor: pointer` — for button-like triggers (Select). */\n pointer?: boolean\n /** Decorative or interactive content at the inline-start of the control. */\n startSlot?: ReactNode\n /** Content at the inline-end — chevron, clear button, spinner. */\n endSlot?: ReactNode\n}\n\nexport type InputBaseProps = NoAsChild<Omit<HTMLArkProps<\"div\">, \"color\">> &\n ShellOwnProps &\n WithTestId & {\n classNames?: ShellClassNames\n }\n\nexport const InputBase = ({\n variant,\n size,\n invalid,\n disabled,\n readOnly,\n pointer,\n startSlot,\n endSlot,\n children,\n className,\n classNames,\n testId,\n asChild: _asChild,\n ...rest\n}: InputBaseProps) => (\n <ark.div\n {...props({\n \"data-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-pointer\": pointer,\n // Drive the slot-aware padding in `inputShell`: each side gains a step of\n // inline padding when an adornment sits there (`data-with-*-slot:`).\n \"data-with-start-slot\": startSlot != null,\n \"data-with-end-slot\": endSlot != null,\n // Only meaningful when `InputBase` is used bare (no `Input`-style inner\n // control routing its own `testId`) — a `testId` given to a control that\n // wraps `InputBase` itself (Input, NumberInput, Select, …) always lands\n // on that control's real interactive element instead, never here.\n \"data-testid\": testId,\n })}\n className={cn(className, classNames?.root, inputShell({ variant, size }))}\n {...rest}\n >\n {startSlot != null && (\n <span className={cn(inputSlot, classNames?.startSlot)} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && (\n <span className={cn(inputSlot, classNames?.endSlot)} aria-hidden>\n {endSlot}\n </span>\n )}\n </ark.div>\n)\n\nexport type InputProps = Omit<HTMLArkProps<\"input\">, \"size\" | \"color\"> &\n ShellOwnProps &\n WithTestId & {\n /** Lands on the underlying `<input>` for focus-on-error. Declared\n * explicitly because `HTMLArkProps` is `ComponentPropsWithoutRef`, so the\n * native prop types alone don't carry it — same as `Textarea`,\n * `PasswordInput`, and `NumberInput`. */\n ref?: Ref<HTMLInputElement>\n classNames?: ShellClassNames & {\n /** The inner `<input>` element. */\n input?: string\n }\n }\n\nexport const Input = ({\n variant,\n size,\n invalid,\n disabled,\n readOnly,\n pointer,\n startSlot,\n endSlot,\n className,\n classNames,\n testId,\n ...rest\n}: InputProps) => {\n // When nested in a `Field`, inherit its id / aria-describedby / state so the\n // label, description, and error wire up — exactly how Ark's own `Field.Input`\n // behaves. `useFieldContext` is null outside a Field, so this is a no-op then.\n const field = useFieldContext()\n const fieldInputProps = field?.getInputProps()\n\n return (\n <InputBase\n variant={variant}\n size={size}\n pointer={pointer}\n startSlot={startSlot}\n endSlot={endSlot}\n className={className}\n classNames={{\n root: classNames?.root,\n startSlot: classNames?.startSlot,\n endSlot: classNames?.endSlot,\n }}\n {...props({\n disabled: disabled || field?.disabled,\n invalid: invalid || field?.invalid,\n readOnly: readOnly || field?.readOnly,\n })}\n >\n <ark.input\n {...fieldInputProps}\n {...fieldA11yProps(field)}\n {...props({\n disabled: disabled || field?.disabled,\n \"aria-invalid\": invalid || field?.invalid,\n readOnly: readOnly || field?.readOnly,\n \"data-testid\": testId,\n })}\n className={cn(inputControlClasses, classNames?.input)}\n {...rest}\n />\n </InputBase>\n )\n}\n"]}
|
|
1
|
+
{"version":3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,EAAY;AAAA,OACvB;AAAA,MACC,GAAG,KAAA,CAAM;AAAA,QACR,QAAA,EAAU,YAAY,KAAA,EAAO,QAAA;AAAA,QAC7B,OAAA,EAAS,WAAW,KAAA,EAAO,OAAA;AAAA,QAC3B,QAAA,EAAU,YAAY,KAAA,EAAO;AAAA,OAC9B,CAAA;AAAA,MAED,QAAA,kBAAA,GAAA;AAAA,QAAC,GAAA,CAAI,KAAA;AAAA,QAAJ;AAAA,UACE,GAAG,eAAA;AAAA,UACH,GAAG,eAAe,KAAK,CAAA;AAAA,UACvB,GAAG,KAAA,CAAM;AAAA,YACR,QAAA,EAAU,YAAY,KAAA,EAAO,QAAA;AAAA,YAC7B,cAAA,EAAgB,WAAW,KAAA,EAAO,OAAA;AAAA,YAClC,QAAA,EAAU,YAAY,KAAA,EAAO,QAAA;AAAA,YAC7B,aAAA,EAAe;AAAA,WAChB,CAAA;AAAA,UACD,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,UAAA,EAAY,KAAK,CAAA;AAAA,UACnD,GAAG;AAAA;AAAA;AACN;AAAA,GACF;AAEJ","file":"chunk-45QRQKRC.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ReactNode, Ref } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps } from \"../field/field\"\n\n/**\n * Input / InputBase — the styled input *shell* the whole form family renders\n * into (Select trigger, Combobox/Autocomplete search field, PillsInput, and\n * `TextInput`). It is deliberately the lowest layer: label / description /\n * error live in `Field`, not here — reach for `TextInput` when you want them\n * built in, which is the common case, and for `Input` when you're composing\n * the shell yourself or the control needs no accessible name of its own.\n *\n * - `InputBase` is the polymorphic shell. It draws the bordered box, the\n * focus-visible ring, the disabled / invalid states, and lays out\n * an optional `startSlot` / `endSlot` around a single control child. The\n * child can be anything — an `<input>`, a `<button>` (Select trigger), or a\n * `<div>` of pills (PillsInput). Style your control with the exported\n * `inputControlClasses` so it sits flush inside the shell.\n * - `Input` is `InputBase` wrapping a real `<input>`. Native\n * input props (`value`, `onChange`, `placeholder`, `name`, `type`, `ref`, …)\n * are forwarded straight to the element; `className` styles the shell root\n * (matching the kit's other components), and `classNames` overrides parts.\n *\n * The shell is palette-independent, so there is no `color` prop: the focus halo\n * and border are a fixed `brand-500` per the 42 UI Kit Figma (see `shellChrome`),\n * and `de33dee` removed both `color` and the `filled` variant. `invalid` swaps\n * the border / ring to red.\n */\n\n/** Inner-control reset — apply to whatever element you nest inside `InputBase`\n * (input, button, …) so it inherits the shell's font and fills the row. */\nexport const inputControlClasses = cn(\n \"w-full flex-1 min-w-0 appearance-none border-0 bg-transparent p-0 m-0\",\n // `font: inherit` is the canonical form-control reset — without it the UA\n // forces its own font-size and the shell's `size` text scale is ignored.\n // No `text-trim`: a native `<input>`'s text renders inside the UA's own\n // form-control internals, not a normal CSS line box, so `text-box-trim`\n // computes an inconsistent (content-dependent) box height there — Chrome\n // was scrolling the text vertically once its computed box stopped matching\n // the element's actual rendered height.\n \"font-[inherit] text-inherit\",\n \"outline-none focus:outline-none\",\n \"placeholder:text-black/50 dark:placeholder:text-white/50\",\n \"disabled:cursor-not-allowed\",\n)\n\n/**\n * Shared shell chrome — surface, border, focus ring, and state styling. The\n * single-line `Input` shell and the multi-line `PillsInput` shell both build on\n * these; only the layout (row vs wrap) and the sizing differ, so the visual\n * treatment (incl. the invalid red halo) lives in exactly one place.\n */\nexport const shellChrome = [\n \"group/input relative rounded-input border outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"transition-[color,box-shadow,border-color]\",\n // Fixed brand-500 focus halo + border, per the 42 UI Kit Figma — independent\n // of the instance's own `color`. The combined selector matches either shape\n // in the family: a shell wrapping a real focusable descendant (Input,\n // Select, Combobox, MultiSelect, ComboboxList, MultiComboboxList, PinInput's\n // per-cell shell) or a shell that IS the tabbable element itself (TreeSelect,\n // TreeMultiSelect). `:has()` alone only matches the former.\n \"[&:is(:focus-visible,:has(:focus-visible))]:border-brand-500 [&:is(:focus-visible,:has(:focus-visible))]:ring-[3px] [&:is(:focus-visible,:has(:focus-visible))]:ring-brand-500/15\",\n // Invalid wins over the palette: red border + red halo. Same combined\n // selector as the rule above so the two can't drift out of sync.\n \"data-invalid:border-red-500 data-invalid:[&:is(:focus-visible,:has(:focus-visible))]:border-red-500 data-invalid:[&:is(:focus-visible,:has(:focus-visible))]:ring-red-500/15\",\n // Disabled affordances on the shell.\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"data-disabled:bg-white/8\",\n \"data-pointer:cursor-pointer\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n]\n\n/** Surface treatment per `variant`, shared across the input shells. */\nexport const shellVariants = {\n // Translucent border to go with the translucent fill: at `bg-white/4` the\n // shell has no ground of its own, so a fixed opaque hairline can vanish (on\n // a light-gray card) or over-assert (on a mid-tone host page). Same hue\n // language as Card's `default` (navy-tinted light / white-tinted dark), one\n // alpha step tighter — these render within a shade of the opaque colors\n // they replace, so the hairline keeps its weight and only gains\n // background-adaptivity.\n default: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n // Escape hatch: strip the chrome but keep the layout (height / slots). Same\n // combined selector as `shellChrome`'s \"on\" rule so the cancel can't drift.\n unstyled: [\n \"border-transparent bg-transparent\",\n \"rounded-none [&:is(:focus-visible,:has(:focus-visible))]:ring-0\",\n ],\n}\n\n/**\n * Inline gap between the shell's slots and control, per `size`. The single\n * source for this spacing: `inputShell` applies it to the shell row, and any\n * control that lays out its *own* slots inside a nested flex (e.g. the Select\n * trigger) reuses it so adornments sit identically across the family.\n */\nexport const shellGap = {\n xs: \"gap-1.5\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-2.5\",\n xl: \"gap-3\",\n} as const\n\n/** Single-line input shell. Reused by the family's button / input controls. */\nexport const inputShell = cva([...shellChrome, \"flex w-full items-center gap-y-0.5\"], {\n variants: {\n variant: shellVariants,\n // Padding is slot-aware: the base is the tight, no-adornment inset, and each\n // side gains a step of inline padding only when `InputBase` flags an\n // adornment there (`data-with-start-slot` / `data-with-end-slot`). These are\n // self-referential `data-*` variants — the attributes live on this same\n // shell element, so a `group-*` variant (which targets descendants) wouldn't\n // match.\n size: {\n xs: [\n \"ps-1.5 pe-1.5\",\n \"data-with-start-slot:ps-2 data-with-end-slot:pe-2\",\n `min-h-7 ${shellGap.xs} text-xs [&_svg]:size-3`,\n ],\n sm: [\n \"ps-2 pe-2\",\n \"data-with-start-slot:ps-2.5 data-with-end-slot:pe-2.5\",\n `min-h-8 ${shellGap.sm} text-sm [&_svg]:size-3.5`,\n ],\n md: [\n \"ps-2 pe-2\",\n \"data-with-start-slot:ps-2.5 data-with-end-slot:pe-2.5\",\n `min-h-9 ${shellGap.md} text-md [&_svg]:size-4`,\n ],\n lg: [\n \"ps-3 pe-3\",\n \"data-with-start-slot:ps-3.5 data-with-end-slot:pe-3.5\",\n `min-h-10 ${shellGap.lg} text-lg [&_svg]:size-5`,\n ],\n xl: [\n \"ps-3.5 pe-3.5\",\n \"data-with-start-slot:ps-4 data-with-end-slot:pe-4\",\n `min-h-12 ${shellGap.xl} text-xl [&_svg]:size-6`,\n ],\n },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n})\n\n/** Start/end adornment slot — the shared visual contract for the inline-start /\n * inline-end content the whole form family lays out (icon, chevron, clear).\n * Exported so Select / Combobox / the pills controls slot their adornments\n * identically to `InputBase` instead of re-deriving the layout. */\nexport const inputSlot = cn(\n \"inline-flex shrink-0 items-center justify-center\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Muted color for a component's own custom-rendered placeholder / empty-state text — a\n * `<span>` standing in for a native `::placeholder` wherever the value display isn't a real\n * `<input>` (Select's trigger, MultiSelect's non-searchable mode, TreeSelect / TreeMultiSelect's\n * trigger, DatePicker's range-mode trigger). Same color pairing as `inputControlClasses`'s native\n * `::placeholder` rule above. Kept as its own export, not folded into `inputSlot` — `inputSlot`'s\n * `inline-flex items-center justify-center shrink-0` are icon-slot layout rules; forced onto a\n * run of text they'd center it and block it from shrinking, silently breaking truncation on the\n * call sites where this color sits on the same span as `flex-1`/`truncate`. */\nexport const placeholderColor = TEXT_COLOR_CLASSES.muted\n\nexport type InputVariant = NonNullable<VariantProps<typeof inputShell>[\"variant\"]>\nexport type InputSize = NonNullable<VariantProps<typeof inputShell>[\"size\"]>\n\ntype ShellClassNames = {\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n startSlot?: string\n endSlot?: string\n}\n\n/** Props shared by the shell and the convenience `Input`. */\ntype ShellOwnProps = VariantProps<typeof inputShell> & {\n /** Red border + ring; also wires `aria-invalid` on `Input`. */\n invalid?: boolean\n /** Dims the shell and (on `Input`) disables the element. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits (on `Input`). */\n readOnly?: boolean\n /** `cursor: pointer` — for button-like triggers (Select). */\n pointer?: boolean\n /** Decorative or interactive content at the inline-start of the control. */\n startSlot?: ReactNode\n /** Content at the inline-end — chevron, clear button, spinner. */\n endSlot?: ReactNode\n}\n\nexport type InputBaseProps = NoAsChild<Omit<HTMLArkProps<\"div\">, \"color\">> &\n ShellOwnProps &\n WithTestId & {\n classNames?: ShellClassNames\n }\n\nexport const InputBase = ({\n variant,\n size,\n invalid,\n disabled,\n readOnly,\n pointer,\n startSlot,\n endSlot,\n children,\n className,\n classNames,\n testId,\n asChild: _asChild,\n ...rest\n}: InputBaseProps) => (\n <ark.div\n {...props({\n \"data-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-pointer\": pointer,\n // Drive the slot-aware padding in `inputShell`: each side gains a step of\n // inline padding when an adornment sits there (`data-with-*-slot:`).\n \"data-with-start-slot\": startSlot != null,\n \"data-with-end-slot\": endSlot != null,\n // Only meaningful when `InputBase` is used bare (no `Input`-style inner\n // control routing its own `testId`) — a `testId` given to a control that\n // wraps `InputBase` itself (Input, NumberInput, Select, …) always lands\n // on that control's real interactive element instead, never here.\n \"data-testid\": testId,\n })}\n className={cn(className, classNames?.root, inputShell({ variant, size }))}\n {...rest}\n >\n {startSlot != null && (\n <span className={cn(inputSlot, classNames?.startSlot)} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && (\n <span className={cn(inputSlot, classNames?.endSlot)} aria-hidden>\n {endSlot}\n </span>\n )}\n </ark.div>\n)\n\nexport type InputProps = Omit<HTMLArkProps<\"input\">, \"size\" | \"color\"> &\n ShellOwnProps &\n WithTestId & {\n /** Lands on the underlying `<input>` for focus-on-error. Declared\n * explicitly because `HTMLArkProps` is `ComponentPropsWithoutRef`, so the\n * native prop types alone don't carry it — same as `Textarea`,\n * `PasswordInput`, and `NumberInput`. */\n ref?: Ref<HTMLInputElement>\n classNames?: ShellClassNames & {\n /** The inner `<input>` element. */\n input?: string\n }\n }\n\nexport const Input = ({\n variant,\n size,\n invalid,\n disabled,\n readOnly,\n pointer,\n startSlot,\n endSlot,\n className,\n classNames,\n testId,\n ...rest\n}: InputProps) => {\n // When nested in a `Field`, inherit its id / aria-describedby / state so the\n // label, description, and error wire up — exactly how Ark's own `Field.Input`\n // behaves. `useFieldContext` is null outside a Field, so this is a no-op then.\n const field = useFieldContext()\n const fieldInputProps = field?.getInputProps()\n\n return (\n <InputBase\n variant={variant}\n size={size}\n pointer={pointer}\n startSlot={startSlot}\n endSlot={endSlot}\n className={className}\n classNames={{\n root: classNames?.root,\n startSlot: classNames?.startSlot,\n endSlot: classNames?.endSlot,\n }}\n {...props({\n disabled: disabled || field?.disabled,\n invalid: invalid || field?.invalid,\n readOnly: readOnly || field?.readOnly,\n })}\n >\n <ark.input\n {...fieldInputProps}\n {...fieldA11yProps(field)}\n {...props({\n disabled: disabled || field?.disabled,\n \"aria-invalid\": invalid || field?.invalid,\n readOnly: readOnly || field?.readOnly,\n \"data-testid\": testId,\n })}\n className={cn(inputControlClasses, classNames?.input)}\n {...rest}\n />\n </InputBase>\n )\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Slider } from './chunk-
|
|
1
|
+
import { Slider } from './chunk-UAYENYS2.js';
|
|
2
2
|
import { cutoutMask } from './chunk-K6YASO4L.js';
|
|
3
3
|
import { MEDIA_RADIUS } from './chunk-J43LSYQO.js';
|
|
4
4
|
import { useObjectUrl } from './chunk-TCFB23JT.js';
|
|
5
5
|
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
6
6
|
import { ratioToNumber } from './chunk-AHM6SGEU.js';
|
|
7
7
|
import { useLocale, useDirectionCheck } from './chunk-IPYHTCFL.js';
|
|
8
|
-
import { ActionIcon } from './chunk-
|
|
8
|
+
import { ActionIcon } from './chunk-BE2LWUHY.js';
|
|
9
9
|
import { iconStroke, mergeIcons } from './chunk-XXOR34T4.js';
|
|
10
10
|
import { props } from './chunk-WYCMIIRR.js';
|
|
11
|
-
import { focusStyles } from './chunk-
|
|
11
|
+
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
12
12
|
import { TYPOGRAPHY_SHADE_CLASSES } from './chunk-GIPQUKCN.js';
|
|
13
|
-
import { cn } from './chunk-
|
|
13
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
14
14
|
import { ImageCropper as ImageCropper$1, useImageCropperContext as useImageCropperContext$1 } from '@ark-ui/react/image-cropper';
|
|
15
15
|
import { RefreshCcw, ZoomIn, ZoomOut, FlipVertical2, FlipHorizontal2, RotateCw, RotateCcw } from 'lucide-react';
|
|
16
16
|
import { createContext, useContext, useMemo } from 'react';
|
|
@@ -433,5 +433,5 @@ var ImageCropper = Object.assign(ImageCropperComponent, {
|
|
|
433
433
|
});
|
|
434
434
|
|
|
435
435
|
export { ImageCropper, useImageCropperContext };
|
|
436
|
-
//# sourceMappingURL=chunk-
|
|
437
|
-
//# sourceMappingURL=chunk-
|
|
436
|
+
//# sourceMappingURL=chunk-47LEAR6G.js.map
|
|
437
|
+
//# sourceMappingURL=chunk-47LEAR6G.js.map
|