@zimyo/ui 1.0.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/_virtual/_rollupPluginBabelHelpers.js +11 -0
- package/dist/components/index.d.ts +59 -0
- package/dist/components/ui/accordion.d.ts +9 -0
- package/dist/components/ui/accordion.js +53 -0
- package/dist/components/ui/alert-dialog.d.ts +16 -0
- package/dist/components/ui/alert-dialog.js +107 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +53 -0
- package/dist/components/ui/aspect-ratio.d.ts +6 -0
- package/dist/components/ui/aspect-ratio.js +12 -0
- package/dist/components/ui/avatar.d.ts +8 -0
- package/dist/components/ui/avatar.js +38 -0
- package/dist/components/ui/badge.d.ts +12 -0
- package/dist/components/ui/badge.js +37 -0
- package/dist/components/ui/breadcrumb.d.ts +13 -0
- package/dist/components/ui/breadcrumb.js +90 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/button.js +49 -0
- package/dist/components/ui/calendar.d.ts +12 -0
- package/dist/components/ui/calendar.js +134 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/card.js +77 -0
- package/dist/components/ui/carousel.d.ts +24 -0
- package/dist/components/ui/carousel.js +163 -0
- package/dist/components/ui/chart.d.ts +43 -0
- package/dist/components/ui/chart.js +187 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.js +24 -0
- package/dist/components/ui/collapsible.d.ts +8 -0
- package/dist/components/ui/collapsible.js +24 -0
- package/dist/components/ui/command.d.ts +21 -0
- package/dist/components/ui/command.js +110 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/context-menu.js +158 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +102 -0
- package/dist/components/ui/drawer.d.ts +15 -0
- package/dist/components/ui/drawer.js +97 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/dropdown-menu.js +160 -0
- package/dist/components/ui/form.d.ts +26 -0
- package/dist/components/ui/form.js +125 -0
- package/dist/components/ui/hover-card.d.ts +8 -0
- package/dist/components/ui/hover-card.js +36 -0
- package/dist/components/ui/input-otp.d.ts +13 -0
- package/dist/components/ui/input-otp.js +61 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +19 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.js +18 -0
- package/dist/components/ui/menubar.d.ts +28 -0
- package/dist/components/ui/menubar.js +178 -0
- package/dist/components/ui/navigation-menu.d.ts +17 -0
- package/dist/components/ui/navigation-menu.js +102 -0
- package/dist/components/ui/pagination.d.ts +17 -0
- package/dist/components/ui/pagination.js +95 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +40 -0
- package/dist/components/ui/progress.d.ts +6 -0
- package/dist/components/ui/progress.js +25 -0
- package/dist/components/ui/radio-group.d.ts +7 -0
- package/dist/components/ui/radio-group.js +34 -0
- package/dist/components/ui/resizable.d.ts +10 -0
- package/dist/components/ui/resizable.js +40 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.js +37 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +118 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/separator.js +22 -0
- package/dist/components/ui/sheet.d.ts +15 -0
- package/dist/components/ui/sheet.js +101 -0
- package/dist/components/ui/sidebar.d.ts +73 -0
- package/dist/components/ui/sidebar.js +484 -0
- package/dist/components/ui/skeleton.d.ts +5 -0
- package/dist/components/ui/skeleton.js +16 -0
- package/dist/components/ui/slider.d.ts +6 -0
- package/dist/components/ui/slider.js +39 -0
- package/dist/components/ui/sonner.d.ts +6 -0
- package/dist/components/ui/sonner.js +18 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/table.d.ts +12 -0
- package/dist/components/ui/table.js +90 -0
- package/dist/components/ui/tabs.d.ts +9 -0
- package/dist/components/ui/tabs.js +48 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.js +17 -0
- package/dist/components/ui/toggle-group.d.ts +10 -0
- package/dist/components/ui/toggle-group.js +52 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +42 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.js +45 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +47 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +8 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +101 -0
- package/dist/node_modules/@date-fns/tz/date/mini.js +207 -0
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +43 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -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 +79 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +321 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +130 -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/aria-hidden/dist/es2015/index.js +137 -0
- package/dist/node_modules/class-variance-authority/dist/index.js +44 -0
- package/dist/node_modules/clsx/dist/clsx.js +3 -0
- package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.js +3 -0
- package/dist/node_modules/cmdk/dist/index.js +10 -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 +46 -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/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/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/setMonth.js +46 -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/embla-carousel/esm/embla-carousel.esm.js +1669 -0
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +37 -0
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +38 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/input-otp/dist/index.js +24 -0
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +285 -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 +30 -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 +522 -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 +18 -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 +25 -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 +51 -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 +28 -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 +39 -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 +24 -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 +38 -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 +24 -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 +15 -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/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 +175 -0
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +85 -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 +50 -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 +92 -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/typeguards.js +66 -0
- package/dist/node_modules/react-hook-form/dist/index.esm.js +507 -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 +160 -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-resizable-panels/dist/react-resizable-panels.js +2407 -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/sonner/dist/index.js +1125 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2956 -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/node_modules/vaul/dist/index.js +1627 -0
- package/dist/styles.css +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function buildMatchFn(args) {
|
|
2
|
+
return (string, options = {}) => {
|
|
3
|
+
const width = options.width;
|
|
4
|
+
|
|
5
|
+
const matchPattern =
|
|
6
|
+
(width && args.matchPatterns[width]) ||
|
|
7
|
+
args.matchPatterns[args.defaultMatchWidth];
|
|
8
|
+
const matchResult = string.match(matchPattern);
|
|
9
|
+
|
|
10
|
+
if (!matchResult) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const matchedString = matchResult[0];
|
|
14
|
+
|
|
15
|
+
const parsePatterns =
|
|
16
|
+
(width && args.parsePatterns[width]) ||
|
|
17
|
+
args.parsePatterns[args.defaultParseWidth];
|
|
18
|
+
|
|
19
|
+
const key = Array.isArray(parsePatterns)
|
|
20
|
+
? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
|
|
21
|
+
: // [TODO] -- I challenge you to fix the type
|
|
22
|
+
findKey(parsePatterns, (pattern) => pattern.test(matchedString));
|
|
23
|
+
|
|
24
|
+
let value;
|
|
25
|
+
|
|
26
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
27
|
+
value = options.valueCallback
|
|
28
|
+
? // [TODO] -- I challenge you to fix the type
|
|
29
|
+
options.valueCallback(value)
|
|
30
|
+
: value;
|
|
31
|
+
|
|
32
|
+
const rest = string.slice(matchedString.length);
|
|
33
|
+
|
|
34
|
+
return { value, rest };
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function findKey(object, predicate) {
|
|
39
|
+
for (const key in object) {
|
|
40
|
+
if (
|
|
41
|
+
Object.prototype.hasOwnProperty.call(object, key) &&
|
|
42
|
+
predicate(object[key])
|
|
43
|
+
) {
|
|
44
|
+
return key;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function findIndex(array, predicate) {
|
|
51
|
+
for (let key = 0; key < array.length; key++) {
|
|
52
|
+
if (predicate(array[key])) {
|
|
53
|
+
return key;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { buildMatchFn };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function buildMatchPatternFn(args) {
|
|
2
|
+
return (string, options = {}) => {
|
|
3
|
+
const matchResult = string.match(args.matchPattern);
|
|
4
|
+
if (!matchResult) return null;
|
|
5
|
+
const matchedString = matchResult[0];
|
|
6
|
+
|
|
7
|
+
const parseResult = string.match(args.parsePattern);
|
|
8
|
+
if (!parseResult) return null;
|
|
9
|
+
let value = args.valueCallback
|
|
10
|
+
? args.valueCallback(parseResult[0])
|
|
11
|
+
: parseResult[0];
|
|
12
|
+
|
|
13
|
+
// [TODO] I challenge you to fix the type
|
|
14
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
15
|
+
|
|
16
|
+
const rest = string.slice(matchedString.length);
|
|
17
|
+
|
|
18
|
+
return { value, rest };
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { buildMatchPatternFn };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const formatDistanceLocale = {
|
|
2
|
+
lessThanXSeconds: {
|
|
3
|
+
one: "less than a second",
|
|
4
|
+
other: "less than {{count}} seconds",
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
xSeconds: {
|
|
8
|
+
one: "1 second",
|
|
9
|
+
other: "{{count}} seconds",
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
halfAMinute: "half a minute",
|
|
13
|
+
|
|
14
|
+
lessThanXMinutes: {
|
|
15
|
+
one: "less than a minute",
|
|
16
|
+
other: "less than {{count}} minutes",
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
xMinutes: {
|
|
20
|
+
one: "1 minute",
|
|
21
|
+
other: "{{count}} minutes",
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
aboutXHours: {
|
|
25
|
+
one: "about 1 hour",
|
|
26
|
+
other: "about {{count}} hours",
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
xHours: {
|
|
30
|
+
one: "1 hour",
|
|
31
|
+
other: "{{count}} hours",
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
xDays: {
|
|
35
|
+
one: "1 day",
|
|
36
|
+
other: "{{count}} days",
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
aboutXWeeks: {
|
|
40
|
+
one: "about 1 week",
|
|
41
|
+
other: "about {{count}} weeks",
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
xWeeks: {
|
|
45
|
+
one: "1 week",
|
|
46
|
+
other: "{{count}} weeks",
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
aboutXMonths: {
|
|
50
|
+
one: "about 1 month",
|
|
51
|
+
other: "about {{count}} months",
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
xMonths: {
|
|
55
|
+
one: "1 month",
|
|
56
|
+
other: "{{count}} months",
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
aboutXYears: {
|
|
60
|
+
one: "about 1 year",
|
|
61
|
+
other: "about {{count}} years",
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
xYears: {
|
|
65
|
+
one: "1 year",
|
|
66
|
+
other: "{{count}} years",
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
overXYears: {
|
|
70
|
+
one: "over 1 year",
|
|
71
|
+
other: "over {{count}} years",
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
almostXYears: {
|
|
75
|
+
one: "almost 1 year",
|
|
76
|
+
other: "almost {{count}} years",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const formatDistance = (token, count, options) => {
|
|
81
|
+
let result;
|
|
82
|
+
|
|
83
|
+
const tokenValue = formatDistanceLocale[token];
|
|
84
|
+
if (typeof tokenValue === "string") {
|
|
85
|
+
result = tokenValue;
|
|
86
|
+
} else if (count === 1) {
|
|
87
|
+
result = tokenValue.one;
|
|
88
|
+
} else {
|
|
89
|
+
result = tokenValue.other.replace("{{count}}", count.toString());
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (options?.addSuffix) {
|
|
93
|
+
if (options.comparison && options.comparison > 0) {
|
|
94
|
+
return "in " + result;
|
|
95
|
+
} else {
|
|
96
|
+
return result + " ago";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return result;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { formatDistance };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { buildFormatLongFn } from '../../_lib/buildFormatLongFn.js';
|
|
2
|
+
|
|
3
|
+
const dateFormats = {
|
|
4
|
+
full: "EEEE, MMMM do, y",
|
|
5
|
+
long: "MMMM do, y",
|
|
6
|
+
medium: "MMM d, y",
|
|
7
|
+
short: "MM/dd/yyyy",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const timeFormats = {
|
|
11
|
+
full: "h:mm:ss a zzzz",
|
|
12
|
+
long: "h:mm:ss a z",
|
|
13
|
+
medium: "h:mm:ss a",
|
|
14
|
+
short: "h:mm a",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const dateTimeFormats = {
|
|
18
|
+
full: "{{date}} 'at' {{time}}",
|
|
19
|
+
long: "{{date}} 'at' {{time}}",
|
|
20
|
+
medium: "{{date}}, {{time}}",
|
|
21
|
+
short: "{{date}}, {{time}}",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const formatLong = {
|
|
25
|
+
date: buildFormatLongFn({
|
|
26
|
+
formats: dateFormats,
|
|
27
|
+
defaultWidth: "full",
|
|
28
|
+
}),
|
|
29
|
+
|
|
30
|
+
time: buildFormatLongFn({
|
|
31
|
+
formats: timeFormats,
|
|
32
|
+
defaultWidth: "full",
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
dateTime: buildFormatLongFn({
|
|
36
|
+
formats: dateTimeFormats,
|
|
37
|
+
defaultWidth: "full",
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { formatLong };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const formatRelativeLocale = {
|
|
2
|
+
lastWeek: "'last' eeee 'at' p",
|
|
3
|
+
yesterday: "'yesterday at' p",
|
|
4
|
+
today: "'today at' p",
|
|
5
|
+
tomorrow: "'tomorrow at' p",
|
|
6
|
+
nextWeek: "eeee 'at' p",
|
|
7
|
+
other: "P",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const formatRelative = (token, _date, _baseDate, _options) =>
|
|
11
|
+
formatRelativeLocale[token];
|
|
12
|
+
|
|
13
|
+
export { formatRelative };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { buildLocalizeFn } from '../../_lib/buildLocalizeFn.js';
|
|
2
|
+
|
|
3
|
+
const eraValues = {
|
|
4
|
+
narrow: ["B", "A"],
|
|
5
|
+
abbreviated: ["BC", "AD"],
|
|
6
|
+
wide: ["Before Christ", "Anno Domini"],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const quarterValues = {
|
|
10
|
+
narrow: ["1", "2", "3", "4"],
|
|
11
|
+
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
12
|
+
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Note: in English, the names of days of the week and months are capitalized.
|
|
16
|
+
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
17
|
+
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
18
|
+
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
19
|
+
const monthValues = {
|
|
20
|
+
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
21
|
+
abbreviated: [
|
|
22
|
+
"Jan",
|
|
23
|
+
"Feb",
|
|
24
|
+
"Mar",
|
|
25
|
+
"Apr",
|
|
26
|
+
"May",
|
|
27
|
+
"Jun",
|
|
28
|
+
"Jul",
|
|
29
|
+
"Aug",
|
|
30
|
+
"Sep",
|
|
31
|
+
"Oct",
|
|
32
|
+
"Nov",
|
|
33
|
+
"Dec",
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
wide: [
|
|
37
|
+
"January",
|
|
38
|
+
"February",
|
|
39
|
+
"March",
|
|
40
|
+
"April",
|
|
41
|
+
"May",
|
|
42
|
+
"June",
|
|
43
|
+
"July",
|
|
44
|
+
"August",
|
|
45
|
+
"September",
|
|
46
|
+
"October",
|
|
47
|
+
"November",
|
|
48
|
+
"December",
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const dayValues = {
|
|
53
|
+
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
54
|
+
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
55
|
+
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
56
|
+
wide: [
|
|
57
|
+
"Sunday",
|
|
58
|
+
"Monday",
|
|
59
|
+
"Tuesday",
|
|
60
|
+
"Wednesday",
|
|
61
|
+
"Thursday",
|
|
62
|
+
"Friday",
|
|
63
|
+
"Saturday",
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const dayPeriodValues = {
|
|
68
|
+
narrow: {
|
|
69
|
+
am: "a",
|
|
70
|
+
pm: "p",
|
|
71
|
+
midnight: "mi",
|
|
72
|
+
noon: "n",
|
|
73
|
+
morning: "morning",
|
|
74
|
+
afternoon: "afternoon",
|
|
75
|
+
evening: "evening",
|
|
76
|
+
night: "night",
|
|
77
|
+
},
|
|
78
|
+
abbreviated: {
|
|
79
|
+
am: "AM",
|
|
80
|
+
pm: "PM",
|
|
81
|
+
midnight: "midnight",
|
|
82
|
+
noon: "noon",
|
|
83
|
+
morning: "morning",
|
|
84
|
+
afternoon: "afternoon",
|
|
85
|
+
evening: "evening",
|
|
86
|
+
night: "night",
|
|
87
|
+
},
|
|
88
|
+
wide: {
|
|
89
|
+
am: "a.m.",
|
|
90
|
+
pm: "p.m.",
|
|
91
|
+
midnight: "midnight",
|
|
92
|
+
noon: "noon",
|
|
93
|
+
morning: "morning",
|
|
94
|
+
afternoon: "afternoon",
|
|
95
|
+
evening: "evening",
|
|
96
|
+
night: "night",
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const formattingDayPeriodValues = {
|
|
101
|
+
narrow: {
|
|
102
|
+
am: "a",
|
|
103
|
+
pm: "p",
|
|
104
|
+
midnight: "mi",
|
|
105
|
+
noon: "n",
|
|
106
|
+
morning: "in the morning",
|
|
107
|
+
afternoon: "in the afternoon",
|
|
108
|
+
evening: "in the evening",
|
|
109
|
+
night: "at night",
|
|
110
|
+
},
|
|
111
|
+
abbreviated: {
|
|
112
|
+
am: "AM",
|
|
113
|
+
pm: "PM",
|
|
114
|
+
midnight: "midnight",
|
|
115
|
+
noon: "noon",
|
|
116
|
+
morning: "in the morning",
|
|
117
|
+
afternoon: "in the afternoon",
|
|
118
|
+
evening: "in the evening",
|
|
119
|
+
night: "at night",
|
|
120
|
+
},
|
|
121
|
+
wide: {
|
|
122
|
+
am: "a.m.",
|
|
123
|
+
pm: "p.m.",
|
|
124
|
+
midnight: "midnight",
|
|
125
|
+
noon: "noon",
|
|
126
|
+
morning: "in the morning",
|
|
127
|
+
afternoon: "in the afternoon",
|
|
128
|
+
evening: "in the evening",
|
|
129
|
+
night: "at night",
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const ordinalNumber = (dirtyNumber, _options) => {
|
|
134
|
+
const number = Number(dirtyNumber);
|
|
135
|
+
|
|
136
|
+
// If ordinal numbers depend on context, for example,
|
|
137
|
+
// if they are different for different grammatical genders,
|
|
138
|
+
// use `options.unit`.
|
|
139
|
+
//
|
|
140
|
+
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
141
|
+
// 'day', 'hour', 'minute', 'second'.
|
|
142
|
+
|
|
143
|
+
const rem100 = number % 100;
|
|
144
|
+
if (rem100 > 20 || rem100 < 10) {
|
|
145
|
+
switch (rem100 % 10) {
|
|
146
|
+
case 1:
|
|
147
|
+
return number + "st";
|
|
148
|
+
case 2:
|
|
149
|
+
return number + "nd";
|
|
150
|
+
case 3:
|
|
151
|
+
return number + "rd";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return number + "th";
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const localize = {
|
|
158
|
+
ordinalNumber,
|
|
159
|
+
|
|
160
|
+
era: buildLocalizeFn({
|
|
161
|
+
values: eraValues,
|
|
162
|
+
defaultWidth: "wide",
|
|
163
|
+
}),
|
|
164
|
+
|
|
165
|
+
quarter: buildLocalizeFn({
|
|
166
|
+
values: quarterValues,
|
|
167
|
+
defaultWidth: "wide",
|
|
168
|
+
argumentCallback: (quarter) => quarter - 1,
|
|
169
|
+
}),
|
|
170
|
+
|
|
171
|
+
month: buildLocalizeFn({
|
|
172
|
+
values: monthValues,
|
|
173
|
+
defaultWidth: "wide",
|
|
174
|
+
}),
|
|
175
|
+
|
|
176
|
+
day: buildLocalizeFn({
|
|
177
|
+
values: dayValues,
|
|
178
|
+
defaultWidth: "wide",
|
|
179
|
+
}),
|
|
180
|
+
|
|
181
|
+
dayPeriod: buildLocalizeFn({
|
|
182
|
+
values: dayPeriodValues,
|
|
183
|
+
defaultWidth: "wide",
|
|
184
|
+
formattingValues: formattingDayPeriodValues,
|
|
185
|
+
defaultFormattingWidth: "wide",
|
|
186
|
+
}),
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { localize };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { buildMatchFn } from '../../_lib/buildMatchFn.js';
|
|
2
|
+
import { buildMatchPatternFn } from '../../_lib/buildMatchPatternFn.js';
|
|
3
|
+
|
|
4
|
+
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
5
|
+
const parseOrdinalNumberPattern = /\d+/i;
|
|
6
|
+
|
|
7
|
+
const matchEraPatterns = {
|
|
8
|
+
narrow: /^(b|a)/i,
|
|
9
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
10
|
+
wide: /^(before christ|before common era|anno domini|common era)/i,
|
|
11
|
+
};
|
|
12
|
+
const parseEraPatterns = {
|
|
13
|
+
any: [/^b/i, /^(a|c)/i],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const matchQuarterPatterns = {
|
|
17
|
+
narrow: /^[1234]/i,
|
|
18
|
+
abbreviated: /^q[1234]/i,
|
|
19
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i,
|
|
20
|
+
};
|
|
21
|
+
const parseQuarterPatterns = {
|
|
22
|
+
any: [/1/i, /2/i, /3/i, /4/i],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const matchMonthPatterns = {
|
|
26
|
+
narrow: /^[jfmasond]/i,
|
|
27
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
28
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
|
|
29
|
+
};
|
|
30
|
+
const parseMonthPatterns = {
|
|
31
|
+
narrow: [
|
|
32
|
+
/^j/i,
|
|
33
|
+
/^f/i,
|
|
34
|
+
/^m/i,
|
|
35
|
+
/^a/i,
|
|
36
|
+
/^m/i,
|
|
37
|
+
/^j/i,
|
|
38
|
+
/^j/i,
|
|
39
|
+
/^a/i,
|
|
40
|
+
/^s/i,
|
|
41
|
+
/^o/i,
|
|
42
|
+
/^n/i,
|
|
43
|
+
/^d/i,
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
any: [
|
|
47
|
+
/^ja/i,
|
|
48
|
+
/^f/i,
|
|
49
|
+
/^mar/i,
|
|
50
|
+
/^ap/i,
|
|
51
|
+
/^may/i,
|
|
52
|
+
/^jun/i,
|
|
53
|
+
/^jul/i,
|
|
54
|
+
/^au/i,
|
|
55
|
+
/^s/i,
|
|
56
|
+
/^o/i,
|
|
57
|
+
/^n/i,
|
|
58
|
+
/^d/i,
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const matchDayPatterns = {
|
|
63
|
+
narrow: /^[smtwf]/i,
|
|
64
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
65
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
66
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
|
|
67
|
+
};
|
|
68
|
+
const parseDayPatterns = {
|
|
69
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
70
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const matchDayPeriodPatterns = {
|
|
74
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
75
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
|
|
76
|
+
};
|
|
77
|
+
const parseDayPeriodPatterns = {
|
|
78
|
+
any: {
|
|
79
|
+
am: /^a/i,
|
|
80
|
+
pm: /^p/i,
|
|
81
|
+
midnight: /^mi/i,
|
|
82
|
+
noon: /^no/i,
|
|
83
|
+
morning: /morning/i,
|
|
84
|
+
afternoon: /afternoon/i,
|
|
85
|
+
evening: /evening/i,
|
|
86
|
+
night: /night/i,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const match = {
|
|
91
|
+
ordinalNumber: buildMatchPatternFn({
|
|
92
|
+
matchPattern: matchOrdinalNumberPattern,
|
|
93
|
+
parsePattern: parseOrdinalNumberPattern,
|
|
94
|
+
valueCallback: (value) => parseInt(value, 10),
|
|
95
|
+
}),
|
|
96
|
+
|
|
97
|
+
era: buildMatchFn({
|
|
98
|
+
matchPatterns: matchEraPatterns,
|
|
99
|
+
defaultMatchWidth: "wide",
|
|
100
|
+
parsePatterns: parseEraPatterns,
|
|
101
|
+
defaultParseWidth: "any",
|
|
102
|
+
}),
|
|
103
|
+
|
|
104
|
+
quarter: buildMatchFn({
|
|
105
|
+
matchPatterns: matchQuarterPatterns,
|
|
106
|
+
defaultMatchWidth: "wide",
|
|
107
|
+
parsePatterns: parseQuarterPatterns,
|
|
108
|
+
defaultParseWidth: "any",
|
|
109
|
+
valueCallback: (index) => index + 1,
|
|
110
|
+
}),
|
|
111
|
+
|
|
112
|
+
month: buildMatchFn({
|
|
113
|
+
matchPatterns: matchMonthPatterns,
|
|
114
|
+
defaultMatchWidth: "wide",
|
|
115
|
+
parsePatterns: parseMonthPatterns,
|
|
116
|
+
defaultParseWidth: "any",
|
|
117
|
+
}),
|
|
118
|
+
|
|
119
|
+
day: buildMatchFn({
|
|
120
|
+
matchPatterns: matchDayPatterns,
|
|
121
|
+
defaultMatchWidth: "wide",
|
|
122
|
+
parsePatterns: parseDayPatterns,
|
|
123
|
+
defaultParseWidth: "any",
|
|
124
|
+
}),
|
|
125
|
+
|
|
126
|
+
dayPeriod: buildMatchFn({
|
|
127
|
+
matchPatterns: matchDayPeriodPatterns,
|
|
128
|
+
defaultMatchWidth: "any",
|
|
129
|
+
parsePatterns: parseDayPeriodPatterns,
|
|
130
|
+
defaultParseWidth: "any",
|
|
131
|
+
}),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export { match };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { formatDistance } from './en-US/_lib/formatDistance.js';
|
|
2
|
+
import { formatLong } from './en-US/_lib/formatLong.js';
|
|
3
|
+
import { formatRelative } from './en-US/_lib/formatRelative.js';
|
|
4
|
+
import { localize } from './en-US/_lib/localize.js';
|
|
5
|
+
import { match } from './en-US/_lib/match.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @category Locales
|
|
9
|
+
* @summary English locale (United States).
|
|
10
|
+
* @language English
|
|
11
|
+
* @iso-639-2 eng
|
|
12
|
+
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
|
|
13
|
+
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
|
|
14
|
+
*/
|
|
15
|
+
const enUS = {
|
|
16
|
+
code: "en-US",
|
|
17
|
+
formatDistance: formatDistance,
|
|
18
|
+
formatLong: formatLong,
|
|
19
|
+
formatRelative: formatRelative,
|
|
20
|
+
localize: localize,
|
|
21
|
+
match: match,
|
|
22
|
+
options: {
|
|
23
|
+
weekStartsOn: 0 /* Sunday */,
|
|
24
|
+
firstWeekContainsDate: 1,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { enUS as default, enUS };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { constructFrom } from './constructFrom.js';
|
|
2
|
+
import { toDate } from './toDate.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The {@link max} function options.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @name max
|
|
10
|
+
* @category Common Helpers
|
|
11
|
+
* @summary Return the latest of the given dates.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Return the latest of the given dates.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
17
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
18
|
+
*
|
|
19
|
+
* @param dates - The dates to compare
|
|
20
|
+
*
|
|
21
|
+
* @returns The latest of the dates
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Which of these dates is the latest?
|
|
25
|
+
* const result = max([
|
|
26
|
+
* new Date(1989, 6, 10),
|
|
27
|
+
* new Date(1987, 1, 11),
|
|
28
|
+
* new Date(1995, 6, 2),
|
|
29
|
+
* new Date(1990, 0, 1)
|
|
30
|
+
* ])
|
|
31
|
+
* //=> Sun Jul 02 1995 00:00:00
|
|
32
|
+
*/
|
|
33
|
+
function max(dates, options) {
|
|
34
|
+
let result;
|
|
35
|
+
let context = options?.in;
|
|
36
|
+
|
|
37
|
+
dates.forEach((date) => {
|
|
38
|
+
// Use the first date object as the context function
|
|
39
|
+
if (!context && typeof date === "object")
|
|
40
|
+
context = constructFrom.bind(null, date);
|
|
41
|
+
|
|
42
|
+
const date_ = toDate(date, context);
|
|
43
|
+
if (!result || result < date_ || isNaN(+date_)) result = date_;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return constructFrom(context, result || NaN);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { max as default, max };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { constructFrom } from './constructFrom.js';
|
|
2
|
+
import { toDate } from './toDate.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The {@link min} function options.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @name min
|
|
10
|
+
* @category Common Helpers
|
|
11
|
+
* @summary Returns the earliest of the given dates.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Returns the earliest of the given dates.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
17
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
18
|
+
*
|
|
19
|
+
* @param dates - The dates to compare
|
|
20
|
+
*
|
|
21
|
+
* @returns The earliest of the dates
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Which of these dates is the earliest?
|
|
25
|
+
* const result = min([
|
|
26
|
+
* new Date(1989, 6, 10),
|
|
27
|
+
* new Date(1987, 1, 11),
|
|
28
|
+
* new Date(1995, 6, 2),
|
|
29
|
+
* new Date(1990, 0, 1)
|
|
30
|
+
* ])
|
|
31
|
+
* //=> Wed Feb 11 1987 00:00:00
|
|
32
|
+
*/
|
|
33
|
+
function min(dates, options) {
|
|
34
|
+
let result;
|
|
35
|
+
let context = options?.in;
|
|
36
|
+
|
|
37
|
+
dates.forEach((date) => {
|
|
38
|
+
// Use the first date object as the context function
|
|
39
|
+
if (!context && typeof date === "object")
|
|
40
|
+
context = constructFrom.bind(null, date);
|
|
41
|
+
|
|
42
|
+
const date_ = toDate(date, context);
|
|
43
|
+
if (!result || result > date_ || isNaN(+date_)) result = date_;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return constructFrom(context, result || NaN);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { min as default, min };
|