diff --git a/.changeset/nervous-icons-draw.md b/.changeset/nervous-icons-draw.md new file mode 100644 index 0000000000..9145a0ddcc --- /dev/null +++ b/.changeset/nervous-icons-draw.md @@ -0,0 +1,7 @@ +--- +"@heroui/date-input": patch +"@heroui/calendar": patch +"@heroui/system": patch +--- + +remove `@interationalized/date` from system diff --git a/.changeset/thick-dogs-march.md b/.changeset/thick-dogs-march.md new file mode 100644 index 0000000000..3e549fda3d --- /dev/null +++ b/.changeset/thick-dogs-march.md @@ -0,0 +1,45 @@ +--- +"@heroui/scroll-shadow": patch +"@heroui/autocomplete": patch +"@heroui/number-input": patch +"@heroui/breadcrumbs": patch +"@heroui/date-picker": patch +"@heroui/date-input": patch +"@heroui/pagination": patch +"@heroui/accordion": patch +"@heroui/input-otp": patch +"@heroui/calendar": patch +"@heroui/checkbox": patch +"@heroui/dropdown": patch +"@heroui/progress": patch +"@heroui/skeleton": patch +"@heroui/listbox": patch +"@heroui/popover": patch +"@heroui/snippet": patch +"@heroui/tooltip": patch +"@heroui/avatar": patch +"@heroui/button": patch +"@heroui/drawer": patch +"@heroui/navbar": patch +"@heroui/ripple": patch +"@heroui/select": patch +"@heroui/slider": patch +"@heroui/switch": patch +"@heroui/alert": patch +"@heroui/badge": patch +"@heroui/image": patch +"@heroui/input": patch +"@heroui/modal": patch +"@heroui/radio": patch +"@heroui/table": patch +"@heroui/toast": patch +"@heroui/card": patch +"@heroui/chip": patch +"@heroui/form": patch +"@heroui/link": patch +"@heroui/menu": patch +"@heroui/tabs": patch +"@heroui/user": patch +--- + +bump system peer dependencies diff --git a/packages/components/accordion/package.json b/packages/components/accordion/package.json index 7b8adb45e7..08ecf6d931 100644 --- a/packages/components/accordion/package.json +++ b/packages/components/accordion/package.json @@ -44,7 +44,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/aria-utils": "workspace:*", diff --git a/packages/components/alert/package.json b/packages/components/alert/package.json index 2739f52031..c80d03319f 100644 --- a/packages/components/alert/package.json +++ b/packages/components/alert/package.json @@ -41,7 +41,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/react-utils": "workspace:*", diff --git a/packages/components/autocomplete/package.json b/packages/components/autocomplete/package.json index 0e09c5c114..4c6584e65f 100644 --- a/packages/components/autocomplete/package.json +++ b/packages/components/autocomplete/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.7", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.6", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "react": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/avatar/package.json b/packages/components/avatar/package.json index 0155e31aae..2e9e14549d 100644 --- a/packages/components/avatar/package.json +++ b/packages/components/avatar/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/badge/package.json b/packages/components/badge/package.json index 323ddb5b7f..696d348c7c 100644 --- a/packages/components/badge/package.json +++ b/packages/components/badge/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/breadcrumbs/package.json b/packages/components/breadcrumbs/package.json index 7c867e05f3..6b0e8c1742 100644 --- a/packages/components/breadcrumbs/package.json +++ b/packages/components/breadcrumbs/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/react-utils": "workspace:*", diff --git a/packages/components/button/package.json b/packages/components/button/package.json index 5acd99fe55..843320a0fa 100644 --- a/packages/components/button/package.json +++ b/packages/components/button/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/calendar/package.json b/packages/components/calendar/package.json index bc2e2cd0dc..aed53b1134 100644 --- a/packages/components/calendar/package.json +++ b/packages/components/calendar/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.7", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.6", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "react": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/calendar/src/use-calendar-base.ts b/packages/components/calendar/src/use-calendar-base.ts index ae9e432bab..6be6ec3827 100644 --- a/packages/components/calendar/src/use-calendar-base.ts +++ b/packages/components/calendar/src/use-calendar-base.ts @@ -1,17 +1,13 @@ import type {CalendarReturnType, CalendarVariantProps} from "@heroui/theme"; -import type { - CalendarPropsBase as AriaCalendarPropsBase, - DateValue, - SpectrumCalendarProps, -} from "@react-types/calendar"; +import type {CalendarPropsBase as AriaCalendarPropsBase} from "@react-types/calendar"; import type {CalendarSlots, SlotsToClasses} from "@heroui/theme"; import type {AriaCalendarGridProps} from "@react-aria/calendar"; import type {AriaButtonProps} from "@react-types/button"; import type {HTMLHeroUIProps, PropGetter} from "@heroui/system"; +import type {DateValue, Calendar, CalendarIdentifier} from "@internationalized/date"; import type {ButtonProps} from "@heroui/button"; import type {CalendarState, RangeCalendarState} from "@react-stately/calendar"; import type {RefObject, ReactNode} from "react"; -import type {CalendarIdentifier} from "@internationalized/date"; import type {ReactRef} from "@heroui/react-utils"; import {createCalendar, CalendarDate, DateFormatter} from "@internationalized/date"; @@ -124,7 +120,7 @@ interface Props extends HeroUIBaseProps { * * @default all calendars */ - createCalendar?: SpectrumCalendarProps["createCalendar"]; + createCalendar?: (identifier: CalendarIdentifier) => Calendar; /** * The style of weekday names to display in the calendar grid header, * e.g. single letter, abbreviation, or full day name. @@ -227,10 +223,10 @@ export function useCalendarBase(originalProps: UseCalendarBasePropsComplete) { isHeaderDefaultExpanded, onHeaderExpandedChange = () => {}, createCalendar: createCalendarProp = globalContext?.createCalendar ?? null, - minValue = globalContext?.defaultDates?.minDate ?? - new CalendarDate(calendarProp, 1900 + gregorianYearOffset, 1, 1), - maxValue = globalContext?.defaultDates?.maxDate ?? - new CalendarDate(calendarProp, 2099 + gregorianYearOffset, 12, 31), + minValue = (globalContext?.defaultDates?.minDate ?? + new CalendarDate(calendarProp, 1900 + gregorianYearOffset, 1, 1)) as DateValue, + maxValue = (globalContext?.defaultDates?.maxDate ?? + new CalendarDate(calendarProp, 2099 + gregorianYearOffset, 12, 31)) as DateValue, prevButtonProps: prevButtonPropsProp, nextButtonProps: nextButtonPropsProp, errorMessage, diff --git a/packages/components/card/package.json b/packages/components/card/package.json index dc1d0a83ea..c2d57d566f 100644 --- a/packages/components/card/package.json +++ b/packages/components/card/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/checkbox/package.json b/packages/components/checkbox/package.json index 8c53cc5d90..ddc09a349b 100644 --- a/packages/components/checkbox/package.json +++ b/packages/components/checkbox/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.7", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.3", "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0" diff --git a/packages/components/chip/package.json b/packages/components/chip/package.json index be36b2018e..11c3a1fef9 100644 --- a/packages/components/chip/package.json +++ b/packages/components/chip/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-icons": "workspace:*", diff --git a/packages/components/date-input/package.json b/packages/components/date-input/package.json index e081fb4fea..19d833d727 100644 --- a/packages/components/date-input/package.json +++ b/packages/components/date-input/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.10", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.16", "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0" diff --git a/packages/components/date-input/src/use-date-input.ts b/packages/components/date-input/src/use-date-input.ts index c01bc67851..c4dfb1de19 100644 --- a/packages/components/date-input/src/use-date-input.ts +++ b/packages/components/date-input/src/use-date-input.ts @@ -1,12 +1,10 @@ import type {DateInputVariantProps, DateInputSlots, SlotsToClasses} from "@heroui/theme"; -import type {AriaDateFieldProps} from "@react-types/datepicker"; -import type {DateValue, SpectrumDatePickerBase} from "@react-types/datepicker"; +import type {AriaDateFieldProps, SpectrumDatePickerBase} from "@react-types/datepicker"; import type {ReactRef} from "@heroui/react-utils"; import type {DOMAttributes, GroupDOMAttributes} from "@react-types/shared"; import type {DateInputGroupProps} from "./date-input-group"; -import type {CalendarIdentifier} from "@internationalized/date"; -import type {PropGetter} from "@heroui/system"; -import type {HTMLHeroUIProps} from "@heroui/system"; +import type {DateValue, CalendarIdentifier} from "@internationalized/date"; +import type {PropGetter, HTMLHeroUIProps} from "@heroui/system"; import {useLocale} from "@react-aria/i18n"; import {createCalendar, CalendarDate, DateFormatter} from "@internationalized/date"; @@ -151,10 +149,10 @@ export function useDateInput(originalProps: UseDateInputPro descriptionProps: descriptionPropsProp, validationBehavior = formValidationBehavior ?? globalContext?.validationBehavior ?? "native", shouldForceLeadingZeros = true, - minValue = globalContext?.defaultDates?.minDate ?? - new CalendarDate(calendarProp, 1900 + gregorianYearOffset, 1, 1), - maxValue = globalContext?.defaultDates?.maxDate ?? - new CalendarDate(calendarProp, 2099 + gregorianYearOffset, 12, 31), + minValue = (globalContext?.defaultDates?.minDate ?? + new CalendarDate(calendarProp, 1900 + gregorianYearOffset, 1, 1)) as DateValue, + maxValue = (globalContext?.defaultDates?.maxDate ?? + new CalendarDate(calendarProp, 2099 + gregorianYearOffset, 12, 31)) as DateValue, createCalendar: createCalendarProp = globalContext?.createCalendar ?? null, isInvalid: isInvalidProp = validationState ? validationState === "invalid" : false, errorMessage, diff --git a/packages/components/date-picker/package.json b/packages/components/date-picker/package.json index 535d771e1f..194e70bd66 100644 --- a/packages/components/date-picker/package.json +++ b/packages/components/date-picker/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.10", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.9", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "react": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/drawer/package.json b/packages/components/drawer/package.json index f1810f4fcb..1b114d549c 100644 --- a/packages/components/drawer/package.json +++ b/packages/components/drawer/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/dropdown/package.json b/packages/components/dropdown/package.json index c5c99a89aa..2d13e45e90 100644 --- a/packages/components/dropdown/package.json +++ b/packages/components/dropdown/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.7", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.6", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "react": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/form/package.json b/packages/components/form/package.json index df09c5d813..a715aa6c50 100644 --- a/packages/components/form/package.json +++ b/packages/components/form/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.7", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.6", "react": ">=18", "react-dom": ">=18" diff --git a/packages/components/image/package.json b/packages/components/image/package.json index 76f8e4fa09..3720ae19aa 100644 --- a/packages/components/image/package.json +++ b/packages/components/image/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/input-otp/package.json b/packages/components/input-otp/package.json index 106a379d65..91fb7f0a8e 100644 --- a/packages/components/input-otp/package.json +++ b/packages/components/input-otp/package.json @@ -37,7 +37,7 @@ "react": ">=18", "react-dom": ">=18", "@heroui/theme": ">=2.4.16", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/form": "workspace:*", diff --git a/packages/components/input/package.json b/packages/components/input/package.json index b25449d918..2874d592d4 100644 --- a/packages/components/input/package.json +++ b/packages/components/input/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.12", - "@heroui/system": ">=2.4.10" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/form": "workspace:*", diff --git a/packages/components/link/package.json b/packages/components/link/package.json index ccb07119a5..7a55cfc128 100644 --- a/packages/components/link/package.json +++ b/packages/components/link/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/listbox/package.json b/packages/components/listbox/package.json index 4a61be4ff5..f989b2cf46 100644 --- a/packages/components/listbox/package.json +++ b/packages/components/listbox/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/aria-utils": "workspace:*", diff --git a/packages/components/menu/package.json b/packages/components/menu/package.json index 3673a53ad5..5805fd4495 100644 --- a/packages/components/menu/package.json +++ b/packages/components/menu/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/divider": "workspace:*", diff --git a/packages/components/modal/package.json b/packages/components/modal/package.json index 7bd5c45f30..93446aab4c 100644 --- a/packages/components/modal/package.json +++ b/packages/components/modal/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/use-disclosure": "workspace:*", diff --git a/packages/components/navbar/package.json b/packages/components/navbar/package.json index b78975360e..f6acfe8932 100644 --- a/packages/components/navbar/package.json +++ b/packages/components/navbar/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/number-input/package.json b/packages/components/number-input/package.json index 493fea5522..e195db4406 100644 --- a/packages/components/number-input/package.json +++ b/packages/components/number-input/package.json @@ -38,7 +38,7 @@ "peerDependencies": { "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", - "@heroui/system": ">=2.4.10", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.16" }, "dependencies": { diff --git a/packages/components/pagination/package.json b/packages/components/pagination/package.json index 589a392e6b..cc6a36a919 100644 --- a/packages/components/pagination/package.json +++ b/packages/components/pagination/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/popover/package.json b/packages/components/popover/package.json index 25e51efdbe..84cb878aad 100644 --- a/packages/components/popover/package.json +++ b/packages/components/popover/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.7", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.6", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "react": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/progress/package.json b/packages/components/progress/package.json index 104627353d..4fa3475744 100644 --- a/packages/components/progress/package.json +++ b/packages/components/progress/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/radio/package.json b/packages/components/radio/package.json index c7233ceb1e..727e810894 100644 --- a/packages/components/radio/package.json +++ b/packages/components/radio/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.3", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/form": "workspace:*", diff --git a/packages/components/ripple/package.json b/packages/components/ripple/package.json index b193165c9c..a28baa5c50 100644 --- a/packages/components/ripple/package.json +++ b/packages/components/ripple/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/scroll-shadow/package.json b/packages/components/scroll-shadow/package.json index 291d87f9a4..f4dce15cd4 100644 --- a/packages/components/scroll-shadow/package.json +++ b/packages/components/scroll-shadow/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/select/package.json b/packages/components/select/package.json index 5570688d73..844ce12d56 100644 --- a/packages/components/select/package.json +++ b/packages/components/select/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.10", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.12", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "react": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/skeleton/package.json b/packages/components/skeleton/package.json index 11b70ffc8b..02a1b32cd1 100644 --- a/packages/components/skeleton/package.json +++ b/packages/components/skeleton/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*" diff --git a/packages/components/slider/package.json b/packages/components/slider/package.json index 6a1649c10c..f34aefc48b 100644 --- a/packages/components/slider/package.json +++ b/packages/components/slider/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/snippet/package.json b/packages/components/snippet/package.json index 6ca812c47e..5b16184784 100644 --- a/packages/components/snippet/package.json +++ b/packages/components/snippet/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/button": "workspace:*", diff --git a/packages/components/switch/package.json b/packages/components/switch/package.json index 71da1c023e..6ea38c695d 100644 --- a/packages/components/switch/package.json +++ b/packages/components/switch/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.3", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/table/package.json b/packages/components/table/package.json index 86bcf9fa0f..7cc55f3ba7 100644 --- a/packages/components/table/package.json +++ b/packages/components/table/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/checkbox": "workspace:*", diff --git a/packages/components/tabs/package.json b/packages/components/tabs/package.json index 97ffb72b54..4544363661 100644 --- a/packages/components/tabs/package.json +++ b/packages/components/tabs/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/toast/package.json b/packages/components/toast/package.json index a290750b5a..c8aef219aa 100644 --- a/packages/components/toast/package.json +++ b/packages/components/toast/package.json @@ -34,7 +34,7 @@ "postpack": "clean-package restore" }, "peerDependencies": { - "@heroui/system": ">=2.4.10", + "@heroui/system": ">=2.4.17", "@heroui/theme": ">=2.4.12", "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", diff --git a/packages/components/tooltip/package.json b/packages/components/tooltip/package.json index b2e7bfd64b..e79defbb1b 100644 --- a/packages/components/tooltip/package.json +++ b/packages/components/tooltip/package.json @@ -38,7 +38,7 @@ "react-dom": ">=18 || >=19.0.0-rc.0", "framer-motion": ">=11.5.6 || >=12.0.0-alpha.1", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/packages/components/user/package.json b/packages/components/user/package.json index d79f9da7cc..4ba1a09ee3 100644 --- a/packages/components/user/package.json +++ b/packages/components/user/package.json @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/avatar": "workspace:*", diff --git a/packages/core/system/package.json b/packages/core/system/package.json index 66b4710525..22a2266293 100644 --- a/packages/core/system/package.json +++ b/packages/core/system/package.json @@ -58,7 +58,6 @@ "@heroui/system-rsc": "workspace:*", "@react-aria/i18n": "3.12.10", "@react-aria/overlays": "3.27.3", - "@react-aria/utils": "3.29.1", - "@react-types/calendar": "3.7.2" + "@react-aria/utils": "3.29.1" } } \ No newline at end of file diff --git a/packages/core/system/src/provider-context.ts b/packages/core/system/src/provider-context.ts index dfedd99ead..b836264bcf 100644 --- a/packages/core/system/src/provider-context.ts +++ b/packages/core/system/src/provider-context.ts @@ -1,5 +1,4 @@ -import type {SpinnerVariants} from "./types"; -import type {DateValue, SpectrumCalendarProps} from "@react-types/calendar"; +import type {SpinnerVariants, Calendar, DateValue, CalendarIdentifier} from "./types"; import {createContext} from "@heroui/react-utils"; @@ -85,7 +84,7 @@ export type ProviderContextProps = { * * @default all calendars */ - createCalendar?: SpectrumCalendarProps["createCalendar"]; + createCalendar?: (identifier: CalendarIdentifier) => Calendar; /** * The default variant of the spinner. * @default default diff --git a/packages/core/system/src/types.ts b/packages/core/system/src/types.ts index a88e2307d6..d21777eba8 100644 --- a/packages/core/system/src/types.ts +++ b/packages/core/system/src/types.ts @@ -2,3 +2,297 @@ * Spinner Variants */ export type SpinnerVariants = "default" | "simple" | "gradient" | "wave" | "dots" | "spinner"; + +/** + * Interationalized Date + * Retrieved from `@internationalized/date` to avoid importing the entire package. + */ +export abstract class CalendarDate { + /** The calendar system associated with this date, e.g. Gregorian. */ + abstract readonly calendar: Calendar; + /** The calendar era for this date, e.g. "BC" or "AD". */ + abstract readonly era: string; + /** The year of this date within the era. */ + abstract readonly year: number; + /** + * The month number within the year. Note that some calendar systems such as Hebrew + * may have a variable number of months per year. Therefore, month numbers may not + * always correspond to the same month names in different years. + */ + abstract readonly month: number; + /** The day number within the month. */ + abstract readonly day: number; + /** Returns a copy of this date. */ + abstract copy(): CalendarDate; + /** Returns a new `CalendarDate` with the given duration added to it. */ + abstract add(duration: DateDuration): CalendarDate; + /** Returns a new `CalendarDate` with the given duration subtracted from it. */ + abstract subtract(duration: DateDuration): CalendarDate; + /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + abstract set(fields: DateFields): CalendarDate; + /** + * Returns a new `CalendarDate` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + abstract cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate; + /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ + abstract toDate(timeZone: string): Date; + /** Converts the date to an ISO 8601 formatted string. */ + abstract toString(): string; + /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ + abstract compare(b: AnyCalendarDate): number; +} + +export abstract class CalendarDateTime { + /** The calendar system associated with this date, e.g. Gregorian. */ + abstract readonly calendar: Calendar; + /** The calendar era for this date, e.g. "BC" or "AD". */ + abstract readonly era: string; + /** The year of this date within the era. */ + abstract readonly year: number; + /** + * The month number within the year. Note that some calendar systems such as Hebrew + * may have a variable number of months per year. Therefore, month numbers may not + * always correspond to the same month names in different years. + */ + abstract readonly month: number; + /** The day number within the month. */ + abstract readonly day: number; + /** The hour in the day, numbered from 0 to 23. */ + abstract readonly hour: number; + /** The minute in the hour. */ + abstract readonly minute: number; + /** The second in the minute. */ + abstract readonly second: number; + /** The millisecond in the second. */ + abstract readonly millisecond: number; + /** Returns a copy of this date. */ + abstract copy(): CalendarDateTime; + /** Returns a new `CalendarDateTime` with the given duration added to it. */ + abstract add(duration: DateTimeDuration): CalendarDateTime; + /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ + abstract subtract(duration: DateTimeDuration): CalendarDateTime; + /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + abstract set(fields: DateFields & TimeFields): CalendarDateTime; + /** + * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + abstract cycle( + field: DateField | TimeField, + amount: number, + options?: CycleTimeOptions, + ): CalendarDateTime; + /** Converts the date to a native JavaScript Date object in the given time zone. */ + abstract toDate(timeZone: string, disambiguation?: Disambiguation): Date; + /** Converts the date to an ISO 8601 formatted string. */ + abstract toString(): string; + /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ + abstract compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number; +} + +export abstract class ZonedDateTime { + /** The calendar system associated with this date, e.g. Gregorian. */ + abstract readonly calendar: Calendar; + /** The calendar era for this date, e.g. "BC" or "AD". */ + abstract readonly era: string; + /** The year of this date within the era. */ + abstract readonly year: number; + /** + * The month number within the year. Note that some calendar systems such as Hebrew + * may have a variable number of months per year. Therefore, month numbers may not + * always correspond to the same month names in different years. + */ + abstract readonly month: number; + /** The day number within the month. */ + abstract readonly day: number; + /** The hour in the day, numbered from 0 to 23. */ + abstract readonly hour: number; + /** The minute in the hour. */ + abstract readonly minute: number; + /** The second in the minute. */ + abstract readonly second: number; + /** The millisecond in the second. */ + abstract readonly millisecond: number; + /** The IANA time zone identifier that this date and time is represented in. */ + abstract readonly timeZone: string; + /** The UTC offset for this time, in milliseconds. */ + abstract readonly offset: number; + /** Returns a copy of this date. */ + abstract copy(): ZonedDateTime; + /** Returns a new `ZonedDateTime` with the given duration added to it. */ + abstract add(duration: DateTimeDuration): ZonedDateTime; + /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ + abstract subtract(duration: DateTimeDuration): ZonedDateTime; + /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ + abstract set(fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime; + /** + * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount. + * When the resulting value reaches the limits of the field, it wraps around. + */ + abstract cycle( + field: DateField | TimeField, + amount: number, + options?: CycleTimeOptions, + ): ZonedDateTime; + /** Converts the date to a native JavaScript Date object. */ + abstract toDate(): Date; + /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ + abstract toString(): string; + /** Converts the date to an ISO 8601 formatted string in UTC. */ + abstract toAbsoluteString(): string; + /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ + abstract compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number; +} + +/** An interface that is compatible with any object with date fields. */ +export abstract class AnyCalendarDate { + abstract readonly calendar: Calendar; + abstract readonly era: string; + abstract readonly year: number; + abstract readonly month: number; + abstract readonly day: number; + abstract copy(): this; +} + +export type CalendarIdentifier = + | "gregory" + | "buddhist" + | "chinese" + | "coptic" + | "dangi" + | "ethioaa" + | "ethiopic" + | "hebrew" + | "indian" + | "islamic" + | "islamic-umalqura" + | "islamic-tbla" + | "islamic-civil" + | "islamic-rgsa" + | "iso8601" + | "japanese" + | "persian" + | "roc"; + +/** + * The Calendar interface represents a calendar system, including information + * about how days, months, years, and eras are organized, and methods to perform + * arithmetic on dates. + */ +export interface Calendar { + /** + * A string identifier for the calendar, as defined by Unicode CLDR. + * See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#supported_calendar_types). + */ + identifier: CalendarIdentifier; + + /** Creates a CalendarDate in this calendar from the given Julian day number. */ + fromJulianDay(jd: number): CalendarDate; + /** Converts a date in this calendar to a Julian day number. */ + toJulianDay(date: AnyCalendarDate): number; + + /** Returns the number of days in the month of the given date. */ + getDaysInMonth(date: AnyCalendarDate): number; + /** Returns the number of months in the year of the given date. */ + getMonthsInYear(date: AnyCalendarDate): number; + /** Returns the number of years in the era of the given date. */ + getYearsInEra(date: AnyCalendarDate): number; + /** Returns a list of era identifiers for the calendar. */ + getEras(): string[]; + + /** + * Returns the minimum month number of the given date's year. + * Normally, this is 1, but in some calendars such as the Japanese, + * eras may begin in the middle of a year. + */ + getMinimumMonthInYear?(date: AnyCalendarDate): number; + /** + * Returns the minimum day number of the given date's month. + * Normally, this is 1, but in some calendars such as the Japanese, + * eras may begin in the middle of a month. + */ + getMinimumDayInMonth?(date: AnyCalendarDate): number; + /** + * Returns a date that is the first day of the month for the given date. + * This is used to determine the month that the given date falls in, if + * the calendar has months that do not align with the standard calendar months + * (e.g. fiscal calendars). + */ + getFormattableMonth?(date: AnyCalendarDate): CalendarDate; + + /** Returns whether the given calendar is the same as this calendar. */ + isEqual?(calendar: Calendar): boolean; + + /** @private */ + balanceDate?(date: AnyCalendarDate): void; + /** @private */ + balanceYearMonth?(date: AnyCalendarDate, previousDate: AnyCalendarDate): void; + /** @private */ + constrainDate?(date: AnyCalendarDate): void; + /** @private */ + isInverseEra?(date: AnyCalendarDate): boolean; +} + +/** Represents an amount of time in calendar-specific units, for use when performing arithmetic. */ +export interface DateDuration { + /** The number of years to add or subtract. */ + years?: number; + /** The number of months to add or subtract. */ + months?: number; + /** The number of weeks to add or subtract. */ + weeks?: number; + /** The number of days to add or subtract. */ + days?: number; +} + +/** Represents an amount of time, for use whe performing arithmetic. */ +export interface TimeDuration { + /** The number of hours to add or subtract. */ + hours?: number; + /** The number of minutes to add or subtract. */ + minutes?: number; + /** The number of seconds to add or subtract. */ + seconds?: number; + /** The number of milliseconds to add or subtract. */ + milliseconds?: number; +} + +/** Represents an amount of time with both date and time components, for use when performing arithmetic. */ +export interface DateTimeDuration extends DateDuration, TimeDuration {} + +export interface DateFields { + era?: string; + year?: number; + month?: number; + day?: number; +} + +export interface TimeFields { + hour?: number; + minute?: number; + second?: number; + millisecond?: number; +} + +export type DateField = keyof DateFields; +export type TimeField = keyof TimeFields; + +export type Disambiguation = "compatible" | "earlier" | "later" | "reject"; + +export interface CycleOptions { + /** Whether to round the field value to the nearest interval of the amount. */ + round?: boolean; +} + +export interface CycleTimeOptions extends CycleOptions { + /** + * Whether to use 12 or 24 hour time. If 12 hour time is chosen, the resulting value + * will remain in the same day period as the original value (e.g. if the value is AM, + * the resulting value also be AM). + * @default 24 + */ + hourCycle?: 12 | 24; +} + +export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime; diff --git a/plop/component/package.json.hbs b/plop/component/package.json.hbs index 0583299d97..26a059c962 100644 --- a/plop/component/package.json.hbs +++ b/plop/component/package.json.hbs @@ -37,7 +37,7 @@ "react": ">=18 || >=19.0.0-rc.0", "react-dom": ">=18 || >=19.0.0-rc.0", "@heroui/theme": ">=2.4.6", - "@heroui/system": ">=2.4.7" + "@heroui/system": ">=2.4.17" }, "dependencies": { "@heroui/shared-utils": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab595fa187..3c56ab013b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3244,9 +3244,6 @@ importers: '@react-aria/utils': specifier: 3.29.1 version: 3.29.1(react-dom@18.3.0(react@18.3.0))(react@18.3.0) - '@react-types/calendar': - specifier: 3.7.2 - version: 3.7.2(react@18.3.0) devDependencies: clean-package: specifier: 2.2.0