@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,37 @@
|
|
|
1
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { areOptionsEqual, arePluginsEqual, canUseDOM } from '../../embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js';
|
|
3
|
+
import EmblaCarousel from '../../embla-carousel/esm/embla-carousel.esm.js';
|
|
4
|
+
|
|
5
|
+
function useEmblaCarousel(options = {}, plugins = []) {
|
|
6
|
+
const storedOptions = useRef(options);
|
|
7
|
+
const storedPlugins = useRef(plugins);
|
|
8
|
+
const [emblaApi, setEmblaApi] = useState();
|
|
9
|
+
const [viewport, setViewport] = useState();
|
|
10
|
+
const reInit = useCallback(() => {
|
|
11
|
+
if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current);
|
|
12
|
+
}, [emblaApi]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (areOptionsEqual(storedOptions.current, options)) return;
|
|
15
|
+
storedOptions.current = options;
|
|
16
|
+
reInit();
|
|
17
|
+
}, [options, reInit]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (arePluginsEqual(storedPlugins.current, plugins)) return;
|
|
20
|
+
storedPlugins.current = plugins;
|
|
21
|
+
reInit();
|
|
22
|
+
}, [plugins, reInit]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (canUseDOM() && viewport) {
|
|
25
|
+
EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions;
|
|
26
|
+
const newEmblaApi = EmblaCarousel(viewport, storedOptions.current, storedPlugins.current);
|
|
27
|
+
setEmblaApi(newEmblaApi);
|
|
28
|
+
return () => newEmblaApi.destroy();
|
|
29
|
+
} else {
|
|
30
|
+
setEmblaApi(undefined);
|
|
31
|
+
}
|
|
32
|
+
}, [viewport, setEmblaApi]);
|
|
33
|
+
return [setViewport, emblaApi];
|
|
34
|
+
}
|
|
35
|
+
useEmblaCarousel.globalOptions = undefined;
|
|
36
|
+
|
|
37
|
+
export { useEmblaCarousel as default };
|
package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function isObject(subject) {
|
|
2
|
+
return Object.prototype.toString.call(subject) === '[object Object]';
|
|
3
|
+
}
|
|
4
|
+
function isRecord(subject) {
|
|
5
|
+
return isObject(subject) || Array.isArray(subject);
|
|
6
|
+
}
|
|
7
|
+
function canUseDOM() {
|
|
8
|
+
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
9
|
+
}
|
|
10
|
+
function areOptionsEqual(optionsA, optionsB) {
|
|
11
|
+
const optionsAKeys = Object.keys(optionsA);
|
|
12
|
+
const optionsBKeys = Object.keys(optionsB);
|
|
13
|
+
if (optionsAKeys.length !== optionsBKeys.length) return false;
|
|
14
|
+
const breakpointsA = JSON.stringify(Object.keys(optionsA.breakpoints || {}));
|
|
15
|
+
const breakpointsB = JSON.stringify(Object.keys(optionsB.breakpoints || {}));
|
|
16
|
+
if (breakpointsA !== breakpointsB) return false;
|
|
17
|
+
return optionsAKeys.every(key => {
|
|
18
|
+
const valueA = optionsA[key];
|
|
19
|
+
const valueB = optionsB[key];
|
|
20
|
+
if (typeof valueA === 'function') return `${valueA}` === `${valueB}`;
|
|
21
|
+
if (!isRecord(valueA) || !isRecord(valueB)) return valueA === valueB;
|
|
22
|
+
return areOptionsEqual(valueA, valueB);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function sortAndMapPluginToOptions(plugins) {
|
|
26
|
+
return plugins.concat().sort((a, b) => a.name > b.name ? 1 : -1).map(plugin => plugin.options);
|
|
27
|
+
}
|
|
28
|
+
function arePluginsEqual(pluginsA, pluginsB) {
|
|
29
|
+
if (pluginsA.length !== pluginsB.length) return false;
|
|
30
|
+
const optionsA = sortAndMapPluginToOptions(pluginsA);
|
|
31
|
+
const optionsB = sortAndMapPluginToOptions(pluginsB);
|
|
32
|
+
return optionsA.every((optionA, index) => {
|
|
33
|
+
const optionB = optionsB[index];
|
|
34
|
+
return areOptionsEqual(optionA, optionB);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { areOptionsEqual, arePluginsEqual, canUseDOM, sortAndMapPluginToOptions };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
var Bt=Object.defineProperty,At=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var vt=(r,s,e)=>s in r?Bt(r,s,{enumerable:true,configurable:true,writable:true,value:e}):r[s]=e,St=(r,s)=>{for(var e in s||(s={}))gt.call(s,e)&&vt(r,e,s[e]);if(Y)for(var e of Y(s))Et.call(s,e)&&vt(r,e,s[e]);return r},bt=(r,s)=>At(r,kt(s));var Pt=(r,s)=>{var e={};for(var u in r)gt.call(r,u)&&s.indexOf(u)<0&&(e[u]=r[u]);if(r!=null&&Y)for(var u of Y(r))s.indexOf(u)<0&&Et.call(r,u)&&(e[u]=r[u]);return e};function ht(r){let s=setTimeout(r,0),e=setTimeout(r,10),u=setTimeout(r,50);return [s,e,u]}function _t(r){let s=React.useRef();return React.useEffect(()=>{s.current=r;}),s.current}var Ot=18,wt=40,Gt=`${wt}px`,xt=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function Tt({containerRef:r,inputRef:s,pushPasswordManagerStrategy:e,isFocused:u}){let[P,D]=React.useState(false),[G,H]=React.useState(false),[F,W]=React.useState(false),Z=React.useMemo(()=>e==="none"?false:(e==="increase-width"||e==="experimental-no-flickering")&&P&&G,[P,G,e]),T=React.useCallback(()=>{let f=r.current,h=s.current;if(!f||!h||F||e==="none")return;let a=f,B=a.getBoundingClientRect().left+a.offsetWidth,A=a.getBoundingClientRect().top+a.offsetHeight/2,z=B-Ot,q=A;document.querySelectorAll(xt).length===0&&document.elementFromPoint(z,q)===f||(D(true),W(true));},[r,s,F,e]);return React.useEffect(()=>{let f=r.current;if(!f||e==="none")return;function h(){let A=window.innerWidth-f.getBoundingClientRect().right;H(A>=wt);}h();let a=setInterval(h,1e3);return ()=>{clearInterval(a);}},[r,e]),React.useEffect(()=>{let f=u||document.activeElement===s.current;if(e==="none"||!f)return;let h=setTimeout(T,0),a=setTimeout(T,2e3),B=setTimeout(T,5e3),A=setTimeout(()=>{W(true);},6e3);return ()=>{clearTimeout(h),clearTimeout(a),clearTimeout(B),clearTimeout(A);}},[s,u,e,T]),{hasPWMBadge:P,willPushPWMBadge:Z,PWM_BADGE_SPACE_WIDTH:Gt}}var jt=React.createContext({}),Lt=React.forwardRef((A,B)=>{var z=A,{value:r,onChange:s,maxLength:e,textAlign:u="left",pattern:P,placeholder:D,inputMode:G="numeric",onComplete:H,pushPasswordManagerStrategy:F="increase-width",pasteTransformer:W,containerClassName:Z,noScriptCSSFallback:T=Nt,render:f,children:h}=z,a=Pt(z,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]);var X,lt,ut,dt,ft;let[q,nt]=React.useState(typeof a.defaultValue=="string"?a.defaultValue:""),i=r!=null?r:q,I=_t(i),x=React.useCallback(t=>{s==null||s(t),nt(t);},[s]),m=React.useMemo(()=>P?typeof P=="string"?new RegExp(P):P:null,[P]),l=React.useRef(null),K=React.useRef(null),J=React.useRef({value:i,onChange:x,isIOS:typeof window!="undefined"&&((lt=(X=window==null?void 0:window.CSS)==null?void 0:X.supports)==null?void 0:lt.call(X,"-webkit-touch-callout","none"))}),V=React.useRef({prev:[(ut=l.current)==null?void 0:ut.selectionStart,(dt=l.current)==null?void 0:dt.selectionEnd,(ft=l.current)==null?void 0:ft.selectionDirection]});React.useImperativeHandle(B,()=>l.current,[]),React.useEffect(()=>{let t=l.current,o=K.current;if(!t||!o)return;J.current.value!==t.value&&J.current.onChange(t.value),V.current.prev=[t.selectionStart,t.selectionEnd,t.selectionDirection];function d(){if(document.activeElement!==t){L(null),N(null);return}let c=t.selectionStart,b=t.selectionEnd,mt=t.selectionDirection,v=t.maxLength,C=t.value,_=V.current.prev,g=-1,E=-1,w;if(C.length!==0&&c!==null&&b!==null){let Dt=c===b,Ht=c===C.length&&C.length<v;if(Dt&&!Ht){let y=c;if(y===0)g=0,E=1,w="forward";else if(y===v)g=y-1,E=y,w="backward";else if(v>1&&C.length>1){let et=0;if(_[0]!==null&&_[1]!==null){w=y<_[1]?"backward":"forward";let Wt=_[0]===_[1]&&_[0]<v;w==="backward"&&!Wt&&(et=-1);}g=et+y,E=et+y+1;}}g!==-1&&E!==-1&&g!==E&&l.current.setSelectionRange(g,E,w);}let pt=g!==-1?g:c,Rt=E!==-1?E:b,yt=w!=null?w:mt;L(pt),N(Rt),V.current.prev=[pt,Rt,yt];}if(document.addEventListener("selectionchange",d,{capture:true}),d(),document.activeElement===t&&Q(true),!document.getElementById("input-otp-style")){let c=document.createElement("style");if(c.id="input-otp-style",document.head.appendChild(c),c.sheet){let b="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";$(c.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),$(c.sheet,`[data-input-otp]:autofill { ${b} }`),$(c.sheet,`[data-input-otp]:-webkit-autofill { ${b} }`),$(c.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),$(c.sheet,"[data-input-otp] + * { pointer-events: all !important; }");}}let R=()=>{o&&o.style.setProperty("--root-height",`${t.clientHeight}px`);};R();let p=new ResizeObserver(R);return p.observe(t),()=>{document.removeEventListener("selectionchange",d,{capture:true}),p.disconnect();}},[]);let[ot,rt]=React.useState(false),[j,Q]=React.useState(false),[M,L]=React.useState(null),[k,N]=React.useState(null);React.useEffect(()=>{ht(()=>{var R,p,c,b;(R=l.current)==null||R.dispatchEvent(new Event("input"));let t=(p=l.current)==null?void 0:p.selectionStart,o=(c=l.current)==null?void 0:c.selectionEnd,d=(b=l.current)==null?void 0:b.selectionDirection;t!==null&&o!==null&&(L(t),N(o),V.current.prev=[t,o,d]);});},[i,j]),React.useEffect(()=>{I!==void 0&&i!==I&&I.length<e&&i.length===e&&(H==null||H(i));},[e,H,I,i]);let O=Tt({containerRef:K,inputRef:l,pushPasswordManagerStrategy:F,isFocused:j}),st=React.useCallback(t=>{let o=t.currentTarget.value.slice(0,e);if(o.length>0&&m&&!m.test(o)){t.preventDefault();return}typeof I=="string"&&o.length<I.length&&document.dispatchEvent(new Event("selectionchange")),x(o);},[e,x,I,m]),at=React.useCallback(()=>{var t;if(l.current){let o=Math.min(l.current.value.length,e-1),d=l.current.value.length;(t=l.current)==null||t.setSelectionRange(o,d),L(o),N(d);}Q(true);},[e]),ct=React.useCallback(t=>{var g,E;let o=l.current;if(!W&&(!J.current.isIOS||!t.clipboardData||!o))return;let d=t.clipboardData.getData("text/plain"),R=W?W(d):d;t.preventDefault();let p=(g=l.current)==null?void 0:g.selectionStart,c=(E=l.current)==null?void 0:E.selectionEnd,v=(p!==c?i.slice(0,p)+R+i.slice(c):i.slice(0,p)+R+i.slice(p)).slice(0,e);if(v.length>0&&m&&!m.test(v))return;o.value=v,x(v);let C=Math.min(v.length,e-1),_=v.length;o.setSelectionRange(C,_),L(C),N(_);},[e,x,m,i]),It=React.useMemo(()=>({position:"relative",cursor:a.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[a.disabled]),it=React.useMemo(()=>({position:"absolute",inset:0,width:O.willPushPWMBadge?`calc(100% + ${O.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:O.willPushPWMBadge?`inset(0 ${O.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:u,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[O.PWM_BADGE_SPACE_WIDTH,O.willPushPWMBadge,u]),Mt=React.useMemo(()=>React.createElement("input",bt(St({autoComplete:a.autoComplete||"one-time-code"},a),{"data-input-otp":true,"data-input-otp-placeholder-shown":i.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":k,inputMode:G,pattern:m==null?void 0:m.source,"aria-placeholder":D,style:it,maxLength:e,value:i,ref:l,onPaste:t=>{var o;ct(t),(o=a.onPaste)==null||o.call(a,t);},onChange:st,onMouseOver:t=>{var o;rt(true),(o=a.onMouseOver)==null||o.call(a,t);},onMouseLeave:t=>{var o;rt(false),(o=a.onMouseLeave)==null||o.call(a,t);},onFocus:t=>{var o;at(),(o=a.onFocus)==null||o.call(a,t);},onBlur:t=>{var o;Q(false),(o=a.onBlur)==null||o.call(a,t);}})),[st,at,ct,G,it,e,k,M,a,m==null?void 0:m.source,i]),tt=React.useMemo(()=>({slots:Array.from({length:e}).map((t,o)=>{var c;let d=j&&M!==null&&k!==null&&(M===k&&o===M||o>=M&&o<k),R=i[o]!==void 0?i[o]:null,p=i[0]!==void 0?null:(c=D==null?void 0:D[o])!=null?c:null;return {char:R,placeholderChar:p,isActive:d,hasFakeCaret:d&&R===null}}),isFocused:j,isHovering:!a.disabled&&ot}),[j,ot,e,k,M,a.disabled,i]),Ct=React.useMemo(()=>f?f(tt):React.createElement(jt.Provider,{value:tt},h),[h,tt,f]);return React.createElement(React.Fragment,null,T!==null&&React.createElement("noscript",null,React.createElement("style",null,T)),React.createElement("div",{ref:K,"data-input-otp-container":true,style:It,className:Z},Ct,React.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Mt)))});Lt.displayName="Input";function $(r,s){try{r.insertRule(s);}catch(e){console.error("input-otp could not insert CSS rule:",s);}}var Nt=`
|
|
4
|
+
[data-input-otp] {
|
|
5
|
+
--nojs-bg: white !important;
|
|
6
|
+
--nojs-fg: black !important;
|
|
7
|
+
|
|
8
|
+
background-color: var(--nojs-bg) !important;
|
|
9
|
+
color: var(--nojs-fg) !important;
|
|
10
|
+
caret-color: var(--nojs-fg) !important;
|
|
11
|
+
letter-spacing: .25em !important;
|
|
12
|
+
text-align: center !important;
|
|
13
|
+
border: 1px solid var(--nojs-fg) !important;
|
|
14
|
+
border-radius: 4px !important;
|
|
15
|
+
width: 100% !important;
|
|
16
|
+
}
|
|
17
|
+
@media (prefers-color-scheme: dark) {
|
|
18
|
+
[data-input-otp] {
|
|
19
|
+
--nojs-bg: black !important;
|
|
20
|
+
--nojs-fg: white !important;
|
|
21
|
+
}
|
|
22
|
+
}`;
|
|
23
|
+
|
|
24
|
+
export { Lt as OTPInput, jt as OTPInputContext };
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import React__default, { useMemo, useCallback, useRef } from 'react';
|
|
2
|
+
import { TZDate } from '../../../@date-fns/tz/date/index.js';
|
|
3
|
+
import '../../../@date-fns/tz/date/mini.js';
|
|
4
|
+
import { UI, DayFlag, SelectionState } from './UI.js';
|
|
5
|
+
import { DateLib } from './classes/DateLib.js';
|
|
6
|
+
import { createGetModifiers } from './helpers/createGetModifiers.js';
|
|
7
|
+
import { getClassNamesForModifiers } from './helpers/getClassNamesForModifiers.js';
|
|
8
|
+
import { getComponents } from './helpers/getComponents.js';
|
|
9
|
+
import { getDataAttributes } from './helpers/getDataAttributes.js';
|
|
10
|
+
import { getDefaultClassNames } from './helpers/getDefaultClassNames.js';
|
|
11
|
+
import { getFormatters } from './helpers/getFormatters.js';
|
|
12
|
+
import { getMonthOptions } from './helpers/getMonthOptions.js';
|
|
13
|
+
import { getStyleForModifiers } from './helpers/getStyleForModifiers.js';
|
|
14
|
+
import { getWeekdays } from './helpers/getWeekdays.js';
|
|
15
|
+
import { getYearOptions } from './helpers/getYearOptions.js';
|
|
16
|
+
import * as index from './labels/index.js';
|
|
17
|
+
import { useAnimation } from './useAnimation.js';
|
|
18
|
+
import { useCalendar } from './useCalendar.js';
|
|
19
|
+
import { dayPickerContext } from './useDayPicker.js';
|
|
20
|
+
import { useFocus } from './useFocus.js';
|
|
21
|
+
import { useSelection } from './useSelection.js';
|
|
22
|
+
import { rangeIncludesDate } from './utils/rangeIncludesDate.js';
|
|
23
|
+
import { isDateRange } from './utils/typeguards.js';
|
|
24
|
+
import { enUS } from '../../../date-fns/locale/en-US.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Renders the DayPicker calendar component.
|
|
28
|
+
*
|
|
29
|
+
* @param initialProps - The props for the DayPicker component.
|
|
30
|
+
* @returns The rendered DayPicker component.
|
|
31
|
+
* @group DayPicker
|
|
32
|
+
* @see https://daypicker.dev
|
|
33
|
+
*/
|
|
34
|
+
function DayPicker(initialProps) {
|
|
35
|
+
let props = initialProps;
|
|
36
|
+
if (props.timeZone) {
|
|
37
|
+
props = {
|
|
38
|
+
...initialProps
|
|
39
|
+
};
|
|
40
|
+
if (props.today) {
|
|
41
|
+
props.today = new TZDate(props.today, props.timeZone);
|
|
42
|
+
}
|
|
43
|
+
if (props.month) {
|
|
44
|
+
props.month = new TZDate(props.month, props.timeZone);
|
|
45
|
+
}
|
|
46
|
+
if (props.defaultMonth) {
|
|
47
|
+
props.defaultMonth = new TZDate(props.defaultMonth, props.timeZone);
|
|
48
|
+
}
|
|
49
|
+
if (props.startMonth) {
|
|
50
|
+
props.startMonth = new TZDate(props.startMonth, props.timeZone);
|
|
51
|
+
}
|
|
52
|
+
if (props.endMonth) {
|
|
53
|
+
props.endMonth = new TZDate(props.endMonth, props.timeZone);
|
|
54
|
+
}
|
|
55
|
+
if (props.mode === "single" && props.selected) {
|
|
56
|
+
props.selected = new TZDate(props.selected, props.timeZone);
|
|
57
|
+
}
|
|
58
|
+
else if (props.mode === "multiple" && props.selected) {
|
|
59
|
+
props.selected = props.selected?.map((date) => new TZDate(date, props.timeZone));
|
|
60
|
+
}
|
|
61
|
+
else if (props.mode === "range" && props.selected) {
|
|
62
|
+
props.selected = {
|
|
63
|
+
from: props.selected.from
|
|
64
|
+
? new TZDate(props.selected.from, props.timeZone)
|
|
65
|
+
: undefined,
|
|
66
|
+
to: props.selected.to
|
|
67
|
+
? new TZDate(props.selected.to, props.timeZone)
|
|
68
|
+
: undefined
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const { components, formatters, labels, dateLib, locale, classNames } = useMemo(() => {
|
|
73
|
+
const locale = { ...enUS, ...props.locale };
|
|
74
|
+
const dateLib = new DateLib({
|
|
75
|
+
locale,
|
|
76
|
+
weekStartsOn: props.broadcastCalendar ? 1 : props.weekStartsOn,
|
|
77
|
+
firstWeekContainsDate: props.firstWeekContainsDate,
|
|
78
|
+
useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
|
|
79
|
+
useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,
|
|
80
|
+
timeZone: props.timeZone,
|
|
81
|
+
numerals: props.numerals
|
|
82
|
+
}, props.dateLib);
|
|
83
|
+
return {
|
|
84
|
+
dateLib,
|
|
85
|
+
components: getComponents(props.components),
|
|
86
|
+
formatters: getFormatters(props.formatters),
|
|
87
|
+
labels: { ...index, ...props.labels },
|
|
88
|
+
locale,
|
|
89
|
+
classNames: { ...getDefaultClassNames(), ...props.classNames }
|
|
90
|
+
};
|
|
91
|
+
}, [
|
|
92
|
+
props.locale,
|
|
93
|
+
props.broadcastCalendar,
|
|
94
|
+
props.weekStartsOn,
|
|
95
|
+
props.firstWeekContainsDate,
|
|
96
|
+
props.useAdditionalWeekYearTokens,
|
|
97
|
+
props.useAdditionalDayOfYearTokens,
|
|
98
|
+
props.timeZone,
|
|
99
|
+
props.numerals,
|
|
100
|
+
props.dateLib,
|
|
101
|
+
props.components,
|
|
102
|
+
props.formatters,
|
|
103
|
+
props.labels,
|
|
104
|
+
props.classNames
|
|
105
|
+
]);
|
|
106
|
+
const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles } = props;
|
|
107
|
+
const { formatCaption, formatDay, formatMonthDropdown, formatWeekNumber, formatWeekNumberHeader, formatWeekdayName, formatYearDropdown } = formatters;
|
|
108
|
+
const calendar = useCalendar(props, dateLib);
|
|
109
|
+
const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth } = calendar;
|
|
110
|
+
const getModifiers = createGetModifiers(days, props, dateLib);
|
|
111
|
+
const { isSelected, select, selected: selectedValue } = useSelection(props, dateLib) ?? {};
|
|
112
|
+
const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus(props, calendar, getModifiers, isSelected ?? (() => false), dateLib);
|
|
113
|
+
const { labelDayButton, labelGridcell, labelGrid, labelMonthDropdown, labelNav, labelPrevious, labelNext, labelWeekday, labelWeekNumber, labelWeekNumberHeader, labelYearDropdown } = labels;
|
|
114
|
+
const weekdays = useMemo(() => getWeekdays(dateLib, props.ISOWeek), [dateLib, props.ISOWeek]);
|
|
115
|
+
const isInteractive = mode !== undefined || onDayClick !== undefined;
|
|
116
|
+
const handlePreviousClick = useCallback(() => {
|
|
117
|
+
if (!previousMonth)
|
|
118
|
+
return;
|
|
119
|
+
goToMonth(previousMonth);
|
|
120
|
+
onPrevClick?.(previousMonth);
|
|
121
|
+
}, [previousMonth, goToMonth, onPrevClick]);
|
|
122
|
+
const handleNextClick = useCallback(() => {
|
|
123
|
+
if (!nextMonth)
|
|
124
|
+
return;
|
|
125
|
+
goToMonth(nextMonth);
|
|
126
|
+
onNextClick?.(nextMonth);
|
|
127
|
+
}, [goToMonth, nextMonth, onNextClick]);
|
|
128
|
+
const handleDayClick = useCallback((day, m) => (e) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
setFocused(day);
|
|
132
|
+
select?.(day.date, m, e);
|
|
133
|
+
onDayClick?.(day.date, m, e);
|
|
134
|
+
}, [select, onDayClick, setFocused]);
|
|
135
|
+
const handleDayFocus = useCallback((day, m) => (e) => {
|
|
136
|
+
setFocused(day);
|
|
137
|
+
onDayFocus?.(day.date, m, e);
|
|
138
|
+
}, [onDayFocus, setFocused]);
|
|
139
|
+
const handleDayBlur = useCallback((day, m) => (e) => {
|
|
140
|
+
blur();
|
|
141
|
+
onDayBlur?.(day.date, m, e);
|
|
142
|
+
}, [blur, onDayBlur]);
|
|
143
|
+
const handleDayKeyDown = useCallback((day, modifiers) => (e) => {
|
|
144
|
+
const keyMap = {
|
|
145
|
+
ArrowLeft: ["day", props.dir === "rtl" ? "after" : "before"],
|
|
146
|
+
ArrowRight: ["day", props.dir === "rtl" ? "before" : "after"],
|
|
147
|
+
ArrowDown: ["week", "after"],
|
|
148
|
+
ArrowUp: ["week", "before"],
|
|
149
|
+
PageUp: [e.shiftKey ? "year" : "month", "before"],
|
|
150
|
+
PageDown: [e.shiftKey ? "year" : "month", "after"],
|
|
151
|
+
Home: ["startOfWeek", "before"],
|
|
152
|
+
End: ["endOfWeek", "after"]
|
|
153
|
+
};
|
|
154
|
+
if (keyMap[e.key]) {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
const [moveBy, moveDir] = keyMap[e.key];
|
|
158
|
+
moveFocus(moveBy, moveDir);
|
|
159
|
+
}
|
|
160
|
+
onDayKeyDown?.(day.date, modifiers, e);
|
|
161
|
+
}, [moveFocus, onDayKeyDown, props.dir]);
|
|
162
|
+
const handleDayMouseEnter = useCallback((day, modifiers) => (e) => {
|
|
163
|
+
onDayMouseEnter?.(day.date, modifiers, e);
|
|
164
|
+
}, [onDayMouseEnter]);
|
|
165
|
+
const handleDayMouseLeave = useCallback((day, modifiers) => (e) => {
|
|
166
|
+
onDayMouseLeave?.(day.date, modifiers, e);
|
|
167
|
+
}, [onDayMouseLeave]);
|
|
168
|
+
const handleMonthChange = useCallback((date) => (e) => {
|
|
169
|
+
const selectedMonth = Number(e.target.value);
|
|
170
|
+
const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
|
|
171
|
+
goToMonth(month);
|
|
172
|
+
}, [dateLib, goToMonth]);
|
|
173
|
+
const handleYearChange = useCallback((date) => (e) => {
|
|
174
|
+
const selectedYear = Number(e.target.value);
|
|
175
|
+
const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
|
|
176
|
+
goToMonth(month);
|
|
177
|
+
}, [dateLib, goToMonth]);
|
|
178
|
+
const { className, style } = useMemo(() => ({
|
|
179
|
+
className: [classNames[UI.Root], props.className]
|
|
180
|
+
.filter(Boolean)
|
|
181
|
+
.join(" "),
|
|
182
|
+
style: { ...styles?.[UI.Root], ...props.style }
|
|
183
|
+
}), [classNames, props.className, props.style, styles]);
|
|
184
|
+
const dataAttributes = getDataAttributes(props);
|
|
185
|
+
const rootElRef = useRef(null);
|
|
186
|
+
useAnimation(rootElRef, Boolean(props.animate), {
|
|
187
|
+
classNames,
|
|
188
|
+
months,
|
|
189
|
+
focused,
|
|
190
|
+
dateLib
|
|
191
|
+
});
|
|
192
|
+
const contextValue = {
|
|
193
|
+
dayPickerProps: props,
|
|
194
|
+
selected: selectedValue,
|
|
195
|
+
select: select,
|
|
196
|
+
isSelected,
|
|
197
|
+
months,
|
|
198
|
+
nextMonth,
|
|
199
|
+
previousMonth,
|
|
200
|
+
goToMonth,
|
|
201
|
+
getModifiers,
|
|
202
|
+
components,
|
|
203
|
+
classNames,
|
|
204
|
+
styles,
|
|
205
|
+
labels,
|
|
206
|
+
formatters
|
|
207
|
+
};
|
|
208
|
+
return (React__default.createElement(dayPickerContext.Provider, { value: contextValue },
|
|
209
|
+
React__default.createElement(components.Root, { rootRef: props.animate ? rootElRef : undefined, className: className, style: style, dir: props.dir, id: props.id, lang: props.lang, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], ...dataAttributes },
|
|
210
|
+
React__default.createElement(components.Months, { className: classNames[UI.Months], style: styles?.[UI.Months] },
|
|
211
|
+
!props.hideNavigation && !navLayout && (React__default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : undefined, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),
|
|
212
|
+
months.map((calendarMonth, displayIndex) => {
|
|
213
|
+
const dropdownMonths = getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib);
|
|
214
|
+
const dropdownYears = getYearOptions(navStart, navEnd, formatters, dateLib);
|
|
215
|
+
return (React__default.createElement(components.Month, { "data-animated-month": props.animate ? "true" : undefined, className: classNames[UI.Month], style: styles?.[UI.Month], key: displayIndex, displayIndex: displayIndex, calendarMonth: calendarMonth },
|
|
216
|
+
navLayout === "around" &&
|
|
217
|
+
!props.hideNavigation &&
|
|
218
|
+
displayIndex === 0 && (React__default.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : undefined },
|
|
219
|
+
React__default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
|
|
220
|
+
React__default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : undefined, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth: calendarMonth, displayIndex: displayIndex }, captionLayout?.startsWith("dropdown") ? (React__default.createElement(components.DropdownNav, { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] },
|
|
221
|
+
captionLayout === "dropdown" ||
|
|
222
|
+
captionLayout === "dropdown-months" ? (React__default.createElement(components.MonthsDropdown, { className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown(), classNames: classNames, components: components, disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date), options: dropdownMonths, style: styles?.[UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) })) : (React__default.createElement("span", null, formatMonthDropdown(calendarMonth.date, dateLib))),
|
|
223
|
+
captionLayout === "dropdown" ||
|
|
224
|
+
captionLayout === "dropdown-years" ? (React__default.createElement(components.YearsDropdown, { className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown(dateLib.options), classNames: classNames, components: components, disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date), options: dropdownYears, style: styles?.[UI.Dropdown], value: dateLib.getYear(calendarMonth.date) })) : (React__default.createElement("span", null, formatYearDropdown(calendarMonth.date, dateLib))),
|
|
225
|
+
React__default.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
226
|
+
border: 0,
|
|
227
|
+
clip: "rect(0 0 0 0)",
|
|
228
|
+
height: "1px",
|
|
229
|
+
margin: "-1px",
|
|
230
|
+
overflow: "hidden",
|
|
231
|
+
padding: 0,
|
|
232
|
+
position: "absolute",
|
|
233
|
+
width: "1px",
|
|
234
|
+
whiteSpace: "nowrap",
|
|
235
|
+
wordWrap: "normal"
|
|
236
|
+
} }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))) : (React__default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))),
|
|
237
|
+
navLayout === "around" &&
|
|
238
|
+
!props.hideNavigation &&
|
|
239
|
+
displayIndex === numberOfMonths - 1 && (React__default.createElement(components.NextMonthButton, { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : undefined },
|
|
240
|
+
React__default.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }))),
|
|
241
|
+
displayIndex === numberOfMonths - 1 &&
|
|
242
|
+
navLayout === "after" &&
|
|
243
|
+
!props.hideNavigation && (React__default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : undefined, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),
|
|
244
|
+
React__default.createElement(components.MonthGrid, { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid(calendarMonth.date, dateLib.options, dateLib) ||
|
|
245
|
+
undefined, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
|
|
246
|
+
!props.hideWeekdays && (React__default.createElement(components.Weekdays, { "data-animated-weekdays": props.animate ? "true" : undefined, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
|
|
247
|
+
showWeekNumber && (React__default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader())),
|
|
248
|
+
weekdays.map((weekday, i) => (React__default.createElement(components.Weekday, { "aria-label": labelWeekday(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: i, style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName(weekday, dateLib.options, dateLib)))))),
|
|
249
|
+
React__default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : undefined, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week, weekIndex) => {
|
|
250
|
+
return (React__default.createElement(components.Week, { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week: week },
|
|
251
|
+
showWeekNumber && (React__default.createElement(components.WeekNumber, { week: week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber(week.weekNumber, {
|
|
252
|
+
locale
|
|
253
|
+
}), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber(week.weekNumber, dateLib))),
|
|
254
|
+
week.days.map((day) => {
|
|
255
|
+
const { date } = day;
|
|
256
|
+
const modifiers = getModifiers(day);
|
|
257
|
+
modifiers[DayFlag.focused] =
|
|
258
|
+
!modifiers.hidden &&
|
|
259
|
+
Boolean(focused?.isEqualTo(day));
|
|
260
|
+
modifiers[SelectionState.selected] =
|
|
261
|
+
isSelected?.(date) || modifiers.selected;
|
|
262
|
+
if (isDateRange(selectedValue)) {
|
|
263
|
+
// add range modifiers
|
|
264
|
+
const { from, to } = selectedValue;
|
|
265
|
+
modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
|
|
266
|
+
modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
|
|
267
|
+
modifiers[SelectionState.range_middle] =
|
|
268
|
+
rangeIncludesDate(selectedValue, date, true, dateLib);
|
|
269
|
+
}
|
|
270
|
+
const style = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
|
271
|
+
const className = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
|
272
|
+
const ariaLabel = !isInteractive && !modifiers.hidden
|
|
273
|
+
? labelGridcell(date, modifiers, dateLib.options, dateLib)
|
|
274
|
+
: undefined;
|
|
275
|
+
return (React__default.createElement(components.Day, { key: `${dateLib.format(date, "yyyy-MM-dd")}_${dateLib.format(day.displayMonth, "yyyy-MM")}`, day: day, modifiers: modifiers, className: className.join(" "), style: style, role: "gridcell", "aria-selected": modifiers.selected || undefined, "aria-label": ariaLabel, "data-day": dateLib.format(date, "yyyy-MM-dd"), "data-month": day.outside
|
|
276
|
+
? dateLib.format(date, "yyyy-MM")
|
|
277
|
+
: undefined, "data-selected": modifiers.selected || undefined, "data-disabled": modifiers.disabled || undefined, "data-hidden": modifiers.hidden || undefined, "data-outside": day.outside || undefined, "data-focused": modifiers.focused || undefined, "data-today": modifiers.today || undefined }, !modifiers.hidden && isInteractive ? (React__default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day: day, modifiers: modifiers, disabled: modifiers.disabled || undefined, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay(date, dateLib.options, dateLib))) : (!modifiers.hidden &&
|
|
278
|
+
formatDay(day.date, dateLib.options, dateLib))));
|
|
279
|
+
})));
|
|
280
|
+
})))));
|
|
281
|
+
})),
|
|
282
|
+
props.footer && (React__default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)))));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export { DayPicker };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the UI elements composing DayPicker. These elements are
|
|
3
|
+
* mapped to {@link CustomComponents}, {@link ClassNames}, and {@link Styles}.
|
|
4
|
+
*
|
|
5
|
+
* Some elements are extended by flags and modifiers.
|
|
6
|
+
*/
|
|
7
|
+
var UI;
|
|
8
|
+
(function (UI) {
|
|
9
|
+
/** The root component displaying the months and the navigation bar. */
|
|
10
|
+
UI["Root"] = "root";
|
|
11
|
+
/** The Chevron SVG element used by navigation buttons and dropdowns. */
|
|
12
|
+
UI["Chevron"] = "chevron";
|
|
13
|
+
/**
|
|
14
|
+
* The grid cell with the day's date. Extended by {@link DayFlag} and
|
|
15
|
+
* {@link SelectionState}.
|
|
16
|
+
*/
|
|
17
|
+
UI["Day"] = "day";
|
|
18
|
+
/** The button containing the formatted day's date, inside the grid cell. */
|
|
19
|
+
UI["DayButton"] = "day_button";
|
|
20
|
+
/** The caption label of the month (when not showing the dropdown navigation). */
|
|
21
|
+
UI["CaptionLabel"] = "caption_label";
|
|
22
|
+
/** The container of the dropdown navigation (when enabled). */
|
|
23
|
+
UI["Dropdowns"] = "dropdowns";
|
|
24
|
+
/** The dropdown element to select for years and months. */
|
|
25
|
+
UI["Dropdown"] = "dropdown";
|
|
26
|
+
/** The container element of the dropdown. */
|
|
27
|
+
UI["DropdownRoot"] = "dropdown_root";
|
|
28
|
+
/** The root element of the footer. */
|
|
29
|
+
UI["Footer"] = "footer";
|
|
30
|
+
/** The month grid. */
|
|
31
|
+
UI["MonthGrid"] = "month_grid";
|
|
32
|
+
/** Contains the dropdown navigation or the caption label. */
|
|
33
|
+
UI["MonthCaption"] = "month_caption";
|
|
34
|
+
/** The dropdown with the months. */
|
|
35
|
+
UI["MonthsDropdown"] = "months_dropdown";
|
|
36
|
+
/** Wrapper of the month grid. */
|
|
37
|
+
UI["Month"] = "month";
|
|
38
|
+
/** The container of the displayed months. */
|
|
39
|
+
UI["Months"] = "months";
|
|
40
|
+
/** The navigation bar with the previous and next buttons. */
|
|
41
|
+
UI["Nav"] = "nav";
|
|
42
|
+
/**
|
|
43
|
+
* The next month button in the navigation. *
|
|
44
|
+
*
|
|
45
|
+
* @since 9.1.0
|
|
46
|
+
*/
|
|
47
|
+
UI["NextMonthButton"] = "button_next";
|
|
48
|
+
/**
|
|
49
|
+
* The previous month button in the navigation.
|
|
50
|
+
*
|
|
51
|
+
* @since 9.1.0
|
|
52
|
+
*/
|
|
53
|
+
UI["PreviousMonthButton"] = "button_previous";
|
|
54
|
+
/** The row containing the week. */
|
|
55
|
+
UI["Week"] = "week";
|
|
56
|
+
/** The group of row weeks in a month (`tbody`). */
|
|
57
|
+
UI["Weeks"] = "weeks";
|
|
58
|
+
/** The column header with the weekday. */
|
|
59
|
+
UI["Weekday"] = "weekday";
|
|
60
|
+
/** The row grouping the weekdays in the column headers. */
|
|
61
|
+
UI["Weekdays"] = "weekdays";
|
|
62
|
+
/** The cell containing the week number. */
|
|
63
|
+
UI["WeekNumber"] = "week_number";
|
|
64
|
+
/** The cell header of the week numbers column. */
|
|
65
|
+
UI["WeekNumberHeader"] = "week_number_header";
|
|
66
|
+
/** The dropdown with the years. */
|
|
67
|
+
UI["YearsDropdown"] = "years_dropdown";
|
|
68
|
+
})(UI || (UI = {}));
|
|
69
|
+
/** Enum representing flags for the {@link UI.Day} element. */
|
|
70
|
+
var DayFlag;
|
|
71
|
+
(function (DayFlag) {
|
|
72
|
+
/** The day is disabled. */
|
|
73
|
+
DayFlag["disabled"] = "disabled";
|
|
74
|
+
/** The day is hidden. */
|
|
75
|
+
DayFlag["hidden"] = "hidden";
|
|
76
|
+
/** The day is outside the current month. */
|
|
77
|
+
DayFlag["outside"] = "outside";
|
|
78
|
+
/** The day is focused. */
|
|
79
|
+
DayFlag["focused"] = "focused";
|
|
80
|
+
/** The day is today. */
|
|
81
|
+
DayFlag["today"] = "today";
|
|
82
|
+
})(DayFlag || (DayFlag = {}));
|
|
83
|
+
/**
|
|
84
|
+
* Enum representing selection states that can be applied to the {@link UI.Day}
|
|
85
|
+
* element in selection mode.
|
|
86
|
+
*/
|
|
87
|
+
var SelectionState;
|
|
88
|
+
(function (SelectionState) {
|
|
89
|
+
/** The day is at the end of a selected range. */
|
|
90
|
+
SelectionState["range_end"] = "range_end";
|
|
91
|
+
/** The day is at the middle of a selected range. */
|
|
92
|
+
SelectionState["range_middle"] = "range_middle";
|
|
93
|
+
/** The day is at the start of a selected range. */
|
|
94
|
+
SelectionState["range_start"] = "range_start";
|
|
95
|
+
/** The day is selected. */
|
|
96
|
+
SelectionState["selected"] = "selected";
|
|
97
|
+
})(SelectionState || (SelectionState = {}));
|
|
98
|
+
/**
|
|
99
|
+
* Enum representing different animation states for transitioning between
|
|
100
|
+
* months.
|
|
101
|
+
*/
|
|
102
|
+
var Animation;
|
|
103
|
+
(function (Animation) {
|
|
104
|
+
/** The entering weeks when they appear before the exiting month. */
|
|
105
|
+
Animation["weeks_before_enter"] = "weeks_before_enter";
|
|
106
|
+
/** The exiting weeks when they disappear before the entering month. */
|
|
107
|
+
Animation["weeks_before_exit"] = "weeks_before_exit";
|
|
108
|
+
/** The entering weeks when they appear after the exiting month. */
|
|
109
|
+
Animation["weeks_after_enter"] = "weeks_after_enter";
|
|
110
|
+
/** The exiting weeks when they disappear after the entering month. */
|
|
111
|
+
Animation["weeks_after_exit"] = "weeks_after_exit";
|
|
112
|
+
/** The entering caption when it appears after the exiting month. */
|
|
113
|
+
Animation["caption_after_enter"] = "caption_after_enter";
|
|
114
|
+
/** The exiting caption when it disappears after the entering month. */
|
|
115
|
+
Animation["caption_after_exit"] = "caption_after_exit";
|
|
116
|
+
/** The entering caption when it appears before the exiting month. */
|
|
117
|
+
Animation["caption_before_enter"] = "caption_before_enter";
|
|
118
|
+
/** The exiting caption when it disappears before the entering month. */
|
|
119
|
+
Animation["caption_before_exit"] = "caption_before_exit";
|
|
120
|
+
})(Animation || (Animation = {}));
|
|
121
|
+
|
|
122
|
+
export { Animation, DayFlag, SelectionState, UI };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defaultDateLib } from './DateLib.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a day displayed in the calendar.
|
|
5
|
+
*
|
|
6
|
+
* In DayPicker, a `CalendarDay` is a wrapper around a `Date` object that
|
|
7
|
+
* provides additional information about the day, such as whether it belongs to
|
|
8
|
+
* the displayed month.
|
|
9
|
+
*/
|
|
10
|
+
class CalendarDay {
|
|
11
|
+
constructor(date, displayMonth, dateLib = defaultDateLib) {
|
|
12
|
+
this.date = date;
|
|
13
|
+
this.displayMonth = displayMonth;
|
|
14
|
+
this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));
|
|
15
|
+
this.dateLib = dateLib;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks if this day is equal to another `CalendarDay`, considering both the
|
|
19
|
+
* date and the displayed month.
|
|
20
|
+
*
|
|
21
|
+
* @param day The `CalendarDay` to compare with.
|
|
22
|
+
* @returns `true` if the days are equal, otherwise `false`.
|
|
23
|
+
*/
|
|
24
|
+
isEqualTo(day) {
|
|
25
|
+
return (this.dateLib.isSameDay(day.date, this.date) &&
|
|
26
|
+
this.dateLib.isSameMonth(day.displayMonth, this.displayMonth));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { CalendarDay };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a month in a calendar year.
|
|
3
|
+
*
|
|
4
|
+
* A `CalendarMonth` contains the weeks within the month and the date of the
|
|
5
|
+
* month.
|
|
6
|
+
*/
|
|
7
|
+
class CalendarMonth {
|
|
8
|
+
constructor(month, weeks) {
|
|
9
|
+
this.date = month;
|
|
10
|
+
this.weeks = weeks;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { CalendarMonth };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a week in a calendar month.
|
|
3
|
+
*
|
|
4
|
+
* A `CalendarWeek` contains the days within the week and the week number.
|
|
5
|
+
*/
|
|
6
|
+
class CalendarWeek {
|
|
7
|
+
constructor(weekNumber, days) {
|
|
8
|
+
this.days = days;
|
|
9
|
+
this.weekNumber = weekNumber;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { CalendarWeek };
|