@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/modal/modal.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;AA2CA,IAAM,gBAAgB,GAAA,CAAI;AAAA,EACxB,8HAAA;AAAA,EACA;AACF,CAAC,CAAA;AAED,IAAM,eAAA,GAAkB,GAAA;AAAA,EACtB,gHAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,QAAA,EAAU;AAAA,QACR,MAAA,EAAQ,gBAAA;AAAA,QACR,GAAA,EAAK,wBAAA;AAAA,QACL,MAAA,EAAQ;AAAA;AACV,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,QAAA,EAAU,QAAA;AAAS;AAE1C,CAAA;AAEA,IAAM,YAAA,GAAe,GAAA;AAAA,EACnB;AAAA,IACE,+BAAA;AAAA,IACA,2BAAA;AAAA,IACA,kEAAA;AAAA,IACA,wDAAA;AAAA,IACA,oBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,oBAAA;AAAA;AAAA,QACJ,EAAA,EAAI,oBAAA;AAAA;AAAA,QACJ,EAAA,EAAI,oBAAA;AAAA;AAAA,QACJ,EAAA,EAAI,oBAAA;AAAA;AAAA,QACJ,EAAA,EAAI,oBAAA;AAAA;AAAA,QACJ,IAAA,EAAM;AAAA,OACR;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,IA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Q,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,UAAA,EAAY,OAAQ,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,sBAClE,eAAe,IAAA,oBACd,GAAA,CAAC,oBAAiB,SAAA,EAAW,UAAA,EAAY,aACtC,QAAA,EAAA,WAAA,EACH;AAAA,qBAAA,EAEJ,CAAA;AAAA,oBACC,eAAA,oBACC,GAAA;AAAA,sBAAC,iBAAA;AAAA,sBAAA;AAAA,wBACC,cAAY,YAAA,EAAc,iBAAA;AAAA,wBAC1B,WAAW,UAAA,EAAY;AAAA;AAAA;AACzB,mBAAA,EAEJ,CAAA;AAAA,kCAEF,GAAA;AAAA,oBAAC,SAAA;AAAA,oBAAA;AAAA,sBACC,SAAA,EAAW,EAAA;AAAA,wBACT,CAAC,SAAA,IAAa,yBAAA;AAAA,wBACd,yBAAA;AAAA,wBACA,UAAA,EAAY;AAAA,uBACd;AAAA,sBAEC;AAAA;AAAA;AACH;AAAA;AAAA;AACF;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAA;AAEO,IAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB;AAAA,EACjD,IAAA,EAAM,SAAA;AAAA,EACN,OAAA,EAAS,YAAA;AAAA,EACT,OAAA,EAAS,YAAA;AAAA,EACT,QAAA,EAAU,aAAA;AAAA,EACV,UAAA,EAAY,eAAA;AAAA,EACZ,OAAA,EAAS,YAAA;AAAA,EACT,KAAA,EAAO,UAAA;AAAA,EACP,WAAA,EAAa,gBAAA;AAAA,EACb,YAAA,EAAc,iBAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ;AACV,CAAC","file":"chunk-HBFN5W7Q.js","sourcesContent":["\"use client\"\n\nimport { Dialog as Ark } from \"@ark-ui/react/dialog\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { type ComponentPropsWithoutRef, type ReactNode, useRef } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { NestedLayer, useLayerGuard } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport {\n createDialogParts,\n DIALOG_PADDING,\n type DialogCloseTriggerProps,\n type DialogIconSlot,\n type DialogIcons,\n DialogRootProviders,\n type DialogSectionProps,\n useDialogNameCheck,\n} from \"../overlays/dialog-parts\"\n\n/**\n * Modal — centered overlay dialog on top of Ark UI's Dialog state machine.\n * Ark owns focus-trap, scroll-lock, RTL, the `Esc` / click-outside behaviour\n * and the `data-state=\"open|closed\"` attribute that drives our enter/exit\n * animations (keyframes live in `theme.css`). This wrapper provides the styled\n * parts and a flatter props API.\n *\n * - High-level form: `<Modal open title size … >children</Modal>` renders the\n * full Portal → Backdrop → Positioner → Content → Header + Body scaffold.\n * This is what the imperative overlays manager mounts.\n * - Low-level parts (`Modal.Root`, `Modal.Content`, `Modal.Title`, …) are\n * exposed for full control / trigger-based composition.\n *\n * Surface padding flows through the `--modal-px` CSS var set on the content, so\n * `Modal.Header` / `Modal.Body` / `Modal.Footer` stay in rhythm without prop\n * plumbing — and keep a sensible fallback when used standalone.\n */\n\nconst modalBackdrop = cva([\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] bg-black/50 backdrop-blur-lg pointer-events-auto select-none\",\n \"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out\",\n])\n\nconst modalPositioner = cva(\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] flex flex-col items-center overflow-y-auto p-4\",\n {\n variants: {\n position: {\n center: \"justify-center\",\n top: \"justify-start mt-[8vh]\",\n bottom: \"justify-end mb-[8vh]\",\n },\n },\n defaultVariants: { position: \"center\" },\n },\n)\n\nconst modalContent = cva(\n [\n \"relative flex w-full flex-col\",\n \"max-h-[calc(100dvh-2rem)]\",\n \"bg-brand-50 text-brand-950 border border-brand-900/20 shadow-2xl\",\n \"dark:bg-brand-950 dark:text-white dark:border-white/15\",\n \"focus:outline-none\",\n \"data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out\",\n ],\n {\n variants: {\n size: {\n xs: \"max-w-(--width-xs)\", // 24rem\n sm: \"max-w-(--width-sm)\", // 30rem\n md: \"max-w-(--width-md)\", // 35rem\n lg: \"max-w-(--width-lg)\", // 40rem\n xl: \"max-w-(--width-xl)\", // 48rem\n full: \"max-w-[calc(100vw-2rem)] min-h-[calc(100dvh-2rem)]\",\n },\n radius: {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-xl\",\n xl: \"rounded-2xl\",\n },\n },\n defaultVariants: { size: \"md\", radius: \"sm\" },\n },\n)\n\n// ---------------------------------------------------------------------------\n// Low-level parts (styled Ark parts + kit conveniences)\n// ---------------------------------------------------------------------------\n\nexport type ModalIconSlot = DialogIconSlot\nexport type ModalIcons = DialogIcons\n\nexport type ModalRootProps = ComponentPropsWithoutRef<typeof Ark.Root> & {\n /** Replaces the default icons: `close`. `Modal.CloseTrigger`'s `children` win over it. */\n icons?: ModalIcons\n}\n\n/** Ark's root, plus the nested-layer guard: while a picker opened inside the\n * dialog is open, an outside click closes the picker only, not the dialog\n * under it. It is also a layer of its own while open, so a hotkey on the page\n * (or in an enclosing overlay) yields to it. See `lib/overlay-layer.tsx`. */\nconst ModalRoot = ({ onPointerDownOutside, icons, children, ...rest }: ModalRootProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n return (\n <Ark.Root onPointerDownOutside={guard.onPointerDownOutside} {...rest}>\n {/* A layer itself, registered with whatever it opened from (the page,\n or an enclosing overlay), so what's under it knows it's covered. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <DialogRootProviders icons={icons} layers={guard.layers}>\n {children}\n </DialogRootProviders>\n </Ark.Root>\n )\n}\nconst ModalTrigger = Ark.Trigger\nconst ModalContext = Ark.Context\n\nexport type ModalBackdropProps = ComponentPropsWithoutRef<typeof Ark.Backdrop> & WithTestId\n\nconst ModalBackdrop = ({ className, testId, ...rest }: ModalBackdropProps) => (\n <Ark.Backdrop\n className={cn(modalBackdrop(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalPosition = VariantProps<typeof modalPositioner>[\"position\"]\nexport type ModalPositionerProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Positioner>> &\n WithTestId & {\n position?: ModalPosition\n }\n\nconst ModalPositioner = ({\n className,\n position,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ModalPositionerProps) => {\n // A ref, not state: overlays read it when they portal, so nothing has to\n // re-render once it attaches (see `lib/overlay-container.tsx`).\n const positioner = useRef<HTMLDivElement>(null)\n return (\n <Ark.Positioner\n ref={positioner}\n className={cn(modalPositioner({ position }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <OverlayContainerProvider value={positioner}>{children}</OverlayContainerProvider>\n </Ark.Positioner>\n )\n}\n\nexport type ModalContentProps = ComponentPropsWithoutRef<typeof Ark.Content> &\n VariantProps<typeof modalContent> &\n WithTestId\n\nconst ModalContent = ({ className, size, radius, testId, ...rest }: ModalContentProps) => {\n const nameCheck = useDialogNameCheck(\"Modal\")\n return (\n <Ark.Content\n ref={nameCheck}\n className={cn(modalContent({ size, radius }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ModalTitleProps = ComponentPropsWithoutRef<typeof Ark.Title> & WithTestId\n\nconst ModalTitle = ({ className, testId, ...rest }: ModalTitleProps) => (\n <Ark.Title\n className={cn(\"text-xl font-semibold leading-tight\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalDescriptionProps = ComponentPropsWithoutRef<typeof Ark.Description> & WithTestId\n\nconst ModalDescription = ({ className, testId, ...rest }: ModalDescriptionProps) => (\n <Ark.Description\n className={cn(\"text-sm\", TEXT_COLOR_CLASSES.muted, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalCloseTriggerProps = DialogCloseTriggerProps\nexport type ModalHeaderProps = DialogSectionProps\nexport type ModalBodyProps = DialogSectionProps\nexport type ModalFooterProps = DialogSectionProps\n\nconst {\n CloseTrigger: ModalCloseTrigger,\n Header: ModalHeader,\n Body: ModalBody,\n Footer: ModalFooter,\n} = createDialogParts(\"modal\", Ark.CloseTrigger)\n\n// ---------------------------------------------------------------------------\n// High-level props-driven Modal\n// ---------------------------------------------------------------------------\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\nexport type ModalSize = NonNullable<VariantProps<typeof modalContent>[\"size\"]>\nexport type ModalRadius = NonNullable<VariantProps<typeof modalContent>[\"radius\"]>\n\nexport type ModalClassNames = Partial<\n Record<\n | \"backdrop\"\n | \"positioner\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"closeButton\",\n string\n >\n>\n\nexport type ModalProps = Omit<\n ArkRootProps,\n \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"role\"\n> &\n WithTestId & {\n /** Controlled open state. */\n open?: boolean\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean\n /** Fires with the next open state. Flattened from Ark's `{ open }`. */\n onOpenChange?: (open: boolean) => void\n /** Header title; renders the header when set, and names the dialog. */\n title?: ReactNode\n /** Id of an element inside the modal that names it, when there is no `title`. For a\n * plain string, use `aria-label`. */\n \"aria-labelledby\"?: string\n /** Optional subtitle under the title. */\n description?: ReactNode\n size?: ModalSize\n radius?: ModalRadius\n /** Vertically center the modal (vs. anchored near the top). */\n position?: ModalPosition\n /** Render the default close button in the header. @default true */\n withCloseButton?: boolean\n /**\n * Render the dimming backdrop. Set `false` when an ancestor (e.g. the modals\n * manager) draws a single shared backdrop for the whole overlay stack.\n * @default true\n */\n withBackdrop?: boolean\n /** Inner padding token; sets `--modal-px`. @default \"md\" */\n padding?: Size\n closeOnEscape?: boolean\n closeOnInteractOutside?: boolean\n /** Use `alertdialog` semantics (confirm flows). @default \"dialog\" */\n role?: \"dialog\" | \"alertdialog\"\n /** Fires after the exit animation completes; the manager unmounts on this. */\n onExitComplete?: () => void\n /** Fires on close (any source) */\n onClose?: () => void\n /** Portal target. Defaults to `document.body`. */\n container?: HTMLElement | null\n children?: ReactNode\n className?: string\n classNames?: ModalClassNames\n /** Overrides the default close button's accessible name (`closeTriggerLabel`, default\n * `\"Close\"`). The compound `ModalCloseTrigger` part takes a plain `aria-label` instead. */\n translations?: ModalTranslations\n /** Replaces the default icons: `close`, the header's close button. */\n icons?: ModalIcons\n }\n\n/** The ready-made modal's wording — `closeTriggerLabel` follows Ark's naming for the\n * same control. */\nexport type ModalTranslations = { closeTriggerLabel?: string }\n\nconst ModalComponent = ({\n open,\n defaultOpen,\n onOpenChange,\n onClose,\n title,\n description,\n \"aria-labelledby\": ariaLabelledby,\n size,\n radius,\n position,\n withCloseButton = true,\n withBackdrop = true,\n padding = \"md\",\n closeOnEscape,\n closeOnInteractOutside,\n role,\n onExitComplete,\n container,\n children,\n className,\n classNames,\n testId,\n translations,\n icons,\n ...rest\n}: ModalProps) => {\n const hasHeader = title != null || description != null || withCloseButton\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={({ open: next }) => {\n onOpenChange?.(next)\n if (!next) onClose?.()\n }}\n closeOnEscape={closeOnEscape}\n // Decoupled from `modal` on purpose: Ark's dialog derives this default\n // from `modal` (`modal && !alertdialog`), so when the overlays manager\n // draws its own shared backdrop and passes `withBackdrop={false}` —\n // forcing `modal={false}` below — outside-click would silently stop\n // dismissing. Default to Ark's intended behaviour instead: dismiss for\n // regular dialogs, keep `alertdialog`s sticky (explicit choice required).\n closeOnInteractOutside={closeOnInteractOutside ?? role !== \"alertdialog\"}\n role={role}\n // Unmount the whole content tree (incl. the `fixed inset-0` positioner)\n // on close — otherwise the positioner lingers as a transparent overlay\n // that swallows page clicks. `lazyMount` keeps it out of the DOM until\n // first open. Both flow to the parts' presence via Ark's Root context.\n lazyMount\n unmountOnExit\n modal={withBackdrop}\n onExitComplete={onExitComplete}\n icons={icons}\n {...rest}\n >\n <Portal container={container ? { current: container } : undefined}>\n {withBackdrop && <ModalBackdrop className={classNames?.backdrop} />}\n <ModalPositioner\n position={position}\n className={cn(\"overflow-clip\", classNames?.positioner)}\n >\n <ModalContent\n size={size}\n radius={radius}\n style={{ [\"--modal-px\" as string]: DIALOG_PADDING[padding] }}\n className={cn(className, classNames?.content)}\n testId={testId}\n aria-labelledby={ariaLabelledby}\n >\n {hasHeader && (\n <ModalHeader className={classNames?.header}>\n <div className=\"flex flex-col gap-1\">\n {title != null && <ModalTitle className={classNames?.title}>{title}</ModalTitle>}\n {description != null && (\n <ModalDescription className={classNames?.description}>\n {description}\n </ModalDescription>\n )}\n </div>\n {withCloseButton && (\n <ModalCloseTrigger\n aria-label={translations?.closeTriggerLabel}\n className={classNames?.closeButton}\n />\n )}\n </ModalHeader>\n )}\n <ModalBody\n className={cn(\n !hasHeader && \"pt-(--modal-px,1.25rem)\",\n \"pb-(--modal-px,1.25rem)\",\n classNames?.body,\n )}\n >\n {children}\n </ModalBody>\n </ModalContent>\n </ModalPositioner>\n </Portal>\n </ModalRoot>\n )\n}\n\nexport const Modal = Object.assign(ModalComponent, {\n Root: ModalRoot,\n Trigger: ModalTrigger,\n Context: ModalContext,\n Backdrop: ModalBackdrop,\n Positioner: ModalPositioner,\n Content: ModalContent,\n Title: ModalTitle,\n Description: ModalDescription,\n CloseTrigger: ModalCloseTrigger,\n Header: ModalHeader,\n Body: ModalBody,\n Footer: ModalFooter,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/modal/modal.tsx"],"names":["Ark"],"mappings":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AAA;AAAA,kCAEF,GAAA;AAAA,oBAAC,SAAA;AAAA,oBAAA;AAAA,sBACC,SAAA,EAAW,EAAA;AAAA,wBACT,CAAC,SAAA,IAAa,yBAAA;AAAA,wBACd,yBAAA;AAAA,wBACA,UAAA,EAAY;AAAA,uBACd;AAAA,sBAEC;AAAA;AAAA;AACH;AAAA;AAAA;AACF;AAAA;AACF,OAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAA;AAEO,IAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB;AAAA,EACjD,IAAA,EAAM,SAAA;AAAA,EACN,OAAA,EAAS,YAAA;AAAA,EACT,OAAA,EAAS,YAAA;AAAA,EACT,QAAA,EAAU,aAAA;AAAA,EACV,UAAA,EAAY,eAAA;AAAA,EACZ,OAAA,EAAS,YAAA;AAAA,EACT,KAAA,EAAO,UAAA;AAAA,EACP,WAAA,EAAa,gBAAA;AAAA,EACb,YAAA,EAAc,iBAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ;AACV,CAAC","file":"chunk-JVG5ISPT.js","sourcesContent":["\"use client\"\n\nimport { Dialog as Ark } from \"@ark-ui/react/dialog\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { type ComponentPropsWithoutRef, type ReactNode, useRef } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { NestedLayer, useLayerGuard } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport {\n createDialogParts,\n DIALOG_PADDING,\n type DialogCloseTriggerProps,\n type DialogIconSlot,\n type DialogIcons,\n DialogRootProviders,\n type DialogSectionProps,\n useDialogNameCheck,\n} from \"../overlays/dialog-parts\"\n\n/**\n * Modal — centered overlay dialog on top of Ark UI's Dialog state machine.\n * Ark owns focus-trap, scroll-lock, RTL, the `Esc` / click-outside behaviour\n * and the `data-state=\"open|closed\"` attribute that drives our enter/exit\n * animations (keyframes live in `theme.css`). This wrapper provides the styled\n * parts and a flatter props API.\n *\n * - High-level form: `<Modal open title size … >children</Modal>` renders the\n * full Portal → Backdrop → Positioner → Content → Header + Body scaffold.\n * This is what the imperative overlays manager mounts.\n * - Low-level parts (`Modal.Root`, `Modal.Content`, `Modal.Title`, …) are\n * exposed for full control / trigger-based composition.\n *\n * Surface padding flows through the `--modal-px` CSS var set on the content, so\n * `Modal.Header` / `Modal.Body` / `Modal.Footer` stay in rhythm without prop\n * plumbing — and keep a sensible fallback when used standalone.\n */\n\nconst modalBackdrop = cva([\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] bg-black/50 backdrop-blur-lg pointer-events-auto select-none\",\n \"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out\",\n])\n\nconst modalPositioner = cva(\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] flex flex-col items-center overflow-y-auto p-4\",\n {\n variants: {\n position: {\n center: \"justify-center\",\n top: \"justify-start mt-[8vh]\",\n bottom: \"justify-end mb-[8vh]\",\n },\n },\n defaultVariants: { position: \"center\" },\n },\n)\n\nconst modalContent = cva(\n [\n \"relative flex w-full flex-col\",\n \"max-h-[calc(100dvh-2rem)]\",\n \"bg-brand-50 text-brand-950 border border-brand-900/20 shadow-2xl\",\n \"dark:bg-brand-950 dark:text-white dark:border-white/15\",\n \"focus:outline-none\",\n \"data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out\",\n ],\n {\n variants: {\n size: {\n xs: \"max-w-(--width-xs)\", // 24rem\n sm: \"max-w-(--width-sm)\", // 30rem\n md: \"max-w-(--width-md)\", // 35rem\n lg: \"max-w-(--width-lg)\", // 40rem\n xl: \"max-w-(--width-xl)\", // 48rem\n full: \"max-w-[calc(100vw-2rem)] min-h-[calc(100dvh-2rem)]\",\n },\n radius: {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-xl\",\n xl: \"rounded-2xl\",\n },\n },\n defaultVariants: { size: \"md\", radius: \"sm\" },\n },\n)\n\n// ---------------------------------------------------------------------------\n// Low-level parts (styled Ark parts + kit conveniences)\n// ---------------------------------------------------------------------------\n\nexport type ModalIconSlot = DialogIconSlot\nexport type ModalIcons = DialogIcons\n\nexport type ModalRootProps = ComponentPropsWithoutRef<typeof Ark.Root> & {\n /** Replaces the default icons: `close`. `Modal.CloseTrigger`'s `children` win over it. */\n icons?: ModalIcons\n}\n\n/** Ark's root, plus the nested-layer guard: while a picker opened inside the\n * dialog is open, an outside click closes the picker only, not the dialog\n * under it. It is also a layer of its own while open, so a hotkey on the page\n * (or in an enclosing overlay) yields to it. See `lib/overlay-layer.tsx`. */\nconst ModalRoot = ({ onPointerDownOutside, icons, children, ...rest }: ModalRootProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n return (\n <Ark.Root onPointerDownOutside={guard.onPointerDownOutside} {...rest}>\n {/* A layer itself, registered with whatever it opened from (the page,\n or an enclosing overlay), so what's under it knows it's covered. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <DialogRootProviders icons={icons} layers={guard.layers}>\n {children}\n </DialogRootProviders>\n </Ark.Root>\n )\n}\nconst ModalTrigger = Ark.Trigger\nconst ModalContext = Ark.Context\n\nexport type ModalBackdropProps = ComponentPropsWithoutRef<typeof Ark.Backdrop> & WithTestId\n\nconst ModalBackdrop = ({ className, testId, ...rest }: ModalBackdropProps) => (\n <Ark.Backdrop\n className={cn(modalBackdrop(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalPosition = VariantProps<typeof modalPositioner>[\"position\"]\nexport type ModalPositionerProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Positioner>> &\n WithTestId & {\n position?: ModalPosition\n }\n\nconst ModalPositioner = ({\n className,\n position,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ModalPositionerProps) => {\n // A ref, not state: overlays read it when they portal, so nothing has to\n // re-render once it attaches (see `lib/overlay-container.tsx`).\n const positioner = useRef<HTMLDivElement>(null)\n return (\n <Ark.Positioner\n ref={positioner}\n className={cn(modalPositioner({ position }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <OverlayContainerProvider value={positioner}>{children}</OverlayContainerProvider>\n </Ark.Positioner>\n )\n}\n\nexport type ModalContentProps = ComponentPropsWithoutRef<typeof Ark.Content> &\n VariantProps<typeof modalContent> &\n WithTestId\n\nconst ModalContent = ({ className, size, radius, testId, ...rest }: ModalContentProps) => {\n const nameCheck = useDialogNameCheck(\"Modal\")\n return (\n <Ark.Content\n ref={nameCheck}\n className={cn(modalContent({ size, radius }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ModalTitleProps = ComponentPropsWithoutRef<typeof Ark.Title> & WithTestId\n\nconst ModalTitle = ({ className, testId, ...rest }: ModalTitleProps) => (\n <Ark.Title\n className={cn(\"text-xl font-semibold leading-tight\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalDescriptionProps = ComponentPropsWithoutRef<typeof Ark.Description> & WithTestId\n\nconst ModalDescription = ({ className, testId, ...rest }: ModalDescriptionProps) => (\n <Ark.Description\n className={cn(\"text-sm\", TEXT_COLOR_CLASSES.muted, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalCloseTriggerProps = DialogCloseTriggerProps\nexport type ModalHeaderProps = DialogSectionProps\nexport type ModalBodyProps = DialogSectionProps\nexport type ModalFooterProps = DialogSectionProps\n\nconst {\n CloseTrigger: ModalCloseTrigger,\n Header: ModalHeader,\n Body: ModalBody,\n Footer: ModalFooter,\n} = createDialogParts(\"modal\", Ark.CloseTrigger)\n\n// ---------------------------------------------------------------------------\n// High-level props-driven Modal\n// ---------------------------------------------------------------------------\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\nexport type ModalSize = NonNullable<VariantProps<typeof modalContent>[\"size\"]>\nexport type ModalRadius = NonNullable<VariantProps<typeof modalContent>[\"radius\"]>\n\nexport type ModalClassNames = Partial<\n Record<\n | \"backdrop\"\n | \"positioner\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"closeButton\",\n string\n >\n>\n\nexport type ModalProps = Omit<\n ArkRootProps,\n \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"role\"\n> &\n WithTestId & {\n /** Controlled open state. */\n open?: boolean\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean\n /** Fires with the next open state. Flattened from Ark's `{ open }`. */\n onOpenChange?: (open: boolean) => void\n /** Header title; renders the header when set, and names the dialog. */\n title?: ReactNode\n /** Id of an element inside the modal that names it, when there is no `title`. For a\n * plain string, use `aria-label`. */\n \"aria-labelledby\"?: string\n /** Optional subtitle under the title. */\n description?: ReactNode\n size?: ModalSize\n radius?: ModalRadius\n /** Vertically center the modal (vs. anchored near the top). */\n position?: ModalPosition\n /** Render the default close button in the header. @default true */\n withCloseButton?: boolean\n /**\n * Render the dimming backdrop. Set `false` when an ancestor (e.g. the modals\n * manager) draws a single shared backdrop for the whole overlay stack.\n * @default true\n */\n withBackdrop?: boolean\n /** Inner padding token; sets `--modal-px`. @default \"md\" */\n padding?: Size\n closeOnEscape?: boolean\n closeOnInteractOutside?: boolean\n /** Use `alertdialog` semantics (confirm flows). @default \"dialog\" */\n role?: \"dialog\" | \"alertdialog\"\n /** Fires after the exit animation completes; the manager unmounts on this. */\n onExitComplete?: () => void\n /** Fires on close (any source) */\n onClose?: () => void\n /** Portal target. Defaults to `document.body`. */\n container?: HTMLElement | null\n children?: ReactNode\n className?: string\n classNames?: ModalClassNames\n /** Overrides the default close button's accessible name (`closeTriggerLabel`, default\n * `\"Close\"`). The compound `ModalCloseTrigger` part takes a plain `aria-label` instead. */\n translations?: ModalTranslations\n /** Replaces the default icons: `close`, the header's close button. */\n icons?: ModalIcons\n }\n\n/** The ready-made modal's wording — `closeTriggerLabel` follows Ark's naming for the\n * same control. */\nexport type ModalTranslations = { closeTriggerLabel?: string }\n\nconst ModalComponent = ({\n open,\n defaultOpen,\n onOpenChange,\n onClose,\n title,\n description,\n \"aria-labelledby\": ariaLabelledby,\n size,\n radius,\n position,\n withCloseButton = true,\n withBackdrop = true,\n padding = \"md\",\n closeOnEscape,\n closeOnInteractOutside,\n role,\n onExitComplete,\n container,\n children,\n className,\n classNames,\n testId,\n translations,\n icons,\n ...rest\n}: ModalProps) => {\n const hasHeader = title != null || description != null || withCloseButton\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={({ open: next }) => {\n onOpenChange?.(next)\n if (!next) onClose?.()\n }}\n closeOnEscape={closeOnEscape}\n // Decoupled from `modal` on purpose: Ark's dialog derives this default\n // from `modal` (`modal && !alertdialog`), so when the overlays manager\n // draws its own shared backdrop and passes `withBackdrop={false}` —\n // forcing `modal={false}` below — outside-click would silently stop\n // dismissing. Default to Ark's intended behaviour instead: dismiss for\n // regular dialogs, keep `alertdialog`s sticky (explicit choice required).\n closeOnInteractOutside={closeOnInteractOutside ?? role !== \"alertdialog\"}\n role={role}\n // Unmount the whole content tree (incl. the `fixed inset-0` positioner)\n // on close — otherwise the positioner lingers as a transparent overlay\n // that swallows page clicks. `lazyMount` keeps it out of the DOM until\n // first open. Both flow to the parts' presence via Ark's Root context.\n lazyMount\n unmountOnExit\n modal={withBackdrop}\n onExitComplete={onExitComplete}\n icons={icons}\n {...rest}\n >\n <Portal container={container ? { current: container } : undefined}>\n {withBackdrop && <ModalBackdrop className={classNames?.backdrop} />}\n <ModalPositioner\n position={position}\n className={cn(\"overflow-clip\", classNames?.positioner)}\n >\n <ModalContent\n size={size}\n radius={radius}\n style={{ [\"--modal-px\" as string]: DIALOG_PADDING[padding] }}\n className={cn(className, classNames?.content)}\n testId={testId}\n aria-labelledby={ariaLabelledby}\n >\n {hasHeader && (\n <ModalHeader className={classNames?.header}>\n <div className=\"flex flex-col gap-1\">\n {title != null && <ModalTitle className={classNames?.title}>{title}</ModalTitle>}\n {description != null && (\n <ModalDescription className={classNames?.description}>\n {description}\n </ModalDescription>\n )}\n </div>\n {withCloseButton && (\n <ModalCloseTrigger\n aria-label={translations?.closeTriggerLabel}\n className={classNames?.closeButton}\n />\n )}\n </ModalHeader>\n )}\n <ModalBody\n className={cn(\n !hasHeader && \"pt-(--modal-px,1.25rem)\",\n \"pb-(--modal-px,1.25rem)\",\n classNames?.body,\n )}\n >\n {children}\n </ModalBody>\n </ModalContent>\n </ModalPositioner>\n </Portal>\n </ModalRoot>\n )\n}\n\nexport const Modal = Object.assign(ModalComponent, {\n Root: ModalRoot,\n Trigger: ModalTrigger,\n Context: ModalContext,\n Backdrop: ModalBackdrop,\n Positioner: ModalPositioner,\n Content: ModalContent,\n Title: ModalTitle,\n Description: ModalDescription,\n CloseTrigger: ModalCloseTrigger,\n Header: ModalHeader,\n Body: ModalBody,\n Footer: ModalFooter,\n})\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { InputBase, inputControlClasses, inputSlot } from './chunk-
|
|
2
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
1
|
+
import { InputBase, inputControlClasses, inputSlot } from './chunk-45QRQKRC.js';
|
|
2
|
+
import { FieldShell, fieldA11yProps } from './chunk-VD6PB3VA.js';
|
|
3
3
|
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
4
|
-
import { popoverClearTrigger } from './chunk-
|
|
5
|
-
import { CloseIcon } from './chunk-
|
|
4
|
+
import { popoverClearTrigger } from './chunk-5HUEBSIS.js';
|
|
5
|
+
import { CloseIcon } from './chunk-6YNLRQ25.js';
|
|
6
6
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
7
7
|
import { props } from './chunk-WYCMIIRR.js';
|
|
8
|
-
import { cn } from './chunk-
|
|
8
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
9
9
|
import { useFieldContext } from '@ark-ui/react/field';
|
|
10
10
|
import { NumberInput as NumberInput$1, useNumberInputContext } from '@ark-ui/react/number-input';
|
|
11
11
|
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
@@ -230,5 +230,5 @@ var NumberInput = ({
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
export { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput };
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
234
|
-
//# sourceMappingURL=chunk-
|
|
233
|
+
//# sourceMappingURL=chunk-KMZENCEP.js.map
|
|
234
|
+
//# sourceMappingURL=chunk-KMZENCEP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;AAuCO,IAAM,iCAAA,GAAoC;AAAA,EAC/C,cAAA,EAAgB,WAAA;AAAA,EAChB,cAAA,EAAgB,WAAA;AAAA,EAChB,iBAAA,EAAmB;AACrB;AAMO,IAAM,aAAA,GAAwD;AAAA,EACnE,SAAA,kBAAW,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC7C,SAAA,kBAAW,GAAA,CAAC,WAAA,EAAA,EAAY,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC/C,KAAA,sBAAQ,SAAA,EAAA,EAAU;AACpB,CAAA;AAkHA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,yGAAA;AAAA,EACA,8FAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,UAAA,GAAa,CAAC,KAAA,KAClB,KAAA,KAAU,MAAA,GAAY,SAAY,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,MAAA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port { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\nexport type NumberInputIconSlot = \"increment\" | \"decrement\" | \"clear\"\nexport type NumberInputIcons = IconMap<NumberInputIconSlot>\n\n/** The default icons: the steppers' chevrons and the clear button's ×. */\nexport const DEFAULT_ICONS: Record<NumberInputIconSlot, ReactNode> = {\n increment: <ChevronUp className={iconStroke} />,\n decrement: <ChevronDown className={iconStroke} />,\n clear: <CloseIcon />,\n}\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n /** Replaces the default icons: `increment`, `decrement`, `clear`. A missing key keeps its\n * default. */\n icons?: NumberInputIcons\n }\n\n/** The increment / decrement steppers — one class list for both, so they share one disabled\n * treatment. */\nconst stepperTrigger = cn(\n \"inline-flex h-1/2 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xxs transition-colors\",\n \"[&:hover:not([data-disabled])]:bg-brand-900/6 dark:[&:hover:not([data-disabled])]:bg-white/8\",\n \"data-disabled:cursor-not-allowed data-disabled:text-brand-900/40 dark:data-disabled:text-white/35\",\n)\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n icons: iconsProp,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Drive the red state 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 inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n const fieldRef = useMergedRefs(inputRef, ref)\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 <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden`, `[&_svg]:pointer-events-none`\n // end-slot span. Render them as direct children instead, and flag\n // the shell's end padding manually so the layout matches an\n // `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={fieldRef}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n {/* Ark disables each stepper at its own bound (it only sees `min`/`max`\n * outside `wrap`, so wrapping fields keep both enabled) — controlled or not. */}\n <Ark.IncrementTrigger className={stepperTrigger}>\n {icons.increment}\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger className={stepperTrigger}>\n {icons.decrement}\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names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A,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,sBAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,mBACT;AAAA,kBAED,CAAC,YAAA,oBACA,IAAA,CAACA,aAAA,CAAI,OAAA,EAAJ,EAAY,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,UAAA,EAAY,OAAO,CAAA,EAGnE,QAAA,EAAA;AAAA,oCAAA,GAAA,CAACA,cAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT,CAAA;AAAA,wCACCA,aAAA,CAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT;AAAA,mBAAA,EACF;AAAA;AAAA;AAAA,aAEJ;AAAA,UAEJ,CAAA,EACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-KMZENCEP.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\nexport type NumberInputIconSlot = \"increment\" | \"decrement\" | \"clear\"\nexport type NumberInputIcons = IconMap<NumberInputIconSlot>\n\n/** The default icons: the steppers' chevrons and the clear button's ×. */\nexport const DEFAULT_ICONS: Record<NumberInputIconSlot, ReactNode> = {\n increment: <ChevronUp className={iconStroke} />,\n decrement: <ChevronDown className={iconStroke} />,\n clear: <CloseIcon />,\n}\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n /** Replaces the default icons: `increment`, `decrement`, `clear`. A missing key keeps its\n * default. */\n icons?: NumberInputIcons\n }\n\n/** The increment / decrement steppers — one class list for both, so they share one disabled\n * treatment. */\nconst stepperTrigger = cn(\n \"inline-flex h-1/2 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xxs transition-colors\",\n \"[&:hover:not([data-disabled])]:bg-brand-900/6 dark:[&:hover:not([data-disabled])]:bg-white/8\",\n \"data-disabled:cursor-not-allowed data-disabled:text-brand-900/40 dark:data-disabled:text-white/35\",\n)\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n icons: iconsProp,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Drive the red state 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 inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n const fieldRef = useMergedRefs(inputRef, ref)\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 <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden`, `[&_svg]:pointer-events-none`\n // end-slot span. Render them as direct children instead, and flag\n // the shell's end padding manually so the layout matches an\n // `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={fieldRef}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n {/* Ark disables each stepper at its own bound (it only sees `min`/`max`\n * outside `wrap`, so wrapping fields keep both enabled) — controlled or not. */}\n <Ark.IncrementTrigger className={stepperTrigger}>\n {icons.increment}\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger className={stepperTrigger}>\n {icons.decrement}\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ComboboxSearchRow } from './chunk-
|
|
2
|
-
import { controlIndicator } from './chunk-
|
|
1
|
+
import { ComboboxSearchRow } from './chunk-SXNAUSEB.js';
|
|
2
|
+
import { controlIndicator } from './chunk-NLOBBJAA.js';
|
|
3
3
|
import { normalizeSelectData, useLabelSearch, filterSelectData } from './chunk-7TDHT3QD.js';
|
|
4
|
-
import { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox } from './chunk-
|
|
5
|
-
import { FieldShell } from './chunk-
|
|
4
|
+
import { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox } from './chunk-MKKQE3TM.js';
|
|
5
|
+
import { FieldShell } from './chunk-VD6PB3VA.js';
|
|
6
6
|
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
7
|
-
import { CheckIcon, CloseIcon } from './chunk-
|
|
7
|
+
import { CheckIcon, CloseIcon } from './chunk-6YNLRQ25.js';
|
|
8
8
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
9
|
-
import { cn } from './chunk-
|
|
9
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
10
10
|
import { Combobox as Combobox$1 } from '@ark-ui/react/combobox';
|
|
11
11
|
import { SearchIcon } from 'lucide-react';
|
|
12
12
|
import { useState, useMemo } from 'react';
|
|
@@ -160,5 +160,5 @@ var MultiComboboxList = ({
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
export { MultiComboboxList };
|
|
163
|
-
//# sourceMappingURL=chunk-
|
|
164
|
-
//# sourceMappingURL=chunk-
|
|
163
|
+
//# sourceMappingURL=chunk-LBAE6FP6.js.map
|
|
164
|
+
//# sourceMappingURL=chunk-LBAE6FP6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/multi-combobox-list/multi-combobox-list.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;AAiEO,IAAM,aAAA,GAA8D;AAAA,EACzE,MAAA,kBAAQ,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC3C,KAAA,sBAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,EAClB,KAAA,sBAAQ,SAAA,EAAA,EAAU;AACpB,CAAA;AA8DO,IAAM,oBAAoB,CAA6C;AAAA,EAC5E,IAAA;AAAA,EACA,KAAA,EAAO,SAAA;AAAA,EACP,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA,GAAc,cAAA;AAAA,EACd,KAAA,GAAQ,eAAA;AAAA,EACR,SAAA;AAAA,EACA,SAAA;AAAA,EACA,iBAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,UAAA;AAAA,EACV,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA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AAA,EADV,KAAA,CAAM,KAE3B,CACD,CAAA,GACD,KAAA,CAAM,GAAA,CAAI,YAAY,CAAA;AAAA,UACzB,SAAS,IAAA,oBAAQ,GAAA,CAAC,QAAA,CAAS,KAAA,EAAT,EAAgB,QAAA,EAAA,KAAA,EAAM;AAAA,SAAA,EAC3C,CAAA;AAAA,QAMC,IAAA,IAAQ,IAAA,IAAQ,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,qBAAM,GAAA,CAAC,OAAA,EAAA,EAAc,IAAA,EAAK,QAAA,EAAS,IAAA,EAAY,KAAA,EAAO,CAAA,EAAA,EAApC,CAAuC,CAAE;AAAA;AAAA;AAAA,GACzF;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,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-VVM7JMZS.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { SearchIcon } from \"lucide-react\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport {\n filterSelectData,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n useLabelSearch,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { controlIndicator } from \"../checkbox/control\"\nimport {\n COMBOBOX_DEFAULT_TRANSLATIONS,\n Combobox,\n type ComboboxTranslations,\n} from \"../combobox/combobox\"\nimport { ComboboxSearchRow } from \"../combobox-list/combobox-search-row\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport type { InputSize, InputVariant } from \"../input/input\"\nimport { CheckIcon, CloseIcon } from \"../popover/icons\"\n\n/**\n * MultiComboboxList — a searchable, multi-value option list with no trigger of\n * its own. Same idea as [`ComboboxList`](/docs/combobox-list) but for several\n * values at once: every option shows a checkbox instead of a single check\n * mark, and picking one doesn't close the list. It renders permanently open —\n * embed it inline inside a container you already control the visibility of\n * (a `Popover`, a `Drawer`, a custom panel).\n *\n * - `data` / `value` / `onChange` match [`MultiSelect`](/docs/multi-select)\n * exactly (`SelectValue<Data>[]`) — but options render as a checkbox list\n * rather than pills in the input, which is lighter in a compact popover.\n * - Type to filter; `clearable` clears every value at once; `maxValues` caps\n * the selection; `hidePickedOptions` drops chosen options from the list.\n * - Label / description / error come from the built-in `Field`, same as the\n * rest of the family — omit them when embedding inside your own popover.\n */\n\ntype MultiComboboxListClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The search row (also targeted by `className`). */\n search?: string\n /** The search `<input>`. */\n input?: string\n /** A single option row. */\n option?: string\n /** The checkbox indicator inside an option row. */\n checkbox?: string\n /** The scrollable option list. */\n list?: string\n}\n\nexport type MultiComboboxListIconSlot = \"search\" | \"clear\" | \"check\"\nexport type MultiComboboxListIcons = IconMap<MultiComboboxListIconSlot>\n\n/** The default icons: the search row's magnifier and clear ×, and the selected option's checkbox mark. */\nexport const DEFAULT_ICONS: Record<MultiComboboxListIconSlot, ReactNode> = {\n search: <SearchIcon className={iconStroke} />,\n clear: <CloseIcon />,\n check: <CheckIcon />,\n}\n\nexport type MultiComboboxListProps<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 selected values. */\n value?: SelectValue<Data>[]\n /** Uncontrolled initial selection. */\n defaultValue?: SelectValue<Data>[]\n /** Fires with the full selection on every add / remove. */\n onChange?: (value: SelectValue<Data>[]) => 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 the\n * checkbox affordance. Omit it to render the checkbox + label.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder for the search field. */\n placeholder?: string\n /** Message shown when no option matches. Pass `null` to render nothing. */\n empty?: ReactNode\n /** Show a button that clears every value at once. */\n clearable?: boolean\n /** Cap the number of selected values. */\n maxValues?: number\n /** Hide options that are already selected. */\n hidePickedOptions?: boolean\n size?: InputSize\n /**\n * Search row treatment. Defaults to `\"unstyled\"` (no border/background) since\n * this is normally embedded inside a container that already draws its own\n * chrome; pass `\"default\"` / `\"filled\"` when using it standalone.\n */\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for native form submission (one hidden input per value). */\n name?: string\n /** Forwarded to the search input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable search `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: MultiComboboxListClassNames\n /** Overrides the clear button's accessible name (`clearTriggerLabel`, default\n * `\"Clear value\"`) — the same key as the rest of the combobox family. */\n translations?: MultiComboboxListTranslations\n /** Replaces the default icons: `search`, `clear`, `check`. A missing key keeps its\n * default; `search: null` drops the magnifier. `renderItem` draws its own rows. */\n icons?: MultiComboboxListIcons\n }\n\n/** The combobox family's `clearTriggerLabel` — the only family key this always-open list\n * renders (it has no chevron). */\nexport type MultiComboboxListTranslations = Pick<ComboboxTranslations, \"clearTriggerLabel\">\n\nexport const MultiComboboxList = <const Data extends SelectData = SelectData>({\n data,\n value: valueProp,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Search…\",\n empty = \"Nothing found\",\n clearable,\n maxValues,\n hidePickedOptions,\n size = \"md\",\n variant = \"unstyled\",\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 icons: iconsProp,\n}: MultiComboboxListProps<Data>) => {\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n const clearLabel =\n translations?.clearTriggerLabel ?? COMBOBOX_DEFAULT_TRANSLATIONS.clearTriggerLabel\n type Item = SelectValue<Data>\n\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\n const [value, setSelected] = useUncontrolled<Item[]>({\n value: valueProp,\n defaultValue: defaultValue ?? [],\n onChange,\n })\n const [search, setSearch] = useState(\"\")\n\n const setValues = (next: Item[]) => {\n // Adding past the cap is rejected; removals always pass.\n if (maxValues != null && next.length > value.length && next.length > maxValues) {\n return\n }\n setSelected(next)\n }\n\n // Normalize once per `data`; only the filter re-runs as the query/selection changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const labelSearch = useLabelSearch()\n const { collection, items, groups } = useMemo(() => {\n const picked = new Set<string>(value)\n return filterSelectData(\n normalized,\n (item) =>\n (!hidePickedOptions || !picked.has(item.value)) && labelSearch.matches(item.label, search),\n )\n }, [normalized, search, hidePickedOptions, value, labelSearch])\n\n // `canClear` reserves the clear button's box (and the shell's end-slot\n // padding) for the whole time the field is clearable, not just while it\n // has a value — otherwise the button mounting/unmounting shifts the\n // search input's width. `showClear` only toggles visibility/interactivity.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && ((value != null && value.length > 0) || search.length > 0)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(\"group/item\", classNames?.option)}\n >\n {(state) =>\n renderItem ? (\n renderItem(item, state)\n ) : (\n <>\n {/* Presentational: the option row owns the selection semantics.\n It borrows Checkbox's own box, driven by `data-state` the way\n Ark drives the real one, so the two never drift apart. */}\n <span\n aria-hidden\n data-state={state.selected ? \"checked\" : \"unchecked\"}\n className={cn(controlIndicator({ size, variant: \"filled\" }), classNames?.checkbox)}\n >\n <ArkCombobox.ItemIndicator>{icons.check}</ArkCombobox.ItemIndicator>\n </span>\n <span className=\"min-w-0 flex-1 truncate\">{item.label}</span>\n </>\n )\n }\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root<NormalizedItemOf<Data>>\n multiple\n collection={collection}\n value={value}\n // Ark types the values as `string[]`; they always originate from `data`,\n // so narrow them back to the caller's value union.\n onValueChange={(details) => setValues(details.value as Item[])}\n inputValue={search}\n onInputValueChange={(details) => setSearch(details.inputValue)}\n selectionBehavior=\"clear\"\n // There's no trigger to open it — the caller (e.g. a `Popover`) already\n // owns whether this mounts at all, so keep the machine permanently open.\n open\n onOpenChange={() => {}}\n // The caller's own container (Popover, Drawer, …) already owns\n // dismiss-on-outside-click; without this the always-open machine\n // registers its own (functionally inert, since `onOpenChange` is a\n // no-op) listbox dismissable layer, which logs a spurious\n // \"[@zag-js/dismissable] node is `null` or `undefined`\" warning.\n disableLayer\n closeOnSelect={false}\n autoFocus\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n >\n <ComboboxSearchRow\n size={size}\n variant={variant}\n invalid={isInvalid}\n placeholder={placeholder}\n canClear={canClear}\n showClear={showClear}\n clearLabel={clearLabel}\n onClear={() => {\n setValues([])\n setSearch(\"\")\n }}\n onBlur={onBlur}\n ref={ref}\n testId={testId}\n icons={icons}\n classNames={classNames}\n />\n\n <Combobox.Panel className={classNames?.list}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Panel>\n\n {/* Hidden inputs carry the real selection so a native `<form>` submits\n the value array (the search input is unnamed). When controlled by a\n form library the value flows through `onChange` instead, and these\n are just submitted alongside it. */}\n {name != null && value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} />)}\n </Combobox.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 >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/multi-combobox-list/multi-combobox-list.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;AAiEO,IAAM,aAAA,GAA8D;AAAA,EACzE,MAAA,kBAAQ,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC3C,KAAA,sBAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,EAClB,KAAA,sBAAQ,SAAA,EAAA,EAAU;AACpB,CAAA;AA8DO,IAAM,oBAAoB,CAA6C;AAAA,EAC5E,IAAA;AAAA,EACA,KAAA,EAAO,SAAA;AAAA,EACP,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA,GAAc,cAAA;AAAA,EACd,KAAA,GAAQ,eAAA;AAAA,EACR,SAAA;AAAA,EACA,SAAA;AAAA,EACA,iBAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,UAAA;AAAA,EACV,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,KAAA,EAAO;AACT,CAAA,KAAoC;AAClC,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,aAAA,EAAe,SAAS,CAAA;AACjD,EAAA,MAAM,UAAA,GACJ,YAAA,EAAc,iBAAA,IAAqB,6BAAA,CAA8B,iBAAA;AAKnE,EAAA,MAAM,SAAA,GAAY,WAAW,KAAA,IAAS,IAAA;AAEtC,EAAA,MAAM,CAAC,K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AA,EAAK,QAAA,EAAS,IAAA,EAAY,KAAA,EAAO,CAAA,EAAA,EAApC,CAAuC,CAAE;AAAA;AAAA;AAAA,GACzF;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,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-LBAE6FP6.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { SearchIcon } from \"lucide-react\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport {\n filterSelectData,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n useLabelSearch,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { controlIndicator } from \"../checkbox/control\"\nimport {\n COMBOBOX_DEFAULT_TRANSLATIONS,\n Combobox,\n type ComboboxTranslations,\n} from \"../combobox/combobox\"\nimport { ComboboxSearchRow } from \"../combobox-list/combobox-search-row\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport type { InputSize, InputVariant } from \"../input/input\"\nimport { CheckIcon, CloseIcon } from \"../popover/icons\"\n\n/**\n * MultiComboboxList — a searchable, multi-value option list with no trigger of\n * its own. Same idea as [`ComboboxList`](/docs/combobox-list) but for several\n * values at once: every option shows a checkbox instead of a single check\n * mark, and picking one doesn't close the list. It renders permanently open —\n * embed it inline inside a container you already control the visibility of\n * (a `Popover`, a `Drawer`, a custom panel).\n *\n * - `data` / `value` / `onChange` match [`MultiSelect`](/docs/multi-select)\n * exactly (`SelectValue<Data>[]`) — but options render as a checkbox list\n * rather than pills in the input, which is lighter in a compact popover.\n * - Type to filter; `clearable` clears every value at once; `maxValues` caps\n * the selection; `hidePickedOptions` drops chosen options from the list.\n * - Label / description / error come from the built-in `Field`, same as the\n * rest of the family — omit them when embedding inside your own popover.\n */\n\ntype MultiComboboxListClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The search row (also targeted by `className`). */\n search?: string\n /** The search `<input>`. */\n input?: string\n /** A single option row. */\n option?: string\n /** The checkbox indicator inside an option row. */\n checkbox?: string\n /** The scrollable option list. */\n list?: string\n}\n\nexport type MultiComboboxListIconSlot = \"search\" | \"clear\" | \"check\"\nexport type MultiComboboxListIcons = IconMap<MultiComboboxListIconSlot>\n\n/** The default icons: the search row's magnifier and clear ×, and the selected option's checkbox mark. */\nexport const DEFAULT_ICONS: Record<MultiComboboxListIconSlot, ReactNode> = {\n search: <SearchIcon className={iconStroke} />,\n clear: <CloseIcon />,\n check: <CheckIcon />,\n}\n\nexport type MultiComboboxListProps<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 selected values. */\n value?: SelectValue<Data>[]\n /** Uncontrolled initial selection. */\n defaultValue?: SelectValue<Data>[]\n /** Fires with the full selection on every add / remove. */\n onChange?: (value: SelectValue<Data>[]) => 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 the\n * checkbox affordance. Omit it to render the checkbox + label.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder for the search field. */\n placeholder?: string\n /** Message shown when no option matches. Pass `null` to render nothing. */\n empty?: ReactNode\n /** Show a button that clears every value at once. */\n clearable?: boolean\n /** Cap the number of selected values. */\n maxValues?: number\n /** Hide options that are already selected. */\n hidePickedOptions?: boolean\n size?: InputSize\n /**\n * Search row treatment. Defaults to `\"unstyled\"` (no border/background) since\n * this is normally embedded inside a container that already draws its own\n * chrome; pass `\"default\"` / `\"filled\"` when using it standalone.\n */\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for native form submission (one hidden input per value). */\n name?: string\n /** Forwarded to the search input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable search `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: MultiComboboxListClassNames\n /** Overrides the clear button's accessible name (`clearTriggerLabel`, default\n * `\"Clear value\"`) — the same key as the rest of the combobox family. */\n translations?: MultiComboboxListTranslations\n /** Replaces the default icons: `search`, `clear`, `check`. A missing key keeps its\n * default; `search: null` drops the magnifier. `renderItem` draws its own rows. */\n icons?: MultiComboboxListIcons\n }\n\n/** The combobox family's `clearTriggerLabel` — the only family key this always-open list\n * renders (it has no chevron). */\nexport type MultiComboboxListTranslations = Pick<ComboboxTranslations, \"clearTriggerLabel\">\n\nexport const MultiComboboxList = <const Data extends SelectData = SelectData>({\n data,\n value: valueProp,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Search…\",\n empty = \"Nothing found\",\n clearable,\n maxValues,\n hidePickedOptions,\n size = \"md\",\n variant = \"unstyled\",\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 icons: iconsProp,\n}: MultiComboboxListProps<Data>) => {\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n const clearLabel =\n translations?.clearTriggerLabel ?? COMBOBOX_DEFAULT_TRANSLATIONS.clearTriggerLabel\n type Item = SelectValue<Data>\n\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\n const [value, setSelected] = useUncontrolled<Item[]>({\n value: valueProp,\n defaultValue: defaultValue ?? [],\n onChange,\n })\n const [search, setSearch] = useState(\"\")\n\n const setValues = (next: Item[]) => {\n // Adding past the cap is rejected; removals always pass.\n if (maxValues != null && next.length > value.length && next.length > maxValues) {\n return\n }\n setSelected(next)\n }\n\n // Normalize once per `data`; only the filter re-runs as the query/selection changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const labelSearch = useLabelSearch()\n const { collection, items, groups } = useMemo(() => {\n const picked = new Set<string>(value)\n return filterSelectData(\n normalized,\n (item) =>\n (!hidePickedOptions || !picked.has(item.value)) && labelSearch.matches(item.label, search),\n )\n }, [normalized, search, hidePickedOptions, value, labelSearch])\n\n // `canClear` reserves the clear button's box (and the shell's end-slot\n // padding) for the whole time the field is clearable, not just while it\n // has a value — otherwise the button mounting/unmounting shifts the\n // search input's width. `showClear` only toggles visibility/interactivity.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && ((value != null && value.length > 0) || search.length > 0)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(\"group/item\", classNames?.option)}\n >\n {(state) =>\n renderItem ? (\n renderItem(item, state)\n ) : (\n <>\n {/* Presentational: the option row owns the selection semantics.\n It borrows Checkbox's own box, driven by `data-state` the way\n Ark drives the real one, so the two never drift apart. */}\n <span\n aria-hidden\n data-state={state.selected ? \"checked\" : \"unchecked\"}\n className={cn(controlIndicator({ size, variant: \"filled\" }), classNames?.checkbox)}\n >\n <ArkCombobox.ItemIndicator>{icons.check}</ArkCombobox.ItemIndicator>\n </span>\n <span className=\"min-w-0 flex-1 truncate\">{item.label}</span>\n </>\n )\n }\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root<NormalizedItemOf<Data>>\n multiple\n collection={collection}\n value={value}\n // Ark types the values as `string[]`; they always originate from `data`,\n // so narrow them back to the caller's value union.\n onValueChange={(details) => setValues(details.value as Item[])}\n inputValue={search}\n onInputValueChange={(details) => setSearch(details.inputValue)}\n selectionBehavior=\"clear\"\n // There's no trigger to open it — the caller (e.g. a `Popover`) already\n // owns whether this mounts at all, so keep the machine permanently open.\n open\n onOpenChange={() => {}}\n // The caller's own container (Popover, Drawer, …) already owns\n // dismiss-on-outside-click; without this the always-open machine\n // registers its own (functionally inert, since `onOpenChange` is a\n // no-op) listbox dismissable layer, which logs a spurious\n // \"[@zag-js/dismissable] node is `null` or `undefined`\" warning.\n disableLayer\n closeOnSelect={false}\n autoFocus\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n >\n <ComboboxSearchRow\n size={size}\n variant={variant}\n invalid={isInvalid}\n placeholder={placeholder}\n canClear={canClear}\n showClear={showClear}\n clearLabel={clearLabel}\n onClear={() => {\n setValues([])\n setSearch(\"\")\n }}\n onBlur={onBlur}\n ref={ref}\n testId={testId}\n icons={icons}\n classNames={classNames}\n />\n\n <Combobox.Panel className={classNames?.list}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Panel>\n\n {/* Hidden inputs carry the real selection so a native `<form>` submits\n the value array (the search input is unnamed). When controlled by a\n form library the value flows through `onChange` instead, and these\n are just submitted alongside it. */}\n {name != null && value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} />)}\n </Combobox.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 >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
2
|
-
import { CloseIcon } from './chunk-
|
|
3
|
-
import { Collapse } from './chunk-
|
|
2
|
+
import { CloseIcon } from './chunk-6YNLRQ25.js';
|
|
3
|
+
import { Collapse } from './chunk-NKOTA5TM.js';
|
|
4
4
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
5
|
-
import { Spinner } from './chunk-
|
|
5
|
+
import { Spinner } from './chunk-D2QIPQ74.js';
|
|
6
6
|
import { props } from './chunk-WYCMIIRR.js';
|
|
7
|
-
import { focusStyles } from './chunk-
|
|
7
|
+
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
8
8
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
9
|
-
import { cn } from './chunk-
|
|
9
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
10
10
|
import { ark } from '@ark-ui/react';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
import { ChevronDownIcon, InfoIcon, TriangleAlertIcon, AlertCircleIcon, CheckCircleIcon } from 'lucide-react';
|
|
@@ -238,5 +238,5 @@ var Notification = Object.assign(NotificationComponent, {
|
|
|
238
238
|
});
|
|
239
239
|
|
|
240
240
|
export { ActionTrigger, CloseTrigger, Description, Icon, NOTIFICATION_DEFAULT_TRANSLATIONS, Notification, TOAST_STATUS, Title, notificationRoot };
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
241
|
+
//# sourceMappingURL=chunk-LKFHUDEW.js.map
|
|
242
|
+
//# sourceMappingURL=chunk-LKFHUDEW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/notification/notification.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmDO,IAAM,mBAAA,GAAsB;AAAA,EACjC,qCAAA;AAAA,EACA;AACF,CAAA;AAMO,IAAM,mBAAmB,GAAA,CAAI;AAAA,EAClC,0EAAA;AAAA,EACA,iEAAA;AAAA;AAAA,EAEA,mCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA,EAGA,oBAAA;AAAA,EACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,EAC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AW,SAAQ,CAAA,EACxF;AAAA,GAAA,EACF,CAAA;AAEJ;AAOO,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAC","file":"chunk-U2PNMMDB.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n AlertCircleIcon,\n CheckCircleIcon,\n ChevronDownIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, type Ref, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { Spinner } from \"../spinner/spinner\"\nimport type { ToastFields, ToastHue, ToastType } from \"./types\"\n\n/**\n * Notification — the kit's **toast**: transient, non-blocking feedback spawned\n * imperatively from anywhere (`notify.success(\"Saved\")`) via `createNotifier`.\n *\n * This module holds the *visual* compound (`Notification.Root` / `Icon` /\n * `Title` / `Description` / `ActionTrigger` / `CloseTrigger` /\n * `CollapseTrigger`) and the ready-made `Notification` card composed from a\n * toast-shaped object (`type` → hue + icon, `title` / `description` /\n * `action`). It is deliberately dumb: the toaster behavior that drives it —\n * store, presence, height measurement, swipe-to-dismiss, stacking — lives in\n * `store.ts` / `create-notifier.tsx`, so the card is equally usable on its own\n * (e.g. a page-level alert).\n *\n * The surface is a single outline recipe; `color` (a `data-color` attribute\n * resolved to the `--c-*` slot vars) is the only styling axis. Status presets\n * map a `type` onto a hue + a leading icon.\n * Enter/exit is driven by Ark Presence → `data-state` → the `toast-in/out`\n * keyframes (like modal/drawer/popover).\n */\n\n/** The outline surface. Deliberately opaque and blurred: a toast floats over\n * arbitrary content. `Alert` (the inline sibling) shares the parts but not\n * this surface — it sits on the page and takes a translucent tint instead.\n * `color` tints the border, text and icon through `--c-solid`. */\nexport const notificationSurface = [\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"text-(--c-solid) border-(--c-solid) backdrop-blur-lg\",\n]\n\n/** The toast card. Enter/exit via `data-state` keyframes (Ark Presence sets\n * `data-state`); stacking position via the `[data-scope=notifications]` rules\n * in theme.css (driven by the `--index`/`--offset`/`--height` vars the toaster\n * sets on each card — see create-notifier). */\nexport const notificationRoot = cva([\n \"data-[state=open]:animate-toast-in data-[state=closed]:animate-toast-out\",\n \"pointer-events-auto flex flex-col w-88 max-w-[calc(100vw-2rem)]\",\n // Phones (< xs): fill the full-bleed bottom region (see createNotifier).\n \"max-xs:w-full! max-xs:max-w-none!\",\n \"rounded-card border px-3 py-3\",\n // Any-focus outline suppression, matching the other overlay surfaces\n // (Modal, Drawer, Popover, Tooltip) — the card can take programmatic focus.\n \"focus:outline-none\",\n focusStyles({ offset: false }),\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"shadow-2xl shadow-white dark:shadow-black/80\",\n \"overflow-clip\",\n notificationSurface,\n])\n\n/** `type` → hue + default leading icon. There are no status color *tokens* in\n * the kit — status maps onto existing hues, reusing the same `--c-*` slots as\n * Badge/Button. `loading` uses the kit Spinner. Exported so `Alert` (which\n * drops the toast-only `loading` type) resolves the same presets. */\nexport const TOAST_STATUS: Record<ToastType, { color: Color; icon: ReactNode }> = {\n success: { color: \"green\", icon: <CheckCircleIcon className={iconStroke} /> },\n error: { color: \"red\", icon: <AlertCircleIcon className={iconStroke} /> },\n warning: { color: \"orange\", icon: <TriangleAlertIcon className={iconStroke} /> },\n info: { color: \"neutral\", icon: <InfoIcon className={iconStroke} /> },\n loading: { color: \"neutral\", icon: <Spinner size=\"md\" label={null} /> },\n}\n\nexport type NotificationIconSlot = ToastType | \"close\" | \"collapse\"\n/**\n * The card's icons: one per status `type` (`success`, `error`, `warning`,\n * `info`, `loading`), the close ×, and the collapse chevron, which turns half\n * a turn while the card is folded. A toast's own `icon` still wins over its\n * status icon.\n */\nexport type NotificationIcons = IconMap<NotificationIconSlot>\n\nexport const DEFAULT_ICONS: Record<NotificationIconSlot, ReactNode> = {\n success: TOAST_STATUS.success.icon,\n error: TOAST_STATUS.error.icon,\n warning: TOAST_STATUS.warning.icon,\n info: TOAST_STATUS.info.icon,\n loading: TOAST_STATUS.loading.icon,\n close: <CloseIcon />,\n collapse: <ChevronDownIcon className={iconStroke} />,\n}\n\n/** Turns the collapse icon half a turn while the card is folded. */\nconst Turn = ({ open, children }: { open: boolean; children: ReactNode }) => (\n <span\n data-open={open}\n className=\"inline-flex transition-transform data-[open=true]:rotate-0 data-[open=false]:rotate-180\"\n >\n {children}\n </span>\n)\n\nexport type NotificationRootProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Accent palette. Drives the `--c-*` slot vars for the whole toast. */\n color?: Color\n /** Forwarded to the underlying element (used by Presence for enter/exit). */\n ref?: Ref<HTMLDivElement>\n }\n\nconst Root = ({ className, color, testId, ...rest }: NotificationRootProps) => (\n <ark.div\n data-color={color}\n className={cn(notificationRoot(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** Leading-glyph slot. Inherits the Root's text color (the `color` hue) and\n * sizes any child svg to match the text.\n * Exported (like the parts below) so `Alert` reuses it as-is — these are\n * width-agnostic, so nothing about them is toast-specific. */\nexport const Icon = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"span\"> & WithTestId) => (\n <span\n className={cn(\"inline-flex [&_svg]:size-5\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Title = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\"text-sm font-bold\", TEXT_COLOR_CLASSES.primary, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Description = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\n \"mt-1 text-sm font-normal text-brand-900/70 opacity-90 dark:text-white/80\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const ActionTrigger = ({\n className,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n className={cn(\n \"inline-flex h-7 cursor-pointer items-center rounded-input px-2 text-xs font-medium\",\n \"border border-current/30 hover:bg-current/10\",\n focusStyles({ ring: \"palette\", offset: false }),\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** The card's control names. `closeTriggerLabel` follows Ark's own Toast key. The ready-made\n * card takes them as `translations`; the compound parts (`CloseTrigger`, `CollapseTrigger`)\n * default to the same English names and take a plain `aria-label` to override. */\nexport type NotificationTranslations = {\n /** The close (×) button. Default `\"Dismiss\"`. */\n closeTriggerLabel?: string\n /** The collapse chevron while the card is open. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** The collapse chevron while the card is folded. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\n/** The one source of the card's English names: the compound parts' defaults, and the base the\n * ready-made card (and `Alert`, `<Notifications>`) merge a partial override onto. */\nexport const NOTIFICATION_DEFAULT_TRANSLATIONS = {\n closeTriggerLabel: \"Dismiss\",\n collapseLabel: \"Collapse\",\n expandLabel: \"Expand\",\n} as const satisfies Required<NotificationTranslations>\n\n/** The close and collapse buttons share one look: a small round control resting at 70%. */\nconst triggerClass = [\n \"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center\",\n \"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4\",\n focusStyles({ ring: \"palette\", offset: false }),\n // The button rests at 70% opacity, which would fade its ring with it.\n \"focus-visible:opacity-100\",\n \"transition-colors\",\n]\n\nexport const CloseTrigger = ({\n className,\n children,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n aria-label={NOTIFICATION_DEFAULT_TRANSLATIONS.closeTriggerLabel}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? DEFAULT_ICONS.close}\n </button>\n)\n\n/**\n * The chevron that folds the card's description and action rows away — the\n * collapse counterpart to `CloseTrigger`, and what the ready-made card renders\n * for `withCollapse`.\n *\n * It is presentational only: `open` drives the label, `aria-expanded` and the\n * chevron's rotation, but the state itself belongs to the caller. The button\n * owns the layout, the opacity and any `className`; the default icon carries\n * nothing but its rotation, so passing a `className` tints or spaces the\n * control once rather than twice.\n */\nexport const CollapseTrigger = ({\n className,\n children,\n type,\n open,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId & { open: boolean }) => (\n <button\n type={type ?? \"button\"}\n aria-label={\n open\n ? NOTIFICATION_DEFAULT_TRANSLATIONS.collapseLabel\n : NOTIFICATION_DEFAULT_TRANSLATIONS.expandLabel\n }\n aria-expanded={open}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? <Turn open={open}>{DEFAULT_ICONS.collapse}</Turn>}\n </button>\n)\n\n/**\n * Props for the ready-made `Notification` card. The presentational fields it\n * shares with a spawned toast (`type` / `title` / `description` / `action` /\n * `color` / `icon` / `withCloseButton`) plus its own collapse controls;\n * the Notifier-managed plumbing (`id` / `status` / `duration`) is optional, so a\n * standalone card is just `<Notification type=\"success\" title=\"Saved\" />`.\n */\nexport type NotificationProps = Omit<NotificationRootProps, \"title\" | \"color\" | \"asChild\"> &\n ForbidAsChild &\n Omit<ToastFields, \"id\" | \"status\" | \"duration\"> &\n Partial<Pick<ToastFields, \"id\" | \"status\" | \"duration\">> &\n ToastHue & {\n /** Invoked when the close (×) button is pressed. */\n onClose?: () => void\n /** Swap the close (×) button for a chevron that folds the description and\n * action rows away. `withCloseButton` takes precedence over this. */\n withCollapse?: boolean\n /** Uncontrolled initial open state — collapsed by default when `withCollapse`,\n * open otherwise. Pair with `withCollapse`. */\n defaultOpen?: boolean\n /** Controlled open state — pair with `onOpenChange`. */\n open?: boolean\n /** Fired when the collapse toggle is pressed. */\n onOpenChange?: (open: boolean) => void\n /** Overrides the close and collapse buttons' accessible names. A partial override keeps\n * the other defaults. */\n translations?: NotificationTranslations\n /** Replaces the default icons: the status icons by `type`, `close` and `collapse`. A missing\n * key keeps its default; `icon` wins over the status icon, and `null` drops a status icon. */\n icons?: NotificationIcons\n }\n\n/**\n * The ready-made **`Notification` card** — the presentational body composed from\n * a toast-shaped object: resolves `type` → `TOAST_STATUS` (hue + leading icon), lets\n * an explicit `color`/`icon` override (`icon={null}` hides the glyph),\n * and lays out the icon/title/close row plus the independently-collapsing\n * description and action sections.\n *\n * Owns no store, presence or gesture state — the Notifier's render body drives\n * it by forwarding a `ref`, stacking style vars, pointer handlers and `onClose`\n * straight through to the `Root`. Rendered on its own it is just a status card\n * (e.g. a page-level alert). For a bespoke layout, compose the parts directly:\n * `Notification.Root`, `.Icon`, `.Title`, `.Description`, `.ActionTrigger`,\n * `.CloseTrigger`.\n *\n * **Announcements are the toaster's job, not the card's.** A toast spawned\n * through `createNotifier` is its own live region: `role=\"status\"`, or\n * `role=\"alert\"` for an `error`, set by the notifier as it renders the card.\n * A standalone card carries no role: rendered with the page it is content to\n * read, not news, and a live region there would only re-announce whatever it\n * holds on every mount. A card you insert in response to an event *is* news:\n * pass the role yourself (`role=\"status\"`, or `role=\"alert\"` for a failure)\n * and it lands on the `Root`, or mount it into a region that's already live.\n */\nfunction NotificationComponent({\n type,\n title,\n description,\n action,\n color: _color,\n icon: _icon,\n withCloseButton = true,\n withCollapse = false,\n defaultOpen,\n open: _open,\n onOpenChange,\n onClose,\n translations,\n icons: iconsProp,\n // Notifier-managed plumbing — not rendered onto the card.\n status: _status,\n duration: _duration,\n asChild: _asChild,\n ...rest\n}: NotificationProps) {\n const resolvedTranslations = { ...NOTIFICATION_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // `type` and `color` are exclusive (see `ToastHue`), and testing the destructured `type`\n // narrows `color` with it: no cast. The preset wins should a JS caller pass both anyway.\n const color = type === undefined ? _color : TOAST_STATUS[type].color\n // Not `??`: an explicit `icon={null}` (hide the glyph) must not fall\n // through to the preset the way an omitted (`undefined`) icon does.\n const icon = _icon === undefined ? type && icons[type] : _icon\n\n const [open, setOpen] = useUncontrolled({\n defaultValue: defaultOpen,\n value: _open,\n finalValue: match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => true)\n .with({ withCollapse: true }, () => false)\n .with({ withCollapse: false }, () => true)\n .exhaustive(),\n onChange: onOpenChange,\n })\n\n // Keep the last-present description / action mounted through their collapse so\n // each reveal has content to animate *out* (removed content unmounts instantly\n // otherwise). Cached independently so the two sections animate separately.\n const lastDescription = useRef(description)\n if (description != null) lastDescription.current = description\n const lastAction = useRef(action)\n if (action != null) lastAction.current = action\n\n return (\n <Root color={color} {...rest}>\n <div className=\"flex flex-row gap-3\">\n {icon != null && <Icon>{icon}</Icon>}\n {title != null && <Title>{title}</Title>}\n {match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => (\n <CloseTrigger aria-label={resolvedTranslations.closeTriggerLabel} onClick={onClose}>\n {icons.close}\n </CloseTrigger>\n ))\n .with({ withCollapse: true }, () => (\n <CollapseTrigger\n open={open}\n aria-label={\n open ? resolvedTranslations.collapseLabel : resolvedTranslations.expandLabel\n }\n onClick={() => setOpen(!open)}\n >\n <Turn open={open}>{icons.collapse}</Turn>\n </CollapseTrigger>\n ))\n .with({ withCollapse: false }, () => null)\n .exhaustive()}\n </div>\n {/* Description and action are independent Collapse sections. */}\n <Collapse open={description != null && open}>\n <Description>{description ?? lastDescription.current}</Description>\n </Collapse>\n <Collapse open={action != null && open}>\n <div className=\"mt-2 flex flex-wrap items-center gap-2\">{action ?? lastAction.current}</div>\n </Collapse>\n </Root>\n )\n}\n\n/**\n * `Notification` — the ready-made card (batteries-included), with the compound\n * parts attached for bespoke composition. Mirrors `Tooltip`/`Modal`: the bare\n * name is the convenience form; `.Root` and friends are the primitives.\n */\nexport const Notification = Object.assign(NotificationComponent, {\n Root,\n Icon,\n Title,\n Description,\n ActionTrigger,\n CloseTrigger,\n CollapseTrigger,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/notification/notification.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmDO,IAAM,mBAAA,GAAsB;AAAA,EACjC,qCAAA;AAAA,EACA;AACF,CAAA;AAMO,IAAM,mBAAmB,GAAA,CAAI;AAAA,EAClC,0EAAA;AAAA,EACA,iEAAA;AAAA;AAAA,EAEA,mCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA,EAGA,oBAAA;AAAA,EACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,EAC7B,8CAAA;AAAA,EACA,8CAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,YAAA,GAAqE;AAAA,EAChF,OAAA,EAAS,EAAE,KAAA,EAAO,OAAA,EAAS,sBAAM,GAAA,CAAC,eAAA,EAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,CAAA,EAAG;AAAA,EAC5E,KAAA,EAAO,EAAE,KAAA,EAAO,KAAA,EAAO,sBAAM,GAAA,CAAC,eAAA,EAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,CAAA,EAAG;AAAA,EACxE,OAAA,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AAA,EAAc,IAAA,EAAK,EAAG,sBAC5B,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,IAAA;AAAA,UACA,YAAA,EACE,IAAA,GAAO,oBAAA,CAAqB,aAAA,GAAgB,oBAAA,CAAqB,WAAA;AAAA,UAEnE,OAAA,EAAS,MAAM,OAAA,CAAQ,CAAC,IAAI,CAAA;AAAA,UAE5B,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAa,QAAA,EAAA,KAAA,CAAM,QAAA,EAAS;AAAA;AAAA,OAErC,CAAA,CACA,IAAA,CAAK,EAAE,YAAA,EAAc,OAAM,EAAG,MAAM,IAAI,CAAA,CACxC,UAAA;AAAW,KAAA,EAChB,CAAA;AAAA,oBAEA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,WAAA,IAAe,IAAA,IAAQ,IAAA,EACrC,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAa,QAAA,EAAA,WAAA,IAAe,eAAA,CAAgB,OAAA,EAAQ,CAAA,EACvD,CAAA;AAAA,oBACA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,MAAA,IAAU,IAAA,IAAQ,IAAA,EAChC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wCAAA,EAA0C,QAAA,EAAA,MAAA,IAAU,UAAA,CAAW,SAAQ,CAAA,EACxF;AAAA,GAAA,EACF,CAAA;AAEJ;AAOO,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAC","file":"chunk-LKFHUDEW.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n AlertCircleIcon,\n CheckCircleIcon,\n ChevronDownIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, type Ref, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { Spinner } from \"../spinner/spinner\"\nimport type { ToastFields, ToastHue, ToastType } from \"./types\"\n\n/**\n * Notification — the kit's **toast**: transient, non-blocking feedback spawned\n * imperatively from anywhere (`notify.success(\"Saved\")`) via `createNotifier`.\n *\n * This module holds the *visual* compound (`Notification.Root` / `Icon` /\n * `Title` / `Description` / `ActionTrigger` / `CloseTrigger` /\n * `CollapseTrigger`) and the ready-made `Notification` card composed from a\n * toast-shaped object (`type` → hue + icon, `title` / `description` /\n * `action`). It is deliberately dumb: the toaster behavior that drives it —\n * store, presence, height measurement, swipe-to-dismiss, stacking — lives in\n * `store.ts` / `create-notifier.tsx`, so the card is equally usable on its own\n * (e.g. a page-level alert).\n *\n * The surface is a single outline recipe; `color` (a `data-color` attribute\n * resolved to the `--c-*` slot vars) is the only styling axis. Status presets\n * map a `type` onto a hue + a leading icon.\n * Enter/exit is driven by Ark Presence → `data-state` → the `toast-in/out`\n * keyframes (like modal/drawer/popover).\n */\n\n/** The outline surface. Deliberately opaque and blurred: a toast floats over\n * arbitrary content. `Alert` (the inline sibling) shares the parts but not\n * this surface — it sits on the page and takes a translucent tint instead.\n * `color` tints the border, text and icon through `--c-solid`. */\nexport const notificationSurface = [\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"text-(--c-solid) border-(--c-solid) backdrop-blur-lg\",\n]\n\n/** The toast card. Enter/exit via `data-state` keyframes (Ark Presence sets\n * `data-state`); stacking position via the `[data-scope=notifications]` rules\n * in theme.css (driven by the `--index`/`--offset`/`--height` vars the toaster\n * sets on each card — see create-notifier). */\nexport const notificationRoot = cva([\n \"data-[state=open]:animate-toast-in data-[state=closed]:animate-toast-out\",\n \"pointer-events-auto flex flex-col w-88 max-w-[calc(100vw-2rem)]\",\n // Phones (< xs): fill the full-bleed bottom region (see createNotifier).\n \"max-xs:w-full! max-xs:max-w-none!\",\n \"rounded-card border px-3 py-3\",\n // Any-focus outline suppression, matching the other overlay surfaces\n // (Modal, Drawer, Popover, Tooltip) — the card can take programmatic focus.\n \"focus:outline-none\",\n focusStyles({ offset: false }),\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"shadow-2xl shadow-white dark:shadow-black/80\",\n \"overflow-clip\",\n notificationSurface,\n])\n\n/** `type` → hue + default leading icon. There are no status color *tokens* in\n * the kit — status maps onto existing hues, reusing the same `--c-*` slots as\n * Badge/Button. `loading` uses the kit Spinner. Exported so `Alert` (which\n * drops the toast-only `loading` type) resolves the same presets. */\nexport const TOAST_STATUS: Record<ToastType, { color: Color; icon: ReactNode }> = {\n success: { color: \"green\", icon: <CheckCircleIcon className={iconStroke} /> },\n error: { color: \"red\", icon: <AlertCircleIcon className={iconStroke} /> },\n warning: { color: \"orange\", icon: <TriangleAlertIcon className={iconStroke} /> },\n info: { color: \"neutral\", icon: <InfoIcon className={iconStroke} /> },\n loading: { color: \"neutral\", icon: <Spinner size=\"md\" label={null} /> },\n}\n\nexport type NotificationIconSlot = ToastType | \"close\" | \"collapse\"\n/**\n * The card's icons: one per status `type` (`success`, `error`, `warning`,\n * `info`, `loading`), the close ×, and the collapse chevron, which turns half\n * a turn while the card is folded. A toast's own `icon` still wins over its\n * status icon.\n */\nexport type NotificationIcons = IconMap<NotificationIconSlot>\n\nexport const DEFAULT_ICONS: Record<NotificationIconSlot, ReactNode> = {\n success: TOAST_STATUS.success.icon,\n error: TOAST_STATUS.error.icon,\n warning: TOAST_STATUS.warning.icon,\n info: TOAST_STATUS.info.icon,\n loading: TOAST_STATUS.loading.icon,\n close: <CloseIcon />,\n collapse: <ChevronDownIcon className={iconStroke} />,\n}\n\n/** Turns the collapse icon half a turn while the card is folded. */\nconst Turn = ({ open, children }: { open: boolean; children: ReactNode }) => (\n <span\n data-open={open}\n className=\"inline-flex transition-transform data-[open=true]:rotate-0 data-[open=false]:rotate-180\"\n >\n {children}\n </span>\n)\n\nexport type NotificationRootProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Accent palette. Drives the `--c-*` slot vars for the whole toast. */\n color?: Color\n /** Forwarded to the underlying element (used by Presence for enter/exit). */\n ref?: Ref<HTMLDivElement>\n }\n\nconst Root = ({ className, color, testId, ...rest }: NotificationRootProps) => (\n <ark.div\n data-color={color}\n className={cn(notificationRoot(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** Leading-glyph slot. Inherits the Root's text color (the `color` hue) and\n * sizes any child svg to match the text.\n * Exported (like the parts below) so `Alert` reuses it as-is — these are\n * width-agnostic, so nothing about them is toast-specific. */\nexport const Icon = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"span\"> & WithTestId) => (\n <span\n className={cn(\"inline-flex [&_svg]:size-5\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Title = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\"text-sm font-bold\", TEXT_COLOR_CLASSES.primary, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Description = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\n \"mt-1 text-sm font-normal text-brand-900/70 opacity-90 dark:text-white/80\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const ActionTrigger = ({\n className,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n className={cn(\n \"inline-flex h-7 cursor-pointer items-center rounded-input px-2 text-xs font-medium\",\n \"border border-current/30 hover:bg-current/10\",\n focusStyles({ ring: \"palette\", offset: false }),\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** The card's control names. `closeTriggerLabel` follows Ark's own Toast key. The ready-made\n * card takes them as `translations`; the compound parts (`CloseTrigger`, `CollapseTrigger`)\n * default to the same English names and take a plain `aria-label` to override. */\nexport type NotificationTranslations = {\n /** The close (×) button. Default `\"Dismiss\"`. */\n closeTriggerLabel?: string\n /** The collapse chevron while the card is open. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** The collapse chevron while the card is folded. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\n/** The one source of the card's English names: the compound parts' defaults, and the base the\n * ready-made card (and `Alert`, `<Notifications>`) merge a partial override onto. */\nexport const NOTIFICATION_DEFAULT_TRANSLATIONS = {\n closeTriggerLabel: \"Dismiss\",\n collapseLabel: \"Collapse\",\n expandLabel: \"Expand\",\n} as const satisfies Required<NotificationTranslations>\n\n/** The close and collapse buttons share one look: a small round control resting at 70%. */\nconst triggerClass = [\n \"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center\",\n \"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4\",\n focusStyles({ ring: \"palette\", offset: false }),\n // The button rests at 70% opacity, which would fade its ring with it.\n \"focus-visible:opacity-100\",\n \"transition-colors\",\n]\n\nexport const CloseTrigger = ({\n className,\n children,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n aria-label={NOTIFICATION_DEFAULT_TRANSLATIONS.closeTriggerLabel}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? DEFAULT_ICONS.close}\n </button>\n)\n\n/**\n * The chevron that folds the card's description and action rows away — the\n * collapse counterpart to `CloseTrigger`, and what the ready-made card renders\n * for `withCollapse`.\n *\n * It is presentational only: `open` drives the label, `aria-expanded` and the\n * chevron's rotation, but the state itself belongs to the caller. The button\n * owns the layout, the opacity and any `className`; the default icon carries\n * nothing but its rotation, so passing a `className` tints or spaces the\n * control once rather than twice.\n */\nexport const CollapseTrigger = ({\n className,\n children,\n type,\n open,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId & { open: boolean }) => (\n <button\n type={type ?? \"button\"}\n aria-label={\n open\n ? NOTIFICATION_DEFAULT_TRANSLATIONS.collapseLabel\n : NOTIFICATION_DEFAULT_TRANSLATIONS.expandLabel\n }\n aria-expanded={open}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? <Turn open={open}>{DEFAULT_ICONS.collapse}</Turn>}\n </button>\n)\n\n/**\n * Props for the ready-made `Notification` card. The presentational fields it\n * shares with a spawned toast (`type` / `title` / `description` / `action` /\n * `color` / `icon` / `withCloseButton`) plus its own collapse controls;\n * the Notifier-managed plumbing (`id` / `status` / `duration`) is optional, so a\n * standalone card is just `<Notification type=\"success\" title=\"Saved\" />`.\n */\nexport type NotificationProps = Omit<NotificationRootProps, \"title\" | \"color\" | \"asChild\"> &\n ForbidAsChild &\n Omit<ToastFields, \"id\" | \"status\" | \"duration\"> &\n Partial<Pick<ToastFields, \"id\" | \"status\" | \"duration\">> &\n ToastHue & {\n /** Invoked when the close (×) button is pressed. */\n onClose?: () => void\n /** Swap the close (×) button for a chevron that folds the description and\n * action rows away. `withCloseButton` takes precedence over this. */\n withCollapse?: boolean\n /** Uncontrolled initial open state — collapsed by default when `withCollapse`,\n * open otherwise. Pair with `withCollapse`. */\n defaultOpen?: boolean\n /** Controlled open state — pair with `onOpenChange`. */\n open?: boolean\n /** Fired when the collapse toggle is pressed. */\n onOpenChange?: (open: boolean) => void\n /** Overrides the close and collapse buttons' accessible names. A partial override keeps\n * the other defaults. */\n translations?: NotificationTranslations\n /** Replaces the default icons: the status icons by `type`, `close` and `collapse`. A missing\n * key keeps its default; `icon` wins over the status icon, and `null` drops a status icon. */\n icons?: NotificationIcons\n }\n\n/**\n * The ready-made **`Notification` card** — the presentational body composed from\n * a toast-shaped object: resolves `type` → `TOAST_STATUS` (hue + leading icon), lets\n * an explicit `color`/`icon` override (`icon={null}` hides the glyph),\n * and lays out the icon/title/close row plus the independently-collapsing\n * description and action sections.\n *\n * Owns no store, presence or gesture state — the Notifier's render body drives\n * it by forwarding a `ref`, stacking style vars, pointer handlers and `onClose`\n * straight through to the `Root`. Rendered on its own it is just a status card\n * (e.g. a page-level alert). For a bespoke layout, compose the parts directly:\n * `Notification.Root`, `.Icon`, `.Title`, `.Description`, `.ActionTrigger`,\n * `.CloseTrigger`.\n *\n * **Announcements are the toaster's job, not the card's.** A toast spawned\n * through `createNotifier` is its own live region: `role=\"status\"`, or\n * `role=\"alert\"` for an `error`, set by the notifier as it renders the card.\n * A standalone card carries no role: rendered with the page it is content to\n * read, not news, and a live region there would only re-announce whatever it\n * holds on every mount. A card you insert in response to an event *is* news:\n * pass the role yourself (`role=\"status\"`, or `role=\"alert\"` for a failure)\n * and it lands on the `Root`, or mount it into a region that's already live.\n */\nfunction NotificationComponent({\n type,\n title,\n description,\n action,\n color: _color,\n icon: _icon,\n withCloseButton = true,\n withCollapse = false,\n defaultOpen,\n open: _open,\n onOpenChange,\n onClose,\n translations,\n icons: iconsProp,\n // Notifier-managed plumbing — not rendered onto the card.\n status: _status,\n duration: _duration,\n asChild: _asChild,\n ...rest\n}: NotificationProps) {\n const resolvedTranslations = { ...NOTIFICATION_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // `type` and `color` are exclusive (see `ToastHue`), and testing the destructured `type`\n // narrows `color` with it: no cast. The preset wins should a JS caller pass both anyway.\n const color = type === undefined ? _color : TOAST_STATUS[type].color\n // Not `??`: an explicit `icon={null}` (hide the glyph) must not fall\n // through to the preset the way an omitted (`undefined`) icon does.\n const icon = _icon === undefined ? type && icons[type] : _icon\n\n const [open, setOpen] = useUncontrolled({\n defaultValue: defaultOpen,\n value: _open,\n finalValue: match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => true)\n .with({ withCollapse: true }, () => false)\n .with({ withCollapse: false }, () => true)\n .exhaustive(),\n onChange: onOpenChange,\n })\n\n // Keep the last-present description / action mounted through their collapse so\n // each reveal has content to animate *out* (removed content unmounts instantly\n // otherwise). Cached independently so the two sections animate separately.\n const lastDescription = useRef(description)\n if (description != null) lastDescription.current = description\n const lastAction = useRef(action)\n if (action != null) lastAction.current = action\n\n return (\n <Root color={color} {...rest}>\n <div className=\"flex flex-row gap-3\">\n {icon != null && <Icon>{icon}</Icon>}\n {title != null && <Title>{title}</Title>}\n {match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => (\n <CloseTrigger aria-label={resolvedTranslations.closeTriggerLabel} onClick={onClose}>\n {icons.close}\n </CloseTrigger>\n ))\n .with({ withCollapse: true }, () => (\n <CollapseTrigger\n open={open}\n aria-label={\n open ? resolvedTranslations.collapseLabel : resolvedTranslations.expandLabel\n }\n onClick={() => setOpen(!open)}\n >\n <Turn open={open}>{icons.collapse}</Turn>\n </CollapseTrigger>\n ))\n .with({ withCollapse: false }, () => null)\n .exhaustive()}\n </div>\n {/* Description and action are independent Collapse sections. */}\n <Collapse open={description != null && open}>\n <Description>{description ?? lastDescription.current}</Description>\n </Collapse>\n <Collapse open={action != null && open}>\n <div className=\"mt-2 flex flex-wrap items-center gap-2\">{action ?? lastAction.current}</div>\n </Collapse>\n </Root>\n )\n}\n\n/**\n * `Notification` — the ready-made card (batteries-included), with the compound\n * parts attached for bespoke composition. Mirrors `Tooltip`/`Modal`: the bare\n * name is the convenience form; `.Root` and friends are the primitives.\n */\nexport const Notification = Object.assign(NotificationComponent, {\n Root,\n Icon,\n Title,\n Description,\n ActionTrigger,\n CloseTrigger,\n CollapseTrigger,\n})\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { inputSlot, inputShell, inputControlClasses } from './chunk-
|
|
2
|
-
import { scrollHighlightedIntoView, popoverChevron, popoverClearTrigger, popoverList, popoverContent, popoverIndicator, popoverOption, popoverGroupLabel, popoverEmpty } from './chunk-
|
|
1
|
+
import { inputSlot, inputShell, inputControlClasses } from './chunk-45QRQKRC.js';
|
|
2
|
+
import { scrollHighlightedIntoView, popoverChevron, popoverClearTrigger, popoverList, popoverContent, popoverIndicator, popoverOption, popoverGroupLabel, popoverEmpty } from './chunk-5HUEBSIS.js';
|
|
3
3
|
import { useOverlayContainer } from './chunk-7P32XCEU.js';
|
|
4
4
|
import { useNestedLayer } from './chunk-H7WOMZXO.js';
|
|
5
|
-
import { ChevronIcon, CloseIcon, CheckIcon } from './chunk-
|
|
5
|
+
import { ChevronIcon, CloseIcon, CheckIcon } from './chunk-6YNLRQ25.js';
|
|
6
6
|
import { composeChildren } from './chunk-R5LYFTHA.js';
|
|
7
7
|
import { props } from './chunk-WYCMIIRR.js';
|
|
8
|
-
import { cn } from './chunk-
|
|
8
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
9
9
|
import { Combobox as Combobox$1, useComboboxContext } from '@ark-ui/react/combobox';
|
|
10
10
|
import { Portal } from '@ark-ui/react/portal';
|
|
11
11
|
import { createContext, useContext } from 'react';
|
|
@@ -181,5 +181,5 @@ var Combobox = {
|
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
export { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox, resolveComboboxTranslations };
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
185
|
-
//# sourceMappingURL=chunk-
|
|
184
|
+
//# sourceMappingURL=chunk-MKKQE3TM.js.map
|
|
185
|
+
//# sourceMappingURL=chunk-MKKQE3TM.js.map
|