@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
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
useRef,
|
|
16
16
|
useState,
|
|
17
17
|
} from "react"
|
|
18
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
18
19
|
import { cn } from "../../lib/cn"
|
|
19
20
|
import type { Color } from "../../lib/colors"
|
|
20
21
|
import { props } from "../../lib/props"
|
|
@@ -283,7 +284,7 @@ type PillsInputClassNames = {
|
|
|
283
284
|
endSlot?: string
|
|
284
285
|
}
|
|
285
286
|
|
|
286
|
-
export type PillsInputProps = Omit<HTMLArkProps<"div">, "color"
|
|
287
|
+
export type PillsInputProps = NoAsChild<Omit<HTMLArkProps<"div">, "color">> &
|
|
287
288
|
WithTestId & {
|
|
288
289
|
size?: InputSize
|
|
289
290
|
variant?: InputVariant
|
|
@@ -323,6 +324,7 @@ const PillsInputBase = ({
|
|
|
323
324
|
classNames,
|
|
324
325
|
children,
|
|
325
326
|
testId,
|
|
327
|
+
asChild: _asChild,
|
|
326
328
|
...rest
|
|
327
329
|
}: PillsInputProps) => {
|
|
328
330
|
// Convention: pills first, the field last. Only the pills feed the line cap;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useRef,
|
|
14
14
|
useState,
|
|
15
15
|
} from "react"
|
|
16
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
16
17
|
import type { UnavailableProps } from "../../lib/available-if"
|
|
17
18
|
import { cn } from "../../lib/cn"
|
|
18
19
|
import { useOverlayContainer } from "../../lib/overlay-container"
|
|
@@ -534,7 +535,7 @@ const Trigger = ({
|
|
|
534
535
|
)
|
|
535
536
|
}
|
|
536
537
|
|
|
537
|
-
export type PopoverContentProps = ArkPopover.ContentProps & WithTestId
|
|
538
|
+
export type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> & WithTestId
|
|
538
539
|
|
|
539
540
|
const Content = ({
|
|
540
541
|
className,
|
|
@@ -544,6 +545,7 @@ const Content = ({
|
|
|
544
545
|
onPointerLeave,
|
|
545
546
|
onPointerDown,
|
|
546
547
|
onFocus,
|
|
548
|
+
asChild: _asChild,
|
|
547
549
|
...rest
|
|
548
550
|
}: PopoverContentProps) => {
|
|
549
551
|
const { width, withinPortal, container, layers, hover } = useContext(PopoverContext)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Progress as Ark } from "@ark-ui/react/progress"
|
|
2
2
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
3
|
import type { ComponentPropsWithoutRef, CSSProperties, Ref } from "react"
|
|
4
|
+
import type { ForbidAsChild } from "../../lib/as-child"
|
|
4
5
|
import { cn } from "../../lib/cn"
|
|
5
6
|
import type { Color } from "../../lib/colors"
|
|
6
7
|
import {
|
|
@@ -89,8 +90,9 @@ type ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>
|
|
|
89
90
|
|
|
90
91
|
export type ProgressProps = Omit<
|
|
91
92
|
ArkRootProps,
|
|
92
|
-
"value" | "defaultValue" | "onValueChange" | "ref" | "className"
|
|
93
|
+
"value" | "defaultValue" | "onValueChange" | "ref" | "className" | "asChild"
|
|
93
94
|
> &
|
|
95
|
+
ForbidAsChild &
|
|
94
96
|
VariantProps<typeof progressRange> &
|
|
95
97
|
WithTestId & {
|
|
96
98
|
/**
|
|
@@ -134,6 +136,7 @@ export const Progress = ({
|
|
|
134
136
|
classNames,
|
|
135
137
|
style,
|
|
136
138
|
testId,
|
|
139
|
+
asChild: _asChild,
|
|
137
140
|
...rest
|
|
138
141
|
}: ProgressProps) => {
|
|
139
142
|
const isGradient = variant === "gradient"
|
|
@@ -2,6 +2,7 @@ import { useFieldContext } from "@ark-ui/react/field"
|
|
|
2
2
|
import { RatingGroup as Ark } from "@ark-ui/react/rating-group"
|
|
3
3
|
import { cva } from "class-variance-authority"
|
|
4
4
|
import type { ComponentPropsWithoutRef, CSSProperties, FocusEvent, ReactNode, Ref } from "react"
|
|
5
|
+
import type { ForbidAsChild } from "../../lib/as-child"
|
|
5
6
|
import { cn } from "../../lib/cn"
|
|
6
7
|
import type { Color } from "../../lib/colors"
|
|
7
8
|
import { focusStyles } from "../../lib/focus-styles"
|
|
@@ -124,29 +125,31 @@ export type RatingClassNames = {
|
|
|
124
125
|
symbol?: string
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
export type RatingProps =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
128
|
+
export type RatingProps = ForbidAsChild &
|
|
129
|
+
Omit<
|
|
130
|
+
ArkRootProps,
|
|
131
|
+
| "asChild"
|
|
132
|
+
| "count"
|
|
133
|
+
| "value"
|
|
134
|
+
| "defaultValue"
|
|
135
|
+
| "onValueChange"
|
|
136
|
+
| "readOnly"
|
|
137
|
+
| "disabled"
|
|
138
|
+
| "allowHalf"
|
|
139
|
+
| "name"
|
|
140
|
+
| "form"
|
|
141
|
+
| "translations"
|
|
142
|
+
| "onBlur"
|
|
143
|
+
| "ref"
|
|
144
|
+
| "className"
|
|
145
|
+
| "children"
|
|
146
|
+
// Ark's polymorphic `HTMLProps<'div'>` pulls in the full (deprecated)
|
|
147
|
+
// `AllHTMLAttributes` set for `as` support, including a plain `color:
|
|
148
|
+
// string` — without omitting it, our richer `Color |
|
|
149
|
+
// ((index: number) => Color)` type below intersects with that `string`
|
|
150
|
+
// instead of replacing it.
|
|
151
|
+
| "color"
|
|
152
|
+
> &
|
|
150
153
|
WithTestId & {
|
|
151
154
|
/** Total number of symbols in the group. */
|
|
152
155
|
count?: number
|
|
@@ -329,6 +332,7 @@ export const Rating = ({
|
|
|
329
332
|
className,
|
|
330
333
|
classNames,
|
|
331
334
|
testId,
|
|
335
|
+
asChild: _asChild,
|
|
332
336
|
...rest
|
|
333
337
|
}: RatingProps) => {
|
|
334
338
|
const resolvedTranslations = resolveRatingTranslations(translations)
|
|
@@ -152,7 +152,7 @@ import { YearView as _YearView } from "./schedule-year-view"
|
|
|
152
152
|
* namespace later without a breaking change. `DayView`/`WeekView` are thin
|
|
153
153
|
* preconfigured `DaysView` wrappers (RFC §17a), not independent
|
|
154
154
|
* implementations — reinstated for convenience after the `DaysView` merge.
|
|
155
|
-
* `AgendaView` is the
|
|
155
|
+
* `AgendaView` is the date-anchored agenda and *is* toolbar-switchable —
|
|
156
156
|
* put `"agenda"` in `views` to give it a tab. `NextUp` renders the same list
|
|
157
157
|
* (`schedule-agenda-list.tsx`) over an unbounded from-now window, with no
|
|
158
158
|
* chrome and no selection, and is deliberately still not a switcher entry:
|
|
@@ -112,7 +112,7 @@ export function NowCursorLine({
|
|
|
112
112
|
{variant === "marker" && !hideDot ? (
|
|
113
113
|
<div
|
|
114
114
|
data-schedule-part="now-indicator-dot"
|
|
115
|
-
className="absolute top-0 inset-s-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-(--sch-now-line-color)"
|
|
115
|
+
className="absolute top-0 inset-s-0 size-2 -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 rounded-full bg-(--sch-now-line-color)"
|
|
116
116
|
/>
|
|
117
117
|
) : null}
|
|
118
118
|
</div>
|
|
@@ -25,16 +25,15 @@ import { chipSelection } from "./use-schedule-selection"
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* The agenda list itself — day groups, `HH:MM` slots, event rows — shared
|
|
28
|
-
* verbatim by `AgendaView` (a
|
|
28
|
+
* verbatim by `AgendaView` (a span of days from its date) and `Schedule.NextUp`
|
|
29
29
|
* (everything from now on). The two differ only in *which* events they
|
|
30
30
|
* gather; once grouped, there is exactly one rendering, which is why this
|
|
31
31
|
* takes `groups` already built and never decides what is in range itself.
|
|
32
32
|
*
|
|
33
|
-
* It renders no root element, deliberately. `Schedule.NextUp`
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* them.
|
|
33
|
+
* It renders no root element, deliberately. `Schedule.NextUp` renders its
|
|
34
|
+
* own `<ark.section>` (with the section's props, `asChild` excluded) and
|
|
35
|
+
* `AgendaView` supplies its own `<ark.div>` plus a toolbar. A shared root
|
|
36
|
+
* here would double-wrap one of them.
|
|
38
37
|
*/
|
|
39
38
|
|
|
40
39
|
/** The only signal a custom row renderer can't trivially recompute from
|
|
@@ -42,7 +41,7 @@ import { chipSelection } from "./use-schedule-selection"
|
|
|
42
41
|
* (tie-broken to the first event of the first same-start stack).
|
|
43
42
|
*
|
|
44
43
|
* Only ever `true` under `Schedule.NextUp`. "Soonest still to come" is a
|
|
45
|
-
* from-now idea; in a
|
|
44
|
+
* from-now idea; in a window anchored on last March there is no such
|
|
46
45
|
* event, so `AgendaView` passes no `nextEventId` and every row gets `false`. */
|
|
47
46
|
export type AgendaEventRenderState = { isNext: boolean }
|
|
48
47
|
|
|
@@ -4,8 +4,7 @@ import { AgendaView } from "./schedule-agenda-view"
|
|
|
4
4
|
import type { ScheduleEvent, ScheduleStaticEvent } from "./schedule-types"
|
|
5
5
|
|
|
6
6
|
const day = (y: number, m: number, d: number, h = 0, min = 0) => new Date(Date.UTC(y, m, d, h, min))
|
|
7
|
-
/** Tue 15 Sep 2026, noon UTC —
|
|
8
|
-
* window is 1 Sep .. 1 Oct and "today" is the 15th. */
|
|
7
|
+
/** Tue 15 Sep 2026, noon UTC — "today" for every case below. */
|
|
9
8
|
const NOW = day(2026, 8, 15, 12)
|
|
10
9
|
|
|
11
10
|
const event = (id: string, start: Date, end: Date, rest: Partial<ScheduleEvent> = {}) =>
|
|
@@ -36,21 +35,38 @@ const controls = () =>
|
|
|
36
35
|
)
|
|
37
36
|
const rowTitles = () => rows().map((el) => el.querySelector("p")?.textContent)
|
|
38
37
|
|
|
38
|
+
/** Anchored on Tue 1 Sep and spanning 30 days, so the window is 1 Sep ..
|
|
39
|
+
* 1 Oct and every row-level case below has a whole month of room. The
|
|
40
|
+
* window's own cases override both. */
|
|
39
41
|
const renderView = (props: Partial<React.ComponentProps<typeof AgendaView>> = {}) =>
|
|
40
42
|
render(
|
|
41
|
-
<AgendaView
|
|
43
|
+
<AgendaView
|
|
44
|
+
data={[]}
|
|
45
|
+
now={NOW}
|
|
46
|
+
defaultDate={day(2026, 8, 1)}
|
|
47
|
+
visibleDays={30}
|
|
48
|
+
timeZone="UTC"
|
|
49
|
+
locale="en-GB"
|
|
50
|
+
testId="agenda"
|
|
51
|
+
{...props}
|
|
52
|
+
/>,
|
|
42
53
|
)
|
|
43
54
|
|
|
44
|
-
describe("AgendaView — the
|
|
45
|
-
|
|
55
|
+
describe("AgendaView — the window", () => {
|
|
56
|
+
/** The whole point: a list is read from its top, so it opens on the
|
|
57
|
+
* anchor's own day — not on the 1st of the month, with today buried. */
|
|
58
|
+
it("starts at the anchor date and spans visibleDays", () => {
|
|
46
59
|
renderView({
|
|
60
|
+
defaultDate: undefined,
|
|
61
|
+
visibleDays: undefined,
|
|
47
62
|
data: [
|
|
48
|
-
event("
|
|
49
|
-
event("
|
|
50
|
-
event("
|
|
63
|
+
event("yesterday", day(2026, 8, 14, 9), day(2026, 8, 14, 10)),
|
|
64
|
+
event("this-morning", day(2026, 8, 15, 8), day(2026, 8, 15, 9)),
|
|
65
|
+
event("in-six-days", day(2026, 8, 21, 9), day(2026, 8, 21, 10)),
|
|
66
|
+
event("in-a-week", day(2026, 8, 22, 9), day(2026, 8, 22, 10)),
|
|
51
67
|
],
|
|
52
68
|
})
|
|
53
|
-
expect(rowTitles()).toEqual(["
|
|
69
|
+
expect(rowTitles()).toEqual(["this-morning", "in-six-days"])
|
|
54
70
|
})
|
|
55
71
|
|
|
56
72
|
it("lists staticEvents alongside data", () => {
|
|
@@ -71,7 +87,7 @@ describe("AgendaView — the month window", () => {
|
|
|
71
87
|
/** Listed once, under its own real start date — clamping it into the window
|
|
72
88
|
* would invent a start the event doesn't have, and disagree with the range
|
|
73
89
|
* its own details popover prints. */
|
|
74
|
-
it("lists a multi-day event straddling the
|
|
90
|
+
it("lists a multi-day event straddling the window start exactly once", () => {
|
|
75
91
|
renderView({ data: [event("conference", day(2026, 7, 28), day(2026, 8, 2))] })
|
|
76
92
|
expect(rowTitles()).toEqual(["conference"])
|
|
77
93
|
})
|
|
@@ -81,7 +97,7 @@ describe("AgendaView — the month window", () => {
|
|
|
81
97
|
expect(list().getByText("today")).toBeTruthy()
|
|
82
98
|
})
|
|
83
99
|
|
|
84
|
-
it("shows the empty state for a
|
|
100
|
+
it("shows the empty state for a window with nothing in it", () => {
|
|
85
101
|
renderView({ data: [event("october", day(2026, 9, 1, 9), day(2026, 9, 1, 10))] })
|
|
86
102
|
expect(list().getByText("No events")).toBeTruthy()
|
|
87
103
|
expect(rows()).toHaveLength(0)
|
|
@@ -94,22 +110,55 @@ describe("AgendaView — the month window", () => {
|
|
|
94
110
|
})
|
|
95
111
|
|
|
96
112
|
describe("AgendaView — pagination", () => {
|
|
97
|
-
it("steps
|
|
113
|
+
it("steps by visibleDays per Prev/Next press", () => {
|
|
98
114
|
renderView({
|
|
115
|
+
defaultDate: day(2026, 8, 15),
|
|
116
|
+
visibleDays: 7,
|
|
99
117
|
data: [
|
|
100
|
-
event("
|
|
101
|
-
event("
|
|
102
|
-
event("
|
|
118
|
+
event("previous-week", day(2026, 8, 10, 9), day(2026, 8, 10, 10)),
|
|
119
|
+
event("this-week", day(2026, 8, 17, 9), day(2026, 8, 17, 10)),
|
|
120
|
+
event("next-week", day(2026, 8, 24, 9), day(2026, 8, 24, 10)),
|
|
103
121
|
],
|
|
104
122
|
})
|
|
105
|
-
expect(rowTitles()).toEqual(["
|
|
123
|
+
expect(rowTitles()).toEqual(["this-week"])
|
|
106
124
|
|
|
107
125
|
fireEvent.click(screen.getByRole("button", { name: "Next" }))
|
|
108
|
-
expect(rowTitles()).toEqual(["
|
|
126
|
+
expect(rowTitles()).toEqual(["next-week"])
|
|
109
127
|
|
|
110
128
|
fireEvent.click(screen.getByRole("button", { name: "Previous" }))
|
|
111
129
|
fireEvent.click(screen.getByRole("button", { name: "Previous" }))
|
|
112
|
-
expect(rowTitles()).toEqual(["
|
|
130
|
+
expect(rowTitles()).toEqual(["previous-week"])
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
/** A new window is a new list: the reader starts at its top, not at
|
|
134
|
+
* whatever offset they had scrolled to in the previous one. */
|
|
135
|
+
it("scrolls the list back to the top when the window moves", () => {
|
|
136
|
+
const scrollTo = vi.fn()
|
|
137
|
+
const original = HTMLElement.prototype.scrollTo
|
|
138
|
+
HTMLElement.prototype.scrollTo = scrollTo
|
|
139
|
+
try {
|
|
140
|
+
renderView()
|
|
141
|
+
scrollTo.mockClear()
|
|
142
|
+
fireEvent.click(screen.getByRole("button", { name: "Next" }))
|
|
143
|
+
expect(scrollTo).toHaveBeenCalledWith({ top: 0 })
|
|
144
|
+
} finally {
|
|
145
|
+
HTMLElement.prototype.scrollTo = original
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it("puts today first after Now, from any window", () => {
|
|
150
|
+
renderView({
|
|
151
|
+
defaultDate: day(2026, 5, 1),
|
|
152
|
+
visibleDays: 7,
|
|
153
|
+
withNowButton: true,
|
|
154
|
+
data: [
|
|
155
|
+
event("earlier-this-month", day(2026, 8, 2, 9), day(2026, 8, 2, 10)),
|
|
156
|
+
event("today", day(2026, 8, 15, 14), day(2026, 8, 15, 15)),
|
|
157
|
+
],
|
|
158
|
+
})
|
|
159
|
+
expect(rows()).toHaveLength(0)
|
|
160
|
+
fireEvent.click(screen.getByRole("button", { name: "Now" }))
|
|
161
|
+
expect(rowTitles()).toEqual(["today"])
|
|
113
162
|
})
|
|
114
163
|
|
|
115
164
|
it("renders no chrome under withPagination={false}", () => {
|
|
@@ -220,30 +269,58 @@ describe("AgendaView — a description is not inside the control", () => {
|
|
|
220
269
|
})
|
|
221
270
|
|
|
222
271
|
describe("AgendaView — event details popover", () => {
|
|
223
|
-
|
|
272
|
+
/** A row already prints title, time and description, so a click selects it
|
|
273
|
+
* and nothing more — a popover would only repeat them. */
|
|
274
|
+
it("opens no popover by default", () => {
|
|
224
275
|
renderView({
|
|
225
276
|
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
226
277
|
selected: "standup",
|
|
227
278
|
})
|
|
228
279
|
const control = controls()[0]
|
|
229
|
-
expect(control?.getAttribute("aria-haspopup")).
|
|
230
|
-
|
|
280
|
+
expect(control?.getAttribute("aria-haspopup")).toBeNull()
|
|
281
|
+
fireEvent.click(control as HTMLElement)
|
|
282
|
+
expect(screen.queryByRole("dialog")).toBeNull()
|
|
231
283
|
})
|
|
232
284
|
|
|
233
|
-
it("
|
|
234
|
-
|
|
285
|
+
it("still selects the row on click", () => {
|
|
286
|
+
const onSelect = vi.fn()
|
|
287
|
+
renderView({
|
|
288
|
+
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
289
|
+
onSelect,
|
|
290
|
+
})
|
|
235
291
|
fireEvent.click(controls()[0] as HTMLElement)
|
|
236
|
-
|
|
237
|
-
expect(
|
|
292
|
+
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "standup" }))
|
|
293
|
+
expect(rows()[0]?.dataset["selected"]).toBeDefined()
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
it("opens the built-in popover for the selected row under withEventDetails", () => {
|
|
297
|
+
renderView({
|
|
298
|
+
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
299
|
+
selected: "standup",
|
|
300
|
+
withEventDetails: true,
|
|
301
|
+
})
|
|
302
|
+
const control = controls()[0]
|
|
303
|
+
expect(control?.getAttribute("aria-haspopup")).toBe("dialog")
|
|
304
|
+
expect(control?.getAttribute("aria-expanded")).toBe("true")
|
|
238
305
|
})
|
|
239
306
|
|
|
240
|
-
it("
|
|
307
|
+
it("opts back in when renderEventDetails is passed alone", () => {
|
|
241
308
|
renderView({
|
|
242
309
|
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
243
310
|
selected: "standup",
|
|
244
|
-
|
|
311
|
+
renderEventDetails: (e) => <span>Details for {e.title}</span>,
|
|
312
|
+
})
|
|
313
|
+
expect(controls()[0]?.getAttribute("aria-haspopup")).toBe("dialog")
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
it("renders the panel inside the agenda's own scroller, not the body", async () => {
|
|
317
|
+
renderView({
|
|
318
|
+
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
319
|
+
withEventDetails: true,
|
|
245
320
|
})
|
|
246
|
-
|
|
321
|
+
fireEvent.click(controls()[0] as HTMLElement)
|
|
322
|
+
const dialog = await screen.findByRole("dialog")
|
|
323
|
+
expect(dialog.closest("[data-schedule-part='agenda-view']")).not.toBeNull()
|
|
247
324
|
})
|
|
248
325
|
})
|
|
249
326
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useEffect, useRef } from "react"
|
|
5
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
6
6
|
import { cn } from "../../lib/cn"
|
|
7
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
7
8
|
import { OverlayContainerProvider } from "../../lib/overlay-container"
|
|
8
9
|
import { props as dataProps } from "../../lib/props"
|
|
9
10
|
import type { WithTestId } from "../../lib/test-id"
|
|
@@ -25,22 +26,17 @@ import { resolveScheduleTranslations } from "./schedule-types"
|
|
|
25
26
|
import { useScheduleSelection } from "./use-schedule-selection"
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* The agenda:
|
|
29
|
-
* fourth toolbar-switchable renderer
|
|
29
|
+
* The agenda: `visibleDays` days of events as a chronological list, starting
|
|
30
|
+
* at the schedule's own date, and the fourth toolbar-switchable renderer
|
|
31
|
+
* (`views={["week", "agenda", "month"]}`).
|
|
30
32
|
*
|
|
31
33
|
* It renders the same list as `Schedule.NextUp` (`schedule-agenda-list.tsx`),
|
|
32
|
-
* over a different window —
|
|
33
|
-
* rather than everything from now on.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* than growing a branch.
|
|
38
|
-
*
|
|
39
|
-
* `getVisibleRange("agenda", …)` is the one that can't be shared — it is the
|
|
40
|
-
* strict calendar month where Month's is the padded six-week grid. See its
|
|
41
|
-
* own comment; the short version is that a list has no adjacent-month cells
|
|
42
|
-
* to justify padding, and `Root`'s reveal would otherwise be told an event
|
|
43
|
-
* the list never renders is already visible.
|
|
34
|
+
* over a different window — one anchored on the schedule's date and bounded at
|
|
35
|
+
* both ends, rather than everything from now on. A list is read from its top,
|
|
36
|
+
* so the window **starts at the anchor itself**: Now puts "Today" first, and
|
|
37
|
+
* Prev/Next step by the window's own span, exactly as a `"relative"` Days
|
|
38
|
+
* window does — which is why `paginateDate` and `formatScheduleTitle` fold
|
|
39
|
+
* `"agenda"` into their `"days"` pattern rather than growing a branch.
|
|
44
40
|
*
|
|
45
41
|
* Unlike Month and Year this holds a live clock (`useNow`): its day headings
|
|
46
42
|
* say "Today"/"Tomorrow", which is the one thing on screen that goes stale
|
|
@@ -50,12 +46,10 @@ import { useScheduleSelection } from "./use-schedule-selection"
|
|
|
50
46
|
* only a divider labelling a group — so there is no surface for it, and a
|
|
51
47
|
* drill-down from a list of events into the day of one of them is what
|
|
52
48
|
* selecting the event already does.
|
|
49
|
+
*
|
|
50
|
+
* And no details popover by default: every row already prints its title, time
|
|
51
|
+
* and description, which is everything the built-in popover would repeat.
|
|
53
52
|
*/
|
|
54
|
-
// No `ScheduleDayClickProps`: an agenda has no day cells and no day headers to
|
|
55
|
-
// click — only a divider labelling a group — so there is no surface for
|
|
56
|
-
// `onDayClick`, and a drill-down from a list of events into the day of one of
|
|
57
|
-
// them is what selecting the event already does. It used to say this by
|
|
58
|
-
// `Omit`ing that one name off the shared slice.
|
|
59
53
|
export type AgendaViewProps<P = unknown> = ScheduleSharedProps<P> &
|
|
60
54
|
ScheduleEventProps<P> &
|
|
61
55
|
ScheduleEmptyProps &
|
|
@@ -64,9 +58,13 @@ export type AgendaViewProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
64
58
|
// `ScheduleEventProps` contributes `onSelect`, and React's own DOM props
|
|
65
59
|
// carry an `onSelect` (text-selection) of their own — the same `Omit`
|
|
66
60
|
// `ScheduleProps` and `MonthViewProps` already need for the same reason.
|
|
67
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
61
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
68
62
|
WithTestId &
|
|
69
|
-
ScheduleAgendaOnlyProps<P>
|
|
63
|
+
ScheduleAgendaOnlyProps<P> & {
|
|
64
|
+
/** How many days the list spans, starting at the anchor date. Default
|
|
65
|
+
* `7`. Prev/Next step by the same amount. */
|
|
66
|
+
visibleDays?: number
|
|
67
|
+
}
|
|
70
68
|
|
|
71
69
|
/** Agenda only. Named so `ScheduleProps` can gate it by name rather than
|
|
72
70
|
* `Pick`ing the key out of `AgendaViewProps` — the hand-maintained shape that
|
|
@@ -90,10 +88,13 @@ export function AgendaView<P = unknown>({
|
|
|
90
88
|
defaultSelected,
|
|
91
89
|
onSelect,
|
|
92
90
|
withSelection = true,
|
|
93
|
-
withEventDetails = true,
|
|
94
91
|
renderEventDetails,
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
// Off by default — a row already shows everything the popover would. Passing
|
|
93
|
+
// `renderEventDetails` alone opts back in: it asks for a popover's content,
|
|
94
|
+
// which is only meaningful with a popover to put it in.
|
|
95
|
+
withEventDetails = renderEventDetails !== undefined,
|
|
96
|
+
locale: localeProp,
|
|
97
|
+
timeZone: timeZoneProp,
|
|
97
98
|
translations,
|
|
98
99
|
classNames,
|
|
99
100
|
className,
|
|
@@ -105,9 +106,13 @@ export function AgendaView<P = unknown>({
|
|
|
105
106
|
now,
|
|
106
107
|
empty,
|
|
107
108
|
renderEvent,
|
|
109
|
+
visibleDays = 7,
|
|
108
110
|
testId,
|
|
111
|
+
asChild: _asChild,
|
|
109
112
|
...rest
|
|
110
113
|
}: AgendaViewProps<P>) {
|
|
114
|
+
const locale = useLocale(localeProp)
|
|
115
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
111
116
|
const [currentDate, setCurrentDate] = useUncontrolled<Date>({
|
|
112
117
|
value: date,
|
|
113
118
|
defaultValue: defaultDate,
|
|
@@ -122,15 +127,16 @@ export function AgendaView<P = unknown>({
|
|
|
122
127
|
})
|
|
123
128
|
const t = resolveScheduleTranslations(translations)
|
|
124
129
|
const current = useNow(now)
|
|
125
|
-
const range = getVisibleRange("agenda", currentDate, { timeZone, locale
|
|
130
|
+
const range = getVisibleRange("agenda", currentDate, { timeZone, locale, visibleDays })
|
|
126
131
|
// `rangesOverlap` against the very range `isEventInVisibleRange` asks about
|
|
127
132
|
// — not `filterUpcomingEvents`, whose open-ended lower bound is NextUp's
|
|
128
133
|
// alone. The two being the same predicate over the same range is what makes
|
|
129
134
|
// `Root`'s reveal correct here by construction rather than by coincidence:
|
|
130
135
|
// an event this list doesn't render is an event `Root` will page to.
|
|
131
136
|
//
|
|
132
|
-
// A multi-day event that started
|
|
133
|
-
// real start date — which can head a group dated
|
|
137
|
+
// A multi-day event that started before the window is listed once, under
|
|
138
|
+
// its own real start date — which can head a group dated before the title's
|
|
139
|
+
// range.
|
|
134
140
|
// Clamping it to the window would invent a start it doesn't have, and
|
|
135
141
|
// disagree with the range its own details popover prints.
|
|
136
142
|
const groups = groupUpcomingEvents(
|
|
@@ -140,6 +146,13 @@ export function AgendaView<P = unknown>({
|
|
|
140
146
|
// The list is the agenda's scroller, and its rows' popovers portal *into* it
|
|
141
147
|
// (see `OverlayContainerProvider`), the same as the Days and Month grids.
|
|
142
148
|
const scrollerRef = useRef<HTMLDivElement>(null)
|
|
149
|
+
// A new window is a new list, read from its top — Prev/Next and Now would
|
|
150
|
+
// otherwise leave the reader wherever they had scrolled in the old one.
|
|
151
|
+
const windowStart = range.start.getTime()
|
|
152
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: re-runs on purpose whenever the window moves
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
scrollerRef.current?.scrollTo({ top: 0 })
|
|
155
|
+
}, [windowStart])
|
|
143
156
|
|
|
144
157
|
return (
|
|
145
158
|
<ark.div
|
|
@@ -158,6 +171,7 @@ export function AgendaView<P = unknown>({
|
|
|
158
171
|
onDateChange={setCurrentDate}
|
|
159
172
|
timeZone={timeZone}
|
|
160
173
|
translations={t}
|
|
174
|
+
visibleDays={visibleDays}
|
|
161
175
|
/>
|
|
162
176
|
<ScheduleToolbar.NextTrigger
|
|
163
177
|
view="agenda"
|
|
@@ -165,6 +179,7 @@ export function AgendaView<P = unknown>({
|
|
|
165
179
|
onDateChange={setCurrentDate}
|
|
166
180
|
timeZone={timeZone}
|
|
167
181
|
translations={t}
|
|
182
|
+
visibleDays={visibleDays}
|
|
168
183
|
/>
|
|
169
184
|
</>
|
|
170
185
|
) : null}
|
|
@@ -192,8 +207,8 @@ export function AgendaView<P = unknown>({
|
|
|
192
207
|
translations={t}
|
|
193
208
|
empty={empty}
|
|
194
209
|
// Deliberately no `nextEventId`: "the soonest one still to come" is
|
|
195
|
-
// a from-now idea, and a
|
|
196
|
-
//
|
|
210
|
+
// a from-now idea, and a window anchored on last March has no such
|
|
211
|
+
// event. Every row gets `isNext: false` here.
|
|
197
212
|
renderEvent={renderEvent}
|
|
198
213
|
onEventSelect={onEventSelect}
|
|
199
214
|
selected={selectedIds}
|
|
@@ -321,7 +321,7 @@ function AllDayEventBar<P>({
|
|
|
321
321
|
)}
|
|
322
322
|
>
|
|
323
323
|
{event.icon != null ? (
|
|
324
|
-
<span className="
|
|
324
|
+
<span className="me-1 inline-flex align-[-1px] [&_svg]:size-3">{event.icon}</span>
|
|
325
325
|
) : null}
|
|
326
326
|
{event.title}
|
|
327
327
|
</button>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn"
|
|
2
|
+
import { poolPieceInsets } from "./schedule-geometry"
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The click-drag-to-create ghost box. RSC — owns no state, only reads the
|
|
@@ -9,8 +10,9 @@ import { cn } from "../../lib/cn"
|
|
|
9
10
|
* `pointermove`, matching the module's "refs are not state" discipline for
|
|
10
11
|
* in-flight gesture coordinates.
|
|
11
12
|
*
|
|
12
|
-
* One of these is mounted per day
|
|
13
|
-
*
|
|
13
|
+
* One of these is mounted per rendered day, pooled in a layer laid over the
|
|
14
|
+
* day columns (`piece-pool` in `schedule-timed-grid.tsx`) and placed on its day
|
|
15
|
+
* by `--sch-create-col`, and a single gesture writes to all of them: a create drag has two axes, so its candidate is clipped to each
|
|
14
16
|
* column's own painted band exactly the way `segmentEvents` clips a real
|
|
15
17
|
* event. A cross-day draft is therefore several of these boxes, one per day,
|
|
16
18
|
* not one box drawn past the bottom of its column.
|
|
@@ -31,7 +33,7 @@ export function ScheduleCreateDraft({ className }: { className?: string }) {
|
|
|
31
33
|
aria-hidden
|
|
32
34
|
data-schedule-part="create-draft"
|
|
33
35
|
className={cn(
|
|
34
|
-
"group pointer-events-none absolute
|
|
36
|
+
"group pointer-events-none absolute hidden rounded-sm border-2",
|
|
35
37
|
// `select-none`, like every other chip surface in the grid. The label
|
|
36
38
|
// rides the box's top edge, which during an upward drag *is* the
|
|
37
39
|
// pointer position — so the browser extended a text selection straight
|
|
@@ -114,9 +116,15 @@ export function ScheduleCreateDraft({ className }: { className?: string }) {
|
|
|
114
116
|
* Easing per direction comes from whichever state the transition heads
|
|
115
117
|
* *to*, so the base carries `ease-in` (the leave) and `data-active` the
|
|
116
118
|
* `ease-out` (the enter). `allow-discrete` rides on `display` alone.
|
|
119
|
+
*
|
|
120
|
+
* `inset-inline-start` is the drag ghost's day-change slide. A draft
|
|
121
|
+
* piece is keyed by its own column (create and resize are pinned where
|
|
122
|
+
* they began, and only grow or shrink), so it never changes column
|
|
123
|
+
* mid-gesture; it is listed so the two previews stay one declaration
|
|
124
|
+
* apart, as `height` is on the ghost.
|
|
117
125
|
*/
|
|
118
|
-
"[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
|
|
119
|
-
"data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
|
|
126
|
+
"[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
|
|
127
|
+
"data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
|
|
120
128
|
// `!` and the full shorthand, not `transition-none`: the `data-active`
|
|
121
129
|
// rule above is a class *and* an attribute selector, so a plain
|
|
122
130
|
// `motion-reduce:transition-none` loses to it and the preview kept
|
|
@@ -138,6 +146,7 @@ export function ScheduleCreateDraft({ className }: { className?: string }) {
|
|
|
138
146
|
// Safe for the inactive pieces this component also renders: they are
|
|
139
147
|
// `display: none` without `data-active`, so their height never paints.
|
|
140
148
|
height: "max(var(--sch-create-height, 0px), calc(1rem + 2px))",
|
|
149
|
+
...poolPieceInsets("--sch-create-col"),
|
|
141
150
|
}}
|
|
142
151
|
>
|
|
143
152
|
{/* The live drop-time readout, the same one `schedule-drag-ghost.tsx`
|