@allxsmith/bestax-bulma 5.65.0 → 5.66.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/Card.js +6 -6
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/Carousel.js +19 -7
- package/dist/esm/components/Carousel.js.map +1 -1
- package/dist/esm/components/Message.js +1 -1
- package/dist/esm/components/Message.js.map +1 -1
- package/dist/esm/components/Modal.js +1 -1
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Navbar.js.map +1 -1
- package/dist/esm/components/Popover.js +4 -1
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/SegmentedControl.js +4 -4
- package/dist/esm/components/SegmentedControl.js.map +1 -1
- package/dist/esm/components/Sidebar.js +1 -1
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/elements/Figure.js +1 -1
- package/dist/esm/elements/Figure.js.map +1 -1
- package/dist/esm/form/ColorInputBase.js +1 -1
- package/dist/esm/form/ColorInputBase.js.map +1 -1
- package/dist/esm/form/DateInput.js +4 -1
- package/dist/esm/form/DateInput.js.map +1 -1
- package/dist/esm/form/DateInputBase.js +1 -1
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInput.js +4 -1
- package/dist/esm/form/DateRangeInput.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js +1 -1
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInput.js +4 -1
- package/dist/esm/form/DateTimeInput.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +1 -1
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Slider.js +19 -9
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/TimeInput.js +4 -1
- package/dist/esm/form/TimeInput.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +1 -1
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/TreeSelect.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +4 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/form/_pickerInternals/TimeWheels.js +1 -1
- package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +15 -1
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -1
- package/dist/esm/form/_selectInternals/DialogSelect.js +1 -1
- package/dist/esm/form/_selectInternals/DialogSelect.js.map +1 -1
- package/dist/esm/helpers/useAnchoredPosition.js +11 -3
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +122 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +6 -6
- package/dist/types/components/Card.d.ts +52 -0
- package/dist/types/components/Carousel.d.ts +12 -3
- package/dist/types/components/Message.d.ts +16 -0
- package/dist/types/components/Modal.d.ts +71 -0
- package/dist/types/components/Navbar.d.ts +10 -0
- package/dist/types/components/Popover.d.ts +5 -1
- package/dist/types/components/SegmentedControl.d.ts +9 -0
- package/dist/types/components/Sidebar.d.ts +45 -5
- package/dist/types/elements/Figure.d.ts +11 -0
- package/dist/types/form/ColorInputBase.d.ts +7 -1
- package/dist/types/form/DateInputBase.d.ts +7 -1
- package/dist/types/form/DateRangeInputBase.d.ts +7 -1
- package/dist/types/form/DateTimeInputBase.d.ts +7 -1
- package/dist/types/form/TimeInputBase.d.ts +7 -1
- package/dist/types/form/TreeSelect.d.ts +4 -1
- package/dist/types/form/_pickerInternals/PickerPopover.d.ts +5 -0
- package/dist/types/form/_pickerInternals/useLocaleDefaults.d.ts +12 -0
- package/dist/types/form/_selectInternals/DialogSelect.d.ts +1 -0
- package/dist/types/helpers/useAnchoredPosition.d.ts +9 -2
- package/dist/types-cjs/components/Card.d.ts +52 -0
- package/dist/types-cjs/components/Carousel.d.ts +12 -3
- package/dist/types-cjs/components/Message.d.ts +16 -0
- package/dist/types-cjs/components/Modal.d.ts +71 -0
- package/dist/types-cjs/components/Navbar.d.ts +10 -0
- package/dist/types-cjs/components/Popover.d.ts +5 -1
- package/dist/types-cjs/components/SegmentedControl.d.ts +9 -0
- package/dist/types-cjs/components/Sidebar.d.ts +45 -5
- package/dist/types-cjs/elements/Figure.d.ts +11 -0
- package/dist/types-cjs/form/ColorInputBase.d.ts +7 -1
- package/dist/types-cjs/form/DateInputBase.d.ts +7 -1
- package/dist/types-cjs/form/DateRangeInputBase.d.ts +7 -1
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +7 -1
- package/dist/types-cjs/form/TimeInputBase.d.ts +7 -1
- package/dist/types-cjs/form/TreeSelect.d.ts +4 -1
- package/dist/types-cjs/form/_pickerInternals/PickerPopover.d.ts +5 -0
- package/dist/types-cjs/form/_pickerInternals/useLocaleDefaults.d.ts +12 -0
- package/dist/types-cjs/form/_selectInternals/DialogSelect.d.ts +1 -0
- package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +9 -2
- 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 +6 -6
- package/src/scss/CLAUDE.md +1 -1
- package/src/scss/_input-trigger.scss +24 -5
- package/src/scss/components/_carousel.scss +22 -4
- package/src/scss/components/_popover.scss +11 -0
- package/src/scss/elements/_button.scss +49 -0
- package/src/scss/elements/_index.scss +1 -0
- package/src/scss/elements/_loader.scss +10 -5
- package/src/scss/form/_dateinput.scss +6 -0
- package/src/scss/form/_passwordinput.scss +6 -5
- package/src/scss/form/_picker-popover.scss +45 -5
- package/src/scss/form/_slider.scss +39 -0
|
@@ -8,6 +8,7 @@ import { Control } from './Control.js';
|
|
|
8
8
|
import { TimeInputBase } from './TimeInputBase.js';
|
|
9
9
|
import { useInsideField, useInsideControl, rendersOwnField, rendersOwnControl } from './FormContext.js';
|
|
10
10
|
import { useAutoLabelId } from './useAutoLabelId.js';
|
|
11
|
+
import { usePickerDirAttrs } from './_pickerInternals/useLocaleDefaults.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* The `TimeInput` component is a form input that opens a popover spinner for time-of-day selection.
|
|
@@ -24,6 +25,8 @@ import { useAutoLabelId } from './useAutoLabelId.js';
|
|
|
24
25
|
*/
|
|
25
26
|
const TimeInput = forwardRef((props, ref) => {
|
|
26
27
|
const { label, labelSize, labelProps, horizontal, iconLeft, iconRight, iconLeftName = 'clock', iconRightName, iconLeftSize, iconRightSize, hasIconsLeft, hasIconsRight, isLoading, isExpanded, controlSize, message, messageColor, fieldClassName, controlClassName, ...baseProps } = props;
|
|
28
|
+
// The picker's own direction, which the Control below takes too.
|
|
29
|
+
const pickerDirAttrs = usePickerDirAttrs(baseProps.locale, baseProps.dir);
|
|
27
30
|
const insideField = useInsideField();
|
|
28
31
|
const insideControl = useInsideControl();
|
|
29
32
|
const ownField = rendersOwnField('TimeInput', {
|
|
@@ -71,7 +74,7 @@ const TimeInput = forwardRef((props, ref) => {
|
|
|
71
74
|
// whether that is the one rendered below or an enclosing one.
|
|
72
75
|
let content = (jsx(TimeInputBase, { ref: ref, ...baseProps, id: controlId }));
|
|
73
76
|
if (ownControl) {
|
|
74
|
-
content = (jsx(Control, { iconLeft: iconLeft, iconRight: iconRight, iconLeftName: iconLeftName, iconRightName: iconRightName, iconLeftSize: iconLeftSize, iconRightSize: iconRightSize, hasIconsLeft: hasIconsLeft || !!iconLeftName, hasIconsRight: hasIconsRight, isLoading: isLoading, isExpanded: isExpanded, size: controlSize, className: controlClassName, children: content }));
|
|
77
|
+
content = (jsx(Control, { ...pickerDirAttrs, iconLeft: iconLeft, iconRight: iconRight, iconLeftName: iconLeftName, iconRightName: iconRightName, iconLeftSize: iconLeftSize, iconRightSize: iconRightSize, hasIconsLeft: hasIconsLeft || !!iconLeftName, hasIconsRight: hasIconsRight, isLoading: isLoading, isExpanded: isExpanded, size: controlSize, className: controlClassName, children: content }));
|
|
75
78
|
}
|
|
76
79
|
const messageEl = message ? jsx("p", { className: helpClass, children: message }) : null;
|
|
77
80
|
if (ownField) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeInput.js","sources":["../../../src/form/TimeInput.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { usePrefixedClassNames } from '../helpers/classNames';\nimport { Field, FieldProps } from './Field';\nimport { Control, ControlBaseProps } from './Control';\nimport { TimeInputBase, TimeInputBaseProps } from './TimeInputBase';\nimport {\n useInsideField,\n useInsideControl,\n rendersOwnField,\n rendersOwnControl,\n} from './FormContext';\nimport { useAutoLabelId } from './useAutoLabelId';\n\n/**\n * Props for the TimeInput convenience wrapper. Extends `TimeInputBaseProps`\n * with Field-level (label, horizontal) and Control-level (icons, loading) props.\n * Inside an existing `Control` it renders no `Control` of its own, so its\n * Control-level props do nothing there and warn in development; set them on\n * that `Control` instead. In `inline` mode it renders no `Control` anywhere,\n * so they do nothing inside a `Control` or out, and warn in development\n * there too. Inside an outer `Field`, or a `Control` with no `Field` around\n * it, it renders no `Field` of its own either.\n * The exception is `label`, `message`, `horizontal` or `fieldClassName` in that\n * bare `Control`: it keeps a `Field` for them, nested in the `.control`, and\n * warns in development. Wrap the `Control` in a `Field` instead, and set the\n * `label`, `horizontal` and class name on that `Field`.\n * @extraProp {string} [name] - Form field name.\n * @extraProp {string} [form] - Form id the input belongs to.\n * @extraProp {boolean} [required=false] - Marks the input as required.\n * @extraProp {string} [className] - Additional CSS classes for the input.\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.\n */\nexport interface TimeInputProps extends TimeInputBaseProps {\n /** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */\n label?: React.ReactNode;\n /** Size for the label. */\n labelSize?: FieldProps['labelSize'];\n /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */\n labelProps?: FieldProps['labelProps'];\n /** Render the field with horizontal layout. */\n horizontal?: boolean;\n /**\n * Icon props for the left icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconLeft?: ControlBaseProps['iconLeft'];\n /**\n * Icon props for the right icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconRight?: ControlBaseProps['iconRight'];\n /** Shortcut for the right icon name. */\n iconRightName?: string;\n /** Shortcut for left icon size. */\n iconLeftSize?: ControlBaseProps['iconLeftSize'];\n /** Shortcut for right icon size. */\n iconRightSize?: ControlBaseProps['iconRightSize'];\n /** Force the left icon container. */\n hasIconsLeft?: boolean;\n /** Force the right icon container. */\n hasIconsRight?: boolean;\n /**\n * Shows a loading spinner on the `Control` it renders, and hides the\n * launcher (`triggerIcon`) while it does. Inside your own `Control` it\n * renders none, so this draws nothing and warns in development; set\n * `isLoading` on that `Control`.\n * Under `prefers-reduced-motion: reduce` the spinner stops and stays\n * drawn (with bestax's CSS loaded).\n */\n isLoading?: boolean;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a spinner shows at the same right edge: this\n * component's `isLoading` when it renders its own `Control`, or the\n * enclosing `Control`'s `isLoading` inside one.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Expand the control to fill its container. */\n isExpanded?: boolean;\n /** Size of the wrapping Control. */\n controlSize?: ControlBaseProps['size'];\n /** Help/validation text below the input. */\n message?: React.ReactNode;\n /** Color modifier for the help message. */\n messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Additional CSS classes for the Field wrapper. */\n fieldClassName?: string;\n /** Additional CSS classes for the Control wrapper. */\n controlClassName?: string;\n}\n\n/**\n * The `TimeInput` component is a form input that opens a popover spinner for time-of-day selection.\n *\n * @function\n * @param {TimeInputProps} props\n * @returns {JSX.Element}\n *\n * @example\n * <TimeInput label=\"Departure\" defaultValue={new Date()} />\n *\n * @example\n * <TimeInput label=\"Slot\" hourFormat=\"12\" incrementMinutes={15} />\n */\nexport const TimeInput = forwardRef<HTMLInputElement, TimeInputProps>(\n (props, ref) => {\n const {\n label,\n labelSize,\n labelProps,\n horizontal,\n iconLeft,\n iconRight,\n iconLeftName = 'clock',\n iconRightName,\n iconLeftSize,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isLoading,\n isExpanded,\n controlSize,\n message,\n messageColor,\n fieldClassName,\n controlClassName,\n ...baseProps\n } = props;\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('TimeInput', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n // Inline mode renders a bare panel with no input, so the Control's\n // icon-left container has nothing to anchor to, and it renders no\n // Control inside one or out. The left icon is checked as the caller\n // passed it: the default glyph is this component's own choice, not a\n // prop the caller set, so it goes in only for the advice.\n const ownControl = rendersOwnControl('TimeInput', {\n insideControl,\n inline: baseProps.inline,\n isLoading,\n iconLeft,\n iconLeftName: props.iconLeftName,\n defaultIconLeftName: iconLeftName,\n iconLeftSize,\n iconRight,\n iconRightName,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isExpanded,\n controlSize,\n controlClassName,\n });\n const { controlId, fieldLabelProps } = useAutoLabelId({\n label,\n id: baseProps.id,\n labelProps,\n // Inline mode renders a bare panel with no input to label.\n rendersLabel: ownField && !baseProps.inline,\n hasInput: !baseProps.inline,\n });\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // The base hides its launcher while the Control it sits in is loading,\n // whether that is the one rendered below or an enclosing one.\n let content: React.ReactNode = (\n <TimeInputBase ref={ref} {...baseProps} id={controlId} />\n );\n\n if (ownControl) {\n content = (\n <Control\n iconLeft={iconLeft}\n iconRight={iconRight}\n iconLeftName={iconLeftName}\n iconRightName={iconRightName}\n iconLeftSize={iconLeftSize}\n iconRightSize={iconRightSize}\n hasIconsLeft={hasIconsLeft || !!iconLeftName}\n hasIconsRight={hasIconsRight}\n isLoading={isLoading}\n isExpanded={isExpanded}\n size={controlSize}\n className={controlClassName}\n >\n {content}\n </Control>\n );\n }\n\n const messageEl = message ? <p className={helpClass}>{message}</p> : null;\n\n if (ownField) {\n return (\n <Field\n label={label}\n labelSize={labelSize}\n labelProps={fieldLabelProps}\n horizontal={horizontal}\n className={fieldClassName}\n >\n {content}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {content}\n {messageEl}\n </>\n );\n }\n);\n\nTimeInput.displayName = 'TimeInput';\n\nexport default TimeInput;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;AA8FA;;;;;;;;;;;;AAYG;AACI,MAAM,SAAS,GAAG,UAAU,CACjC,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,MAAM,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GAAG,OAAO,EACtB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,GAAG,SAAS,EACb,GAAG,KAAK;AACT,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE;AACpC,IAAA,MAAM,aAAa,GAAG,gBAAgB,EAA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AE,YAAY,IAAI,CAAC,CAAC,YAAY,EAC5C,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,gBAAgB,EAAA,QAAA,EAE1B,OAAO,EAAA,CACA,CACX;IACH;AAEA,IAAA,MAAM,SAAS,GAAG,OAAO,GAAGA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,SAAS,YAAG,OAAO,EAAA,CAAK,GAAG,IAAI;IAEzE,IAAI,QAAQ,EAAE;AACZ,QAAA,QACEC,IAAA,CAAC,KAAK,EAAA,EACJ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,cAAc,EAAA,QAAA,EAAA,CAExB,OAAO,EACP,SAAS,CAAA,EAAA,CACJ;IAEZ;AAEA,IAAA,QACEA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,OAAO,EACP,SAAS,CAAA,EAAA,CACT;AAEP,CAAC;AAGH,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
|
|
1
|
+
{"version":3,"file":"TimeInput.js","sources":["../../../src/form/TimeInput.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { usePrefixedClassNames } from '../helpers/classNames';\nimport { Field, FieldProps } from './Field';\nimport { Control, ControlBaseProps } from './Control';\nimport { TimeInputBase, TimeInputBaseProps } from './TimeInputBase';\nimport {\n useInsideField,\n useInsideControl,\n rendersOwnField,\n rendersOwnControl,\n} from './FormContext';\nimport { useAutoLabelId } from './useAutoLabelId';\nimport { usePickerDirAttrs } from './_pickerInternals/useLocaleDefaults';\n\n/**\n * Props for the TimeInput convenience wrapper. Extends `TimeInputBaseProps`\n * with Field-level (label, horizontal) and Control-level (icons, loading) props.\n * Inside an existing `Control` it renders no `Control` of its own, so its\n * Control-level props do nothing there and warn in development; set them on\n * that `Control` instead. In `inline` mode it renders no `Control` anywhere,\n * so they do nothing inside a `Control` or out, and warn in development\n * there too. Inside an outer `Field`, or a `Control` with no `Field` around\n * it, it renders no `Field` of its own either.\n * The exception is `label`, `message`, `horizontal` or `fieldClassName` in that\n * bare `Control`: it keeps a `Field` for them, nested in the `.control`, and\n * warns in development. Wrap the `Control` in a `Field` instead, and set the\n * `label`, `horizontal` and class name on that `Field`.\n * @extraProp {string} [name] - Form field name.\n * @extraProp {string} [form] - Form id the input belongs to.\n * @extraProp {boolean} [required=false] - Marks the input as required.\n * @extraProp {string} [className] - Additional CSS classes for the input.\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.\n */\nexport interface TimeInputProps extends TimeInputBaseProps {\n /** Field label. Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */\n label?: React.ReactNode;\n /** Size for the label. */\n labelSize?: FieldProps['labelSize'];\n /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */\n labelProps?: FieldProps['labelProps'];\n /** Render the field with horizontal layout. */\n horizontal?: boolean;\n /**\n * Icon props for the left icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconLeft?: ControlBaseProps['iconLeft'];\n /**\n * Icon props for the right icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconRight?: ControlBaseProps['iconRight'];\n /** Shortcut for the right icon name. */\n iconRightName?: string;\n /** Shortcut for left icon size. */\n iconLeftSize?: ControlBaseProps['iconLeftSize'];\n /** Shortcut for right icon size. */\n iconRightSize?: ControlBaseProps['iconRightSize'];\n /** Force the left icon container. */\n hasIconsLeft?: boolean;\n /** Force the right icon container. */\n hasIconsRight?: boolean;\n /**\n * Shows a loading spinner on the `Control` it renders, and hides the\n * launcher (`triggerIcon`) while it does. Inside your own `Control` it\n * renders none, so this draws nothing and warns in development; set\n * `isLoading` on that `Control`.\n * Under `prefers-reduced-motion: reduce` the spinner stops and stays\n * drawn (with bestax's CSS loaded).\n */\n isLoading?: boolean;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a spinner shows at the same right edge: this\n * component's `isLoading` when it renders its own `Control`, or the\n * enclosing `Control`'s `isLoading` inside one.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Expand the control to fill its container. */\n isExpanded?: boolean;\n /** Size of the wrapping Control. */\n controlSize?: ControlBaseProps['size'];\n /** Help/validation text below the input. */\n message?: React.ReactNode;\n /** Color modifier for the help message. */\n messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Additional CSS classes for the Field wrapper. */\n fieldClassName?: string;\n /** Additional CSS classes for the Control wrapper. */\n controlClassName?: string;\n}\n\n/**\n * The `TimeInput` component is a form input that opens a popover spinner for time-of-day selection.\n *\n * @function\n * @param {TimeInputProps} props\n * @returns {JSX.Element}\n *\n * @example\n * <TimeInput label=\"Departure\" defaultValue={new Date()} />\n *\n * @example\n * <TimeInput label=\"Slot\" hourFormat=\"12\" incrementMinutes={15} />\n */\nexport const TimeInput = forwardRef<HTMLInputElement, TimeInputProps>(\n (props, ref) => {\n const {\n label,\n labelSize,\n labelProps,\n horizontal,\n iconLeft,\n iconRight,\n iconLeftName = 'clock',\n iconRightName,\n iconLeftSize,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isLoading,\n isExpanded,\n controlSize,\n message,\n messageColor,\n fieldClassName,\n controlClassName,\n ...baseProps\n } = props;\n // The picker's own direction, which the Control below takes too.\n const pickerDirAttrs = usePickerDirAttrs(baseProps.locale, baseProps.dir);\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('TimeInput', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n // Inline mode renders a bare panel with no input, so the Control's\n // icon-left container has nothing to anchor to, and it renders no\n // Control inside one or out. The left icon is checked as the caller\n // passed it: the default glyph is this component's own choice, not a\n // prop the caller set, so it goes in only for the advice.\n const ownControl = rendersOwnControl('TimeInput', {\n insideControl,\n inline: baseProps.inline,\n isLoading,\n iconLeft,\n iconLeftName: props.iconLeftName,\n defaultIconLeftName: iconLeftName,\n iconLeftSize,\n iconRight,\n iconRightName,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isExpanded,\n controlSize,\n controlClassName,\n });\n const { controlId, fieldLabelProps } = useAutoLabelId({\n label,\n id: baseProps.id,\n labelProps,\n // Inline mode renders a bare panel with no input to label.\n rendersLabel: ownField && !baseProps.inline,\n hasInput: !baseProps.inline,\n });\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // The base hides its launcher while the Control it sits in is loading,\n // whether that is the one rendered below or an enclosing one.\n let content: React.ReactNode = (\n <TimeInputBase ref={ref} {...baseProps} id={controlId} />\n );\n\n if (ownControl) {\n content = (\n <Control\n {...pickerDirAttrs}\n iconLeft={iconLeft}\n iconRight={iconRight}\n iconLeftName={iconLeftName}\n iconRightName={iconRightName}\n iconLeftSize={iconLeftSize}\n iconRightSize={iconRightSize}\n hasIconsLeft={hasIconsLeft || !!iconLeftName}\n hasIconsRight={hasIconsRight}\n isLoading={isLoading}\n isExpanded={isExpanded}\n size={controlSize}\n className={controlClassName}\n >\n {content}\n </Control>\n );\n }\n\n const messageEl = message ? <p className={helpClass}>{message}</p> : null;\n\n if (ownField) {\n return (\n <Field\n label={label}\n labelSize={labelSize}\n labelProps={fieldLabelProps}\n horizontal={horizontal}\n className={fieldClassName}\n >\n {content}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {content}\n {messageEl}\n </>\n );\n }\n);\n\nTimeInput.displayName = 'TimeInput';\n\nexport default TimeInput;\n"],"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AAA,EAAA,QAAA,EAAA,CACG,OAAO,EACP,SAAS,CAAA,EAAA,CACT;AAEP,CAAC;AAGH,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
|
|
@@ -43,7 +43,7 @@ const fromIsoTime = (s) => {
|
|
|
43
43
|
* @returns {JSX.Element}
|
|
44
44
|
*/
|
|
45
45
|
const TimeInputBase = forwardRef((props, ref) => {
|
|
46
|
-
const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled: disabledProp, readOnly, placeholder, format, parse, locale: localeProp, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = false, position
|
|
46
|
+
const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled: disabledProp, readOnly, placeholder, format, parse, locale: localeProp, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = false, position, appendToBody = false, color, size, isRounded, hourFormat = '24', enableSeconds = false, incrementHours = 1, incrementMinutes = 1, incrementSeconds = 1, unselectableTimes, className, name, form, required, id: idProp, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', labels, audioTick = false, haptics = false, ...rest } = props;
|
|
47
47
|
// A LocaleProvider around the picker sets its default locale.
|
|
48
48
|
const locale = usePickerLocale(localeProp);
|
|
49
49
|
// Its own language and direction, which its root and a portaled panel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeInputBase.js","sources":["../../../src/form/TimeInputBase.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 PickerLabels,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n formatTime,\n hourCycleFromFormat,\n parseTime,\n DateFormatOption,\n DEFAULT_TIME_FORMAT_24,\n DEFAULT_TIME_FORMAT_12,\n} from './_pickerInternals/formatters';\nimport {\n setTimeOfDay,\n floorMin,\n isWithin,\n snapTimeToIncrement,\n} from './_pickerInternals/dateUtils';\nimport { TimeWheels } from './_pickerInternals/TimeWheels';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport {\n usePickerLocale,\n usePickerLocaleScope,\n} from './_pickerInternals/useLocaleDefaults';\nimport { useControlLoading } from './controlLoading';\nimport { useFieldLabelTarget, useFieldsetDisabled } from './FormContext';\nimport { Icon } from '../elements/Icon';\nimport { Buttons } from '../elements/Buttons';\n\nconst toIsoTime = (d: Date, withSeconds: boolean): string => {\n const hh = String(d.getHours()).padStart(2, '0');\n const mm = String(d.getMinutes()).padStart(2, '0');\n if (!withSeconds) return `${hh}:${mm}`;\n const ss = String(d.getSeconds()).padStart(2, '0');\n return `${hh}:${mm}:${ss}`;\n};\n\nconst fromIsoTime = (s: string): Date | null => {\n // The HTML time value may carry fractional seconds (the spec allows them\n // and some engines normalize to `:ss.sss`); accept and drop.\n const m = /^(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,3})?)?$/.exec(s);\n if (!m) return null;\n const today = new Date();\n return new Date(\n today.getFullYear(),\n today.getMonth(),\n today.getDate(),\n Number(m[1]),\n Number(m[2]),\n m[3] ? Number(m[3]) : 0,\n 0\n );\n};\n\n/**\n * Props for the raw TimeInput base. Use the higher-level `TimeInput` for\n * Field/Control composition; `TimeInputBase` is the input + popover only.\n */\nexport interface TimeInputBaseProps\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 time (date portion is preserved). */\n value?: Date | null;\n /** Initial value for uncontrolled usage. */\n defaultValue?: Date | null;\n /** Fired when the value changes. */\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 * Earliest selectable time. A `min` before year 1 is raised to midnight on\n * 1 January of year 1, and a `value` dated before then is out of range, so\n * the wheels and typing change nothing on it, as in the date pickers.\n */\n min?: Date;\n /** Latest selectable time. */\n max?: Date;\n /** Disable the input. */\n disabled?: boolean;\n /** Make the input read-only. */\n readOnly?: boolean;\n /** Placeholder text for the input. */\n placeholder?: string;\n /**\n * Token format string or `Intl.DateTimeFormat` options.\n * @defaultValue (see below)\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 and the date.\n */\n parse?: (s: string) => Date | null;\n /**\n * BCP-47 locale tag for Intl formatting. Unset, it is the `locale` of a\n * `LocaleProvider` around the picker, and with neither, `Intl` uses the\n * runtime's own locale.\n */\n locale?: string;\n /** Render the spinner inline (no popover). */\n inline?: boolean;\n /** Use `<input type=\"time\">` on coarse-pointer + small-viewport devices. */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). */\n popover?: boolean;\n /**\n * Open the popover when the input is focused. 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 /** Close the popover after a time is selected (off by default). */\n closeOnSelect?: boolean;\n /** Popover anchor position relative to the input. */\n position?: PickerPosition;\n /**\n * Render the popover through a portal, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default. On a narrow screen\n * an in-place popover spans the bottom of the viewport, while a portaled\n * one stays on its `position` corner.\n */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the input, also carried by the wheels, where it\n * colors the selection band. A focused wheel's keyboard focus ring is drawn\n * inside the band in the color's `-invert`, like the selected value, so it\n * shows on the fill. Unset, the wheels use\n * `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Render the input with rounded corners. */\n isRounded?: boolean;\n /** Hour format. `'12'` adds an AM/PM column to the wheels. */\n hourFormat?: HourFormat;\n /** Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. */\n enableSeconds?: boolean;\n /** Hour step for the spinner. */\n incrementHours?: number;\n /** Minute step. Combine with `min`/`max` for slot-style pickers. */\n incrementMinutes?: number;\n /** Second step. Default `1`. */\n incrementSeconds?: number;\n /** Predicate returning `true` for times that should be skipped. 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 /**\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 /** Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. */\n audioTick?: boolean;\n /** Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. */\n haptics?: boolean;\n}\n\n/**\n * Raw TimeInput — input + popover spinner without Field/Control wrapping.\n * Use `TimeInput` for the convenience wrapper.\n *\n * @function\n * @param {TimeInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const TimeInputBase = forwardRef<HTMLInputElement, TimeInputBaseProps>(\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 = 'bottom-left',\n appendToBody = false,\n color,\n size,\n isRounded,\n hourFormat = '24',\n enableSeconds = false,\n incrementHours = 1,\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 labels,\n audioTick = false,\n haptics = false,\n ...rest\n } = props;\n // A LocaleProvider around the picker sets its default locale.\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 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\n // Platform-appropriate feedback routing: when `haptics` is opted in and\n // the runtime has no Vibration API (notably iOS Safari), enable the\n // audio thunk so the user still gets *some* tactile cue. When vibrate\n // is available (Android Chrome etc.), the existing unconditional\n // `navigator.vibrate(5)` carries the haptic — no audio added unless\n // the consumer explicitly set `audioTick`. `audioTick` always wins.\n const hasVibrate =\n typeof navigator !== 'undefined' &&\n typeof navigator.vibrate === 'function';\n const effectiveAudioTick = audioTick || (haptics && !hasVibrate);\n const t = mergeLabels(labels);\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 const defaultFormat: DateFormatOption =\n format ??\n (hourFormat === '12'\n ? enableSeconds\n ? 'hh:mm:ss A'\n : DEFAULT_TIME_FORMAT_12\n : enableSeconds\n ? 'HH:mm:ss'\n : DEFAULT_TIME_FORMAT_24);\n\n // The displayed format is the source of truth for the hour cycle: an\n // explicit 12-hour `format` must drive a 12-hour wheel even when\n // `hourFormat` was left at its default. Fall back to the raw prop only when\n // the cycle can't be read from the format (an Intl-options object, or no\n // hour token).\n const effectiveHourFormat =\n hourCycleFromFormat(defaultFormat) ?? hourFormat;\n\n const [open, setOpenState] = useState(false);\n const [text, setText] = useState<string>(\n value ? formatTime(value, defaultFormat, locale) : ''\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n // Snapshot of value at the moment the popover opens, used by Cancel.\n const valueAtOpenRef = useRef<Date | null>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\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 const inputClass = usePrefixedClassNames('input', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n });\n const containerClass = usePrefixedClassNames('timeinput-container');\n const triggerClass = usePrefixedClassNames('timeinput-trigger');\n const panelClass = usePrefixedClassNames('timeinput-panel');\n const footerClass = usePrefixedClassNames('timeinput-footer');\n const footerButton = usePrefixedClassNames('button', 'is-small');\n const footerOkClass = usePrefixedClassNames(\n 'button',\n 'is-small',\n 'timeinput-footer-ok'\n );\n const mobileFooterClass = usePrefixedClassNames('timeinput-footer-mobile');\n const mobileFooterResetClass = usePrefixedClassNames(\n 'timeinput-footer-reset'\n );\n const mobileFooterDoneClass = usePrefixedClassNames(\n 'timeinput-footer-done'\n );\n\n // What the latest request asked for, so a second request in the same\n // event sees it before React renders. The callbacks fire here rather than\n // in a state updater, which StrictMode calls twice, and after the state\n // is set, 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 ? formatTime(value, defaultFormat, locale) : '');\n }, [value, defaultFormat, locale]);\n\n // A value's date before year 1 is out of range, as in the date pickers.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const commitValue = useCallback(\n (next: Date | null) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n // An empty field starts from today, at the whole minute or second the\n // wheels show.\n const handleSpinnerChange = useCallback(\n (parts: { hours: number; minutes: number; seconds?: number }) => {\n const next = value\n ? setTimeOfDay(value, parts)\n : setTimeOfDay(new Date(), {\n ...parts,\n seconds: parts.seconds ?? 0,\n milliseconds: 0,\n });\n if (!isWithin(next, lowerBound, max)) return;\n commitValue(next);\n },\n [value, 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 const fmt = typeof format === 'string' ? format : undefined;\n return parse\n ? parse(trimmed)\n : parseTime(\n trimmed,\n fmt ??\n (typeof defaultFormat === 'string'\n ? defaultFormat\n : DEFAULT_TIME_FORMAT_24)\n );\n },\n [parse, format, defaultFormat]\n );\n\n // The Date the user edits when starting without a current value. Noon so\n // the 12h / 24h hour calculations are unambiguous.\n const makeBaseDate = useCallback((): Date => {\n const d = new Date();\n d.setHours(12, 0, 0, 0);\n return d;\n }, []);\n\n const inputReadOnlyAttr = !!readOnly || !editable;\n const canOpen = !!popover && !disabled && !readOnly;\n\n const { inputHandlers } = useSegmentedEntry({\n format: defaultFormat,\n value,\n commitValue,\n formatFn: formatTime,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min: lowerBound,\n max,\n isBlocked: unselectableTimes,\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 =\n node;\n },\n [ref]\n );\n\n if (useNative) {\n const nativeStep = enableSeconds\n ? incrementSeconds\n : incrementMinutes * 60;\n return (\n <input\n {...localeScope.rootAttrs}\n {...cleanRest}\n ref={combinedRef}\n type=\"time\"\n step={nativeStep}\n className={classNames(inputClass, bulmaHelperClasses, className)}\n value={value ? toIsoTime(value, enableSeconds) : ''}\n onChange={e => {\n const parsed = e.target.value ? fromIsoTime(e.target.value) : null;\n commitValue(parsed);\n }}\n min={min ? toIsoTime(min, enableSeconds) : undefined}\n max={max ? toIsoTime(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 className={panelClass}>\n <TimeWheels\n value={spinnerValue}\n onChange={handleSpinnerChange}\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 // The popover panel takes `popoverId`, so the wheels inside it take\n // one of their own. Inline there is no panel, and the wheels keep\n // the id they released with.\n id={inline ? popoverId : `${popoverId}-time`}\n labels={labels}\n itemHeight={wheelItemHeight}\n audioTick={effectiveAudioTick}\n onCommit={() => setOpen(false)}\n />\n {/* Footer is popover-only. Desktop gets the OK / Now / Cancel triad;\n mobile drops to an iOS-style \"Reset / ✓\" pair to match the OS\n picker's footer affordances and free up vertical space on small\n screens. */}\n {!inline && !isSmallViewport && (\n <Buttons className={footerClass} hasAddons>\n <button\n type=\"button\"\n className={footerOkClass}\n onClick={() => setOpen(false)}\n >\n {t.ok}\n </button>\n <button\n type=\"button\"\n className={footerButton}\n onClick={() => {\n commitValue(\n snapTimeToIncrement(new Date(), {\n incrementHours,\n incrementMinutes,\n incrementSeconds,\n enableSeconds,\n })\n );\n setOpen(false);\n }}\n >\n {t.now}\n </button>\n <button\n type=\"button\"\n className={footerButton}\n onClick={() => {\n commitValue(valueAtOpenRef.current);\n setOpen(false);\n }}\n >\n {t.cancel}\n </button>\n </Buttons>\n )}\n {!inline && isSmallViewport && (\n <div className={mobileFooterClass}>\n <button\n type=\"button\"\n className={mobileFooterResetClass}\n onClick={() => {\n commitValue(valueAtOpenRef.current);\n setOpen(false);\n }}\n >\n {t.reset}\n </button>\n <button\n type=\"button\"\n className={mobileFooterDoneClass}\n aria-label={t.done}\n onClick={() => setOpen(false)}\n >\n <svg\n width=\"22\"\n height=\"22\"\n viewBox=\"0 0 22 22\"\n aria-hidden=\"true\"\n >\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 )}\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 ? toIsoTime(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.chooseTime}\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.chooseTime}\n id={popoverId}\n restoreFocusRef={inputRef}\n >\n {panel}\n </PickerPopover>\n )}\n </div>\n );\n }\n);\n\nTimeInputBase.displayName = 'TimeInputBase';\n\nexport default TimeInputBase;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,MAAM,SAAS,GAAG,CAAC,CAAO,EAAE,WAAoB,KAAY;AAC1D,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAChD,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,UA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IAAI,OAAO;AAAE,wBAAA,OAAO,CAAC,CAAC,IAAI,CAAC;gBAC7B,CAAC,EACD,QAAQ,EAAE,CAAC,OAAO,EAAA,YAAA,EACN,CAAC,CAAC,UAAU,EAAA,eAAA,EACV,QAAQ,mBACP,SAAS,EAAA,eAAA,EACT,IAAI,EACnB,QAAQ,EAAE,OAAO,GAAG,CAAC,GAAG,EAAE,EAAA,QAAA,EAE1BA,GAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAA,CAAI,GACpC,CACV,EACA,OAAO,KACNA,GAAA,CAAC,aAAa,EAAA,EACZ,WAAW,EAAE,WAAW,CAAC,KAAK,EAC9B,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAC7B,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,CAAC,CAAC,UAAU,EACvB,EAAE,EAAE,SAAS,EACb,eAAe,EAAE,QAAQ,EAAA,QAAA,EAExB,KAAK,EAAA,CACQ,CACjB,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
1
|
+
{"version":3,"file":"TimeInputBase.js","sources":["../../../src/form/TimeInputBase.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 PickerLabels,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n formatTime,\n hourCycleFromFormat,\n parseTime,\n DateFormatOption,\n DEFAULT_TIME_FORMAT_24,\n DEFAULT_TIME_FORMAT_12,\n} from './_pickerInternals/formatters';\nimport {\n setTimeOfDay,\n floorMin,\n isWithin,\n snapTimeToIncrement,\n} from './_pickerInternals/dateUtils';\nimport { TimeWheels } from './_pickerInternals/TimeWheels';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport {\n usePickerLocale,\n usePickerLocaleScope,\n} from './_pickerInternals/useLocaleDefaults';\nimport { useControlLoading } from './controlLoading';\nimport { useFieldLabelTarget, useFieldsetDisabled } from './FormContext';\nimport { Icon } from '../elements/Icon';\nimport { Buttons } from '../elements/Buttons';\n\nconst toIsoTime = (d: Date, withSeconds: boolean): string => {\n const hh = String(d.getHours()).padStart(2, '0');\n const mm = String(d.getMinutes()).padStart(2, '0');\n if (!withSeconds) return `${hh}:${mm}`;\n const ss = String(d.getSeconds()).padStart(2, '0');\n return `${hh}:${mm}:${ss}`;\n};\n\nconst fromIsoTime = (s: string): Date | null => {\n // The HTML time value may carry fractional seconds (the spec allows them\n // and some engines normalize to `:ss.sss`); accept and drop.\n const m = /^(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,3})?)?$/.exec(s);\n if (!m) return null;\n const today = new Date();\n return new Date(\n today.getFullYear(),\n today.getMonth(),\n today.getDate(),\n Number(m[1]),\n Number(m[2]),\n m[3] ? Number(m[3]) : 0,\n 0\n );\n};\n\n/**\n * Props for the raw TimeInput base. Use the higher-level `TimeInput` for\n * Field/Control composition; `TimeInputBase` is the input + popover only.\n */\nexport interface TimeInputBaseProps\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 time (date portion is preserved). */\n value?: Date | null;\n /** Initial value for uncontrolled usage. */\n defaultValue?: Date | null;\n /** Fired when the value changes. */\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 * Earliest selectable time. A `min` before year 1 is raised to midnight on\n * 1 January of year 1, and a `value` dated before then is out of range, so\n * the wheels and typing change nothing on it, as in the date pickers.\n */\n min?: Date;\n /** Latest selectable time. */\n max?: Date;\n /** Disable the input. */\n disabled?: boolean;\n /** Make the input read-only. */\n readOnly?: boolean;\n /** Placeholder text for the input. */\n placeholder?: string;\n /**\n * Token format string or `Intl.DateTimeFormat` options.\n * @defaultValue (see below)\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 and the date.\n */\n parse?: (s: string) => Date | null;\n /**\n * BCP-47 locale tag for Intl formatting. Unset, it is the `locale` of a\n * `LocaleProvider` around the picker, and with neither, `Intl` uses the\n * runtime's own locale.\n */\n locale?: string;\n /** Render the spinner inline (no popover). */\n inline?: boolean;\n /** Use `<input type=\"time\">` on coarse-pointer + small-viewport devices. */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing in the input (type the time directly, auto-advancing across segments). `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the spinner popover exists. `false` makes the field input-only (segmented typing, no popover). */\n popover?: boolean;\n /**\n * Open the popover when the input is focused. 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 /** Close the popover after a time is selected (off by default). */\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. On a narrow screen\n * an in-place popover spans the bottom of the viewport, while a portaled\n * one stays on its `position` corner.\n */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the input, also carried by the wheels, where it\n * colors the selection band. A focused wheel's keyboard focus ring is drawn\n * inside the band in the color's `-invert`, like the selected value, so it\n * shows on the fill. Unset, the wheels use\n * `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Render the input with rounded corners. */\n isRounded?: boolean;\n /** Hour format. `'12'` adds an AM/PM column to the wheels. */\n hourFormat?: HourFormat;\n /** Show a seconds column. Note: iOS Safari's native time picker UI does not include a seconds wheel; pass `mobileNative={false}` if you need one on iOS. */\n enableSeconds?: boolean;\n /** Hour step for the spinner. */\n incrementHours?: number;\n /** Minute step. Combine with `min`/`max` for slot-style pickers. */\n incrementMinutes?: number;\n /** Second step. Default `1`. */\n incrementSeconds?: number;\n /** Predicate returning `true` for times that should be skipped. 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 /**\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 /** Play a short audible click on each wheel-item crossing. Substitute for haptic feedback on iOS Safari (which has no web haptic API as of May 2026); on Android, `navigator.vibrate(5)` fires automatically regardless. */\n audioTick?: boolean;\n /** Auto-route platform-appropriate feedback: vibrate on Android (already happening), audio thunk on iOS (where vibrate is unavailable). One switch instead of platform-sniffing on the consumer side. `audioTick={true}` always wins. */\n haptics?: boolean;\n}\n\n/**\n * Raw TimeInput — input + popover spinner without Field/Control wrapping.\n * Use `TimeInput` for the convenience wrapper.\n *\n * @function\n * @param {TimeInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const TimeInputBase = forwardRef<HTMLInputElement, TimeInputBaseProps>(\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 hourFormat = '24',\n enableSeconds = false,\n incrementHours = 1,\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 labels,\n audioTick = false,\n haptics = false,\n ...rest\n } = props;\n // A LocaleProvider around the picker sets its default locale.\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 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\n // Platform-appropriate feedback routing: when `haptics` is opted in and\n // the runtime has no Vibration API (notably iOS Safari), enable the\n // audio thunk so the user still gets *some* tactile cue. When vibrate\n // is available (Android Chrome etc.), the existing unconditional\n // `navigator.vibrate(5)` carries the haptic — no audio added unless\n // the consumer explicitly set `audioTick`. `audioTick` always wins.\n const hasVibrate =\n typeof navigator !== 'undefined' &&\n typeof navigator.vibrate === 'function';\n const effectiveAudioTick = audioTick || (haptics && !hasVibrate);\n const t = mergeLabels(labels);\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 const defaultFormat: DateFormatOption =\n format ??\n (hourFormat === '12'\n ? enableSeconds\n ? 'hh:mm:ss A'\n : DEFAULT_TIME_FORMAT_12\n : enableSeconds\n ? 'HH:mm:ss'\n : DEFAULT_TIME_FORMAT_24);\n\n // The displayed format is the source of truth for the hour cycle: an\n // explicit 12-hour `format` must drive a 12-hour wheel even when\n // `hourFormat` was left at its default. Fall back to the raw prop only when\n // the cycle can't be read from the format (an Intl-options object, or no\n // hour token).\n const effectiveHourFormat =\n hourCycleFromFormat(defaultFormat) ?? hourFormat;\n\n const [open, setOpenState] = useState(false);\n const [text, setText] = useState<string>(\n value ? formatTime(value, defaultFormat, locale) : ''\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n // Snapshot of value at the moment the popover opens, used by Cancel.\n const valueAtOpenRef = useRef<Date | null>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\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 const inputClass = usePrefixedClassNames('input', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n });\n const containerClass = usePrefixedClassNames('timeinput-container');\n const triggerClass = usePrefixedClassNames('timeinput-trigger');\n const panelClass = usePrefixedClassNames('timeinput-panel');\n const footerClass = usePrefixedClassNames('timeinput-footer');\n const footerButton = usePrefixedClassNames('button', 'is-small');\n const footerOkClass = usePrefixedClassNames(\n 'button',\n 'is-small',\n 'timeinput-footer-ok'\n );\n const mobileFooterClass = usePrefixedClassNames('timeinput-footer-mobile');\n const mobileFooterResetClass = usePrefixedClassNames(\n 'timeinput-footer-reset'\n );\n const mobileFooterDoneClass = usePrefixedClassNames(\n 'timeinput-footer-done'\n );\n\n // What the latest request asked for, so a second request in the same\n // event sees it before React renders. The callbacks fire here rather than\n // in a state updater, which StrictMode calls twice, and after the state\n // is set, 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 ? formatTime(value, defaultFormat, locale) : '');\n }, [value, defaultFormat, locale]);\n\n // A value's date before year 1 is out of range, as in the date pickers.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const commitValue = useCallback(\n (next: Date | null) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n // An empty field starts from today, at the whole minute or second the\n // wheels show.\n const handleSpinnerChange = useCallback(\n (parts: { hours: number; minutes: number; seconds?: number }) => {\n const next = value\n ? setTimeOfDay(value, parts)\n : setTimeOfDay(new Date(), {\n ...parts,\n seconds: parts.seconds ?? 0,\n milliseconds: 0,\n });\n if (!isWithin(next, lowerBound, max)) return;\n commitValue(next);\n },\n [value, 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 const fmt = typeof format === 'string' ? format : undefined;\n return parse\n ? parse(trimmed)\n : parseTime(\n trimmed,\n fmt ??\n (typeof defaultFormat === 'string'\n ? defaultFormat\n : DEFAULT_TIME_FORMAT_24)\n );\n },\n [parse, format, defaultFormat]\n );\n\n // The Date the user edits when starting without a current value. Noon so\n // the 12h / 24h hour calculations are unambiguous.\n const makeBaseDate = useCallback((): Date => {\n const d = new Date();\n d.setHours(12, 0, 0, 0);\n return d;\n }, []);\n\n const inputReadOnlyAttr = !!readOnly || !editable;\n const canOpen = !!popover && !disabled && !readOnly;\n\n const { inputHandlers } = useSegmentedEntry({\n format: defaultFormat,\n value,\n commitValue,\n formatFn: formatTime,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min: lowerBound,\n max,\n isBlocked: unselectableTimes,\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 =\n node;\n },\n [ref]\n );\n\n if (useNative) {\n const nativeStep = enableSeconds\n ? incrementSeconds\n : incrementMinutes * 60;\n return (\n <input\n {...localeScope.rootAttrs}\n {...cleanRest}\n ref={combinedRef}\n type=\"time\"\n step={nativeStep}\n className={classNames(inputClass, bulmaHelperClasses, className)}\n value={value ? toIsoTime(value, enableSeconds) : ''}\n onChange={e => {\n const parsed = e.target.value ? fromIsoTime(e.target.value) : null;\n commitValue(parsed);\n }}\n min={min ? toIsoTime(min, enableSeconds) : undefined}\n max={max ? toIsoTime(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 className={panelClass}>\n <TimeWheels\n value={spinnerValue}\n onChange={handleSpinnerChange}\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 // The popover panel takes `popoverId`, so the wheels inside it take\n // one of their own. Inline there is no panel, and the wheels keep\n // the id they released with.\n id={inline ? popoverId : `${popoverId}-time`}\n labels={labels}\n itemHeight={wheelItemHeight}\n audioTick={effectiveAudioTick}\n onCommit={() => setOpen(false)}\n />\n {/* Footer is popover-only. Desktop gets the OK / Now / Cancel triad;\n mobile drops to an iOS-style \"Reset / ✓\" pair to match the OS\n picker's footer affordances and free up vertical space on small\n screens. */}\n {!inline && !isSmallViewport && (\n <Buttons className={footerClass} hasAddons>\n <button\n type=\"button\"\n className={footerOkClass}\n onClick={() => setOpen(false)}\n >\n {t.ok}\n </button>\n <button\n type=\"button\"\n className={footerButton}\n onClick={() => {\n commitValue(\n snapTimeToIncrement(new Date(), {\n incrementHours,\n incrementMinutes,\n incrementSeconds,\n enableSeconds,\n })\n );\n setOpen(false);\n }}\n >\n {t.now}\n </button>\n <button\n type=\"button\"\n className={footerButton}\n onClick={() => {\n commitValue(valueAtOpenRef.current);\n setOpen(false);\n }}\n >\n {t.cancel}\n </button>\n </Buttons>\n )}\n {!inline && isSmallViewport && (\n <div className={mobileFooterClass}>\n <button\n type=\"button\"\n className={mobileFooterResetClass}\n onClick={() => {\n commitValue(valueAtOpenRef.current);\n setOpen(false);\n }}\n >\n {t.reset}\n </button>\n <button\n type=\"button\"\n className={mobileFooterDoneClass}\n aria-label={t.done}\n onClick={() => setOpen(false)}\n >\n <svg\n width=\"22\"\n height=\"22\"\n viewBox=\"0 0 22 22\"\n aria-hidden=\"true\"\n >\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 )}\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 ? toIsoTime(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.chooseTime}\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.chooseTime}\n id={popoverId}\n restoreFocusRef={inputRef}\n >\n {panel}\n </PickerPopover>\n )}\n </div>\n );\n }\n);\n\nTimeInputBase.displayName = 'TimeInputBase';\n\nexport default TimeInputBase;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,MAAM,SAAS,GAAG,CAAC,CAAO,EAAE,WAAoB,KAAY;AAC1D,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAChD,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC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AO;AAAE,wBAAA,OAAO,CAAC,CAAC,IAAI,CAAC;gBAC7B,CAAC,EACD,QAAQ,EAAE,CAAC,OAAO,EAAA,YAAA,EACN,CAAC,CAAC,UAAU,EAAA,eAAA,EACV,QAAQ,mBACP,SAAS,EAAA,eAAA,EACT,IAAI,EACnB,QAAQ,EAAE,OAAO,GAAG,CAAC,GAAG,EAAE,EAAA,QAAA,EAE1BA,GAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAA,CAAI,GACpC,CACV,EACA,OAAO,KACNA,GAAA,CAAC,aAAa,EAAA,EACZ,WAAW,EAAE,WAAW,CAAC,KAAK,EAC9B,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAC7B,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,CAAC,CAAC,UAAU,EACvB,EAAE,EAAE,SAAS,EACb,eAAe,EAAE,QAAQ,EAAA,QAAA,EAExB,KAAK,EAAA,CACQ,CACjB,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
@@ -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, relative to the field, as on the pickers.\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":";;;;;;;;;;;;;;;;AAwTA,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,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC;AAED;AACA,MAAM,OAAO,GAAG,CAAC,I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,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 /** @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.displ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IAAI,EAAE,aAAa,CAAc,mBAAmB,CAAC,GACzD,KAAK,EAAE;wBACZ;oBACF,CAAC,EAAA,CACD,CACH,EACA,YAAY,IACX,KAAK,KACHA,aAAK,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAA,QAAA,EACtC,KAAK,EAAA,CACF,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;;"}
|
|
@@ -12,7 +12,7 @@ import { useLatestRef } from '../../helpers/useLatestRef.js';
|
|
|
12
12
|
import { useAnchoredPosition, marginGap } from '../../helpers/useAnchoredPosition.js';
|
|
13
13
|
|
|
14
14
|
const isBrowser = typeof window !== 'undefined';
|
|
15
|
-
const PickerPopover = ({ isOpen, onClose, anchorRef, children, position
|
|
15
|
+
const PickerPopover = ({ isOpen, onClose, anchorRef, children, position, appendToBody = false, className, trapFocus = true, closeOnClickOutside = true, closeOnEscape = true, ariaLabel, ariaLabelledBy, role = 'dialog', id, restoreFocusRef, initialFocusSelector, localeScope, matchWidth = false, followContent = false, }) => {
|
|
16
16
|
const panelRef = useRef(null);
|
|
17
17
|
const resolveContainer = usePortalContainer();
|
|
18
18
|
// Read as the trap turns on, once the panel's content has rendered.
|
|
@@ -91,6 +91,9 @@ const PickerPopover = ({ isOpen, onClose, anchorRef, children, position = 'botto
|
|
|
91
91
|
const panelClass = usePrefixedClassNames('picker-popover', {
|
|
92
92
|
'is-active': isOpen,
|
|
93
93
|
[`is-${resolved.position}`]: true,
|
|
94
|
+
// The default lines up with the field's inline start, so the stylesheet
|
|
95
|
+
// moves it to the right edge on a right-to-left page.
|
|
96
|
+
'is-start-aligned': position === undefined,
|
|
94
97
|
'is-portal': appendToBody,
|
|
95
98
|
'has-anchor-width': matchWidth,
|
|
96
99
|
});
|