@42-central/ui-react 0.20.0 → 0.20.2
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-P276SCCV.js → chunk-2BNIHOMT.js} +6 -6
- package/dist/{chunk-P276SCCV.js.map → chunk-2BNIHOMT.js.map} +1 -1
- 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-VVM7JMZS.js → chunk-37VQGKD6.js} +8 -8
- package/dist/{chunk-VVM7JMZS.js.map → chunk-37VQGKD6.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-FZNPJAGJ.js → chunk-45TG7H5Q.js} +5 -5
- package/dist/{chunk-FZNPJAGJ.js.map → chunk-45TG7H5Q.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-WFHY6NRQ.js → chunk-5CNVVA7I.js} +11 -11
- package/dist/{chunk-WFHY6NRQ.js.map → chunk-5CNVVA7I.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-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-LSIX2PVU.js → chunk-C74TV64U.js} +7 -7
- package/dist/{chunk-LSIX2PVU.js.map → chunk-C74TV64U.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-H7INUXZD.js → chunk-F342ZT7O.js} +4 -4
- package/dist/{chunk-H7INUXZD.js.map → chunk-F342ZT7O.js.map} +1 -1
- package/dist/{chunk-KOT4PWGE.js → chunk-FDCPMUJK.js} +6 -6
- package/dist/{chunk-KOT4PWGE.js.map → chunk-FDCPMUJK.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-WR444JRU.js → chunk-HQPU73WV.js} +7 -7
- package/dist/{chunk-WR444JRU.js.map → chunk-HQPU73WV.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-HBFN5W7Q.js → chunk-JVG5ISPT.js} +4 -4
- package/dist/{chunk-HBFN5W7Q.js.map → chunk-JVG5ISPT.js.map} +1 -1
- package/dist/{chunk-JL4QMM46.js → chunk-LFQDB5OD.js} +5 -5
- package/dist/{chunk-JL4QMM46.js.map → chunk-LFQDB5OD.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-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-ZN3WYGIQ.js → chunk-N66NC6QK.js} +121 -25
- package/dist/chunk-N66NC6QK.js.map +1 -0
- 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-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-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-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-DHTSVJ4G.js → chunk-UCCJUFOG.js} +9 -9
- package/dist/{chunk-DHTSVJ4G.js.map → chunk-UCCJUFOG.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-6KER77RS.js → chunk-UVQXRDRO.js} +7 -7
- package/dist/{chunk-6KER77RS.js.map → chunk-UVQXRDRO.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-V6PY7C6S.js +18 -0
- package/dist/chunk-V6PY7C6S.js.map +1 -0
- 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-7AWOMWCQ.js → chunk-WXL5RP6P.js} +7 -7
- package/dist/{chunk-7AWOMWCQ.js.map → chunk-WXL5RP6P.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/{chunk-2OQP7UY4.js → chunk-YZJUPYPO.js} +5 -5
- package/dist/{chunk-2OQP7UY4.js.map → chunk-YZJUPYPO.js.map} +1 -1
- package/dist/{chunk-JYK6JVR3.js → chunk-Z4MBCKG5.js} +8 -8
- package/dist/{chunk-JYK6JVR3.js.map → chunk-Z4MBCKG5.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 +7 -6
- package/dist/components/autocomplete/index.js.map +1 -1
- 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 +15 -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 +7 -7
- package/dist/components/code-block/index.js +8 -8
- 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 +7 -6
- package/dist/components/combobox-list/index.js +9 -8
- package/dist/components/compare/index.js +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/data-table/index.js +33 -33
- package/dist/components/date-picker/index.js +16 -15
- package/dist/components/date-picker/index.js.map +1 -1
- 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/hover-card.d.ts +44 -26
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +36 -54
- package/dist/components/hover-card/index.js.map +1 -1
- 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 +5 -5
- package/dist/components/modal/index.js +6 -6
- package/dist/components/multi-combobox-list/index.js +11 -10
- package/dist/components/multi-select/index.js +10 -9
- package/dist/components/multi-select/index.js.map +1 -1
- 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 +7 -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 +18 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- 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.d.ts +1 -1
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/index.js +3 -2
- package/dist/components/popover/popover.d.ts +44 -29
- package/dist/components/popover/popover.d.ts.map +1 -1
- 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 +10 -10
- package/dist/components/segment-group/index.js +3 -3
- package/dist/components/select/index.js +8 -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 +16 -15
- package/dist/components/spotlight/index.js.map +1 -1
- 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 +9 -8
- package/dist/components/tags-input/index.js.map +1 -1
- 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 +9 -8
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/title/index.js +2 -2
- package/dist/components/tooltip/index.js +4 -4
- package/dist/components/tree-multi-select/index.js +11 -10
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-select/index.js +8 -7
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +1 -1
- package/dist/lib/placement.d.ts +42 -1
- package/dist/lib/placement.d.ts.map +1 -1
- package/dist/lib/slide-on-switch.d.ts +69 -0
- package/dist/lib/slide-on-switch.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/card/card.test.tsx +10 -0
- package/src/components/card/card.tsx +4 -1
- package/src/components/hover-card/hover-card.tsx +89 -167
- package/src/components/popover/index.ts +2 -0
- package/src/components/popover/popover.test.tsx +131 -0
- package/src/components/popover/popover.tsx +191 -53
- package/src/lib/cn.test.ts +9 -0
- package/src/lib/cn.ts +9 -1
- package/src/lib/placement.test.ts +37 -0
- package/src/lib/placement.ts +60 -1
- package/src/lib/slide-on-switch.ts +99 -0
- package/dist/chunk-G52U24GR.js +0 -10
- package/dist/chunk-G52U24GR.js.map +0 -1
- package/dist/chunk-QP4I37PA.js +0 -14
- package/dist/chunk-QP4I37PA.js.map +0 -1
- package/dist/chunk-Z5WYYDG2.js.map +0 -1
- package/dist/chunk-ZN3WYGIQ.js.map +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AAA;AAAA,UACH,eAAA,EAAiB,QAAA,CAAS,SAAA,GAAY,MAAA,GAAY,QAAQ,eAAe,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKzE,WAAA,EAAa,CAAC,KAAA,KAAqB,KAAA,CAAM,cAAA;AAAe,SAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,EAAE,GAAG,KAAA,CAAM,EAAE,eAAe,MAAA,EAAQ,CAAA,EAAG,GAAG,IAAA,EAAM,SAAA,EAAW,EAAA,CAAG,aAAA,EAAe,SAAS,CAAA;AAAE,OAC1F;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;AAGO,IAAM,iBAAiBA,IAAA,CAAQ;AAC/B,IAAM,YAAYA,IAAA,CAAQ;AAC1B,IAAM,UAAUA,IAAA,CAAQ;AAExB,IAAM,SAAA,GAAY;AAElB,IAAM,UAAA,GAAa","file":"chunk-KOT4PWGE.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react/factory\"\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Menu as ArkMenu, useMenuContext } from \"@ark-ui/react/menu\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { usePresenceContext } from \"@ark-ui/react/presence\"\nimport { mergeProps } from \"@ark-ui/react/utils\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type DragEvent,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { warnRenamedProp } from \"../../lib/dev-warn\"\nimport { type IconMap, mergeIcons } from \"../../lib/icons\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { CheckIcon, ChevronRightIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverChrome,\n popoverGroupLabel,\n popoverIndicator,\n} from \"../popover/popover\"\n\n/**\n * Menu — the kit's dropdown of actions, a styled layer over Ark UI's Menu.\n * It's the click-triggered sibling of `Popover` (a free-form panel): Ark's Menu\n * machine wires roving focus, type-ahead, `role=\"menu\"` / `menuitem`,\n * `aria-haspopup` / `aria-expanded`, submenus, and checkbox / radio selection.\n *\n * Two ways to use it — the compound parts (this file) give full control; the\n * data-driven `<Menu data={…}>` convenience (see `menu-data.tsx`) covers the\n * common action-menu case and is built on these very parts.\n *\n * <Menu.Root>\n * <Menu.Trigger asChild><Button>Open</Button></Menu.Trigger>\n * <Menu.Content>\n * <Menu.Item startSection={<User />} onClick={openProfile}>Profile</Menu.Item>\n * <Menu.Divider />\n * <Menu.Item color=\"red\" startSection={<Trash />} onClick={remove}>Delete</Menu.Item>\n * </Menu.Content>\n * </Menu.Root>\n *\n * Portaled by default (escapes `overflow:hidden` ancestors), sized to content,\n * and animated via the kit's shared `popover-in/out` tokens.\n */\n\n/** Menu surface — the shared floating chrome, sized to content and scrollable\n * when tall. Unlike the form pickers' `popoverContent` (an `overflow-hidden`\n * clip around a nested scroller) a Menu scrolls natively, so Ark needs no\n * `scrollToIndexFn` workaround. */\nconst menuContent = cn(\n popoverChrome,\n \"flex w-max min-w-40 flex-col p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))] overflow-y-auto overscroll-contain\",\n)\n\n/** A single menu row — shared by `Item`, `CheckboxItem`, `RadioItem`, and\n * `SubTrigger` so every row is visually identical. Mirrors `popoverOption`'s\n * neutral look, but the `colored` variant swaps the text + highlight tints to\n * the palette slot vars (`--c-text` / `--c-soft`) resolved from `data-color` —\n * e.g. a red \"Delete\". Highlight is `data-highlighted`, selection is\n * `data-[state=checked]`, disabled is `data-disabled`, all owned by Ark. */\nconst menuItem = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-xs px-2.5 py-1.5 text-md\",\n \"select-none outline-none\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n colored: {\n // Neutral highlight is transparent — a low-opacity black/white wash,\n // not an opaque gray — matching the surface's own background-dependent\n // tint (no Figma reference for this state yet).\n false: [\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n ],\n // Slot vars already shift by theme (colors.css), so no `dark:` needed.\n true: [\"text-(--c-text)\", \"data-highlighted:bg-(--c-soft)\"],\n },\n },\n defaultVariants: { colored: false },\n },\n)\n\n/** Hairline between groups of items. Same shade as Popover's own\n * Header/Footer/Body slotEdge dividers (brand-900/20 / white/15) — both are\n * separator lines on the identical popoverChrome panel, so they shouldn't\n * drift to different weights. */\nconst menuDivider = \"-mx-1 my-1 h-px border-0 bg-brand-900/20 dark:bg-white/15\"\n\ntype MenuPlacement = NonNullable<NonNullable<ArkMenu.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type MenuPosition = LogicalPosition<MenuPlacement>\n\nexport type MenuIconSlot = \"check\" | \"radio\" | \"submenu\"\nexport type MenuIcons = IconMap<MenuIconSlot>\n\n/**\n * The default icons: the checkbox item's check, the radio item's dot, and the\n * submenu trigger's chevron. The chevron points to where the submenu opens, the\n * inline end, so it mirrors under RTL; a consumer's icon is drawn as given.\n * The dot is a filled glyph, so it takes no `iconStroke`.\n */\nexport const DEFAULT_ICONS: Record<MenuIconSlot, ReactNode> = {\n check: <CheckIcon />,\n radio: (\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"5\" />\n </svg>\n ),\n submenu: <ChevronRightIcon className=\"rtl:-scale-x-100\" />,\n}\n\ntype MenuContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n icons: Record<MenuIconSlot, ReactNode>\n}\nconst MenuContext = createContext<MenuContextValue>({ withinPortal: true, icons: DEFAULT_ICONS })\n\nexport type MenuRootProps = Omit<ArkMenu.RootProps, \"positioning\" | \"onOpenChange\"> & {\n /** Dropdown placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`bottom-start`, `top`, …).\n * Defaults to `\"bottom\"`. */\n position?: MenuPosition\n /** Gap in px between the trigger and the dropdown. */\n offset?: number\n /** Render the dropdown in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Called when the menu opens or closes (flattened from Ark's detail object). */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, outside interaction, item selection, or a controlled `onOpenChange`. */\n onClose?: () => void\n /** Replaces the default icons: `check`, `radio`, `submenu`. Reaches every item and submenu\n * inside, drawn as given (never restroked or mirrored). */\n icons?: MenuIcons\n}\n\n/**\n * Selects a link item (`<Menu.Item asChild><Link/></Menu.Item>`) from the\n * keyboard. zag's default `navigate` dispatches `new MouseEvent(\"click\")`,\n * which doesn't bubble, so React's delegated `onClick` never sees it and a\n * router `Link` falls back to a full page load. `node.click()` dispatches a\n * bubbling click instead, which reaches the router. Deferred like zag's own,\n * so the menu settles before the navigation starts. A `navigate` prop still\n * overrides it.\n */\nconst clickLink: NonNullable<ArkMenu.RootProps[\"navigate\"]> = ({ node }) => {\n queueMicrotask(() => node.click())\n}\n\nconst Root = ({\n position = \"bottom\",\n offset,\n withinPortal = true,\n container,\n onOpenChange,\n onClose,\n icons,\n children,\n ...rest\n}: MenuRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <MenuContext.Provider\n value={{ withinPortal, container, icons: mergeIcons(DEFAULT_ICONS, icons) }}\n >\n <ArkMenu.Root\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n navigate={clickLink}\n onOpenChange={({ open }) => {\n onOpenChange?.(open)\n if (!open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuContentProps = ArkMenu.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: MenuContentProps) => {\n const { withinPortal, container } = useContext(MenuContext)\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the menu is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useMenuContext().open)\n const panel = (\n <ArkMenu.Positioner>\n <ArkMenu.Content\n className={cn(menuContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkMenu.Content>\n </ArkMenu.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\n/** Shared inline-start wrapper for a `startSlot`. Sizes a bare icon to 16px\n * (`size-4`, like Button `md` / Input / Accordion) so every row's label starts\n * on the same column whatever icon it carries. Scoped to this slot — not the\n * whole row — so SVGs in `children` / `endSlot` and the row's own indicator\n * or chevron keep their sizes. `:where()` drops the rule to zero class\n * specificity, so a size class on the icon itself (`className=\"size-5\"`) still\n * wins; Lucide's `size` prop is only an HTML attribute and does not. */\nconst StartSlot = ({ children }: { children: ReactNode }) => (\n <span className=\"inline-flex shrink-0 items-center [:where(&)_svg]:size-4\">{children}</span>\n)\n\n/** Shared inline-end wrapper for an `endSlot` (pushes it to the far edge). */\nconst EndSlot = ({ children }: { children: ReactNode }) => (\n <span className={cn(\"ms-auto inline-flex shrink-0 items-center gap-2\", TEXT_COLOR_CLASSES.muted)}>\n {children}\n </span>\n)\n\n/** A row's leading slot, plus its former `startSection` spelling. */\nexport type MenuStartSlotProps = {\n /** Content before the label (usually an icon — a bare SVG is sized to 16px;\n * a size class on the icon overrides it). */\n startSlot?: ReactNode\n /** @deprecated Renamed `startSlot`, like the rest of the kit's leading slots.\n * Removed in the next minor. `startSlot` wins when both are set. */\n startSection?: ReactNode\n}\n\n/** A row's trailing slot, plus its former `endSection` spelling. */\nexport type MenuEndSlotProps = {\n /** Content after the label, pushed to the inline-end. */\n endSlot?: ReactNode\n /** @deprecated Renamed `endSlot`, like the rest of the kit's trailing slots.\n * Removed in the next minor. `endSlot` wins when both are set. */\n endSection?: ReactNode\n}\n\n/** Warns once when a part is still given a deprecated `*Section` slot. */\nconst warnSections = (part: string, start: ReactNode, end?: ReactNode) => {\n if (start !== undefined) warnRenamedProp(`Menu.${part}`, \"startSection\", \"startSlot\")\n if (end !== undefined) warnRenamedProp(`Menu.${part}`, \"endSection\", \"endSlot\")\n}\n\nexport type MenuItemProps = Omit<ArkMenu.ItemProps, \"value\" | \"onClick\" | \"onSelect\"> &\n WithTestId &\n MenuStartSlotProps &\n MenuEndSlotProps & {\n /** Unique value — used for type-ahead + the selection detail. Auto-generated\n * when omitted (Mantine-style items need no explicit value). */\n value?: string\n /** Palette for the row — colors the label + highlight tint (e.g. `\"red\"` for a\n * destructive action). Resolved from `data-color` via the slot vars. */\n color?: Color\n /** Fires when the item is selected — on click *and* keyboard activation\n * (Enter / Space), not just a pointer click. Wraps Ark's `onSelect`. */\n onClick?: () => void\n }\n\nconst Item = ({\n value,\n startSection,\n endSection,\n startSlot = startSection,\n endSlot = endSection,\n color,\n onClick,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemProps) => {\n const autoId = useId()\n warnSections(\"Item\", startSection, endSection)\n return (\n <ArkMenu.Item\n asChild={asChild}\n value={value ?? autoId}\n onSelect={onClick}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n {endSlot != null && <EndSlot>{endSlot}</EndSlot>}\n </>\n ))}\n </ArkMenu.Item>\n )\n}\n\n/** Optional decorative leader for a section heading — the code-themed `// ` from\n * `Text`'s `prefix`. Hidden from screen readers and the clipboard\n * (`aria-hidden` + `select-none`); renders nothing when unset (off by default). */\nconst HeadingPrefix = ({ prefix }: { prefix: ReactNode }) =>\n prefix === undefined ? null : (\n <span aria-hidden=\"true\" className=\"select-none\">\n {prefix}\n </span>\n )\n\nexport type MenuLabelProps = Omit<ComponentPropsWithoutRef<\"div\">, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\n/** Standalone section heading (Mantine parity). For grouped items with proper\n * ARIA wiring, prefer `Menu.ItemGroup` + `Menu.ItemGroupLabel`. */\nconst Label = ({ className, prefix, children, testId, ...rest }: MenuLabelProps) => (\n <div className={cn(popoverGroupLabel, className)} {...props({ \"data-testid\": testId })} {...rest}>\n <HeadingPrefix prefix={prefix} />\n {children}\n </div>\n)\n\nexport type MenuItemGroupLabelProps = Omit<ArkMenu.ItemGroupLabelProps, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\nconst ItemGroupLabel = ({\n className,\n prefix,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemGroupLabelProps) => (\n <ArkMenu.ItemGroupLabel\n asChild={asChild}\n className={cn(popoverGroupLabel, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n <HeadingPrefix prefix={prefix} />\n {own}\n </>\n ))}\n </ArkMenu.ItemGroupLabel>\n)\n\nconst Divider = ({ className, testId, ...rest }: ArkMenu.SeparatorProps & WithTestId) => (\n <ArkMenu.Separator\n className={cn(menuDivider, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type MenuCheckboxItemProps = ArkMenu.CheckboxItemProps &\n WithTestId &\n MenuStartSlotProps & {\n color?: Color\n }\n\nconst CheckboxItem = ({\n startSection,\n startSlot = startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuCheckboxItemProps) => {\n const { icons } = useContext(MenuContext)\n warnSections(\"CheckboxItem\", startSection)\n return (\n <ArkMenu.CheckboxItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>{icons.check}</ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.CheckboxItem>\n )\n}\n\nexport type MenuRadioGroupProps = Omit<\n ArkMenu.RadioItemGroupProps,\n \"onValueChange\" | \"onChange\"\n> & {\n /** Called with the newly selected value (flattened from Ark's detail object). */\n onChange?: (value: string) => void\n}\n\nconst RadioGroup = ({ onChange, ...rest }: MenuRadioGroupProps) => (\n <ArkMenu.RadioItemGroup\n onValueChange={onChange ? ({ value }) => onChange(value) : undefined}\n {...rest}\n />\n)\n\nexport type MenuRadioItemProps = ArkMenu.RadioItemProps &\n WithTestId &\n MenuStartSlotProps & {\n color?: Color\n }\n\nconst RadioItem = ({\n startSection,\n startSlot = startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuRadioItemProps) => {\n const { icons } = useContext(MenuContext)\n warnSections(\"RadioItem\", startSection)\n return (\n <ArkMenu.RadioItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>{icons.radio}</ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.RadioItem>\n )\n}\n\nexport type MenuSubProps = Omit<ArkMenu.RootProps, \"positioning\"> & {\n /** Gap in px between the trigger row and the submenu. Ark manages submenu\n * *placement* itself (RTL-aware `right-start` / `left-start`, flush to the\n * parent), so only this main-axis gap is adjustable. Defaults to `10`. */\n offset?: number\n}\n\n/** A submenu opens flush to its trigger row, so its first item lands one surface\n * inset *below* the trigger — the `menuContent` top border (1px) + top padding\n * (`p-1` = 4px). Nudging the submenu up by that inset lines the first sub-item\n * up with the trigger row. Cross-axis is the vertical axis for the (Ark-forced)\n * `right-start` / `left-start` placements, and Floating UI maps a negative value\n * to \"up\" in both directions — so one constant covers LTR and RTL. */\nconst SUBMENU_ALIGN_OFFSET = -5\n\n/** Submenu root — a nested Ark Menu whose triggering row is `Menu.SubTrigger`.\n * Inherits the parent's portal settings via context (see `Menu.SubContent`).\n *\n * Ark's menu machine hard-overrides a submenu's placement and `gutter` (to `0`),\n * so a `gutter`-based offset is silently dropped. It leaves `offset` untouched,\n * and Floating UI resolves the axes as `offset.mainAxis ?? gutter` (the gap) and\n * `offset.crossAxis` (the top alignment) — so the whole `offset` object is the\n * one path that survives the override. */\nconst Sub = ({ offset = 10, children, ...rest }: MenuSubProps) => (\n <ArkMenu.Root\n positioning={{ offset: { mainAxis: offset, crossAxis: SUBMENU_ALIGN_OFFSET } }}\n navigate={clickLink}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n)\n\nexport type MenuSubTriggerProps = ArkMenu.TriggerItemProps &\n WithTestId &\n MenuStartSlotProps & {\n color?: Color\n }\n\nconst SubTrigger = ({\n startSection,\n startSlot = startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuSubTriggerProps) => {\n const { icons } = useContext(MenuContext)\n warnSections(\"SubTrigger\", startSection)\n return (\n <ArkMenu.TriggerItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n <span className={cn(popoverChevron, \"ms-auto -me-1 [&_svg]:size-4\")}>\n {icons.submenu}\n </span>\n </>\n ))}\n </ArkMenu.TriggerItem>\n )\n}\n\nexport {\n CheckboxItem,\n Content,\n Divider,\n Item,\n ItemGroupLabel,\n Label,\n RadioGroup,\n RadioItem,\n Root,\n Sub,\n SubTrigger,\n}\n\nexport type MenuTriggerProps = ArkMenu.TriggerProps & WithTestId & { ref?: Ref<HTMLButtonElement> }\n\n/** Ark's `Menu.Trigger` minus one handler. Zag's trigger calls `preventDefault()`\n * on `pointerdown`, which cancels the browser's own mouse-down focus of the\n * button. With no pointer-initiated focus on record, Chromium treats every\n * later *programmatic* focus as keyboard-like: Zag's `focus()` on the content\n * when the menu opens, and its `focus()` back on the trigger when it closes,\n * both match `:focus-visible`, so a mouse user gets the keyboard ring on the\n * trigger after every menu interaction (#227).\n *\n * Leaving `pointerdown` alone restores the platform behaviour — the click\n * focuses the button without a ring, and the programmatic focuses that follow\n * inherit that. Keyboard users keep the ring, since a Tab/Enter/Escape still\n * marks the focus as keyboard-driven. It's also how Zag's own Popover trigger\n * behaves (it never cancels `pointerdown`). */\nexport const Trigger = ({ ref, value, className, testId, ...rest }: MenuTriggerProps) => {\n const menu = useMenuContext()\n const presence = usePresenceContext()\n const { onPointerDown: _cancelsNativeFocus, ...trigger } = menu.getTriggerProps({ value })\n return (\n <ark.button\n {...mergeProps(\n {\n ...trigger,\n \"aria-controls\": presence.unmounted ? undefined : trigger[\"aria-controls\"],\n // The canceled `pointerdown` also blocked a native drag as a side\n // effect: an `asChild` `<a href>`, or the `<img>` of an avatar\n // trigger, would otherwise lift a drag ghost off the trigger.\n // Canceling `dragstart` instead leaves the press, and its focus, alone.\n onDragStart: (event: DragEvent) => event.preventDefault(),\n },\n // Same side effect for text: a double-click or drag on a non-button\n // trigger (`asChild` + `<span role=\"button\">`) would select its label.\n // CSS restores that. It lands on the `asChild` child too, and the\n // consumer's `className` comes last so it can override it.\n { ...props({ \"data-testid\": testId }), ...rest, className: cn(\"select-none\", className) },\n )}\n ref={ref}\n />\n )\n}\n\n/** Ark parts re-exported unchanged (no styling needed). */\nexport const ContextTrigger = ArkMenu.ContextTrigger\nexport const ItemGroup = ArkMenu.ItemGroup\nexport const Context = ArkMenu.Context\n/** Alias for `Divider` (Ark's name for the same part). */\nexport const Separator = Divider\n/** Submenu dropdown — identical surface + portalling to `Menu.Content`. */\nexport const SubContent = Content\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/menu/menu.tsx"],"names":["ArkMenu"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgEA,IAAM,WAAA,GAAc,EAAA;AAAA,EAClB,aAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAQA,IAAM,QAAA,GAAW,GAAA;AAAA,EACf;AAAA,IACE,kFAAA;AAAA,IACA,0BAAA;AAAA,IACA,kCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,QAIP,KAAA,EAAO;AAAA,UACL,kBAAA,CAAmB,OAAA;AAAA,UACnB;AAAA,SACF;AAAA;AAAA,QAEA,IAAA,EAAM,CAAC,iBAAA,EAAmB,gCAAgC;AAAA;AAC5D,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,KAAA;AAAM;AAEtC,CAAA;AAMA,IAAM,WAAA,GAAc,2DAAA;AAiBb,IAAM,aAAA,GAAiD;AAAA,EAC5D,KAAA,sBAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,EAClB,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,OAAA,EAAQ,WAAA,EAAY,MAAK,cAAA,EAAe,aAAA,EAAY,MAAA,EACvD,QAAA,kBAAA,GAAA,CAAC,YAAO,EAAA,EAAG,IAAA,EAAK,IAAG,IAAA,EAAK,CAAA,EAAE,KAAI,CAAA,EAChC,CAAA;AAAA,EAEF,OAAA,kBAAS,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EA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aAAA,EAAe,mBAAA,EAAqB,GAAG,OAAA,KAAY,IAAA,CAAK,eAAA,CAAgB,EAAE,KAAA,EAAO,CAAA;AACzF,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA,CAAI,MAAA;AAAA,IAAJ;AAAA,MACE,GAAG,UAAA;AAAA,QACF;AAAA,UACE,GAAG,OAAA;AAAA,UACH,eAAA,EAAiB,QAAA,CAAS,SAAA,GAAY,MAAA,GAAY,QAAQ,eAAe,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKzE,WAAA,EAAa,CAAC,KAAA,KAAqB,KAAA,CAAM,cAAA;AAAe,SAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,EAAE,GAAG,KAAA,CAAM,EAAE,eAAe,MAAA,EAAQ,CAAA,EAAG,GAAG,IAAA,EAAM,SAAA,EAAW,EAAA,CAAG,aAAA,EAAe,SAAS,CAAA;AAAE,OAC1F;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;AAGO,IAAM,iBAAiBA,IAAA,CAAQ;AAC/B,IAAM,YAAYA,IAAA,CAAQ;AAC1B,IAAM,UAAUA,IAAA,CAAQ;AAExB,IAAM,SAAA,GAAY;AAElB,IAAM,UAAA,GAAa","file":"chunk-FDCPMUJK.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react/factory\"\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Menu as ArkMenu, useMenuContext } from \"@ark-ui/react/menu\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { usePresenceContext } from \"@ark-ui/react/presence\"\nimport { mergeProps } from \"@ark-ui/react/utils\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type DragEvent,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { warnRenamedProp } from \"../../lib/dev-warn\"\nimport { type IconMap, mergeIcons } from \"../../lib/icons\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { CheckIcon, ChevronRightIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverChrome,\n popoverGroupLabel,\n popoverIndicator,\n} from \"../popover/popover\"\n\n/**\n * Menu — the kit's dropdown of actions, a styled layer over Ark UI's Menu.\n * It's the click-triggered sibling of `Popover` (a free-form panel): Ark's Menu\n * machine wires roving focus, type-ahead, `role=\"menu\"` / `menuitem`,\n * `aria-haspopup` / `aria-expanded`, submenus, and checkbox / radio selection.\n *\n * Two ways to use it — the compound parts (this file) give full control; the\n * data-driven `<Menu data={…}>` convenience (see `menu-data.tsx`) covers the\n * common action-menu case and is built on these very parts.\n *\n * <Menu.Root>\n * <Menu.Trigger asChild><Button>Open</Button></Menu.Trigger>\n * <Menu.Content>\n * <Menu.Item startSection={<User />} onClick={openProfile}>Profile</Menu.Item>\n * <Menu.Divider />\n * <Menu.Item color=\"red\" startSection={<Trash />} onClick={remove}>Delete</Menu.Item>\n * </Menu.Content>\n * </Menu.Root>\n *\n * Portaled by default (escapes `overflow:hidden` ancestors), sized to content,\n * and animated via the kit's shared `popover-in/out` tokens.\n */\n\n/** Menu surface — the shared floating chrome, sized to content and scrollable\n * when tall. Unlike the form pickers' `popoverContent` (an `overflow-hidden`\n * clip around a nested scroller) a Menu scrolls natively, so Ark needs no\n * `scrollToIndexFn` workaround. */\nconst menuContent = cn(\n popoverChrome,\n \"flex w-max min-w-40 flex-col p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))] overflow-y-auto overscroll-contain\",\n)\n\n/** A single menu row — shared by `Item`, `CheckboxItem`, `RadioItem`, and\n * `SubTrigger` so every row is visually identical. Mirrors `popoverOption`'s\n * neutral look, but the `colored` variant swaps the text + highlight tints to\n * the palette slot vars (`--c-text` / `--c-soft`) resolved from `data-color` —\n * e.g. a red \"Delete\". Highlight is `data-highlighted`, selection is\n * `data-[state=checked]`, disabled is `data-disabled`, all owned by Ark. */\nconst menuItem = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-xs px-2.5 py-1.5 text-md\",\n \"select-none outline-none\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n colored: {\n // Neutral highlight is transparent — a low-opacity black/white wash,\n // not an opaque gray — matching the surface's own background-dependent\n // tint (no Figma reference for this state yet).\n false: [\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n ],\n // Slot vars already shift by theme (colors.css), so no `dark:` needed.\n true: [\"text-(--c-text)\", \"data-highlighted:bg-(--c-soft)\"],\n },\n },\n defaultVariants: { colored: false },\n },\n)\n\n/** Hairline between groups of items. Same shade as Popover's own\n * Header/Footer/Body slotEdge dividers (brand-900/20 / white/15) — both are\n * separator lines on the identical popoverChrome panel, so they shouldn't\n * drift to different weights. */\nconst menuDivider = \"-mx-1 my-1 h-px border-0 bg-brand-900/20 dark:bg-white/15\"\n\ntype MenuPlacement = NonNullable<NonNullable<ArkMenu.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type MenuPosition = LogicalPosition<MenuPlacement>\n\nexport type MenuIconSlot = \"check\" | \"radio\" | \"submenu\"\nexport type MenuIcons = IconMap<MenuIconSlot>\n\n/**\n * The default icons: the checkbox item's check, the radio item's dot, and the\n * submenu trigger's chevron. The chevron points to where the submenu opens, the\n * inline end, so it mirrors under RTL; a consumer's icon is drawn as given.\n * The dot is a filled glyph, so it takes no `iconStroke`.\n */\nexport const DEFAULT_ICONS: Record<MenuIconSlot, ReactNode> = {\n check: <CheckIcon />,\n radio: (\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"5\" />\n </svg>\n ),\n submenu: <ChevronRightIcon className=\"rtl:-scale-x-100\" />,\n}\n\ntype MenuContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n icons: Record<MenuIconSlot, ReactNode>\n}\nconst MenuContext = createContext<MenuContextValue>({ withinPortal: true, icons: DEFAULT_ICONS })\n\nexport type MenuRootProps = Omit<ArkMenu.RootProps, \"positioning\" | \"onOpenChange\"> & {\n /** Dropdown placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`bottom-start`, `top`, …).\n * Defaults to `\"bottom\"`. */\n position?: MenuPosition\n /** Gap in px between the trigger and the dropdown. */\n offset?: number\n /** Render the dropdown in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Called when the menu opens or closes (flattened from Ark's detail object). */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, outside interaction, item selection, or a controlled `onOpenChange`. */\n onClose?: () => void\n /** Replaces the default icons: `check`, `radio`, `submenu`. Reaches every item and submenu\n * inside, drawn as given (never restroked or mirrored). */\n icons?: MenuIcons\n}\n\n/**\n * Selects a link item (`<Menu.Item asChild><Link/></Menu.Item>`) from the\n * keyboard. zag's default `navigate` dispatches `new MouseEvent(\"click\")`,\n * which doesn't bubble, so React's delegated `onClick` never sees it and a\n * router `Link` falls back to a full page load. `node.click()` dispatches a\n * bubbling click instead, which reaches the router. Deferred like zag's own,\n * so the menu settles before the navigation starts. A `navigate` prop still\n * overrides it.\n */\nconst clickLink: NonNullable<ArkMenu.RootProps[\"navigate\"]> = ({ node }) => {\n queueMicrotask(() => node.click())\n}\n\nconst Root = ({\n position = \"bottom\",\n offset,\n withinPortal = true,\n container,\n onOpenChange,\n onClose,\n icons,\n children,\n ...rest\n}: MenuRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <MenuContext.Provider\n value={{ withinPortal, container, icons: mergeIcons(DEFAULT_ICONS, icons) }}\n >\n <ArkMenu.Root\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n navigate={clickLink}\n onOpenChange={({ open }) => {\n onOpenChange?.(open)\n if (!open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuContentProps = ArkMenu.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: MenuContentProps) => {\n const { withinPortal, container } = useContext(MenuContext)\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the menu is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useMenuContext().open)\n const panel = (\n <ArkMenu.Positioner>\n <ArkMenu.Content\n className={cn(menuContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkMenu.Content>\n </ArkMenu.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\n/** Shared inline-start wrapper for a `startSlot`. Sizes a bare icon to 16px\n * (`size-4`, like Button `md` / Input / Accordion) so every row's label starts\n * on the same column whatever icon it carries. Scoped to this slot — not the\n * whole row — so SVGs in `children` / `endSlot` and the row's own indicator\n * or chevron keep their sizes. `:where()` drops the rule to zero class\n * specificity, so a size class on the icon itself (`className=\"size-5\"`) still\n * wins; Lucide's `size` prop is only an HTML attribute and does not. */\nconst StartSlot = ({ children }: { children: ReactNode }) => (\n <span className=\"inline-flex shrink-0 items-center [:where(&)_svg]:size-4\">{children}</span>\n)\n\n/** Shared inline-end wrapper for an `endSlot` (pushes it to the far edge). */\nconst EndSlot = ({ children }: { children: ReactNode }) => (\n <span className={cn(\"ms-auto inline-flex shrink-0 items-center gap-2\", TEXT_COLOR_CLASSES.muted)}>\n {children}\n </span>\n)\n\n/** A row's leading slot, plus its former `startSection` spelling. */\nexport type MenuStartSlotProps = {\n /** Content before the label (usually an icon — a bare SVG is sized to 16px;\n * a size class on the icon overrides it). */\n startSlot?: ReactNode\n /** @deprecated Renamed `startSlot`, like the rest of the kit's leading slots.\n * Removed in the next minor. `startSlot` wins when both are set. */\n startSection?: ReactNode\n}\n\n/** A row's trailing slot, plus its former `endSection` spelling. */\nexport type MenuEndSlotProps = {\n /** Content after the label, pushed to the inline-end. */\n endSlot?: ReactNode\n /** @deprecated Renamed `endSlot`, like the rest of the kit's trailing slots.\n * Removed in the next minor. `endSlot` wins when both are set. */\n endSection?: ReactNode\n}\n\n/** Warns once when a part is still given a deprecated `*Section` slot. */\nconst warnSections = (part: string, start: ReactNode, end?: ReactNode) => {\n if (start !== undefined) warnRenamedProp(`Menu.${part}`, \"startSection\", \"startSlot\")\n if (end !== undefined) warnRenamedProp(`Menu.${part}`, \"endSection\", \"endSlot\")\n}\n\nexport type MenuItemProps = Omit<ArkMenu.ItemProps, \"value\" | \"onClick\" | \"onSelect\"> &\n WithTestId &\n MenuStartSlotProps &\n MenuEndSlotProps & {\n /** Unique value — used for type-ahead + the selection detail. Auto-generated\n * when omitted (Mantine-style items need no explicit value). */\n value?: string\n /** Palette for the row — colors the label + highlight tint (e.g. `\"red\"` for a\n * destructive action). Resolved from `data-color` via the slot vars. */\n color?: Color\n /** Fires when the item is selected — on click *and* keyboard activation\n * (Enter / Space), not just a pointer click. Wraps Ark's `onSelect`. */\n onClick?: () => void\n }\n\nconst Item = ({\n value,\n startSection,\n endSection,\n startSlot = startSection,\n endSlot = endSection,\n color,\n onClick,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemProps) => {\n const autoId = useId()\n warnSections(\"Item\", startSection, endSection)\n return (\n <ArkMenu.Item\n asChild={asChild}\n value={value ?? autoId}\n onSelect={onClick}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n {endSlot != null && <EndSlot>{endSlot}</EndSlot>}\n </>\n ))}\n </ArkMenu.Item>\n )\n}\n\n/** Optional decorative leader for a section heading — the code-themed `// ` from\n * `Text`'s `prefix`. Hidden from screen readers and the clipboard\n * (`aria-hidden` + `select-none`); renders nothing when unset (off by default). */\nconst HeadingPrefix = ({ prefix }: { prefix: ReactNode }) =>\n prefix === undefined ? null : (\n <span aria-hidden=\"true\" className=\"select-none\">\n {prefix}\n </span>\n )\n\nexport type MenuLabelProps = Omit<ComponentPropsWithoutRef<\"div\">, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\n/** Standalone section heading (Mantine parity). For grouped items with proper\n * ARIA wiring, prefer `Menu.ItemGroup` + `Menu.ItemGroupLabel`. */\nconst Label = ({ className, prefix, children, testId, ...rest }: MenuLabelProps) => (\n <div className={cn(popoverGroupLabel, className)} {...props({ \"data-testid\": testId })} {...rest}>\n <HeadingPrefix prefix={prefix} />\n {children}\n </div>\n)\n\nexport type MenuItemGroupLabelProps = Omit<ArkMenu.ItemGroupLabelProps, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\nconst ItemGroupLabel = ({\n className,\n prefix,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemGroupLabelProps) => (\n <ArkMenu.ItemGroupLabel\n asChild={asChild}\n className={cn(popoverGroupLabel, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n <HeadingPrefix prefix={prefix} />\n {own}\n </>\n ))}\n </ArkMenu.ItemGroupLabel>\n)\n\nconst Divider = ({ className, testId, ...rest }: ArkMenu.SeparatorProps & WithTestId) => (\n <ArkMenu.Separator\n className={cn(menuDivider, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type MenuCheckboxItemProps = ArkMenu.CheckboxItemProps &\n WithTestId &\n MenuStartSlotProps & {\n color?: Color\n }\n\nconst CheckboxItem = ({\n startSection,\n startSlot = startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuCheckboxItemProps) => {\n const { icons } = useContext(MenuContext)\n warnSections(\"CheckboxItem\", startSection)\n return (\n <ArkMenu.CheckboxItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>{icons.check}</ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.CheckboxItem>\n )\n}\n\nexport type MenuRadioGroupProps = Omit<\n ArkMenu.RadioItemGroupProps,\n \"onValueChange\" | \"onChange\"\n> & {\n /** Called with the newly selected value (flattened from Ark's detail object). */\n onChange?: (value: string) => void\n}\n\nconst RadioGroup = ({ onChange, ...rest }: MenuRadioGroupProps) => (\n <ArkMenu.RadioItemGroup\n onValueChange={onChange ? ({ value }) => onChange(value) : undefined}\n {...rest}\n />\n)\n\nexport type MenuRadioItemProps = ArkMenu.RadioItemProps &\n WithTestId &\n MenuStartSlotProps & {\n color?: Color\n }\n\nconst RadioItem = ({\n startSection,\n startSlot = startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuRadioItemProps) => {\n const { icons } = useContext(MenuContext)\n warnSections(\"RadioItem\", startSection)\n return (\n <ArkMenu.RadioItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>{icons.radio}</ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.RadioItem>\n )\n}\n\nexport type MenuSubProps = Omit<ArkMenu.RootProps, \"positioning\"> & {\n /** Gap in px between the trigger row and the submenu. Ark manages submenu\n * *placement* itself (RTL-aware `right-start` / `left-start`, flush to the\n * parent), so only this main-axis gap is adjustable. Defaults to `10`. */\n offset?: number\n}\n\n/** A submenu opens flush to its trigger row, so its first item lands one surface\n * inset *below* the trigger — the `menuContent` top border (1px) + top padding\n * (`p-1` = 4px). Nudging the submenu up by that inset lines the first sub-item\n * up with the trigger row. Cross-axis is the vertical axis for the (Ark-forced)\n * `right-start` / `left-start` placements, and Floating UI maps a negative value\n * to \"up\" in both directions — so one constant covers LTR and RTL. */\nconst SUBMENU_ALIGN_OFFSET = -5\n\n/** Submenu root — a nested Ark Menu whose triggering row is `Menu.SubTrigger`.\n * Inherits the parent's portal settings via context (see `Menu.SubContent`).\n *\n * Ark's menu machine hard-overrides a submenu's placement and `gutter` (to `0`),\n * so a `gutter`-based offset is silently dropped. It leaves `offset` untouched,\n * and Floating UI resolves the axes as `offset.mainAxis ?? gutter` (the gap) and\n * `offset.crossAxis` (the top alignment) — so the whole `offset` object is the\n * one path that survives the override. */\nconst Sub = ({ offset = 10, children, ...rest }: MenuSubProps) => (\n <ArkMenu.Root\n positioning={{ offset: { mainAxis: offset, crossAxis: SUBMENU_ALIGN_OFFSET } }}\n navigate={clickLink}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n)\n\nexport type MenuSubTriggerProps = ArkMenu.TriggerItemProps &\n WithTestId &\n MenuStartSlotProps & {\n color?: Color\n }\n\nconst SubTrigger = ({\n startSection,\n startSlot = startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuSubTriggerProps) => {\n const { icons } = useContext(MenuContext)\n warnSections(\"SubTrigger\", startSection)\n return (\n <ArkMenu.TriggerItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSlot != null && <StartSlot>{startSlot}</StartSlot>}\n {own}\n <span className={cn(popoverChevron, \"ms-auto -me-1 [&_svg]:size-4\")}>\n {icons.submenu}\n </span>\n </>\n ))}\n </ArkMenu.TriggerItem>\n )\n}\n\nexport {\n CheckboxItem,\n Content,\n Divider,\n Item,\n ItemGroupLabel,\n Label,\n RadioGroup,\n RadioItem,\n Root,\n Sub,\n SubTrigger,\n}\n\nexport type MenuTriggerProps = ArkMenu.TriggerProps & WithTestId & { ref?: Ref<HTMLButtonElement> }\n\n/** Ark's `Menu.Trigger` minus one handler. Zag's trigger calls `preventDefault()`\n * on `pointerdown`, which cancels the browser's own mouse-down focus of the\n * button. With no pointer-initiated focus on record, Chromium treats every\n * later *programmatic* focus as keyboard-like: Zag's `focus()` on the content\n * when the menu opens, and its `focus()` back on the trigger when it closes,\n * both match `:focus-visible`, so a mouse user gets the keyboard ring on the\n * trigger after every menu interaction (#227).\n *\n * Leaving `pointerdown` alone restores the platform behaviour — the click\n * focuses the button without a ring, and the programmatic focuses that follow\n * inherit that. Keyboard users keep the ring, since a Tab/Enter/Escape still\n * marks the focus as keyboard-driven. It's also how Zag's own Popover trigger\n * behaves (it never cancels `pointerdown`). */\nexport const Trigger = ({ ref, value, className, testId, ...rest }: MenuTriggerProps) => {\n const menu = useMenuContext()\n const presence = usePresenceContext()\n const { onPointerDown: _cancelsNativeFocus, ...trigger } = menu.getTriggerProps({ value })\n return (\n <ark.button\n {...mergeProps(\n {\n ...trigger,\n \"aria-controls\": presence.unmounted ? undefined : trigger[\"aria-controls\"],\n // The canceled `pointerdown` also blocked a native drag as a side\n // effect: an `asChild` `<a href>`, or the `<img>` of an avatar\n // trigger, would otherwise lift a drag ghost off the trigger.\n // Canceling `dragstart` instead leaves the press, and its focus, alone.\n onDragStart: (event: DragEvent) => event.preventDefault(),\n },\n // Same side effect for text: a double-click or drag on a non-button\n // trigger (`asChild` + `<span role=\"button\">`) would select its label.\n // CSS restores that. It lands on the `asChild` child too, and the\n // consumer's `className` comes last so it can override it.\n { ...props({ \"data-testid\": testId }), ...rest, className: cn(\"select-none\", className) },\n )}\n ref={ref}\n />\n )\n}\n\n/** Ark parts re-exported unchanged (no styling needed). */\nexport const ContextTrigger = ArkMenu.ContextTrigger\nexport const ItemGroup = ArkMenu.ItemGroup\nexport const Context = ArkMenu.Context\n/** Alias for `Divider` (Ark's name for the same part). */\nexport const Separator = Divider\n/** Submenu dropdown — identical surface + portalling to `Menu.Content`. */\nexport const SubContent = Content\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { props } from './chunk-WYCMIIRR.js';
|
|
2
2
|
import { TYPOGRAPHY_SHADE_CLASSES, TEXT_COLOR_CLASSES, TYPOGRAPHY_SIZE_CLASSES, resolveHeadingSize } from './chunk-GIPQUKCN.js';
|
|
3
|
-
import { cn } from './chunk-
|
|
3
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
4
4
|
import { ark } from '@ark-ui/react';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -47,5 +47,5 @@ var Title = ({ className, order = 1, size, c, testId, ...rest }) => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export { Title };
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-H3PYSAWN.js.map
|
|
51
|
+
//# sourceMappingURL=chunk-H3PYSAWN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/title/title.tsx"],"names":[],"mappings":";;;;;;;AAuCA,IAAM,aAAA,GAAgB,GAAA,CAAI,CAAC,kDAAkD,CAAA,EAAG;AAAA,EAC9E,QAA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,EAAc,CAAA,EAAG,CAAA,EAAG,SAAS;AAAA;AAAA,GACnE;AAEJ","file":"chunk-H3PYSAWN.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ElementType } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport {\n type HeadingSizeAlias,\n resolveHeadingSize,\n TEXT_COLOR_CLASSES,\n TYPOGRAPHY_SHADE_CLASSES,\n TYPOGRAPHY_SIZE_CLASSES,\n} from \"../../lib/typography-size\"\n\n/**\n * Title — heading primitive.\n *\n * Pure React Server Component. The `order` prop selects the semantic\n * element (`<h1>`..`<h6>`); `size` controls the visual scale and defaults to\n * a sensible per-order mapping (h1=4xl, h2=3xl, …, h6=md). Decoupling order\n * from size lets a designer demote/promote a heading visually without\n * breaking the document outline:\n *\n * <Title order={3} size=\"xl\" /> -> <h3 class=\"text-xl ...\">\n *\n * `size` also accepts the heading aliases (`h1`..`h6`, `p`) as friendlier\n * names for the same scale, e.g. `<Title order={3} size=\"h1\" />` is\n * identical to `size=\"4xl\"` — still an `<h3>`, just sized like an `h1`.\n *\n * The visual scale is the same one `Text` uses (`lib/typography-size.ts`),\n * so a `Title` and a `Text` given the same `size` render at the same size.\n *\n * `c` is the same foreground shade switch `Text` has (`default` / `secondary`\n * / `muted`, from the same shared classes). `default` is the strongest\n * foreground (gray-900/gray-50), where Text's inherits.\n *\n * Always emits semibold + tight tracking; if a screen needs a different\n * weight, pass it via `className`.\n */\nconst titleVariants = cva([\"font-semibold tracking-tight font-mono text-trim\"], {\n variants: {\n size: TYPOGRAPHY_SIZE_CLASSES,\n c: {\n default: TEXT_COLOR_CLASSES.primary,\n ...TYPOGRAPHY_SHADE_CLASSES,\n },\n },\n defaultVariants: {\n c: \"default\",\n },\n})\n\nexport type TitleOrder = 1 | 2 | 3 | 4 | 5 | 6\nexport type TitleSize = NonNullable<VariantProps<typeof titleVariants>[\"size\"]>\n\nconst ELEMENT_BY_ORDER = {\n 1: ark.h1,\n 2: ark.h2,\n 3: ark.h3,\n 4: ark.h4,\n 5: ark.h5,\n 6: ark.h6,\n} as const satisfies Record<TitleOrder, ElementType>\n\nconst SIZE_BY_ORDER = {\n 1: \"4xl\",\n 2: \"3xl\",\n 3: \"2xl\",\n 4: \"xl\",\n 5: \"lg\",\n 6: \"md\",\n} as const satisfies Record<TitleOrder, TitleSize>\n\nexport type TitleProps = HTMLArkProps<\"h1\"> &\n Omit<VariantProps<typeof titleVariants>, \"size\"> &\n WithTestId & {\n /** Semantic heading level — picks the `<h*>` element. Defaults to `1`. */\n order?: TitleOrder\n /**\n * Visual scale. Defaults to the per-order map (`order=3` -> `2xl`, etc.).\n * Also accepts the heading aliases (`h1`..`h6`, `p`) for the same tokens.\n */\n size?: TitleSize | HeadingSizeAlias\n }\n\nexport const Title = ({ className, order = 1, size, c, testId, ...rest }: TitleProps) => {\n const Element = ELEMENT_BY_ORDER[order]\n const resolvedSize = size ? resolveHeadingSize(size) : SIZE_BY_ORDER[order]\n return (\n <Element\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(titleVariants({ size: resolvedSize, c }), className)}\n />\n )\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Tooltip } from './chunk-
|
|
2
|
-
import { popoverChrome } from './chunk-
|
|
1
|
+
import { Tooltip } from './chunk-YZJUPYPO.js';
|
|
2
|
+
import { popoverChrome } from './chunk-N66NC6QK.js';
|
|
3
3
|
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
4
|
-
import { Collapse } from './chunk-
|
|
4
|
+
import { Collapse } from './chunk-NKOTA5TM.js';
|
|
5
5
|
import { iconStroke, mergeIcons } from './chunk-XXOR34T4.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 { useClipboard } from '@ark-ui/react/clipboard';
|
|
12
12
|
import { ChevronUpIcon, ChevronDownIcon, CheckIcon, CopyIcon } from 'lucide-react';
|
|
@@ -226,5 +226,5 @@ function CodeBlockChrome({
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
export { CodeBlockButton, CodeBlockChrome, DEFAULT_ICONS };
|
|
229
|
-
//# sourceMappingURL=chunk-
|
|
230
|
-
//# sourceMappingURL=chunk-
|
|
229
|
+
//# sourceMappingURL=chunk-HQPU73WV.js.map
|
|
230
|
+
//# sourceMappingURL=chunk-HQPU73WV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/code-block/chrome.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAwBA,IAAM,oBAAA,GAA8C;AAAA,EAClD,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,WAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAOO,IAAM,aAAA,GAAsD;AAAA,EACjE,IAAA,kBAAM,GAAA,CAAC,QAAA,EAAA,EAAS,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EACvC,MAAA,kBAAQ,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC1C,MAAA,kBAAQ,GAAA,CAAC,eAAA,EAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAChD,QAAA,kBAAU,GAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAW,UAAA,EAAY;AAClD;AAyBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA,OAAA;AAAA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chunk-WR444JRU.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useClipboard } from \"@ark-ui/react/clipboard\"\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon, CopyIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\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 { popoverChrome } from \"../popover/popover\"\nimport { Tooltip } from \"../tooltip/tooltip\"\n\nexport type CodeBlockTranslations = {\n copy: string\n copied: string\n expand: string\n collapse: string\n}\n\nconst DEFAULT_TRANSLATIONS: CodeBlockTranslations = {\n copy: \"Copy\",\n copied: \"Copied\",\n expand: \"Show more\",\n collapse: \"Show less\",\n}\n\nexport type CodeBlockIconSlot = \"copy\" | \"copied\" | \"expand\" | \"collapse\"\n/** The toolbar's icons: `copy` and `copied` on the copy button, `expand` and\n * `collapse` on the collapse toggle. `null` leaves that button empty. */\nexport type CodeBlockIcons = IconMap<CodeBlockIconSlot>\n\nexport const DEFAULT_ICONS: Record<CodeBlockIconSlot, ReactNode> = {\n copy: <CopyIcon className={iconStroke} />,\n copied: <CheckIcon className={iconStroke} />,\n expand: <ChevronDownIcon className={iconStroke} />,\n collapse: <ChevronUpIcon className={iconStroke} />,\n}\n\nexport type CodeBlockClassNames = {\n root?: string\n title?: string\n pre?: string\n controls?: string\n copyButton?: string\n expandButton?: string\n}\n\nexport type CodeBlockButtonProps = HTMLArkProps<\"button\"> & WithTestId\n\n/**\n * `CodeBlock.Button` — the toolbar's own compact icon-button primitive.\n * `Copy`/expand use it internally, and it's exported so a consumer's own\n * `controls` button matches the exact same size/style instead of hand-\n * rolling one — same composition API as the rest of the kit (`asChild`, via\n * `HTMLArkProps`, so it wraps in a `Tooltip` exactly like the built-in\n * buttons do).\n *\n * A plain hand-rolled button, not an `ActionIcon` wrapper: this toolbar\n * needed something smaller than `ActionIcon`'s own `xs` floor, which is\n * sized for general-purpose use, not a compact floating strip over code.\n */\nexport const CodeBlockButton = ({\n className,\n asChild,\n type,\n testId,\n ...rest\n}: CodeBlockButtonProps) => (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n {...props({ \"data-testid\": testId })}\n className={cn(\n \"inline-flex size-6 shrink-0 items-center justify-center rounded\",\n \"text-(--c-text) [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"hover:bg-(--c-soft)\",\n focusStyles({ offset: false }),\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n />\n)\n\ntype CopyTriggerProps = {\n code: string\n onCopy?: () => void\n copyLabel: string\n copiedLabel: string\n icons: Record<CodeBlockIconSlot, ReactNode>\n className?: string\n testId?: string\n}\n\n/**\n * Renaming the focused button (`aria-label` → \"Copied\") isn't re-read by\n * screen readers, so the copy is also announced through a visually hidden\n * `role=\"status\"` beside it: mounted empty, filled while `copied` lasts. It is\n * a sibling of the `Tooltip`-wrapped button (`asChild` needs one element), and\n * `sr-only` takes it out of the toolbar's flex row.\n *\n * Uses Ark's `useClipboard` hook directly rather than the `Clipboard.Root`/\n * `Clipboard.Indicator` components — both render their own wrapping `<div>`\n * (`data-part=\"root\"`/`\"indicator\"`), which, sitting as a direct child of the\n * toolbar's flex row, threw off its sizing/alignment next to the plain\n * `ActionIcon` the `ExpandTrigger` renders. The hook gives the same\n * `copied`/`copy` state machine with no imposed DOM structure at all — this\n * renders as a single real `<button>`, exactly like `ExpandTrigger`.\n */\nfunction CopyTrigger({\n code,\n onCopy,\n copyLabel,\n copiedLabel,\n icons,\n className,\n testId,\n}: CopyTriggerProps) {\n const { copied, copy } = useClipboard({\n value: code,\n timeout: 2000,\n onStatusChange: (details) => details.copied && onCopy?.(),\n })\n const label = copied ? copiedLabel : copyLabel\n return (\n <>\n <Tooltip label={label} asChild>\n <CodeBlockButton aria-label={label} onClick={copy} className={className} testId={testId}>\n {copied ? icons.copied : icons.copy}\n </CodeBlockButton>\n </Tooltip>\n <span role=\"status\" className=\"sr-only\">\n {copied ? copiedLabel : \"\"}\n </span>\n </>\n )\n}\n\ntype ExpandTriggerProps = {\n expanded: boolean\n onToggle: () => void\n expandLabel: string\n collapseLabel: string\n icons: Record<CodeBlockIconSlot, ReactNode>\n className?: string\n testId?: string\n}\n\n/** Toolbar icon button toggling the collapsed \"tail\" seam — an\n * `aria-expanded` `ActionIcon` with a matching `Tooltip`/accessible name,\n * same shape as `CopyTrigger`. Only rendered when `isCollapsible`. */\nfunction ExpandTrigger({\n expanded,\n onToggle,\n expandLabel,\n collapseLabel,\n icons,\n className,\n testId,\n}: ExpandTriggerProps) {\n const label = expanded ? collapseLabel : expandLabel\n return (\n <Tooltip label={label} asChild>\n <CodeBlockButton\n aria-label={label}\n aria-expanded={expanded}\n onClick={onToggle}\n className={className}\n testId={testId}\n >\n {expanded ? icons.collapse : icons.expand}\n </CodeBlockButton>\n </Tooltip>\n )\n}\n\nexport type CodeBlockChromeProps = WithTestId & {\n /** Raw source, used only for the copy button's clipboard value — this\n * component never highlights anything itself. */\n code: string\n /** Whether the tail half exists at all (mirrors the caller's own\n * `collapsedLines`/line-count decision) — controls whether the expand\n * toggle and the `Collapse`-wrapped tail slot render at all. */\n isCollapsible: boolean\n /** The head half's already-rendered content (highlighted HTML, or a\n * loading fallback — this component has no opinion on which). */\n headContent: ReactNode\n /** The tail half's already-rendered content — only read when\n * `isCollapsible`. */\n tailContent?: ReactNode\n\n /** Header row above the code; hosts the toolbar when set. */\n title?: ReactNode\n\n /** @default true */\n withCopyButton?: boolean\n onCopy?: () => void\n\n /** @default false */\n defaultExpanded?: boolean\n expanded?: boolean\n onExpandedChange?: (expanded: boolean) => void\n\n /** Replaces the toolbar's icons: `copy`, `copied`, `expand`, `collapse`. A missing key keeps\n * its default; `null` leaves that button empty. */\n icons?: CodeBlockIcons\n controls?: ReactNode\n translations?: Partial<CodeBlockTranslations>\n className?: string\n classNames?: CodeBlockClassNames\n}\n\n/**\n * The interactive shell shared by `CodeBlock` (client, highlights via\n * `highlightCode` in an effect) and `CodeBlock.Static` (an async Server\n * Component that `await`s `highlightCode` directly during render, for a\n * fully static/SSR'd result with zero client JS spent on Shiki) — this\n * component owns the toolbar/copy/collapse-expand interactivity and\n * nothing about HOW `headContent`/`tailContent` were produced. Kept in its\n * own file specifically so `CodeBlock.Static` (no `\"use client\"`, safe to\n * import from a Server Component) can render it without pulling in\n * `code-block.tsx`'s own client-only highlighting logic.\n */\nexport function CodeBlockChrome({\n code,\n isCollapsible,\n headContent,\n tailContent,\n title,\n withCopyButton = true,\n onCopy,\n defaultExpanded = false,\n expanded: expandedProp,\n onExpandedChange,\n icons: iconsProp,\n controls,\n translations,\n testId,\n className,\n classNames,\n}: CodeBlockChromeProps) {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n\n const [expanded, setExpanded] = useUncontrolled({\n value: expandedProp,\n defaultValue: defaultExpanded,\n finalValue: false,\n onChange: onExpandedChange,\n })\n\n // A fixed `top-2` reads fine pinned to the corner of a tall, multi-line\n // block, but on a single line there's no \"corner\" to anchor to — it just\n // looks like an arbitrarily offset button. True vertical centering (equal\n // gap above/below) is the correct treatment there instead.\n const isSingleLine = !code.includes(\"\\n\")\n\n const toolbar = (controls != null || withCopyButton || isCollapsible) && (\n <div\n className={cn(\n \"flex items-center gap-1 p-0.5\",\n // In a title header the toolbar sits in-flow at the row's end;\n // otherwise it floats over the code's top-right corner. Physical on\n // purpose, not `inset-e-*`: the code is always `dir=\"ltr\"` (even on an\n // RTL page), so its lines end on the right; a logical inset would put\n // the toolbar over the start of every line under `dir=\"rtl\"`.\n title == null && \"absolute right-2 z-10\",\n title == null && (isSingleLine ? \"top-1/2 -translate-y-1/2\" : \"top-2\"),\n // Same floating-surface chrome every other overlay panel in the\n // kit uses (Popover/Menu/Select's positioner) — border-brand-900/20\n // dark:border-white/15 + bg-brand-50/90 dark:bg-brand-950/85 +\n // backdrop-blur-sm + shadow-lg — rather than an ad-hoc neutral\n // white/gray tint that doesn't match the kit's own convention\n // for \"a small panel floating over content.\" Only while floating —\n // inside the title header it's part of the bar, not over content.\n title == null && popoverChrome,\n classNames?.controls,\n )}\n >\n {controls}\n {isCollapsible && (\n <ExpandTrigger\n expanded={expanded}\n onToggle={() => setExpanded((prev) => !prev)}\n expandLabel={t.expand}\n collapseLabel={t.collapse}\n icons={icons}\n className={classNames?.expandButton}\n testId={testId && `${testId}-expand`}\n />\n )}\n {withCopyButton && (\n <CopyTrigger\n code={code}\n onCopy={onCopy}\n copyLabel={t.copy}\n copiedLabel={t.copied}\n icons={icons}\n className={classNames?.copyButton}\n testId={testId && `${testId}-copy`}\n />\n )}\n </div>\n )\n\n return (\n <div\n className={cn(\n \"relative rounded-card border border-brand-900/30 dark:border-white/10 bg-white/4\",\n className,\n classNames?.root,\n )}\n {...props({ \"data-testid\": testId })}\n >\n {title != null ? (\n <div\n className={cn(\n \"flex min-h-9 items-center gap-2 border-b border-brand-900/30 dark:border-white/10 ps-4 pe-2\",\n \"text-xs font-mono\",\n TEXT_COLOR_CLASSES.muted,\n classNames?.title,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{title}</span>\n {toolbar}\n </div>\n ) : (\n toolbar\n )}\n\n {headContent}\n\n {isCollapsible && <Collapse open={expanded}>{tailContent}</Collapse>}\n\n {isCollapsible && (\n // Pinned to the *outer* card's own bottom edge (that div is the\n // nearest positioned ancestor), not to the code/Collapse content —\n // so it tracks the container's live height as Collapse animates\n // open/closed instead of sitting at a fixed spot relative to the\n // head/tail boundary, which \"teleported\" relative to the visibly\n // growing/shrinking content. Always mounted; only opacity toggles,\n // in sync with Collapse's own 300ms timing, so it fades together\n // with the reveal instead of popping in/out at the instant of click.\n <div\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-x-0 bottom-0 h-8 rounded-b-card\",\n \"transition-opacity duration-300\",\n // Same brand-tinted family as this card's own border\n // (border-brand-900/30 dark:border-white/10) and the toolbar's\n // popoverChrome (bg-brand-50/90 dark:bg-brand-950/85) — a plain\n // neutral white/gray-950 fade doesn't match either, and visibly\n // seams against a brand-tinted page background (dark mode's\n // --color-fd-background is brand-950, not a neutral gray).\n \"bg-linear-to-t from-brand-50/95 to-transparent dark:from-brand-950/95\",\n expanded ? \"opacity-0\" : \"opacity-100\",\n )}\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/code-block/chrome.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAwBA,IAAM,oBAAA,GAA8C;AAAA,EAClD,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,WAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAOO,IAAM,aAAA,GAAsD;AAAA,EACjE,IAAA,kBAAM,GAAA,CAAC,QAAA,EAAA,EAAS,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EACvC,MAAA,kBAAQ,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC1C,MAAA,kBAAQ,GAAA,CAAC,eAAA,EAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAChD,QAAA,kBAAU,GAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAW,UAAA,EAAY;AAClD;AAyBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA;AAAA,EAAC,GAAA,CAAI,MAAA;AAAA,EAAJ;AAAA,I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;AAAA;AAAA;AAC7B;AAAA;AAAA,GAEJ;AAGF,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,EAAA;AAAA,QACT,kFAAA;AAAA,QACA,SAAA;AAAA,QACA,UAAA,EAAY;AAAA,OACd;AAAA,MACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAElC,QAAA,EAAA;AAAA,QAAA,KAAA,IAAS,IAAA,mBACR,IAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,EAAA;AAAA,cACT,6FAAA;AAAA,cACA,mBAAA;AAAA,cACA,kBAAA,CAAmB,KAAA;AAAA,cACnB,UAAA,EAAY;AAAA,aACd;AAAA,YAEA,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yBAAA,EAA2B,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,cAChD;AAAA;AAAA;AAAA,SACH,GAEA,OAAA;AAAA,QAGD,WAAA;AAAA,QAEA,aAAA,oBAAiB,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,UAAW,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,QAExD,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASC,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAW,IAAA;AAAA,YACX,SAAA,EAAW,EAAA;AAAA,cACT,oEAAA;AAAA,cACA,iCAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAOA,uEAAA;AAAA,cACA,WAAW,WAAA,GAAc;AAAA;AAC3B;AAAA;AACF;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-HQPU73WV.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useClipboard } from \"@ark-ui/react/clipboard\"\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon, CopyIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\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 { popoverChrome } from \"../popover/popover\"\nimport { Tooltip } from \"../tooltip/tooltip\"\n\nexport type CodeBlockTranslations = {\n copy: string\n copied: string\n expand: string\n collapse: string\n}\n\nconst DEFAULT_TRANSLATIONS: CodeBlockTranslations = {\n copy: \"Copy\",\n copied: \"Copied\",\n expand: \"Show more\",\n collapse: \"Show less\",\n}\n\nexport type CodeBlockIconSlot = \"copy\" | \"copied\" | \"expand\" | \"collapse\"\n/** The toolbar's icons: `copy` and `copied` on the copy button, `expand` and\n * `collapse` on the collapse toggle. `null` leaves that button empty. */\nexport type CodeBlockIcons = IconMap<CodeBlockIconSlot>\n\nexport const DEFAULT_ICONS: Record<CodeBlockIconSlot, ReactNode> = {\n copy: <CopyIcon className={iconStroke} />,\n copied: <CheckIcon className={iconStroke} />,\n expand: <ChevronDownIcon className={iconStroke} />,\n collapse: <ChevronUpIcon className={iconStroke} />,\n}\n\nexport type CodeBlockClassNames = {\n root?: string\n title?: string\n pre?: string\n controls?: string\n copyButton?: string\n expandButton?: string\n}\n\nexport type CodeBlockButtonProps = HTMLArkProps<\"button\"> & WithTestId\n\n/**\n * `CodeBlock.Button` — the toolbar's own compact icon-button primitive.\n * `Copy`/expand use it internally, and it's exported so a consumer's own\n * `controls` button matches the exact same size/style instead of hand-\n * rolling one — same composition API as the rest of the kit (`asChild`, via\n * `HTMLArkProps`, so it wraps in a `Tooltip` exactly like the built-in\n * buttons do).\n *\n * A plain hand-rolled button, not an `ActionIcon` wrapper: this toolbar\n * needed something smaller than `ActionIcon`'s own `xs` floor, which is\n * sized for general-purpose use, not a compact floating strip over code.\n */\nexport const CodeBlockButton = ({\n className,\n asChild,\n type,\n testId,\n ...rest\n}: CodeBlockButtonProps) => (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n {...props({ \"data-testid\": testId })}\n className={cn(\n \"inline-flex size-6 shrink-0 items-center justify-center rounded\",\n \"text-(--c-text) [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"hover:bg-(--c-soft)\",\n focusStyles({ offset: false }),\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n />\n)\n\ntype CopyTriggerProps = {\n code: string\n onCopy?: () => void\n copyLabel: string\n copiedLabel: string\n icons: Record<CodeBlockIconSlot, ReactNode>\n className?: string\n testId?: string\n}\n\n/**\n * Renaming the focused button (`aria-label` → \"Copied\") isn't re-read by\n * screen readers, so the copy is also announced through a visually hidden\n * `role=\"status\"` beside it: mounted empty, filled while `copied` lasts. It is\n * a sibling of the `Tooltip`-wrapped button (`asChild` needs one element), and\n * `sr-only` takes it out of the toolbar's flex row.\n *\n * Uses Ark's `useClipboard` hook directly rather than the `Clipboard.Root`/\n * `Clipboard.Indicator` components — both render their own wrapping `<div>`\n * (`data-part=\"root\"`/`\"indicator\"`), which, sitting as a direct child of the\n * toolbar's flex row, threw off its sizing/alignment next to the plain\n * `ActionIcon` the `ExpandTrigger` renders. The hook gives the same\n * `copied`/`copy` state machine with no imposed DOM structure at all — this\n * renders as a single real `<button>`, exactly like `ExpandTrigger`.\n */\nfunction CopyTrigger({\n code,\n onCopy,\n copyLabel,\n copiedLabel,\n icons,\n className,\n testId,\n}: CopyTriggerProps) {\n const { copied, copy } = useClipboard({\n value: code,\n timeout: 2000,\n onStatusChange: (details) => details.copied && onCopy?.(),\n })\n const label = copied ? copiedLabel : copyLabel\n return (\n <>\n <Tooltip label={label} asChild>\n <CodeBlockButton aria-label={label} onClick={copy} className={className} testId={testId}>\n {copied ? icons.copied : icons.copy}\n </CodeBlockButton>\n </Tooltip>\n <span role=\"status\" className=\"sr-only\">\n {copied ? copiedLabel : \"\"}\n </span>\n </>\n )\n}\n\ntype ExpandTriggerProps = {\n expanded: boolean\n onToggle: () => void\n expandLabel: string\n collapseLabel: string\n icons: Record<CodeBlockIconSlot, ReactNode>\n className?: string\n testId?: string\n}\n\n/** Toolbar icon button toggling the collapsed \"tail\" seam — an\n * `aria-expanded` `ActionIcon` with a matching `Tooltip`/accessible name,\n * same shape as `CopyTrigger`. Only rendered when `isCollapsible`. */\nfunction ExpandTrigger({\n expanded,\n onToggle,\n expandLabel,\n collapseLabel,\n icons,\n className,\n testId,\n}: ExpandTriggerProps) {\n const label = expanded ? collapseLabel : expandLabel\n return (\n <Tooltip label={label} asChild>\n <CodeBlockButton\n aria-label={label}\n aria-expanded={expanded}\n onClick={onToggle}\n className={className}\n testId={testId}\n >\n {expanded ? icons.collapse : icons.expand}\n </CodeBlockButton>\n </Tooltip>\n )\n}\n\nexport type CodeBlockChromeProps = WithTestId & {\n /** Raw source, used only for the copy button's clipboard value — this\n * component never highlights anything itself. */\n code: string\n /** Whether the tail half exists at all (mirrors the caller's own\n * `collapsedLines`/line-count decision) — controls whether the expand\n * toggle and the `Collapse`-wrapped tail slot render at all. */\n isCollapsible: boolean\n /** The head half's already-rendered content (highlighted HTML, or a\n * loading fallback — this component has no opinion on which). */\n headContent: ReactNode\n /** The tail half's already-rendered content — only read when\n * `isCollapsible`. */\n tailContent?: ReactNode\n\n /** Header row above the code; hosts the toolbar when set. */\n title?: ReactNode\n\n /** @default true */\n withCopyButton?: boolean\n onCopy?: () => void\n\n /** @default false */\n defaultExpanded?: boolean\n expanded?: boolean\n onExpandedChange?: (expanded: boolean) => void\n\n /** Replaces the toolbar's icons: `copy`, `copied`, `expand`, `collapse`. A missing key keeps\n * its default; `null` leaves that button empty. */\n icons?: CodeBlockIcons\n controls?: ReactNode\n translations?: Partial<CodeBlockTranslations>\n className?: string\n classNames?: CodeBlockClassNames\n}\n\n/**\n * The interactive shell shared by `CodeBlock` (client, highlights via\n * `highlightCode` in an effect) and `CodeBlock.Static` (an async Server\n * Component that `await`s `highlightCode` directly during render, for a\n * fully static/SSR'd result with zero client JS spent on Shiki) — this\n * component owns the toolbar/copy/collapse-expand interactivity and\n * nothing about HOW `headContent`/`tailContent` were produced. Kept in its\n * own file specifically so `CodeBlock.Static` (no `\"use client\"`, safe to\n * import from a Server Component) can render it without pulling in\n * `code-block.tsx`'s own client-only highlighting logic.\n */\nexport function CodeBlockChrome({\n code,\n isCollapsible,\n headContent,\n tailContent,\n title,\n withCopyButton = true,\n onCopy,\n defaultExpanded = false,\n expanded: expandedProp,\n onExpandedChange,\n icons: iconsProp,\n controls,\n translations,\n testId,\n className,\n classNames,\n}: CodeBlockChromeProps) {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n\n const [expanded, setExpanded] = useUncontrolled({\n value: expandedProp,\n defaultValue: defaultExpanded,\n finalValue: false,\n onChange: onExpandedChange,\n })\n\n // A fixed `top-2` reads fine pinned to the corner of a tall, multi-line\n // block, but on a single line there's no \"corner\" to anchor to — it just\n // looks like an arbitrarily offset button. True vertical centering (equal\n // gap above/below) is the correct treatment there instead.\n const isSingleLine = !code.includes(\"\\n\")\n\n const toolbar = (controls != null || withCopyButton || isCollapsible) && (\n <div\n className={cn(\n \"flex items-center gap-1 p-0.5\",\n // In a title header the toolbar sits in-flow at the row's end;\n // otherwise it floats over the code's top-right corner. Physical on\n // purpose, not `inset-e-*`: the code is always `dir=\"ltr\"` (even on an\n // RTL page), so its lines end on the right; a logical inset would put\n // the toolbar over the start of every line under `dir=\"rtl\"`.\n title == null && \"absolute right-2 z-10\",\n title == null && (isSingleLine ? \"top-1/2 -translate-y-1/2\" : \"top-2\"),\n // Same floating-surface chrome every other overlay panel in the\n // kit uses (Popover/Menu/Select's positioner) — border-brand-900/20\n // dark:border-white/15 + bg-brand-50/90 dark:bg-brand-950/85 +\n // backdrop-blur-sm + shadow-lg — rather than an ad-hoc neutral\n // white/gray tint that doesn't match the kit's own convention\n // for \"a small panel floating over content.\" Only while floating —\n // inside the title header it's part of the bar, not over content.\n title == null && popoverChrome,\n classNames?.controls,\n )}\n >\n {controls}\n {isCollapsible && (\n <ExpandTrigger\n expanded={expanded}\n onToggle={() => setExpanded((prev) => !prev)}\n expandLabel={t.expand}\n collapseLabel={t.collapse}\n icons={icons}\n className={classNames?.expandButton}\n testId={testId && `${testId}-expand`}\n />\n )}\n {withCopyButton && (\n <CopyTrigger\n code={code}\n onCopy={onCopy}\n copyLabel={t.copy}\n copiedLabel={t.copied}\n icons={icons}\n className={classNames?.copyButton}\n testId={testId && `${testId}-copy`}\n />\n )}\n </div>\n )\n\n return (\n <div\n className={cn(\n \"relative rounded-card border border-brand-900/30 dark:border-white/10 bg-white/4\",\n className,\n classNames?.root,\n )}\n {...props({ \"data-testid\": testId })}\n >\n {title != null ? (\n <div\n className={cn(\n \"flex min-h-9 items-center gap-2 border-b border-brand-900/30 dark:border-white/10 ps-4 pe-2\",\n \"text-xs font-mono\",\n TEXT_COLOR_CLASSES.muted,\n classNames?.title,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{title}</span>\n {toolbar}\n </div>\n ) : (\n toolbar\n )}\n\n {headContent}\n\n {isCollapsible && <Collapse open={expanded}>{tailContent}</Collapse>}\n\n {isCollapsible && (\n // Pinned to the *outer* card's own bottom edge (that div is the\n // nearest positioned ancestor), not to the code/Collapse content —\n // so it tracks the container's live height as Collapse animates\n // open/closed instead of sitting at a fixed spot relative to the\n // head/tail boundary, which \"teleported\" relative to the visibly\n // growing/shrinking content. Always mounted; only opacity toggles,\n // in sync with Collapse's own 300ms timing, so it fades together\n // with the reveal instead of popping in/out at the instant of click.\n <div\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-x-0 bottom-0 h-8 rounded-b-card\",\n \"transition-opacity duration-300\",\n // Same brand-tinted family as this card's own border\n // (border-brand-900/30 dark:border-white/10) and the toolbar's\n // popoverChrome (bg-brand-50/90 dark:bg-brand-950/85) — a plain\n // neutral white/gray-950 fade doesn't match either, and visibly\n // seams against a brand-tinted page background (dark mode's\n // --color-fd-background is brand-950, not a neutral gray).\n \"bg-linear-to-t from-brand-50/95 to-transparent dark:from-brand-950/95\",\n expanded ? \"opacity-0\" : \"opacity-100\",\n )}\n />\n )}\n </div>\n )\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useLinkComponent } from './chunk-GTKKRV5N.js';
|
|
2
2
|
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
3
|
-
import { ChevronIcon } from './chunk-
|
|
4
|
-
import { Collapse } from './chunk-
|
|
3
|
+
import { ChevronIcon } from './chunk-6YNLRQ25.js';
|
|
4
|
+
import { Collapse } from './chunk-NKOTA5TM.js';
|
|
5
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
6
|
-
import { focusStyles } from './chunk-
|
|
6
|
+
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
7
7
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
8
|
-
import { cn } from './chunk-
|
|
8
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
9
9
|
import { cva } from 'class-variance-authority';
|
|
10
10
|
import { useId } from 'react';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -165,5 +165,5 @@ function Navigation(props2) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export { NavLink, Navigation };
|
|
168
|
-
//# sourceMappingURL=chunk-
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
168
|
+
//# sourceMappingURL=chunk-HRNWWL3Y.js.map
|
|
169
|
+
//# sourceMappingURL=chunk-HRNWWL3Y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/nav-link/nav-link.tsx","../src/components/nav-link/navigation.tsx"],"names":["props","jsx"],"mappings":";;;;;;;;;;;;AA6CA,IAAM,UAAA,GAAa,GAAA;AAAA,EACjB;AAAA,IACE,iGAAA;AAAA,IACA,gCAAA;AAAA,IACA,wCAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,uEAAA;AAAA,QACN,OAAO,kBAAA,CAAmB;AAAA;AAC5B,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,KAAA;AAAM;AAEtC,CAAA;AAEA,IAAM,aAAA,GAAgB,EAAA;AAAA,EACpB,yGAAA;AAAA,EACA,2DAAA;AAAA,EACA,WAAA;AACF,CAAA;AAEA,IAAM,OAAA,GAAU,CAAC,IAAA,qBACf,GAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACC,aAAA,EAAY,MAAA;AAAA,IACZ,YAAA,EAAY,OAAO,MAAA,GAAS,QAAA;AAAA,IAC5B,SAAA,EAAU,wFAAA;AAAA,IAEV,8BAAC,WAAA,EAAA,EAAY;AAAA;AACf,CAAA;AAkDF,SAAS,WAAA,CAAY;AAAA,EACnB,KAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAiB;AACf,EAAA,MAAM,CAAC,MAAA,EAAQ,OAAO,CAAA,GAAI,eAAA,CAAyB;AAAA,IACjD,KAAA,EAAO,IAAA;AAAA,IACP,YAAA,EAAc,WAAA;AAAA,IACd,UAAA,EAAY,KAAA;AAAA,IACZ,QAAA,EAAU;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,KAAM,UAAA,CAAW,IAAA,EAAM,CAAA,IAAA,EAAO,CAAC,CAAA,CAAA,EAAI,aAAA,EAAe,YAAY,CAAC,CAAA,EAClF,CAAA;AAEJ;AAIO,SAAS,WAAWD,MAAAA,EAAmC;AAC5D,EAAA,uBAAOC,GAAAA,CAAC,cAAA,EAAA,EAAgB,GAAGD,MAAAA,EAAO,CAAA;AACpC","file":"chunk-Q5ZO2O25.js","sourcesContent":["\"use client\"\n\nimport { cva } from \"class-variance-authority\"\nimport { type ElementType, type ReactNode, useId } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useLinkComponent } from \"../../lib/link-component\"\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 { ChevronIcon } from \"../popover/icons\"\n\n/**\n * NavLink — a single sidebar/nav row: leading `startSlot`, `label`, trailing\n * `endSlot`, current-page treatment, and self-nesting via `children` for\n * arbitrary-depth sub-navigation (each nested `<NavLink>` renders indented,\n * revealed with `Collapse` when the parent is `open`).\n *\n * Router-agnostic: pass whatever the target link needs as `linkOptions` (a\n * plain `{ href }` for a bare `<a>`, or a framework router's own shape, e.g.\n * TanStack Router's `{ to, params }`) — it's spread verbatim onto whatever\n * renders the link. `linkComponent` picks what that is; if omitted, it falls\n * back to the app-wide `<LinkComponentProvider>` (see `lib/link-component`),\n * then to a plain `<a>`. Generic over `linkOptions`'s shape so a router's own\n * type-safety utilities can validate/autocomplete it — see\n * `nav-link/tanstack.tsx` for a TanStack Router–typed wrapper built this way.\n *\n * A row with no `linkOptions` (a pure category / toggle heading) renders as a\n * `<button>` instead of a link. A row with both `linkOptions` and nested\n * children renders the link and its expand/collapse toggle as two separate\n * controls (a link nested inside a button, or vice versa, isn't valid HTML).\n *\n * A `disabled` link row drops its target: it renders a plain `<a role=\"link\"\n * aria-disabled=\"true\">` with no `href` (and so no tab stop), bypassing\n * `linkComponent` — a router's `Link` would put the `href` straight back.\n *\n * <NavLink label=\"Dashboard\" startSlot={<Home />} linkOptions={{ href: \"/dashboard\" }} />\n * <NavLink label=\"Settings\" startSlot={<Settings />} defaultOpen>\n * <NavLink label=\"Profile\" linkOptions={{ href: \"/settings/profile\" }} />\n * <NavLink label=\"Security\" linkOptions={{ href: \"/settings/security\" }} />\n * </NavLink>\n */\n\nconst navLinkRow = cva(\n [\n \"flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2.5 py-2 text-start text-sm\",\n \"outline-none transition-colors\",\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n focusStyles(),\n \"aria-disabled:pointer-events-none aria-disabled:opacity-50\",\n ],\n {\n variants: {\n current: {\n true: \"bg-black/5 font-medium text-brand-950 dark:bg-white/8 dark:text-white\",\n false: TEXT_COLOR_CLASSES.secondary,\n },\n },\n defaultVariants: { current: false },\n },\n)\n\nconst chevronButton = cn(\n \"flex shrink-0 cursor-pointer items-center justify-center rounded-md p-2 text-black/50 transition-colors\",\n \"hover:bg-black/5 dark:text-white/50 dark:hover:bg-white/8\",\n focusStyles(),\n)\n\nconst chevron = (open: boolean) => (\n <span\n aria-hidden=\"true\"\n data-state={open ? \"open\" : \"closed\"}\n className=\"ms-auto flex shrink-0 transition-transform data-[state=open]:rotate-180 [&_svg]:size-4\"\n >\n <ChevronIcon />\n </span>\n)\n\nexport type NavLinkClassNames = {\n /** The link/button row itself. */\n row?: string\n /** The indented container holding nested `<NavLink>` children. */\n items?: string\n}\n\n/** The expand/collapse chevron's accessible names — the same keys as `Notification`'s. Only\n * rendered for a row that is both a link and has children (a pure toggle row is its own\n * button, named by its label). */\nexport type NavLinkTranslations = {\n /** While the children are revealed. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** While the children are hidden. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\nexport type NavLinkProps<TOptions = unknown> = WithTestId & {\n label: ReactNode\n /** Leading slot (icon, avatar, etc). */\n startSlot?: ReactNode\n /** Trailing slot (e.g. a count or status badge). */\n endSlot?: ReactNode\n /** Marks this as the active/current page. */\n current?: boolean\n /** Not interactive: a link row loses its `href` and tab stop, a toggle row\n * its button behaviour; both keep `aria-disabled` so they're announced. */\n disabled?: boolean\n /** Whether nested `children` are revealed. Uncontrolled by default. */\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** The router's own link options — e.g. `{ href: \"/x\" }` for a plain `<a>`,\n * or `{ to: \"/x\", params: {...} }` for TanStack Router. Omit for a pure\n * category/toggle row with no link of its own. */\n linkOptions?: TOptions\n /** Overrides the `<LinkComponentProvider>` for this row only. */\n linkComponent?: ElementType\n classNames?: NavLinkClassNames\n className?: string\n /** Overrides the expand/collapse chevron's accessible names. A partial override keeps the\n * other default. */\n translations?: NavLinkTranslations\n /** Nested `<NavLink>` elements, revealed when `open`. */\n children?: ReactNode\n}\n\nfunction NavLinkImpl({\n label,\n startSlot,\n endSlot,\n current,\n disabled,\n open,\n defaultOpen,\n onOpenChange,\n linkOptions,\n linkComponent,\n classNames,\n className,\n translations,\n children,\n testId,\n}: NavLinkProps) {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange: onOpenChange,\n })\n const hasChildren = children != null\n const isLink = linkOptions != null\n const Comp = useLinkComponent(linkComponent) ?? \"a\"\n const itemsId = `nav-link-items-${useId()}`\n\n const content = (\n <>\n {startSlot}\n <span className=\"min-w-0 flex-1 truncate\">{label}</span>\n {endSlot}\n </>\n )\n\n const rowClassName = cn(navLinkRow({ current }), classNames?.row, className)\n const rowState = props({\n \"aria-current\": current && \"page\",\n \"aria-disabled\": disabled,\n \"data-testid\": testId,\n })\n\n return (\n <div>\n <div className=\"flex items-stretch gap-1\">\n {isLink && disabled ? (\n // No `href`, so no tab stop and nothing for Enter to follow; the\n // explicit role keeps it announced as a (disabled) link.\n <a role=\"link\" {...rowState} className={rowClassName}>\n {content}\n </a>\n ) : isLink ? (\n <Comp {...linkOptions} {...rowState} className={rowClassName}>\n {content}\n </Comp>\n ) : (\n <button\n type=\"button\"\n {...rowState}\n aria-expanded={hasChildren ? isOpen : undefined}\n {...props({ \"aria-controls\": hasChildren && itemsId })}\n disabled={disabled}\n onClick={() => hasChildren && setOpen(!isOpen)}\n className={rowClassName}\n >\n {content}\n {hasChildren && chevron(isOpen)}\n </button>\n )}\n {hasChildren && isLink && (\n <button\n type=\"button\"\n aria-expanded={isOpen}\n aria-controls={itemsId}\n aria-label={\n isOpen\n ? (translations?.collapseLabel ?? \"Collapse\")\n : (translations?.expandLabel ?? \"Expand\")\n }\n onClick={() => setOpen(!isOpen)}\n className={chevronButton}\n >\n {chevron(isOpen)}\n </button>\n )}\n </div>\n {hasChildren && (\n <Collapse open={isOpen}>\n <div\n id={itemsId}\n className={cn(\n \"ms-4.5 space-y-0.5 border-s border-brand-900/20 ps-2 pt-0.5 dark:border-white/15\",\n classNames?.items,\n )}\n >\n {children}\n </div>\n </Collapse>\n )}\n </div>\n )\n}\n\n/**\n * `NavLink<TOptions>` — generic so a router's own type-safety utility (e.g.\n * TanStack Router's `ValidateLinkOptions`) can validate `linkOptions` when\n * explicitly parameterized. The implementation itself stays untyped/loose\n * (the generic can't be forwarded through the JSX body); see\n * TanStack Router's own documented pattern for this exact split.\n */\nexport function NavLink<TOptions = unknown>(props: NavLinkProps<TOptions>): ReactNode\nexport function NavLink(props: NavLinkProps): ReactNode {\n return <NavLinkImpl {...props} />\n}\n","\"use client\"\n\nimport type { ElementType, ReactNode } from \"react\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { NavLink, type NavLinkClassNames, type NavLinkTranslations } from \"./nav-link\"\n\n/**\n * `Navigation` — the `data`-driven convenience wrapper over `NavLink` (same\n * relationship as `menu-data.tsx` to `menu.tsx`): pass a `data` array, get a\n * fully wired, arbitrarily-nested nav tree.\n *\n * <Navigation\n * data={[\n * { label: \"Dashboard\", startSlot: <Home />, linkOptions: { href: \"/dashboard\" } },\n * { label: \"Settings\", startSlot: <Settings />, items: [\n * { label: \"Profile\", linkOptions: { href: \"/settings/profile\" } },\n * { label: \"Security\", linkOptions: { href: \"/settings/security\" } },\n * ]},\n * ]}\n * />\n *\n * Generic over the same `TOptions` as `NavLink` — parameterize it (e.g. with\n * `TanStackLinkOptions` from `nav-link/tanstack`) to get a router's own\n * type-safety utilities validating every entry's `linkOptions`.\n *\n * Renders a real list — a `<ul>` of `<li>`, nested `<ul>`s for `items` — so a\n * screen reader announces how many entries each level holds. List styles are\n * reset, so it looks the same as composing `NavLink`s by hand.\n */\nexport type NavigationItem<TOptions = unknown> = {\n label: ReactNode\n startSlot?: ReactNode\n endSlot?: ReactNode\n current?: boolean\n disabled?: boolean\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n linkOptions?: TOptions\n classNames?: NavLinkClassNames\n /** `data-testid` on this entry's row (its link or button). */\n testId?: string\n /** Nested entries — an item with `items` renders its children indented,\n * revealed on expand/collapse. Recursive: nests to any depth. */\n items?: readonly NavigationItem<TOptions>[]\n}\n\nexport type NavigationProps<TOptions = unknown> = WithTestId & {\n /** The nav entries, in order. */\n data: readonly NavigationItem<TOptions>[]\n /** Overrides the app-wide `<LinkComponentProvider>` for every generated row. */\n linkComponent?: ElementType\n /** `NavLink`'s chevron names, forwarded to every generated row. */\n translations?: NavLinkTranslations\n}\n\n/** The `<ul>` reset: no bullets, no indent, so the list is invisible. */\nconst listClasses = \"m-0 list-none p-0\"\n\nconst renderItem = (\n item: NavigationItem,\n key: string,\n linkComponent: ElementType | undefined,\n translations: NavLinkTranslations | undefined,\n): ReactNode => (\n <li key={key}>\n <NavLink\n label={item.label}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n current={item.current}\n disabled={item.disabled}\n open={item.open}\n defaultOpen={item.defaultOpen}\n onOpenChange={item.onOpenChange}\n linkOptions={item.linkOptions}\n linkComponent={linkComponent}\n classNames={item.classNames}\n translations={translations}\n testId={item.testId}\n >\n {item.items && item.items.length > 0 ? (\n // NavLink spaces its direct children; the list is now that one child,\n // so it carries the same spacing for its own items.\n <ul className={`${listClasses} space-y-0.5`}>\n {item.items.map((child, i) =>\n renderItem(child, `${key}.${i}`, linkComponent, translations),\n )}\n </ul>\n ) : undefined}\n </NavLink>\n </li>\n)\n\nfunction NavigationImpl({ data, linkComponent, translations, testId }: NavigationProps) {\n return (\n <ul className={listClasses} {...props({ \"data-testid\": testId })}>\n {data.map((item, i) => renderItem(item, `nav-${i}`, linkComponent, translations))}\n </ul>\n )\n}\n\n/** Generic for the same reason as `NavLink` — see its doc comment. */\nexport function Navigation<TOptions = unknown>(props: NavigationProps<TOptions>): ReactNode\nexport function Navigation(props: NavigationProps): ReactNode {\n return <NavigationImpl {...props} />\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/nav-link/nav-link.tsx","../src/components/nav-link/navigation.tsx"],"names":["props","jsx"],"mappings":";;;;;;;;;;;;AA6CA,IAAM,UAAA,GAAa,GAAA;AAAA,EACjB;AAAA,IACE,iGAAA;AAAA,IACA,gCAAA;AAAA,IACA,wCAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,uEAAA;AAAA,QACN,OAAO,kBAAA,CAAmB;AAAA;AAC5B,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,KAAA;AAAM;AAEtC,CAAA;AAEA,IAAM,aAAA,GAAgB,EAAA;AAAA,EACpB,yGAAA;AAAA,EACA,2DAAA;AAAA,EACA,WAAA;AACF,CAAA;AAEA,IAAM,OAAA,GAAU,CAAC,IAAA,qBACf,GAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACC,aAAA,EAAY,MAAA;AAA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S,CAAA;AAAA;AAAA;AAAA,sBAGjCA,IAAC,IAAA,EAAA,EAAG,SAAA,EAAW,GAAG,WAAW,CAAA,YAAA,CAAA,EAC1B,eAAK,KAAA,CAAM,GAAA;AAAA,QAAI,CAAC,KAAA,EAAO,CAAA,KACtB,UAAA,CAAW,KAAA,EAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,EAAI,aAAA,EAAe,YAAY;AAAA,OAC9D,EACF;AAAA,QACE;AAAA;AACN,CAAA,EAAA,EAzBO,GA0BT,CAAA;AAGF,SAAS,eAAe,EAAE,IAAA,EAAM,aAAA,EAAe,YAAA,EAAc,QAAO,EAAoB;AACtF,EAAA,uBACEA,GAAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAW,WAAA,EAAc,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,MAAA,EAAQ,CAAA,EAC5D,eAAK,GAAA,CAAI,CAAC,IAAA,EAAM,CAAA,KAAM,UAAA,CAAW,IAAA,EAAM,CAAA,IAAA,EAAO,CAAC,CAAA,CAAA,EAAI,aAAA,EAAe,YAAY,CAAC,CAAA,EAClF,CAAA;AAEJ;AAIO,SAAS,WAAWD,MAAAA,EAAmC;AAC5D,EAAA,uBAAOC,GAAAA,CAAC,cAAA,EAAA,EAAgB,GAAGD,MAAAA,EAAO,CAAA;AACpC","file":"chunk-HRNWWL3Y.js","sourcesContent":["\"use client\"\n\nimport { cva } from \"class-variance-authority\"\nimport { type ElementType, type ReactNode, useId } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useLinkComponent } from \"../../lib/link-component\"\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 { ChevronIcon } from \"../popover/icons\"\n\n/**\n * NavLink — a single sidebar/nav row: leading `startSlot`, `label`, trailing\n * `endSlot`, current-page treatment, and self-nesting via `children` for\n * arbitrary-depth sub-navigation (each nested `<NavLink>` renders indented,\n * revealed with `Collapse` when the parent is `open`).\n *\n * Router-agnostic: pass whatever the target link needs as `linkOptions` (a\n * plain `{ href }` for a bare `<a>`, or a framework router's own shape, e.g.\n * TanStack Router's `{ to, params }`) — it's spread verbatim onto whatever\n * renders the link. `linkComponent` picks what that is; if omitted, it falls\n * back to the app-wide `<LinkComponentProvider>` (see `lib/link-component`),\n * then to a plain `<a>`. Generic over `linkOptions`'s shape so a router's own\n * type-safety utilities can validate/autocomplete it — see\n * `nav-link/tanstack.tsx` for a TanStack Router–typed wrapper built this way.\n *\n * A row with no `linkOptions` (a pure category / toggle heading) renders as a\n * `<button>` instead of a link. A row with both `linkOptions` and nested\n * children renders the link and its expand/collapse toggle as two separate\n * controls (a link nested inside a button, or vice versa, isn't valid HTML).\n *\n * A `disabled` link row drops its target: it renders a plain `<a role=\"link\"\n * aria-disabled=\"true\">` with no `href` (and so no tab stop), bypassing\n * `linkComponent` — a router's `Link` would put the `href` straight back.\n *\n * <NavLink label=\"Dashboard\" startSlot={<Home />} linkOptions={{ href: \"/dashboard\" }} />\n * <NavLink label=\"Settings\" startSlot={<Settings />} defaultOpen>\n * <NavLink label=\"Profile\" linkOptions={{ href: \"/settings/profile\" }} />\n * <NavLink label=\"Security\" linkOptions={{ href: \"/settings/security\" }} />\n * </NavLink>\n */\n\nconst navLinkRow = cva(\n [\n \"flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2.5 py-2 text-start text-sm\",\n \"outline-none transition-colors\",\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n focusStyles(),\n \"aria-disabled:pointer-events-none aria-disabled:opacity-50\",\n ],\n {\n variants: {\n current: {\n true: \"bg-black/5 font-medium text-brand-950 dark:bg-white/8 dark:text-white\",\n false: TEXT_COLOR_CLASSES.secondary,\n },\n },\n defaultVariants: { current: false },\n },\n)\n\nconst chevronButton = cn(\n \"flex shrink-0 cursor-pointer items-center justify-center rounded-md p-2 text-black/50 transition-colors\",\n \"hover:bg-black/5 dark:text-white/50 dark:hover:bg-white/8\",\n focusStyles(),\n)\n\nconst chevron = (open: boolean) => (\n <span\n aria-hidden=\"true\"\n data-state={open ? \"open\" : \"closed\"}\n className=\"ms-auto flex shrink-0 transition-transform data-[state=open]:rotate-180 [&_svg]:size-4\"\n >\n <ChevronIcon />\n </span>\n)\n\nexport type NavLinkClassNames = {\n /** The link/button row itself. */\n row?: string\n /** The indented container holding nested `<NavLink>` children. */\n items?: string\n}\n\n/** The expand/collapse chevron's accessible names — the same keys as `Notification`'s. Only\n * rendered for a row that is both a link and has children (a pure toggle row is its own\n * button, named by its label). */\nexport type NavLinkTranslations = {\n /** While the children are revealed. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** While the children are hidden. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\nexport type NavLinkProps<TOptions = unknown> = WithTestId & {\n label: ReactNode\n /** Leading slot (icon, avatar, etc). */\n startSlot?: ReactNode\n /** Trailing slot (e.g. a count or status badge). */\n endSlot?: ReactNode\n /** Marks this as the active/current page. */\n current?: boolean\n /** Not interactive: a link row loses its `href` and tab stop, a toggle row\n * its button behaviour; both keep `aria-disabled` so they're announced. */\n disabled?: boolean\n /** Whether nested `children` are revealed. Uncontrolled by default. */\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** The router's own link options — e.g. `{ href: \"/x\" }` for a plain `<a>`,\n * or `{ to: \"/x\", params: {...} }` for TanStack Router. Omit for a pure\n * category/toggle row with no link of its own. */\n linkOptions?: TOptions\n /** Overrides the `<LinkComponentProvider>` for this row only. */\n linkComponent?: ElementType\n classNames?: NavLinkClassNames\n className?: string\n /** Overrides the expand/collapse chevron's accessible names. A partial override keeps the\n * other default. */\n translations?: NavLinkTranslations\n /** Nested `<NavLink>` elements, revealed when `open`. */\n children?: ReactNode\n}\n\nfunction NavLinkImpl({\n label,\n startSlot,\n endSlot,\n current,\n disabled,\n open,\n defaultOpen,\n onOpenChange,\n linkOptions,\n linkComponent,\n classNames,\n className,\n translations,\n children,\n testId,\n}: NavLinkProps) {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange: onOpenChange,\n })\n const hasChildren = children != null\n const isLink = linkOptions != null\n const Comp = useLinkComponent(linkComponent) ?? \"a\"\n const itemsId = `nav-link-items-${useId()}`\n\n const content = (\n <>\n {startSlot}\n <span className=\"min-w-0 flex-1 truncate\">{label}</span>\n {endSlot}\n </>\n )\n\n const rowClassName = cn(navLinkRow({ current }), classNames?.row, className)\n const rowState = props({\n \"aria-current\": current && \"page\",\n \"aria-disabled\": disabled,\n \"data-testid\": testId,\n })\n\n return (\n <div>\n <div className=\"flex items-stretch gap-1\">\n {isLink && disabled ? (\n // No `href`, so no tab stop and nothing for Enter to follow; the\n // explicit role keeps it announced as a (disabled) link.\n <a role=\"link\" {...rowState} className={rowClassName}>\n {content}\n </a>\n ) : isLink ? (\n <Comp {...linkOptions} {...rowState} className={rowClassName}>\n {content}\n </Comp>\n ) : (\n <button\n type=\"button\"\n {...rowState}\n aria-expanded={hasChildren ? isOpen : undefined}\n {...props({ \"aria-controls\": hasChildren && itemsId })}\n disabled={disabled}\n onClick={() => hasChildren && setOpen(!isOpen)}\n className={rowClassName}\n >\n {content}\n {hasChildren && chevron(isOpen)}\n </button>\n )}\n {hasChildren && isLink && (\n <button\n type=\"button\"\n aria-expanded={isOpen}\n aria-controls={itemsId}\n aria-label={\n isOpen\n ? (translations?.collapseLabel ?? \"Collapse\")\n : (translations?.expandLabel ?? \"Expand\")\n }\n onClick={() => setOpen(!isOpen)}\n className={chevronButton}\n >\n {chevron(isOpen)}\n </button>\n )}\n </div>\n {hasChildren && (\n <Collapse open={isOpen}>\n <div\n id={itemsId}\n className={cn(\n \"ms-4.5 space-y-0.5 border-s border-brand-900/20 ps-2 pt-0.5 dark:border-white/15\",\n classNames?.items,\n )}\n >\n {children}\n </div>\n </Collapse>\n )}\n </div>\n )\n}\n\n/**\n * `NavLink<TOptions>` — generic so a router's own type-safety utility (e.g.\n * TanStack Router's `ValidateLinkOptions`) can validate `linkOptions` when\n * explicitly parameterized. The implementation itself stays untyped/loose\n * (the generic can't be forwarded through the JSX body); see\n * TanStack Router's own documented pattern for this exact split.\n */\nexport function NavLink<TOptions = unknown>(props: NavLinkProps<TOptions>): ReactNode\nexport function NavLink(props: NavLinkProps): ReactNode {\n return <NavLinkImpl {...props} />\n}\n","\"use client\"\n\nimport type { ElementType, ReactNode } from \"react\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { NavLink, type NavLinkClassNames, type NavLinkTranslations } from \"./nav-link\"\n\n/**\n * `Navigation` — the `data`-driven convenience wrapper over `NavLink` (same\n * relationship as `menu-data.tsx` to `menu.tsx`): pass a `data` array, get a\n * fully wired, arbitrarily-nested nav tree.\n *\n * <Navigation\n * data={[\n * { label: \"Dashboard\", startSlot: <Home />, linkOptions: { href: \"/dashboard\" } },\n * { label: \"Settings\", startSlot: <Settings />, items: [\n * { label: \"Profile\", linkOptions: { href: \"/settings/profile\" } },\n * { label: \"Security\", linkOptions: { href: \"/settings/security\" } },\n * ]},\n * ]}\n * />\n *\n * Generic over the same `TOptions` as `NavLink` — parameterize it (e.g. with\n * `TanStackLinkOptions` from `nav-link/tanstack`) to get a router's own\n * type-safety utilities validating every entry's `linkOptions`.\n *\n * Renders a real list — a `<ul>` of `<li>`, nested `<ul>`s for `items` — so a\n * screen reader announces how many entries each level holds. List styles are\n * reset, so it looks the same as composing `NavLink`s by hand.\n */\nexport type NavigationItem<TOptions = unknown> = {\n label: ReactNode\n startSlot?: ReactNode\n endSlot?: ReactNode\n current?: boolean\n disabled?: boolean\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n linkOptions?: TOptions\n classNames?: NavLinkClassNames\n /** `data-testid` on this entry's row (its link or button). */\n testId?: string\n /** Nested entries — an item with `items` renders its children indented,\n * revealed on expand/collapse. Recursive: nests to any depth. */\n items?: readonly NavigationItem<TOptions>[]\n}\n\nexport type NavigationProps<TOptions = unknown> = WithTestId & {\n /** The nav entries, in order. */\n data: readonly NavigationItem<TOptions>[]\n /** Overrides the app-wide `<LinkComponentProvider>` for every generated row. */\n linkComponent?: ElementType\n /** `NavLink`'s chevron names, forwarded to every generated row. */\n translations?: NavLinkTranslations\n}\n\n/** The `<ul>` reset: no bullets, no indent, so the list is invisible. */\nconst listClasses = \"m-0 list-none p-0\"\n\nconst renderItem = (\n item: NavigationItem,\n key: string,\n linkComponent: ElementType | undefined,\n translations: NavLinkTranslations | undefined,\n): ReactNode => (\n <li key={key}>\n <NavLink\n label={item.label}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n current={item.current}\n disabled={item.disabled}\n open={item.open}\n defaultOpen={item.defaultOpen}\n onOpenChange={item.onOpenChange}\n linkOptions={item.linkOptions}\n linkComponent={linkComponent}\n classNames={item.classNames}\n translations={translations}\n testId={item.testId}\n >\n {item.items && item.items.length > 0 ? (\n // NavLink spaces its direct children; the list is now that one child,\n // so it carries the same spacing for its own items.\n <ul className={`${listClasses} space-y-0.5`}>\n {item.items.map((child, i) =>\n renderItem(child, `${key}.${i}`, linkComponent, translations),\n )}\n </ul>\n ) : undefined}\n </NavLink>\n </li>\n)\n\nfunction NavigationImpl({ data, linkComponent, translations, testId }: NavigationProps) {\n return (\n <ul className={listClasses} {...props({ \"data-testid\": testId })}>\n {data.map((item, i) => renderItem(item, `nav-${i}`, linkComponent, translations))}\n </ul>\n )\n}\n\n/** Generic for the same reason as `NavLink` — see its doc comment. */\nexport function Navigation<TOptions = unknown>(props: NavigationProps<TOptions>): ReactNode\nexport function Navigation(props: NavigationProps): ReactNode {\n return <NavigationImpl {...props} />\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createDialogParts, DIALOG_PADDING, useDialogNameCheck, DialogRootProviders } from './chunk-
|
|
1
|
+
import { createDialogParts, DIALOG_PADDING, useDialogNameCheck, DialogRootProviders } from './chunk-DA4QII2N.js';
|
|
2
2
|
import { OverlayContainerProvider } from './chunk-7P32XCEU.js';
|
|
3
3
|
import { useLayerGuard, NestedLayer } from './chunk-H7WOMZXO.js';
|
|
4
4
|
import { props } from './chunk-WYCMIIRR.js';
|
|
5
5
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
6
|
-
import { cn } from './chunk-
|
|
6
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
7
7
|
import { Dialog } from '@ark-ui/react/dialog';
|
|
8
8
|
import { Portal } from '@ark-ui/react/portal';
|
|
9
9
|
import { cva } from 'class-variance-authority';
|
|
@@ -245,5 +245,5 @@ var Modal = Object.assign(ModalComponent, {
|
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
export { Modal };
|
|
248
|
-
//# sourceMappingURL=chunk-
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
248
|
+
//# sourceMappingURL=chunk-JVG5ISPT.js.map
|
|
249
|
+
//# sourceMappingURL=chunk-JVG5ISPT.js.map
|
|
@@ -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,EACn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,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":";;;;;;;;;;;;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;A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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,6 +1,6 @@
|
|
|
1
|
-
import { SegmentGroup } from './chunk-
|
|
2
|
-
import { NumberInput } from './chunk-
|
|
3
|
-
import { cn } from './chunk-
|
|
1
|
+
import { SegmentGroup } from './chunk-C4NFRSOR.js';
|
|
2
|
+
import { NumberInput } from './chunk-UVQXRDRO.js';
|
|
3
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
4
4
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -246,5 +246,5 @@ var TimeRow = ({
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
export { TimeRow, dayPeriodLabels, fromDisplayHour, is12Hour, resolveHourCycle, timeRowMinWidth, toDisplayHour };
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
249
|
+
//# sourceMappingURL=chunk-LFQDB5OD.js.map
|
|
250
|
+
//# sourceMappingURL=chunk-LFQDB5OD.js.map
|