@42-central/ui-react 0.17.0 → 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/README.md +36 -175
- 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-ACE7FBWE.js → chunk-EBREIC3L.js} +5 -4
- 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-PJL4ZL5V.js → chunk-O23Y5ML4.js} +8 -8
- package/dist/{chunk-PJL4ZL5V.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-TMMEJKLI.js → chunk-UHNRAI6V.js} +17 -4
- package/dist/chunk-UHNRAI6V.js.map +1 -0
- 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 +18 -10
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +17 -5
- 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/calendar-body.d.ts.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/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +8 -7
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +7 -6
- 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 +4 -4
- package/dist/components/schedule/index.js +211 -110
- 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-create-draft.d.ts +3 -2
- package/dist/components/schedule/schedule-create-draft.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-drag-ghost.d.ts +12 -5
- package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-geometry.d.ts +16 -0
- package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
- package/dist/components/schedule/schedule-grid-gesture.d.ts +29 -6
- package/dist/components/schedule/schedule-grid-gesture.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-timed-grid.d.ts.map +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts +3 -3
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +9 -4
- 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/schedule/use-event-create.d.ts.map +1 -1
- package/dist/components/schedule/use-event-drag.d.ts.map +1 -1
- package/dist/components/schedule/use-event-resize.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/dist/theme.css +9 -3
- 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 +25 -2
- package/src/components/alert/alert.tsx +39 -13
- 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/calendar/calendar-body.tsx +8 -1
- 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/create-notifier.tsx +6 -5
- package/src/components/notification/notification.test.tsx +15 -0
- package/src/components/notification/notification.tsx +8 -5
- 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/now-cursor-line.tsx +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 +46 -31
- package/src/components/schedule/schedule-all-day-row.tsx +1 -1
- package/src/components/schedule/schedule-create-draft.tsx +14 -5
- package/src/components/schedule/schedule-dates.test.ts +37 -52
- package/src/components/schedule/schedule-dates.ts +25 -27
- package/src/components/schedule/schedule-days-view.tsx +9 -5
- package/src/components/schedule/schedule-drag-ghost.tsx +27 -12
- package/src/components/schedule/schedule-event-chip.tsx +9 -2
- package/src/components/schedule/schedule-event-list-popover-content.tsx +1 -1
- package/src/components/schedule/schedule-geometry.ts +21 -0
- package/src/components/schedule/schedule-grid-gesture.test.ts +83 -1
- package/src/components/schedule/schedule-grid-gesture.ts +67 -28
- package/src/components/schedule/schedule-month-view.tsx +10 -6
- package/src/components/schedule/schedule-next-up.tsx +11 -5
- package/src/components/schedule/schedule-timed-grid.tsx +41 -3
- package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
- package/src/components/schedule/schedule-toolbar.tsx +35 -17
- package/src/components/schedule/schedule-types.ts +9 -4
- package/src/components/schedule/schedule-views.ts +4 -5
- package/src/components/schedule/schedule-year-view.tsx +10 -6
- package/src/components/schedule/schedule.test.tsx +198 -36
- package/src/components/schedule/schedule.tsx +28 -17
- package/src/components/schedule/use-event-create.ts +7 -6
- package/src/components/schedule/use-event-drag.ts +10 -4
- package/src/components/schedule/use-event-resize.ts +4 -2
- 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/src/theme.css +9 -3
- 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-ACE7FBWE.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-TMMEJKLI.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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { UnavailableProps } from "./available-if";
|
|
3
|
+
/**
|
|
4
|
+
* The two sanctioned ways for a kit part to meet Ark's `asChild`.
|
|
5
|
+
*
|
|
6
|
+
* Ark's factory clones **exactly one** valid element under `asChild` and
|
|
7
|
+
* renders `null` otherwise (`isValidElement(children) ? clone : null`). So a
|
|
8
|
+
* part that renders anything besides a bare `{children}` — an icon, a
|
|
9
|
+
* section, an indicator, a default fallback — breaks in one of two ways:
|
|
10
|
+
*
|
|
11
|
+
* - **It renders nothing.** Two or more JSX child expressions become an
|
|
12
|
+
* array, even when some of them evaluate to `false`
|
|
13
|
+
* (`{start && <Start/>}{children}{end && <End/>}`), and an array is not an
|
|
14
|
+
* element.
|
|
15
|
+
* - **Its own content is lost or misplaced.** Under `asChild`, `children`
|
|
16
|
+
* *is* the consumer's element, so `children ?? <DefaultIcon/>` never
|
|
17
|
+
* reaches the fallback, and a wrapper (`<Provider>{children}</Provider>`)
|
|
18
|
+
* is what gets cloned instead of the consumer's element.
|
|
19
|
+
*
|
|
20
|
+
* Every such part must pick one of these:
|
|
21
|
+
*
|
|
22
|
+
* - **`withAsChildContent`** — the part can sensibly *become* the consumer's
|
|
23
|
+
* element (a menu item rendered as a router `<Link>`, a crumb, an alert
|
|
24
|
+
* that links somewhere). The kit's content is folded into the child's own
|
|
25
|
+
* children, so Ark still receives a single element.
|
|
26
|
+
* - **`NoAsChild`** — the part renders structure that cannot live inside an
|
|
27
|
+
* arbitrary element (a slider's track and thumbs, a scheduler grid). The
|
|
28
|
+
* prop becomes a compile error that says why.
|
|
29
|
+
*
|
|
30
|
+
* `as-child.contract.test.tsx` enforces the choice: it derives every public
|
|
31
|
+
* part that accepts `asChild` from the component entries, renders each one
|
|
32
|
+
* with an `<a>` child, and fails the typecheck when a part is in neither its
|
|
33
|
+
* render table nor `NoAsChild`.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Rebuilds the single `asChild` child's own children through `render`, so
|
|
37
|
+
* kit content (sections, icons, spinners) lands *inside* the element Ark
|
|
38
|
+
* clones instead of beside it. `extra` is merged onto the child too, for the
|
|
39
|
+
* odd prop the kit has to own (a click guard while loading).
|
|
40
|
+
*
|
|
41
|
+
* A child that isn't a single element falls through unchanged, leaving
|
|
42
|
+
* Ark's own handling of the misuse as it is.
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <ArkMenu.Item asChild {...rest}>
|
|
46
|
+
* {withAsChildContent(children, (own) => (
|
|
47
|
+
* <>
|
|
48
|
+
* <StartSection>{startSection}</StartSection>
|
|
49
|
+
* {own}
|
|
50
|
+
* </>
|
|
51
|
+
* ))}
|
|
52
|
+
* </ArkMenu.Item>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare const withAsChildContent: (child: ReactNode, render: (own: ReactNode) => ReactNode, extra?: Record<string, unknown>) => ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* The usual call site: `render` wraps the part's `children` with its own
|
|
58
|
+
* content either way, around `children` normally and inside the consumer's
|
|
59
|
+
* element under `asChild`. One `render` serves both branches, so the two
|
|
60
|
+
* can't drift apart.
|
|
61
|
+
*
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <ArkMenu.Item asChild={asChild} {...rest}>
|
|
64
|
+
* {composeChildren(asChild, children, (own) => <>{icon}{own}</>)}
|
|
65
|
+
* </ArkMenu.Item>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const composeChildren: (asChild: boolean | undefined, children: ReactNode, render: (own: ReactNode) => ReactNode) => ReactNode;
|
|
69
|
+
/** The sentence a caller reads when passing `asChild` to a `NoAsChild` part. */
|
|
70
|
+
export type NoAsChildReason = "renders its own structure around its children, so asChild is not supported";
|
|
71
|
+
/**
|
|
72
|
+
* The forbid shape on its own: `asChild` typed as a branded `Unavailable`.
|
|
73
|
+
* Intersect it beside a props type (`Omit<RootProps, "children"> &
|
|
74
|
+
* ForbidAsChild & { data }`); `NoAsChild<P>` is the same thing as a wrapper.
|
|
75
|
+
*
|
|
76
|
+
* Uses the brand rather than omitting the key, because omission is silent
|
|
77
|
+
* on a JSX spread (`<Slider {...props} />`), which is exactly how prop bags
|
|
78
|
+
* get forwarded. Either way the error names the reason:
|
|
79
|
+
*
|
|
80
|
+
* Type 'boolean' is not assignable to type 'Unavailable<"renders its own
|
|
81
|
+
* structure around its children, so asChild is not supported">'
|
|
82
|
+
*/
|
|
83
|
+
export type ForbidAsChild = UnavailableProps<{
|
|
84
|
+
asChild?: boolean;
|
|
85
|
+
}, NoAsChildReason>;
|
|
86
|
+
/**
|
|
87
|
+
* `P` with `asChild` forbidden: `P & ForbidAsChild`, so `asChild` resolves
|
|
88
|
+
* to `(boolean & Unavailable<…>) | undefined`, which nothing but `undefined`
|
|
89
|
+
* satisfies.
|
|
90
|
+
*
|
|
91
|
+
* An intersection, not `Omit<P, "asChild"> & …`. `Omit` re-maps every key of
|
|
92
|
+
* a large HTML/Ark props type, and measured on the forbidden parts that cost
|
|
93
|
+
* each importing file about 38k extra type instantiations (+8.6%); the
|
|
94
|
+
* intersection costs nothing measurable. It also leaves a union in `P` (a
|
|
95
|
+
* discriminated `type` / `color` pair, a slot-size union) and any generic
|
|
96
|
+
* untouched, where `Omit` would flatten the one and hide the other from
|
|
97
|
+
* inference.
|
|
98
|
+
*
|
|
99
|
+
* The component destructures `asChild` out before spreading the rest onto
|
|
100
|
+
* its Ark part (`({ asChild: _asChild, ...rest })`), so a JS caller that
|
|
101
|
+
* passes it anyway gets the normal render rather than Ark's `null`.
|
|
102
|
+
*/
|
|
103
|
+
export type NoAsChild<P> = P & ForbidAsChild;
|
|
104
|
+
//# sourceMappingURL=as-child.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"as-child.d.ts","sourceRoot":"","sources":["../../src/lib/as-child.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,UACtB,SAAS,UACR,CAAC,GAAG,EAAE,SAAS,KAAK,SAAS,UAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,SAGF,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,YACjB,OAAO,GAAG,SAAS,YAClB,SAAS,UACX,CAAC,GAAG,EAAE,SAAS,KAAK,SAAS,KACpC,SAAgF,CAAA;AAEnF,gFAAgF;AAChF,MAAM,MAAM,eAAe,GACzB,4EAA4E,CAAA;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,eAAe,CAAC,CAAA;AAEpF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA"}
|
package/dist/theme.css
CHANGED
|
@@ -525,10 +525,16 @@ body {
|
|
|
525
525
|
px length rather than a percentage on purpose: the band is made of elements
|
|
526
526
|
of *different* widths (an all-day bar can span several columns), and a
|
|
527
527
|
percentage would resolve against each element's own box, so the wide ones
|
|
528
|
-
would overshoot. One measured length moves every piece in lockstep.
|
|
528
|
+
would overshoot. One measured length moves every piece in lockstep.
|
|
529
|
+
|
|
530
|
+
The sign in those lengths is logical: positive means "toward later days".
|
|
531
|
+
`--sch-inline-dir` turns it into a physical direction. The grid sets it to
|
|
532
|
+
`-1` under `rtl:`, where later days sit to the left, so "next" enters from
|
|
533
|
+
the left there. The JS that measures the band never needs to know the
|
|
534
|
+
direction. */
|
|
529
535
|
@keyframes schedule-page-enter {
|
|
530
536
|
from {
|
|
531
|
-
transform: translateX(var(--sch-page-from, 0px));
|
|
537
|
+
transform: translateX(calc(var(--sch-page-from, 0px) * var(--sch-inline-dir, 1)));
|
|
532
538
|
}
|
|
533
539
|
to {
|
|
534
540
|
transform: none;
|
|
@@ -539,7 +545,7 @@ body {
|
|
|
539
545
|
transform: none;
|
|
540
546
|
}
|
|
541
547
|
to {
|
|
542
|
-
transform: translateX(var(--sch-page-to, 0px));
|
|
548
|
+
transform: translateX(calc(var(--sch-page-to, 0px) * var(--sch-inline-dir, 1)));
|
|
543
549
|
}
|
|
544
550
|
}
|
|
545
551
|
|