@zealakit/chrono-react 0.0.0-stage → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +624 -2
- package/dist/calendar/components.d.ts +346 -0
- package/dist/calendar/components.js +245 -0
- package/dist/calendar/context.d.ts +636 -0
- package/dist/calendar/context.js +21 -0
- package/dist/calendar/index.d.ts +6 -0
- package/dist/calendar/index.js +6 -0
- package/dist/calendar/mini-calendar.d.ts +60 -0
- package/dist/calendar/mini-calendar.js +50 -0
- package/dist/calendar/options.d.ts +4 -0
- package/dist/calendar/options.js +98 -0
- package/dist/calendar/use-calendar.d.ts +340 -0
- package/dist/calendar/use-calendar.js +156 -0
- package/dist/calendar/use-mini-calendar.d.ts +302 -0
- package/dist/calendar/use-mini-calendar.js +56 -0
- package/dist/calendar/utilities.d.ts +9 -0
- package/dist/calendar/utilities.js +8 -0
- package/dist/date/bind-panel.d.ts +30 -0
- package/dist/date/bind-panel.js +125 -0
- package/dist/date/components.d.ts +197 -0
- package/dist/date/components.js +202 -0
- package/dist/date/context.d.ts +34 -0
- package/dist/date/context.js +19 -0
- package/dist/date/index.d.ts +4 -0
- package/dist/date/index.js +4 -0
- package/dist/date/options.d.ts +7 -0
- package/dist/date/options.js +91 -0
- package/dist/date/use-date-input.d.ts +43 -0
- package/dist/date/use-date-input.js +138 -0
- package/dist/date/use-date-panel.d.ts +81 -0
- package/dist/date/use-date-panel.js +21 -0
- package/dist/date/utilities.d.ts +4 -0
- package/dist/date/utilities.js +4 -0
- package/dist/datetime/components.d.ts +121 -0
- package/dist/datetime/components.js +169 -0
- package/dist/datetime/context.d.ts +8 -0
- package/dist/datetime/context.js +18 -0
- package/dist/datetime/index.d.ts +4 -0
- package/dist/datetime/index.js +4 -0
- package/dist/datetime/options.d.ts +5 -0
- package/dist/datetime/options.js +99 -0
- package/dist/datetime/use-datetime-input.d.ts +44 -0
- package/dist/datetime/use-datetime-input.js +145 -0
- package/dist/datetime/use-datetime-panel.d.ts +128 -0
- package/dist/datetime/use-datetime-panel.js +60 -0
- package/dist/datetime/utilities.d.ts +4 -0
- package/dist/datetime/utilities.js +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/shared/merge-props.d.ts +9 -0
- package/dist/shared/merge-props.js +33 -0
- package/dist/shared/modifiers.d.ts +7 -0
- package/dist/shared/modifiers.js +6 -0
- package/dist/shared/part.d.ts +10 -0
- package/dist/shared/part.js +9 -0
- package/dist/shared/slot.d.ts +12 -0
- package/dist/shared/slot.js +60 -0
- package/dist/shared/style-properties.d.ts +8 -0
- package/dist/shared/style-properties.js +13 -0
- package/dist/shared/to-react-props.d.ts +11 -0
- package/dist/shared/to-react-props.js +27 -0
- package/dist/time/bind-panel.d.ts +19 -0
- package/dist/time/bind-panel.js +97 -0
- package/dist/time/components.d.ts +183 -0
- package/dist/time/components.js +174 -0
- package/dist/time/context.d.ts +24 -0
- package/dist/time/context.js +19 -0
- package/dist/time/index.d.ts +4 -0
- package/dist/time/index.js +4 -0
- package/dist/time/options.d.ts +5 -0
- package/dist/time/options.js +85 -0
- package/dist/time/use-time-input.d.ts +43 -0
- package/dist/time/use-time-input.js +138 -0
- package/dist/time/use-time-panel.d.ts +37 -0
- package/dist/time/use-time-panel.js +18 -0
- package/dist/time/utilities.d.ts +4 -0
- package/dist/time/utilities.js +4 -0
- package/dist/vendor/core/calendar/availability.d.ts +39 -0
- package/dist/vendor/core/calendar/availability.js +74 -0
- package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
- package/dist/vendor/core/calendar/controllers/calendar-controller.js +1448 -0
- package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
- package/dist/vendor/core/calendar/controllers/drag-engine.js +382 -0
- package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
- package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +170 -0
- package/dist/vendor/core/calendar/controllers/shared.d.ts +29 -0
- package/dist/vendor/core/calendar/controllers/shared.js +82 -0
- package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
- package/dist/vendor/core/calendar/events/agenda-layout.js +71 -0
- package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
- package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
- package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
- package/dist/vendor/core/calendar/events/background-layout.js +107 -0
- package/dist/vendor/core/calendar/events/index.d.ts +17 -0
- package/dist/vendor/core/calendar/events/index.js +8 -0
- package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
- package/dist/vendor/core/calendar/events/month-layout.js +156 -0
- package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
- package/dist/vendor/core/calendar/events/normalize.js +159 -0
- package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
- package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
- package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
- package/dist/vendor/core/calendar/events/overflow.js +112 -0
- package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
- package/dist/vendor/core/calendar/events/sort.js +35 -0
- package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
- package/dist/vendor/core/calendar/events/time-grid-layout.js +184 -0
- package/dist/vendor/core/calendar/events/types.d.ts +141 -0
- package/dist/vendor/core/calendar/events/types.js +1 -0
- package/dist/vendor/core/calendar/index.d.ts +70 -0
- package/dist/vendor/core/calendar/index.js +37 -0
- package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +19 -0
- package/dist/vendor/core/calendar/interaction/auto-scroll.js +64 -0
- package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
- package/dist/vendor/core/calendar/interaction/drag-geometry.js +125 -0
- package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
- package/dist/vendor/core/calendar/interaction/drag-keyboard.js +56 -0
- package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +23 -0
- package/dist/vendor/core/calendar/interaction/drag-pointer.js +203 -0
- package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
- package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
- package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
- package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
- package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
- package/dist/vendor/core/calendar/interaction/pending.js +17 -0
- package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
- package/dist/vendor/core/calendar/interaction/pointer.js +119 -0
- package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
- package/dist/vendor/core/calendar/interaction/selection.js +47 -0
- package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
- package/dist/vendor/core/calendar/internal/equal.js +43 -0
- package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
- package/dist/vendor/core/calendar/navigation/navigate.js +83 -0
- package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
- package/dist/vendor/core/calendar/navigation/range.js +52 -0
- package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
- package/dist/vendor/core/calendar/navigation/title.js +39 -0
- package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
- package/dist/vendor/core/calendar/navigation/view-definition.js +61 -0
- package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
- package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
- package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
- package/dist/vendor/core/calendar/recurrence/apply.js +207 -0
- package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
- package/dist/vendor/core/calendar/recurrence/expand.js +302 -0
- package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
- package/dist/vendor/core/calendar/recurrence/pack.js +251 -0
- package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
- package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
- package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
- package/dist/vendor/core/calendar/recurrence/rrule.js +288 -0
- package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
- package/dist/vendor/core/calendar/recurrence/series.js +165 -0
- package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
- package/dist/vendor/core/calendar/recurrence/types.js +1 -0
- package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
- package/dist/vendor/core/calendar/resources/keys.js +2 -0
- package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
- package/dist/vendor/core/calendar/resources/resource-time-grid.js +130 -0
- package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
- package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
- package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
- package/dist/vendor/core/calendar/resources/timeline-layout.js +111 -0
- package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
- package/dist/vendor/core/calendar/resources/tree.js +86 -0
- package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
- package/dist/vendor/core/calendar/resources/types.js +1 -0
- package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
- package/dist/vendor/core/calendar/resources/views.js +45 -0
- package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
- package/dist/vendor/core/calendar/resources/windowing.js +17 -0
- package/dist/vendor/core/calendar/views/day.d.ts +37 -0
- package/dist/vendor/core/calendar/views/day.js +39 -0
- package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
- package/dist/vendor/core/calendar/views/list-layout.js +5 -0
- package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
- package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
- package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
- package/dist/vendor/core/calendar/views/month-layout.js +63 -0
- package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
- package/dist/vendor/core/calendar/views/time-grid-layout.js +30 -0
- package/dist/vendor/core/date/index.d.ts +9 -0
- package/dist/vendor/core/date/index.js +9 -0
- package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
- package/dist/vendor/core/date/input/date-input-controller.js +478 -0
- package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
- package/dist/vendor/core/date/input/date-range-input-controller.js +189 -0
- package/dist/vendor/core/date/input/parse.d.ts +22 -0
- package/dist/vendor/core/date/input/parse.js +84 -0
- package/dist/vendor/core/date/input/validity.d.ts +6 -0
- package/dist/vendor/core/date/input/validity.js +13 -0
- package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
- package/dist/vendor/core/date/panel/panel-controller.js +726 -0
- package/dist/vendor/core/date/presets.d.ts +22 -0
- package/dist/vendor/core/date/presets.js +104 -0
- package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
- package/dist/vendor/core/date/selection/multiple.js +32 -0
- package/dist/vendor/core/date/selection/range.d.ts +29 -0
- package/dist/vendor/core/date/selection/range.js +39 -0
- package/dist/vendor/core/date/types.d.ts +12 -0
- package/dist/vendor/core/date/types.js +1 -0
- package/dist/vendor/core/datetime/compose.d.ts +24 -0
- package/dist/vendor/core/datetime/compose.js +49 -0
- package/dist/vendor/core/datetime/constraints.d.ts +42 -0
- package/dist/vendor/core/datetime/constraints.js +56 -0
- package/dist/vendor/core/datetime/index.d.ts +9 -0
- package/dist/vendor/core/datetime/index.js +9 -0
- package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
- package/dist/vendor/core/datetime/input/datetime-input-controller.js +395 -0
- package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
- package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +182 -0
- package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
- package/dist/vendor/core/datetime/input/parse.js +59 -0
- package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
- package/dist/vendor/core/datetime/panel/controller.js +197 -0
- package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
- package/dist/vendor/core/datetime/panel/range-controller.js +217 -0
- package/dist/vendor/core/datetime/types.d.ts +12 -0
- package/dist/vendor/core/datetime/types.js +1 -0
- package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
- package/dist/vendor/core/datetime/zone/day-instants.js +54 -0
- package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
- package/dist/vendor/core/datetime/zone/resolve.js +26 -0
- package/dist/vendor/core/foundation/a11y/announcer.d.ts +7 -0
- package/dist/vendor/core/foundation/a11y/announcer.js +36 -0
- package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
- package/dist/vendor/core/foundation/a11y/grid-navigation.js +86 -0
- package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
- package/dist/vendor/core/foundation/a11y/index.js +5 -0
- package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
- package/dist/vendor/core/foundation/a11y/labels.js +43 -0
- package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
- package/dist/vendor/core/foundation/a11y/messages.js +74 -0
- package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
- package/dist/vendor/core/foundation/a11y/roving-focus.js +52 -0
- package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
- package/dist/vendor/core/foundation/constraints/availability-rules.js +66 -0
- package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
- package/dist/vendor/core/foundation/constraints/availability.js +490 -0
- package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
- package/dist/vendor/core/foundation/constraints/date.js +41 -0
- package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
- package/dist/vendor/core/foundation/constraints/index.js +4 -0
- package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
- package/dist/vendor/core/foundation/constraints/range.js +70 -0
- package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
- package/dist/vendor/core/foundation/constraints/time.js +56 -0
- package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
- package/dist/vendor/core/foundation/grid/index.js +4 -0
- package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
- package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
- package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
- package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
- package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
- package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
- package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
- package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
- package/dist/vendor/core/foundation/index.d.ts +8 -0
- package/dist/vendor/core/foundation/index.js +8 -0
- package/dist/vendor/core/foundation/input/form.d.ts +7 -0
- package/dist/vendor/core/foundation/input/form.js +10 -0
- package/dist/vendor/core/foundation/input/index.d.ts +6 -0
- package/dist/vendor/core/foundation/input/index.js +3 -0
- package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
- package/dist/vendor/core/foundation/input/segment-engine.js +49 -0
- package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
- package/dist/vendor/core/foundation/input/tokenize.js +24 -0
- package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
- package/dist/vendor/core/foundation/locale/digits.js +35 -0
- package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
- package/dist/vendor/core/foundation/locale/direction.js +37 -0
- package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
- package/dist/vendor/core/foundation/locale/format.js +79 -0
- package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
- package/dist/vendor/core/foundation/locale/hour-cycle.js +45 -0
- package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
- package/dist/vendor/core/foundation/locale/index.js +8 -0
- package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
- package/dist/vendor/core/foundation/locale/names.js +30 -0
- package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
- package/dist/vendor/core/foundation/locale/resolve.js +29 -0
- package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
- package/dist/vendor/core/foundation/locale/week-info.js +61 -0
- package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
- package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
- package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
- package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
- package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
- package/dist/vendor/core/foundation/ranges/index.js +2 -0
- package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
- package/dist/vendor/core/foundation/ranges/interval.js +56 -0
- package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
- package/dist/vendor/core/foundation/store/attributes.js +43 -0
- package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
- package/dist/vendor/core/foundation/store/controllable.js +50 -0
- package/dist/vendor/core/foundation/store/env.d.ts +1 -0
- package/dist/vendor/core/foundation/store/env.js +3 -0
- package/dist/vendor/core/foundation/store/global-state.d.ts +1 -0
- package/dist/vendor/core/foundation/store/global-state.js +21 -0
- package/dist/vendor/core/foundation/store/ids.d.ts +2 -0
- package/dist/vendor/core/foundation/store/ids.js +7 -0
- package/dist/vendor/core/foundation/store/index.d.ts +11 -0
- package/dist/vendor/core/foundation/store/index.js +7 -0
- package/dist/vendor/core/foundation/store/store.d.ts +7 -0
- package/dist/vendor/core/foundation/store/store.js +25 -0
- package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
- package/dist/vendor/core/foundation/store/ticker.js +27 -0
- package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
- package/dist/vendor/core/foundation/values/clock.js +21 -0
- package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
- package/dist/vendor/core/foundation/values/compare.js +70 -0
- package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
- package/dist/vendor/core/foundation/values/convert.js +112 -0
- package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
- package/dist/vendor/core/foundation/values/epoch-day.js +47 -0
- package/dist/vendor/core/foundation/values/index.d.ts +14 -0
- package/dist/vendor/core/foundation/values/index.js +10 -0
- package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
- package/dist/vendor/core/foundation/values/iso.js +113 -0
- package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
- package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
- package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
- package/dist/vendor/core/foundation/values/plain-date.js +105 -0
- package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
- package/dist/vendor/core/foundation/values/plain-time.js +45 -0
- package/dist/vendor/core/foundation/values/types.d.ts +37 -0
- package/dist/vendor/core/foundation/values/types.js +1 -0
- package/dist/vendor/core/foundation/values/week.d.ts +9 -0
- package/dist/vendor/core/foundation/values/week.js +31 -0
- package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
- package/dist/vendor/core/foundation/values/year-month.js +19 -0
- package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
- package/dist/vendor/core/foundation/values/zoned.js +155 -0
- package/dist/vendor/core/index.d.ts +5 -0
- package/dist/vendor/core/index.js +5 -0
- package/dist/vendor/core/time/index.d.ts +8 -0
- package/dist/vendor/core/time/index.js +8 -0
- package/dist/vendor/core/time/input/parse.d.ts +19 -0
- package/dist/vendor/core/time/input/parse.js +84 -0
- package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
- package/dist/vendor/core/time/input/time-input-controller.js +562 -0
- package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
- package/dist/vendor/core/time/input/time-range-input-controller.js +185 -0
- package/dist/vendor/core/time/input/validity.d.ts +7 -0
- package/dist/vendor/core/time/input/validity.js +16 -0
- package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
- package/dist/vendor/core/time/panel/time-panel-controller.js +839 -0
- package/dist/vendor/core/time/selection/range.d.ts +25 -0
- package/dist/vendor/core/time/selection/range.js +35 -0
- package/dist/vendor/core/time/selection/slots.d.ts +46 -0
- package/dist/vendor/core/time/selection/slots.js +78 -0
- package/dist/vendor/core/time/types.d.ts +11 -0
- package/dist/vendor/core/time/types.js +1 -0
- package/package.json +90 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { fromSecondOfDay, plainDateTime, toInstant, toZoned, } from "../../foundation/index.js";
|
|
2
|
+
const wallEquals = (zoned, time) => zoned.hour === time.hour &&
|
|
3
|
+
zoned.minute === time.minute &&
|
|
4
|
+
zoned.second === time.second;
|
|
5
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
6
|
+
/** `+07:00` for an offset in minutes. */
|
|
7
|
+
export function formatOffset(minutes) {
|
|
8
|
+
const abs = Math.abs(minutes);
|
|
9
|
+
return `${minutes < 0 ? "-" : "+"}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Wall-aligned entries of one day (plan 08 X4): times in a gap are left out, times in
|
|
13
|
+
* the repeated hour appear twice (earlier first), each with its offset.
|
|
14
|
+
*/
|
|
15
|
+
export function getDayInstants(date, timeZone, stepMinutes) {
|
|
16
|
+
const entries = [];
|
|
17
|
+
const step = Math.max(1, stepMinutes) * 60;
|
|
18
|
+
for (let at = 0; at < 86400; at += step) {
|
|
19
|
+
const time = fromSecondOfDay(at);
|
|
20
|
+
const wall = plainDateTime(date, time);
|
|
21
|
+
const earlier = toZoned(wall, timeZone, "earlier");
|
|
22
|
+
const later = toZoned(wall, timeZone, "later");
|
|
23
|
+
const keep = (zoned) => wallEquals(zoned, time);
|
|
24
|
+
const key = `${pad(time.hour)}:${pad(time.minute)}`;
|
|
25
|
+
if (!keep(earlier) && !keep(later))
|
|
26
|
+
continue; // gap
|
|
27
|
+
if (keep(earlier) && keep(later) && earlier.offset !== later.offset) {
|
|
28
|
+
entries.push({
|
|
29
|
+
key,
|
|
30
|
+
time,
|
|
31
|
+
offset: earlier.offset,
|
|
32
|
+
instant: toInstant(earlier),
|
|
33
|
+
ordinal: 1,
|
|
34
|
+
}, {
|
|
35
|
+
key: `${key}#2`,
|
|
36
|
+
time,
|
|
37
|
+
offset: later.offset,
|
|
38
|
+
instant: toInstant(later),
|
|
39
|
+
ordinal: 2,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const zoned = keep(earlier) ? earlier : later;
|
|
44
|
+
entries.push({
|
|
45
|
+
key,
|
|
46
|
+
time,
|
|
47
|
+
offset: zoned.offset,
|
|
48
|
+
instant: toInstant(zoned),
|
|
49
|
+
ordinal: 1,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return entries;
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Disambiguation, type PlainDateTime, type ZonedDateTime } from "../../foundation/index.js";
|
|
2
|
+
export type ResolvedWall = {
|
|
3
|
+
zoned: ZonedDateTime;
|
|
4
|
+
/** The resolved wall fields differ from the typed ones (a DST gap was crossed). */
|
|
5
|
+
adjusted: boolean;
|
|
6
|
+
/** The wall time happens twice (a DST overlap). */
|
|
7
|
+
ambiguous: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Pin a wall time to a zone (plan 08 X3). A gap resolves per `disambiguation` and sets
|
|
11
|
+
* `adjusted`; an overlap resolves per `disambiguation` and sets `ambiguous`. With
|
|
12
|
+
* `"reject"` both throw a `RangeError`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveWall(wall: PlainDateTime, zone: string, disambiguation?: Disambiguation): ResolvedWall;
|
|
15
|
+
/** The same instant in the zone the app stores values in (plan 08 X2). */
|
|
16
|
+
export declare const toValueZone: (zoned: ZonedDateTime, valueTimeZone: string | undefined) => ZonedDateTime;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { toZoned, withTimeZone, } from "../../foundation/index.js";
|
|
2
|
+
const sameWall = (a, b) => a.year === b.year &&
|
|
3
|
+
a.month === b.month &&
|
|
4
|
+
a.day === b.day &&
|
|
5
|
+
a.hour === b.hour &&
|
|
6
|
+
a.minute === b.minute &&
|
|
7
|
+
a.second === b.second;
|
|
8
|
+
/**
|
|
9
|
+
* Pin a wall time to a zone (plan 08 X3). A gap resolves per `disambiguation` and sets
|
|
10
|
+
* `adjusted`; an overlap resolves per `disambiguation` and sets `ambiguous`. With
|
|
11
|
+
* `"reject"` both throw a `RangeError`.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveWall(wall, zone, disambiguation = "compatible") {
|
|
14
|
+
const zoned = toZoned(wall, zone, disambiguation);
|
|
15
|
+
const earlier = toZoned(wall, zone, "earlier");
|
|
16
|
+
const later = toZoned(wall, zone, "later");
|
|
17
|
+
return {
|
|
18
|
+
zoned,
|
|
19
|
+
adjusted: !sameWall(zoned, wall),
|
|
20
|
+
ambiguous: earlier.offset !== later.offset &&
|
|
21
|
+
sameWall(earlier, wall) &&
|
|
22
|
+
sameWall(later, wall),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** The same instant in the zone the app stores values in (plan 08 X2). */
|
|
26
|
+
export const toValueZone = (zoned, valueTimeZone) => valueTimeZone === undefined ? zoned : withTimeZone(zoned, valueTimeZone);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Announce `message` through a polite live region. The region is created
|
|
3
|
+
* lazily and shared by every copy of core on the page; the app can pass its
|
|
4
|
+
* own element, or `false` to disable announcements. A no-op outside the
|
|
5
|
+
* browser.
|
|
6
|
+
*/
|
|
7
|
+
export declare function announce(message: string, element?: HTMLElement | false): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getGlobalState } from "../store/global-state.js";
|
|
2
|
+
import { isBrowser } from "../store/env.js";
|
|
3
|
+
/**
|
|
4
|
+
* The one shared visually-hidden live region per document (plan 05 E20). This
|
|
5
|
+
* inline style is the single accessibility exception to the "no styles" rule
|
|
6
|
+
* (02 §2.8): it hides the region from sight while screen readers read it.
|
|
7
|
+
*/
|
|
8
|
+
const VISUALLY_HIDDEN = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";
|
|
9
|
+
function createRegion() {
|
|
10
|
+
const region = document.createElement("div");
|
|
11
|
+
region.setAttribute("aria-live", "polite");
|
|
12
|
+
region.setAttribute("role", "status");
|
|
13
|
+
region.setAttribute("aria-atomic", "true");
|
|
14
|
+
region.setAttribute("style", VISUALLY_HIDDEN);
|
|
15
|
+
document.body.appendChild(region);
|
|
16
|
+
return region;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Announce `message` through a polite live region. The region is created
|
|
20
|
+
* lazily and shared by every copy of core on the page; the app can pass its
|
|
21
|
+
* own element, or `false` to disable announcements. A no-op outside the
|
|
22
|
+
* browser.
|
|
23
|
+
*/
|
|
24
|
+
export function announce(message, element) {
|
|
25
|
+
if (element === false || !isBrowser()) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const shared = element === undefined;
|
|
29
|
+
const region = element ?? getGlobalState("announcer", createRegion);
|
|
30
|
+
if (shared && !region.isConnected) {
|
|
31
|
+
document.body.appendChild(region);
|
|
32
|
+
}
|
|
33
|
+
// Clearing first lets the same message be read twice in a row.
|
|
34
|
+
region.textContent = "";
|
|
35
|
+
region.textContent = message;
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DayOfWeek, PlainDate } from "../values/types.js";
|
|
2
|
+
export type GridNavKey = "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "Home" | "End" | "PageUp" | "PageDown";
|
|
3
|
+
export type GridNavContext = {
|
|
4
|
+
weekStartsOn: DayOfWeek;
|
|
5
|
+
direction: "ltr" | "rtl";
|
|
6
|
+
min?: PlainDate;
|
|
7
|
+
max?: PlainDate;
|
|
8
|
+
level: "day" | "month" | "year";
|
|
9
|
+
/** Cells per row of the month and year grids (default 4). */
|
|
10
|
+
columns?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Pure key to next-focus mapping for a date grid. It never touches the DOM.
|
|
14
|
+
* Disabled dates are not skipped: they stay focusable (APG, D14). Results are
|
|
15
|
+
* clamped to `min` and `max`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function nextFocusedDate(current: PlainDate, key: GridNavKey, modifiers: {
|
|
18
|
+
shift: boolean;
|
|
19
|
+
}, ctx: GridNavContext): PlainDate;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { addDays, addMonths, addYears, endOfWeek, plainDate, startOfWeek, } from "../values/plain-date.js";
|
|
2
|
+
import { compare } from "../values/compare.js";
|
|
3
|
+
function clamp(date, ctx) {
|
|
4
|
+
if (ctx.min && compare(date, ctx.min) < 0) {
|
|
5
|
+
return ctx.min;
|
|
6
|
+
}
|
|
7
|
+
if (ctx.max && compare(date, ctx.max) > 0) {
|
|
8
|
+
return ctx.max;
|
|
9
|
+
}
|
|
10
|
+
return date;
|
|
11
|
+
}
|
|
12
|
+
/** `addDays` and friends throw outside years 1-9999; pin to the bounds instead. */
|
|
13
|
+
function safely(move, towardsEnd) {
|
|
14
|
+
try {
|
|
15
|
+
return move();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return towardsEnd ? plainDate(9999, 12, 31) : plainDate(1, 1, 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Pure key to next-focus mapping for a date grid. It never touches the DOM.
|
|
23
|
+
* Disabled dates are not skipped: they stay focusable (APG, D14). Results are
|
|
24
|
+
* clamped to `min` and `max`.
|
|
25
|
+
*/
|
|
26
|
+
export function nextFocusedDate(current, key, modifiers, ctx) {
|
|
27
|
+
const rtl = ctx.direction === "rtl";
|
|
28
|
+
const columns = ctx.columns ?? 4;
|
|
29
|
+
const horizontal = key === "ArrowLeft"
|
|
30
|
+
? rtl
|
|
31
|
+
? 1
|
|
32
|
+
: -1
|
|
33
|
+
: key === "ArrowRight"
|
|
34
|
+
? rtl
|
|
35
|
+
? -1
|
|
36
|
+
: 1
|
|
37
|
+
: 0;
|
|
38
|
+
const vertical = key === "ArrowUp" ? -1 : key === "ArrowDown" ? 1 : 0;
|
|
39
|
+
const page = key === "PageUp" ? -1 : key === "PageDown" ? 1 : 0;
|
|
40
|
+
const forward = horizontal > 0 || vertical > 0 || page > 0 || key === "End";
|
|
41
|
+
const move = () => {
|
|
42
|
+
if (ctx.level === "day") {
|
|
43
|
+
if (horizontal)
|
|
44
|
+
return addDays(current, horizontal);
|
|
45
|
+
if (vertical)
|
|
46
|
+
return addDays(current, vertical * 7);
|
|
47
|
+
if (key === "Home")
|
|
48
|
+
return startOfWeek(current, ctx.weekStartsOn);
|
|
49
|
+
if (key === "End")
|
|
50
|
+
return endOfWeek(current, ctx.weekStartsOn);
|
|
51
|
+
return modifiers.shift
|
|
52
|
+
? addYears(current, page)
|
|
53
|
+
: addMonths(current, page);
|
|
54
|
+
}
|
|
55
|
+
if (ctx.level === "month") {
|
|
56
|
+
if (horizontal)
|
|
57
|
+
return addMonths(current, horizontal);
|
|
58
|
+
if (vertical)
|
|
59
|
+
return addMonths(current, vertical * columns);
|
|
60
|
+
if (key === "Home")
|
|
61
|
+
return plainDate(current.year, 1, current.day, {
|
|
62
|
+
overflow: "constrain",
|
|
63
|
+
});
|
|
64
|
+
if (key === "End")
|
|
65
|
+
return plainDate(current.year, 12, current.day, {
|
|
66
|
+
overflow: "constrain",
|
|
67
|
+
});
|
|
68
|
+
return addYears(current, modifiers.shift ? page * 10 : page);
|
|
69
|
+
}
|
|
70
|
+
if (horizontal)
|
|
71
|
+
return addYears(current, horizontal);
|
|
72
|
+
if (vertical)
|
|
73
|
+
return addYears(current, vertical * columns);
|
|
74
|
+
const decade = Math.floor(current.year / 10) * 10;
|
|
75
|
+
if (key === "Home")
|
|
76
|
+
return plainDate(Math.max(decade, 1), current.month, current.day, {
|
|
77
|
+
overflow: "constrain",
|
|
78
|
+
});
|
|
79
|
+
if (key === "End")
|
|
80
|
+
return plainDate(Math.min(decade + 9, 9999), current.month, current.day, {
|
|
81
|
+
overflow: "constrain",
|
|
82
|
+
});
|
|
83
|
+
return addYears(current, page * (modifiers.shift ? 100 : 10));
|
|
84
|
+
};
|
|
85
|
+
return clamp(safely(move, forward), ctx);
|
|
86
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { nextFocusedDate } from "./grid-navigation.js";
|
|
2
|
+
export type { GridNavContext, GridNavKey } from "./grid-navigation.js";
|
|
3
|
+
export { getDateLabel, getRangeLabel, getTimeLabel } from "./labels.js";
|
|
4
|
+
export type { LabelStatus } from "./labels.js";
|
|
5
|
+
export { defaultMessages, formatMessage, mergeMessages } from "./messages.js";
|
|
6
|
+
export { focusDateCell, focusPart, scrollOptionIntoView, syncRovingTabIndex, } from "./roving-focus.js";
|
|
7
|
+
export { announce } from "./announcer.js";
|
|
8
|
+
export type { Messages, TimeMessages } from "./messages.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { nextFocusedDate } from "./grid-navigation.js";
|
|
2
|
+
export { getDateLabel, getRangeLabel, getTimeLabel } from "./labels.js";
|
|
3
|
+
export { defaultMessages, formatMessage, mergeMessages } from "./messages.js";
|
|
4
|
+
export { focusDateCell, focusPart, scrollOptionIntoView, syncRovingTabIndex, } from "./roving-focus.js";
|
|
5
|
+
export { announce } from "./announcer.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DateRange } from "../ranges/date-range.js";
|
|
2
|
+
import type { PlainDate, PlainTime } from "../values/types.js";
|
|
3
|
+
import { type Messages } from "./messages.js";
|
|
4
|
+
export type LabelStatus = {
|
|
5
|
+
today?: boolean;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
unavailable?: boolean;
|
|
8
|
+
partiallyAvailable?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Extra wording, e.g. a blocked rule's reason (plan 11 V12). */
|
|
11
|
+
reason?: string;
|
|
12
|
+
rangeStart?: boolean;
|
|
13
|
+
rangeEnd?: boolean;
|
|
14
|
+
inRange?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** For example "Tuesday, November 17, 2026, today, selected". */
|
|
17
|
+
export declare function getDateLabel(date: PlainDate, locale: string | undefined, status?: LabelStatus, messages?: Messages): string;
|
|
18
|
+
/** For example "3:30 PM, selected". */
|
|
19
|
+
export declare function getTimeLabel(time: PlainTime, locale: string | undefined, status?: LabelStatus, messages?: Messages): string;
|
|
20
|
+
/** For example "November 17 – 20, 2026". */
|
|
21
|
+
export declare function getRangeLabel(range: DateRange, locale: string | undefined): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { formatDate, formatDateRange, formatTime } from "../locale/format.js";
|
|
2
|
+
import { defaultMessages } from "./messages.js";
|
|
3
|
+
const STATE_ORDER = [
|
|
4
|
+
"today",
|
|
5
|
+
"rangeStart",
|
|
6
|
+
"rangeEnd",
|
|
7
|
+
"inRange",
|
|
8
|
+
"selected",
|
|
9
|
+
"unavailable",
|
|
10
|
+
"partiallyAvailable",
|
|
11
|
+
"disabled",
|
|
12
|
+
];
|
|
13
|
+
function words(status, messages) {
|
|
14
|
+
const words = STATE_ORDER.filter((key) => status[key]).map((key) => messages[key]);
|
|
15
|
+
return status.reason ? [...words, status.reason] : words;
|
|
16
|
+
}
|
|
17
|
+
/** For example "Tuesday, November 17, 2026, today, selected". */
|
|
18
|
+
export function getDateLabel(date, locale, status = {}, messages = defaultMessages) {
|
|
19
|
+
const text = formatDate(date, locale, {
|
|
20
|
+
weekday: "long",
|
|
21
|
+
year: "numeric",
|
|
22
|
+
month: "long",
|
|
23
|
+
day: "numeric",
|
|
24
|
+
});
|
|
25
|
+
return [text, ...words(status, messages)].join(", ");
|
|
26
|
+
}
|
|
27
|
+
/** For example "3:30 PM, selected". */
|
|
28
|
+
export function getTimeLabel(time, locale, status = {}, messages = defaultMessages) {
|
|
29
|
+
const text = formatTime(time, locale, {
|
|
30
|
+
hour: "numeric",
|
|
31
|
+
minute: "2-digit",
|
|
32
|
+
second: time.second === 0 ? undefined : "2-digit",
|
|
33
|
+
});
|
|
34
|
+
return [text, ...words(status, messages)].join(", ");
|
|
35
|
+
}
|
|
36
|
+
/** For example "November 17 – 20, 2026". */
|
|
37
|
+
export function getRangeLabel(range, locale) {
|
|
38
|
+
return formatDateRange(range, locale, {
|
|
39
|
+
year: "numeric",
|
|
40
|
+
month: "long",
|
|
41
|
+
day: "numeric",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Words for states that `Intl` has no names for (D13). Only English ships. */
|
|
2
|
+
export type Messages = {
|
|
3
|
+
today: string;
|
|
4
|
+
selected: string;
|
|
5
|
+
unavailable: string;
|
|
6
|
+
partiallyAvailable: string;
|
|
7
|
+
disabled: string;
|
|
8
|
+
rangeStart: string;
|
|
9
|
+
rangeEnd: string;
|
|
10
|
+
inRange: string;
|
|
11
|
+
/** Accessible names for calendar controls. */
|
|
12
|
+
previous: string;
|
|
13
|
+
next: string;
|
|
14
|
+
goToToday: string;
|
|
15
|
+
calendar: string;
|
|
16
|
+
/** `{number}` is replaced by the week number. */
|
|
17
|
+
weekNumber: string;
|
|
18
|
+
hasEvents: string;
|
|
19
|
+
/** Event-related (plan 05 §2.6). */
|
|
20
|
+
events: string;
|
|
21
|
+
/** `{count}` is replaced by the number of hidden events. */
|
|
22
|
+
moreEvents: string;
|
|
23
|
+
allDay: string;
|
|
24
|
+
/** `{count}` is replaced by the event count of a cell. */
|
|
25
|
+
cellEvents: string;
|
|
26
|
+
/** `{range}` is replaced by the selected range label. */
|
|
27
|
+
selectionCreated: string;
|
|
28
|
+
selectionCancelled: string;
|
|
29
|
+
eventSelected: string;
|
|
30
|
+
/** One of a recurring series (plan 12). */
|
|
31
|
+
recurring: string;
|
|
32
|
+
/** Editing events (plan 09). `{event}` and `{range}` are replaced. */
|
|
33
|
+
editInstructions: string;
|
|
34
|
+
moving: string;
|
|
35
|
+
resizing: string;
|
|
36
|
+
movedTo: string;
|
|
37
|
+
resizedTo: string;
|
|
38
|
+
changeCancelled: string;
|
|
39
|
+
notAllowedHere: string;
|
|
40
|
+
/** Date panels and inputs (plan 06). */
|
|
41
|
+
chooseMonth: string;
|
|
42
|
+
chooseYear: string;
|
|
43
|
+
clear: string;
|
|
44
|
+
startDate: string;
|
|
45
|
+
endDate: string;
|
|
46
|
+
/** `{count}` is replaced by the number of selected dates. */
|
|
47
|
+
selectedCount: string;
|
|
48
|
+
placeholderDay: string;
|
|
49
|
+
placeholderMonth: string;
|
|
50
|
+
placeholderYear: string;
|
|
51
|
+
day: string;
|
|
52
|
+
month: string;
|
|
53
|
+
year: string;
|
|
54
|
+
empty: string;
|
|
55
|
+
/** Time inputs and panels (plan 07). */
|
|
56
|
+
placeholderHour: string;
|
|
57
|
+
placeholderMinute: string;
|
|
58
|
+
placeholderSecond: string;
|
|
59
|
+
placeholderDayPeriod: string;
|
|
60
|
+
hour: string;
|
|
61
|
+
minute: string;
|
|
62
|
+
second: string;
|
|
63
|
+
dayPeriod: string;
|
|
64
|
+
startTime: string;
|
|
65
|
+
endTime: string;
|
|
66
|
+
time: string;
|
|
67
|
+
/** Date-time inputs and panels (plan 08). */
|
|
68
|
+
date: string;
|
|
69
|
+
/** The note for a wall time moved by a daylight-saving gap. */
|
|
70
|
+
adjustedTime: string;
|
|
71
|
+
timeZone: string;
|
|
72
|
+
startDateTime: string;
|
|
73
|
+
endDateTime: string;
|
|
74
|
+
};
|
|
75
|
+
/** The same flat type serves every domain. */
|
|
76
|
+
export type TimeMessages = Messages;
|
|
77
|
+
export declare const defaultMessages: Readonly<Messages>;
|
|
78
|
+
/** Replace `{name}` placeholders in a message template. */
|
|
79
|
+
export declare function formatMessage(template: string, values: Readonly<Record<string, string | number>>): string;
|
|
80
|
+
export declare function mergeMessages(defaults: Readonly<Messages>, overrides?: Partial<Messages>): Messages;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const defaultMessages = Object.freeze({
|
|
2
|
+
today: "today",
|
|
3
|
+
selected: "selected",
|
|
4
|
+
unavailable: "unavailable",
|
|
5
|
+
partiallyAvailable: "partially available",
|
|
6
|
+
disabled: "disabled",
|
|
7
|
+
rangeStart: "range start",
|
|
8
|
+
rangeEnd: "range end",
|
|
9
|
+
inRange: "in range",
|
|
10
|
+
previous: "Previous",
|
|
11
|
+
next: "Next",
|
|
12
|
+
goToToday: "Today",
|
|
13
|
+
calendar: "Calendar",
|
|
14
|
+
weekNumber: "Week {number}",
|
|
15
|
+
hasEvents: "has events",
|
|
16
|
+
events: "events",
|
|
17
|
+
moreEvents: "{count} more events",
|
|
18
|
+
allDay: "All day",
|
|
19
|
+
cellEvents: "{count} events",
|
|
20
|
+
selectionCreated: "Selected {range}",
|
|
21
|
+
selectionCancelled: "Selection cancelled",
|
|
22
|
+
eventSelected: "Event selected",
|
|
23
|
+
recurring: "recurring event",
|
|
24
|
+
editInstructions: "Press M to move, R to resize",
|
|
25
|
+
moving: "Moving {event}, {range}",
|
|
26
|
+
resizing: "Resizing {event}, {range}",
|
|
27
|
+
movedTo: "Moved to {range}",
|
|
28
|
+
resizedTo: "Resized to {range}",
|
|
29
|
+
changeCancelled: "Change cancelled",
|
|
30
|
+
notAllowedHere: "Not allowed here",
|
|
31
|
+
chooseMonth: "Choose month",
|
|
32
|
+
chooseYear: "Choose year",
|
|
33
|
+
clear: "Clear",
|
|
34
|
+
startDate: "Start date",
|
|
35
|
+
endDate: "End date",
|
|
36
|
+
selectedCount: "{count} dates selected",
|
|
37
|
+
placeholderDay: "dd",
|
|
38
|
+
placeholderMonth: "mm",
|
|
39
|
+
placeholderYear: "yyyy",
|
|
40
|
+
day: "Day",
|
|
41
|
+
month: "Month",
|
|
42
|
+
year: "Year",
|
|
43
|
+
empty: "Empty",
|
|
44
|
+
placeholderHour: "hh",
|
|
45
|
+
placeholderMinute: "mm",
|
|
46
|
+
placeholderSecond: "ss",
|
|
47
|
+
placeholderDayPeriod: "--",
|
|
48
|
+
hour: "Hour",
|
|
49
|
+
minute: "Minute",
|
|
50
|
+
second: "Second",
|
|
51
|
+
dayPeriod: "AM/PM",
|
|
52
|
+
startTime: "Start time",
|
|
53
|
+
endTime: "End time",
|
|
54
|
+
time: "Time",
|
|
55
|
+
date: "Date",
|
|
56
|
+
adjustedTime: "adjusted for daylight saving time",
|
|
57
|
+
timeZone: "Time zone",
|
|
58
|
+
startDateTime: "Start date and time",
|
|
59
|
+
endDateTime: "End date and time",
|
|
60
|
+
});
|
|
61
|
+
/** Replace `{name}` placeholders in a message template. */
|
|
62
|
+
export function formatMessage(template, values) {
|
|
63
|
+
return template.replace(/\{(\w+)\}/g, (match, key) => key in values ? String(values[key]) : match);
|
|
64
|
+
}
|
|
65
|
+
export function mergeMessages(defaults, overrides) {
|
|
66
|
+
const merged = { ...defaults };
|
|
67
|
+
for (const key of Object.keys(overrides ?? {})) {
|
|
68
|
+
const value = overrides?.[key];
|
|
69
|
+
if (value !== undefined) {
|
|
70
|
+
merged[key] = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return merged;
|
|
74
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PlainDate } from "../values/types.js";
|
|
2
|
+
type DateKey = PlainDate | string;
|
|
3
|
+
/**
|
|
4
|
+
* Move DOM focus to the cell carrying `data-chrono-key`. Call it from
|
|
5
|
+
* lifecycle code only (an effect), never during render. Returns `false` when
|
|
6
|
+
* the cell is not rendered.
|
|
7
|
+
*/
|
|
8
|
+
export declare function focusDateCell(container: ParentNode, date: DateKey): boolean;
|
|
9
|
+
/** Roving tabindex: only the focused cell is a tab stop. */
|
|
10
|
+
export declare function syncRovingTabIndex(container: ParentNode, focused: DateKey): void;
|
|
11
|
+
/** Move DOM focus to the input segment carrying `data-chrono-part` (plan 06 A10). */
|
|
12
|
+
export declare function focusPart(container: ParentNode, part: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Keep an option inside its scrolling listbox (plan 07 T15, R7). DOM behavior, not
|
|
15
|
+
* styling; never throws where `scrollIntoView` or its options form is missing.
|
|
16
|
+
*/
|
|
17
|
+
export declare function scrollOptionIntoView(element: Element | null): void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { toIsoString } from "../values/iso.js";
|
|
2
|
+
const keyOf = (value) => typeof value === "string" ? value : toIsoString(value);
|
|
3
|
+
const escapeAttribute = (key) => key.replace(/["\\]/g, "\\$&");
|
|
4
|
+
function findCell(container, key) {
|
|
5
|
+
const selector = `[data-chrono-key="${escapeAttribute(key)}"]`;
|
|
6
|
+
return (container.querySelector(`${selector}:not([data-outside-month])`) ?? container.querySelector(selector));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Move DOM focus to the cell carrying `data-chrono-key`. Call it from
|
|
10
|
+
* lifecycle code only (an effect), never during render. Returns `false` when
|
|
11
|
+
* the cell is not rendered.
|
|
12
|
+
*/
|
|
13
|
+
export function focusDateCell(container, date) {
|
|
14
|
+
const cell = findCell(container, keyOf(date));
|
|
15
|
+
if (!cell) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
cell.focus();
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
/** Roving tabindex: only the focused cell is a tab stop. */
|
|
22
|
+
export function syncRovingTabIndex(container, focused) {
|
|
23
|
+
const key = keyOf(focused);
|
|
24
|
+
const target = findCell(container, key);
|
|
25
|
+
for (const cell of container.querySelectorAll("[data-chrono-key]")) {
|
|
26
|
+
cell.tabIndex = cell === target ? 0 : -1;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Move DOM focus to the input segment carrying `data-chrono-part` (plan 06 A10). */
|
|
30
|
+
export function focusPart(container, part) {
|
|
31
|
+
const element = container.querySelector(`[data-chrono-part="${escapeAttribute(part)}"]`);
|
|
32
|
+
if (!element) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
element.focus();
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Keep an option inside its scrolling listbox (plan 07 T15, R7). DOM behavior, not
|
|
40
|
+
* styling; never throws where `scrollIntoView` or its options form is missing.
|
|
41
|
+
*/
|
|
42
|
+
export function scrollOptionIntoView(element) {
|
|
43
|
+
if (!element || typeof element.scrollIntoView !== "function") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
element.scrollIntoView({ block: "nearest" });
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
element.scrollIntoView();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { DayOfWeek, PlainDate } from "../values/types.js";
|
|
2
|
+
/** Fields every rule may carry (plan 11 V2). */
|
|
3
|
+
export type AvailabilityRuleMeta = {
|
|
4
|
+
id?: string;
|
|
5
|
+
/** Human wording for "why" (plan 11 V12). */
|
|
6
|
+
reason?: string;
|
|
7
|
+
/** App data; never serialized into the DOM (plan 11 R7). */
|
|
8
|
+
data?: unknown;
|
|
9
|
+
resourceId?: string | readonly string[];
|
|
10
|
+
};
|
|
11
|
+
export type DailyAvailabilityRule = AvailabilityRuleMeta & {
|
|
12
|
+
type: "daily";
|
|
13
|
+
/** `"09:00"` or `"09:00:00"`; `"24:00"` is allowed for `end`. */
|
|
14
|
+
start: string;
|
|
15
|
+
end: string;
|
|
16
|
+
};
|
|
17
|
+
export type WeeklyAvailabilityRule = AvailabilityRuleMeta & {
|
|
18
|
+
type: "weekly";
|
|
19
|
+
days: readonly DayOfWeek[];
|
|
20
|
+
/** Defaults to `"00:00"`. */
|
|
21
|
+
start?: string;
|
|
22
|
+
/** Defaults to `"24:00"` (the whole day). */
|
|
23
|
+
end?: string;
|
|
24
|
+
};
|
|
25
|
+
export type DatesAvailabilityRule = AvailabilityRuleMeta & {
|
|
26
|
+
type: "dates";
|
|
27
|
+
dates: readonly (PlainDate | string)[];
|
|
28
|
+
start?: string;
|
|
29
|
+
end?: string;
|
|
30
|
+
};
|
|
31
|
+
export type RangeAvailabilityRule = AvailabilityRuleMeta & {
|
|
32
|
+
type: "range";
|
|
33
|
+
/** A date (whole days, half-open) or a date-time (half-open over wall time). */
|
|
34
|
+
start: PlainDate | string;
|
|
35
|
+
end: PlainDate | string;
|
|
36
|
+
};
|
|
37
|
+
export type AvailabilityRule = DailyAvailabilityRule | WeeklyAvailabilityRule | DatesAvailabilityRule | RangeAvailabilityRule;
|
|
38
|
+
/** A rule whose `dates` are already `PlainDate` values. */
|
|
39
|
+
export type NormalizedAvailabilityRule = Exclude<AvailabilityRule, DatesAvailabilityRule> | (Omit<DatesAvailabilityRule, "dates"> & {
|
|
40
|
+
dates: readonly PlainDate[];
|
|
41
|
+
});
|
|
42
|
+
/** Seconds since local midnight for a `"HH:mm"` or `"HH:mm:ss"` token. `"24:00"` is 86400. */
|
|
43
|
+
export declare function timeTokenToSeconds(token: string): number;
|
|
44
|
+
/** Normalize `dates` (strings or values) once, at compile time. */
|
|
45
|
+
export declare function normalizeRule(rule: AvailabilityRule): NormalizedAvailabilityRule;
|
|
46
|
+
/** Whether a rule applies to `resourceId` (rules without one apply to everything). */
|
|
47
|
+
export declare function ruleMatchesResource(rule: AvailabilityRule, resourceId: string | undefined): boolean;
|
|
48
|
+
/** The wall-time window of a day-scoped rule on `day`, as instants in `zone`. */
|
|
49
|
+
export declare function expandRuleDay(rule: Exclude<AvailabilityRule, RangeAvailabilityRule>, day: PlainDate, zone: string): {
|
|
50
|
+
start: number;
|
|
51
|
+
end: number;
|
|
52
|
+
};
|