rn-grid-date-time-picker 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +101 -0
- package/LICENSE +21 -0
- package/README.md +176 -2
- package/lib/commonjs/adapters/index.js +28 -0
- package/lib/commonjs/adapters/index.js.map +1 -0
- package/lib/commonjs/adapters/iso.js +40 -0
- package/lib/commonjs/adapters/iso.js.map +1 -0
- package/lib/commonjs/adapters/utcMidnight.js +125 -0
- package/lib/commonjs/adapters/utcMidnight.js.map +1 -0
- package/lib/commonjs/components/DateTimePicker.js +1278 -0
- package/lib/commonjs/components/DateTimePicker.js.map +1 -0
- package/lib/commonjs/components/calendar/Calendar.js +409 -0
- package/lib/commonjs/components/calendar/Calendar.js.map +1 -0
- package/lib/commonjs/components/calendar/CalendarHeader.js +211 -0
- package/lib/commonjs/components/calendar/CalendarHeader.js.map +1 -0
- package/lib/commonjs/components/calendar/CalendarSwitch.js +150 -0
- package/lib/commonjs/components/calendar/CalendarSwitch.js.map +1 -0
- package/lib/commonjs/components/calendar/DayCell.js +77 -0
- package/lib/commonjs/components/calendar/DayCell.js.map +1 -0
- package/lib/commonjs/components/calendar/DayGrid.js +145 -0
- package/lib/commonjs/components/calendar/DayGrid.js.map +1 -0
- package/lib/commonjs/components/calendar/PeriodGrid.js +71 -0
- package/lib/commonjs/components/calendar/PeriodGrid.js.map +1 -0
- package/lib/commonjs/components/calendar/calendarStyles.js +227 -0
- package/lib/commonjs/components/calendar/calendarStyles.js.map +1 -0
- package/lib/commonjs/components/calendar/localeNames.js +87 -0
- package/lib/commonjs/components/calendar/localeNames.js.map +1 -0
- package/lib/commonjs/components/calendar/selection.js +96 -0
- package/lib/commonjs/components/calendar/selection.js.map +1 -0
- package/lib/commonjs/components/container/DefaultSheet.js +96 -0
- package/lib/commonjs/components/container/DefaultSheet.js.map +1 -0
- package/lib/commonjs/components/container/PickerContainer.js +67 -0
- package/lib/commonjs/components/container/PickerContainer.js.map +1 -0
- package/lib/commonjs/components/container/PickerLayout.js +106 -0
- package/lib/commonjs/components/container/PickerLayout.js.map +1 -0
- package/lib/commonjs/components/container/containerStyles.js +111 -0
- package/lib/commonjs/components/container/containerStyles.js.map +1 -0
- package/lib/commonjs/components/field/FieldMessages.js +48 -0
- package/lib/commonjs/components/field/FieldMessages.js.map +1 -0
- package/lib/commonjs/components/field/RangeFields.js +117 -0
- package/lib/commonjs/components/field/RangeFields.js.map +1 -0
- package/lib/commonjs/components/field/SegmentedInput.js +245 -0
- package/lib/commonjs/components/field/SegmentedInput.js.map +1 -0
- package/lib/commonjs/components/field/ValueField.js +249 -0
- package/lib/commonjs/components/field/ValueField.js.map +1 -0
- package/lib/commonjs/components/field/fieldStyles.js +137 -0
- package/lib/commonjs/components/field/fieldStyles.js.map +1 -0
- package/lib/commonjs/components/field/fieldText.js +85 -0
- package/lib/commonjs/components/field/fieldText.js.map +1 -0
- package/lib/commonjs/components/hooks/useBottomInset.js +32 -0
- package/lib/commonjs/components/hooks/useBottomInset.js.map +1 -0
- package/lib/commonjs/components/hooks/useKeyboardFold.js +57 -0
- package/lib/commonjs/components/hooks/useKeyboardFold.js.map +1 -0
- package/lib/commonjs/components/hooks/useOpenPicker.js +99 -0
- package/lib/commonjs/components/hooks/useOpenPicker.js.map +1 -0
- package/lib/commonjs/components/hooks/usePickerDraft.js +60 -0
- package/lib/commonjs/components/hooks/usePickerDraft.js.map +1 -0
- package/lib/commonjs/components/hooks/useReduceMotion.js +32 -0
- package/lib/commonjs/components/hooks/useReduceMotion.js.map +1 -0
- package/lib/commonjs/components/hooks/useTodayTick.js +31 -0
- package/lib/commonjs/components/hooks/useTodayTick.js.map +1 -0
- package/lib/commonjs/components/hooks/useTypedSegments.js +81 -0
- package/lib/commonjs/components/hooks/useTypedSegments.js.map +1 -0
- package/lib/commonjs/components/nativeTypes.js +6 -0
- package/lib/commonjs/components/nativeTypes.js.map +1 -0
- package/lib/commonjs/components/theme/a11y.js +15 -0
- package/lib/commonjs/components/theme/a11y.js.map +1 -0
- package/lib/commonjs/components/theme/defaultStrings.js +80 -0
- package/lib/commonjs/components/theme/defaultStrings.js.map +1 -0
- package/lib/commonjs/components/theme/numerals.js +16 -0
- package/lib/commonjs/components/theme/numerals.js.map +1 -0
- package/lib/commonjs/components/theme/styleKeys.js +38 -0
- package/lib/commonjs/components/theme/styleKeys.js.map +1 -0
- package/lib/commonjs/components/theme/tokens.js +108 -0
- package/lib/commonjs/components/theme/tokens.js.map +1 -0
- package/lib/commonjs/components/time/TimeRow.js +251 -0
- package/lib/commonjs/components/time/TimeRow.js.map +1 -0
- package/lib/commonjs/components/time/TimeRows.js +152 -0
- package/lib/commonjs/components/time/TimeRows.js.map +1 -0
- package/lib/commonjs/components/time/TypedTime.js +121 -0
- package/lib/commonjs/components/time/TypedTime.js.map +1 -0
- package/lib/commonjs/components/time/Wheel.js +313 -0
- package/lib/commonjs/components/time/Wheel.js.map +1 -0
- package/lib/commonjs/components/time/timeStyles.js +177 -0
- package/lib/commonjs/components/time/timeStyles.js.map +1 -0
- package/lib/commonjs/components/types.js +50 -0
- package/lib/commonjs/components/types.js.map +1 -0
- package/lib/commonjs/core/calendarDate.js +79 -0
- package/lib/commonjs/core/calendarDate.js.map +1 -0
- package/lib/commonjs/core/calendarSystem.js +305 -0
- package/lib/commonjs/core/calendarSystem.js.map +1 -0
- package/lib/commonjs/core/constraints.js +153 -0
- package/lib/commonjs/core/constraints.js.map +1 -0
- package/lib/commonjs/core/digits.js +25 -0
- package/lib/commonjs/core/digits.js.map +1 -0
- package/lib/commonjs/core/draft.js +444 -0
- package/lib/commonjs/core/draft.js.map +1 -0
- package/lib/commonjs/core/locale.js +134 -0
- package/lib/commonjs/core/locale.js.map +1 -0
- package/lib/commonjs/core/monthGrid.js +59 -0
- package/lib/commonjs/core/monthGrid.js.map +1 -0
- package/lib/commonjs/core/numerals.js +46 -0
- package/lib/commonjs/core/numerals.js.map +1 -0
- package/lib/commonjs/core/segmentEditor.js +148 -0
- package/lib/commonjs/core/segmentEditor.js.map +1 -0
- package/lib/commonjs/core/segments.js +226 -0
- package/lib/commonjs/core/segments.js.map +1 -0
- package/lib/commonjs/core/selectionRules.js +58 -0
- package/lib/commonjs/core/selectionRules.js.map +1 -0
- package/lib/commonjs/core/timeEntry.js +152 -0
- package/lib/commonjs/core/timeEntry.js.map +1 -0
- package/lib/commonjs/core/types.js +2 -0
- package/lib/commonjs/core/types.js.map +1 -0
- package/lib/commonjs/core/zoned.js +33 -0
- package/lib/commonjs/core/zoned.js.map +1 -0
- package/lib/commonjs/icons/index.js +190 -0
- package/lib/commonjs/icons/index.js.map +1 -0
- package/lib/commonjs/index.js +170 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/adapters/index.js +13 -0
- package/lib/module/adapters/index.js.map +1 -0
- package/lib/module/adapters/iso.js +37 -0
- package/lib/module/adapters/iso.js.map +1 -0
- package/lib/module/adapters/utcMidnight.js +118 -0
- package/lib/module/adapters/utcMidnight.js.map +1 -0
- package/lib/module/components/DateTimePicker.js +1273 -0
- package/lib/module/components/DateTimePicker.js.map +1 -0
- package/lib/module/components/calendar/Calendar.js +402 -0
- package/lib/module/components/calendar/Calendar.js.map +1 -0
- package/lib/module/components/calendar/CalendarHeader.js +203 -0
- package/lib/module/components/calendar/CalendarHeader.js.map +1 -0
- package/lib/module/components/calendar/CalendarSwitch.js +145 -0
- package/lib/module/components/calendar/CalendarSwitch.js.map +1 -0
- package/lib/module/components/calendar/DayCell.js +71 -0
- package/lib/module/components/calendar/DayCell.js.map +1 -0
- package/lib/module/components/calendar/DayGrid.js +136 -0
- package/lib/module/components/calendar/DayGrid.js.map +1 -0
- package/lib/module/components/calendar/PeriodGrid.js +66 -0
- package/lib/module/components/calendar/PeriodGrid.js.map +1 -0
- package/lib/module/components/calendar/calendarStyles.js +222 -0
- package/lib/module/components/calendar/calendarStyles.js.map +1 -0
- package/lib/module/components/calendar/localeNames.js +81 -0
- package/lib/module/components/calendar/localeNames.js.map +1 -0
- package/lib/module/components/calendar/selection.js +90 -0
- package/lib/module/components/calendar/selection.js.map +1 -0
- package/lib/module/components/container/DefaultSheet.js +90 -0
- package/lib/module/components/container/DefaultSheet.js.map +1 -0
- package/lib/module/components/container/PickerContainer.js +62 -0
- package/lib/module/components/container/PickerContainer.js.map +1 -0
- package/lib/module/components/container/PickerLayout.js +100 -0
- package/lib/module/components/container/PickerLayout.js.map +1 -0
- package/lib/module/components/container/containerStyles.js +106 -0
- package/lib/module/components/container/containerStyles.js.map +1 -0
- package/lib/module/components/field/FieldMessages.js +42 -0
- package/lib/module/components/field/FieldMessages.js.map +1 -0
- package/lib/module/components/field/RangeFields.js +112 -0
- package/lib/module/components/field/RangeFields.js.map +1 -0
- package/lib/module/components/field/SegmentedInput.js +238 -0
- package/lib/module/components/field/SegmentedInput.js.map +1 -0
- package/lib/module/components/field/ValueField.js +242 -0
- package/lib/module/components/field/ValueField.js.map +1 -0
- package/lib/module/components/field/fieldStyles.js +132 -0
- package/lib/module/components/field/fieldStyles.js.map +1 -0
- package/lib/module/components/field/fieldText.js +76 -0
- package/lib/module/components/field/fieldText.js.map +1 -0
- package/lib/module/components/hooks/useBottomInset.js +27 -0
- package/lib/module/components/hooks/useBottomInset.js.map +1 -0
- package/lib/module/components/hooks/useKeyboardFold.js +51 -0
- package/lib/module/components/hooks/useKeyboardFold.js.map +1 -0
- package/lib/module/components/hooks/useOpenPicker.js +95 -0
- package/lib/module/components/hooks/useOpenPicker.js.map +1 -0
- package/lib/module/components/hooks/usePickerDraft.js +55 -0
- package/lib/module/components/hooks/usePickerDraft.js.map +1 -0
- package/lib/module/components/hooks/useReduceMotion.js +28 -0
- package/lib/module/components/hooks/useReduceMotion.js.map +1 -0
- package/lib/module/components/hooks/useTodayTick.js +26 -0
- package/lib/module/components/hooks/useTodayTick.js.map +1 -0
- package/lib/module/components/hooks/useTypedSegments.js +76 -0
- package/lib/module/components/hooks/useTypedSegments.js.map +1 -0
- package/lib/module/components/nativeTypes.js +4 -0
- package/lib/module/components/nativeTypes.js.map +1 -0
- package/lib/module/components/theme/a11y.js +11 -0
- package/lib/module/components/theme/a11y.js.map +1 -0
- package/lib/module/components/theme/defaultStrings.js +75 -0
- package/lib/module/components/theme/defaultStrings.js.map +1 -0
- package/lib/module/components/theme/numerals.js +12 -0
- package/lib/module/components/theme/numerals.js.map +1 -0
- package/lib/module/components/theme/styleKeys.js +34 -0
- package/lib/module/components/theme/styleKeys.js.map +1 -0
- package/lib/module/components/theme/tokens.js +102 -0
- package/lib/module/components/theme/tokens.js.map +1 -0
- package/lib/module/components/time/TimeRow.js +244 -0
- package/lib/module/components/time/TimeRow.js.map +1 -0
- package/lib/module/components/time/TimeRows.js +145 -0
- package/lib/module/components/time/TimeRows.js.map +1 -0
- package/lib/module/components/time/TypedTime.js +116 -0
- package/lib/module/components/time/TypedTime.js.map +1 -0
- package/lib/module/components/time/Wheel.js +304 -0
- package/lib/module/components/time/Wheel.js.map +1 -0
- package/lib/module/components/time/timeStyles.js +172 -0
- package/lib/module/components/time/timeStyles.js.map +1 -0
- package/lib/module/components/types.js +46 -0
- package/lib/module/components/types.js.map +1 -0
- package/lib/module/core/calendarDate.js +63 -0
- package/lib/module/core/calendarDate.js.map +1 -0
- package/lib/module/core/calendarSystem.js +292 -0
- package/lib/module/core/calendarSystem.js.map +1 -0
- package/lib/module/core/constraints.js +149 -0
- package/lib/module/core/constraints.js.map +1 -0
- package/lib/module/core/digits.js +20 -0
- package/lib/module/core/digits.js.map +1 -0
- package/lib/module/core/draft.js +431 -0
- package/lib/module/core/draft.js.map +1 -0
- package/lib/module/core/locale.js +124 -0
- package/lib/module/core/locale.js.map +1 -0
- package/lib/module/core/monthGrid.js +54 -0
- package/lib/module/core/monthGrid.js.map +1 -0
- package/lib/module/core/numerals.js +39 -0
- package/lib/module/core/numerals.js.map +1 -0
- package/lib/module/core/segmentEditor.js +143 -0
- package/lib/module/core/segmentEditor.js.map +1 -0
- package/lib/module/core/segments.js +216 -0
- package/lib/module/core/segments.js.map +1 -0
- package/lib/module/core/selectionRules.js +53 -0
- package/lib/module/core/selectionRules.js.map +1 -0
- package/lib/module/core/timeEntry.js +142 -0
- package/lib/module/core/timeEntry.js.map +1 -0
- package/lib/module/core/types.js +2 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/zoned.js +27 -0
- package/lib/module/core/zoned.js.map +1 -0
- package/lib/module/icons/index.js +178 -0
- package/lib/module/icons/index.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/adapters/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/adapters/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/adapters/iso.d.ts +3 -0
- package/lib/typescript/commonjs/src/adapters/iso.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/adapters/utcMidnight.d.ts +15 -0
- package/lib/typescript/commonjs/src/adapters/utcMidnight.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/DateTimePicker.d.ts +16 -0
- package/lib/typescript/commonjs/src/components/DateTimePicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/Calendar.d.ts +68 -0
- package/lib/typescript/commonjs/src/components/calendar/Calendar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/CalendarHeader.d.ts +44 -0
- package/lib/typescript/commonjs/src/components/calendar/CalendarHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/CalendarSwitch.d.ts +26 -0
- package/lib/typescript/commonjs/src/components/calendar/CalendarSwitch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/DayCell.d.ts +30 -0
- package/lib/typescript/commonjs/src/components/calendar/DayCell.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/DayGrid.d.ts +48 -0
- package/lib/typescript/commonjs/src/components/calendar/DayGrid.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/PeriodGrid.d.ts +25 -0
- package/lib/typescript/commonjs/src/components/calendar/PeriodGrid.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/calendarStyles.d.ts +297 -0
- package/lib/typescript/commonjs/src/components/calendar/calendarStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/localeNames.d.ts +23 -0
- package/lib/typescript/commonjs/src/components/calendar/localeNames.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/calendar/selection.d.ts +25 -0
- package/lib/typescript/commonjs/src/components/calendar/selection.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/container/DefaultSheet.d.ts +27 -0
- package/lib/typescript/commonjs/src/components/container/DefaultSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/container/PickerContainer.d.ts +22 -0
- package/lib/typescript/commonjs/src/components/container/PickerContainer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/container/PickerLayout.d.ts +38 -0
- package/lib/typescript/commonjs/src/components/container/PickerLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/container/containerStyles.d.ts +123 -0
- package/lib/typescript/commonjs/src/components/container/containerStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/field/FieldMessages.d.ts +19 -0
- package/lib/typescript/commonjs/src/components/field/FieldMessages.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/field/RangeFields.d.ts +53 -0
- package/lib/typescript/commonjs/src/components/field/RangeFields.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/field/SegmentedInput.d.ts +33 -0
- package/lib/typescript/commonjs/src/components/field/SegmentedInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/field/ValueField.d.ts +75 -0
- package/lib/typescript/commonjs/src/components/field/ValueField.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/field/fieldStyles.d.ts +183 -0
- package/lib/typescript/commonjs/src/components/field/fieldStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/field/fieldText.d.ts +24 -0
- package/lib/typescript/commonjs/src/components/field/fieldText.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/useBottomInset.d.ts +8 -0
- package/lib/typescript/commonjs/src/components/hooks/useBottomInset.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/useKeyboardFold.d.ts +16 -0
- package/lib/typescript/commonjs/src/components/hooks/useKeyboardFold.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/useOpenPicker.d.ts +27 -0
- package/lib/typescript/commonjs/src/components/hooks/useOpenPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/usePickerDraft.d.ts +21 -0
- package/lib/typescript/commonjs/src/components/hooks/usePickerDraft.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/useReduceMotion.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/hooks/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/useTodayTick.d.ts +7 -0
- package/lib/typescript/commonjs/src/components/hooks/useTodayTick.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/hooks/useTypedSegments.d.ts +16 -0
- package/lib/typescript/commonjs/src/components/hooks/useTypedSegments.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/nativeTypes.d.ts +11 -0
- package/lib/typescript/commonjs/src/components/nativeTypes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/theme/a11y.d.ts +8 -0
- package/lib/typescript/commonjs/src/components/theme/a11y.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/theme/defaultStrings.d.ts +74 -0
- package/lib/typescript/commonjs/src/components/theme/defaultStrings.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/theme/numerals.d.ts +7 -0
- package/lib/typescript/commonjs/src/components/theme/numerals.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/theme/styleKeys.d.ts +11 -0
- package/lib/typescript/commonjs/src/components/theme/styleKeys.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/theme/tokens.d.ts +78 -0
- package/lib/typescript/commonjs/src/components/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/time/TimeRow.d.ts +53 -0
- package/lib/typescript/commonjs/src/components/time/TimeRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/time/TimeRows.d.ts +49 -0
- package/lib/typescript/commonjs/src/components/time/TimeRows.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/time/TypedTime.d.ts +35 -0
- package/lib/typescript/commonjs/src/components/time/TypedTime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/time/Wheel.d.ts +41 -0
- package/lib/typescript/commonjs/src/components/time/Wheel.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/time/timeStyles.d.ts +221 -0
- package/lib/typescript/commonjs/src/components/time/timeStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/types.d.ts +371 -0
- package/lib/typescript/commonjs/src/components/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/calendarDate.d.ts +25 -0
- package/lib/typescript/commonjs/src/core/calendarDate.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/calendarSystem.d.ts +66 -0
- package/lib/typescript/commonjs/src/core/calendarSystem.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/constraints.d.ts +71 -0
- package/lib/typescript/commonjs/src/core/constraints.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/digits.d.ts +3 -0
- package/lib/typescript/commonjs/src/core/digits.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/draft.d.ts +102 -0
- package/lib/typescript/commonjs/src/core/draft.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/locale.d.ts +32 -0
- package/lib/typescript/commonjs/src/core/locale.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/monthGrid.d.ts +23 -0
- package/lib/typescript/commonjs/src/core/monthGrid.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/numerals.d.ts +15 -0
- package/lib/typescript/commonjs/src/core/numerals.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/segmentEditor.d.ts +46 -0
- package/lib/typescript/commonjs/src/core/segmentEditor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/segments.d.ts +73 -0
- package/lib/typescript/commonjs/src/core/segments.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/selectionRules.d.ts +26 -0
- package/lib/typescript/commonjs/src/core/selectionRules.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/timeEntry.d.ts +51 -0
- package/lib/typescript/commonjs/src/core/timeEntry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types.d.ts +49 -0
- package/lib/typescript/commonjs/src/core/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/zoned.d.ts +13 -0
- package/lib/typescript/commonjs/src/core/zoned.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/icons/index.d.ts +51 -0
- package/lib/typescript/commonjs/src/icons/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +24 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/adapters/index.d.ts +7 -0
- package/lib/typescript/module/src/adapters/index.d.ts.map +1 -0
- package/lib/typescript/module/src/adapters/iso.d.ts +3 -0
- package/lib/typescript/module/src/adapters/iso.d.ts.map +1 -0
- package/lib/typescript/module/src/adapters/utcMidnight.d.ts +15 -0
- package/lib/typescript/module/src/adapters/utcMidnight.d.ts.map +1 -0
- package/lib/typescript/module/src/components/DateTimePicker.d.ts +16 -0
- package/lib/typescript/module/src/components/DateTimePicker.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/Calendar.d.ts +68 -0
- package/lib/typescript/module/src/components/calendar/Calendar.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/CalendarHeader.d.ts +44 -0
- package/lib/typescript/module/src/components/calendar/CalendarHeader.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/CalendarSwitch.d.ts +26 -0
- package/lib/typescript/module/src/components/calendar/CalendarSwitch.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/DayCell.d.ts +30 -0
- package/lib/typescript/module/src/components/calendar/DayCell.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/DayGrid.d.ts +48 -0
- package/lib/typescript/module/src/components/calendar/DayGrid.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/PeriodGrid.d.ts +25 -0
- package/lib/typescript/module/src/components/calendar/PeriodGrid.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/calendarStyles.d.ts +297 -0
- package/lib/typescript/module/src/components/calendar/calendarStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/localeNames.d.ts +23 -0
- package/lib/typescript/module/src/components/calendar/localeNames.d.ts.map +1 -0
- package/lib/typescript/module/src/components/calendar/selection.d.ts +25 -0
- package/lib/typescript/module/src/components/calendar/selection.d.ts.map +1 -0
- package/lib/typescript/module/src/components/container/DefaultSheet.d.ts +27 -0
- package/lib/typescript/module/src/components/container/DefaultSheet.d.ts.map +1 -0
- package/lib/typescript/module/src/components/container/PickerContainer.d.ts +22 -0
- package/lib/typescript/module/src/components/container/PickerContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/components/container/PickerLayout.d.ts +38 -0
- package/lib/typescript/module/src/components/container/PickerLayout.d.ts.map +1 -0
- package/lib/typescript/module/src/components/container/containerStyles.d.ts +123 -0
- package/lib/typescript/module/src/components/container/containerStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/field/FieldMessages.d.ts +19 -0
- package/lib/typescript/module/src/components/field/FieldMessages.d.ts.map +1 -0
- package/lib/typescript/module/src/components/field/RangeFields.d.ts +53 -0
- package/lib/typescript/module/src/components/field/RangeFields.d.ts.map +1 -0
- package/lib/typescript/module/src/components/field/SegmentedInput.d.ts +33 -0
- package/lib/typescript/module/src/components/field/SegmentedInput.d.ts.map +1 -0
- package/lib/typescript/module/src/components/field/ValueField.d.ts +75 -0
- package/lib/typescript/module/src/components/field/ValueField.d.ts.map +1 -0
- package/lib/typescript/module/src/components/field/fieldStyles.d.ts +183 -0
- package/lib/typescript/module/src/components/field/fieldStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/field/fieldText.d.ts +24 -0
- package/lib/typescript/module/src/components/field/fieldText.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/useBottomInset.d.ts +8 -0
- package/lib/typescript/module/src/components/hooks/useBottomInset.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/useKeyboardFold.d.ts +16 -0
- package/lib/typescript/module/src/components/hooks/useKeyboardFold.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/useOpenPicker.d.ts +27 -0
- package/lib/typescript/module/src/components/hooks/useOpenPicker.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/usePickerDraft.d.ts +21 -0
- package/lib/typescript/module/src/components/hooks/usePickerDraft.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/useReduceMotion.d.ts +3 -0
- package/lib/typescript/module/src/components/hooks/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/useTodayTick.d.ts +7 -0
- package/lib/typescript/module/src/components/hooks/useTodayTick.d.ts.map +1 -0
- package/lib/typescript/module/src/components/hooks/useTypedSegments.d.ts +16 -0
- package/lib/typescript/module/src/components/hooks/useTypedSegments.d.ts.map +1 -0
- package/lib/typescript/module/src/components/nativeTypes.d.ts +11 -0
- package/lib/typescript/module/src/components/nativeTypes.d.ts.map +1 -0
- package/lib/typescript/module/src/components/theme/a11y.d.ts +8 -0
- package/lib/typescript/module/src/components/theme/a11y.d.ts.map +1 -0
- package/lib/typescript/module/src/components/theme/defaultStrings.d.ts +74 -0
- package/lib/typescript/module/src/components/theme/defaultStrings.d.ts.map +1 -0
- package/lib/typescript/module/src/components/theme/numerals.d.ts +7 -0
- package/lib/typescript/module/src/components/theme/numerals.d.ts.map +1 -0
- package/lib/typescript/module/src/components/theme/styleKeys.d.ts +11 -0
- package/lib/typescript/module/src/components/theme/styleKeys.d.ts.map +1 -0
- package/lib/typescript/module/src/components/theme/tokens.d.ts +78 -0
- package/lib/typescript/module/src/components/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/module/src/components/time/TimeRow.d.ts +53 -0
- package/lib/typescript/module/src/components/time/TimeRow.d.ts.map +1 -0
- package/lib/typescript/module/src/components/time/TimeRows.d.ts +49 -0
- package/lib/typescript/module/src/components/time/TimeRows.d.ts.map +1 -0
- package/lib/typescript/module/src/components/time/TypedTime.d.ts +35 -0
- package/lib/typescript/module/src/components/time/TypedTime.d.ts.map +1 -0
- package/lib/typescript/module/src/components/time/Wheel.d.ts +41 -0
- package/lib/typescript/module/src/components/time/Wheel.d.ts.map +1 -0
- package/lib/typescript/module/src/components/time/timeStyles.d.ts +221 -0
- package/lib/typescript/module/src/components/time/timeStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/types.d.ts +371 -0
- package/lib/typescript/module/src/components/types.d.ts.map +1 -0
- package/lib/typescript/module/src/core/calendarDate.d.ts +25 -0
- package/lib/typescript/module/src/core/calendarDate.d.ts.map +1 -0
- package/lib/typescript/module/src/core/calendarSystem.d.ts +66 -0
- package/lib/typescript/module/src/core/calendarSystem.d.ts.map +1 -0
- package/lib/typescript/module/src/core/constraints.d.ts +71 -0
- package/lib/typescript/module/src/core/constraints.d.ts.map +1 -0
- package/lib/typescript/module/src/core/digits.d.ts +3 -0
- package/lib/typescript/module/src/core/digits.d.ts.map +1 -0
- package/lib/typescript/module/src/core/draft.d.ts +102 -0
- package/lib/typescript/module/src/core/draft.d.ts.map +1 -0
- package/lib/typescript/module/src/core/locale.d.ts +32 -0
- package/lib/typescript/module/src/core/locale.d.ts.map +1 -0
- package/lib/typescript/module/src/core/monthGrid.d.ts +23 -0
- package/lib/typescript/module/src/core/monthGrid.d.ts.map +1 -0
- package/lib/typescript/module/src/core/numerals.d.ts +15 -0
- package/lib/typescript/module/src/core/numerals.d.ts.map +1 -0
- package/lib/typescript/module/src/core/segmentEditor.d.ts +46 -0
- package/lib/typescript/module/src/core/segmentEditor.d.ts.map +1 -0
- package/lib/typescript/module/src/core/segments.d.ts +73 -0
- package/lib/typescript/module/src/core/segments.d.ts.map +1 -0
- package/lib/typescript/module/src/core/selectionRules.d.ts +26 -0
- package/lib/typescript/module/src/core/selectionRules.d.ts.map +1 -0
- package/lib/typescript/module/src/core/timeEntry.d.ts +51 -0
- package/lib/typescript/module/src/core/timeEntry.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types.d.ts +49 -0
- package/lib/typescript/module/src/core/types.d.ts.map +1 -0
- package/lib/typescript/module/src/core/zoned.d.ts +13 -0
- package/lib/typescript/module/src/core/zoned.d.ts.map +1 -0
- package/lib/typescript/module/src/icons/index.d.ts +51 -0
- package/lib/typescript/module/src/icons/index.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +24 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +176 -4
- package/src/adapters/index.ts +14 -0
- package/src/adapters/iso.ts +35 -0
- package/src/adapters/utcMidnight.ts +131 -0
- package/src/components/DateTimePicker.tsx +1696 -0
- package/src/components/calendar/Calendar.tsx +537 -0
- package/src/components/calendar/CalendarHeader.tsx +277 -0
- package/src/components/calendar/CalendarSwitch.tsx +170 -0
- package/src/components/calendar/DayCell.tsx +139 -0
- package/src/components/calendar/DayGrid.tsx +195 -0
- package/src/components/calendar/PeriodGrid.tsx +116 -0
- package/src/components/calendar/calendarStyles.ts +155 -0
- package/src/components/calendar/localeNames.ts +123 -0
- package/src/components/calendar/selection.ts +75 -0
- package/src/components/container/DefaultSheet.tsx +123 -0
- package/src/components/container/PickerContainer.tsx +75 -0
- package/src/components/container/PickerLayout.tsx +152 -0
- package/src/components/container/containerStyles.ts +87 -0
- package/src/components/field/FieldMessages.tsx +62 -0
- package/src/components/field/RangeFields.tsx +169 -0
- package/src/components/field/SegmentedInput.tsx +305 -0
- package/src/components/field/ValueField.tsx +357 -0
- package/src/components/field/fieldStyles.ts +104 -0
- package/src/components/field/fieldText.ts +145 -0
- package/src/components/hooks/useBottomInset.ts +33 -0
- package/src/components/hooks/useKeyboardFold.ts +59 -0
- package/src/components/hooks/useOpenPicker.ts +107 -0
- package/src/components/hooks/usePickerDraft.ts +118 -0
- package/src/components/hooks/useReduceMotion.ts +30 -0
- package/src/components/hooks/useTodayTick.ts +30 -0
- package/src/components/hooks/useTypedSegments.ts +104 -0
- package/src/components/nativeTypes.ts +13 -0
- package/src/components/theme/a11y.ts +8 -0
- package/src/components/theme/defaultStrings.ts +132 -0
- package/src/components/theme/numerals.ts +11 -0
- package/src/components/theme/styleKeys.ts +138 -0
- package/src/components/theme/tokens.ts +145 -0
- package/src/components/time/TimeRow.tsx +320 -0
- package/src/components/time/TimeRows.tsx +238 -0
- package/src/components/time/TypedTime.tsx +180 -0
- package/src/components/time/Wheel.tsx +372 -0
- package/src/components/time/timeStyles.ts +138 -0
- package/src/components/types.ts +409 -0
- package/src/core/calendarDate.ts +87 -0
- package/src/core/calendarSystem.ts +344 -0
- package/src/core/constraints.ts +241 -0
- package/src/core/digits.ts +21 -0
- package/src/core/draft.ts +477 -0
- package/src/core/locale.ts +137 -0
- package/src/core/monthGrid.ts +73 -0
- package/src/core/numerals.ts +35 -0
- package/src/core/segmentEditor.ts +203 -0
- package/src/core/segments.ts +253 -0
- package/src/core/selectionRules.ts +73 -0
- package/src/core/timeEntry.ts +146 -0
- package/src/core/types.ts +60 -0
- package/src/core/zoned.ts +32 -0
- package/src/icons/index.tsx +173 -0
- package/src/index.tsx +91 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [1.1.0] - 2026-10-30
|
|
6
|
+
|
|
7
|
+
1.1.0 reworks the Hijri calendar (Gregorian / Hijri tabs, a calendar switch, Arabic by default) and fixes issues found in real-device testing. It changes some 1.0.0 behaviour, listed below: most apps need no changes, but check this list if you use the Hijri or dual calendar, full `PickerStrings` / `ThemeTokens` objects, or tests that match `onChange` calls exactly.
|
|
8
|
+
|
|
9
|
+
### Changes from 1.0.0 to check
|
|
10
|
+
|
|
11
|
+
- **`calendarSystem="dual"`** shows Gregorian and Hijri as two tabs, one calendar at a time; it no longer writes the Hijri day under each Gregorian day. `styles.daySubLabel` is no longer drawn, and `renderDay` gets `subLabel: null`. Use `dualDefaultTab` to choose the tab it opens on. A date shows selected only in the tab it was picked in, and a tap in the other tab starts the selection over.
|
|
12
|
+
- **A folded calendar stays mounted but hidden** while the keyboard is up, so it comes back on the month it showed. A test that checks `dp-calendar` is gone while folded should check that it's hidden instead.
|
|
13
|
+
- **`calendarSystem="hijri"` is written in Arabic** (month and weekday names, Arabic digits), whatever the app's `locale`, and **the field shows the Hijri date** (e.g. "١٥ جمادى الأولى ١٤٤٨ هـ") instead of the Gregorian date in `dateFormat`. `hijriLocale={locale}` and `numerals="latin"` bring back 1.0.0's language and digits; the field still writes the date in Hijri. Values passed to `onChange` stay Gregorian.
|
|
14
|
+
- **`onChange` gets a second argument**, `{ calendarSystem }`, when a Hijri calendar can show. Tests asserting `toHaveBeenCalledWith(value)` need `expect.anything()` added.
|
|
15
|
+
- **Stored values must start with a full `YYYY-MM-DD` day.** Strings such as `'2026-10'`, `'2026'` or `'10:30'` now read as empty instead of being guessed, and so do a leading space, a lowercase `t` and six-digit years (`+002026-…`).
|
|
16
|
+
- **Days outside `yearRange` are greyed**, like days outside `minDate` / `maxDate`.
|
|
17
|
+
- **Outside days** (from the months before and after) use the new `outsideText` token, which follows `mutedText`, instead of `placeholder`.
|
|
18
|
+
- **The built-in sheet's padding** is 8 at the bottom (was 24) and 24 above the title (was 8), plus the bottom safe-area inset, which the sheet now adds itself (see Added). If you added `insets.bottom` to `styles.sheet.paddingBottom` yourself, that still wins; you can drop it.
|
|
19
|
+
- **From / To ranges:** a tap on a full range starts a new range (or moves the nearer end with `reselect: 'moveNearestEnd'`), instead of replacing To.
|
|
20
|
+
- **`strings.errorRangeOrder`** now defaults to "The end date must be greater than the start date".
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- `sheet.bottomInset`: the built-in sheet keeps the bottom safe-area inset (home indicator, Android's navigation bar) free below Confirm. By default it's read from `react-native-safe-area-context` when the app has a `SafeAreaProvider` (an optional peer dependency).
|
|
25
|
+
- `calendarSwitch`: a Gregorian / Hijri / Dual switch above the calendar, with `onCalendarSystemChange`, `renderCalendarSwitch` and style keys for each part.
|
|
26
|
+
- `dualDefaultTab`, `hijriLocale` and `numerals` (`'latin'`, `'arabic'` or `'locale'` digits; values stay 0–9).
|
|
27
|
+
- `info.calendarSystem` in `onChange`: the calendar a date was picked in.
|
|
28
|
+
- `hideCalendarOnKeyboard` (on by default, as the calendar folded in 1.0.0; `false` keeps it in view) and `sheet.keyboardMaxHeight`.
|
|
29
|
+
- `strings.a11yClose` for the sheet backdrop's screen-reader label, which was always English.
|
|
30
|
+
- `strings.dateTimeSeparator` (default `' '`): what goes between the date and the time in the field text and its placeholder.
|
|
31
|
+
- `hijriDateText` and `arabicDigits`, the helpers the field uses to write a Hijri date and Arabic digits, so an app's own text (filter chips, summaries) matches the field.
|
|
32
|
+
- New optional keys: `ThemeTokens.outsideText` and the `PickerStrings` keys `calendarGregorian`, `calendarHijri`, `calendarDual`, `a11yCalendarSystem` and `a11yClose`. A full 1.0.0 `ThemeTokens` or `PickerStrings` object still compiles.
|
|
33
|
+
- Exported types: `ChangeInfo`, `CalendarSwitchRenderProps`, `CalendarSystem`, `Numerals`, `RangeRole`, `StyleKey`, `PickerStyleValue`.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- A range end picked on the start's day starts an hour after the start (within the day's `timeBounds`), so a same-day date-time range isn't out of order before the user touches the time.
|
|
38
|
+
- With `commitMode="instant"`, each value is saved once, and typing in the sheet's field saves when focus leaves it or its last box fills.
|
|
39
|
+
- A controlled `visible` waits for the keyboard to close before opening, like the built-in open.
|
|
40
|
+
- The sheet's body scrolls without a scroll bar, and day cells are read out from the platform's own month and weekday names.
|
|
41
|
+
- `getConstraints` gets `yearRange` in `ctx.limits.minDate` / `maxDate`.
|
|
42
|
+
- Time boxes and wheel columns are read out with their row's label ("Start time, Hour"), and a custom `renderMonthChip` keeps the chip's role, name and state.
|
|
43
|
+
- A date typed in another month brings the calendar to that month; browsing without picking leaves it on the month you browsed to, folded or not.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- Android, edge-to-edge apps (the default from Android 15 / recent Expo): the sheet now sits above the keyboard instead of behind it, and Confirm no longer sits under the navigation bar's Back / Home buttons.
|
|
48
|
+
- A date typed or pasted with separators and no padding (`1/12/2025`) reads as 1 December, not 11 February.
|
|
49
|
+
- The field writes AM / PM with `strings.am` / `strings.pm`, like the time row.
|
|
50
|
+
- A minute off the wheel's step shows at the nearest row, not 00.
|
|
51
|
+
- Multiple dates saved with different times keep them on Confirm; before, every date took the first date's time. A day listed twice counts once.
|
|
52
|
+
- Instant mode no longer saves twice on a tap, again on parent re-renders while `value` catches up, or values half-way through typing; a date still being typed is saved when the sheet closes.
|
|
53
|
+
- A controlled `calendarSystem` fed from `onCalendarSystemChange` keeps each selection in one calendar, and typing in the on-screen field keeps the saved date's calendar.
|
|
54
|
+
- Limits built with `dependsOnNow` refresh every minute while the picker is open.
|
|
55
|
+
- Holidays load for the next or previous year when the grid shows its days (a Hijri month running into January, December's outside days).
|
|
56
|
+
- From / To: tapping the start again deselects it instead of leaving the range stuck.
|
|
57
|
+
- A folded calendar comes back on the month and view it showed.
|
|
58
|
+
- The sheet keeps some room under a keyboard as tall as the window, knows a keyboard that's already up, and reads it as down once it has hidden on iOS.
|
|
59
|
+
- RTL chevrons and the selected month chip, digits typed in Arabic and Persian, the date order on Hermes for Android and iOS `ar-SA`, iOS month and weekday names, and scrolling the sheet from the calendar grid.
|
|
60
|
+
|
|
61
|
+
### Performance
|
|
62
|
+
|
|
63
|
+
- A tap redraws only the day cells that changed, not all 42, and Hijri dates are worked out once.
|
|
64
|
+
|
|
65
|
+
## [1.0.0] - 2026-10-27
|
|
66
|
+
|
|
67
|
+
Initial release.
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- `DateTimePicker` for dates and date-times, in `single`, `multiple` and `range` modes (one field or From / To), as a bottom sheet or inline. Range lengths (`minDays` / `maxDays`) count calendar days, both ends included.
|
|
72
|
+
- String values in `'iso'` (default) or `'utc-midnight'` format, or through your own `ValueAdapter`.
|
|
73
|
+
- Typed segments in the field, typed time boxes or a wheel, 12- / 24-hour, minute steps that divide the hour.
|
|
74
|
+
- Limits: `minDate` / `maxDate`, `disabledWeekdays`, `disabledDates` / `enabledDates`, `timeBounds`, `holidays` / `loadHolidays` / `disableHolidays`, and `getConstraints` for full control. `createConstraints` is exported.
|
|
75
|
+
- Gregorian, dual and Hijri (Umm al-Qura) calendars, with a Gregorian fallback.
|
|
76
|
+
- Locale-based defaults for the date order and the clock (through `Intl`) and for the first day of the week (from the locale's region).
|
|
77
|
+
- Theme tokens, `styles` keys for every part, `strings` for every text, and render props for the sheet, field, label, instruction, days, cells and time row.
|
|
78
|
+
- The system font by default, so there's nothing to load. `INTER_FONTS` switches to Inter (`Inter-Regular`, `Inter-Medium`, `Inter-SemiBold`, loaded by the app); `SYSTEM_FONTS` switches back.
|
|
79
|
+
- A `fontFamily` token that sets the font for all text, next to the per-weight `fontRegular` / `fontMedium` / `fontSemiBold`.
|
|
80
|
+
- `icons` replaces any icon with your own component or hides it, and `iconProps` sets each icon's colour, disabled colour, size, width and height.
|
|
81
|
+
- `renderField` receives `displayText` and `clear`, so your own input can show the value and clear it. `renderTimeRow` receives `time`, `rangeTimes` and `setTime`, so your own time row can change the time.
|
|
82
|
+
- `initialVisibleDate` opens an empty calendar on a chosen month (e.g. for a date of birth).
|
|
83
|
+
- `sheet` sets the sheet's `height` and `maxHeight`, whether the header and footer stay fixed or scroll with the body, and whether the field above the calendar shows (`showField`, `fieldPlaceholder`), and whether that field shows the calendar icon (`fieldIcon`).
|
|
84
|
+
- Placeholder strings for the typed segments and time boxes (`placeholderDay`, `placeholderMonth`, `placeholderYear`, `placeholderHour`, `placeholderHour24`, `placeholderMinute`).
|
|
85
|
+
- `precision: 'month' | 'year'` picks a whole month or year: the month or year grid is the last step, the saved value is the period's first day, the field shows "March 2026" / "2026", and a period can be picked when any day in it can. The current month or year is outlined (`monthCellCurrent`, `yearCellCurrent`).
|
|
86
|
+
- `strings.rangeSeparator` (default `' – '`) joins the two ends of a range in the field text.
|
|
87
|
+
- `fieldTextDisabled` style key for the value's text while the field is disabled.
|
|
88
|
+
- With `commitMode="instant"`, × in the field above the calendar clears the saved value (`onChange('')`), not just the selection.
|
|
89
|
+
- Text style keys for every text: `yearCellText`, `monthCellText`, `daySubLabel`, `timeBoxText`, `ampmOptionText`, `wheelText`, `todayButtonText`, `fieldPeriodText`.
|
|
90
|
+
- `validate` runs your own check before a value is saved (on Confirm, with `commitMode="instant"`, and when typing in the on-screen field) and shows its message (`styles.validationText`).
|
|
91
|
+
- Times are checked when Confirm is pressed, not while typing; `onError` reports the time problem.
|
|
92
|
+
- Typed segments handle fast input (hardware keyboards, autofill) without dropping or doubling digits, and a full last box can still be corrected.
|
|
93
|
+
- With `allowFieldTyping`, the on-screen field saves once typing pauses (focus leaves it or its last box fills), not on every complete value.
|
|
94
|
+
- A date typed into the field takes the time already entered in the time row, so Confirm works without retyping it.
|
|
95
|
+
- In 12-hour mode a typed time reads as AM until switched; segment boxes grow with the font size and system text size, and the time wraps to a second line instead of overlapping the icons.
|
|
96
|
+
- A bad `minuteStep`, an unknown `timeZone` or a throwing custom `parse` falls back with a development warning instead of crashing.
|
|
97
|
+
- `dateFormat` in any case (`'dd/mm/yyyy'`). A format the picker can't use warns in development and falls back to the locale order.
|
|
98
|
+
- Accessibility labels and states, reduce-motion support, a font-scale cap and RTL mirroring. On iOS every typed box gets a Done button above the number pad, and errors are announced to VoiceOver.
|
|
99
|
+
|
|
100
|
+
[1.1.0]: https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/compare/v1.0.0...v1.1.0
|
|
101
|
+
[1.0.0]: https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/releases/tag/v1.0.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bhairavi M
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,177 @@
|
|
|
1
|
-
#
|
|
1
|
+
# rn-grid-date-time-picker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/rn-grid-date-time-picker)
|
|
4
|
+

|
|
5
|
+
[](https://www.npmjs.com/package/rn-grid-date-time-picker)
|
|
6
|
+
|
|
7
|
+
A themeable date and time picker for React Native: one date, several dates or a range, typed or tapped, with limits, holidays and the Hijri calendar. Pure JS, so there's nothing native to install. It runs on iOS and Android and works in Expo Go.
|
|
8
|
+
|
|
9
|
+
<!-- Absolute URLs so the screenshots also show on npmjs.com. -->
|
|
10
|
+
<p align="center">
|
|
11
|
+
<img src="https://raw.githubusercontent.com/Bhairavi-ancy/rn-grid-date-time-picker/main/docs/screenshots.png" width="760" alt="The bottom sheet three ways: a date picked, a From / To date range, and a date with a typed time" />
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<!--
|
|
15
|
+
Live demo: after publishing, create a Snack (see CONTRIBUTING.md) and uncomment.
|
|
16
|
+
The query offers only Expo Go, iOS and Android (no web) and opens on Android.
|
|
17
|
+
|
|
18
|
+
**[Try it in Expo Snack →](https://snack.expo.dev/@your-account/rn-grid-date-time-picker?supportedPlatforms=mydevice,ios,android&platform=android)**
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
## Why this picker
|
|
22
|
+
|
|
23
|
+
- **Every kind of pick**: one date, several dates, or a range in one field or as From / To, with or without a time. Month-and-year and year-only picks too.
|
|
24
|
+
- **Typed or tapped**: users type the date and time, or pick them on the calendar. Time is typed boxes or a scrolling wheel, 12- or 24-hour, in minute steps.
|
|
25
|
+
- **Only the days you allow**: block past dates, weekends, holidays loaded from your server, booked days, or hours outside opening times.
|
|
26
|
+
- **Saves only on Confirm**: by default `onChange` fires once, when the user confirms, and closing the sheet never touches your value. `commitMode="instant"` saves each edit instead.
|
|
27
|
+
- **Gregorian, Hijri or both**: a Hijri (Umm al-Qura) calendar written in Arabic, Gregorian and Hijri tabs, or a switch between them. Layouts mirror in RTL.
|
|
28
|
+
- **Your design**: colours, fonts, corners and every text, a style for every part, or your own field, sheet and day cells.
|
|
29
|
+
- **Accessible and light**: every control is labelled for screen readers, reduce motion is respected, and the only dependency is [Luxon](https://moment.github.io/luxon/).
|
|
30
|
+
|
|
31
|
+
## Hijri and Arabic
|
|
32
|
+
|
|
33
|
+
<img align="right" src="https://raw.githubusercontent.com/Bhairavi-ancy/rn-grid-date-time-picker/main/docs/hijri-dual.png" width="200" alt="Gregorian and Hijri tabs, the Hijri month in Arabic" />
|
|
34
|
+
|
|
35
|
+
`calendarSystem="hijri"` lays out Hijri months, days and years in Arabic, whatever your app's language. `"dual"` shows Gregorian and Hijri as two tabs, and `calendarSwitch` lets users switch for themselves. Values stay plain Gregorian strings, so your API doesn't change.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<DateTimePicker
|
|
39
|
+
type="date"
|
|
40
|
+
value={value}
|
|
41
|
+
onChange={setValue}
|
|
42
|
+
calendarSystem="dual"
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
More in [Locale, RTL and Hijri](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/localization.md).
|
|
47
|
+
|
|
48
|
+
<br clear="right" />
|
|
49
|
+
|
|
50
|
+
## Make it yours
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<img src="https://raw.githubusercontent.com/Bhairavi-ancy/rn-grid-date-time-picker/main/docs/theme-blue-sharp.png" width="200" alt="Blue accent, square corners" />
|
|
54
|
+
<img src="https://raw.githubusercontent.com/Bhairavi-ancy/rn-grid-date-time-picker/main/docs/theme-teal.png" width="200" alt="Teal accent, medium corners" />
|
|
55
|
+
<img src="https://raw.githubusercontent.com/Bhairavi-ancy/rn-grid-date-time-picker/main/docs/theme-coral-round.png" width="200" alt="Coral accent, round corners" />
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
One `theme` prop sets the colours, fonts, corners and sizes. Each of the sheets above is one line:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
const blue = { accent: '#2563EB', rangeFill: '#DBEAFE', radius: 4 };
|
|
62
|
+
const teal = { accent: '#0F766E', rangeFill: '#CCFBF1', radius: 8 };
|
|
63
|
+
const coral = { accent: '#D9434B', rangeFill: '#FDE2E2', radius: 16 };
|
|
64
|
+
|
|
65
|
+
<DateTimePicker type="date" value={value} onChange={setValue} theme={teal} />
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Every text can be changed with `strings`, every part has a style key in `styles`, and the field, sheet and day cells can be your own components. See [Theming, fonts and icons](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/theming.md).
|
|
69
|
+
|
|
70
|
+
## Install
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
npm i rn-grid-date-time-picker
|
|
74
|
+
# or
|
|
75
|
+
yarn add rn-grid-date-time-picker
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
There are no native steps. `react` (18 or later) and `react-native` (0.71 or later) are peer dependencies.
|
|
79
|
+
|
|
80
|
+
## Quick start
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { useState } from 'react';
|
|
84
|
+
import DateTimePicker, { type PickerValue } from 'rn-grid-date-time-picker';
|
|
85
|
+
|
|
86
|
+
export function DueDate() {
|
|
87
|
+
const [value, setValue] = useState<PickerValue>('');
|
|
88
|
+
return (
|
|
89
|
+
<DateTimePicker
|
|
90
|
+
type="date"
|
|
91
|
+
label="Due date"
|
|
92
|
+
value={value} // '2026-10-24'
|
|
93
|
+
onChange={setValue}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A date-time value:
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<DateTimePicker
|
|
103
|
+
type="datetime"
|
|
104
|
+
value={startsAt} // '2026-10-24T10:00:00.000Z'
|
|
105
|
+
onChange={setStartsAt}
|
|
106
|
+
timeZone="Europe/London"
|
|
107
|
+
minuteStep={15}
|
|
108
|
+
/>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
A range:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<DateTimePicker
|
|
115
|
+
type="date"
|
|
116
|
+
mode="range"
|
|
117
|
+
range={{ layout: 'fromTo', minDays: 1, maxDays: 14 }}
|
|
118
|
+
value={stay} // { from: '2026-10-24', to: '2026-10-27' }
|
|
119
|
+
onChange={setStay}
|
|
120
|
+
/>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Values are strings, so they go straight into a form, a store or an API. See [Values](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/values.md) for other formats.
|
|
124
|
+
|
|
125
|
+
## Common props
|
|
126
|
+
|
|
127
|
+
| Prop | Type | Default | What it does |
|
|
128
|
+
|---|---|---|---|
|
|
129
|
+
| `type` | `'date' \| 'datetime'` | required | A date, or a date and time |
|
|
130
|
+
| `mode` | `'single' \| 'multiple' \| 'range'` | `'single'` | One date, several, or a range |
|
|
131
|
+
| `value` / `onChange` | `PickerValue` | required | The saved value; `onChange` fires on Confirm |
|
|
132
|
+
| `presentation` | `'sheet' \| 'inline'` | `'sheet'` | A bottom sheet, or in place on the page |
|
|
133
|
+
| `label`, `placeholder` | `string` | – | The field's label and placeholder |
|
|
134
|
+
| `allowTyping` | `boolean` | `false` | Type the date and time in the sheet |
|
|
135
|
+
| `allowClear` | `boolean` | `false` | An × that clears the value |
|
|
136
|
+
| `minDate`, `maxDate` | `{ year, month, day }` | – | The first and last days that can be picked |
|
|
137
|
+
| `disabledWeekdays` | `Weekday[]` | `[]` | Weekdays that can't be picked, e.g. `[6, 7]` |
|
|
138
|
+
| `holidays`, `loadHolidays` | `string[]`, `(year) => Promise<string[]>` | – | Holidays to mark, or to block with `disableHolidays` |
|
|
139
|
+
| `timeInput` | `'typed' \| 'wheel'` | `'typed'` | Typed time boxes or a scrolling wheel |
|
|
140
|
+
| `timeFormat` | `'12h' \| '24h'` | from `locale` | The clock |
|
|
141
|
+
| `minuteStep` | `number` | `1` | Minutes in steps, e.g. `15` |
|
|
142
|
+
| `locale` | BCP-47 tag | the device's | Month and weekday names, date order, first day of the week |
|
|
143
|
+
| `calendarSystem` | `'gregory' \| 'dual' \| 'hijri'` | `'gregory'` | The calendar |
|
|
144
|
+
| `theme` | `Partial<ThemeTokens>` | – | Colours, fonts, corners and sizes |
|
|
145
|
+
| `strings` | `Partial<PickerStrings>` | English | Every visible and spoken text |
|
|
146
|
+
|
|
147
|
+
Every other prop is in [Props](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/props.md).
|
|
148
|
+
|
|
149
|
+
## How do I…
|
|
150
|
+
|
|
151
|
+
- **Grey out past days, weekends or booked days?** [Limits and validation](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/limits.md)
|
|
152
|
+
- **Check a value with my own rule on Confirm?** [Your own validation](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/limits.md#your-own-validation)
|
|
153
|
+
- **Store epoch milliseconds or UTC midnight?** [Values](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/values.md)
|
|
154
|
+
- **Change the sheet, or show the picker inline?** [Sheet, field and time](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/presentation.md)
|
|
155
|
+
- **Use my own input or my own sheet?** [Your own input](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/presentation.md#your-own-input)
|
|
156
|
+
- **Pick only a month and year?** `precision="month"` in [Props](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/props.md#calendar)
|
|
157
|
+
- **Match my app's colours, fonts and icons?** [Theming, fonts and icons](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/theming.md)
|
|
158
|
+
- **Translate the texts?** [Strings and i18n](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/localization.md#strings--i18n)
|
|
159
|
+
- **Find the testIDs for my tests?** [Accessibility and testing](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/testing.md)
|
|
160
|
+
|
|
161
|
+
All pages: [docs](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/README.md).
|
|
162
|
+
|
|
163
|
+
## Platform support
|
|
164
|
+
|
|
165
|
+
- **iOS and Android**, in Expo Go and bare React Native apps. Web is untested.
|
|
166
|
+
- **Hijri** needs the platform's `Intl` support for the Islamic calendar. Some Hermes builds on Android lack it, and the picker then falls back to Gregorian.
|
|
167
|
+
- **The built-in sheet** sits on the keyboard while it's up, and keeps the home indicator or Android's navigation bar free below Confirm, read from `react-native-safe-area-context` when your app has it, or from `sheet.bottomInset`.
|
|
168
|
+
|
|
169
|
+
Other known limits are listed in the [docs](https://github.com/Bhairavi-ancy/rn-grid-date-time-picker/blob/main/docs/README.md#platform-support-and-known-limits).
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the setup, scripts and the example app.
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT © 2026 Bhairavi M. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "isoAdapter", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _iso.isoAdapter;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.resolveAdapter = void 0;
|
|
13
|
+
Object.defineProperty(exports, "utcMidnightAdapter", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _utcMidnight.utcMidnightAdapter;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _iso = require("./iso.js");
|
|
20
|
+
var _utcMidnight = require("./utcMidnight.js");
|
|
21
|
+
/** The adapter for a `valueFormat` prop (default 'iso'). */
|
|
22
|
+
const resolveAdapter = (valueFormat = 'iso') => {
|
|
23
|
+
if (valueFormat === 'iso') return _iso.isoAdapter;
|
|
24
|
+
if (valueFormat === 'utc-midnight') return _utcMidnight.utcMidnightAdapter;
|
|
25
|
+
return valueFormat;
|
|
26
|
+
};
|
|
27
|
+
exports.resolveAdapter = resolveAdapter;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_iso","require","_utcMidnight","resolveAdapter","valueFormat","isoAdapter","utcMidnightAdapter","exports"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA;AACO,MAAME,cAAc,GAAGA,CAC5BC,WAAwB,GAAG,KAAK,KACf;EACjB,IAAIA,WAAW,KAAK,KAAK,EAAE,OAAOC,eAAU;EAC5C,IAAID,WAAW,KAAK,cAAc,EAAE,OAAOE,+BAAkB;EAC7D,OAAOF,WAAW;AACpB,CAAC;AAACG,OAAA,CAAAJ,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isoAdapter = void 0;
|
|
7
|
+
var _calendarDate = require("../core/calendarDate.js");
|
|
8
|
+
var _utcMidnight = require("./utcMidnight.js");
|
|
9
|
+
/**
|
|
10
|
+
* `valueFormat: 'iso'` (the default):
|
|
11
|
+
* - date: 'YYYY-MM-DD'; anything else is invalid;
|
|
12
|
+
* - date-time: the same as 'utc-midnight', a UTC ISO instant with seconds and
|
|
13
|
+
* milliseconds zeroed, read and written in `timeZone`.
|
|
14
|
+
*
|
|
15
|
+
* There is no `formatUnchanged`: an untouched Confirm emits the stored string as it came in.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
19
|
+
const isoAdapter = exports.isoAdapter = {
|
|
20
|
+
parse: (raw, {
|
|
21
|
+
type,
|
|
22
|
+
timeZone
|
|
23
|
+
}) => {
|
|
24
|
+
if (type === 'datetime') return (0, _utcMidnight.parseInstant)(raw, timeZone);
|
|
25
|
+
if (!raw || !DATE_ONLY.test(raw)) return null;
|
|
26
|
+
const date = (0, _calendarDate.fromDateKey)(raw);
|
|
27
|
+
return date && (0, _calendarDate.isValidCalendarDate)(date) ? {
|
|
28
|
+
date,
|
|
29
|
+
time: null
|
|
30
|
+
} : null;
|
|
31
|
+
},
|
|
32
|
+
format: (value, {
|
|
33
|
+
type,
|
|
34
|
+
timeZone
|
|
35
|
+
}) => {
|
|
36
|
+
if (type === 'datetime') return (0, _utcMidnight.formatInstant)(value, timeZone);
|
|
37
|
+
return value && (0, _calendarDate.isValidCalendarDate)(value.date) && (0, _utcMidnight.isWritableYear)(value.date.year) ? (0, _calendarDate.toDateKey)(value.date) : '';
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=iso.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_calendarDate","require","_utcMidnight","DATE_ONLY","isoAdapter","exports","parse","raw","type","timeZone","parseInstant","test","date","fromDateKey","isValidCalendarDate","time","format","value","formatInstant","isWritableYear","year","toDateKey"],"sourceRoot":"../../../src","sources":["adapters/iso.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAME,SAAS,GAAG,qBAAqB;AAEhC,MAAMC,UAAwB,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACtCE,KAAK,EAAEA,CAACC,GAAG,EAAE;IAAEC,IAAI;IAAEC;EAAS,CAAC,KAAK;IAClC,IAAID,IAAI,KAAK,UAAU,EAAE,OAAO,IAAAE,yBAAY,EAACH,GAAG,EAAEE,QAAQ,CAAC;IAC3D,IAAI,CAACF,GAAG,IAAI,CAACJ,SAAS,CAACQ,IAAI,CAACJ,GAAG,CAAC,EAAE,OAAO,IAAI;IAC7C,MAAMK,IAAI,GAAG,IAAAC,yBAAW,EAACN,GAAG,CAAC;IAC7B,OAAOK,IAAI,IAAI,IAAAE,iCAAmB,EAACF,IAAI,CAAC,GAAG;MAAEA,IAAI;MAAEG,IAAI,EAAE;IAAK,CAAC,GAAG,IAAI;EACxE,CAAC;EACDC,MAAM,EAAEA,CAACC,KAAK,EAAE;IAAET,IAAI;IAAEC;EAAS,CAAC,KAAK;IACrC,IAAID,IAAI,KAAK,UAAU,EAAE,OAAO,IAAAU,0BAAa,EAACD,KAAK,EAAER,QAAQ,CAAC;IAC9D,OAAOQ,KAAK,IACV,IAAAH,iCAAmB,EAACG,KAAK,CAACL,IAAI,CAAC,IAC/B,IAAAO,2BAAc,EAACF,KAAK,CAACL,IAAI,CAACQ,IAAI,CAAC,GAC7B,IAAAC,uBAAS,EAACJ,KAAK,CAACL,IAAI,CAAC,GACrB,EAAE;EACR;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.utcMidnightAdapter = exports.parseInstant = exports.isWritableYear = exports.formatInstant = void 0;
|
|
7
|
+
var _luxon = require("luxon");
|
|
8
|
+
var _calendarDate = require("../core/calendarDate.js");
|
|
9
|
+
var _zoned = require("../core/zoned.js");
|
|
10
|
+
/**
|
|
11
|
+
* `valueFormat: 'utc-midnight'`:
|
|
12
|
+
* - date: 'YYYY-MM-DDT00:00:00.000Z', the calendar day (never shifted by a zone);
|
|
13
|
+
* - date-time: a UTC ISO string with seconds and milliseconds zeroed.
|
|
14
|
+
*
|
|
15
|
+
* `zone` is passed in by the caller; this module never reads the device zone.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const isValidTime = t => !!t && Number.isInteger(t.hour) && Number.isInteger(t.minute) && t.hour >= 0 && t.hour <= 23 && t.minute >= 0 && t.minute <= 59;
|
|
19
|
+
|
|
20
|
+
/** Years that ISO strings write with four digits, so they read back the same. */
|
|
21
|
+
const isWritableYear = year => year >= 1 && year <= 9999;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A stored value must start with a full day: Luxon also reads '10:30' (today),
|
|
25
|
+
* '2026' or week and ordinal dates, which aren't dates the picker saved.
|
|
26
|
+
*/
|
|
27
|
+
exports.isWritableYear = isWritableYear;
|
|
28
|
+
const STARTS_WITH_DAY = /^\d{4}-\d{2}-\d{2}(?:T|$)/;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A stored instant → its day and wall-clock time in `zone`, or null when it
|
|
32
|
+
* can't be parsed. Shared by every built-in format for date-time values.
|
|
33
|
+
*/
|
|
34
|
+
const parseInstant = (value, zone) => {
|
|
35
|
+
if (!value || !STARTS_WITH_DAY.test(value)) return null;
|
|
36
|
+
const utc = _luxon.DateTime.fromISO(value, {
|
|
37
|
+
zone: 'utc'
|
|
38
|
+
});
|
|
39
|
+
if (!utc.isValid) return null;
|
|
40
|
+
const local = utc.setZone(zone);
|
|
41
|
+
if (!local.isValid || !isWritableYear(local.year)) return null;
|
|
42
|
+
return {
|
|
43
|
+
date: (0, _calendarDate.calendarDateOf)(local),
|
|
44
|
+
time: {
|
|
45
|
+
hour: local.hour,
|
|
46
|
+
minute: local.minute
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A date-time value → a UTC ISO instant (seconds and ms zeroed), or '' when it
|
|
53
|
+
* is incomplete. Shared by every built-in format for date-time values.
|
|
54
|
+
*/
|
|
55
|
+
exports.parseInstant = parseInstant;
|
|
56
|
+
const formatInstant = (value, zone) => {
|
|
57
|
+
if (!value || !(0, _calendarDate.isValidCalendarDate)(value.date)) return '';
|
|
58
|
+
if (!isValidTime(value.time)) return '';
|
|
59
|
+
const utc = (0, _zoned.toZonedDateTime)(value, zone).toUTC();
|
|
60
|
+
// A day near year 1 or 9999 can fall in year 0 or 10000 in UTC.
|
|
61
|
+
return utc.isValid && isWritableYear(utc.year) ? utc.toISO() ?? '' : '';
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Saved string → picker value. Returns null for '' or an unparsable string. */
|
|
65
|
+
exports.formatInstant = formatInstant;
|
|
66
|
+
const fromWire = (value, type, zone) => {
|
|
67
|
+
if (!value) return null;
|
|
68
|
+
if (type !== 'date') return parseInstant(value, zone);
|
|
69
|
+
if (!STARTS_WITH_DAY.test(value)) return null;
|
|
70
|
+
// The calendar day as written: an offset in the string ('+05:30') is kept,
|
|
71
|
+
// not converted to UTC, so the day never moves.
|
|
72
|
+
const written = _luxon.DateTime.fromISO(value, {
|
|
73
|
+
setZone: true
|
|
74
|
+
});
|
|
75
|
+
if (!written.isValid || !isWritableYear(written.year)) return null;
|
|
76
|
+
return {
|
|
77
|
+
date: (0, _calendarDate.calendarDateOf)(written),
|
|
78
|
+
time: null
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Picker value → saved string. Returns '' when the value is incomplete
|
|
84
|
+
* (no valid day, or a date-time without a valid time).
|
|
85
|
+
*/
|
|
86
|
+
const toWire = (value, type, zone) => {
|
|
87
|
+
if (!value || !(0, _calendarDate.isValidCalendarDate)(value.date)) return '';
|
|
88
|
+
if (!isWritableYear(value.date.year)) return '';
|
|
89
|
+
if (type === 'date') {
|
|
90
|
+
return _luxon.DateTime.utc(value.date.year, value.date.month, value.date.day).toISO() ?? '';
|
|
91
|
+
}
|
|
92
|
+
return formatInstant(value, zone);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* What to emit when the user confirms without changing anything.
|
|
97
|
+
* - date-time keeps the stored instant, including seconds/ms (re-serialised as UTC ISO);
|
|
98
|
+
* - date re-serialises the stored day, as written, as UTC midnight.
|
|
99
|
+
* Returns '' for an unparsable value.
|
|
100
|
+
*/
|
|
101
|
+
const unchangedWire = (value, type) => {
|
|
102
|
+
if (!value) return '';
|
|
103
|
+
if (type === 'datetime') {
|
|
104
|
+
if (!STARTS_WITH_DAY.test(value)) return '';
|
|
105
|
+
const dt = _luxon.DateTime.fromISO(value, {
|
|
106
|
+
zone: 'utc'
|
|
107
|
+
});
|
|
108
|
+
return dt.isValid ? dt.toUTC().toISO() ?? '' : '';
|
|
109
|
+
}
|
|
110
|
+
return toWire(fromWire(value, 'date', 'utc'), 'date', 'utc');
|
|
111
|
+
};
|
|
112
|
+
const utcMidnightAdapter = exports.utcMidnightAdapter = {
|
|
113
|
+
parse: (raw, {
|
|
114
|
+
type,
|
|
115
|
+
timeZone
|
|
116
|
+
}) => fromWire(raw, type, timeZone),
|
|
117
|
+
format: (value, {
|
|
118
|
+
type,
|
|
119
|
+
timeZone
|
|
120
|
+
}) => toWire(value, type, timeZone),
|
|
121
|
+
formatUnchanged: (raw, {
|
|
122
|
+
type
|
|
123
|
+
}) => unchangedWire(raw, type)
|
|
124
|
+
};
|
|
125
|
+
//# sourceMappingURL=utcMidnight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_luxon","require","_calendarDate","_zoned","isValidTime","t","Number","isInteger","hour","minute","isWritableYear","year","exports","STARTS_WITH_DAY","parseInstant","value","zone","test","utc","DateTime","fromISO","isValid","local","setZone","date","calendarDateOf","time","formatInstant","isValidCalendarDate","toZonedDateTime","toUTC","toISO","fromWire","type","written","toWire","month","day","unchangedWire","dt","utcMidnightAdapter","parse","raw","timeZone","format","formatUnchanged"],"sourceRoot":"../../../src","sources":["adapters/utcMidnight.ts"],"mappings":"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","ignoreList":[]}
|