@allxsmith/bestax-bulma 5.55.0 → 5.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/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 +1 -0
- 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 +28 -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 +69 -0
- package/dist/esm/form/ColorInput.js.map +1 -0
- package/dist/esm/form/ColorInputBase.js +199 -0
- package/dist/esm/form/ColorInputBase.js.map +1 -0
- package/dist/esm/form/ColorPicker.js +5 -20
- 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 +41 -0
- package/dist/esm/form/_colorInternals/EyeDropperButton.js.map +1 -0
- package/dist/esm/form/_colorInternals/pickerState.js +5 -4
- 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/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +300 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/DataTable.d.ts +1 -1
- package/dist/types/components/useDataTable.d.ts +36 -0
- package/dist/types/form/ColorInput.d.ts +76 -0
- package/dist/types/form/ColorInputBase.d.ts +108 -0
- package/dist/types/form/ColorPicker.d.ts +5 -0
- package/dist/types/form/_colorInternals/EyeDropperButton.d.ts +8 -0
- package/dist/types/form/_colorInternals/pickerState.d.ts +7 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types-cjs/components/DataTable.d.ts +1 -1
- package/dist/types-cjs/components/useDataTable.d.ts +36 -0
- package/dist/types-cjs/form/ColorInput.d.ts +76 -0
- package/dist/types-cjs/form/ColorInputBase.d.ts +108 -0
- package/dist/types-cjs/form/ColorPicker.d.ts +5 -0
- package/dist/types-cjs/form/_colorInternals/EyeDropperButton.d.ts +8 -0
- package/dist/types-cjs/form/_colorInternals/pickerState.d.ts +7 -1
- package/dist/types-cjs/index.d.ts +4 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +2 -1
- package/src/scss/form/_colorinput.scss +109 -0
- package/src/scss/form/_index.scss +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSegmentedEntry.js","sources":["../../../../src/form/_pickerInternals/useSegmentedEntry.ts"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useClientLayoutEffect } from '../../helpers/useClientLayoutEffect';\nimport { DateFormatOption } from './formatters';\nimport { isWithin } from './dateUtils';\nimport {\n buildSegmentMap,\n incrementSegmentValue,\n setSegmentValue,\n setAmPm,\n segmentIndexAtCaret,\n SegmentKind,\n SegmentMap,\n} from './segmentMap';\n\n/**\n * Single-character literals that, when typed, jump the caret to the next\n * editable segment — the slash / colon / dash / dot / space separators that\n * appear between date and time tokens. Lets a user type `12/25/2026` or\n * `13:45` straight through, skipping over the format's punctuation.\n */\nconst SEPARATOR_RE = /[/:\\-.\\s]/;\n\nexport interface UseSegmentedEntryParams {\n /** Resolved format actually used to render (the host's default format). */\n format: DateFormatOption;\n /**\n * Segment kinds the caret never stops on: they still render, but arrows,\n * digits and separators pass over them. A month picker skips `'day'` so a\n * format such as `'YYYY-MM-DD'` edits only the year and month. Must be\n * referentially stable. A format left with no editable segment falls back\n * to free-form entry.\n */\n skipKinds?: readonly SegmentKind[];\n /** Current canonical value (controlled or internal). */\n value: Date | null;\n /** Commit a new Date through the host's onChange / internal pipeline. */\n commitValue: (next: Date | null) => void;\n /** Host formatter: formatDate | formatTime | formatDateTime. */\n formatFn: (\n d: Date,\n fmt: DateFormatOption | undefined,\n locale?: string\n ) => string;\n /** Host parser used by the free-form fallback (parseDate / parseTime / custom). */\n tryParse: (s: string) => Date | null;\n /** Host's displayed-text state and setter (the hook drives it during edits). */\n text: string;\n setText: (s: string) => void;\n /**\n * Seed for an empty value when the user starts typing: Time → today at noon,\n * Date → today at 00:00, DateTime → now. Should be referentially stable.\n */\n makeBaseDate: () => Date;\n locale?: string;\n min?: Date;\n max?: Date;\n /**\n * Host-supplied blocking predicate (composed from shouldDisableDate /\n * unselectableDates / unselectableTimes). Checked alongside min/max on\n * every manual-entry commit; return true to reject the candidate value.\n */\n isBlocked?: (d: Date) => boolean;\n /**\n * Rejects a candidate only while the digits typed into its segment leave\n * it unfinished, such as the first digits of a year. The digit stays in\n * the segment and the next one tries again, so a value passing through a\n * candidate it can't commit on the way to one it can costs nothing. A\n * finished segment, an arrow step and parsed text answer to `isBlocked`\n * alone.\n */\n isUnfinishedBlocked?: (d: Date) => boolean;\n disabled?: boolean;\n readOnly?: boolean;\n /** Allow segmented typing. When false, segment mode never engages. */\n editable?: boolean;\n /** Whether a popover exists; gates open-on-focus / click / Alt+ArrowDown. */\n popover?: boolean;\n openOnFocus?: boolean;\n closeOnSelect?: boolean;\n isOpen: boolean;\n /**\n * The host's open-state setter. The hook asks it to open on focus, click\n * or Alt+ArrowDown, but not on the focus the popover's focus trap hands\n * back to the input as it closes, which is not the user arriving.\n */\n setOpen: (next: boolean) => void;\n inputRef: React.RefObject<HTMLInputElement | null>;\n containerRef: React.RefObject<HTMLElement | null>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n}\n\nexport interface UseSegmentedEntryResult {\n segmentMap: SegmentMap | null;\n activeSegmentIdx: number | null;\n /** True when segment typing is available (map + editable + not disabled/readOnly). */\n segmentEditable: boolean;\n /** True when a segment is actively selected. */\n inSegmentMode: boolean;\n /** Spread onto the combobox `<input>`. */\n inputHandlers: {\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onFocus: React.FocusEventHandler<HTMLInputElement>;\n onClick: React.MouseEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onBlur: React.FocusEventHandler<HTMLInputElement>;\n };\n}\n\n/**\n * Segmented manual keyboard entry for a date / time picker input. Computes a\n * segment map from the token format, tracks the active segment, and returns\n * the full set of `<input>` event handlers — segment-mutating keys (arrows,\n * digits, AM/PM, separators) are handled here, while popover open/close and\n * free-form parse-on-blur/Enter are driven through the host-supplied\n * `setOpen` / `tryParse` / `commitValue` callbacks. When the format is an\n * `Intl` options object or contains variable-width tokens, the segment map is\n * null and the input transparently falls back to free-form text entry.\n */\nexport function useSegmentedEntry(\n params: UseSegmentedEntryParams\n): UseSegmentedEntryResult {\n const {\n format,\n skipKinds,\n value,\n commitValue,\n formatFn,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min,\n max,\n isBlocked,\n isUnfinishedBlocked,\n disabled,\n readOnly,\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = false,\n isOpen,\n setOpen,\n inputRef,\n containerRef,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n } = params;\n\n const segmentMap: SegmentMap | null = useMemo(() => {\n const map = typeof format === 'string' ? buildSegmentMap(format) : null;\n if (!map || !skipKinds) return map;\n const editable = map.editable.filter(\n i => !skipKinds.includes(map.segments[i].kind)\n );\n return editable.length > 0 ? { ...map, editable } : null;\n }, [format, skipKinds]);\n const [activeSegmentIdx, setActiveSegmentIdx] = useState<number | null>(null);\n // Buffer of digits typed within the current segment, cleared on segment\n // change. Kept in a ref because key handlers read+update synchronously\n // within the same event tick.\n const typedDigitsRef = useRef<string>('');\n // The text focus seeded an empty picker with, until the user edits it or\n // leaves.\n const seedRef = useRef<string | null>(null);\n\n // Whether the text is still what the picker put there, so nothing in it was\n // typed: the value's display, or an empty picker's seed until an edit drops\n // it. Against a value it compares text alone, so typing that ends back on\n // the display counts as untouched.\n const isUntouched = useCallback(\n (s: string) =>\n value\n ? s === formatFn(value, format, locale)\n : seedRef.current !== null && s === seedRef.current,\n [value, formatFn, format, locale]\n );\n\n // A seed the popover never turned into a value closes with it, wherever\n // focus goes, so a dismissed empty field stays empty.\n //\n // As the popover closes, its focus trap hands focus back to the input. That\n // focus is not the user arriving: it must not open the popover again under\n // `openOnFocus`, or seed an empty picker. `closingRef` is set in the layout\n // phase of the commit that closes it and cleared by that commit's effects,\n // and React runs a commit's effect cleanups, the trap's among them, before\n // any of its effects, so a focus in between is the one handed back.\n const closingRef = useRef(false);\n const wasOpenRef = useRef(isOpen);\n useClientLayoutEffect(() => {\n if (wasOpenRef.current && !isOpen) {\n closingRef.current = true;\n if (!value && isUntouched(text)) setText('');\n seedRef.current = null;\n }\n wasOpenRef.current = isOpen;\n }, [isOpen, value, isUntouched, text, setText]);\n useEffect(() => {\n closingRef.current = false;\n }, [isOpen]);\n\n // Segment mode is unavailable for disabled / read-only / non-editable\n // pickers and for Intl-options / variable-width formats (segmentMap null).\n const segmentEditable = !!segmentMap && !!editable && !disabled && !readOnly;\n\n // The Date we edit when the user starts without a current value.\n const segmentBaseDate = useCallback(\n (): Date => value ?? makeBaseDate(),\n [value, makeBaseDate]\n );\n\n // Single gate for every manual-entry commit: min/max bounds plus the\n // host's blocking predicate.\n const isAllowed = useCallback(\n (d: Date) => isWithin(d, min, max) && !isBlocked?.(d),\n [min, max, isBlocked]\n );\n\n // Apply a segment-driven date update: commit through the host pipeline (so\n // onChange / controlled mode keep working) and re-render the text so the\n // active selection range stays valid.\n const applyDateFromSegment = useCallback(\n (next: Date) => {\n if (!isAllowed(next)) return;\n commitValue(next);\n setText(formatFn(next, format, locale));\n },\n [commitValue, isAllowed, formatFn, format, locale, setText]\n );\n\n // After every segment-driven change, restore the system selection on the\n // active segment's char range. A layout effect runs synchronously before\n // paint so the user never sees a stray caret position. We deliberately do\n // NOT gate on document.activeElement: when openOnFocus is true the focus\n // trap moves focus into the popover, but setSelectionRange on an unfocused\n // input is well-defined and the selection becomes visible on refocus.\n useClientLayoutEffect(() => {\n if (activeSegmentIdx === null || !segmentMap || !inputRef.current) return;\n const seg = segmentMap.segments[activeSegmentIdx];\n if (!seg) return;\n try {\n inputRef.current.setSelectionRange(seg.start, seg.end);\n } catch {\n // Some read-only inputs reject setSelectionRange; harmless.\n }\n }, [activeSegmentIdx, segmentMap, text, inputRef]);\n\n const moveSegment = useCallback(\n (delta: 1 | -1) => {\n if (!segmentMap || activeSegmentIdx === null) return;\n const pos = segmentMap.editable.indexOf(activeSegmentIdx);\n if (pos < 0) return;\n const nextPos = Math.max(\n 0,\n Math.min(segmentMap.editable.length - 1, pos + delta)\n );\n const nextIdx = segmentMap.editable[nextPos];\n if (nextIdx !== activeSegmentIdx) {\n typedDigitsRef.current = '';\n setActiveSegmentIdx(nextIdx);\n }\n },\n [segmentMap, activeSegmentIdx]\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n // In segment mode the text is managed programmatically (every edit\n // re-formats from the canonical Date). Browser-issued input events\n // would otherwise clobber it. The free-form path runs only when\n // segment mode is inactive.\n if (activeSegmentIdx !== null && segmentEditable) return;\n seedRef.current = null;\n setText(e.target.value);\n },\n [activeSegmentIdx, segmentEditable, setText]\n );\n\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n // The popover opens on focus by default, and the focus trap moves focus\n // into the popover panel — that fires this blur even though the user is\n // still in the same picker. Only tear down segment state and re-parse\n // when focus has truly left the picker's container.\n const nextFocus = e.relatedTarget as HTMLElement | null;\n const stayingInPicker =\n nextFocus !== null &&\n containerRef.current !== null &&\n containerRef.current.contains(nextFocus);\n if (stayingInPicker) {\n onBlur?.(e);\n return;\n }\n setActiveSegmentIdx(null);\n typedDigitsRef.current = '';\n // Leaving commits only what was typed. Re-parsing the value's display\n // could drop what the format leaves out, such as seconds, and a seed\n // nobody typed over is not the user's date.\n const untouched = isUntouched(text);\n // An open popover keeps an unused seed until it closes, so one portaled\n // outside the picker, whose focus reads as leaving, keeps it as one\n // inside does.\n if (!isOpen) seedRef.current = null;\n if (untouched) {\n if (!value && !isOpen) setText('');\n onBlur?.(e);\n return;\n }\n const parsed = tryParse(text);\n if (parsed && isAllowed(parsed)) {\n commitValue(parsed);\n } else {\n setText(value ? formatFn(value, format, locale) : '');\n }\n onBlur?.(e);\n },\n [\n containerRef,\n isUntouched,\n isOpen,\n tryParse,\n text,\n isAllowed,\n commitValue,\n value,\n formatFn,\n format,\n locale,\n setText,\n onBlur,\n ]\n );\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n const handedBack = closingRef.current;\n if (!handedBack && openOnFocus && popover && !disabled && !readOnly) {\n setOpen(true);\n }\n // Enter segment mode: prime an initial value (so editing works even when\n // empty), seed the text, and highlight the first editable segment. The\n // segment base doesn't need the seed, so focus handed back skips it.\n if (segmentEditable && segmentMap) {\n if (!value && !handedBack) {\n const seed = formatFn(makeBaseDate(), format, locale);\n seedRef.current = seed;\n setText(seed);\n }\n typedDigitsRef.current = '';\n setActiveSegmentIdx(segmentMap.editable[0]);\n }\n onFocus?.(e);\n },\n [\n openOnFocus,\n popover,\n disabled,\n readOnly,\n setOpen,\n segmentEditable,\n segmentMap,\n value,\n makeBaseDate,\n formatFn,\n format,\n locale,\n setText,\n onFocus,\n ]\n );\n\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLInputElement>) => {\n // Clicking the field opens the popover only when `openOnFocus` is on —\n // a click is just a focus. With `openOnFocus={false}` (manual-entry\n // mode) the click positions the caret for typing and the popover is\n // opened explicitly via the right launcher button (or Alt+ArrowDown).\n if (openOnFocus && popover && !disabled && !readOnly) setOpen(true);\n if (segmentEditable && segmentMap && inputRef.current) {\n const caret = inputRef.current.selectionStart ?? 0;\n const idx = segmentIndexAtCaret(segmentMap, caret);\n if (idx !== null && idx !== activeSegmentIdx) {\n typedDigitsRef.current = '';\n setActiveSegmentIdx(idx);\n }\n }\n onClick?.(e);\n },\n [\n openOnFocus,\n popover,\n disabled,\n readOnly,\n setOpen,\n segmentEditable,\n segmentMap,\n inputRef,\n activeSegmentIdx,\n onClick,\n ]\n );\n\n const inSegmentMode =\n segmentEditable && segmentMap !== null && activeSegmentIdx !== null;\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n // Segment-mode key routing comes first. When segment mode isn't engaged\n // (not editable, no map, or no active segment — e.g. after a typed-text\n // fallback), unhandled keys fall through to the popover / free-form\n // handling below.\n if (inSegmentMode && segmentMap && activeSegmentIdx !== null) {\n const seg = segmentMap.segments[activeSegmentIdx];\n const base = segmentBaseDate();\n const isPm = base.getHours() >= 12;\n switch (e.key) {\n case 'ArrowUp':\n case 'ArrowDown':\n e.preventDefault();\n // The plain arrows step the segment, so the popover opens on\n // Alt+ArrowDown and closes on Alt+ArrowUp, as a combobox's does,\n // and neither steps it.\n if (e.altKey) {\n if (e.key === 'ArrowUp') {\n if (isOpen) setOpen(false);\n } else if (!isOpen && popover) {\n setOpen(true);\n }\n return;\n }\n typedDigitsRef.current = '';\n applyDateFromSegment(\n incrementSegmentValue(\n seg,\n base,\n e.key === 'ArrowUp' ? 1 : -1,\n isPm\n )\n );\n return;\n case 'ArrowRight':\n e.preventDefault();\n moveSegment(1);\n return;\n case 'ArrowLeft':\n e.preventDefault();\n moveSegment(-1);\n return;\n case 'Backspace':\n e.preventDefault();\n if (typedDigitsRef.current.length > 0) {\n typedDigitsRef.current = '';\n } else {\n moveSegment(-1);\n }\n return;\n case 'Escape':\n if (isOpen) {\n e.preventDefault();\n setOpen(false);\n }\n return;\n case 'Enter':\n e.preventDefault();\n if (closeOnSelect) setOpen(false);\n return;\n case 'Tab':\n setActiveSegmentIdx(null);\n typedDigitsRef.current = '';\n return;\n default:\n // AM/PM keys.\n if (seg.kind === 'ampm') {\n if (e.key === 'a' || e.key === 'A') {\n e.preventDefault();\n typedDigitsRef.current = '';\n applyDateFromSegment(setAmPm(base, false));\n moveSegment(1);\n return;\n }\n if (e.key === 'p' || e.key === 'P') {\n e.preventDefault();\n typedDigitsRef.current = '';\n applyDateFromSegment(setAmPm(base, true));\n moveSegment(1);\n return;\n }\n }\n // Typing a format separator (/, :, -, ., space) jumps to the next\n // segment, skipping over the literal punctuation.\n if (e.key.length === 1 && SEPARATOR_RE.test(e.key)) {\n e.preventDefault();\n typedDigitsRef.current = '';\n moveSegment(1);\n return;\n }\n // Digit entry for numeric segments.\n if (/^[0-9]$/.test(e.key) && seg.kind !== 'ampm') {\n e.preventDefault();\n const nextBuffer = typedDigitsRef.current + e.key;\n typedDigitsRef.current = nextBuffer;\n const { date, advance } = setSegmentValue(\n seg,\n base,\n nextBuffer,\n isPm\n );\n if (!advance && isUnfinishedBlocked?.(date)) return;\n applyDateFromSegment(date);\n if (advance) {\n typedDigitsRef.current = '';\n moveSegment(1);\n }\n return;\n }\n }\n }\n // ----- free-form / popover key handling -----\n // With no segment to step, ArrowDown opens the popover with or without\n // Alt, unless the field is read-only or disabled, as focus and the\n // launcher don't open it then either. Alt+ArrowUp closes it.\n if (\n e.key === 'ArrowDown' &&\n !isOpen &&\n popover &&\n !disabled &&\n !readOnly\n ) {\n e.preventDefault();\n setOpen(true);\n return;\n }\n if (e.key === 'ArrowUp' && e.altKey && isOpen) {\n e.preventDefault();\n setOpen(false);\n return;\n }\n if (e.key === 'Escape' && isOpen) {\n e.preventDefault();\n setOpen(false);\n return;\n }\n if (e.key === 'Enter') {\n e.preventDefault();\n // Untouched text has nothing to commit, as on leaving, but Enter\n // still confirms what the field shows.\n if (isUntouched(text)) {\n if (closeOnSelect) setOpen(false);\n } else {\n const parsed = tryParse(text);\n if (parsed && isAllowed(parsed)) {\n commitValue(parsed);\n if (closeOnSelect) setOpen(false);\n }\n }\n }\n onKeyDown?.(e);\n },\n [\n inSegmentMode,\n segmentMap,\n activeSegmentIdx,\n segmentBaseDate,\n applyDateFromSegment,\n isUnfinishedBlocked,\n moveSegment,\n isOpen,\n setOpen,\n closeOnSelect,\n popover,\n disabled,\n readOnly,\n isUntouched,\n tryParse,\n text,\n isAllowed,\n commitValue,\n onKeyDown,\n ]\n );\n\n return {\n segmentMap,\n activeSegmentIdx,\n segmentEditable,\n inSegmentMode,\n inputHandlers: {\n onChange: handleChange,\n onFocus: handleFocus,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onBlur: handleBlur,\n },\n };\n}\n"],"names":[],"mappings":";;;;;;AAoBA;;;;;AAKG;AACH,MAAM,YAAY,GAAG,WAAW;AA2FhC;;;;;;;;;AASG;AACG,SAAU,iBAAiB,CAC/B,MAA+B,EAAA;AAE/B,IAAA,MAAM,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,MAAM,EACN,GAAG,EACH,GAAG,EACH,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,IAAI,EAClB,aAAa,GAAG,KAAK,EACrB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,GACP,GAAG,MAAM;AAEV,IAAA,MAAM,UAAU,GAAsB,OAAO,CAAC,MAAK;AACjD,QAAA,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI;AACvE,QAAA,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS;AAAE,YAAA,OAAO,GAAG;QAClC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAClC,CAAC,IA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Ac,EAAE;YAClB,OAAO,CAAC,KAAK,CAAC;YACd;QACF;AACA,QAAA,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,CAAC,CAAC,cAAc,EAAE;;;AAGlB,YAAA,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;AACrB,gBAAA,IAAI,aAAa;oBAAE,OAAO,CAAC,KAAK,CAAC;YACnC;iBAAO;AACL,gBAAA,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC7B,gBAAA,IAAI,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;oBAC/B,WAAW,CAAC,MAAM,CAAC;AACnB,oBAAA,IAAI,aAAa;wBAAE,OAAO,CAAC,KAAK,CAAC;gBACnC;YACF;QACF;AACA,QAAA,SAAS,GAAG,CAAC,CAAC;AAChB,IAAA,CAAC,EACD;QACE,aAAa;QACb,UAAU;QACV,gBAAgB;QAChB,eAAe;QACf,oBAAoB;QACpB,mBAAmB;QACnB,WAAW;QACX,MAAM;QACN,OAAO;QACP,aAAa;QACb,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,QAAQ;QACR,IAAI;QACJ,SAAS;QACT,WAAW;QACX,SAAS;AACV,KAAA,CACF;IAED,OAAO;QACL,UAAU;QACV,gBAAgB;QAChB,eAAe;QACf,aAAa;AACb,QAAA,aAAa,EAAE;AACb,YAAA,QAAQ,EAAE,YAAY;AACtB,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,SAAS,EAAE,aAAa;AACxB,YAAA,MAAM,EAAE,UAAU;AACnB,SAAA;KACF;AACH;;"}
|
|
1
|
+
{"version":3,"file":"useSegmentedEntry.js","sources":["../../../../src/form/_pickerInternals/useSegmentedEntry.ts"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useClientLayoutEffect } from '../../helpers/useClientLayoutEffect';\nimport { DateFormatOption } from './formatters';\nimport { isWithin } from './dateUtils';\nimport {\n buildSegmentMap,\n incrementSegmentValue,\n setSegmentValue,\n setAmPm,\n segmentIndexAtCaret,\n SegmentKind,\n SegmentMap,\n} from './segmentMap';\n\n/**\n * Single-character literals that, when typed, jump the caret to the next\n * editable segment — the slash / colon / dash / dot / space separators that\n * appear between date and time tokens. Lets a user type `12/25/2026` or\n * `13:45` straight through, skipping over the format's punctuation.\n */\nconst SEPARATOR_RE = /[/:\\-.\\s]/;\n\nexport interface UseSegmentedEntryParams {\n /** Resolved format actually used to render (the host's default format). */\n format: DateFormatOption;\n /**\n * Segment kinds the caret never stops on: they still render, but arrows,\n * digits and separators pass over them. A month picker skips `'day'` so a\n * format such as `'YYYY-MM-DD'` edits only the year and month. Must be\n * referentially stable. A format left with no editable segment falls back\n * to free-form entry.\n */\n skipKinds?: readonly SegmentKind[];\n /** Current canonical value (controlled or internal). */\n value: Date | null;\n /** Commit a new Date through the host's onChange / internal pipeline. */\n commitValue: (next: Date | null) => void;\n /** Host formatter: formatDate | formatTime | formatDateTime. */\n formatFn: (\n d: Date,\n fmt: DateFormatOption | undefined,\n locale?: string\n ) => string;\n /** Host parser used by the free-form fallback (parseDate / parseTime / custom). */\n tryParse: (s: string) => Date | null;\n /** Host's displayed-text state and setter (the hook drives it during edits). */\n text: string;\n setText: (s: string) => void;\n /**\n * Seed for an empty value when the user starts typing: Time → today at noon,\n * Date → today at 00:00, DateTime → now. Should be referentially stable.\n */\n makeBaseDate: () => Date;\n locale?: string;\n min?: Date;\n max?: Date;\n /**\n * Host-supplied blocking predicate (composed from shouldDisableDate /\n * unselectableDates / unselectableTimes). Checked alongside min/max on\n * every manual-entry commit; return true to reject the candidate value.\n */\n isBlocked?: (d: Date) => boolean;\n /**\n * Rejects a candidate only while the digits typed into its segment leave\n * it unfinished, such as the first digits of a year. The digit stays in\n * the segment and the next one tries again, so a value passing through a\n * candidate it can't commit on the way to one it can costs nothing. A\n * finished segment, an arrow step and parsed text answer to `isBlocked`\n * alone.\n */\n isUnfinishedBlocked?: (d: Date) => boolean;\n disabled?: boolean;\n readOnly?: boolean;\n /** Allow segmented typing. When false, segment mode never engages. */\n editable?: boolean;\n /** Whether a popover exists; gates open-on-focus / click / Alt+ArrowDown. */\n popover?: boolean;\n openOnFocus?: boolean;\n closeOnSelect?: boolean;\n isOpen: boolean;\n /**\n * The host's open-state setter. The hook asks it to open on focus, click\n * or Alt+ArrowDown, but not on the focus the popover's focus trap hands\n * back to the input as it closes, which is not the user arriving.\n */\n setOpen: (next: boolean) => void;\n inputRef: React.RefObject<HTMLInputElement | null>;\n containerRef: React.RefObject<HTMLElement | null>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n}\n\nexport interface UseSegmentedEntryResult {\n segmentMap: SegmentMap | null;\n activeSegmentIdx: number | null;\n /** True when segment typing is available (map + editable + not disabled/readOnly). */\n segmentEditable: boolean;\n /** True when a segment is actively selected. */\n inSegmentMode: boolean;\n /** Spread onto the combobox `<input>`. */\n inputHandlers: {\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onFocus: React.FocusEventHandler<HTMLInputElement>;\n onClick: React.MouseEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onBlur: React.FocusEventHandler<HTMLInputElement>;\n };\n}\n\n/**\n * Segmented manual keyboard entry for a date / time picker input. Computes a\n * segment map from the token format, tracks the active segment, and returns\n * the full set of `<input>` event handlers — segment-mutating keys (arrows,\n * digits, AM/PM, separators) are handled here, while popover open/close and\n * free-form parse-on-blur/Enter are driven through the host-supplied\n * `setOpen` / `tryParse` / `commitValue` callbacks. When the format is an\n * `Intl` options object or contains variable-width tokens, the segment map is\n * null and the input transparently falls back to free-form text entry.\n */\nexport function useSegmentedEntry(\n params: UseSegmentedEntryParams\n): UseSegmentedEntryResult {\n const {\n format,\n skipKinds,\n value,\n commitValue,\n formatFn,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min,\n max,\n isBlocked,\n isUnfinishedBlocked,\n disabled,\n readOnly,\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = false,\n isOpen,\n setOpen,\n inputRef,\n containerRef,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n } = params;\n\n const segmentMap: SegmentMap | null = useMemo(() => {\n const map = typeof format === 'string' ? buildSegmentMap(format) : null;\n if (!map || !skipKinds) return map;\n const editable = map.editable.filter(\n i => !skipKinds.includes(map.segments[i].kind)\n );\n return editable.length > 0 ? { ...map, editable } : null;\n }, [format, skipKinds]);\n const [activeSegmentIdx, setActiveSegmentIdx] = useState<number | null>(null);\n // Buffer of digits typed within the current segment, cleared on segment\n // change. Kept in a ref because key handlers read+update synchronously\n // within the same event tick.\n const typedDigitsRef = useRef<string>('');\n // The text focus seeded an empty picker with, until the user edits it or\n // leaves.\n const seedRef = useRef<string | null>(null);\n\n // Whether the text is still what the picker put there, so nothing in it was\n // typed: the value's display, or an empty picker's seed until an edit drops\n // it. Against a value it compares text alone, so typing that ends back on\n // the display counts as untouched.\n const isUntouched = useCallback(\n (s: string) =>\n value\n ? s === formatFn(value, format, locale)\n : seedRef.current !== null && s === seedRef.current,\n [value, formatFn, format, locale]\n );\n\n // A seed the popover never turned into a value closes with it, wherever\n // focus goes, so a dismissed empty field stays empty.\n //\n // As the popover closes, its focus trap hands focus back to the input. That\n // focus is not the user arriving: it must not open the popover again under\n // `openOnFocus`, or seed an empty picker. `closingRef` is set in the layout\n // phase of the commit that closes it and cleared by that commit's effects,\n // and React runs a commit's effect cleanups, the trap's among them, before\n // any of its effects, so a focus in between is the one handed back.\n const closingRef = useRef(false);\n const wasOpenRef = useRef(isOpen);\n useClientLayoutEffect(() => {\n if (wasOpenRef.current && !isOpen) {\n closingRef.current = true;\n if (!value && isUntouched(text)) setText('');\n seedRef.current = null;\n }\n wasOpenRef.current = isOpen;\n }, [isOpen, value, isUntouched, text, setText]);\n useEffect(() => {\n closingRef.current = false;\n }, [isOpen]);\n\n // Segment mode is unavailable for disabled / read-only / non-editable\n // pickers and for Intl-options / variable-width formats (segmentMap null).\n const segmentEditable = !!segmentMap && !!editable && !disabled && !readOnly;\n\n // The Date we edit when the user starts without a current value.\n const segmentBaseDate = useCallback(\n (): Date => value ?? makeBaseDate(),\n [value, makeBaseDate]\n );\n\n // Single gate for every manual-entry commit: min/max bounds plus the\n // host's blocking predicate.\n const isAllowed = useCallback(\n (d: Date) => isWithin(d, min, max) && !isBlocked?.(d),\n [min, max, isBlocked]\n );\n\n // Apply a segment-driven date update: commit through the host pipeline (so\n // onChange / controlled mode keep working) and re-render the text so the\n // active selection range stays valid.\n const applyDateFromSegment = useCallback(\n (next: Date) => {\n if (!isAllowed(next)) return;\n commitValue(next);\n setText(formatFn(next, format, locale));\n },\n [commitValue, isAllowed, formatFn, format, locale, setText]\n );\n\n // After every segment-driven change, restore the system selection on the\n // active segment's char range. A layout effect runs synchronously before\n // paint so the user never sees a stray caret position. We deliberately do\n // NOT gate on document.activeElement: when openOnFocus is true the focus\n // trap moves focus into the popover, but setSelectionRange on an unfocused\n // input is well-defined and the selection becomes visible on refocus.\n useClientLayoutEffect(() => {\n if (activeSegmentIdx === null || !segmentMap || !inputRef.current) return;\n const seg = segmentMap.segments[activeSegmentIdx];\n if (!seg) return;\n try {\n inputRef.current.setSelectionRange(seg.start, seg.end);\n } catch {\n // Some read-only inputs reject setSelectionRange; harmless.\n }\n }, [activeSegmentIdx, segmentMap, text, inputRef]);\n\n const moveSegment = useCallback(\n (delta: 1 | -1) => {\n if (!segmentMap || activeSegmentIdx === null) return;\n const pos = segmentMap.editable.indexOf(activeSegmentIdx);\n if (pos < 0) return;\n const nextPos = Math.max(\n 0,\n Math.min(segmentMap.editable.length - 1, pos + delta)\n );\n const nextIdx = segmentMap.editable[nextPos];\n if (nextIdx !== activeSegmentIdx) {\n typedDigitsRef.current = '';\n setActiveSegmentIdx(nextIdx);\n }\n },\n [segmentMap, activeSegmentIdx]\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n // In segment mode the text is managed programmatically (every edit\n // re-formats from the canonical Date). Browser-issued input events\n // would otherwise clobber it. The free-form path runs only when\n // segment mode is inactive.\n if (activeSegmentIdx !== null && segmentEditable) return;\n seedRef.current = null;\n setText(e.target.value);\n },\n [activeSegmentIdx, segmentEditable, setText]\n );\n\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n // The popover opens on focus by default, and the focus trap moves focus\n // into the popover panel — that fires this blur even though the user is\n // still in the same picker. Only tear down segment state and re-parse\n // when focus has truly left the picker's container.\n const nextFocus = e.relatedTarget as HTMLElement | null;\n const stayingInPicker =\n nextFocus !== null &&\n containerRef.current !== null &&\n containerRef.current.contains(nextFocus);\n if (stayingInPicker) {\n onBlur?.(e);\n return;\n }\n setActiveSegmentIdx(null);\n typedDigitsRef.current = '';\n // Leaving commits only what was typed. Re-parsing the value's display\n // could drop what the format leaves out, such as seconds, and a seed\n // nobody typed over is not the user's date.\n const untouched = isUntouched(text);\n // An open popover keeps an unused seed until it closes, so one portaled\n // outside the picker, whose focus reads as leaving, keeps it as one\n // inside does.\n if (!isOpen) seedRef.current = null;\n if (untouched) {\n if (!value && !isOpen) setText('');\n onBlur?.(e);\n return;\n }\n const parsed = tryParse(text);\n if (parsed && isAllowed(parsed)) {\n commitValue(parsed);\n } else {\n setText(value ? formatFn(value, format, locale) : '');\n }\n onBlur?.(e);\n },\n [\n containerRef,\n isUntouched,\n isOpen,\n tryParse,\n text,\n isAllowed,\n commitValue,\n value,\n formatFn,\n format,\n locale,\n setText,\n onBlur,\n ]\n );\n\n const handleFocus = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n const handedBack = closingRef.current;\n if (!handedBack && openOnFocus && popover && !disabled && !readOnly) {\n setOpen(true);\n }\n // Enter segment mode: prime an initial value (so editing works even when\n // empty), seed the text, and highlight the first editable segment. The\n // segment base doesn't need the seed, so focus handed back skips it.\n if (segmentEditable && segmentMap) {\n if (!value && !handedBack) {\n const seed = formatFn(makeBaseDate(), format, locale);\n seedRef.current = seed;\n setText(seed);\n }\n typedDigitsRef.current = '';\n setActiveSegmentIdx(segmentMap.editable[0]);\n }\n onFocus?.(e);\n },\n [\n openOnFocus,\n popover,\n disabled,\n readOnly,\n setOpen,\n segmentEditable,\n segmentMap,\n value,\n makeBaseDate,\n formatFn,\n format,\n locale,\n setText,\n onFocus,\n ]\n );\n\n const handleClick = useCallback(\n (e: React.MouseEvent<HTMLInputElement>) => {\n // Clicking the field opens the popover only when `openOnFocus` is on —\n // a click is just a focus. With `openOnFocus={false}` (manual-entry\n // mode) the click positions the caret for typing and the popover is\n // opened explicitly via the right launcher button (or Alt+ArrowDown).\n if (openOnFocus && popover && !disabled && !readOnly) setOpen(true);\n if (segmentEditable && segmentMap && inputRef.current) {\n const caret = inputRef.current.selectionStart ?? 0;\n const idx = segmentIndexAtCaret(segmentMap, caret);\n if (idx !== null && idx !== activeSegmentIdx) {\n typedDigitsRef.current = '';\n setActiveSegmentIdx(idx);\n }\n }\n onClick?.(e);\n },\n [\n openOnFocus,\n popover,\n disabled,\n readOnly,\n setOpen,\n segmentEditable,\n segmentMap,\n inputRef,\n activeSegmentIdx,\n onClick,\n ]\n );\n\n const inSegmentMode =\n segmentEditable && segmentMap !== null && activeSegmentIdx !== null;\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n // Segment-mode key routing comes first. When segment mode isn't engaged\n // (not editable, no map, or no active segment — e.g. after a typed-text\n // fallback), unhandled keys fall through to the popover / free-form\n // handling below.\n if (inSegmentMode && segmentMap && activeSegmentIdx !== null) {\n const seg = segmentMap.segments[activeSegmentIdx];\n const base = segmentBaseDate();\n const isPm = base.getHours() >= 12;\n switch (e.key) {\n case 'ArrowUp':\n case 'ArrowDown':\n e.preventDefault();\n // The plain arrows step the segment, so the popover opens on\n // Alt+ArrowDown and closes on Alt+ArrowUp, as a combobox's does,\n // and neither steps it.\n if (e.altKey) {\n if (e.key === 'ArrowUp') {\n if (isOpen) setOpen(false);\n } else if (!isOpen && popover) {\n setOpen(true);\n }\n return;\n }\n typedDigitsRef.current = '';\n applyDateFromSegment(\n incrementSegmentValue(\n seg,\n base,\n e.key === 'ArrowUp' ? 1 : -1,\n isPm\n )\n );\n return;\n case 'ArrowRight':\n e.preventDefault();\n moveSegment(1);\n return;\n case 'ArrowLeft':\n e.preventDefault();\n moveSegment(-1);\n return;\n case 'Backspace':\n e.preventDefault();\n if (typedDigitsRef.current.length > 0) {\n typedDigitsRef.current = '';\n } else {\n moveSegment(-1);\n }\n return;\n case 'Escape':\n if (isOpen) {\n e.preventDefault();\n setOpen(false);\n }\n return;\n case 'Enter':\n e.preventDefault();\n if (closeOnSelect) setOpen(false);\n return;\n case 'Tab':\n setActiveSegmentIdx(null);\n typedDigitsRef.current = '';\n return;\n default:\n // AM/PM keys.\n if (seg.kind === 'ampm') {\n if (e.key === 'a' || e.key === 'A') {\n e.preventDefault();\n typedDigitsRef.current = '';\n applyDateFromSegment(setAmPm(base, false));\n moveSegment(1);\n return;\n }\n if (e.key === 'p' || e.key === 'P') {\n e.preventDefault();\n typedDigitsRef.current = '';\n applyDateFromSegment(setAmPm(base, true));\n moveSegment(1);\n return;\n }\n }\n // Typing a format separator (/, :, -, ., space) jumps to the next\n // segment, skipping over the literal punctuation.\n if (e.key.length === 1 && SEPARATOR_RE.test(e.key)) {\n e.preventDefault();\n typedDigitsRef.current = '';\n moveSegment(1);\n return;\n }\n // Digit entry for numeric segments.\n if (/^[0-9]$/.test(e.key) && seg.kind !== 'ampm') {\n e.preventDefault();\n const nextBuffer = typedDigitsRef.current + e.key;\n typedDigitsRef.current = nextBuffer;\n const { date, advance } = setSegmentValue(\n seg,\n base,\n nextBuffer,\n isPm\n );\n if (!advance && isUnfinishedBlocked?.(date)) return;\n applyDateFromSegment(date);\n if (advance) {\n typedDigitsRef.current = '';\n moveSegment(1);\n }\n return;\n }\n }\n }\n // ----- free-form / popover key handling -----\n // With no segment to step, ArrowDown opens the popover with or without\n // Alt, unless the field is read-only or disabled, as focus and the\n // launcher don't open it then either. Alt+ArrowUp closes it.\n if (\n e.key === 'ArrowDown' &&\n !isOpen &&\n popover &&\n !disabled &&\n !readOnly\n ) {\n e.preventDefault();\n setOpen(true);\n return;\n }\n if (e.key === 'ArrowUp' && e.altKey && isOpen) {\n e.preventDefault();\n setOpen(false);\n return;\n }\n if (e.key === 'Escape' && isOpen) {\n e.preventDefault();\n setOpen(false);\n return;\n }\n if (e.key === 'Enter') {\n e.preventDefault();\n // Untouched text has nothing to commit, as on leaving, but Enter\n // still confirms what the field shows.\n if (isUntouched(text)) {\n if (closeOnSelect) setOpen(false);\n } else {\n const parsed = tryParse(text);\n if (parsed && isAllowed(parsed)) {\n commitValue(parsed);\n if (closeOnSelect) setOpen(false);\n }\n }\n }\n onKeyDown?.(e);\n },\n [\n inSegmentMode,\n segmentMap,\n activeSegmentIdx,\n segmentBaseDate,\n applyDateFromSegment,\n isUnfinishedBlocked,\n moveSegment,\n isOpen,\n setOpen,\n closeOnSelect,\n popover,\n disabled,\n readOnly,\n isUntouched,\n tryParse,\n text,\n isAllowed,\n commitValue,\n onKeyDown,\n ]\n );\n\n return {\n segmentMap,\n activeSegmentIdx,\n segmentEditable,\n inSegmentMode,\n inputHandlers: {\n onChange: handleChange,\n onFocus: handleFocus,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onBlur: handleBlur,\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;AAoBA;;;;;AAKG;AACH,MAAM,YAAY,GAAG,WAAW;AA2FhC;;;;;;;;;AASG;AACG,SAAU,iBAAiB,CAC/B,MAA+B,EAAA;AAE/B,IAAA,MAAM,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ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AO;QACP,aAAa;QACb,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,QAAQ;QACR,IAAI;QACJ,SAAS;QACT,WAAW;QACX,SAAS;AACV,KAAA,CACF;IAED,OAAO;QACL,UAAU;QACV,gBAAgB;QAChB,eAAe;QACf,aAAa;AACb,QAAA,aAAa,EAAE;AACb,YAAA,QAAQ,EAAE,YAAY;AACtB,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,SAAS,EAAE,aAAa;AACxB,YAAA,MAAM,EAAE,UAAU;AACnB,SAAA;KACF;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controlLoading.js","sources":["../../../src/form/controlLoading.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n// Whether the nearest enclosing `Control` shows its `isLoading` spinner. The\n// picker bases read it so their right-side launcher gives way to that\n// spinner, which sits at the same edge, whether the `Control` is the one a\n// convenience input renders or one the caller wrapped around the input.\n// Autocomplete reads it for its clear button, which sits there too.\n// Kept apart from `FormContext`, whose contexts only report whether a `Field`\n// or `Control` is present. Internal; not part of the public API.\nconst ControlLoadingContext = createContext(false);\n\n/** Provider for the loading state, used internally by `Control`. */\nexport const ControlLoadingProvider = ControlLoadingContext.Provider;\n\n/** Whether the nearest enclosing `Control` is loading; `false` outside one. */\nexport const useControlLoading = () => useContext(ControlLoadingContext);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controlLoading.js","sources":["../../../src/form/controlLoading.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n// Whether the nearest enclosing `Control` shows its `isLoading` spinner. The\n// picker bases read it so their right-side launcher gives way to that\n// spinner, which sits at the same edge, whether the `Control` is the one a\n// convenience input renders or one the caller wrapped around the input.\n// Autocomplete reads it for its clear button, which sits there too.\n// Kept apart from `FormContext`, whose contexts only report whether a `Field`\n// or `Control` is present. Internal; not part of the public API.\nconst ControlLoadingContext = createContext(false);\n\n/** Provider for the loading state, used internally by `Control`. */\nexport const ControlLoadingProvider = ControlLoadingContext.Provider;\n\n/** Whether the nearest enclosing `Control` is loading; `false` outside one. */\nexport const useControlLoading = () => useContext(ControlLoadingContext);\n"],"names":[],"mappings":";;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,aAAa,CAAC,KAAK,CAAC;AAElD;AACO,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAE5D;AACO,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC,qBAAqB;;"}
|
|
@@ -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 { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
4
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
5
|
import { FieldProvider } from './FormContext.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupFieldset.js","sources":["../../../src/form/groupFieldset.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { FieldProvider } from './FormContext';\nimport type { FormFieldProps } from './fieldProps';\n\ninterface GroupFieldsetProps {\n /** The group's label, rendered as the `<legend>`. */\n label: React.ReactNode;\n /** Sizes the legend's label column when `horizontal`. */\n labelSize?: FormFieldProps['labelSize'];\n /** Props for the element that shows the label; any `htmlFor` is dropped. */\n labelProps?: FormFieldProps['labelProps'];\n /** Puts the legend in the label column and the rest in the body. */\n horizontal?: boolean;\n /** Set on the `<fieldset>` beside its `field` class. */\n fieldClassName?: string;\n /** The group's role, when it isn't the fieldset's own `group`. */\n role?: 'radiogroup';\n /** The group's own attributes: they describe the group, so they go on the `<fieldset>`. */\n attributes: object;\n /** The group's help text, after the content. */\n message: React.ReactNode;\n /** The group's content: its `Control` and the box of choices. */\n children: React.ReactNode;\n}\n\n/**\n * The `Field` a `Checkboxes` or `Radios` with `as=\"fieldset\"` renders of its\n * own, as a native `<fieldset>`: Bulma's field markup, with its label as the\n * `<legend>` (inside the `field-label` column when horizontal), so the legend\n * names the group and needs no id. It holds a `Field`'s place for what is\n * inside, so the choices read as inside a `Field`. Internal; not part of the\n * public API.\n */\nexport const GroupFieldset: React.FC<GroupFieldsetProps> = ({\n label,\n labelSize,\n labelProps,\n horizontal,\n fieldClassName,\n role,\n attributes,\n message,\n children,\n}) => {\n const fieldClass = usePrefixedClassNames('field', {\n 'is-horizontal': !!horizontal,\n });\n const labelClass = usePrefixedClassNames('label');\n const fieldLabelClass = usePrefixedClassNames('field-label', {\n [`is-${labelSize || 'normal'}`]: true,\n });\n const fieldBodyClass = usePrefixedClassNames('field-body');\n\n // A legend names its fieldset with no `for`, so a `htmlFor` has nothing\n // to point at.\n const {\n htmlFor: _htmlFor,\n className: labelClassName,\n ...ownLabelProps\n } = labelProps ?? {};\n void _htmlFor;\n const shownLabel = {\n ...ownLabelProps,\n className: classNames(labelClass, labelClassName as string | undefined),\n } as React.HTMLAttributes<HTMLElement>;\n\n let legend: React.ReactNode = null;\n if (label) {\n legend = horizontal ? (\n <legend className={fieldLabelClass}>\n <span {...shownLabel}>{label}</span>\n </legend>\n ) : (\n <legend {...shownLabel}>{label}</legend>\n );\n }\n\n return (\n <FieldProvider value={true}>\n <fieldset\n className={classNames(fieldClass, fieldClassName)}\n role={role}\n {...attributes}\n >\n {legend}\n {horizontal ? (\n <div className={fieldBodyClass}>\n {children}\n {message}\n </div>\n ) : (\n <>\n {children}\n {message}\n </>\n )}\n </fieldset>\n </FieldProvider>\n );\n};\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"groupFieldset.js","sources":["../../../src/form/groupFieldset.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { FieldProvider } from './FormContext';\nimport type { FormFieldProps } from './fieldProps';\n\ninterface GroupFieldsetProps {\n /** The group's label, rendered as the `<legend>`. */\n label: React.ReactNode;\n /** Sizes the legend's label column when `horizontal`. */\n labelSize?: FormFieldProps['labelSize'];\n /** Props for the element that shows the label; any `htmlFor` is dropped. */\n labelProps?: FormFieldProps['labelProps'];\n /** Puts the legend in the label column and the rest in the body. */\n horizontal?: boolean;\n /** Set on the `<fieldset>` beside its `field` class. */\n fieldClassName?: string;\n /** The group's role, when it isn't the fieldset's own `group`. */\n role?: 'radiogroup';\n /** The group's own attributes: they describe the group, so they go on the `<fieldset>`. */\n attributes: object;\n /** The group's help text, after the content. */\n message: React.ReactNode;\n /** The group's content: its `Control` and the box of choices. */\n children: React.ReactNode;\n}\n\n/**\n * The `Field` a `Checkboxes` or `Radios` with `as=\"fieldset\"` renders of its\n * own, as a native `<fieldset>`: Bulma's field markup, with its label as the\n * `<legend>` (inside the `field-label` column when horizontal), so the legend\n * names the group and needs no id. It holds a `Field`'s place for what is\n * inside, so the choices read as inside a `Field`. Internal; not part of the\n * public API.\n */\nexport const GroupFieldset: React.FC<GroupFieldsetProps> = ({\n label,\n labelSize,\n labelProps,\n horizontal,\n fieldClassName,\n role,\n attributes,\n message,\n children,\n}) => {\n const fieldClass = usePrefixedClassNames('field', {\n 'is-horizontal': !!horizontal,\n });\n const labelClass = usePrefixedClassNames('label');\n const fieldLabelClass = usePrefixedClassNames('field-label', {\n [`is-${labelSize || 'normal'}`]: true,\n });\n const fieldBodyClass = usePrefixedClassNames('field-body');\n\n // A legend names its fieldset with no `for`, so a `htmlFor` has nothing\n // to point at.\n const {\n htmlFor: _htmlFor,\n className: labelClassName,\n ...ownLabelProps\n } = labelProps ?? {};\n void _htmlFor;\n const shownLabel = {\n ...ownLabelProps,\n className: classNames(labelClass, labelClassName as string | undefined),\n } as React.HTMLAttributes<HTMLElement>;\n\n let legend: React.ReactNode = null;\n if (label) {\n legend = horizontal ? (\n <legend className={fieldLabelClass}>\n <span {...shownLabel}>{label}</span>\n </legend>\n ) : (\n <legend {...shownLabel}>{label}</legend>\n );\n }\n\n return (\n <FieldProvider value={true}>\n <fieldset\n className={classNames(fieldClass, fieldClassName)}\n role={role}\n {...attributes}\n >\n {legend}\n {horizontal ? (\n <div className={fieldBodyClass}>\n {children}\n {message}\n </div>\n ) : (\n <>\n {children}\n {message}\n </>\n )}\n </fieldset>\n </FieldProvider>\n );\n};\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;AA0BA;;;;;;;AAOG;AACI,MAAM,aAAa,GAAiC,CAAC,EAC1D,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,IAAI,EACJ,UAAU,EACV,OAAO,EACP,QAAQ,GACT,KAAI;AACH,IAAA,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,EAAE;QAChD,eAAe,EAAE,CAAC,CAAC,UAAU;AAC9B,KAAA,CAAC;AACF,IAAA,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC;AACjD,IAAA,MAAM,eAAe,GAAG,qBAAqB,CAAC,aAAa,EAAE;AAC3D,QAAA,CAAC,MAAM,SAAS,IAAI,QAAQ,CAAA,CAAE,GAAG,IAAI;AACtC,KAAA,CAAC;AACF,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,YAAY,CAAC;;;AAI1D,IAAA,MAAM,EACJ,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAE,cAAc,EACzB,GAAG,aAAa,EACjB,GAAG,UAAU,IAAI,EAAE;AAEpB,IAAA,MAAM,UAAU,GAAG;AACjB,QAAA,GAAG,aAAa;AAChB,QAAA,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,cAAoC,CAAC;KACnC;IAEtC,IAAI,MAAM,GAAoB,IAAI;IAClC,IAAI,KAAK,EAAE;AACT,QAAA,MAAM,GAAG,UAAU,IACjBA,GAAA,CAAA,QAAA,EAAA,EAAQ,SAAS,EAAE,eAAe,EAAA,QAAA,EAChCA,GAAA,CAAA,MAAA,EAAA,EAAA,GAAU,UAAU,EAAA,QAAA,EAAG,KAAK,EAAA,CAAQ,EAAA,CAC7B,KAETA,GAAA,CAAA,QAAA,EAAA,EAAA,GAAY,UAAU,EAAA,QAAA,EAAG,KAAK,EAAA,CAAU,CACzC;IACH;IAEA,QACEA,GAAA,CAAC,aAAa,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACxBC,IAAA,CAAA,UAAA,EAAA,EACE,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,cAAc,CAAC,EACjD,IAAI,EAAE,IAAI,EAAA,GACN,UAAU,EAAA,QAAA,EAAA,CAEb,MAAM,EACN,UAAU,IACTA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,cAAc,EAAA,QAAA,EAAA,CAC3B,QAAQ,EACR,OAAO,CAAA,EAAA,CACJ,KAENA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,QAAQ,EACR,OAAO,CAAA,EAAA,CACP,CACJ,CAAA,EAAA,CACQ,EAAA,CACG;AAEpB;;"}
|
|
@@ -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 { useId } from 'react';
|
|
3
4
|
import { useFieldLabelId, useFieldLabelFor, useReportFieldLabelFor, useFieldLabelElementId } from './FormContext.js';
|
|
4
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoLabelId.js","sources":["../../../src/form/useAutoLabelId.ts"],"sourcesContent":["import React, { useId } from 'react';\nimport type { FieldProps } from './Field';\nimport {\n useFieldLabelElementId,\n useFieldLabelFor,\n useFieldLabelId,\n useReportFieldLabelFor,\n} from './FormContext';\n\ninterface UseAutoLabelIdOptions {\n /** The convenience `label` prop as passed by the caller. */\n label: React.ReactNode;\n /** User-supplied id for the control, if any. */\n id?: string;\n /** User-supplied labelProps, if any. */\n labelProps?: FieldProps['labelProps'];\n /**\n * True when this render actually outputs the label wired to a control —\n * false inside an outer Field (label is dropped), in variants that render\n * no Field, and in modes with no labellable control (e.g. inline pickers).\n */\n rendersLabel: boolean;\n /**\n * False when this render has no input to label at all (an inline picker),\n * so it takes no id from a surrounding Field either. Defaults to true.\n */\n hasInput?: boolean;\n /**\n * True when the control also points `aria-labelledby` at the label, as a\n * range Slider's thumbs (#981), Autocomplete's and Taginput's suggestion\n * lists (#998, #1082) and Combobox's list (#1083) do, so it needs the\n * label's own id. Its own label then gets one\n * (`labelProps.id` when given, otherwise a generated one), and the hook\n * returns it, or a surrounding Field's, as `labelId`.\n */\n needsLabelId?: boolean;\n}\n\n/**\n * Associates the convenience `label` prop with its control (#368): generates\n * an id for the control and returns labelProps carrying a matching `htmlFor`.\n * A user-supplied `id` is used as the target instead of the generated one, and\n * an explicit `htmlFor` key in labelProps — even set to `undefined` — disables\n * generation entirely: the user has taken over the association (#495 presence\n * semantics). When the control renders no label of its own, it adopts the id\n * a labeled Field around it offers, the way the bases do, so that Field's\n * label names it (#939); a user `id` still wins there. It tells that Field\n * when the control took its id, since the Field's label drops a `for`\n * nothing took (#1004). With `needsLabelId` it also returns the id of\n * whichever label names the control (#981).\n * Internal; not part of the public API.\n */\nexport function useAutoLabelId({\n label,\n id,\n labelProps,\n rendersLabel,\n hasInput = true,\n needsLabelId = false,\n}: UseAutoLabelIdOptions): {\n controlId: string | undefined;\n fieldLabelProps: FieldProps['labelProps'] | undefined;\n /** Whether a rendered label, its own or a surrounding Field's, points at `controlId`. */\n labelled: boolean;\n /**\n * With `needsLabelId`, the id of the label that names `controlId`, its own\n * or a surrounding Field's. Undefined when no label names it, or when a\n * Field's label wired by hand names it without an `id` in its labelProps,\n * since the Field generates none for a label wired by hand.\n */\n labelId: string | undefined;\n} {\n // Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.\n const generatedId = useId();\n // Read outside the control's own Field, so it is set only when an outer\n // Field holds the control, which then renders no label of its own.\n const fieldLabelId = useFieldLabelId();\n // What an outer Field's label points at, even when wired by hand, and the\n // id that label renders with, read together so the id is that label's.\n // Set in `grouped`/`hasAddons` Fields too when the label is wired by hand,\n // since its `for` names this one control whatever the layout (see Field).\n const fieldLabelFor = useFieldLabelFor();\n // Truthiness mirrors Field's own `if (label)` render gate.\n const active = !!label && rendersLabel;\n // Presence, not truthiness: `htmlFor: undefined` is an explicit opt-out and\n // must not leave an orphan generated id on the control.\n const userWired = !!labelProps && 'htmlFor' in labelProps;\n const adopted = !active && hasInput ? fieldLabelId : undefined;\n const controlId = id ?? (active && !userWired ? generatedId : adopted);\n // Tells a labeled Field around the control when its label's `for` names\n // the control, since it drops a `for` nothing took (#1004).\n useReportFieldLabelFor(\n fieldLabelId !== undefined && controlId === fieldLabelId\n );\n const ownLabelProps = { htmlFor: controlId, ...labelProps };\n const labelTarget = active ? ownLabelProps.htmlFor : fieldLabelFor.htmlFor;\n const labelled = !!controlId && labelTarget === controlId;\n // Only a label that names the control gets an id to point at, with the\n // suffix Field gives its own, from an id that is already unique.\n const ownLabelId =\n needsLabelId && active && labelled\n ? (labelProps?.id ?? `${generatedId}-label`)\n : undefined;\n // Inactive with a label still means an own Field may render it (pickers'\n // inline mode). The explicit `htmlFor: undefined` tells Field the\n // association is owned here, so it must not generate one that would\n // dangle (#495 presence semantics).\n const fieldLabelProps = active\n ? ownLabelId\n ? { ...ownLabelProps, id: ownLabelId }\n : ownLabelProps\n : label\n ? { htmlFor: undefined, ...labelProps }\n : labelProps;\n const labelId =\n needsLabelId && labelled\n ? active\n ? ownLabelId\n : fieldLabelFor.id\n : undefined;\n return { controlId, fieldLabelProps, labelled, labelId };\n}\n\ninterface UseAutoLabelledByOptions {\n /** The convenience `label` prop as passed by the caller. */\n label: React.ReactNode;\n /** User-supplied labelProps, if any. */\n labelProps?: FieldProps['labelProps'];\n /** True when this render actually outputs the label naming the group. */\n rendersLabel: boolean;\n /**\n * The caller's remaining props. A non-empty `aria-label` among them names\n * the group, and so does any `aria-labelledby` key, even an undefined one,\n * since the group spreads them after its own attribute. Either keeps every\n * label off the group, its own and a surrounding Field's alike.\n */\n callerProps: object;\n}\n\n/**\n * Group-input counterpart of {@link useAutoLabelId} (#494): a group of\n * controls cannot take a single `htmlFor`, so instead the rendered `<label>`\n * gets a generated id and the group container points at it with\n * `aria-labelledby`. A user-supplied `labelProps.id` is used as the target\n * instead of generating one. Any caller `htmlFor` is stripped — a group label\n * names the group, never a single control — so the merged labelProps always\n * carry an explicit `htmlFor: undefined`. When the group renders no label of\n * its own, it points at the label of a labeled Field around it instead\n * (#939). A caller who named the group with `aria-label` or\n * `aria-labelledby` gets no `aria-labelledby` from either label, so their\n * name wins wherever the label sits.\n * Internal; not part of the public API.\n */\nexport function useAutoLabelledBy({\n label,\n labelProps,\n rendersLabel,\n callerProps,\n}: UseAutoLabelledByOptions): {\n ariaLabelledBy: string | undefined;\n fieldLabelProps: FieldProps['labelProps'] | undefined;\n} {\n // Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.\n const generatedId = useId();\n // Set only when an outer Field holds the group (see useAutoLabelId).\n const fieldLabelElementId = useFieldLabelElementId();\n const active = !!label && rendersLabel;\n const labelId = labelProps?.id ?? (active ? generatedId : undefined);\n const fieldLabelProps = active\n ? { ...labelProps, id: labelId, htmlFor: undefined }\n : labelProps;\n const aria = callerProps as React.AriaAttributes;\n // Presence for aria-labelledby: the caller's key replaces the attribute\n // through the spread whatever its value, and pointing it at a label would\n // only take a Rate's fallback name away. Checked before either label, so\n // the caller's name wins over the group's own `label` as it does over a\n // Field's, the way an aria-label beats a `<label for>` on a single input.\n const callerNamed = !!aria['aria-label'] || 'aria-labelledby' in aria;\n const ariaLabelledBy = callerNamed\n ? undefined\n : active\n ? labelId\n : fieldLabelElementId;\n return { ariaLabelledBy, fieldLabelProps };\n}\n"],"names":[],"mappings":";;;;AAsCA;;;;;;;;;;;;;AAaG;SACa,cAAc,CAAC,EAC7B,KAAK,EACL,EAAE,EACF,UAAU,EACV,Y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E,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC1D;AAkBA;;;;;;;;;;;;;AAaG;AACG,SAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,YAAY,EACZ,WAAW,GACc,EAAA;;AAKzB,IAAA,MAAM,WAAW,GAAG,KAAK,EAAE;;AAE3B,IAAA,MAAM,mBAAmB,GAAG,sBAAsB,EAAE;AACpD,IAAA,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,YAAY;AACtC,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,EAAE,KAAK,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IACpE,MAAM,eAAe,GAAG;AACtB,UAAE,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS;UAChD,UAAU;IACd,MAAM,IAAI,GAAG,WAAmC;;;;;;AAMhD,IAAA,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,iBAAiB,IAAI,IAAI;IACrE,MAAM,cAAc,GAAG;AACrB,UAAE;AACF,UAAE;AACA,cAAE;cACA,mBAAmB;AACzB,IAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE;AAC5C;;"}
|
|
1
|
+
{"version":3,"file":"useAutoLabelId.js","sources":["../../../src/form/useAutoLabelId.ts"],"sourcesContent":["import React, { useId } from 'react';\nimport type { FieldProps } from './Field';\nimport {\n useFieldLabelElementId,\n useFieldLabelFor,\n useFieldLabelId,\n useReportFieldLabelFor,\n} from './FormContext';\n\ninterface UseAutoLabelIdOptions {\n /** The convenience `label` prop as passed by the caller. */\n label: React.ReactNode;\n /** User-supplied id for the control, if any. */\n id?: string;\n /** User-supplied labelProps, if any. */\n labelProps?: FieldProps['labelProps'];\n /**\n * True when this render actually outputs the label wired to a control —\n * false inside an outer Field (label is dropped), in variants that render\n * no Field, and in modes with no labellable control (e.g. inline pickers).\n */\n rendersLabel: boolean;\n /**\n * False when this render has no input to label at all (an inline picker),\n * so it takes no id from a surrounding Field either. Defaults to true.\n */\n hasInput?: boolean;\n /**\n * True when the control also points `aria-labelledby` at the label, as a\n * range Slider's thumbs (#981), Autocomplete's and Taginput's suggestion\n * lists (#998, #1082) and Combobox's list (#1083) do, so it needs the\n * label's own id. Its own label then gets one\n * (`labelProps.id` when given, otherwise a generated one), and the hook\n * returns it, or a surrounding Field's, as `labelId`.\n */\n needsLabelId?: boolean;\n}\n\n/**\n * Associates the convenience `label` prop with its control (#368): generates\n * an id for the control and returns labelProps carrying a matching `htmlFor`.\n * A user-supplied `id` is used as the target instead of the generated one, and\n * an explicit `htmlFor` key in labelProps — even set to `undefined` — disables\n * generation entirely: the user has taken over the association (#495 presence\n * semantics). When the control renders no label of its own, it adopts the id\n * a labeled Field around it offers, the way the bases do, so that Field's\n * label names it (#939); a user `id` still wins there. It tells that Field\n * when the control took its id, since the Field's label drops a `for`\n * nothing took (#1004). With `needsLabelId` it also returns the id of\n * whichever label names the control (#981).\n * Internal; not part of the public API.\n */\nexport function useAutoLabelId({\n label,\n id,\n labelProps,\n rendersLabel,\n hasInput = true,\n needsLabelId = false,\n}: UseAutoLabelIdOptions): {\n controlId: string | undefined;\n fieldLabelProps: FieldProps['labelProps'] | undefined;\n /** Whether a rendered label, its own or a surrounding Field's, points at `controlId`. */\n labelled: boolean;\n /**\n * With `needsLabelId`, the id of the label that names `controlId`, its own\n * or a surrounding Field's. Undefined when no label names it, or when a\n * Field's label wired by hand names it without an `id` in its labelProps,\n * since the Field generates none for a label wired by hand.\n */\n labelId: string | undefined;\n} {\n // Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.\n const generatedId = useId();\n // Read outside the control's own Field, so it is set only when an outer\n // Field holds the control, which then renders no label of its own.\n const fieldLabelId = useFieldLabelId();\n // What an outer Field's label points at, even when wired by hand, and the\n // id that label renders with, read together so the id is that label's.\n // Set in `grouped`/`hasAddons` Fields too when the label is wired by hand,\n // since its `for` names this one control whatever the layout (see Field).\n const fieldLabelFor = useFieldLabelFor();\n // Truthiness mirrors Field's own `if (label)` render gate.\n const active = !!label && rendersLabel;\n // Presence, not truthiness: `htmlFor: undefined` is an explicit opt-out and\n // must not leave an orphan generated id on the control.\n const userWired = !!labelProps && 'htmlFor' in labelProps;\n const adopted = !active && hasInput ? fieldLabelId : undefined;\n const controlId = id ?? (active && !userWired ? generatedId : adopted);\n // Tells a labeled Field around the control when its label's `for` names\n // the control, since it drops a `for` nothing took (#1004).\n useReportFieldLabelFor(\n fieldLabelId !== undefined && controlId === fieldLabelId\n );\n const ownLabelProps = { htmlFor: controlId, ...labelProps };\n const labelTarget = active ? ownLabelProps.htmlFor : fieldLabelFor.htmlFor;\n const labelled = !!controlId && labelTarget === controlId;\n // Only a label that names the control gets an id to point at, with the\n // suffix Field gives its own, from an id that is already unique.\n const ownLabelId =\n needsLabelId && active && labelled\n ? (labelProps?.id ?? `${generatedId}-label`)\n : undefined;\n // Inactive with a label still means an own Field may render it (pickers'\n // inline mode). The explicit `htmlFor: undefined` tells Field the\n // association is owned here, so it must not generate one that would\n // dangle (#495 presence semantics).\n const fieldLabelProps = active\n ? ownLabelId\n ? { ...ownLabelProps, id: ownLabelId }\n : ownLabelProps\n : label\n ? { htmlFor: undefined, ...labelProps }\n : labelProps;\n const labelId =\n needsLabelId && labelled\n ? active\n ? ownLabelId\n : fieldLabelFor.id\n : undefined;\n return { controlId, fieldLabelProps, labelled, labelId };\n}\n\ninterface UseAutoLabelledByOptions {\n /** The convenience `label` prop as passed by the caller. */\n label: React.ReactNode;\n /** User-supplied labelProps, if any. */\n labelProps?: FieldProps['labelProps'];\n /** True when this render actually outputs the label naming the group. */\n rendersLabel: boolean;\n /**\n * The caller's remaining props. A non-empty `aria-label` among them names\n * the group, and so does any `aria-labelledby` key, even an undefined one,\n * since the group spreads them after its own attribute. Either keeps every\n * label off the group, its own and a surrounding Field's alike.\n */\n callerProps: object;\n}\n\n/**\n * Group-input counterpart of {@link useAutoLabelId} (#494): a group of\n * controls cannot take a single `htmlFor`, so instead the rendered `<label>`\n * gets a generated id and the group container points at it with\n * `aria-labelledby`. A user-supplied `labelProps.id` is used as the target\n * instead of generating one. Any caller `htmlFor` is stripped — a group label\n * names the group, never a single control — so the merged labelProps always\n * carry an explicit `htmlFor: undefined`. When the group renders no label of\n * its own, it points at the label of a labeled Field around it instead\n * (#939). A caller who named the group with `aria-label` or\n * `aria-labelledby` gets no `aria-labelledby` from either label, so their\n * name wins wherever the label sits.\n * Internal; not part of the public API.\n */\nexport function useAutoLabelledBy({\n label,\n labelProps,\n rendersLabel,\n callerProps,\n}: UseAutoLabelledByOptions): {\n ariaLabelledBy: string | undefined;\n fieldLabelProps: FieldProps['labelProps'] | undefined;\n} {\n // Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.\n const generatedId = useId();\n // Set only when an outer Field holds the group (see useAutoLabelId).\n const fieldLabelElementId = useFieldLabelElementId();\n const active = !!label && rendersLabel;\n const labelId = labelProps?.id ?? (active ? generatedId : undefined);\n const fieldLabelProps = active\n ? { ...labelProps, id: labelId, htmlFor: undefined }\n : labelProps;\n const aria = callerProps as React.AriaAttributes;\n // Presence for aria-labelledby: the caller's key replaces the attribute\n // through the spread whatever its value, and pointing it at a label would\n // only take a Rate's fallback name away. Checked before either label, so\n // the caller's name wins over the group's own `label` as it does over a\n // Field's, the way an aria-label beats a `<label for>` on a single input.\n const callerNamed = !!aria['aria-label'] || 'aria-labelledby' in aria;\n const ariaLabelledBy = callerNamed\n ? undefined\n : active\n ? labelId\n : fieldLabelElementId;\n return { ariaLabelledBy, fieldLabelProps };\n}\n"],"names":[],"mappings":";;;;;AAsCA;;;;;;;;;;;;;AAaG;SACa,cAAc,CAAC,EAC7B,KAAK,EACL,EAAE,EACF,UAAU,EACV,YAAY,EACZ,QAAQ,GAAG,IAAI,EACf,YAAY,GAAG,KAAK,GACE,EAAA;;AActB,IAAA,MAAM,WAAW,GAAG,KAAK,EAAE;;;AAG3B,IAAA,MAAM,YAAY,GA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Z,WAAW,GACc,EAAA;;AAKzB,IAAA,MAAM,WAAW,GAAG,KAAK,EAAE;;AAE3B,IAAA,MAAM,mBAAmB,GAAG,sBAAsB,EAAE;AACpD,IAAA,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,YAAY;AACtC,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,EAAE,KAAK,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IACpE,MAAM,eAAe,GAAG;AACtB,UAAE,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS;UAChD,UAAU;IACd,MAAM,IAAI,GAAG,WAAmC;;;;;;AAMhD,IAAA,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,iBAAiB,IAAI,IAAI;IACrE,MAAM,cAAc,GAAG;AACrB,UAAE;AACF,UAAE;AACA,cAAE;cACA,mBAAmB;AACzB,IAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE;AAC5C;;"}
|
package/dist/esm/grid/Cell.js
CHANGED
|
@@ -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 { jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
5
|
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.js","sources":["../../../src/grid/Cell.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Type for grid cell span values.\n */\nexport type CellSpanValue = number;\n\n/**\n * Props for the Cell component.\n */\nexport interface CellProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Which column the cell starts at (Bulma: `is-col-start-x`). */\n colStart?: number;\n /** Which column the cell ends at, counting from the end (Bulma: `is-col-from-end-x`). */\n colFromEnd?: number;\n /** How many columns the cell will span (Bulma: `is-col-span-x`). */\n colSpan?: CellSpanValue;\n /** Which row the cell starts at (Bulma: `is-row-start-x`). */\n rowStart?: number;\n /** Which row the cell ends at, counting from the end (Bulma: `is-row-from-end-x`). */\n rowFromEnd?: number;\n /** How many rows the cell will span (Bulma: `is-row-span-x`). */\n rowSpan?: CellSpanValue;\n /** Additional CSS class names. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the cell. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the cell. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Cell` component provides a single Bulma grid cell for use inside the [`Grid`](./grid.md) component.\n *\n * @function\n * @param {CellProps} props - Props for the Cell component.\n * @returns {JSX.Element} The rendered grid cell.\n * @see {@link https://bulma.io/documentation/grid/ | Bulma Grid documentation}\n */\nexport const Cell: React.FC<CellProps> = ({\n colStart,\n colFromEnd,\n colSpan,\n rowStart,\n rowFromEnd,\n rowSpan,\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('cell');\n\n // Build cell grid classes with prefixes\n const cellGridClasses = usePrefixedClassNames('', {\n [`is-col-start-${colStart}`]: colStart !== undefined && colStart !== null,\n [`is-col-from-end-${colFromEnd}`]:\n colFromEnd !== undefined && colFromEnd !== null,\n [`is-col-span-${colSpan}`]: colSpan !== undefined && colSpan !== null,\n [`is-row-start-${rowStart}`]: rowStart !== undefined && rowStart !== null,\n [`is-row-from-end-${rowFromEnd}`]:\n rowFromEnd !== undefined && rowFromEnd !== null,\n [`is-row-span-${rowSpan}`]: rowSpan !== undefined && rowSpan !== null,\n });\n\n const cellClasses = classNames(\n mainClass,\n cellGridClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={cellClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cell.js","sources":["../../../src/grid/Cell.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Type for grid cell span values.\n */\nexport type CellSpanValue = number;\n\n/**\n * Props for the Cell component.\n */\nexport interface CellProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Which column the cell starts at (Bulma: `is-col-start-x`). */\n colStart?: number;\n /** Which column the cell ends at, counting from the end (Bulma: `is-col-from-end-x`). */\n colFromEnd?: number;\n /** How many columns the cell will span (Bulma: `is-col-span-x`). */\n colSpan?: CellSpanValue;\n /** Which row the cell starts at (Bulma: `is-row-start-x`). */\n rowStart?: number;\n /** Which row the cell ends at, counting from the end (Bulma: `is-row-from-end-x`). */\n rowFromEnd?: number;\n /** How many rows the cell will span (Bulma: `is-row-span-x`). */\n rowSpan?: CellSpanValue;\n /** Additional CSS class names. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the cell. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the cell. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Cell` component provides a single Bulma grid cell for use inside the [`Grid`](./grid.md) component.\n *\n * @function\n * @param {CellProps} props - Props for the Cell component.\n * @returns {JSX.Element} The rendered grid cell.\n * @see {@link https://bulma.io/documentation/grid/ | Bulma Grid documentation}\n */\nexport const Cell: React.FC<CellProps> = ({\n colStart,\n colFromEnd,\n colSpan,\n rowStart,\n rowFromEnd,\n rowSpan,\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('cell');\n\n // Build cell grid classes with prefixes\n const cellGridClasses = usePrefixedClassNames('', {\n [`is-col-start-${colStart}`]: colStart !== undefined && colStart !== null,\n [`is-col-from-end-${colFromEnd}`]:\n colFromEnd !== undefined && colFromEnd !== null,\n [`is-col-span-${colSpan}`]: colSpan !== undefined && colSpan !== null,\n [`is-row-start-${rowStart}`]: rowStart !== undefined && rowStart !== null,\n [`is-row-from-end-${rowFromEnd}`]:\n rowFromEnd !== undefined && rowFromEnd !== null,\n [`is-row-span-${rowSpan}`]: rowSpan !== undefined && rowSpan !== null,\n });\n\n const cellClasses = classNames(\n mainClass,\n cellGridClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={cellClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AA4CA;;;;;;;AAOG;AACI,MAAM,IAAI,GAAwB,CAAC,EACxC,QAAQ,EACR,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,KAAK,EAAE,WAAW,EAClB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC;;AAG/C,IAAA,MAAM,eAAe,GAAG,qBAAqB,CAAC,EAAE,EAAE;QAChD,CAAC,CAAA,aAAA,EAAgB,QAAQ,CAAA,CAAE,GAAG,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI;QACzE,CAAC,CAAA,gBAAA,EAAmB,UAAU,CAAA,CAAE,GAC9B,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI;QACjD,CAAC,CAAA,YAAA,EAAe,OAAO,CAAA,CAAE,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI;QACrE,CAAC,CAAA,aAAA,EAAgB,QAAQ,CAAA,CAAE,GAAG,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI;QACzE,CAAC,CAAA,gBAAA,EAAmB,UAAU,CAAA,CAAE,GAC9B,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI;QACjD,CAAC,CAAA,YAAA,EAAe,OAAO,CAAA,CAAE,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI;AACtE,KAAA,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,EACT,eAAe,EACf,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,WAAW,EAAA,GAAM,IAAI,EAAA,QAAA,EAClC,QAAQ,EAAA,CACL;AAEV;;"}
|
package/dist/esm/grid/Grid.js
CHANGED
|
@@ -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 { jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
5
|
import { withSubComponents } from '../helpers/withSubComponents.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sources":["../../../src/grid/Grid.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Cell } from './Cell';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport type { BulmaGapStep } from '../helpers/bulmaClassHelpers';\n\n/**\n * The whole steps of Bulma's 0-8 gap scale, as `Columns` takes them. Accepts\n * the value as a number or a numeric string.\n *\n * `Grid`'s gap props and the shared `gap`, `columnGap` and `rowGap` helper\n * props take the half steps as well, as `BulmaGapStep`.\n */\nexport type BulmaGapValue =\n | 0\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | '0'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8';\n/**\n * Allowed minimum column values for Bulma grid.\n */\nexport type BulmaMinColValue =\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | 9\n | 10\n | 11\n | 12\n | 13\n | 14\n | 15\n | 16\n | 17\n | 18\n | 19\n | 20\n | 21\n | 22\n | 23\n | 24\n | 25\n | 26\n | 27\n | 28\n | 29\n | 30\n | 31\n | 32;\n/**\n * Allowed fixed grid columns for Bulma grid.\n */\nexport type BulmaFixedGridCols =\n 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n/**\n * Allowed fixed grid columns prop for Bulma grid.\n */\nexport type BulmaFixedGridColsProp = BulmaFixedGridCols | 'auto';\n\n/**\n * Props for the Grid component.\n */\nexport interface GridProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Use a fixed grid layout (`.fixed-grid > .grid`). */\n isFixed?: boolean;\n /**\n * Main gap for grid (Bulma `is-gap-X`), a whole or half step of Bulma's gap\n * scale. The same values and class as the `gap` helper prop on every other\n * component.\n */\n gap?: BulmaGapStep;\n /** Column gap for grid (`is-column-gap-X`), on the same scale as `gap`. */\n columnGap?: BulmaGapStep;\n /** Row gap for grid (`is-row-gap-X`), on the same scale as `gap`. */\n rowGap?: BulmaGapStep;\n /** Minimum column width for the grid (`is-col-min-X`). */\n minCol?: BulmaMinColValue;\n /** For fixed grids: explicit column count (`has-X-cols`), or `'auto'` for auto-count. */\n fixedCols?: BulmaFixedGridColsProp;\n /** For fixed grids: explicit column count for mobile. */\n fixedColsMobile?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for tablet. */\n fixedColsTablet?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for desktop. */\n fixedColsDesktop?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for widescreen. */\n fixedColsWidescreen?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for fullhd. */\n fixedColsFullhd?: BulmaFixedGridCols;\n /** Additional CSS classes for the grid. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the grid. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Children to render inside the grid (usually `Cell` components). */\n children?: React.ReactNode;\n}\n\n/**\n * The `Grid` component provides Bulma's advanced CSS Grid layout for complex, modern layouts.\n *\n * @function\n * @param {GridProps} props - Props for the Grid component.\n * @returns {JSX.Element} The rendered grid.\n * @see {@link https://bulma.io/documentation/grid/ | Bulma Grid documentation}\n */\nconst GridComponent: React.FC<GridProps> = ({\n isFixed = false,\n gap,\n columnGap,\n rowGap,\n minCol,\n fixedCols,\n fixedColsMobile,\n fixedColsTablet,\n fixedColsDesktop,\n fixedColsWidescreen,\n fixedColsFullhd,\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n children,\n ...props\n}) => {\n // Map textColor and bgColor to color and backgroundColor for useBulmaClasses\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('grid');\n\n // Build grid inner classes with prefixes\n const gridInnerClasses = usePrefixedClassNames('', {\n [`is-gap-${gap}`]: gap !== undefined && gap !== null,\n [`is-column-gap-${columnGap}`]:\n columnGap !== undefined && columnGap !== null,\n [`is-row-gap-${rowGap}`]: rowGap !== undefined && rowGap !== null,\n [`is-col-min-${minCol}`]: minCol !== undefined && minCol !== null,\n });\n\n // Build fixed grid classes with prefixes (always called, used conditionally)\n const fixedGridClasses = usePrefixedClassNames('fixed-grid', {\n 'has-auto-count': fixedCols === 'auto',\n [`has-${fixedCols}-cols`]: fixedCols !== undefined && fixedCols !== 'auto',\n [`has-${fixedColsMobile}-cols-mobile`]:\n fixedColsMobile !== undefined && fixedColsMobile !== null,\n [`has-${fixedColsTablet}-cols-tablet`]:\n fixedColsTablet !== undefined && fixedColsTablet !== null,\n [`has-${fixedColsDesktop}-cols-desktop`]:\n fixedColsDesktop !== undefined && fixedColsDesktop !== null,\n [`has-${fixedColsWidescreen}-cols-widescreen`]:\n fixedColsWidescreen !== undefined && fixedColsWidescreen !== null,\n [`has-${fixedColsFullhd}-cols-fullhd`]:\n fixedColsFullhd !== undefined && fixedColsFullhd !== null,\n });\n\n const gridClasses = classNames(\n mainClass,\n gridInnerClasses,\n bulmaHelperClasses,\n className\n );\n\n if (isFixed) {\n return (\n <div className={fixedGridClasses}>\n <div className={gridClasses} {...rest}>\n {children}\n </div>\n </div>\n );\n }\n\n // Standard Bulma grid (not fixed)\n return (\n <div className={gridClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Grid = withSubComponents(GridComponent, { Cell }, 'Grid');\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Grid.js","sources":["../../../src/grid/Grid.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Cell } from './Cell';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport type { BulmaGapStep } from '../helpers/bulmaClassHelpers';\n\n/**\n * The whole steps of Bulma's 0-8 gap scale, as `Columns` takes them. Accepts\n * the value as a number or a numeric string.\n *\n * `Grid`'s gap props and the shared `gap`, `columnGap` and `rowGap` helper\n * props take the half steps as well, as `BulmaGapStep`.\n */\nexport type BulmaGapValue =\n | 0\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | '0'\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8';\n/**\n * Allowed minimum column values for Bulma grid.\n */\nexport type BulmaMinColValue =\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | 9\n | 10\n | 11\n | 12\n | 13\n | 14\n | 15\n | 16\n | 17\n | 18\n | 19\n | 20\n | 21\n | 22\n | 23\n | 24\n | 25\n | 26\n | 27\n | 28\n | 29\n | 30\n | 31\n | 32;\n/**\n * Allowed fixed grid columns for Bulma grid.\n */\nexport type BulmaFixedGridCols =\n 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n/**\n * Allowed fixed grid columns prop for Bulma grid.\n */\nexport type BulmaFixedGridColsProp = BulmaFixedGridCols | 'auto';\n\n/**\n * Props for the Grid component.\n */\nexport interface GridProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Use a fixed grid layout (`.fixed-grid > .grid`). */\n isFixed?: boolean;\n /**\n * Main gap for grid (Bulma `is-gap-X`), a whole or half step of Bulma's gap\n * scale. The same values and class as the `gap` helper prop on every other\n * component.\n */\n gap?: BulmaGapStep;\n /** Column gap for grid (`is-column-gap-X`), on the same scale as `gap`. */\n columnGap?: BulmaGapStep;\n /** Row gap for grid (`is-row-gap-X`), on the same scale as `gap`. */\n rowGap?: BulmaGapStep;\n /** Minimum column width for the grid (`is-col-min-X`). */\n minCol?: BulmaMinColValue;\n /** For fixed grids: explicit column count (`has-X-cols`), or `'auto'` for auto-count. */\n fixedCols?: BulmaFixedGridColsProp;\n /** For fixed grids: explicit column count for mobile. */\n fixedColsMobile?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for tablet. */\n fixedColsTablet?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for desktop. */\n fixedColsDesktop?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for widescreen. */\n fixedColsWidescreen?: BulmaFixedGridCols;\n /** For fixed grids: explicit column count for fullhd. */\n fixedColsFullhd?: BulmaFixedGridCols;\n /** Additional CSS classes for the grid. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the grid. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Children to render inside the grid (usually `Cell` components). */\n children?: React.ReactNode;\n}\n\n/**\n * The `Grid` component provides Bulma's advanced CSS Grid layout for complex, modern layouts.\n *\n * @function\n * @param {GridProps} props - Props for the Grid component.\n * @returns {JSX.Element} The rendered grid.\n * @see {@link https://bulma.io/documentation/grid/ | Bulma Grid documentation}\n */\nconst GridComponent: React.FC<GridProps> = ({\n isFixed = false,\n gap,\n columnGap,\n rowGap,\n minCol,\n fixedCols,\n fixedColsMobile,\n fixedColsTablet,\n fixedColsDesktop,\n fixedColsWidescreen,\n fixedColsFullhd,\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n children,\n ...props\n}) => {\n // Map textColor and bgColor to color and backgroundColor for useBulmaClasses\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('grid');\n\n // Build grid inner classes with prefixes\n const gridInnerClasses = usePrefixedClassNames('', {\n [`is-gap-${gap}`]: gap !== undefined && gap !== null,\n [`is-column-gap-${columnGap}`]:\n columnGap !== undefined && columnGap !== null,\n [`is-row-gap-${rowGap}`]: rowGap !== undefined && rowGap !== null,\n [`is-col-min-${minCol}`]: minCol !== undefined && minCol !== null,\n });\n\n // Build fixed grid classes with prefixes (always called, used conditionally)\n const fixedGridClasses = usePrefixedClassNames('fixed-grid', {\n 'has-auto-count': fixedCols === 'auto',\n [`has-${fixedCols}-cols`]: fixedCols !== undefined && fixedCols !== 'auto',\n [`has-${fixedColsMobile}-cols-mobile`]:\n fixedColsMobile !== undefined && fixedColsMobile !== null,\n [`has-${fixedColsTablet}-cols-tablet`]:\n fixedColsTablet !== undefined && fixedColsTablet !== null,\n [`has-${fixedColsDesktop}-cols-desktop`]:\n fixedColsDesktop !== undefined && fixedColsDesktop !== null,\n [`has-${fixedColsWidescreen}-cols-widescreen`]:\n fixedColsWidescreen !== undefined && fixedColsWidescreen !== null,\n [`has-${fixedColsFullhd}-cols-fullhd`]:\n fixedColsFullhd !== undefined && fixedColsFullhd !== null,\n });\n\n const gridClasses = classNames(\n mainClass,\n gridInnerClasses,\n bulmaHelperClasses,\n className\n );\n\n if (isFixed) {\n return (\n <div className={fixedGridClasses}>\n <div className={gridClasses} {...rest}>\n {children}\n </div>\n </div>\n );\n }\n\n // Standard Bulma grid (not fixed)\n return (\n <div className={gridClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Grid = withSubComponents(GridComponent, { Cell }, 'Grid');\n"],"names":["_jsx"],"mappings":";;;;;;;;AAgIA;;;;;;;AAOG;AACH,MAAM,aAAa,GAAwB,CAAC,EAC1C,OAAO,GAAG,KAAK,EACf,GAAG,EACH,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,SAAS,EACT,KAAK,EAAE,WAAW,EAClB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;;AAEH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAA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AK,SAAS,IAAI,mBAAmB,KAAK,IAAI;QACnE,CAAC,CAAA,IAAA,EAAO,eAAe,CAAA,YAAA,CAAc,GACnC,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,IAAI;AAC5D,KAAA,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,CACV;IAED,IAAI,OAAO,EAAE;AACX,QAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,gBAAgB,YAC9BA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,WAAW,KAAM,IAAI,EAAA,QAAA,EAClC,QAAQ,EAAA,CACL,EAAA,CACF;IAEV;;IAGA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,WAAW,EAAA,GAAM,IAAI,EAAA,QAAA,EAClC,QAAQ,EAAA,CACL;AAEV,CAAC;AAEM,MAAM,IAAI,GAAG,iBAAiB,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.js","sources":["../../../src/helpers/ClientOnly.tsx"],"sourcesContent":["import React from 'react';\nimport { useIsHydrated } from './useIsHydrated';\n\n/**\n * Props for the ClientOnly component.\n */\nexport interface ClientOnlyProps {\n /**\n * Content to render once the page has hydrated. A function is called only\n * then, so an inline expression that reads `window`, `document` or\n * `localStorage` never runs on the server.\n */\n children?: React.ReactNode | (() => React.ReactNode);\n /**\n * Rendered on the server and during hydration instead of `children`, such\n * as a placeholder the same size as the content so the layout doesn't\n * shift when it arrives.\n * @defaultValue null\n */\n fallback?: React.ReactNode;\n}\n\n/**\n * Renders its children only in the browser, after hydration, and a `fallback` until then, so content that depends on browser-only state doesn't cause a hydration mismatch.\n *\n * The server render and the hydrating client render both show `fallback`,\n * which keeps them identical; the children replace it in the commit that\n * follows. In an app without server rendering the children show on the first\n * render.\n *\n * @function\n * @param {ClientOnlyProps} props - Props for the ClientOnly component.\n * @returns The children once hydrated, otherwise the fallback.\n *\n * @example\n * // The server's time zone is not the reader's.\n * <ClientOnly fallback={<Skeleton variant=\"lines\" lines={1} />}>\n * {() => (\n * <p>Times are shown in {Intl.DateTimeFormat().resolvedOptions().timeZone}.</p>\n * )}\n * </ClientOnly>\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n const hydrated = useIsHydrated();\n if (!hydrated) return <>{fallback}</>;\n return <>{typeof children === 'function' ? children() : children}</>;\n}\n"],"names":["_jsx","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientOnly.js","sources":["../../../src/helpers/ClientOnly.tsx"],"sourcesContent":["import React from 'react';\nimport { useIsHydrated } from './useIsHydrated';\n\n/**\n * Props for the ClientOnly component.\n */\nexport interface ClientOnlyProps {\n /**\n * Content to render once the page has hydrated. A function is called only\n * then, so an inline expression that reads `window`, `document` or\n * `localStorage` never runs on the server.\n */\n children?: React.ReactNode | (() => React.ReactNode);\n /**\n * Rendered on the server and during hydration instead of `children`, such\n * as a placeholder the same size as the content so the layout doesn't\n * shift when it arrives.\n * @defaultValue null\n */\n fallback?: React.ReactNode;\n}\n\n/**\n * Renders its children only in the browser, after hydration, and a `fallback` until then, so content that depends on browser-only state doesn't cause a hydration mismatch.\n *\n * The server render and the hydrating client render both show `fallback`,\n * which keeps them identical; the children replace it in the commit that\n * follows. In an app without server rendering the children show on the first\n * render.\n *\n * @function\n * @param {ClientOnlyProps} props - Props for the ClientOnly component.\n * @returns The children once hydrated, otherwise the fallback.\n *\n * @example\n * // The server's time zone is not the reader's.\n * <ClientOnly fallback={<Skeleton variant=\"lines\" lines={1} />}>\n * {() => (\n * <p>Times are shown in {Intl.DateTimeFormat().resolvedOptions().timeZone}.</p>\n * )}\n * </ClientOnly>\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n const hydrated = useIsHydrated();\n if (!hydrated) return <>{fallback}</>;\n return <>{typeof children === 'function' ? children() : children}</>;\n}\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;AAsBA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAmB,EAAA;AACvE,IAAA,MAAM,QAAQ,GAAG,aAAa,EAAE;AAChC,IAAA,IAAI,CAAC,QAAQ;QAAE,OAAOA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AACrC,IAAA,OAAOD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,OAAO,QAAQ,KAAK,UAAU,GAAG,QAAQ,EAAE,GAAG,QAAQ,GAAI;AACtE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sources":["../../../src/helpers/Config.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\n\n/** Supported icon library identifiers. */\ntype IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';\n\n/**\n * Shape of the configuration context value.\n */\nexport interface ConfigContextProps {\n /** Prefix applied to all Bulma class names. */\n classPrefix?: string;\n /** Default icon library for Icon components. */\n iconLibrary?: IconLibrary;\n /** Where portaled content goes when it has no target of its own. */\n portalContainer?: string | HTMLElement;\n}\n\nconst ConfigContext = createContext<ConfigContextProps>({});\n\n/**\n * Hook to access the bulma-ui configuration context.\n *\n * @function\n * @returns {ConfigContextProps} The current configuration values.\n */\nexport const useConfig = () => useContext(ConfigContext);\n\n/**\n * Props for the ConfigProvider component.\n */\nexport interface ConfigProviderProps {\n /** Child components to receive configuration. */\n children: ReactNode;\n /** Prefix applied to all Bulma class names. */\n classPrefix?: string;\n /** Default icon library for Icon components. */\n iconLibrary?: IconLibrary;\n /**\n * Where portaled content goes when it has no target of its own: what a\n * `Portal` without a `container` renders, and what the library's components\n * portal, such as Popover's `appendToBody` panel, a `Modal` with `portal`\n * set to `true`, or a `Toast`. An element, or a `document.querySelector`\n * selector. Unset, or a selector that matches nothing, that content goes to\n * `document.body`. A target a component is given, such as a `Toast`'s\n * `container`, still wins, and nothing portals that would otherwise render\n * in place.\n *\n * The overlays and panels this moves are `position: fixed`, so pick an\n * element with no ancestor that has a `transform`, `filter`,\n * `backdrop-filter`, `perspective`, `will-change: transform`, or a\n * `contain` that includes `paint` or `layout`. That ancestor becomes their\n * containing block, and they cover or line up against it instead of the\n * viewport. An ancestor that starts a stacking context, with a `z-index` or\n * `isolation: isolate`, keeps them inside it, under anything the page\n * stacks above it. `NotificationContainer`'s status region moves too, so\n * this also decides where its announcements come from, and an `aria-hidden`\n * ancestor silences them.\n *\n * A selector can't find an element inside a shadow root, so pass the\n * element itself there, held in state from a ref callback. Content that\n * portals before the element is set goes to `document.body` and moves when\n * it is, which remounts it, as `Portal`'s `container` describes.\n */\n portalContainer?: string | HTMLElement;\n}\n\n/**\n * ConfigProvider injects configuration into all child components via React context.\n *\n * A nested provider replaces the outer one's settings rather than adding to\n * them, so inside it any setting it leaves out is back to its default.\n *\n * @function\n * @param {ConfigProviderProps} props - Provider props.\n * @returns {JSX.Element} The context provider wrapping children.\n *\n * @example\n * <ConfigProvider classPrefix=\"my-\" iconLibrary=\"mdi\">\n * <App />\n * </ConfigProvider>\n */\nexport const ConfigProvider: React.FC<ConfigProviderProps> = ({\n classPrefix,\n iconLibrary,\n portalContainer,\n children,\n}) => {\n return (\n <ConfigContext.Provider\n value={{ classPrefix, iconLibrary, portalContainer }}\n >\n {children}\n </ConfigContext.Provider>\n );\n};\n\n/**\n * Utility hook to get the configured class prefix string.\n *\n * @function\n * @returns {string} The class prefix, or empty string if none configured.\n */\nexport const useClassPrefix = () => {\n const { classPrefix } = useConfig();\n return classPrefix || '';\n};\n\n/**\n * Hook that returns a function to prefix a class name with the configured prefix.\n *\n * @function\n * @returns {(className: string) => string} A function that applies the class prefix.\n */\nexport const usePrefixedClass = () => {\n const { classPrefix } = useConfig();\n return (className: string) =>\n classPrefix ? `${classPrefix}${className}` : className;\n};\n\n/**\n * Hook to get the default icon library from configuration.\n *\n * @function\n * @returns {IconLibrary | undefined} The configured icon library, or undefined.\n */\nexport const useIconLibrary = () => {\n const { iconLibrary } = useConfig();\n return iconLibrary;\n};\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Config.js","sources":["../../../src/helpers/Config.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\n\n/** Supported icon library identifiers. */\ntype IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';\n\n/**\n * Shape of the configuration context value.\n */\nexport interface ConfigContextProps {\n /** Prefix applied to all Bulma class names. */\n classPrefix?: string;\n /** Default icon library for Icon components. */\n iconLibrary?: IconLibrary;\n /** Where portaled content goes when it has no target of its own. */\n portalContainer?: string | HTMLElement;\n}\n\nconst ConfigContext = createContext<ConfigContextProps>({});\n\n/**\n * Hook to access the bulma-ui configuration context.\n *\n * @function\n * @returns {ConfigContextProps} The current configuration values.\n */\nexport const useConfig = () => useContext(ConfigContext);\n\n/**\n * Props for the ConfigProvider component.\n */\nexport interface ConfigProviderProps {\n /** Child components to receive configuration. */\n children: ReactNode;\n /** Prefix applied to all Bulma class names. */\n classPrefix?: string;\n /** Default icon library for Icon components. */\n iconLibrary?: IconLibrary;\n /**\n * Where portaled content goes when it has no target of its own: what a\n * `Portal` without a `container` renders, and what the library's components\n * portal, such as Popover's `appendToBody` panel, a `Modal` with `portal`\n * set to `true`, or a `Toast`. An element, or a `document.querySelector`\n * selector. Unset, or a selector that matches nothing, that content goes to\n * `document.body`. A target a component is given, such as a `Toast`'s\n * `container`, still wins, and nothing portals that would otherwise render\n * in place.\n *\n * The overlays and panels this moves are `position: fixed`, so pick an\n * element with no ancestor that has a `transform`, `filter`,\n * `backdrop-filter`, `perspective`, `will-change: transform`, or a\n * `contain` that includes `paint` or `layout`. That ancestor becomes their\n * containing block, and they cover or line up against it instead of the\n * viewport. An ancestor that starts a stacking context, with a `z-index` or\n * `isolation: isolate`, keeps them inside it, under anything the page\n * stacks above it. `NotificationContainer`'s status region moves too, so\n * this also decides where its announcements come from, and an `aria-hidden`\n * ancestor silences them.\n *\n * A selector can't find an element inside a shadow root, so pass the\n * element itself there, held in state from a ref callback. Content that\n * portals before the element is set goes to `document.body` and moves when\n * it is, which remounts it, as `Portal`'s `container` describes.\n */\n portalContainer?: string | HTMLElement;\n}\n\n/**\n * ConfigProvider injects configuration into all child components via React context.\n *\n * A nested provider replaces the outer one's settings rather than adding to\n * them, so inside it any setting it leaves out is back to its default.\n *\n * @function\n * @param {ConfigProviderProps} props - Provider props.\n * @returns {JSX.Element} The context provider wrapping children.\n *\n * @example\n * <ConfigProvider classPrefix=\"my-\" iconLibrary=\"mdi\">\n * <App />\n * </ConfigProvider>\n */\nexport const ConfigProvider: React.FC<ConfigProviderProps> = ({\n classPrefix,\n iconLibrary,\n portalContainer,\n children,\n}) => {\n return (\n <ConfigContext.Provider\n value={{ classPrefix, iconLibrary, portalContainer }}\n >\n {children}\n </ConfigContext.Provider>\n );\n};\n\n/**\n * Utility hook to get the configured class prefix string.\n *\n * @function\n * @returns {string} The class prefix, or empty string if none configured.\n */\nexport const useClassPrefix = () => {\n const { classPrefix } = useConfig();\n return classPrefix || '';\n};\n\n/**\n * Hook that returns a function to prefix a class name with the configured prefix.\n *\n * @function\n * @returns {(className: string) => string} A function that applies the class prefix.\n */\nexport const usePrefixedClass = () => {\n const { classPrefix } = useConfig();\n return (className: string) =>\n classPrefix ? `${classPrefix}${className}` : className;\n};\n\n/**\n * Hook to get the default icon library from configuration.\n *\n * @function\n * @returns {IconLibrary | undefined} The configured icon library, or undefined.\n */\nexport const useIconLibrary = () => {\n const { iconLibrary } = useConfig();\n return iconLibrary;\n};\n"],"names":["_jsx"],"mappings":";;;;;AAiBA,MAAM,aAAa,GAAG,aAAa,CAAqB,EAAE,CAAC;AAE3D;;;;;AAKG;AACI,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,aAAa;AAyCvD;;;;;;;;;;;;;;AAcG;AACI,MAAM,cAAc,GAAkC,CAAC,EAC5D,WAAW,EACX,WAAW,EACX,eAAe,EACf,QAAQ,GACT,KAAI;AACH,IAAA,QACEA,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EACrB,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,YAEnD,QAAQ,EAAA,CACc;AAE7B;AAEA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,MAAK;AACjC,IAAA,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE;IACnC,OAAO,WAAW,IAAI,EAAE;AAC1B;AAEA;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,MAAK;AACnC,IAAA,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE;AACnC,IAAA,OAAO,CAAC,SAAiB,KACvB,WAAW,GAAG,CAAA,EAAG,WAAW,GAAG,SAAS,CAAA,CAAE,GAAG,SAAS;AAC1D;AAEA;;;;;AAKG;AACI,MAAM,cAAc,GAAG,MAAK;AACjC,IAAA,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE;AACnC,IAAA,OAAO,WAAW;AACpB;;"}
|
|
@@ -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 { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
4
|
import { createContext, forwardRef, useContext, useMemo, useRef, useCallback, useState } from 'react';
|
|
4
5
|
import { classNames } from './classNames.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleProvider.js","sources":["../../../src/helpers/LocaleProvider.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames } from './classNames';\nimport { useBulmaClasses, BulmaClassesProps } from './useBulmaClasses';\nimport { warnOnce } from './devWarnings';\nimport { canonicalLocale, localeDirection } from './localeInfo';\n\n/** A writing direction. */\nexport type TextDirection = 'ltr' | 'rtl';\n\n/** What the nearest `LocaleProvider` sets, both `undefined` outside one. */\nexport interface LocaleContextValue {\n /**\n * The locale, as a canonical BCP 47 tag such as `\"ar-EG\"`: the provider's\n * own, else the one an outer provider sets.\n */\n locale?: string;\n /**\n * The direction: the provider's own `dir`, else its own locale's, else the\n * one an outer provider sets.\n */\n dir?: TextDirection;\n}\n\nconst LocaleContext = createContext<LocaleContextValue | null>(null);\n\n/** The nearest provider's wrapper element, for `LocalePortalScope` to test targets against. */\nconst LocaleElementContext =\n createContext<React.RefObject<HTMLDivElement | null> | null>(null);\n\n/**\n * Props for the LocaleProvider component. The helper props, the other\n * attributes and the `ref` land on its `<div>`.\n */\nexport interface LocaleProviderProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'dir' | 'lang' | 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * A BCP 47 language tag, such as `\"de\"` or `\"ar-EG\"`. It becomes the\n * wrapper's `lang`, the default `locale` of the date and time pickers\n * inside, and, with no `dir`, the direction, from the way its script is\n * written. Unset, a nested provider keeps the outer one's. A tag `Intl`\n * refuses is ignored, with a warning in development.\n */\n locale?: string;\n /**\n * The direction, whatever the locale. Unset, it follows this provider's\n * `locale`, else an outer provider's direction, else the page's.\n */\n dir?: TextDirection;\n /** The part of the app it covers. */\n children?: React.ReactNode;\n}\n\n/** A tag in canonical form, or `undefined`, warning about one `Intl` refuses. */\nfunction validLocale(tag: string | undefined): string | undefined {\n try {\n return canonicalLocale(tag);\n } catch {\n warnOnce(\n `locale-provider-invalid:${tag}`,\n `[bestax-bulma] <LocaleProvider locale=\"${tag}\">: not a language ` +\n 'tag Intl accepts, so it is ignored. Use a BCP 47 tag such as ' +\n '\"en-US\", with a hyphen rather than an underscore.'\n );\n return undefined;\n }\n}\n\n/**\n * Sets the language and writing direction for the part of the app inside it, on a wrapper `<div>` and on what the library portals out of it.\n *\n * The wrapper carries `dir` and `lang`, so CSS and the components that read\n * the computed direction follow it, as they follow `<html dir>`. A `locale`\n * alone sets the direction of its script, and a `dir` sets the direction\n * whatever the locale. A nested provider keeps whatever it leaves unset.\n *\n * Inside it, the date and time pickers take its `locale` unless given their\n * own, and their week starts on the first day of the locale they use unless\n * `firstDayOfWeek` is set, and a picker with a `locale` of its own is read\n * like a nested provider. With a `locale`, the numbers the library writes,\n * such as page numbers and badge counts, follow it, and so does the\n * filtering in `Combobox`, `Autocomplete`, `Taginput` and `Command`, which then ignores\n * accents where the language treats letters as the same. The library's\n * portaled content, such as a `Popover` panel, a `Modal` with `portal`, a\n * `Toast` or a `Portal`'s children, keeps the same `dir` and `lang` though\n * it renders outside the wrapper: in a container outside the wrapper, it\n * sits in a `display: contents` element that carries them. Without a\n * provider none of this changes.\n *\n * @function\n * @param {LocaleProviderProps} props - Props for the LocaleProvider.\n * @returns {JSX.Element} The wrapper, inside the context.\n *\n * @example\n * <LocaleProvider locale=\"ar-EG\">\n * <App />\n * </LocaleProvider>\n */\nexport const LocaleProvider = forwardRef<HTMLDivElement, LocaleProviderProps>(\n (\n { locale: localeProp, dir: dirProp, className, children, ...props },\n ref\n ) => {\n const outer = useContext(LocaleContext);\n const ownLocale = useMemo(() => validLocale(localeProp), [localeProp]);\n const ownLocaleDir = useMemo(\n () => (ownLocale ? localeDirection(ownLocale) : undefined),\n [ownLocale]\n );\n const locale = ownLocale || outer?.locale;\n const dir = dirProp || ownLocaleDir || outer?.dir;\n const value = useMemo(() => ({ locale, dir }), [locale, dir]);\n\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // The wrapper, for portaled content to tell whether its target is inside\n // it, and the caller's ref. A callback ref's cleanup is held and run on\n // detach, as Toast and Modal do, since React 18 discards the return value.\n const elementRef = useRef<HTMLDivElement | null>(null);\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n const setElement = useCallback(\n (node: HTMLDivElement | null) => {\n elementRef.current = node;\n if (typeof ref === 'function') {\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) consumerCleanup();\n else ref(null);\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n\n return (\n <LocaleContext.Provider value={value}>\n <LocaleElementContext.Provider value={elementRef}>\n <div\n ref={setElement}\n className={classNames(bulmaHelperClasses, className) || undefined}\n {...rest}\n dir={dir}\n lang={locale}\n >\n {children}\n </div>\n </LocaleElementContext.Provider>\n </LocaleContext.Provider>\n );\n }\n);\n\nLocaleProvider.displayName = 'LocaleProvider';\n\n/** What `useLocale` returns outside a provider, the same object each time. */\nconst noLocale: LocaleContextValue = {};\n\n/**\n * The locale and direction the nearest `LocaleProvider` sets, for an app's own `Intl` calls or its own portaled content; both are `undefined` outside one.\n *\n * It isn't the page's direction: with no provider, or one that sets no\n * direction, the page's `<html dir>` still decides. To act on the direction\n * an element is laid out in, read `getComputedStyle(element).direction`, as\n * the library's components do.\n *\n * @function\n * @returns {LocaleContextValue} The nearest provider's `locale` and `dir`.\n *\n * @example\n * const { locale } = useLocale();\n * const price = new Intl.NumberFormat(locale, {\n * style: 'currency',\n * currency: 'EUR',\n * }).format(12.5);\n */\nexport function useLocale(): LocaleContextValue {\n return useContext(LocaleContext) ?? noLocale;\n}\n\n/**\n * INTERNAL, deliberately not exported from `src/index.ts`. The nearest\n * provider's settings, or `null` outside any provider, so a caller can tell\n * \"no provider\" from \"a provider that sets nothing\".\n */\nexport function useLocaleScope(): LocaleContextValue | null {\n return useContext(LocaleContext);\n}\n\nconst displayContents: React.CSSProperties = { display: 'contents' };\n\n/** The `dir` and `lang` portaled content carries: a provider's, or a picker's own. */\nexport interface PortalLocale {\n /** The `lang` to carry, unset for none. */\n locale?: string;\n /** The `dir` to carry, unset for none. */\n dir?: string;\n}\n\n/**\n * INTERNAL, deliberately not exported from `src/index.ts`. Keeps the `dir`\n * and `lang` of the nearest provider, or the `scope` given in their place,\n * on content the library portals into `target`, which has left the\n * provider's wrapper behind.\n *\n * A target inside the provider's own wrapper gets the content as it is: it\n * inherits from the wrapper, and follows it when the provider changes.\n * Content that must be its container's direct child, a `<tr>` portaled into\n * a `<tbody>` there, stays one. Any other target, `document.body` included,\n * gets the content inside a `display: contents` element carrying the\n * values, which adds no box. So does content with a `scope` of its own, a\n * picker's panel, since the provider's values aren't its own.\n *\n * Which of the two is decided once, when the content mounts, and kept while\n * it stays: switching between them would put a different element in its\n * place and remount everything inside, losing typed text, focus and timers.\n * A change of locale or direction updates the wrapper's attributes instead.\n * A target is never left bare because something else, such as `<html>`,\n * happens to carry the same values, since that can stop being true without\n * the content remounting. Outside a provider it renders the children alone,\n * so nothing changes there.\n */\nexport function LocalePortalScope({\n children,\n target,\n scope,\n}: {\n children: React.ReactNode;\n /** The element the content is portaled into. */\n target: Element;\n /** Values to carry in place of the provider's, such as a picker's own. */\n scope?: PortalLocale;\n}) {\n const provider = useContext(LocaleContext);\n const element = useContext(LocaleElementContext);\n const [wrap] = useState(\n () => scope !== undefined || !element?.current?.contains(target)\n );\n if (!provider || !wrap) return <>{children}</>;\n const values = scope ?? provider;\n return (\n <div dir={values.dir} lang={values.locale} style={displayContents}>\n {children}\n </div>\n );\n}\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;AA+BA,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC;AAEpE;AACA,MAAM,oBAAoB,GACxB,aAAa,CAAgD,IAAI,CAAC;AA2BpE;AACA,SAAS,WAAW,CAAC,GAAuB,EAAA;AAC1C,IAAA,IAAI;AACF,QAAA,OAAO,eAAe,CAAC,GAAG,CAAC;IAC7B;AAAE,IAAA,MAAM;AACN,QAAA,QAAQ,CACN,CAAA,wBAAA,EAA2B,GAAG,EAAE,EAChC,CAA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;AAsBG;AACG,SAAU,iBAAiB,CAAC,EAChC,QAAQ,EACR,MAAM,EACN,KAAK,GAON,EAAA;AACC,IAAA,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC;AAC1C,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAChD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CACrB,MAAM,KAAK,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CACjE;AACD,IAAA,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI;QAAE,OAAOA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAC9C,IAAA,MAAM,MAAM,GAAG,KAAK,IAAI,QAAQ;IAChC,QACED,aAAK,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAA,QAAA,EAC9D,QAAQ,EAAA,CACL;AAEV;;"}
|
|
1
|
+
{"version":3,"file":"LocaleProvider.js","sources":["../../../src/helpers/LocaleProvider.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames } from './classNames';\nimport { useBulmaClasses, BulmaClassesProps } from './useBulmaClasses';\nimport { warnOnce } from './devWarnings';\nimport { canonicalLocale, localeDirection } from './localeInfo';\n\n/** A writing direction. */\nexport type TextDirection = 'ltr' | 'rtl';\n\n/** What the nearest `LocaleProvider` sets, both `undefined` outside one. */\nexport interface LocaleContextValue {\n /**\n * The locale, as a canonical BCP 47 tag such as `\"ar-EG\"`: the provider's\n * own, else the one an outer provider sets.\n */\n locale?: string;\n /**\n * The direction: the provider's own `dir`, else its own locale's, else the\n * one an outer provider sets.\n */\n dir?: TextDirection;\n}\n\nconst LocaleContext = createContext<LocaleContextValue | null>(null);\n\n/** The nearest provider's wrapper element, for `LocalePortalScope` to test targets against. */\nconst LocaleElementContext =\n createContext<React.RefObject<HTMLDivElement | null> | null>(null);\n\n/**\n * Props for the LocaleProvider component. The helper props, the other\n * attributes and the `ref` land on its `<div>`.\n */\nexport interface LocaleProviderProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'dir' | 'lang' | 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * A BCP 47 language tag, such as `\"de\"` or `\"ar-EG\"`. It becomes the\n * wrapper's `lang`, the default `locale` of the date and time pickers\n * inside, and, with no `dir`, the direction, from the way its script is\n * written. Unset, a nested provider keeps the outer one's. A tag `Intl`\n * refuses is ignored, with a warning in development.\n */\n locale?: string;\n /**\n * The direction, whatever the locale. Unset, it follows this provider's\n * `locale`, else an outer provider's direction, else the page's.\n */\n dir?: TextDirection;\n /** The part of the app it covers. */\n children?: React.ReactNode;\n}\n\n/** A tag in canonical form, or `undefined`, warning about one `Intl` refuses. */\nfunction validLocale(tag: string | undefined): string | undefined {\n try {\n return canonicalLocale(tag);\n } catch {\n warnOnce(\n `locale-provider-invalid:${tag}`,\n `[bestax-bulma] <LocaleProvider locale=\"${tag}\">: not a language ` +\n 'tag Intl accepts, so it is ignored. Use a BCP 47 tag such as ' +\n '\"en-US\", with a hyphen rather than an underscore.'\n );\n return undefined;\n }\n}\n\n/**\n * Sets the language and writing direction for the part of the app inside it, on a wrapper `<div>` and on what the library portals out of it.\n *\n * The wrapper carries `dir` and `lang`, so CSS and the components that read\n * the computed direction follow it, as they follow `<html dir>`. A `locale`\n * alone sets the direction of its script, and a `dir` sets the direction\n * whatever the locale. A nested provider keeps whatever it leaves unset.\n *\n * Inside it, the date and time pickers take its `locale` unless given their\n * own, and their week starts on the first day of the locale they use unless\n * `firstDayOfWeek` is set, and a picker with a `locale` of its own is read\n * like a nested provider. With a `locale`, the numbers the library writes,\n * such as page numbers and badge counts, follow it, and so does the\n * filtering in `Combobox`, `Autocomplete`, `Taginput` and `Command`, which then ignores\n * accents where the language treats letters as the same. The library's\n * portaled content, such as a `Popover` panel, a `Modal` with `portal`, a\n * `Toast` or a `Portal`'s children, keeps the same `dir` and `lang` though\n * it renders outside the wrapper: in a container outside the wrapper, it\n * sits in a `display: contents` element that carries them. Without a\n * provider none of this changes.\n *\n * @function\n * @param {LocaleProviderProps} props - Props for the LocaleProvider.\n * @returns {JSX.Element} The wrapper, inside the context.\n *\n * @example\n * <LocaleProvider locale=\"ar-EG\">\n * <App />\n * </LocaleProvider>\n */\nexport const LocaleProvider = forwardRef<HTMLDivElement, LocaleProviderProps>(\n (\n { locale: localeProp, dir: dirProp, className, children, ...props },\n ref\n ) => {\n const outer = useContext(LocaleContext);\n const ownLocale = useMemo(() => validLocale(localeProp), [localeProp]);\n const ownLocaleDir = useMemo(\n () => (ownLocale ? localeDirection(ownLocale) : undefined),\n [ownLocale]\n );\n const locale = ownLocale || outer?.locale;\n const dir = dirProp || ownLocaleDir || outer?.dir;\n const value = useMemo(() => ({ locale, dir }), [locale, dir]);\n\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // The wrapper, for portaled content to tell whether its target is inside\n // it, and the caller's ref. A callback ref's cleanup is held and run on\n // detach, as Toast and Modal do, since React 18 discards the return value.\n const elementRef = useRef<HTMLDivElement | null>(null);\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n const setElement = useCallback(\n (node: HTMLDivElement | null) => {\n elementRef.current = node;\n if (typeof ref === 'function') {\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) consumerCleanup();\n else ref(null);\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n\n return (\n <LocaleContext.Provider value={value}>\n <LocaleElementContext.Provider value={elementRef}>\n <div\n ref={setElement}\n className={classNames(bulmaHelperClasses, className) || undefined}\n {...rest}\n dir={dir}\n lang={locale}\n >\n {children}\n </div>\n </LocaleElementContext.Provider>\n </LocaleContext.Provider>\n );\n }\n);\n\nLocaleProvider.displayName = 'LocaleProvider';\n\n/** What `useLocale` returns outside a provider, the same object each time. */\nconst noLocale: LocaleContextValue = {};\n\n/**\n * The locale and direction the nearest `LocaleProvider` sets, for an app's own `Intl` calls or its own portaled content; both are `undefined` outside one.\n *\n * It isn't the page's direction: with no provider, or one that sets no\n * direction, the page's `<html dir>` still decides. To act on the direction\n * an element is laid out in, read `getComputedStyle(element).direction`, as\n * the library's components do.\n *\n * @function\n * @returns {LocaleContextValue} The nearest provider's `locale` and `dir`.\n *\n * @example\n * const { locale } = useLocale();\n * const price = new Intl.NumberFormat(locale, {\n * style: 'currency',\n * currency: 'EUR',\n * }).format(12.5);\n */\nexport function useLocale(): LocaleContextValue {\n return useContext(LocaleContext) ?? noLocale;\n}\n\n/**\n * INTERNAL, deliberately not exported from `src/index.ts`. The nearest\n * provider's settings, or `null` outside any provider, so a caller can tell\n * \"no provider\" from \"a provider that sets nothing\".\n */\nexport function useLocaleScope(): LocaleContextValue | null {\n return useContext(LocaleContext);\n}\n\nconst displayContents: React.CSSProperties = { display: 'contents' };\n\n/** The `dir` and `lang` portaled content carries: a provider's, or a picker's own. */\nexport interface PortalLocale {\n /** The `lang` to carry, unset for none. */\n locale?: string;\n /** The `dir` to carry, unset for none. */\n dir?: string;\n}\n\n/**\n * INTERNAL, deliberately not exported from `src/index.ts`. Keeps the `dir`\n * and `lang` of the nearest provider, or the `scope` given in their place,\n * on content the library portals into `target`, which has left the\n * provider's wrapper behind.\n *\n * A target inside the provider's own wrapper gets the content as it is: it\n * inherits from the wrapper, and follows it when the provider changes.\n * Content that must be its container's direct child, a `<tr>` portaled into\n * a `<tbody>` there, stays one. Any other target, `document.body` included,\n * gets the content inside a `display: contents` element carrying the\n * values, which adds no box. So does content with a `scope` of its own, a\n * picker's panel, since the provider's values aren't its own.\n *\n * Which of the two is decided once, when the content mounts, and kept while\n * it stays: switching between them would put a different element in its\n * place and remount everything inside, losing typed text, focus and timers.\n * A change of locale or direction updates the wrapper's attributes instead.\n * A target is never left bare because something else, such as `<html>`,\n * happens to carry the same values, since that can stop being true without\n * the content remounting. Outside a provider it renders the children alone,\n * so nothing changes there.\n */\nexport function LocalePortalScope({\n children,\n target,\n scope,\n}: {\n children: React.ReactNode;\n /** The element the content is portaled into. */\n target: Element;\n /** Values to carry in place of the provider's, such as a picker's own. */\n scope?: PortalLocale;\n}) {\n const provider = useContext(LocaleContext);\n const element = useContext(LocaleElementContext);\n const [wrap] = useState(\n () => scope !== undefined || !element?.current?.contains(target)\n );\n if (!provider || !wrap) return <>{children}</>;\n const values = scope ?? provider;\n return (\n <div dir={values.dir} lang={values.locale} style={displayContents}>\n {children}\n </div>\n );\n}\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;AA+BA,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC;AAEpE;AACA,MAAM,oBAAoB,GACxB,aAAa,CAAgD,IAAI,CAAC;AA2BpE;AACA,SAAS,WAAW,CAAC,GAAuB,EAAA;AAC1C,IAAA,IAAI;AACF,QAAA,OAAO,eAAe,CAAC,GAAG,CAAC;IAC7B;AAAE,IAAA,MAAM;AACN,QAAA,QAAQ,CACN,CAAA,wBAAA,EAA2B,GAAG,EAAE,EAChC,CAAA,uCAAA,EAA0C,GAAG,CAAA,mBAAA,CAAqB;YAChE,+DAA+D;AAC/D,YAAA,mDAAmD,CACtD;AACD,QAAA,OAAO,SAAS;IAClB;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AACI,MAAM,cAAc,GAAG,UAAU,CACtC,CACE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,aAAa,CAAC;AACvC,IAA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AE,OAAOA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAC9C,IAAA,MAAM,MAAM,GAAG,KAAK,IAAI,QAAQ;IAChC,QACED,aAAK,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAA,QAAA,EAC9D,QAAQ,EAAA,CACL;AAEV;;"}
|
|
@@ -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 { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
4
|
import { useMemo, useEffect, useState } from 'react';
|
|
4
5
|
import { classNames } from './classNames.js';
|