rn-grid-date-time-picker 1.0.0 → 1.2.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 +86 -0
- package/README.md +100 -638
- package/lib/commonjs/adapters/utcMidnight.js +15 -6
- package/lib/commonjs/adapters/utcMidnight.js.map +1 -1
- package/lib/commonjs/components/DateTimePicker.js +484 -85
- package/lib/commonjs/components/DateTimePicker.js.map +1 -1
- package/lib/commonjs/components/calendar/Calendar.js +21 -7
- package/lib/commonjs/components/calendar/Calendar.js.map +1 -1
- package/lib/commonjs/components/calendar/CalendarHeader.js +46 -6
- package/lib/commonjs/components/calendar/CalendarHeader.js.map +1 -1
- 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 +8 -3
- package/lib/commonjs/components/calendar/DayCell.js.map +1 -1
- package/lib/commonjs/components/calendar/DayGrid.js +13 -2
- package/lib/commonjs/components/calendar/DayGrid.js.map +1 -1
- package/lib/commonjs/components/calendar/PeriodGrid.js +3 -1
- package/lib/commonjs/components/calendar/PeriodGrid.js.map +1 -1
- package/lib/commonjs/components/calendar/calendarStyles.js +3 -2
- package/lib/commonjs/components/calendar/calendarStyles.js.map +1 -1
- package/lib/commonjs/components/calendar/localeNames.js +46 -24
- package/lib/commonjs/components/calendar/localeNames.js.map +1 -1
- package/lib/commonjs/components/calendar/selection.js +9 -1
- package/lib/commonjs/components/calendar/selection.js.map +1 -1
- package/lib/commonjs/components/container/DefaultSheet.js +42 -11
- package/lib/commonjs/components/container/DefaultSheet.js.map +1 -1
- package/lib/commonjs/components/container/PickerContainer.js +4 -0
- package/lib/commonjs/components/container/PickerContainer.js.map +1 -1
- package/lib/commonjs/components/container/PickerLayout.js +1 -1
- package/lib/commonjs/components/container/PickerLayout.js.map +1 -1
- package/lib/commonjs/components/container/containerStyles.js +12 -4
- package/lib/commonjs/components/container/containerStyles.js.map +1 -1
- package/lib/commonjs/components/field/RangeFields.js +5 -1
- package/lib/commonjs/components/field/RangeFields.js.map +1 -1
- package/lib/commonjs/components/field/SegmentedInput.js +8 -3
- package/lib/commonjs/components/field/SegmentedInput.js.map +1 -1
- package/lib/commonjs/components/field/ValueField.js +64 -8
- package/lib/commonjs/components/field/ValueField.js.map +1 -1
- package/lib/commonjs/components/field/fieldStyles.js +17 -0
- package/lib/commonjs/components/field/fieldStyles.js.map +1 -1
- package/lib/commonjs/components/field/fieldText.js +29 -13
- package/lib/commonjs/components/field/fieldText.js.map +1 -1
- 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 +36 -13
- package/lib/commonjs/components/hooks/useKeyboardFold.js.map +1 -1
- package/lib/commonjs/components/hooks/useOpenPicker.js +39 -17
- package/lib/commonjs/components/hooks/useOpenPicker.js.map +1 -1
- package/lib/commonjs/components/hooks/useTypedSegments.js +6 -2
- package/lib/commonjs/components/hooks/useTypedSegments.js.map +1 -1
- package/lib/commonjs/components/theme/defaultStrings.js +13 -3
- package/lib/commonjs/components/theme/defaultStrings.js.map +1 -1
- package/lib/commonjs/components/theme/direction.js +17 -0
- package/lib/commonjs/components/theme/direction.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 +10 -2
- package/lib/commonjs/components/theme/styleKeys.js.map +1 -1
- package/lib/commonjs/components/theme/tokens.js +4 -0
- package/lib/commonjs/components/theme/tokens.js.map +1 -1
- package/lib/commonjs/components/time/TimeRow.js +10 -2
- package/lib/commonjs/components/time/TimeRow.js.map +1 -1
- package/lib/commonjs/components/time/TypedTime.js +3 -1
- package/lib/commonjs/components/time/TypedTime.js.map +1 -1
- package/lib/commonjs/components/time/Wheel.js +20 -3
- package/lib/commonjs/components/time/Wheel.js.map +1 -1
- package/lib/commonjs/components/time/timeStyles.js +4 -5
- package/lib/commonjs/components/time/timeStyles.js.map +1 -1
- package/lib/commonjs/components/types.js +10 -0
- package/lib/commonjs/components/types.js.map +1 -1
- package/lib/commonjs/core/calendarSystem.js +123 -22
- package/lib/commonjs/core/calendarSystem.js.map +1 -1
- package/lib/commonjs/core/digits.js +25 -0
- package/lib/commonjs/core/digits.js.map +1 -0
- package/lib/commonjs/core/draft.js +31 -10
- package/lib/commonjs/core/draft.js.map +1 -1
- package/lib/commonjs/core/locale.js +20 -4
- package/lib/commonjs/core/locale.js.map +1 -1
- package/lib/commonjs/core/numerals.js +46 -0
- package/lib/commonjs/core/numerals.js.map +1 -0
- package/lib/commonjs/core/segmentEditor.js +9 -0
- package/lib/commonjs/core/segmentEditor.js.map +1 -1
- package/lib/commonjs/core/segments.js +2 -11
- package/lib/commonjs/core/segments.js.map +1 -1
- package/lib/commonjs/core/selectionRules.js +2 -1
- package/lib/commonjs/core/selectionRules.js.map +1 -1
- package/lib/commonjs/core/timeEntry.js +7 -91
- package/lib/commonjs/core/timeEntry.js.map +1 -1
- package/lib/commonjs/icons/index.js +5 -1
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/index.js +20 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/adapters/utcMidnight.js +14 -5
- package/lib/module/adapters/utcMidnight.js.map +1 -1
- package/lib/module/components/DateTimePicker.js +490 -91
- package/lib/module/components/DateTimePicker.js.map +1 -1
- package/lib/module/components/calendar/Calendar.js +25 -11
- package/lib/module/components/calendar/Calendar.js.map +1 -1
- package/lib/module/components/calendar/CalendarHeader.js +47 -7
- package/lib/module/components/calendar/CalendarHeader.js.map +1 -1
- 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 +8 -3
- package/lib/module/components/calendar/DayCell.js.map +1 -1
- package/lib/module/components/calendar/DayGrid.js +14 -3
- package/lib/module/components/calendar/DayGrid.js.map +1 -1
- package/lib/module/components/calendar/PeriodGrid.js +3 -1
- package/lib/module/components/calendar/PeriodGrid.js.map +1 -1
- package/lib/module/components/calendar/calendarStyles.js +3 -2
- package/lib/module/components/calendar/calendarStyles.js.map +1 -1
- package/lib/module/components/calendar/localeNames.js +46 -24
- package/lib/module/components/calendar/localeNames.js.map +1 -1
- package/lib/module/components/calendar/selection.js +7 -0
- package/lib/module/components/calendar/selection.js.map +1 -1
- package/lib/module/components/container/DefaultSheet.js +42 -12
- package/lib/module/components/container/DefaultSheet.js.map +1 -1
- package/lib/module/components/container/PickerContainer.js +4 -0
- package/lib/module/components/container/PickerContainer.js.map +1 -1
- package/lib/module/components/container/PickerLayout.js +1 -1
- package/lib/module/components/container/PickerLayout.js.map +1 -1
- package/lib/module/components/container/containerStyles.js +11 -3
- package/lib/module/components/container/containerStyles.js.map +1 -1
- package/lib/module/components/field/RangeFields.js +5 -1
- package/lib/module/components/field/RangeFields.js.map +1 -1
- package/lib/module/components/field/SegmentedInput.js +8 -3
- package/lib/module/components/field/SegmentedInput.js.map +1 -1
- package/lib/module/components/field/ValueField.js +66 -10
- package/lib/module/components/field/ValueField.js.map +1 -1
- package/lib/module/components/field/fieldStyles.js +17 -0
- package/lib/module/components/field/fieldStyles.js.map +1 -1
- package/lib/module/components/field/fieldText.js +28 -11
- package/lib/module/components/field/fieldText.js.map +1 -1
- 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 +33 -12
- package/lib/module/components/hooks/useKeyboardFold.js.map +1 -1
- package/lib/module/components/hooks/useOpenPicker.js +39 -17
- package/lib/module/components/hooks/useOpenPicker.js.map +1 -1
- package/lib/module/components/hooks/useTypedSegments.js +6 -2
- package/lib/module/components/hooks/useTypedSegments.js.map +1 -1
- package/lib/module/components/theme/defaultStrings.js +11 -2
- package/lib/module/components/theme/defaultStrings.js.map +1 -1
- package/lib/module/components/theme/direction.js +13 -0
- package/lib/module/components/theme/direction.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 +10 -2
- package/lib/module/components/theme/styleKeys.js.map +1 -1
- package/lib/module/components/theme/tokens.js +4 -0
- package/lib/module/components/theme/tokens.js.map +1 -1
- package/lib/module/components/time/TimeRow.js +11 -3
- package/lib/module/components/time/TimeRow.js.map +1 -1
- package/lib/module/components/time/TypedTime.js +3 -1
- package/lib/module/components/time/TypedTime.js.map +1 -1
- package/lib/module/components/time/Wheel.js +18 -2
- package/lib/module/components/time/Wheel.js.map +1 -1
- package/lib/module/components/time/timeStyles.js +4 -5
- package/lib/module/components/time/timeStyles.js.map +1 -1
- package/lib/module/components/types.js +10 -0
- package/lib/module/components/types.js.map +1 -1
- package/lib/module/core/calendarSystem.js +118 -19
- package/lib/module/core/calendarSystem.js.map +1 -1
- package/lib/module/core/digits.js +20 -0
- package/lib/module/core/digits.js.map +1 -0
- package/lib/module/core/draft.js +29 -9
- package/lib/module/core/draft.js.map +1 -1
- package/lib/module/core/locale.js +18 -3
- package/lib/module/core/locale.js.map +1 -1
- package/lib/module/core/numerals.js +39 -0
- package/lib/module/core/numerals.js.map +1 -0
- package/lib/module/core/segmentEditor.js +9 -0
- package/lib/module/core/segmentEditor.js.map +1 -1
- package/lib/module/core/segments.js +0 -8
- package/lib/module/core/segments.js.map +1 -1
- package/lib/module/core/selectionRules.js +2 -1
- package/lib/module/core/selectionRules.js.map +1 -1
- package/lib/module/core/timeEntry.js +7 -89
- package/lib/module/core/timeEntry.js.map +1 -1
- package/lib/module/icons/index.js +5 -1
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/adapters/utcMidnight.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/DateTimePicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/Calendar.d.ts +8 -4
- package/lib/typescript/commonjs/src/components/calendar/Calendar.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/CalendarHeader.d.ts.map +1 -1
- 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 +1 -1
- package/lib/typescript/commonjs/src/components/calendar/DayCell.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/DayGrid.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/calendar/DayGrid.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/PeriodGrid.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/calendarStyles.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/calendar/calendarStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/localeNames.d.ts +8 -3
- package/lib/typescript/commonjs/src/components/calendar/localeNames.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/calendar/selection.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/calendar/selection.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/container/DefaultSheet.d.ts +10 -2
- package/lib/typescript/commonjs/src/components/container/DefaultSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/container/PickerContainer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/container/containerStyles.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/container/containerStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/field/RangeFields.d.ts +5 -0
- package/lib/typescript/commonjs/src/components/field/RangeFields.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/field/SegmentedInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/field/ValueField.d.ts +7 -0
- package/lib/typescript/commonjs/src/components/field/ValueField.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/field/fieldStyles.d.ts +15 -0
- package/lib/typescript/commonjs/src/components/field/fieldStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/field/fieldText.d.ts +14 -5
- package/lib/typescript/commonjs/src/components/field/fieldText.d.ts.map +1 -1
- 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 +10 -2
- package/lib/typescript/commonjs/src/components/hooks/useKeyboardFold.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/hooks/useOpenPicker.d.ts +2 -1
- package/lib/typescript/commonjs/src/components/hooks/useOpenPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/hooks/useTypedSegments.d.ts +3 -2
- package/lib/typescript/commonjs/src/components/hooks/useTypedSegments.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/theme/defaultStrings.d.ts +13 -2
- package/lib/typescript/commonjs/src/components/theme/defaultStrings.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/theme/direction.d.ts +8 -0
- package/lib/typescript/commonjs/src/components/theme/direction.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 +1 -1
- package/lib/typescript/commonjs/src/components/theme/styleKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/theme/tokens.d.ts +3 -1
- package/lib/typescript/commonjs/src/components/theme/tokens.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/time/TimeRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/time/TypedTime.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/time/Wheel.d.ts +5 -0
- package/lib/typescript/commonjs/src/components/time/Wheel.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/time/timeStyles.d.ts +0 -2
- package/lib/typescript/commonjs/src/components/time/timeStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/types.d.ts +84 -4
- package/lib/typescript/commonjs/src/components/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/calendarSystem.d.ts +20 -5
- package/lib/typescript/commonjs/src/core/calendarSystem.d.ts.map +1 -1
- 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 +12 -1
- package/lib/typescript/commonjs/src/core/draft.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/locale.d.ts +6 -0
- package/lib/typescript/commonjs/src/core/locale.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/commonjs/src/core/segments.d.ts +0 -2
- package/lib/typescript/commonjs/src/core/segments.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/selectionRules.d.ts +3 -2
- package/lib/typescript/commonjs/src/core/selectionRules.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/timeEntry.d.ts +4 -24
- package/lib/typescript/commonjs/src/core/timeEntry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +7 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/adapters/utcMidnight.d.ts.map +1 -1
- package/lib/typescript/module/src/components/DateTimePicker.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/Calendar.d.ts +8 -4
- package/lib/typescript/module/src/components/calendar/Calendar.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/CalendarHeader.d.ts.map +1 -1
- 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 +1 -1
- package/lib/typescript/module/src/components/calendar/DayCell.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/DayGrid.d.ts +2 -0
- package/lib/typescript/module/src/components/calendar/DayGrid.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/PeriodGrid.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/calendarStyles.d.ts +1 -1
- package/lib/typescript/module/src/components/calendar/calendarStyles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/localeNames.d.ts +8 -3
- package/lib/typescript/module/src/components/calendar/localeNames.d.ts.map +1 -1
- package/lib/typescript/module/src/components/calendar/selection.d.ts +2 -0
- package/lib/typescript/module/src/components/calendar/selection.d.ts.map +1 -1
- package/lib/typescript/module/src/components/container/DefaultSheet.d.ts +10 -2
- package/lib/typescript/module/src/components/container/DefaultSheet.d.ts.map +1 -1
- package/lib/typescript/module/src/components/container/PickerContainer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/container/containerStyles.d.ts +6 -0
- package/lib/typescript/module/src/components/container/containerStyles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/field/RangeFields.d.ts +5 -0
- package/lib/typescript/module/src/components/field/RangeFields.d.ts.map +1 -1
- package/lib/typescript/module/src/components/field/SegmentedInput.d.ts.map +1 -1
- package/lib/typescript/module/src/components/field/ValueField.d.ts +7 -0
- package/lib/typescript/module/src/components/field/ValueField.d.ts.map +1 -1
- package/lib/typescript/module/src/components/field/fieldStyles.d.ts +15 -0
- package/lib/typescript/module/src/components/field/fieldStyles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/field/fieldText.d.ts +14 -5
- package/lib/typescript/module/src/components/field/fieldText.d.ts.map +1 -1
- 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 +10 -2
- package/lib/typescript/module/src/components/hooks/useKeyboardFold.d.ts.map +1 -1
- package/lib/typescript/module/src/components/hooks/useOpenPicker.d.ts +2 -1
- package/lib/typescript/module/src/components/hooks/useOpenPicker.d.ts.map +1 -1
- package/lib/typescript/module/src/components/hooks/useTypedSegments.d.ts +3 -2
- package/lib/typescript/module/src/components/hooks/useTypedSegments.d.ts.map +1 -1
- package/lib/typescript/module/src/components/theme/defaultStrings.d.ts +13 -2
- package/lib/typescript/module/src/components/theme/defaultStrings.d.ts.map +1 -1
- package/lib/typescript/module/src/components/theme/direction.d.ts +8 -0
- package/lib/typescript/module/src/components/theme/direction.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 +1 -1
- package/lib/typescript/module/src/components/theme/styleKeys.d.ts.map +1 -1
- package/lib/typescript/module/src/components/theme/tokens.d.ts +3 -1
- package/lib/typescript/module/src/components/theme/tokens.d.ts.map +1 -1
- package/lib/typescript/module/src/components/time/TimeRow.d.ts.map +1 -1
- package/lib/typescript/module/src/components/time/TypedTime.d.ts.map +1 -1
- package/lib/typescript/module/src/components/time/Wheel.d.ts +5 -0
- package/lib/typescript/module/src/components/time/Wheel.d.ts.map +1 -1
- package/lib/typescript/module/src/components/time/timeStyles.d.ts +0 -2
- package/lib/typescript/module/src/components/time/timeStyles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/types.d.ts +84 -4
- package/lib/typescript/module/src/components/types.d.ts.map +1 -1
- package/lib/typescript/module/src/core/calendarSystem.d.ts +20 -5
- package/lib/typescript/module/src/core/calendarSystem.d.ts.map +1 -1
- 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 +12 -1
- package/lib/typescript/module/src/core/draft.d.ts.map +1 -1
- package/lib/typescript/module/src/core/locale.d.ts +6 -0
- package/lib/typescript/module/src/core/locale.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/typescript/module/src/core/segments.d.ts +0 -2
- package/lib/typescript/module/src/core/segments.d.ts.map +1 -1
- package/lib/typescript/module/src/core/selectionRules.d.ts +3 -2
- package/lib/typescript/module/src/core/selectionRules.d.ts.map +1 -1
- package/lib/typescript/module/src/core/timeEntry.d.ts +4 -24
- package/lib/typescript/module/src/core/timeEntry.d.ts.map +1 -1
- package/lib/typescript/module/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +7 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +22 -7
- package/src/adapters/utcMidnight.ts +14 -5
- package/src/components/DateTimePicker.tsx +607 -108
- package/src/components/calendar/Calendar.tsx +54 -16
- package/src/components/calendar/CalendarHeader.tsx +41 -9
- package/src/components/calendar/CalendarSwitch.tsx +170 -0
- package/src/components/calendar/DayCell.tsx +16 -4
- package/src/components/calendar/DayGrid.tsx +18 -3
- package/src/components/calendar/PeriodGrid.tsx +3 -1
- package/src/components/calendar/calendarStyles.ts +3 -2
- package/src/components/calendar/localeNames.ts +52 -22
- package/src/components/calendar/selection.ts +8 -0
- package/src/components/container/DefaultSheet.tsx +60 -14
- package/src/components/container/PickerContainer.tsx +4 -0
- package/src/components/container/PickerLayout.tsx +1 -1
- package/src/components/container/containerStyles.ts +12 -3
- package/src/components/field/RangeFields.tsx +12 -2
- package/src/components/field/SegmentedInput.tsx +8 -3
- package/src/components/field/ValueField.tsx +94 -18
- package/src/components/field/fieldStyles.ts +6 -0
- package/src/components/field/fieldText.ts +68 -15
- package/src/components/hooks/useBottomInset.ts +33 -0
- package/src/components/hooks/useKeyboardFold.ts +41 -13
- package/src/components/hooks/useOpenPicker.ts +41 -18
- package/src/components/hooks/useTypedSegments.ts +7 -3
- package/src/components/theme/defaultStrings.ts +29 -4
- package/src/components/theme/direction.ts +12 -0
- package/src/components/theme/numerals.ts +11 -0
- package/src/components/theme/styleKeys.ts +18 -1
- package/src/components/theme/tokens.ts +5 -1
- package/src/components/time/TimeRow.tsx +23 -3
- package/src/components/time/TypedTime.tsx +3 -1
- package/src/components/time/Wheel.tsx +19 -5
- package/src/components/time/timeStyles.ts +2 -3
- package/src/components/types.ts +86 -4
- package/src/core/calendarSystem.ts +145 -21
- package/src/core/digits.ts +21 -0
- package/src/core/draft.ts +41 -13
- package/src/core/locale.ts +20 -3
- package/src/core/numerals.ts +35 -0
- package/src/core/segmentEditor.ts +13 -0
- package/src/core/segments.ts +0 -8
- package/src/core/selectionRules.ts +3 -2
- package/src/core/timeEntry.ts +6 -96
- package/src/icons/index.tsx +3 -1
- package/src/index.tsx +12 -2
|
@@ -43,6 +43,18 @@ const create = t => StyleSheet.create({
|
|
|
43
43
|
fontSize: t.fontSizeMedium,
|
|
44
44
|
color: t.text
|
|
45
45
|
},
|
|
46
|
+
textScroll: {
|
|
47
|
+
flex: 1
|
|
48
|
+
},
|
|
49
|
+
textScrollContent: {
|
|
50
|
+
flexGrow: 1,
|
|
51
|
+
alignItems: 'center'
|
|
52
|
+
},
|
|
53
|
+
// In the scroll, or as a date set apart from its time, the text keeps its full width.
|
|
54
|
+
textScrolled: {
|
|
55
|
+
flex: 0,
|
|
56
|
+
flexShrink: 0
|
|
57
|
+
},
|
|
46
58
|
placeholder: {
|
|
47
59
|
color: t.placeholder
|
|
48
60
|
},
|
|
@@ -76,6 +88,11 @@ const create = t => StyleSheet.create({
|
|
|
76
88
|
alignItems: 'center',
|
|
77
89
|
flexWrap: 'nowrap'
|
|
78
90
|
},
|
|
91
|
+
// After a date, the time sits in the middle of the space left before the icons.
|
|
92
|
+
segmentTime: {
|
|
93
|
+
flexGrow: 1,
|
|
94
|
+
justifyContent: 'center'
|
|
95
|
+
},
|
|
79
96
|
segment: {
|
|
80
97
|
paddingVertical: 8,
|
|
81
98
|
paddingHorizontal: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","fontStyle","cache","WeakMap","create","t","wrapper","width","labelWrap","marginBottom","label","fontSize","fontSizeMedium","color","text","mandatory","error","field","flexDirection","alignItems","minHeight","fieldHeight","borderWidth","borderColor","border","borderRadius","radius","backgroundColor","background","paddingHorizontal","fieldFocused","borderFocused","fieldError","fieldDisabled","disabledBackground","flex","placeholder","disabledText","icons","marginStart","iconButton","minWidth","touchTarget","justifyContent","clearButton","marginEnd","segmentRow","direction","flexWrap","columnGap","segmentGroup","segment","paddingVertical","textAlign","segmentFocused","accent","separator","mutedText","period","periodSelected","periodText","fontSizeSmall","message","marginTop","helper","buildFieldStyles","tokens","hit","get","styles","set"],"sourceRoot":"../../../../src","sources":["components/field/fieldStyles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAA0B,oBAAiB;AAE7D,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAyC,CAAC;AAEnE,MAAMC,MAAM,GAAIC,CAAc,IAC5BL,UAAU,CAACI,MAAM,CAAC;EAChBE,OAAO,EAAE;IAAEC,KAAK,EAAE;EAAO,CAAC;EAC1BC,SAAS,EAAE;IAAEC,YAAY,EAAE;EAAE,CAAC;EAC9BC,KAAK,EAAE;IACL,GAAGT,SAAS,CAACI,CAAC,EAAE,QAAQ,CAAC;IACzBM,QAAQ,EAAEN,CAAC,CAACO,cAAc;IAC1BC,KAAK,EAAER,CAAC,CAACS;EACX,CAAC;EACDC,SAAS,EAAE;IAAEF,KAAK,EAAER,CAAC,CAACW;EAAM,CAAC;EAC7BC,KAAK,EAAE;IACLC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,SAAS,EAAEf,CAAC,CAACgB,WAAW;IACxBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAElB,CAAC,CAACmB,MAAM;IACrBC,YAAY,EAAEpB,CAAC,CAACqB,MAAM;IACtBC,eAAe,EAAEtB,CAAC,CAACuB,UAAU;IAC7BC,iBAAiB,EAAE;EACrB,CAAC;EACDC,YAAY,EAAE;IAAEP,WAAW,EAAElB,CAAC,CAAC0B;EAAc,CAAC;EAC9CC,UAAU,EAAE;IAAET,WAAW,EAAElB,CAAC,CAACW;EAAM,CAAC;EACpCiB,aAAa,EAAE;IAAEN,eAAe,EAAEtB,CAAC,CAAC6B;EAAmB,CAAC;EACxDpB,IAAI,EAAE;IACJqB,IAAI,EAAE,CAAC;IACP,GAAGlC,SAAS,CAACI,CAAC,EAAE,SAAS,CAAC;IAC1BM,QAAQ,EAAEN,CAAC,CAACO,cAAc;IAC1BC,KAAK,EAAER,CAAC,CAACS;EACX,CAAC;EACDsB,WAAW,EAAE;
|
|
1
|
+
{"version":3,"names":["StyleSheet","fontStyle","cache","WeakMap","create","t","wrapper","width","labelWrap","marginBottom","label","fontSize","fontSizeMedium","color","text","mandatory","error","field","flexDirection","alignItems","minHeight","fieldHeight","borderWidth","borderColor","border","borderRadius","radius","backgroundColor","background","paddingHorizontal","fieldFocused","borderFocused","fieldError","fieldDisabled","disabledBackground","flex","textScroll","textScrollContent","flexGrow","textScrolled","flexShrink","placeholder","disabledText","icons","marginStart","iconButton","minWidth","touchTarget","justifyContent","clearButton","marginEnd","segmentRow","direction","flexWrap","columnGap","segmentGroup","segmentTime","segment","paddingVertical","textAlign","segmentFocused","accent","separator","mutedText","period","periodSelected","periodText","fontSizeSmall","message","marginTop","helper","buildFieldStyles","tokens","hit","get","styles","set"],"sourceRoot":"../../../../src","sources":["components/field/fieldStyles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAA0B,oBAAiB;AAE7D,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAyC,CAAC;AAEnE,MAAMC,MAAM,GAAIC,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C0D;EACX,CAAC;EACDC,MAAM,EAAE;IACNpB,WAAW,EAAE,CAAC;IACdf,iBAAiB,EAAE,CAAC;IACpB6B,eAAe,EAAE,CAAC;IAClBjC,YAAY,EAAEpB,CAAC,CAACqB,MAAM;IACtBJ,WAAW,EAAE,CAAC;IACdC,WAAW,EAAElB,CAAC,CAACmB;EACjB,CAAC;EACDyC,cAAc,EAAE;IAAE1C,WAAW,EAAElB,CAAC,CAACwD;EAAO,CAAC;EACzCK,UAAU,EAAE;IACV,GAAGjE,SAAS,CAACI,CAAC,EAAE,QAAQ,CAAC;IACzBM,QAAQ,EAAEN,CAAC,CAAC8D,aAAa;IACzBtD,KAAK,EAAER,CAAC,CAACwD;EACX,CAAC;EACDO,OAAO,EAAE;IACPC,SAAS,EAAE,CAAC;IACZ,GAAGpE,SAAS,CAACI,CAAC,EAAE,SAAS,CAAC;IAC1BM,QAAQ,EAAEN,CAAC,CAAC8D;EACd,CAAC;EACDnD,KAAK,EAAE;IAAEH,KAAK,EAAER,CAAC,CAACW;EAAM,CAAC;EACzBsD,MAAM,EAAE;IAAEzD,KAAK,EAAER,CAAC,CAAC0D;EAAU;AAC/B,CAAC,CAAC;;AAEJ;AACA,OAAO,MAAMQ,gBAAgB,GAC3BC,MAAmB,IACW;EAC9B,MAAMC,GAAG,GAAGvE,KAAK,CAACwE,GAAG,CAACF,MAAM,CAAC;EAC7B,IAAIC,GAAG,EAAE,OAAOA,GAAG;EACnB,MAAME,MAAM,GAAGvE,MAAM,CAACoE,MAAM,CAAC;EAC7BtE,KAAK,CAAC0E,GAAG,CAACJ,MAAM,EAAEG,MAAM,CAAC;EACzB,OAAOA,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -1,38 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { to12Hour } from "../../core/segments.js";
|
|
3
4
|
import { DEFAULT_STRINGS } from "../theme/defaultStrings.js";
|
|
4
5
|
const pad2 = n => String(n).padStart(2, '0');
|
|
5
6
|
|
|
6
7
|
/** '21-10-2026' for 'dd-MM-yyyy', '10-21-2026' for 'MM-dd-yyyy'. */
|
|
7
8
|
export const formatDateText = (value, dateFormat) => dateFormat.replace('yyyy', String(value.date.year).padStart(4, '0')).replace('MM', pad2(value.date.month)).replace('dd', pad2(value.date.day));
|
|
8
9
|
|
|
10
|
+
/** The AM / PM labels and the date-time separator, from `strings`. */
|
|
11
|
+
|
|
9
12
|
/** '03:45 PM' (12-hour) or '15:45' (24-hour). Always shows AM/PM in 12-hour mode. */
|
|
10
|
-
export const formatTimeText = (value, timeFormat) => {
|
|
13
|
+
export const formatTimeText = (value, timeFormat, periods = DEFAULT_STRINGS) => {
|
|
11
14
|
if (!value.time) return '';
|
|
12
15
|
const {
|
|
13
16
|
hour,
|
|
14
17
|
minute
|
|
15
18
|
} = value.time;
|
|
16
19
|
if (timeFormat === '24h') return `${pad2(hour)}:${pad2(minute)}`;
|
|
17
|
-
const
|
|
18
|
-
|
|
20
|
+
const {
|
|
21
|
+
hour12,
|
|
22
|
+
period
|
|
23
|
+
} = to12Hour(hour);
|
|
24
|
+
return `${pad2(hour12)}:${pad2(minute)} ${period === 'AM' ? periods.am : periods.pm}`;
|
|
19
25
|
};
|
|
20
|
-
|
|
26
|
+
|
|
27
|
+
/** Writes a value's date some other way, e.g. as a Hijri date. */
|
|
28
|
+
|
|
29
|
+
/** A value's date and time as two texts; the time is '' for a date or a value without one. */
|
|
30
|
+
export const formatValueParts = (value, type, dateFormat, timeFormat, dateText, periods = DEFAULT_STRINGS) => ({
|
|
31
|
+
date: dateText ? dateText(value) : formatDateText(value, dateFormat),
|
|
32
|
+
time: type === 'datetime' && value.time ? formatTimeText(value, timeFormat, periods) : ''
|
|
33
|
+
});
|
|
34
|
+
export const formatValueText = (value, type, dateFormat, timeFormat, dateText, periods = DEFAULT_STRINGS) => {
|
|
21
35
|
if (!value) return '';
|
|
22
|
-
const
|
|
23
|
-
|
|
36
|
+
const {
|
|
37
|
+
date,
|
|
38
|
+
time
|
|
39
|
+
} = formatValueParts(value, type, dateFormat, timeFormat, dateText, periods);
|
|
40
|
+
return time ? `${date}${periods.dateTimeSeparator ?? ' '}${time}` : date;
|
|
24
41
|
};
|
|
25
42
|
|
|
26
43
|
/** '21-10-2026 – 25-10-2026'; just the start (with the dash) while the end is open. */
|
|
27
|
-
export const formatRangeText = (from, to, type, dateFormat, timeFormat, separator = ' – ') => {
|
|
44
|
+
export const formatRangeText = (from, to, type, dateFormat, timeFormat, separator = ' – ', dateText, periods = DEFAULT_STRINGS) => {
|
|
28
45
|
if (!from && !to) return '';
|
|
29
|
-
const a = formatValueText(from, type, dateFormat, timeFormat);
|
|
30
|
-
const b = formatValueText(to, type, dateFormat, timeFormat);
|
|
46
|
+
const a = formatValueText(from, type, dateFormat, timeFormat, dateText, periods);
|
|
47
|
+
const b = formatValueText(to, type, dateFormat, timeFormat, dateText, periods);
|
|
31
48
|
return `${a}${separator}${b}`.trim();
|
|
32
49
|
};
|
|
33
50
|
|
|
34
51
|
/** '21-10-2026, 23-10-2026' (the field shows one line and truncates). */
|
|
35
|
-
export const formatMultipleText = (values, type, dateFormat, timeFormat) => values.filter(v => !!v).map(v => formatValueText(v, type, dateFormat, timeFormat)).join(', ');
|
|
52
|
+
export const formatMultipleText = (values, type, dateFormat, timeFormat, dateText, periods = DEFAULT_STRINGS) => values.filter(v => !!v).map(v => formatValueText(v, type, dateFormat, timeFormat, dateText, periods)).join(', ');
|
|
36
53
|
|
|
37
54
|
/** 'DD-MM-YYYY' or 'DD-MM-YYYY hh:mm AM', from the placeholder strings. */
|
|
38
55
|
export const placeholderText = (type, dateFormat, timeFormat, strings = DEFAULT_STRINGS) => {
|
|
@@ -44,7 +61,7 @@ export const placeholderText = (type, dateFormat, timeFormat, strings = DEFAULT_
|
|
|
44
61
|
const date = dateFormat.replace(/yyyy|MM|dd/g, t => parts[t] ?? t);
|
|
45
62
|
if (type !== 'datetime') return date;
|
|
46
63
|
const time = timeFormat === '24h' ? `${strings.placeholderHour24}:${strings.placeholderMinute}` : `${strings.placeholderHour}:${strings.placeholderMinute} ${strings.am}`;
|
|
47
|
-
return `${date} ${time}`;
|
|
64
|
+
return `${date}${strings.dateTimeSeparator ?? ' '}${time}`;
|
|
48
65
|
};
|
|
49
66
|
const TIME_KEYS = ['hour', 'minute', 'period'];
|
|
50
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_STRINGS","pad2","n","String","padStart","formatDateText","value","dateFormat","replace","date","year","month","day","formatTimeText","timeFormat","time","hour","minute","hour12","
|
|
1
|
+
{"version":3,"names":["to12Hour","DEFAULT_STRINGS","pad2","n","String","padStart","formatDateText","value","dateFormat","replace","date","year","month","day","formatTimeText","timeFormat","periods","time","hour","minute","hour12","period","am","pm","formatValueParts","type","dateText","formatValueText","dateTimeSeparator","formatRangeText","from","to","separator","a","b","trim","formatMultipleText","values","filter","v","map","join","placeholderText","strings","parts","dd","placeholderDay","MM","placeholderMonth","yyyy","placeholderYear","t","placeholderHour24","placeholderMinute","placeholderHour","TIME_KEYS","segmentErrorText","errors","yearRange","first","isTime","includes","key","code","errorIncompleteTime","errorIncomplete","errorInvalidTime","errorInvalidDate","errorYearOutOfRange"],"sourceRoot":"../../../../src","sources":["components/field/fieldText.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAA2B,wBAAqB;AAEjE,SAASC,eAAe,QAA4B,4BAAyB;AAE7E,MAAMC,IAAI,GAAIC,CAAS,IAAaC,MAAM,CAACD,CAAC,CAAC,CAACE,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;;AAE9D;AACA,OAAO,MAAMC,cAAc,GAAGA,CAC5BC,KAAoB,EACpBC,UAAkB,KAElBA,UAAU,CACPC,OAAO,CAAC,MAAM,EAAEL,MAAM,CAACG,KAAK,CAACG,IAAI,CAACC,IAAI,CAAC,CAACN,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CACzDI,OAAO,CAAC,IAAI,EAAEP,I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U;MACb,OAAOH,MAAM,GAAGjB,OAAO,CAACqB,mBAAmB,GAAGrB,OAAO,CAACsB,eAAe;IACvE,KAAK,cAAc;MACjB,OAAOL,MAAM,GAAGjB,OAAO,CAACuB,gBAAgB,GAAGvB,OAAO,CAACwB,gBAAgB;IACrE,KAAK,YAAY;MACf,OAAOT,SAAS,GACZf,OAAO,CAACyB,mBAAmB,CAACV,SAAS,CAAC,GACtCf,OAAO,CAACwB,gBAAgB;IAC9B;MACE,OAAOxB,OAAO,CAACwB,gBAAgB;EACnC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* react-native-safe-area-context's insets, when the app has that package (an
|
|
6
|
+
* optional peer: most Expo apps do). The require sits in a try so a missing
|
|
7
|
+
* package is fine: Metro allows optional dependencies there.
|
|
8
|
+
*/
|
|
9
|
+
const readContext = () => {
|
|
10
|
+
try {
|
|
11
|
+
const lib = require('react-native-safe-area-context');
|
|
12
|
+
return lib.SafeAreaInsetsContext ?? null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const NO_INSETS = /*#__PURE__*/createContext(null);
|
|
18
|
+
const InsetsContext = readContext() ?? NO_INSETS;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The bottom safe-area inset (the home indicator, or Android's navigation bar
|
|
22
|
+
* in an edge-to-edge app), from the app's SafeAreaProvider; 0 without one.
|
|
23
|
+
* Read through the context rather than `useSafeAreaInsets`, which throws when
|
|
24
|
+
* there's no provider.
|
|
25
|
+
*/
|
|
26
|
+
export const useBottomInset = () => useContext(InsetsContext)?.bottom ?? 0;
|
|
27
|
+
//# sourceMappingURL=useBottomInset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","readContext","lib","require","SafeAreaInsetsContext","NO_INSETS","InsetsContext","useBottomInset","bottom"],"sourceRoot":"../../../../src","sources":["components/hooks/useBottomInset.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAsB,OAAO;AAM/D;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAGA,CAAA,KAA8B;EAChD,IAAI;IACF,MAAMC,GAAG,GAAGC,OAAO,CAAC,gCAAgC,CAEnD;IACD,OAAOD,GAAG,CAACE,qBAAqB,IAAI,IAAI;EAC1C,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC;AAED,MAAMC,SAAS,gBAAGN,aAAa,CAAS,IAAI,CAAC;AAC7C,MAAMO,aAAa,GAAGL,WAAW,CAAC,CAAC,IAAII,SAAS;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,cAAc,GAAGA,CAAA,KAC5BP,UAAU,CAACM,aAAa,CAAC,EAAEE,MAAM,IAAI,CAAC","ignoreList":[]}
|
|
@@ -2,29 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { Keyboard, Platform } from 'react-native';
|
|
5
|
+
const DOWN = {
|
|
6
|
+
up: false,
|
|
7
|
+
height: 0
|
|
8
|
+
};
|
|
5
9
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/** The keyboard as it is now: it can already be up when the picker mounts or opens. */
|
|
11
|
+
const current = () => Keyboard.isVisible() ? {
|
|
12
|
+
up: true,
|
|
13
|
+
height: Keyboard.metrics()?.height ?? 0
|
|
14
|
+
} : DOWN;
|
|
15
|
+
|
|
16
|
+
/** Whether the keyboard is up, and how tall it is, while `active`. */
|
|
17
|
+
export const useKeyboard = active => {
|
|
18
|
+
const [keyboard, setKeyboard] = useState(() => active ? current() : DOWN);
|
|
14
19
|
useEffect(() => {
|
|
15
20
|
if (!active) {
|
|
16
|
-
|
|
21
|
+
setKeyboard(DOWN);
|
|
17
22
|
return undefined;
|
|
18
23
|
}
|
|
24
|
+
setKeyboard(current());
|
|
19
25
|
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
20
26
|
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
21
|
-
const show = Keyboard.addListener(showEvent,
|
|
22
|
-
|
|
27
|
+
const show = Keyboard.addListener(showEvent, e => setKeyboard({
|
|
28
|
+
up: true,
|
|
29
|
+
height: e?.endCoordinates?.height ?? 0
|
|
30
|
+
}));
|
|
31
|
+
const hide = Keyboard.addListener(hideEvent, () => setKeyboard(DOWN));
|
|
32
|
+
// iOS: a sheet opened on keyboardWillHide mounts before the keyboard is
|
|
33
|
+
// gone, so it reads it as up; keyboardDidHide puts that right.
|
|
34
|
+
const hidden = hideEvent === 'keyboardDidHide' ? null : Keyboard.addListener('keyboardDidHide', () => setKeyboard(DOWN));
|
|
23
35
|
return () => {
|
|
24
36
|
show.remove();
|
|
25
37
|
hide.remove();
|
|
38
|
+
hidden?.remove();
|
|
26
39
|
};
|
|
27
40
|
}, [active]);
|
|
28
|
-
return
|
|
41
|
+
return keyboard;
|
|
29
42
|
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* True while the keyboard is up and the picker is open. With
|
|
46
|
+
* `hideCalendarOnKeyboard` the picker folds the calendar away then, so the box being typed in (and Confirm) stay visible on
|
|
47
|
+
* small phones; inline, it folds only while one of its own boxes has focus,
|
|
48
|
+
* since another field on the screen can raise the keyboard too.
|
|
49
|
+
*/
|
|
50
|
+
export const useKeyboardFold = active => useKeyboard(active).up;
|
|
30
51
|
//# sourceMappingURL=useKeyboardFold.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","Keyboard","Platform","
|
|
1
|
+
{"version":3,"names":["useEffect","useState","Keyboard","Platform","DOWN","up","height","current","isVisible","metrics","useKeyboard","active","keyboard","setKeyboard","undefined","showEvent","OS","hideEvent","show","addListener","e","endCoordinates","hide","hidden","remove","useKeyboardFold"],"sourceRoot":"../../../../src","sources":["components/hooks/useKeyboardFold.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,QAAQ,EAAEC,QAAQ,QAA4B,cAAc;AAQrE,MAAMC,IAAmB,GAAG;EAAEC,EAAE,EAAE,KAAK;EAAEC,MAAM,EAAE;AAAE,CAAC;;AAEpD;AACA,MAAMC,OAAO,GAAGA,CAAA,KACdL,QAAQ,CAACM,SAAS,CAAC,CAAC,GAChB;EAAEH,EAAE,EAAE,IAAI;EAAEC,MAAM,EAAEJ,QAAQ,CAACO,OAAO,CAAC,CAAC,EAAEH,MAAM,IAAI;AAAE,CAAC,GACrDF,IAAI;;AAEV;AACA,OAAO,MAAMM,WAAW,GAAIC,MAAe,IAAoB;EAC7D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGZ,QAAQ,CAAC,MAAOU,MAAM,GAAGJ,OAAO,CAAC,CAAC,GAAGH,IAAK,CAAC;EAE3EJ,SAAS,CAAC,MAAM;IACd,IAAI,CAACW,MAAM,EAAE;MACXE,WAAW,CAACT,IAAI,CAAC;MACjB,OAAOU,SAAS;IAClB;IACAD,WAAW,CAACN,OAAO,CAAC,CAAC,CAAC;IACtB,MAAMQ,SAAS,GACbZ,QAAQ,CAACa,EAAE,KAAK,KAAK,GAAG,kBAAkB,GAAG,iBAAiB;IAChE,MAAMC,SAAS,GACbd,QAAQ,CAACa,EAAE,KAAK,KAAK,GAAG,kBAAkB,GAAG,iBAAiB;IAChE,MAAME,IAAI,GAAGhB,QAAQ,CAACiB,WAAW,CAACJ,SAAS,EAAGK,CAAiB,IAC7DP,WAAW,CAAC;MAAER,EAAE,EAAE,IAAI;MAAEC,MAAM,EAAEc,CAAC,EAAEC,cAAc,EAAEf,MAAM,IAAI;IAAE,CAAC,CAClE,CAAC;IACD,MAAMgB,IAAI,GAAGpB,QAAQ,CAACiB,WAAW,CAACF,SAAS,EAAE,MAAMJ,WAAW,CAACT,IAAI,CAAC,CAAC;IACrE;IACA;IACA,MAAMmB,MAAM,GACVN,SAAS,KAAK,iBAAiB,GAC3B,IAAI,GACJf,QAAQ,CAACiB,WAAW,CAAC,iBAAiB,EAAE,MAAMN,WAAW,CAACT,IAAI,CAAC,CAAC;IACtE,OAAO,MAAM;MACXc,IAAI,CAACM,MAAM,CAAC,CAAC;MACbF,IAAI,CAACE,MAAM,CAAC,CAAC;MACbD,MAAM,EAAEC,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,CAACb,MAAM,CAAC,CAAC;EAEZ,OAAOC,QAAQ;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMa,eAAe,GAAId,MAAe,IAC7CD,WAAW,CAACC,MAAM,CAAC,CAACN,EAAE","ignoreList":[]}
|
|
@@ -9,7 +9,8 @@ export const KEYBOARD_WAIT_FALLBACK_MS = 450;
|
|
|
9
9
|
* Opens and closes the picker.
|
|
10
10
|
* - calls `onBeforeOpen` first;
|
|
11
11
|
* - if a text input has focus, closes the keyboard and waits for it on iOS and
|
|
12
|
-
* Android (so the sheet doesn't jump as the keyboard leaves), with a 450 ms
|
|
12
|
+
* Android (so the sheet doesn't jump as the keyboard leaves), with a 450 ms
|
|
13
|
+
* fallback; a controlled `visible` turned on waits the same way;
|
|
13
14
|
* - disabled and read-only pickers never open.
|
|
14
15
|
*/
|
|
15
16
|
export const useOpenPicker = ({
|
|
@@ -22,34 +23,33 @@ export const useOpenPicker = ({
|
|
|
22
23
|
}) => {
|
|
23
24
|
const [openState, setOpenState] = useState(false);
|
|
24
25
|
const isControlled = visible !== undefined;
|
|
25
|
-
|
|
26
|
+
// Controlled: `visible` turned on while a text input has focus waits for
|
|
27
|
+
// the keyboard. Decided while rendering, so the sheet never shows a frame
|
|
28
|
+
// early.
|
|
29
|
+
const [keyboardWait, setKeyboardWait] = useState(false);
|
|
30
|
+
const [seenVisible, setSeenVisible] = useState(visible);
|
|
31
|
+
if (isControlled && visible !== seenVisible) {
|
|
32
|
+
setSeenVisible(visible);
|
|
33
|
+
setKeyboardWait(!!visible && !!TextInput.State.currentlyFocusedInput?.());
|
|
34
|
+
}
|
|
35
|
+
const isOpen = isControlled ? !!visible && !keyboardWait : openState;
|
|
26
36
|
const pending = useRef(null);
|
|
27
37
|
const cancelPending = () => {
|
|
28
38
|
pending.current?.cancel();
|
|
29
39
|
pending.current = null;
|
|
30
40
|
};
|
|
31
41
|
useEffect(() => cancelPending, []);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onOpen?.();
|
|
36
|
-
}, [isControlled, onOpen]);
|
|
37
|
-
const open = useCallback(() => {
|
|
38
|
-
if (disabled || readOnly || isOpen || pending.current) return;
|
|
39
|
-
onBeforeOpen?.();
|
|
40
|
-
const focused = TextInput.State.currentlyFocusedInput?.();
|
|
41
|
-
if (!focused) {
|
|
42
|
-
reallyOpen();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
42
|
+
|
|
43
|
+
/** Closes the keyboard and calls `then` once it's gone (or after the fallback). */
|
|
44
|
+
const afterKeyboard = then => {
|
|
45
45
|
const event = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
46
46
|
const sub = Keyboard.addListener(event, () => {
|
|
47
47
|
cancelPending();
|
|
48
|
-
|
|
48
|
+
then();
|
|
49
49
|
});
|
|
50
50
|
const timer = setTimeout(() => {
|
|
51
51
|
cancelPending();
|
|
52
|
-
|
|
52
|
+
then();
|
|
53
53
|
}, KEYBOARD_WAIT_FALLBACK_MS);
|
|
54
54
|
pending.current = {
|
|
55
55
|
cancel: () => {
|
|
@@ -58,6 +58,28 @@ export const useOpenPicker = ({
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
Keyboard.dismiss();
|
|
61
|
+
};
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!keyboardWait) return undefined;
|
|
64
|
+
afterKeyboard(() => setKeyboardWait(false));
|
|
65
|
+
return cancelPending;
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- while waiting
|
|
67
|
+
}, [keyboardWait]);
|
|
68
|
+
const reallyOpen = useCallback(() => {
|
|
69
|
+
pending.current = null;
|
|
70
|
+
if (!isControlled) setOpenState(true);
|
|
71
|
+
onOpen?.();
|
|
72
|
+
}, [isControlled, onOpen]);
|
|
73
|
+
const open = useCallback(() => {
|
|
74
|
+
if (disabled || readOnly || isOpen || pending.current) return;
|
|
75
|
+
onBeforeOpen?.();
|
|
76
|
+
const focused = TextInput.State.currentlyFocusedInput?.();
|
|
77
|
+
if (!focused) {
|
|
78
|
+
reallyOpen();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
afterKeyboard(reallyOpen);
|
|
82
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- afterKeyboard only uses refs and stable APIs
|
|
61
83
|
}, [disabled, readOnly, isOpen, onBeforeOpen, reallyOpen]);
|
|
62
84
|
const close = useCallback(() => {
|
|
63
85
|
cancelPending();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useRef","useState","Keyboard","Platform","TextInput","KEYBOARD_WAIT_FALLBACK_MS","useOpenPicker","disabled","readOnly","visible","onBeforeOpen","onOpen","onClose","openState","setOpenState","isControlled","undefined","
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useState","Keyboard","Platform","TextInput","KEYBOARD_WAIT_FALLBACK_MS","useOpenPicker","disabled","readOnly","visible","onBeforeOpen","onOpen","onClose","openState","setOpenState","isControlled","undefined","keyboardWait","setKeyboardWait","seenVisible","setSeenVisible","State","currentlyFocusedInput","isOpen","pending","cancelPending","current","cancel","afterKeyboard","then","event","OS","sub","addListener","timer","setTimeout","remove","clearTimeout","dismiss","reallyOpen","open","focused","close"],"sourceRoot":"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;IACzD,IAAI,CAACmB,OAAO,EAAE;MACZF,UAAU,CAAC,CAAC;MACZ;IACF;IACAX,aAAa,CAACW,UAAU,CAAC;IACzB;EACF,CAAC,EAAE,CAAChC,QAAQ,EAAEC,QAAQ,EAAEe,MAAM,EAAEb,YAAY,EAAE6B,UAAU,CAAC,CAAC;EAE1D,MAAMG,KAAK,GAAG5C,WAAW,CAAC,MAAM;IAC9B2B,aAAa,CAAC,CAAC;IACf,IAAI,CAACV,YAAY,EAAED,YAAY,CAAC,KAAK,CAAC;IACtCF,OAAO,GAAG,CAAC;EACb,CAAC,EAAE,CAACG,YAAY,EAAEH,OAAO,CAAC,CAAC;EAE3B,OAAO;IAAEW,MAAM;IAAEiB,IAAI;IAAEE;EAAM,CAAC;AAChC,CAAC","ignoreList":[]}
|
|
@@ -7,7 +7,8 @@ const valueKey = v => v ? `${v.date.year}-${v.date.month}-${v.date.day} ${v.time
|
|
|
7
7
|
/**
|
|
8
8
|
* State for the typed field. Re-syncs from `value` when it changes from outside
|
|
9
9
|
* (a calendar tap, a clear) while no segment is focused, and reports every
|
|
10
|
-
* parse result to `onParsed
|
|
10
|
+
* parse result to `onParsed`, saying whether it came from such a value
|
|
11
|
+
* (`fromOutside`) rather than from typing.
|
|
11
12
|
*/
|
|
12
13
|
export const useTypedSegments = (value, options, onParsed) => {
|
|
13
14
|
const opts = useMemo(() => options,
|
|
@@ -18,8 +19,11 @@ export const useTypedSegments = (value, options, onParsed) => {
|
|
|
18
19
|
// Fast typing (a hardware keyboard, autofill) sends the next character
|
|
19
20
|
// before React re-renders, so inputs compare against this, not `state`.
|
|
20
21
|
const latest = useRef(state);
|
|
22
|
+
// Whether the last action was a value set from outside, not typing.
|
|
23
|
+
const lastWasReset = useRef(false);
|
|
21
24
|
const dispatch = useCallback(action => {
|
|
22
25
|
latest.current = reducer(latest.current, action);
|
|
26
|
+
lastWasReset.current = action.type === 'reset';
|
|
23
27
|
reactDispatch(action);
|
|
24
28
|
}, [reducer]);
|
|
25
29
|
const getState = useCallback(() => latest.current, []);
|
|
@@ -61,7 +65,7 @@ export const useTypedSegments = (value, options, onParsed) => {
|
|
|
61
65
|
// What's typed is newer than anything that was waiting to be shown.
|
|
62
66
|
resetOnLeave.current = false;
|
|
63
67
|
}
|
|
64
|
-
onParsedRef.current?.(state.parsed);
|
|
68
|
+
onParsedRef.current?.(state.parsed, lastWasReset.current);
|
|
65
69
|
}, [state.parsed]);
|
|
66
70
|
return {
|
|
67
71
|
state,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useMemo","useReducer","useRef","createSegmentEditor","segmentEditorReducer","valueKey","v","date","year","month","day","time","hour","minute","useTypedSegments","value","options","onParsed","opts","dateFormat","type","timeFormat","yearRange","first","last","reducer","s","a","state","reactDispatch","latest","dispatch","action","current","getState","lastValueKey","valueRef","resetOnLeave","key","focused","onParsedRef","lastParsed","parsed"],"sourceRoot":"../../../../src","sources":["components/hooks/useTypedSegments.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAC3E,SACEC,mBAAmB,EACnBC,oBAAoB,QAIf,6BAA0B;AAIjC,MAAMC,QAAQ,GAAIC,CAAuB,IACvCA,CAAC,GACG,GAAGA,CAAC,CAACC,IAAI,CAACC,IAAI,IAAIF,CAAC,CAACC,IAAI,CAACE,KAAK,IAAIH,CAAC,CAACC,IAAI,CAACG,GAAG,IAAIJ,CAAC,CAACK,IAAI,EAAEC,IAAI,IAAI,EAAE,IAAIN,CAAC,CAACK,IAAI,EAAEE,MAAM,IAAI,EAAE,EAAE,GAC5F,EAAE;;AAER;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAC9BC,KAA2B,EAC3BC,OAA6B,EAC7BC,
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useReducer","useRef","createSegmentEditor","segmentEditorReducer","valueKey","v","date","year","month","day","time","hour","minute","useTypedSegments","value","options","onParsed","opts","dateFormat","type","timeFormat","yearRange","first","last","reducer","s","a","state","reactDispatch","latest","lastWasReset","dispatch","action","current","getState","lastValueKey","valueRef","resetOnLeave","key","focused","onParsedRef","lastParsed","parsed"],"sourceRoot":"../../../../src","sources":["components/hooks/useTypedSegments.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAC3E,SACEC,mBAAmB,EACnBC,oBAAoB,QAIf,6BAA0B;AAIjC,MAAMC,QAAQ,GAAIC,CAAuB,IACvCA,CAAC,GACG,GAAGA,CAAC,CAACC,IAAI,CAACC,IAAI,IAAIF,CAAC,CAACC,IAAI,CAACE,KAAK,IAAIH,CAAC,CAACC,IAAI,CAACG,GAAG,IAAIJ,CAAC,CAACK,IAAI,EAAEC,IAAI,IAAI,EAAE,IAAIN,CAAC,CAACK,IAAI,EAAEE,MAAM,IAAI,EAAE,EAAE,GAC5F,EAAE;;AAER;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAC9BC,KAA2B,EAC3BC,OAA6B,EAC7BC,QAAiE,KAM9D;EACH,MAAMC,IAAI,GAAGlB,OAAO,CAClB,MAAMgB,OAAO;EACb;EACA,CACEA,OAAO,CAACG,UAAU,EAClBH,OAAO,CAACI,IAAI,EACZJ,OAAO,CAACK,UAAU,EAClBL,OAAO,CAACM,SAAS,EAAEC,KAAK,EACxBP,OAAO,CAACM,SAAS,EAAEE,IAAI,CAE3B,CAAC;EACD,MAAMC,OAAO,GAAG3B,WAAW,CACzB,CAAC4B,CAAqB,EAAEC,CAAsB,KAC5CvB,oBAAoB,CAACsB,CAAC,EAAEC,CAAC,EAAET,IAAI,CAAC,EAClC,CAACA,IAAI,CACP,CAAC;EACD,MAAM,CAACU,KAAK,EAAEC,aAAa,CAAC,GAAG5B,UAAU,CAACwB,OAAO,EAAEV,KAAK,EA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AY,CAACJ,OAAO,EAAE;IAC5CI,YAAY,CAACJ,OAAO,GAAG,KAAK;IAC5BF,QAAQ,CAAC;MAAEZ,IAAI,EAAE,OAAO;MAAEL,KAAK,EAAEsB,QAAQ,CAACH;IAAQ,CAAC,CAAC;IACpD;EACF,CAAC,EAAE,CAACN,KAAK,CAACY,OAAO,CAAC,CAAC;EAEnB,MAAMC,WAAW,GAAGvC,MAAM,CAACe,QAAQ,CAAC;EACpCwB,WAAW,CAACP,OAAO,GAAGjB,QAAQ;EAC9B,MAAMyB,UAAU,GAAGxC,MAAM,CAAC0B,KAAK,CAACe,MAAM,CAAC;EACvC5C,SAAS,CAAC,MAAM;IACd,IAAI6B,KAAK,CAACe,MAAM,KAAKD,UAAU,CAACR,OAAO,EAAE;IACzCQ,UAAU,CAACR,OAAO,GAAGN,KAAK,CAACe,MAAM;IACjC,IAAIf,KAAK,CAACe,MAAM,CAAC5B,KAAK,EAAE;MACtBqB,YAAY,CAACF,OAAO,GAAG7B,QAAQ,CAACuB,KAAK,CAACe,MAAM,CAAC5B,KAAK,CAAC;MACnD;MACAuB,YAAY,CAACJ,OAAO,GAAG,KAAK;IAC9B;IACAO,WAAW,CAACP,OAAO,GAAGN,KAAK,CAACe,MAAM,EAAEZ,YAAY,CAACG,OAAO,CAAC;EAC3D,CAAC,EAAE,CAACN,KAAK,CAACe,MAAM,CAAC,CAAC;EAElB,OAAO;IAAEf,KAAK;IAAEI,QAAQ;IAAEG;EAAS,CAAC;AACtC,CAAC","ignoreList":[]}
|
|
@@ -20,6 +20,7 @@ export const DEFAULT_STRINGS = {
|
|
|
20
20
|
am: 'AM',
|
|
21
21
|
rangeSeparator: ' – ',
|
|
22
22
|
pm: 'PM',
|
|
23
|
+
dateTimeSeparator: ' ',
|
|
23
24
|
placeholderDay: 'DD',
|
|
24
25
|
placeholderMonth: 'MM',
|
|
25
26
|
placeholderYear: 'YYYY',
|
|
@@ -37,12 +38,17 @@ export const DEFAULT_STRINGS = {
|
|
|
37
38
|
errorNotAllowed: "This date isn't available",
|
|
38
39
|
errorTimeNotAllowed: "This time isn't available",
|
|
39
40
|
errorMinuteStep: step => `Choose a minute in steps of ${step}`,
|
|
40
|
-
errorRangeOrder: 'The end must be
|
|
41
|
+
errorRangeOrder: 'The end date must be greater than the start date',
|
|
41
42
|
errorRangeTooShort: n => `Choose a range of at least ${n} days`,
|
|
42
43
|
errorRangeTooLong: n => `Choose a range of at most ${n} days`,
|
|
43
44
|
nothingSelectable: 'No dates are available',
|
|
45
|
+
calendarGregorian: 'Gregorian',
|
|
46
|
+
calendarHijri: 'Hijri',
|
|
47
|
+
calendarDual: 'Dual',
|
|
48
|
+
a11yCalendarSystem: 'Calendar',
|
|
44
49
|
a11yClear: 'Clear date',
|
|
45
50
|
a11yOpen: 'Open date picker',
|
|
51
|
+
a11yClose: 'Close',
|
|
46
52
|
a11yDay: 'Day',
|
|
47
53
|
a11yMonth: 'Month',
|
|
48
54
|
a11yYear: 'Year',
|
|
@@ -59,11 +65,14 @@ export const DEFAULT_STRINGS = {
|
|
|
59
65
|
a11yRangeEnd: 'end of range'
|
|
60
66
|
};
|
|
61
67
|
|
|
68
|
+
/** The keys that have a value: one left `undefined` (or `null`) keeps what's under it. */
|
|
69
|
+
export const compactStrings = overrides => overrides ? Object.fromEntries(Object.entries(overrides).filter(([, v]) => v != null)) : {};
|
|
70
|
+
|
|
62
71
|
/** The English defaults with the caller's overrides on top. */
|
|
63
72
|
export const resolveStrings = overrides => {
|
|
64
73
|
return {
|
|
65
74
|
...DEFAULT_STRINGS,
|
|
66
|
-
...overrides
|
|
75
|
+
...compactStrings(overrides)
|
|
67
76
|
};
|
|
68
77
|
};
|
|
69
78
|
//# sourceMappingURL=defaultStrings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_STRINGS","titleDate","confirm","reset","clear","today","done","time","startTime","endTime","from","to","am","rangeSeparator","pm","placeholderDay","placeholderMonth","placeholderYear","placeholderHour","placeholderHour24","placeholderMinute","errorIncomplete","errorIncompleteTime","errorInvalidDate","errorInvalidTime","errorYearOutOfRange","first","last","errorNotAllowed","errorTimeNotAllowed","errorMinuteStep","step","errorRangeOrder","errorRangeTooShort","n","errorRangeTooLong","nothingSelectable","a11yClear","a11yOpen","a11yDay","a11yMonth","a11yYear","a11yHour","a11yMinute","a11yPeriod","a11yPreviousYear","a11yNextYear","a11yChooseYear","a11yChooseMonth","a11yToday","a11yHoliday","a11yRangeStart","a11yRangeEnd","
|
|
1
|
+
{"version":3,"names":["DEFAULT_STRINGS","titleDate","confirm","reset","clear","today","done","time","startTime","endTime","from","to","am","rangeSeparator","pm","dateTimeSeparator","placeholderDay","placeholderMonth","placeholderYear","placeholderHour","placeholderHour24","placeholderMinute","errorIncomplete","errorIncompleteTime","errorInvalidDate","errorInvalidTime","errorYearOutOfRange","first","last","errorNotAllowed","errorTimeNotAllowed","errorMinuteStep","step","errorRangeOrder","errorRangeTooShort","n","errorRangeTooLong","nothingSelectable","calendarGregorian","calendarHijri","calendarDual","a11yCalendarSystem","a11yClear","a11yOpen","a11yClose","a11yDay","a11yMonth","a11yYear","a11yHour","a11yMinute","a11yPeriod","a11yPreviousYear","a11yNextYear","a11yChooseYear","a11yChooseMonth","a11yToday","a11yHoliday","a11yRangeStart","a11yRangeEnd","compactStrings","overrides","Object","fromEntries","entries","filter","v","resolveStrings"],"sourceRoot":"../../../../src","sources":["components/theme/defaultStrings.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAiEA,OAAO,MAAMA,eAAwC,GAAG;EACtDC,SAAS,EAAE,aAAa;EACxBC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE,YAAY;EACvBC,OAAO,EAAE,UAAU;EACnBC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,IAAI;EACRC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OAAO;EAClBC,WAAW,EAAE,SAAS;EACtBC,cAAc,EAAE,gBAAgB;EAChCC,YAAY,EAAE;AAChB,CAAC;;AAED;AACA,OAAO,MAAMC,cAAc,GACzBC,SAAkC,IAElCA,SAAS,GACJC,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAACH,SAAS,CAAC,CAACI,MAAM,CAAC,CAAC,GAAGC,CAAC,CAAC,KAAKA,CAAC,IAAI,IAAI,CACvD,CAAC,GACD,CAAC,CAAC;;AAER;AACA,OAAO,MAAMC,cAAc,GACzBN,SAAkC,IACN;EAC5B,OAAO;IAAE,GAAG5D,eAAe;IAAE,GAAG2D,cAAc,CAACC,SAAS;EAAE,CAAC;AAC7D,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { I18nManager } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether a part of the picker is laid out right to left. The picker sets it
|
|
8
|
+
* for the calendar and the time rows while the Hijri tab shows; elsewhere the
|
|
9
|
+
* app's direction (`I18nManager.isRTL`) decides.
|
|
10
|
+
*/
|
|
11
|
+
export const RtlContext = /*#__PURE__*/createContext(null);
|
|
12
|
+
export const useIsRTL = () => useContext(RtlContext) ?? I18nManager.isRTL;
|
|
13
|
+
//# sourceMappingURL=direction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","I18nManager","RtlContext","useIsRTL","isRTL"],"sourceRoot":"../../../../src","sources":["components/theme/direction.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,WAAW,QAAQ,cAAc;;AAE1C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGH,aAAa,CAAiB,IAAI,CAAC;AAE7D,OAAO,MAAMI,QAAQ,GAAGA,CAAA,KACtBH,UAAU,CAACE,UAAU,CAAC,IAAID,WAAW,CAACG,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { latinDigits } from "../../core/numerals.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The digits every number in the picker is drawn with, set once by the picker
|
|
8
|
+
* from its `numerals` and `locale` props. Values and typed input stay 0–9.
|
|
9
|
+
*/
|
|
10
|
+
export const NumeralsContext = /*#__PURE__*/createContext(latinDigits);
|
|
11
|
+
export const useNumerals = () => useContext(NumeralsContext);
|
|
12
|
+
//# sourceMappingURL=numerals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","latinDigits","NumeralsContext","useNumerals"],"sourceRoot":"../../../../src","sources":["components/theme/numerals.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,WAAW,QAAQ,wBAAqB;;AAEjD;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,gBAC1BH,aAAa,CAA2BE,WAAW,CAAC;AAEtD,OAAO,MAAME,WAAW,GAAGA,CAAA,KAAMH,UAAU,CAACE,eAAe,CAAC","ignoreList":[]}
|
|
@@ -9,14 +9,22 @@ export const STYLE_KEYS = [
|
|
|
9
9
|
'container', 'sheet', 'sheetBackdrop', 'header', 'title', 'resetButton', 'resetText', 'body', 'footer', 'confirmButton', 'confirmText',
|
|
10
10
|
// field
|
|
11
11
|
'field', 'fieldFocused', 'fieldError', 'fieldDisabled', 'fieldText', /** The value's text while the field is disabled (the placeholder keeps its own colour). */
|
|
12
|
-
'fieldTextDisabled',
|
|
12
|
+
'fieldTextDisabled',
|
|
13
|
+
/**
|
|
14
|
+
* Sets the date of a single date-time value apart from its time, e.g.
|
|
15
|
+
* `{ minWidth: '50%' }` starts the time at the middle of the field.
|
|
16
|
+
*/
|
|
17
|
+
'fieldDateText', 'fieldPlaceholder', 'fieldSegment', 'fieldSegmentFocused', 'fieldSeparator', 'fieldPeriod', 'fieldPeriodSelected', 'fieldPeriodText', 'fieldIcon', 'clearIcon', 'label', 'mandatoryMark', 'helperText', 'instructionText', 'errorText', /** The `validate` message inside the picker (on top of `errorText`). */
|
|
13
18
|
'validationText',
|
|
14
19
|
// calendar header
|
|
15
20
|
'calendarHeader', 'navArrow', 'navArrowDisabled', 'yearButton', 'yearButtonText', 'monthChipRow', 'monthChip', 'monthChipText', 'monthChipSelected', 'monthChipDisabled',
|
|
21
|
+
// calendar switch (calendarSwitch prop)
|
|
22
|
+
'calendarSwitch', 'calendarSwitchSegment', 'calendarSwitchSegmentSelected', 'calendarSwitchText', 'calendarSwitchTextSelected', /** The Gregorian / Hijri tabs of a dual calendar. */
|
|
23
|
+
'dualTabs', 'dualTab', 'dualTabSelected', 'dualTabText', 'dualTabTextSelected',
|
|
16
24
|
// weekdays
|
|
17
25
|
'weekdayRow', 'weekdayText',
|
|
18
26
|
// day cells
|
|
19
|
-
'day', 'dayText', 'dayPressed', 'today', 'todayText', 'selected', 'selectedText', 'rangeStart', 'rangeMiddle', 'rangeEnd', 'rangeFill', 'outside', 'outsideText', 'disabled', 'disabledText', 'holiday', 'holidayText', /**
|
|
27
|
+
'day', 'dayText', 'dayPressed', 'today', 'todayText', 'selected', 'selectedText', 'rangeStart', 'rangeMiddle', 'rangeEnd', 'rangeFill', 'outside', 'outsideText', 'disabled', 'disabledText', 'holiday', 'holidayText', /** A second line under the day number. Not drawn by the picker any more; kept so styles that set it still compile. */
|
|
20
28
|
'daySubLabel',
|
|
21
29
|
// grids
|
|
22
30
|
'yearGrid', 'yearCell', 'yearCellSelected', 'yearCellDisabled', 'yearCellText', /** The current year (outlined) in a year pick. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["STYLE_KEYS"],"sourceRoot":"../../../../src","sources":["components/theme/styleKeys.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,UAAU,GAAG;AACxB;AACA,WAAW,EACX,OAAO,EACP,eAAe,EACf,QAAQ,EACR,OAAO,EACP,aAAa,EACb,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,EACf,aAAa;AACb;AACA,OAAO,EACP,cAAc,EACd,YAAY,EACZ,eAAe,EACf,WAAW,EACX;AACA,mBAAmB,
|
|
1
|
+
{"version":3,"names":["STYLE_KEYS"],"sourceRoot":"../../../../src","sources":["components/theme/styleKeys.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,UAAU,GAAG;AACxB;AACA,WAAW,EACX,OAAO,EACP,eAAe,EACf,QAAQ,EACR,OAAO,EACP,aAAa,EACb,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,EACf,aAAa;AACb;AACA,OAAO,EACP,cAAc,EACd,YAAY,EACZ,eAAe,EACf,WAAW,EACX;AACA,mBAAmB;AACnB;AACF;AACA;AACA;AACE,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,OAAO,EACP,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX;AACA,gBAAgB;AAChB;AACA,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,mBAAmB;AACnB;AACA,gBAAgB,EAChB,uBAAuB,EACvB,+BAA+B,EAC/B,oBAAoB,EACpB,4BAA4B,EAC5B;AACA,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,qBAAqB;AACrB;AACA,YAAY,EACZ,aAAa;AACb;AACA,KAAK,EACL,SAAS,EACT,YAAY,EACZ,OAAO,EACP,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb;AACA,aAAa;AACb;AACA,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd;AACA,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf;AACA,kBAAkB;AAClB;AACA,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB;AAChB;AACA,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,CACR;;AAMV","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ export const DEFAULT_TOKENS = {
|
|
|
11
11
|
text: '#111827',
|
|
12
12
|
heading: '#111827',
|
|
13
13
|
mutedText: '#6B7280',
|
|
14
|
+
outsideText: '#6B7280',
|
|
14
15
|
placeholder: '#9CA3AF',
|
|
15
16
|
border: '#D1D5DB',
|
|
16
17
|
inputBorder: '#D1D5DB',
|
|
@@ -64,6 +65,9 @@ export const buildTokens = overrides => {
|
|
|
64
65
|
...(overrides?.accent ? {
|
|
65
66
|
borderFocused: overrides.accent
|
|
66
67
|
} : null),
|
|
68
|
+
...(overrides?.mutedText ? {
|
|
69
|
+
outsideText: overrides.mutedText
|
|
70
|
+
} : null),
|
|
67
71
|
...overrides
|
|
68
72
|
};
|
|
69
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_TOKENS","accent","onAccent","text","heading","mutedText","placeholder","border","inputBorder","separator","toggleTrack","borderFocused","error","background","surface","disabledBackground","disabledText","rangeFill","holiday","fontFamily","undefined","fontRegular","fontMedium","fontSemiBold","fontSizeSmall","fontSizeMedium","fontSizeLarge","radius","fieldHeight","touchTarget","SYSTEM_FONTS","INTER_FONTS","buildTokens","overrides","WEIGHTS","regular","medium","semiBold","FAMILIES","fontStyle","t","weight","own","fontWeight"],"sourceRoot":"../../../../src","sources":["components/theme/tokens.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["DEFAULT_TOKENS","accent","onAccent","text","heading","mutedText","outsideText","placeholder","border","inputBorder","separator","toggleTrack","borderFocused","error","background","surface","disabledBackground","disabledText","rangeFill","holiday","fontFamily","undefined","fontRegular","fontMedium","fontSemiBold","fontSizeSmall","fontSizeMedium","fontSizeLarge","radius","fieldHeight","touchTarget","SYSTEM_FONTS","INTER_FONTS","buildTokens","overrides","WEIGHTS","regular","medium","semiBold","FAMILIES","fontStyle","t","weight","own","fontWeight"],"sourceRoot":"../../../../src","sources":["components/theme/tokens.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AA+CA,OAAO,MAAMA,cAAqC,GAAG;EACnDC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,SAAS;EACnBC,IAAI,EAAE,SAAS;EACfC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE,SAAS;EACpBC,WAAW,EAAE,SAAS;EACtBC,WAAW,EAAE,SAAS;EACtBC,MAAM,EAAE,SAAS;EACjBC,WAAW,EAAE,SAAS;EACtBC,SAAS,EAAE,SAAS;EACpBC,WAAW,EAAE,SAAS;EACtBC,aAAa,EAAE,SAAS;EACxBC,KAAK,EAAE,SAAS;EAChBC,UAAU,EAAE,SAAS;EACrBC,OAAO,EAAE,SAAS;EAClBC,kBAAkB,EAAE,SAAS;EAC7BC,YAAY,EAAE,SAAS;EACvBC,SAAS,EAAE,SAAS;EACpBC,OAAO,EAAE,SAAS;EAClBC,UAAU,EAAEC,SAAS;EACrBC,WAAW,EAAED,SAAS;EACtBE,UAAU,EAAEF,SAAS;EACrBG,Y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