@allxsmith/bestax-bulma 5.67.0 → 5.67.2
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/Dropdown.js +8 -2
- package/dist/esm/components/Dropdown.js.map +1 -1
- package/dist/esm/form/Control.js +2 -5
- package/dist/esm/form/Control.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/DateRangeInputBase.js +1 -1
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +3 -3
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Field.js +2 -4
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +19 -10
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +35 -25
- package/dist/index.cjs.map +1 -1
- package/dist/types/components/Dropdown.d.ts +5 -1
- package/dist/types/form/DateInputBase.d.ts +10 -2
- package/dist/types/form/DateRangeInputBase.d.ts +10 -2
- package/dist/types/form/DateTimeInputBase.d.ts +10 -2
- package/dist/types/form/_pickerInternals/Calendar.d.ts +12 -0
- package/dist/types-cjs/components/Dropdown.d.ts +5 -1
- package/dist/types-cjs/form/DateInputBase.d.ts +10 -2
- package/dist/types-cjs/form/DateRangeInputBase.d.ts +10 -2
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +10 -2
- package/dist/types-cjs/form/_pickerInternals/Calendar.d.ts +12 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/form/_dateinput.scss +4 -0
- package/src/scss/form/_datetimeinput.scss +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../src/form/Field.tsx"],"sourcesContent":["import React, { useCallback, useId, useMemo, useRef, useState } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport {\n FieldProvider,\n FieldLabelIdProvider,\n FieldLabelElementIdProvider,\n FieldLabelForProvider,\n FieldLabelForReportProvider,\n useFieldLabelFor,\n} from './FormContext';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { Control } from './Control';\n\n/**\n * Props for the Field component.\n */\nexport interface FieldProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Renders the field as horizontal (label and control side by side). */\n horizontal?: boolean;\n /** Group controls in a row (optionally centered, right, or multiline). */\n grouped?: boolean | 'centered' | 'right' | 'multiline';\n /** Group controls as addons (optionally centered or right-aligned). */\n hasAddons?: boolean | 'centered' | 'right';\n /** Constrains the field to its content's width (used inside horizontal field bodies). */\n narrow?: boolean;\n /** Field label, rendered above the widget. Automatically names the one control the Field holds: a composed `InputBase`, `SelectBase`, `TextAreaBase`, `DateInputBase`, `TimeInputBase` or `DateTimeInputBase` (an `inline` picker has no input, so it takes nothing), or a bestax input that renders a single input of its own (`Input`, `Select`, `TextArea`, `Numberinput`, `PinInput`, `Slider`, `DateInput`, `TimeInput`, `DateTimeInput`, `Autocomplete`, `Combobox`, `TreeSelect`, `Taginput`, `File`), adopts a generated id that the label's `htmlFor` points at, and a group (`Radios`, `Checkboxes`, `Rate`, `DateRangeInput`, or a composed `DateRangeInputBase`, `inline` or not) points `aria-labelledby` at the label's own id unless you gave the group an `aria-label` or `aria-labelledby`. A range `Slider` takes the id on its low thumb and also starts each thumb's name with the label through `aria-labelledby`, unless its `ariaLabel` names that thumb or its own `aria-label` or `aria-labelledby` takes the label's place. An `Autocomplete`, a `Combobox` or a `Taginput` also names its open list after the label through `aria-labelledby`, and a `TreeSelect` its panel and the tree in it. `Checkbox`, `Radio` and `Switch` are named by their own children, and the label names one only when you wire it as you would any control with an `id` of its own, `labelProps={{ htmlFor }}` plus that control's `id`. Only the single inputs take the `htmlFor`, so once the Field's content has mounted the label keeps it only while one of them holds the id, and drops it over anything else: a group, a `Checkbox`, `Radio` or `Switch`, an `inline` picker, an inner `Field`, an input with an `id` of its own, markup of your own, or nothing at all. A server render, and the first render while hydrating, still write the `htmlFor`, which keeps hydration matching, and an input that mounts later puts it back. The label names an input with an `id` of your own only through `labelProps={{ htmlFor }}` set to that `id`, a `for` it always keeps; `labelProps={{ htmlFor: undefined }}` opts out. Skipped for `grouped`/`hasAddons` fields (multiple controls), and a nested `Field` starts its own scope, so a horizontal Field whose body holds an inner `Field` names the control there only when you wire it. Two controls in one plain labeled Field would both adopt the id, so give each an `id` of its own. */\n label?: React.ReactNode;\n /** Size for the label. */\n labelSize?: 'small' | 'normal' | 'medium' | 'large';\n /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. While the association is on, the label renders with the `id` given here, or a generated one, and a group control, a range `Slider`'s thumbs and an `Autocomplete`'s, a `Combobox`'s or a `Taginput`'s list point `aria-labelledby` at it. A label you take over gets no generated id, and no group points at it on its own. With an `id` here, though, a range `Slider`, an `Autocomplete` or a `Taginput` whose `id` your `htmlFor` names, or a `Combobox` whose field's `id` it names, still points its thumbs or its list at it, in a `grouped` or `hasAddons` Field too. To point a group in an inner `Field` at this label by hand, pass that `id`. Nothing in the inner `Field` takes the generated `htmlFor`, so the label drops it after mounting, and adding `htmlFor: undefined` keeps it out of server-rendered markup too. */\n labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {\n [key: string]: unknown;\n };\n /** Text color for the field. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color for the field. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the field. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Additional CSS classes. */\n className?: string;\n /** Field content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the FieldLabel component.\n */\nexport interface FieldLabelProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Size for the field label. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Text color for the label. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color for the label. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the label. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Additional CSS classes. */\n className?: string;\n /** Field label content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the FieldBody component.\n */\nexport interface FieldBodyProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Text color for the field body. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color for the field body. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the field body. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Additional CSS classes. */\n className?: string;\n /** Field body content. */\n children?: React.ReactNode;\n}\n\n/**\n * FieldLabel component for rendering a Bulma field label. It renders the\n * label column of a horizontal `Field` (a `div` with the `field-label` class),\n * not a `<label>`, so text placed straight in it names nothing. Put a `<label>`\n * with the `label` class inside it and point its `htmlFor` at the control's\n * `id`, or give the horizontal `Field` a `label` prop, which renders this\n * column and its `<label>` for you. A `<label>` you put here names the\n * control through its `htmlFor` alone: a range `Slider`'s thumbs and an\n * `Autocomplete`'s, a `Combobox`'s or a `Taginput`'s list point\n * `aria-labelledby` at a `Field`'s label only when its `label` prop renders it\n * and it names the control. Where it would not name the control on its own, as in an inner `Field`,\n * pass `labelProps={{ htmlFor, id }}` with a matching `id` on the control.\n *\n * @function\n * @param {FieldLabelProps} props - Props for the FieldLabel component.\n * @returns {JSX.Element} The rendered field label.\n *\n * @example\n * <FieldLabel size=\"normal\">\n * <label className=\"label\" htmlFor=\"name\">Name</label>\n * </FieldLabel>\n */\nexport const FieldLabel: React.FC<FieldLabelProps> = ({\n size,\n textColor,\n bgColor,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('field-label', {\n [`is-${size}`]: !!size,\n });\n const fieldLabelClass = classNames(mainClass, bulmaHelperClasses, className);\n // Spread ...props and ...rest so custom props like data-testid are included\n return (\n <div className={fieldLabelClass} {...props} {...rest}>\n {children}\n </div>\n );\n};\n\n/**\n * FieldBody component for rendering Bulma field body.\n *\n * @function\n * @param {FieldBodyProps} props - Props for the FieldBody component.\n * @returns {JSX.Element} The rendered field body.\n *\n * @example\n * <FieldBody><input className=\"input\" /></FieldBody>\n */\nexport const FieldBody: React.FC<FieldBodyProps> = ({\n textColor,\n bgColor,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('field-body');\n const fieldBodyClass = classNames(mainClass, bulmaHelperClasses, className);\n // Spread ...props and ...rest so custom props like data-testid are included\n return (\n <div className={fieldBodyClass} {...props} {...rest}>\n {children}\n </div>\n );\n};\n\n/**\n * The `Field` component is a Bulma-styled form field container.\n *\n * @function\n * @param {FieldProps} props - Props for the Field component.\n * @returns {JSX.Element} The rendered field container.\n * @see {@link https://bulma.io/documentation/form/general/#field | Bulma Field documentation}\n *\n * @example\n * // Labelled field — the label auto-associates with the composed base\n * <Field label=\"Email\">\n * <Control>\n * <InputBase type=\"email\" />\n * </Control>\n * </Field>\n *\n * @example\n * // Horizontal field\n * <Field horizontal label=\"Name\">\n * <Control>\n * <InputBase />\n * </Control>\n * </Field>\n */\nconst FieldComponent: React.FC<FieldProps> = ({\n horizontal,\n grouped,\n hasAddons,\n narrow,\n label,\n labelSize,\n labelProps,\n textColor,\n color: _fieldColor,\n bgColor,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('field', {\n 'is-horizontal': horizontal,\n 'has-addons': !!hasAddons,\n 'has-addons-centered': hasAddons === 'centered',\n 'has-addons-right': hasAddons === 'right',\n 'is-narrow': narrow,\n 'is-grouped':\n grouped === true ||\n grouped === 'centered' ||\n grouped === 'right' ||\n grouped === 'multiline',\n 'is-grouped-centered': grouped === 'centered',\n 'is-grouped-right': grouped === 'right',\n 'is-grouped-multiline': grouped === 'multiline',\n });\n const fieldClass = classNames(mainClass, bulmaHelperClasses, className);\n\n // Default labelSize to 'normal' when horizontal for proper baseline alignment\n const effectiveLabelSize = labelSize ?? (horizontal ? 'normal' : undefined);\n\n const labelClass = usePrefixedClassNames('label');\n\n // Auto-associate the label with a single composed base control (#495): the\n // label points at a generated id shared via context, which a composed base\n // adopts when the user supplied no id of their own.\n // Presence semantics on htmlFor — even an explicit `htmlFor: undefined`\n // means the caller owns the association. Grouped/addons fields hold several\n // controls, so no single association is generated for them.\n const generatedId = useId();\n const userWiredLabel = !!labelProps && 'htmlFor' in labelProps;\n const targetId =\n label && !userWiredLabel && !grouped && !hasAddons\n ? generatedId\n : undefined;\n // A group control (Radios, Checkboxes, Rate, DateRangeInput and its base)\n // cannot take that `for`, so it points `aria-labelledby` at the label\n // itself (#939).\n // The label gets an id whenever the association is on, unless the caller\n // gave it one.\n const labelId =\n labelProps?.id ?? (targetId ? `${targetId}-label` : undefined);\n // What the rendered label's `for` points at, generated or the caller's, and\n // the id it renders with, so a control can tell when a label wired by hand\n // names it and point at that label. An unlabeled Field passes on its\n // parent's. Unlike `targetId`, a label wired by hand passes on its own in\n // `grouped`/`hasAddons` Fields too, on purpose: those only stop the Field\n // picking one control out of several, and the caller's `for` has picked\n // one, so a range Slider or Autocomplete it names points at that label in\n // a row as well. A group reads the label element id below instead, which\n // stays off for a label wired by hand, since no group takes its `for`.\n const inheritedLabelFor = useFieldLabelFor();\n const labelForTarget = userWiredLabel ? labelProps.htmlFor : targetId;\n const ownLabelFor = useMemo(\n () => ({ htmlFor: labelForTarget, id: labelId }),\n [labelForTarget, labelId]\n );\n const labelFor = label ? ownLabelFor : inheritedLabelFor;\n\n // Whether the label keeps its generated `for` (#1004). Content that takes\n // the Field's id says so from a layout effect, and this Field's own layout\n // effect runs after its content's in the same commit, so by then every\n // report has landed. Until it runs, on the server and in the first render\n // while hydrating, the label writes the `for` as it always has. From then\n // on it keeps the `for` only while some content holds the id, and content\n // that mounts or changes later reports when it does. Counted in a ref, and\n // state is set only once settled, so content that takes the id renders\n // the Field just once.\n const takersRef = useRef(0);\n const settledRef = useRef(false);\n const [forTaken, setForTaken] = useState(true);\n const settle = useCallback(() => {\n if (settledRef.current) setForTaken(takersRef.current > 0);\n }, []);\n const reportLabelFor = useCallback(() => {\n takersRef.current += 1;\n settle();\n return () => {\n takersRef.current -= 1;\n settle();\n };\n }, [settle]);\n useClientLayoutEffect(() => {\n settledRef.current = true;\n if (targetId) settle();\n }, [targetId, settle]);\n const renderedTargetId = forTaken ? targetId : undefined;\n\n let renderedLabel = null;\n if (label) {\n if (horizontal) {\n renderedLabel = (\n <FieldLabel size={effectiveLabelSize}>\n <label\n htmlFor={renderedTargetId}\n {...labelProps}\n id={labelId}\n className={classNames(labelClass, labelProps?.className)}\n style={labelProps?.style}\n >\n {label}\n </label>\n </FieldLabel>\n );\n } else {\n renderedLabel = (\n <label\n htmlFor={renderedTargetId}\n {...labelProps}\n id={labelId}\n className={classNames(labelClass, labelProps?.className)}\n style={{ display: 'block', ...(labelProps?.style || {}) }}\n >\n {label}\n </label>\n );\n }\n }\n\n // If horizontal, wrap children in FieldBody (unless the user already provided\n // a FieldBody — either as the single child, or as one element among siblings\n // like <Field.Label/> + <Field.Body/>).\n let content = children;\n if (horizontal) {\n const isFieldBody = (c: React.ReactNode): boolean =>\n React.isValidElement(c) &&\n // @ts-expect-error displayName isn't on the public type\n (c.type === FieldBody || c.type?.displayName === 'FieldBody');\n const isFieldLabel = (c: React.ReactNode): boolean =>\n React.isValidElement(c) &&\n // @ts-expect-error displayName isn't on the public type\n (c.type === FieldLabel || c.type?.displayName === 'FieldLabel');\n const childArray = React.Children.toArray(children);\n const userProvidedStructure = childArray.some(\n c => isFieldBody(c) || isFieldLabel(c)\n );\n if (userProvidedStructure) {\n content = children;\n } else {\n content = <FieldBody>{children}</FieldBody>;\n }\n }\n\n return (\n <FieldProvider value={true}>\n <FieldLabelIdProvider value={targetId}>\n <FieldLabelElementIdProvider value={targetId ? labelId : undefined}>\n <FieldLabelForProvider value={labelFor}>\n <FieldLabelForReportProvider\n value={targetId ? reportLabelFor : undefined}\n >\n <div className={fieldClass} {...rest}>\n {renderedLabel}\n {content}\n </div>\n </FieldLabelForReportProvider>\n </FieldLabelForProvider>\n </FieldLabelElementIdProvider>\n </FieldLabelIdProvider>\n </FieldProvider>\n );\n};\n\nFieldLabel.displayName = 'FieldLabel';\nFieldBody.displayName = 'FieldBody';\n\nexport const Field = withSubComponents(\n FieldComponent,\n {\n Label: FieldLabel,\n Body: FieldBody,\n Control,\n },\n 'Field'\n);\n\nexport default Field;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AA8FA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACU,UAAU,GAA8B,CAAC,EACpD,IAAI,EACJ,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ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Field.tsx"],"sourcesContent":["import React, { useCallback, useId, useMemo, useRef, useState } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport {\n FieldProvider,\n FieldLabelIdProvider,\n FieldLabelElementIdProvider,\n FieldLabelForProvider,\n FieldLabelForReportProvider,\n useFieldLabelFor,\n} from './FormContext';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { Control } from './Control';\n\n/**\n * Props for the Field component.\n */\nexport interface FieldProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Renders the field as horizontal (label and control side by side). */\n horizontal?: boolean;\n /** Group controls in a row (optionally centered, right, or multiline). */\n grouped?: boolean | 'centered' | 'right' | 'multiline';\n /** Group controls as addons (optionally centered or right-aligned). */\n hasAddons?: boolean | 'centered' | 'right';\n /** Constrains the field to its content's width (used inside horizontal field bodies). */\n narrow?: boolean;\n /** Field label, rendered above the widget. Automatically names the one control the Field holds: a composed `InputBase`, `SelectBase`, `TextAreaBase`, `DateInputBase`, `TimeInputBase` or `DateTimeInputBase` (an `inline` picker has no input, so it takes nothing), or a bestax input that renders a single input of its own (`Input`, `Select`, `TextArea`, `Numberinput`, `PinInput`, `Slider`, `DateInput`, `TimeInput`, `DateTimeInput`, `Autocomplete`, `Combobox`, `TreeSelect`, `Taginput`, `File`), adopts a generated id that the label's `htmlFor` points at, and a group (`Radios`, `Checkboxes`, `Rate`, `DateRangeInput`, or a composed `DateRangeInputBase`, `inline` or not) points `aria-labelledby` at the label's own id unless you gave the group an `aria-label` or `aria-labelledby`. A range `Slider` takes the id on its low thumb and also starts each thumb's name with the label through `aria-labelledby`, unless its `ariaLabel` names that thumb or its own `aria-label` or `aria-labelledby` takes the label's place. An `Autocomplete`, a `Combobox` or a `Taginput` also names its open list after the label through `aria-labelledby`, and a `TreeSelect` its panel and the tree in it. `Checkbox`, `Radio` and `Switch` are named by their own children, and the label names one only when you wire it as you would any control with an `id` of its own, `labelProps={{ htmlFor }}` plus that control's `id`. Only the single inputs take the `htmlFor`, so once the Field's content has mounted the label keeps it only while one of them holds the id, and drops it over anything else: a group, a `Checkbox`, `Radio` or `Switch`, an `inline` picker, an inner `Field`, an input with an `id` of its own, markup of your own, or nothing at all. A server render, and the first render while hydrating, still write the `htmlFor`, which keeps hydration matching, and an input that mounts later puts it back. The label names an input with an `id` of your own only through `labelProps={{ htmlFor }}` set to that `id`, a `for` it always keeps; `labelProps={{ htmlFor: undefined }}` opts out. Skipped for `grouped`/`hasAddons` fields (multiple controls), and a nested `Field` starts its own scope, so a horizontal Field whose body holds an inner `Field` names the control there only when you wire it. Two controls in one plain labeled Field would both adopt the id, so give each an `id` of its own. */\n label?: React.ReactNode;\n /** Size for the label. */\n labelSize?: 'small' | 'normal' | 'medium' | 'large';\n /** Props for the label element. An explicit `htmlFor` key — even set to `undefined` — takes over the association. While the association is on, the label renders with the `id` given here, or a generated one, and a group control, a range `Slider`'s thumbs and an `Autocomplete`'s, a `Combobox`'s or a `Taginput`'s list point `aria-labelledby` at it. A label you take over gets no generated id, and no group points at it on its own. With an `id` here, though, a range `Slider`, an `Autocomplete` or a `Taginput` whose `id` your `htmlFor` names, or a `Combobox` whose field's `id` it names, still points its thumbs or its list at it, in a `grouped` or `hasAddons` Field too. To point a group in an inner `Field` at this label by hand, pass that `id`. Nothing in the inner `Field` takes the generated `htmlFor`, so the label drops it after mounting, and adding `htmlFor: undefined` keeps it out of server-rendered markup too. */\n labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {\n [key: string]: unknown;\n };\n /** Text color for the field. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color for the field. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the field. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Additional CSS classes. */\n className?: string;\n /** Field content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the FieldLabel component.\n */\nexport interface FieldLabelProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Size for the field label. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Text color for the label. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color for the label. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the label. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Additional CSS classes. */\n className?: string;\n /** Field label content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the FieldBody component.\n */\nexport interface FieldBodyProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Text color for the field body. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color for the field body. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the field body. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Additional CSS classes. */\n className?: string;\n /** Field body content. */\n children?: React.ReactNode;\n}\n\n/**\n * FieldLabel component for rendering a Bulma field label. It renders the\n * label column of a horizontal `Field` (a `div` with the `field-label` class),\n * not a `<label>`, so text placed straight in it names nothing. Put a `<label>`\n * with the `label` class inside it and point its `htmlFor` at the control's\n * `id`, or give the horizontal `Field` a `label` prop, which renders this\n * column and its `<label>` for you. A `<label>` you put here names the\n * control through its `htmlFor` alone: a range `Slider`'s thumbs and an\n * `Autocomplete`'s, a `Combobox`'s or a `Taginput`'s list point\n * `aria-labelledby` at a `Field`'s label only when its `label` prop renders it\n * and it names the control. Where it would not name the control on its own, as in an inner `Field`,\n * pass `labelProps={{ htmlFor, id }}` with a matching `id` on the control.\n *\n * @function\n * @param {FieldLabelProps} props - Props for the FieldLabel component.\n * @returns {JSX.Element} The rendered field label.\n *\n * @example\n * <FieldLabel size=\"normal\">\n * <label className=\"label\" htmlFor=\"name\">Name</label>\n * </FieldLabel>\n */\nexport const FieldLabel: React.FC<FieldLabelProps> = ({\n size,\n textColor,\n bgColor,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('field-label', {\n [`is-${size}`]: !!size,\n });\n const fieldLabelClass = classNames(mainClass, bulmaHelperClasses, className);\n return (\n <div className={fieldLabelClass} {...rest}>\n {children}\n </div>\n );\n};\n\n/**\n * FieldBody component for rendering Bulma field body.\n *\n * @function\n * @param {FieldBodyProps} props - Props for the FieldBody component.\n * @returns {JSX.Element} The rendered field body.\n *\n * @example\n * <FieldBody><input className=\"input\" /></FieldBody>\n */\nexport const FieldBody: React.FC<FieldBodyProps> = ({\n textColor,\n bgColor,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('field-body');\n const fieldBodyClass = classNames(mainClass, bulmaHelperClasses, className);\n return (\n <div className={fieldBodyClass} {...rest}>\n {children}\n </div>\n );\n};\n\n/**\n * The `Field` component is a Bulma-styled form field container.\n *\n * @function\n * @param {FieldProps} props - Props for the Field component.\n * @returns {JSX.Element} The rendered field container.\n * @see {@link https://bulma.io/documentation/form/general/#field | Bulma Field documentation}\n *\n * @example\n * // Labelled field — the label auto-associates with the composed base\n * <Field label=\"Email\">\n * <Control>\n * <InputBase type=\"email\" />\n * </Control>\n * </Field>\n *\n * @example\n * // Horizontal field\n * <Field horizontal label=\"Name\">\n * <Control>\n * <InputBase />\n * </Control>\n * </Field>\n */\nconst FieldComponent: React.FC<FieldProps> = ({\n horizontal,\n grouped,\n hasAddons,\n narrow,\n label,\n labelSize,\n labelProps,\n textColor,\n color: _fieldColor,\n bgColor,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('field', {\n 'is-horizontal': horizontal,\n 'has-addons': !!hasAddons,\n 'has-addons-centered': hasAddons === 'centered',\n 'has-addons-right': hasAddons === 'right',\n 'is-narrow': narrow,\n 'is-grouped':\n grouped === true ||\n grouped === 'centered' ||\n grouped === 'right' ||\n grouped === 'multiline',\n 'is-grouped-centered': grouped === 'centered',\n 'is-grouped-right': grouped === 'right',\n 'is-grouped-multiline': grouped === 'multiline',\n });\n const fieldClass = classNames(mainClass, bulmaHelperClasses, className);\n\n // Default labelSize to 'normal' when horizontal for proper baseline alignment\n const effectiveLabelSize = labelSize ?? (horizontal ? 'normal' : undefined);\n\n const labelClass = usePrefixedClassNames('label');\n\n // Auto-associate the label with a single composed base control (#495): the\n // label points at a generated id shared via context, which a composed base\n // adopts when the user supplied no id of their own.\n // Presence semantics on htmlFor — even an explicit `htmlFor: undefined`\n // means the caller owns the association. Grouped/addons fields hold several\n // controls, so no single association is generated for them.\n const generatedId = useId();\n const userWiredLabel = !!labelProps && 'htmlFor' in labelProps;\n const targetId =\n label && !userWiredLabel && !grouped && !hasAddons\n ? generatedId\n : undefined;\n // A group control (Radios, Checkboxes, Rate, DateRangeInput and its base)\n // cannot take that `for`, so it points `aria-labelledby` at the label\n // itself (#939).\n // The label gets an id whenever the association is on, unless the caller\n // gave it one.\n const labelId =\n labelProps?.id ?? (targetId ? `${targetId}-label` : undefined);\n // What the rendered label's `for` points at, generated or the caller's, and\n // the id it renders with, so a control can tell when a label wired by hand\n // names it and point at that label. An unlabeled Field passes on its\n // parent's. Unlike `targetId`, a label wired by hand passes on its own in\n // `grouped`/`hasAddons` Fields too, on purpose: those only stop the Field\n // picking one control out of several, and the caller's `for` has picked\n // one, so a range Slider or Autocomplete it names points at that label in\n // a row as well. A group reads the label element id below instead, which\n // stays off for a label wired by hand, since no group takes its `for`.\n const inheritedLabelFor = useFieldLabelFor();\n const labelForTarget = userWiredLabel ? labelProps.htmlFor : targetId;\n const ownLabelFor = useMemo(\n () => ({ htmlFor: labelForTarget, id: labelId }),\n [labelForTarget, labelId]\n );\n const labelFor = label ? ownLabelFor : inheritedLabelFor;\n\n // Whether the label keeps its generated `for` (#1004). Content that takes\n // the Field's id says so from a layout effect, and this Field's own layout\n // effect runs after its content's in the same commit, so by then every\n // report has landed. Until it runs, on the server and in the first render\n // while hydrating, the label writes the `for` as it always has. From then\n // on it keeps the `for` only while some content holds the id, and content\n // that mounts or changes later reports when it does. Counted in a ref, and\n // state is set only once settled, so content that takes the id renders\n // the Field just once.\n const takersRef = useRef(0);\n const settledRef = useRef(false);\n const [forTaken, setForTaken] = useState(true);\n const settle = useCallback(() => {\n if (settledRef.current) setForTaken(takersRef.current > 0);\n }, []);\n const reportLabelFor = useCallback(() => {\n takersRef.current += 1;\n settle();\n return () => {\n takersRef.current -= 1;\n settle();\n };\n }, [settle]);\n useClientLayoutEffect(() => {\n settledRef.current = true;\n if (targetId) settle();\n }, [targetId, settle]);\n const renderedTargetId = forTaken ? targetId : undefined;\n\n let renderedLabel = null;\n if (label) {\n if (horizontal) {\n renderedLabel = (\n <FieldLabel size={effectiveLabelSize}>\n <label\n htmlFor={renderedTargetId}\n {...labelProps}\n id={labelId}\n className={classNames(labelClass, labelProps?.className)}\n style={labelProps?.style}\n >\n {label}\n </label>\n </FieldLabel>\n );\n } else {\n renderedLabel = (\n <label\n htmlFor={renderedTargetId}\n {...labelProps}\n id={labelId}\n className={classNames(labelClass, labelProps?.className)}\n style={{ display: 'block', ...(labelProps?.style || {}) }}\n >\n {label}\n </label>\n );\n }\n }\n\n // If horizontal, wrap children in FieldBody (unless the user already provided\n // a FieldBody — either as the single child, or as one element among siblings\n // like <Field.Label/> + <Field.Body/>).\n let content = children;\n if (horizontal) {\n const isFieldBody = (c: React.ReactNode): boolean =>\n React.isValidElement(c) &&\n // @ts-expect-error displayName isn't on the public type\n (c.type === FieldBody || c.type?.displayName === 'FieldBody');\n const isFieldLabel = (c: React.ReactNode): boolean =>\n React.isValidElement(c) &&\n // @ts-expect-error displayName isn't on the public type\n (c.type === FieldLabel || c.type?.displayName === 'FieldLabel');\n const childArray = React.Children.toArray(children);\n const userProvidedStructure = childArray.some(\n c => isFieldBody(c) || isFieldLabel(c)\n );\n if (userProvidedStructure) {\n content = children;\n } else {\n content = <FieldBody>{children}</FieldBody>;\n }\n }\n\n return (\n <FieldProvider value={true}>\n <FieldLabelIdProvider value={targetId}>\n <FieldLabelElementIdProvider value={targetId ? labelId : undefined}>\n <FieldLabelForProvider value={labelFor}>\n <FieldLabelForReportProvider\n value={targetId ? reportLabelFor : undefined}\n >\n <div className={fieldClass} {...rest}>\n {renderedLabel}\n {content}\n </div>\n </FieldLabelForReportProvider>\n </FieldLabelForProvider>\n </FieldLabelElementIdProvider>\n </FieldLabelIdProvider>\n </FieldProvider>\n );\n};\n\nFieldLabel.displayName = 'FieldLabel';\nFieldBody.displayName = 'FieldBody';\n\nexport const Field = withSubComponents(\n FieldComponent,\n {\n Label: FieldLabel,\n Body: FieldBody,\n Control,\n },\n 'Field'\n);\n\nexport default Field;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AA8FA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACU,UAAU,GAA8B,CAAC,EACpD,IAAI,EACJ,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,SAAS,GAAG,qBAAqB,CAAC,aAAa,EAAE;AACrD,QAAA,CAAC,MAAM,IAAI,CAAA,CAAE,GAAG,CAAC,CAAC,I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Q,GAAa;QAC7C;IACF;AAEA,IAAA,QACEA,GAAA,CAAC,aAAa,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACxBA,GAAA,CAAC,oBAAoB,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAA,QAAA,EACnCA,GAAA,CAAC,2BAA2B,EAAA,EAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,EAAA,QAAA,EAChEA,GAAA,CAAC,qBAAqB,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAA,QAAA,EACpCA,GAAA,CAAC,2BAA2B,EAAA,EAC1B,KAAK,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,EAAA,QAAA,EAE5CC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,EAAA,GAAM,IAAI,aACjC,aAAa,EACb,OAAO,CAAA,EAAA,CACJ,GACsB,EAAA,CACR,EAAA,CACI,EAAA,CACT,EAAA,CACT;AAEpB,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY;AACrC,SAAS,CAAC,WAAW,GAAG,WAAW;AAE5B,MAAM,KAAK,GAAG,iBAAiB,CACpC,cAAc,EACd;AACE,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,IAAI,EAAE,SAAS;IACf,OAAO;CACR,EACD,OAAO;;"}
|
|
@@ -136,7 +136,11 @@ function yearStep(key, focusedYear, years) {
|
|
|
136
136
|
return null;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minProp, max, shouldDisableDate, unselectableDates, firstDayOfWeek = 0, locale, dayNames, monthNames, nearbyMonthDays = true, color, size, className, id, autoFocusCell = false, labels, yearsRange, granularity = 'day', range, onRangeSelect, allowDisabledInRange = false, }) => {
|
|
139
|
+
const Calendar = ({ value, focusedDate, onSelect: onSelectProp, onFocusedDateChange, min: minProp, max, shouldDisableDate, unselectableDates, firstDayOfWeek = 0, locale, dayNames, monthNames, nearbyMonthDays = true, color, size, className, id, autoFocusCell = false, labels, yearsRange, granularity = 'day', range, onRangeSelect, allowDisabledInRange = false, disabled: calendarDisabled = false, readOnly = false, }) => {
|
|
140
|
+
// A disabled or read-only calendar picks nothing, so its picks reach no
|
|
141
|
+
// `onSelect`, and a range pick returns before it starts.
|
|
142
|
+
const canPick = !calendarDisabled && !readOnly;
|
|
143
|
+
const onSelect = canPick ? onSelectProp : undefined;
|
|
140
144
|
const gridRef = useRef(null);
|
|
141
145
|
const monthGridRef = useRef(null);
|
|
142
146
|
const yearGridRef = useRef(null);
|
|
@@ -200,13 +204,16 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
200
204
|
// The start of a range being picked, which nothing outside the calendar
|
|
201
205
|
// sees until its end is picked too. It starts as the range's own pending
|
|
202
206
|
// start, and starts there again whenever the range changes from outside.
|
|
203
|
-
const [
|
|
207
|
+
const [pendingAnchor, setAnchor] = useState(valuePending);
|
|
204
208
|
const rangeKey = `${timeOf(range?.[0])}|${timeOf(range?.[1])}`;
|
|
205
209
|
const [anchorRangeKey, setAnchorRangeKey] = useState(rangeKey);
|
|
206
210
|
if (anchorRangeKey !== rangeKey) {
|
|
207
211
|
setAnchorRangeKey(rangeKey);
|
|
208
212
|
setAnchor(valuePending);
|
|
209
213
|
}
|
|
214
|
+
// A calendar that picks nothing has no start pending, so it previews no
|
|
215
|
+
// range and says nothing of picking an end.
|
|
216
|
+
const anchor = canPick ? pendingAnchor : null;
|
|
210
217
|
// The day under the pointer while a start is pending, which the preview
|
|
211
218
|
// runs to ahead of the focused day.
|
|
212
219
|
const [hoverDate, setHoverDate] = useState(null);
|
|
@@ -224,6 +231,8 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
224
231
|
// A pick in range mode: the end of the pending range when it can be one,
|
|
225
232
|
// and otherwise the start of a new one.
|
|
226
233
|
const pickRangeDay = useCallback((picked) => {
|
|
234
|
+
if (!canPick)
|
|
235
|
+
return;
|
|
227
236
|
const day = startOfDay(picked);
|
|
228
237
|
// The pointer is on the picked day, which the focused day now is too.
|
|
229
238
|
setHoverDate(null);
|
|
@@ -234,7 +243,7 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
234
243
|
else {
|
|
235
244
|
setAnchor(day);
|
|
236
245
|
}
|
|
237
|
-
}, [anchor, canEndAt, onRangeSelect]);
|
|
246
|
+
}, [canPick, anchor, canEndAt, onRangeSelect]);
|
|
238
247
|
// What the grid shows: while a start is pending, the range from it to the
|
|
239
248
|
// hovered or focused day, when that day can end it; otherwise the
|
|
240
249
|
// committed range.
|
|
@@ -644,11 +653,11 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
644
653
|
list.querySelector('[data-focused-year="true"]')?.focus();
|
|
645
654
|
}, [isYearGranularity, focusedYear]);
|
|
646
655
|
const navArrow = (d) => (jsx("svg", { viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", children: jsx("path", { d: d, fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
647
|
-
return (jsxs("div", { className: classNames(calendarClass, className), id: id, children: [jsxs("div", { className: headerClass, children: [isYearGranularity ? (jsx("span", { className: monthLabelClass, id: labelId, children: monthLabel })) : (jsxs("button", { type: "button", className: monthTriggerClass, "aria-haspopup": "listbox", "aria-expanded": view === 'years', onClick: () => {
|
|
656
|
+
return (jsxs("div", { className: classNames(calendarClass, className), id: id, children: [jsxs("div", { className: headerClass, children: [isYearGranularity ? (jsx("span", { className: monthLabelClass, id: labelId, children: monthLabel })) : (jsxs("button", { type: "button", className: monthTriggerClass, "aria-haspopup": "listbox", "aria-expanded": view === 'years', disabled: calendarDisabled, onClick: () => {
|
|
648
657
|
setNavYear(null);
|
|
649
658
|
setView(v => (v === 'years' ? baseView : 'years'));
|
|
650
|
-
}, children: [jsx("span", { className: monthLabelClass, id: labelId, "aria-live": "polite", children: monthLabel }), jsx("svg", { className: monthCaretClass, viewBox: "0 0 12 12", width: "10", height: "10", "aria-hidden": "true", children: jsx("path", { d: "M2 4l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) })] })), !isYearGranularity && (jsxs("div", { className: navGroupClass, children: [jsx("button", { type: "button", className: navPrevClass, "aria-label": isDayGranularity ? t.prevMonth : t.prevYear, disabled: prevDisabled || view !== baseView, onClick: () => onFocusedDateChange(prevAnchor), children: navArrow('M10 3l-5 5 5 5') }), jsx("button", { type: "button", className: navNextClass, "aria-label": isDayGranularity ? t.nextMonth : t.nextYear, disabled: nextDisabled || view !== baseView, onClick: () => onFocusedDateChange(nextAnchor), children: navArrow('M6 3l5 5-5 5') })] }))] }), view === 'days' && (jsxs(Fragment, { children: [jsx("div", { className: dayNamesRowClass, "aria-hidden": "true", children: computedDayNames.map((name, i) => (jsx("div", { className: dayNameClass, children: name }, i))) }), jsx("div", { ref: gridRef, role: "grid", "aria-labelledby": labelId, "aria-multiselectable": rangeMode || undefined, "aria-describedby": rangeMode ? rangeSummaryId : undefined, className: gridClass, onKeyDown: handleKeyDown, onMouseLeave: anchor ? () => setHoverDate(null) : undefined, ...gridFocusHandlers, children: inWeeks(cells.map(cell => {
|
|
651
|
-
const disabled = isDateUnselectable(cell.date);
|
|
659
|
+
}, children: [jsx("span", { className: monthLabelClass, id: labelId, "aria-live": "polite", children: monthLabel }), jsx("svg", { className: monthCaretClass, viewBox: "0 0 12 12", width: "10", height: "10", "aria-hidden": "true", children: jsx("path", { d: "M2 4l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) })] })), !isYearGranularity && (jsxs("div", { className: navGroupClass, children: [jsx("button", { type: "button", className: navPrevClass, "aria-label": isDayGranularity ? t.prevMonth : t.prevYear, disabled: calendarDisabled || prevDisabled || view !== baseView, onClick: () => onFocusedDateChange(prevAnchor), children: navArrow('M10 3l-5 5 5 5') }), jsx("button", { type: "button", className: navNextClass, "aria-label": isDayGranularity ? t.nextMonth : t.nextYear, disabled: calendarDisabled || nextDisabled || view !== baseView, onClick: () => onFocusedDateChange(nextAnchor), children: navArrow('M6 3l5 5-5 5') })] }))] }), view === 'days' && (jsxs(Fragment, { children: [jsx("div", { className: dayNamesRowClass, "aria-hidden": "true", children: computedDayNames.map((name, i) => (jsx("div", { className: dayNameClass, children: name }, i))) }), jsx("div", { ref: gridRef, role: "grid", "aria-labelledby": labelId, "aria-multiselectable": rangeMode || undefined, "aria-describedby": rangeMode ? rangeSummaryId : undefined, "aria-disabled": calendarDisabled || undefined, "aria-readonly": readOnly || undefined, className: gridClass, onKeyDown: handleKeyDown, onMouseLeave: anchor ? () => setHoverDate(null) : undefined, ...gridFocusHandlers, children: inWeeks(cells.map(cell => {
|
|
660
|
+
const disabled = calendarDisabled || isDateUnselectable(cell.date);
|
|
652
661
|
const time = cell.date.getTime();
|
|
653
662
|
// Range mode. The range on show has its ends filled. Every day
|
|
654
663
|
// of a committed range is selected, and of a preview only the
|
|
@@ -710,9 +719,9 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
710
719
|
else
|
|
711
720
|
onSelect?.(cell.date);
|
|
712
721
|
}, style: !display ? { visibility: 'hidden' } : undefined, children: cell.date.getDate() }, cell.date.toISOString()));
|
|
713
|
-
}), weekClass) })] })), view === 'months' && (jsx("div", { ref: monthGridRef, role: "grid", "aria-labelledby": labelId, className: monthsGridClass, onKeyDown: handleMonthKeyDown, ...gridFocusHandlers, children: MONTH_ROWS.map(row => (jsx("div", { role: "row", className: monthsRowClass, children: row.map(month => {
|
|
722
|
+
}), weekClass) })] })), view === 'months' && (jsx("div", { ref: monthGridRef, role: "grid", "aria-labelledby": labelId, "aria-disabled": calendarDisabled || undefined, "aria-readonly": readOnly || undefined, className: monthsGridClass, onKeyDown: handleMonthKeyDown, ...gridFocusHandlers, children: MONTH_ROWS.map(row => (jsx("div", { role: "row", className: monthsRowClass, children: row.map(month => {
|
|
714
723
|
const date = makeDate(focusedYear, month);
|
|
715
|
-
const disabled = disabledMonths[month];
|
|
724
|
+
const disabled = calendarDisabled || disabledMonths[month];
|
|
716
725
|
const isSelected = !!value && isSameMonth(value, date);
|
|
717
726
|
const isFocused = month === tabStopMonth;
|
|
718
727
|
const isCurrent = !!today && isSameMonth(date, today);
|
|
@@ -731,7 +740,7 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
731
740
|
onFocusedDateChange(clampDate(date, min, max));
|
|
732
741
|
onSelect?.(date);
|
|
733
742
|
}, children: monthCellNames[month] }, month));
|
|
734
|
-
}) }, row[0]))) })), view === 'years' && (jsx("div", { ref: yearGridRef, className: yearsGridClass, role: "listbox", "aria-label": isYearGranularity ? t.chooseYear : monthLabel, onKeyDown: handleYearListKeyDown, children: yearList.map(year => {
|
|
743
|
+
}) }, row[0]))) })), view === 'years' && (jsx("div", { ref: yearGridRef, className: yearsGridClass, role: "listbox", "aria-label": isYearGranularity ? t.chooseYear : monthLabel, "aria-disabled": calendarDisabled || undefined, "aria-readonly": (isYearGranularity && readOnly) || undefined, onKeyDown: handleYearListKeyDown, children: yearList.map(year => {
|
|
735
744
|
const isFocused = year === tabStopYear;
|
|
736
745
|
const isToday = year === todayYear;
|
|
737
746
|
// As navigation the focused year is the current one. As the
|
|
@@ -739,7 +748,7 @@ const Calendar = ({ value, focusedDate, onSelect, onFocusedDateChange, min: minP
|
|
|
739
748
|
const isSelected = isYearGranularity
|
|
740
749
|
? !!value && value.getFullYear() === year
|
|
741
750
|
: isFocused;
|
|
742
|
-
const disabled = disabledYears.has(year);
|
|
751
|
+
const disabled = calendarDisabled || disabledYears.has(year);
|
|
743
752
|
const cellCls = prefixedClassNames(classPrefix, 'dateinput-year-cell', {
|
|
744
753
|
'is-selected': isSelected,
|
|
745
754
|
'is-today': isToday,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../src/form/_pickerInternals/Calendar.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../../helpers/classNames';\nimport { useConfig } from '../../helpers/Config';\nimport { getActiveElementInTree } from '../../helpers/shadowDom';\nimport { visuallyHidden } from '../../helpers/statusRegion';\nimport { useIsHydrated } from '../../helpers/useIsHydrated';\nimport {\n DateGranularity,\n DateRangeValue,\n DayOfWeek,\n PickerLabels,\n isPopoverToggleKey,\n mergeLabels,\n} from './pickerTypes';\nimport {\n addDays,\n addMonths,\n addYears,\n buildMonthGrid,\n canCloseRange,\n clampDate,\n FIRST_YEAR,\n floorMin,\n isDayUnselectable,\n isPeriodUnselectable,\n isSameDay,\n isSameMonth,\n makeDate,\n startOfDay,\n startOfMonth,\n} from './dateUtils';\nimport { formatDate, getDayNames, getMonthNames } from './formatters';\n\n/** What every calendar takes, whichever way it picks. */\ninterface CalendarBaseProps {\n focusedDate: Date;\n onFocusedDateChange: (d: Date) => void;\n /**\n * Earliest selectable date. One before year 1, or none, counts as the start\n * of year 1.\n */\n min?: Date;\n max?: Date;\n shouldDisableDate?: (d: Date) => boolean;\n unselectableDates?: Date[];\n firstDayOfWeek?: DayOfWeek;\n locale?: string;\n dayNames?: string[];\n monthNames?: string[];\n nearbyMonthDays?: boolean;\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n size?: 'small' | 'medium' | 'large';\n className?: string;\n id?: string;\n /**\n * When true, the day or month grid takes focus as it renders, and again as\n * it comes back from the year list. With or without it, once a grid has\n * focus, focus follows its tab stop from cell to cell.\n */\n autoFocusCell?: boolean;\n /** Optional translatable string overrides. */\n labels?: PickerLabels;\n /**\n * Inclusive `[min, max]` year range shown in the year-dropdown view.\n * Defaults to ±100 years around the focused year, clamped by `min`/`max`\n * and never reaching below year 1.\n * At `'year'` granularity the window centres on the year focused when the\n * calendar mounted, so moving focus never reflows the list.\n */\n yearsRange?: [number, number];\n /**\n * What a selection means. `'day'` shows the day grid; `'month'` shows a\n * month grid for the focused year, with the year list one header click\n * away for jumping; `'year'` shows the year list as the selection surface.\n * A month or year cell is disabled when every day in it is, and `onSelect`\n * receives the period's first day.\n */\n granularity?: DateGranularity;\n}\n\n/** A calendar that picks one day, month or year. */\ninterface CalendarSingleProps {\n /** The selected date. */\n value: Date | null;\n /** Called with a picked date, or the first day of a picked period. */\n onSelect: (d: Date) => void;\n range?: never;\n onRangeSelect?: never;\n allowDisabledInRange?: never;\n}\n\n/** A calendar that picks a range of days. */\ninterface CalendarRangeProps {\n /**\n * The committed range, start first, which turns on range mode. The day grid\n * then picks two days: the first pick marks a start inside the calendar and\n * commits nothing, and the second calls `onRangeSelect` with both ends. A\n * pick that cannot end the range starts a new one instead: one before the\n * start, or one past a disabled day unless `allowDisabledInRange` is set.\n * While a start is pending the grid previews the range to the hovered day,\n * or to the focused day, and hides the committed one. A range with a start\n * and no end opens with that start pending. Escape takes back a pending pick\n * and stops there, so a popover around the calendar stays open; a pending\n * start that came from `range` is not a pick, and Escape goes on.\n */\n range: DateRangeValue;\n /** Called with both ends once the second day is picked. */\n onRangeSelect: (start: Date, end: Date) => void;\n /**\n * Let a range include days that `shouldDisableDate` or `unselectableDates`\n * disable. Its ends can still not be such days.\n */\n allowDisabledInRange?: boolean;\n /** Only the day grid picks a range. */\n granularity?: 'day';\n value?: never;\n onSelect?: never;\n}\n\n/**\n * The calendar picks one date through `value` and `onSelect`, or a range\n * through `range` and `onRangeSelect`, and its props take exactly one pair.\n */\nexport type CalendarProps = CalendarBaseProps &\n (CalendarSingleProps | CalendarRangeProps);\n\n/**\n * Selects the calendar's focused cell, the one tab stop of whichever grid or\n * year list is on show, for a popover to put focus on as it opens. It runs\n * against the whole panel, so it matches only inside the grid or the list.\n */\nexport const CALENDAR_FOCUSED_CELL =\n '[role=\"grid\"] [data-focused=\"true\"], [role=\"listbox\"] [data-focused-year=\"true\"]';\n\ntype CalendarView = 'days' | 'months' | 'years';\n\nconst BASE_VIEW: Record<DateGranularity, CalendarView> = {\n day: 'days',\n month: 'months',\n year: 'years',\n};\n\n// Months in rows of three, so the grid is four rows deep.\nconst MONTH_ROWS = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [9, 10, 11],\n];\nconst MONTHS_PER_ROW = 3;\n// The year list's CSS lays it out four to a row.\nconst YEARS_PER_ROW = 4;\n\n/**\n * The month grid's keyboard, after the day grid's: arrows move a month or a\n * row, Home/End go to the row's ends, PageUp/PageDown move a year. Returns\n * the months to move by and the direction to search past disabled months, or\n * `null` for a key the grid doesn't handle. `col` is the focused month's\n * column.\n */\nfunction monthStep(key: string, col: number): [number, 1 | -1] | null {\n switch (key) {\n case 'ArrowLeft':\n return [-1, -1];\n case 'ArrowRight':\n return [1, 1];\n case 'ArrowUp':\n return [-MONTHS_PER_ROW, -1];\n case 'ArrowDown':\n return [MONTHS_PER_ROW, 1];\n case 'PageUp':\n return [-12, -1];\n case 'PageDown':\n return [12, 1];\n case 'Home':\n return [-col, 1];\n case 'End':\n return [MONTHS_PER_ROW - 1 - col, -1];\n default:\n return null;\n }\n}\n\n/**\n * Whether DOM focus should follow a grid's tab stop as it moves: focus is in\n * the grid, or fell to <body> while the grid held it last, as it does when\n * the focused cell leaves the page or becomes disabled. Focus is read in the\n * grid's own tree, so this holds inside a shadow root too.\n */\nfunction focusFollows(grid: HTMLElement, heldLast: boolean): boolean {\n const active = getActiveElementInTree(grid);\n if (grid.contains(active)) return true;\n return heldLast && active === grid.ownerDocument.body;\n}\n\n/**\n * The cell nearest index `i` that `disabled` leaves enabled, `i` itself when\n * it is. At equal distance the later cell wins. With every cell disabled it\n * stays `i`, as there is nothing to reach.\n */\nfunction nearestEnabled(i: number, disabled: boolean[]): number {\n if (!disabled[i]) return i;\n for (let d = 1; d < disabled.length; d++) {\n if (i + d < disabled.length && !disabled[i + d]) return i + d;\n if (i - d >= 0 && !disabled[i - d]) return i - d;\n }\n return i;\n}\n\n/** The long, spoken form of a date in a range's announcement. */\nconst LONG_DATE: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n};\n\n/** A range's pending start: its start, when it has no end. */\nconst pendingStartOf = (range?: DateRangeValue): Date | null =>\n range?.[0] && !range[1] ? startOfDay(range[0]) : null;\n\n/**\n * The day grid's cells in rows of a week. A grid owns rows and rows own\n * cells, so assistive technology can walk the grid, and the selection it\n * reports, row by row.\n */\nconst inWeeks = (days: React.ReactElement[], className: string) => {\n const rows: React.ReactElement[] = [];\n for (let i = 0; i < days.length; i += 7) {\n rows.push(\n <div key={i} role=\"row\" className={className}>\n {days.slice(i, i + 7)}\n </div>\n );\n }\n return rows;\n};\n\n/** A date's time, or `null` for none, for comparing ranges by value. */\nconst timeOf = (d: Date | null | undefined): number | null =>\n d ? d.getTime() : null;\n\n/**\n * The year list's keyboard, as the selection surface and as navigation:\n * arrows move a year or a row, Home/End go to the list's ends. Returns the\n * year to start from and the direction to search past disabled years, or\n * `null` for a key the list doesn't handle. As navigation no year is\n * disabled, so only the year is used.\n */\nfunction yearStep(\n key: string,\n focusedYear: number,\n years: number[]\n): [number, 1 | -1] | null {\n switch (key) {\n case 'ArrowLeft':\n return [focusedYear - 1, -1];\n case 'ArrowRight':\n return [focusedYear + 1, 1];\n case 'ArrowUp':\n return [focusedYear - YEARS_PER_ROW, -1];\n case 'ArrowDown':\n return [focusedYear + YEARS_PER_ROW, 1];\n case 'Home':\n return [years[0], 1];\n case 'End':\n return [years[years.length - 1], -1];\n default:\n return null;\n }\n}\n\nexport const Calendar: React.FC<CalendarProps> = ({\n value,\n focusedDate,\n onSelect,\n onFocusedDateChange,\n min: minProp,\n max,\n shouldDisableDate,\n unselectableDates,\n firstDayOfWeek = 0,\n locale,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n color,\n size,\n className,\n id,\n autoFocusCell = false,\n labels,\n yearsRange,\n granularity = 'day',\n range,\n onRangeSelect,\n allowDisabledInRange = false,\n}) => {\n const gridRef = useRef<HTMLDivElement>(null);\n const monthGridRef = useRef<HTMLDivElement>(null);\n const yearGridRef = useRef<HTMLDivElement>(null);\n const { classPrefix } = useConfig();\n const t = mergeLabels(labels);\n const baseView = BASE_VIEW[granularity];\n const isDayGranularity = granularity === 'day';\n const isYearGranularity = granularity === 'year';\n const [view, setView] = useState<CalendarView>(baseView);\n // Nothing before year 1 can be picked or reached, as in HTML's date inputs.\n const min = useMemo(() => floorMin(minProp), [minProp]);\n\n const computedDayNames = useMemo(() => {\n if (dayNames && dayNames.length === 7) return dayNames;\n const sundayFirst = getDayNames(locale, 'short');\n return [\n ...sundayFirst.slice(firstDayOfWeek),\n ...sundayFirst.slice(0, firstDayOfWeek),\n ];\n }, [dayNames, locale, firstDayOfWeek]);\n\n const computedMonthNames = useMemo(() => {\n if (monthNames && monthNames.length === 12) return monthNames;\n return getMonthNames(locale, 'long');\n }, [monthNames, locale]);\n\n // The month grid's cells are too narrow for long names, so they show the\n // short form unless the caller supplied names of their own.\n const monthCellNames = useMemo(() => {\n if (monthNames && monthNames.length === 12) return monthNames;\n return getMonthNames(locale, 'short');\n }, [monthNames, locale]);\n\n const cells = useMemo(\n () => buildMonthGrid(focusedDate, firstDayOfWeek),\n [focusedDate, firstDayOfWeek]\n );\n\n const isDateUnselectable = useCallback(\n (d: Date) =>\n isDayUnselectable(d, { min, max, shouldDisableDate, unselectableDates }),\n [min, max, shouldDisableDate, unselectableDates]\n );\n\n // A month or year is out of reach only when every day in it is.\n const isMonthUnselectable = useCallback(\n (d: Date) =>\n isPeriodUnselectable(d, 'month', {\n min,\n max,\n shouldDisableDate,\n unselectableDates,\n }),\n [min, max, shouldDisableDate, unselectableDates]\n );\n const isYearUnselectable = useCallback(\n (year: number) =>\n isPeriodUnselectable(makeDate(year), 'year', {\n min,\n max,\n shouldDisableDate,\n unselectableDates,\n }),\n [min, max, shouldDisableDate, unselectableDates]\n );\n\n // The day grid's one tab stop. A disabled button can't take focus, so when\n // the focused day is disabled the stop moves to the nearest enabled day of\n // the month on show, and focusing it makes it the focused day. A nearby\n // month's day is left out, as focusing it would turn the grid to its month.\n const tabStopDay = useMemo(() => {\n const days = cells.filter(c => c.inCurrentMonth).map(c => c.date);\n const i = nearestEnabled(\n focusedDate.getDate() - 1,\n days.map(isDateUnselectable)\n );\n return days[i];\n }, [cells, focusedDate, isDateUnselectable]);\n\n // ----- Range mode -----\n // Range props come only with the day grid.\n const rangeMode = !!range;\n const valuePending = pendingStartOf(range);\n\n // The start of a range being picked, which nothing outside the calendar\n // sees until its end is picked too. It starts as the range's own pending\n // start, and starts there again whenever the range changes from outside.\n const [anchor, setAnchor] = useState<Date | null>(valuePending);\n const rangeKey = `${timeOf(range?.[0])}|${timeOf(range?.[1])}`;\n const [anchorRangeKey, setAnchorRangeKey] = useState(rangeKey);\n if (anchorRangeKey !== rangeKey) {\n setAnchorRangeKey(rangeKey);\n setAnchor(valuePending);\n }\n // The day under the pointer while a start is pending, which the preview\n // runs to ahead of the focused day.\n const [hoverDate, setHoverDate] = useState<Date | null>(null);\n\n // Whether `day` can end a range that starts on `start`. The start is\n // checked as well as the end: one the range brought, or one picked before\n // the bounds or the disabled days changed, can rule itself out.\n const canEndAt = useCallback(\n (start: Date, day: Date) =>\n !isDateUnselectable(start) &&\n !isDateUnselectable(day) &&\n canCloseRange(\n start,\n day,\n { shouldDisableDate, unselectableDates },\n allowDisabledInRange\n ),\n [\n isDateUnselectable,\n shouldDisableDate,\n unselectableDates,\n allowDisabledInRange,\n ]\n );\n\n // A pick in range mode: the end of the pending range when it can be one,\n // and otherwise the start of a new one.\n const pickRangeDay = useCallback(\n (picked: Date) => {\n const day = startOfDay(picked);\n // The pointer is on the picked day, which the focused day now is too.\n setHoverDate(null);\n if (anchor && canEndAt(anchor, day)) {\n setAnchor(null);\n onRangeSelect?.(anchor, day);\n } else {\n setAnchor(day);\n }\n },\n [anchor, canEndAt, onRangeSelect]\n );\n\n // What the grid shows: while a start is pending, the range from it to the\n // hovered or focused day, when that day can end it; otherwise the\n // committed range.\n let shownStart: Date | null;\n let shownEnd: Date | null;\n if (anchor) {\n shownStart = anchor;\n const previewEnd = startOfDay(hoverDate ?? focusedDate);\n shownEnd = canEndAt(anchor, previewEnd) ? previewEnd : null;\n } else {\n shownStart = range?.[0] ? startOfDay(range[0]) : null;\n shownEnd = range?.[1] ? startOfDay(range[1]) : null;\n }\n const previewing = !!anchor;\n\n // Ids for the words that name a range's ends and state the whole range.\n const reactId = useId();\n const rangeIdBase = id ?? `calendar-${reactId}`;\n const rangeStartId = `${rangeIdBase}-range-start`;\n const rangeEndId = `${rangeIdBase}-range-end`;\n const rangePreviewEndId = `${rangeIdBase}-range-preview-end`;\n const rangeSummaryId = `${rangeIdBase}-range-summary`;\n // The selection in words: the pending start alone, or the committed ends.\n const selectedEnd = previewing ? null : shownEnd;\n const rangeSummary = [\n shownStart &&\n `${t.rangeStart}: ${formatDate(shownStart, LONG_DATE, locale)}`,\n selectedEnd &&\n `${t.rangeEnd}: ${formatDate(selectedEnd, LONG_DATE, locale)}`,\n ]\n .filter(Boolean)\n .join(', ');\n\n // Whether the grid on show holds focus, or held it last before focus went\n // nowhere: the cell that had it left the page or became disabled. A blur\n // that takes focus out of the grid, to nowhere included, is the user\n // leaving, so it clears this. A render that removes or disables the focused\n // cell sends no blur here: browsers fire none, or fire it inside React's\n // commit, where React delivers no events.\n const gridHeldFocusRef = useRef(false);\n const gridFocusHandlers = {\n onFocus: () => {\n gridHeldFocusRef.current = true;\n },\n onBlur: (e: React.FocusEvent<HTMLDivElement>) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !e.currentTarget.contains(next)) {\n gridHeldFocusRef.current = false;\n }\n },\n };\n\n // Step from `next` by `direction` days until we hit a selectable date,\n // skipping past dates blocked by min/max, shouldDisableDate, or\n // unselectableDates. If the whole searched range is disabled, focus stays\n // put. Cap iterations to guard against pathologically empty ranges.\n const moveFocus = useCallback(\n (next: Date, direction: 1 | -1) => {\n let candidate = next;\n for (let i = 0; i < 366; i++) {\n if (candidate.getTime() < startOfDay(min).getTime()) return;\n if (max && candidate.getTime() > startOfDay(max).getTime()) return;\n if (!isDateUnselectable(candidate)) {\n onFocusedDateChange(candidate);\n return;\n }\n candidate = addDays(candidate, direction);\n }\n },\n [min, max, isDateUnselectable, onFocusedDateChange]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (isPopoverToggleKey(e)) return;\n // A key takes the range preview back from the pointer.\n setHoverDate(null);\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n moveFocus(addDays(focusedDate, -1), -1);\n break;\n case 'ArrowRight':\n e.preventDefault();\n moveFocus(addDays(focusedDate, 1), 1);\n break;\n case 'ArrowUp':\n e.preventDefault();\n moveFocus(addDays(focusedDate, -7), -1);\n break;\n case 'ArrowDown':\n e.preventDefault();\n moveFocus(addDays(focusedDate, 7), 1);\n break;\n case 'PageUp':\n e.preventDefault();\n moveFocus(\n e.shiftKey ? addYears(focusedDate, -1) : addMonths(focusedDate, -1),\n -1\n );\n break;\n case 'PageDown':\n e.preventDefault();\n moveFocus(\n e.shiftKey ? addYears(focusedDate, 1) : addMonths(focusedDate, 1),\n 1\n );\n break;\n case 'Home': {\n e.preventDefault();\n const dayOfWeek = focusedDate.getDay();\n const offset = (dayOfWeek - firstDayOfWeek + 7) % 7;\n moveFocus(addDays(focusedDate, -offset), 1);\n break;\n }\n case 'End': {\n e.preventDefault();\n const dayOfWeek = focusedDate.getDay();\n const offset = (dayOfWeek - firstDayOfWeek + 7) % 7;\n moveFocus(addDays(focusedDate, 6 - offset), -1);\n break;\n }\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (isDateUnselectable(focusedDate)) break;\n if (rangeMode) pickRangeDay(focusedDate);\n else onSelect?.(focusedDate);\n break;\n case 'Escape':\n // A pending pick is taken back, and the key stops there so a\n // popover around the calendar stays open. The range's own pending\n // start is no pick, so Escape goes on to close the popover.\n if (anchor && !(valuePending && isSameDay(anchor, valuePending))) {\n e.preventDefault();\n e.stopPropagation();\n setAnchor(valuePending);\n }\n break;\n }\n },\n [\n focusedDate,\n firstDayOfWeek,\n isDateUnselectable,\n moveFocus,\n onSelect,\n rangeMode,\n pickRangeDay,\n anchor,\n valuePending,\n ]\n );\n\n // The month grid's counterpart to `moveFocus`: step by `direction` months\n // until a month with a selectable day turns up, stopping at the min/max\n // months. The cap guards against a range with nothing selectable.\n const moveMonthFocus = useCallback(\n (next: Date, direction: 1 | -1) => {\n let candidate = next;\n for (let i = 0; i < 120; i++) {\n const month = startOfMonth(candidate).getTime();\n if (month < startOfMonth(min).getTime()) return;\n if (max && month > startOfMonth(max).getTime()) return;\n if (!isMonthUnselectable(candidate)) {\n onFocusedDateChange(candidate);\n return;\n }\n candidate = addMonths(candidate, direction);\n }\n },\n [min, max, isMonthUnselectable, onFocusedDateChange]\n );\n\n const handleMonthKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (isPopoverToggleKey(e)) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (!isMonthUnselectable(focusedDate)) {\n onSelect?.(startOfMonth(focusedDate));\n }\n return;\n }\n const step = monthStep(e.key, focusedDate.getMonth() % MONTHS_PER_ROW);\n if (!step) return;\n e.preventDefault();\n moveMonthFocus(addMonths(focusedDate, step[0]), step[1]);\n },\n [focusedDate, isMonthUnselectable, moveMonthFocus, onSelect]\n );\n\n const calendarClass = usePrefixedClassNames('dateinput', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n });\n const headerClass = usePrefixedClassNames('dateinput-header');\n const monthTriggerClass = usePrefixedClassNames('dateinput-month-trigger', {\n 'is-active': view === 'years',\n });\n const monthCaretClass = usePrefixedClassNames('dateinput-month-caret');\n const navGroupClass = usePrefixedClassNames('dateinput-nav-group');\n const navPrevClass = usePrefixedClassNames('dateinput-nav-prev');\n const navNextClass = usePrefixedClassNames('dateinput-nav-next');\n const monthLabelClass = usePrefixedClassNames('dateinput-month-label');\n const dayNamesRowClass = usePrefixedClassNames('dateinput-day-names');\n const dayNameClass = usePrefixedClassNames('dateinput-day-name');\n const gridClass = usePrefixedClassNames('dateinput-grid');\n const weekClass = usePrefixedClassNames('dateinput-week');\n const monthsGridClass = usePrefixedClassNames('dateinput-months-grid');\n const monthsRowClass = usePrefixedClassNames('dateinput-months-row');\n const yearsGridClass = usePrefixedClassNames('dateinput-years-grid');\n\n const focusedYear = focusedDate.getFullYear();\n // Today is the reader's, so it's marked only once the page has hydrated: a\n // server render and the render hydrating it mark no day, month or year,\n // and the commit after marks the browser's own. A calendar mounted after\n // hydration marks it from its first render.\n const hydrated = useIsHydrated();\n const today = hydrated ? new Date() : null;\n const todayYear = today?.getFullYear();\n\n // The header steps a month at a time over the day grid and a year at a\n // time over the month grid, kept inside min/max. A step is off once the\n // month or year on show holds the bound or lies past it, as picking a year\n // from the list can leave it.\n const prevAnchor = isDayGranularity\n ? addMonths(focusedDate, -1)\n : clampDate(addYears(focusedDate, -1), min, max);\n const nextAnchor = isDayGranularity\n ? addMonths(focusedDate, 1)\n : clampDate(addYears(focusedDate, 1), min, max);\n const focusedMonth = startOfMonth(focusedDate).getTime();\n const prevDisabled = isDayGranularity\n ? focusedMonth <= startOfMonth(min).getTime()\n : focusedYear <= min.getFullYear();\n const nextDisabled = isDayGranularity\n ? !!max && focusedMonth >= startOfMonth(max).getTime()\n : !!max && focusedYear >= max.getFullYear();\n\n const labelId = id ? `${id}-label` : undefined;\n const monthLabel = isDayGranularity\n ? `${computedMonthNames[focusedDate.getMonth()]} ${focusedYear}`\n : String(focusedYear);\n\n // As the selection surface the year list is where focus moves, so its\n // window stays centred on the year focused at mount: re-centring on every\n // move would reflow the list under the keyboard.\n const [mountYear] = useState(focusedYear);\n const windowYear = isYearGranularity ? mountYear : focusedYear;\n\n const yearList = useMemo<number[]>(() => {\n const minYear = minProp\n ? min.getFullYear()\n : Math.max(FIRST_YEAR, windowYear - 100);\n const maxYear = max ? max.getFullYear() : windowYear + 100;\n const [lo, hi] = yearsRange ?? [minYear, maxYear];\n const start = Math.max(lo, minYear);\n const end = Math.min(hi, maxYear);\n const out: number[] = [];\n for (let y = start; y <= end; y++) out.push(y);\n return out;\n }, [windowYear, minProp, min, max, yearsRange]);\n\n // Only the selection surface disables years; as navigation every listed\n // year can be visited.\n const disabledYears = useMemo(\n () =>\n new Set(\n isYearGranularity ? yearList.filter(y => isYearUnselectable(y)) : []\n ),\n [isYearGranularity, yearList, isYearUnselectable]\n );\n // The year list's one tab stop, after the month grid's: when the focused\n // year is disabled the stop moves to the nearest enabled year in the list,\n // and focusing it makes it the focused year. As the selection surface a\n // year outside a non-empty list starts from the end it fell past, so the\n // list keeps a stop. As navigation it marks the current year, so a year\n // outside the list marks no option, and the stop itself follows focus.\n const tabStopYear = useMemo(() => {\n let i = yearList.indexOf(focusedYear);\n if (i < 0) {\n if (!isYearGranularity || yearList.length === 0) return focusedYear;\n i = focusedYear < yearList[0] ? 0 : yearList.length - 1;\n }\n return yearList[\n nearestEnabled(\n i,\n yearList.map(y => disabledYears.has(y))\n )\n ];\n }, [yearList, focusedYear, disabledYears, isYearGranularity]);\n\n // As navigation the keys move focus and leave the focused year alone, so\n // the tab stop goes to the year that last had focus while it is listed,\n // and Tab leaves the list rather than landing on the current year. It\n // starts over each time the list opens.\n const [navYear, setNavYear] = useState<number | null>(null);\n const listTabStop =\n navYear !== null && yearList.includes(navYear) ? navYear : tabStopYear;\n\n // Which of the focused year's months have no selectable day.\n const disabledMonths = useMemo(\n () =>\n granularity === 'month'\n ? Array.from({ length: 12 }, (_, m) =>\n isMonthUnselectable(makeDate(focusedYear, m))\n )\n : [],\n [granularity, focusedYear, isMonthUnselectable]\n );\n // The month grid's one tab stop. A disabled button can't take focus, so\n // when the focused month is disabled the stop moves to the nearest enabled\n // month, and focusing it makes it the focused month.\n const tabStopMonth = nearestEnabled(focusedDate.getMonth(), disabledMonths);\n\n const handleYearSelect = useCallback(\n (year: number) => {\n const next = new Date(focusedDate);\n next.setFullYear(year);\n // Keep month/day. The month grid also clamps into [min, max] so its\n // focused month is never one the bounds rule out.\n onFocusedDateChange(isDayGranularity ? next : clampDate(next, min, max));\n setView(baseView);\n },\n [focusedDate, onFocusedDateChange, isDayGranularity, min, max, baseView]\n );\n\n // Picking from the year list as the selection surface: focus follows the\n // pick and `onSelect` gets the year's first day.\n const handleYearPick = useCallback(\n (year: number) => {\n onFocusedDateChange(clampDate(makeDate(year), min, max));\n onSelect?.(makeDate(year));\n },\n [min, max, onFocusedDateChange, onSelect]\n );\n\n // Step through the listed years from `year` by `direction`, skipping\n // disabled ones, and focus the first selectable year found.\n const moveYearFocus = useCallback(\n (year: number, direction: 1 | -1) => {\n const first = yearList[0];\n const last = yearList[yearList.length - 1];\n for (let y = year; y >= first && y <= last; y += direction) {\n if (!disabledYears.has(y)) {\n onFocusedDateChange(clampDate(makeDate(y), min, max));\n return;\n }\n }\n },\n [yearList, disabledYears, onFocusedDateChange, min, max]\n );\n\n const handleYearListKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (isPopoverToggleKey(e)) return;\n if (isYearGranularity) {\n const step = yearStep(e.key, focusedYear, yearList);\n if (!step) return;\n e.preventDefault();\n moveYearFocus(step[0], step[1]);\n return;\n }\n // As navigation, Escape returns to the grid the list was opened from.\n // It stops there, so a popover around the calendar stays open and only\n // a second Escape closes it.\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setView(baseView);\n return;\n }\n // The other keys move DOM focus from the year that has it and leave\n // the focused date alone. The list is centred on that date, so moving\n // it would reflow the list under the keyboard, and it would turn the\n // grid behind the list before anything is picked. Enter or Space\n // clicks the year with focus, which picks it.\n const options = Array.from(\n e.currentTarget.querySelectorAll<HTMLElement>('[role=\"option\"]')\n );\n const from = options.indexOf(e.target as HTMLElement);\n if (from < 0) return;\n const step = yearStep(e.key, yearList[from], yearList);\n if (!step) return;\n e.preventDefault();\n // The listed years run one apart, so a year's index is its distance\n // from the first. A step past either end finds no option.\n options[step[0] - yearList[0]]?.focus();\n },\n [isYearGranularity, baseView, focusedYear, yearList, moveYearFocus]\n );\n\n // The day or month grid takes focus as the popover opens on it, or comes\n // back to it from the year list.\n useEffect(() => {\n if (!autoFocusCell) return;\n const grid =\n view === 'days'\n ? gridRef.current\n : view === 'months'\n ? monthGridRef.current\n : null;\n grid?.querySelector<HTMLElement>('[data-focused=\"true\"]')?.focus();\n }, [autoFocusCell, view]);\n\n // From then on focus follows the tab stop only while the grid has it, or\n // has just lost it, so focus on a header button or a time wheel stays put.\n const tabStopDayTime = tabStopDay.getTime();\n useEffect(() => {\n const grid = gridRef.current;\n if (view !== 'days' || !grid) return;\n if (!focusFollows(grid, gridHeldFocusRef.current)) return;\n grid.querySelector<HTMLElement>('[data-focused=\"true\"]')?.focus();\n }, [tabStopDayTime, view]);\n\n useEffect(() => {\n const grid = monthGridRef.current;\n if (view !== 'months' || !grid) return;\n if (!focusFollows(grid, gridHeldFocusRef.current)) return;\n grid.querySelector<HTMLElement>('[data-focused=\"true\"]')?.focus();\n }, [focusedYear, tabStopMonth, view]);\n\n // When the year view opens as navigation, scroll the focused year into\n // view.\n useEffect(() => {\n if (view !== 'years' || isYearGranularity || !yearGridRef.current) return;\n const sel = yearGridRef.current.querySelector<HTMLElement>(\n '[data-focused-year=\"true\"]'\n );\n sel?.scrollIntoView({ block: 'center' });\n sel?.focus();\n }, [view, isYearGranularity]);\n\n // As the selection surface the year list opens with the focused year in\n // its middle. It scrolls the list itself rather than calling\n // `scrollIntoView`, which would also scroll the page to an inline calendar\n // on load, and focuses that year only when the popover asks.\n useEffect(() => {\n const list = yearGridRef.current;\n if (!isYearGranularity || !list) return;\n const target = list.querySelector<HTMLElement>(\n '[data-focused-year=\"true\"]'\n );\n if (!target) return;\n const rect = target.getBoundingClientRect();\n list.scrollTop +=\n rect.top -\n list.getBoundingClientRect().top -\n (list.clientHeight - rect.height) / 2;\n if (autoFocusCell) target.focus({ preventScroll: true });\n }, [isYearGranularity, autoFocusCell]);\n\n // Keyboard moves keep DOM focus on the focused year while the list has it.\n useEffect(() => {\n const list = yearGridRef.current;\n if (!isYearGranularity || !list) return;\n if (!list.contains(getActiveElementInTree(list))) return;\n list.querySelector<HTMLElement>('[data-focused-year=\"true\"]')?.focus();\n }, [isYearGranularity, focusedYear]);\n\n const navArrow = (d: string) => (\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <path\n d={d}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n\n return (\n <div className={classNames(calendarClass, className)} id={id}>\n <div className={headerClass}>\n {isYearGranularity ? (\n // The year list is the only view, so the label opens nothing.\n <span className={monthLabelClass} id={labelId}>\n {monthLabel}\n </span>\n ) : (\n <button\n type=\"button\"\n className={monthTriggerClass}\n aria-haspopup=\"listbox\"\n aria-expanded={view === 'years'}\n onClick={() => {\n setNavYear(null);\n setView(v => (v === 'years' ? baseView : 'years'));\n }}\n >\n <span className={monthLabelClass} id={labelId} aria-live=\"polite\">\n {monthLabel}\n </span>\n <svg\n className={monthCaretClass}\n viewBox=\"0 0 12 12\"\n width=\"10\"\n height=\"10\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M2 4l4 4 4-4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n )}\n {!isYearGranularity && (\n <div className={navGroupClass}>\n <button\n type=\"button\"\n className={navPrevClass}\n aria-label={isDayGranularity ? t.prevMonth : t.prevYear}\n disabled={prevDisabled || view !== baseView}\n onClick={() => onFocusedDateChange(prevAnchor)}\n >\n {navArrow('M10 3l-5 5 5 5')}\n </button>\n <button\n type=\"button\"\n className={navNextClass}\n aria-label={isDayGranularity ? t.nextMonth : t.nextYear}\n disabled={nextDisabled || view !== baseView}\n onClick={() => onFocusedDateChange(nextAnchor)}\n >\n {navArrow('M6 3l5 5-5 5')}\n </button>\n </div>\n )}\n </div>\n\n {view === 'days' && (\n <>\n <div className={dayNamesRowClass} aria-hidden=\"true\">\n {computedDayNames.map((name, i) => (\n <div key={i} className={dayNameClass}>\n {name}\n </div>\n ))}\n </div>\n <div\n ref={gridRef}\n role=\"grid\"\n aria-labelledby={labelId}\n aria-multiselectable={rangeMode || undefined}\n aria-describedby={rangeMode ? rangeSummaryId : undefined}\n className={gridClass}\n onKeyDown={handleKeyDown}\n onMouseLeave={anchor ? () => setHoverDate(null) : undefined}\n {...gridFocusHandlers}\n >\n {inWeeks(\n cells.map(cell => {\n const disabled = isDateUnselectable(cell.date);\n const time = cell.date.getTime();\n // Range mode. The range on show has its ends filled. Every day\n // of a committed range is selected, and of a preview only the\n // start.\n const isStart = time === timeOf(shownStart);\n const isEnd = time === timeOf(shownEnd);\n const inRange =\n !!shownStart &&\n !!shownEnd &&\n time > shownStart.getTime() &&\n time < shownEnd.getTime();\n // The day a pending range would end on, which isn't picked\n // yet, so its description says what picking it does.\n const isPreviewEnd = previewing && isEnd && !isStart;\n const isPreview = (previewing && inRange) || isPreviewEnd;\n const isFilled = rangeMode\n ? isStart || (isEnd && !previewing)\n : !!value && isSameDay(value, cell.date);\n const isSelected =\n isFilled || (rangeMode && !previewing && inRange);\n const describedBy = rangeMode\n ? [\n isStart && rangeStartId,\n isEnd && !previewing && rangeEndId,\n isPreviewEnd && rangePreviewEndId,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n : undefined;\n const isFocused = isSameDay(cell.date, tabStopDay);\n const isToday = hydrated && cell.isToday;\n const otherMonth = !cell.inCurrentMonth;\n const cellClass = prefixedClassNames(\n classPrefix,\n 'dateinput-cell',\n {\n 'is-selected': isFilled,\n 'is-range-start': isStart,\n 'is-range-end': isEnd,\n 'is-in-range': inRange,\n 'is-preview': isPreview,\n 'is-today': isToday,\n 'is-disabled': disabled,\n 'is-other-month': otherMonth,\n }\n );\n const display = !otherMonth || nearbyMonthDays;\n return (\n <button\n key={cell.date.toISOString()}\n type=\"button\"\n role=\"gridcell\"\n tabIndex={isFocused ? 0 : -1}\n aria-selected={isSelected}\n aria-disabled={disabled}\n aria-current={isToday ? 'date' : undefined}\n aria-describedby={describedBy}\n data-focused={isFocused ? 'true' : undefined}\n disabled={disabled || !display}\n className={cellClass}\n onFocus={() => {\n // Reached by Tab while the focused day is disabled, or\n // by pointer: keys move on from here. A nearby month's\n // day waits for its click, which turns the grid.\n if (!otherMonth && !isSameDay(cell.date, focusedDate)) {\n onFocusedDateChange(cell.date);\n }\n }}\n // Mouseover rather than mouseenter: browsers send it to a\n // disabled day as well, where React holds mouseenter back,\n // so the preview leaves the last enabled day behind.\n onMouseOver={\n anchor ? () => setHoverDate(cell.date) : undefined\n }\n onClick={() => {\n if (disabled) return;\n onFocusedDateChange(cell.date);\n if (rangeMode) pickRangeDay(cell.date);\n else onSelect?.(cell.date);\n }}\n style={!display ? { visibility: 'hidden' } : undefined}\n >\n {cell.date.getDate()}\n </button>\n );\n }),\n weekClass\n )}\n </div>\n </>\n )}\n\n {view === 'months' && (\n <div\n ref={monthGridRef}\n role=\"grid\"\n aria-labelledby={labelId}\n className={monthsGridClass}\n onKeyDown={handleMonthKeyDown}\n {...gridFocusHandlers}\n >\n {MONTH_ROWS.map(row => (\n <div key={row[0]} role=\"row\" className={monthsRowClass}>\n {row.map(month => {\n const date = makeDate(focusedYear, month);\n const disabled = disabledMonths[month];\n const isSelected = !!value && isSameMonth(value, date);\n const isFocused = month === tabStopMonth;\n const isCurrent = !!today && isSameMonth(date, today);\n const cellClass = prefixedClassNames(\n classPrefix,\n 'dateinput-month-cell',\n {\n 'is-selected': isSelected,\n 'is-today': isCurrent,\n 'is-disabled': disabled,\n }\n );\n return (\n <button\n key={month}\n type=\"button\"\n role=\"gridcell\"\n tabIndex={isFocused ? 0 : -1}\n aria-selected={isSelected}\n aria-disabled={disabled}\n aria-current={isCurrent ? 'date' : undefined}\n aria-label={computedMonthNames[month]}\n data-focused={isFocused ? 'true' : undefined}\n disabled={disabled}\n className={cellClass}\n onFocus={() => {\n // Reached by Tab while the focused month is disabled,\n // or by pointer: keys move on from here.\n if (month !== focusedDate.getMonth()) {\n onFocusedDateChange(clampDate(date, min, max));\n }\n }}\n onClick={() => {\n onFocusedDateChange(clampDate(date, min, max));\n onSelect?.(date);\n }}\n >\n {monthCellNames[month]}\n </button>\n );\n })}\n </div>\n ))}\n </div>\n )}\n\n {view === 'years' && (\n <div\n ref={yearGridRef}\n className={yearsGridClass}\n role=\"listbox\"\n aria-label={isYearGranularity ? t.chooseYear : monthLabel}\n onKeyDown={handleYearListKeyDown}\n >\n {yearList.map(year => {\n const isFocused = year === tabStopYear;\n const isToday = year === todayYear;\n // As navigation the focused year is the current one. As the\n // selection surface the value's year is selected and focus roams.\n const isSelected = isYearGranularity\n ? !!value && value.getFullYear() === year\n : isFocused;\n const disabled = disabledYears.has(year);\n const cellCls = prefixedClassNames(\n classPrefix,\n 'dateinput-year-cell',\n {\n 'is-selected': isSelected,\n 'is-today': isToday,\n 'is-disabled': disabled,\n }\n );\n return (\n <button\n key={year}\n type=\"button\"\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={isYearGranularity ? disabled : undefined}\n aria-current={isYearGranularity && isToday ? 'date' : undefined}\n data-focused-year={isFocused ? 'true' : undefined}\n tabIndex={year === listTabStop ? 0 : -1}\n disabled={disabled}\n className={cellCls}\n onFocus={() => {\n // As navigation, focusing a year by key or pointer only\n // moves the tab stop: nothing is committed until a year is\n // picked. As the selection surface it is reached by Tab\n // while the focused year is disabled, or by pointer, and\n // keys move on from here.\n if (!isYearGranularity) {\n setNavYear(year);\n } else if (year !== focusedYear) {\n onFocusedDateChange(clampDate(makeDate(year), min, max));\n }\n }}\n onClick={() =>\n isYearGranularity\n ? handleYearPick(year)\n : handleYearSelect(year)\n }\n >\n {year}\n </button>\n );\n })}\n </div>\n )}\n\n {rangeMode && (\n // The words the day cells and the grid point at. The live region\n // stays mounted while the year list is open, so it is in the page\n // already when a pick changes what it says.\n <>\n <span id={rangeStartId} hidden>\n {t.rangeStart}\n </span>\n <span id={rangeEndId} hidden>\n {t.rangeEnd}\n </span>\n <span id={rangePreviewEndId} hidden>\n {t.rangePreviewEnd}\n </span>\n <div id={rangeSummaryId} aria-live=\"polite\" style={visuallyHidden}>\n {rangeSummary}\n </div>\n </>\n )}\n </div>\n );\n};\n\nCalendar.displayName = 'Calendar';\n\nexport default Calendar;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;AAyIA;;;;AAIG;AACI,MAAM,qBAAqB,GAChC;AAIF,MAAM,SAAS,GAA0C;AACvD,IAAA,GAAG,EAAE,MAAM;AACX,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,IAAI,EAAE,OAAO;CACd;AAED;AACA,MAAM,UAAU,GAAG;AACjB,IAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACT,IAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACT,IAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACT,IAAA,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;CACZ;AACD,MAAM,cAAc,GAAG,CAAC;AACxB;AACA,MAAM,aAAa,GAAG,CAAC;AAEvB;;;;;;AAMG;AACH,SAAS,SAAS,CAAC,GAAW,EAAE,GAAW,EAAA;IACzC,QAAQ,GAAG;AACT,QAAA,KAAK,WAAW;AACd,YAAA,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;AACjB,QAAA,KAAK,YAAY;AACf,YAAA,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACf,QAAA,KAAK,SAAS;AACZ,YAAA,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC;AAC9B,QAAA,KAAK,WAAW;AACd,YAAA,OAAO,CAAC,cAAc,EAAE,CAAC,C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AE,MAAM,EAAA,IAAA,EAAA,QAAA,EACzB,CAAC,CAAC,QAAQ,EAAA,CACN,EACPA,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAA,IAAA,EAAA,QAAA,EAChC,CAAC,CAAC,eAAe,EAAA,CACb,EACPA,GAAA,CAAA,KAAA,EAAA,EAAK,EAAE,EAAE,cAAc,EAAA,WAAA,EAAY,QAAQ,EAAC,KAAK,EAAE,cAAc,EAAA,QAAA,EAC9D,YAAY,EAAA,CACT,CAAA,EAAA,CACL,CACJ,CAAA,EAAA,CACG;AAEV;AAEA,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
|
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../src/form/_pickerInternals/Calendar.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../../helpers/classNames';\nimport { useConfig } from '../../helpers/Config';\nimport { getActiveElementInTree } from '../../helpers/shadowDom';\nimport { visuallyHidden } from '../../helpers/statusRegion';\nimport { useIsHydrated } from '../../helpers/useIsHydrated';\nimport {\n DateGranularity,\n DateRangeValue,\n DayOfWeek,\n PickerLabels,\n isPopoverToggleKey,\n mergeLabels,\n} from './pickerTypes';\nimport {\n addDays,\n addMonths,\n addYears,\n buildMonthGrid,\n canCloseRange,\n clampDate,\n FIRST_YEAR,\n floorMin,\n isDayUnselectable,\n isPeriodUnselectable,\n isSameDay,\n isSameMonth,\n makeDate,\n startOfDay,\n startOfMonth,\n} from './dateUtils';\nimport { formatDate, getDayNames, getMonthNames } from './formatters';\n\n/** What every calendar takes, whichever way it picks. */\ninterface CalendarBaseProps {\n focusedDate: Date;\n onFocusedDateChange: (d: Date) => void;\n /**\n * Earliest selectable date. One before year 1, or none, counts as the start\n * of year 1.\n */\n min?: Date;\n max?: Date;\n shouldDisableDate?: (d: Date) => boolean;\n unselectableDates?: Date[];\n firstDayOfWeek?: DayOfWeek;\n locale?: string;\n dayNames?: string[];\n monthNames?: string[];\n nearbyMonthDays?: boolean;\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n size?: 'small' | 'medium' | 'large';\n className?: string;\n id?: string;\n /**\n * When true, the day or month grid takes focus as it renders, and again as\n * it comes back from the year list. With or without it, once a grid has\n * focus, focus follows its tab stop from cell to cell.\n */\n autoFocusCell?: boolean;\n /** Optional translatable string overrides. */\n labels?: PickerLabels;\n /**\n * Inclusive `[min, max]` year range shown in the year-dropdown view.\n * Defaults to ±100 years around the focused year, clamped by `min`/`max`\n * and never reaching below year 1.\n * At `'year'` granularity the window centres on the year focused when the\n * calendar mounted, so moving focus never reflows the list.\n */\n yearsRange?: [number, number];\n /**\n * What a selection means. `'day'` shows the day grid; `'month'` shows a\n * month grid for the focused year, with the year list one header click\n * away for jumping; `'year'` shows the year list as the selection surface.\n * A month or year cell is disabled when every day in it is, and `onSelect`\n * receives the period's first day.\n */\n granularity?: DateGranularity;\n /**\n * Disable every button the calendar draws, its days and header included,\n * as a disabled fieldset around it does, so nothing can be picked or\n * focused.\n */\n disabled?: boolean;\n /**\n * Pick nothing. Focus still moves through the dates, by key and pointer,\n * and the header still turns the month, but a click, Enter or Space selects\n * no day, month or year.\n */\n readOnly?: boolean;\n}\n\n/** A calendar that picks one day, month or year. */\ninterface CalendarSingleProps {\n /** The selected date. */\n value: Date | null;\n /** Called with a picked date, or the first day of a picked period. */\n onSelect: (d: Date) => void;\n range?: never;\n onRangeSelect?: never;\n allowDisabledInRange?: never;\n}\n\n/** A calendar that picks a range of days. */\ninterface CalendarRangeProps {\n /**\n * The committed range, start first, which turns on range mode. The day grid\n * then picks two days: the first pick marks a start inside the calendar and\n * commits nothing, and the second calls `onRangeSelect` with both ends. A\n * pick that cannot end the range starts a new one instead: one before the\n * start, or one past a disabled day unless `allowDisabledInRange` is set.\n * While a start is pending the grid previews the range to the hovered day,\n * or to the focused day, and hides the committed one. A range with a start\n * and no end opens with that start pending. Escape takes back a pending pick\n * and stops there, so a popover around the calendar stays open; a pending\n * start that came from `range` is not a pick, and Escape goes on.\n */\n range: DateRangeValue;\n /** Called with both ends once the second day is picked. */\n onRangeSelect: (start: Date, end: Date) => void;\n /**\n * Let a range include days that `shouldDisableDate` or `unselectableDates`\n * disable. Its ends can still not be such days.\n */\n allowDisabledInRange?: boolean;\n /** Only the day grid picks a range. */\n granularity?: 'day';\n value?: never;\n onSelect?: never;\n}\n\n/**\n * The calendar picks one date through `value` and `onSelect`, or a range\n * through `range` and `onRangeSelect`, and its props take exactly one pair.\n */\nexport type CalendarProps = CalendarBaseProps &\n (CalendarSingleProps | CalendarRangeProps);\n\n/**\n * Selects the calendar's focused cell, the one tab stop of whichever grid or\n * year list is on show, for a popover to put focus on as it opens. It runs\n * against the whole panel, so it matches only inside the grid or the list.\n */\nexport const CALENDAR_FOCUSED_CELL =\n '[role=\"grid\"] [data-focused=\"true\"], [role=\"listbox\"] [data-focused-year=\"true\"]';\n\ntype CalendarView = 'days' | 'months' | 'years';\n\nconst BASE_VIEW: Record<DateGranularity, CalendarView> = {\n day: 'days',\n month: 'months',\n year: 'years',\n};\n\n// Months in rows of three, so the grid is four rows deep.\nconst MONTH_ROWS = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [9, 10, 11],\n];\nconst MONTHS_PER_ROW = 3;\n// The year list's CSS lays it out four to a row.\nconst YEARS_PER_ROW = 4;\n\n/**\n * The month grid's keyboard, after the day grid's: arrows move a month or a\n * row, Home/End go to the row's ends, PageUp/PageDown move a year. Returns\n * the months to move by and the direction to search past disabled months, or\n * `null` for a key the grid doesn't handle. `col` is the focused month's\n * column.\n */\nfunction monthStep(key: string, col: number): [number, 1 | -1] | null {\n switch (key) {\n case 'ArrowLeft':\n return [-1, -1];\n case 'ArrowRight':\n return [1, 1];\n case 'ArrowUp':\n return [-MONTHS_PER_ROW, -1];\n case 'ArrowDown':\n return [MONTHS_PER_ROW, 1];\n case 'PageUp':\n return [-12, -1];\n case 'PageDown':\n return [12, 1];\n case 'Home':\n return [-col, 1];\n case 'End':\n return [MONTHS_PER_ROW - 1 - col, -1];\n default:\n return null;\n }\n}\n\n/**\n * Whether DOM focus should follow a grid's tab stop as it moves: focus is in\n * the grid, or fell to <body> while the grid held it last, as it does when\n * the focused cell leaves the page or becomes disabled. Focus is read in the\n * grid's own tree, so this holds inside a shadow root too.\n */\nfunction focusFollows(grid: HTMLElement, heldLast: boolean): boolean {\n const active = getActiveElementInTree(grid);\n if (grid.contains(active)) return true;\n return heldLast && active === grid.ownerDocument.body;\n}\n\n/**\n * The cell nearest index `i` that `disabled` leaves enabled, `i` itself when\n * it is. At equal distance the later cell wins. With every cell disabled it\n * stays `i`, as there is nothing to reach.\n */\nfunction nearestEnabled(i: number, disabled: boolean[]): number {\n if (!disabled[i]) return i;\n for (let d = 1; d < disabled.length; d++) {\n if (i + d < disabled.length && !disabled[i + d]) return i + d;\n if (i - d >= 0 && !disabled[i - d]) return i - d;\n }\n return i;\n}\n\n/** The long, spoken form of a date in a range's announcement. */\nconst LONG_DATE: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n};\n\n/** A range's pending start: its start, when it has no end. */\nconst pendingStartOf = (range?: DateRangeValue): Date | null =>\n range?.[0] && !range[1] ? startOfDay(range[0]) : null;\n\n/**\n * The day grid's cells in rows of a week. A grid owns rows and rows own\n * cells, so assistive technology can walk the grid, and the selection it\n * reports, row by row.\n */\nconst inWeeks = (days: React.ReactElement[], className: string) => {\n const rows: React.ReactElement[] = [];\n for (let i = 0; i < days.length; i += 7) {\n rows.push(\n <div key={i} role=\"row\" className={className}>\n {days.slice(i, i + 7)}\n </div>\n );\n }\n return rows;\n};\n\n/** A date's time, or `null` for none, for comparing ranges by value. */\nconst timeOf = (d: Date | null | undefined): number | null =>\n d ? d.getTime() : null;\n\n/**\n * The year list's keyboard, as the selection surface and as navigation:\n * arrows move a year or a row, Home/End go to the list's ends. Returns the\n * year to start from and the direction to search past disabled years, or\n * `null` for a key the list doesn't handle. As navigation no year is\n * disabled, so only the year is used.\n */\nfunction yearStep(\n key: string,\n focusedYear: number,\n years: number[]\n): [number, 1 | -1] | null {\n switch (key) {\n case 'ArrowLeft':\n return [focusedYear - 1, -1];\n case 'ArrowRight':\n return [focusedYear + 1, 1];\n case 'ArrowUp':\n return [focusedYear - YEARS_PER_ROW, -1];\n case 'ArrowDown':\n return [focusedYear + YEARS_PER_ROW, 1];\n case 'Home':\n return [years[0], 1];\n case 'End':\n return [years[years.length - 1], -1];\n default:\n return null;\n }\n}\n\nexport const Calendar: React.FC<CalendarProps> = ({\n value,\n focusedDate,\n onSelect: onSelectProp,\n onFocusedDateChange,\n min: minProp,\n max,\n shouldDisableDate,\n unselectableDates,\n firstDayOfWeek = 0,\n locale,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n color,\n size,\n className,\n id,\n autoFocusCell = false,\n labels,\n yearsRange,\n granularity = 'day',\n range,\n onRangeSelect,\n allowDisabledInRange = false,\n disabled: calendarDisabled = false,\n readOnly = false,\n}) => {\n // A disabled or read-only calendar picks nothing, so its picks reach no\n // `onSelect`, and a range pick returns before it starts.\n const canPick = !calendarDisabled && !readOnly;\n const onSelect = canPick ? onSelectProp : undefined;\n const gridRef = useRef<HTMLDivElement>(null);\n const monthGridRef = useRef<HTMLDivElement>(null);\n const yearGridRef = useRef<HTMLDivElement>(null);\n const { classPrefix } = useConfig();\n const t = mergeLabels(labels);\n const baseView = BASE_VIEW[granularity];\n const isDayGranularity = granularity === 'day';\n const isYearGranularity = granularity === 'year';\n const [view, setView] = useState<CalendarView>(baseView);\n // Nothing before year 1 can be picked or reached, as in HTML's date inputs.\n const min = useMemo(() => floorMin(minProp), [minProp]);\n\n const computedDayNames = useMemo(() => {\n if (dayNames && dayNames.length === 7) return dayNames;\n const sundayFirst = getDayNames(locale, 'short');\n return [\n ...sundayFirst.slice(firstDayOfWeek),\n ...sundayFirst.slice(0, firstDayOfWeek),\n ];\n }, [dayNames, locale, firstDayOfWeek]);\n\n const computedMonthNames = useMemo(() => {\n if (monthNames && monthNames.length === 12) return monthNames;\n return getMonthNames(locale, 'long');\n }, [monthNames, locale]);\n\n // The month grid's cells are too narrow for long names, so they show the\n // short form unless the caller supplied names of their own.\n const monthCellNames = useMemo(() => {\n if (monthNames && monthNames.length === 12) return monthNames;\n return getMonthNames(locale, 'short');\n }, [monthNames, locale]);\n\n const cells = useMemo(\n () => buildMonthGrid(focusedDate, firstDayOfWeek),\n [focusedDate, firstDayOfWeek]\n );\n\n const isDateUnselectable = useCallback(\n (d: Date) =>\n isDayUnselectable(d, { min, max, shouldDisableDate, unselectableDates }),\n [min, max, shouldDisableDate, unselectableDates]\n );\n\n // A month or year is out of reach only when every day in it is.\n const isMonthUnselectable = useCallback(\n (d: Date) =>\n isPeriodUnselectable(d, 'month', {\n min,\n max,\n shouldDisableDate,\n unselectableDates,\n }),\n [min, max, shouldDisableDate, unselectableDates]\n );\n const isYearUnselectable = useCallback(\n (year: number) =>\n isPeriodUnselectable(makeDate(year), 'year', {\n min,\n max,\n shouldDisableDate,\n unselectableDates,\n }),\n [min, max, shouldDisableDate, unselectableDates]\n );\n\n // The day grid's one tab stop. A disabled button can't take focus, so when\n // the focused day is disabled the stop moves to the nearest enabled day of\n // the month on show, and focusing it makes it the focused day. A nearby\n // month's day is left out, as focusing it would turn the grid to its month.\n const tabStopDay = useMemo(() => {\n const days = cells.filter(c => c.inCurrentMonth).map(c => c.date);\n const i = nearestEnabled(\n focusedDate.getDate() - 1,\n days.map(isDateUnselectable)\n );\n return days[i];\n }, [cells, focusedDate, isDateUnselectable]);\n\n // ----- Range mode -----\n // Range props come only with the day grid.\n const rangeMode = !!range;\n const valuePending = pendingStartOf(range);\n\n // The start of a range being picked, which nothing outside the calendar\n // sees until its end is picked too. It starts as the range's own pending\n // start, and starts there again whenever the range changes from outside.\n const [pendingAnchor, setAnchor] = useState<Date | null>(valuePending);\n const rangeKey = `${timeOf(range?.[0])}|${timeOf(range?.[1])}`;\n const [anchorRangeKey, setAnchorRangeKey] = useState(rangeKey);\n if (anchorRangeKey !== rangeKey) {\n setAnchorRangeKey(rangeKey);\n setAnchor(valuePending);\n }\n // A calendar that picks nothing has no start pending, so it previews no\n // range and says nothing of picking an end.\n const anchor = canPick ? pendingAnchor : null;\n // The day under the pointer while a start is pending, which the preview\n // runs to ahead of the focused day.\n const [hoverDate, setHoverDate] = useState<Date | null>(null);\n\n // Whether `day` can end a range that starts on `start`. The start is\n // checked as well as the end: one the range brought, or one picked before\n // the bounds or the disabled days changed, can rule itself out.\n const canEndAt = useCallback(\n (start: Date, day: Date) =>\n !isDateUnselectable(start) &&\n !isDateUnselectable(day) &&\n canCloseRange(\n start,\n day,\n { shouldDisableDate, unselectableDates },\n allowDisabledInRange\n ),\n [\n isDateUnselectable,\n shouldDisableDate,\n unselectableDates,\n allowDisabledInRange,\n ]\n );\n\n // A pick in range mode: the end of the pending range when it can be one,\n // and otherwise the start of a new one.\n const pickRangeDay = useCallback(\n (picked: Date) => {\n if (!canPick) return;\n const day = startOfDay(picked);\n // The pointer is on the picked day, which the focused day now is too.\n setHoverDate(null);\n if (anchor && canEndAt(anchor, day)) {\n setAnchor(null);\n onRangeSelect?.(anchor, day);\n } else {\n setAnchor(day);\n }\n },\n [canPick, anchor, canEndAt, onRangeSelect]\n );\n\n // What the grid shows: while a start is pending, the range from it to the\n // hovered or focused day, when that day can end it; otherwise the\n // committed range.\n let shownStart: Date | null;\n let shownEnd: Date | null;\n if (anchor) {\n shownStart = anchor;\n const previewEnd = startOfDay(hoverDate ?? focusedDate);\n shownEnd = canEndAt(anchor, previewEnd) ? previewEnd : null;\n } else {\n shownStart = range?.[0] ? startOfDay(range[0]) : null;\n shownEnd = range?.[1] ? startOfDay(range[1]) : null;\n }\n const previewing = !!anchor;\n\n // Ids for the words that name a range's ends and state the whole range.\n const reactId = useId();\n const rangeIdBase = id ?? `calendar-${reactId}`;\n const rangeStartId = `${rangeIdBase}-range-start`;\n const rangeEndId = `${rangeIdBase}-range-end`;\n const rangePreviewEndId = `${rangeIdBase}-range-preview-end`;\n const rangeSummaryId = `${rangeIdBase}-range-summary`;\n // The selection in words: the pending start alone, or the committed ends.\n const selectedEnd = previewing ? null : shownEnd;\n const rangeSummary = [\n shownStart &&\n `${t.rangeStart}: ${formatDate(shownStart, LONG_DATE, locale)}`,\n selectedEnd &&\n `${t.rangeEnd}: ${formatDate(selectedEnd, LONG_DATE, locale)}`,\n ]\n .filter(Boolean)\n .join(', ');\n\n // Whether the grid on show holds focus, or held it last before focus went\n // nowhere: the cell that had it left the page or became disabled. A blur\n // that takes focus out of the grid, to nowhere included, is the user\n // leaving, so it clears this. A render that removes or disables the focused\n // cell sends no blur here: browsers fire none, or fire it inside React's\n // commit, where React delivers no events.\n const gridHeldFocusRef = useRef(false);\n const gridFocusHandlers = {\n onFocus: () => {\n gridHeldFocusRef.current = true;\n },\n onBlur: (e: React.FocusEvent<HTMLDivElement>) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !e.currentTarget.contains(next)) {\n gridHeldFocusRef.current = false;\n }\n },\n };\n\n // Step from `next` by `direction` days until we hit a selectable date,\n // skipping past dates blocked by min/max, shouldDisableDate, or\n // unselectableDates. If the whole searched range is disabled, focus stays\n // put. Cap iterations to guard against pathologically empty ranges.\n const moveFocus = useCallback(\n (next: Date, direction: 1 | -1) => {\n let candidate = next;\n for (let i = 0; i < 366; i++) {\n if (candidate.getTime() < startOfDay(min).getTime()) return;\n if (max && candidate.getTime() > startOfDay(max).getTime()) return;\n if (!isDateUnselectable(candidate)) {\n onFocusedDateChange(candidate);\n return;\n }\n candidate = addDays(candidate, direction);\n }\n },\n [min, max, isDateUnselectable, onFocusedDateChange]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (isPopoverToggleKey(e)) return;\n // A key takes the range preview back from the pointer.\n setHoverDate(null);\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n moveFocus(addDays(focusedDate, -1), -1);\n break;\n case 'ArrowRight':\n e.preventDefault();\n moveFocus(addDays(focusedDate, 1), 1);\n break;\n case 'ArrowUp':\n e.preventDefault();\n moveFocus(addDays(focusedDate, -7), -1);\n break;\n case 'ArrowDown':\n e.preventDefault();\n moveFocus(addDays(focusedDate, 7), 1);\n break;\n case 'PageUp':\n e.preventDefault();\n moveFocus(\n e.shiftKey ? addYears(focusedDate, -1) : addMonths(focusedDate, -1),\n -1\n );\n break;\n case 'PageDown':\n e.preventDefault();\n moveFocus(\n e.shiftKey ? addYears(focusedDate, 1) : addMonths(focusedDate, 1),\n 1\n );\n break;\n case 'Home': {\n e.preventDefault();\n const dayOfWeek = focusedDate.getDay();\n const offset = (dayOfWeek - firstDayOfWeek + 7) % 7;\n moveFocus(addDays(focusedDate, -offset), 1);\n break;\n }\n case 'End': {\n e.preventDefault();\n const dayOfWeek = focusedDate.getDay();\n const offset = (dayOfWeek - firstDayOfWeek + 7) % 7;\n moveFocus(addDays(focusedDate, 6 - offset), -1);\n break;\n }\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (isDateUnselectable(focusedDate)) break;\n if (rangeMode) pickRangeDay(focusedDate);\n else onSelect?.(focusedDate);\n break;\n case 'Escape':\n // A pending pick is taken back, and the key stops there so a\n // popover around the calendar stays open. The range's own pending\n // start is no pick, so Escape goes on to close the popover.\n if (anchor && !(valuePending && isSameDay(anchor, valuePending))) {\n e.preventDefault();\n e.stopPropagation();\n setAnchor(valuePending);\n }\n break;\n }\n },\n [\n focusedDate,\n firstDayOfWeek,\n isDateUnselectable,\n moveFocus,\n onSelect,\n rangeMode,\n pickRangeDay,\n anchor,\n valuePending,\n ]\n );\n\n // The month grid's counterpart to `moveFocus`: step by `direction` months\n // until a month with a selectable day turns up, stopping at the min/max\n // months. The cap guards against a range with nothing selectable.\n const moveMonthFocus = useCallback(\n (next: Date, direction: 1 | -1) => {\n let candidate = next;\n for (let i = 0; i < 120; i++) {\n const month = startOfMonth(candidate).getTime();\n if (month < startOfMonth(min).getTime()) return;\n if (max && month > startOfMonth(max).getTime()) return;\n if (!isMonthUnselectable(candidate)) {\n onFocusedDateChange(candidate);\n return;\n }\n candidate = addMonths(candidate, direction);\n }\n },\n [min, max, isMonthUnselectable, onFocusedDateChange]\n );\n\n const handleMonthKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (isPopoverToggleKey(e)) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (!isMonthUnselectable(focusedDate)) {\n onSelect?.(startOfMonth(focusedDate));\n }\n return;\n }\n const step = monthStep(e.key, focusedDate.getMonth() % MONTHS_PER_ROW);\n if (!step) return;\n e.preventDefault();\n moveMonthFocus(addMonths(focusedDate, step[0]), step[1]);\n },\n [focusedDate, isMonthUnselectable, moveMonthFocus, onSelect]\n );\n\n const calendarClass = usePrefixedClassNames('dateinput', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n });\n const headerClass = usePrefixedClassNames('dateinput-header');\n const monthTriggerClass = usePrefixedClassNames('dateinput-month-trigger', {\n 'is-active': view === 'years',\n });\n const monthCaretClass = usePrefixedClassNames('dateinput-month-caret');\n const navGroupClass = usePrefixedClassNames('dateinput-nav-group');\n const navPrevClass = usePrefixedClassNames('dateinput-nav-prev');\n const navNextClass = usePrefixedClassNames('dateinput-nav-next');\n const monthLabelClass = usePrefixedClassNames('dateinput-month-label');\n const dayNamesRowClass = usePrefixedClassNames('dateinput-day-names');\n const dayNameClass = usePrefixedClassNames('dateinput-day-name');\n const gridClass = usePrefixedClassNames('dateinput-grid');\n const weekClass = usePrefixedClassNames('dateinput-week');\n const monthsGridClass = usePrefixedClassNames('dateinput-months-grid');\n const monthsRowClass = usePrefixedClassNames('dateinput-months-row');\n const yearsGridClass = usePrefixedClassNames('dateinput-years-grid');\n\n const focusedYear = focusedDate.getFullYear();\n // Today is the reader's, so it's marked only once the page has hydrated: a\n // server render and the render hydrating it mark no day, month or year,\n // and the commit after marks the browser's own. A calendar mounted after\n // hydration marks it from its first render.\n const hydrated = useIsHydrated();\n const today = hydrated ? new Date() : null;\n const todayYear = today?.getFullYear();\n\n // The header steps a month at a time over the day grid and a year at a\n // time over the month grid, kept inside min/max. A step is off once the\n // month or year on show holds the bound or lies past it, as picking a year\n // from the list can leave it.\n const prevAnchor = isDayGranularity\n ? addMonths(focusedDate, -1)\n : clampDate(addYears(focusedDate, -1), min, max);\n const nextAnchor = isDayGranularity\n ? addMonths(focusedDate, 1)\n : clampDate(addYears(focusedDate, 1), min, max);\n const focusedMonth = startOfMonth(focusedDate).getTime();\n const prevDisabled = isDayGranularity\n ? focusedMonth <= startOfMonth(min).getTime()\n : focusedYear <= min.getFullYear();\n const nextDisabled = isDayGranularity\n ? !!max && focusedMonth >= startOfMonth(max).getTime()\n : !!max && focusedYear >= max.getFullYear();\n\n const labelId = id ? `${id}-label` : undefined;\n const monthLabel = isDayGranularity\n ? `${computedMonthNames[focusedDate.getMonth()]} ${focusedYear}`\n : String(focusedYear);\n\n // As the selection surface the year list is where focus moves, so its\n // window stays centred on the year focused at mount: re-centring on every\n // move would reflow the list under the keyboard.\n const [mountYear] = useState(focusedYear);\n const windowYear = isYearGranularity ? mountYear : focusedYear;\n\n const yearList = useMemo<number[]>(() => {\n const minYear = minProp\n ? min.getFullYear()\n : Math.max(FIRST_YEAR, windowYear - 100);\n const maxYear = max ? max.getFullYear() : windowYear + 100;\n const [lo, hi] = yearsRange ?? [minYear, maxYear];\n const start = Math.max(lo, minYear);\n const end = Math.min(hi, maxYear);\n const out: number[] = [];\n for (let y = start; y <= end; y++) out.push(y);\n return out;\n }, [windowYear, minProp, min, max, yearsRange]);\n\n // Only the selection surface disables years; as navigation every listed\n // year can be visited.\n const disabledYears = useMemo(\n () =>\n new Set(\n isYearGranularity ? yearList.filter(y => isYearUnselectable(y)) : []\n ),\n [isYearGranularity, yearList, isYearUnselectable]\n );\n // The year list's one tab stop, after the month grid's: when the focused\n // year is disabled the stop moves to the nearest enabled year in the list,\n // and focusing it makes it the focused year. As the selection surface a\n // year outside a non-empty list starts from the end it fell past, so the\n // list keeps a stop. As navigation it marks the current year, so a year\n // outside the list marks no option, and the stop itself follows focus.\n const tabStopYear = useMemo(() => {\n let i = yearList.indexOf(focusedYear);\n if (i < 0) {\n if (!isYearGranularity || yearList.length === 0) return focusedYear;\n i = focusedYear < yearList[0] ? 0 : yearList.length - 1;\n }\n return yearList[\n nearestEnabled(\n i,\n yearList.map(y => disabledYears.has(y))\n )\n ];\n }, [yearList, focusedYear, disabledYears, isYearGranularity]);\n\n // As navigation the keys move focus and leave the focused year alone, so\n // the tab stop goes to the year that last had focus while it is listed,\n // and Tab leaves the list rather than landing on the current year. It\n // starts over each time the list opens.\n const [navYear, setNavYear] = useState<number | null>(null);\n const listTabStop =\n navYear !== null && yearList.includes(navYear) ? navYear : tabStopYear;\n\n // Which of the focused year's months have no selectable day.\n const disabledMonths = useMemo(\n () =>\n granularity === 'month'\n ? Array.from({ length: 12 }, (_, m) =>\n isMonthUnselectable(makeDate(focusedYear, m))\n )\n : [],\n [granularity, focusedYear, isMonthUnselectable]\n );\n // The month grid's one tab stop. A disabled button can't take focus, so\n // when the focused month is disabled the stop moves to the nearest enabled\n // month, and focusing it makes it the focused month.\n const tabStopMonth = nearestEnabled(focusedDate.getMonth(), disabledMonths);\n\n const handleYearSelect = useCallback(\n (year: number) => {\n const next = new Date(focusedDate);\n next.setFullYear(year);\n // Keep month/day. The month grid also clamps into [min, max] so its\n // focused month is never one the bounds rule out.\n onFocusedDateChange(isDayGranularity ? next : clampDate(next, min, max));\n setView(baseView);\n },\n [focusedDate, onFocusedDateChange, isDayGranularity, min, max, baseView]\n );\n\n // Picking from the year list as the selection surface: focus follows the\n // pick and `onSelect` gets the year's first day.\n const handleYearPick = useCallback(\n (year: number) => {\n onFocusedDateChange(clampDate(makeDate(year), min, max));\n onSelect?.(makeDate(year));\n },\n [min, max, onFocusedDateChange, onSelect]\n );\n\n // Step through the listed years from `year` by `direction`, skipping\n // disabled ones, and focus the first selectable year found.\n const moveYearFocus = useCallback(\n (year: number, direction: 1 | -1) => {\n const first = yearList[0];\n const last = yearList[yearList.length - 1];\n for (let y = year; y >= first && y <= last; y += direction) {\n if (!disabledYears.has(y)) {\n onFocusedDateChange(clampDate(makeDate(y), min, max));\n return;\n }\n }\n },\n [yearList, disabledYears, onFocusedDateChange, min, max]\n );\n\n const handleYearListKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (isPopoverToggleKey(e)) return;\n if (isYearGranularity) {\n const step = yearStep(e.key, focusedYear, yearList);\n if (!step) return;\n e.preventDefault();\n moveYearFocus(step[0], step[1]);\n return;\n }\n // As navigation, Escape returns to the grid the list was opened from.\n // It stops there, so a popover around the calendar stays open and only\n // a second Escape closes it.\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setView(baseView);\n return;\n }\n // The other keys move DOM focus from the year that has it and leave\n // the focused date alone. The list is centred on that date, so moving\n // it would reflow the list under the keyboard, and it would turn the\n // grid behind the list before anything is picked. Enter or Space\n // clicks the year with focus, which picks it.\n const options = Array.from(\n e.currentTarget.querySelectorAll<HTMLElement>('[role=\"option\"]')\n );\n const from = options.indexOf(e.target as HTMLElement);\n if (from < 0) return;\n const step = yearStep(e.key, yearList[from], yearList);\n if (!step) return;\n e.preventDefault();\n // The listed years run one apart, so a year's index is its distance\n // from the first. A step past either end finds no option.\n options[step[0] - yearList[0]]?.focus();\n },\n [isYearGranularity, baseView, focusedYear, yearList, moveYearFocus]\n );\n\n // The day or month grid takes focus as the popover opens on it, or comes\n // back to it from the year list.\n useEffect(() => {\n if (!autoFocusCell) return;\n const grid =\n view === 'days'\n ? gridRef.current\n : view === 'months'\n ? monthGridRef.current\n : null;\n grid?.querySelector<HTMLElement>('[data-focused=\"true\"]')?.focus();\n }, [autoFocusCell, view]);\n\n // From then on focus follows the tab stop only while the grid has it, or\n // has just lost it, so focus on a header button or a time wheel stays put.\n const tabStopDayTime = tabStopDay.getTime();\n useEffect(() => {\n const grid = gridRef.current;\n if (view !== 'days' || !grid) return;\n if (!focusFollows(grid, gridHeldFocusRef.current)) return;\n grid.querySelector<HTMLElement>('[data-focused=\"true\"]')?.focus();\n }, [tabStopDayTime, view]);\n\n useEffect(() => {\n const grid = monthGridRef.current;\n if (view !== 'months' || !grid) return;\n if (!focusFollows(grid, gridHeldFocusRef.current)) return;\n grid.querySelector<HTMLElement>('[data-focused=\"true\"]')?.focus();\n }, [focusedYear, tabStopMonth, view]);\n\n // When the year view opens as navigation, scroll the focused year into\n // view.\n useEffect(() => {\n if (view !== 'years' || isYearGranularity || !yearGridRef.current) return;\n const sel = yearGridRef.current.querySelector<HTMLElement>(\n '[data-focused-year=\"true\"]'\n );\n sel?.scrollIntoView({ block: 'center' });\n sel?.focus();\n }, [view, isYearGranularity]);\n\n // As the selection surface the year list opens with the focused year in\n // its middle. It scrolls the list itself rather than calling\n // `scrollIntoView`, which would also scroll the page to an inline calendar\n // on load, and focuses that year only when the popover asks.\n useEffect(() => {\n const list = yearGridRef.current;\n if (!isYearGranularity || !list) return;\n const target = list.querySelector<HTMLElement>(\n '[data-focused-year=\"true\"]'\n );\n if (!target) return;\n const rect = target.getBoundingClientRect();\n list.scrollTop +=\n rect.top -\n list.getBoundingClientRect().top -\n (list.clientHeight - rect.height) / 2;\n if (autoFocusCell) target.focus({ preventScroll: true });\n }, [isYearGranularity, autoFocusCell]);\n\n // Keyboard moves keep DOM focus on the focused year while the list has it.\n useEffect(() => {\n const list = yearGridRef.current;\n if (!isYearGranularity || !list) return;\n if (!list.contains(getActiveElementInTree(list))) return;\n list.querySelector<HTMLElement>('[data-focused-year=\"true\"]')?.focus();\n }, [isYearGranularity, focusedYear]);\n\n const navArrow = (d: string) => (\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <path\n d={d}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n\n return (\n <div className={classNames(calendarClass, className)} id={id}>\n <div className={headerClass}>\n {isYearGranularity ? (\n // The year list is the only view, so the label opens nothing.\n <span className={monthLabelClass} id={labelId}>\n {monthLabel}\n </span>\n ) : (\n <button\n type=\"button\"\n className={monthTriggerClass}\n aria-haspopup=\"listbox\"\n aria-expanded={view === 'years'}\n disabled={calendarDisabled}\n onClick={() => {\n setNavYear(null);\n setView(v => (v === 'years' ? baseView : 'years'));\n }}\n >\n <span className={monthLabelClass} id={labelId} aria-live=\"polite\">\n {monthLabel}\n </span>\n <svg\n className={monthCaretClass}\n viewBox=\"0 0 12 12\"\n width=\"10\"\n height=\"10\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M2 4l4 4 4-4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n )}\n {!isYearGranularity && (\n <div className={navGroupClass}>\n <button\n type=\"button\"\n className={navPrevClass}\n aria-label={isDayGranularity ? t.prevMonth : t.prevYear}\n disabled={calendarDisabled || prevDisabled || view !== baseView}\n onClick={() => onFocusedDateChange(prevAnchor)}\n >\n {navArrow('M10 3l-5 5 5 5')}\n </button>\n <button\n type=\"button\"\n className={navNextClass}\n aria-label={isDayGranularity ? t.nextMonth : t.nextYear}\n disabled={calendarDisabled || nextDisabled || view !== baseView}\n onClick={() => onFocusedDateChange(nextAnchor)}\n >\n {navArrow('M6 3l5 5-5 5')}\n </button>\n </div>\n )}\n </div>\n\n {view === 'days' && (\n <>\n <div className={dayNamesRowClass} aria-hidden=\"true\">\n {computedDayNames.map((name, i) => (\n <div key={i} className={dayNameClass}>\n {name}\n </div>\n ))}\n </div>\n <div\n ref={gridRef}\n role=\"grid\"\n aria-labelledby={labelId}\n aria-multiselectable={rangeMode || undefined}\n aria-describedby={rangeMode ? rangeSummaryId : undefined}\n aria-disabled={calendarDisabled || undefined}\n aria-readonly={readOnly || undefined}\n className={gridClass}\n onKeyDown={handleKeyDown}\n onMouseLeave={anchor ? () => setHoverDate(null) : undefined}\n {...gridFocusHandlers}\n >\n {inWeeks(\n cells.map(cell => {\n const disabled =\n calendarDisabled || isDateUnselectable(cell.date);\n const time = cell.date.getTime();\n // Range mode. The range on show has its ends filled. Every day\n // of a committed range is selected, and of a preview only the\n // start.\n const isStart = time === timeOf(shownStart);\n const isEnd = time === timeOf(shownEnd);\n const inRange =\n !!shownStart &&\n !!shownEnd &&\n time > shownStart.getTime() &&\n time < shownEnd.getTime();\n // The day a pending range would end on, which isn't picked\n // yet, so its description says what picking it does.\n const isPreviewEnd = previewing && isEnd && !isStart;\n const isPreview = (previewing && inRange) || isPreviewEnd;\n const isFilled = rangeMode\n ? isStart || (isEnd && !previewing)\n : !!value && isSameDay(value, cell.date);\n const isSelected =\n isFilled || (rangeMode && !previewing && inRange);\n const describedBy = rangeMode\n ? [\n isStart && rangeStartId,\n isEnd && !previewing && rangeEndId,\n isPreviewEnd && rangePreviewEndId,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n : undefined;\n const isFocused = isSameDay(cell.date, tabStopDay);\n const isToday = hydrated && cell.isToday;\n const otherMonth = !cell.inCurrentMonth;\n const cellClass = prefixedClassNames(\n classPrefix,\n 'dateinput-cell',\n {\n 'is-selected': isFilled,\n 'is-range-start': isStart,\n 'is-range-end': isEnd,\n 'is-in-range': inRange,\n 'is-preview': isPreview,\n 'is-today': isToday,\n 'is-disabled': disabled,\n 'is-other-month': otherMonth,\n }\n );\n const display = !otherMonth || nearbyMonthDays;\n return (\n <button\n key={cell.date.toISOString()}\n type=\"button\"\n role=\"gridcell\"\n tabIndex={isFocused ? 0 : -1}\n aria-selected={isSelected}\n aria-disabled={disabled}\n aria-current={isToday ? 'date' : undefined}\n aria-describedby={describedBy}\n data-focused={isFocused ? 'true' : undefined}\n disabled={disabled || !display}\n className={cellClass}\n onFocus={() => {\n // Reached by Tab while the focused day is disabled, or\n // by pointer: keys move on from here. A nearby month's\n // day waits for its click, which turns the grid.\n if (!otherMonth && !isSameDay(cell.date, focusedDate)) {\n onFocusedDateChange(cell.date);\n }\n }}\n // Mouseover rather than mouseenter: browsers send it to a\n // disabled day as well, where React holds mouseenter back,\n // so the preview leaves the last enabled day behind.\n onMouseOver={\n anchor ? () => setHoverDate(cell.date) : undefined\n }\n onClick={() => {\n if (disabled) return;\n onFocusedDateChange(cell.date);\n if (rangeMode) pickRangeDay(cell.date);\n else onSelect?.(cell.date);\n }}\n style={!display ? { visibility: 'hidden' } : undefined}\n >\n {cell.date.getDate()}\n </button>\n );\n }),\n weekClass\n )}\n </div>\n </>\n )}\n\n {view === 'months' && (\n <div\n ref={monthGridRef}\n role=\"grid\"\n aria-labelledby={labelId}\n aria-disabled={calendarDisabled || undefined}\n aria-readonly={readOnly || undefined}\n className={monthsGridClass}\n onKeyDown={handleMonthKeyDown}\n {...gridFocusHandlers}\n >\n {MONTH_ROWS.map(row => (\n <div key={row[0]} role=\"row\" className={monthsRowClass}>\n {row.map(month => {\n const date = makeDate(focusedYear, month);\n const disabled = calendarDisabled || disabledMonths[month];\n const isSelected = !!value && isSameMonth(value, date);\n const isFocused = month === tabStopMonth;\n const isCurrent = !!today && isSameMonth(date, today);\n const cellClass = prefixedClassNames(\n classPrefix,\n 'dateinput-month-cell',\n {\n 'is-selected': isSelected,\n 'is-today': isCurrent,\n 'is-disabled': disabled,\n }\n );\n return (\n <button\n key={month}\n type=\"button\"\n role=\"gridcell\"\n tabIndex={isFocused ? 0 : -1}\n aria-selected={isSelected}\n aria-disabled={disabled}\n aria-current={isCurrent ? 'date' : undefined}\n aria-label={computedMonthNames[month]}\n data-focused={isFocused ? 'true' : undefined}\n disabled={disabled}\n className={cellClass}\n onFocus={() => {\n // Reached by Tab while the focused month is disabled,\n // or by pointer: keys move on from here.\n if (month !== focusedDate.getMonth()) {\n onFocusedDateChange(clampDate(date, min, max));\n }\n }}\n onClick={() => {\n onFocusedDateChange(clampDate(date, min, max));\n onSelect?.(date);\n }}\n >\n {monthCellNames[month]}\n </button>\n );\n })}\n </div>\n ))}\n </div>\n )}\n\n {view === 'years' && (\n <div\n ref={yearGridRef}\n className={yearsGridClass}\n role=\"listbox\"\n aria-label={isYearGranularity ? t.chooseYear : monthLabel}\n aria-disabled={calendarDisabled || undefined}\n aria-readonly={(isYearGranularity && readOnly) || undefined}\n onKeyDown={handleYearListKeyDown}\n >\n {yearList.map(year => {\n const isFocused = year === tabStopYear;\n const isToday = year === todayYear;\n // As navigation the focused year is the current one. As the\n // selection surface the value's year is selected and focus roams.\n const isSelected = isYearGranularity\n ? !!value && value.getFullYear() === year\n : isFocused;\n const disabled = calendarDisabled || disabledYears.has(year);\n const cellCls = prefixedClassNames(\n classPrefix,\n 'dateinput-year-cell',\n {\n 'is-selected': isSelected,\n 'is-today': isToday,\n 'is-disabled': disabled,\n }\n );\n return (\n <button\n key={year}\n type=\"button\"\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={isYearGranularity ? disabled : undefined}\n aria-current={isYearGranularity && isToday ? 'date' : undefined}\n data-focused-year={isFocused ? 'true' : undefined}\n tabIndex={year === listTabStop ? 0 : -1}\n disabled={disabled}\n className={cellCls}\n onFocus={() => {\n // As navigation, focusing a year by key or pointer only\n // moves the tab stop: nothing is committed until a year is\n // picked. As the selection surface it is reached by Tab\n // while the focused year is disabled, or by pointer, and\n // keys move on from here.\n if (!isYearGranularity) {\n setNavYear(year);\n } else if (year !== focusedYear) {\n onFocusedDateChange(clampDate(makeDate(year), min, max));\n }\n }}\n onClick={() =>\n isYearGranularity\n ? handleYearPick(year)\n : handleYearSelect(year)\n }\n >\n {year}\n </button>\n );\n })}\n </div>\n )}\n\n {rangeMode && (\n // The words the day cells and the grid point at. The live region\n // stays mounted while the year list is open, so it is in the page\n // already when a pick changes what it says.\n <>\n <span id={rangeStartId} hidden>\n {t.rangeStart}\n </span>\n <span id={rangeEndId} hidden>\n {t.rangeEnd}\n </span>\n <span id={rangePreviewEndId} hidden>\n {t.rangePreviewEnd}\n </span>\n <div id={rangeSummaryId} aria-live=\"polite\" style={visuallyHidden}>\n {rangeSummary}\n </div>\n </>\n )}\n </div>\n );\n};\n\nCalendar.displayName = 'Calendar';\n\nexport default Calendar;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;AAqJA;;;;AAIG;AACI,MAAM,qBAAqB,GAChC;AAIF,MAAM,SAAS,GAA0C;AACvD,IAAA,GAAG,EAAE,MAAM;AACX,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,IAAI,EAAE,OAAO;CACd;AAED;AACA,MAAM,UAAU,GAAG;AACjB,IAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACT,IAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACT,IAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACT,IAAA,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;CACZ;AACD,MAAM,cAAc,GAAG,CAAC;AACxB;AACA,MAAM,aAAa,GAAG,CAAC;AAEvB;;;;;;AAMG;AACH,SAAS,SAAS,CAAC,GAAW,EAAE,GAAW,EAAA;IACzC,QAAQ,GAAG;AACT,QAAA,KAAK,WAAW;AACd,YAAA,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;AACjB,QAAA,KAAK,YAAY;AACf,YAAA,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACf,QAAA,KAAK,SAAS;AACZ,YAAA,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC;AAC9B,QAAA,KAAK,WAAW;AACd,YAAA,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAC5B,QAAA,KAAK,QAAQ;AACX,YAAA,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;AAClB,QAAA,KAAK,UAAU;AACb,YAAA,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AA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