@allxsmith/bestax-bulma 5.66.1 → 5.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/Command.js.map +1 -1
- package/dist/esm/components/HoverCard.js.map +1 -1
- package/dist/esm/components/Loading.js +3 -3
- package/dist/esm/components/Loading.js.map +1 -1
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/Sidebar.js +21 -29
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/components/Toast.js +6 -8
- package/dist/esm/components/Toast.js.map +1 -1
- package/dist/esm/elements/IconButton.js.map +1 -1
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/TreeSelect.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +12 -5
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +6 -2
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/helpers/scrollLock.js +47 -11
- package/dist/esm/helpers/scrollLock.js.map +1 -1
- package/dist/esm/helpers/useAnchoredPosition.js +35 -11
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
- package/dist/esm/layout/Level.js +2 -2
- package/dist/esm/layout/Level.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +128 -65
- package/dist/index.cjs.map +1 -1
- package/dist/types/components/Command.d.ts +5 -5
- package/dist/types/components/HoverCard.d.ts +2 -4
- package/dist/types/components/Modal.d.ts +6 -3
- package/dist/types/components/Popover.d.ts +1 -3
- package/dist/types/components/Sidebar.d.ts +6 -2
- package/dist/types/components/Toast.d.ts +3 -1
- package/dist/types/elements/IconButton.d.ts +2 -5
- package/dist/types/form/Combobox.d.ts +13 -13
- package/dist/types/form/DateInputBase.d.ts +8 -1
- package/dist/types/form/DateRangeInputBase.d.ts +5 -0
- package/dist/types/form/DateTimeInputBase.d.ts +8 -1
- package/dist/types/form/TreeSelect.d.ts +4 -4
- package/dist/types/helpers/scrollLock.d.ts +4 -4
- package/dist/types/helpers/useAnchoredPosition.d.ts +14 -12
- package/dist/types/layout/Level.d.ts +10 -0
- package/dist/types-cjs/components/Command.d.ts +5 -5
- package/dist/types-cjs/components/HoverCard.d.ts +2 -4
- package/dist/types-cjs/components/Modal.d.ts +6 -3
- package/dist/types-cjs/components/Popover.d.ts +1 -3
- package/dist/types-cjs/components/Sidebar.d.ts +6 -2
- package/dist/types-cjs/components/Toast.d.ts +3 -1
- package/dist/types-cjs/elements/IconButton.d.ts +2 -5
- package/dist/types-cjs/form/Combobox.d.ts +13 -13
- package/dist/types-cjs/form/DateInputBase.d.ts +8 -1
- package/dist/types-cjs/form/DateRangeInputBase.d.ts +5 -0
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +8 -1
- package/dist/types-cjs/form/TreeSelect.d.ts +4 -4
- package/dist/types-cjs/helpers/scrollLock.d.ts +4 -4
- package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +14 -12
- package/dist/types-cjs/layout/Level.d.ts +10 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/CLAUDE.md +25 -2
- package/src/scss/components/_index.scss +1 -0
- package/src/scss/components/_loading.scss +17 -3
- package/src/scss/components/_navbar.scss +20 -0
- package/src/scss/form/_radio.scss +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInputBase.js","sources":["../../../src/form/DateTimeInputBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n PickerPosition,\n HourFormat,\n DayOfWeek,\n PickerLabels,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n formatDateTime,\n formatTime,\n hourCycleFromFormat,\n parseDate,\n DateFormatOption,\n DEFAULT_DATETIME_FORMAT,\n} from './_pickerInternals/formatters';\nimport {\n isWithin,\n setTimeOfDay,\n clampDate,\n FIRST_YEAR,\n floorMin,\n isSameDay,\n makeDate,\n} from './_pickerInternals/dateUtils';\nimport { Calendar, CALENDAR_FOCUSED_CELL } from './_pickerInternals/Calendar';\nimport { TimeWheels } from './_pickerInternals/TimeWheels';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport {\n hasOwnDayNames,\n usePickerFirstDayOfWeek,\n usePickerLocale,\n usePickerLocaleScope,\n} from './_pickerInternals/useLocaleDefaults';\nimport { useControlLoading } from './controlLoading';\nimport { useFieldLabelTarget, useFieldsetDisabled } from './FormContext';\nimport { Icon } from '../elements/Icon';\nimport { getActiveElementInTree } from '../helpers/shadowDom';\nimport { inertProps } from '../helpers/inertProps';\n\n// The year is padded to four digits, as `datetime-local` requires. HTML has\n// no such shape for a year before 1, so a date then is empty, as that input\n// would make it.\nconst toIsoDateTime = (d: Date, withSeconds: boolean): string => {\n if (d.getFullYear() < FIRST_YEAR) return '';\n const yyyy = String(d.getFullYear()).padStart(4, '0');\n const mo = String(d.getMonth() + 1).padStart(2, '0');\n const dd = String(d.getDate()).padStart(2, '0');\n const hh = String(d.getHours()).padStart(2, '0');\n const mm = String(d.getMinutes()).padStart(2, '0');\n const ss = String(d.getSeconds()).padStart(2, '0');\n return withSeconds\n ? `${yyyy}-${mo}-${dd}T${hh}:${mm}:${ss}`\n : `${yyyy}-${mo}-${dd}T${hh}:${mm}`;\n};\n\nconst fromIsoDateTime = (s: string): Date | null => {\n // The HTML datetime-local value may carry fractional seconds (the spec\n // allows them and some engines normalize to `:ss.sss`); accept and drop.\n // Its year is four or more digits, as `toIsoDateTime` writes one past 9999.\n const m =\n /^(\\d{4,})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,3})?)?$/.exec(\n s\n );\n if (!m) return null;\n const d = makeDate(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n d.setHours(Number(m[4]), Number(m[5]), m[6] ? Number(m[6]) : 0, 0);\n return d;\n};\n\n/**\n * Props for the raw DateTimeInput base. Use the higher-level `DateTimeInput`\n * for Field/Control composition. Combines the prop set of `DateInputBaseProps`\n * and `TimeInputBaseProps`.\n */\nexport interface DateTimeInputBaseProps\n extends\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'size'\n | 'color'\n | 'min'\n | 'max'\n | 'type'\n | 'popover'\n >,\n Omit<BulmaClassesProps, 'color'> {\n /** Controlled selected date-time. */\n value?: Date | null;\n /** Initial value for uncontrolled usage. */\n defaultValue?: Date | null;\n /**\n * Fired when either the date or time portion changes. Picking a day keeps\n * the value's whole time of day, down to seconds and milliseconds the field\n * doesn't show, and `min` and `max` judge the picked day at that time. An\n * empty field's day is picked at midnight.\n */\n onChange?: (d: Date | null) => void;\n /** Fired when the popover opens. */\n onOpen?: () => void;\n /** Fired when the popover closes. */\n onClose?: () => void;\n /**\n * Lower bound for the combined date-time. A `min` before year 1 is raised\n * to midnight on 1 January of year 1, where the range starts without one\n * too: HTML's datetime-local input holds no earlier year, so the calendar,\n * the time wheels and typing stop there.\n */\n min?: Date;\n /** Upper bound for the combined date-time. */\n max?: Date;\n /** Disable the input. */\n disabled?: boolean;\n /** Read-only input. */\n readOnly?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /**\n * Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`.\n * @defaultValue 'YYYY-MM-DD HH:mm'\n */\n format?: DateFormatOption;\n /**\n * Custom parser. Enter and leaving the field call it only if the user\n * changed the text, so focus passing through commits nothing and the value\n * keeps what the format leaves out, such as seconds.\n */\n parse?: (s: string) => Date | null;\n /**\n * BCP-47 locale tag for day/month names and Intl formatting. Unset, it is\n * the `locale` of a `LocaleProvider` around the picker, and with neither,\n * `Intl` uses the runtime's own locale. On a server render that is the\n * server's, so an `inline` calendar rendered there names its days in the\n * server's language and the browser's own render names them in the\n * browser's: give it a locale, here or through a `LocaleProvider`, where\n * the two can differ.\n */\n locale?: string;\n /** Render the panel inline (no popover). */\n inline?: boolean;\n /** Use `<input type=\"datetime-local\">` on coarse-pointer devices. */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. */\n popover?: boolean;\n /**\n * Open the popover on focus. Default `true`. Focus that a closing popover\n * hands back to the input leaves it closed. Dismissing it commits nothing:\n * an empty field stays empty, and leaving afterwards commits only what was\n * typed since. With it off, the launcher or Alt+ArrowDown opens it.\n */\n openOnFocus?: boolean;\n /** Off by default — users typically tweak both halves before committing. */\n closeOnSelect?: boolean;\n /**\n * Where the popover opens against the field. Left out, it opens below and\n * lines up with the field's start edge, which is its right edge when the\n * picker reads right to left. A corner you pass stays physical, so\n * `bottom-left` lines up the left edges either way.\n * @defaultValue 'bottom-left'\n */\n position?: PickerPosition;\n /**\n * Render the popover through a portal, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default.\n */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the input, also carried by the calendar and the\n * time wheels, where it colors the selected date and the selection band.\n * Today's date and the calendar's keyboard focus ring take the color's\n * `-on-scheme` variant, which Bulma adjusts to contrast with the background,\n * so pale colors stay readable. A focused wheel's ring is\n * drawn inside the band in the color's `-invert`, like the selected value,\n * so it shows on the fill. Unset, they use their\n * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which\n * follow `primary` by default. The footer's time pill and Done button do not\n * follow `color`.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Rounded input corners. */\n isRounded?: boolean;\n // date subset\n /** Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). */\n shouldDisableDate?: (d: Date) => boolean;\n /** Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. */\n unselectableDates?: Date[];\n /**\n * Day the week starts on (0 = Sunday). Unset inside a `LocaleProvider`,\n * it is the first day of the week in the picker's locale, its own `locale`\n * or else the provider's, such as Monday for `\"de\"`. Elsewhere, with no\n * locale from either, or with seven `dayNames` of your own, it is Sunday:\n * set it with `dayNames` to start the week on another day.\n * @defaultValue 0\n */\n firstDayOfWeek?: DayOfWeek;\n /**\n * Override the 7 day-name labels (in calendar order, post-rotation). They\n * are shown exactly as given, from the first column, so they have to start\n * on the day the week does. With them, an unset `firstDayOfWeek` stays\n * Sunday even inside a `LocaleProvider`, so names written Sunday first keep\n * matching their columns; to start on the locale's day, set\n * `firstDayOfWeek` too and list the names from that day.\n */\n dayNames?: string[];\n /** Override the 12 month-name labels. */\n monthNames?: string[];\n /** Show dimmed dates from adjacent months. */\n nearbyMonthDays?: boolean;\n // time subset\n /** Time format. */\n hourFormat?: HourFormat;\n /** Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. */\n enableSeconds?: boolean;\n /** Hour step. */\n incrementHours?: number;\n /** Step between minute-wheel values (`1` = every minute, iOS-style). */\n incrementMinutes?: number;\n /** Step between second-wheel values (only with `enableSeconds`). */\n incrementSeconds?: number;\n /** Block specific times. Blocked times are also rejected during manual typing. */\n unselectableTimes?: (d: Date) => boolean;\n /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */\n iconLeftName?: string;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a `Control` it sits in shows its `isLoading`\n * spinner, which shares that right edge.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Glyph for the right launcher button. */\n triggerIconName?: string;\n /** Play a short audible tick on each time-wheel crossing. Default `false`. */\n audioTick?: boolean;\n /** Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. */\n haptics?: boolean;\n /**\n * Optional translatable string overrides. In a 12-hour picker, `ampm`\n * names the AM/PM column, `'AM/PM'` by default.\n */\n labels?: PickerLabels;\n}\n\n/**\n * Raw DateTimeInput — combined input + calendar + time spinner without\n * Field/Control wrapping. Use `DateTimeInput` for the convenience wrapper.\n *\n * @function\n * @param {DateTimeInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const DateTimeInputBase = forwardRef<\n HTMLInputElement,\n DateTimeInputBaseProps\n>((props, ref) => {\n const {\n value: controlledValue,\n defaultValue,\n onChange,\n onOpen,\n onClose,\n min,\n max,\n disabled: disabledProp,\n readOnly,\n placeholder,\n format,\n parse,\n locale: localeProp,\n inline = false,\n mobileNative = 'auto',\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = false,\n position,\n appendToBody = false,\n color,\n size,\n isRounded,\n shouldDisableDate,\n unselectableDates,\n firstDayOfWeek: firstDayOfWeekProp,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n hourFormat = '24',\n enableSeconds = false,\n incrementHours = 1,\n // Step between visible wheel values; 1 gives the iOS-style every-minute wheel.\n incrementMinutes = 1,\n incrementSeconds = 1,\n unselectableTimes,\n className,\n name,\n form,\n required,\n id: idProp,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n iconLeftName: _iconLeftName,\n triggerIcon: triggerIconProp,\n triggerIconName = 'chevron-down',\n audioTick = false,\n haptics = false,\n labels,\n ...rest\n } = props;\n // A LocaleProvider around the picker sets its default locale and, through\n // that locale, the day its week starts on.\n const locale = usePickerLocale(localeProp);\n // Its own language and direction, which its root and a portaled panel\n // carry inside a provider.\n const localeScope = usePickerLocaleScope(localeProp, props.dir);\n const firstDayOfWeek = usePickerFirstDayOfWeek(\n firstDayOfWeekProp,\n locale,\n hasOwnDayNames(dayNames)\n );\n const disabled = useFieldsetDisabled(disabledProp);\n // Inside a labeled Field the input takes the id the label points at\n // when the caller set none, as InputBase does, and the popover's ids\n // follow it. Inline there is no input to name, so nothing takes the\n // Field's id or builds on it.\n const id = useFieldLabelTarget(idProp, !inline);\n // The launcher gives way to the loading spinner of a Control this sits in.\n const controlLoading = useControlLoading();\n const triggerIcon = triggerIconProp ?? !controlLoading;\n const t = mergeLabels(labels);\n\n // Platform-appropriate feedback routing for the time wheel: on iOS (no\n // navigator.vibrate) the audio thunk fills in; on Android the real haptic\n // fires and no audio is layered on. `audioTick` always wins.\n const hasVibrate =\n typeof navigator !== 'undefined' && typeof navigator.vibrate === 'function';\n const effectiveAudioTick = audioTick || (haptics && !hasVibrate);\n\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState<Date | null>(\n defaultValue ?? null\n );\n const value = isControlled ? (controlledValue ?? null) : internalValue;\n\n // Nothing before year 1 is in range, as in HTML's date inputs.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const initialFocused = useMemo(\n () => clampDate(value ?? new Date(), lowerBound, max),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n const [focusedDate, setFocusedDate] = useState<Date>(initialFocused);\n // Re-clamp focusedDate when min/max change so the focused cell stays valid.\n useEffect(() => {\n setFocusedDate(prev => clampDate(prev, lowerBound, max));\n }, [lowerBound, max]);\n\n const defaultFormat: DateFormatOption =\n format ??\n (hourFormat === '12'\n ? enableSeconds\n ? 'YYYY-MM-DD hh:mm:ss A'\n : 'YYYY-MM-DD hh:mm A'\n : enableSeconds\n ? 'YYYY-MM-DD HH:mm:ss'\n : DEFAULT_DATETIME_FORMAT);\n\n // The displayed format is the source of truth for the hour cycle: an explicit\n // 12-hour `format` must drive a 12-hour wheel + pill even when `hourFormat`\n // was left at its default. Fall back to the raw prop only when the cycle\n // can't be read from the format (an Intl-options object, or no hour token).\n const effectiveHourFormat = hourCycleFromFormat(defaultFormat) ?? hourFormat;\n\n const [open, setOpenState] = useState(false);\n // The time wheels are collapsed by default (iOS-style); the user reveals\n // them by clicking the time value in the footer.\n const [timeOpen, setTimeOpen] = useState(false);\n const [text, setText] = useState<string>(\n value ? formatDateTime(value, defaultFormat, locale) : ''\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n // Snapshot of the value when the popover opens, so Reset can revert the\n // edits made in this session (reverting to empty if it opened empty).\n const valueAtOpenRef = useRef<Date | null>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\n const timeWheelsId = `${popoverId}-time`;\n\n const { bulmaHelperClasses, rest: cleanRest } = useBulmaClasses(rest);\n\n const { shouldUseNative, isSmallViewport } = useNativeMobilePicker({\n force: mobileNative === 'auto' ? undefined : mobileNative,\n });\n const useNative = !inline && shouldUseNative;\n const wheelItemHeight = isSmallViewport ? 40 : 32;\n\n // Time-only format for the footer's \"Time 5:07 PM\" display.\n const timeDisplayFormat =\n effectiveHourFormat === '12'\n ? enableSeconds\n ? 'h:mm:ss A'\n : 'h:mm A'\n : enableSeconds\n ? 'HH:mm:ss'\n : 'HH:mm';\n\n const inputClass = usePrefixedClassNames('input', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n });\n const containerClass = usePrefixedClassNames('datetimeinput-container');\n const triggerClass = usePrefixedClassNames('datetimeinput-trigger');\n const panelClass = usePrefixedClassNames('datetimeinput');\n const calendarWrapClass = usePrefixedClassNames(\n 'datetimeinput-calendar-wrap'\n );\n const timeOverlayClass = usePrefixedClassNames('datetimeinput-time-overlay');\n const timeCardClass = usePrefixedClassNames('datetimeinput-time-card');\n const footerClass = usePrefixedClassNames('datetimeinput-footer');\n const footerTimeClass = usePrefixedClassNames('datetimeinput-footer-time');\n const footerActionsClass = usePrefixedClassNames(\n 'datetimeinput-footer-actions'\n );\n const footerResetClass = usePrefixedClassNames('datetimeinput-footer-reset');\n const footerDoneClass = usePrefixedClassNames('datetimeinput-footer-done');\n const footerTimePillClass = usePrefixedClassNames(\n 'datetimeinput-footer-time-pill'\n );\n\n // What the latest request asked for, so a second request in the same event\n // sees it before React renders. The callbacks fire here rather than in a\n // state updater, which StrictMode calls twice, and after the state is set,\n // so a request a callback makes is the one that lands last.\n const requestedOpenRef = useRef(false);\n const setOpen = useCallback(\n (next: boolean) => {\n if (requestedOpenRef.current === next) return;\n requestedOpenRef.current = next;\n setOpenState(next);\n if (next) {\n valueAtOpenRef.current = value;\n onOpen?.();\n } else {\n onClose?.();\n }\n },\n [onOpen, onClose, value]\n );\n\n useEffect(() => {\n setText(value ? formatDateTime(value, defaultFormat, locale) : '');\n }, [value, defaultFormat, locale]);\n\n // Collapse the time wheels whenever the popover closes.\n useEffect(() => {\n if (!open) setTimeOpen(false);\n }, [open]);\n\n // The footer's Time button opens the wheels, and the hours wheel takes\n // focus so the keys turn it straight away. The calendar they cover is\n // inert meanwhile, so no tab stop, pointer or screen reader reaches a day\n // behind them. Closing the wheels hands focus back to the button: focus\n // in them would fall to the page as they unmount, and a pointer press\n // outside them has already dropped it on the panel or the page. Focus the\n // keys moved on to the footer, such as Reset, stays there.\n const panelRef = useRef<HTMLDivElement>(null);\n const timeButtonRef = useRef<HTMLButtonElement>(null);\n const timeOverlayRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!timeOpen) return;\n timeOverlayRef.current\n ?.querySelector<HTMLElement>('[role=\"spinbutton\"]')\n ?.focus();\n }, [timeOpen]);\n const closeTime = useCallback(() => {\n const panel = panelRef.current;\n const active = getActiveElementInTree(panel);\n const movedOn =\n !!panel?.contains(active) && !timeOverlayRef.current?.contains(active);\n if (!movedOn) timeButtonRef.current?.focus();\n setTimeOpen(false);\n }, []);\n\n const commitValue = useCallback(\n (next: Date | null) => {\n if (!isControlled) setInternalValue(next);\n // Keep the calendar's focused cell tracking typed / parsed values.\n if (next) setFocusedDate(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n // A picked day takes the value's whole time of day, seconds and all, or\n // midnight in an empty field. The day handed over by the keyboard is the\n // calendar's focused date, which can carry the time of the clock it\n // started from, so none of its time is kept.\n const handleDateSelect = useCallback(\n (d: Date) => {\n const merged = setTimeOfDay(d, {\n hours: value?.getHours() ?? 0,\n minutes: value?.getMinutes() ?? 0,\n seconds: value?.getSeconds() ?? 0,\n milliseconds: value?.getMilliseconds() ?? 0,\n });\n if (!isWithin(merged, lowerBound, max)) return;\n commitValue(merged);\n setFocusedDate(d);\n },\n [value, lowerBound, max, commitValue]\n );\n\n // The wheels set the value's time. An empty field starts from the focused\n // day, at the whole minute or second the wheels show.\n const handleTimeChange = useCallback(\n (parts: { hours: number; minutes: number; seconds?: number }) => {\n const next = value\n ? setTimeOfDay(value, parts)\n : setTimeOfDay(focusedDate, {\n ...parts,\n seconds: parts.seconds ?? 0,\n milliseconds: 0,\n });\n if (!isWithin(next, lowerBound, max)) return;\n commitValue(next);\n },\n [value, focusedDate, lowerBound, max, commitValue]\n );\n\n const tryParse = useCallback(\n (s: string): Date | null => {\n const trimmed = s.trim();\n if (!trimmed) return null;\n if (parse) return parse(trimmed);\n const fmt = typeof defaultFormat === 'string' ? defaultFormat : undefined;\n return parseDate(trimmed, fmt ?? DEFAULT_DATETIME_FORMAT, locale);\n },\n [parse, defaultFormat, locale]\n );\n\n // The Date the user edits when starting without a current value: now, at\n // the whole minute, or the whole second with `enableSeconds`.\n const makeBaseDate = useCallback(\n (): Date =>\n setTimeOfDay(new Date(), {\n seconds: enableSeconds ? undefined : 0,\n milliseconds: 0,\n }),\n [enableSeconds]\n );\n\n const inputReadOnlyAttr = !!readOnly || !editable;\n const canOpen = !!popover && !disabled && !readOnly;\n\n // Blocking predicate for manual entry, combining the calendar's\n // disabled-day logic with the wheels' unselectable-times predicate. The\n // candidate passed in carries the full date-time, so date predicates\n // should use day-based checks.\n const isBlocked = useMemo(() => {\n if (!shouldDisableDate && !unselectableDates?.length && !unselectableTimes)\n return undefined;\n return (d: Date) =>\n !!shouldDisableDate?.(d) ||\n !!unselectableDates?.some(u => isSameDay(u, d)) ||\n !!unselectableTimes?.(d);\n }, [shouldDisableDate, unselectableDates, unselectableTimes]);\n\n const { inputHandlers } = useSegmentedEntry({\n format: defaultFormat,\n value,\n commitValue,\n formatFn: formatDateTime,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min: lowerBound,\n max,\n isBlocked,\n disabled,\n readOnly,\n editable,\n popover,\n openOnFocus,\n closeOnSelect,\n isOpen: open,\n setOpen,\n inputRef,\n containerRef,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n });\n\n const combinedRef = useCallback(\n (node: HTMLInputElement | null) => {\n (inputRef as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref]\n );\n\n if (useNative) {\n const nativeStep = enableSeconds ? incrementSeconds : incrementMinutes * 60;\n return (\n <input\n {...localeScope.rootAttrs}\n {...cleanRest}\n ref={combinedRef}\n type=\"datetime-local\"\n step={nativeStep}\n className={classNames(inputClass, bulmaHelperClasses, className)}\n value={value ? toIsoDateTime(value, enableSeconds) : ''}\n onChange={e => {\n const parsed = e.target.value\n ? fromIsoDateTime(e.target.value)\n : null;\n commitValue(parsed);\n }}\n min={min ? toIsoDateTime(lowerBound, enableSeconds) : undefined}\n max={max ? toIsoDateTime(max, enableSeconds) : undefined}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n name={name}\n form={form}\n required={required}\n id={id}\n />\n );\n }\n\n const spinnerValue = {\n hours: value?.getHours() ?? 0,\n minutes: value?.getMinutes() ?? 0,\n seconds: enableSeconds ? (value?.getSeconds() ?? 0) : undefined,\n };\n\n const panel = (\n <div\n ref={panelRef}\n className={panelClass}\n onKeyDown={e => {\n // First Escape collapses the floating time wheels; the popover's own\n // Escape handler (which closes the whole panel) only sees the second.\n if (timeOpen && e.key === 'Escape') {\n e.stopPropagation();\n closeTime();\n }\n }}\n >\n <div className={calendarWrapClass}>\n <div {...inertProps(timeOpen)}>\n <Calendar\n value={value}\n focusedDate={focusedDate}\n onSelect={handleDateSelect}\n onFocusedDateChange={setFocusedDate}\n min={min}\n max={max}\n shouldDisableDate={shouldDisableDate}\n unselectableDates={unselectableDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n dayNames={dayNames}\n monthNames={monthNames}\n nearbyMonthDays={nearbyMonthDays}\n color={color}\n size={size}\n id={`${popoverId}-cal`}\n autoFocusCell={open}\n labels={labels}\n />\n </div>\n {timeOpen && (\n <div\n ref={timeOverlayRef}\n className={timeOverlayClass}\n onClick={e => {\n // Tap outside the wheel card (on the covered calendar area)\n // collapses the wheels without selecting a date, matching the\n // native behavior.\n if (e.target === e.currentTarget) closeTime();\n }}\n >\n <div className={timeCardClass}>\n <TimeWheels\n value={spinnerValue}\n onChange={handleTimeChange}\n hourFormat={effectiveHourFormat}\n enableSeconds={enableSeconds}\n incrementHours={incrementHours}\n incrementMinutes={incrementMinutes}\n incrementSeconds={incrementSeconds}\n unselectableTimes={unselectableTimes}\n color={color}\n size={size}\n disabled={disabled}\n id={timeWheelsId}\n labels={labels}\n itemHeight={wheelItemHeight}\n audioTick={effectiveAudioTick}\n // Enter on a wheel commits the time, which the wheels already\n // did live, and closes: the popover, or inline, where there\n // is no popover, the wheels, as Escape does.\n onCommit={() => (inline ? closeTime() : setOpen(false))}\n />\n </div>\n </div>\n )}\n </div>\n <div className={footerClass}>\n <button\n ref={timeButtonRef}\n type=\"button\"\n className={footerTimeClass}\n onClick={() => (timeOpen ? closeTime() : setTimeOpen(true))}\n aria-expanded={timeOpen}\n // The wheels exist only while open, so only then is there an\n // element for the button to name.\n aria-controls={timeOpen ? timeWheelsId : undefined}\n disabled={disabled}\n >\n <span>{t.time}</span>\n <span className={footerTimePillClass}>\n {value ? formatTime(value, timeDisplayFormat, locale) : '—'}\n </span>\n </button>\n <div className={footerActionsClass}>\n <button\n type=\"button\"\n className={footerResetClass}\n onClick={() => commitValue(valueAtOpenRef.current)}\n >\n {t.reset}\n </button>\n <button\n type=\"button\"\n className={footerDoneClass}\n aria-label={t.done}\n onClick={() => setOpen(false)}\n >\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" aria-hidden=\"true\">\n <path\n d=\"M5 11l4 4 8-8\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n </div>\n </div>\n );\n\n if (inline) {\n return (\n <div\n {...localeScope.rootAttrs}\n {...cleanRest}\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n >\n {panel}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n value={value ? toIsoDateTime(value, enableSeconds) : ''}\n required={required}\n />\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n {...localeScope.rootAttrs}\n {...cleanRest}\n >\n <input\n ref={combinedRef}\n type=\"text\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={popoverId}\n autoComplete=\"off\"\n className={inputClass}\n value={text}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={inputReadOnlyAttr}\n name={name}\n form={form}\n required={required}\n id={id}\n {...inputHandlers}\n />\n {popover && triggerIcon && (\n <button\n type=\"button\"\n className={triggerClass}\n onClick={() => {\n if (canOpen) setOpen(!open);\n }}\n disabled={!canOpen}\n aria-label={t.chooseDateTime}\n aria-haspopup=\"dialog\"\n aria-controls={popoverId}\n aria-expanded={open}\n tabIndex={canOpen ? 0 : -1}\n >\n <Icon name={triggerIconName} size={size} />\n </button>\n )}\n {popover && (\n <PickerPopover\n localeScope={localeScope.panel}\n isOpen={open}\n onClose={() => setOpen(false)}\n anchorRef={containerRef}\n position={position}\n appendToBody={appendToBody}\n ariaLabel={t.chooseDateTime}\n id={popoverId}\n restoreFocusRef={inputRef}\n initialFocusSelector={CALENDAR_FOCUSED_CELL}\n >\n {panel}\n </PickerPopover>\n )}\n </div>\n );\n});\n\nDateTimeInputBase.displayName = 'DateTimeInputBase';\n\nexport default DateTimeInputBase;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,CAAO,EAAE,WAAoB,KAAY;AAC9D,IAAA,IAAI,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU;AAAE,QAAA,OAAO,EAAE;AAC3C,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACrD,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACpD,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC/C,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,C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mB;;"}
|
|
1
|
+
{"version":3,"file":"DateTimeInputBase.js","sources":["../../../src/form/DateTimeInputBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n PickerPosition,\n HourFormat,\n DayOfWeek,\n PickerLabels,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n formatDateTime,\n formatTime,\n hourCycleFromFormat,\n parseDate,\n DateFormatOption,\n DEFAULT_DATETIME_FORMAT,\n} from './_pickerInternals/formatters';\nimport {\n isWithin,\n setTimeOfDay,\n clampDate,\n FIRST_YEAR,\n floorMin,\n isSameDay,\n makeDate,\n} from './_pickerInternals/dateUtils';\nimport { Calendar, CALENDAR_FOCUSED_CELL } from './_pickerInternals/Calendar';\nimport { TimeWheels } from './_pickerInternals/TimeWheels';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport {\n hasOwnDayNames,\n usePickerFirstDayOfWeek,\n usePickerLocale,\n usePickerLocaleScope,\n} from './_pickerInternals/useLocaleDefaults';\nimport { useControlLoading } from './controlLoading';\nimport { useFieldLabelTarget, useFieldsetDisabled } from './FormContext';\nimport { Icon } from '../elements/Icon';\nimport { getActiveElementInTree } from '../helpers/shadowDom';\nimport { inertProps } from '../helpers/inertProps';\n\n// The year is padded to four digits, as `datetime-local` requires. HTML has\n// no such shape for a year before 1, so a date then is empty, as that input\n// would make it.\nconst toIsoDateTime = (d: Date, withSeconds: boolean): string => {\n if (d.getFullYear() < FIRST_YEAR) return '';\n const yyyy = String(d.getFullYear()).padStart(4, '0');\n const mo = String(d.getMonth() + 1).padStart(2, '0');\n const dd = String(d.getDate()).padStart(2, '0');\n const hh = String(d.getHours()).padStart(2, '0');\n const mm = String(d.getMinutes()).padStart(2, '0');\n const ss = String(d.getSeconds()).padStart(2, '0');\n return withSeconds\n ? `${yyyy}-${mo}-${dd}T${hh}:${mm}:${ss}`\n : `${yyyy}-${mo}-${dd}T${hh}:${mm}`;\n};\n\nconst fromIsoDateTime = (s: string): Date | null => {\n // The HTML datetime-local value may carry fractional seconds (the spec\n // allows them and some engines normalize to `:ss.sss`); accept and drop.\n // Its year is four or more digits, as `toIsoDateTime` writes one past 9999.\n const m =\n /^(\\d{4,})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,3})?)?$/.exec(\n s\n );\n if (!m) return null;\n const d = makeDate(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n d.setHours(Number(m[4]), Number(m[5]), m[6] ? Number(m[6]) : 0, 0);\n return d;\n};\n\n/**\n * Props for the raw DateTimeInput base. Use the higher-level `DateTimeInput`\n * for Field/Control composition. Combines the prop set of `DateInputBaseProps`\n * and `TimeInputBaseProps`.\n */\nexport interface DateTimeInputBaseProps\n extends\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'size'\n | 'color'\n | 'min'\n | 'max'\n | 'type'\n | 'popover'\n >,\n Omit<BulmaClassesProps, 'color'> {\n /** Controlled selected date-time. */\n value?: Date | null;\n /** Initial value for uncontrolled usage. */\n defaultValue?: Date | null;\n /**\n * Fired when either the date or time portion changes. Picking a day keeps\n * the value's whole time of day, down to seconds and milliseconds the field\n * doesn't show, and `min` and `max` judge the picked day at that time. An\n * empty field's day is picked at midnight.\n */\n onChange?: (d: Date | null) => void;\n /** Fired when the popover opens. */\n onOpen?: () => void;\n /** Fired when the popover closes. */\n onClose?: () => void;\n /**\n * Lower bound for the combined date-time. A `min` before year 1 is raised\n * to midnight on 1 January of year 1, where the range starts without one\n * too: HTML's datetime-local input holds no earlier year, so the calendar,\n * the time wheels and typing stop there.\n */\n min?: Date;\n /** Upper bound for the combined date-time. */\n max?: Date;\n /** Disable the input. */\n disabled?: boolean;\n /** Read-only input. */\n readOnly?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /**\n * Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD HH:mm'`.\n * @defaultValue 'YYYY-MM-DD HH:mm'\n */\n format?: DateFormatOption;\n /**\n * Custom parser. Enter and leaving the field call it only if the user\n * changed the text, so focus passing through commits nothing and the value\n * keeps what the format leaves out, such as seconds.\n */\n parse?: (s: string) => Date | null;\n /**\n * BCP-47 locale tag for day/month names and Intl formatting. Unset, it is\n * the `locale` of a `LocaleProvider` around the picker, and with neither,\n * `Intl` uses the runtime's own locale. On a server render that is the\n * server's, so an `inline` calendar rendered there names its days in the\n * server's language and the browser's own render names them in the\n * browser's: give it a locale, here or through a `LocaleProvider`, where\n * the two can differ.\n */\n locale?: string;\n /**\n * Render the panel inline (no popover).\n * On a server-rendered page it marks today once the page hydrates, by\n * the browser's clock rather than the server's. With no `value` or\n * `defaultValue` it opens on the month the clock reads, and around the end\n * of a month the server's clock and the browser's can read different\n * months, so give it a date both render the same.\n */\n inline?: boolean;\n /** Use `<input type=\"datetime-local\">` on coarse-pointer devices. */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing (type the date-time directly across all segments). `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the calendar + time popover exists. `false` makes the field input-only (segmented typing with no popover). Default `true`. */\n popover?: boolean;\n /**\n * Open the popover on focus. Default `true`. Focus that a closing popover\n * hands back to the input leaves it closed. Dismissing it commits nothing:\n * an empty field stays empty, and leaving afterwards commits only what was\n * typed since. With it off, the launcher or Alt+ArrowDown opens it.\n */\n openOnFocus?: boolean;\n /** Off by default — users typically tweak both halves before committing. */\n closeOnSelect?: boolean;\n /**\n * Where the popover opens against the field. Left out, it opens below and\n * lines up with the field's start edge, which is its right edge when the\n * picker reads right to left. A corner you pass stays physical, so\n * `bottom-left` lines up the left edges either way.\n * @defaultValue 'bottom-left'\n */\n position?: PickerPosition;\n /**\n * Render the popover through a portal, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default.\n */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the input, also carried by the calendar and the\n * time wheels, where it colors the selected date and the selection band.\n * Today's date and the calendar's keyboard focus ring take the color's\n * `-on-scheme` variant, which Bulma adjusts to contrast with the background,\n * so pale colors stay readable. A focused wheel's ring is\n * drawn inside the band in the color's `-invert`, like the selected value,\n * so it shows on the fill. Unset, they use their\n * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which\n * follow `primary` by default. The footer's time pill and Done button do not\n * follow `color`.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Rounded input corners. */\n isRounded?: boolean;\n // date subset\n /** Disable specific dates. Blocked dates are also rejected during manual typing (the predicate receives the full candidate date-time — prefer day-based checks). */\n shouldDisableDate?: (d: Date) => boolean;\n /** Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. */\n unselectableDates?: Date[];\n /**\n * Day the week starts on (0 = Sunday). Unset inside a `LocaleProvider`,\n * it is the first day of the week in the picker's locale, its own `locale`\n * or else the provider's, such as Monday for `\"de\"`. Elsewhere, with no\n * locale from either, or with seven `dayNames` of your own, it is Sunday:\n * set it with `dayNames` to start the week on another day.\n * @defaultValue 0\n */\n firstDayOfWeek?: DayOfWeek;\n /**\n * Override the 7 day-name labels (in calendar order, post-rotation). They\n * are shown exactly as given, from the first column, so they have to start\n * on the day the week does. With them, an unset `firstDayOfWeek` stays\n * Sunday even inside a `LocaleProvider`, so names written Sunday first keep\n * matching their columns; to start on the locale's day, set\n * `firstDayOfWeek` too and list the names from that day.\n */\n dayNames?: string[];\n /** Override the 12 month-name labels. */\n monthNames?: string[];\n /** Show dimmed dates from adjacent months. */\n nearbyMonthDays?: boolean;\n // time subset\n /** Time format. */\n hourFormat?: HourFormat;\n /** Show seconds column. Note: iOS Safari's native datetime-local picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. */\n enableSeconds?: boolean;\n /** Hour step. */\n incrementHours?: number;\n /** Step between minute-wheel values (`1` = every minute, iOS-style). */\n incrementMinutes?: number;\n /** Step between second-wheel values (only with `enableSeconds`). */\n incrementSeconds?: number;\n /** Block specific times. Blocked times are also rejected during manual typing. */\n unselectableTimes?: (d: Date) => boolean;\n /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */\n iconLeftName?: string;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a `Control` it sits in shows its `isLoading`\n * spinner, which shares that right edge.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Glyph for the right launcher button. */\n triggerIconName?: string;\n /** Play a short audible tick on each time-wheel crossing. Default `false`. */\n audioTick?: boolean;\n /** Auto-route tactile feedback per wheel tick (vibrate on Android, audio thunk on iOS). Default `false`. */\n haptics?: boolean;\n /**\n * Optional translatable string overrides. In a 12-hour picker, `ampm`\n * names the AM/PM column, `'AM/PM'` by default.\n */\n labels?: PickerLabels;\n}\n\n/**\n * Raw DateTimeInput — combined input + calendar + time spinner without\n * Field/Control wrapping. Use `DateTimeInput` for the convenience wrapper.\n *\n * @function\n * @param {DateTimeInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const DateTimeInputBase = forwardRef<\n HTMLInputElement,\n DateTimeInputBaseProps\n>((props, ref) => {\n const {\n value: controlledValue,\n defaultValue,\n onChange,\n onOpen,\n onClose,\n min,\n max,\n disabled: disabledProp,\n readOnly,\n placeholder,\n format,\n parse,\n locale: localeProp,\n inline = false,\n mobileNative = 'auto',\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = false,\n position,\n appendToBody = false,\n color,\n size,\n isRounded,\n shouldDisableDate,\n unselectableDates,\n firstDayOfWeek: firstDayOfWeekProp,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n hourFormat = '24',\n enableSeconds = false,\n incrementHours = 1,\n // Step between visible wheel values; 1 gives the iOS-style every-minute wheel.\n incrementMinutes = 1,\n incrementSeconds = 1,\n unselectableTimes,\n className,\n name,\n form,\n required,\n id: idProp,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n iconLeftName: _iconLeftName,\n triggerIcon: triggerIconProp,\n triggerIconName = 'chevron-down',\n audioTick = false,\n haptics = false,\n labels,\n ...rest\n } = props;\n // A LocaleProvider around the picker sets its default locale and, through\n // that locale, the day its week starts on.\n const locale = usePickerLocale(localeProp);\n // Its own language and direction, which its root and a portaled panel\n // carry inside a provider.\n const localeScope = usePickerLocaleScope(localeProp, props.dir);\n const firstDayOfWeek = usePickerFirstDayOfWeek(\n firstDayOfWeekProp,\n locale,\n hasOwnDayNames(dayNames)\n );\n const disabled = useFieldsetDisabled(disabledProp);\n // Inside a labeled Field the input takes the id the label points at\n // when the caller set none, as InputBase does, and the popover's ids\n // follow it. Inline there is no input to name, so nothing takes the\n // Field's id or builds on it.\n const id = useFieldLabelTarget(idProp, !inline);\n // The launcher gives way to the loading spinner of a Control this sits in.\n const controlLoading = useControlLoading();\n const triggerIcon = triggerIconProp ?? !controlLoading;\n const t = mergeLabels(labels);\n\n // Platform-appropriate feedback routing for the time wheel: on iOS (no\n // navigator.vibrate) the audio thunk fills in; on Android the real haptic\n // fires and no audio is layered on. `audioTick` always wins.\n const hasVibrate =\n typeof navigator !== 'undefined' && typeof navigator.vibrate === 'function';\n const effectiveAudioTick = audioTick || (haptics && !hasVibrate);\n\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState<Date | null>(\n defaultValue ?? null\n );\n const value = isControlled ? (controlledValue ?? null) : internalValue;\n\n // Nothing before year 1 is in range, as in HTML's date inputs.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const initialFocused = useMemo(\n () => clampDate(value ?? new Date(), lowerBound, max),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n const [focusedDate, setFocusedDate] = useState<Date>(initialFocused);\n // Re-clamp focusedDate when min/max change so the focused cell stays valid.\n useEffect(() => {\n setFocusedDate(prev => clampDate(prev, lowerBound, max));\n }, [lowerBound, max]);\n\n const defaultFormat: DateFormatOption =\n format ??\n (hourFormat === '12'\n ? enableSeconds\n ? 'YYYY-MM-DD hh:mm:ss A'\n : 'YYYY-MM-DD hh:mm A'\n : enableSeconds\n ? 'YYYY-MM-DD HH:mm:ss'\n : DEFAULT_DATETIME_FORMAT);\n\n // The displayed format is the source of truth for the hour cycle: an explicit\n // 12-hour `format` must drive a 12-hour wheel + pill even when `hourFormat`\n // was left at its default. Fall back to the raw prop only when the cycle\n // can't be read from the format (an Intl-options object, or no hour token).\n const effectiveHourFormat = hourCycleFromFormat(defaultFormat) ?? hourFormat;\n\n const [open, setOpenState] = useState(false);\n // The time wheels are collapsed by default (iOS-style); the user reveals\n // them by clicking the time value in the footer.\n const [timeOpen, setTimeOpen] = useState(false);\n const [text, setText] = useState<string>(\n value ? formatDateTime(value, defaultFormat, locale) : ''\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n // Snapshot of the value when the popover opens, so Reset can revert the\n // edits made in this session (reverting to empty if it opened empty).\n const valueAtOpenRef = useRef<Date | null>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\n const timeWheelsId = `${popoverId}-time`;\n\n const { bulmaHelperClasses, rest: cleanRest } = useBulmaClasses(rest);\n\n const { shouldUseNative, isSmallViewport } = useNativeMobilePicker({\n force: mobileNative === 'auto' ? undefined : mobileNative,\n });\n const useNative = !inline && shouldUseNative;\n const wheelItemHeight = isSmallViewport ? 40 : 32;\n\n // Time-only format for the footer's \"Time 5:07 PM\" display.\n const timeDisplayFormat =\n effectiveHourFormat === '12'\n ? enableSeconds\n ? 'h:mm:ss A'\n : 'h:mm A'\n : enableSeconds\n ? 'HH:mm:ss'\n : 'HH:mm';\n\n const inputClass = usePrefixedClassNames('input', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n });\n const containerClass = usePrefixedClassNames('datetimeinput-container');\n const triggerClass = usePrefixedClassNames('datetimeinput-trigger');\n const panelClass = usePrefixedClassNames('datetimeinput');\n const calendarWrapClass = usePrefixedClassNames(\n 'datetimeinput-calendar-wrap'\n );\n const timeOverlayClass = usePrefixedClassNames('datetimeinput-time-overlay');\n const timeCardClass = usePrefixedClassNames('datetimeinput-time-card');\n const footerClass = usePrefixedClassNames('datetimeinput-footer');\n const footerTimeClass = usePrefixedClassNames('datetimeinput-footer-time');\n const footerActionsClass = usePrefixedClassNames(\n 'datetimeinput-footer-actions'\n );\n const footerResetClass = usePrefixedClassNames('datetimeinput-footer-reset');\n const footerDoneClass = usePrefixedClassNames('datetimeinput-footer-done');\n const footerTimePillClass = usePrefixedClassNames(\n 'datetimeinput-footer-time-pill'\n );\n\n // What the latest request asked for, so a second request in the same event\n // sees it before React renders. The callbacks fire here rather than in a\n // state updater, which StrictMode calls twice, and after the state is set,\n // so a request a callback makes is the one that lands last.\n const requestedOpenRef = useRef(false);\n const setOpen = useCallback(\n (next: boolean) => {\n if (requestedOpenRef.current === next) return;\n requestedOpenRef.current = next;\n setOpenState(next);\n if (next) {\n valueAtOpenRef.current = value;\n onOpen?.();\n } else {\n onClose?.();\n }\n },\n [onOpen, onClose, value]\n );\n\n useEffect(() => {\n setText(value ? formatDateTime(value, defaultFormat, locale) : '');\n }, [value, defaultFormat, locale]);\n\n // Collapse the time wheels whenever the popover closes.\n useEffect(() => {\n if (!open) setTimeOpen(false);\n }, [open]);\n\n // The footer's Time button opens the wheels, and the hours wheel takes\n // focus so the keys turn it straight away. The calendar they cover is\n // inert meanwhile, so no tab stop, pointer or screen reader reaches a day\n // behind them. Closing the wheels hands focus back to the button: focus\n // in them would fall to the page as they unmount, and a pointer press\n // outside them has already dropped it on the panel or the page. Focus the\n // keys moved on to the footer, such as Reset, stays there.\n const panelRef = useRef<HTMLDivElement>(null);\n const timeButtonRef = useRef<HTMLButtonElement>(null);\n const timeOverlayRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!timeOpen) return;\n timeOverlayRef.current\n ?.querySelector<HTMLElement>('[role=\"spinbutton\"]')\n ?.focus();\n }, [timeOpen]);\n const closeTime = useCallback(() => {\n const panel = panelRef.current;\n const active = getActiveElementInTree(panel);\n const movedOn =\n !!panel?.contains(active) && !timeOverlayRef.current?.contains(active);\n if (!movedOn) timeButtonRef.current?.focus();\n setTimeOpen(false);\n }, []);\n\n const commitValue = useCallback(\n (next: Date | null) => {\n if (!isControlled) setInternalValue(next);\n // Keep the calendar's focused cell tracking typed / parsed values.\n if (next) setFocusedDate(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n // A picked day takes the value's whole time of day, seconds and all, or\n // midnight in an empty field. The day handed over by the keyboard is the\n // calendar's focused date, which can carry the time of the clock it\n // started from, so none of its time is kept.\n const handleDateSelect = useCallback(\n (d: Date) => {\n const merged = setTimeOfDay(d, {\n hours: value?.getHours() ?? 0,\n minutes: value?.getMinutes() ?? 0,\n seconds: value?.getSeconds() ?? 0,\n milliseconds: value?.getMilliseconds() ?? 0,\n });\n if (!isWithin(merged, lowerBound, max)) return;\n commitValue(merged);\n setFocusedDate(d);\n },\n [value, lowerBound, max, commitValue]\n );\n\n // The wheels set the value's time. An empty field starts from the focused\n // day, at the whole minute or second the wheels show.\n const handleTimeChange = useCallback(\n (parts: { hours: number; minutes: number; seconds?: number }) => {\n const next = value\n ? setTimeOfDay(value, parts)\n : setTimeOfDay(focusedDate, {\n ...parts,\n seconds: parts.seconds ?? 0,\n milliseconds: 0,\n });\n if (!isWithin(next, lowerBound, max)) return;\n commitValue(next);\n },\n [value, focusedDate, lowerBound, max, commitValue]\n );\n\n const tryParse = useCallback(\n (s: string): Date | null => {\n const trimmed = s.trim();\n if (!trimmed) return null;\n if (parse) return parse(trimmed);\n const fmt = typeof defaultFormat === 'string' ? defaultFormat : undefined;\n return parseDate(trimmed, fmt ?? DEFAULT_DATETIME_FORMAT, locale);\n },\n [parse, defaultFormat, locale]\n );\n\n // The Date the user edits when starting without a current value: now, at\n // the whole minute, or the whole second with `enableSeconds`.\n const makeBaseDate = useCallback(\n (): Date =>\n setTimeOfDay(new Date(), {\n seconds: enableSeconds ? undefined : 0,\n milliseconds: 0,\n }),\n [enableSeconds]\n );\n\n const inputReadOnlyAttr = !!readOnly || !editable;\n const canOpen = !!popover && !disabled && !readOnly;\n\n // Blocking predicate for manual entry, combining the calendar's\n // disabled-day logic with the wheels' unselectable-times predicate. The\n // candidate passed in carries the full date-time, so date predicates\n // should use day-based checks.\n const isBlocked = useMemo(() => {\n if (!shouldDisableDate && !unselectableDates?.length && !unselectableTimes)\n return undefined;\n return (d: Date) =>\n !!shouldDisableDate?.(d) ||\n !!unselectableDates?.some(u => isSameDay(u, d)) ||\n !!unselectableTimes?.(d);\n }, [shouldDisableDate, unselectableDates, unselectableTimes]);\n\n const { inputHandlers } = useSegmentedEntry({\n format: defaultFormat,\n value,\n commitValue,\n formatFn: formatDateTime,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min: lowerBound,\n max,\n isBlocked,\n disabled,\n readOnly,\n editable,\n popover,\n openOnFocus,\n closeOnSelect,\n isOpen: open,\n setOpen,\n inputRef,\n containerRef,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n });\n\n const combinedRef = useCallback(\n (node: HTMLInputElement | null) => {\n (inputRef as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref]\n );\n\n if (useNative) {\n const nativeStep = enableSeconds ? incrementSeconds : incrementMinutes * 60;\n return (\n <input\n {...localeScope.rootAttrs}\n {...cleanRest}\n ref={combinedRef}\n type=\"datetime-local\"\n step={nativeStep}\n className={classNames(inputClass, bulmaHelperClasses, className)}\n value={value ? toIsoDateTime(value, enableSeconds) : ''}\n onChange={e => {\n const parsed = e.target.value\n ? fromIsoDateTime(e.target.value)\n : null;\n commitValue(parsed);\n }}\n min={min ? toIsoDateTime(lowerBound, enableSeconds) : undefined}\n max={max ? toIsoDateTime(max, enableSeconds) : undefined}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n name={name}\n form={form}\n required={required}\n id={id}\n />\n );\n }\n\n const spinnerValue = {\n hours: value?.getHours() ?? 0,\n minutes: value?.getMinutes() ?? 0,\n seconds: enableSeconds ? (value?.getSeconds() ?? 0) : undefined,\n };\n\n const panel = (\n <div\n ref={panelRef}\n className={panelClass}\n onKeyDown={e => {\n // First Escape collapses the floating time wheels; the popover's own\n // Escape handler (which closes the whole panel) only sees the second.\n if (timeOpen && e.key === 'Escape') {\n e.stopPropagation();\n closeTime();\n }\n }}\n >\n <div className={calendarWrapClass}>\n <div {...inertProps(timeOpen)}>\n <Calendar\n value={value}\n focusedDate={focusedDate}\n onSelect={handleDateSelect}\n onFocusedDateChange={setFocusedDate}\n min={min}\n max={max}\n shouldDisableDate={shouldDisableDate}\n unselectableDates={unselectableDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n dayNames={dayNames}\n monthNames={monthNames}\n nearbyMonthDays={nearbyMonthDays}\n color={color}\n size={size}\n id={`${popoverId}-cal`}\n autoFocusCell={open}\n labels={labels}\n />\n </div>\n {timeOpen && (\n <div\n ref={timeOverlayRef}\n className={timeOverlayClass}\n onClick={e => {\n // Tap outside the wheel card (on the covered calendar area)\n // collapses the wheels without selecting a date, matching the\n // native behavior.\n if (e.target === e.currentTarget) closeTime();\n }}\n >\n <div className={timeCardClass}>\n <TimeWheels\n value={spinnerValue}\n onChange={handleTimeChange}\n hourFormat={effectiveHourFormat}\n enableSeconds={enableSeconds}\n incrementHours={incrementHours}\n incrementMinutes={incrementMinutes}\n incrementSeconds={incrementSeconds}\n unselectableTimes={unselectableTimes}\n color={color}\n size={size}\n disabled={disabled}\n id={timeWheelsId}\n labels={labels}\n itemHeight={wheelItemHeight}\n audioTick={effectiveAudioTick}\n // Enter on a wheel commits the time, which the wheels already\n // did live, and closes: the popover, or inline, where there\n // is no popover, the wheels, as Escape does.\n onCommit={() => (inline ? closeTime() : setOpen(false))}\n />\n </div>\n </div>\n )}\n </div>\n <div className={footerClass}>\n <button\n ref={timeButtonRef}\n type=\"button\"\n className={footerTimeClass}\n onClick={() => (timeOpen ? closeTime() : setTimeOpen(true))}\n aria-expanded={timeOpen}\n // The wheels exist only while open, so only then is there an\n // element for the button to name.\n aria-controls={timeOpen ? timeWheelsId : undefined}\n disabled={disabled}\n >\n <span>{t.time}</span>\n <span className={footerTimePillClass}>\n {value ? formatTime(value, timeDisplayFormat, locale) : '—'}\n </span>\n </button>\n <div className={footerActionsClass}>\n <button\n type=\"button\"\n className={footerResetClass}\n onClick={() => commitValue(valueAtOpenRef.current)}\n >\n {t.reset}\n </button>\n <button\n type=\"button\"\n className={footerDoneClass}\n aria-label={t.done}\n onClick={() => setOpen(false)}\n >\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" aria-hidden=\"true\">\n <path\n d=\"M5 11l4 4 8-8\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n </div>\n </div>\n );\n\n if (inline) {\n return (\n <div\n {...localeScope.rootAttrs}\n {...cleanRest}\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n >\n {panel}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n value={value ? toIsoDateTime(value, enableSeconds) : ''}\n required={required}\n />\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n {...localeScope.rootAttrs}\n {...cleanRest}\n >\n <input\n ref={combinedRef}\n type=\"text\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={popoverId}\n autoComplete=\"off\"\n className={inputClass}\n value={text}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={inputReadOnlyAttr}\n name={name}\n form={form}\n required={required}\n id={id}\n {...inputHandlers}\n />\n {popover && triggerIcon && (\n <button\n type=\"button\"\n className={triggerClass}\n onClick={() => {\n if (canOpen) setOpen(!open);\n }}\n disabled={!canOpen}\n aria-label={t.chooseDateTime}\n aria-haspopup=\"dialog\"\n aria-controls={popoverId}\n aria-expanded={open}\n tabIndex={canOpen ? 0 : -1}\n >\n <Icon name={triggerIconName} size={size} />\n </button>\n )}\n {popover && (\n <PickerPopover\n localeScope={localeScope.panel}\n isOpen={open}\n onClose={() => setOpen(false)}\n anchorRef={containerRef}\n position={position}\n appendToBody={appendToBody}\n ariaLabel={t.chooseDateTime}\n id={popoverId}\n restoreFocusRef={inputRef}\n initialFocusSelector={CALENDAR_FOCUSED_CELL}\n >\n {panel}\n </PickerPopover>\n )}\n </div>\n );\n});\n\nDateTimeInputBase.displayName = 'DateTimeInputBase';\n\nexport default DateTimeInputBase;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDA;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,CAAO,EAAE,WAAoB,KAAY;AAC9D,IAAA,IAAI,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU;AAAE,QAAA,OAAO,EAAE;AAC3C,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACrD,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACpD,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC/C,IAAA,MAAM,EAAE,GAAG,MA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A,CACG;AAEV,CAAC;AAED,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSelect.js","sources":["../../../src/form/TreeSelect.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { usePrefixedClassNames } from '../helpers/classNames';\nimport type { BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher } from '../helpers/localeFormat';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport {\n TreeViewHiddenContext,\n readChecks,\n toggledList,\n} from '../helpers/useTreeView';\nimport { useControlled } from '../helpers/useControlled';\nimport {\n checkRecords,\n checkedByStrategy,\n childNodes,\n indexTree,\n isParentNode,\n nodeLabel,\n searchTree,\n} from '../helpers/treeData';\nimport { TreeView } from '../components/TreeView';\nimport type { FormFieldProps } from './fieldProps';\nimport { useFieldsetDisabled } from './FormContext';\nimport type { PickerPosition } from './_pickerInternals/pickerTypes';\nimport { DialogSelect } from './_selectInternals/DialogSelect';\nimport { ValueTags, tagIds } from './_selectInternals/ValueTags';\n\n/**\n * One node in a TreeSelect's `data`: Combobox's item fields plus\n * TreeView.Item's, with `children` for the nodes under it.\n */\nexport interface TreeItemData {\n /** **Required.** What the value holds and `name` posts. Unique in the whole tree. */\n value: string;\n /** What the row, the field and the tags show, and what search matches. The `value` when it's left out. */\n label?: string;\n /** Reachable, but never picked, checked, opened or closed. */\n disabled?: boolean;\n /** A picture before the label: an `Icon` name, or a node. Hidden from assistive tech. */\n icon?: React.ReactNode;\n /** The nodes under this one. */\n children?: TreeItemData[];\n /** Shows the node as a parent before its children are known, for a branch that loads when it opens. */\n hasChildren?: boolean;\n /** Its children are on their way: an open branch ends in a row that says so, and the live region says it too. */\n isLoading?: boolean;\n /** Its children didn't load: an open branch ends in this message, with a Retry button when there's an `onRetry`. */\n loadError?: React.ReactNode;\n /** Called by the Retry button on a failed load's row. Set `isLoading` while the retry runs. */\n onRetry?: () => void;\n}\n\n/** What a checked branch puts in the value a check makes. */\nexport type TreeSelectCheckedStrategy = 'child' | 'parent' | 'all';\n\n/** The visible and accessible strings, in your app's language. */\nexport interface TreeSelectLabels {\n /**\n * Names the panel and the tree in it.\n * @defaultValue the field's label\n */\n choose?: string;\n /**\n * Names the search box.\n * @defaultValue 'Search'\n */\n search?: string;\n /**\n * Names the clear button.\n * @defaultValue 'Clear'\n */\n clear?: string;\n /**\n * What a loading branch's row says, as on TreeView.\n * @defaultValue 'Loading…'\n */\n loading?: string;\n /**\n * The Retry button's text on a failed load's row, as on TreeView.\n * @defaultValue 'Retry'\n */\n retry?: string;\n /**\n * What the live region says when an open branch starts loading, built\n * from its name, as on TreeView.\n * @defaultValue name => `Loading ${name}`\n */\n loadingAnnouncement?: (name: string) => string;\n /**\n * What the live region says when that load finishes, as on TreeView.\n * @defaultValue name => `${name} loaded`\n */\n loadedAnnouncement?: (name: string) => string;\n}\n\n/**\n * What every TreeSelect takes. The helper props and the other attributes\n * land on the root `<div>`, as Combobox's do, and the `ref` on the field.\n */\ninterface TreeSelectBaseProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'defaultValue' | 'children'\n >,\n Omit<BulmaClassesProps, 'color'>,\n FormFieldProps {\n /** **Required.** The tree, as nodes nested through `children`. */\n data: TreeItemData[];\n /**\n * The field's label, which names the field through `htmlFor`, and the\n * panel and the tree in it through `aria-labelledby`. Dropped inside an\n * outer `Field`, whose label names them instead.\n */\n label?: React.ReactNode;\n /** The field's `id`, which the label then points at. The panel's is this one with `-panel` after it. */\n id?: string;\n /** Names the field, and the panel and the tree, in place of a `label`. */\n 'aria-label'?: string;\n /** The ids of what names the field, and the panel and the tree, in place of a `label`. */\n 'aria-labelledby'?: string;\n /** The ids of what describes the field, ahead of the tags. */\n 'aria-describedby'?: string;\n /** The open branches' values when you hold the state, as TreeView's `expanded`. */\n expanded?: string[];\n /** The branches open to begin with, when TreeSelect holds its own state. */\n defaultExpanded?: string[];\n /**\n * Called with the new list whenever a branch opens or closes, opening the\n * panel on the picked item's branch included. Fetch a lazy branch's\n * children from here. The branches a search opens aren't in it.\n */\n onExpandedChange?: (expanded: string[]) => void;\n /** Whether the panel is open, controlled: opening and closing then only call `onOpenChange`. */\n open?: boolean;\n /** The panel is open to begin with. */\n defaultOpen?: boolean;\n /** Called with the new state when the panel opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Puts a search box at the top of the panel. It matches labels, keeps a\n * match's ancestors and the nodes under it, and opens every branch with a\n * match. A printable key on the field opens the panel with it in the box,\n * and the search empties when the panel closes.\n */\n searchable?: boolean;\n /** The search text when you hold the state. */\n query?: string;\n /** The search text to begin with. */\n defaultQuery?: string;\n /** Called with the search text as it changes. */\n onQueryChange?: (query: string) => void;\n /**\n * Whether a node matches the search, in place of the locale-aware match on\n * its label. It's handed the search text trimmed, the node, and its path\n * from the top node down, the node last, as Cascader's `filter` is. A\n * match's ancestors stay either way. The search runs again when the search\n * text or `data` changes, not when only this does, so one written inline\n * costs nothing.\n */\n filter?: (query: string, item: TreeItemData, path: TreeItemData[]) => boolean;\n /** What the panel shows when the search matches nothing, such as \"No folders match\". Announced once. */\n empty?: React.ReactNode;\n /** Renders a row's content in place of its label. The field and the tags still show the label. */\n itemTemplate?: (item: TreeItemData) => React.ReactNode;\n /** What the field shows while nothing is picked. */\n placeholder?: string;\n /** A form field name. A hidden input posts the value, or one per value in the checkbox modes. */\n name?: string;\n /** The id of the form the hidden inputs belong to, when it isn't an ancestor. */\n form?: string;\n /**\n * A value is needed: the field is `aria-required`, and the form won't\n * submit while nothing is picked. The browser's message points at the\n * field, which shows focus, and the next key goes to it.\n */\n required?: boolean;\n /** The field can't be used: it can't be focused or opened, its tags lose their buttons, and its hidden inputs don't post. */\n disabled?: boolean;\n /**\n * Shows a clear button at the field's inline end while something it can\n * take off is picked. It leaves checked disabled items, which no control\n * unchecks.\n */\n clearable?: boolean;\n /** Bulma color modifier for the field. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** The field's size, which the tree in the panel follows. */\n size?: 'small' | 'medium' | 'large';\n /** Rounds the field's corners (Bulma's `is-rounded`). */\n isRounded?: boolean;\n /**\n * Where the panel opens against the field, as on the pickers. Left out, it\n * opens below and lines up with the field's start edge, which is its right\n * edge on a right-to-left page. A corner you pass stays physical, so\n * `bottom-left` lines up the left edges either way.\n * @defaultValue 'bottom-left'\n */\n position?: PickerPosition;\n /** Renders the panel through a portal, into a `ConfigProvider`'s `portalContainer`, `document.body` by default. */\n appendToBody?: boolean;\n /** The visible and accessible strings, in your app's language. */\n labels?: TreeSelectLabels;\n}\n\n/** Props for a TreeSelect that picks one item. */\nexport interface TreeSelectSingleProps extends TreeSelectBaseProps {\n /**\n * `'single'`: one item, picked with Enter, Space or a click on its row.\n * `'checkbox'`: any number, with a box on every item. A check reaches every\n * enabled item under it, and a parent with some of them checked is mixed.\n * `'checkbox-independent'`: any number, each box checking its own item, so\n * a parent means the parent alone (Mantine's and Ant Design's\n * `checkStrictly`). The checkbox modes show the value as tags.\n */\n selectionMode?: 'single';\n /**\n * The value when you hold the state: in `'single'` the picked item's\n * value, or `null` for none, and in the checkbox modes the checked values.\n * In `'checkbox'` a parent's value checks its whole branch, so the list any\n * `checkedStrategy` gives checks the same boxes.\n */\n value?: string | null;\n /** The value to begin with, when TreeSelect holds its own state: a value or `null`, or a list in the checkbox modes. */\n defaultValue?: string | null;\n /**\n * Called with the new value: in `'single'` the picked item's value, or\n * `null` when it's cleared, and in the checkbox modes the new list, after a\n * check, an uncheck, a tag's button or the clear button, each shaped by\n * `checkedStrategy`. A reset of the field's form calls it too, with\n * `defaultValue` as it was given, or with `null` or `[]` when you hold\n * the value, for you to set.\n */\n onChange?: (value: string | null) => void;\n /**\n * A parent's row picks the parent. `false` makes the row, Enter and Space\n * open it instead, so only leaves are picked.\n * @defaultValue true\n */\n parentsSelectable?: boolean;\n /**\n * Closes the panel after a pick and puts focus back on the field.\n * @defaultValue true\n */\n closeOnSelect?: boolean;\n /** @internal Read with the checkbox modes only. */\n checkedStrategy?: never;\n /** @internal Read with the checkbox modes only. */\n ariaCloseLabel?: never;\n}\n\n/** Props for a TreeSelect with a box on every item. */\nexport interface TreeSelectCheckboxProps extends TreeSelectBaseProps {\n /**\n * `'checkbox'`: a check reaches every enabled item under it, and a parent\n * with some of them checked is mixed. `'checkbox-independent'`: each box\n * checks its own item, so a parent means the parent alone.\n */\n selectionMode: 'checkbox' | 'checkbox-independent';\n /**\n * The checked values when you hold the state. In `'checkbox'`, a parent's\n * value checks its whole branch, so the list any `checkedStrategy` gives\n * checks the same boxes.\n */\n value?: string[];\n /** The values checked to begin with, when TreeSelect holds its own state. */\n defaultValue?: string[];\n /**\n * Called with the new list after a check, an uncheck, a tag's button or\n * the clear button, shaped by `checkedStrategy`, and after a reset of the\n * field's form, with `defaultValue` as given, or `[]` when you hold the\n * value.\n */\n onChange?: (value: string[]) => void;\n /**\n * What a checked branch puts in the value, in `'checkbox'`: `'child'` its\n * leaves, `'parent'` its topmost checked item, `'all'` every checked item,\n * parents included. A checked disabled item is in all three, since only\n * its own value checks it. It shapes the value a check, an uncheck, a\n * tag's button or the clear button makes, which `onChange` reports, and\n * not `defaultValue`, a value you pass or the one a form reset puts back.\n * The tags and the hidden\n * inputs show the value as it's held, so a value you pass shows as you\n * pass it, and a branch that loads later changes nothing the form posts.\n * `'checkbox-independent'` always reports exactly the checked items.\n * @defaultValue 'child'\n */\n checkedStrategy?: TreeSelectCheckedStrategy;\n /** Names each tag's button, in place of \"Remove\" and the item's label, as on Combobox. */\n ariaCloseLabel?: string;\n /** @internal Read with `'single'` only. */\n parentsSelectable?: never;\n /** @internal Read with `'single'` only: the panel stays open while boxes are checked. */\n closeOnSelect?: never;\n}\n\n/**\n * Props for the TreeSelect component. The helper props and the other\n * attributes land on the `div.tree-select` around the field, and the `ref`\n * on the field. It renders the `Field` and the label itself, unless an outer\n * `Field` already does.\n *\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the field, the read-only `<input role=\"combobox\">`.\n */\nexport type TreeSelectProps = TreeSelectSingleProps | TreeSelectCheckboxProps;\n\nconst NOTHING_HIDDEN: ReadonlySet<string> = new Set();\nconst noMatches = [{ id: 'empty' }];\nconst nothingToSay: Array<{ id: string }> = [];\n/** What takes focus as the panel opens. */\nconst INITIAL_FOCUS = '[data-initial-focus]';\n\n/** One value or several, as a list. */\nconst asList = (value: string | string[] | null | undefined): string[] =>\n value == null ? [] : Array.isArray(value) ? value : [value];\n\n/** Whether two lists hold the same values, whatever their order and repeats. */\nconst sameValues = (a: string[], b: string[]): boolean => {\n const inA = new Set(a);\n const inB = new Set(b);\n return inA.size === inB.size && [...inA].every(value => inB.has(value));\n};\n\n/** The list with every value of `more` it doesn't have added at the end. */\nconst withAll = (list: string[], more: string[]): string[] => [\n ...list,\n ...more.filter(value => !list.includes(value)),\n];\n\n/**\n * The `TreeSelect` component is a form field whose options are a tree, such as categories, places or teams: it opens a panel holding a real `TreeView`, picks one item or checks a branch at a time, and searches labels.\n *\n * The field is a read-only `role=\"combobox\"` that opens a dialog, wired as\n * DateInput's is, so focus moves into the tree for real and the tree keeps\n * TreeView's keys, type-ahead and spoken output. The tree is given as `data`,\n * so the field and the tags can name what's picked while the panel is shut,\n * and on the server.\n *\n * `selectionMode` picks the kind. `'single'` picks one item and closes. With\n * `'checkbox'`, a check reaches every enabled item under it, closed or hidden\n * by a search, and `checkedStrategy` decides what the value holds: the\n * leaves, the topmost checked items or every one. With\n * `'checkbox-independent'`, each box is its own item's, so a parent means\n * itself alone (Mantine's and Ant Design's `checkStrictly`). The value shows\n * as tags under the field.\n *\n * A value no node has is kept and shown as it is, with a warning in\n * development, so a value under a branch that hasn't loaded survives until\n * it does.\n *\n * @function\n * @param {TreeSelectProps} props - Props for the TreeSelect component.\n * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the field.\n * @returns {JSX.Element} The field, its tags and its panel, in a `Field` with the label unless one is around it.\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/combobox/ | APG Combobox Pattern}\n *\n * @example\n * <TreeSelect\n * label=\"Save to\"\n * data={[\n * { value: 'docs', label: 'Documents', children: [{ value: 'invoices', label: 'Invoices' }] },\n * { value: 'photos', label: 'Photos' },\n * ]}\n * searchable\n * />\n *\n * @example\n * <TreeSelect label=\"Regions\" selectionMode=\"checkbox\" checkedStrategy=\"parent\" data={regions} />\n */\nexport const TreeSelect = forwardRef<HTMLInputElement, TreeSelectProps>(\n (props, ref) => {\n const {\n data,\n expanded: expandedProp,\n defaultExpanded = [],\n onExpandedChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n searchable = false,\n query: queryProp,\n defaultQuery = '',\n onQueryChange,\n filter,\n empty,\n itemTemplate,\n disabled: disabledProp,\n clearable = false,\n size,\n labels,\n selectionMode = 'single',\n value: valueProp,\n defaultValue,\n // Called below through `props`, which knows which value it takes.\n onChange: _onChange,\n parentsSelectable = true,\n closeOnSelect = true,\n checkedStrategy = 'child',\n ariaCloseLabel,\n ...rest\n } = props;\n const disabled = useFieldsetDisabled(disabledProp);\n const single = selectionMode === 'single';\n const cascade = selectionMode === 'checkbox';\n\n const index = useMemo(() => indexTree(data), [data]);\n const records = useMemo(() => checkRecords(index), [index]);\n const labelFor = (value: string) => {\n const entry = index.get(value);\n return entry ? nodeLabel(entry.node) : value;\n };\n\n // The value, as a list: none or one in `single`.\n const [held, setHeld] = useControlled<string | string[] | null>(\n valueProp,\n defaultValue ?? null\n );\n const listed = asList(held);\n const change = (next: string[]) => {\n const value = single ? (next[0] ?? null) : next;\n setHeld(value);\n // The mode decides which of the two `onChange` takes.\n const report = props.onChange as\n ((value: string | string[] | null) => void) | undefined;\n report?.(value);\n };\n // What the field, the tags and the hidden inputs show: the value as it's\n // held. `checkedStrategy` shapes a new value as a check makes it, so a\n // branch that loads later changes nothing the form posts.\n const picked = single ? listed.slice(0, 1) : Array.from(new Set(listed));\n\n const unknown = picked.find(value => !index.has(value));\n useEffect(() => {\n if (unknown !== undefined) {\n warnOnce(\n 'TreeSelect:unknown-value',\n `[bestax-bulma] <TreeSelect> was given the value \"${unknown}\", ` +\n 'which no node in its data has. It is kept and shown as it is, ' +\n 'as it should be for a node under a branch that has not loaded ' +\n 'yet. Otherwise, check the value against the data.'\n );\n }\n }, [unknown]);\n\n const [expanded, setExpanded] = useControlled(\n expandedProp,\n defaultExpanded\n );\n const changeExpanded = (next: string[]) => {\n setExpanded(next);\n onExpandedChange?.(next);\n };\n\n // The picked item focus goes to: the first in the tree's order.\n const pickedSet = new Set(picked);\n const target = Array.from(index.keys()).find(value => pickedSet.has(value));\n\n const [query, setQueryState] = useControlled(queryProp, defaultQuery);\n const setQuery = (next: string) => {\n if (next === query) return;\n setQueryState(next);\n onQueryChange?.(next);\n };\n\n const [isOpen, setOpenState] = useControlled(openProp, defaultOpen);\n const setOpen = (next: boolean) => {\n if (next === isOpen) return;\n if (next) {\n // Opening shows the picked item, its branch open.\n const path = (target !== undefined && index.get(target)?.path) || [];\n if (path.some(value => !expanded.includes(value))) {\n changeExpanded(withAll(expanded, path));\n }\n } else {\n setQuery('');\n }\n setOpenState(next);\n onOpenChange?.(next);\n };\n\n const matchText = useLocaleMatcher();\n const typed = searchable ? query.trim() : '';\n // Every item reads the hidden set, so it's only built again when the\n // search text or the data changes.\n const search = useMemo(\n () =>\n typed\n ? searchTree(data, (node, path) => {\n if (filter) return filter(typed, node, path);\n const text = nodeLabel(node);\n return matchText\n ? matchText(text, typed)\n : text.toLowerCase().includes(typed.toLowerCase());\n })\n : null,\n // `filter` is read as it is when the text or the data changes: one\n // written inline is a new function every render, and listing it would\n // search again on each.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data, typed, matchText]\n );\n // The branches a search opened that were closed during it, for the\n // search text they were closed under: any new text, from the box or\n // from a held `query`, starts over.\n const [searchClosed, setSearchClosed] = useState({\n query: typed,\n values: [] as string[],\n });\n if (searchClosed.query !== typed) {\n setSearchClosed({ query: typed, values: [] });\n }\n const closedHere = searchClosed.query === typed ? searchClosed.values : [];\n // The branches a search opens show open over the ones you opened, and\n // close again once it's cleared.\n const forced = search\n ? search.open.filter(value => !closedHere.includes(value))\n : [];\n const shownExpanded = withAll(expanded, forced);\n // TreeView's click on a row selects it and opens it. A pick by click, as\n // a pick by Enter, only picks, so the open the tree asks for right after\n // one on a parent is dropped, and a lazy parent isn't fetched to be\n // picked.\n const clickPickedRef = useRef(false);\n const onTreeExpandedChange = (next: string[]) => {\n if (clickPickedRef.current) {\n clickPickedRef.current = false;\n return;\n }\n const closed = shownExpanded.filter(value => !next.includes(value));\n const opened = next.filter(value => !shownExpanded.includes(value));\n const closedForced = closed.filter(value => forced.includes(value));\n if (closedForced.length > 0) {\n setSearchClosed({\n query: typed,\n values: [...closedHere, ...closedForced],\n });\n }\n if (opened.length > 0 || closed.some(value => expanded.includes(value))) {\n changeExpanded([\n ...expanded.filter(value => !closed.includes(value)),\n ...opened,\n ]);\n }\n };\n\n // Whether an item is on the page with the panel open: every branch\n // above it open, and the search not hiding it.\n const visible = (value: string) =>\n !search?.hidden.has(value) &&\n index.get(value)!.path.every(above => shownExpanded.includes(above));\n const focusTarget =\n target !== undefined && visible(target)\n ? target\n : data.find(node => visible(node.value))?.value;\n\n // Picking in `single`. TreeView shows `selected`, held here, and the\n // picks are made from the rows' own keys and clicks, so a parent can\n // open instead and a pick of the picked item still closes.\n const pickable = (node: TreeItemData) =>\n !node.disabled && (parentsSelectable || !isParentNode(node));\n const pick = (value: string) => {\n if (listed.length !== 1 || listed[0] !== value) change([value]);\n if (closeOnSelect) setOpen(false);\n };\n const toggleClass = usePrefixedClassNames('tree-view-toggle');\n const rowHandlers = (node: TreeItemData) =>\n single\n ? {\n onKeyDown: (event: React.KeyboardEvent<HTMLLIElement>) => {\n if (\n event.target !== event.currentTarget ||\n event.repeat ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n (event.key !== 'Enter' && event.key !== ' ')\n ) {\n return;\n }\n if (pickable(node)) {\n pick(node.value);\n } else if (!node.disabled && isParentNode(node)) {\n // TreeView leaves a key that's been used alone.\n event.preventDefault();\n onTreeExpandedChange(\n shownExpanded.includes(node.value)\n ? shownExpanded.filter(value => value !== node.value)\n : [...shownExpanded, node.value]\n );\n }\n },\n onClick: (event: React.MouseEvent<HTMLLIElement>) => {\n const item = event.currentTarget;\n const target = event.target as Element;\n // A click in this item's own row, where TreeView reads one,\n // not one in the group of items inside it, and not on its\n // chevron, which only opens it.\n const inRow =\n target === item || item.firstElementChild!.contains(target);\n const onChevron =\n isParentNode(node) && !!target.closest(`.${toggleClass}`);\n if (inRow && !onChevron && pickable(node)) {\n // TreeView opens a parent it's handed this click on, in\n // this same click: the flag goes once the click is over.\n clickPickedRef.current = isParentNode(node);\n queueMicrotask(() => {\n clickPickedRef.current = false;\n });\n pick(node.value);\n }\n },\n }\n : undefined;\n\n const renderNode = (node: TreeItemData): React.ReactNode => (\n <TreeView.Item\n key={node.value}\n value={node.value}\n label={itemTemplate ? itemTemplate(node) : nodeLabel(node)}\n icon={node.icon}\n hasChildren={node.hasChildren}\n isLoading={node.isLoading}\n loadError={node.loadError}\n onRetry={node.onRetry}\n disabled={node.disabled}\n data-initial-focus={\n !searchable && node.value === focusTarget ? '' : undefined\n }\n {...rowHandlers(node)}\n >\n {childNodes(node).map(renderNode)}\n </TreeView.Item>\n );\n\n // In `checkbox`, TreeView reports every checked item, read here into\n // the list `checkedStrategy` gives.\n const shaped = (next: string[]) =>\n cascade ? checkedByStrategy(records, next, checkedStrategy) : next;\n const onCheckedChange = (next: string[]) => change(shaped(next));\n // Every item's check state, read once a render, which the clear button\n // and the tags' buttons decide from. Only `checkbox` reads TreeView's\n // rules: in `checkbox-independent` a listed item is a checked one.\n const listedKey = JSON.stringify(listed);\n const checks = useMemo(\n () => (cascade ? readChecks(records, new Set(listed)) : null),\n // `listed` by what it holds, since a held list is a new array each\n // render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [cascade, records, listedKey]\n );\n const isDisabled = (value: string) => !!index.get(value)?.node.disabled;\n // Read in `checkbox` only, where there are states to read.\n const isChecked = (value: string) => checks!.states.get(value) === true;\n // What a control can uncheck. In `checkbox`, that's each checked end no\n // checked disabled item above it keeps checked, and every item above it,\n // which takes it along; elsewhere it's each listed item that isn't\n // disabled. A disabled item is checked only by its own value, so nothing\n // unchecks it, or what it keeps checked.\n const uncheckable = new Set<string>();\n if (checks) {\n for (const end of checks.ends) {\n const { path } = index.get(end)!;\n if (\n isChecked(end) &&\n !path.some(above => isDisabled(above) && isChecked(above))\n ) {\n uncheckable.add(end);\n path.forEach(above => uncheckable.add(above));\n }\n }\n } else if (!single) {\n picked.forEach(value => !isDisabled(value) && uncheckable.add(value));\n }\n // A tag's button takes its value off where that changes what's checked,\n // the way its box would. A value no node has can always go.\n const removable = (value: string) =>\n !index.has(value) || (!isDisabled(value) && uncheckable.has(value));\n const without = (value: string) =>\n cascade && records.has(value)\n ? shaped(toggledList(records, listed, value))\n : listed.filter(item => item !== value);\n // What the clear button leaves: the checked disabled items, and in\n // `checkbox` what they keep checked, shaped as a check's value is.\n const cleared = single\n ? []\n : shaped(\n checks\n ? Array.from(records.keys()).filter(\n value => isDisabled(value) && isChecked(value)\n )\n : picked.filter(isDisabled)\n );\n const canClear = single\n ? picked.length > 0\n : uncheckable.size > 0 || picked.some(value => !index.has(value));\n const inputRef = useRef<HTMLInputElement | null>(null);\n // A forwarded callback's cleanup, which React 19 lets it return, run on\n // detach in place of a call with `null`, on React 18 as well.\n const refCleanupRef = useRef<(() => void) | null>(null);\n const fieldRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n if (node === null) {\n const cleanup = refCleanupRef.current;\n refCleanupRef.current = null;\n if (cleanup) cleanup();\n else ref(null);\n return;\n }\n const cleanup: unknown = ref(node);\n refCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n const tagsId = useId();\n const ids = tagIds(tagsId, picked);\n\n const searchClass = usePrefixedClassNames('input', 'tree-select-search', {\n [`is-${size}`]: !!size,\n });\n const emptyClass = usePrefixedClassNames('tree-select-empty');\n const treeRef = useRef<HTMLUListElement>(null);\n const emptyRef = useRef<HTMLDivElement>(null);\n const nothingFound = !!search && !search.found;\n // The region reads the text on screen, whatever `empty` renders.\n const describeEmpty = useCallback(() => {\n const node = emptyRef.current;\n /* istanbul ignore if: it's only announced while it's on screen */\n if (!node) return null;\n return spokenText(node);\n }, []);\n\n return (\n <DialogSelect\n {...rest}\n component=\"TreeSelect\"\n rootClass=\"tree-select\"\n panelClass=\"tree-select-panel\"\n text={single && picked.length > 0 ? labelFor(picked[0]) : ''}\n values={single ? [picked[0] ?? ''] : picked}\n hasValue={picked.length > 0}\n open={isOpen}\n onOpenChange={setOpen}\n onPrintableKey={\n searchable\n ? key => {\n setQuery(key);\n setOpen(true);\n return true;\n }\n : undefined\n }\n onClear={() => change(cleared)}\n clearable={clearable && canClear}\n onFormReset={() => {\n // Back to `defaultValue`, or to nothing for a held value, which\n // its owner sets from `onChange`.\n const back = valueProp === undefined ? asList(defaultValue) : [];\n if (!sameValues(back, listed)) change(back);\n }}\n clearLabel={labels?.clear || 'Clear'}\n chooseLabel={labels?.choose}\n disabled={disabled}\n size={size}\n inputRef={inputRef}\n fieldRef={fieldRef}\n describedBy={single ? undefined : ids.join(' ')}\n below={\n single ? undefined : (\n <ValueTags\n values={picked}\n ids={ids}\n labelFor={labelFor}\n disabled={disabled}\n ariaCloseLabel={ariaCloseLabel}\n removable={removable}\n onRemove={value => {\n change(without(value));\n inputRef.current?.focus();\n }}\n />\n )\n }\n initialFocusSelector={INITIAL_FOCUS}\n >\n {panelName => (\n <>\n {searchable && (\n <input\n className={searchClass}\n type=\"search\"\n aria-label={labels?.search || 'Search'}\n autoComplete=\"off\"\n value={query}\n data-initial-focus=\"\"\n onChange={event => setQuery(event.target.value)}\n onFocus={event => {\n // A key that opened the panel is in the box: type after it.\n const { length } = event.currentTarget.value;\n event.currentTarget.setSelectionRange(length, length);\n }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // The search box's Enter would submit the form.\n event.preventDefault();\n } else if (event.key === 'ArrowDown' && !event.altKey) {\n event.preventDefault();\n const tree = treeRef.current;\n (\n tree?.querySelector<HTMLElement>(\n '[role=\"treeitem\"][tabindex=\"0\"]'\n ) ?? tree?.querySelector<HTMLElement>('[role=\"treeitem\"]')\n )?.focus();\n }\n }}\n />\n )}\n {nothingFound ? (\n empty && (\n <div className={emptyClass} ref={emptyRef}>\n {empty}\n </div>\n )\n ) : (\n <TreeViewHiddenContext.Provider\n value={search?.hidden ?? NOTHING_HIDDEN}\n >\n <TreeView\n {...panelName}\n ref={treeRef}\n // It scrolls, and Firefox makes a scroller a Tab stop of\n // its own: the roving one on its items is the tree's.\n tabIndex={-1}\n selectionMode={selectionMode}\n size={size}\n selected={single ? (picked[0] ?? null) : undefined}\n checked={single ? undefined : listed}\n onCheckedChange={onCheckedChange}\n expanded={shownExpanded}\n onExpandedChange={onTreeExpandedChange}\n loadingLabel={labels?.loading}\n retryLabel={labels?.retry}\n loadingAnnouncement={labels?.loadingAnnouncement}\n loadedAnnouncement={labels?.loadedAnnouncement}\n >\n {data.map(renderNode)}\n </TreeView>\n </TreeViewHiddenContext.Provider>\n )}\n <StatusRegion\n items={nothingFound && empty ? noMatches : nothingToSay}\n describe={describeEmpty}\n />\n </>\n )}\n </DialogSelect>\n );\n }\n);\n\nTreeSelect.displayName = 'TreeSelect';\n\nexport default TreeSelect;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AA2TA,MAAM,cAAc,GAAwB,IAAI,GAAG,EAAE;AACrD,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACnC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CACP,KAEDA,GAAA,CAAC,qBAAqB,CAAC,QAAQ,EAAA,EAC7B,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,cAAc,YAEvCA,GAAA,CAAC,QAAQ,OACH,SAAS,EACb,GAAG,EAAE,OAAO;;;wBAGZ,QAAQ,EAAE,EAAE,EACZ,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,SAAS,EAClD,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EACpC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,oBAAoB,EACtC,YAAY,EAAE,MAAM,EAAE,OAAO,EAC7B,UAAU,EAAE,MAAM,EAAE,KAAK,EACzB,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAChD,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAA,QAAA,EAE7C,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAA,CACZ,GACoB,CAClC,EACDA,GAAA,CAAC,YAAY,EAAA,EACX,KAAK,EAAE,YAAY,IAAI,KAAK,GAAG,SAAS,GAAG,YAAY,EACvD,QAAQ,EAAE,aAAa,EAAA,CACvB,CAAA,EAAA,CACD,CACJ,EAAA,CACY;AAEnB,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
1
|
+
{"version":3,"file":"TreeSelect.js","sources":["../../../src/form/TreeSelect.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { usePrefixedClassNames } from '../helpers/classNames';\nimport type { BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher } from '../helpers/localeFormat';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport {\n TreeViewHiddenContext,\n readChecks,\n toggledList,\n} from '../helpers/useTreeView';\nimport { useControlled } from '../helpers/useControlled';\nimport {\n checkRecords,\n checkedByStrategy,\n childNodes,\n indexTree,\n isParentNode,\n nodeLabel,\n searchTree,\n} from '../helpers/treeData';\nimport { TreeView } from '../components/TreeView';\nimport type { FormFieldProps } from './fieldProps';\nimport { useFieldsetDisabled } from './FormContext';\nimport type { PickerPosition } from './_pickerInternals/pickerTypes';\nimport { DialogSelect } from './_selectInternals/DialogSelect';\nimport { ValueTags, tagIds } from './_selectInternals/ValueTags';\n\n/**\n * One node in a TreeSelect's `data`: Combobox's item fields plus\n * TreeView.Item's, with `children` for the nodes under it.\n */\nexport interface TreeItemData {\n /** **Required.** What the value holds and `name` posts. Unique in the whole tree. */\n value: string;\n /** What the row, the field and the tags show, and what search matches. The `value` when it's left out. */\n label?: string;\n /** Reachable, but never picked, checked, opened or closed. */\n disabled?: boolean;\n /** A picture before the label: an `Icon` name, or a node. Hidden from assistive tech. */\n icon?: React.ReactNode;\n /** The nodes under this one. */\n children?: TreeItemData[];\n /** Shows the node as a parent before its children are known, for a branch that loads when it opens. */\n hasChildren?: boolean;\n /** Its children are on their way: an open branch ends in a row that says so, and the live region says it too. */\n isLoading?: boolean;\n /** Its children didn't load: an open branch ends in this message, with a Retry button when there's an `onRetry`. */\n loadError?: React.ReactNode;\n /** Called by the Retry button on a failed load's row. Set `isLoading` while the retry runs. */\n onRetry?: () => void;\n}\n\n/** What a checked branch puts in the value a check makes. */\nexport type TreeSelectCheckedStrategy = 'child' | 'parent' | 'all';\n\n/** The visible and accessible strings, in your app's language. */\nexport interface TreeSelectLabels {\n /**\n * Names the panel and the tree in it.\n * @defaultValue the field's label\n */\n choose?: string;\n /**\n * Names the search box.\n * @defaultValue 'Search'\n */\n search?: string;\n /**\n * Names the clear button.\n * @defaultValue 'Clear'\n */\n clear?: string;\n /**\n * What a loading branch's row says, as on TreeView.\n * @defaultValue 'Loading…'\n */\n loading?: string;\n /**\n * The Retry button's text on a failed load's row, as on TreeView.\n * @defaultValue 'Retry'\n */\n retry?: string;\n /**\n * What the live region says when an open branch starts loading, built\n * from its name, as on TreeView.\n * @defaultValue name => `Loading ${name}`\n */\n loadingAnnouncement?: (name: string) => string;\n /**\n * What the live region says when that load finishes, as on TreeView.\n * @defaultValue name => `${name} loaded`\n */\n loadedAnnouncement?: (name: string) => string;\n}\n\n/**\n * What every TreeSelect takes. The helper props and the other attributes\n * land on the root `<div>`, as Combobox's do, and the `ref` on the field.\n */\ninterface TreeSelectBaseProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'defaultValue' | 'children'\n >,\n Omit<BulmaClassesProps, 'color'>,\n FormFieldProps {\n /** **Required.** The tree, as nodes nested through `children`. */\n data: TreeItemData[];\n /**\n * The field's label, which names the field through `htmlFor`, and the\n * panel and the tree in it through `aria-labelledby`. Dropped inside an\n * outer `Field`, whose label names them instead.\n */\n label?: React.ReactNode;\n /** The field's `id`, which the label then points at. The panel's is this one with `-panel` after it. */\n id?: string;\n /** Names the field, and the panel and the tree, in place of a `label`. */\n 'aria-label'?: string;\n /** The ids of what names the field, and the panel and the tree, in place of a `label`. */\n 'aria-labelledby'?: string;\n /** The ids of what describes the field, ahead of the tags. */\n 'aria-describedby'?: string;\n /** The open branches' values when you hold the state, as TreeView's `expanded`. */\n expanded?: string[];\n /** The branches open to begin with, when TreeSelect holds its own state. */\n defaultExpanded?: string[];\n /**\n * Called with the new list whenever a branch opens or closes, opening the\n * panel on the picked item's branch included. Fetch a lazy branch's\n * children from here. The branches a search opens aren't in it.\n */\n onExpandedChange?: (expanded: string[]) => void;\n /** Whether the panel is open, controlled: opening and closing then only call `onOpenChange`. */\n open?: boolean;\n /** The panel is open to begin with. */\n defaultOpen?: boolean;\n /** Called with the new state when the panel opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Puts a search box at the top of the panel. It matches labels, keeps a\n * match's ancestors and the nodes under it, and opens every branch with a\n * match. A printable key on the field opens the panel with it in the box,\n * and the search empties when the panel closes.\n */\n searchable?: boolean;\n /** The search text when you hold the state. */\n query?: string;\n /** The search text to begin with. */\n defaultQuery?: string;\n /** Called with the search text as it changes. */\n onQueryChange?: (query: string) => void;\n /**\n * Whether a node matches the search, in place of the locale-aware match on\n * its label. It's handed the search text trimmed, the node, and its path\n * from the top node down, the node last, as Cascader's `filter` is. A\n * match's ancestors stay either way. The search runs again when the search\n * text or `data` changes, not when only this does, so one written inline\n * costs nothing.\n */\n filter?: (query: string, item: TreeItemData, path: TreeItemData[]) => boolean;\n /** What the panel shows when the search matches nothing, such as \"No folders match\". Announced once. */\n empty?: React.ReactNode;\n /** Renders a row's content in place of its label. The field and the tags still show the label. */\n itemTemplate?: (item: TreeItemData) => React.ReactNode;\n /** What the field shows while nothing is picked. */\n placeholder?: string;\n /** A form field name. A hidden input posts the value, or one per value in the checkbox modes. */\n name?: string;\n /** The id of the form the hidden inputs belong to, when it isn't an ancestor. */\n form?: string;\n /**\n * A value is needed: the field is `aria-required`, and the form won't\n * submit while nothing is picked. The browser's message points at the\n * field, which shows focus, and the next key goes to it.\n */\n required?: boolean;\n /** The field can't be used: it can't be focused or opened, its tags lose their buttons, and its hidden inputs don't post. */\n disabled?: boolean;\n /**\n * Shows a clear button at the field's inline end while something it can\n * take off is picked. It leaves checked disabled items, which no control\n * unchecks.\n */\n clearable?: boolean;\n /** Bulma color modifier for the field. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** The field's size, which the tree in the panel follows. */\n size?: 'small' | 'medium' | 'large';\n /** Rounds the field's corners (Bulma's `is-rounded`). */\n isRounded?: boolean;\n /**\n * Where the panel opens against the field, as on the pickers. Left out, it\n * opens below and lines up with the field's start edge, which is its right\n * edge on a right-to-left page. A corner you pass stays physical, so\n * `bottom-left` lines up the left edges either way.\n * @defaultValue 'bottom-left'\n */\n position?: PickerPosition;\n /** Renders the panel through a portal, into a `ConfigProvider`'s `portalContainer`, `document.body` by default. */\n appendToBody?: boolean;\n /** The visible and accessible strings, in your app's language. */\n labels?: TreeSelectLabels;\n}\n\n/** Props for a TreeSelect that picks one item. */\nexport interface TreeSelectSingleProps extends TreeSelectBaseProps {\n /**\n * `'single'`: one item, picked with Enter, Space or a click on its row.\n * `'checkbox'`: any number, with a box on every item. A check reaches every\n * enabled item under it, and a parent with some of them checked is mixed.\n * `'checkbox-independent'`: any number, each box checking its own item, so\n * a parent means the parent alone (Mantine's and Ant Design's\n * `checkStrictly`). The checkbox modes show the value as tags.\n */\n selectionMode?: 'single';\n /**\n * The value when you hold the state: in `'single'` the picked item's\n * value, or `null` for none, and in the checkbox modes the checked values.\n * In `'checkbox'` a parent's value checks its whole branch, so the list any\n * `checkedStrategy` gives checks the same boxes.\n */\n value?: string | null;\n /** The value to begin with, when TreeSelect holds its own state: a value or `null`, or a list in the checkbox modes. */\n defaultValue?: string | null;\n /**\n * Called with the new value: in `'single'` the picked item's value, or\n * `null` when it's cleared, and in the checkbox modes the new list, after a\n * check, an uncheck, a tag's button or the clear button, each shaped by\n * `checkedStrategy`. A reset of the field's form calls it too, with\n * `defaultValue` as it was given, or with `null` or `[]` when you hold\n * the value, for you to set.\n */\n onChange?: (value: string | null) => void;\n /**\n * A parent's row picks the parent. `false` makes the row, Enter and Space\n * open it instead, so only leaves are picked.\n * @defaultValue true\n */\n parentsSelectable?: boolean;\n /**\n * Closes the panel after a pick and puts focus back on the field.\n * @defaultValue true\n */\n closeOnSelect?: boolean;\n /** Read with the checkbox modes only. */\n checkedStrategy?: never;\n /** Read with the checkbox modes only. */\n ariaCloseLabel?: never;\n}\n\n/** Props for a TreeSelect with a box on every item. */\nexport interface TreeSelectCheckboxProps extends TreeSelectBaseProps {\n /**\n * `'checkbox'`: a check reaches every enabled item under it, and a parent\n * with some of them checked is mixed. `'checkbox-independent'`: each box\n * checks its own item, so a parent means the parent alone.\n */\n selectionMode: 'checkbox' | 'checkbox-independent';\n /**\n * The checked values when you hold the state. In `'checkbox'`, a parent's\n * value checks its whole branch, so the list any `checkedStrategy` gives\n * checks the same boxes.\n */\n value?: string[];\n /** The values checked to begin with, when TreeSelect holds its own state. */\n defaultValue?: string[];\n /**\n * Called with the new list after a check, an uncheck, a tag's button or\n * the clear button, shaped by `checkedStrategy`, and after a reset of the\n * field's form, with `defaultValue` as given, or `[]` when you hold the\n * value.\n */\n onChange?: (value: string[]) => void;\n /**\n * What a checked branch puts in the value, in `'checkbox'`: `'child'` its\n * leaves, `'parent'` its topmost checked item, `'all'` every checked item,\n * parents included. A checked disabled item is in all three, since only\n * its own value checks it. It shapes the value a check, an uncheck, a\n * tag's button or the clear button makes, which `onChange` reports, and\n * not `defaultValue`, a value you pass or the one a form reset puts back.\n * The tags and the hidden\n * inputs show the value as it's held, so a value you pass shows as you\n * pass it, and a branch that loads later changes nothing the form posts.\n * `'checkbox-independent'` always reports exactly the checked items.\n * @defaultValue 'child'\n */\n checkedStrategy?: TreeSelectCheckedStrategy;\n /** Names each tag's button, in place of \"Remove\" and the item's label, as on Combobox. */\n ariaCloseLabel?: string;\n /** Read with `'single'` only. */\n parentsSelectable?: never;\n /** Read with `'single'` only: the panel stays open while boxes are checked. */\n closeOnSelect?: never;\n}\n\n/**\n * Props for the TreeSelect component. The helper props and the other\n * attributes land on the `div.tree-select` around the field, and the `ref`\n * on the field. It renders the `Field` and the label itself, unless an outer\n * `Field` already does.\n *\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Ref forwarded to the field, the read-only `<input role=\"combobox\">`.\n */\nexport type TreeSelectProps = TreeSelectSingleProps | TreeSelectCheckboxProps;\n\nconst NOTHING_HIDDEN: ReadonlySet<string> = new Set();\nconst noMatches = [{ id: 'empty' }];\nconst nothingToSay: Array<{ id: string }> = [];\n/** What takes focus as the panel opens. */\nconst INITIAL_FOCUS = '[data-initial-focus]';\n\n/** One value or several, as a list. */\nconst asList = (value: string | string[] | null | undefined): string[] =>\n value == null ? [] : Array.isArray(value) ? value : [value];\n\n/** Whether two lists hold the same values, whatever their order and repeats. */\nconst sameValues = (a: string[], b: string[]): boolean => {\n const inA = new Set(a);\n const inB = new Set(b);\n return inA.size === inB.size && [...inA].every(value => inB.has(value));\n};\n\n/** The list with every value of `more` it doesn't have added at the end. */\nconst withAll = (list: string[], more: string[]): string[] => [\n ...list,\n ...more.filter(value => !list.includes(value)),\n];\n\n/**\n * The `TreeSelect` component is a form field whose options are a tree, such as categories, places or teams: it opens a panel holding a real `TreeView`, picks one item or checks a branch at a time, and searches labels.\n *\n * The field is a read-only `role=\"combobox\"` that opens a dialog, wired as\n * DateInput's is, so focus moves into the tree for real and the tree keeps\n * TreeView's keys, type-ahead and spoken output. The tree is given as `data`,\n * so the field and the tags can name what's picked while the panel is shut,\n * and on the server.\n *\n * `selectionMode` picks the kind. `'single'` picks one item and closes. With\n * `'checkbox'`, a check reaches every enabled item under it, closed or hidden\n * by a search, and `checkedStrategy` decides what the value holds: the\n * leaves, the topmost checked items or every one. With\n * `'checkbox-independent'`, each box is its own item's, so a parent means\n * itself alone (Mantine's and Ant Design's `checkStrictly`). The value shows\n * as tags under the field.\n *\n * A value no node has is kept and shown as it is, with a warning in\n * development, so a value under a branch that hasn't loaded survives until\n * it does.\n *\n * @function\n * @param {TreeSelectProps} props - Props for the TreeSelect component.\n * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the field.\n * @returns {JSX.Element} The field, its tags and its panel, in a `Field` with the label unless one is around it.\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/combobox/ | APG Combobox Pattern}\n *\n * @example\n * <TreeSelect\n * label=\"Save to\"\n * data={[\n * { value: 'docs', label: 'Documents', children: [{ value: 'invoices', label: 'Invoices' }] },\n * { value: 'photos', label: 'Photos' },\n * ]}\n * searchable\n * />\n *\n * @example\n * <TreeSelect label=\"Regions\" selectionMode=\"checkbox\" checkedStrategy=\"parent\" data={regions} />\n */\nexport const TreeSelect = forwardRef<HTMLInputElement, TreeSelectProps>(\n (props, ref) => {\n const {\n data,\n expanded: expandedProp,\n defaultExpanded = [],\n onExpandedChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n searchable = false,\n query: queryProp,\n defaultQuery = '',\n onQueryChange,\n filter,\n empty,\n itemTemplate,\n disabled: disabledProp,\n clearable = false,\n size,\n labels,\n selectionMode = 'single',\n value: valueProp,\n defaultValue,\n // Called below through `props`, which knows which value it takes.\n onChange: _onChange,\n parentsSelectable = true,\n closeOnSelect = true,\n checkedStrategy = 'child',\n ariaCloseLabel,\n ...rest\n } = props;\n const disabled = useFieldsetDisabled(disabledProp);\n const single = selectionMode === 'single';\n const cascade = selectionMode === 'checkbox';\n\n const index = useMemo(() => indexTree(data), [data]);\n const records = useMemo(() => checkRecords(index), [index]);\n const labelFor = (value: string) => {\n const entry = index.get(value);\n return entry ? nodeLabel(entry.node) : value;\n };\n\n // The value, as a list: none or one in `single`.\n const [held, setHeld] = useControlled<string | string[] | null>(\n valueProp,\n defaultValue ?? null\n );\n const listed = asList(held);\n const change = (next: string[]) => {\n const value = single ? (next[0] ?? null) : next;\n setHeld(value);\n // The mode decides which of the two `onChange` takes.\n const report = props.onChange as\n ((value: string | string[] | null) => void) | undefined;\n report?.(value);\n };\n // What the field, the tags and the hidden inputs show: the value as it's\n // held. `checkedStrategy` shapes a new value as a check makes it, so a\n // branch that loads later changes nothing the form posts.\n const picked = single ? listed.slice(0, 1) : Array.from(new Set(listed));\n\n const unknown = picked.find(value => !index.has(value));\n useEffect(() => {\n if (unknown !== undefined) {\n warnOnce(\n 'TreeSelect:unknown-value',\n `[bestax-bulma] <TreeSelect> was given the value \"${unknown}\", ` +\n 'which no node in its data has. It is kept and shown as it is, ' +\n 'as it should be for a node under a branch that has not loaded ' +\n 'yet. Otherwise, check the value against the data.'\n );\n }\n }, [unknown]);\n\n const [expanded, setExpanded] = useControlled(\n expandedProp,\n defaultExpanded\n );\n const changeExpanded = (next: string[]) => {\n setExpanded(next);\n onExpandedChange?.(next);\n };\n\n // The picked item focus goes to: the first in the tree's order.\n const pickedSet = new Set(picked);\n const target = Array.from(index.keys()).find(value => pickedSet.has(value));\n\n const [query, setQueryState] = useControlled(queryProp, defaultQuery);\n const setQuery = (next: string) => {\n if (next === query) return;\n setQueryState(next);\n onQueryChange?.(next);\n };\n\n const [isOpen, setOpenState] = useControlled(openProp, defaultOpen);\n const setOpen = (next: boolean) => {\n if (next === isOpen) return;\n if (next) {\n // Opening shows the picked item, its branch open.\n const path = (target !== undefined && index.get(target)?.path) || [];\n if (path.some(value => !expanded.includes(value))) {\n changeExpanded(withAll(expanded, path));\n }\n } else {\n setQuery('');\n }\n setOpenState(next);\n onOpenChange?.(next);\n };\n\n const matchText = useLocaleMatcher();\n const typed = searchable ? query.trim() : '';\n // Every item reads the hidden set, so it's only built again when the\n // search text or the data changes.\n const search = useMemo(\n () =>\n typed\n ? searchTree(data, (node, path) => {\n if (filter) return filter(typed, node, path);\n const text = nodeLabel(node);\n return matchText\n ? matchText(text, typed)\n : text.toLowerCase().includes(typed.toLowerCase());\n })\n : null,\n // `filter` is read as it is when the text or the data changes: one\n // written inline is a new function every render, and listing it would\n // search again on each.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data, typed, matchText]\n );\n // The branches a search opened that were closed during it, for the\n // search text they were closed under: any new text, from the box or\n // from a held `query`, starts over.\n const [searchClosed, setSearchClosed] = useState({\n query: typed,\n values: [] as string[],\n });\n if (searchClosed.query !== typed) {\n setSearchClosed({ query: typed, values: [] });\n }\n const closedHere = searchClosed.query === typed ? searchClosed.values : [];\n // The branches a search opens show open over the ones you opened, and\n // close again once it's cleared.\n const forced = search\n ? search.open.filter(value => !closedHere.includes(value))\n : [];\n const shownExpanded = withAll(expanded, forced);\n // TreeView's click on a row selects it and opens it. A pick by click, as\n // a pick by Enter, only picks, so the open the tree asks for right after\n // one on a parent is dropped, and a lazy parent isn't fetched to be\n // picked.\n const clickPickedRef = useRef(false);\n const onTreeExpandedChange = (next: string[]) => {\n if (clickPickedRef.current) {\n clickPickedRef.current = false;\n return;\n }\n const closed = shownExpanded.filter(value => !next.includes(value));\n const opened = next.filter(value => !shownExpanded.includes(value));\n const closedForced = closed.filter(value => forced.includes(value));\n if (closedForced.length > 0) {\n setSearchClosed({\n query: typed,\n values: [...closedHere, ...closedForced],\n });\n }\n if (opened.length > 0 || closed.some(value => expanded.includes(value))) {\n changeExpanded([\n ...expanded.filter(value => !closed.includes(value)),\n ...opened,\n ]);\n }\n };\n\n // Whether an item is on the page with the panel open: every branch\n // above it open, and the search not hiding it.\n const visible = (value: string) =>\n !search?.hidden.has(value) &&\n index.get(value)!.path.every(above => shownExpanded.includes(above));\n const focusTarget =\n target !== undefined && visible(target)\n ? target\n : data.find(node => visible(node.value))?.value;\n\n // Picking in `single`. TreeView shows `selected`, held here, and the\n // picks are made from the rows' own keys and clicks, so a parent can\n // open instead and a pick of the picked item still closes.\n const pickable = (node: TreeItemData) =>\n !node.disabled && (parentsSelectable || !isParentNode(node));\n const pick = (value: string) => {\n if (listed.length !== 1 || listed[0] !== value) change([value]);\n if (closeOnSelect) setOpen(false);\n };\n const toggleClass = usePrefixedClassNames('tree-view-toggle');\n const rowHandlers = (node: TreeItemData) =>\n single\n ? {\n onKeyDown: (event: React.KeyboardEvent<HTMLLIElement>) => {\n if (\n event.target !== event.currentTarget ||\n event.repeat ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n (event.key !== 'Enter' && event.key !== ' ')\n ) {\n return;\n }\n if (pickable(node)) {\n pick(node.value);\n } else if (!node.disabled && isParentNode(node)) {\n // TreeView leaves a key that's been used alone.\n event.preventDefault();\n onTreeExpandedChange(\n shownExpanded.includes(node.value)\n ? shownExpanded.filter(value => value !== node.value)\n : [...shownExpanded, node.value]\n );\n }\n },\n onClick: (event: React.MouseEvent<HTMLLIElement>) => {\n const item = event.currentTarget;\n const target = event.target as Element;\n // A click in this item's own row, where TreeView reads one,\n // not one in the group of items inside it, and not on its\n // chevron, which only opens it.\n const inRow =\n target === item || item.firstElementChild!.contains(target);\n const onChevron =\n isParentNode(node) && !!target.closest(`.${toggleClass}`);\n if (inRow && !onChevron && pickable(node)) {\n // TreeView opens a parent it's handed this click on, in\n // this same click: the flag goes once the click is over.\n clickPickedRef.current = isParentNode(node);\n queueMicrotask(() => {\n clickPickedRef.current = false;\n });\n pick(node.value);\n }\n },\n }\n : undefined;\n\n const renderNode = (node: TreeItemData): React.ReactNode => (\n <TreeView.Item\n key={node.value}\n value={node.value}\n label={itemTemplate ? itemTemplate(node) : nodeLabel(node)}\n icon={node.icon}\n hasChildren={node.hasChildren}\n isLoading={node.isLoading}\n loadError={node.loadError}\n onRetry={node.onRetry}\n disabled={node.disabled}\n data-initial-focus={\n !searchable && node.value === focusTarget ? '' : undefined\n }\n {...rowHandlers(node)}\n >\n {childNodes(node).map(renderNode)}\n </TreeView.Item>\n );\n\n // In `checkbox`, TreeView reports every checked item, read here into\n // the list `checkedStrategy` gives.\n const shaped = (next: string[]) =>\n cascade ? checkedByStrategy(records, next, checkedStrategy) : next;\n const onCheckedChange = (next: string[]) => change(shaped(next));\n // Every item's check state, read once a render, which the clear button\n // and the tags' buttons decide from. Only `checkbox` reads TreeView's\n // rules: in `checkbox-independent` a listed item is a checked one.\n const listedKey = JSON.stringify(listed);\n const checks = useMemo(\n () => (cascade ? readChecks(records, new Set(listed)) : null),\n // `listed` by what it holds, since a held list is a new array each\n // render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [cascade, records, listedKey]\n );\n const isDisabled = (value: string) => !!index.get(value)?.node.disabled;\n // Read in `checkbox` only, where there are states to read.\n const isChecked = (value: string) => checks!.states.get(value) === true;\n // What a control can uncheck. In `checkbox`, that's each checked end no\n // checked disabled item above it keeps checked, and every item above it,\n // which takes it along; elsewhere it's each listed item that isn't\n // disabled. A disabled item is checked only by its own value, so nothing\n // unchecks it, or what it keeps checked.\n const uncheckable = new Set<string>();\n if (checks) {\n for (const end of checks.ends) {\n const { path } = index.get(end)!;\n if (\n isChecked(end) &&\n !path.some(above => isDisabled(above) && isChecked(above))\n ) {\n uncheckable.add(end);\n path.forEach(above => uncheckable.add(above));\n }\n }\n } else if (!single) {\n picked.forEach(value => !isDisabled(value) && uncheckable.add(value));\n }\n // A tag's button takes its value off where that changes what's checked,\n // the way its box would. A value no node has can always go.\n const removable = (value: string) =>\n !index.has(value) || (!isDisabled(value) && uncheckable.has(value));\n const without = (value: string) =>\n cascade && records.has(value)\n ? shaped(toggledList(records, listed, value))\n : listed.filter(item => item !== value);\n // What the clear button leaves: the checked disabled items, and in\n // `checkbox` what they keep checked, shaped as a check's value is.\n const cleared = single\n ? []\n : shaped(\n checks\n ? Array.from(records.keys()).filter(\n value => isDisabled(value) && isChecked(value)\n )\n : picked.filter(isDisabled)\n );\n const canClear = single\n ? picked.length > 0\n : uncheckable.size > 0 || picked.some(value => !index.has(value));\n const inputRef = useRef<HTMLInputElement | null>(null);\n // A forwarded callback's cleanup, which React 19 lets it return, run on\n // detach in place of a call with `null`, on React 18 as well.\n const refCleanupRef = useRef<(() => void) | null>(null);\n const fieldRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n if (node === null) {\n const cleanup = refCleanupRef.current;\n refCleanupRef.current = null;\n if (cleanup) cleanup();\n else ref(null);\n return;\n }\n const cleanup: unknown = ref(node);\n refCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n const tagsId = useId();\n const ids = tagIds(tagsId, picked);\n\n const searchClass = usePrefixedClassNames('input', 'tree-select-search', {\n [`is-${size}`]: !!size,\n });\n const emptyClass = usePrefixedClassNames('tree-select-empty');\n const treeRef = useRef<HTMLUListElement>(null);\n const emptyRef = useRef<HTMLDivElement>(null);\n const nothingFound = !!search && !search.found;\n // The region reads the text on screen, whatever `empty` renders.\n const describeEmpty = useCallback(() => {\n const node = emptyRef.current;\n /* istanbul ignore if: it's only announced while it's on screen */\n if (!node) return null;\n return spokenText(node);\n }, []);\n\n return (\n <DialogSelect\n {...rest}\n component=\"TreeSelect\"\n rootClass=\"tree-select\"\n panelClass=\"tree-select-panel\"\n text={single && picked.length > 0 ? labelFor(picked[0]) : ''}\n values={single ? [picked[0] ?? ''] : picked}\n hasValue={picked.length > 0}\n open={isOpen}\n onOpenChange={setOpen}\n onPrintableKey={\n searchable\n ? key => {\n setQuery(key);\n setOpen(true);\n return true;\n }\n : undefined\n }\n onClear={() => change(cleared)}\n clearable={clearable && canClear}\n onFormReset={() => {\n // Back to `defaultValue`, or to nothing for a held value, which\n // its owner sets from `onChange`.\n const back = valueProp === undefined ? asList(defaultValue) : [];\n if (!sameValues(back, listed)) change(back);\n }}\n clearLabel={labels?.clear || 'Clear'}\n chooseLabel={labels?.choose}\n disabled={disabled}\n size={size}\n inputRef={inputRef}\n fieldRef={fieldRef}\n describedBy={single ? undefined : ids.join(' ')}\n below={\n single ? undefined : (\n <ValueTags\n values={picked}\n ids={ids}\n labelFor={labelFor}\n disabled={disabled}\n ariaCloseLabel={ariaCloseLabel}\n removable={removable}\n onRemove={value => {\n change(without(value));\n inputRef.current?.focus();\n }}\n />\n )\n }\n initialFocusSelector={INITIAL_FOCUS}\n >\n {panelName => (\n <>\n {searchable && (\n <input\n className={searchClass}\n type=\"search\"\n aria-label={labels?.search || 'Search'}\n autoComplete=\"off\"\n value={query}\n data-initial-focus=\"\"\n onChange={event => setQuery(event.target.value)}\n onFocus={event => {\n // A key that opened the panel is in the box: type after it.\n const { length } = event.currentTarget.value;\n event.currentTarget.setSelectionRange(length, length);\n }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n // The search box's Enter would submit the form.\n event.preventDefault();\n } else if (event.key === 'ArrowDown' && !event.altKey) {\n event.preventDefault();\n const tree = treeRef.current;\n (\n tree?.querySelector<HTMLElement>(\n '[role=\"treeitem\"][tabindex=\"0\"]'\n ) ?? tree?.querySelector<HTMLElement>('[role=\"treeitem\"]')\n )?.focus();\n }\n }}\n />\n )}\n {nothingFound ? (\n empty && (\n <div className={emptyClass} ref={emptyRef}>\n {empty}\n </div>\n )\n ) : (\n <TreeViewHiddenContext.Provider\n value={search?.hidden ?? NOTHING_HIDDEN}\n >\n <TreeView\n {...panelName}\n ref={treeRef}\n // It scrolls, and Firefox makes a scroller a Tab stop of\n // its own: the roving one on its items is the tree's.\n tabIndex={-1}\n selectionMode={selectionMode}\n size={size}\n selected={single ? (picked[0] ?? null) : undefined}\n checked={single ? undefined : listed}\n onCheckedChange={onCheckedChange}\n expanded={shownExpanded}\n onExpandedChange={onTreeExpandedChange}\n loadingLabel={labels?.loading}\n retryLabel={labels?.retry}\n loadingAnnouncement={labels?.loadingAnnouncement}\n loadedAnnouncement={labels?.loadedAnnouncement}\n >\n {data.map(renderNode)}\n </TreeView>\n </TreeViewHiddenContext.Provider>\n )}\n <StatusRegion\n items={nothingFound && empty ? noMatches : nothingToSay}\n describe={describeEmpty}\n />\n </>\n )}\n </DialogSelect>\n );\n }\n);\n\nTreeSelect.displayName = 'TreeSelect';\n\nexport default TreeSelect;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AA2TA,MAAM,cAAc,GAAwB,IAAI,GAAG,EAAE;AACrD,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACnC,MAAM,YAAY,GAA0B,EAAE;AAC9C;AACA,MAAM,aAAa,GAAG,sBAAsB;AAE5C;AACA,MAAM,MAAM,GAAG,CAAC,KAA2C,KACzD,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAE7D;AACA,MAAM,UAAU,GAAG,CAAC,CAAW,EAAE,CAAW,KAAa;AACvD,IAAA,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;AACtB,IAAA,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IACtB,OAAO,GAAG,CAAC,IAAI,KAA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,oBAAoB,EACtC,YAAY,EAAE,MAAM,EAAE,OAAO,EAC7B,UAAU,EAAE,MAAM,EAAE,KAAK,EACzB,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAChD,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAA,QAAA,EAE7C,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAA,CACZ,GACoB,CAClC,EACDA,GAAA,CAAC,YAAY,EAAA,EACX,KAAK,EAAE,YAAY,IAAI,KAAK,GAAG,SAAS,GAAG,YAAY,EACvD,QAAQ,EAAE,aAAa,EAAA,CACvB,CAAA,EAAA,CACD,CACJ,EAAA,CACY;AAEnB,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
@@ -6,6 +6,7 @@ import { usePrefixedClassNames, prefixedClassNames, classNames } from '../../hel
|
|
|
6
6
|
import { useConfig } from '../../helpers/Config.js';
|
|
7
7
|
import { getActiveElementInTree } from '../../helpers/shadowDom.js';
|
|
8
8
|
import { visuallyHidden } from '../../helpers/statusRegion.js';
|
|
9
|
+
import { useIsHydrated } from '../../helpers/useIsHydrated.js';
|
|
9
10
|
import { mergeLabels, isPopoverToggleKey } from './pickerTypes.js';
|
|
10
11
|
import { floorMin, buildMonthGrid, isDayUnselectable, isPeriodUnselectable, makeDate, canCloseRange, startOfDay, addDays, isSameDay, addYears, addMonths, startOfMonth, clampDate, FIRST_YEAR, isSameMonth } from './dateUtils.js';
|
|
11
12
|
import { getDayNames, getMonthNames, formatDate } from './formatters.js';
|
|
@@ -433,8 +434,13 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
433
434
|
const monthsRowClass = usePrefixedClassNames('dateinput-months-row');
|
|
434
435
|
const yearsGridClass = usePrefixedClassNames('dateinput-years-grid');
|
|
435
436
|
const focusedYear = focusedDate.getFullYear();
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
// Today is the reader's, so it's marked only once the page has hydrated: a
|
|
438
|
+
// server render and the render hydrating it mark no day, month or year,
|
|
439
|
+
// and the commit after marks the browser's own. A calendar mounted after
|
|
440
|
+
// hydration marks it from its first render.
|
|
441
|
+
const hydrated = useIsHydrated();
|
|
442
|
+
const today = hydrated ? new Date() : null;
|
|
443
|
+
const todayYear = today?.getFullYear();
|
|
438
444
|
// The header steps a month at a time over the day grid and a year at a
|
|
439
445
|
// time over the month grid, kept inside min/max. A step is off once the
|
|
440
446
|
// month or year on show holds the bound or lies past it, as picking a year
|
|
@@ -671,6 +677,7 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
671
677
|
.join(' ') || undefined
|
|
672
678
|
: undefined;
|
|
673
679
|
const isFocused = isSameDay(cell.date, tabStopDay);
|
|
680
|
+
const isToday = hydrated && cell.isToday;
|
|
674
681
|
const otherMonth = !cell.inCurrentMonth;
|
|
675
682
|
const cellClass = prefixedClassNames(classPrefix, 'dateinput-cell', {
|
|
676
683
|
'is-selected': isFilled,
|
|
@@ -678,12 +685,12 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
678
685
|
'is-range-end': isEnd,
|
|
679
686
|
'is-in-range': inRange,
|
|
680
687
|
'is-preview': isPreview,
|
|
681
|
-
'is-today':
|
|
688
|
+
'is-today': isToday,
|
|
682
689
|
'is-disabled': disabled,
|
|
683
690
|
'is-other-month': otherMonth,
|
|
684
691
|
});
|
|
685
692
|
const display = !otherMonth || nearbyMonthDays;
|
|
686
|
-
return (jsx("button", { type: "button", role: "gridcell", tabIndex: isFocused ? 0 : -1, "aria-selected": isSelected, "aria-disabled": disabled, "aria-current":
|
|
693
|
+
return (jsx("button", { type: "button", role: "gridcell", tabIndex: isFocused ? 0 : -1, "aria-selected": isSelected, "aria-disabled": disabled, "aria-current": isToday ? 'date' : undefined, "aria-describedby": describedBy, "data-focused": isFocused ? 'true' : undefined, disabled: disabled || !display, className: cellClass, onFocus: () => {
|
|
687
694
|
// Reached by Tab while the focused day is disabled, or
|
|
688
695
|
// by pointer: keys move on from here. A nearby month's
|
|
689
696
|
// day waits for its click, which turns the grid.
|
|
@@ -708,7 +715,7 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
708
715
|
const disabled = disabledMonths[month];
|
|
709
716
|
const isSelected = !!value && isSameMonth(value, date);
|
|
710
717
|
const isFocused = month === tabStopMonth;
|
|
711
|
-
const isCurrent = isSameMonth(date, today);
|
|
718
|
+
const isCurrent = !!today && isSameMonth(date, today);
|
|
712
719
|
const cellClass = prefixedClassNames(classPrefix, 'dateinput-month-cell', {
|
|
713
720
|
'is-selected': isSelected,
|
|
714
721
|
'is-today': isCurrent,
|