@42-central/ui-react 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FD6P6PLQ.js → chunk-5JHDSVEZ.js} +3 -3
- package/dist/{chunk-FD6P6PLQ.js.map → chunk-5JHDSVEZ.js.map} +1 -1
- package/dist/{chunk-QMW7D5GU.js → chunk-5OQLFX47.js} +4 -3
- package/dist/chunk-5OQLFX47.js.map +1 -0
- package/dist/{chunk-VZ2TPU4B.js → chunk-6GDMSENK.js} +3 -2
- package/dist/chunk-6GDMSENK.js.map +1 -0
- package/dist/{chunk-TNNH3FVQ.js → chunk-6OLTJYSX.js} +24 -8
- package/dist/chunk-6OLTJYSX.js.map +1 -0
- package/dist/{chunk-POKDSVQT.js → chunk-AE7QTLJ5.js} +5 -4
- package/dist/chunk-AE7QTLJ5.js.map +1 -0
- package/dist/{chunk-44OV3PNH.js → chunk-B2YJKRNQ.js} +3 -3
- package/dist/{chunk-44OV3PNH.js.map → chunk-B2YJKRNQ.js.map} +1 -1
- package/dist/{chunk-YIQI2CF3.js → chunk-CTSO6V72.js} +3 -2
- package/dist/chunk-CTSO6V72.js.map +1 -0
- package/dist/{chunk-EVVMHTCL.js → chunk-EBREIC3L.js} +4 -3
- package/dist/chunk-EBREIC3L.js.map +1 -0
- package/dist/{chunk-UNSAA7YG.js → chunk-FHG54IT5.js} +3 -2
- package/dist/chunk-FHG54IT5.js.map +1 -0
- package/dist/{chunk-3GYOIQW7.js → chunk-FZIHZT5R.js} +5 -5
- package/dist/{chunk-3GYOIQW7.js.map → chunk-FZIHZT5R.js.map} +1 -1
- package/dist/{chunk-2H46IXW4.js → chunk-HAQJQFE6.js} +28 -8
- package/dist/chunk-HAQJQFE6.js.map +1 -0
- package/dist/{chunk-IHYFYMHJ.js → chunk-HT5JAHR3.js} +6 -6
- package/dist/{chunk-IHYFYMHJ.js.map → chunk-HT5JAHR3.js.map} +1 -1
- package/dist/chunk-I4SQQIP5.js +12 -0
- package/dist/chunk-I4SQQIP5.js.map +1 -0
- package/dist/{chunk-J3PELDH3.js → chunk-JITF6I7N.js} +22 -6
- package/dist/chunk-JITF6I7N.js.map +1 -0
- package/dist/{chunk-IFWCCAQV.js → chunk-KHMFNH3X.js} +3 -2
- package/dist/chunk-KHMFNH3X.js.map +1 -0
- package/dist/{chunk-SIG4DMNZ.js → chunk-MI2WZRK3.js} +4 -4
- package/dist/{chunk-SIG4DMNZ.js.map → chunk-MI2WZRK3.js.map} +1 -1
- package/dist/{chunk-YON5Y336.js → chunk-O23Y5ML4.js} +8 -8
- package/dist/{chunk-YON5Y336.js.map → chunk-O23Y5ML4.js.map} +1 -1
- package/dist/{chunk-P7A3BCAC.js → chunk-OWG4BCQR.js} +3 -3
- package/dist/{chunk-P7A3BCAC.js.map → chunk-OWG4BCQR.js.map} +1 -1
- package/dist/{chunk-FUWSTUDM.js → chunk-PH354ECN.js} +4 -4
- package/dist/{chunk-FUWSTUDM.js.map → chunk-PH354ECN.js.map} +1 -1
- package/dist/{chunk-U5GW5EBR.js → chunk-RAUOFTUH.js} +12 -20
- package/dist/chunk-RAUOFTUH.js.map +1 -0
- package/dist/{chunk-2762HZYX.js → chunk-S2HWWR2H.js} +47 -25
- package/dist/chunk-S2HWWR2H.js.map +1 -0
- package/dist/{chunk-VLUKI3HL.js → chunk-S7N4LGLZ.js} +6 -13
- package/dist/chunk-S7N4LGLZ.js.map +1 -0
- package/dist/{chunk-NSOA3GMZ.js → chunk-UHNRAI6V.js} +3 -3
- package/dist/{chunk-NSOA3GMZ.js.map → chunk-UHNRAI6V.js.map} +1 -1
- package/dist/{chunk-3NZXWCGF.js → chunk-WHKKN3ZK.js} +6 -6
- package/dist/{chunk-3NZXWCGF.js.map → chunk-WHKKN3ZK.js.map} +1 -1
- package/dist/{chunk-MOI7B3KH.js → chunk-WQN64ZHG.js} +5 -5
- package/dist/{chunk-MOI7B3KH.js.map → chunk-WQN64ZHG.js.map} +1 -1
- package/dist/chunk-WSIVRDRB.js +34 -0
- package/dist/chunk-WSIVRDRB.js.map +1 -0
- package/dist/{chunk-6SWK4XG5.js → chunk-YXE4B6X3.js} +2 -2
- package/dist/chunk-YXE4B6X3.js.map +1 -0
- package/dist/{chunk-NGAQITWP.js → chunk-Z2Z5EXVT.js} +10 -7
- package/dist/chunk-Z2Z5EXVT.js.map +1 -0
- package/dist/{chunk-IXKELBJA.js → chunk-ZDXQ64A7.js} +63 -44
- package/dist/chunk-ZDXQ64A7.js.map +1 -0
- package/dist/components/accordion/accordion-data.d.ts +3 -2
- package/dist/components/accordion/accordion-data.d.ts.map +1 -1
- package/dist/components/accordion/accordion.d.ts +2 -2
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/index.js +20 -8
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-icon/action-icon.d.ts +3 -4
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +2 -1
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +16 -4
- package/dist/components/alert/index.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +3 -2
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +4 -2
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +5 -4
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +3 -2
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +11 -5
- package/dist/components/breadcrumb/index.js.map +1 -1
- package/dist/components/button/button.d.ts +4 -4
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +2 -1
- package/dist/components/button-multi-select/index.js +4 -3
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/index.js +4 -3
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/index.js +3 -2
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +3 -2
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +1 -0
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/clipboard.d.ts +1 -1
- package/dist/components/clipboard/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard/index.js +9 -5
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code-block/chrome.d.ts +4 -1
- package/dist/components/code-block/chrome.d.ts.map +1 -1
- package/dist/components/code-block/chrome.js +5 -4
- package/dist/components/code-block/code-block.d.ts +7 -1
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/index.d.ts +1 -1
- package/dist/components/code-block/index.js +12 -10
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/code-block/notation.d.ts +5 -2
- package/dist/components/code-block/notation.d.ts.map +1 -1
- package/dist/components/code-block/static.d.ts +4 -1
- package/dist/components/code-block/static.d.ts.map +1 -1
- package/dist/components/code-block/static.js +5 -4
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/collapse/collapse.d.ts +7 -3
- package/dist/components/collapse/collapse.d.ts.map +1 -1
- package/dist/components/collapse/index.js +2 -1
- package/dist/components/combobox/combobox.d.ts +11 -10
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +5 -4
- package/dist/components/combobox-list/index.js +6 -5
- package/dist/components/data-table/index.js +20 -19
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +12 -11
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/divider/divider.d.ts +3 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/drawer/drawer.d.ts +6 -5
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +3 -2
- package/dist/components/field/field.d.ts +7 -4
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/file-upload/index.js +3 -2
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/hover-card/index.js +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts +3 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/menu/index.js +3 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu-data.d.ts +6 -1
- package/dist/components/menu/menu-data.d.ts.map +1 -1
- package/dist/components/menu/menu.d.ts +5 -5
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +3 -2
- package/dist/components/modal/modal.d.ts +4 -3
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +6 -5
- package/dist/components/multi-select/index.js +7 -6
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/nav-link/index.js +3 -2
- package/dist/components/nav-link/tanstack.js +3 -2
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/notification/index.js +4 -3
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +3 -2
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/overlays/index.js +5 -4
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/password-input/index.js +2 -2
- package/dist/components/pill/index.js +2 -1
- package/dist/components/pill/pill.d.ts +4 -2
- package/dist/components/pill/pill.d.ts.map +1 -1
- package/dist/components/pills-input/index.js +5 -4
- package/dist/components/pills-input/pills-input.d.ts +3 -2
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +2 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/popover.d.ts +3 -2
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/progress.d.ts +3 -2
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/index.js +2 -1
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts +3 -2
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.d.ts +2 -2
- package/dist/components/schedule/index.js +50 -23
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/schedule/schedule-agenda-list.d.ts +6 -7
- package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -1
- package/dist/components/schedule/schedule-agenda-view.d.ts +19 -16
- package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
- package/dist/components/schedule/schedule-days-view.d.ts +3 -2
- package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-month-view.d.ts +3 -2
- package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-next-up.d.ts +4 -3
- package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +5 -3
- package/dist/components/schedule/schedule-types.d.ts.map +1 -1
- package/dist/components/schedule/schedule-views.d.ts +2 -2
- package/dist/components/schedule/schedule-views.d.ts.map +1 -1
- package/dist/components/schedule/schedule-year-view.d.ts +3 -2
- package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule.d.ts +9 -6
- package/dist/components/schedule/schedule.d.ts.map +1 -1
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/select/index.js +4 -4
- package/dist/components/slider/index.js +2 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/slider.d.ts +3 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/tabs-data.d.ts +3 -2
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +6 -5
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/time-input/index.js +6 -6
- package/dist/components/timeline/index.js +8 -5
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +6 -5
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-select/index.js +3 -3
- package/dist/lib/as-child.d.ts +104 -0
- package/dist/lib/as-child.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +809 -0
- package/src/components/accordion/accordion-data.tsx +8 -5
- package/src/components/accordion/accordion.test.tsx +40 -0
- package/src/components/accordion/accordion.tsx +23 -6
- package/src/components/action-icon/action-icon.tsx +9 -24
- package/src/components/alert/alert.test.tsx +17 -0
- package/src/components/alert/alert.tsx +21 -2
- package/src/components/app-shell/app-shell.tsx +3 -1
- package/src/components/breadcrumb/breadcrumb.test.tsx +30 -0
- package/src/components/breadcrumb/breadcrumb.tsx +21 -12
- package/src/components/button/button.tsx +21 -50
- package/src/components/circular-progress/circular-progress.tsx +4 -1
- package/src/components/clipboard/clipboard.test.tsx +18 -0
- package/src/components/clipboard/clipboard.tsx +8 -2
- package/src/components/code-block/chrome.tsx +60 -36
- package/src/components/code-block/code-block.test.tsx +27 -0
- package/src/components/code-block/code-block.tsx +13 -3
- package/src/components/code-block/notation.test.ts +8 -0
- package/src/components/code-block/notation.ts +6 -3
- package/src/components/code-block/static.tsx +8 -2
- package/src/components/collapse/collapse.tsx +33 -15
- package/src/components/combobox/combobox.test.tsx +38 -0
- package/src/components/combobox/combobox.tsx +24 -10
- package/src/components/divider/divider.tsx +3 -1
- package/src/components/drawer/drawer.tsx +37 -16
- package/src/components/field/field.tsx +7 -3
- package/src/components/input/input.tsx +3 -1
- package/src/components/menu/menu-data.tsx +8 -1
- package/src/components/menu/menu.test.tsx +52 -0
- package/src/components/menu/menu.tsx +83 -35
- package/src/components/modal/close-trigger.test.tsx +38 -0
- package/src/components/modal/modal.tsx +29 -13
- package/src/components/notification/notification.tsx +4 -1
- package/src/components/pill/pill.tsx +29 -20
- package/src/components/pills-input/pills-input.tsx +3 -1
- package/src/components/popover/popover.tsx +3 -1
- package/src/components/progress/progress.tsx +4 -1
- package/src/components/rating/rating.tsx +27 -23
- package/src/components/schedule/index.ts +1 -1
- package/src/components/schedule/schedule-agenda-list.tsx +6 -7
- package/src/components/schedule/schedule-agenda-view.test.tsx +105 -28
- package/src/components/schedule/schedule-agenda-view.tsx +41 -28
- package/src/components/schedule/schedule-dates.test.ts +37 -52
- package/src/components/schedule/schedule-dates.ts +22 -25
- package/src/components/schedule/schedule-days-view.tsx +3 -1
- package/src/components/schedule/schedule-month-view.tsx +3 -1
- package/src/components/schedule/schedule-next-up.tsx +6 -2
- package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
- package/src/components/schedule/schedule-toolbar.tsx +13 -1
- package/src/components/schedule/schedule-types.ts +5 -3
- package/src/components/schedule/schedule-views.ts +4 -5
- package/src/components/schedule/schedule-year-view.tsx +3 -1
- package/src/components/schedule/schedule.test.tsx +66 -22
- package/src/components/schedule/schedule.tsx +22 -13
- package/src/components/slider/slider.tsx +4 -0
- package/src/components/tabs/tabs-data.tsx +17 -14
- package/src/components/timeline/timeline.tsx +102 -95
- package/src/components/tooltip/tooltip.tsx +2 -1
- package/src/lib/as-child.test.tsx +70 -0
- package/src/lib/as-child.ts +119 -0
- package/dist/chunk-2762HZYX.js.map +0 -1
- package/dist/chunk-2H46IXW4.js.map +0 -1
- package/dist/chunk-6SWK4XG5.js.map +0 -1
- package/dist/chunk-EVVMHTCL.js.map +0 -1
- package/dist/chunk-HWNPXAEN.js +0 -31
- package/dist/chunk-HWNPXAEN.js.map +0 -1
- package/dist/chunk-IFWCCAQV.js.map +0 -1
- package/dist/chunk-IXKELBJA.js.map +0 -1
- package/dist/chunk-J3PELDH3.js.map +0 -1
- package/dist/chunk-NGAQITWP.js.map +0 -1
- package/dist/chunk-POKDSVQT.js.map +0 -1
- package/dist/chunk-QMW7D5GU.js.map +0 -1
- package/dist/chunk-TNNH3FVQ.js.map +0 -1
- package/dist/chunk-U5GW5EBR.js.map +0 -1
- package/dist/chunk-UNSAA7YG.js.map +0 -1
- package/dist/chunk-VLUKI3HL.js.map +0 -1
- package/dist/chunk-VZ2TPU4B.js.map +0 -1
- package/dist/chunk-YIQI2CF3.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/alert/alert.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/alert/alert.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAoDO,IAAM,YAAY,GAAA,CAAI;AAAA,EAC3B,sBAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA,EAGA,oBAAA;AAAA,EACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,EAC7B,8CAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC;AASD,IAAM,IAAA,GAAO,CAAC,EAAE,SAAA,EAAW,OAAO,MAAA,EAAQ,GAAG,MAAK,qBAChD,GAAA;AAAA,EAAC,GAAA,CAAI,GAAA;AAAA,EAAJ;AAAA,IACC,YAAA,EAAY,KAAA;AAAA,IACZ,SAAA,EAAW,EAAA,CAAG,SAAA,EAAU,EAAG,SAAS,CAAA;AAAA,IACnC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AA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E,UAAU,IAAA,oBAAQ,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,0CAA0C,QAAA,EAAA,MAAA,EAAO;AAAA,GAAA,EACrF,CAAA;AAGF,EAAA;AAAA;AAAA;AAAA;AAAA,oBAIE,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EAAc,OAAA,EAAmB,GAAG,IAAA,EACvC,QAAA,EAAA,OAAA,GACG,kBAAA,CAAmB,QAAA,EAAU,CAAC,GAAA,qBAC5B,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,MAAA,IAAA;AAAA,MACA;AAAA,KAAA,EACH,CACD,IACD,IAAA,EACN;AAAA;AAEJ;AAOO,IAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB;AAAA,EACjD,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAC","file":"index.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport type { ReactNode, Ref } from \"react\"\nimport { withAsChildContent } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport {\n ActionTrigger,\n CloseTrigger,\n Description,\n Icon,\n Title,\n TOAST_STATUS,\n} from \"../notification/notification\"\nimport type { ToastHue, ToastType } from \"../notification/types\"\n\n/**\n * Alert — a wide, static status card with `Notification`'s look (`type`\n * presets, the `Icon` / `Title` / `Description` / `ActionTrigger` /\n * `CloseTrigger` parts) but full-width and always-mounted — for an inline note\n * in page content (a doc callout, a form-level warning), not a floating,\n * self-dismissing toast.\n *\n * It reuses `Notification`'s parts and `type` → hue/icon presets directly (see\n * `notification.tsx`). The root surface is its own: a toast floats over\n * arbitrary content and needs its opaque, blurred panel, while an alert sits\n * on the page, so it takes a translucent tint of its hue instead.\n *\n * @example\n * ```tsx\n * <Alert type=\"warning\" title=\"Breaking change\" description=\"…\" />\n * ```\n */\n\n/** Same presets as `Notification`, minus `loading` — a static alert isn't an\n * in-flight async state. */\nexport type AlertType = Exclude<ToastType, \"loading\">\n\n/** The card surface. Full-width and flat (no toast shadow/animation) — meant\n * to sit inline in page content rather than float above it. Translucent, so\n * it blends into whatever surface hosts it: a faint `--c-solid` wash carries\n * the status across the whole card, edged by a translucent `--c-solid` (the\n * edge `ChoiceCardGroup`'s checked `filled` card uses). The wash comes from\n * `--c-solid`, not `--c-soft`: light-mode `--c-soft` is the near-white 50 step\n * for every hue but `neutral` (a 16% black), so warning/error vanished while\n * info turned into the heaviest card. `text-(--c-solid)` still tints the icon\n * and the `current`-based triggers. */\nexport const alertRoot = cva([\n \"flex flex-col w-full\",\n \"rounded-card border px-3 py-3\",\n // Any-focus outline suppression, matching the other overlay surfaces\n // (Modal, Drawer, Popover, Tooltip) — the card can take programmatic focus.\n \"focus:outline-none\",\n focusStyles({ offset: false }),\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"overflow-clip\",\n \"bg-(--c-solid)/8 dark:bg-(--c-solid)/12 border-(--c-solid)/45 text-(--c-solid)\",\n])\n\nexport type AlertRootProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Accent palette. Drives the `--c-*` slot vars for the whole card. */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\nconst Root = ({ className, color, testId, ...rest }: AlertRootProps) => (\n <ark.div\n data-color={color}\n className={cn(alertRoot(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/**\n * Props for the ready-made `Alert` card — the presentational fields it\n * shares with `Notification` (`type` / `title` / `description` / `action` /\n * `color` / `icon`), minus the collapse/notifier-only plumbing\n * that only makes sense for a spawned toast.\n */\nexport type AlertProps = Omit<AlertRootProps, \"title\" | \"color\"> &\n ToastHue<AlertType> & {\n /** The header row content. */\n title?: ReactNode\n /** Secondary line, below the header row. */\n description?: ReactNode\n /** Action row (e.g. an `ActionTrigger`), below the description. */\n action?: ReactNode\n /** Override the leading glyph; `null` hides it. */\n icon?: ReactNode | null\n /** Render the close (×) button; `onClose` fires when pressed. Static by\n * default — an inline alert usually isn't meant to be dismissed. */\n withCloseButton?: boolean\n /** Invoked when the close (×) button is pressed. */\n onClose?: () => void\n }\n\n/**\n * The ready-made **`Alert` card** — the presentational body composed from a\n * status-shaped object, same as `Notification`: resolves `type` → `TOAST_STATUS`\n * (hue + leading icon), lets an explicit `color`/`icon` override\n * (`icon={null}` hides the glyph), and lays out the icon/title/close row plus\n * the description and action sections underneath.\n *\n * No store, presence, or collapse state — it's always fully mounted. For a\n * bespoke layout, compose the parts directly: `Alert.Root`, `.Icon`, `.Title`,\n * `.Description`, `.ActionTrigger`, `.CloseTrigger`.\n */\nfunction AlertComponent({\n type,\n title,\n description,\n action,\n color: _color,\n icon: _icon,\n withCloseButton = false,\n onClose,\n asChild,\n children,\n ...rest\n}: AlertProps) {\n const preset = type ? TOAST_STATUS[type] : undefined\n // `type` and `color` are exclusive (see `ToastHue`); the preset wins\n // should a JS caller pass both anyway.\n const color = preset ? preset.color : (_color as Color | undefined)\n // Not `??`: an explicit `icon={null}` (hide the glyph) must not fall\n // through to the preset the way an omitted (`undefined`) icon does.\n const icon = _icon === undefined ? preset?.icon : _icon\n\n const card = (\n <>\n <div className=\"flex flex-row gap-3\">\n {icon != null && <Icon>{icon}</Icon>}\n {title != null ? (\n <Title>{title}</Title>\n ) : (\n // No title: the description takes its place in the header row\n // (still in description styling, just not stranded under a lone\n // icon) instead of sitting in its own block below.\n description != null && <Description className=\"mt-0\">{description}</Description>\n )}\n {withCloseButton && <CloseTrigger onClick={onClose} />}\n </div>\n {title != null && description != null && <Description>{description}</Description>}\n {action != null && <div className=\"mt-2 flex flex-wrap items-center gap-2\">{action}</div>}\n </>\n )\n\n return (\n // Under `asChild` the card becomes the consumer's element (a link to the\n // details, say), with the card's rows folded in ahead of that element's\n // own content.\n <Root color={color} asChild={asChild} {...rest}>\n {asChild\n ? withAsChildContent(children, (own) => (\n <>\n {card}\n {own}\n </>\n ))\n : card}\n </Root>\n )\n}\n\n/**\n * `Alert` — the ready-made card (batteries-included), with the compound\n * parts attached for bespoke composition. Mirrors `Notification`: the bare\n * name is the convenience form; `.Root` and friends are the primitives.\n */\nexport const Alert = Object.assign(AlertComponent, {\n Root,\n Icon,\n Title,\n Description,\n ActionTrigger,\n CloseTrigger,\n})\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type HTMLArkProps } from "@ark-ui/react";
|
|
2
2
|
import { type ComponentPropsWithoutRef, type Ref } from "react";
|
|
3
|
+
import type { NoAsChild } from "../../lib/as-child";
|
|
3
4
|
import type { Size } from "../../lib/sizes";
|
|
4
5
|
import type { WithTestId } from "../../lib/test-id";
|
|
5
6
|
export type AppShellProps = HTMLArkProps<"div"> & WithTestId & {
|
|
@@ -12,7 +13,7 @@ export type AppShellProps = HTMLArkProps<"div"> & WithTestId & {
|
|
|
12
13
|
ref?: Ref<HTMLDivElement>;
|
|
13
14
|
};
|
|
14
15
|
declare const AppShellRoot: ({ breakpoint, className, style, children, ref, testId, ...rest }: AppShellProps) => import("react").JSX.Element;
|
|
15
|
-
export type AppShellSidebarProps = HTMLArkProps<"aside"
|
|
16
|
+
export type AppShellSidebarProps = NoAsChild<HTMLArkProps<"aside">> & WithTestId & {
|
|
16
17
|
/** Width when expanded, from the kit's Size scale. @default "md" */
|
|
17
18
|
size?: Size;
|
|
18
19
|
};
|
|
@@ -44,7 +45,7 @@ export type AppShellSidebarProps = HTMLArkProps<"aside"> & WithTestId & {
|
|
|
44
45
|
* arbitrary `<aside>` props don't apply to `Drawer`'s own curated prop
|
|
45
46
|
* surface.
|
|
46
47
|
*/
|
|
47
|
-
declare const AppShellSidebar: ({ size, className, children, testId, ...rest }: AppShellSidebarProps) => import("react").JSX.Element;
|
|
48
|
+
declare const AppShellSidebar: ({ size, className, children, testId, asChild: _asChild, ...rest }: AppShellSidebarProps) => import("react").JSX.Element;
|
|
48
49
|
export type AppShellSidebarHeaderProps = ComponentPropsWithoutRef<"div"> & WithTestId;
|
|
49
50
|
declare const AppShellSidebarHeader: ({ className, testId, ...rest }: AppShellSidebarHeaderProps) => import("react").JSX.Element;
|
|
50
51
|
export type AppShellSidebarBodyProps = ComponentPropsWithoutRef<"div"> & WithTestId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EACL,KAAK,wBAAwB,EAG7B,KAAK,GAAG,EAKT,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EACL,KAAK,wBAAwB,EAG7B,KAAK,GAAG,EAKT,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AA2DnD,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,GAC7C,UAAU,GAAG;IACX;;gFAE4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;6CACyC;IACzC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CAC1B,CAAA;AAEH,QAAA,MAAM,YAAY,qEAQf,aAAa,gCAqBf,CAAA;AAUD,MAAM,MAAM,oBAAoB,GAAG,SAAS,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;GAiBG;AACH,QAAA,MAAM,YAAY,wBAAyB,iBAAiB,gCAE3D,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,UAAU,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,eAAe,mCAAoC,oBAAoB,gCAS5E,CAAA;AAUD,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,OAAO,CAAC,GACpD,UAAU,GAAG;IACX,mEAAmE;IACnE,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAEH;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,aAAa,yCAAiD,kBAAkB,gCAWrF,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAA;AAE7E;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,iCAAkC,2BAA2B,uCAgBxF,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;CAWnB,CAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { mergeRefs } from '../../chunk-UVYTJQTJ.js';
|
|
3
|
-
import { Drawer } from '../../chunk-
|
|
3
|
+
import { Drawer } from '../../chunk-HAQJQFE6.js';
|
|
4
4
|
import { useContainerQuery } from '../../chunk-P3XMBETI.js';
|
|
5
5
|
import '../../chunk-AIQG7IIT.js';
|
|
6
6
|
import '../../chunk-7P32XCEU.js';
|
|
7
7
|
import '../../chunk-BUIHQJGE.js';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-S7N4LGLZ.js';
|
|
9
9
|
import '../../chunk-NSDM3FEB.js';
|
|
10
|
+
import '../../chunk-I4SQQIP5.js';
|
|
10
11
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
11
12
|
import '../../chunk-B2LCHXUB.js';
|
|
12
13
|
import { cn } from '../../chunk-QP4I37PA.js';
|
|
@@ -59,6 +60,7 @@ var AppShellSidebar = ({
|
|
|
59
60
|
className,
|
|
60
61
|
children,
|
|
61
62
|
testId,
|
|
63
|
+
asChild: _asChild,
|
|
62
64
|
...rest
|
|
63
65
|
}) => {
|
|
64
66
|
const { isMobile, mobileOpen, setMobileOpen } = useAppShell();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAoEA,IAAM,eAAA,GAAkB,cAA2C,IAAI,CAAA;AAEvE,SAAS,WAAA,GAAoC;AAC3C,EAAA,MAAM,GAAA,GAAM,WAAW,eAAe,CAAA;AACtC,EAAA,IAAI,CAAC,GAAA,EAAK,MAAM,IAAI,MAAM,oDAAoD,CAAA;AAC9E,EAAA,OAAO,GAAA;AACT;AAaA,IAAM,eAAe,CAAC;AAAA,EACpB,UAAA,GAAa,GAAA;AAAA,EACb,SAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAqB;AACnB,EAAA,MAAM,OAAA,GAAU,OAAuB,IAAI,CAAA;AAC3C,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA;AAClD,EAAA,MAAM,QAAA,GAAW,iBAAA,CAAkB,OAAA,EAAS,UAAU,CAAA;AAEtD,EAAA,uBACE,GAAA,CAAC,gBAAgB,QAAA,EAAhB,EAAyB,OAAO,EAAE,UAAA,EAAY,aAAA,EAAe,QAAA,EAAS,EACrE,QAAA,kBAAA,GAAA;AAAA,IAAC,GAAA,CAAI,GAAA;AAAA,IAAJ;AAAA,MACE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAClC,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,SAAA,CAAU,GAAA,EAAK,OAAO,CAAA;AAAA,MAC3B,KAAA,EAAO,EAAE,iBAAA,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A;AAAA,EACf,WAAA,EAAa,mBAAA;AAAA,EACb,aAAA,EAAe,qBAAA;AAAA,EACf,cAAA,EAAgB,sBAAA;AAAA,EAChB,MAAA,EAAQ,cAAA;AAAA,EACR,IAAA,EAAM,YAAA;AAAA,EACN,IAAA,EAAM,YAAA;AAAA,EACN,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAC","file":"index.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type Dispatch,\n type Ref,\n type SetStateAction,\n useContext,\n useRef,\n useState,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useContainerQuery } from \"../../lib/use-container-query\"\nimport { Drawer } from \"../drawer/drawer\"\n\n/**\n * AppShell — header / sidebar / main / aside app frame, laid out with CSS\n * Grid named areas. Sidebar spans the full height on the left; Header\n * spans the rest of the top (above both Main and Aside — Header never\n * spans over Sidebar, but it does span over Aside, unlike Sidebar itself);\n * Aside sits below Header, full height only within the remaining row,\n * beside Main. No Footer — add one only once a real consumer needs it.\n *\n * Sidebar is always visible on desktop — there's no way to hide it when\n * there's room to show it. Below `breakpoint`, it becomes an overlay\n * `Drawer` instead, toggled by `AppShell.SidebarTrigger` (which renders\n * nothing on desktop — there's nothing to toggle). Aside works\n * differently: it's always mounted (no JS/container-query gating at all,\n * unlike Sidebar) and purely CSS-driven — hidden below a `@xl` container\n * breakpoint, visible above it — mirroring how fumadocs' own docs layout\n * keeps its table-of-contents rail always in the DOM. There is no\n * `variant`/`color` axis — like `Table`/`Grid`/`Flex`, this is a\n * structural primitive, not a themed surface.\n *\n * `breakpoint` and Aside's `@xl` cutoff are both measured against\n * `AppShell`'s own rendered width, not the browser viewport — so this\n * behaves correctly embedded in a panel, a resizable pane, or anything\n * narrower than the window, not just when it fills the whole page.\n *\n * <AppShell>\n * <AppShell.Sidebar>\n * <AppShell.SidebarHeader>Logo</AppShell.SidebarHeader>\n * <AppShell.SidebarBody>Nav — scrolls</AppShell.SidebarBody>\n * <AppShell.SidebarFooter>User menu</AppShell.SidebarFooter>\n * </AppShell.Sidebar>\n * <AppShell.Header>\n * <AppShell.SidebarTrigger asChild>\n * <ActionIcon variant=\"subtle\" color=\"neutral\"><PanelLeft /></ActionIcon>\n * </AppShell.SidebarTrigger>\n * </AppShell.Header>\n * <AppShell.Main>Page content</AppShell.Main>\n * <AppShell.Aside>On this page…</AppShell.Aside>\n * </AppShell>\n */\n\ntype AppShellContextValue = {\n /** Mobile drawer open state — always uncontrolled, never a public prop. */\n mobileOpen: boolean\n setMobileOpen: Dispatch<SetStateAction<boolean>>\n isMobile: boolean\n}\n\nconst AppShellContext = createContext<AppShellContextValue | null>(null)\n\nfunction useAppShell(): AppShellContextValue {\n const ctx = useContext(AppShellContext)\n if (!ctx) throw new Error(\"AppShell parts must be rendered within <AppShell>.\")\n return ctx\n}\n\nexport type AppShellProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** AppShell's own rendered width (px) below which Sidebar renders as an\n * overlay `Drawer` instead of a grid column — measured against the\n * container itself via `ResizeObserver`, not the viewport. @default 768 */\n breakpoint?: number\n /** Lands on the grid root; also used internally to measure `breakpoint`\n * against the container's own width. */\n ref?: Ref<HTMLDivElement>\n }\n\nconst AppShellRoot = ({\n breakpoint = 768,\n className,\n style,\n children,\n ref,\n testId,\n ...rest\n}: AppShellProps) => {\n const rootRef = useRef<HTMLDivElement>(null)\n const [mobileOpen, setMobileOpen] = useState(false)\n const isMobile = useContainerQuery(rootRef, breakpoint)\n\n return (\n <AppShellContext.Provider value={{ mobileOpen, setMobileOpen, isMobile }}>\n <ark.div\n {...props({ \"data-testid\": testId })}\n {...rest}\n ref={mergeRefs(ref, rootRef)}\n style={{ gridTemplateAreas: `\"sidebar header header\" \"sidebar main aside\"`, ...style }}\n className={cn(\n \"@container grid h-dvh grid-cols-[auto_1fr_auto] grid-rows-[auto_1fr] overflow-hidden\",\n className,\n )}\n >\n {children}\n </ark.div>\n </AppShellContext.Provider>\n )\n}\n\nconst SIDEBAR_WIDTH: Record<Size, string> = {\n xs: \"w-56\",\n sm: \"w-64\",\n md: \"w-72\",\n lg: \"w-80\",\n xl: \"w-96\",\n}\n\nexport type AppShellSidebarProps = HTMLArkProps<\"aside\"> &\n WithTestId & {\n /** Width when expanded, from the kit's Size scale. @default \"md\" */\n size?: Size\n }\n\n/**\n * Below `breakpoint`, renders through the kit's own `Drawer` instead of the\n * grid column — same `SidebarHeader`/`SidebarBody`/`SidebarFooter` children\n * either way, mirroring the desktop docked aside's layout: `Drawer`'s own\n * body normally forces every child through one scrolling container, which\n * would otherwise carry Header/Footer along with the scroll instead of\n * pinning them — `classNames.body` turns it into the same flex column\n * (Header/Footer as plain shrink-0 flex items, only SidebarBody's own\n * `overflow-y-auto` scrolls) instead. Full width, opening from the logical\n * end edge (right in LTR). `withCloseButton={false}` — at full width,\n * `Drawer`'s own generic close bar would just stack a second, redundant\n * header above `SidebarHeader`; render a `SidebarTrigger` inside\n * `SidebarHeader` itself instead for one unified bar with a visible close\n * affordance (swipe-to-dismiss on `Drawer`'s content still works too, but\n * isn't the only way out — not discoverable, and risky to rely on alone in\n * a sidebar full of tappable nav rows).\n *\n * Exclusive branch, not always-mounted-and-CSS-hidden like `Aside` — unlike\n * `Aside`, `Sidebar` has two genuinely different structural forms (a plain\n * `<aside>` vs. a portaled dialog with focus-trap/ARIA machinery), so\n * keeping both permanently mounted would mean literally duplicating\n * `children` (and any side effects inside it) into two simultaneous trees.\n * Matches fumadocs' own sidebar, which is JS-conditional for the same\n * reason — only its TOC (this component's `Aside`) goes the always-mounted\n * route. Only `size`/`className`/`children` carry over to `Drawer` mode;\n * arbitrary `<aside>` props don't apply to `Drawer`'s own curated prop\n * surface.\n */\nconst AppShellSidebar = ({\n size = \"md\",\n className,\n children,\n testId,\n ...rest\n}: AppShellSidebarProps) => {\n const { isMobile, mobileOpen, setMobileOpen } = useAppShell()\n\n if (isMobile) {\n return (\n <Drawer\n open={mobileOpen}\n onOpenChange={setMobileOpen}\n placement=\"end\"\n withCloseButton={false}\n testId={testId}\n classNames={{ body: \"flex flex-col overflow-hidden p-0\" }}\n className={cn(\"w-full max-w-none\", className)}\n >\n {children}\n </Drawer>\n )\n }\n\n return (\n <ark.aside\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"[grid-area:sidebar] flex flex-col overflow-hidden text-gray-light-900 dark:text-gray-dark-25\",\n // Brand-derived border/fill, matching InputBase/Popover/Modal/Drawer/Table's\n // own chrome (border-brand-900/20 dark:border-white/15, bg-brand-50/90\n // dark:bg-brand-950/85) rather than a neutral gray.\n \"border-e border-brand-900/20 bg-brand-50/90 dark:border-white/15 dark:bg-brand-950/85\",\n SIDEBAR_WIDTH[size],\n className,\n )}\n >\n {children}\n </ark.aside>\n )\n}\n\n// Shared by SidebarHeader and Header so the two sit at the same height and\n// Header's bottom border lines up level with SidebarHeader's own bottom edge\n// — sizing each off its own padding + content independently (the original\n// approach) drifts out of sync as soon as one holds taller content than the\n// other.\nconst HEADER_HEIGHT_CLASS = \"h-14\"\n\nexport type AppShellSidebarHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n// Plain flex sibling, not routed through the `ark.*` factory — mirrors\n// Drawer.Header/.Body/.Footer, which aren't either.\nconst AppShellSidebarHeader = ({ className, testId, ...rest }: AppShellSidebarHeaderProps) => (\n <div\n className={cn(HEADER_HEIGHT_CLASS, \"flex shrink-0 items-center gap-2 px-4\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type AppShellSidebarBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * The scroll region — the only part of Sidebar that scrolls. The mask fades\n * content at the top/bottom edges instead of clipping it on a hard line\n * (fumadocs' own docs sidebar uses the same static mask on its nav\n * viewport); `overscroll-contain` stops scrolling the list from chaining\n * into scrolling the rest of the page once it hits either end.\n */\nconst AppShellSidebarBody = ({ className, testId, ...rest }: AppShellSidebarBodyProps) => (\n <div\n className={cn(\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain p-4\",\n \"[mask-image:linear-gradient(to_bottom,transparent,black_12px,black_calc(100%-12px),transparent)]\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type AppShellSidebarFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nconst AppShellSidebarFooter = ({ className, testId, ...rest }: AppShellSidebarFooterProps) => (\n <div className={cn(\"shrink-0 p-4\", className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type AppShellHeaderProps = HTMLArkProps<\"header\"> & WithTestId\n\nconst AppShellHeader = ({ className, testId, ...rest }: AppShellHeaderProps) => (\n <ark.header\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n HEADER_HEIGHT_CLASS,\n // Brand-derived border/fill, matching InputBase/Popover/Modal/Drawer/Table's\n // own chrome (border-brand-900/20 dark:border-white/15, bg-brand-50/90\n // dark:bg-brand-950/85) rather than a neutral gray.\n \"[grid-area:header] flex shrink-0 items-center gap-3 border-b border-brand-900/20 bg-brand-50/90 px-4 text-gray-light-900\",\n \"dark:border-white/15 dark:bg-brand-950/85 dark:text-gray-dark-25\",\n className,\n )}\n />\n)\n\nexport type AppShellMainSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\n// A local scale rather than the shared Size one: these are page widths, not\n// control widths, so they read off the kit's own `--width-*` tokens\n// (theme.css) — the vocabulary Modal already uses — instead of inventing a\n// second set. Static class strings so Tailwind's build-time scanner picks them\n// up, in the same lookup-map shape as SIDEBAR_WIDTH/ASIDE_WIDTH above.\nconst MAIN_MEASURE: Record<AppShellMainSize, string> = {\n sm: \"[--app-shell-measure:var(--width-xl)]\", // 48rem / 768px\n md: \"[--app-shell-measure:var(--width-2xl)]\", // 64rem / 1024px\n lg: \"[--app-shell-measure:var(--width-3xl)]\", // 80rem / 1280px\n xl: \"[--app-shell-measure:var(--width-4xl)]\", // 90rem / 1440px\n}\n\nexport type AppShellMainProps = HTMLArkProps<\"main\"> &\n WithTestId & {\n /** Width of the content column, from the kit's `--width-*` tokens:\n * `sm` 48rem · `md` 64rem · `lg` 80rem · `xl` 90rem. @default \"lg\" */\n size?: AppShellMainSize\n /** Drop the content column entirely — children fill Main edge to edge, as\n * they did before the column existed. For pages whose Main *is* one\n * full-canvas component (a Schedule, a DataTable sized to the viewport)\n * rather than a document. @default false */\n fluid?: boolean\n }\n\n/**\n * The page region. By default its children sit in a centered content column,\n * so a page of prose and forms doesn't stretch to whatever width the window\n * happens to be; `AppShell.Full` opts one child out to the full width, and\n * `AppShell.Content` puts arbitrary content back in.\n *\n * The column is three grid tracks — `1fr`, the column, `1fr` — rather than\n * inline padding, which is what lets a child span *past* the gutters without\n * negative margins, `100vw`, or any JS measurement. Percentages in track\n * sizing resolve against Main's own content box, so the column is correct\n * beside a sidebar, inside a resizable pane, or in a bounded docs preview\n * frame, with no media query and no `ResizeObserver` involved. Below\n * `measure + 2 × gutter` the middle track collapses to `100% - 2 × gutter`\n * and the `1fr` tracks land exactly on the gutter, so the column degrades\n * into plain padding continuously, without a breakpoint.\n *\n * `align-content: start` is load-bearing: grid's default (`normal`, i.e.\n * `stretch`) hands leftover vertical space to every auto row, which would\n * space a short page's blocks out down the viewport.\n *\n * <AppShell.Main>\n * <Title>Quarterly sales</Title>\n * <AppShell.Full asChild>\n * <DataTable … />\n * </AppShell.Full>\n * </AppShell.Main>\n */\nconst AppShellMain = ({\n size = \"lg\",\n fluid = false,\n className,\n testId,\n ...rest\n}: AppShellMainProps) => (\n <ark.main\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"[grid-area:main] min-h-0 overflow-y-auto\",\n !fluid && [\n // Gutter doubles as Main's block padding, so content never butts\n // against Header. Overridable per page with\n // `className=\"[--app-shell-gutter:2rem]\"`; both vars inherit, which is\n // what lets `AppShell.Content` re-derive the column at any depth.\n \"[--app-shell-gutter:1.5rem] py-(--app-shell-gutter)\",\n MAIN_MEASURE[size],\n \"grid content-start grid-cols-[1fr_min(100%-2*var(--app-shell-gutter),var(--app-shell-measure))_1fr]\",\n // Both placement rules are authored here, on the same element, so\n // their relative weight is decided by specificity — `.main > [data-full]`\n // (0,2,0) over `.main > *` (0,1,0) — and never by where Tailwind\n // happens to sort two same-weight utilities. `min-w-0` stops a wide\n // child (a DataTable) overflowing the column, and zeroes a spanning\n // child's min-content contribution so it can't inflate the gutters.\n \"[&>*]:col-start-2 [&>*]:min-w-0\",\n \"[&>[data-full]]:col-span-full\",\n ],\n className,\n )}\n />\n)\n\nexport type AppShellFullProps = HTMLArkProps<\"div\"> & WithTestId\n\n/**\n * Opts one child of `AppShell.Main` out of the content column, spanning every\n * track so it reaches Main's true edges — for the things a column actively\n * hurts: data tables, carousels, heroes, full-width backgrounds.\n *\n * Carries no layout class of its own; it only marks itself with `data-full`,\n * and Main's own rule does the placement (see `AppShellMain`). `asChild`\n * merges that marker onto the component itself, so nothing extra lands in the\n * DOM:\n *\n * <AppShell.Full asChild>\n * <DataTable … />\n * </AppShell.Full>\n *\n * Only works as a *direct* child of Main — breaking out of a grid means being\n * in it. Wrap content in a `Full` band and use `AppShell.Content` inside it\n * rather than nesting `Full` deeper.\n */\nconst AppShellFull = ({ testId, ...rest }: AppShellFullProps) => (\n <ark.div data-full=\"\" {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type AppShellContentProps = HTMLArkProps<\"div\"> & WithTestId\n\n/**\n * Puts content back into Main's column — the counterpart to `AppShell.Full`,\n * for a full-width band whose *text* should still line up with the rest of the\n * page:\n *\n * <AppShell.Full asChild>\n * <section className=\"bg-brand-50 py-16\">\n * <AppShell.Content>\n * <Title>Welcome back</Title>\n * </AppShell.Content>\n * </section>\n * </AppShell.Full>\n *\n * The width expression is the same one Main gives its middle track, resolved\n * against this element's own containing block, so the edges line up exactly at\n * both ends of the range — full measure when there's room, gutter-only when\n * there isn't. Reading the inherited custom properties rather than using\n * `subgrid` is deliberate: subgrid would only reach one level down, only from\n * an element spanning every track, and would break on any wrapper in between.\n * This works at any depth, including inside a `fluid` Main.\n */\nconst AppShellContent = ({ className, testId, ...rest }: AppShellContentProps) => (\n <ark.div\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"mx-auto w-[min(100%-2*var(--app-shell-gutter),var(--app-shell-measure))]\",\n className,\n )}\n />\n)\n\nconst ASIDE_WIDTH: Record<Size, string> = {\n xs: \"@xl:w-56\",\n sm: \"@xl:w-64\",\n md: \"@xl:w-72\",\n lg: \"@xl:w-80\",\n xl: \"@xl:w-96\",\n}\n\nexport type AppShellAsideProps = HTMLArkProps<\"aside\"> &\n WithTestId & {\n /** Width when visible, from the kit's Size scale. @default \"md\" */\n size?: Size\n }\n\n/**\n * The right region, below `Header` (unlike `Sidebar`, which spans the full\n * height beside it). Unlike `Sidebar`, always mounted — hidden below a\n * `@xl` *container* breakpoint (1280px of `AppShell`'s own width, via\n * Tailwind's native container queries — `AppShell`'s root carries\n * `@container`) and shown above it, purely via static classes, no\n * `useContainerQuery`/context involved. Matches fumadocs' own docs layout,\n * which keeps its table-of-contents rail always in the DOM rather than\n * conditionally unmounting it — no hydration mismatch is possible when\n * nothing renders differently based on client-only state. Fixed to `@xl`\n * rather than a configurable prop like Sidebar's `breakpoint`: Sidebar's is\n * JS-driven and can take any pixel value at runtime, but a static Tailwind\n * class can't take an arbitrary runtime breakpoint without breaking the\n * build-time class scanner.\n */\nconst AppShellAside = ({ size = \"md\", className, testId, ...rest }: AppShellAsideProps) => (\n <ark.aside\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"[grid-area:aside] hidden flex-col overflow-y-auto text-gray-light-900 dark:text-gray-dark-25\",\n \"@xl:flex\",\n ASIDE_WIDTH[size],\n className,\n )}\n />\n)\n\nexport type AppShellSidebarTriggerProps = HTMLArkProps<\"button\"> & WithTestId\n\n/**\n * Opens/closes the mobile `Drawer`. Renders nothing above `breakpoint` —\n * Sidebar is always visible on desktop, so there's nothing to toggle.\n * `asChild`-able, like every other kit trigger.\n */\nconst AppShellSidebarTrigger = ({ onClick, testId, ...rest }: AppShellSidebarTriggerProps) => {\n const { isMobile, setMobileOpen } = useAppShell()\n\n if (!isMobile) return null\n\n return (\n <ark.button\n type=\"button\"\n {...props({ \"data-testid\": testId })}\n {...rest}\n onClick={(event) => {\n onClick?.(event)\n setMobileOpen((open) => !open)\n }}\n />\n )\n}\n\nexport const AppShell = Object.assign(AppShellRoot, {\n Sidebar: AppShellSidebar,\n SidebarHeader: AppShellSidebarHeader,\n SidebarBody: AppShellSidebarBody,\n SidebarFooter: AppShellSidebarFooter,\n SidebarTrigger: AppShellSidebarTrigger,\n Header: AppShellHeader,\n Main: AppShellMain,\n Full: AppShellFull,\n Content: AppShellContent,\n Aside: AppShellAside,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqEA,IAAM,eAAA,GAAkB,cAA2C,IAAI,CAAA;AAEvE,SAAS,WAAA,GAAoC;AAC3C,EAAA,MAAM,GAAA,GAAM,WAAW,eAAe,CAAA;AACtC,EAAA,IAAI,CAAC,GAAA,EAAK,MAAM,IAAI,MAAM,oDAAoD,CAAA;AAC9E,EAAA,OAAO,GAAA;AACT;AAaA,IAAM,eAAe,CAAC;AAAA,EACpB,UAAA,GAAa,GAAA;AAAA,EACb,SAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAqB;AACnB,EAAA,MAAM,OAAA,GAAU,OAAuB,IAAI,CAAA;AAC3C,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA;AAClD,EAAA,MA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AAA,CAAI,MAAA;AAAA,IAAJ;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACJ,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAClC,GAAG,IAAA;AAAA,MACJ,OAAA,EAAS,CAAC,KAAA,KAAU;AAClB,QAAA,OAAA,GAAU,KAAK,CAAA;AACf,QAAA,aAAA,CAAc,CAAC,IAAA,KAAS,CAAC,IAAI,CAAA;AAAA,MAC/B;AAAA;AAAA,GACF;AAEJ,CAAA;AAEO,IAAM,QAAA,GAAW,MAAA,CAAO,MAAA,CAAO,YAAA,EAAc;AAAA,EAClD,OAAA,EAAS,eAAA;AAAA,EACT,aAAA,EAAe,qBAAA;AAAA,EACf,WAAA,EAAa,mBAAA;AAAA,EACb,aAAA,EAAe,qBAAA;AAAA,EACf,cAAA,EAAgB,sBAAA;AAAA,EAChB,MAAA,EAAQ,cAAA;AAAA,EACR,IAAA,EAAM,YAAA;AAAA,EACN,IAAA,EAAM,YAAA;AAAA,EACN,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAC","file":"index.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type Dispatch,\n type Ref,\n type SetStateAction,\n useContext,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useContainerQuery } from \"../../lib/use-container-query\"\nimport { Drawer } from \"../drawer/drawer\"\n\n/**\n * AppShell — header / sidebar / main / aside app frame, laid out with CSS\n * Grid named areas. Sidebar spans the full height on the left; Header\n * spans the rest of the top (above both Main and Aside — Header never\n * spans over Sidebar, but it does span over Aside, unlike Sidebar itself);\n * Aside sits below Header, full height only within the remaining row,\n * beside Main. No Footer — add one only once a real consumer needs it.\n *\n * Sidebar is always visible on desktop — there's no way to hide it when\n * there's room to show it. Below `breakpoint`, it becomes an overlay\n * `Drawer` instead, toggled by `AppShell.SidebarTrigger` (which renders\n * nothing on desktop — there's nothing to toggle). Aside works\n * differently: it's always mounted (no JS/container-query gating at all,\n * unlike Sidebar) and purely CSS-driven — hidden below a `@xl` container\n * breakpoint, visible above it — mirroring how fumadocs' own docs layout\n * keeps its table-of-contents rail always in the DOM. There is no\n * `variant`/`color` axis — like `Table`/`Grid`/`Flex`, this is a\n * structural primitive, not a themed surface.\n *\n * `breakpoint` and Aside's `@xl` cutoff are both measured against\n * `AppShell`'s own rendered width, not the browser viewport — so this\n * behaves correctly embedded in a panel, a resizable pane, or anything\n * narrower than the window, not just when it fills the whole page.\n *\n * <AppShell>\n * <AppShell.Sidebar>\n * <AppShell.SidebarHeader>Logo</AppShell.SidebarHeader>\n * <AppShell.SidebarBody>Nav — scrolls</AppShell.SidebarBody>\n * <AppShell.SidebarFooter>User menu</AppShell.SidebarFooter>\n * </AppShell.Sidebar>\n * <AppShell.Header>\n * <AppShell.SidebarTrigger asChild>\n * <ActionIcon variant=\"subtle\" color=\"neutral\"><PanelLeft /></ActionIcon>\n * </AppShell.SidebarTrigger>\n * </AppShell.Header>\n * <AppShell.Main>Page content</AppShell.Main>\n * <AppShell.Aside>On this page…</AppShell.Aside>\n * </AppShell>\n */\n\ntype AppShellContextValue = {\n /** Mobile drawer open state — always uncontrolled, never a public prop. */\n mobileOpen: boolean\n setMobileOpen: Dispatch<SetStateAction<boolean>>\n isMobile: boolean\n}\n\nconst AppShellContext = createContext<AppShellContextValue | null>(null)\n\nfunction useAppShell(): AppShellContextValue {\n const ctx = useContext(AppShellContext)\n if (!ctx) throw new Error(\"AppShell parts must be rendered within <AppShell>.\")\n return ctx\n}\n\nexport type AppShellProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** AppShell's own rendered width (px) below which Sidebar renders as an\n * overlay `Drawer` instead of a grid column — measured against the\n * container itself via `ResizeObserver`, not the viewport. @default 768 */\n breakpoint?: number\n /** Lands on the grid root; also used internally to measure `breakpoint`\n * against the container's own width. */\n ref?: Ref<HTMLDivElement>\n }\n\nconst AppShellRoot = ({\n breakpoint = 768,\n className,\n style,\n children,\n ref,\n testId,\n ...rest\n}: AppShellProps) => {\n const rootRef = useRef<HTMLDivElement>(null)\n const [mobileOpen, setMobileOpen] = useState(false)\n const isMobile = useContainerQuery(rootRef, breakpoint)\n\n return (\n <AppShellContext.Provider value={{ mobileOpen, setMobileOpen, isMobile }}>\n <ark.div\n {...props({ \"data-testid\": testId })}\n {...rest}\n ref={mergeRefs(ref, rootRef)}\n style={{ gridTemplateAreas: `\"sidebar header header\" \"sidebar main aside\"`, ...style }}\n className={cn(\n \"@container grid h-dvh grid-cols-[auto_1fr_auto] grid-rows-[auto_1fr] overflow-hidden\",\n className,\n )}\n >\n {children}\n </ark.div>\n </AppShellContext.Provider>\n )\n}\n\nconst SIDEBAR_WIDTH: Record<Size, string> = {\n xs: \"w-56\",\n sm: \"w-64\",\n md: \"w-72\",\n lg: \"w-80\",\n xl: \"w-96\",\n}\n\nexport type AppShellSidebarProps = NoAsChild<HTMLArkProps<\"aside\">> &\n WithTestId & {\n /** Width when expanded, from the kit's Size scale. @default \"md\" */\n size?: Size\n }\n\n/**\n * Below `breakpoint`, renders through the kit's own `Drawer` instead of the\n * grid column — same `SidebarHeader`/`SidebarBody`/`SidebarFooter` children\n * either way, mirroring the desktop docked aside's layout: `Drawer`'s own\n * body normally forces every child through one scrolling container, which\n * would otherwise carry Header/Footer along with the scroll instead of\n * pinning them — `classNames.body` turns it into the same flex column\n * (Header/Footer as plain shrink-0 flex items, only SidebarBody's own\n * `overflow-y-auto` scrolls) instead. Full width, opening from the logical\n * end edge (right in LTR). `withCloseButton={false}` — at full width,\n * `Drawer`'s own generic close bar would just stack a second, redundant\n * header above `SidebarHeader`; render a `SidebarTrigger` inside\n * `SidebarHeader` itself instead for one unified bar with a visible close\n * affordance (swipe-to-dismiss on `Drawer`'s content still works too, but\n * isn't the only way out — not discoverable, and risky to rely on alone in\n * a sidebar full of tappable nav rows).\n *\n * Exclusive branch, not always-mounted-and-CSS-hidden like `Aside` — unlike\n * `Aside`, `Sidebar` has two genuinely different structural forms (a plain\n * `<aside>` vs. a portaled dialog with focus-trap/ARIA machinery), so\n * keeping both permanently mounted would mean literally duplicating\n * `children` (and any side effects inside it) into two simultaneous trees.\n * Matches fumadocs' own sidebar, which is JS-conditional for the same\n * reason — only its TOC (this component's `Aside`) goes the always-mounted\n * route. Only `size`/`className`/`children` carry over to `Drawer` mode;\n * arbitrary `<aside>` props don't apply to `Drawer`'s own curated prop\n * surface.\n */\nconst AppShellSidebar = ({\n size = \"md\",\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: AppShellSidebarProps) => {\n const { isMobile, mobileOpen, setMobileOpen } = useAppShell()\n\n if (isMobile) {\n return (\n <Drawer\n open={mobileOpen}\n onOpenChange={setMobileOpen}\n placement=\"end\"\n withCloseButton={false}\n testId={testId}\n classNames={{ body: \"flex flex-col overflow-hidden p-0\" }}\n className={cn(\"w-full max-w-none\", className)}\n >\n {children}\n </Drawer>\n )\n }\n\n return (\n <ark.aside\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"[grid-area:sidebar] flex flex-col overflow-hidden text-gray-light-900 dark:text-gray-dark-25\",\n // Brand-derived border/fill, matching InputBase/Popover/Modal/Drawer/Table's\n // own chrome (border-brand-900/20 dark:border-white/15, bg-brand-50/90\n // dark:bg-brand-950/85) rather than a neutral gray.\n \"border-e border-brand-900/20 bg-brand-50/90 dark:border-white/15 dark:bg-brand-950/85\",\n SIDEBAR_WIDTH[size],\n className,\n )}\n >\n {children}\n </ark.aside>\n )\n}\n\n// Shared by SidebarHeader and Header so the two sit at the same height and\n// Header's bottom border lines up level with SidebarHeader's own bottom edge\n// — sizing each off its own padding + content independently (the original\n// approach) drifts out of sync as soon as one holds taller content than the\n// other.\nconst HEADER_HEIGHT_CLASS = \"h-14\"\n\nexport type AppShellSidebarHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n// Plain flex sibling, not routed through the `ark.*` factory — mirrors\n// Drawer.Header/.Body/.Footer, which aren't either.\nconst AppShellSidebarHeader = ({ className, testId, ...rest }: AppShellSidebarHeaderProps) => (\n <div\n className={cn(HEADER_HEIGHT_CLASS, \"flex shrink-0 items-center gap-2 px-4\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type AppShellSidebarBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * The scroll region — the only part of Sidebar that scrolls. The mask fades\n * content at the top/bottom edges instead of clipping it on a hard line\n * (fumadocs' own docs sidebar uses the same static mask on its nav\n * viewport); `overscroll-contain` stops scrolling the list from chaining\n * into scrolling the rest of the page once it hits either end.\n */\nconst AppShellSidebarBody = ({ className, testId, ...rest }: AppShellSidebarBodyProps) => (\n <div\n className={cn(\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain p-4\",\n \"[mask-image:linear-gradient(to_bottom,transparent,black_12px,black_calc(100%-12px),transparent)]\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type AppShellSidebarFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nconst AppShellSidebarFooter = ({ className, testId, ...rest }: AppShellSidebarFooterProps) => (\n <div className={cn(\"shrink-0 p-4\", className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type AppShellHeaderProps = HTMLArkProps<\"header\"> & WithTestId\n\nconst AppShellHeader = ({ className, testId, ...rest }: AppShellHeaderProps) => (\n <ark.header\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n HEADER_HEIGHT_CLASS,\n // Brand-derived border/fill, matching InputBase/Popover/Modal/Drawer/Table's\n // own chrome (border-brand-900/20 dark:border-white/15, bg-brand-50/90\n // dark:bg-brand-950/85) rather than a neutral gray.\n \"[grid-area:header] flex shrink-0 items-center gap-3 border-b border-brand-900/20 bg-brand-50/90 px-4 text-gray-light-900\",\n \"dark:border-white/15 dark:bg-brand-950/85 dark:text-gray-dark-25\",\n className,\n )}\n />\n)\n\nexport type AppShellMainSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\n// A local scale rather than the shared Size one: these are page widths, not\n// control widths, so they read off the kit's own `--width-*` tokens\n// (theme.css) — the vocabulary Modal already uses — instead of inventing a\n// second set. Static class strings so Tailwind's build-time scanner picks them\n// up, in the same lookup-map shape as SIDEBAR_WIDTH/ASIDE_WIDTH above.\nconst MAIN_MEASURE: Record<AppShellMainSize, string> = {\n sm: \"[--app-shell-measure:var(--width-xl)]\", // 48rem / 768px\n md: \"[--app-shell-measure:var(--width-2xl)]\", // 64rem / 1024px\n lg: \"[--app-shell-measure:var(--width-3xl)]\", // 80rem / 1280px\n xl: \"[--app-shell-measure:var(--width-4xl)]\", // 90rem / 1440px\n}\n\nexport type AppShellMainProps = HTMLArkProps<\"main\"> &\n WithTestId & {\n /** Width of the content column, from the kit's `--width-*` tokens:\n * `sm` 48rem · `md` 64rem · `lg` 80rem · `xl` 90rem. @default \"lg\" */\n size?: AppShellMainSize\n /** Drop the content column entirely — children fill Main edge to edge, as\n * they did before the column existed. For pages whose Main *is* one\n * full-canvas component (a Schedule, a DataTable sized to the viewport)\n * rather than a document. @default false */\n fluid?: boolean\n }\n\n/**\n * The page region. By default its children sit in a centered content column,\n * so a page of prose and forms doesn't stretch to whatever width the window\n * happens to be; `AppShell.Full` opts one child out to the full width, and\n * `AppShell.Content` puts arbitrary content back in.\n *\n * The column is three grid tracks — `1fr`, the column, `1fr` — rather than\n * inline padding, which is what lets a child span *past* the gutters without\n * negative margins, `100vw`, or any JS measurement. Percentages in track\n * sizing resolve against Main's own content box, so the column is correct\n * beside a sidebar, inside a resizable pane, or in a bounded docs preview\n * frame, with no media query and no `ResizeObserver` involved. Below\n * `measure + 2 × gutter` the middle track collapses to `100% - 2 × gutter`\n * and the `1fr` tracks land exactly on the gutter, so the column degrades\n * into plain padding continuously, without a breakpoint.\n *\n * `align-content: start` is load-bearing: grid's default (`normal`, i.e.\n * `stretch`) hands leftover vertical space to every auto row, which would\n * space a short page's blocks out down the viewport.\n *\n * <AppShell.Main>\n * <Title>Quarterly sales</Title>\n * <AppShell.Full asChild>\n * <DataTable … />\n * </AppShell.Full>\n * </AppShell.Main>\n */\nconst AppShellMain = ({\n size = \"lg\",\n fluid = false,\n className,\n testId,\n ...rest\n}: AppShellMainProps) => (\n <ark.main\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"[grid-area:main] min-h-0 overflow-y-auto\",\n !fluid && [\n // Gutter doubles as Main's block padding, so content never butts\n // against Header. Overridable per page with\n // `className=\"[--app-shell-gutter:2rem]\"`; both vars inherit, which is\n // what lets `AppShell.Content` re-derive the column at any depth.\n \"[--app-shell-gutter:1.5rem] py-(--app-shell-gutter)\",\n MAIN_MEASURE[size],\n \"grid content-start grid-cols-[1fr_min(100%-2*var(--app-shell-gutter),var(--app-shell-measure))_1fr]\",\n // Both placement rules are authored here, on the same element, so\n // their relative weight is decided by specificity — `.main > [data-full]`\n // (0,2,0) over `.main > *` (0,1,0) — and never by where Tailwind\n // happens to sort two same-weight utilities. `min-w-0` stops a wide\n // child (a DataTable) overflowing the column, and zeroes a spanning\n // child's min-content contribution so it can't inflate the gutters.\n \"[&>*]:col-start-2 [&>*]:min-w-0\",\n \"[&>[data-full]]:col-span-full\",\n ],\n className,\n )}\n />\n)\n\nexport type AppShellFullProps = HTMLArkProps<\"div\"> & WithTestId\n\n/**\n * Opts one child of `AppShell.Main` out of the content column, spanning every\n * track so it reaches Main's true edges — for the things a column actively\n * hurts: data tables, carousels, heroes, full-width backgrounds.\n *\n * Carries no layout class of its own; it only marks itself with `data-full`,\n * and Main's own rule does the placement (see `AppShellMain`). `asChild`\n * merges that marker onto the component itself, so nothing extra lands in the\n * DOM:\n *\n * <AppShell.Full asChild>\n * <DataTable … />\n * </AppShell.Full>\n *\n * Only works as a *direct* child of Main — breaking out of a grid means being\n * in it. Wrap content in a `Full` band and use `AppShell.Content` inside it\n * rather than nesting `Full` deeper.\n */\nconst AppShellFull = ({ testId, ...rest }: AppShellFullProps) => (\n <ark.div data-full=\"\" {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type AppShellContentProps = HTMLArkProps<\"div\"> & WithTestId\n\n/**\n * Puts content back into Main's column — the counterpart to `AppShell.Full`,\n * for a full-width band whose *text* should still line up with the rest of the\n * page:\n *\n * <AppShell.Full asChild>\n * <section className=\"bg-brand-50 py-16\">\n * <AppShell.Content>\n * <Title>Welcome back</Title>\n * </AppShell.Content>\n * </section>\n * </AppShell.Full>\n *\n * The width expression is the same one Main gives its middle track, resolved\n * against this element's own containing block, so the edges line up exactly at\n * both ends of the range — full measure when there's room, gutter-only when\n * there isn't. Reading the inherited custom properties rather than using\n * `subgrid` is deliberate: subgrid would only reach one level down, only from\n * an element spanning every track, and would break on any wrapper in between.\n * This works at any depth, including inside a `fluid` Main.\n */\nconst AppShellContent = ({ className, testId, ...rest }: AppShellContentProps) => (\n <ark.div\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"mx-auto w-[min(100%-2*var(--app-shell-gutter),var(--app-shell-measure))]\",\n className,\n )}\n />\n)\n\nconst ASIDE_WIDTH: Record<Size, string> = {\n xs: \"@xl:w-56\",\n sm: \"@xl:w-64\",\n md: \"@xl:w-72\",\n lg: \"@xl:w-80\",\n xl: \"@xl:w-96\",\n}\n\nexport type AppShellAsideProps = HTMLArkProps<\"aside\"> &\n WithTestId & {\n /** Width when visible, from the kit's Size scale. @default \"md\" */\n size?: Size\n }\n\n/**\n * The right region, below `Header` (unlike `Sidebar`, which spans the full\n * height beside it). Unlike `Sidebar`, always mounted — hidden below a\n * `@xl` *container* breakpoint (1280px of `AppShell`'s own width, via\n * Tailwind's native container queries — `AppShell`'s root carries\n * `@container`) and shown above it, purely via static classes, no\n * `useContainerQuery`/context involved. Matches fumadocs' own docs layout,\n * which keeps its table-of-contents rail always in the DOM rather than\n * conditionally unmounting it — no hydration mismatch is possible when\n * nothing renders differently based on client-only state. Fixed to `@xl`\n * rather than a configurable prop like Sidebar's `breakpoint`: Sidebar's is\n * JS-driven and can take any pixel value at runtime, but a static Tailwind\n * class can't take an arbitrary runtime breakpoint without breaking the\n * build-time class scanner.\n */\nconst AppShellAside = ({ size = \"md\", className, testId, ...rest }: AppShellAsideProps) => (\n <ark.aside\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"[grid-area:aside] hidden flex-col overflow-y-auto text-gray-light-900 dark:text-gray-dark-25\",\n \"@xl:flex\",\n ASIDE_WIDTH[size],\n className,\n )}\n />\n)\n\nexport type AppShellSidebarTriggerProps = HTMLArkProps<\"button\"> & WithTestId\n\n/**\n * Opens/closes the mobile `Drawer`. Renders nothing above `breakpoint` —\n * Sidebar is always visible on desktop, so there's nothing to toggle.\n * `asChild`-able, like every other kit trigger.\n */\nconst AppShellSidebarTrigger = ({ onClick, testId, ...rest }: AppShellSidebarTriggerProps) => {\n const { isMobile, setMobileOpen } = useAppShell()\n\n if (!isMobile) return null\n\n return (\n <ark.button\n type=\"button\"\n {...props({ \"data-testid\": testId })}\n {...rest}\n onClick={(event) => {\n onClick?.(event)\n setMobileOpen((open) => !open)\n }}\n />\n )\n}\n\nexport const AppShell = Object.assign(AppShellRoot, {\n Sidebar: AppShellSidebar,\n SidebarHeader: AppShellSidebarHeader,\n SidebarBody: AppShellSidebarBody,\n SidebarFooter: AppShellSidebarFooter,\n SidebarTrigger: AppShellSidebarTrigger,\n Header: AppShellHeader,\n Main: AppShellMain,\n Full: AppShellFull,\n Content: AppShellContent,\n Aside: AppShellAside,\n})\n"]}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { controlOpenProps } from '../../chunk-5FDOOG4J.js';
|
|
3
3
|
import { normalizeSelectData, filterSelectData } from '../../chunk-TWGCWKRV.js';
|
|
4
|
-
import { Combobox } from '../../chunk-
|
|
5
|
-
import { inputControlClasses, inputSlot } from '../../chunk-
|
|
6
|
-
import { FieldShell } from '../../chunk-
|
|
7
|
-
import { popoverClearTrigger } from '../../chunk-
|
|
4
|
+
import { Combobox } from '../../chunk-6OLTJYSX.js';
|
|
5
|
+
import { inputControlClasses, inputSlot } from '../../chunk-5OQLFX47.js';
|
|
6
|
+
import { FieldShell } from '../../chunk-FHG54IT5.js';
|
|
7
|
+
import { popoverClearTrigger } from '../../chunk-6GDMSENK.js';
|
|
8
8
|
import '../../chunk-AIQG7IIT.js';
|
|
9
9
|
import '../../chunk-7P32XCEU.js';
|
|
10
10
|
import '../../chunk-BUIHQJGE.js';
|
|
11
11
|
import { useUncontrolled } from '../../chunk-BEL75C7N.js';
|
|
12
12
|
import { CloseIcon } from '../../chunk-IG7FBZVM.js';
|
|
13
|
+
import '../../chunk-I4SQQIP5.js';
|
|
13
14
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
14
15
|
import { cn } from '../../chunk-QP4I37PA.js';
|
|
15
16
|
import { Combobox as Combobox$1 } from '@ark-ui/react/combobox';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;;;;AA6FO,IAAM,eAAe,CAA6C;AAAA,EACvE,IAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA,GAAmB,SAAA;AAAA,EACnB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA,GAAQ,eAAA;AAAA,EACR,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,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C,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n filterSelectData,\n type ItemRenderState,\n type NormalizedItem,\n normalizeSelectData,\n type SelectData,\n type SelectPayload,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Combobox } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { type InputSize, type InputVariant, inputControlClasses, inputSlot } from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * Autocomplete — free-text input with a suggestion popover, on the `Combobox`\n * engine. Unlike `Select`, the **value is the typed string** (`allowCustomValue`):\n * `data` are only suggestions, and the user can type anything or pick one.\n *\n * - `data` accepts the same shapes as `Select` (strings / objects / groups).\n * - Suggestions filter as you type. Once the query exactly\n * matches a suggestion (e.g. right after picking one) the full list shows\n * again rather than collapsing to that single match.\n * - Label / description / error come from the built-in `Field` wrapper.\n */\n\ntype AutocompleteClassNames = {\n field?: string\n control?: string\n input?: string\n option?: string\n popover?: string\n}\n\nexport type AutocompleteProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Suggestions: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled input text (this is the value). */\n value?: string\n /** Uncontrolled initial text. */\n defaultValue?: string\n /** Fires with the input text on every change (typing or picking a suggestion). */\n onChange?: (value: string) => void\n /**\n * Render each suggestion yourself. Receives the item — including its typed\n * `payload` — and its live `{ selected, highlighted }` state; you own the whole\n * row, including any check affordance. Omit it to render the label + selected\n * check.\n */\n renderItem?: (item: NormalizedItem<SelectPayload<Data>>, state: ItemRenderState) => ReactNode\n /** Placeholder shown while the field is empty — this same field also filters the\n * suggestion list, so there's no separate search placeholder. */\n placeholder?: string\n /** Show a clear button once there's text. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the clear button / chevron. */\n endSlot?: ReactNode\n /** Message shown when no suggestion matches. Pass `null` to render nothing. */\n empty?: ReactNode\n size?: InputSize\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for the underlying input (form submission). */\n name?: string\n /** Forwarded to the input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: AutocompleteClassNames\n }\n\nexport const Autocomplete = <const Data extends SelectData = SelectData>({\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder,\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n empty = \"Nothing found\",\n size = \"md\",\n variant = \"default\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: AutocompleteProps<Data>) => {\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n const [query, setQuery] = useUncontrolled({\n value,\n defaultValue,\n onChange,\n finalValue: \"\",\n })\n\n // Clear shows once there's text; in \"replace\" mode it hides the chevron.\n const showClear = Boolean(clearable && query)\n\n // Normalize once per `data`; only the filter re-runs as the query changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const { collection, items, groups } = useMemo(() => {\n const q = query.trim().toLowerCase()\n // Once the query exactly matches an option (e.g. right after\n // picking one) show the full list again rather than just that match.\n const exact = normalized.items.some((i) => i.label.toLowerCase() === q)\n const shouldFilter = q.length > 0 && !exact\n return filterSelectData(\n normalized,\n (item) => !shouldFilter || item.label.toLowerCase().includes(q),\n )\n }, [normalized, query])\n\n const renderOption = (item: NormalizedItem) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={classNames?.option}\n >\n {renderItem\n ? (state) => renderItem(item as NormalizedItem<SelectPayload<Data>>, state)\n : item.label}\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root\n collection={collection}\n inputValue={query}\n onInputValueChange={(details) => setQuery(details.inputValue)}\n allowCustomValue\n openOnClick\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n >\n <Combobox.Context>\n {(api) => (\n <Combobox.Control\n className={classNames?.control}\n startSlot={startSlot}\n {...props({ \"data-invalid\": isInvalid })}\n // Tablet affordance: a tap on the field's dead zones (start/end slots,\n // padding) opens the suggestions and focuses the input. The input,\n // clear ✕ and chevron keep their own taps. Inert when disabled/readOnly.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n >\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `onBlur` / `aria-invalid` pass straight through. */}\n <ArkCombobox.Input\n placeholder={placeholder}\n name={name}\n onBlur={onBlur}\n ref={ref}\n aria-invalid={isInvalid || undefined}\n {...props({ \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {/* The value here is the typed text, not a machine selection, so Ark's\n `value`-gated ClearTrigger stays hidden — clear the input directly\n instead. A real (tabbable) button; `preventDefault` keeps focus on\n the input through the tap. */}\n {showClear && (\n <button\n type=\"button\"\n aria-label=\"Clear value\"\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => setQuery(\"\")}\n className={popoverClearTrigger}\n >\n <CloseIcon />\n </button>\n )}\n {(clearSectionMode === \"both\" || !showClear) && (\n <Combobox.Trigger aria-label=\"Show options\" data-chevron />\n )}\n </Combobox.Control>\n )}\n </Combobox.Context>\n\n <Combobox.Content className={classNames?.popover}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Content>\n </Combobox.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;;;;;AA6FO,IAAM,eAAe,CAA6C;AAAA,EACvE,IAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA,GAAmB,SAAA;AAAA,EACnB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA,GAAQ,eAAA;AAAA,EACR,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,KAA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AAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n filterSelectData,\n type ItemRenderState,\n type NormalizedItem,\n normalizeSelectData,\n type SelectData,\n type SelectPayload,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Combobox } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { type InputSize, type InputVariant, inputControlClasses, inputSlot } from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * Autocomplete — free-text input with a suggestion popover, on the `Combobox`\n * engine. Unlike `Select`, the **value is the typed string** (`allowCustomValue`):\n * `data` are only suggestions, and the user can type anything or pick one.\n *\n * - `data` accepts the same shapes as `Select` (strings / objects / groups).\n * - Suggestions filter as you type. Once the query exactly\n * matches a suggestion (e.g. right after picking one) the full list shows\n * again rather than collapsing to that single match.\n * - Label / description / error come from the built-in `Field` wrapper.\n */\n\ntype AutocompleteClassNames = {\n field?: string\n control?: string\n input?: string\n option?: string\n popover?: string\n}\n\nexport type AutocompleteProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Suggestions: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled input text (this is the value). */\n value?: string\n /** Uncontrolled initial text. */\n defaultValue?: string\n /** Fires with the input text on every change (typing or picking a suggestion). */\n onChange?: (value: string) => void\n /**\n * Render each suggestion yourself. Receives the item — including its typed\n * `payload` — and its live `{ selected, highlighted }` state; you own the whole\n * row, including any check affordance. Omit it to render the label + selected\n * check.\n */\n renderItem?: (item: NormalizedItem<SelectPayload<Data>>, state: ItemRenderState) => ReactNode\n /** Placeholder shown while the field is empty — this same field also filters the\n * suggestion list, so there's no separate search placeholder. */\n placeholder?: string\n /** Show a clear button once there's text. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the clear button / chevron. */\n endSlot?: ReactNode\n /** Message shown when no suggestion matches. Pass `null` to render nothing. */\n empty?: ReactNode\n size?: InputSize\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for the underlying input (form submission). */\n name?: string\n /** Forwarded to the input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: AutocompleteClassNames\n }\n\nexport const Autocomplete = <const Data extends SelectData = SelectData>({\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder,\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n empty = \"Nothing found\",\n size = \"md\",\n variant = \"default\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: AutocompleteProps<Data>) => {\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n const [query, setQuery] = useUncontrolled({\n value,\n defaultValue,\n onChange,\n finalValue: \"\",\n })\n\n // Clear shows once there's text; in \"replace\" mode it hides the chevron.\n const showClear = Boolean(clearable && query)\n\n // Normalize once per `data`; only the filter re-runs as the query changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const { collection, items, groups } = useMemo(() => {\n const q = query.trim().toLowerCase()\n // Once the query exactly matches an option (e.g. right after\n // picking one) show the full list again rather than just that match.\n const exact = normalized.items.some((i) => i.label.toLowerCase() === q)\n const shouldFilter = q.length > 0 && !exact\n return filterSelectData(\n normalized,\n (item) => !shouldFilter || item.label.toLowerCase().includes(q),\n )\n }, [normalized, query])\n\n const renderOption = (item: NormalizedItem) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={classNames?.option}\n >\n {renderItem\n ? (state) => renderItem(item as NormalizedItem<SelectPayload<Data>>, state)\n : item.label}\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root\n collection={collection}\n inputValue={query}\n onInputValueChange={(details) => setQuery(details.inputValue)}\n allowCustomValue\n openOnClick\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n >\n <Combobox.Context>\n {(api) => (\n <Combobox.Control\n className={classNames?.control}\n startSlot={startSlot}\n {...props({ \"data-invalid\": isInvalid })}\n // Tablet affordance: a tap on the field's dead zones (start/end slots,\n // padding) opens the suggestions and focuses the input. The input,\n // clear ✕ and chevron keep their own taps. Inert when disabled/readOnly.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n >\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `onBlur` / `aria-invalid` pass straight through. */}\n <ArkCombobox.Input\n placeholder={placeholder}\n name={name}\n onBlur={onBlur}\n ref={ref}\n aria-invalid={isInvalid || undefined}\n {...props({ \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {/* The value here is the typed text, not a machine selection, so Ark's\n `value`-gated ClearTrigger stays hidden — clear the input directly\n instead. A real (tabbable) button; `preventDefault` keeps focus on\n the input through the tap. */}\n {showClear && (\n <button\n type=\"button\"\n aria-label=\"Clear value\"\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => setQuery(\"\")}\n className={popoverClearTrigger}\n >\n <CloseIcon />\n </button>\n )}\n {(clearSectionMode === \"both\" || !showClear) && (\n <Combobox.Trigger aria-label=\"Show options\" data-chevron />\n )}\n </Combobox.Control>\n )}\n </Combobox.Context>\n\n <Combobox.Content className={classNames?.popover}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Content>\n </Combobox.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type HTMLArkProps } from "@ark-ui/react";
|
|
2
2
|
import type { ElementType, ReactNode } from "react";
|
|
3
|
+
import { type ForbidAsChild } from "../../lib/as-child";
|
|
3
4
|
import type { WithTestId } from "../../lib/test-id";
|
|
4
5
|
/** A framework's own link component (e.g. Next.js's `Link`), substituted for
|
|
5
6
|
* a plain `<a>` so navigation stays client-side. Must accept `href` —
|
|
@@ -45,7 +46,7 @@ export type BreadcrumbDataItem = {
|
|
|
45
46
|
* stable positional fallback (`` `breadcrumb-item-${i}` ``). */
|
|
46
47
|
testId?: string;
|
|
47
48
|
};
|
|
48
|
-
export type BreadcrumbProps = Omit<BreadcrumbRootProps, "children"> & {
|
|
49
|
+
export type BreadcrumbProps = Omit<BreadcrumbRootProps, "children" | "asChild"> & ForbidAsChild & {
|
|
49
50
|
/** The crumbs to render, in order. */
|
|
50
51
|
data: readonly BreadcrumbDataItem[];
|
|
51
52
|
/** Renders a leading icon-only `Breadcrumb.Home`. `true` uses the default
|
|
@@ -54,7 +55,7 @@ export type BreadcrumbProps = Omit<BreadcrumbRootProps, "children"> & {
|
|
|
54
55
|
href: string;
|
|
55
56
|
});
|
|
56
57
|
};
|
|
57
|
-
declare const BreadcrumbComponent: ({ data, withHome, ...rootProps }: BreadcrumbProps) => import("react").JSX.Element;
|
|
58
|
+
declare const BreadcrumbComponent: ({ data, withHome, asChild: _asChild, ...rootProps }: BreadcrumbProps) => import("react").JSX.Element;
|
|
58
59
|
export declare const Breadcrumb: typeof BreadcrumbComponent & {
|
|
59
60
|
Root: typeof BreadcrumbRoot;
|
|
60
61
|
Home: typeof BreadcrumbHome;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjE,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,oBAAoB,CAAA;AAG3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAsCnD;;;+DAG+D;AAC/D,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAA;AAEjD,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,KAAK,CAAC,GACnD,UAAU,GAAG;IACX,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;0CACsC;IACtC,aAAa,CAAC,EAAE,uBAAuB,CAAA;IACvC;yBACqB;IACrB,UA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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withAsChildContent } from '../../chunk-I4SQQIP5.js';
|
|
1
2
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
2
3
|
import { cn } from '../../chunk-QP4I37PA.js';
|
|
3
4
|
import { ark } from '@ark-ui/react';
|
|
@@ -129,7 +130,7 @@ var BreadcrumbHome = ({
|
|
|
129
130
|
testId,
|
|
130
131
|
...rest
|
|
131
132
|
}) => {
|
|
132
|
-
const icon =
|
|
133
|
+
const icon = (own) => own ?? /* @__PURE__ */ jsx(House, { "aria-hidden": true, size: 16 });
|
|
133
134
|
if (asChild) {
|
|
134
135
|
return /* @__PURE__ */ jsx("li", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
135
136
|
ark.a,
|
|
@@ -139,7 +140,7 @@ var BreadcrumbHome = ({
|
|
|
139
140
|
className: cn(linkItemClasses, className),
|
|
140
141
|
...props({ "data-testid": testId }),
|
|
141
142
|
...rest,
|
|
142
|
-
children: icon
|
|
143
|
+
children: withAsChildContent(children, icon)
|
|
143
144
|
}
|
|
144
145
|
) });
|
|
145
146
|
}
|
|
@@ -152,7 +153,7 @@ var BreadcrumbHome = ({
|
|
|
152
153
|
className: cn(linkItemClasses, className),
|
|
153
154
|
...props({ "data-testid": testId }),
|
|
154
155
|
...rest,
|
|
155
|
-
children: icon
|
|
156
|
+
children: icon(children)
|
|
156
157
|
}
|
|
157
158
|
) });
|
|
158
159
|
}
|
|
@@ -164,7 +165,7 @@ var BreadcrumbHome = ({
|
|
|
164
165
|
className: cn(linkItemClasses, className),
|
|
165
166
|
...props({ "data-testid": testId }),
|
|
166
167
|
...rest,
|
|
167
|
-
children: icon
|
|
168
|
+
children: icon(children)
|
|
168
169
|
}
|
|
169
170
|
) });
|
|
170
171
|
};
|
|
@@ -179,7 +180,12 @@ var renderDataItem = (item, key, current) => /* @__PURE__ */ jsx(
|
|
|
179
180
|
},
|
|
180
181
|
key
|
|
181
182
|
);
|
|
182
|
-
var BreadcrumbComponent = ({
|
|
183
|
+
var BreadcrumbComponent = ({
|
|
184
|
+
data,
|
|
185
|
+
withHome,
|
|
186
|
+
asChild: _asChild,
|
|
187
|
+
...rootProps
|
|
188
|
+
}) => {
|
|
183
189
|
const explicitCurrent = data.some((item) => item.current !== void 0);
|
|
184
190
|
return /* @__PURE__ */ jsxs(BreadcrumbRoot, { ...rootProps, children: [
|
|
185
191
|
withHome && /* @__PURE__ */ jsx(BreadcrumbHome, { ...typeof withHome === "object" ? withHome : void 0 }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/breadcrumb/breadcrumb.tsx"],"names":[],"mappings":";;;;;;;AAUA,IAAM,WAAA,GAAc,EAAA;AAAA,EAClB,yGAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,eAAA,GAAkB,4DAAA;AAIxB,IAAM,kBAAA,GAAqB,6CAAA;AAM3B,IAAM,eAAA,GAAkB,wDAAA;AACxB,IAAM,eAAA,GAAkB,EAAA,CAAG,eAAA,EAAiB,eAAe,CAAA;AAC3D,IAAM,kBAAA,GAAqB,EAAA,CAAG,eAAA,EAAiB,kBAAkB,CAAA;AAWjE,IAAM,YAAA,GAAe,mDAAA;AACrB,IAAM,gBAAA,GAAmB,EAAA,CAAG,YAAA,EAAc,aAAa,CAAA;AACvD,IAAM,mBAAA,GAAsB,EAAA,CAAG,YAAA,EAAc,WAAW,CAAA;AAExD,IAAM,gBAAA,GAAmB,iEAAA;AA2DzB,SAAS,eACP,IAAA,EACmE;AACnE,EAAA,OAAO,eAAe,IAAI,CAAA,KAAM,KAAK,IAAA,KAAS,cAAA,IAAkB,KAAK,IAAA,KAAS,cAAA,CAAA;AAChF;AAEA,IAAM,iBAAiB,CAAC;AAAA,EACtB,SAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA,GAAY,GAAA;AAAA,EACZ,aAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,KAA2B;A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YAAY,MAAS,CAAA;AAEtE,EAAA,uBACE,IAAA,CAAC,cAAA,EAAA,EAAgB,GAAG,SAAA,EACjB,QAAA,EAAA;AAAA,IAAA,QAAA,wBAAa,cAAA,EAAA,EAAgB,GAAI,OAAO,QAAA,KAAa,QAAA,GAAW,WAAW,MAAA,EAAY,CAAA;AAAA,IACvF,IAAA,CAAK,GAAA;AAAA,MAAI,CAAC,MAAM,CAAA,KACf,cAAA;AAAA,QACE,IAAA;AAAA,QACA,mBAAmB,CAAC,CAAA,CAAA;AAAA,QACpB,KAAK,OAAA,KAAY,CAAC,eAAA,IAAmB,CAAA,KAAM,KAAK,MAAA,GAAS,CAAA;AAAA;AAC3D;AACF,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,IAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,mBAAA,EAAqB;AAAA,EAC3D,IAAA,EAAM,cAAA;AAAA,EACN,IAAA,EAAM,cAAA;AAAA,EACN,IAAA,EAAM;AACR,CAAC","file":"index.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { House } from \"lucide-react\"\nimport type { ElementType, ReactElement, ReactNode } from \"react\"\nimport { Children, cloneElement, isValidElement } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/** Figma's \"Radius/sm\" for this pill is 4px, which is this kit's `rounded-xs`\n * step, not `rounded-sm` — the two token scales don't line up at \"sm\". */\nconst listClasses = cn(\n \"m-0 inline-flex max-w-full list-none items-center gap-1 rounded-xs border border-brand-900/20 px-2 py-1\",\n \"font-mono text-sm leading-[18px] dark:border-white/15\",\n)\n\nconst linkItemClasses = \"text-gray-light-900 dark:text-gray-dark-25 hover:underline\"\n\n/** The current/last crumb isn't a link, so it's de-emphasized rather than\n * bolded — matches the source design, the inverse of some conventions. */\nconst currentItemClasses = \"text-gray-light-500 dark:text-gray-dark-400\"\n\n/** A text crumb's label ellipsizes once its `<li>` is squeezed. CSS never\n * ellipsizes the first character or atomic inline on a line — it clips it —\n * so a lone label letter would block a bare \"…\"; the empty inline-block\n * `::before` takes that exemption instead, letting the label elide entirely. */\nconst truncateClasses = \"block truncate before:inline-block before:content-['']\"\nconst linkTextClasses = cn(truncateClasses, linkItemClasses)\nconst currentTextClasses = cn(truncateClasses, currentItemClasses)\n\n/** Truncation is the flex algorithm's job, not JS's: crumbs may shrink down to\n * `1ch` — exactly the mono \"…\" glyph — and shrink weights order who gives way.\n * Links (1000) dwarf the current crumb (10), so ancestors elide first and the\n * page you're on stays readable longest. A hovered or keyboard-focused crumb\n * drops to 1, so its siblings give up their room first and it reopens to its\n * full label — still eliding rather than overflowing if even that isn't\n * enough, which `shrink-0` would do. No weight goes below 1: when the\n * unfrozen items' factors sum to less than 1, flexbox distributes only that\n * fraction of the overflow, and a lone hovered crumb would overflow anyway. */\nconst crumbClasses = \"min-w-[1ch] hover:shrink has-focus-visible:shrink\"\nconst linkCrumbClasses = cn(crumbClasses, \"shrink-1000\")\nconst currentCrumbClasses = cn(crumbClasses, \"shrink-10\")\n\nconst separatorClasses = \"shrink-0 select-none text-gray-light-900 dark:text-gray-dark-25\"\n\n/** A framework's own link component (e.g. Next.js's `Link`), substituted for\n * a plain `<a>` so navigation stays client-side. Must accept `href` —\n * routers whose Link takes `to` instead (React Router) need a two-line\n * local wrapper renaming the prop before it's passed here. */\nexport type BreadcrumbLinkComponent = ElementType\n\nexport type BreadcrumbRootProps = HTMLArkProps<\"nav\"> &\n WithTestId & {\n /** Rendered between crumbs, decorative (`aria-hidden`). @default \"/\" */\n separator?: ReactNode\n /** Default `linkComponent` for every `Breadcrumb.Item`/`Breadcrumb.Home`\n * child that doesn't set its own. */\n linkComponent?: BreadcrumbLinkComponent\n /** Styles the inner `<ol>` (the bordered pill); `className` targets the\n * outer `<nav>`. */\n classNames?: { list?: string }\n }\n\n/**\n * Breadcrumb — a trail of links showing the current page's place in a\n * hierarchy (home → … → current page). Pure React Server Component: no\n * state, no `\"use client\"`.\n *\n * The last crumb renders muted and non-interactive with `aria-current=\"page\"`\n * — it isn't a link, so it's deliberately de-emphasized rather than bolded.\n * Separators (\"/\") are generated automatically between crumbs; you never\n * place them yourself.\n *\n * The trail fits its container without any JS: when space runs out, link\n * crumbs ellipsize first (down to a bare \"…\"), then the current crumb. The\n * Home icon and separators never shrink. Hovering or focusing a crumb reveals\n * its full label.\n *\n * Two ways to use it:\n *\n * <Breadcrumb data={[{ label: \"Repo\", href: \"/repo\" }, { label: \"File\" }]} withHome />\n *\n * <Breadcrumb.Root>\n * <Breadcrumb.Home href=\"/\" />\n * <Breadcrumb.Item href=\"/repo\">Repo</Breadcrumb.Item>\n * <Breadcrumb.Item current>File</Breadcrumb.Item>\n * </Breadcrumb.Root>\n *\n * Pass `linkComponent` (here, or per-item) to route every generated crumb\n * through a framework's own `Link` instead of a plain `<a>`, so navigation\n * stays client-side:\n *\n * <Breadcrumb data={items} linkComponent={Link} />\n *\n * For one-off composition, `asChild` (inherited from Ark) still works on any\n * single `Breadcrumb.Item`/`Breadcrumb.Home` — it wins over `linkComponent`.\n *\n * There's no leading \"back\" button, even though every one of this\n * component's source designs pairs it with one — that's a router/history\n * action this kit has no opinion on. Compose your own next to `Breadcrumb`\n * with `ActionIcon` (see the docs).\n */\nfunction isCrumbElement(\n node: ReactNode,\n): node is ReactElement<{ linkComponent?: BreadcrumbLinkComponent }> {\n return isValidElement(node) && (node.type === BreadcrumbItem || node.type === BreadcrumbHome)\n}\n\nconst BreadcrumbRoot = ({\n className,\n classNames,\n separator = \"/\",\n linkComponent,\n children,\n testId,\n ...rest\n}: BreadcrumbRootProps) => {\n let content: ReactNode = children\n if (!rest.asChild) {\n const rendered: ReactNode[] = []\n let seenCrumb = false\n for (const child of Children.toArray(children)) {\n if (!isCrumbElement(child)) {\n rendered.push(child)\n continue\n }\n if (seenCrumb) {\n rendered.push(\n <li key={`separator-${rendered.length}`} aria-hidden=\"true\" className={separatorClasses}>\n {separator}\n </li>,\n )\n }\n rendered.push(\n cloneElement(child, { linkComponent: child.props.linkComponent ?? linkComponent }),\n )\n seenCrumb = true\n }\n content = <ol className={cn(listClasses, classNames?.list)}>{rendered}</ol>\n }\n\n return (\n <ark.nav\n aria-label=\"Breadcrumb\"\n className={cn(\"min-w-0\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {content}\n </ark.nav>\n )\n}\n\nexport type BreadcrumbItemProps = HTMLArkProps<\"a\"> &\n WithTestId & {\n /** Marks this as the current/last crumb: non-interactive, muted,\n * `aria-current=\"page\"`, no href/anchor. Figma's `state=\"Active\"`. */\n current?: boolean\n /** Overrides the `linkComponent` inherited from `Breadcrumb.Root`. */\n linkComponent?: BreadcrumbLinkComponent\n }\n\n/** One crumb — a link, or (with `current`) the non-interactive current page. */\nconst BreadcrumbItem = ({\n href,\n current,\n linkComponent: LinkComponent,\n asChild,\n className,\n children,\n testId,\n ...rest\n}: BreadcrumbItemProps) => {\n if (current) {\n return (\n <li className={currentCrumbClasses}>\n <ark.span\n aria-current=\"page\"\n className={cn(currentTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ark.span>\n </li>\n )\n }\n if (asChild) {\n return (\n <li className={linkCrumbClasses}>\n <ark.a\n asChild\n className={cn(linkTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ark.a>\n </li>\n )\n }\n if (LinkComponent) {\n return (\n <li className={linkCrumbClasses}>\n <LinkComponent\n href={href}\n className={cn(linkTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </LinkComponent>\n </li>\n )\n }\n return (\n <li className={linkCrumbClasses}>\n <ark.a\n href={href}\n className={cn(linkTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ark.a>\n </li>\n )\n}\n\nexport type BreadcrumbHomeProps = HTMLArkProps<\"a\"> &\n WithTestId & {\n /** Overrides the `linkComponent` inherited from `Breadcrumb.Root`. */\n linkComponent?: BreadcrumbLinkComponent\n }\n\n/** Icon-only leading crumb — always a link, never `current`. `children`\n * overrides the default house icon; `aria-label` defaults to \"Home\". */\nconst BreadcrumbHome = ({\n href,\n linkComponent: LinkComponent,\n asChild,\n className,\n children,\n \"aria-label\": ariaLabel = \"Home\",\n testId,\n ...rest\n}: BreadcrumbHomeProps) => {\n const icon = children ?? <House aria-hidden size={16} />\n if (asChild) {\n return (\n <li className=\"shrink-0\">\n <ark.a\n asChild\n aria-label={ariaLabel}\n className={cn(linkItemClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {icon}\n </ark.a>\n </li>\n )\n }\n if (LinkComponent) {\n return (\n <li className=\"shrink-0\">\n <LinkComponent\n href={href}\n aria-label={ariaLabel}\n className={cn(linkItemClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {icon}\n </LinkComponent>\n </li>\n )\n }\n return (\n <li className=\"shrink-0\">\n <ark.a\n href={href}\n aria-label={ariaLabel}\n className={cn(linkItemClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {icon}\n </ark.a>\n </li>\n )\n}\n\nexport type BreadcrumbDataItem = {\n label: ReactNode\n href?: string\n /** Explicit override; if no entry sets this, the last entry defaults to current. */\n current?: boolean\n linkComponent?: BreadcrumbLinkComponent\n /** `data-testid` on the rendered crumb. Defaults to `href` when set, else a\n * stable positional fallback (`` `breadcrumb-item-${i}` ``). */\n testId?: string\n}\n\nexport type BreadcrumbProps = Omit<BreadcrumbRootProps, \"children\"> & {\n /** The crumbs to render, in order. */\n data: readonly BreadcrumbDataItem[]\n /** Renders a leading icon-only `Breadcrumb.Home`. `true` uses the default\n * house icon with no link; pass an object (with `href`) to link it. */\n withHome?: boolean | (BreadcrumbHomeProps & { href: string })\n}\n\n/** Renders one `data` entry to a `Breadcrumb.Item` — factored out so its\n * `key` (built from position) isn't a bare index inline in a `.map` JSX\n * callback. */\nconst renderDataItem = (item: BreadcrumbDataItem, key: string, current: boolean): ReactNode => (\n <BreadcrumbItem\n key={key}\n href={item.href}\n linkComponent={item.linkComponent}\n current={current}\n testId={item.testId ?? item.href ?? key}\n >\n {item.label}\n </BreadcrumbItem>\n)\n\nconst BreadcrumbComponent = ({ data, withHome, ...rootProps }: BreadcrumbProps) => {\n const explicitCurrent = data.some((item) => item.current !== undefined)\n\n return (\n <BreadcrumbRoot {...rootProps}>\n {withHome && <BreadcrumbHome {...(typeof withHome === \"object\" ? withHome : undefined)} />}\n {data.map((item, i) =>\n renderDataItem(\n item,\n `breadcrumb-item-${i}`,\n item.current ?? (!explicitCurrent && i === data.length - 1),\n ),\n )}\n </BreadcrumbRoot>\n )\n}\n\nexport const Breadcrumb = Object.assign(BreadcrumbComponent, {\n Root: BreadcrumbRoot,\n Home: BreadcrumbHome,\n Item: BreadcrumbItem,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/breadcrumb/breadcrumb.tsx"],"names":[],"mappings":";;;;;;;;AAWA,IAAM,WAAA,GAAc,EAAA;AAAA,EAClB,yGAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,eAAA,GAAkB,4DAAA;AAIxB,IAAM,kBAAA,GAAqB,6CAAA;AAM3B,IAAM,eAAA,GAAkB,wDAAA;AACxB,IAAM,eAAA,GAAkB,EAAA,CAAG,eAAA,EAAiB,eAAe,CAAA;AAC3D,IAAM,kBAAA,GAAqB,EAAA,CAAG,eAAA,EAAiB,kBAAkB,CAAA;AAWjE,IAAM,YAAA,GAAe,mDAAA;AACrB,IAAM,gBAAA,GAAmB,EAAA,CAAG,YAAA,EAAc,aAAa,CAAA;AACvD,IAAM,mBAAA,GAAsB,EAAA,CAAG,YAAA,EAAc,WAAW,CAAA;AAExD,IAAM,gBAAA,GAAmB,iEAAA;AA2DzB,SAAS,eACP,IAAA,EACmE;AACnE,EAAA,OAAO,eAAe,IAAI,CAAA,KAAM,KAAK,IAAA,KAAS,cAAA,IAAkB,KAAK,IAAA,KAAS,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A,IAAU,IAAA,CAAK,IAAA,IAAQ,GAAA;AAAA,IAEnC,QAAA,EAAA,IAAA,CAAK;AAAA,GAAA;AAAA,EAND;AAOP,CAAA;AAGF,IAAM,sBAAsB,CAAC;AAAA,EAC3B,IAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA,EAAS,QAAA;AAAA,EACT,GAAG;AACL,CAAA,KAAuB;AACrB,EAAA,MAAM,kBAAkB,IAAA,CAAK,IAAA,CAAK,CAAC,IAAA,KAAS,IAAA,CAAK,YAAY,MAAS,CAAA;AAEtE,EAAA,uBACE,IAAA,CAAC,cAAA,EAAA,EAAgB,GAAG,SAAA,EACjB,QAAA,EAAA;AAAA,IAAA,QAAA,wBAAa,cAAA,EAAA,EAAgB,GAAI,OAAO,QAAA,KAAa,QAAA,GAAW,WAAW,MAAA,EAAY,CAAA;AAAA,IACvF,IAAA,CAAK,GAAA;AAAA,MAAI,CAAC,MAAM,CAAA,KACf,cAAA;AAAA,QACE,IAAA;AAAA,QACA,mBAAmB,CAAC,CAAA,CAAA;AAAA,QACpB,KAAK,OAAA,KAAY,CAAC,eAAA,IAAmB,CAAA,KAAM,KAAK,MAAA,GAAS,CAAA;AAAA;AAC3D;AACF,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,IAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,mBAAA,EAAqB;AAAA,EAC3D,IAAA,EAAM,cAAA;AAAA,EACN,IAAA,EAAM,cAAA;AAAA,EACN,IAAA,EAAM;AACR,CAAC","file":"index.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { House } from \"lucide-react\"\nimport type { ElementType, ReactElement, ReactNode } from \"react\"\nimport { Children, cloneElement, isValidElement } from \"react\"\nimport { type ForbidAsChild, withAsChildContent } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/** Figma's \"Radius/sm\" for this pill is 4px, which is this kit's `rounded-xs`\n * step, not `rounded-sm` — the two token scales don't line up at \"sm\". */\nconst listClasses = cn(\n \"m-0 inline-flex max-w-full list-none items-center gap-1 rounded-xs border border-brand-900/20 px-2 py-1\",\n \"font-mono text-sm leading-[18px] dark:border-white/15\",\n)\n\nconst linkItemClasses = \"text-gray-light-900 dark:text-gray-dark-25 hover:underline\"\n\n/** The current/last crumb isn't a link, so it's de-emphasized rather than\n * bolded — matches the source design, the inverse of some conventions. */\nconst currentItemClasses = \"text-gray-light-500 dark:text-gray-dark-400\"\n\n/** A text crumb's label ellipsizes once its `<li>` is squeezed. CSS never\n * ellipsizes the first character or atomic inline on a line — it clips it —\n * so a lone label letter would block a bare \"…\"; the empty inline-block\n * `::before` takes that exemption instead, letting the label elide entirely. */\nconst truncateClasses = \"block truncate before:inline-block before:content-['']\"\nconst linkTextClasses = cn(truncateClasses, linkItemClasses)\nconst currentTextClasses = cn(truncateClasses, currentItemClasses)\n\n/** Truncation is the flex algorithm's job, not JS's: crumbs may shrink down to\n * `1ch` — exactly the mono \"…\" glyph — and shrink weights order who gives way.\n * Links (1000) dwarf the current crumb (10), so ancestors elide first and the\n * page you're on stays readable longest. A hovered or keyboard-focused crumb\n * drops to 1, so its siblings give up their room first and it reopens to its\n * full label — still eliding rather than overflowing if even that isn't\n * enough, which `shrink-0` would do. No weight goes below 1: when the\n * unfrozen items' factors sum to less than 1, flexbox distributes only that\n * fraction of the overflow, and a lone hovered crumb would overflow anyway. */\nconst crumbClasses = \"min-w-[1ch] hover:shrink has-focus-visible:shrink\"\nconst linkCrumbClasses = cn(crumbClasses, \"shrink-1000\")\nconst currentCrumbClasses = cn(crumbClasses, \"shrink-10\")\n\nconst separatorClasses = \"shrink-0 select-none text-gray-light-900 dark:text-gray-dark-25\"\n\n/** A framework's own link component (e.g. Next.js's `Link`), substituted for\n * a plain `<a>` so navigation stays client-side. Must accept `href` —\n * routers whose Link takes `to` instead (React Router) need a two-line\n * local wrapper renaming the prop before it's passed here. */\nexport type BreadcrumbLinkComponent = ElementType\n\nexport type BreadcrumbRootProps = HTMLArkProps<\"nav\"> &\n WithTestId & {\n /** Rendered between crumbs, decorative (`aria-hidden`). @default \"/\" */\n separator?: ReactNode\n /** Default `linkComponent` for every `Breadcrumb.Item`/`Breadcrumb.Home`\n * child that doesn't set its own. */\n linkComponent?: BreadcrumbLinkComponent\n /** Styles the inner `<ol>` (the bordered pill); `className` targets the\n * outer `<nav>`. */\n classNames?: { list?: string }\n }\n\n/**\n * Breadcrumb — a trail of links showing the current page's place in a\n * hierarchy (home → … → current page). Pure React Server Component: no\n * state, no `\"use client\"`.\n *\n * The last crumb renders muted and non-interactive with `aria-current=\"page\"`\n * — it isn't a link, so it's deliberately de-emphasized rather than bolded.\n * Separators (\"/\") are generated automatically between crumbs; you never\n * place them yourself.\n *\n * The trail fits its container without any JS: when space runs out, link\n * crumbs ellipsize first (down to a bare \"…\"), then the current crumb. The\n * Home icon and separators never shrink. Hovering or focusing a crumb reveals\n * its full label.\n *\n * Two ways to use it:\n *\n * <Breadcrumb data={[{ label: \"Repo\", href: \"/repo\" }, { label: \"File\" }]} withHome />\n *\n * <Breadcrumb.Root>\n * <Breadcrumb.Home href=\"/\" />\n * <Breadcrumb.Item href=\"/repo\">Repo</Breadcrumb.Item>\n * <Breadcrumb.Item current>File</Breadcrumb.Item>\n * </Breadcrumb.Root>\n *\n * Pass `linkComponent` (here, or per-item) to route every generated crumb\n * through a framework's own `Link` instead of a plain `<a>`, so navigation\n * stays client-side:\n *\n * <Breadcrumb data={items} linkComponent={Link} />\n *\n * For one-off composition, `asChild` (inherited from Ark) still works on any\n * single `Breadcrumb.Item`/`Breadcrumb.Home` — it wins over `linkComponent`.\n *\n * There's no leading \"back\" button, even though every one of this\n * component's source designs pairs it with one — that's a router/history\n * action this kit has no opinion on. Compose your own next to `Breadcrumb`\n * with `ActionIcon` (see the docs).\n */\nfunction isCrumbElement(\n node: ReactNode,\n): node is ReactElement<{ linkComponent?: BreadcrumbLinkComponent }> {\n return isValidElement(node) && (node.type === BreadcrumbItem || node.type === BreadcrumbHome)\n}\n\nconst BreadcrumbRoot = ({\n className,\n classNames,\n separator = \"/\",\n linkComponent,\n children,\n testId,\n ...rest\n}: BreadcrumbRootProps) => {\n let content: ReactNode = children\n if (!rest.asChild) {\n const rendered: ReactNode[] = []\n let seenCrumb = false\n for (const child of Children.toArray(children)) {\n if (!isCrumbElement(child)) {\n rendered.push(child)\n continue\n }\n if (seenCrumb) {\n rendered.push(\n <li key={`separator-${rendered.length}`} aria-hidden=\"true\" className={separatorClasses}>\n {separator}\n </li>,\n )\n }\n rendered.push(\n cloneElement(child, { linkComponent: child.props.linkComponent ?? linkComponent }),\n )\n seenCrumb = true\n }\n content = <ol className={cn(listClasses, classNames?.list)}>{rendered}</ol>\n }\n\n return (\n <ark.nav\n aria-label=\"Breadcrumb\"\n className={cn(\"min-w-0\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {content}\n </ark.nav>\n )\n}\n\nexport type BreadcrumbItemProps = HTMLArkProps<\"a\"> &\n WithTestId & {\n /** Marks this as the current/last crumb: non-interactive, muted,\n * `aria-current=\"page\"`, no href/anchor. Figma's `state=\"Active\"`. */\n current?: boolean\n /** Overrides the `linkComponent` inherited from `Breadcrumb.Root`. */\n linkComponent?: BreadcrumbLinkComponent\n }\n\n/** One crumb — a link, or (with `current`) the non-interactive current page. */\nconst BreadcrumbItem = ({\n href,\n current,\n linkComponent: LinkComponent,\n asChild,\n className,\n children,\n testId,\n ...rest\n}: BreadcrumbItemProps) => {\n if (current) {\n return (\n <li className={currentCrumbClasses}>\n <ark.span\n aria-current=\"page\"\n className={cn(currentTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ark.span>\n </li>\n )\n }\n if (asChild) {\n return (\n <li className={linkCrumbClasses}>\n <ark.a\n asChild\n className={cn(linkTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ark.a>\n </li>\n )\n }\n if (LinkComponent) {\n return (\n <li className={linkCrumbClasses}>\n <LinkComponent\n href={href}\n className={cn(linkTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </LinkComponent>\n </li>\n )\n }\n return (\n <li className={linkCrumbClasses}>\n <ark.a\n href={href}\n className={cn(linkTextClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ark.a>\n </li>\n )\n}\n\nexport type BreadcrumbHomeProps = HTMLArkProps<\"a\"> &\n WithTestId & {\n /** Overrides the `linkComponent` inherited from `Breadcrumb.Root`. */\n linkComponent?: BreadcrumbLinkComponent\n }\n\n/** Icon-only leading crumb — always a link, never `current`. `children`\n * overrides the default house icon; `aria-label` defaults to \"Home\". */\nconst BreadcrumbHome = ({\n href,\n linkComponent: LinkComponent,\n asChild,\n className,\n children,\n \"aria-label\": ariaLabel = \"Home\",\n testId,\n ...rest\n}: BreadcrumbHomeProps) => {\n // Under `asChild`, `children` is the consumer's link, so the house goes\n // inside it whenever that link brings no content of its own.\n const icon = (own: ReactNode) => own ?? <House aria-hidden size={16} />\n if (asChild) {\n return (\n <li className=\"shrink-0\">\n <ark.a\n asChild\n aria-label={ariaLabel}\n className={cn(linkItemClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withAsChildContent(children, icon)}\n </ark.a>\n </li>\n )\n }\n if (LinkComponent) {\n return (\n <li className=\"shrink-0\">\n <LinkComponent\n href={href}\n aria-label={ariaLabel}\n className={cn(linkItemClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {icon(children)}\n </LinkComponent>\n </li>\n )\n }\n return (\n <li className=\"shrink-0\">\n <ark.a\n href={href}\n aria-label={ariaLabel}\n className={cn(linkItemClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {icon(children)}\n </ark.a>\n </li>\n )\n}\n\nexport type BreadcrumbDataItem = {\n label: ReactNode\n href?: string\n /** Explicit override; if no entry sets this, the last entry defaults to current. */\n current?: boolean\n linkComponent?: BreadcrumbLinkComponent\n /** `data-testid` on the rendered crumb. Defaults to `href` when set, else a\n * stable positional fallback (`` `breadcrumb-item-${i}` ``). */\n testId?: string\n}\n\nexport type BreadcrumbProps = Omit<BreadcrumbRootProps, \"children\" | \"asChild\"> &\n ForbidAsChild & {\n /** The crumbs to render, in order. */\n data: readonly BreadcrumbDataItem[]\n /** Renders a leading icon-only `Breadcrumb.Home`. `true` uses the default\n * house icon with no link; pass an object (with `href`) to link it. */\n withHome?: boolean | (BreadcrumbHomeProps & { href: string })\n }\n\n/** Renders one `data` entry to a `Breadcrumb.Item` — factored out so its\n * `key` (built from position) isn't a bare index inline in a `.map` JSX\n * callback. */\nconst renderDataItem = (item: BreadcrumbDataItem, key: string, current: boolean): ReactNode => (\n <BreadcrumbItem\n key={key}\n href={item.href}\n linkComponent={item.linkComponent}\n current={current}\n testId={item.testId ?? item.href ?? key}\n >\n {item.label}\n </BreadcrumbItem>\n)\n\nconst BreadcrumbComponent = ({\n data,\n withHome,\n asChild: _asChild,\n ...rootProps\n}: BreadcrumbProps) => {\n const explicitCurrent = data.some((item) => item.current !== undefined)\n\n return (\n <BreadcrumbRoot {...rootProps}>\n {withHome && <BreadcrumbHome {...(typeof withHome === \"object\" ? withHome : undefined)} />}\n {data.map((item, i) =>\n renderDataItem(\n item,\n `breadcrumb-item-${i}`,\n item.current ?? (!explicitCurrent && i === data.length - 1),\n ),\n )}\n </BreadcrumbRoot>\n )\n}\n\nexport const Breadcrumb = Object.assign(BreadcrumbComponent, {\n Root: BreadcrumbRoot,\n Home: BreadcrumbHome,\n Item: BreadcrumbItem,\n})\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HTMLArkProps } from "@ark-ui/react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
import {
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
4
|
import type { Color } from "../../lib/colors";
|
|
5
5
|
import type { WithTestId } from "../../lib/test-id";
|
|
6
6
|
/**
|
|
@@ -21,10 +21,10 @@ import type { WithTestId } from "../../lib/test-id";
|
|
|
21
21
|
* required.
|
|
22
22
|
*
|
|
23
23
|
* `asChild` (inherited from `HTMLArkProps`) renders the single child element
|
|
24
|
-
* with Button's styling merged in. Ark's factory
|
|
25
|
-
* only one element can survive the swap — `startSlot`/`endSlot` (and the
|
|
24
|
+
* with Button's styling merged in. Ark's factory clones exactly one element,
|
|
25
|
+
* so only one element can survive the swap — `startSlot`/`endSlot` (and the
|
|
26
26
|
* `loading` spinner, which replaces `startSlot`) are folded into *that*
|
|
27
|
-
* element's own children (
|
|
27
|
+
* element's own children (`withAsChildContent`, `lib/as-child.ts`) rather than
|
|
28
28
|
* rendered as siblings, so they keep showing up even when the child is a
|
|
29
29
|
* link. Common case: `<Button asChild startSlot={<Icon />}><a ...>Go</a></Button>`.
|
|
30
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,OAAO,CAAA;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,QAAA,MAAM,cAAc;;;8EA6CnB,CAAA;AAyBD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;AACvF,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAEjF,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,OAAO,cAAc,CAAC,GACnC,UAAU,GAAG;IACX,kEAAkE;IAClE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAuBH,eAAO,MAAM,MAAM,kIAehB,WAAW,gCAwCb,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import '../../chunk-ORTCK34Y.js';
|
|
3
|
-
export { Button } from '../../chunk-
|
|
3
|
+
export { Button } from '../../chunk-RAUOFTUH.js';
|
|
4
4
|
import '../../chunk-NSDM3FEB.js';
|
|
5
|
+
import '../../chunk-I4SQQIP5.js';
|
|
5
6
|
import '../../chunk-WYCMIIRR.js';
|
|
6
7
|
import '../../chunk-B2LCHXUB.js';
|
|
7
8
|
import '../../chunk-QP4I37PA.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Context, Item, MultiRoot, ButtonSelectControl } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
2
|
+
import { Context, Item, MultiRoot, ButtonSelectControl } from '../../chunk-MI2WZRK3.js';
|
|
3
|
+
import '../../chunk-FHG54IT5.js';
|
|
4
|
+
import '../../chunk-RAUOFTUH.js';
|
|
5
5
|
import '../../chunk-2SVX3MQQ.js';
|
|
6
6
|
import { useUncontrolled } from '../../chunk-BEL75C7N.js';
|
|
7
7
|
import '../../chunk-NSDM3FEB.js';
|
|
8
|
+
import '../../chunk-I4SQQIP5.js';
|
|
8
9
|
import '../../chunk-WYCMIIRR.js';
|
|
9
10
|
import '../../chunk-B2LCHXUB.js';
|
|
10
11
|
import '../../chunk-QP4I37PA.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/button-multi-select/button-multi-select.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button-multi-select/button-multi-select.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAmCA,IAAM,6BAA6B,CAAyD;AAAA,EAC1F,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAoC;AAClC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,eAAA,CAAwD;AAAA,IACtF,KAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAY,EAAC;AAAA,IACb,UAAU,CAAC,IAAA,KAAS,WAAW,CAAC,GAAG,IAAI,CAAC;AAAA,GACzC,CAAA;AAED,EAAA,uBACE,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAQ,IAAA;AAAA,MACR,KAAA,EAAO,QAAA;AAAA,MAGP,aAAA,EAAe,CAAC,IAAA,KAAS,WAAA,CAAY,IAAiC,CAAA;AAAA,MACtE,UAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ,CAAA;AAWO,IAAM,iBAAA,GAAoB,MAAA,CAAO,MAAA,CAAO,0BAAA,EAA4B;AAAA,EACzE,IAAA,EAAM,SAAA;AAAA,EACN,IAAA;AAAA,EACA;AACF,CAAC","file":"index.js","sourcesContent":["\"use client\"\n\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Context, Item, MultiRoot } from \"../button-select/button-select\"\nimport {\n type ButtonSelectBaseProps,\n ButtonSelectControl,\n} from \"../button-select/button-select-control\"\nimport type {\n ButtonSelectData,\n ButtonSelectValue,\n RenderButtonSelectItem,\n} from \"../button-select/button-select-items\"\n\n/**\n * ButtonMultiSelect — `ButtonSelect`'s multiple-choice twin: a row of joined\n * `Button`s where each item toggles independently. The selected items take\n * `selectedVariant` (default `filled`), the rest `variant` (default `light`).\n * Text formatting toggles, weekday pickers, filter rows.\n *\n * - Same `data` items as `ButtonSelect`; `value` is an array of the data's\n * literal values, in selection order.\n * - The group is a `role=\"group\"` of toggle buttons carrying `aria-pressed`.\n * - `name` submits one hidden input per selected value.\n */\nexport type ButtonMultiSelectProps<Data extends ButtonSelectData = ButtonSelectData> =\n ButtonSelectBaseProps<Data> & {\n /** Controlled value. */\n value?: ReadonlyArray<ButtonSelectValue<Data>>\n /** Uncontrolled initial value. */\n defaultValue?: ReadonlyArray<ButtonSelectValue<Data>>\n /** Fires with every selected value. */\n onChange?: (value: ButtonSelectValue<Data>[]) => void\n }\n\nconst ButtonMultiSelectComponent = <const Data extends ButtonSelectData = ButtonSelectData>({\n value,\n defaultValue,\n onChange,\n renderItem,\n ...rest\n}: ButtonMultiSelectProps<Data>) => {\n const [selected, setSelected] = useUncontrolled<ReadonlyArray<ButtonSelectValue<Data>>>({\n value,\n defaultValue,\n finalValue: [],\n onChange: (next) => onChange?.([...next]),\n })\n\n return (\n <ButtonSelectControl\n multiple\n value={selected}\n // The machine's values are `string`s that always originate from `data`,\n // so they narrow back to the caller's union.\n onValueChange={(next) => setSelected(next as ButtonSelectValue<Data>[])}\n renderItem={renderItem as RenderButtonSelectItem<ButtonSelectData> | undefined}\n {...rest}\n />\n )\n}\n\n/**\n * The public `ButtonMultiSelect` — the data-driven form, with the composable\n * parts attached:\n *\n * <ButtonMultiSelect.Root aria-label=\"Formatting\" defaultValue={[\"bold\"]}>\n * <ButtonMultiSelect.Item value=\"bold\" aria-label=\"Bold\"><BoldIcon /></ButtonMultiSelect.Item>\n * <ButtonMultiSelect.Item value=\"italic\" aria-label=\"Italic\"><ItalicIcon /></ButtonMultiSelect.Item>\n * </ButtonMultiSelect.Root>\n */\nexport const ButtonMultiSelect = Object.assign(ButtonMultiSelectComponent, {\n Root: MultiRoot,\n Item,\n Context,\n})\n"]}
|