@coopdigital/react 0.49.1 → 0.51.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/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/index.js +5 -0
- package/dist/components/Card/Card.js +4 -4
- package/dist/components/Checkbox/Checkbox.d.ts +7 -1
- package/dist/components/Checkbox/Checkbox.js +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +61 -0
- package/dist/components/DatePicker/DatePicker.js +135 -0
- package/dist/components/DatePicker/datepicker-utils.d.ts +68 -0
- package/dist/components/DatePicker/datepicker-utils.js +215 -0
- package/dist/components/DatePicker/index.d.ts +4 -0
- package/dist/components/Field/Field.js +29 -26
- package/dist/components/Field/index.js +6 -0
- package/dist/components/Pill/Pill.js +2 -2
- package/dist/components/Popover/Popover.d.ts +74 -0
- package/dist/components/Popover/Popover.js +75 -0
- package/dist/components/Popover/index.d.ts +4 -0
- package/dist/components/Popover/index.js +5 -0
- package/dist/components/Radio/Radio.d.ts +7 -1
- package/dist/components/Radio/Radio.js +4 -0
- package/dist/components/Searchbox/Searchbox.js +4 -3
- package/dist/components/Select/Select.d.ts +3 -0
- package/dist/components/Select/Select.js +4 -1
- package/dist/components/Signpost/Signpost.js +2 -2
- package/dist/components/Tag/Tag.js +2 -2
- package/dist/components/TextInput/TextInput.d.ts +6 -1
- package/dist/components/TextInput/TextInput.js +3 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -5
- package/dist/components/Textarea/Textarea.js +5 -4
- package/dist/hooks/useSlots.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +83 -0
- package/dist/node_modules/@date-fns/tz/date/mini.js +235 -0
- package/dist/node_modules/@date-fns/tz/tzName/index.js +39 -0
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +44 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +814 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +751 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +350 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +161 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +137 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +213 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +31 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +209 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +303 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +285 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +19 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +132 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +43 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +89 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +137 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.js +775 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +94 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +66 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +31 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +25 -0
- package/dist/node_modules/date-fns/addDays.js +41 -0
- package/dist/node_modules/date-fns/addMonths.js +75 -0
- package/dist/node_modules/date-fns/addWeeks.js +33 -0
- package/dist/node_modules/date-fns/addYears.js +33 -0
- package/dist/node_modules/date-fns/constants.js +67 -0
- package/dist/node_modules/date-fns/constructFrom.js +49 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +62 -0
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +42 -0
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +65 -0
- package/dist/node_modules/date-fns/eachYearOfInterval.js +65 -0
- package/dist/node_modules/date-fns/endOfISOWeek.js +35 -0
- package/dist/node_modules/date-fns/endOfMonth.js +37 -0
- package/dist/node_modules/date-fns/endOfWeek.js +53 -0
- package/dist/node_modules/date-fns/endOfYear.js +37 -0
- package/dist/node_modules/date-fns/format.js +423 -0
- package/dist/node_modules/date-fns/getDayOfYear.js +34 -0
- package/dist/node_modules/date-fns/getDaysInMonth.js +36 -0
- package/dist/node_modules/date-fns/getDefaultOptions.js +31 -0
- package/dist/node_modules/date-fns/getISODay.js +33 -0
- package/dist/node_modules/date-fns/getISOWeek.js +40 -0
- package/dist/node_modules/date-fns/getISOWeekYear.js +52 -0
- package/dist/node_modules/date-fns/getMonth.js +29 -0
- package/dist/node_modules/date-fns/getWeek.js +54 -0
- package/dist/node_modules/date-fns/getWeekYear.js +75 -0
- package/dist/node_modules/date-fns/getYear.js +29 -0
- package/dist/node_modules/date-fns/isAfter.js +25 -0
- package/dist/node_modules/date-fns/isBefore.js +25 -0
- package/dist/node_modules/date-fns/isDate.js +41 -0
- package/dist/node_modules/date-fns/isSameDay.js +46 -0
- package/dist/node_modules/date-fns/isSameMonth.js +43 -0
- package/dist/node_modules/date-fns/isSameYear.js +35 -0
- package/dist/node_modules/date-fns/isValid.js +39 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +10 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +64 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +59 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +22 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +103 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +41 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +13 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +189 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +134 -0
- package/dist/node_modules/date-fns/locale/en-US.js +28 -0
- package/dist/node_modules/date-fns/max.js +49 -0
- package/dist/node_modules/date-fns/min.js +49 -0
- package/dist/node_modules/date-fns/parse/_lib/Parser.js +27 -0
- package/dist/node_modules/date-fns/parse/_lib/Setter.js +59 -0
- package/dist/node_modules/date-fns/parse/_lib/constants.js +33 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +55 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +55 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DateParser.js +59 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +57 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayParser.js +64 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +56 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/EraParser.js +41 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +24 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +21 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +36 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +31 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +32 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +38 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +118 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +48 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +44 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +96 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +76 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +31 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +86 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +83 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +31 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +97 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +86 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +83 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +19 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +19 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/YearParser.js +62 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers.js +110 -0
- package/dist/node_modules/date-fns/parse/_lib/utils.js +135 -0
- package/dist/node_modules/date-fns/parse.js +497 -0
- package/dist/node_modules/date-fns/setDay.js +59 -0
- package/dist/node_modules/date-fns/setISODay.js +40 -0
- package/dist/node_modules/date-fns/setISOWeek.js +39 -0
- package/dist/node_modules/date-fns/setMonth.js +46 -0
- package/dist/node_modules/date-fns/setWeek.js +53 -0
- package/dist/node_modules/date-fns/setYear.js +40 -0
- package/dist/node_modules/date-fns/startOfDay.js +35 -0
- package/dist/node_modules/date-fns/startOfISOWeek.js +35 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +42 -0
- package/dist/node_modules/date-fns/startOfMonth.js +37 -0
- package/dist/node_modules/date-fns/startOfWeek.js +53 -0
- package/dist/node_modules/date-fns/startOfWeekYear.js +64 -0
- package/dist/node_modules/date-fns/startOfYear.js +36 -0
- package/dist/node_modules/date-fns/toDate.js +46 -0
- package/dist/node_modules/date-fns/transpose.js +52 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +320 -0
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +122 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +604 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +31 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +23 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +73 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +95 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +22 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +28 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +59 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +24 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +46 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +24 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getLabels.js +53 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +69 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +51 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +40 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +36 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +37 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +36 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +31 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +11 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +32 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +25 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +22 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +16 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js +67 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +57 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +45 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +44 -0
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +174 -0
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +113 -0
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +25 -0
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +56 -0
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +31 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +95 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js +57 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +62 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +30 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +74 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +35 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js +16 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +66 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +167 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +110 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/types/index.d.ts +10 -0
- package/package.json +11 -7
- package/src/components/Checkbox/Checkbox.tsx +6 -1
- package/src/components/DatePicker/DatePicker.tsx +372 -0
- package/src/components/DatePicker/datepicker-utils.ts +269 -0
- package/src/components/DatePicker/index.ts +5 -0
- package/src/components/Field/Field.tsx +30 -28
- package/src/components/Popover/Popover.tsx +198 -0
- package/src/components/Popover/index.ts +5 -0
- package/src/components/Radio/Radio.tsx +6 -1
- package/src/components/Searchbox/Searchbox.tsx +4 -1
- package/src/components/Select/Select.tsx +7 -2
- package/src/components/TextInput/TextInput.tsx +5 -1
- package/src/components/Textarea/Textarea.tsx +9 -13
- package/src/index.ts +2 -0
- package/src/types/index.ts +15 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const numericPatterns = {
|
|
2
|
+
month: /^(1[0-2]|0?\d)/, // 0 to 12
|
|
3
|
+
date: /^(3[0-1]|[0-2]?\d)/, // 0 to 31
|
|
4
|
+
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, // 0 to 366
|
|
5
|
+
week: /^(5[0-3]|[0-4]?\d)/, // 0 to 53
|
|
6
|
+
hour23h: /^(2[0-3]|[0-1]?\d)/, // 0 to 23
|
|
7
|
+
hour24h: /^(2[0-4]|[0-1]?\d)/, // 0 to 24
|
|
8
|
+
hour11h: /^(1[0-1]|0?\d)/, // 0 to 11
|
|
9
|
+
hour12h: /^(1[0-2]|0?\d)/, // 0 to 12
|
|
10
|
+
minute: /^[0-5]?\d/, // 0 to 59
|
|
11
|
+
second: /^[0-5]?\d/, // 0 to 59
|
|
12
|
+
|
|
13
|
+
singleDigit: /^\d/, // 0 to 9
|
|
14
|
+
twoDigits: /^\d{1,2}/, // 0 to 99
|
|
15
|
+
threeDigits: /^\d{1,3}/, // 0 to 999
|
|
16
|
+
fourDigits: /^\d{1,4}/, // 0 to 9999
|
|
17
|
+
|
|
18
|
+
anyDigitsSigned: /^-?\d+/,
|
|
19
|
+
singleDigitSigned: /^-?\d/, // 0 to 9, -0 to -9
|
|
20
|
+
twoDigitsSigned: /^-?\d{1,2}/, // 0 to 99, -0 to -99
|
|
21
|
+
threeDigitsSigned: /^-?\d{1,3}/, // 0 to 999, -0 to -999
|
|
22
|
+
fourDigitsSigned: /^-?\d{1,4}/, // 0 to 9999, -0 to -9999
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const timezonePatterns = {
|
|
26
|
+
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
27
|
+
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
28
|
+
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
29
|
+
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
30
|
+
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { numericPatterns, timezonePatterns };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Parser } from '../Parser.js';
|
|
2
|
+
import { dayPeriodEnumToHours } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
class AMPMMidnightParser extends Parser {
|
|
5
|
+
priority = 80;
|
|
6
|
+
|
|
7
|
+
parse(dateString, token, match) {
|
|
8
|
+
switch (token) {
|
|
9
|
+
case "b":
|
|
10
|
+
case "bb":
|
|
11
|
+
case "bbb":
|
|
12
|
+
return (
|
|
13
|
+
match.dayPeriod(dateString, {
|
|
14
|
+
width: "abbreviated",
|
|
15
|
+
context: "formatting",
|
|
16
|
+
}) ||
|
|
17
|
+
match.dayPeriod(dateString, {
|
|
18
|
+
width: "narrow",
|
|
19
|
+
context: "formatting",
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
case "bbbbb":
|
|
24
|
+
return match.dayPeriod(dateString, {
|
|
25
|
+
width: "narrow",
|
|
26
|
+
context: "formatting",
|
|
27
|
+
});
|
|
28
|
+
case "bbbb":
|
|
29
|
+
default:
|
|
30
|
+
return (
|
|
31
|
+
match.dayPeriod(dateString, {
|
|
32
|
+
width: "wide",
|
|
33
|
+
context: "formatting",
|
|
34
|
+
}) ||
|
|
35
|
+
match.dayPeriod(dateString, {
|
|
36
|
+
width: "abbreviated",
|
|
37
|
+
context: "formatting",
|
|
38
|
+
}) ||
|
|
39
|
+
match.dayPeriod(dateString, {
|
|
40
|
+
width: "narrow",
|
|
41
|
+
context: "formatting",
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set(date, _flags, value) {
|
|
48
|
+
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
49
|
+
return date;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { AMPMMidnightParser };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Parser } from '../Parser.js';
|
|
2
|
+
import { dayPeriodEnumToHours } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
class AMPMParser extends Parser {
|
|
5
|
+
priority = 80;
|
|
6
|
+
|
|
7
|
+
parse(dateString, token, match) {
|
|
8
|
+
switch (token) {
|
|
9
|
+
case "a":
|
|
10
|
+
case "aa":
|
|
11
|
+
case "aaa":
|
|
12
|
+
return (
|
|
13
|
+
match.dayPeriod(dateString, {
|
|
14
|
+
width: "abbreviated",
|
|
15
|
+
context: "formatting",
|
|
16
|
+
}) ||
|
|
17
|
+
match.dayPeriod(dateString, {
|
|
18
|
+
width: "narrow",
|
|
19
|
+
context: "formatting",
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
case "aaaaa":
|
|
24
|
+
return match.dayPeriod(dateString, {
|
|
25
|
+
width: "narrow",
|
|
26
|
+
context: "formatting",
|
|
27
|
+
});
|
|
28
|
+
case "aaaa":
|
|
29
|
+
default:
|
|
30
|
+
return (
|
|
31
|
+
match.dayPeriod(dateString, {
|
|
32
|
+
width: "wide",
|
|
33
|
+
context: "formatting",
|
|
34
|
+
}) ||
|
|
35
|
+
match.dayPeriod(dateString, {
|
|
36
|
+
width: "abbreviated",
|
|
37
|
+
context: "formatting",
|
|
38
|
+
}) ||
|
|
39
|
+
match.dayPeriod(dateString, {
|
|
40
|
+
width: "narrow",
|
|
41
|
+
context: "formatting",
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set(date, _flags, value) {
|
|
48
|
+
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
49
|
+
return date;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { AMPMParser };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { numericPatterns } from '../constants.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
import { parseNDigits, parseNumericPattern, isLeapYearIndex } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
6
|
+
const DAYS_IN_MONTH_LEAP_YEAR = [
|
|
7
|
+
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
// Day of the month
|
|
11
|
+
class DateParser extends Parser {
|
|
12
|
+
priority = 90;
|
|
13
|
+
subPriority = 1;
|
|
14
|
+
|
|
15
|
+
parse(dateString, token, match) {
|
|
16
|
+
switch (token) {
|
|
17
|
+
case "d":
|
|
18
|
+
return parseNumericPattern(numericPatterns.date, dateString);
|
|
19
|
+
case "do":
|
|
20
|
+
return match.ordinalNumber(dateString, { unit: "date" });
|
|
21
|
+
default:
|
|
22
|
+
return parseNDigits(token.length, dateString);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
validate(date, value) {
|
|
27
|
+
const year = date.getFullYear();
|
|
28
|
+
const isLeapYear = isLeapYearIndex(year);
|
|
29
|
+
const month = date.getMonth();
|
|
30
|
+
if (isLeapYear) {
|
|
31
|
+
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
|
32
|
+
} else {
|
|
33
|
+
return value >= 1 && value <= DAYS_IN_MONTH[month];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
set(date, _flags, value) {
|
|
38
|
+
date.setDate(value);
|
|
39
|
+
date.setHours(0, 0, 0, 0);
|
|
40
|
+
return date;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
incompatibleTokens = [
|
|
44
|
+
"Y",
|
|
45
|
+
"R",
|
|
46
|
+
"q",
|
|
47
|
+
"Q",
|
|
48
|
+
"w",
|
|
49
|
+
"I",
|
|
50
|
+
"D",
|
|
51
|
+
"i",
|
|
52
|
+
"e",
|
|
53
|
+
"c",
|
|
54
|
+
"t",
|
|
55
|
+
"T",
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { DateParser };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { numericPatterns } from '../constants.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
import { parseNDigits, parseNumericPattern, isLeapYearIndex } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
class DayOfYearParser extends Parser {
|
|
6
|
+
priority = 90;
|
|
7
|
+
|
|
8
|
+
subpriority = 1;
|
|
9
|
+
|
|
10
|
+
parse(dateString, token, match) {
|
|
11
|
+
switch (token) {
|
|
12
|
+
case "D":
|
|
13
|
+
case "DD":
|
|
14
|
+
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
|
15
|
+
case "Do":
|
|
16
|
+
return match.ordinalNumber(dateString, { unit: "date" });
|
|
17
|
+
default:
|
|
18
|
+
return parseNDigits(token.length, dateString);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
validate(date, value) {
|
|
23
|
+
const year = date.getFullYear();
|
|
24
|
+
const isLeapYear = isLeapYearIndex(year);
|
|
25
|
+
if (isLeapYear) {
|
|
26
|
+
return value >= 1 && value <= 366;
|
|
27
|
+
} else {
|
|
28
|
+
return value >= 1 && value <= 365;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set(date, _flags, value) {
|
|
33
|
+
date.setMonth(0, value);
|
|
34
|
+
date.setHours(0, 0, 0, 0);
|
|
35
|
+
return date;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
incompatibleTokens = [
|
|
39
|
+
"Y",
|
|
40
|
+
"R",
|
|
41
|
+
"q",
|
|
42
|
+
"Q",
|
|
43
|
+
"M",
|
|
44
|
+
"L",
|
|
45
|
+
"w",
|
|
46
|
+
"I",
|
|
47
|
+
"d",
|
|
48
|
+
"E",
|
|
49
|
+
"i",
|
|
50
|
+
"e",
|
|
51
|
+
"c",
|
|
52
|
+
"t",
|
|
53
|
+
"T",
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { DayOfYearParser };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { setDay } from '../../../setDay.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
|
|
4
|
+
// Day of week
|
|
5
|
+
class DayParser extends Parser {
|
|
6
|
+
priority = 90;
|
|
7
|
+
|
|
8
|
+
parse(dateString, token, match) {
|
|
9
|
+
switch (token) {
|
|
10
|
+
// Tue
|
|
11
|
+
case "E":
|
|
12
|
+
case "EE":
|
|
13
|
+
case "EEE":
|
|
14
|
+
return (
|
|
15
|
+
match.day(dateString, {
|
|
16
|
+
width: "abbreviated",
|
|
17
|
+
context: "formatting",
|
|
18
|
+
}) ||
|
|
19
|
+
match.day(dateString, { width: "short", context: "formatting" }) ||
|
|
20
|
+
match.day(dateString, { width: "narrow", context: "formatting" })
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// T
|
|
24
|
+
case "EEEEE":
|
|
25
|
+
return match.day(dateString, {
|
|
26
|
+
width: "narrow",
|
|
27
|
+
context: "formatting",
|
|
28
|
+
});
|
|
29
|
+
// Tu
|
|
30
|
+
case "EEEEEE":
|
|
31
|
+
return (
|
|
32
|
+
match.day(dateString, { width: "short", context: "formatting" }) ||
|
|
33
|
+
match.day(dateString, { width: "narrow", context: "formatting" })
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Tuesday
|
|
37
|
+
case "EEEE":
|
|
38
|
+
default:
|
|
39
|
+
return (
|
|
40
|
+
match.day(dateString, { width: "wide", context: "formatting" }) ||
|
|
41
|
+
match.day(dateString, {
|
|
42
|
+
width: "abbreviated",
|
|
43
|
+
context: "formatting",
|
|
44
|
+
}) ||
|
|
45
|
+
match.day(dateString, { width: "short", context: "formatting" }) ||
|
|
46
|
+
match.day(dateString, { width: "narrow", context: "formatting" })
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
validate(_date, value) {
|
|
52
|
+
return value >= 0 && value <= 6;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set(date, _flags, value, options) {
|
|
56
|
+
date = setDay(date, value, options);
|
|
57
|
+
date.setHours(0, 0, 0, 0);
|
|
58
|
+
return date;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { DayParser };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Parser } from '../Parser.js';
|
|
2
|
+
import { dayPeriodEnumToHours } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
// in the morning, in the afternoon, in the evening, at night
|
|
5
|
+
class DayPeriodParser extends Parser {
|
|
6
|
+
priority = 80;
|
|
7
|
+
|
|
8
|
+
parse(dateString, token, match) {
|
|
9
|
+
switch (token) {
|
|
10
|
+
case "B":
|
|
11
|
+
case "BB":
|
|
12
|
+
case "BBB":
|
|
13
|
+
return (
|
|
14
|
+
match.dayPeriod(dateString, {
|
|
15
|
+
width: "abbreviated",
|
|
16
|
+
context: "formatting",
|
|
17
|
+
}) ||
|
|
18
|
+
match.dayPeriod(dateString, {
|
|
19
|
+
width: "narrow",
|
|
20
|
+
context: "formatting",
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
case "BBBBB":
|
|
25
|
+
return match.dayPeriod(dateString, {
|
|
26
|
+
width: "narrow",
|
|
27
|
+
context: "formatting",
|
|
28
|
+
});
|
|
29
|
+
case "BBBB":
|
|
30
|
+
default:
|
|
31
|
+
return (
|
|
32
|
+
match.dayPeriod(dateString, {
|
|
33
|
+
width: "wide",
|
|
34
|
+
context: "formatting",
|
|
35
|
+
}) ||
|
|
36
|
+
match.dayPeriod(dateString, {
|
|
37
|
+
width: "abbreviated",
|
|
38
|
+
context: "formatting",
|
|
39
|
+
}) ||
|
|
40
|
+
match.dayPeriod(dateString, {
|
|
41
|
+
width: "narrow",
|
|
42
|
+
context: "formatting",
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
set(date, _flags, value) {
|
|
49
|
+
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
50
|
+
return date;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
incompatibleTokens = ["a", "b", "t", "T"];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { DayPeriodParser };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Parser } from '../Parser.js';
|
|
2
|
+
|
|
3
|
+
class EraParser extends Parser {
|
|
4
|
+
priority = 140;
|
|
5
|
+
|
|
6
|
+
parse(dateString, token, match) {
|
|
7
|
+
switch (token) {
|
|
8
|
+
// AD, BC
|
|
9
|
+
case "G":
|
|
10
|
+
case "GG":
|
|
11
|
+
case "GGG":
|
|
12
|
+
return (
|
|
13
|
+
match.era(dateString, { width: "abbreviated" }) ||
|
|
14
|
+
match.era(dateString, { width: "narrow" })
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
// A, B
|
|
18
|
+
case "GGGGG":
|
|
19
|
+
return match.era(dateString, { width: "narrow" });
|
|
20
|
+
// Anno Domini, Before Christ
|
|
21
|
+
case "GGGG":
|
|
22
|
+
default:
|
|
23
|
+
return (
|
|
24
|
+
match.era(dateString, { width: "wide" }) ||
|
|
25
|
+
match.era(dateString, { width: "abbreviated" }) ||
|
|
26
|
+
match.era(dateString, { width: "narrow" })
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set(date, flags, value) {
|
|
32
|
+
flags.era = value;
|
|
33
|
+
date.setFullYear(value, 0, 1);
|
|
34
|
+
date.setHours(0, 0, 0, 0);
|
|
35
|
+
return date;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
incompatibleTokens = ["R", "u", "t", "T"];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { EraParser };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Parser } from '../Parser.js';
|
|
2
|
+
import { parseNDigitsSigned } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
class ExtendedYearParser extends Parser {
|
|
5
|
+
priority = 130;
|
|
6
|
+
|
|
7
|
+
parse(dateString, token) {
|
|
8
|
+
if (token === "u") {
|
|
9
|
+
return parseNDigitsSigned(4, dateString);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return parseNDigitsSigned(token.length, dateString);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
set(date, _flags, value) {
|
|
16
|
+
date.setFullYear(value, 0, 1);
|
|
17
|
+
date.setHours(0, 0, 0, 0);
|
|
18
|
+
return date;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { ExtendedYearParser };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Parser } from '../Parser.js';
|
|
2
|
+
import { mapValue, parseNDigits } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
class FractionOfSecondParser extends Parser {
|
|
5
|
+
priority = 30;
|
|
6
|
+
|
|
7
|
+
parse(dateString, token) {
|
|
8
|
+
const valueCallback = (value) =>
|
|
9
|
+
Math.trunc(value * Math.pow(10, -token.length + 3));
|
|
10
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
set(date, _flags, value) {
|
|
14
|
+
date.setMilliseconds(value);
|
|
15
|
+
return date;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
incompatibleTokens = ["t", "T"];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { FractionOfSecondParser };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { numericPatterns } from '../constants.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
class Hour0To11Parser extends Parser {
|
|
6
|
+
priority = 70;
|
|
7
|
+
|
|
8
|
+
parse(dateString, token, match) {
|
|
9
|
+
switch (token) {
|
|
10
|
+
case "K":
|
|
11
|
+
return parseNumericPattern(numericPatterns.hour11h, dateString);
|
|
12
|
+
case "Ko":
|
|
13
|
+
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
+
default:
|
|
15
|
+
return parseNDigits(token.length, dateString);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
validate(_date, value) {
|
|
20
|
+
return value >= 0 && value <= 11;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set(date, _flags, value) {
|
|
24
|
+
const isPM = date.getHours() >= 12;
|
|
25
|
+
if (isPM && value < 12) {
|
|
26
|
+
date.setHours(value + 12, 0, 0, 0);
|
|
27
|
+
} else {
|
|
28
|
+
date.setHours(value, 0, 0, 0);
|
|
29
|
+
}
|
|
30
|
+
return date;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Hour0To11Parser };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { numericPatterns } from '../constants.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
class Hour0to23Parser extends Parser {
|
|
6
|
+
priority = 70;
|
|
7
|
+
|
|
8
|
+
parse(dateString, token, match) {
|
|
9
|
+
switch (token) {
|
|
10
|
+
case "H":
|
|
11
|
+
return parseNumericPattern(numericPatterns.hour23h, dateString);
|
|
12
|
+
case "Ho":
|
|
13
|
+
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
+
default:
|
|
15
|
+
return parseNDigits(token.length, dateString);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
validate(_date, value) {
|
|
20
|
+
return value >= 0 && value <= 23;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set(date, _flags, value) {
|
|
24
|
+
date.setHours(value, 0, 0, 0);
|
|
25
|
+
return date;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Hour0to23Parser };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { numericPatterns } from '../constants.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
class Hour1To24Parser extends Parser {
|
|
6
|
+
priority = 70;
|
|
7
|
+
|
|
8
|
+
parse(dateString, token, match) {
|
|
9
|
+
switch (token) {
|
|
10
|
+
case "k":
|
|
11
|
+
return parseNumericPattern(numericPatterns.hour24h, dateString);
|
|
12
|
+
case "ko":
|
|
13
|
+
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
+
default:
|
|
15
|
+
return parseNDigits(token.length, dateString);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
validate(_date, value) {
|
|
20
|
+
return value >= 1 && value <= 24;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set(date, _flags, value) {
|
|
24
|
+
const hours = value <= 24 ? value % 24 : value;
|
|
25
|
+
date.setHours(hours, 0, 0, 0);
|
|
26
|
+
return date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Hour1To24Parser };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { numericPatterns } from '../constants.js';
|
|
2
|
+
import { Parser } from '../Parser.js';
|
|
3
|
+
import { parseNDigits, parseNumericPattern } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
class Hour1to12Parser extends Parser {
|
|
6
|
+
priority = 70;
|
|
7
|
+
|
|
8
|
+
parse(dateString, token, match) {
|
|
9
|
+
switch (token) {
|
|
10
|
+
case "h":
|
|
11
|
+
return parseNumericPattern(numericPatterns.hour12h, dateString);
|
|
12
|
+
case "ho":
|
|
13
|
+
return match.ordinalNumber(dateString, { unit: "hour" });
|
|
14
|
+
default:
|
|
15
|
+
return parseNDigits(token.length, dateString);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
validate(_date, value) {
|
|
20
|
+
return value >= 1 && value <= 12;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set(date, _flags, value) {
|
|
24
|
+
const isPM = date.getHours() >= 12;
|
|
25
|
+
if (isPM && value < 12) {
|
|
26
|
+
date.setHours(value + 12, 0, 0, 0);
|
|
27
|
+
} else if (!isPM && value === 12) {
|
|
28
|
+
date.setHours(0, 0, 0, 0);
|
|
29
|
+
} else {
|
|
30
|
+
date.setHours(value, 0, 0, 0);
|
|
31
|
+
}
|
|
32
|
+
return date;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
incompatibleTokens = ["H", "K", "k", "t", "T"];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Hour1to12Parser };
|