@coopdigital/react 0.49.1 → 0.50.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 +10 -6
- 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,235 @@
|
|
|
1
|
+
import { tzOffset } from '../tzOffset/index.js';
|
|
2
|
+
|
|
3
|
+
class TZDateMini extends Date {
|
|
4
|
+
//#region static
|
|
5
|
+
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super();
|
|
8
|
+
if (args.length > 1 && typeof args[args.length - 1] === "string") {
|
|
9
|
+
this.timeZone = args.pop();
|
|
10
|
+
}
|
|
11
|
+
this.internal = new Date();
|
|
12
|
+
if (isNaN(tzOffset(this.timeZone, this))) {
|
|
13
|
+
this.setTime(NaN);
|
|
14
|
+
} else {
|
|
15
|
+
if (!args.length) {
|
|
16
|
+
this.setTime(Date.now());
|
|
17
|
+
} else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
|
|
18
|
+
this.setTime(args[0]);
|
|
19
|
+
} else if (typeof args[0] === "string") {
|
|
20
|
+
this.setTime(+new Date(args[0]));
|
|
21
|
+
} else if (args[0] instanceof Date) {
|
|
22
|
+
this.setTime(+args[0]);
|
|
23
|
+
} else {
|
|
24
|
+
this.setTime(+new Date(...args));
|
|
25
|
+
adjustToSystemTZ(this);
|
|
26
|
+
syncToInternal(this);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static tz(tz, ...args) {
|
|
31
|
+
return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
|
|
36
|
+
//#region time zone
|
|
37
|
+
|
|
38
|
+
withTimeZone(timeZone) {
|
|
39
|
+
return new TZDateMini(+this, timeZone);
|
|
40
|
+
}
|
|
41
|
+
getTimezoneOffset() {
|
|
42
|
+
const offset = -tzOffset(this.timeZone, this);
|
|
43
|
+
// Remove the seconds offset
|
|
44
|
+
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
45
|
+
return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
|
|
50
|
+
//#region time
|
|
51
|
+
|
|
52
|
+
setTime(time) {
|
|
53
|
+
Date.prototype.setTime.apply(this, arguments);
|
|
54
|
+
syncToInternal(this);
|
|
55
|
+
return +this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
|
|
60
|
+
//#region date-fns integration
|
|
61
|
+
|
|
62
|
+
[Symbol.for("constructDateFrom")](date) {
|
|
63
|
+
return new TZDateMini(+new Date(date), this.timeZone);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Assign getters and setters
|
|
70
|
+
const re = /^(get|set)(?!UTC)/;
|
|
71
|
+
Object.getOwnPropertyNames(Date.prototype).forEach(method => {
|
|
72
|
+
if (!re.test(method)) return;
|
|
73
|
+
const utcMethod = method.replace(re, "$1UTC");
|
|
74
|
+
// Filter out methods without UTC counterparts
|
|
75
|
+
if (!TZDateMini.prototype[utcMethod]) return;
|
|
76
|
+
if (method.startsWith("get")) {
|
|
77
|
+
// Delegate to internal date's UTC method
|
|
78
|
+
TZDateMini.prototype[method] = function () {
|
|
79
|
+
return this.internal[utcMethod]();
|
|
80
|
+
};
|
|
81
|
+
} else {
|
|
82
|
+
// Assign regular setter
|
|
83
|
+
TZDateMini.prototype[method] = function () {
|
|
84
|
+
Date.prototype[utcMethod].apply(this.internal, arguments);
|
|
85
|
+
syncFromInternal(this);
|
|
86
|
+
return +this;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Assign UTC setter
|
|
90
|
+
TZDateMini.prototype[utcMethod] = function () {
|
|
91
|
+
Date.prototype[utcMethod].apply(this, arguments);
|
|
92
|
+
syncToInternal(this);
|
|
93
|
+
return +this;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Function syncs time to internal date, applying the time zone offset.
|
|
100
|
+
*
|
|
101
|
+
* @param {Date} date - Date to sync
|
|
102
|
+
*/
|
|
103
|
+
function syncToInternal(date) {
|
|
104
|
+
date.internal.setTime(+date);
|
|
105
|
+
date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Function syncs the internal date UTC values to the date. It allows to get
|
|
110
|
+
* accurate timestamp value.
|
|
111
|
+
*
|
|
112
|
+
* @param {Date} date - The date to sync
|
|
113
|
+
*/
|
|
114
|
+
function syncFromInternal(date) {
|
|
115
|
+
// First we transpose the internal values
|
|
116
|
+
Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
|
|
117
|
+
Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
|
|
118
|
+
|
|
119
|
+
// Now we have to adjust the date to the system time zone
|
|
120
|
+
adjustToSystemTZ(date);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Function adjusts the date to the system time zone. It uses the time zone
|
|
125
|
+
* differences to calculate the offset and adjust the date.
|
|
126
|
+
*
|
|
127
|
+
* @param {Date} date - Date to adjust
|
|
128
|
+
*/
|
|
129
|
+
function adjustToSystemTZ(date) {
|
|
130
|
+
// Save the time zone offset before all the adjustments
|
|
131
|
+
const baseOffset = tzOffset(date.timeZone, date);
|
|
132
|
+
// Remove the seconds offset
|
|
133
|
+
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
134
|
+
const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
|
|
135
|
+
//#region System DST adjustment
|
|
136
|
+
|
|
137
|
+
// The biggest problem with using the system time zone is that when we create
|
|
138
|
+
// a date from internal values stored in UTC, the system time zone might end
|
|
139
|
+
// up on the DST hour:
|
|
140
|
+
//
|
|
141
|
+
// $ TZ=America/New_York node
|
|
142
|
+
// > new Date(2020, 2, 8, 1).toString()
|
|
143
|
+
// 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'
|
|
144
|
+
// > new Date(2020, 2, 8, 2).toString()
|
|
145
|
+
// 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
146
|
+
// > new Date(2020, 2, 8, 3).toString()
|
|
147
|
+
// 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
148
|
+
// > new Date(2020, 2, 8, 4).toString()
|
|
149
|
+
// 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
150
|
+
//
|
|
151
|
+
// Here we get the same hour for both 2 and 3, because the system time zone
|
|
152
|
+
// has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have
|
|
153
|
+
// to adjust the internal date to reflect that.
|
|
154
|
+
//
|
|
155
|
+
// However we want to adjust only if that's the DST hour the change happenes,
|
|
156
|
+
// not the hour where DST moves to.
|
|
157
|
+
|
|
158
|
+
// We calculate the previous hour to see if the time zone offset has changed
|
|
159
|
+
// and we have landed on the DST hour.
|
|
160
|
+
const prevHour = new Date(+date);
|
|
161
|
+
// We use UTC methods here as we don't want to land on the same hour again
|
|
162
|
+
// in case of DST.
|
|
163
|
+
prevHour.setUTCHours(prevHour.getUTCHours() - 1);
|
|
164
|
+
|
|
165
|
+
// Calculate if we are on the system DST hour.
|
|
166
|
+
const systemOffset = -new Date(+date).getTimezoneOffset();
|
|
167
|
+
const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
|
|
168
|
+
const systemDSTChange = systemOffset - prevHourSystemOffset;
|
|
169
|
+
// Detect the DST shift. System DST change will occur both on
|
|
170
|
+
const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
|
|
171
|
+
|
|
172
|
+
// Move the internal date when we are on the system DST hour.
|
|
173
|
+
if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
|
|
177
|
+
//#region System diff adjustment
|
|
178
|
+
|
|
179
|
+
// Now we need to adjust the date, since we just applied internal values.
|
|
180
|
+
// We need to calculate the difference between the system and date time zones
|
|
181
|
+
// and apply it to the date.
|
|
182
|
+
|
|
183
|
+
const offsetDiff = systemOffset - offset;
|
|
184
|
+
if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
187
|
+
|
|
188
|
+
//#region Seconds System diff adjustment
|
|
189
|
+
|
|
190
|
+
const systemDate = new Date(+date);
|
|
191
|
+
// Set the UTC seconds to 0 to isolate the timezone offset in seconds.
|
|
192
|
+
systemDate.setUTCSeconds(0);
|
|
193
|
+
// For negative systemOffset, invert the seconds.
|
|
194
|
+
const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
|
|
195
|
+
|
|
196
|
+
// Calculate the seconds offset based on the timezone offset.
|
|
197
|
+
const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
|
|
198
|
+
if (secondsOffset || systemSecondsOffset) {
|
|
199
|
+
date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
|
|
200
|
+
Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
|
|
205
|
+
//#region Post-adjustment DST fix
|
|
206
|
+
|
|
207
|
+
const postBaseOffset = tzOffset(date.timeZone, date);
|
|
208
|
+
// Remove the seconds offset
|
|
209
|
+
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
210
|
+
const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
|
|
211
|
+
const postSystemOffset = -new Date(+date).getTimezoneOffset();
|
|
212
|
+
const postOffsetDiff = postSystemOffset - postOffset;
|
|
213
|
+
const offsetChanged = postOffset !== offset;
|
|
214
|
+
const postDiff = postOffsetDiff - offsetDiff;
|
|
215
|
+
if (offsetChanged && postDiff) {
|
|
216
|
+
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
|
|
217
|
+
|
|
218
|
+
// Now we need to check if got offset change during the post-adjustment.
|
|
219
|
+
// If so, we also need both dates to reflect that.
|
|
220
|
+
|
|
221
|
+
const newBaseOffset = tzOffset(date.timeZone, date);
|
|
222
|
+
// Remove the seconds offset
|
|
223
|
+
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
224
|
+
const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
|
|
225
|
+
const offsetChange = postOffset - newOffset;
|
|
226
|
+
if (offsetChange) {
|
|
227
|
+
date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
|
|
228
|
+
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
//#endregion
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export { TZDateMini };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time zone name format.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The function returns the time zone name for the given date in the specified
|
|
7
|
+
* time zone.
|
|
8
|
+
*
|
|
9
|
+
* It uses the `Intl.DateTimeFormat` API and by default outputs the time zone
|
|
10
|
+
* name in a long format, e.g. "Pacific Standard Time" or
|
|
11
|
+
* "Singapore Standard Time".
|
|
12
|
+
*
|
|
13
|
+
* It is possible to specify the format as the third argument using one of the following options
|
|
14
|
+
*
|
|
15
|
+
* - "short": e.g. "EDT" or "GMT+8".
|
|
16
|
+
* - "long": e.g. "Eastern Daylight Time".
|
|
17
|
+
* - "shortGeneric": e.g. "ET" or "Singapore Time".
|
|
18
|
+
* - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
|
|
19
|
+
*
|
|
20
|
+
* These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
|
|
21
|
+
*
|
|
22
|
+
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
23
|
+
* @param date - Date object to get the time zone name for
|
|
24
|
+
* @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
|
|
25
|
+
*
|
|
26
|
+
* @returns Time zone name (e.g. "Singapore Standard Time")
|
|
27
|
+
*/
|
|
28
|
+
function tzName(timeZone, date, format = "long") {
|
|
29
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
30
|
+
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
|
|
31
|
+
hour: "numeric",
|
|
32
|
+
timeZone: timeZone,
|
|
33
|
+
timeZoneName: format
|
|
34
|
+
}).format(date).split(/\s/g) // Format.JS uses non-breaking spaces
|
|
35
|
+
.slice(2) // Skip the hour and AM/PM parts
|
|
36
|
+
.join(" ");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { tzName };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const offsetFormatCache = {};
|
|
2
|
+
const offsetCache = {};
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The function extracts UTC offset in minutes from the given date in specified
|
|
6
|
+
* time zone.
|
|
7
|
+
*
|
|
8
|
+
* Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
|
|
9
|
+
* mirrored to the sign of the offset in the time zone. For Asia/Singapore
|
|
10
|
+
* (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.
|
|
11
|
+
*
|
|
12
|
+
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
13
|
+
* @param date - Date to check the offset for
|
|
14
|
+
*
|
|
15
|
+
* @returns UTC offset in minutes
|
|
16
|
+
*/
|
|
17
|
+
function tzOffset(timeZone, date) {
|
|
18
|
+
try {
|
|
19
|
+
const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
|
|
20
|
+
timeZone,
|
|
21
|
+
timeZoneName: "longOffset"
|
|
22
|
+
}).format;
|
|
23
|
+
const offsetStr = format(date).split("GMT")[1];
|
|
24
|
+
if (offsetStr in offsetCache) return offsetCache[offsetStr];
|
|
25
|
+
return calcOffset(offsetStr, offsetStr.split(":"));
|
|
26
|
+
} catch {
|
|
27
|
+
// Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH
|
|
28
|
+
// See: https://github.com/nodejs/node/issues/53419
|
|
29
|
+
if (timeZone in offsetCache) return offsetCache[timeZone];
|
|
30
|
+
const captures = timeZone?.match(offsetRe);
|
|
31
|
+
if (captures) return calcOffset(timeZone, captures.slice(1));
|
|
32
|
+
return NaN;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const offsetRe = /([+-]\d\d):?(\d\d)?/;
|
|
36
|
+
function calcOffset(cacheStr, values) {
|
|
37
|
+
const hours = +(values[0] || 0);
|
|
38
|
+
const minutes = +(values[1] || 0);
|
|
39
|
+
// Convert seconds to minutes by dividing by 60 to keep the function return in minutes.
|
|
40
|
+
const seconds = +(values[2] || 0) / 60;
|
|
41
|
+
return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { tzOffset };
|