@zimyo/ui 1.0.1 → 1.1.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/package.json +79 -80
- package/dist/_virtual/_rollupPluginBabelHelpers.js +0 -11
- package/dist/components/index.d.ts +0 -59
- package/dist/components/ui/accordion.d.ts +0 -9
- package/dist/components/ui/accordion.js +0 -53
- package/dist/components/ui/alert-dialog.d.ts +0 -16
- package/dist/components/ui/alert-dialog.js +0 -107
- package/dist/components/ui/alert.d.ts +0 -12
- package/dist/components/ui/alert.js +0 -53
- package/dist/components/ui/aspect-ratio.d.ts +0 -6
- package/dist/components/ui/aspect-ratio.js +0 -12
- package/dist/components/ui/avatar.d.ts +0 -8
- package/dist/components/ui/avatar.js +0 -38
- package/dist/components/ui/badge.d.ts +0 -12
- package/dist/components/ui/badge.js +0 -37
- package/dist/components/ui/breadcrumb.d.ts +0 -13
- package/dist/components/ui/breadcrumb.js +0 -90
- package/dist/components/ui/button.d.ts +0 -13
- package/dist/components/ui/button.js +0 -49
- package/dist/components/ui/calendar.d.ts +0 -12
- package/dist/components/ui/calendar.js +0 -134
- package/dist/components/ui/card.d.ts +0 -11
- package/dist/components/ui/card.js +0 -77
- package/dist/components/ui/carousel.d.ts +0 -24
- package/dist/components/ui/carousel.js +0 -163
- package/dist/components/ui/chart.d.ts +0 -43
- package/dist/components/ui/chart.js +0 -187
- package/dist/components/ui/checkbox.d.ts +0 -6
- package/dist/components/ui/checkbox.js +0 -24
- package/dist/components/ui/collapsible.d.ts +0 -8
- package/dist/components/ui/collapsible.js +0 -24
- package/dist/components/ui/command.d.ts +0 -21
- package/dist/components/ui/command.js +0 -110
- package/dist/components/ui/context-menu.d.ts +0 -27
- package/dist/components/ui/context-menu.js +0 -158
- package/dist/components/ui/dialog.d.ts +0 -17
- package/dist/components/ui/dialog.js +0 -102
- package/dist/components/ui/drawer.d.ts +0 -15
- package/dist/components/ui/drawer.js +0 -97
- package/dist/components/ui/dropdown-menu.d.ts +0 -27
- package/dist/components/ui/dropdown-menu.js +0 -160
- package/dist/components/ui/form.d.ts +0 -26
- package/dist/components/ui/form.js +0 -125
- package/dist/components/ui/hover-card.d.ts +0 -8
- package/dist/components/ui/hover-card.js +0 -36
- package/dist/components/ui/input-otp.d.ts +0 -13
- package/dist/components/ui/input-otp.js +0 -61
- package/dist/components/ui/input.d.ts +0 -5
- package/dist/components/ui/input.js +0 -19
- package/dist/components/ui/label.d.ts +0 -6
- package/dist/components/ui/label.js +0 -18
- package/dist/components/ui/menubar.d.ts +0 -28
- package/dist/components/ui/menubar.js +0 -178
- package/dist/components/ui/navigation-menu.d.ts +0 -17
- package/dist/components/ui/navigation-menu.js +0 -102
- package/dist/components/ui/pagination.d.ts +0 -17
- package/dist/components/ui/pagination.js +0 -95
- package/dist/components/ui/popover.d.ts +0 -9
- package/dist/components/ui/popover.js +0 -40
- package/dist/components/ui/progress.d.ts +0 -6
- package/dist/components/ui/progress.js +0 -25
- package/dist/components/ui/radio-group.d.ts +0 -7
- package/dist/components/ui/radio-group.js +0 -34
- package/dist/components/ui/resizable.d.ts +0 -10
- package/dist/components/ui/resizable.js +0 -40
- package/dist/components/ui/scroll-area.d.ts +0 -7
- package/dist/components/ui/scroll-area.js +0 -37
- package/dist/components/ui/select.d.ts +0 -17
- package/dist/components/ui/select.js +0 -118
- package/dist/components/ui/separator.d.ts +0 -6
- package/dist/components/ui/separator.js +0 -22
- package/dist/components/ui/sheet.d.ts +0 -15
- package/dist/components/ui/sheet.js +0 -101
- package/dist/components/ui/sidebar.d.ts +0 -73
- package/dist/components/ui/sidebar.js +0 -484
- package/dist/components/ui/skeleton.d.ts +0 -5
- package/dist/components/ui/skeleton.js +0 -16
- package/dist/components/ui/slider.d.ts +0 -6
- package/dist/components/ui/slider.js +0 -39
- package/dist/components/ui/sonner.d.ts +0 -6
- package/dist/components/ui/sonner.js +0 -18
- package/dist/components/ui/switch.d.ts +0 -6
- package/dist/components/ui/switch.js +0 -21
- package/dist/components/ui/table.d.ts +0 -12
- package/dist/components/ui/table.js +0 -90
- package/dist/components/ui/tabs.d.ts +0 -9
- package/dist/components/ui/tabs.js +0 -48
- package/dist/components/ui/textarea.d.ts +0 -5
- package/dist/components/ui/textarea.js +0 -17
- package/dist/components/ui/toggle-group.d.ts +0 -10
- package/dist/components/ui/toggle-group.js +0 -52
- package/dist/components/ui/toggle.d.ts +0 -12
- package/dist/components/ui/toggle.js +0 -42
- package/dist/components/ui/tooltip.d.ts +0 -9
- package/dist/components/ui/tooltip.js +0 -45
- package/dist/index.d.ts +0 -61
- package/dist/index.js +0 -47
- package/dist/lib/utils.d.ts +0 -5
- package/dist/lib/utils.js +0 -8
- package/dist/node_modules/@date-fns/tz/date/index.js +0 -101
- package/dist/node_modules/@date-fns/tz/date/mini.js +0 -207
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +0 -43
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -89
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
- package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
- package/dist/node_modules/clsx/dist/clsx.js +0 -3
- package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.js +0 -3
- package/dist/node_modules/cmdk/dist/index.js +0 -10
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -7
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -775
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -94
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -66
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -31
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -25
- package/dist/node_modules/date-fns/addDays.js +0 -41
- package/dist/node_modules/date-fns/addMonths.js +0 -75
- package/dist/node_modules/date-fns/addWeeks.js +0 -33
- package/dist/node_modules/date-fns/addYears.js +0 -33
- package/dist/node_modules/date-fns/constants.js +0 -46
- package/dist/node_modules/date-fns/constructFrom.js +0 -49
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -62
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -42
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +0 -65
- package/dist/node_modules/date-fns/endOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/endOfMonth.js +0 -37
- package/dist/node_modules/date-fns/endOfWeek.js +0 -53
- package/dist/node_modules/date-fns/endOfYear.js +0 -37
- package/dist/node_modules/date-fns/format.js +0 -423
- package/dist/node_modules/date-fns/getDayOfYear.js +0 -34
- package/dist/node_modules/date-fns/getDaysInMonth.js +0 -36
- package/dist/node_modules/date-fns/getISOWeek.js +0 -40
- package/dist/node_modules/date-fns/getISOWeekYear.js +0 -52
- package/dist/node_modules/date-fns/getMonth.js +0 -29
- package/dist/node_modules/date-fns/getWeek.js +0 -54
- package/dist/node_modules/date-fns/getWeekYear.js +0 -75
- package/dist/node_modules/date-fns/getYear.js +0 -29
- package/dist/node_modules/date-fns/isAfter.js +0 -25
- package/dist/node_modules/date-fns/isBefore.js +0 -25
- package/dist/node_modules/date-fns/isDate.js +0 -41
- package/dist/node_modules/date-fns/isSameDay.js +0 -46
- package/dist/node_modules/date-fns/isSameMonth.js +0 -43
- package/dist/node_modules/date-fns/isSameYear.js +0 -35
- package/dist/node_modules/date-fns/isValid.js +0 -39
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -10
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -64
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -59
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -22
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -103
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -41
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -13
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -189
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -134
- package/dist/node_modules/date-fns/locale/en-US.js +0 -28
- package/dist/node_modules/date-fns/max.js +0 -49
- package/dist/node_modules/date-fns/min.js +0 -49
- package/dist/node_modules/date-fns/setMonth.js +0 -46
- package/dist/node_modules/date-fns/setYear.js +0 -40
- package/dist/node_modules/date-fns/startOfDay.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -42
- package/dist/node_modules/date-fns/startOfMonth.js +0 -37
- package/dist/node_modules/date-fns/startOfWeek.js +0 -53
- package/dist/node_modules/date-fns/startOfWeekYear.js +0 -64
- package/dist/node_modules/date-fns/startOfYear.js +0 -36
- package/dist/node_modules/date-fns/toDate.js +0 -46
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
- package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
- package/dist/node_modules/input-otp/dist/index.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +0 -285
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +0 -122
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +0 -522
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +0 -26
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +0 -23
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +0 -7
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +0 -73
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +0 -95
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +0 -20
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +0 -46
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +0 -69
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +0 -39
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +0 -36
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +0 -37
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +0 -38
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +0 -11
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +0 -32
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +0 -57
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +0 -45
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +0 -44
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +0 -175
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +0 -85
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +0 -50
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +0 -92
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +0 -62
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +0 -74
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +0 -35
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +0 -66
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -507
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -160
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
- package/dist/node_modules/react-resizable-panels/dist/react-resizable-panels.js +0 -2407
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
- package/dist/node_modules/sonner/dist/index.js +0 -1125
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2956
- package/dist/node_modules/tslib/tslib.es6.js +0 -56
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
- package/dist/node_modules/vaul/dist/index.js +0 -1627
- package/dist/styles.css +0 -1
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const FIVE_WEEKS = 5;
|
|
2
|
-
const FOUR_WEEKS = 4;
|
|
3
|
-
/**
|
|
4
|
-
* Returns the number of weeks to display in the broadcast calendar for a given
|
|
5
|
-
* month.
|
|
6
|
-
*
|
|
7
|
-
* The broadcast calendar may have either 4 or 5 weeks in a month, depending on
|
|
8
|
-
* the start and end dates of the broadcast weeks.
|
|
9
|
-
*
|
|
10
|
-
* @since 9.4.0
|
|
11
|
-
* @param month The month for which to calculate the number of weeks.
|
|
12
|
-
* @param dateLib The date library to use for date manipulation.
|
|
13
|
-
* @returns The number of weeks in the broadcast calendar (4 or 5).
|
|
14
|
-
*/
|
|
15
|
-
function getBroadcastWeeksInMonth(month, dateLib) {
|
|
16
|
-
// Get the first day of the month
|
|
17
|
-
const firstDayOfMonth = dateLib.startOfMonth(month);
|
|
18
|
-
// Get the day of the week for the first day of the month (1-7, where 1 is Monday)
|
|
19
|
-
const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
|
|
20
|
-
const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
|
|
21
|
-
const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
|
|
22
|
-
const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek)
|
|
23
|
-
? FIVE_WEEKS
|
|
24
|
-
: FOUR_WEEKS;
|
|
25
|
-
return numberOfWeeks;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { getBroadcastWeeksInMonth };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { DayFlag, SelectionState, UI } from '../UI.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the class names for a day based on its modifiers.
|
|
5
|
-
*
|
|
6
|
-
* This function combines the base class name for the day with any class names
|
|
7
|
-
* associated with active modifiers.
|
|
8
|
-
*
|
|
9
|
-
* @param modifiers The modifiers applied to the day.
|
|
10
|
-
* @param classNames The base class names for the calendar elements.
|
|
11
|
-
* @param modifiersClassNames The class names associated with specific
|
|
12
|
-
* modifiers.
|
|
13
|
-
* @returns An array of class names for the day.
|
|
14
|
-
*/
|
|
15
|
-
function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) {
|
|
16
|
-
const modifierClassNames = Object.entries(modifiers)
|
|
17
|
-
.filter(([, active]) => active === true)
|
|
18
|
-
.reduce((previousValue, [key]) => {
|
|
19
|
-
if (modifiersClassNames[key]) {
|
|
20
|
-
previousValue.push(modifiersClassNames[key]);
|
|
21
|
-
}
|
|
22
|
-
else if (classNames[DayFlag[key]]) {
|
|
23
|
-
previousValue.push(classNames[DayFlag[key]]);
|
|
24
|
-
}
|
|
25
|
-
else if (classNames[SelectionState[key]]) {
|
|
26
|
-
previousValue.push(classNames[SelectionState[key]]);
|
|
27
|
-
}
|
|
28
|
-
return previousValue;
|
|
29
|
-
}, [classNames[UI.Day]]);
|
|
30
|
-
return modifierClassNames;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { getClassNamesForModifiers };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as customComponents from '../components/custom-components.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Merges custom components from the props with the default components.
|
|
5
|
-
*
|
|
6
|
-
* This function ensures that any custom components provided in the props
|
|
7
|
-
* override the default components.
|
|
8
|
-
*
|
|
9
|
-
* @param customComponents The custom components provided in the DayPicker
|
|
10
|
-
* props.
|
|
11
|
-
* @returns An object containing the merged components.
|
|
12
|
-
*/
|
|
13
|
-
function getComponents(customComponents$1) {
|
|
14
|
-
return {
|
|
15
|
-
...customComponents,
|
|
16
|
-
...customComponents$1
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { getComponents };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts `data-` attributes from the DayPicker props.
|
|
3
|
-
*
|
|
4
|
-
* This function collects all `data-` attributes from the props and adds
|
|
5
|
-
* additional attributes based on the DayPicker configuration.
|
|
6
|
-
*
|
|
7
|
-
* @param props The DayPicker props.
|
|
8
|
-
* @returns An object containing the `data-` attributes.
|
|
9
|
-
*/
|
|
10
|
-
function getDataAttributes(props) {
|
|
11
|
-
const dataAttributes = {
|
|
12
|
-
"data-mode": props.mode ?? undefined,
|
|
13
|
-
"data-required": "required" in props ? props.required : undefined,
|
|
14
|
-
"data-multiple-months": (props.numberOfMonths && props.numberOfMonths > 1) || undefined,
|
|
15
|
-
"data-week-numbers": props.showWeekNumber || undefined,
|
|
16
|
-
"data-broadcast-calendar": props.broadcastCalendar || undefined,
|
|
17
|
-
"data-nav-layout": props.navLayout || undefined
|
|
18
|
-
};
|
|
19
|
-
Object.entries(props).forEach(([key, val]) => {
|
|
20
|
-
if (key.startsWith("data-")) {
|
|
21
|
-
dataAttributes[key] = val;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return dataAttributes;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { getDataAttributes };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns all the dates to display in the calendar.
|
|
3
|
-
*
|
|
4
|
-
* This function calculates the range of dates to display based on the provided
|
|
5
|
-
* display months, constraints, and calendar configuration.
|
|
6
|
-
*
|
|
7
|
-
* @param displayMonths The months to display in the calendar.
|
|
8
|
-
* @param maxDate The maximum date to include in the range.
|
|
9
|
-
* @param props The DayPicker props, including calendar configuration options.
|
|
10
|
-
* @param dateLib The date library to use for date manipulation.
|
|
11
|
-
* @returns An array of dates to display in the calendar.
|
|
12
|
-
*/
|
|
13
|
-
function getDates(displayMonths, maxDate, props, dateLib) {
|
|
14
|
-
const firstMonth = displayMonths[0];
|
|
15
|
-
const lastMonth = displayMonths[displayMonths.length - 1];
|
|
16
|
-
const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {};
|
|
17
|
-
const { addDays, differenceInCalendarDays, differenceInCalendarMonths, endOfBroadcastWeek, endOfISOWeek, endOfMonth, endOfWeek, isAfter, startOfBroadcastWeek, startOfISOWeek, startOfWeek } = dateLib;
|
|
18
|
-
const startWeekFirstDate = broadcastCalendar
|
|
19
|
-
? startOfBroadcastWeek(firstMonth, dateLib)
|
|
20
|
-
: ISOWeek
|
|
21
|
-
? startOfISOWeek(firstMonth)
|
|
22
|
-
: startOfWeek(firstMonth);
|
|
23
|
-
const endWeekLastDate = broadcastCalendar
|
|
24
|
-
? endOfBroadcastWeek(lastMonth)
|
|
25
|
-
: ISOWeek
|
|
26
|
-
? endOfISOWeek(endOfMonth(lastMonth))
|
|
27
|
-
: endOfWeek(endOfMonth(lastMonth));
|
|
28
|
-
const nOfDays = differenceInCalendarDays(endWeekLastDate, startWeekFirstDate);
|
|
29
|
-
const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;
|
|
30
|
-
const dates = [];
|
|
31
|
-
for (let i = 0; i <= nOfDays; i++) {
|
|
32
|
-
const date = addDays(startWeekFirstDate, i);
|
|
33
|
-
if (maxDate && isAfter(date, maxDate)) {
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
dates.push(date);
|
|
37
|
-
}
|
|
38
|
-
// If fixed weeks is enabled, add the extra dates to the array
|
|
39
|
-
const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;
|
|
40
|
-
const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
|
|
41
|
-
if (fixedWeeks && dates.length < extraDates) {
|
|
42
|
-
const daysToAdd = extraDates - dates.length;
|
|
43
|
-
for (let i = 0; i < daysToAdd; i++) {
|
|
44
|
-
const date = addDays(dates[dates.length - 1], 1);
|
|
45
|
-
dates.push(date);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return dates;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { getDates };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns all the days belonging to the calendar by merging the days in the
|
|
3
|
-
* weeks for each month.
|
|
4
|
-
*
|
|
5
|
-
* @param calendarMonths The array of calendar months.
|
|
6
|
-
* @returns An array of `CalendarDay` objects representing all the days in the
|
|
7
|
-
* calendar.
|
|
8
|
-
*/
|
|
9
|
-
function getDays(calendarMonths) {
|
|
10
|
-
const initialDays = [];
|
|
11
|
-
return calendarMonths.reduce((days, month) => {
|
|
12
|
-
const weekDays = month.weeks.reduce((weekDays, week) => {
|
|
13
|
-
return [...weekDays, ...week.days];
|
|
14
|
-
}, initialDays);
|
|
15
|
-
return [...days, ...weekDays];
|
|
16
|
-
}, initialDays);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { getDays };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UI, DayFlag, SelectionState, Animation } from '../UI.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the default class names for the UI elements.
|
|
5
|
-
*
|
|
6
|
-
* This function generates a mapping of default class names for various UI
|
|
7
|
-
* elements, day flags, selection states, and animations.
|
|
8
|
-
*
|
|
9
|
-
* @returns An object containing the default class names.
|
|
10
|
-
* @group Utilities
|
|
11
|
-
*/
|
|
12
|
-
function getDefaultClassNames() {
|
|
13
|
-
const classNames = {};
|
|
14
|
-
for (const key in UI) {
|
|
15
|
-
classNames[UI[key]] =
|
|
16
|
-
`rdp-${UI[key]}`;
|
|
17
|
-
}
|
|
18
|
-
for (const key in DayFlag) {
|
|
19
|
-
classNames[DayFlag[key]] =
|
|
20
|
-
`rdp-${DayFlag[key]}`;
|
|
21
|
-
}
|
|
22
|
-
for (const key in SelectionState) {
|
|
23
|
-
classNames[SelectionState[key]] =
|
|
24
|
-
`rdp-${SelectionState[key]}`;
|
|
25
|
-
}
|
|
26
|
-
for (const key in Animation) {
|
|
27
|
-
classNames[Animation[key]] =
|
|
28
|
-
`rdp-${Animation[key]}`;
|
|
29
|
-
}
|
|
30
|
-
return classNames;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { getDefaultClassNames };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the months to display in the calendar.
|
|
3
|
-
*
|
|
4
|
-
* @param firstDisplayedMonth The first month currently displayed in the
|
|
5
|
-
* calendar.
|
|
6
|
-
* @param calendarEndMonth The latest month the user can navigate to.
|
|
7
|
-
* @param props The DayPicker props, including `numberOfMonths`.
|
|
8
|
-
* @param dateLib The date library to use for date manipulation.
|
|
9
|
-
* @returns An array of dates representing the months to display.
|
|
10
|
-
*/
|
|
11
|
-
function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) {
|
|
12
|
-
const { numberOfMonths = 1 } = props;
|
|
13
|
-
const months = [];
|
|
14
|
-
for (let i = 0; i < numberOfMonths; i++) {
|
|
15
|
-
const month = dateLib.addMonths(firstDisplayedMonth, i);
|
|
16
|
-
if (calendarEndMonth && month > calendarEndMonth) {
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
months.push(month);
|
|
20
|
-
}
|
|
21
|
-
return months;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { getDisplayMonths };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the next date that should be focused in the calendar.
|
|
3
|
-
*
|
|
4
|
-
* This function determines the next focusable date based on the movement
|
|
5
|
-
* direction, constraints, and calendar configuration.
|
|
6
|
-
*
|
|
7
|
-
* @param moveBy The unit of movement (e.g., "day", "week").
|
|
8
|
-
* @param moveDir The direction of movement ("before" or "after").
|
|
9
|
-
* @param refDate The reference date from which to calculate the next focusable
|
|
10
|
-
* date.
|
|
11
|
-
* @param navStart The earliest date the user can navigate to.
|
|
12
|
-
* @param navEnd The latest date the user can navigate to.
|
|
13
|
-
* @param props The DayPicker props, including calendar configuration options.
|
|
14
|
-
* @param dateLib The date library to use for date manipulation.
|
|
15
|
-
* @returns The next focusable date.
|
|
16
|
-
*/
|
|
17
|
-
function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
|
|
18
|
-
const { ISOWeek, broadcastCalendar } = props;
|
|
19
|
-
const { addDays, addMonths, addWeeks, addYears, endOfBroadcastWeek, endOfISOWeek, endOfWeek, max, min, startOfBroadcastWeek, startOfISOWeek, startOfWeek } = dateLib;
|
|
20
|
-
const moveFns = {
|
|
21
|
-
day: addDays,
|
|
22
|
-
week: addWeeks,
|
|
23
|
-
month: addMonths,
|
|
24
|
-
year: addYears,
|
|
25
|
-
startOfWeek: (date) => broadcastCalendar
|
|
26
|
-
? startOfBroadcastWeek(date, dateLib)
|
|
27
|
-
: ISOWeek
|
|
28
|
-
? startOfISOWeek(date)
|
|
29
|
-
: startOfWeek(date),
|
|
30
|
-
endOfWeek: (date) => broadcastCalendar
|
|
31
|
-
? endOfBroadcastWeek(date)
|
|
32
|
-
: ISOWeek
|
|
33
|
-
? endOfISOWeek(date)
|
|
34
|
-
: endOfWeek(date)
|
|
35
|
-
};
|
|
36
|
-
let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
|
|
37
|
-
if (moveDir === "before" && navStart) {
|
|
38
|
-
focusableDate = max([navStart, focusableDate]);
|
|
39
|
-
}
|
|
40
|
-
else if (moveDir === "after" && navEnd) {
|
|
41
|
-
focusableDate = min([navEnd, focusableDate]);
|
|
42
|
-
}
|
|
43
|
-
return focusableDate;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { getFocusableDate };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as index from '../formatters/index.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Merges custom formatters from the props with the default formatters.
|
|
5
|
-
*
|
|
6
|
-
* @param customFormatters The custom formatters provided in the DayPicker
|
|
7
|
-
* props.
|
|
8
|
-
* @returns The merged formatters object.
|
|
9
|
-
*/
|
|
10
|
-
function getFormatters(customFormatters) {
|
|
11
|
-
if (customFormatters?.formatMonthCaption && !customFormatters.formatCaption) {
|
|
12
|
-
customFormatters.formatCaption = customFormatters.formatMonthCaption;
|
|
13
|
-
}
|
|
14
|
-
if (customFormatters?.formatYearCaption &&
|
|
15
|
-
!customFormatters.formatYearDropdown) {
|
|
16
|
-
customFormatters.formatYearDropdown = customFormatters.formatYearCaption;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
...index,
|
|
20
|
-
...customFormatters
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { getFormatters };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines the initial month to display in the calendar based on the provided
|
|
3
|
-
* props.
|
|
4
|
-
*
|
|
5
|
-
* This function calculates the starting month, considering constraints such as
|
|
6
|
-
* `startMonth`, `endMonth`, and the number of months to display.
|
|
7
|
-
*
|
|
8
|
-
* @param props The DayPicker props, including navigation and date constraints.
|
|
9
|
-
* @param dateLib The date library to use for date manipulation.
|
|
10
|
-
* @returns The initial month to display.
|
|
11
|
-
*/
|
|
12
|
-
function getInitialMonth(props, dateLib) {
|
|
13
|
-
const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1, endMonth, startMonth } = props;
|
|
14
|
-
let initialMonth = month || defaultMonth || today;
|
|
15
|
-
const { differenceInCalendarMonths, addMonths, startOfMonth } = dateLib;
|
|
16
|
-
// Adjust the initial month if it is after the endMonth
|
|
17
|
-
if (endMonth && differenceInCalendarMonths(endMonth, initialMonth) < 0) {
|
|
18
|
-
const offset = -1 * (numberOfMonths - 1);
|
|
19
|
-
initialMonth = addMonths(endMonth, offset);
|
|
20
|
-
}
|
|
21
|
-
// Adjust the initial month if it is before the startMonth
|
|
22
|
-
if (startMonth && differenceInCalendarMonths(initialMonth, startMonth) < 0) {
|
|
23
|
-
initialMonth = startMonth;
|
|
24
|
-
}
|
|
25
|
-
return startOfMonth(initialMonth);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { getInitialMonth };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the months to show in the dropdown.
|
|
3
|
-
*
|
|
4
|
-
* This function generates a list of months for the current year, formatted
|
|
5
|
-
* using the provided formatter, and determines whether each month should be
|
|
6
|
-
* disabled based on the navigation range.
|
|
7
|
-
*
|
|
8
|
-
* @param displayMonth The currently displayed month.
|
|
9
|
-
* @param navStart The start date for navigation.
|
|
10
|
-
* @param navEnd The end date for navigation.
|
|
11
|
-
* @param formatters The formatters to use for formatting the month labels.
|
|
12
|
-
* @param dateLib The date library to use for date manipulation.
|
|
13
|
-
* @returns An array of dropdown options representing the months, or `undefined`
|
|
14
|
-
* if no months are available.
|
|
15
|
-
*/
|
|
16
|
-
function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
|
|
17
|
-
const { startOfMonth, startOfYear, endOfYear, eachMonthOfInterval, getMonth } = dateLib;
|
|
18
|
-
const months = eachMonthOfInterval({
|
|
19
|
-
start: startOfYear(displayMonth),
|
|
20
|
-
end: endOfYear(displayMonth)
|
|
21
|
-
});
|
|
22
|
-
const options = months.map((month) => {
|
|
23
|
-
const label = formatters.formatMonthDropdown(month, dateLib);
|
|
24
|
-
const value = getMonth(month);
|
|
25
|
-
const disabled = (navStart && month < startOfMonth(navStart)) ||
|
|
26
|
-
(navEnd && month > startOfMonth(navEnd)) ||
|
|
27
|
-
false;
|
|
28
|
-
return { value, label, disabled };
|
|
29
|
-
});
|
|
30
|
-
return options;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { getMonthOptions };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { CalendarDay } from '../classes/CalendarDay.js';
|
|
2
|
-
import { CalendarWeek } from '../classes/CalendarWeek.js';
|
|
3
|
-
import { CalendarMonth } from '../classes/CalendarMonth.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns the months to display in the calendar.
|
|
7
|
-
*
|
|
8
|
-
* This function generates `CalendarMonth` objects for each month to be
|
|
9
|
-
* displayed, including their weeks and days, based on the provided display
|
|
10
|
-
* months and dates.
|
|
11
|
-
*
|
|
12
|
-
* @param displayMonths The months (as dates) to display in the calendar.
|
|
13
|
-
* @param dates The dates to display in the calendar.
|
|
14
|
-
* @param props Options from the DayPicker props context.
|
|
15
|
-
* @param dateLib The date library to use for date manipulation.
|
|
16
|
-
* @returns An array of `CalendarMonth` objects representing the months to
|
|
17
|
-
* display.
|
|
18
|
-
*/
|
|
19
|
-
function getMonths(displayMonths, dates, props, dateLib) {
|
|
20
|
-
const { addDays, endOfBroadcastWeek, endOfISOWeek, endOfMonth, endOfWeek, getISOWeek, getWeek, startOfBroadcastWeek, startOfISOWeek, startOfWeek } = dateLib;
|
|
21
|
-
const dayPickerMonths = displayMonths.reduce((months, month) => {
|
|
22
|
-
const firstDateOfFirstWeek = props.broadcastCalendar
|
|
23
|
-
? startOfBroadcastWeek(month, dateLib)
|
|
24
|
-
: props.ISOWeek
|
|
25
|
-
? startOfISOWeek(month)
|
|
26
|
-
: startOfWeek(month);
|
|
27
|
-
const lastDateOfLastWeek = props.broadcastCalendar
|
|
28
|
-
? endOfBroadcastWeek(month)
|
|
29
|
-
: props.ISOWeek
|
|
30
|
-
? endOfISOWeek(endOfMonth(month))
|
|
31
|
-
: endOfWeek(endOfMonth(month));
|
|
32
|
-
/** The dates to display in the month. */
|
|
33
|
-
const monthDates = dates.filter((date) => {
|
|
34
|
-
return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
|
|
35
|
-
});
|
|
36
|
-
const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;
|
|
37
|
-
if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
|
|
38
|
-
const extraDates = dates.filter((date) => {
|
|
39
|
-
const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;
|
|
40
|
-
return (date > lastDateOfLastWeek &&
|
|
41
|
-
date <= addDays(lastDateOfLastWeek, daysToAdd));
|
|
42
|
-
});
|
|
43
|
-
monthDates.push(...extraDates);
|
|
44
|
-
}
|
|
45
|
-
const weeks = monthDates.reduce((weeks, date) => {
|
|
46
|
-
const weekNumber = props.ISOWeek ? getISOWeek(date) : getWeek(date);
|
|
47
|
-
const week = weeks.find((week) => week.weekNumber === weekNumber);
|
|
48
|
-
const day = new CalendarDay(date, month, dateLib);
|
|
49
|
-
if (!week) {
|
|
50
|
-
weeks.push(new CalendarWeek(weekNumber, [day]));
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
week.days.push(day);
|
|
54
|
-
}
|
|
55
|
-
return weeks;
|
|
56
|
-
}, []);
|
|
57
|
-
const dayPickerMonth = new CalendarMonth(month, weeks);
|
|
58
|
-
months.push(dayPickerMonth);
|
|
59
|
-
return months;
|
|
60
|
-
}, []);
|
|
61
|
-
if (!props.reverseMonths) {
|
|
62
|
-
return dayPickerMonths;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return dayPickerMonths.reverse();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export { getMonths };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the start and end months for calendar navigation.
|
|
3
|
-
*
|
|
4
|
-
* @param props The DayPicker props, including navigation and layout options.
|
|
5
|
-
* @param dateLib The date library to use for date manipulation.
|
|
6
|
-
* @returns A tuple containing the start and end months for navigation.
|
|
7
|
-
*/
|
|
8
|
-
function getNavMonths(props, dateLib) {
|
|
9
|
-
let { startMonth, endMonth } = props;
|
|
10
|
-
const { startOfYear, startOfDay, startOfMonth, endOfMonth, addYears, endOfYear, newDate, today } = dateLib;
|
|
11
|
-
// Handle deprecated code
|
|
12
|
-
const { fromYear, toYear, fromMonth, toMonth } = props;
|
|
13
|
-
if (!startMonth && fromMonth) {
|
|
14
|
-
startMonth = fromMonth;
|
|
15
|
-
}
|
|
16
|
-
if (!startMonth && fromYear) {
|
|
17
|
-
startMonth = dateLib.newDate(fromYear, 0, 1);
|
|
18
|
-
}
|
|
19
|
-
if (!endMonth && toMonth) {
|
|
20
|
-
endMonth = toMonth;
|
|
21
|
-
}
|
|
22
|
-
if (!endMonth && toYear) {
|
|
23
|
-
endMonth = newDate(toYear, 11, 31);
|
|
24
|
-
}
|
|
25
|
-
const hasYearDropdown = props.captionLayout === "dropdown" ||
|
|
26
|
-
props.captionLayout === "dropdown-years";
|
|
27
|
-
if (startMonth) {
|
|
28
|
-
startMonth = startOfMonth(startMonth);
|
|
29
|
-
}
|
|
30
|
-
else if (fromYear) {
|
|
31
|
-
startMonth = newDate(fromYear, 0, 1);
|
|
32
|
-
}
|
|
33
|
-
else if (!startMonth && hasYearDropdown) {
|
|
34
|
-
startMonth = startOfYear(addYears(props.today ?? today(), -100));
|
|
35
|
-
}
|
|
36
|
-
if (endMonth) {
|
|
37
|
-
endMonth = endOfMonth(endMonth);
|
|
38
|
-
}
|
|
39
|
-
else if (toYear) {
|
|
40
|
-
endMonth = newDate(toYear, 11, 31);
|
|
41
|
-
}
|
|
42
|
-
else if (!endMonth && hasYearDropdown) {
|
|
43
|
-
endMonth = endOfYear(props.today ?? today());
|
|
44
|
-
}
|
|
45
|
-
return [
|
|
46
|
-
startMonth ? startOfDay(startMonth) : startMonth,
|
|
47
|
-
endMonth ? startOfDay(endMonth) : endMonth
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { getNavMonths };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { dateMatchModifiers } from '../utils/dateMatchModifiers.js';
|
|
2
|
-
import { getFocusableDate } from './getFocusableDate.js';
|
|
3
|
-
import { CalendarDay } from '../classes/CalendarDay.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Determines the next focusable day in the calendar.
|
|
7
|
-
*
|
|
8
|
-
* This function recursively calculates the next focusable day based on the
|
|
9
|
-
* movement direction and modifiers applied to the days.
|
|
10
|
-
*
|
|
11
|
-
* @param moveBy The unit of movement (e.g., "day", "week").
|
|
12
|
-
* @param moveDir The direction of movement ("before" or "after").
|
|
13
|
-
* @param refDay The currently focused day.
|
|
14
|
-
* @param calendarStartMonth The earliest month the user can navigate to.
|
|
15
|
-
* @param calendarEndMonth The latest month the user can navigate to.
|
|
16
|
-
* @param props The DayPicker props, including modifiers and configuration
|
|
17
|
-
* options.
|
|
18
|
-
* @param dateLib The date library to use for date manipulation.
|
|
19
|
-
* @param attempt The current recursion attempt (used to limit recursion depth).
|
|
20
|
-
* @returns The next focusable day, or `undefined` if no focusable day is found.
|
|
21
|
-
*/
|
|
22
|
-
function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) {
|
|
23
|
-
if (attempt > 365) {
|
|
24
|
-
// Limit the recursion to 365 attempts
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib);
|
|
28
|
-
const isDisabled = Boolean(props.disabled && dateMatchModifiers(focusableDate, props.disabled, dateLib));
|
|
29
|
-
const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib));
|
|
30
|
-
const targetMonth = focusableDate;
|
|
31
|
-
const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib);
|
|
32
|
-
if (!isDisabled && !isHidden) {
|
|
33
|
-
return focusDay;
|
|
34
|
-
}
|
|
35
|
-
// Recursively attempt to find the next focusable date
|
|
36
|
-
return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { getNextFocus };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the next month the user can navigate to, based on the given options.
|
|
3
|
-
*
|
|
4
|
-
* The next month is not always the next calendar month:
|
|
5
|
-
*
|
|
6
|
-
* - If it is after the `calendarEndMonth`, it returns `undefined`.
|
|
7
|
-
* - If paged navigation is enabled, it skips forward by the number of displayed
|
|
8
|
-
* months.
|
|
9
|
-
*
|
|
10
|
-
* @param firstDisplayedMonth The first month currently displayed in the
|
|
11
|
-
* calendar.
|
|
12
|
-
* @param calendarEndMonth The latest month the user can navigate to.
|
|
13
|
-
* @param options Navigation options, including `numberOfMonths` and
|
|
14
|
-
* `pagedNavigation`.
|
|
15
|
-
* @param dateLib The date library to use for date manipulation.
|
|
16
|
-
* @returns The next month, or `undefined` if navigation is not possible.
|
|
17
|
-
*/
|
|
18
|
-
function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) {
|
|
19
|
-
if (options.disableNavigation) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
const { pagedNavigation, numberOfMonths = 1 } = options;
|
|
23
|
-
const { startOfMonth, addMonths, differenceInCalendarMonths } = dateLib;
|
|
24
|
-
const offset = pagedNavigation ? numberOfMonths : 1;
|
|
25
|
-
const month = startOfMonth(firstDisplayedMonth);
|
|
26
|
-
if (!calendarEndMonth) {
|
|
27
|
-
return addMonths(month, offset);
|
|
28
|
-
}
|
|
29
|
-
const monthsDiff = differenceInCalendarMonths(calendarEndMonth, firstDisplayedMonth);
|
|
30
|
-
if (monthsDiff < numberOfMonths) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return addMonths(month, offset);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { getNextMonth };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the previous month the user can navigate to, based on the given
|
|
3
|
-
* options.
|
|
4
|
-
*
|
|
5
|
-
* The previous month is not always the previous calendar month:
|
|
6
|
-
*
|
|
7
|
-
* - If it is before the `calendarStartMonth`, it returns `undefined`.
|
|
8
|
-
* - If paged navigation is enabled, it skips back by the number of displayed
|
|
9
|
-
* months.
|
|
10
|
-
*
|
|
11
|
-
* @param firstDisplayedMonth The first month currently displayed in the
|
|
12
|
-
* calendar.
|
|
13
|
-
* @param calendarStartMonth The earliest month the user can navigate to.
|
|
14
|
-
* @param options Navigation options, including `numberOfMonths` and
|
|
15
|
-
* `pagedNavigation`.
|
|
16
|
-
* @param dateLib The date library to use for date manipulation.
|
|
17
|
-
* @returns The previous month, or `undefined` if navigation is not possible.
|
|
18
|
-
*/
|
|
19
|
-
function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) {
|
|
20
|
-
if (options.disableNavigation) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
const { pagedNavigation, numberOfMonths } = options;
|
|
24
|
-
const { startOfMonth, addMonths, differenceInCalendarMonths } = dateLib;
|
|
25
|
-
const offset = pagedNavigation ? (numberOfMonths ?? 1) : 1;
|
|
26
|
-
const month = startOfMonth(firstDisplayedMonth);
|
|
27
|
-
if (!calendarStartMonth) {
|
|
28
|
-
return addMonths(month, -offset);
|
|
29
|
-
}
|
|
30
|
-
const monthsDiff = differenceInCalendarMonths(month, calendarStartMonth);
|
|
31
|
-
if (monthsDiff <= 0) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
return addMonths(month, -offset);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { getPreviousMonth };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { UI } from '../UI.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the computed style for a day based on its modifiers.
|
|
5
|
-
*
|
|
6
|
-
* This function merges the base styles for the day with any styles associated
|
|
7
|
-
* with active modifiers.
|
|
8
|
-
*
|
|
9
|
-
* @param dayModifiers The modifiers applied to the day.
|
|
10
|
-
* @param styles The base styles for the calendar elements.
|
|
11
|
-
* @param modifiersStyles The styles associated with specific modifiers.
|
|
12
|
-
* @returns The computed style for the day.
|
|
13
|
-
*/
|
|
14
|
-
function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) {
|
|
15
|
-
let style = { ...styles?.[UI.Day] };
|
|
16
|
-
Object.entries(dayModifiers)
|
|
17
|
-
.filter(([, active]) => active === true)
|
|
18
|
-
.forEach(([modifier]) => {
|
|
19
|
-
style = {
|
|
20
|
-
...style,
|
|
21
|
-
...modifiersStyles?.[modifier]
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
return style;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { getStyleForModifiers };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a series of 7 days, starting from the beginning of the week, to use
|
|
3
|
-
* for formatting weekday names (e.g., Monday, Tuesday, etc.).
|
|
4
|
-
*
|
|
5
|
-
* @param dateLib The date library to use for date manipulation.
|
|
6
|
-
* @param ISOWeek Whether to use ISO week numbering (weeks start on Monday).
|
|
7
|
-
* @param broadcastCalendar Whether to use the broadcast calendar (weeks start
|
|
8
|
-
* on Monday, but may include adjustments for broadcast-specific rules).
|
|
9
|
-
* @returns An array of 7 dates representing the weekdays.
|
|
10
|
-
*/
|
|
11
|
-
function getWeekdays(dateLib, ISOWeek, broadcastCalendar) {
|
|
12
|
-
const today = dateLib.today();
|
|
13
|
-
const start = ISOWeek
|
|
14
|
-
? dateLib.startOfISOWeek(today)
|
|
15
|
-
: dateLib.startOfWeek(today);
|
|
16
|
-
const days = [];
|
|
17
|
-
for (let i = 0; i < 7; i++) {
|
|
18
|
-
const day = dateLib.addDays(start, i);
|
|
19
|
-
days.push(day);
|
|
20
|
-
}
|
|
21
|
-
return days;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { getWeekdays };
|