@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,185 @@
|
|
|
1
|
+
import { createControllable, createId, getHiddenInputs, isSameTime, } from "../../foundation/index.js";
|
|
2
|
+
import { checkTimeRangeValue, } from "../selection/range.js";
|
|
3
|
+
import { createTimeInputController, } from "./time-input-controller.js";
|
|
4
|
+
import { isTimeInvalid } from "./validity.js";
|
|
5
|
+
const same = (a, b) => a === b || (a !== null && b !== null && isSameTime(a, b));
|
|
6
|
+
const sameRange = (a, b) => a === b ||
|
|
7
|
+
(a !== null && b !== null && same(a.start, b.start) && same(a.end, b.end));
|
|
8
|
+
const iso = (time, seconds) => time
|
|
9
|
+
? `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}${seconds ? `:${String(time.second).padStart(2, "0")}` : ""}`
|
|
10
|
+
: null;
|
|
11
|
+
export function createTimeRangeInputController(initial = {}) {
|
|
12
|
+
let options = initial;
|
|
13
|
+
const id = options.id ?? createId("chrono-time-range-input");
|
|
14
|
+
const control = createControllable({
|
|
15
|
+
value: options.value,
|
|
16
|
+
defaultValue: options.defaultValue ?? null,
|
|
17
|
+
onChange: (value) => options.onValueChange?.(value),
|
|
18
|
+
equals: sameRange,
|
|
19
|
+
});
|
|
20
|
+
let lastCommitted = control.get();
|
|
21
|
+
const childOptions = () => {
|
|
22
|
+
const { value: _v, defaultValue: _d, onValueChange: _c, onValueCommit: _m, name: _n, startName: _s, endName: _e, allowOvernight: _o, minDuration: _a, maxDuration: _b, ...shared } = options;
|
|
23
|
+
return shared;
|
|
24
|
+
};
|
|
25
|
+
const combine = (start, end) => start === null && end === null ? null : { start, end };
|
|
26
|
+
const setSide = (side, value) => {
|
|
27
|
+
const current = control.get();
|
|
28
|
+
control.set(combine(side === "start" ? value : (current?.start ?? null), side === "end" ? value : (current?.end ?? null)));
|
|
29
|
+
propagate();
|
|
30
|
+
refresh();
|
|
31
|
+
};
|
|
32
|
+
const startController = createTimeInputController({
|
|
33
|
+
...childOptions(),
|
|
34
|
+
id: `${id}-start`,
|
|
35
|
+
value: control.get()?.start ?? null,
|
|
36
|
+
defaultValue: undefined,
|
|
37
|
+
onValueChange: (value) => setSide("start", value),
|
|
38
|
+
});
|
|
39
|
+
const endController = createTimeInputController({
|
|
40
|
+
...childOptions(),
|
|
41
|
+
id: `${id}-end`,
|
|
42
|
+
value: control.get()?.end ?? null,
|
|
43
|
+
defaultValue: undefined,
|
|
44
|
+
onValueChange: (value) => setSide("end", value),
|
|
45
|
+
});
|
|
46
|
+
function propagate() {
|
|
47
|
+
const value = control.get();
|
|
48
|
+
startController.setOptions({ value: value?.start ?? null });
|
|
49
|
+
endController.setOptions({ value: value?.end ?? null });
|
|
50
|
+
}
|
|
51
|
+
let state;
|
|
52
|
+
const listeners = new Set();
|
|
53
|
+
const limits = () => ({
|
|
54
|
+
allowOvernight: options.allowOvernight,
|
|
55
|
+
minDuration: options.minDuration,
|
|
56
|
+
maxDuration: options.maxDuration,
|
|
57
|
+
});
|
|
58
|
+
const compute = () => {
|
|
59
|
+
const start = startController.getState();
|
|
60
|
+
const end = endController.getState();
|
|
61
|
+
let validity;
|
|
62
|
+
let duration = null;
|
|
63
|
+
let crossesMidnight = false;
|
|
64
|
+
if (start.validity === "empty" && end.validity === "empty")
|
|
65
|
+
validity = "empty";
|
|
66
|
+
else if (start.validity !== "valid" && start.validity !== "empty")
|
|
67
|
+
validity = start.validity;
|
|
68
|
+
else if (end.validity !== "valid" && end.validity !== "empty")
|
|
69
|
+
validity = end.validity;
|
|
70
|
+
else if (start.validity === "empty" || end.validity === "empty")
|
|
71
|
+
validity = "incomplete";
|
|
72
|
+
else {
|
|
73
|
+
const check = checkTimeRangeValue(start.value, end.value, limits());
|
|
74
|
+
if (check.valid) {
|
|
75
|
+
validity = "valid";
|
|
76
|
+
duration = check.duration;
|
|
77
|
+
crossesMidnight = check.crossesMidnight;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
validity = check.reason === "start-invalid" ? "disabled" : check.reason;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const value = control.get();
|
|
84
|
+
const seconds = start.granularity === "second";
|
|
85
|
+
const name = options.name;
|
|
86
|
+
return {
|
|
87
|
+
id,
|
|
88
|
+
value,
|
|
89
|
+
validity,
|
|
90
|
+
start,
|
|
91
|
+
end,
|
|
92
|
+
duration,
|
|
93
|
+
crossesMidnight,
|
|
94
|
+
disabled: start.disabled,
|
|
95
|
+
readOnly: start.readOnly,
|
|
96
|
+
hidden: getHiddenInputs([
|
|
97
|
+
[
|
|
98
|
+
options.startName ?? (name ? `${name}-start` : undefined),
|
|
99
|
+
iso(value?.start, seconds),
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
options.endName ?? (name ? `${name}-end` : undefined),
|
|
103
|
+
iso(value?.end, seconds),
|
|
104
|
+
],
|
|
105
|
+
]),
|
|
106
|
+
messages: start.messages,
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
const refresh = () => {
|
|
110
|
+
const next = compute();
|
|
111
|
+
if (state && JSON.stringify(state) === JSON.stringify(next))
|
|
112
|
+
return;
|
|
113
|
+
state = next;
|
|
114
|
+
for (const listener of [...listeners])
|
|
115
|
+
listener(state);
|
|
116
|
+
};
|
|
117
|
+
state = compute();
|
|
118
|
+
startController.subscribe(refresh);
|
|
119
|
+
endController.subscribe(refresh);
|
|
120
|
+
const controller = {
|
|
121
|
+
getState: () => state,
|
|
122
|
+
subscribe(listener) {
|
|
123
|
+
listeners.add(listener);
|
|
124
|
+
return () => {
|
|
125
|
+
listeners.delete(listener);
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
setOptions(next) {
|
|
129
|
+
options = { ...options, ...next };
|
|
130
|
+
control.sync({ value: options.value });
|
|
131
|
+
const shared = childOptions();
|
|
132
|
+
startController.setOptions({
|
|
133
|
+
...shared,
|
|
134
|
+
value: control.get()?.start ?? null,
|
|
135
|
+
});
|
|
136
|
+
endController.setOptions({
|
|
137
|
+
...shared,
|
|
138
|
+
value: control.get()?.end ?? null,
|
|
139
|
+
});
|
|
140
|
+
refresh();
|
|
141
|
+
},
|
|
142
|
+
getStart: () => startController,
|
|
143
|
+
getEnd: () => endController,
|
|
144
|
+
commit() {
|
|
145
|
+
const value = control.get();
|
|
146
|
+
if (state.validity === "valid" &&
|
|
147
|
+
value?.start &&
|
|
148
|
+
value.end &&
|
|
149
|
+
!sameRange(value, lastCommitted)) {
|
|
150
|
+
lastCommitted = value;
|
|
151
|
+
options.onValueCommit?.({ start: value.start, end: value.end });
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
clear() {
|
|
155
|
+
startController.clear();
|
|
156
|
+
endController.clear();
|
|
157
|
+
lastCommitted = null;
|
|
158
|
+
},
|
|
159
|
+
reset() {
|
|
160
|
+
const value = options.defaultValue ?? null;
|
|
161
|
+
control.set(value);
|
|
162
|
+
propagate();
|
|
163
|
+
startController.reset();
|
|
164
|
+
endController.reset();
|
|
165
|
+
lastCommitted = value;
|
|
166
|
+
refresh();
|
|
167
|
+
},
|
|
168
|
+
getRootAttributes: () => ({
|
|
169
|
+
role: "group",
|
|
170
|
+
"data-chrono-time-range-input": true,
|
|
171
|
+
"data-mode": state.start.mode,
|
|
172
|
+
"data-disabled": state.disabled,
|
|
173
|
+
"data-readonly": state.readOnly,
|
|
174
|
+
"data-invalid": isTimeInvalid(state.validity),
|
|
175
|
+
"aria-disabled": state.disabled ? "true" : undefined,
|
|
176
|
+
dir: state.start.direction,
|
|
177
|
+
}),
|
|
178
|
+
destroy() {
|
|
179
|
+
listeners.clear();
|
|
180
|
+
startController.destroy();
|
|
181
|
+
endController.destroy();
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
return controller;
|
|
185
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PlainTime, type TimeConstraints } from "../../foundation/index.js";
|
|
2
|
+
export type TimeValidity = "empty" | "incomplete" | "valid" | "before-min" | "after-max" | "disabled" | "unavailable" | "off-step";
|
|
3
|
+
/** `filled` is how many of the `required` parts hold a value. */
|
|
4
|
+
export declare function getTimeValidity(filled: number, required: number, time: PlainTime | null, constraints: TimeConstraints & {
|
|
5
|
+
isTimeUnavailable?: (time: PlainTime) => boolean;
|
|
6
|
+
}): TimeValidity;
|
|
7
|
+
export declare const isTimeInvalid: (validity: string) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getTimeStatus, } from "../../foundation/index.js";
|
|
2
|
+
/** `filled` is how many of the `required` parts hold a value. */
|
|
3
|
+
export function getTimeValidity(filled, required, time, constraints) {
|
|
4
|
+
if (filled === 0)
|
|
5
|
+
return "empty";
|
|
6
|
+
if (filled < required || !time)
|
|
7
|
+
return "incomplete";
|
|
8
|
+
const status = getTimeStatus(time, constraints);
|
|
9
|
+
if (!status.selectable) {
|
|
10
|
+
return status.reason === "disabled-range" || status.reason === "disabled"
|
|
11
|
+
? "disabled"
|
|
12
|
+
: status.reason;
|
|
13
|
+
}
|
|
14
|
+
return constraints.isTimeUnavailable?.(time) ? "unavailable" : "valid";
|
|
15
|
+
}
|
|
16
|
+
export const isTimeInvalid = (validity) => validity !== "valid" && validity !== "empty";
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { type Attributes, type Availability, type AvailabilitySpec, type Messages, type PlainTime, type TimeInput } from "../../foundation/index.js";
|
|
2
|
+
import { type TimeRangeInvalidReason } from "../selection/range.js";
|
|
3
|
+
import { type BookingSlot, type BookingSlotInput } from "../selection/slots.js";
|
|
4
|
+
import type { HourCycle, TimeGranularity, TimePartName, TimeRangeValue, TimeValue } from "../types.js";
|
|
5
|
+
export type TimePanelModifiers = {
|
|
6
|
+
shift: boolean;
|
|
7
|
+
ctrl: boolean;
|
|
8
|
+
meta: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type TimePanelKind = "single" | "range";
|
|
11
|
+
export type TimePanelBaseOptions = {
|
|
12
|
+
id?: string;
|
|
13
|
+
granularity?: TimeGranularity;
|
|
14
|
+
hourCycle?: HourCycle;
|
|
15
|
+
step?: {
|
|
16
|
+
minutes?: number;
|
|
17
|
+
seconds?: number;
|
|
18
|
+
};
|
|
19
|
+
/** List layout: first entry (default 00:00). */
|
|
20
|
+
start?: TimeInput;
|
|
21
|
+
/** List layout: exclusive end (default end of day). */
|
|
22
|
+
end?: TimeInput;
|
|
23
|
+
/** Minutes: each entry becomes a slot `[start, start + slotDuration)`. */
|
|
24
|
+
slotDuration?: number;
|
|
25
|
+
slots?: readonly BookingSlotInput[];
|
|
26
|
+
groupBy?: false | "hour" | "dayPeriod" | ((time: PlainTime) => {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
});
|
|
30
|
+
min?: TimeInput;
|
|
31
|
+
max?: TimeInput;
|
|
32
|
+
disabledRanges?: readonly {
|
|
33
|
+
start: TimeInput;
|
|
34
|
+
end: TimeInput;
|
|
35
|
+
}[];
|
|
36
|
+
isTimeDisabled?: (time: PlainTime) => boolean;
|
|
37
|
+
isTimeUnavailable?: (time: PlainTime) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Availability model (plan 11 V6, V8). Time-only components use `daily`
|
|
40
|
+
* rules only; other rule types are ignored with a development warning.
|
|
41
|
+
*/
|
|
42
|
+
availability?: AvailabilitySpec | Availability;
|
|
43
|
+
scrollToSelected?: boolean;
|
|
44
|
+
autoFocus?: boolean;
|
|
45
|
+
readOnly?: boolean;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
locale?: string;
|
|
48
|
+
timeZone?: string;
|
|
49
|
+
now?: number;
|
|
50
|
+
messages?: Partial<Messages>;
|
|
51
|
+
/** Clock for type-ahead (milliseconds). Default `Date.now`. */
|
|
52
|
+
timer?: () => number;
|
|
53
|
+
};
|
|
54
|
+
export type TimePanelOptions = TimePanelBaseOptions & {
|
|
55
|
+
layout?: "columns" | "list";
|
|
56
|
+
value?: TimeValue;
|
|
57
|
+
defaultValue?: TimeValue;
|
|
58
|
+
onValueChange?: (value: TimeValue, info: {
|
|
59
|
+
slot?: BookingSlot;
|
|
60
|
+
}) => void;
|
|
61
|
+
onValueCommit?: (value: PlainTime, info: {
|
|
62
|
+
slot?: BookingSlot;
|
|
63
|
+
}) => void;
|
|
64
|
+
};
|
|
65
|
+
export type TimeRangePanelOptions = TimePanelBaseOptions & {
|
|
66
|
+
layout?: "list" | "columns";
|
|
67
|
+
value?: TimeRangeValue;
|
|
68
|
+
defaultValue?: TimeRangeValue;
|
|
69
|
+
onValueChange?: (value: TimeRangeValue) => void;
|
|
70
|
+
onValueCommit?: (value: {
|
|
71
|
+
start: PlainTime;
|
|
72
|
+
end: PlainTime;
|
|
73
|
+
}) => void;
|
|
74
|
+
onRangePreviewChange?: (preview: {
|
|
75
|
+
start: PlainTime;
|
|
76
|
+
end: PlainTime;
|
|
77
|
+
} | null) => void;
|
|
78
|
+
onInvalidRange?: (reason: TimeRangeInvalidReason) => void;
|
|
79
|
+
allowOvernight?: boolean;
|
|
80
|
+
/** Minutes. */
|
|
81
|
+
minDuration?: number;
|
|
82
|
+
maxDuration?: number;
|
|
83
|
+
};
|
|
84
|
+
export type TimePanelOptionState = {
|
|
85
|
+
key: string;
|
|
86
|
+
text: string;
|
|
87
|
+
label: string;
|
|
88
|
+
/** Columns: the part value; list: seconds since midnight of the start. */
|
|
89
|
+
value: number;
|
|
90
|
+
selected: boolean;
|
|
91
|
+
disabled: boolean;
|
|
92
|
+
unavailable: boolean;
|
|
93
|
+
focused: boolean;
|
|
94
|
+
now: boolean;
|
|
95
|
+
rangeStart: boolean;
|
|
96
|
+
rangeEnd: boolean;
|
|
97
|
+
inRange: boolean;
|
|
98
|
+
preview: boolean;
|
|
99
|
+
blocked: boolean;
|
|
100
|
+
};
|
|
101
|
+
export type TimePanelColumnState = {
|
|
102
|
+
key: string;
|
|
103
|
+
part: TimePartName;
|
|
104
|
+
label: string;
|
|
105
|
+
options: TimePanelOptionState[];
|
|
106
|
+
};
|
|
107
|
+
export type TimePanelSetState = {
|
|
108
|
+
key: "value" | "start" | "end";
|
|
109
|
+
label: string;
|
|
110
|
+
columns: TimePanelColumnState[];
|
|
111
|
+
};
|
|
112
|
+
export type TimePanelGroupState = {
|
|
113
|
+
key: string;
|
|
114
|
+
label: string;
|
|
115
|
+
options: TimePanelOptionState[];
|
|
116
|
+
};
|
|
117
|
+
export type TimePanelState = {
|
|
118
|
+
id: string;
|
|
119
|
+
kind: TimePanelKind;
|
|
120
|
+
layout: "columns" | "list";
|
|
121
|
+
value: TimeValue | TimeRangeValue;
|
|
122
|
+
draft: boolean;
|
|
123
|
+
preview: {
|
|
124
|
+
start: PlainTime;
|
|
125
|
+
end: PlainTime;
|
|
126
|
+
} | null;
|
|
127
|
+
sets: TimePanelSetState[];
|
|
128
|
+
groups: TimePanelGroupState[];
|
|
129
|
+
focusKey: string;
|
|
130
|
+
crossesMidnight: boolean;
|
|
131
|
+
/** Minutes of a complete range. */
|
|
132
|
+
duration: number | null;
|
|
133
|
+
readOnly: boolean;
|
|
134
|
+
disabled: boolean;
|
|
135
|
+
autoFocus: boolean;
|
|
136
|
+
scrollToSelected: boolean;
|
|
137
|
+
direction: "ltr" | "rtl";
|
|
138
|
+
locale?: string;
|
|
139
|
+
messages: Messages;
|
|
140
|
+
};
|
|
141
|
+
export type TimePanelController<V, O> = {
|
|
142
|
+
getState(): TimePanelState;
|
|
143
|
+
subscribe(listener: (state: TimePanelState) => void): () => void;
|
|
144
|
+
setOptions(options: Partial<O>): void;
|
|
145
|
+
getValue(): V;
|
|
146
|
+
getSlot(key: string): BookingSlot | undefined;
|
|
147
|
+
pick(key: string, source: "pointer" | "keyboard"): void;
|
|
148
|
+
setPreview(key: string | null): void;
|
|
149
|
+
cancelDraft(): void;
|
|
150
|
+
clear(): void;
|
|
151
|
+
commit(): void;
|
|
152
|
+
focusOption(key: string): void;
|
|
153
|
+
handleKeyDown(key: string, modifiers: TimePanelModifiers): boolean;
|
|
154
|
+
getRootAttributes(): Attributes;
|
|
155
|
+
getSetAttributes(set: TimePanelSetState): Attributes;
|
|
156
|
+
getColumnAttributes(column: TimePanelColumnState): Attributes;
|
|
157
|
+
getGroupAttributes(group: TimePanelGroupState): Attributes;
|
|
158
|
+
getListAttributes(): Attributes;
|
|
159
|
+
getOptionAttributes(option: TimePanelOptionState): Attributes;
|
|
160
|
+
destroy(): void;
|
|
161
|
+
};
|
|
162
|
+
export declare const createTimePanelController: (options?: TimePanelOptions) => TimePanelController<TimeValue, TimePanelOptions>;
|
|
163
|
+
export declare const createTimeRangePanelController: (options?: TimeRangePanelOptions) => TimePanelController<TimeRangeValue, TimeRangePanelOptions>;
|