@allxsmith/bestax-bulma 5.56.0 → 5.57.1
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/README.md +2 -2
- package/dist/esm/columns/Column.js +1 -0
- package/dist/esm/columns/Column.js.map +1 -1
- package/dist/esm/columns/Columns.js +1 -0
- package/dist/esm/columns/Columns.js.map +1 -1
- package/dist/esm/components/Avatar.js +1 -0
- package/dist/esm/components/Avatar.js.map +1 -1
- package/dist/esm/components/Avatars.js +1 -0
- package/dist/esm/components/Avatars.js.map +1 -1
- package/dist/esm/components/Badge.js +1 -0
- package/dist/esm/components/Badge.js.map +1 -1
- package/dist/esm/components/Breadcrumb.js +1 -0
- package/dist/esm/components/Breadcrumb.js.map +1 -1
- package/dist/esm/components/Card.js +1 -0
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/Carousel.js +1 -0
- package/dist/esm/components/Carousel.js.map +1 -1
- package/dist/esm/components/Collapse.js +1 -0
- package/dist/esm/components/Collapse.js.map +1 -1
- package/dist/esm/components/Collapses.js +1 -0
- package/dist/esm/components/Collapses.js.map +1 -1
- package/dist/esm/components/Command.js +1 -0
- package/dist/esm/components/Command.js.map +1 -1
- package/dist/esm/components/ContextMenu.js +1 -0
- package/dist/esm/components/ContextMenu.js.map +1 -1
- package/dist/esm/components/DataTable.js +1 -0
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/Dialog.js +1 -0
- package/dist/esm/components/Dialog.js.map +1 -1
- package/dist/esm/components/Dropdown.js +5 -1
- package/dist/esm/components/Dropdown.js.map +1 -1
- package/dist/esm/components/EmptyState.js +1 -0
- package/dist/esm/components/EmptyState.js.map +1 -1
- package/dist/esm/components/HoverCard.js +1 -0
- package/dist/esm/components/HoverCard.js.map +1 -1
- package/dist/esm/components/Loading.js +1 -0
- package/dist/esm/components/Loading.js.map +1 -1
- package/dist/esm/components/Menu.js +1 -0
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Message.js +1 -0
- package/dist/esm/components/Message.js.map +1 -1
- package/dist/esm/components/Modal.js +1 -0
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Navbar.js +1 -0
- package/dist/esm/components/Navbar.js.map +1 -1
- package/dist/esm/components/Pagination.js +1 -0
- package/dist/esm/components/Pagination.js.map +1 -1
- package/dist/esm/components/Panel.js +1 -0
- package/dist/esm/components/Panel.js.map +1 -1
- package/dist/esm/components/Popover.js +1 -0
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/Reveal.js +1 -0
- package/dist/esm/components/Reveal.js.map +1 -1
- package/dist/esm/components/ScrollArea.js +1 -0
- package/dist/esm/components/ScrollArea.js.map +1 -1
- package/dist/esm/components/SegmentedControl.js +1 -0
- package/dist/esm/components/SegmentedControl.js.map +1 -1
- package/dist/esm/components/Sidebar.js +1 -0
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/components/Steps.js +1 -0
- package/dist/esm/components/Steps.js.map +1 -1
- package/dist/esm/components/Tabs.js +1 -0
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/components/Timeline.js +1 -0
- package/dist/esm/components/Timeline.js.map +1 -1
- package/dist/esm/components/Toast.js +1 -0
- package/dist/esm/components/Toast.js.map +1 -1
- package/dist/esm/components/Tooltip.js +1 -0
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/TreeView.js +1 -0
- package/dist/esm/components/TreeView.js.map +1 -1
- package/dist/esm/components/collapsesContext.js +1 -0
- package/dist/esm/components/collapsesContext.js.map +1 -1
- package/dist/esm/components/useDataTable.js +1 -0
- package/dist/esm/components/useDataTable.js.map +1 -1
- package/dist/esm/elements/Block.js +1 -0
- package/dist/esm/elements/Block.js.map +1 -1
- package/dist/esm/elements/Box.js +1 -0
- package/dist/esm/elements/Box.js.map +1 -1
- package/dist/esm/elements/Button.js +1 -0
- package/dist/esm/elements/Button.js.map +1 -1
- package/dist/esm/elements/Buttons.js +1 -0
- package/dist/esm/elements/Buttons.js.map +1 -1
- package/dist/esm/elements/Code.js +1 -0
- package/dist/esm/elements/Code.js.map +1 -1
- package/dist/esm/elements/ColorSwatch.js +1 -0
- package/dist/esm/elements/ColorSwatch.js.map +1 -1
- package/dist/esm/elements/Content.js +1 -0
- package/dist/esm/elements/Content.js.map +1 -1
- package/dist/esm/elements/Delete.js +1 -0
- package/dist/esm/elements/Delete.js.map +1 -1
- package/dist/esm/elements/DescriptionList.js +1 -0
- package/dist/esm/elements/DescriptionList.js.map +1 -1
- package/dist/esm/elements/Divider.js +1 -0
- package/dist/esm/elements/Divider.js.map +1 -1
- package/dist/esm/elements/Emphasis.js +1 -0
- package/dist/esm/elements/Emphasis.js.map +1 -1
- package/dist/esm/elements/Figure.js +1 -0
- package/dist/esm/elements/Figure.js.map +1 -1
- package/dist/esm/elements/Icon.js +1 -0
- package/dist/esm/elements/Icon.js.map +1 -1
- package/dist/esm/elements/IconText.js +1 -0
- package/dist/esm/elements/IconText.js.map +1 -1
- package/dist/esm/elements/Image.js +1 -0
- package/dist/esm/elements/Image.js.map +1 -1
- package/dist/esm/elements/Kbd.js +1 -0
- package/dist/esm/elements/Kbd.js.map +1 -1
- package/dist/esm/elements/Link.js +1 -0
- package/dist/esm/elements/Link.js.map +1 -1
- package/dist/esm/elements/LinkButton.js +1 -0
- package/dist/esm/elements/LinkButton.js.map +1 -1
- package/dist/esm/elements/ListItem.js +1 -0
- package/dist/esm/elements/ListItem.js.map +1 -1
- package/dist/esm/elements/Loader.js +1 -0
- package/dist/esm/elements/Loader.js.map +1 -1
- package/dist/esm/elements/Notification.js +1 -0
- package/dist/esm/elements/Notification.js.map +1 -1
- package/dist/esm/elements/OrderedList.js +1 -0
- package/dist/esm/elements/OrderedList.js.map +1 -1
- package/dist/esm/elements/Paragraph.js +1 -0
- package/dist/esm/elements/Paragraph.js.map +1 -1
- package/dist/esm/elements/Pre.js +1 -0
- package/dist/esm/elements/Pre.js.map +1 -1
- package/dist/esm/elements/Progress.js +1 -0
- package/dist/esm/elements/Progress.js.map +1 -1
- package/dist/esm/elements/RingProgress.js +1 -0
- package/dist/esm/elements/RingProgress.js.map +1 -1
- package/dist/esm/elements/Skeleton.js +1 -0
- package/dist/esm/elements/Skeleton.js.map +1 -1
- package/dist/esm/elements/Span.js +1 -0
- package/dist/esm/elements/Span.js.map +1 -1
- package/dist/esm/elements/Strong.js +1 -0
- package/dist/esm/elements/Strong.js.map +1 -1
- package/dist/esm/elements/SubTitle.js +1 -0
- package/dist/esm/elements/SubTitle.js.map +1 -1
- package/dist/esm/elements/Table.js +1 -0
- package/dist/esm/elements/Table.js.map +1 -1
- package/dist/esm/elements/Tag.js +1 -0
- package/dist/esm/elements/Tag.js.map +1 -1
- package/dist/esm/elements/Tags.js +1 -0
- package/dist/esm/elements/Tags.js.map +1 -1
- package/dist/esm/elements/Tbody.js +1 -0
- package/dist/esm/elements/Tbody.js.map +1 -1
- package/dist/esm/elements/Td.js +1 -0
- package/dist/esm/elements/Td.js.map +1 -1
- package/dist/esm/elements/Tfoot.js +1 -0
- package/dist/esm/elements/Tfoot.js.map +1 -1
- package/dist/esm/elements/Th.js +1 -0
- package/dist/esm/elements/Th.js.map +1 -1
- package/dist/esm/elements/Thead.js +1 -0
- package/dist/esm/elements/Thead.js.map +1 -1
- package/dist/esm/elements/Title.js +1 -0
- package/dist/esm/elements/Title.js.map +1 -1
- package/dist/esm/elements/ToggleButton.js +1 -0
- package/dist/esm/elements/ToggleButton.js.map +1 -1
- package/dist/esm/elements/Tr.js +1 -0
- package/dist/esm/elements/Tr.js.map +1 -1
- package/dist/esm/elements/UnorderedList.js +1 -0
- package/dist/esm/elements/UnorderedList.js.map +1 -1
- package/dist/esm/elements/iconProps.js +1 -0
- package/dist/esm/elements/iconProps.js.map +1 -1
- package/dist/esm/form/Autocomplete.js +1 -0
- package/dist/esm/form/Autocomplete.js.map +1 -1
- package/dist/esm/form/Checkbox.js +1 -0
- package/dist/esm/form/Checkbox.js.map +1 -1
- package/dist/esm/form/CheckboxCard.js +1 -0
- package/dist/esm/form/CheckboxCard.js.map +1 -1
- package/dist/esm/form/Checkboxes.js +1 -0
- package/dist/esm/form/Checkboxes.js.map +1 -1
- package/dist/esm/form/ColorInput.js +1 -0
- package/dist/esm/form/ColorInput.js.map +1 -1
- package/dist/esm/form/ColorInputBase.js +1 -0
- package/dist/esm/form/ColorInputBase.js.map +1 -1
- package/dist/esm/form/ColorPicker.js +1 -0
- package/dist/esm/form/ColorPicker.js.map +1 -1
- package/dist/esm/form/Combobox.js +1 -0
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/Control.js +1 -0
- package/dist/esm/form/Control.js.map +1 -1
- package/dist/esm/form/DateInput.js +1 -0
- package/dist/esm/form/DateInput.js.map +1 -1
- package/dist/esm/form/DateInputBase.js +1 -0
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInput.js +1 -0
- package/dist/esm/form/DateRangeInput.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js +1 -0
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInput.js +1 -0
- package/dist/esm/form/DateTimeInput.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +1 -0
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Dropzone.js +1 -0
- package/dist/esm/form/Dropzone.js.map +1 -1
- package/dist/esm/form/Field.js +1 -0
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/Fieldset.js +1 -0
- package/dist/esm/form/Fieldset.js.map +1 -1
- package/dist/esm/form/File.js +1 -0
- package/dist/esm/form/File.js.map +1 -1
- package/dist/esm/form/FormContext.js +1 -0
- package/dist/esm/form/FormContext.js.map +1 -1
- package/dist/esm/form/Input.js +1 -0
- package/dist/esm/form/Input.js.map +1 -1
- package/dist/esm/form/InputBase.js +1 -0
- package/dist/esm/form/InputBase.js.map +1 -1
- package/dist/esm/form/Numberinput.js +1 -0
- package/dist/esm/form/Numberinput.js.map +1 -1
- package/dist/esm/form/PinInput.js +1 -0
- package/dist/esm/form/PinInput.js.map +1 -1
- package/dist/esm/form/Radio.js +1 -0
- package/dist/esm/form/Radio.js.map +1 -1
- package/dist/esm/form/RadioCard.js +1 -0
- package/dist/esm/form/RadioCard.js.map +1 -1
- package/dist/esm/form/Radios.js +1 -0
- package/dist/esm/form/Radios.js.map +1 -1
- package/dist/esm/form/Rate.js +1 -0
- package/dist/esm/form/Rate.js.map +1 -1
- package/dist/esm/form/Select.js +1 -0
- package/dist/esm/form/Select.js.map +1 -1
- package/dist/esm/form/SelectBase.js +1 -0
- package/dist/esm/form/SelectBase.js.map +1 -1
- package/dist/esm/form/Slider.js +1 -0
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/Switch.js +1 -0
- package/dist/esm/form/Switch.js.map +1 -1
- package/dist/esm/form/Taginput.js +1 -0
- package/dist/esm/form/Taginput.js.map +1 -1
- package/dist/esm/form/TextArea.js +1 -0
- package/dist/esm/form/TextArea.js.map +1 -1
- package/dist/esm/form/TextAreaBase.js +1 -0
- package/dist/esm/form/TextAreaBase.js.map +1 -1
- package/dist/esm/form/TimeInput.js +1 -0
- package/dist/esm/form/TimeInput.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +1 -0
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/_colorInternals/EyeDropperButton.js +1 -0
- package/dist/esm/form/_colorInternals/EyeDropperButton.js.map +1 -1
- package/dist/esm/form/_colorInternals/pickerState.js +1 -0
- package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +1 -0
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +1 -0
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/form/_pickerInternals/TimeWheels.js +1 -0
- package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +1 -0
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +1 -0
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +1 -0
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -1
- package/dist/esm/form/controlLoading.js +1 -0
- package/dist/esm/form/controlLoading.js.map +1 -1
- package/dist/esm/form/groupFieldset.js +1 -0
- package/dist/esm/form/groupFieldset.js.map +1 -1
- package/dist/esm/form/useAutoLabelId.js +1 -0
- package/dist/esm/form/useAutoLabelId.js.map +1 -1
- package/dist/esm/grid/Cell.js +1 -0
- package/dist/esm/grid/Cell.js.map +1 -1
- package/dist/esm/grid/Grid.js +1 -0
- package/dist/esm/grid/Grid.js.map +1 -1
- package/dist/esm/helpers/ClientOnly.js +1 -0
- package/dist/esm/helpers/ClientOnly.js.map +1 -1
- package/dist/esm/helpers/Config.js +1 -0
- package/dist/esm/helpers/Config.js.map +1 -1
- package/dist/esm/helpers/LocaleProvider.js +1 -0
- package/dist/esm/helpers/LocaleProvider.js.map +1 -1
- package/dist/esm/helpers/Theme.js +1 -0
- package/dist/esm/helpers/Theme.js.map +1 -1
- package/dist/esm/helpers/flattenChildren.js +1 -0
- package/dist/esm/helpers/flattenChildren.js.map +1 -1
- package/dist/esm/helpers/inertProps.js +1 -0
- package/dist/esm/helpers/inertProps.js.map +1 -1
- package/dist/esm/helpers/localeFormat.js +1 -0
- package/dist/esm/helpers/localeFormat.js.map +1 -1
- package/dist/esm/helpers/overlayStack.js +1 -0
- package/dist/esm/helpers/overlayStack.js.map +1 -1
- package/dist/esm/helpers/portal.js +1 -0
- package/dist/esm/helpers/portal.js.map +1 -1
- package/dist/esm/helpers/scrollLock.js +1 -0
- package/dist/esm/helpers/scrollLock.js.map +1 -1
- package/dist/esm/helpers/statusRegion.js +1 -0
- package/dist/esm/helpers/statusRegion.js.map +1 -1
- package/dist/esm/helpers/typeahead.js +1 -0
- package/dist/esm/helpers/typeahead.js.map +1 -1
- package/dist/esm/helpers/useAnchoredPosition.js +1 -0
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
- package/dist/esm/helpers/useBulmaClasses.js +1 -0
- package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
- package/dist/esm/helpers/useClientLayoutEffect.js +1 -0
- package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -1
- package/dist/esm/helpers/useColorClasses.js +1 -0
- package/dist/esm/helpers/useColorClasses.js.map +1 -1
- package/dist/esm/helpers/useComboboxEngine.js +1 -0
- package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
- package/dist/esm/helpers/useContextMenuTrigger.js +1 -0
- package/dist/esm/helpers/useContextMenuTrigger.js.map +1 -1
- package/dist/esm/helpers/useFlexboxClasses.js +1 -0
- package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
- package/dist/esm/helpers/useFocusTrap.js +1 -0
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/esm/helpers/useHoverOpen.js +1 -0
- package/dist/esm/helpers/useHoverOpen.js.map +1 -1
- package/dist/esm/helpers/useInertSiblings.js +1 -0
- package/dist/esm/helpers/useInertSiblings.js.map +1 -1
- package/dist/esm/helpers/useIsHydrated.js +1 -0
- package/dist/esm/helpers/useIsHydrated.js.map +1 -1
- package/dist/esm/helpers/useLatestRef.js +1 -0
- package/dist/esm/helpers/useLatestRef.js.map +1 -1
- package/dist/esm/helpers/useMenuKeys.js +1 -0
- package/dist/esm/helpers/useMenuKeys.js.map +1 -1
- package/dist/esm/helpers/useOtherClasses.js +1 -0
- package/dist/esm/helpers/useOtherClasses.js.map +1 -1
- package/dist/esm/helpers/useSpacingClasses.js +1 -0
- package/dist/esm/helpers/useSpacingClasses.js.map +1 -1
- package/dist/esm/helpers/useTreeView.js +1 -0
- package/dist/esm/helpers/useTreeView.js.map +1 -1
- package/dist/esm/helpers/useTypographyClasses.js +1 -0
- package/dist/esm/helpers/useTypographyClasses.js.map +1 -1
- package/dist/esm/helpers/useVisibilityClasses.js +1 -0
- package/dist/esm/helpers/useVisibilityClasses.js.map +1 -1
- package/dist/esm/layout/Container.js +1 -0
- package/dist/esm/layout/Container.js.map +1 -1
- package/dist/esm/layout/Footer.js +1 -0
- package/dist/esm/layout/Footer.js.map +1 -1
- package/dist/esm/layout/Hero.js +1 -0
- package/dist/esm/layout/Hero.js.map +1 -1
- package/dist/esm/layout/Level.js +1 -0
- package/dist/esm/layout/Level.js.map +1 -1
- package/dist/esm/layout/Media.js +1 -0
- package/dist/esm/layout/Media.js.map +1 -1
- package/dist/esm/layout/Section.js +1 -0
- package/dist/esm/layout/Section.js.map +1 -1
- package/dist/esm/layout/Splitter.js +1 -0
- package/dist/esm/layout/Splitter.js.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/package.json +28 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EyeDropperButton.js","sources":["../../../../src/form/_colorInternals/EyeDropperButton.tsx"],"sourcesContent":["// INTERNAL: deliberately not exported from src/index.ts. The eye dropper\n// button, shared by ColorPicker.Input and the panel ColorInput opens.\n\nimport { useContext } from 'react';\nimport { classNames, usePrefixedClassNames } from '../../helpers/classNames';\nimport { useIsHydrated } from '../../helpers/useIsHydrated';\nimport { parseColor } from './colorMath';\nimport {\n ColorPickerContext,\n ColorPickerContextValue,\n keepingChannels,\n noop,\n} from './pickerState';\n\n/** The browser's eye dropper, where it has one. */\ninterface EyeDropperLike {\n open: () => Promise<{ sRGBHex: string }>;\n}\ntype EyeDropperConstructor = new () => EyeDropperLike;\n\n/** A pipette. */\nconst EyeDropperIcon = () => (\n <svg viewBox=\"0 0 16 16\" width=\"1em\" height=\"1em\" aria-hidden=\"true\">\n <path\n d=\"M10.5 2.5l3 3M9 4l3 3-6.5 6.5H3v-3z\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\n/**\n * A button that picks a color from anywhere on the screen, for the picker\n * around it. It renders only once the page has hydrated, where the browser\n * has the EyeDropper API, and inside a picker that asked for it.\n */\nexport function EyeDropperButton({ className }: { className?: string }) {\n // Rendered only inside a picker's provider.\n const picker = useContext(ColorPickerContext) as ColorPickerContextValue;\n const buttonClass = usePrefixedClassNames('button', { 'is-small': true });\n const hydrated = useIsHydrated();\n const Dropper = hydrated\n ? (window as unknown as { EyeDropper?: EyeDropperConstructor }).EyeDropper\n : undefined;\n if (!picker.eyeDropper || !Dropper) return null;\n const { color, change, disabled, labels } = picker;\n\n // Escape, or a click away, cancels it, which rejects.\n const pickFromScreen = () =>\n new Dropper().open().then(({ sRGBHex }) => {\n const parsed = parseColor(sRGBHex);\n // The screen gives a solid color as hex; the alpha stays as it was,\n // and a gray keeps the hue the picker had.\n if (parsed) {\n change(\n keepingChannels({ ...parsed, a: color.a }, color, sRGBHex),\n true\n );\n }\n }, noop);\n\n return (\n <button\n type=\"button\"\n className={classNames(buttonClass, className)}\n aria-label={labels.eyeDropper}\n title={labels.eyeDropper}\n disabled={disabled}\n onClick={pickFromScreen}\n >\n <EyeDropperIcon />\n </button>\n );\n}\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EyeDropperButton.js","sources":["../../../../src/form/_colorInternals/EyeDropperButton.tsx"],"sourcesContent":["// INTERNAL: deliberately not exported from src/index.ts. The eye dropper\n// button, shared by ColorPicker.Input and the panel ColorInput opens.\n\nimport { useContext } from 'react';\nimport { classNames, usePrefixedClassNames } from '../../helpers/classNames';\nimport { useIsHydrated } from '../../helpers/useIsHydrated';\nimport { parseColor } from './colorMath';\nimport {\n ColorPickerContext,\n ColorPickerContextValue,\n keepingChannels,\n noop,\n} from './pickerState';\n\n/** The browser's eye dropper, where it has one. */\ninterface EyeDropperLike {\n open: () => Promise<{ sRGBHex: string }>;\n}\ntype EyeDropperConstructor = new () => EyeDropperLike;\n\n/** A pipette. */\nconst EyeDropperIcon = () => (\n <svg viewBox=\"0 0 16 16\" width=\"1em\" height=\"1em\" aria-hidden=\"true\">\n <path\n d=\"M10.5 2.5l3 3M9 4l3 3-6.5 6.5H3v-3z\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\n/**\n * A button that picks a color from anywhere on the screen, for the picker\n * around it. It renders only once the page has hydrated, where the browser\n * has the EyeDropper API, and inside a picker that asked for it.\n */\nexport function EyeDropperButton({ className }: { className?: string }) {\n // Rendered only inside a picker's provider.\n const picker = useContext(ColorPickerContext) as ColorPickerContextValue;\n const buttonClass = usePrefixedClassNames('button', { 'is-small': true });\n const hydrated = useIsHydrated();\n const Dropper = hydrated\n ? (window as unknown as { EyeDropper?: EyeDropperConstructor }).EyeDropper\n : undefined;\n if (!picker.eyeDropper || !Dropper) return null;\n const { color, change, disabled, labels } = picker;\n\n // Escape, or a click away, cancels it, which rejects.\n const pickFromScreen = () =>\n new Dropper().open().then(({ sRGBHex }) => {\n const parsed = parseColor(sRGBHex);\n // The screen gives a solid color as hex; the alpha stays as it was,\n // and a gray keeps the hue the picker had.\n if (parsed) {\n change(\n keepingChannels({ ...parsed, a: color.a }, color, sRGBHex),\n true\n );\n }\n }, noop);\n\n return (\n <button\n type=\"button\"\n className={classNames(buttonClass, className)}\n aria-label={labels.eyeDropper}\n title={labels.eyeDropper}\n disabled={disabled}\n onClick={pickFromScreen}\n >\n <EyeDropperIcon />\n </button>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;AAoBA;AACA,MAAM,cAAc,GAAG,OACrBA,GAAA,CAAA,KAAA,EAAA,EAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAA,aAAA,EAAa,MAAM,EAAA,QAAA,EAClE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AQ,EAAE,QAAQ,EAClB,OAAO,EAAE,cAAc,EAAA,QAAA,EAEvBA,GAAA,CAAC,cAAc,EAAA,EAAA,CAAG,EAAA,CACX;AAEb;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
'use client';
|
|
2
3
|
import { createContext, useContext, useEffect, useState, useRef, useCallback } from 'react';
|
|
3
4
|
import { useNumberFormat } from '../../helpers/localeFormat.js';
|
|
4
5
|
import { useClientLayoutEffect } from '../../helpers/useClientLayoutEffect.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickerState.js","sources":["../../../../src/form/_colorInternals/pickerState.ts"],"sourcesContent":["// INTERNAL: deliberately not exported from src/index.ts. The color a picker\n// holds and the context its parts read, shared by ColorPicker and the panel\n// ColorInput opens, so the panel needs no Field or Control of its own.\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useNumberFormat, NumberFormatter } from '../../helpers/localeFormat';\nimport { useClientLayoutEffect } from '../../helpers/useClientLayoutEffect';\nimport { warnOnce } from '../../helpers/devWarnings';\nimport { useNativeMobilePicker } from '../_pickerInternals/useNativeMobilePicker';\nimport {\n ColorFormat,\n Hsva,\n formatColor,\n namesHue,\n parseColor,\n} from './colorMath';\nimport type { ColorPickerLabels, ColorPickerSwatch } from '../ColorPicker';\n\nconst DEFAULT_LABELS: Required<ColorPickerLabels> = {\n area: 'Saturation and brightness',\n areaRoleDescription: '2D slider',\n saturation: 'Saturation',\n brightness: 'Brightness',\n hue: 'Hue',\n alpha: 'Alpha',\n degrees: 'degrees',\n value: 'Color value',\n swatches: 'Swatches',\n eyeDropper: 'Pick a color from the screen',\n chooseColor: 'Choose color',\n};\n\n/** The labels with each one left out, or empty, at its default. */\nexport const mergeColorLabels = (\n labels: ColorPickerLabels | undefined\n): Required<ColorPickerLabels> => {\n const merged = { ...DEFAULT_LABELS };\n for (const [key, value] of Object.entries(labels ?? {})) {\n if (value) merged[key as keyof ColorPickerLabels] = value;\n }\n return merged;\n};\n\nexport const BLACK: Hsva = { h: 0, s: 0, v: 0, a: 1 };\n\n/**\n * A color read from outside the picker, written as `source`, with the hue\n * and saturation the picker had where the new color has none, so the thumbs\n * don't jump to 0. A gray written as hex, `rgb()` or a name has no hue, so\n * it keeps the picker's; one written as `hsl()` names its hue, which wins.\n * Black has no saturation in the square either way, and keeps the picker's,\n * which writes no differently.\n */\nexport const keepingChannels = (\n next: Hsva,\n previous: Hsva,\n source: string\n): Hsva => ({\n ...next,\n h: (next.s === 0 || next.v === 0) && !namesHue(source) ? previous.h : next.h,\n s: next.v === 0 ? previous.s : next.s,\n});\n\n/** What a picker's parts read from the picker around them. */\nexport interface ColorPickerContextValue {\n /** The color shown, alpha at 1 unless the picker takes alpha. */\n color: Hsva;\n /** The color written in the picker's format. */\n text: string;\n format: ColorFormat;\n alpha: boolean;\n disabled: boolean;\n labels: Required<ColorPickerLabels>;\n swatches: ColorPickerSwatch[] | 'bulma' | undefined;\n eyeDropper: boolean;\n /** Whether a touch screen reader is likely, so both square inputs show. */\n touch: boolean;\n /** Writes a percentage, in the locale of a LocaleProvider when there is one. */\n percent: (value: number) => string;\n /** Writes a hue in degrees, in the locale of a LocaleProvider when there is one. */\n degrees: (value: number) => string;\n /** Sets the color: `onChange`, and `onChangeEnd` too when `end` is set. */\n change: (next: Hsva, end?: boolean) => void;\n /** Ends a drag: `onChangeEnd` with the latest value. */\n end: () => void;\n}\n\nexport const ColorPickerContext = createContext<ColorPickerContextValue | null>(\n null\n);\n\n/** Does nothing, for a part outside a picker and a cancelled eye dropper. */\nexport const noop = () => {};\n\n// What a part outside a ColorPicker reads, so its hooks run the same; it\n// then renders nothing.\nexport const standalone: ColorPickerContextValue = {\n color: BLACK,\n text: '',\n format: 'hsl',\n alpha: false,\n disabled: true,\n labels: DEFAULT_LABELS,\n swatches: undefined,\n eyeDropper: false,\n touch: false,\n percent: String,\n degrees: String,\n change: noop,\n end: noop,\n};\n\n/** The picker around a part, or null with a development warning. */\nexport function usePicker(part: string): ColorPickerContextValue | null {\n const picker = useContext(ColorPickerContext);\n const outside = !picker;\n useEffect(() => {\n if (outside) {\n warnOnce(\n `ColorPicker:${part}:outside`,\n `[bestax-bulma] <ColorPicker.${part}> needs a <ColorPicker> around ` +\n 'it, which holds the color, and renders nothing without one.'\n );\n }\n }, [outside, part]);\n return picker;\n}\n\n/** A percentage, in the provider's locale when there is one. */\nconst writePercent =\n (formatNumber: NumberFormatter | null) => (value: number) =>\n formatNumber\n ? formatNumber(value / 100, { style: 'percent' })\n : `${value}%`;\n\n/** Degrees, in the provider's locale when there is one, else with `unit`. */\nconst writeDegrees =\n (formatNumber: NumberFormatter | null, unit: string) => (value: number) =>\n formatNumber\n ? formatNumber(value, {\n style: 'unit',\n unit: 'degree',\n unitDisplay: 'long',\n })\n : `${value} ${unit}`;\n\n/** What a picker is given: ColorPicker's props, or the ones ColorInput passes on. */\nexport interface PickerOptions {\n value: string | undefined;\n defaultValue: string | undefined;\n onChange: ((value: string) => void) | undefined;\n onChangeEnd: ((value: string) => void) | undefined;\n format: ColorFormat;\n alpha: boolean;\n disabled: boolean;\n swatches: ColorPickerSwatch[] | 'bulma' | undefined;\n eyeDropper: boolean;\n labels: ColorPickerLabels | undefined;\n /**\n * Whether the field the picker serves is empty, as ColorInput's can be.\n * The picker still shows a color then, and any change, even to that same\n * color, is reported, so it fills the field.\n */\n empty?: boolean;\n}\n\n/**\n * Holds a picker's color and builds what its parts read. Controlled, the\n * color shown follows `value`; a value the picker handed out comes back as\n * the exact color it was, thumbs and all.\n */\nexport function useColorPicker({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n format,\n alpha,\n disabled,\n swatches,\n eyeDropper,\n labels,\n empty = false,\n}: PickerOptions): ColorPickerContextValue {\n const isControlled = value !== undefined;\n // The color the picker last set or started with, and its text. While\n // `value` is that text, this is the color shown.\n const [own, setOwn] = useState(() => {\n const start = isControlled ? value : defaultValue;\n return { text: start ?? '', color: parseColor(start) ?? BLACK };\n });\n // A controlled value from outside becomes the color held, during this\n // render, keeping the hue and saturation a gray or black has none of.\n // One the picker can't read changes nothing, so the last good color\n // stays on screen.\n if (isControlled && value !== own.text) {\n const parsed = parseColor(value);\n if (parsed) {\n setOwn({\n text: value,\n color: keepingChannels(parsed, own.color, value),\n });\n }\n }\n const color = alpha ? own.color : { ...own.color, a: 1 };\n const text = formatColor(color, format, alpha);\n\n // The latest text handed out, so a step that writes the same text\n // doesn't call onChange again, and a drag's end reports the last one.\n const lastTextRef = useRef(text);\n useClientLayoutEffect(() => {\n lastTextRef.current = text;\n });\n\n const change = useCallback(\n (next: Hsva, finished = false) => {\n if (disabled) return;\n const solid = alpha ? next : { ...next, a: 1 };\n const nextText = formatColor(solid, format, alpha);\n setOwn({ text: nextText, color: solid });\n if (empty || nextText !== lastTextRef.current) {\n lastTextRef.current = nextText;\n onChange?.(nextText);\n }\n if (finished) onChangeEnd?.(nextText);\n },\n [disabled, alpha, format, onChange, onChangeEnd, empty]\n );\n const end = useCallback(\n () => onChangeEnd?.(lastTextRef.current),\n [onChangeEnd]\n );\n\n const formatNumber = useNumberFormat();\n const { isCoarsePointer } = useNativeMobilePicker();\n const merged = mergeColorLabels(labels);\n return {\n color,\n text,\n format,\n alpha,\n disabled,\n labels: merged,\n swatches,\n eyeDropper,\n touch: isCoarsePointer,\n percent: writePercent(formatNumber),\n degrees: writeDegrees(formatNumber, merged.degrees),\n change,\n end,\n };\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACA;AAuBA,MAAM,cAAc,GAAgC;AAClD,IAAA,IAAI,EAAE,2BAA2B;AACjC,IAAA,mBAAmB,EAAE,WAAW;AAChC,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,KAAK,EAAE,OAAO;AAC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,CAAC,EAAE;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;QAClD,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACxC,IAAI,KAAK,IAAI,QAAQ,KAAK,WAAW,CAAC,OAAO,EAAE;AAC7C,YAAA,WAAW,CAAC,OAAO,GAAG,QAAQ;AAC9B,YAAA,QAAQ,GAAG,QAAQ,CAAC;QACtB;AACA,QAAA,IAAI,QAAQ;AAAE,YAAA,WAAW,GAAG,QAAQ,CAAC;AACvC,IAAA,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,CACxD;AACD,IAAA,MAAM,GAAG,GAAG,WAAW,CACrB,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,EACxC,CAAC,WAAW,CAAC,CACd;AAED,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;AACtC,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAE;AACnD,IAAA,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACvC,OAAO;QACL,KAAK;QACL,IAAI;QACJ,MAAM;QACN,KAAK;QACL,QAAQ;AACR,QAAA,MAAM,EAAE,MAAM;QACd,QAAQ;QACR,UAAU;AACV,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,OAAO,EAAE,YAAY,CAAC,YAAY,CAAC;QACnC,OAAO,EAAE,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC;QACnD,MAAM;QACN,GAAG;KACJ;AACH;;"}
|
|
1
|
+
{"version":3,"file":"pickerState.js","sources":["../../../../src/form/_colorInternals/pickerState.ts"],"sourcesContent":["// INTERNAL: deliberately not exported from src/index.ts. The color a picker\n// holds and the context its parts read, shared by ColorPicker and the panel\n// ColorInput opens, so the panel needs no Field or Control of its own.\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useNumberFormat, NumberFormatter } from '../../helpers/localeFormat';\nimport { useClientLayoutEffect } from '../../helpers/useClientLayoutEffect';\nimport { warnOnce } from '../../helpers/devWarnings';\nimport { useNativeMobilePicker } from '../_pickerInternals/useNativeMobilePicker';\nimport {\n ColorFormat,\n Hsva,\n formatColor,\n namesHue,\n parseColor,\n} from './colorMath';\nimport type { ColorPickerLabels, ColorPickerSwatch } from '../ColorPicker';\n\nconst DEFAULT_LABELS: Required<ColorPickerLabels> = {\n area: 'Saturation and brightness',\n areaRoleDescription: '2D slider',\n saturation: 'Saturation',\n brightness: 'Brightness',\n hue: 'Hue',\n alpha: 'Alpha',\n degrees: 'degrees',\n value: 'Color value',\n swatches: 'Swatches',\n eyeDropper: 'Pick a color from the screen',\n chooseColor: 'Choose color',\n};\n\n/** The labels with each one left out, or empty, at its default. */\nexport const mergeColorLabels = (\n labels: ColorPickerLabels | undefined\n): Required<ColorPickerLabels> => {\n const merged = { ...DEFAULT_LABELS };\n for (const [key, value] of Object.entries(labels ?? {})) {\n if (value) merged[key as keyof ColorPickerLabels] = value;\n }\n return merged;\n};\n\nexport const BLACK: Hsva = { h: 0, s: 0, v: 0, a: 1 };\n\n/**\n * A color read from outside the picker, written as `source`, with the hue\n * and saturation the picker had where the new color has none, so the thumbs\n * don't jump to 0. A gray written as hex, `rgb()` or a name has no hue, so\n * it keeps the picker's; one written as `hsl()` names its hue, which wins.\n * Black has no saturation in the square either way, and keeps the picker's,\n * which writes no differently.\n */\nexport const keepingChannels = (\n next: Hsva,\n previous: Hsva,\n source: string\n): Hsva => ({\n ...next,\n h: (next.s === 0 || next.v === 0) && !namesHue(source) ? previous.h : next.h,\n s: next.v === 0 ? previous.s : next.s,\n});\n\n/** What a picker's parts read from the picker around them. */\nexport interface ColorPickerContextValue {\n /** The color shown, alpha at 1 unless the picker takes alpha. */\n color: Hsva;\n /** The color written in the picker's format. */\n text: string;\n format: ColorFormat;\n alpha: boolean;\n disabled: boolean;\n labels: Required<ColorPickerLabels>;\n swatches: ColorPickerSwatch[] | 'bulma' | undefined;\n eyeDropper: boolean;\n /** Whether a touch screen reader is likely, so both square inputs show. */\n touch: boolean;\n /** Writes a percentage, in the locale of a LocaleProvider when there is one. */\n percent: (value: number) => string;\n /** Writes a hue in degrees, in the locale of a LocaleProvider when there is one. */\n degrees: (value: number) => string;\n /** Sets the color: `onChange`, and `onChangeEnd` too when `end` is set. */\n change: (next: Hsva, end?: boolean) => void;\n /** Ends a drag: `onChangeEnd` with the latest value. */\n end: () => void;\n}\n\nexport const ColorPickerContext = createContext<ColorPickerContextValue | null>(\n null\n);\n\n/** Does nothing, for a part outside a picker and a cancelled eye dropper. */\nexport const noop = () => {};\n\n// What a part outside a ColorPicker reads, so its hooks run the same; it\n// then renders nothing.\nexport const standalone: ColorPickerContextValue = {\n color: BLACK,\n text: '',\n format: 'hsl',\n alpha: false,\n disabled: true,\n labels: DEFAULT_LABELS,\n swatches: undefined,\n eyeDropper: false,\n touch: false,\n percent: String,\n degrees: String,\n change: noop,\n end: noop,\n};\n\n/** The picker around a part, or null with a development warning. */\nexport function usePicker(part: string): ColorPickerContextValue | null {\n const picker = useContext(ColorPickerContext);\n const outside = !picker;\n useEffect(() => {\n if (outside) {\n warnOnce(\n `ColorPicker:${part}:outside`,\n `[bestax-bulma] <ColorPicker.${part}> needs a <ColorPicker> around ` +\n 'it, which holds the color, and renders nothing without one.'\n );\n }\n }, [outside, part]);\n return picker;\n}\n\n/** A percentage, in the provider's locale when there is one. */\nconst writePercent =\n (formatNumber: NumberFormatter | null) => (value: number) =>\n formatNumber\n ? formatNumber(value / 100, { style: 'percent' })\n : `${value}%`;\n\n/** Degrees, in the provider's locale when there is one, else with `unit`. */\nconst writeDegrees =\n (formatNumber: NumberFormatter | null, unit: string) => (value: number) =>\n formatNumber\n ? formatNumber(value, {\n style: 'unit',\n unit: 'degree',\n unitDisplay: 'long',\n })\n : `${value} ${unit}`;\n\n/** What a picker is given: ColorPicker's props, or the ones ColorInput passes on. */\nexport interface PickerOptions {\n value: string | undefined;\n defaultValue: string | undefined;\n onChange: ((value: string) => void) | undefined;\n onChangeEnd: ((value: string) => void) | undefined;\n format: ColorFormat;\n alpha: boolean;\n disabled: boolean;\n swatches: ColorPickerSwatch[] | 'bulma' | undefined;\n eyeDropper: boolean;\n labels: ColorPickerLabels | undefined;\n /**\n * Whether the field the picker serves is empty, as ColorInput's can be.\n * The picker still shows a color then, and any change, even to that same\n * color, is reported, so it fills the field.\n */\n empty?: boolean;\n}\n\n/**\n * Holds a picker's color and builds what its parts read. Controlled, the\n * color shown follows `value`; a value the picker handed out comes back as\n * the exact color it was, thumbs and all.\n */\nexport function useColorPicker({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n format,\n alpha,\n disabled,\n swatches,\n eyeDropper,\n labels,\n empty = false,\n}: PickerOptions): ColorPickerContextValue {\n const isControlled = value !== undefined;\n // The color the picker last set or started with, and its text. While\n // `value` is that text, this is the color shown.\n const [own, setOwn] = useState(() => {\n const start = isControlled ? value : defaultValue;\n return { text: start ?? '', color: parseColor(start) ?? BLACK };\n });\n // A controlled value from outside becomes the color held, during this\n // render, keeping the hue and saturation a gray or black has none of.\n // One the picker can't read changes nothing, so the last good color\n // stays on screen.\n if (isControlled && value !== own.text) {\n const parsed = parseColor(value);\n if (parsed) {\n setOwn({\n text: value,\n color: keepingChannels(parsed, own.color, value),\n });\n }\n }\n const color = alpha ? own.color : { ...own.color, a: 1 };\n const text = formatColor(color, format, alpha);\n\n // The latest text handed out, so a step that writes the same text\n // doesn't call onChange again, and a drag's end reports the last one.\n const lastTextRef = useRef(text);\n useClientLayoutEffect(() => {\n lastTextRef.current = text;\n });\n\n const change = useCallback(\n (next: Hsva, finished = false) => {\n if (disabled) return;\n const solid = alpha ? next : { ...next, a: 1 };\n const nextText = formatColor(solid, format, alpha);\n setOwn({ text: nextText, color: solid });\n if (empty || nextText !== lastTextRef.current) {\n lastTextRef.current = nextText;\n onChange?.(nextText);\n }\n if (finished) onChangeEnd?.(nextText);\n },\n [disabled, alpha, format, onChange, onChangeEnd, empty]\n );\n const end = useCallback(\n () => onChangeEnd?.(lastTextRef.current),\n [onChangeEnd]\n );\n\n const formatNumber = useNumberFormat();\n const { isCoarsePointer } = useNativeMobilePicker();\n const merged = mergeColorLabels(labels);\n return {\n color,\n text,\n format,\n alpha,\n disabled,\n labels: merged,\n swatches,\n eyeDropper,\n touch: isCoarsePointer,\n percent: writePercent(formatNumber),\n degrees: writeDegrees(formatNumber, merged.degrees),\n change,\n end,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAuBA,MAAM,cAAc,GAAgC;AAClD,IAAA,IAAI,EAAE,2BAA2B;AACjC,IAAA,mBAAmB,EAAE,WAAW;AAChC,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,UAAU,EAAE,8BAA8B;AAC1C,IAAA,WAAW,EAAE,cAAc;CAC5B;AAED;AACO,MAAM,gBAAgB,GAAG,CAC9B,MAAqC,KACN;AAC/B,IAAA,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE;AACpC,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE;AACvD,QAAA,IAAI,KAAK;AAAE,YAAA,MAAM,CAAC,GAA8B,CAAC,GAAG,KAAK;IAC3D;AACA,IAAA,OAAO,MAAM;AACf;MAEa,KAAK,GAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,C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,WAAW,CAAC,CACd;AAED,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;AACtC,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAE;AACnD,IAAA,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACvC,OAAO;QACL,KAAK;QACL,IAAI;QACJ,MAAM;QACN,KAAK;QACL,QAAQ;AACR,QAAA,MAAM,EAAE,MAAM;QACd,QAAQ;QACR,UAAU;AACV,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,OAAO,EAAE,YAAY,CAAC,YAAY,CAAC;QACnC,OAAO,EAAE,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC;QACnD,MAAM;QACN,GAAG;KACJ;AACH;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
'use client';
|
|
2
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
4
|
import { useRef, useState, useMemo, useCallback, useId, useEffect } from 'react';
|
|
4
5
|
import { usePrefixedClassNames, prefixedClassNames, classNames } from '../../helpers/classNames.js';
|
|
@@ -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 {\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 const today = new Date();\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 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': cell.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={cell.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 = 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":";;;;;;;;;;;AAwIA;;;;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,CA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F,wBAAA,CAAC,EACD,OAAO,EAAE,MACP;AACE,8BAAE,cAAc,CAAC,IAAI;8BACnB,gBAAgB,CAAC,IAAI,CAAC,EAAA,QAAA,EAG3B,IAAI,EAAA,EA5BA,IAAI,CA6BF;AAEb,gBAAA,CAAC,CAAC,EAAA,CACE,CACP,EAEA,SAAS,KAIRC,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACEF,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAA,IAAA,EAAA,QAAA,EAC3B,CAAC,CAAC,UAAU,EAAA,CACR,EACPA,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,UAAU,EAAE,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 {\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 const today = new Date();\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 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': cell.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={cell.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 = 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":";;;;;;;;;;;;AAwIA;;;;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;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CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;4BAC1D;AACF,wBAAA,CAAC,EACD,OAAO,EAAE,MACP;AACE,8BAAE,cAAc,CAAC,IAAI;8BACnB,gBAAgB,CAAC,IAAI,CAAC,EAAA,QAAA,EAG3B,IAAI,EAAA,EA5BA,IAAI,CA6BF;AAEb,gBAAA,CAAC,CAAC,EAAA,CACE,CACP,EAEA,SAAS,KAIRC,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACEF,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAA,IAAA,EAAA,QAAA,EAC3B,CAAC,CAAC,UAAU,EAAA,CACR,EACPA,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,UAAU,EAAE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerPopover.js","sources":["../../../../src/form/_pickerInternals/PickerPopover.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport { classNames, usePrefixedClassNames } from '../../helpers/classNames';\nimport { useFocusTrap } from '../../helpers/useFocusTrap';\nimport { usePortalContainer } from '../../helpers/portal';\nimport {\n LocalePortalScope,\n type PortalLocale,\n} from '../../helpers/LocaleProvider';\nimport { isEventInside } from '../../helpers/shadowDom';\nimport { useLatestRef } from '../../helpers/useLatestRef';\nimport {\n marginGap,\n useAnchoredPosition,\n} from '../../helpers/useAnchoredPosition';\nimport { PickerPosition } from './pickerTypes';\n\nexport interface PickerPopoverProps {\n isOpen: boolean;\n onClose: () => void;\n anchorRef: React.RefObject<HTMLElement | null>;\n children: React.ReactNode;\n position?: PickerPosition;\n appendToBody?: boolean;\n className?: string;\n trapFocus?: boolean;\n closeOnClickOutside?: boolean;\n /** Close on Escape and on Alt+ArrowUp. Default `true`. */\n closeOnEscape?: boolean;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n role?: 'dialog' | 'group';\n id?: string;\n /**\n * Where focus goes when the popover closes. Without it, focus goes back to\n * whatever had it when the focus trap turned on, which is read after the\n * panel's content mounts: a calendar that focuses a cell as it mounts\n * would be recorded instead, and that cell leaves with the panel.\n */\n restoreFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * Selects the element in the panel that takes focus as it opens, such as a\n * calendar's focused date rather than the first button in its header. When\n * nothing matches, or the match can't take focus, the first tab stop does.\n */\n initialFocusSelector?: string;\n /**\n * The `dir` and `lang` the panel carries when it portals, in place of a\n * `LocaleProvider`'s: the picker's own, from `usePickerLocaleScope`.\n */\n localeScope?: PortalLocale;\n}\n\nconst isBrowser = typeof window !== 'undefined';\n\nexport const PickerPopover: React.FC<PickerPopoverProps> = ({\n isOpen,\n onClose,\n anchorRef,\n children,\n position = 'bottom-left',\n appendToBody = false,\n className,\n trapFocus = true,\n closeOnClickOutside = true,\n closeOnEscape = true,\n ariaLabel,\n ariaLabelledBy,\n role = 'dialog',\n id,\n restoreFocusRef,\n initialFocusSelector,\n localeScope,\n}) => {\n const panelRef = useRef<HTMLDivElement>(null);\n const resolveContainer = usePortalContainer();\n // Read as the trap turns on, once the panel's content has rendered.\n const initialFocusRef = useMemo(\n () =>\n initialFocusSelector === undefined\n ? undefined\n : {\n get current() {\n return (\n panelRef.current?.querySelector<HTMLElement>(\n initialFocusSelector\n ) ?? null\n );\n },\n },\n [initialFocusSelector]\n );\n const resolved = useAnchoredPosition(anchorRef, panelRef, {\n active: isOpen,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-picker-popover-offset` as a margin, in place\n // or portaled, so the coordinates leave it out and `auto` reads it off\n // the panel.\n offset: 0,\n styledGap: marginGap,\n });\n\n // Read when a press lands outside or a key arrives, so both listeners stay\n // put while `onClose` changes identity, as an inline one does on every\n // render of the field.\n const onCloseRef = useLatestRef(onClose);\n\n useEffect(() => {\n if (!isOpen || !closeOnClickOutside || !isBrowser) return undefined;\n // Listen on `pointerdown` (rather than `mousedown`) so touch starts\n // outside the popover dismiss it on mobile — including swipe-from-outside\n // gestures, where the synthetic mouse event would otherwise lag a few\n // hundred ms behind the actual touch.\n const handler = (e: PointerEvent) => {\n const path = e.composedPath();\n if (panelRef.current && path.includes(panelRef.current)) return;\n if (anchorRef.current && path.includes(anchorRef.current)) return;\n onCloseRef.current();\n };\n document.addEventListener('pointerdown', handler);\n return () => document.removeEventListener('pointerdown', handler);\n }, [isOpen, closeOnClickOutside, anchorRef, onCloseRef]);\n\n // Escape closes it, and so does Alt+ArrowUp, the combobox's key for it,\n // which the calendar and the time wheels inside leave to it. Escape closes\n // it from anywhere, but the key is only the picker's when it was pressed in\n // the panel or the field: then it's marked used, so a Modal or Sidebar\n // around the picker stays open. From anywhere else, such as a dialog opened\n // over the picker, the key goes on to whatever has focus.\n useEffect(() => {\n if (!isOpen || !closeOnEscape || !isBrowser) return undefined;\n const handler = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n if (\n isEventInside(e, panelRef.current) ||\n isEventInside(e, anchorRef.current)\n ) {\n e.preventDefault();\n }\n onCloseRef.current();\n } else if (e.altKey && e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n onCloseRef.current();\n }\n };\n document.addEventListener('keydown', handler);\n return () => document.removeEventListener('keydown', handler);\n }, [isOpen, closeOnEscape, anchorRef, onCloseRef]);\n\n useFocusTrap(panelRef, {\n active: isOpen && trapFocus,\n initialFocusRef,\n restoreFocus: restoreFocusRef ?? true,\n });\n\n const panelClass = usePrefixedClassNames('picker-popover', {\n 'is-active': isOpen,\n [`is-${resolved.position}`]: true,\n 'is-portal': appendToBody,\n });\n\n if (!isOpen) return null;\n\n const style: React.CSSProperties = appendToBody\n ? {\n position: 'fixed',\n top: resolved.top,\n left: resolved.left,\n }\n : {};\n\n const panel = (\n <div\n ref={panelRef}\n id={id}\n role={role}\n aria-modal={role === 'dialog' ? 'false' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n tabIndex={-1}\n className={classNames(panelClass, className)}\n style={style}\n // An Escape pressed in the panel is the picker's, and the listener\n // above claims it. A Dropdown menu around the picker hears Escape in a\n // React handler, which runs before that listener, so the panel claims\n // it here too, where React gets to it first.\n onKeyDown={e => {\n if (closeOnEscape && e.key === 'Escape') e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n\n if (appendToBody && isBrowser) {\n const target = resolveContainer();\n return createPortal(\n <LocalePortalScope target={target} scope={localeScope}>\n {panel}\n </LocalePortalScope>,\n target\n );\n }\n return panel;\n};\n\nPickerPopover.displayName = 'PickerPopover';\n\nexport default PickerPopover;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;AAqDA,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW;AAExC,MAAM,aAAa,GAAiC,CAAC,EAC1D,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,GAAG,aAAa,EACxB,YAAY,GAAG,KAAK,EACpB,SAAS,EACT,SAAS,GAAG,IAAI,EAChB,mBAAmB,GAAG,IAAI,EAC1B,aAAa,GAAG,IAAI,EACpB,SAAS,EACT,cAAc,EACd,IAAI,GAAG,QAAQ,EACf,EAAE,EACF,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,KAAI;AACH,IAAA,MAAM,QAAQ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AA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,IAAI;IAExB,MAAM,KAAK,GAAwB;AACjC,UAAE;AACE,YAAA,QAAQ,EAAE,OAAO;YACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;AACpB;UACD,EAAE;IAEN,MAAM,KAAK,IACTA,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,QAAQ,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EAAA,YAAA,EACE,IAAI,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,gBACvC,SAAS,EAAA,iBAAA,EACJ,cAAc,EAC/B,QAAQ,EAAE,EAAE,EACZ,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAC5C,KAAK,EAAE,KAAK;;;;;QAKZ,SAAS,EAAE,CAAC,IAAG;AACb,YAAA,IAAI,aAAa,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;gBAAE,CAAC,CAAC,cAAc,EAAE;AAC7D,QAAA,CAAC,EAAA,QAAA,EAEA,QAAQ,EAAA,CACL,CACP;AAED,IAAA,IAAI,YAAY,IAAI,SAAS,EAAE;AAC7B,QAAA,MAAM,MAAM,GAAG,gBAAgB,EAAE;AACjC,QAAA,OAAO,YAAY,CACjBA,GAAA,CAAC,iBAAiB,EAAA,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAA,QAAA,EAClD,KAAK,GACY,EACpB,MAAM,CACP;IACH;AACA,IAAA,OAAO,KAAK;AACd;AAEA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
1
|
+
{"version":3,"file":"PickerPopover.js","sources":["../../../../src/form/_pickerInternals/PickerPopover.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport { classNames, usePrefixedClassNames } from '../../helpers/classNames';\nimport { useFocusTrap } from '../../helpers/useFocusTrap';\nimport { usePortalContainer } from '../../helpers/portal';\nimport {\n LocalePortalScope,\n type PortalLocale,\n} from '../../helpers/LocaleProvider';\nimport { isEventInside } from '../../helpers/shadowDom';\nimport { useLatestRef } from '../../helpers/useLatestRef';\nimport {\n marginGap,\n useAnchoredPosition,\n} from '../../helpers/useAnchoredPosition';\nimport { PickerPosition } from './pickerTypes';\n\nexport interface PickerPopoverProps {\n isOpen: boolean;\n onClose: () => void;\n anchorRef: React.RefObject<HTMLElement | null>;\n children: React.ReactNode;\n position?: PickerPosition;\n appendToBody?: boolean;\n className?: string;\n trapFocus?: boolean;\n closeOnClickOutside?: boolean;\n /** Close on Escape and on Alt+ArrowUp. Default `true`. */\n closeOnEscape?: boolean;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n role?: 'dialog' | 'group';\n id?: string;\n /**\n * Where focus goes when the popover closes. Without it, focus goes back to\n * whatever had it when the focus trap turned on, which is read after the\n * panel's content mounts: a calendar that focuses a cell as it mounts\n * would be recorded instead, and that cell leaves with the panel.\n */\n restoreFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * Selects the element in the panel that takes focus as it opens, such as a\n * calendar's focused date rather than the first button in its header. When\n * nothing matches, or the match can't take focus, the first tab stop does.\n */\n initialFocusSelector?: string;\n /**\n * The `dir` and `lang` the panel carries when it portals, in place of a\n * `LocaleProvider`'s: the picker's own, from `usePickerLocaleScope`.\n */\n localeScope?: PortalLocale;\n}\n\nconst isBrowser = typeof window !== 'undefined';\n\nexport const PickerPopover: React.FC<PickerPopoverProps> = ({\n isOpen,\n onClose,\n anchorRef,\n children,\n position = 'bottom-left',\n appendToBody = false,\n className,\n trapFocus = true,\n closeOnClickOutside = true,\n closeOnEscape = true,\n ariaLabel,\n ariaLabelledBy,\n role = 'dialog',\n id,\n restoreFocusRef,\n initialFocusSelector,\n localeScope,\n}) => {\n const panelRef = useRef<HTMLDivElement>(null);\n const resolveContainer = usePortalContainer();\n // Read as the trap turns on, once the panel's content has rendered.\n const initialFocusRef = useMemo(\n () =>\n initialFocusSelector === undefined\n ? undefined\n : {\n get current() {\n return (\n panelRef.current?.querySelector<HTMLElement>(\n initialFocusSelector\n ) ?? null\n );\n },\n },\n [initialFocusSelector]\n );\n const resolved = useAnchoredPosition(anchorRef, panelRef, {\n active: isOpen,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-picker-popover-offset` as a margin, in place\n // or portaled, so the coordinates leave it out and `auto` reads it off\n // the panel.\n offset: 0,\n styledGap: marginGap,\n });\n\n // Read when a press lands outside or a key arrives, so both listeners stay\n // put while `onClose` changes identity, as an inline one does on every\n // render of the field.\n const onCloseRef = useLatestRef(onClose);\n\n useEffect(() => {\n if (!isOpen || !closeOnClickOutside || !isBrowser) return undefined;\n // Listen on `pointerdown` (rather than `mousedown`) so touch starts\n // outside the popover dismiss it on mobile — including swipe-from-outside\n // gestures, where the synthetic mouse event would otherwise lag a few\n // hundred ms behind the actual touch.\n const handler = (e: PointerEvent) => {\n const path = e.composedPath();\n if (panelRef.current && path.includes(panelRef.current)) return;\n if (anchorRef.current && path.includes(anchorRef.current)) return;\n onCloseRef.current();\n };\n document.addEventListener('pointerdown', handler);\n return () => document.removeEventListener('pointerdown', handler);\n }, [isOpen, closeOnClickOutside, anchorRef, onCloseRef]);\n\n // Escape closes it, and so does Alt+ArrowUp, the combobox's key for it,\n // which the calendar and the time wheels inside leave to it. Escape closes\n // it from anywhere, but the key is only the picker's when it was pressed in\n // the panel or the field: then it's marked used, so a Modal or Sidebar\n // around the picker stays open. From anywhere else, such as a dialog opened\n // over the picker, the key goes on to whatever has focus.\n useEffect(() => {\n if (!isOpen || !closeOnEscape || !isBrowser) return undefined;\n const handler = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n if (\n isEventInside(e, panelRef.current) ||\n isEventInside(e, anchorRef.current)\n ) {\n e.preventDefault();\n }\n onCloseRef.current();\n } else if (e.altKey && e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n onCloseRef.current();\n }\n };\n document.addEventListener('keydown', handler);\n return () => document.removeEventListener('keydown', handler);\n }, [isOpen, closeOnEscape, anchorRef, onCloseRef]);\n\n useFocusTrap(panelRef, {\n active: isOpen && trapFocus,\n initialFocusRef,\n restoreFocus: restoreFocusRef ?? true,\n });\n\n const panelClass = usePrefixedClassNames('picker-popover', {\n 'is-active': isOpen,\n [`is-${resolved.position}`]: true,\n 'is-portal': appendToBody,\n });\n\n if (!isOpen) return null;\n\n const style: React.CSSProperties = appendToBody\n ? {\n position: 'fixed',\n top: resolved.top,\n left: resolved.left,\n }\n : {};\n\n const panel = (\n <div\n ref={panelRef}\n id={id}\n role={role}\n aria-modal={role === 'dialog' ? 'false' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n tabIndex={-1}\n className={classNames(panelClass, className)}\n style={style}\n // An Escape pressed in the panel is the picker's, and the listener\n // above claims it. A Dropdown menu around the picker hears Escape in a\n // React handler, which runs before that listener, so the panel claims\n // it here too, where React gets to it first.\n onKeyDown={e => {\n if (closeOnEscape && e.key === 'Escape') e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n\n if (appendToBody && isBrowser) {\n const target = resolveContainer();\n return createPortal(\n <LocalePortalScope target={target} scope={localeScope}>\n {panel}\n </LocalePortalScope>,\n target\n );\n }\n return panel;\n};\n\nPickerPopover.displayName = 'PickerPopover';\n\nexport default PickerPopover;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;AAqDA,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW;AAExC,MAAM,aAAa,GAAiC,CAAC,EAC1D,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,GAAG,aAAa,EACxB,YAAY,GAAG,KAAK,EACpB,SAAS,EACT,SAAS,GAAG,IAAI,EAChB,mBAAmB,GAAG,IAAI,EAC1B,aAAa,GAAG,IAAI,EACpB,SAAS,EACT,cAAc,EACd,IAAI,GAAG,QAAQ,EACf,EAAE,EACF,eAAe,EACf,oBA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QAAA,WAAW,EAAE,YAAY;AAC1B,KAAA,CAAC;AAEF,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,IAAI;IAExB,MAAM,KAAK,GAAwB;AACjC,UAAE;AACE,YAAA,QAAQ,EAAE,OAAO;YACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;AACpB;UACD,EAAE;IAEN,MAAM,KAAK,IACTA,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,QAAQ,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EAAA,YAAA,EACE,IAAI,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,gBACvC,SAAS,EAAA,iBAAA,EACJ,cAAc,EAC/B,QAAQ,EAAE,EAAE,EACZ,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAC5C,KAAK,EAAE,KAAK;;;;;QAKZ,SAAS,EAAE,CAAC,IAAG;AACb,YAAA,IAAI,aAAa,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;gBAAE,CAAC,CAAC,cAAc,EAAE;AAC7D,QAAA,CAAC,EAAA,QAAA,EAEA,QAAQ,EAAA,CACL,CACP;AAED,IAAA,IAAI,YAAY,IAAI,SAAS,EAAE;AAC7B,QAAA,MAAM,MAAM,GAAG,gBAAgB,EAAE;AACjC,QAAA,OAAO,YAAY,CACjBA,GAAA,CAAC,iBAAiB,EAAA,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAA,QAAA,EAClD,KAAK,GACY,EACpB,MAAM,CACP;IACH;AACA,IAAA,OAAO,KAAK;AACd;AAEA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
'use client';
|
|
2
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
4
|
import React, { useState, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
4
5
|
import { prefixedClassNames, usePrefixedClassNames, classNames } from '../../helpers/classNames.js';
|