@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,155 @@
|
|
|
1
|
+
import { civilFromDays, daysFromCivil, floorDiv, MAX_YEAR, MIN_YEAR, } from "./epoch-day.js";
|
|
2
|
+
import { plainDateTime, wallSeconds } from "./plain-date-time.js";
|
|
3
|
+
import { fromSecondOfDay } from "./plain-time.js";
|
|
4
|
+
import { fromEpochDay, plainDate } from "./plain-date.js";
|
|
5
|
+
const DAY_SECONDS = 86400;
|
|
6
|
+
const OFFSET_ID = /^([+-])(\d{2}):?(\d{2})$/;
|
|
7
|
+
const formatters = new Map();
|
|
8
|
+
/** Minutes east of UTC for a fixed-offset id such as `+05:30`, else `null`. */
|
|
9
|
+
export function parseOffsetId(id) {
|
|
10
|
+
const match = OFFSET_ID.exec(id);
|
|
11
|
+
if (!match) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const hours = Number(match[2]);
|
|
15
|
+
const minutes = Number(match[3]);
|
|
16
|
+
if (hours > 23 || minutes > 59) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (match[1] === "-" ? -1 : 1) * (hours * 60 + minutes);
|
|
20
|
+
}
|
|
21
|
+
function getFormatter(timeZone) {
|
|
22
|
+
let formatter = formatters.get(timeZone);
|
|
23
|
+
if (!formatter) {
|
|
24
|
+
formatter = new Intl.DateTimeFormat("en-US", {
|
|
25
|
+
timeZone,
|
|
26
|
+
calendar: "gregory",
|
|
27
|
+
hourCycle: "h23",
|
|
28
|
+
year: "numeric",
|
|
29
|
+
month: "numeric",
|
|
30
|
+
day: "numeric",
|
|
31
|
+
hour: "numeric",
|
|
32
|
+
minute: "numeric",
|
|
33
|
+
second: "numeric",
|
|
34
|
+
});
|
|
35
|
+
formatters.set(timeZone, formatter);
|
|
36
|
+
}
|
|
37
|
+
return formatter;
|
|
38
|
+
}
|
|
39
|
+
/** `true` for an IANA zone id the runtime knows, or a fixed offset such as `+05:30`. */
|
|
40
|
+
export function isValidTimeZone(timeZone) {
|
|
41
|
+
if (typeof timeZone !== "string" || timeZone === "") {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (parseOffsetId(timeZone) !== null) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
getFormatter(timeZone);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function assertTimeZone(timeZone) {
|
|
56
|
+
if (!isValidTimeZone(timeZone)) {
|
|
57
|
+
throw new RangeError(`Unknown time zone "${timeZone}".`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Offset of `timeZone` at an instant, in minutes east of UTC. Historical
|
|
62
|
+
* offsets with seconds (pre-1900 local mean time) are rounded to the minute.
|
|
63
|
+
*/
|
|
64
|
+
export function getOffset(epochMs, timeZone) {
|
|
65
|
+
const fixed = parseOffsetId(timeZone);
|
|
66
|
+
if (fixed !== null) {
|
|
67
|
+
return fixed;
|
|
68
|
+
}
|
|
69
|
+
// UTC never shifts; skip the Intl round-trip on the common fixed-zone path.
|
|
70
|
+
if (timeZone === "UTC" || timeZone === "Etc/UTC") {
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
assertTimeZone(timeZone);
|
|
74
|
+
const values = {};
|
|
75
|
+
for (const part of getFormatter(timeZone).formatToParts(epochMs)) {
|
|
76
|
+
if (part.type !== "literal") {
|
|
77
|
+
values[part.type] = Number(part.value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const days = daysFromCivil(values.year ?? 1970, values.month ?? 1, values.day ?? 1);
|
|
81
|
+
const wall = days * DAY_SECONDS +
|
|
82
|
+
((values.hour ?? 0) % 24) * 3600 +
|
|
83
|
+
(values.minute ?? 0) * 60 +
|
|
84
|
+
(values.second ?? 0);
|
|
85
|
+
return Math.round((wall - Math.floor(epochMs / 1000)) / 60);
|
|
86
|
+
}
|
|
87
|
+
function build(dateTime, timeZone, offset) {
|
|
88
|
+
return Object.freeze({
|
|
89
|
+
calendar: "gregory",
|
|
90
|
+
year: dateTime.year,
|
|
91
|
+
month: dateTime.month,
|
|
92
|
+
day: dateTime.day,
|
|
93
|
+
hour: dateTime.hour,
|
|
94
|
+
minute: dateTime.minute,
|
|
95
|
+
second: dateTime.second,
|
|
96
|
+
timeZone,
|
|
97
|
+
offset,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** The instant (epoch milliseconds) a zoned value points at. */
|
|
101
|
+
export function toInstant(zoned) {
|
|
102
|
+
return (wallSeconds(zoned) - zoned.offset * 60) * 1000;
|
|
103
|
+
}
|
|
104
|
+
export function fromInstant(epochMs, timeZone) {
|
|
105
|
+
const offset = getOffset(epochMs, timeZone);
|
|
106
|
+
const wall = Math.floor(epochMs / 1000) + offset * 60;
|
|
107
|
+
const days = floorDiv(wall, DAY_SECONDS);
|
|
108
|
+
const [year] = civilFromDays(days);
|
|
109
|
+
if (year < MIN_YEAR || year > MAX_YEAR) {
|
|
110
|
+
throw new RangeError(`Date out of range: year ${year}.`);
|
|
111
|
+
}
|
|
112
|
+
const date = fromEpochDay(days);
|
|
113
|
+
const time = fromSecondOfDay(wall - days * DAY_SECONDS);
|
|
114
|
+
return build(plainDateTime(date, time), timeZone, offset);
|
|
115
|
+
}
|
|
116
|
+
/** Pin a wall time to a zone. DST gaps and overlaps follow `disambiguation` (D8). */
|
|
117
|
+
export function toZoned(dateTime, timeZone, disambiguation = "compatible") {
|
|
118
|
+
assertTimeZone(timeZone);
|
|
119
|
+
// Validates the fields as a side effect.
|
|
120
|
+
plainDate(dateTime.year, dateTime.month, dateTime.day);
|
|
121
|
+
const fixed = parseOffsetId(timeZone);
|
|
122
|
+
if (fixed !== null) {
|
|
123
|
+
return build(dateTime, timeZone, fixed);
|
|
124
|
+
}
|
|
125
|
+
const wall = wallSeconds(dateTime);
|
|
126
|
+
const before = getOffset((wall - DAY_SECONDS) * 1000, timeZone);
|
|
127
|
+
const after = getOffset((wall + DAY_SECONDS) * 1000, timeZone);
|
|
128
|
+
const candidates = before === after ? [before] : [before, after];
|
|
129
|
+
const valid = candidates.filter((offset) => getOffset((wall - offset * 60) * 1000, timeZone) === offset);
|
|
130
|
+
let offset;
|
|
131
|
+
if (valid.length === 1) {
|
|
132
|
+
offset = valid[0];
|
|
133
|
+
}
|
|
134
|
+
else if (valid.length === 2) {
|
|
135
|
+
if (disambiguation === "reject") {
|
|
136
|
+
throw new RangeError(`${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute} is ambiguous in ${timeZone}.`);
|
|
137
|
+
}
|
|
138
|
+
// Larger offset = earlier instant.
|
|
139
|
+
offset =
|
|
140
|
+
disambiguation === "later"
|
|
141
|
+
? Math.min(before, after)
|
|
142
|
+
: Math.max(before, after);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
if (disambiguation === "reject") {
|
|
146
|
+
throw new RangeError(`${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute} does not exist in ${timeZone} (DST gap).`);
|
|
147
|
+
}
|
|
148
|
+
// In a gap the offset grows. Using the old offset moves forward, the new one backward.
|
|
149
|
+
offset = disambiguation === "earlier" ? after : before;
|
|
150
|
+
}
|
|
151
|
+
return fromInstant((wall - offset * 60) * 1000, timeZone);
|
|
152
|
+
}
|
|
153
|
+
export function withTimeZone(zoned, timeZone) {
|
|
154
|
+
return fromInstant(toInstant(zoned), timeZone);
|
|
155
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./selection/slots.js";
|
|
3
|
+
export * from "./selection/range.js";
|
|
4
|
+
export * from "./input/parse.js";
|
|
5
|
+
export * from "./input/validity.js";
|
|
6
|
+
export * from "./input/time-input-controller.js";
|
|
7
|
+
export * from "./input/time-range-input-controller.js";
|
|
8
|
+
export * from "./panel/time-panel-controller.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./selection/slots.js";
|
|
3
|
+
export * from "./selection/range.js";
|
|
4
|
+
export * from "./input/parse.js";
|
|
5
|
+
export * from "./input/validity.js";
|
|
6
|
+
export * from "./input/time-input-controller.js";
|
|
7
|
+
export * from "./input/time-range-input-controller.js";
|
|
8
|
+
export * from "./panel/time-panel-controller.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PlainTime } from "../../foundation/index.js";
|
|
2
|
+
import type { HourCycle, TimeGranularity } from "../types.js";
|
|
3
|
+
export type TimeParseContext = {
|
|
4
|
+
locale?: string;
|
|
5
|
+
hourCycle?: HourCycle;
|
|
6
|
+
granularity?: TimeGranularity;
|
|
7
|
+
};
|
|
8
|
+
export type TimeParseResult = {
|
|
9
|
+
time: PlainTime;
|
|
10
|
+
} | {
|
|
11
|
+
error: "empty" | "unparseable" | "invalid";
|
|
12
|
+
};
|
|
13
|
+
/** `am` / `pm` for a word: the locale's labels, `am`, `pm`, and the first letters `a`, `p`. */
|
|
14
|
+
export declare function dayPeriodOf(word: string, locale?: string): "am" | "pm" | null;
|
|
15
|
+
/**
|
|
16
|
+
* Parse typed text into a time (plan 07 T17): `9`, `930`, `0930`, `9:30`, `9.30`,
|
|
17
|
+
* `9h30`, `21:30`, `9:30 pm`, `9 PM`, the locale's day-period words and `09:30:15`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseTime(text: string, context?: TimeParseContext): TimeParseResult;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { fold, getDayPeriodNames, plainTime, tokenize, toLatinDigits, } from "../../foundation/index.js";
|
|
2
|
+
const isValidTime = (h, m, s) => h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
|
|
3
|
+
const clean = (text) => fold(text).replace(/[.\s]/g, "");
|
|
4
|
+
/** `am` / `pm` for a word: the locale's labels, `am`, `pm`, and the first letters `a`, `p`. */
|
|
5
|
+
export function dayPeriodOf(word, locale) {
|
|
6
|
+
const needle = clean(word);
|
|
7
|
+
if (!needle)
|
|
8
|
+
return null;
|
|
9
|
+
const names = getDayPeriodNames(locale);
|
|
10
|
+
if (needle === clean(names.am) || needle === "am" || needle === "a")
|
|
11
|
+
return "am";
|
|
12
|
+
if (needle === clean(names.pm) || needle === "pm" || needle === "p")
|
|
13
|
+
return "pm";
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse typed text into a time (plan 07 T17): `9`, `930`, `0930`, `9:30`, `9.30`,
|
|
18
|
+
* `9h30`, `21:30`, `9:30 pm`, `9 PM`, the locale's day-period words and `09:30:15`.
|
|
19
|
+
*/
|
|
20
|
+
export function parseTime(text, context = {}) {
|
|
21
|
+
const latin = toLatinDigits(text.trim(), context.locale);
|
|
22
|
+
if (latin === "")
|
|
23
|
+
return { error: "empty" };
|
|
24
|
+
const tokens = tokenize(latin, context.locale);
|
|
25
|
+
let period = null;
|
|
26
|
+
const numbers = [];
|
|
27
|
+
let separators = 0;
|
|
28
|
+
for (const token of tokens) {
|
|
29
|
+
if (token.type === "number") {
|
|
30
|
+
numbers.push(token);
|
|
31
|
+
}
|
|
32
|
+
else if (token.type === "word") {
|
|
33
|
+
if (/^h$/i.test(token.text)) {
|
|
34
|
+
separators += 1;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const found = dayPeriodOf(token.text, context.locale);
|
|
38
|
+
if (!found || period)
|
|
39
|
+
return { error: "unparseable" };
|
|
40
|
+
period = found;
|
|
41
|
+
}
|
|
42
|
+
else if (/[:.]/.test(token.text)) {
|
|
43
|
+
separators += 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// A glued day period such as `9pm` is one word token after the number.
|
|
47
|
+
let hour;
|
|
48
|
+
let minute = 0;
|
|
49
|
+
let second = 0;
|
|
50
|
+
if (numbers.length === 1 && separators === 0) {
|
|
51
|
+
const digits = numbers[0].text;
|
|
52
|
+
if (digits.length <= 2)
|
|
53
|
+
hour = Number(digits);
|
|
54
|
+
else if (digits.length <= 4) {
|
|
55
|
+
hour = Number(digits.slice(0, -2));
|
|
56
|
+
minute = Number(digits.slice(-2));
|
|
57
|
+
}
|
|
58
|
+
else if (digits.length <= 6) {
|
|
59
|
+
hour = Number(digits.slice(0, -4));
|
|
60
|
+
minute = Number(digits.slice(-4, -2));
|
|
61
|
+
second = Number(digits.slice(-2));
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
return { error: "unparseable" };
|
|
65
|
+
}
|
|
66
|
+
else if (numbers.length >= 1 &&
|
|
67
|
+
numbers.length <= 3 &&
|
|
68
|
+
separators >= numbers.length - 1) {
|
|
69
|
+
hour = numbers[0].value;
|
|
70
|
+
minute = numbers[1]?.value ?? 0;
|
|
71
|
+
second = numbers[2]?.value ?? 0;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return { error: "unparseable" };
|
|
75
|
+
}
|
|
76
|
+
if (period) {
|
|
77
|
+
if (hour < 1 || hour > 12)
|
|
78
|
+
return { error: "invalid" };
|
|
79
|
+
hour = (hour % 12) + (period === "pm" ? 12 : 0);
|
|
80
|
+
}
|
|
81
|
+
return isValidTime(hour, minute, second)
|
|
82
|
+
? { time: plainTime(hour, minute, second) }
|
|
83
|
+
: { error: "invalid" };
|
|
84
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type Attributes, type Availability, type AvailabilitySpec, type HiddenInput, type Messages, type PlainTime, type TimeInput } from "../../foundation/index.js";
|
|
2
|
+
import type { HourCycle, TimeGranularity, TimePartName, TimeValue } from "../types.js";
|
|
3
|
+
import { type TimeParseContext } from "./parse.js";
|
|
4
|
+
import { type TimeValidity } from "./validity.js";
|
|
5
|
+
export type TimeInputOptions = {
|
|
6
|
+
id?: string;
|
|
7
|
+
value?: TimeValue;
|
|
8
|
+
defaultValue?: TimeValue;
|
|
9
|
+
onValueChange?: (value: TimeValue) => void;
|
|
10
|
+
/** On blur or Enter with a valid value. */
|
|
11
|
+
onValueCommit?: (value: PlainTime) => void;
|
|
12
|
+
mode?: "segmented" | "text";
|
|
13
|
+
granularity?: TimeGranularity;
|
|
14
|
+
hourCycle?: HourCycle;
|
|
15
|
+
step?: {
|
|
16
|
+
minutes?: number;
|
|
17
|
+
seconds?: number;
|
|
18
|
+
};
|
|
19
|
+
/** The value ↑/↓ starts from on an empty part (default: now, rounded down to the step). */
|
|
20
|
+
placeholderValue?: TimeInput;
|
|
21
|
+
parse?: (text: string, context: TimeParseContext) => PlainTime | null;
|
|
22
|
+
format?: (time: PlainTime, context: {
|
|
23
|
+
locale?: string;
|
|
24
|
+
hourCycle: HourCycle;
|
|
25
|
+
}) => string;
|
|
26
|
+
onInvalidInput?: (text: string) => void;
|
|
27
|
+
name?: string;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
min?: TimeInput;
|
|
32
|
+
max?: TimeInput;
|
|
33
|
+
disabledRanges?: readonly {
|
|
34
|
+
start: TimeInput;
|
|
35
|
+
end: TimeInput;
|
|
36
|
+
}[];
|
|
37
|
+
isTimeDisabled?: (time: PlainTime) => boolean;
|
|
38
|
+
isTimeUnavailable?: (time: PlainTime) => boolean;
|
|
39
|
+
/** Availability model (plan 11 V6): `daily` rules only. */
|
|
40
|
+
availability?: AvailabilitySpec | Availability;
|
|
41
|
+
locale?: string;
|
|
42
|
+
timeZone?: string;
|
|
43
|
+
now?: number;
|
|
44
|
+
messages?: Partial<Messages>;
|
|
45
|
+
/** Internal: called when focus tries to leave the first (-1) or last (1) part. */
|
|
46
|
+
onFocusEdge?: (direction: 1 | -1) => void;
|
|
47
|
+
};
|
|
48
|
+
export type TimeSegmentView = {
|
|
49
|
+
type: TimePartName | "literal";
|
|
50
|
+
text: string;
|
|
51
|
+
value: number | null;
|
|
52
|
+
placeholder: string;
|
|
53
|
+
min: number;
|
|
54
|
+
max: number;
|
|
55
|
+
valueText: string;
|
|
56
|
+
editable: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type TimeInputState = {
|
|
59
|
+
id: string;
|
|
60
|
+
mode: "segmented" | "text";
|
|
61
|
+
segments: TimeSegmentView[];
|
|
62
|
+
text: string;
|
|
63
|
+
value: TimeValue;
|
|
64
|
+
validity: TimeValidity;
|
|
65
|
+
focusedPart: TimePartName;
|
|
66
|
+
granularity: TimeGranularity;
|
|
67
|
+
hourCycle: HourCycle;
|
|
68
|
+
pattern: string;
|
|
69
|
+
required: boolean;
|
|
70
|
+
readOnly: boolean;
|
|
71
|
+
disabled: boolean;
|
|
72
|
+
direction: "ltr" | "rtl";
|
|
73
|
+
locale?: string;
|
|
74
|
+
messages: Messages;
|
|
75
|
+
hidden: HiddenInput[];
|
|
76
|
+
};
|
|
77
|
+
export type TimeKeyModifiers = {
|
|
78
|
+
shift: boolean;
|
|
79
|
+
ctrl: boolean;
|
|
80
|
+
meta: boolean;
|
|
81
|
+
};
|
|
82
|
+
export type TimeInputController = {
|
|
83
|
+
getState(): TimeInputState;
|
|
84
|
+
subscribe(listener: (state: TimeInputState) => void): () => void;
|
|
85
|
+
setOptions(options: Partial<TimeInputOptions>): void;
|
|
86
|
+
handleKeyDown(part: TimePartName, key: string, modifiers: TimeKeyModifiers): boolean;
|
|
87
|
+
focusPart(part: TimePartName): void;
|
|
88
|
+
settle(): void;
|
|
89
|
+
paste(text: string): boolean;
|
|
90
|
+
setText(text: string): void;
|
|
91
|
+
commitText(): boolean;
|
|
92
|
+
commit(): void;
|
|
93
|
+
clear(): void;
|
|
94
|
+
reset(): void;
|
|
95
|
+
handleTextKeyDown(key: string): boolean;
|
|
96
|
+
getRootAttributes(): Attributes;
|
|
97
|
+
getSegmentAttributes(segment: TimeSegmentView): Attributes;
|
|
98
|
+
getTextFieldAttributes(): Attributes;
|
|
99
|
+
getClearButtonAttributes(): Attributes;
|
|
100
|
+
destroy(): void;
|
|
101
|
+
};
|
|
102
|
+
export declare function createTimeInputController(initial?: TimeInputOptions): TimeInputController;
|