jaci-ui 0.1.1 → 0.2.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/CHANGELOG.md +6 -0
- package/README.md +30 -1
- package/dist/components/color-picker/color-picker.cjs +77 -22
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.d.cts +3 -3
- package/dist/components/color-picker/color-picker.d.ts +3 -3
- package/dist/components/color-picker/color-picker.js +77 -22
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +227 -30
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +23 -5
- package/dist/components/date-picker/date-picker.d.ts +23 -5
- package/dist/components/date-picker/date-picker.js +226 -32
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-picker/date-utils.cjs +32 -2
- package/dist/components/date-picker/date-utils.cjs.map +1 -1
- package/dist/components/date-picker/date-utils.d.cts +5 -0
- package/dist/components/date-picker/date-utils.d.ts +5 -0
- package/dist/components/date-picker/date-utils.js +29 -3
- package/dist/components/date-picker/date-utils.js.map +1 -1
- package/dist/components/date-picker/index.d.cts +3 -2
- package/dist/components/date-picker/index.d.ts +3 -2
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -2
- package/dist/styled-system/recipes/color-picker.cjs +1 -0
- package/dist/styled-system/recipes/color-picker.cjs.map +1 -1
- package/dist/styled-system/recipes/color-picker.js +1 -0
- package/dist/styled-system/recipes/color-picker.js.map +1 -1
- package/dist/styled-system/recipes/date-picker.cjs +6 -0
- package/dist/styled-system/recipes/date-picker.cjs.map +1 -1
- package/dist/styled-system/recipes/date-picker.js +6 -0
- package/dist/styled-system/recipes/date-picker.js.map +1 -1
- package/dist/styles.css +190 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.cjs","names":["startOfMonth","datePicker","isBeforeDay","isAfterDay","createCalendarDate","addDays","dateKey","addMonths","formatDateLabel","BasePopover","toInputDate","cx","withRecipeClassName","formatMonthLabel","isSameDay","getDateRangeLabel","getCalendarDays","getWeekdayLabels"],"sources":["../../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent, MouseEvent, ReactNode, Ref } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { datePicker } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport {\n addDays,\n addMonths,\n createCalendarDate,\n dateKey,\n formatDateLabel,\n formatMonthLabel,\n getCalendarDays,\n getDateRangeLabel,\n getWeekdayLabels,\n isAfterDay,\n isBeforeDay,\n isSameDay,\n startOfMonth,\n toInputDate,\n} from \"./date-utils\";\n\nexport type DatePickerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DatePickerContextValue {\n canNavigate: (amount: number) => boolean;\n close: () => void;\n dateDisabled: (date: Date) => boolean;\n disabled: boolean;\n focusDate: (date: Date, direction?: number) => void;\n focusedDate: Date;\n formatDate: (date: Date | null) => string;\n labelId: string;\n locale: string;\n month: Date;\n onClear: () => void;\n onSelect: (date: Date) => void;\n placeholder: ReactNode;\n registerDay: (key: string, node: HTMLButtonElement | null) => void;\n selected: Date | null;\n setFocusedDate: (date: Date) => void;\n setMonth: (date: Date) => void;\n size: DatePickerSize;\n styles: ReturnType<typeof datePicker>;\n today: Date;\n triggerId: string;\n weekStartsOn: number;\n}\n\nconst DatePickerContext = createContext<DatePickerContextValue | null>(null);\n\nfunction useDatePickerContext() {\n const context = useContext(DatePickerContext);\n if (!context) {\n throw new Error(\"DatePicker parts must be rendered inside DatePicker.Root.\");\n }\n\n return context;\n}\n\nfunction isSameMonth(left: Date, right: Date) {\n return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();\n}\n\nfunction composeRefs<T>(first: Ref<T> | undefined, second: (value: T | null) => void) {\n return (value: T | null) => {\n second(value);\n if (typeof first === \"function\") {\n first(value);\n } else if (first) {\n first.current = value;\n }\n };\n}\n\nexport interface DatePickerRootProps extends Omit<BasePopoverRoot.Props, \"children\"> {\n /** Selected value. Use together with `onValueChange` for a controlled picker. */\n value?: Date | null;\n /** Initial selected value for an uncontrolled picker. */\n defaultValue?: Date | null;\n /** Called after a valid day is selected, or when the value is cleared. */\n onValueChange?: (value: Date | null) => void;\n /** Prevents dates before this local calendar day from being selected. */\n minDate?: Date;\n /** Prevents dates after this local calendar day from being selected. */\n maxDate?: Date;\n /** Adds application-specific disabled dates, such as holidays or weekends. */\n isDateDisabled?: (date: Date) => boolean;\n /** Locale used for month, weekday and value formatting. */\n locale?: string;\n /** Called after the visible calendar month changes. */\n onMonthChange?: (month: Date) => void;\n /** First weekday in the calendar, where 0 is Sunday and 1 is Monday. */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** Text shown when no date has been selected. */\n placeholder?: ReactNode;\n /** Shared visual size for the trigger and calendar days. */\n size?: DatePickerSize;\n /** Adds a native hidden input using the `YYYY-MM-DD` representation. */\n name?: string;\n /** Prevents interaction and disables the hidden form input. */\n disabled?: boolean;\n /** Closes the popup after a day is chosen. Defaults to true. */\n closeOnSelect?: boolean;\n children?: ReactNode;\n}\n\nexport function DatePickerRoot({\n children,\n closeOnSelect = true,\n defaultValue = null,\n disabled = false,\n isDateDisabled,\n locale = \"pt-BR\",\n maxDate,\n minDate,\n name,\n onValueChange,\n onMonthChange,\n placeholder = \"Select a date\",\n size = \"md\",\n value: controlledValue,\n weekStartsOn = 0,\n actionsRef: externalActionsRef,\n ...popoverProps\n}: DatePickerRootProps) {\n const [uncontrolledValue, setUncontrolledValue] = useState<Date | null>(defaultValue);\n const selected = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const [month, setMonthState] = useState(() => startOfMonth(selected ?? new Date()));\n const [focusedDate, setFocusedDate] = useState(selected ?? month);\n const previousMonthRef = useRef(month);\n const internalActionsRef = useRef<BasePopoverRoot.Actions | null>(null);\n const dayRefs = useRef(new Map<string, HTMLButtonElement>());\n const labelId = useId();\n const triggerId = useId();\n const today = useMemo(() => new Date(), []);\n const styles = datePicker({ size });\n const minMonth = minDate ? startOfMonth(minDate) : undefined;\n const maxMonth = maxDate ? startOfMonth(maxDate) : undefined;\n\n const clampMonth = useCallback(\n (nextMonth: Date) => {\n const normalized = startOfMonth(nextMonth);\n if (minMonth && isBeforeDay(normalized, minMonth)) return minMonth;\n if (maxMonth && isAfterDay(normalized, maxMonth)) return maxMonth;\n return normalized;\n },\n [maxMonth, minMonth],\n );\n\n const setMonth = useCallback(\n (nextMonth: Date) => {\n const normalized = clampMonth(nextMonth);\n setMonthState((current) => {\n if (isSameMonth(current, normalized)) return current;\n return normalized;\n });\n },\n [clampMonth],\n );\n\n useEffect(() => {\n if (isSameMonth(previousMonthRef.current, month)) return;\n previousMonthRef.current = month;\n onMonthChange?.(month);\n }, [month, onMonthChange]);\n\n useEffect(() => {\n if (!selected) {\n return;\n }\n\n setFocusedDate(selected);\n setMonthState((current) => (isSameMonth(current, selected) ? current : clampMonth(selected)));\n }, [clampMonth, selected]);\n\n const dateDisabled = useCallback(\n (date: Date) =>\n Boolean(\n (minDate && isBeforeDay(date, minDate)) ||\n (maxDate && isAfterDay(date, maxDate)) ||\n isDateDisabled?.(date),\n ),\n [isDateDisabled, maxDate, minDate],\n );\n\n const close = useCallback(() => {\n (externalActionsRef ?? internalActionsRef).current?.close();\n }, [externalActionsRef]);\n\n const onSelect = useCallback(\n (date: Date) => {\n if (disabled || dateDisabled(date)) {\n return;\n }\n\n const nextValue = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n setUncontrolledValue(nextValue);\n setFocusedDate(nextValue);\n setMonth(startOfMonth(nextValue));\n onValueChange?.(nextValue);\n if (closeOnSelect) {\n close();\n }\n },\n [close, closeOnSelect, dateDisabled, disabled, onValueChange, setMonth],\n );\n\n const onClear = useCallback(() => {\n setUncontrolledValue(null);\n onValueChange?.(null);\n }, [onValueChange]);\n\n const focusDate = useCallback(\n (date: Date, direction = 1) => {\n let nextDate = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n const step = direction < 0 ? -1 : 1;\n let attempts = 0;\n while (dateDisabled(nextDate) && attempts < 366) {\n nextDate = addDays(nextDate, step);\n attempts += 1;\n }\n\n setFocusedDate(nextDate);\n setMonth(nextDate);\n\n const focusTarget = () => dayRefs.current.get(dateKey(nextDate))?.focus();\n focusTarget();\n queueMicrotask(focusTarget);\n },\n [dateDisabled, setMonth],\n );\n\n const canNavigate = useCallback(\n (amount: number) => {\n const nextMonth = addMonths(month, amount);\n return !(\n (minMonth && isBeforeDay(nextMonth, minMonth)) ||\n (maxMonth && isAfterDay(nextMonth, maxMonth))\n );\n },\n [maxMonth, minMonth, month],\n );\n\n const registerDay = useCallback((key: string, node: HTMLButtonElement | null) => {\n if (node) {\n dayRefs.current.set(key, node);\n } else {\n dayRefs.current.delete(key);\n }\n }, []);\n\n const context: DatePickerContextValue = {\n canNavigate,\n close,\n dateDisabled,\n disabled,\n focusDate,\n focusedDate,\n formatDate: (date) => formatDateLabel(date, locale, String(placeholder)),\n labelId,\n locale,\n month,\n onClear,\n onSelect,\n placeholder,\n registerDay,\n selected,\n setFocusedDate,\n setMonth,\n size,\n styles,\n today: createCalendarDate(today.getFullYear(), today.getMonth(), today.getDate()),\n triggerId,\n weekStartsOn,\n };\n\n return (\n <DatePickerContext.Provider value={context}>\n <BasePopover.Root {...popoverProps} actionsRef={externalActionsRef ?? internalActionsRef}>\n {children}\n </BasePopover.Root>\n {name ? (\n <input disabled={disabled} name={name} type=\"hidden\" value={toInputDate(selected)} />\n ) : null}\n </DatePickerContext.Provider>\n );\n}\n\nexport type DatePickerLabelProps = ComponentPropsWithoutRef<\"label\">;\n\nexport const DatePickerLabel = forwardRef<HTMLLabelElement, DatePickerLabelProps>(\n function DatePickerLabel({ children, className, ...props }, ref) {\n const { labelId, styles, triggerId } = useDatePickerContext();\n\n return (\n <label\n {...props}\n ref={ref}\n className={cx(styles.label, className)}\n data-slot=\"date-picker-label\"\n htmlFor={props.htmlFor ?? triggerId}\n id={props.id ?? labelId}\n >\n {children}\n </label>\n );\n },\n);\n\nexport type DatePickerControlProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DatePickerControl = forwardRef<HTMLDivElement, DatePickerControlProps>(\n function DatePickerControl({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <div\n {...props}\n ref={ref}\n className={cx(styles.control, className)}\n data-jaci-component=\"date-picker\"\n data-slot=\"date-picker-control\"\n />\n );\n },\n);\n\nexport type DatePickerTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\n\nexport const DatePickerTrigger = forwardRef<HTMLButtonElement, DatePickerTriggerProps>(\n function DatePickerTrigger({ children, className, disabled, id, ...props }, ref) {\n const { disabled: pickerDisabled, styles, triggerId } = useDatePickerContext();\n\n return (\n <BasePopover.Trigger\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Choose date\"}\n disabled={disabled ?? pickerDisabled}\n id={id ?? triggerId}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-jaci-component=\"date-picker\"\n data-slot=\"date-picker-trigger\"\n >\n {children ?? (\n <>\n <DatePickerValue />\n <span aria-hidden=\"true\">▾</span>\n </>\n )}\n </BasePopover.Trigger>\n );\n },\n);\n\nexport interface DatePickerValueProps extends ComponentPropsWithoutRef<\"span\"> {\n placeholder?: ReactNode;\n}\n\nexport const DatePickerValue = forwardRef<HTMLSpanElement, DatePickerValueProps>(\n function DatePickerValue({ children, className, placeholder, ...props }, ref) {\n const { formatDate, selected, styles } = useDatePickerContext();\n const value = children ?? (selected ? formatDate(selected) : (placeholder ?? \"Select a date\"));\n\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.value, className)}\n data-placeholder={selected ? undefined : \"true\"}\n data-slot=\"date-picker-value\"\n >\n {value}\n </span>\n );\n },\n);\n\nexport type DatePickerClearProps = ComponentPropsWithoutRef<\"button\">;\n\nexport const DatePickerClear = forwardRef<HTMLButtonElement, DatePickerClearProps>(\n function DatePickerClear({ children = \"×\", className, disabled, onClick, ...props }, ref) {\n const { close, disabled: pickerDisabled, onClear, selected, styles } = useDatePickerContext();\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClear();\n onClick?.(event);\n close();\n };\n\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Clear date\"}\n className={cx(styles.clear, className)}\n data-slot=\"date-picker-clear\"\n disabled={disabled || pickerDisabled || !selected}\n onClick={handleClick}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type DatePickerPortalProps = ComponentPropsWithoutRef<typeof BasePopover.Portal>;\nexport const DatePickerPortal: typeof BasePopover.Portal = BasePopover.Portal;\n\nexport type DatePickerPositionerProps = ComponentPropsWithoutRef<typeof BasePopover.Positioner>;\n\nexport const DatePickerPositioner = forwardRef<HTMLDivElement, DatePickerPositionerProps>(\n function DatePickerPositioner({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <BasePopover.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.positioner, className)}\n data-slot=\"date-picker-positioner\"\n />\n );\n },\n);\n\nexport type DatePickerPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\n\nexport const DatePickerPopup = forwardRef<HTMLDivElement, DatePickerPopupProps>(\n function DatePickerPopup({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <BasePopover.Popup\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Calendar\"}\n className={withRecipeClassName(styles.popup, className)}\n data-slot=\"date-picker-popup\"\n />\n );\n },\n);\n\nexport type DatePickerCloseProps = ComponentPropsWithoutRef<typeof BasePopover.Close>;\n\nexport const DatePickerClose = forwardRef<HTMLButtonElement, DatePickerCloseProps>(\n function DatePickerClose({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <BasePopover.Close\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.clear, className)}\n data-slot=\"date-picker-close\"\n />\n );\n },\n);\n\nexport type DatePickerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DatePickerHeader = forwardRef<HTMLDivElement, DatePickerHeaderProps>(\n function DatePickerHeader({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <div\n {...props}\n ref={ref}\n className={cx(styles.header, className)}\n data-slot=\"date-picker-header\"\n />\n );\n },\n);\n\nexport type DatePickerCaptionProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const DatePickerCaption = forwardRef<HTMLSpanElement, DatePickerCaptionProps>(\n function DatePickerCaption({ children, className, ...props }, ref) {\n const { locale, month, styles } = useDatePickerContext();\n\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"date-picker-caption\"\n >\n {children ?? formatMonthLabel(month, locale)}\n </span>\n );\n },\n);\n\nexport interface DatePickerNavigationProps extends ComponentPropsWithoutRef<\"button\"> {\n amount?: number;\n}\n\nconst DatePickerNavigationButton = forwardRef<HTMLButtonElement, DatePickerNavigationProps>(\n function DatePickerNavigationButton({ amount, children, className, onClick, ...props }, ref) {\n const { canNavigate, month, setMonth, styles } = useDatePickerContext();\n const direction = amount ?? 1;\n const isDisabled = props.disabled || !canNavigate(direction);\n\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? (direction < 0 ? \"Previous month\" : \"Next month\")}\n className={cx(styles.navigation, className)}\n data-slot={direction < 0 ? \"date-picker-previous\" : \"date-picker-next\"}\n disabled={isDisabled}\n onClick={(event) => {\n if (!isDisabled) setMonth(addMonths(month, direction));\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children ?? (direction < 0 ? \"‹\" : \"›\")}\n </button>\n );\n },\n);\n\nexport const DatePickerPrevious = forwardRef<HTMLButtonElement, DatePickerNavigationProps>(\n function DatePickerPrevious(props, ref) {\n return <DatePickerNavigationButton {...props} amount={-1} ref={ref} />;\n },\n);\n\nexport const DatePickerNext = forwardRef<HTMLButtonElement, DatePickerNavigationProps>(\n function DatePickerNext(props, ref) {\n return <DatePickerNavigationButton {...props} amount={1} ref={ref} />;\n },\n);\n\nexport interface DatePickerDayProps extends Omit<ComponentPropsWithoutRef<\"button\">, \"value\"> {\n date: Date;\n}\n\nexport const DatePickerDay = forwardRef<HTMLButtonElement, DatePickerDayProps>(\n function DatePickerDay(\n { children, className, date, disabled, onClick, onKeyDown, ...props },\n ref,\n ) {\n const {\n dateDisabled,\n disabled: pickerDisabled,\n focusDate,\n focusedDate,\n locale,\n month,\n onSelect,\n registerDay,\n selected,\n styles,\n today,\n } = useDatePickerContext();\n const key = dateKey(date);\n const outsideMonth = !isSameMonth(date, month);\n const isDisabled = disabled || pickerDisabled || dateDisabled(date);\n const isFocused = isSameDay(date, focusedDate);\n const isSelected = isSameDay(date, selected);\n const isToday = isSameDay(date, today);\n const dayRef = composeRefs(ref, (node) => registerDay(key, node));\n\n const moveByKey = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.defaultPrevented) {\n return;\n }\n\n let nextDate: Date | undefined;\n switch (event.key) {\n case \"ArrowLeft\":\n nextDate = addDays(date, -1);\n break;\n case \"ArrowRight\":\n nextDate = addDays(date, 1);\n break;\n case \"ArrowUp\":\n nextDate = addDays(date, -7);\n break;\n case \"ArrowDown\":\n nextDate = addDays(date, 7);\n break;\n case \"Home\":\n nextDate = addDays(date, -date.getDay());\n break;\n case \"End\":\n nextDate = addDays(date, 6 - date.getDay());\n break;\n case \"PageUp\":\n nextDate = addMonths(date, event.shiftKey ? -12 : -1);\n break;\n case \"PageDown\":\n nextDate = addMonths(date, event.shiftKey ? 12 : 1);\n break;\n case \"Enter\":\n case \" \":\n if (!isDisabled) {\n event.preventDefault();\n onSelect(date);\n }\n break;\n default:\n break;\n }\n\n if (nextDate) {\n event.preventDefault();\n focusDate(nextDate, nextDate < date ? -1 : 1);\n }\n };\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: A calendar day is an interactive gridcell, not a generic table cell.\n <button\n {...props}\n ref={dayRef}\n aria-label={props[\"aria-label\"] ?? getDateRangeLabel(date, locale)}\n aria-current={isToday ? \"date\" : undefined}\n aria-selected={isSelected}\n className={cx(styles.day, className)}\n data-date={key}\n data-disabled={isDisabled || undefined}\n data-outside-month={outsideMonth || undefined}\n data-selected={isSelected || undefined}\n data-slot=\"date-picker-day\"\n data-today={isToday || undefined}\n disabled={isDisabled}\n onClick={(event) => {\n onSelect(date);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n moveByKey(event);\n onKeyDown?.(event);\n }}\n role=\"gridcell\"\n tabIndex={isFocused && !isDisabled ? 0 : -1}\n type=\"button\"\n >\n {children ?? date.getDate()}\n </button>\n );\n },\n);\n\nexport interface DatePickerCalendarProps\n extends Omit<ComponentPropsWithoutRef<\"section\">, \"children\"> {\n \"aria-label\"?: string;\n}\n\nexport const DatePickerCalendar = forwardRef<HTMLElement, DatePickerCalendarProps>(\n function DatePickerCalendar({ \"aria-label\": ariaLabel, className, ...props }, ref) {\n const { locale, month, styles, weekStartsOn } = useDatePickerContext();\n const days = useMemo(() => getCalendarDays(month, weekStartsOn), [month, weekStartsOn]);\n const weekdays = useMemo(() => getWeekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);\n\n return (\n <section\n {...props}\n ref={ref}\n aria-label={ariaLabel ?? formatMonthLabel(month, locale)}\n className={cx(styles.calendar, className)}\n data-slot=\"date-picker-calendar\"\n >\n <div aria-hidden=\"true\" className={styles.weekdays} data-slot=\"date-picker-weekdays\">\n {weekdays.map((weekday) => (\n <span className={styles.weekday} data-slot=\"date-picker-weekday\" key={weekday}>\n {weekday}\n </span>\n ))}\n </div>\n {/* biome-ignore lint/a11y/useSemanticElements: Calendar grids use the WAI-ARIA grid pattern for roving day focus. */}\n <div\n aria-label={formatMonthLabel(month, locale)}\n className={styles.grid}\n data-slot=\"date-picker-grid\"\n role=\"grid\"\n >\n {days.map((date) => (\n <DatePickerDay date={date} key={dateKey(date)} />\n ))}\n </div>\n </section>\n );\n },\n);\n\nexport const DatePicker = {\n Root: DatePickerRoot,\n Label: DatePickerLabel,\n Control: DatePickerControl,\n Trigger: DatePickerTrigger,\n Value: DatePickerValue,\n Clear: DatePickerClear,\n Portal: DatePickerPortal,\n Positioner: DatePickerPositioner,\n Popup: DatePickerPopup,\n Close: DatePickerClose,\n Header: DatePickerHeader,\n Caption: DatePickerCaption,\n Previous: DatePickerPrevious,\n Next: DatePickerNext,\n Day: DatePickerDay,\n Calendar: DatePickerCalendar,\n};\n"],"mappings":";;;;;;;;;AAgEA,MAAM,qBAAA,GAAA,MAAA,cAAA,CAAiE,IAAI;AAE3E,SAAS,uBAAuB;CAC9B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,iBAAiB;CAC5C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,2DAA2D;CAG7E,OAAO;AACT;AAEA,SAAS,YAAY,MAAY,OAAa;CAC5C,OAAO,KAAK,YAAY,MAAM,MAAM,YAAY,KAAK,KAAK,SAAS,MAAM,MAAM,SAAS;AAC1F;AAEA,SAAS,YAAe,OAA2B,QAAmC;CACpF,QAAQ,UAAoB;EAC1B,OAAO,KAAK;EACZ,IAAI,OAAO,UAAU,YACnB,MAAM,KAAK;OACN,IAAI,OACT,MAAM,UAAU;CAEpB;AACF;AAkCA,SAAgB,eAAe,EAC7B,UACA,gBAAgB,MAChB,eAAe,MACf,WAAW,OACX,gBACA,SAAS,SACT,SACA,SACA,MACA,eACA,eACA,cAAc,iBACd,OAAO,MACP,OAAO,iBACP,eAAe,GACf,YAAY,oBACZ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EL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACE,cAAYE,mBAAAA,iBAAiB,OAAO,MAAM;GAC1C,WAAW,OAAO;GAClB,aAAU;GACV,MAAK;aAEJ,KAAK,KAAK,SACT,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD,EAAqB,KAA2B,GAAhBP,mBAAAA,QAAQ,IAAI,CAAI,CACjD;EACE,CAAA,CACE;;AAEb,CACF;AAEA,MAAa,aAAa;CACxB,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,OAAO;CACP,QAAQ;CACR,SAAS;CACT,UAAU;CACV,MAAM;CACN,KAAK;CACL,UAAU;AACZ"}
|
|
1
|
+
{"version":3,"file":"date-picker.cjs","names":["startOfMonth","datePicker","isBeforeDay","isAfterDay","createCalendarDate","isSameDay","addDays","dateKey","addMonths","toTimeInput","formatDateLabel","BasePopover","toInputMonth","toInputDateTime","toInputDate","cx","withRecipeClassName","formatMonthLabel","getMonthLabels","getDateRangeLabel","getCalendarDays","getWeekdayLabels"],"sources":["../../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent, MouseEvent, ReactNode, Ref } from \"react\";\nimport type { PopoverRoot as BasePopoverRoot } from \"@base-ui/react/popover\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { datePicker } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport {\n addDays,\n addMonths,\n createCalendarDate,\n dateKey,\n formatDateLabel,\n formatMonthLabel,\n getCalendarDays,\n getDateRangeLabel,\n getMonthLabels,\n getWeekdayLabels,\n isAfterDay,\n isBeforeDay,\n isSameDay,\n startOfMonth,\n toInputDate,\n toInputDateTime,\n toInputMonth,\n toTimeInput,\n} from \"./date-utils\";\nimport type { DatePickerGranularity } from \"./date-utils\";\n\nexport type DatePickerSize = \"sm\" | \"md\" | \"lg\";\nexport type { DatePickerGranularity } from \"./date-utils\";\n\nexport interface DatePickerYearRange {\n start: number;\n end: number;\n}\n\ninterface DatePickerContextValue {\n canNavigate: (amount: number) => boolean;\n close: () => void;\n dateDisabled: (date: Date) => boolean;\n granularity: DatePickerGranularity;\n disabled: boolean;\n focusDate: (date: Date, direction?: number) => void;\n focusedDate: Date;\n formatDate: (date: Date | null) => string;\n labelId: string;\n locale: string;\n month: Date;\n monthDisabled: (date: Date) => boolean;\n onClear: () => void;\n onTimeChange: (value: string) => void;\n onSelect: (date: Date) => void;\n selectMonth: (month: number) => void;\n selectYear: (year: number) => void;\n placeholder: ReactNode;\n registerDay: (key: string, node: HTMLButtonElement | null) => void;\n selected: Date | null;\n setFocusedDate: (date: Date) => void;\n setMonth: (date: Date) => void;\n size: DatePickerSize;\n styles: ReturnType<typeof datePicker>;\n today: Date;\n timeMax: string | undefined;\n timeMin: string | undefined;\n triggerId: string;\n weekStartsOn: number;\n yearRange: DatePickerYearRange;\n}\n\nconst DatePickerContext = createContext<DatePickerContextValue | null>(null);\n\nfunction useDatePickerContext() {\n const context = useContext(DatePickerContext);\n if (!context) {\n throw new Error(\"DatePicker parts must be rendered inside DatePicker.Root.\");\n }\n\n return context;\n}\n\nfunction isSameMonth(left: Date, right: Date) {\n return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();\n}\n\nfunction composeRefs<T>(first: Ref<T> | undefined, second: (value: T | null) => void) {\n return (value: T | null) => {\n second(value);\n if (typeof first === \"function\") {\n first(value);\n } else if (first) {\n first.current = value;\n }\n };\n}\n\nexport interface DatePickerRootProps extends Omit<BasePopoverRoot.Props, \"children\"> {\n /** Selected value. Use together with `onValueChange` for a controlled picker. */\n value?: Date | null;\n /** Initial selected value for an uncontrolled picker. */\n defaultValue?: Date | null;\n /** Called after a valid day, month, or time is selected, or when the value is cleared. */\n onValueChange?: (value: Date | null) => void;\n /** Prevents dates before this local calendar day from being selected. */\n minDate?: Date;\n /** Prevents dates after this local calendar day from being selected. */\n maxDate?: Date;\n /** Adds application-specific disabled dates, such as holidays or weekends. */\n isDateDisabled?: (date: Date) => boolean;\n /** Locale used for month, weekday and value formatting. */\n locale?: string;\n /** Called after the visible calendar month changes. */\n onMonthChange?: (month: Date) => void;\n /** First weekday in the calendar, where 0 is Sunday and 1 is Monday. */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** Text shown when no date has been selected. */\n placeholder?: ReactNode;\n /** Shared visual size for the trigger and calendar days. */\n size?: DatePickerSize;\n /** Controls whether the picker selects days, months, or date and time. */\n granularity?: DatePickerGranularity;\n /** Inclusive range used by the year selector. */\n yearRange?: DatePickerYearRange;\n /** Adds a native hidden input using the representation for the selected granularity. */\n name?: string;\n /** Prevents interaction and disables the hidden form input. */\n disabled?: boolean;\n /** Closes the popup after a value is chosen. Defaults to false for date-time mode and true otherwise. */\n closeOnSelect?: boolean;\n children?: ReactNode;\n}\n\nexport function DatePickerRoot({\n children,\n closeOnSelect: closeOnSelectProp,\n defaultValue = null,\n disabled = false,\n granularity = \"day\",\n isDateDisabled,\n locale = \"pt-BR\",\n maxDate,\n minDate,\n name,\n onValueChange,\n onMonthChange,\n placeholder = \"Select a date\",\n size = \"md\",\n value: controlledValue,\n weekStartsOn = 0,\n yearRange: configuredYearRange,\n actionsRef: externalActionsRef,\n ...popoverProps\n}: DatePickerRootProps) {\n const [uncontrolledValue, setUncontrolledValue] = useState<Date | null>(defaultValue);\n const selected = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const [month, setMonthState] = useState(() => startOfMonth(selected ?? new Date()));\n const [focusedDate, setFocusedDate] = useState(selected ?? month);\n const previousMonthRef = useRef(month);\n const internalActionsRef = useRef<BasePopoverRoot.Actions | null>(null);\n const dayRefs = useRef(new Map<string, HTMLButtonElement>());\n const labelId = useId();\n const triggerId = useId();\n const today = useMemo(() => new Date(), []);\n const styles = datePicker({ size });\n const minMonth = minDate ? startOfMonth(minDate) : undefined;\n const maxMonth = maxDate ? startOfMonth(maxDate) : undefined;\n const closeOnSelect = closeOnSelectProp ?? granularity !== \"date-time\";\n const yearRange = useMemo(() => {\n const defaultStart = today.getFullYear() - 100;\n const defaultEnd = today.getFullYear() + 20;\n const start = configuredYearRange?.start ?? defaultStart;\n const end = configuredYearRange?.end ?? defaultEnd;\n const years = [selected?.getFullYear(), minDate?.getFullYear(), maxDate?.getFullYear()].filter(\n (year): year is number => year !== undefined,\n );\n return {\n end: Math.max(start, end, ...years),\n start: Math.min(start, end, ...years),\n };\n }, [configuredYearRange?.end, configuredYearRange?.start, maxDate, minDate, selected, today]);\n\n const clampMonth = useCallback(\n (nextMonth: Date) => {\n const normalized = startOfMonth(nextMonth);\n if (minMonth && isBeforeDay(normalized, minMonth)) return minMonth;\n if (maxMonth && isAfterDay(normalized, maxMonth)) return maxMonth;\n return normalized;\n },\n [maxMonth, minMonth],\n );\n\n const setMonth = useCallback(\n (nextMonth: Date) => {\n const normalized = clampMonth(nextMonth);\n setMonthState((current) => {\n if (isSameMonth(current, normalized)) return current;\n return normalized;\n });\n },\n [clampMonth],\n );\n\n useEffect(() => {\n if (isSameMonth(previousMonthRef.current, month)) return;\n previousMonthRef.current = month;\n onMonthChange?.(month);\n }, [month, onMonthChange]);\n\n useEffect(() => {\n if (!selected) {\n return;\n }\n\n setFocusedDate(selected);\n setMonthState((current) => (isSameMonth(current, selected) ? current : clampMonth(selected)));\n }, [clampMonth, selected]);\n\n const dateDisabled = useCallback(\n (date: Date) =>\n Boolean(\n (minDate && isBeforeDay(date, minDate)) ||\n (maxDate && isAfterDay(date, maxDate)) ||\n isDateDisabled?.(date),\n ),\n [isDateDisabled, maxDate, minDate],\n );\n\n const close = useCallback(() => {\n (externalActionsRef ?? internalActionsRef).current?.close();\n }, [externalActionsRef]);\n\n const setValue = useCallback(\n (nextValue: Date | null) => {\n setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n },\n [onValueChange],\n );\n\n const monthDisabled = useCallback(\n (candidate: Date) => {\n const firstDay = startOfMonth(candidate);\n const lastDay = createCalendarDate(candidate.getFullYear(), candidate.getMonth() + 1, 0);\n return Boolean(\n (minDate && isBeforeDay(lastDay, minDate)) || (maxDate && isAfterDay(firstDay, maxDate)),\n );\n },\n [maxDate, minDate],\n );\n\n const onSelect = useCallback(\n (date: Date) => {\n if (disabled || (granularity === \"month\" ? monthDisabled(date) : dateDisabled(date))) {\n return;\n }\n\n const nextValue = createCalendarDate(\n date.getFullYear(),\n date.getMonth(),\n granularity === \"month\" ? 1 : date.getDate(),\n );\n if (granularity === \"date-time\") {\n nextValue.setHours(selected?.getHours() ?? 12, selected?.getMinutes() ?? 0, 0, 0);\n if (minDate && isSameDay(nextValue, minDate) && nextValue < minDate) {\n nextValue.setHours(minDate.getHours(), minDate.getMinutes(), 0, 0);\n }\n if (maxDate && isSameDay(nextValue, maxDate) && nextValue > maxDate) {\n nextValue.setHours(maxDate.getHours(), maxDate.getMinutes(), 0, 0);\n }\n }\n setValue(nextValue);\n setFocusedDate(nextValue);\n setMonth(startOfMonth(nextValue));\n if (closeOnSelect) {\n close();\n }\n },\n [\n close,\n closeOnSelect,\n dateDisabled,\n disabled,\n granularity,\n maxDate,\n monthDisabled,\n minDate,\n selected,\n setMonth,\n setValue,\n ],\n );\n\n const onClear = useCallback(() => {\n setValue(null);\n }, [setValue]);\n\n const selectMonth = useCallback(\n (monthIndex: number) => {\n const nextMonth = clampMonth(createCalendarDate(month.getFullYear(), monthIndex, 1));\n if (monthDisabled(nextMonth)) return;\n setMonth(nextMonth);\n if (granularity === \"month\") {\n const nextValue = createCalendarDate(nextMonth.getFullYear(), nextMonth.getMonth(), 1);\n setFocusedDate(nextValue);\n setValue(nextValue);\n if (closeOnSelect) close();\n }\n },\n [clampMonth, close, closeOnSelect, granularity, month, monthDisabled, setMonth, setValue],\n );\n\n const selectYear = useCallback(\n (year: number) => {\n const nextMonth = clampMonth(createCalendarDate(year, month.getMonth(), 1));\n if (monthDisabled(nextMonth)) return;\n setMonth(nextMonth);\n if (granularity === \"month\") {\n const nextValue = createCalendarDate(nextMonth.getFullYear(), nextMonth.getMonth(), 1);\n setFocusedDate(nextValue);\n setValue(nextValue);\n if (closeOnSelect) close();\n }\n },\n [clampMonth, close, closeOnSelect, granularity, month, monthDisabled, setMonth, setValue],\n );\n\n const onTimeChange = useCallback(\n (value: string) => {\n const match = value.match(/^(\\d{2}):(\\d{2})$/);\n if (!match) return;\n const hours = Number(match[1]);\n const minutes = Number(match[2]);\n if (hours > 23 || minutes > 59) return;\n const baseDate = selected ?? focusedDate;\n const nextValue = createCalendarDate(\n baseDate.getFullYear(),\n baseDate.getMonth(),\n baseDate.getDate(),\n );\n nextValue.setHours(hours, minutes, 0, 0);\n if (minDate && isSameDay(nextValue, minDate) && nextValue < minDate) return;\n if (maxDate && isSameDay(nextValue, maxDate) && nextValue > maxDate) return;\n setValue(nextValue);\n },\n [focusedDate, maxDate, minDate, selected, setValue],\n );\n\n const focusDate = useCallback(\n (date: Date, direction = 1) => {\n let nextDate = createCalendarDate(date.getFullYear(), date.getMonth(), date.getDate());\n const step = direction < 0 ? -1 : 1;\n let attempts = 0;\n while (dateDisabled(nextDate) && attempts < 366) {\n nextDate = addDays(nextDate, step);\n attempts += 1;\n }\n\n setFocusedDate(nextDate);\n setMonth(nextDate);\n\n const focusTarget = () => dayRefs.current.get(dateKey(nextDate))?.focus();\n focusTarget();\n queueMicrotask(focusTarget);\n },\n [dateDisabled, setMonth],\n );\n\n const canNavigate = useCallback(\n (amount: number) => {\n const nextMonth = addMonths(month, amount);\n return !(\n (minMonth && isBeforeDay(nextMonth, minMonth)) ||\n (maxMonth && isAfterDay(nextMonth, maxMonth))\n );\n },\n [maxMonth, minMonth, month],\n );\n\n const registerDay = useCallback((key: string, node: HTMLButtonElement | null) => {\n if (node) {\n dayRefs.current.set(key, node);\n } else {\n dayRefs.current.delete(key);\n }\n }, []);\n\n const timeMin =\n selected && minDate && isSameDay(selected, minDate) ? toTimeInput(minDate) : undefined;\n const timeMax =\n selected && maxDate && isSameDay(selected, maxDate) ? toTimeInput(maxDate) : undefined;\n\n const context: DatePickerContextValue = {\n canNavigate,\n close,\n dateDisabled,\n granularity,\n disabled,\n focusDate,\n focusedDate,\n formatDate: (date) => formatDateLabel(date, locale, String(placeholder), granularity),\n labelId,\n locale,\n month,\n monthDisabled,\n onClear,\n onTimeChange,\n onSelect,\n selectMonth,\n selectYear,\n placeholder,\n registerDay,\n selected,\n setFocusedDate,\n setMonth,\n size,\n styles,\n today: createCalendarDate(today.getFullYear(), today.getMonth(), today.getDate()),\n timeMax,\n timeMin,\n triggerId,\n weekStartsOn,\n yearRange,\n };\n\n return (\n <DatePickerContext.Provider value={context}>\n <BasePopover.Root {...popoverProps} actionsRef={externalActionsRef ?? internalActionsRef}>\n {children}\n </BasePopover.Root>\n {name ? (\n <input\n disabled={disabled}\n name={name}\n type=\"hidden\"\n value={\n granularity === \"month\"\n ? toInputMonth(selected)\n : granularity === \"date-time\"\n ? toInputDateTime(selected)\n : toInputDate(selected)\n }\n />\n ) : null}\n </DatePickerContext.Provider>\n );\n}\n\nexport type DatePickerLabelProps = ComponentPropsWithoutRef<\"label\">;\n\nexport const DatePickerLabel = forwardRef<HTMLLabelElement, DatePickerLabelProps>(\n function DatePickerLabel({ children, className, ...props }, ref) {\n const { labelId, styles, triggerId } = useDatePickerContext();\n\n return (\n <label\n {...props}\n ref={ref}\n className={cx(styles.label, className)}\n data-slot=\"date-picker-label\"\n htmlFor={props.htmlFor ?? triggerId}\n id={props.id ?? labelId}\n >\n {children}\n </label>\n );\n },\n);\n\nexport type DatePickerControlProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DatePickerControl = forwardRef<HTMLDivElement, DatePickerControlProps>(\n function DatePickerControl({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <div\n {...props}\n ref={ref}\n className={cx(styles.control, className)}\n data-jaci-component=\"date-picker\"\n data-slot=\"date-picker-control\"\n />\n );\n },\n);\n\nexport type DatePickerTriggerProps = ComponentPropsWithoutRef<typeof BasePopover.Trigger>;\n\nexport const DatePickerTrigger = forwardRef<HTMLButtonElement, DatePickerTriggerProps>(\n function DatePickerTrigger({ children, className, disabled, id, ...props }, ref) {\n const { disabled: pickerDisabled, styles, triggerId } = useDatePickerContext();\n\n return (\n <BasePopover.Trigger\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Choose date\"}\n disabled={disabled ?? pickerDisabled}\n id={id ?? triggerId}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-jaci-component=\"date-picker\"\n data-slot=\"date-picker-trigger\"\n >\n {children ?? (\n <>\n <DatePickerValue />\n <span aria-hidden=\"true\">▾</span>\n </>\n )}\n </BasePopover.Trigger>\n );\n },\n);\n\nexport interface DatePickerValueProps extends ComponentPropsWithoutRef<\"span\"> {\n placeholder?: ReactNode;\n}\n\nexport const DatePickerValue = forwardRef<HTMLSpanElement, DatePickerValueProps>(\n function DatePickerValue({ children, className, placeholder, ...props }, ref) {\n const { formatDate, selected, styles } = useDatePickerContext();\n const value = children ?? (selected ? formatDate(selected) : (placeholder ?? \"Select a date\"));\n\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.value, className)}\n data-placeholder={selected ? undefined : \"true\"}\n data-slot=\"date-picker-value\"\n >\n {value}\n </span>\n );\n },\n);\n\nexport type DatePickerClearProps = ComponentPropsWithoutRef<\"button\">;\n\nexport const DatePickerClear = forwardRef<HTMLButtonElement, DatePickerClearProps>(\n function DatePickerClear({ children = \"×\", className, disabled, onClick, ...props }, ref) {\n const { close, disabled: pickerDisabled, onClear, selected, styles } = useDatePickerContext();\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClear();\n onClick?.(event);\n close();\n };\n\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Clear date\"}\n className={cx(styles.clear, className)}\n data-slot=\"date-picker-clear\"\n disabled={disabled || pickerDisabled || !selected}\n onClick={handleClick}\n ref={ref}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nexport type DatePickerPortalProps = ComponentPropsWithoutRef<typeof BasePopover.Portal>;\nexport const DatePickerPortal: typeof BasePopover.Portal = BasePopover.Portal;\n\nexport type DatePickerPositionerProps = ComponentPropsWithoutRef<typeof BasePopover.Positioner>;\n\nexport const DatePickerPositioner = forwardRef<HTMLDivElement, DatePickerPositionerProps>(\n function DatePickerPositioner({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <BasePopover.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.positioner, className)}\n data-slot=\"date-picker-positioner\"\n />\n );\n },\n);\n\nexport type DatePickerPopupProps = ComponentPropsWithoutRef<typeof BasePopover.Popup>;\n\nexport const DatePickerPopup = forwardRef<HTMLDivElement, DatePickerPopupProps>(\n function DatePickerPopup({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <BasePopover.Popup\n {...props}\n ref={ref}\n aria-label={props[\"aria-label\"] ?? \"Calendar\"}\n className={withRecipeClassName(styles.popup, className)}\n data-slot=\"date-picker-popup\"\n />\n );\n },\n);\n\nexport type DatePickerCloseProps = ComponentPropsWithoutRef<typeof BasePopover.Close>;\n\nexport const DatePickerClose = forwardRef<HTMLButtonElement, DatePickerCloseProps>(\n function DatePickerClose({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <BasePopover.Close\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.close, className)}\n data-slot=\"date-picker-close\"\n />\n );\n },\n);\n\nexport type DatePickerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DatePickerHeader = forwardRef<HTMLDivElement, DatePickerHeaderProps>(\n function DatePickerHeader({ className, ...props }, ref) {\n const { styles } = useDatePickerContext();\n\n return (\n <div\n {...props}\n ref={ref}\n className={cx(styles.header, className)}\n data-slot=\"date-picker-header\"\n />\n );\n },\n);\n\nexport type DatePickerCaptionProps = ComponentPropsWithoutRef<\"span\">;\n\nexport const DatePickerCaption = forwardRef<HTMLSpanElement, DatePickerCaptionProps>(\n function DatePickerCaption({ children, className, ...props }, ref) {\n const { locale, month, styles } = useDatePickerContext();\n\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"date-picker-caption\"\n >\n {children ?? formatMonthLabel(month, locale)}\n </span>\n );\n },\n);\n\nexport type DatePickerMonthSelectProps = Omit<\n ComponentPropsWithoutRef<\"select\">,\n \"children\" | \"onChange\" | \"value\"\n>;\n\nexport const DatePickerMonthSelect = forwardRef<HTMLSelectElement, DatePickerMonthSelectProps>(\n function DatePickerMonthSelect({ className, ...props }, ref) {\n const { locale, month, monthDisabled, selectMonth, styles } = useDatePickerContext();\n const labels = getMonthLabels(locale);\n\n return (\n <select\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select month\"}\n className={cx(styles.monthSelect, className)}\n data-slot=\"date-picker-month-select\"\n onChange={(event) => selectMonth(Number(event.currentTarget.value))}\n ref={ref}\n value={month.getMonth()}\n >\n {labels.map((label, monthIndex) => (\n <option\n disabled={monthDisabled(createCalendarDate(month.getFullYear(), monthIndex, 1))}\n key={label}\n value={monthIndex}\n >\n {label}\n </option>\n ))}\n </select>\n );\n },\n);\n\nexport type DatePickerYearSelectProps = Omit<\n ComponentPropsWithoutRef<\"select\">,\n \"children\" | \"onChange\" | \"value\"\n>;\n\nexport const DatePickerYearSelect = forwardRef<HTMLSelectElement, DatePickerYearSelectProps>(\n function DatePickerYearSelect({ className, ...props }, ref) {\n const { month, monthDisabled, selectYear, styles, yearRange } = useDatePickerContext();\n const years = Array.from(\n { length: yearRange.end - yearRange.start + 1 },\n (_, index) => yearRange.start + index,\n );\n\n return (\n <select\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select year\"}\n className={cx(styles.yearSelect, className)}\n data-slot=\"date-picker-year-select\"\n onChange={(event) => selectYear(Number(event.currentTarget.value))}\n ref={ref}\n value={month.getFullYear()}\n >\n {years.map((year) => (\n <option\n disabled={monthDisabled(createCalendarDate(year, month.getMonth(), 1))}\n key={year}\n value={year}\n >\n {year}\n </option>\n ))}\n </select>\n );\n },\n);\n\nexport type DatePickerTimeFieldProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"onChange\" | \"type\" | \"value\"\n>;\n\nexport const DatePickerTimeField = forwardRef<HTMLInputElement, DatePickerTimeFieldProps>(\n function DatePickerTimeField({ className, ...props }, ref) {\n const { disabled, granularity, onTimeChange, selected, styles, timeMax, timeMin } =\n useDatePickerContext();\n if (granularity !== \"date-time\") return null;\n\n return (\n <input\n {...props}\n aria-label={props[\"aria-label\"] ?? \"Select time\"}\n className={cx(styles.timeField, className)}\n data-slot=\"date-picker-time-field\"\n disabled={disabled || !selected}\n max={timeMax}\n min={timeMin}\n onChange={(event) => onTimeChange(event.currentTarget.value)}\n ref={ref}\n type=\"time\"\n value={toTimeInput(selected)}\n />\n );\n },\n);\n\nexport interface DatePickerNavigationProps extends ComponentPropsWithoutRef<\"button\"> {\n amount?: number;\n}\n\nconst DatePickerNavigationButton = forwardRef<HTMLButtonElement, DatePickerNavigationProps>(\n function DatePickerNavigationButton({ amount, children, className, onClick, ...props }, ref) {\n const { canNavigate, month, setMonth, styles } = useDatePickerContext();\n const direction = amount ?? 1;\n const isDisabled = props.disabled || !canNavigate(direction);\n\n return (\n <button\n {...props}\n aria-label={props[\"aria-label\"] ?? (direction < 0 ? \"Previous month\" : \"Next month\")}\n className={cx(styles.navigation, className)}\n data-slot={direction < 0 ? \"date-picker-previous\" : \"date-picker-next\"}\n disabled={isDisabled}\n onClick={(event) => {\n if (!isDisabled) setMonth(addMonths(month, direction));\n onClick?.(event);\n }}\n ref={ref}\n type=\"button\"\n >\n {children ?? (direction < 0 ? \"‹\" : \"›\")}\n </button>\n );\n },\n);\n\nexport const DatePickerPrevious = forwardRef<HTMLButtonElement, DatePickerNavigationProps>(\n function DatePickerPrevious(props, ref) {\n return <DatePickerNavigationButton {...props} amount={-1} ref={ref} />;\n },\n);\n\nexport const DatePickerNext = forwardRef<HTMLButtonElement, DatePickerNavigationProps>(\n function DatePickerNext(props, ref) {\n return <DatePickerNavigationButton {...props} amount={1} ref={ref} />;\n },\n);\n\nexport interface DatePickerDayProps extends Omit<ComponentPropsWithoutRef<\"button\">, \"value\"> {\n date: Date;\n}\n\nexport const DatePickerDay = forwardRef<HTMLButtonElement, DatePickerDayProps>(\n function DatePickerDay(\n { children, className, date, disabled, onClick, onKeyDown, ...props },\n ref,\n ) {\n const {\n dateDisabled,\n disabled: pickerDisabled,\n focusDate,\n focusedDate,\n locale,\n month,\n onSelect,\n registerDay,\n selected,\n styles,\n today,\n } = useDatePickerContext();\n const key = dateKey(date);\n const outsideMonth = !isSameMonth(date, month);\n const isDisabled = disabled || pickerDisabled || dateDisabled(date);\n const isFocused = isSameDay(date, focusedDate);\n const isSelected = isSameDay(date, selected);\n const isToday = isSameDay(date, today);\n const dayRef = composeRefs(ref, (node) => registerDay(key, node));\n\n const moveByKey = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.defaultPrevented) {\n return;\n }\n\n let nextDate: Date | undefined;\n switch (event.key) {\n case \"ArrowLeft\":\n nextDate = addDays(date, -1);\n break;\n case \"ArrowRight\":\n nextDate = addDays(date, 1);\n break;\n case \"ArrowUp\":\n nextDate = addDays(date, -7);\n break;\n case \"ArrowDown\":\n nextDate = addDays(date, 7);\n break;\n case \"Home\":\n nextDate = addDays(date, -date.getDay());\n break;\n case \"End\":\n nextDate = addDays(date, 6 - date.getDay());\n break;\n case \"PageUp\":\n nextDate = addMonths(date, event.shiftKey ? -12 : -1);\n break;\n case \"PageDown\":\n nextDate = addMonths(date, event.shiftKey ? 12 : 1);\n break;\n case \"Enter\":\n case \" \":\n if (!isDisabled) {\n event.preventDefault();\n onSelect(date);\n }\n break;\n default:\n break;\n }\n\n if (nextDate) {\n event.preventDefault();\n focusDate(nextDate, nextDate < date ? -1 : 1);\n }\n };\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: A calendar day is an interactive gridcell, not a generic table cell.\n <button\n {...props}\n ref={dayRef}\n aria-label={props[\"aria-label\"] ?? getDateRangeLabel(date, locale)}\n aria-current={isToday ? \"date\" : undefined}\n aria-selected={isSelected}\n className={cx(styles.day, className)}\n data-date={key}\n data-disabled={isDisabled || undefined}\n data-outside-month={outsideMonth || undefined}\n data-selected={isSelected || undefined}\n data-slot=\"date-picker-day\"\n data-today={isToday || undefined}\n disabled={isDisabled}\n onClick={(event) => {\n onSelect(date);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n moveByKey(event);\n onKeyDown?.(event);\n }}\n role=\"gridcell\"\n tabIndex={isFocused && !isDisabled ? 0 : -1}\n type=\"button\"\n >\n {children ?? date.getDate()}\n </button>\n );\n },\n);\n\ninterface DatePickerMonthButtonProps {\n date: Date;\n}\n\nconst DatePickerMonthButton = forwardRef<HTMLButtonElement, DatePickerMonthButtonProps>(\n function DatePickerMonthButton({ date }, ref) {\n const { disabled, granularity, locale, monthDisabled, onSelect, selected, styles } =\n useDatePickerContext();\n const isDisabled = disabled || monthDisabled(date);\n const isSelected = granularity === \"month\" && Boolean(selected && isSameMonth(selected, date));\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: Month choices use the calendar gridcell pattern.\n <button\n aria-label={new Intl.DateTimeFormat(locale, { month: \"long\" }).format(date)}\n aria-selected={isSelected}\n className={styles.month}\n data-disabled={isDisabled || undefined}\n data-selected={isSelected || undefined}\n data-slot=\"date-picker-month\"\n disabled={isDisabled}\n onClick={() => onSelect(date)}\n ref={ref}\n role=\"gridcell\"\n type=\"button\"\n >\n {new Intl.DateTimeFormat(locale, { month: \"short\" }).format(date)}\n </button>\n );\n },\n);\n\nexport interface DatePickerCalendarProps\n extends Omit<ComponentPropsWithoutRef<\"section\">, \"children\"> {\n \"aria-label\"?: string;\n}\n\nexport const DatePickerCalendar = forwardRef<HTMLElement, DatePickerCalendarProps>(\n function DatePickerCalendar({ \"aria-label\": ariaLabel, className, ...props }, ref) {\n const { granularity, locale, month, styles, weekStartsOn } = useDatePickerContext();\n const days = useMemo(() => getCalendarDays(month, weekStartsOn), [month, weekStartsOn]);\n const weekdays = useMemo(() => getWeekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);\n const monthDates = useMemo(\n () =>\n Array.from({ length: 12 }, (_, index) => createCalendarDate(month.getFullYear(), index, 1)),\n [month],\n );\n\n return (\n <section\n {...props}\n ref={ref}\n aria-label={ariaLabel ?? formatMonthLabel(month, locale)}\n className={cx(styles.calendar, className)}\n data-granularity={granularity}\n data-slot=\"date-picker-calendar\"\n >\n {granularity === \"month\" ? (\n // biome-ignore lint/a11y/useSemanticElements: Month selection uses the calendar grid pattern.\n <div\n aria-label={String(month.getFullYear())}\n className={styles.monthGrid}\n data-slot=\"date-picker-month-grid\"\n role=\"grid\"\n >\n {monthDates.map((date) => (\n <DatePickerMonthButton date={date} key={dateKey(date)} />\n ))}\n </div>\n ) : (\n <>\n <div aria-hidden=\"true\" className={styles.weekdays} data-slot=\"date-picker-weekdays\">\n {weekdays.map((weekday) => (\n <span className={styles.weekday} data-slot=\"date-picker-weekday\" key={weekday}>\n {weekday}\n </span>\n ))}\n </div>\n {/* biome-ignore lint/a11y/useSemanticElements: Calendar grids use the WAI-ARIA grid pattern for roving day focus. */}\n <div\n aria-label={formatMonthLabel(month, locale)}\n className={styles.grid}\n data-slot=\"date-picker-grid\"\n role=\"grid\"\n >\n {days.map((date) => (\n <DatePickerDay date={date} key={dateKey(date)} />\n ))}\n </div>\n </>\n )}\n </section>\n );\n },\n);\n\nexport const DatePicker = {\n Root: DatePickerRoot,\n Label: DatePickerLabel,\n Control: DatePickerControl,\n Trigger: DatePickerTrigger,\n Value: DatePickerValue,\n Clear: DatePickerClear,\n Portal: DatePickerPortal,\n Positioner: DatePickerPositioner,\n Popup: DatePickerPopup,\n Close: DatePickerClose,\n Header: DatePickerHeader,\n Caption: DatePickerCaption,\n MonthSelect: DatePickerMonthSelect,\n YearSelect: DatePickerYearSelect,\n TimeField: DatePickerTimeField,\n Previous: DatePickerPrevious,\n Next: DatePickerNext,\n Day: DatePickerDay,\n Calendar: DatePickerCalendar,\n};\n"],"mappings":";;;;;;;;;AAmFA,MAAM,qBAAA,GAAA,MAAA,cAAA,CAAiE,IAAI;AAE3E,SAAS,uBAAuB;CAC9B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,iBAAiB;CAC5C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,2DAA2D;CAG7E,OAAO;AACT;AAEA,SAAS,YAAY,MAAY,OAAa;CAC5C,OAAO,KAAK,YAAY,MAAM,MAAM,YAAY,KAAK,KAAK,SAAS,MAAM,MAAM,SAAS;AAC1F;AAEA,SAAS,YAAe,OAA2B,QAAmC;CACpF,QAAQ,UAAoB;EAC1B,OAAO,KAAK;EACZ,IAAI,OAAO,UAAU,YACnB,MAAM,KAAK;OACN,IAAI,OACT,MAAM,UAAU;CAEpB;AACF;AAsCA,SAAgB,eAAe,EAC7B,UACA,eAAe,mBACf,eAAe,MACf,WAAW,OACX,cAAc,OACd,gBACA,SAAS,SACT,SACA,SACA,MACA,eACA,eACA,cAAc,iBACd,OAAO,MACP,OAAO,iBACP,eAAe,GACf,WAAW,qBACX,YAAY,oBACZ,GAAG,gBACmB;CACtB,MAAM,CAAC,mBAAmB,yBAAA,GAAA,MAAA,SAAA,CAA8C,YAAY;CACpF,MAAM,WAAW,oBAAoB,KAAA,IAAY,oBAAoB;CACrE,MAAM,CAAC,OAAO,kBAAA,GAAA,MAAA,SAAA,OAAgCA,mBAAAA,aAAa,4BAAY,IAAI,KAAK,CAAC,CAAC;CAClF,MAAM,CAAC,aAAa,mBAAA,GAAA,MAAA,SAAA,CAA2B,YAAY,KAAK;CAChE,MAAM,oBAAA,GAAA,MAAA,OAAA,CAA0B,KAAK;CACrC,MAAM,sBAAA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CACZ,WAAW;CACX,UAAU;CACV,MAAM;CACN,KAAK;CACL,UAAU;AACZ"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { DatePickerGranularity } from "./date-utils.cjs";
|
|
1
2
|
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
3
|
import { Popover, PopoverRoot } from "@base-ui/react/popover";
|
|
3
4
|
//#region src/components/date-picker/date-picker.d.ts
|
|
4
5
|
type DatePickerSize = "sm" | "md" | "lg";
|
|
6
|
+
interface DatePickerYearRange {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
}
|
|
5
10
|
interface DatePickerRootProps extends Omit<PopoverRoot.Props, "children"> {
|
|
6
11
|
/** Selected value. Use together with `onValueChange` for a controlled picker. */
|
|
7
12
|
value?: Date | null;
|
|
8
13
|
/** Initial selected value for an uncontrolled picker. */
|
|
9
14
|
defaultValue?: Date | null;
|
|
10
|
-
/** Called after a valid day is selected, or when the value is cleared. */
|
|
15
|
+
/** Called after a valid day, month, or time is selected, or when the value is cleared. */
|
|
11
16
|
onValueChange?: (value: Date | null) => void;
|
|
12
17
|
/** Prevents dates before this local calendar day from being selected. */
|
|
13
18
|
minDate?: Date;
|
|
@@ -25,15 +30,19 @@ interface DatePickerRootProps extends Omit<PopoverRoot.Props, "children"> {
|
|
|
25
30
|
placeholder?: ReactNode;
|
|
26
31
|
/** Shared visual size for the trigger and calendar days. */
|
|
27
32
|
size?: DatePickerSize;
|
|
28
|
-
/**
|
|
33
|
+
/** Controls whether the picker selects days, months, or date and time. */
|
|
34
|
+
granularity?: DatePickerGranularity;
|
|
35
|
+
/** Inclusive range used by the year selector. */
|
|
36
|
+
yearRange?: DatePickerYearRange;
|
|
37
|
+
/** Adds a native hidden input using the representation for the selected granularity. */
|
|
29
38
|
name?: string;
|
|
30
39
|
/** Prevents interaction and disables the hidden form input. */
|
|
31
40
|
disabled?: boolean;
|
|
32
|
-
/** Closes the popup after a
|
|
41
|
+
/** Closes the popup after a value is chosen. Defaults to false for date-time mode and true otherwise. */
|
|
33
42
|
closeOnSelect?: boolean;
|
|
34
43
|
children?: ReactNode;
|
|
35
44
|
}
|
|
36
|
-
declare function DatePickerRoot({ children, closeOnSelect, defaultValue, disabled, isDateDisabled, locale, maxDate, minDate, name, onValueChange, onMonthChange, placeholder, size, value: controlledValue, weekStartsOn, actionsRef: externalActionsRef, ...popoverProps }: DatePickerRootProps): import("react").JSX.Element;
|
|
45
|
+
declare function DatePickerRoot({ children, closeOnSelect: closeOnSelectProp, defaultValue, disabled, granularity, isDateDisabled, locale, maxDate, minDate, name, onValueChange, onMonthChange, placeholder, size, value: controlledValue, weekStartsOn, yearRange: configuredYearRange, actionsRef: externalActionsRef, ...popoverProps }: DatePickerRootProps): import("react").JSX.Element;
|
|
37
46
|
type DatePickerLabelProps = ComponentPropsWithoutRef<"label">;
|
|
38
47
|
declare const DatePickerLabel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
39
48
|
type DatePickerControlProps = ComponentPropsWithoutRef<"div">;
|
|
@@ -70,6 +79,12 @@ type DatePickerHeaderProps = ComponentPropsWithoutRef<"div">;
|
|
|
70
79
|
declare const DatePickerHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
71
80
|
type DatePickerCaptionProps = ComponentPropsWithoutRef<"span">;
|
|
72
81
|
declare const DatePickerCaption: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
82
|
+
type DatePickerMonthSelectProps = Omit<ComponentPropsWithoutRef<"select">, "children" | "onChange" | "value">;
|
|
83
|
+
declare const DatePickerMonthSelect: import("react").ForwardRefExoticComponent<DatePickerMonthSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
84
|
+
type DatePickerYearSelectProps = Omit<ComponentPropsWithoutRef<"select">, "children" | "onChange" | "value">;
|
|
85
|
+
declare const DatePickerYearSelect: import("react").ForwardRefExoticComponent<DatePickerYearSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
86
|
+
type DatePickerTimeFieldProps = Omit<ComponentPropsWithoutRef<"input">, "onChange" | "type" | "value">;
|
|
87
|
+
declare const DatePickerTimeField: import("react").ForwardRefExoticComponent<DatePickerTimeFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
73
88
|
interface DatePickerNavigationProps extends ComponentPropsWithoutRef<"button"> {
|
|
74
89
|
amount?: number;
|
|
75
90
|
}
|
|
@@ -108,11 +123,14 @@ declare const DatePicker: {
|
|
|
108
123
|
Close: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
109
124
|
Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
110
125
|
Caption: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
126
|
+
MonthSelect: import("react").ForwardRefExoticComponent<DatePickerMonthSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
127
|
+
YearSelect: import("react").ForwardRefExoticComponent<DatePickerYearSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
128
|
+
TimeField: import("react").ForwardRefExoticComponent<DatePickerTimeFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
111
129
|
Previous: import("react").ForwardRefExoticComponent<DatePickerNavigationProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
112
130
|
Next: import("react").ForwardRefExoticComponent<DatePickerNavigationProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
113
131
|
Day: import("react").ForwardRefExoticComponent<DatePickerDayProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
114
132
|
Calendar: import("react").ForwardRefExoticComponent<DatePickerCalendarProps & import("react").RefAttributes<HTMLElement>>;
|
|
115
133
|
};
|
|
116
134
|
//#endregion
|
|
117
|
-
export { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps };
|
|
135
|
+
export { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, type DatePickerGranularity, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerMonthSelect, DatePickerMonthSelectProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTimeField, DatePickerTimeFieldProps, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps, DatePickerYearRange, DatePickerYearSelect, DatePickerYearSelectProps };
|
|
118
136
|
//# sourceMappingURL=date-picker.d.cts.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { DatePickerGranularity } from "./date-utils.js";
|
|
1
2
|
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
3
|
import { Popover, PopoverRoot } from "@base-ui/react/popover";
|
|
3
4
|
//#region src/components/date-picker/date-picker.d.ts
|
|
4
5
|
type DatePickerSize = "sm" | "md" | "lg";
|
|
6
|
+
interface DatePickerYearRange {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
}
|
|
5
10
|
interface DatePickerRootProps extends Omit<PopoverRoot.Props, "children"> {
|
|
6
11
|
/** Selected value. Use together with `onValueChange` for a controlled picker. */
|
|
7
12
|
value?: Date | null;
|
|
8
13
|
/** Initial selected value for an uncontrolled picker. */
|
|
9
14
|
defaultValue?: Date | null;
|
|
10
|
-
/** Called after a valid day is selected, or when the value is cleared. */
|
|
15
|
+
/** Called after a valid day, month, or time is selected, or when the value is cleared. */
|
|
11
16
|
onValueChange?: (value: Date | null) => void;
|
|
12
17
|
/** Prevents dates before this local calendar day from being selected. */
|
|
13
18
|
minDate?: Date;
|
|
@@ -25,15 +30,19 @@ interface DatePickerRootProps extends Omit<PopoverRoot.Props, "children"> {
|
|
|
25
30
|
placeholder?: ReactNode;
|
|
26
31
|
/** Shared visual size for the trigger and calendar days. */
|
|
27
32
|
size?: DatePickerSize;
|
|
28
|
-
/**
|
|
33
|
+
/** Controls whether the picker selects days, months, or date and time. */
|
|
34
|
+
granularity?: DatePickerGranularity;
|
|
35
|
+
/** Inclusive range used by the year selector. */
|
|
36
|
+
yearRange?: DatePickerYearRange;
|
|
37
|
+
/** Adds a native hidden input using the representation for the selected granularity. */
|
|
29
38
|
name?: string;
|
|
30
39
|
/** Prevents interaction and disables the hidden form input. */
|
|
31
40
|
disabled?: boolean;
|
|
32
|
-
/** Closes the popup after a
|
|
41
|
+
/** Closes the popup after a value is chosen. Defaults to false for date-time mode and true otherwise. */
|
|
33
42
|
closeOnSelect?: boolean;
|
|
34
43
|
children?: ReactNode;
|
|
35
44
|
}
|
|
36
|
-
declare function DatePickerRoot({ children, closeOnSelect, defaultValue, disabled, isDateDisabled, locale, maxDate, minDate, name, onValueChange, onMonthChange, placeholder, size, value: controlledValue, weekStartsOn, actionsRef: externalActionsRef, ...popoverProps }: DatePickerRootProps): import("react").JSX.Element;
|
|
45
|
+
declare function DatePickerRoot({ children, closeOnSelect: closeOnSelectProp, defaultValue, disabled, granularity, isDateDisabled, locale, maxDate, minDate, name, onValueChange, onMonthChange, placeholder, size, value: controlledValue, weekStartsOn, yearRange: configuredYearRange, actionsRef: externalActionsRef, ...popoverProps }: DatePickerRootProps): import("react").JSX.Element;
|
|
37
46
|
type DatePickerLabelProps = ComponentPropsWithoutRef<"label">;
|
|
38
47
|
declare const DatePickerLabel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
39
48
|
type DatePickerControlProps = ComponentPropsWithoutRef<"div">;
|
|
@@ -70,6 +79,12 @@ type DatePickerHeaderProps = ComponentPropsWithoutRef<"div">;
|
|
|
70
79
|
declare const DatePickerHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
71
80
|
type DatePickerCaptionProps = ComponentPropsWithoutRef<"span">;
|
|
72
81
|
declare const DatePickerCaption: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
82
|
+
type DatePickerMonthSelectProps = Omit<ComponentPropsWithoutRef<"select">, "children" | "onChange" | "value">;
|
|
83
|
+
declare const DatePickerMonthSelect: import("react").ForwardRefExoticComponent<DatePickerMonthSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
84
|
+
type DatePickerYearSelectProps = Omit<ComponentPropsWithoutRef<"select">, "children" | "onChange" | "value">;
|
|
85
|
+
declare const DatePickerYearSelect: import("react").ForwardRefExoticComponent<DatePickerYearSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
86
|
+
type DatePickerTimeFieldProps = Omit<ComponentPropsWithoutRef<"input">, "onChange" | "type" | "value">;
|
|
87
|
+
declare const DatePickerTimeField: import("react").ForwardRefExoticComponent<DatePickerTimeFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
73
88
|
interface DatePickerNavigationProps extends ComponentPropsWithoutRef<"button"> {
|
|
74
89
|
amount?: number;
|
|
75
90
|
}
|
|
@@ -108,11 +123,14 @@ declare const DatePicker: {
|
|
|
108
123
|
Close: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
109
124
|
Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
110
125
|
Caption: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
126
|
+
MonthSelect: import("react").ForwardRefExoticComponent<DatePickerMonthSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
127
|
+
YearSelect: import("react").ForwardRefExoticComponent<DatePickerYearSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
128
|
+
TimeField: import("react").ForwardRefExoticComponent<DatePickerTimeFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
111
129
|
Previous: import("react").ForwardRefExoticComponent<DatePickerNavigationProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
112
130
|
Next: import("react").ForwardRefExoticComponent<DatePickerNavigationProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
113
131
|
Day: import("react").ForwardRefExoticComponent<DatePickerDayProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
114
132
|
Calendar: import("react").ForwardRefExoticComponent<DatePickerCalendarProps & import("react").RefAttributes<HTMLElement>>;
|
|
115
133
|
};
|
|
116
134
|
//#endregion
|
|
117
|
-
export { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps };
|
|
135
|
+
export { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, type DatePickerGranularity, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerMonthSelect, DatePickerMonthSelectProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTimeField, DatePickerTimeFieldProps, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps, DatePickerYearRange, DatePickerYearSelect, DatePickerYearSelectProps };
|
|
118
136
|
//# sourceMappingURL=date-picker.d.ts.map
|