@allxsmith/bestax-bulma 5.56.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/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 +1 -0
- package/dist/esm/components/useDataTable.js.map +1 -1
- package/dist/esm/elements/Block.js +1 -0
- package/dist/esm/elements/Block.js.map +1 -1
- package/dist/esm/elements/Box.js +1 -0
- package/dist/esm/elements/Box.js.map +1 -1
- package/dist/esm/elements/Button.js +1 -0
- package/dist/esm/elements/Button.js.map +1 -1
- package/dist/esm/elements/Buttons.js +1 -0
- package/dist/esm/elements/Buttons.js.map +1 -1
- package/dist/esm/elements/Code.js +1 -0
- package/dist/esm/elements/Code.js.map +1 -1
- package/dist/esm/elements/ColorSwatch.js +1 -0
- package/dist/esm/elements/ColorSwatch.js.map +1 -1
- package/dist/esm/elements/Content.js +1 -0
- package/dist/esm/elements/Content.js.map +1 -1
- package/dist/esm/elements/Delete.js +1 -0
- package/dist/esm/elements/Delete.js.map +1 -1
- package/dist/esm/elements/DescriptionList.js +1 -0
- package/dist/esm/elements/DescriptionList.js.map +1 -1
- package/dist/esm/elements/Divider.js +1 -0
- package/dist/esm/elements/Divider.js.map +1 -1
- package/dist/esm/elements/Emphasis.js +1 -0
- package/dist/esm/elements/Emphasis.js.map +1 -1
- package/dist/esm/elements/Figure.js +1 -0
- package/dist/esm/elements/Figure.js.map +1 -1
- package/dist/esm/elements/Icon.js +1 -0
- package/dist/esm/elements/Icon.js.map +1 -1
- package/dist/esm/elements/IconText.js +1 -0
- package/dist/esm/elements/IconText.js.map +1 -1
- package/dist/esm/elements/Image.js +1 -0
- package/dist/esm/elements/Image.js.map +1 -1
- package/dist/esm/elements/Kbd.js +1 -0
- package/dist/esm/elements/Kbd.js.map +1 -1
- package/dist/esm/elements/Link.js +1 -0
- package/dist/esm/elements/Link.js.map +1 -1
- package/dist/esm/elements/LinkButton.js +1 -0
- package/dist/esm/elements/LinkButton.js.map +1 -1
- package/dist/esm/elements/ListItem.js +1 -0
- package/dist/esm/elements/ListItem.js.map +1 -1
- package/dist/esm/elements/Loader.js +1 -0
- package/dist/esm/elements/Loader.js.map +1 -1
- package/dist/esm/elements/Notification.js +1 -0
- package/dist/esm/elements/Notification.js.map +1 -1
- package/dist/esm/elements/OrderedList.js +1 -0
- package/dist/esm/elements/OrderedList.js.map +1 -1
- package/dist/esm/elements/Paragraph.js +1 -0
- package/dist/esm/elements/Paragraph.js.map +1 -1
- package/dist/esm/elements/Pre.js +1 -0
- package/dist/esm/elements/Pre.js.map +1 -1
- package/dist/esm/elements/Progress.js +1 -0
- package/dist/esm/elements/Progress.js.map +1 -1
- package/dist/esm/elements/RingProgress.js +1 -0
- package/dist/esm/elements/RingProgress.js.map +1 -1
- package/dist/esm/elements/Skeleton.js +1 -0
- package/dist/esm/elements/Skeleton.js.map +1 -1
- package/dist/esm/elements/Span.js +1 -0
- package/dist/esm/elements/Span.js.map +1 -1
- package/dist/esm/elements/Strong.js +1 -0
- package/dist/esm/elements/Strong.js.map +1 -1
- package/dist/esm/elements/SubTitle.js +1 -0
- package/dist/esm/elements/SubTitle.js.map +1 -1
- package/dist/esm/elements/Table.js +1 -0
- package/dist/esm/elements/Table.js.map +1 -1
- package/dist/esm/elements/Tag.js +1 -0
- package/dist/esm/elements/Tag.js.map +1 -1
- package/dist/esm/elements/Tags.js +1 -0
- package/dist/esm/elements/Tags.js.map +1 -1
- package/dist/esm/elements/Tbody.js +1 -0
- package/dist/esm/elements/Tbody.js.map +1 -1
- package/dist/esm/elements/Td.js +1 -0
- package/dist/esm/elements/Td.js.map +1 -1
- package/dist/esm/elements/Tfoot.js +1 -0
- package/dist/esm/elements/Tfoot.js.map +1 -1
- package/dist/esm/elements/Th.js +1 -0
- package/dist/esm/elements/Th.js.map +1 -1
- package/dist/esm/elements/Thead.js +1 -0
- package/dist/esm/elements/Thead.js.map +1 -1
- package/dist/esm/elements/Title.js +1 -0
- package/dist/esm/elements/Title.js.map +1 -1
- package/dist/esm/elements/ToggleButton.js +1 -0
- package/dist/esm/elements/ToggleButton.js.map +1 -1
- package/dist/esm/elements/Tr.js +1 -0
- package/dist/esm/elements/Tr.js.map +1 -1
- package/dist/esm/elements/UnorderedList.js +1 -0
- package/dist/esm/elements/UnorderedList.js.map +1 -1
- package/dist/esm/elements/iconProps.js +1 -0
- package/dist/esm/elements/iconProps.js.map +1 -1
- package/dist/esm/form/Autocomplete.js +1 -0
- package/dist/esm/form/Autocomplete.js.map +1 -1
- package/dist/esm/form/Checkbox.js +1 -0
- package/dist/esm/form/Checkbox.js.map +1 -1
- package/dist/esm/form/CheckboxCard.js +1 -0
- package/dist/esm/form/CheckboxCard.js.map +1 -1
- package/dist/esm/form/Checkboxes.js +1 -0
- package/dist/esm/form/Checkboxes.js.map +1 -1
- package/dist/esm/form/ColorInput.js +1 -0
- package/dist/esm/form/ColorInput.js.map +1 -1
- package/dist/esm/form/ColorInputBase.js +1 -0
- package/dist/esm/form/ColorInputBase.js.map +1 -1
- package/dist/esm/form/ColorPicker.js +1 -0
- package/dist/esm/form/ColorPicker.js.map +1 -1
- package/dist/esm/form/Combobox.js +1 -0
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/Control.js +1 -0
- package/dist/esm/form/Control.js.map +1 -1
- package/dist/esm/form/DateInput.js +1 -0
- package/dist/esm/form/DateInput.js.map +1 -1
- package/dist/esm/form/DateInputBase.js +1 -0
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInput.js +1 -0
- package/dist/esm/form/DateRangeInput.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js +1 -0
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInput.js +1 -0
- package/dist/esm/form/DateTimeInput.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +1 -0
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Dropzone.js +1 -0
- package/dist/esm/form/Dropzone.js.map +1 -1
- package/dist/esm/form/Field.js +1 -0
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/Fieldset.js +1 -0
- package/dist/esm/form/Fieldset.js.map +1 -1
- package/dist/esm/form/File.js +1 -0
- package/dist/esm/form/File.js.map +1 -1
- package/dist/esm/form/FormContext.js +1 -0
- package/dist/esm/form/FormContext.js.map +1 -1
- package/dist/esm/form/Input.js +1 -0
- package/dist/esm/form/Input.js.map +1 -1
- package/dist/esm/form/InputBase.js +1 -0
- package/dist/esm/form/InputBase.js.map +1 -1
- package/dist/esm/form/Numberinput.js +1 -0
- package/dist/esm/form/Numberinput.js.map +1 -1
- package/dist/esm/form/PinInput.js +1 -0
- package/dist/esm/form/PinInput.js.map +1 -1
- package/dist/esm/form/Radio.js +1 -0
- package/dist/esm/form/Radio.js.map +1 -1
- package/dist/esm/form/RadioCard.js +1 -0
- package/dist/esm/form/RadioCard.js.map +1 -1
- package/dist/esm/form/Radios.js +1 -0
- package/dist/esm/form/Radios.js.map +1 -1
- package/dist/esm/form/Rate.js +1 -0
- package/dist/esm/form/Rate.js.map +1 -1
- package/dist/esm/form/Select.js +1 -0
- package/dist/esm/form/Select.js.map +1 -1
- package/dist/esm/form/SelectBase.js +1 -0
- package/dist/esm/form/SelectBase.js.map +1 -1
- package/dist/esm/form/Slider.js +1 -0
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/Switch.js +1 -0
- package/dist/esm/form/Switch.js.map +1 -1
- package/dist/esm/form/Taginput.js +1 -0
- package/dist/esm/form/Taginput.js.map +1 -1
- package/dist/esm/form/TextArea.js +1 -0
- package/dist/esm/form/TextArea.js.map +1 -1
- package/dist/esm/form/TextAreaBase.js +1 -0
- package/dist/esm/form/TextAreaBase.js.map +1 -1
- package/dist/esm/form/TimeInput.js +1 -0
- package/dist/esm/form/TimeInput.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +1 -0
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/_colorInternals/EyeDropperButton.js +1 -0
- package/dist/esm/form/_colorInternals/EyeDropperButton.js.map +1 -1
- package/dist/esm/form/_colorInternals/pickerState.js +1 -0
- package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +1 -0
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +1 -0
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/form/_pickerInternals/TimeWheels.js +1 -0
- package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +1 -0
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +1 -0
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +1 -0
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -1
- package/dist/esm/form/controlLoading.js +1 -0
- package/dist/esm/form/controlLoading.js.map +1 -1
- package/dist/esm/form/groupFieldset.js +1 -0
- package/dist/esm/form/groupFieldset.js.map +1 -1
- package/dist/esm/form/useAutoLabelId.js +1 -0
- package/dist/esm/form/useAutoLabelId.js.map +1 -1
- package/dist/esm/grid/Cell.js +1 -0
- package/dist/esm/grid/Cell.js.map +1 -1
- package/dist/esm/grid/Grid.js +1 -0
- package/dist/esm/grid/Grid.js.map +1 -1
- package/dist/esm/helpers/ClientOnly.js +1 -0
- package/dist/esm/helpers/ClientOnly.js.map +1 -1
- package/dist/esm/helpers/Config.js +1 -0
- package/dist/esm/helpers/Config.js.map +1 -1
- package/dist/esm/helpers/LocaleProvider.js +1 -0
- package/dist/esm/helpers/LocaleProvider.js.map +1 -1
- package/dist/esm/helpers/Theme.js +1 -0
- package/dist/esm/helpers/Theme.js.map +1 -1
- package/dist/esm/helpers/flattenChildren.js +1 -0
- package/dist/esm/helpers/flattenChildren.js.map +1 -1
- package/dist/esm/helpers/inertProps.js +1 -0
- package/dist/esm/helpers/inertProps.js.map +1 -1
- package/dist/esm/helpers/localeFormat.js +1 -0
- package/dist/esm/helpers/localeFormat.js.map +1 -1
- package/dist/esm/helpers/overlayStack.js +1 -0
- package/dist/esm/helpers/overlayStack.js.map +1 -1
- package/dist/esm/helpers/portal.js +1 -0
- package/dist/esm/helpers/portal.js.map +1 -1
- package/dist/esm/helpers/scrollLock.js +1 -0
- package/dist/esm/helpers/scrollLock.js.map +1 -1
- package/dist/esm/helpers/statusRegion.js +1 -0
- package/dist/esm/helpers/statusRegion.js.map +1 -1
- package/dist/esm/helpers/typeahead.js +1 -0
- package/dist/esm/helpers/typeahead.js.map +1 -1
- package/dist/esm/helpers/useAnchoredPosition.js +1 -0
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
- package/dist/esm/helpers/useBulmaClasses.js +1 -0
- package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
- package/dist/esm/helpers/useClientLayoutEffect.js +1 -0
- package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -1
- package/dist/esm/helpers/useColorClasses.js +1 -0
- package/dist/esm/helpers/useColorClasses.js.map +1 -1
- package/dist/esm/helpers/useComboboxEngine.js +1 -0
- package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
- package/dist/esm/helpers/useContextMenuTrigger.js +1 -0
- package/dist/esm/helpers/useContextMenuTrigger.js.map +1 -1
- package/dist/esm/helpers/useFlexboxClasses.js +1 -0
- package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
- package/dist/esm/helpers/useFocusTrap.js +1 -0
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/esm/helpers/useHoverOpen.js +1 -0
- package/dist/esm/helpers/useHoverOpen.js.map +1 -1
- package/dist/esm/helpers/useInertSiblings.js +1 -0
- package/dist/esm/helpers/useInertSiblings.js.map +1 -1
- package/dist/esm/helpers/useIsHydrated.js +1 -0
- package/dist/esm/helpers/useIsHydrated.js.map +1 -1
- package/dist/esm/helpers/useLatestRef.js +1 -0
- package/dist/esm/helpers/useLatestRef.js.map +1 -1
- package/dist/esm/helpers/useMenuKeys.js +1 -0
- package/dist/esm/helpers/useMenuKeys.js.map +1 -1
- package/dist/esm/helpers/useOtherClasses.js +1 -0
- package/dist/esm/helpers/useOtherClasses.js.map +1 -1
- package/dist/esm/helpers/useSpacingClasses.js +1 -0
- package/dist/esm/helpers/useSpacingClasses.js.map +1 -1
- package/dist/esm/helpers/useTreeView.js +1 -0
- package/dist/esm/helpers/useTreeView.js.map +1 -1
- package/dist/esm/helpers/useTypographyClasses.js +1 -0
- package/dist/esm/helpers/useTypographyClasses.js.map +1 -1
- package/dist/esm/helpers/useVisibilityClasses.js +1 -0
- package/dist/esm/helpers/useVisibilityClasses.js.map +1 -1
- package/dist/esm/layout/Container.js +1 -0
- package/dist/esm/layout/Container.js.map +1 -1
- package/dist/esm/layout/Footer.js +1 -0
- package/dist/esm/layout/Footer.js.map +1 -1
- package/dist/esm/layout/Hero.js +1 -0
- package/dist/esm/layout/Hero.js.map +1 -1
- package/dist/esm/layout/Level.js +1 -0
- package/dist/esm/layout/Level.js.map +1 -1
- package/dist/esm/layout/Media.js +1 -0
- package/dist/esm/layout/Media.js.map +1 -1
- package/dist/esm/layout/Section.js +1 -0
- package/dist/esm/layout/Section.js.map +1 -1
- package/dist/esm/layout/Splitter.js +1 -0
- package/dist/esm/layout/Splitter.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsesContext.js","sources":["../../../src/components/collapsesContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * What a `Collapses` group hands the item it wraps: whether that item is open,\n * and how to ask the group for a change.\n *\n * This module is internal. `index.ts` re-exports `Collapse` and `Collapses`\n * whole, so the context lives here, where neither re-export reaches it.\n */\nexport interface CollapsesItemContextValue {\n /** Whether the group has this item open. */\n open: boolean;\n /** Asks the group to open (`true`) or close (`false`) this item. */\n setOpen: (open: boolean) => void;\n}\n\n/**\n * `null` outside a group. A `Collapse` also resets it to `null` for its own\n * subtree, so a Collapse nested in an item's content keeps its own state\n * instead of answering to its ancestor's slot in the group.\n */\nexport const CollapsesItemContext =\n createContext<CollapsesItemContextValue | null>(null);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collapsesContext.js","sources":["../../../src/components/collapsesContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * What a `Collapses` group hands the item it wraps: whether that item is open,\n * and how to ask the group for a change.\n *\n * This module is internal. `index.ts` re-exports `Collapse` and `Collapses`\n * whole, so the context lives here, where neither re-export reaches it.\n */\nexport interface CollapsesItemContextValue {\n /** Whether the group has this item open. */\n open: boolean;\n /** Asks the group to open (`true`) or close (`false`) this item. */\n setOpen: (open: boolean) => void;\n}\n\n/**\n * `null` outside a group. A `Collapse` also resets it to `null` for its own\n * subtree, so a Collapse nested in an item's content keeps its own state\n * instead of answering to its ancestor's slot in the group.\n */\nexport const CollapsesItemContext =\n createContext<CollapsesItemContextValue | null>(null);\n"],"names":[],"mappings":";;;;AAgBA;;;;AAIG;MACU,oBAAoB,GAC/B,aAAa,CAAmC,IAAI;;"}
|
|
@@ -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 { useMemo, useCallback, useState, useRef } from 'react';
|
|
3
4
|
import { prefixedClassNames } from '../helpers/classNames.js';
|
|
4
5
|
import { useClassPrefix } from '../helpers/Config.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTable.js","sources":["../../../src/components/useDataTable.ts"],"sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { prefixedClassNames } from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport { useLocale } from '../helpers/LocaleProvider';\nimport { useLocaleMatcher, useNumberFormat } from '../helpers/localeFormat';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport type { TableAlignment } from '../elements/tableAlignment';\n\n/**\n * Carries a row type and adds nothing, so `DataTableColumnMeta` can take the\n * row type for the fields an add-on merges in while it has none of its own.\n */\ntype CarriesRow<TRow> = { [K in never]?: TRow };\n\n/**\n * Options of its own an add-on gives a column, read from the column's\n * `meta`. Empty in bestax: an add-on, such as a spreadsheet exporter, adds\n * its fields by declaration merging, and every column then takes them. Every\n * declaration of it names the row type the same way, `TRow`.\n *\n * @example\n * declare module '@allxsmith/bestax-bulma' {\n * interface DataTableColumnMeta<TRow> {\n * exportValue?: (row: TRow) => string | number;\n * }\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty so an add-on can merge into it\nexport interface DataTableColumnMeta<TRow = unknown> extends CarriesRow<TRow> {}\n\n/** What a column's `cell` is given beside the row. */\nexport interface DataTableCellContext {\n /** The column's raw value for the row, from its `accessor`. */\n value: unknown;\n /** The column's text for the row, from its `format`. */\n text: string;\n /** The row's id, from `getRowId`. */\n rowId: string;\n}\n\n/**\n * One column of a DataTable. A column keeps three things apart: its raw\n * value (`accessor`), which sorting and `filterFn` read; its text\n * (`format`), which the cell shows, the search matches and an export\n * writes; and its rich content (`cell`), which only the screen sees.\n */\nexport interface DataTableColumn<TRow> {\n /**\n * Names the column for good: the sort, the filters and an export refer to\n * it by this id. Unique within the table, and stable across renders.\n */\n id: string;\n /**\n * The column's name, as text: the header, the sort button's name, the\n * row checkboxes' names when it's the row header, and the header an\n * export writes.\n */\n header: string;\n /**\n * The raw value, for sorting and filtering: a key of the row, or a\n * function of it. Left out, it's the row's property named `id`.\n */\n accessor?: keyof TRow | ((row: TRow) => unknown);\n /**\n * The text for the value: what the cell shows when there's no `cell`, what\n * the search matches, and what an export writes. Left out, it's the value\n * as a string, and nothing for `null` or `undefined`. Give one for\n * numbers and dates you want written a certain way.\n */\n format?: (value: unknown, row: TRow) => string;\n /**\n * Rich content for the cell, such as a tag or a link. Only the screen\n * reads it: sorting, the search and an export use the value and its text.\n */\n cell?: (row: TRow, context: DataTableCellContext) => React.ReactNode;\n /**\n * Makes the header a button that sorts by this column: ascending, then\n * descending, then unsorted.\n */\n sortable?: boolean;\n /** Sorts descending on the first press, for a column read from the top, such as a score. */\n sortDescFirst?: boolean;\n /**\n * Compares two rows for an ascending sort, returning a negative number,\n * zero or a positive one. Descending reverses it. Without it, numbers,\n * dates and booleans compare by value, anything else by its text in the\n * `LocaleProvider`'s locale with numbers inside it read as numbers (\"Item\n * 9\" before \"Item 10\"), and an empty value goes last either way.\n */\n sortFn?: (a: TRow, b: TRow) => number;\n /**\n * Whether the column takes part in filtering: the search matches its\n * text, and `filters` can hold a value for it. `false` leaves it out of\n * both, as for a column of actions.\n */\n filterable?: boolean;\n /**\n * Decides whether a row passes this column's value in `filters`. Without\n * it, the column's text has to contain the value's text, compared as the\n * search compares.\n */\n filterFn?: (row: TRow, filterValue: unknown) => boolean;\n /** Aligns the header and the cells (`isAligned` on `Th` and `Td`). */\n align?: TableAlignment;\n /** The column's width, on its header cell: a number is pixels, a string any CSS length. */\n width?: string | number;\n /**\n * Renders this column's cells as row headers (`th scope=\"row\"`), which a\n * screen reader reads out with the other cells of the row. The row's\n * checkbox is named from it. Mark one column, usually the first.\n */\n isRowHeader?: boolean;\n /** Options of an add-on's own, as `DataTableColumnMeta` declares them. */\n meta?: DataTableColumnMeta<TRow>;\n}\n\n/** The direction of a sort, in `aria-sort`'s words. */\nexport type DataTableSortDirection = 'ascending' | 'descending';\n\n/** One column a DataTable sorts by. */\nexport interface DataTableSort {\n /** The column's `id`. */\n id: string;\n /** Which way it sorts. */\n direction: DataTableSortDirection;\n}\n\n/** The values per column `filters` holds, keyed by column `id`. */\nexport type DataTableFilters = Record<string, unknown>;\n\n/**\n * Which of a table's rows to read: `all` of `data`, `filtered` (the ones the\n * search and the filters let through, from every page), the `page` shown,\n * or the `selected` ones the filters let through. Each comes in the order\n * the table shows them.\n */\nexport type DataTableRowScope = 'all' | 'filtered' | 'page' | 'selected';\n\n/** Whether a DataTable has row checkboxes. */\nexport type DataTableSelectionMode = 'none' | 'multiple';\n\n/**\n * The words a DataTable writes. Each is English unless you give your own,\n * and the numbers in the default messages are written in the\n * `LocaleProvider`'s locale.\n */\nexport interface DataTableLabels {\n /**\n * The header checkbox's name. \"Select all rows\", or \"Select all rows on\n * this page\" when there's more than one page, since it then covers the\n * page shown.\n */\n selectAll?: string;\n /** A row checkbox's name, from the row's label (`label => 'Select ' + label`). */\n selectRow?: (rowLabel: string) => string;\n /**\n * Says that headers with buttons sort: hidden at the end of the caption,\n * after a comma, or as a hidden caption of its own. \"column headers with\n * buttons are sortable\".\n */\n sortHint?: string;\n /** The search field's label. \"Search\". */\n search?: string;\n /** Announced after the search or a filter changes (\"12 rows match\"). */\n results?: (count: number) => string;\n /** Announced after the page changes (\"Showing 11 to 20 of 57\"). */\n pageRange?: (first: number, last: number, total: number) => string;\n /** Announced while `loading`, once the search, a filter or the page has changed. \"Loading\". */\n loading?: string;\n /**\n * The pager's name. \"{the table's name} pages\" when the table is named by\n * `aria-label` or a text `caption`, so two tables' pagers have different\n * names, else `Pagination`'s own.\n */\n pagination?: string;\n /** What the table shows with no rows at all. \"No rows to show.\" */\n empty?: string;\n /** What the table shows when the search and filters let no row through. \"No rows match.\" */\n noResults?: string;\n}\n\n/** The words a DataTable writes, with every default filled in. */\nexport interface DataTableResolvedLabels extends Required<\n Omit<DataTableLabels, 'pagination'>\n> {\n /** The pager's name, when one was given. */\n pagination?: string;\n}\n\n/**\n * The options `useDataTable` and `DataTable` share, beside the columns and\n * the data. Each piece of state is yours when you pass its value (and its\n * `on…Change`), or the table's own, starting from its `default…`.\n */\nexport interface DataTableStateOptions<TRow> {\n /**\n * A row's id, unique and stable, which the selection is a list of. Left\n * out, it's the row's `id` property as a string. A development build\n * warns about a missing or repeated id, and a row with none falls back to\n * its index, which doesn't survive the data changing.\n */\n getRowId?: (row: TRow, index: number) => string;\n /**\n * The sort when you hold it: an array of `{ id, direction }`, the first\n * deciding and each next one breaking ties. The headers set one at a time.\n */\n sort?: DataTableSort[];\n /**\n * The sort to start with when the table holds it. Text sorts in the\n * `LocaleProvider`'s locale, or the runtime's own outside one, which can\n * differ between a server and the browser, so put a table rendered on the\n * server sorted inside a `LocaleProvider`.\n */\n defaultSort?: DataTableSort[];\n /** Called with the new sort when a header is pressed. */\n onSortChange?: (sort: DataTableSort[]) => void;\n /**\n * `multiple` adds a checkbox to each row and a \"select all\" checkbox to the header.\n *\n * @defaultValue 'none'\n */\n selectionMode?: DataTableSelectionMode;\n /**\n * The selected rows' ids when you hold them. They stay selected while the\n * search, a filter or the page hides them.\n */\n selected?: string[];\n /** The rows selected to begin with, by id, when the table holds them. */\n defaultSelected?: string[];\n /** Called with every selected id after a checkbox changes. */\n onSelectedChange?: (selected: string[]) => void;\n /** Rows per page. Set, the table pages through `Pagination`; left out, it shows every row. */\n pageSize?: number;\n /**\n * The page shown when you hold it, counting from 1. A page past the end\n * shows the last.\n */\n page?: number;\n /**\n * The page to start on when the table holds it.\n *\n * @defaultValue 1\n */\n defaultPage?: number;\n /**\n * Called with the page chosen in the pager, and with 1 when the search or\n * a filter changes through the table while the page held isn't 1, even\n * when a page past the end shows as the last.\n */\n onPageChange?: (page: number) => void;\n /**\n * The search when you hold it, matched against every filterable column's\n * text: in the `LocaleProvider`'s locale, ignoring case and the accents\n * the language ignores, or a case-insensitive substring outside one.\n */\n search?: string;\n /** The search to start with when the table holds it. */\n defaultSearch?: string;\n /** Called with the search as it changes through the table. */\n onSearchChange?: (search: string) => void;\n /**\n * A value per column, by `id`, when you hold them. A row passes when every\n * column with a value passes it: the column's `filterFn` if it has one,\n * given the value as it is, or else the column's text has to contain the\n * value's text, compared as the search compares. An array is a choice of\n * values, as a multiple-choice filter gives, and passes a row whose text\n * contains any of them. A value of `undefined`, `null`, `''` or an empty\n * array is no filter.\n */\n filters?: DataTableFilters;\n /** The filters to start with when the table holds them. */\n defaultFilters?: DataTableFilters;\n /** Called with every filter value after one changes through the table. */\n onFiltersChange?: (filters: DataTableFilters) => void;\n /**\n * Hands sorting, filtering and paging to a server: the table shows `data`\n * as given, as the current page, and only reports the state as it\n * changes.\n */\n manual?: boolean;\n /**\n * With `manual`, how many rows match in all, which sets the page count and\n * the announced count. Without it, the table counts the rows in `data`,\n * which with a `pageSize` is one page and no pager, and a development\n * build warns.\n */\n rowCount?: number;\n /** The words the table writes, in your app's language. */\n labels?: DataTableLabels;\n}\n\n/** What `useDataTable` takes. */\nexport interface UseDataTableOptions<TRow> extends DataTableStateOptions<TRow> {\n /**\n * The columns, in the order they're shown. Keep the array the same from\n * one render to the next, defined outside the component or in `useMemo`:\n * a new one has every cell's text worked out again.\n */\n columns: DataTableColumn<TRow>[];\n /** The rows, as records of your own. */\n data: TRow[];\n}\n\n/** The table's state, as it stands. */\nexport interface DataTableState {\n /** The sort, the first entry deciding. */\n sort: DataTableSort[];\n /** The selected rows' ids. */\n selected: string[];\n /** The page shown, counting from 1. */\n page: number;\n /** Rows per page, or `undefined` when it doesn't page. */\n pageSize: number | undefined;\n /** The search. */\n search: string;\n /** The filter values, by column id. */\n filters: DataTableFilters;\n}\n\n/** The props `getSortButtonProps` gives a header's `<button>`. */\nexport interface DataTableSortButtonProps {\n type: 'button';\n className: string;\n onClick: () => void;\n}\n\n/** The props `getSearchProps` gives a search `<input>` or bestax `Input`. */\nexport interface DataTableSearchProps {\n type: 'search';\n value: string;\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\n/** The props `getHeaderCellProps` gives a column's `Th`. */\nexport interface DataTableHeaderCellProps {\n scope: 'col';\n 'aria-sort'?: DataTableSortDirection;\n isAligned?: TableAlignment;\n width?: string | number;\n}\n\n/** The props `getCellProps` gives a row's `Td`, or its `Th` for the row header. */\nexport interface DataTableCellProps {\n scope?: 'row';\n isAligned?: TableAlignment;\n}\n\n/** The props `getSelectAllProps` and `getSelectRowProps` give a `Checkbox`. */\nexport interface DataTableCheckboxProps {\n 'aria-label': string;\n checked: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n onChange: () => void;\n}\n\n/** The props `getPaginationProps` gives `Pagination`. */\nexport interface DataTablePaginationProps {\n total: number;\n current: number;\n onPageChange: (page: number) => void;\n}\n\n/** What `toCSV` writes. */\nexport interface DataTableCSVOptions {\n /**\n * Which rows, in the order the table shows them: the ones the search and\n * filters let through, from every page, by default, or `all`, `page` or\n * `selected`.\n *\n * @defaultValue 'filtered'\n */\n rows?: DataTableRowScope;\n /** The ids of the columns to write, in that order. Every column, in the order shown, by default. */\n columns?: string[];\n /**\n * Writes the columns' headers as the first line.\n *\n * @defaultValue true\n */\n header?: boolean;\n /**\n * What separates the fields. A semicolon suits a spreadsheet that reads\n * a comma as the decimal point, as Excel does in much of Europe.\n *\n * @defaultValue ','\n */\n delimiter?: string;\n}\n\n/**\n * A table: what `useDataTable` returns, what `DataTable`'s `toolbar` is\n * given, and what its `table` takes. It reads the rows and the state, changes\n * the state, and hands out props for bestax's own `Th`, `Tr`, `Td`,\n * `Checkbox` and `Pagination`, so markup of your own behaves as DataTable's\n * does.\n */\nexport interface DataTableModel<TRow> {\n /** The columns, in the order they're shown. */\n columns: DataTableColumn<TRow>[];\n /** The state as it stands. */\n state: DataTableState;\n /** Whether rows have checkboxes. */\n selectionMode: DataTableSelectionMode;\n /** Whether a server sorts, filters and pages (`manual`). */\n manual: boolean;\n /** How many rows the search and filters let through, or `rowCount` with `manual`. */\n rowCount: number;\n /** How many pages there are, at least 1. */\n pageCount: number;\n /** The words the table writes, with the defaults filled in. */\n labels: DataTableResolvedLabels;\n /** The rows in `scope` (`filtered` by default), in the order the table shows them. */\n getRows: (scope?: DataTableRowScope) => TRow[];\n /** A row's id. */\n getRowId: (row: TRow) => string;\n /** A column's raw value for a row, or `undefined` for a column it doesn't have. */\n getValue: (row: TRow, columnId: string) => unknown;\n /** A column's text for a row, or `''` for a column it doesn't have. */\n getText: (row: TRow, columnId: string) => string;\n /** What names a row: its row header's text, or its first column's. */\n getRowLabel: (row: TRow) => string;\n /**\n * The rows as CSV, from the columns' text (`format`, not `cell`), with a\n * line break of `\\r\\n` between rows and fields quoted as RFC 4180 asks.\n * A field that starts with `=`, `+`, `-`, `@`, a tab or a carriage return\n * gets a `'` in front, so a spreadsheet shows it as text rather than\n * running it as a formula, unless it's a plain number such as `-12.5`.\n * Excel takes a file as UTF-8 only when it starts with a byte order mark,\n * so put `\\uFEFF` in front of the text when you save it for Excel.\n */\n toCSV: (options?: DataTableCSVOptions) => string;\n /** Whether a row is selected. */\n isSelected: (row: TRow) => boolean;\n /** Sets the sort. */\n setSort: (sort: DataTableSort[]) => void;\n /** Moves a column through its sort, as its header button does. */\n toggleSort: (columnId: string) => void;\n /** Sets the selected ids. */\n setSelected: (selected: string[]) => void;\n /**\n * Selects a row, or clears it, or with no `selected` flips it. Called\n * twice in one handler, the second call builds on the first while the\n * table holds the selection. While you hold it, each call builds on the\n * selection as rendered, so make several changes at once with\n * `setSelected`.\n */\n toggleRowSelected: (row: TRow, selected?: boolean) => void;\n /**\n * Selects every row on the page, or clears them, or with no `selected`\n * does what the header checkbox does. It builds on earlier calls as\n * `toggleRowSelected` does.\n */\n togglePageSelected: (selected?: boolean) => void;\n /** Goes to a page, counting from 1. */\n setPage: (page: number) => void;\n /**\n * Sets the search, and goes back to page 1, calling `onPageChange` with 1\n * unless the page held is 1 already.\n */\n setSearch: (search: string) => void;\n /**\n * Sets one column's filter value, and goes back to page 1. Called twice in\n * one handler, the second call builds on the first while the table holds\n * the filters. While you hold them, each call builds on the filters as\n * rendered, so set several at once with `setFilters`.\n */\n setFilter: (columnId: string, value: unknown) => void;\n /** Sets every filter value, and goes back to page 1, as `setSearch` does. */\n setFilters: (filters: DataTableFilters) => void;\n /** Props for a column's `Th`: its scope, its `aria-sort` while sorted, its alignment and width. */\n getHeaderCellProps: (\n column: DataTableColumn<TRow>\n ) => DataTableHeaderCellProps;\n /** Props for the `<button>` in a sortable column's header. */\n getSortButtonProps: (\n column: DataTableColumn<TRow>\n ) => DataTableSortButtonProps;\n /** Props for a row's `Tr`: Bulma's selected look while it's selected. */\n getRowProps: (row: TRow) => { isSelected: boolean };\n /** Props for a row's cell in a column: its alignment, and `scope=\"row\"` for the row header. */\n getCellProps: (\n row: TRow,\n column: DataTableColumn<TRow>\n ) => DataTableCellProps;\n /** Props for the header's \"select all\" `Checkbox`, which covers the page shown. */\n getSelectAllProps: () => DataTableCheckboxProps;\n /** Props for a row's `Checkbox`, named for the row. */\n getSelectRowProps: (row: TRow) => DataTableCheckboxProps;\n /** Props for `Pagination`: the page count, the page and the handler. */\n getPaginationProps: () => DataTablePaginationProps;\n /** Props for a search field, bound to the search. */\n getSearchProps: () => DataTableSearchProps;\n}\n\n/** A column's raw value for a row. */\nfunction readValue<TRow>(column: DataTableColumn<TRow>, row: TRow): unknown {\n const { accessor } = column;\n if (typeof accessor === 'function') return accessor(row);\n if (row === null || typeof row !== 'object') return undefined;\n return (row as Record<PropertyKey, unknown>)[\n (accessor ?? column.id) as PropertyKey\n ];\n}\n\n/** A column's text for a row. */\nfunction readText<TRow>(column: DataTableColumn<TRow>, row: TRow): string {\n const value = readValue(column, row);\n if (column.format) return column.format(value, row);\n return value === null || value === undefined ? '' : String(value);\n}\n\n/** Whether a value sorts as empty: nothing, no text, or no number or date. */\nfunction isEmptyValue(value: unknown): boolean {\n return (\n value === null ||\n value === undefined ||\n value === '' ||\n (typeof value === 'number' && Number.isNaN(value)) ||\n (value instanceof Date && Number.isNaN(value.getTime()))\n );\n}\n\n/** Compares two values that aren't empty, for an ascending sort. */\nfunction compareValues(a: unknown, b: unknown, collator: Intl.Collator) {\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return Number(a) - Number(b);\n }\n return collator.compare(String(a), String(b));\n}\n\n/** Whether a filter value filters anything. */\nfunction isActiveFilter(value: unknown): boolean {\n return (\n value !== undefined &&\n value !== null &&\n value !== '' &&\n !(Array.isArray(value) && value.length === 0)\n );\n}\n\n/** A field a spreadsheet would read as the start of a formula. */\nconst formulaStart = /^[=+\\-@\\t\\r]/;\n/** A plain number, signed, with any grouping, which no spreadsheet runs. */\nconst plainNumber = /^[+-]?\\d[\\d.,]*$/;\n\n/**\n * One CSV field: a `'` in front of what would start a formula, then quoted\n * when it holds the delimiter, a quote or a line break, its quotes doubled.\n */\nfunction csvField(text: string, delimiter: string): string {\n const safe =\n formulaStart.test(text) && !plainNumber.test(text) ? `'${text}` : text;\n return safe.includes(delimiter) || /[\"\\r\\n]/.test(safe)\n ? `\"${safe.replace(/\"/g, '\"\"')}\"`\n : safe;\n}\n\n/**\n * Whether a search or a filter value is narrowing the rows. Used by\n * DataTable to tell an empty table from one with no matches.\n */\nexport function isFiltering(search: string, filters: DataTableFilters) {\n return search.trim() !== '' || Object.values(filters).some(isActiveFilter);\n}\n\n/** A row's id from its `id` property, or nothing when it has none. */\nfunction idOf(row: unknown): string | undefined {\n if (row === null || typeof row !== 'object') return undefined;\n const id = (row as { id?: unknown }).id;\n return id === undefined || id === null || id === '' ? undefined : String(id);\n}\n\n/**\n * A piece of state that's the caller's when they pass its value, and the\n * table's own otherwise. Setting it calls the change handler either way.\n *\n * It also returns `latest`, what a change should build on. While the table\n * holds the state, that's the value last set, even before React renders it,\n * so two changes in one handler build on each other. While the caller holds\n * it, it's the value as rendered, since only the caller knows what it made\n * of a change.\n */\nfunction useTableState<T>(\n value: T | undefined,\n initial: T,\n onChange: ((next: T) => void) | undefined\n): [T, (next: T) => void, () => T] {\n const [own, setOwn] = useState(initial);\n const held = value !== undefined;\n const current = held ? value : own;\n const rendered = useLatestRef(current);\n // A value set since the last commit, cleared once a commit shows it.\n const pendingRef = useRef<{ value: T } | null>(null);\n useClientLayoutEffect(() => {\n pendingRef.current = null;\n });\n const set = useCallback(\n (next: T) => {\n if (!held) {\n pendingRef.current = { value: next };\n setOwn(next);\n }\n onChange?.(next);\n },\n [held, onChange]\n );\n const latest = useCallback(\n () => (pendingRef.current ? pendingRef.current.value : rendered.current),\n [rendered]\n );\n return [current, set, latest];\n}\n\nconst noSort: DataTableSort[] = [];\nconst noIds: string[] = [];\nconst noFilters: DataTableFilters = {};\n\n/**\n * `useDataTable` holds a table's sort, selection, page, search and filters,\n * works out its rows, and hands out props for bestax's own table parts, so\n * custom markup behaves as `DataTable` does. Pass its result to\n * `<DataTable table={table} />` to render it with DataTable's own markup,\n * with a toolbar or an export button elsewhere on the page.\n *\n * @example\n * const table = useDataTable({ columns, data: users, pageSize: 10 });\n *\n * <DataTable table={table} caption=\"Users\" hasSearch />\n */\nexport function useDataTable<TRow>(\n options: UseDataTableOptions<TRow>\n): DataTableModel<TRow> {\n const {\n columns,\n data,\n getRowId: rowIdOf,\n sort: sortProp,\n defaultSort = noSort,\n onSortChange,\n selectionMode = 'none',\n selected: selectedProp,\n defaultSelected = noIds,\n onSelectedChange,\n pageSize: pageSizeProp,\n page: pageProp,\n defaultPage = 1,\n onPageChange,\n search: searchProp,\n defaultSearch = '',\n onSearchChange,\n filters: filtersProp,\n defaultFilters = noFilters,\n onFiltersChange,\n manual = false,\n rowCount: rowCountProp,\n labels,\n } = options;\n\n const [sort, setSort] = useTableState(sortProp, defaultSort, onSortChange);\n const [selected, setSelected, latestSelected] = useTableState(\n selectedProp,\n defaultSelected,\n onSelectedChange\n );\n const [pageState, setPageState, latestPage] = useTableState(\n pageProp,\n defaultPage,\n onPageChange\n );\n const [search, setSearchState] = useTableState(\n searchProp,\n defaultSearch,\n onSearchChange\n );\n const [filters, setFiltersState, latestFilters] = useTableState(\n filtersProp,\n defaultFilters,\n onFiltersChange\n );\n\n const prefix = useClassPrefix();\n const { locale } = useLocale();\n const matchText = useLocaleMatcher();\n const formatNumber = useNumberFormat();\n const collator = useMemo(\n () => new Intl.Collator(locale, { numeric: true }),\n [locale]\n );\n\n const pageSize =\n pageSizeProp !== undefined &&\n Number.isFinite(pageSizeProp) &&\n pageSizeProp >= 1\n ? Math.floor(pageSizeProp)\n : undefined;\n\n const columnsById = useMemo(() => {\n const byId = new Map<string, DataTableColumn<TRow>>();\n for (const column of columns) {\n if (byId.has(column.id)) {\n warnOnce(\n 'DataTable:duplicate-column',\n `[bestax-bulma] DataTable has two columns with the id \"${column.id}\". ` +\n 'Give each column its own id: the sort, the filters and an export ' +\n 'find a column by it.'\n );\n } else {\n byId.set(column.id, column);\n }\n }\n return byId;\n }, [columns]);\n\n // Each row's id, by its index in `data`.\n const ids = useMemo(() => {\n const out = data.map((row, index) => {\n const id = rowIdOf ? rowIdOf(row, index) : idOf(row);\n if (id === undefined || id === '') {\n warnOnce(\n 'DataTable:missing-row-id',\n '[bestax-bulma] A DataTable row has no id, so it falls back to its ' +\n \"index, which doesn't survive the data changing. Give each row \" +\n 'an `id`, or pass `getRowId`.'\n );\n return String(index);\n }\n return id;\n });\n if (isDev() && new Set(out).size < out.length) {\n warnOnce(\n 'DataTable:duplicate-row-id',\n '[bestax-bulma] Two DataTable rows have the same id, so selecting ' +\n 'one selects both. Make the ids unique, or pass a `getRowId` ' +\n 'that does.'\n );\n }\n return out;\n }, [data, rowIdOf]);\n\n const indexOf = useMemo(() => {\n const map = new Map<TRow, number>();\n data.forEach((row, index) => {\n if (!map.has(row)) map.set(row, index);\n });\n return map;\n }, [data]);\n\n /** A row's id, from its index when the row is one of `data`. */\n const getRowId = useCallback(\n (row: TRow) => {\n const index = indexOf.get(row);\n if (index !== undefined) return ids[index];\n const id = rowIdOf ? rowIdOf(row, -1) : idOf(row);\n return id ?? '';\n },\n [indexOf, ids, rowIdOf]\n );\n\n // Every column's text for every row, worked out once per data and\n // columns, since the search reads them on every keystroke.\n const texts = useMemo(\n () => data.map(row => columns.map(column => readText(column, row))),\n [data, columns]\n );\n\n const sortedIndexes = useMemo(() => {\n const all = data.map((_, index) => index);\n if (manual) return all;\n const keys = sort\n .map(entry => ({\n column: columnsById.get(entry.id),\n descending: entry.direction === 'descending',\n }))\n .filter(\n (key): key is { column: DataTableColumn<TRow>; descending: boolean } =>\n key.column !== undefined\n );\n if (keys.length === 0) return all;\n const values = keys.map(({ column }) =>\n column.sortFn ? null : data.map(row => readValue(column, row))\n );\n return all.sort((x, y) => {\n for (let k = 0; k < keys.length; k++) {\n const { column, descending } = keys[k];\n let result: number;\n if (column.sortFn) {\n result = column.sortFn(data[x], data[y]);\n if (descending) result = -result;\n } else {\n const a = values[k]![x];\n const b = values[k]![y];\n const aEmpty = isEmptyValue(a);\n const bEmpty = isEmptyValue(b);\n if (aEmpty || bEmpty) {\n // Empty values go last whichever way the column sorts.\n result = Number(aEmpty) - Number(bEmpty);\n } else {\n result = compareValues(a, b, collator);\n if (descending) result = -result;\n }\n }\n if (result) return result;\n }\n // Ties keep the order of `data`.\n return x - y;\n });\n }, [data, sort, columnsById, collator, manual]);\n\n const filteredIndexes = useMemo(() => {\n if (manual) return sortedIndexes;\n const query = search.trim();\n const holds = matchText\n ? (text: string, needle: string) => matchText(text, needle)\n : (text: string, needle: string) =>\n text.toLowerCase().includes(needle.toLowerCase());\n const searched = columns\n .map((column, index) => ({ column, index }))\n .filter(({ column }) => column.filterable !== false);\n const filtered = Object.entries(filters)\n .filter(([, value]) => isActiveFilter(value))\n .map(([id, value]) => ({\n column: columnsById.get(id),\n index: columns.findIndex(column => column.id === id),\n value,\n }))\n .filter(\n ({ column }) => column !== undefined && column.filterable !== false\n );\n if (query === '' && filtered.length === 0) return sortedIndexes;\n return sortedIndexes.filter(rowIndex => {\n const row = data[rowIndex];\n const rowTexts = texts[rowIndex];\n for (const { column, index, value } of filtered) {\n // An array is any of its entries, as a multiple-choice filter gives.\n const passes = column!.filterFn\n ? column!.filterFn(row, value)\n : Array.isArray(value)\n ? value.some(entry => holds(rowTexts[index], String(entry)))\n : holds(rowTexts[index], String(value));\n if (!passes) return false;\n }\n return (\n query === '' ||\n searched.some(({ index }) => holds(rowTexts[index], query))\n );\n });\n }, [\n manual,\n sortedIndexes,\n search,\n filters,\n matchText,\n columns,\n columnsById,\n data,\n texts,\n ]);\n\n const knowsCount =\n rowCountProp !== undefined && Number.isFinite(rowCountProp);\n if (manual && pageSize !== undefined && !knowsCount) {\n warnOnce(\n 'DataTable:manual-row-count',\n '[bestax-bulma] A DataTable with `manual` and a `pageSize` has no ' +\n '`rowCount`, so it counts only the rows in `data`, makes one page ' +\n 'of them and shows no pager. Pass `rowCount`, how many rows match ' +\n 'on the server.'\n );\n }\n const rowCount = manual\n ? Math.max(\n Math.floor(knowsCount ? (rowCountProp as number) : data.length),\n 0\n )\n : filteredIndexes.length;\n const pageCount = pageSize ? Math.max(Math.ceil(rowCount / pageSize), 1) : 1;\n const page = Math.min(\n Math.max(Number.isFinite(pageState) ? Math.floor(pageState) : 1, 1),\n pageCount\n );\n\n const pageIndexes = useMemo(() => {\n if (manual || !pageSize) return filteredIndexes;\n return filteredIndexes.slice((page - 1) * pageSize, page * pageSize);\n }, [manual, pageSize, filteredIndexes, page]);\n\n const selectedSet = useMemo(() => new Set(selected), [selected]);\n const selectable = selectionMode === 'multiple';\n\n const rowsOf = useCallback(\n (indexes: number[]) => indexes.map(index => data[index]),\n [data]\n );\n\n const getRows = useCallback(\n (scope: DataTableRowScope = 'filtered') => {\n switch (scope) {\n case 'all':\n return rowsOf(sortedIndexes);\n case 'page':\n return rowsOf(pageIndexes);\n case 'selected':\n return rowsOf(\n filteredIndexes.filter(index => selectedSet.has(ids[index]))\n );\n default:\n return rowsOf(filteredIndexes);\n }\n },\n [rowsOf, sortedIndexes, pageIndexes, filteredIndexes, selectedSet, ids]\n );\n\n const getValue = useCallback(\n (row: TRow, columnId: string) => {\n const column = columnsById.get(columnId);\n return column ? readValue(column, row) : undefined;\n },\n [columnsById]\n );\n\n const getText = useCallback(\n (row: TRow, columnId: string) => {\n const column = columnsById.get(columnId);\n if (!column) return '';\n const index = indexOf.get(row);\n return index !== undefined\n ? texts[index][columns.indexOf(column)]\n : readText(column, row);\n },\n [columnsById, indexOf, columns, texts]\n );\n\n const labelColumn = columns.find(column => column.isRowHeader) ?? columns[0];\n const getRowLabel = useCallback(\n (row: TRow) =>\n (labelColumn && getText(row, labelColumn.id)) || getRowId(row),\n [labelColumn, getText, getRowId]\n );\n\n const isSelected = useCallback(\n (row: TRow) => selectable && selectedSet.has(getRowId(row)),\n [selectable, selectedSet, getRowId]\n );\n\n const setPage = useCallback(\n (next: number) => {\n if (next !== page) setPageState(next);\n },\n [page, setPageState]\n );\n\n // A new search or filter starts from the first page. It's measured against\n // the page as stored, not as shown: a page past the end shows the last,\n // and left stored it would come back once the rows grew again.\n const resetPage = useCallback(() => {\n if (latestPage() !== 1) setPageState(1);\n }, [latestPage, setPageState]);\n\n const setSearch = useCallback(\n (next: string) => {\n setSearchState(next);\n resetPage();\n },\n [setSearchState, resetPage]\n );\n\n const setFilters = useCallback(\n (next: DataTableFilters) => {\n setFiltersState(next);\n resetPage();\n },\n [setFiltersState, resetPage]\n );\n\n const setFilter = useCallback(\n (columnId: string, value: unknown) => {\n const next = { ...latestFilters() };\n if (isActiveFilter(value)) next[columnId] = value;\n else delete next[columnId];\n setFilters(next);\n },\n [latestFilters, setFilters]\n );\n\n const toggleSort = useCallback(\n (columnId: string) => {\n const column = columnsById.get(columnId);\n if (!column) return;\n const first: DataTableSortDirection = column.sortDescFirst\n ? 'descending'\n : 'ascending';\n const current = sort[0]?.id === columnId ? sort[0].direction : undefined;\n if (current === undefined) {\n setSort([{ id: columnId, direction: first }]);\n } else if (current === first) {\n setSort([\n {\n id: columnId,\n direction: first === 'ascending' ? 'descending' : 'ascending',\n },\n ]);\n } else {\n setSort([]);\n }\n },\n [columnsById, sort, setSort]\n );\n\n const toggleRowSelected = useCallback(\n (row: TRow, value?: boolean) => {\n const id = getRowId(row);\n const current = latestSelected();\n const has = current.includes(id);\n const on = value ?? !has;\n if (on === has) return;\n setSelected(on ? [...current, id] : current.filter(s => s !== id));\n },\n [getRowId, latestSelected, setSelected]\n );\n\n const pageIds = useMemo(\n () => pageIndexes.map(index => ids[index]),\n [pageIndexes, ids]\n );\n const pageSelectedCount = pageIds.filter(id => selectedSet.has(id)).length;\n const allPageSelected =\n pageIds.length > 0 && pageSelectedCount === pageIds.length;\n\n const togglePageSelected = useCallback(\n (value?: boolean) => {\n const current = latestSelected();\n const has = new Set(current);\n const on =\n value ?? !(pageIds.length > 0 && pageIds.every(id => has.has(id)));\n if (on) {\n const adding = pageIds.filter(id => !has.has(id));\n if (adding.length > 0) setSelected([...current, ...adding]);\n } else {\n const onPage = new Set(pageIds);\n const kept = current.filter(id => !onPage.has(id));\n if (kept.length !== current.length) setSelected(kept);\n }\n },\n [latestSelected, pageIds, setSelected]\n );\n\n const count = useCallback(\n (value: number) => (formatNumber ? formatNumber(value) : String(value)),\n [formatNumber]\n );\n\n const resolvedLabels: DataTableResolvedLabels = {\n selectAll:\n labels?.selectAll ||\n (pageCount > 1 ? 'Select all rows on this page' : 'Select all rows'),\n selectRow: labels?.selectRow ?? (label => `Select ${label}`),\n sortHint: labels?.sortHint || 'column headers with buttons are sortable',\n search: labels?.search || 'Search',\n results:\n labels?.results ??\n (total =>\n total === 0\n ? 'No rows match'\n : `${count(total)} ${total === 1 ? 'row matches' : 'rows match'}`),\n pageRange:\n labels?.pageRange ??\n ((first, last, total) =>\n `Showing ${count(first)} to ${count(last)} of ${count(total)}`),\n loading: labels?.loading || 'Loading',\n pagination: labels?.pagination || undefined,\n empty: labels?.empty || 'No rows to show.',\n noResults: labels?.noResults || 'No rows match.',\n };\n\n const toCSV = useCallback(\n ({\n rows = 'filtered',\n columns: ids,\n header = true,\n delimiter = ',',\n }: DataTableCSVOptions = {}) => {\n const written = ids\n ? ids\n .map(id => columnsById.get(id))\n .filter(\n (column): column is DataTableColumn<TRow> => column !== undefined\n )\n : columns;\n const line = (fields: string[]) =>\n fields.map(field => csvField(field, delimiter)).join(delimiter);\n const lines = getRows(rows).map(row =>\n line(written.map(column => getText(row, column.id)))\n );\n if (header) lines.unshift(line(written.map(column => column.header)));\n return lines.join('\\r\\n');\n },\n [columnsById, columns, getRows, getText]\n );\n\n const sortButtonClass = prefixedClassNames(prefix, 'data-table-sort');\n\n return {\n columns,\n state: { sort, selected, page, pageSize, search, filters },\n selectionMode,\n manual,\n rowCount,\n pageCount,\n labels: resolvedLabels,\n getRows,\n getRowId,\n getValue,\n getText,\n getRowLabel,\n toCSV,\n isSelected,\n setSort,\n toggleSort,\n setSelected,\n toggleRowSelected,\n togglePageSelected,\n setPage,\n setSearch,\n setFilter,\n setFilters,\n getHeaderCellProps: column => ({\n scope: 'col',\n 'aria-sort': sort[0]?.id === column.id ? sort[0].direction : undefined,\n isAligned: column.align,\n width: column.width,\n }),\n getSortButtonProps: column => ({\n type: 'button',\n className: sortButtonClass,\n onClick: () => toggleSort(column.id),\n }),\n getRowProps: row => ({ isSelected: isSelected(row) }),\n getCellProps: (_row, column) => ({\n scope: column.isRowHeader ? 'row' : undefined,\n isAligned: column.align,\n }),\n getSelectAllProps: () => ({\n 'aria-label': resolvedLabels.selectAll,\n checked: allPageSelected,\n indeterminate: pageSelectedCount > 0 && !allPageSelected,\n disabled: pageIds.length === 0,\n onChange: () => togglePageSelected(),\n }),\n getSelectRowProps: row => ({\n 'aria-label': resolvedLabels.selectRow(getRowLabel(row)),\n checked: selectedSet.has(getRowId(row)),\n onChange: () => toggleRowSelected(row),\n }),\n getPaginationProps: () => ({\n total: pageCount,\n current: page,\n onPageChange: setPage,\n }),\n getSearchProps: () => ({\n type: 'search',\n value: search,\n onChange: event => setSearch(event.target.value),\n }),\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;AAifA;AACA,SAAS,SAAS,CAAO,MAA6B,EAAE,GAAS,EAAA;AAC/D,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM;IAC3B,IAAI,OAAO,QAAQ,KAAK,UAAU;AAAE,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC;AACxD,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;IAC7D,OAAQ,GAAoC,EACzC,QAAQ,IAAI,MAAM,CAAC,EAAE,EACvB;AACH;AAEA;AACA,SAAS,QAAQ,CAAO,MAA6B,EAAE,GAAS,EAAA;IAC9D,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;IACpC,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,M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K,CAAC,MAAM,CAAC,KAAK,CAAC;SACjD,CAAC;KACH;AACH;;"}
|
|
1
|
+
{"version":3,"file":"useDataTable.js","sources":["../../../src/components/useDataTable.ts"],"sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { prefixedClassNames } from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport { useLocale } from '../helpers/LocaleProvider';\nimport { useLocaleMatcher, useNumberFormat } from '../helpers/localeFormat';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport type { TableAlignment } from '../elements/tableAlignment';\n\n/**\n * Carries a row type and adds nothing, so `DataTableColumnMeta` can take the\n * row type for the fields an add-on merges in while it has none of its own.\n */\ntype CarriesRow<TRow> = { [K in never]?: TRow };\n\n/**\n * Options of its own an add-on gives a column, read from the column's\n * `meta`. Empty in bestax: an add-on, such as a spreadsheet exporter, adds\n * its fields by declaration merging, and every column then takes them. Every\n * declaration of it names the row type the same way, `TRow`.\n *\n * @example\n * declare module '@allxsmith/bestax-bulma' {\n * interface DataTableColumnMeta<TRow> {\n * exportValue?: (row: TRow) => string | number;\n * }\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- empty so an add-on can merge into it\nexport interface DataTableColumnMeta<TRow = unknown> extends CarriesRow<TRow> {}\n\n/** What a column's `cell` is given beside the row. */\nexport interface DataTableCellContext {\n /** The column's raw value for the row, from its `accessor`. */\n value: unknown;\n /** The column's text for the row, from its `format`. */\n text: string;\n /** The row's id, from `getRowId`. */\n rowId: string;\n}\n\n/**\n * One column of a DataTable. A column keeps three things apart: its raw\n * value (`accessor`), which sorting and `filterFn` read; its text\n * (`format`), which the cell shows, the search matches and an export\n * writes; and its rich content (`cell`), which only the screen sees.\n */\nexport interface DataTableColumn<TRow> {\n /**\n * Names the column for good: the sort, the filters and an export refer to\n * it by this id. Unique within the table, and stable across renders.\n */\n id: string;\n /**\n * The column's name, as text: the header, the sort button's name, the\n * row checkboxes' names when it's the row header, and the header an\n * export writes.\n */\n header: string;\n /**\n * The raw value, for sorting and filtering: a key of the row, or a\n * function of it. Left out, it's the row's property named `id`.\n */\n accessor?: keyof TRow | ((row: TRow) => unknown);\n /**\n * The text for the value: what the cell shows when there's no `cell`, what\n * the search matches, and what an export writes. Left out, it's the value\n * as a string, and nothing for `null` or `undefined`. Give one for\n * numbers and dates you want written a certain way.\n */\n format?: (value: unknown, row: TRow) => string;\n /**\n * Rich content for the cell, such as a tag or a link. Only the screen\n * reads it: sorting, the search and an export use the value and its text.\n */\n cell?: (row: TRow, context: DataTableCellContext) => React.ReactNode;\n /**\n * Makes the header a button that sorts by this column: ascending, then\n * descending, then unsorted.\n */\n sortable?: boolean;\n /** Sorts descending on the first press, for a column read from the top, such as a score. */\n sortDescFirst?: boolean;\n /**\n * Compares two rows for an ascending sort, returning a negative number,\n * zero or a positive one. Descending reverses it. Without it, numbers,\n * dates and booleans compare by value, anything else by its text in the\n * `LocaleProvider`'s locale with numbers inside it read as numbers (\"Item\n * 9\" before \"Item 10\"), and an empty value goes last either way.\n */\n sortFn?: (a: TRow, b: TRow) => number;\n /**\n * Whether the column takes part in filtering: the search matches its\n * text, and `filters` can hold a value for it. `false` leaves it out of\n * both, as for a column of actions.\n */\n filterable?: boolean;\n /**\n * Decides whether a row passes this column's value in `filters`. Without\n * it, the column's text has to contain the value's text, compared as the\n * search compares.\n */\n filterFn?: (row: TRow, filterValue: unknown) => boolean;\n /** Aligns the header and the cells (`isAligned` on `Th` and `Td`). */\n align?: TableAlignment;\n /** The column's width, on its header cell: a number is pixels, a string any CSS length. */\n width?: string | number;\n /**\n * Renders this column's cells as row headers (`th scope=\"row\"`), which a\n * screen reader reads out with the other cells of the row. The row's\n * checkbox is named from it. Mark one column, usually the first.\n */\n isRowHeader?: boolean;\n /** Options of an add-on's own, as `DataTableColumnMeta` declares them. */\n meta?: DataTableColumnMeta<TRow>;\n}\n\n/** The direction of a sort, in `aria-sort`'s words. */\nexport type DataTableSortDirection = 'ascending' | 'descending';\n\n/** One column a DataTable sorts by. */\nexport interface DataTableSort {\n /** The column's `id`. */\n id: string;\n /** Which way it sorts. */\n direction: DataTableSortDirection;\n}\n\n/** The values per column `filters` holds, keyed by column `id`. */\nexport type DataTableFilters = Record<string, unknown>;\n\n/**\n * Which of a table's rows to read: `all` of `data`, `filtered` (the ones the\n * search and the filters let through, from every page), the `page` shown,\n * or the `selected` ones the filters let through. Each comes in the order\n * the table shows them.\n */\nexport type DataTableRowScope = 'all' | 'filtered' | 'page' | 'selected';\n\n/** Whether a DataTable has row checkboxes. */\nexport type DataTableSelectionMode = 'none' | 'multiple';\n\n/**\n * The words a DataTable writes. Each is English unless you give your own,\n * and the numbers in the default messages are written in the\n * `LocaleProvider`'s locale.\n */\nexport interface DataTableLabels {\n /**\n * The header checkbox's name. \"Select all rows\", or \"Select all rows on\n * this page\" when there's more than one page, since it then covers the\n * page shown.\n */\n selectAll?: string;\n /** A row checkbox's name, from the row's label (`label => 'Select ' + label`). */\n selectRow?: (rowLabel: string) => string;\n /**\n * Says that headers with buttons sort: hidden at the end of the caption,\n * after a comma, or as a hidden caption of its own. \"column headers with\n * buttons are sortable\".\n */\n sortHint?: string;\n /** The search field's label. \"Search\". */\n search?: string;\n /** Announced after the search or a filter changes (\"12 rows match\"). */\n results?: (count: number) => string;\n /** Announced after the page changes (\"Showing 11 to 20 of 57\"). */\n pageRange?: (first: number, last: number, total: number) => string;\n /** Announced while `loading`, once the search, a filter or the page has changed. \"Loading\". */\n loading?: string;\n /**\n * The pager's name. \"{the table's name} pages\" when the table is named by\n * `aria-label` or a text `caption`, so two tables' pagers have different\n * names, else `Pagination`'s own.\n */\n pagination?: string;\n /** What the table shows with no rows at all. \"No rows to show.\" */\n empty?: string;\n /** What the table shows when the search and filters let no row through. \"No rows match.\" */\n noResults?: string;\n}\n\n/** The words a DataTable writes, with every default filled in. */\nexport interface DataTableResolvedLabels extends Required<\n Omit<DataTableLabels, 'pagination'>\n> {\n /** The pager's name, when one was given. */\n pagination?: string;\n}\n\n/**\n * The options `useDataTable` and `DataTable` share, beside the columns and\n * the data. Each piece of state is yours when you pass its value (and its\n * `on…Change`), or the table's own, starting from its `default…`.\n */\nexport interface DataTableStateOptions<TRow> {\n /**\n * A row's id, unique and stable, which the selection is a list of. Left\n * out, it's the row's `id` property as a string. A development build\n * warns about a missing or repeated id, and a row with none falls back to\n * its index, which doesn't survive the data changing.\n */\n getRowId?: (row: TRow, index: number) => string;\n /**\n * The sort when you hold it: an array of `{ id, direction }`, the first\n * deciding and each next one breaking ties. The headers set one at a time.\n */\n sort?: DataTableSort[];\n /**\n * The sort to start with when the table holds it. Text sorts in the\n * `LocaleProvider`'s locale, or the runtime's own outside one, which can\n * differ between a server and the browser, so put a table rendered on the\n * server sorted inside a `LocaleProvider`.\n */\n defaultSort?: DataTableSort[];\n /** Called with the new sort when a header is pressed. */\n onSortChange?: (sort: DataTableSort[]) => void;\n /**\n * `multiple` adds a checkbox to each row and a \"select all\" checkbox to the header.\n *\n * @defaultValue 'none'\n */\n selectionMode?: DataTableSelectionMode;\n /**\n * The selected rows' ids when you hold them. They stay selected while the\n * search, a filter or the page hides them.\n */\n selected?: string[];\n /** The rows selected to begin with, by id, when the table holds them. */\n defaultSelected?: string[];\n /** Called with every selected id after a checkbox changes. */\n onSelectedChange?: (selected: string[]) => void;\n /** Rows per page. Set, the table pages through `Pagination`; left out, it shows every row. */\n pageSize?: number;\n /**\n * The page shown when you hold it, counting from 1. A page past the end\n * shows the last.\n */\n page?: number;\n /**\n * The page to start on when the table holds it.\n *\n * @defaultValue 1\n */\n defaultPage?: number;\n /**\n * Called with the page chosen in the pager, and with 1 when the search or\n * a filter changes through the table while the page held isn't 1, even\n * when a page past the end shows as the last.\n */\n onPageChange?: (page: number) => void;\n /**\n * The search when you hold it, matched against every filterable column's\n * text: in the `LocaleProvider`'s locale, ignoring case and the accents\n * the language ignores, or a case-insensitive substring outside one.\n */\n search?: string;\n /** The search to start with when the table holds it. */\n defaultSearch?: string;\n /** Called with the search as it changes through the table. */\n onSearchChange?: (search: string) => void;\n /**\n * A value per column, by `id`, when you hold them. A row passes when every\n * column with a value passes it: the column's `filterFn` if it has one,\n * given the value as it is, or else the column's text has to contain the\n * value's text, compared as the search compares. An array is a choice of\n * values, as a multiple-choice filter gives, and passes a row whose text\n * contains any of them. A value of `undefined`, `null`, `''` or an empty\n * array is no filter.\n */\n filters?: DataTableFilters;\n /** The filters to start with when the table holds them. */\n defaultFilters?: DataTableFilters;\n /** Called with every filter value after one changes through the table. */\n onFiltersChange?: (filters: DataTableFilters) => void;\n /**\n * Hands sorting, filtering and paging to a server: the table shows `data`\n * as given, as the current page, and only reports the state as it\n * changes.\n */\n manual?: boolean;\n /**\n * With `manual`, how many rows match in all, which sets the page count and\n * the announced count. Without it, the table counts the rows in `data`,\n * which with a `pageSize` is one page and no pager, and a development\n * build warns.\n */\n rowCount?: number;\n /** The words the table writes, in your app's language. */\n labels?: DataTableLabels;\n}\n\n/** What `useDataTable` takes. */\nexport interface UseDataTableOptions<TRow> extends DataTableStateOptions<TRow> {\n /**\n * The columns, in the order they're shown. Keep the array the same from\n * one render to the next, defined outside the component or in `useMemo`:\n * a new one has every cell's text worked out again.\n */\n columns: DataTableColumn<TRow>[];\n /** The rows, as records of your own. */\n data: TRow[];\n}\n\n/** The table's state, as it stands. */\nexport interface DataTableState {\n /** The sort, the first entry deciding. */\n sort: DataTableSort[];\n /** The selected rows' ids. */\n selected: string[];\n /** The page shown, counting from 1. */\n page: number;\n /** Rows per page, or `undefined` when it doesn't page. */\n pageSize: number | undefined;\n /** The search. */\n search: string;\n /** The filter values, by column id. */\n filters: DataTableFilters;\n}\n\n/** The props `getSortButtonProps` gives a header's `<button>`. */\nexport interface DataTableSortButtonProps {\n type: 'button';\n className: string;\n onClick: () => void;\n}\n\n/** The props `getSearchProps` gives a search `<input>` or bestax `Input`. */\nexport interface DataTableSearchProps {\n type: 'search';\n value: string;\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\n/** The props `getHeaderCellProps` gives a column's `Th`. */\nexport interface DataTableHeaderCellProps {\n scope: 'col';\n 'aria-sort'?: DataTableSortDirection;\n isAligned?: TableAlignment;\n width?: string | number;\n}\n\n/** The props `getCellProps` gives a row's `Td`, or its `Th` for the row header. */\nexport interface DataTableCellProps {\n scope?: 'row';\n isAligned?: TableAlignment;\n}\n\n/** The props `getSelectAllProps` and `getSelectRowProps` give a `Checkbox`. */\nexport interface DataTableCheckboxProps {\n 'aria-label': string;\n checked: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n onChange: () => void;\n}\n\n/** The props `getPaginationProps` gives `Pagination`. */\nexport interface DataTablePaginationProps {\n total: number;\n current: number;\n onPageChange: (page: number) => void;\n}\n\n/** What `toCSV` writes. */\nexport interface DataTableCSVOptions {\n /**\n * Which rows, in the order the table shows them: the ones the search and\n * filters let through, from every page, by default, or `all`, `page` or\n * `selected`.\n *\n * @defaultValue 'filtered'\n */\n rows?: DataTableRowScope;\n /** The ids of the columns to write, in that order. Every column, in the order shown, by default. */\n columns?: string[];\n /**\n * Writes the columns' headers as the first line.\n *\n * @defaultValue true\n */\n header?: boolean;\n /**\n * What separates the fields. A semicolon suits a spreadsheet that reads\n * a comma as the decimal point, as Excel does in much of Europe.\n *\n * @defaultValue ','\n */\n delimiter?: string;\n}\n\n/**\n * A table: what `useDataTable` returns, what `DataTable`'s `toolbar` is\n * given, and what its `table` takes. It reads the rows and the state, changes\n * the state, and hands out props for bestax's own `Th`, `Tr`, `Td`,\n * `Checkbox` and `Pagination`, so markup of your own behaves as DataTable's\n * does.\n */\nexport interface DataTableModel<TRow> {\n /** The columns, in the order they're shown. */\n columns: DataTableColumn<TRow>[];\n /** The state as it stands. */\n state: DataTableState;\n /** Whether rows have checkboxes. */\n selectionMode: DataTableSelectionMode;\n /** Whether a server sorts, filters and pages (`manual`). */\n manual: boolean;\n /** How many rows the search and filters let through, or `rowCount` with `manual`. */\n rowCount: number;\n /** How many pages there are, at least 1. */\n pageCount: number;\n /** The words the table writes, with the defaults filled in. */\n labels: DataTableResolvedLabels;\n /** The rows in `scope` (`filtered` by default), in the order the table shows them. */\n getRows: (scope?: DataTableRowScope) => TRow[];\n /** A row's id. */\n getRowId: (row: TRow) => string;\n /** A column's raw value for a row, or `undefined` for a column it doesn't have. */\n getValue: (row: TRow, columnId: string) => unknown;\n /** A column's text for a row, or `''` for a column it doesn't have. */\n getText: (row: TRow, columnId: string) => string;\n /** What names a row: its row header's text, or its first column's. */\n getRowLabel: (row: TRow) => string;\n /**\n * The rows as CSV, from the columns' text (`format`, not `cell`), with a\n * line break of `\\r\\n` between rows and fields quoted as RFC 4180 asks.\n * A field that starts with `=`, `+`, `-`, `@`, a tab or a carriage return\n * gets a `'` in front, so a spreadsheet shows it as text rather than\n * running it as a formula, unless it's a plain number such as `-12.5`.\n * Excel takes a file as UTF-8 only when it starts with a byte order mark,\n * so put `\\uFEFF` in front of the text when you save it for Excel.\n */\n toCSV: (options?: DataTableCSVOptions) => string;\n /** Whether a row is selected. */\n isSelected: (row: TRow) => boolean;\n /** Sets the sort. */\n setSort: (sort: DataTableSort[]) => void;\n /** Moves a column through its sort, as its header button does. */\n toggleSort: (columnId: string) => void;\n /** Sets the selected ids. */\n setSelected: (selected: string[]) => void;\n /**\n * Selects a row, or clears it, or with no `selected` flips it. Called\n * twice in one handler, the second call builds on the first while the\n * table holds the selection. While you hold it, each call builds on the\n * selection as rendered, so make several changes at once with\n * `setSelected`.\n */\n toggleRowSelected: (row: TRow, selected?: boolean) => void;\n /**\n * Selects every row on the page, or clears them, or with no `selected`\n * does what the header checkbox does. It builds on earlier calls as\n * `toggleRowSelected` does.\n */\n togglePageSelected: (selected?: boolean) => void;\n /** Goes to a page, counting from 1. */\n setPage: (page: number) => void;\n /**\n * Sets the search, and goes back to page 1, calling `onPageChange` with 1\n * unless the page held is 1 already.\n */\n setSearch: (search: string) => void;\n /**\n * Sets one column's filter value, and goes back to page 1. Called twice in\n * one handler, the second call builds on the first while the table holds\n * the filters. While you hold them, each call builds on the filters as\n * rendered, so set several at once with `setFilters`.\n */\n setFilter: (columnId: string, value: unknown) => void;\n /** Sets every filter value, and goes back to page 1, as `setSearch` does. */\n setFilters: (filters: DataTableFilters) => void;\n /** Props for a column's `Th`: its scope, its `aria-sort` while sorted, its alignment and width. */\n getHeaderCellProps: (\n column: DataTableColumn<TRow>\n ) => DataTableHeaderCellProps;\n /** Props for the `<button>` in a sortable column's header. */\n getSortButtonProps: (\n column: DataTableColumn<TRow>\n ) => DataTableSortButtonProps;\n /** Props for a row's `Tr`: Bulma's selected look while it's selected. */\n getRowProps: (row: TRow) => { isSelected: boolean };\n /** Props for a row's cell in a column: its alignment, and `scope=\"row\"` for the row header. */\n getCellProps: (\n row: TRow,\n column: DataTableColumn<TRow>\n ) => DataTableCellProps;\n /** Props for the header's \"select all\" `Checkbox`, which covers the page shown. */\n getSelectAllProps: () => DataTableCheckboxProps;\n /** Props for a row's `Checkbox`, named for the row. */\n getSelectRowProps: (row: TRow) => DataTableCheckboxProps;\n /** Props for `Pagination`: the page count, the page and the handler. */\n getPaginationProps: () => DataTablePaginationProps;\n /** Props for a search field, bound to the search. */\n getSearchProps: () => DataTableSearchProps;\n}\n\n/** A column's raw value for a row. */\nfunction readValue<TRow>(column: DataTableColumn<TRow>, row: TRow): unknown {\n const { accessor } = column;\n if (typeof accessor === 'function') return accessor(row);\n if (row === null || typeof row !== 'object') return undefined;\n return (row as Record<PropertyKey, unknown>)[\n (accessor ?? column.id) as PropertyKey\n ];\n}\n\n/** A column's text for a row. */\nfunction readText<TRow>(column: DataTableColumn<TRow>, row: TRow): string {\n const value = readValue(column, row);\n if (column.format) return column.format(value, row);\n return value === null || value === undefined ? '' : String(value);\n}\n\n/** Whether a value sorts as empty: nothing, no text, or no number or date. */\nfunction isEmptyValue(value: unknown): boolean {\n return (\n value === null ||\n value === undefined ||\n value === '' ||\n (typeof value === 'number' && Number.isNaN(value)) ||\n (value instanceof Date && Number.isNaN(value.getTime()))\n );\n}\n\n/** Compares two values that aren't empty, for an ascending sort. */\nfunction compareValues(a: unknown, b: unknown, collator: Intl.Collator) {\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return Number(a) - Number(b);\n }\n return collator.compare(String(a), String(b));\n}\n\n/** Whether a filter value filters anything. */\nfunction isActiveFilter(value: unknown): boolean {\n return (\n value !== undefined &&\n value !== null &&\n value !== '' &&\n !(Array.isArray(value) && value.length === 0)\n );\n}\n\n/** A field a spreadsheet would read as the start of a formula. */\nconst formulaStart = /^[=+\\-@\\t\\r]/;\n/** A plain number, signed, with any grouping, which no spreadsheet runs. */\nconst plainNumber = /^[+-]?\\d[\\d.,]*$/;\n\n/**\n * One CSV field: a `'` in front of what would start a formula, then quoted\n * when it holds the delimiter, a quote or a line break, its quotes doubled.\n */\nfunction csvField(text: string, delimiter: string): string {\n const safe =\n formulaStart.test(text) && !plainNumber.test(text) ? `'${text}` : text;\n return safe.includes(delimiter) || /[\"\\r\\n]/.test(safe)\n ? `\"${safe.replace(/\"/g, '\"\"')}\"`\n : safe;\n}\n\n/**\n * Whether a search or a filter value is narrowing the rows. Used by\n * DataTable to tell an empty table from one with no matches.\n */\nexport function isFiltering(search: string, filters: DataTableFilters) {\n return search.trim() !== '' || Object.values(filters).some(isActiveFilter);\n}\n\n/** A row's id from its `id` property, or nothing when it has none. */\nfunction idOf(row: unknown): string | undefined {\n if (row === null || typeof row !== 'object') return undefined;\n const id = (row as { id?: unknown }).id;\n return id === undefined || id === null || id === '' ? undefined : String(id);\n}\n\n/**\n * A piece of state that's the caller's when they pass its value, and the\n * table's own otherwise. Setting it calls the change handler either way.\n *\n * It also returns `latest`, what a change should build on. While the table\n * holds the state, that's the value last set, even before React renders it,\n * so two changes in one handler build on each other. While the caller holds\n * it, it's the value as rendered, since only the caller knows what it made\n * of a change.\n */\nfunction useTableState<T>(\n value: T | undefined,\n initial: T,\n onChange: ((next: T) => void) | undefined\n): [T, (next: T) => void, () => T] {\n const [own, setOwn] = useState(initial);\n const held = value !== undefined;\n const current = held ? value : own;\n const rendered = useLatestRef(current);\n // A value set since the last commit, cleared once a commit shows it.\n const pendingRef = useRef<{ value: T } | null>(null);\n useClientLayoutEffect(() => {\n pendingRef.current = null;\n });\n const set = useCallback(\n (next: T) => {\n if (!held) {\n pendingRef.current = { value: next };\n setOwn(next);\n }\n onChange?.(next);\n },\n [held, onChange]\n );\n const latest = useCallback(\n () => (pendingRef.current ? pendingRef.current.value : rendered.current),\n [rendered]\n );\n return [current, set, latest];\n}\n\nconst noSort: DataTableSort[] = [];\nconst noIds: string[] = [];\nconst noFilters: DataTableFilters = {};\n\n/**\n * `useDataTable` holds a table's sort, selection, page, search and filters,\n * works out its rows, and hands out props for bestax's own table parts, so\n * custom markup behaves as `DataTable` does. Pass its result to\n * `<DataTable table={table} />` to render it with DataTable's own markup,\n * with a toolbar or an export button elsewhere on the page.\n *\n * @example\n * const table = useDataTable({ columns, data: users, pageSize: 10 });\n *\n * <DataTable table={table} caption=\"Users\" hasSearch />\n */\nexport function useDataTable<TRow>(\n options: UseDataTableOptions<TRow>\n): DataTableModel<TRow> {\n const {\n columns,\n data,\n getRowId: rowIdOf,\n sort: sortProp,\n defaultSort = noSort,\n onSortChange,\n selectionMode = 'none',\n selected: selectedProp,\n defaultSelected = noIds,\n onSelectedChange,\n pageSize: pageSizeProp,\n page: pageProp,\n defaultPage = 1,\n onPageChange,\n search: searchProp,\n defaultSearch = '',\n onSearchChange,\n filters: filtersProp,\n defaultFilters = noFilters,\n onFiltersChange,\n manual = false,\n rowCount: rowCountProp,\n labels,\n } = options;\n\n const [sort, setSort] = useTableState(sortProp, defaultSort, onSortChange);\n const [selected, setSelected, latestSelected] = useTableState(\n selectedProp,\n defaultSelected,\n onSelectedChange\n );\n const [pageState, setPageState, latestPage] = useTableState(\n pageProp,\n defaultPage,\n onPageChange\n );\n const [search, setSearchState] = useTableState(\n searchProp,\n defaultSearch,\n onSearchChange\n );\n const [filters, setFiltersState, latestFilters] = useTableState(\n filtersProp,\n defaultFilters,\n onFiltersChange\n );\n\n const prefix = useClassPrefix();\n const { locale } = useLocale();\n const matchText = useLocaleMatcher();\n const formatNumber = useNumberFormat();\n const collator = useMemo(\n () => new Intl.Collator(locale, { numeric: true }),\n [locale]\n );\n\n const pageSize =\n pageSizeProp !== undefined &&\n Number.isFinite(pageSizeProp) &&\n pageSizeProp >= 1\n ? Math.floor(pageSizeProp)\n : undefined;\n\n const columnsById = useMemo(() => {\n const byId = new Map<string, DataTableColumn<TRow>>();\n for (const column of columns) {\n if (byId.has(column.id)) {\n warnOnce(\n 'DataTable:duplicate-column',\n `[bestax-bulma] DataTable has two columns with the id \"${column.id}\". ` +\n 'Give each column its own id: the sort, the filters and an export ' +\n 'find a column by it.'\n );\n } else {\n byId.set(column.id, column);\n }\n }\n return byId;\n }, [columns]);\n\n // Each row's id, by its index in `data`.\n const ids = useMemo(() => {\n const out = data.map((row, index) => {\n const id = rowIdOf ? rowIdOf(row, index) : idOf(row);\n if (id === undefined || id === '') {\n warnOnce(\n 'DataTable:missing-row-id',\n '[bestax-bulma] A DataTable row has no id, so it falls back to its ' +\n \"index, which doesn't survive the data changing. Give each row \" +\n 'an `id`, or pass `getRowId`.'\n );\n return String(index);\n }\n return id;\n });\n if (isDev() && new Set(out).size < out.length) {\n warnOnce(\n 'DataTable:duplicate-row-id',\n '[bestax-bulma] Two DataTable rows have the same id, so selecting ' +\n 'one selects both. Make the ids unique, or pass a `getRowId` ' +\n 'that does.'\n );\n }\n return out;\n }, [data, rowIdOf]);\n\n const indexOf = useMemo(() => {\n const map = new Map<TRow, number>();\n data.forEach((row, index) => {\n if (!map.has(row)) map.set(row, index);\n });\n return map;\n }, [data]);\n\n /** A row's id, from its index when the row is one of `data`. */\n const getRowId = useCallback(\n (row: TRow) => {\n const index = indexOf.get(row);\n if (index !== undefined) return ids[index];\n const id = rowIdOf ? rowIdOf(row, -1) : idOf(row);\n return id ?? '';\n },\n [indexOf, ids, rowIdOf]\n );\n\n // Every column's text for every row, worked out once per data and\n // columns, since the search reads them on every keystroke.\n const texts = useMemo(\n () => data.map(row => columns.map(column => readText(column, row))),\n [data, columns]\n );\n\n const sortedIndexes = useMemo(() => {\n const all = data.map((_, index) => index);\n if (manual) return all;\n const keys = sort\n .map(entry => ({\n column: columnsById.get(entry.id),\n descending: entry.direction === 'descending',\n }))\n .filter(\n (key): key is { column: DataTableColumn<TRow>; descending: boolean } =>\n key.column !== undefined\n );\n if (keys.length === 0) return all;\n const values = keys.map(({ column }) =>\n column.sortFn ? null : data.map(row => readValue(column, row))\n );\n return all.sort((x, y) => {\n for (let k = 0; k < keys.length; k++) {\n const { column, descending } = keys[k];\n let result: number;\n if (column.sortFn) {\n result = column.sortFn(data[x], data[y]);\n if (descending) result = -result;\n } else {\n const a = values[k]![x];\n const b = values[k]![y];\n const aEmpty = isEmptyValue(a);\n const bEmpty = isEmptyValue(b);\n if (aEmpty || bEmpty) {\n // Empty values go last whichever way the column sorts.\n result = Number(aEmpty) - Number(bEmpty);\n } else {\n result = compareValues(a, b, collator);\n if (descending) result = -result;\n }\n }\n if (result) return result;\n }\n // Ties keep the order of `data`.\n return x - y;\n });\n }, [data, sort, columnsById, collator, manual]);\n\n const filteredIndexes = useMemo(() => {\n if (manual) return sortedIndexes;\n const query = search.trim();\n const holds = matchText\n ? (text: string, needle: string) => matchText(text, needle)\n : (text: string, needle: string) =>\n text.toLowerCase().includes(needle.toLowerCase());\n const searched = columns\n .map((column, index) => ({ column, index }))\n .filter(({ column }) => column.filterable !== false);\n const filtered = Object.entries(filters)\n .filter(([, value]) => isActiveFilter(value))\n .map(([id, value]) => ({\n column: columnsById.get(id),\n index: columns.findIndex(column => column.id === id),\n value,\n }))\n .filter(\n ({ column }) => column !== undefined && column.filterable !== false\n );\n if (query === '' && filtered.length === 0) return sortedIndexes;\n return sortedIndexes.filter(rowIndex => {\n const row = data[rowIndex];\n const rowTexts = texts[rowIndex];\n for (const { column, index, value } of filtered) {\n // An array is any of its entries, as a multiple-choice filter gives.\n const passes = column!.filterFn\n ? column!.filterFn(row, value)\n : Array.isArray(value)\n ? value.some(entry => holds(rowTexts[index], String(entry)))\n : holds(rowTexts[index], String(value));\n if (!passes) return false;\n }\n return (\n query === '' ||\n searched.some(({ index }) => holds(rowTexts[index], query))\n );\n });\n }, [\n manual,\n sortedIndexes,\n search,\n filters,\n matchText,\n columns,\n columnsById,\n data,\n texts,\n ]);\n\n const knowsCount =\n rowCountProp !== undefined && Number.isFinite(rowCountProp);\n if (manual && pageSize !== undefined && !knowsCount) {\n warnOnce(\n 'DataTable:manual-row-count',\n '[bestax-bulma] A DataTable with `manual` and a `pageSize` has no ' +\n '`rowCount`, so it counts only the rows in `data`, makes one page ' +\n 'of them and shows no pager. Pass `rowCount`, how many rows match ' +\n 'on the server.'\n );\n }\n const rowCount = manual\n ? Math.max(\n Math.floor(knowsCount ? (rowCountProp as number) : data.length),\n 0\n )\n : filteredIndexes.length;\n const pageCount = pageSize ? Math.max(Math.ceil(rowCount / pageSize), 1) : 1;\n const page = Math.min(\n Math.max(Number.isFinite(pageState) ? Math.floor(pageState) : 1, 1),\n pageCount\n );\n\n const pageIndexes = useMemo(() => {\n if (manual || !pageSize) return filteredIndexes;\n return filteredIndexes.slice((page - 1) * pageSize, page * pageSize);\n }, [manual, pageSize, filteredIndexes, page]);\n\n const selectedSet = useMemo(() => new Set(selected), [selected]);\n const selectable = selectionMode === 'multiple';\n\n const rowsOf = useCallback(\n (indexes: number[]) => indexes.map(index => data[index]),\n [data]\n );\n\n const getRows = useCallback(\n (scope: DataTableRowScope = 'filtered') => {\n switch (scope) {\n case 'all':\n return rowsOf(sortedIndexes);\n case 'page':\n return rowsOf(pageIndexes);\n case 'selected':\n return rowsOf(\n filteredIndexes.filter(index => selectedSet.has(ids[index]))\n );\n default:\n return rowsOf(filteredIndexes);\n }\n },\n [rowsOf, sortedIndexes, pageIndexes, filteredIndexes, selectedSet, ids]\n );\n\n const getValue = useCallback(\n (row: TRow, columnId: string) => {\n const column = columnsById.get(columnId);\n return column ? readValue(column, row) : undefined;\n },\n [columnsById]\n );\n\n const getText = useCallback(\n (row: TRow, columnId: string) => {\n const column = columnsById.get(columnId);\n if (!column) return '';\n const index = indexOf.get(row);\n return index !== undefined\n ? texts[index][columns.indexOf(column)]\n : readText(column, row);\n },\n [columnsById, indexOf, columns, texts]\n );\n\n const labelColumn = columns.find(column => column.isRowHeader) ?? columns[0];\n const getRowLabel = useCallback(\n (row: TRow) =>\n (labelColumn && getText(row, labelColumn.id)) || getRowId(row),\n [labelColumn, getText, getRowId]\n );\n\n const isSelected = useCallback(\n (row: TRow) => selectable && selectedSet.has(getRowId(row)),\n [selectable, selectedSet, getRowId]\n );\n\n const setPage = useCallback(\n (next: number) => {\n if (next !== page) setPageState(next);\n },\n [page, setPageState]\n );\n\n // A new search or filter starts from the first page. It's measured against\n // the page as stored, not as shown: a page past the end shows the last,\n // and left stored it would come back once the rows grew again.\n const resetPage = useCallback(() => {\n if (latestPage() !== 1) setPageState(1);\n }, [latestPage, setPageState]);\n\n const setSearch = useCallback(\n (next: string) => {\n setSearchState(next);\n resetPage();\n },\n [setSearchState, resetPage]\n );\n\n const setFilters = useCallback(\n (next: DataTableFilters) => {\n setFiltersState(next);\n resetPage();\n },\n [setFiltersState, resetPage]\n );\n\n const setFilter = useCallback(\n (columnId: string, value: unknown) => {\n const next = { ...latestFilters() };\n if (isActiveFilter(value)) next[columnId] = value;\n else delete next[columnId];\n setFilters(next);\n },\n [latestFilters, setFilters]\n );\n\n const toggleSort = useCallback(\n (columnId: string) => {\n const column = columnsById.get(columnId);\n if (!column) return;\n const first: DataTableSortDirection = column.sortDescFirst\n ? 'descending'\n : 'ascending';\n const current = sort[0]?.id === columnId ? sort[0].direction : undefined;\n if (current === undefined) {\n setSort([{ id: columnId, direction: first }]);\n } else if (current === first) {\n setSort([\n {\n id: columnId,\n direction: first === 'ascending' ? 'descending' : 'ascending',\n },\n ]);\n } else {\n setSort([]);\n }\n },\n [columnsById, sort, setSort]\n );\n\n const toggleRowSelected = useCallback(\n (row: TRow, value?: boolean) => {\n const id = getRowId(row);\n const current = latestSelected();\n const has = current.includes(id);\n const on = value ?? !has;\n if (on === has) return;\n setSelected(on ? [...current, id] : current.filter(s => s !== id));\n },\n [getRowId, latestSelected, setSelected]\n );\n\n const pageIds = useMemo(\n () => pageIndexes.map(index => ids[index]),\n [pageIndexes, ids]\n );\n const pageSelectedCount = pageIds.filter(id => selectedSet.has(id)).length;\n const allPageSelected =\n pageIds.length > 0 && pageSelectedCount === pageIds.length;\n\n const togglePageSelected = useCallback(\n (value?: boolean) => {\n const current = latestSelected();\n const has = new Set(current);\n const on =\n value ?? !(pageIds.length > 0 && pageIds.every(id => has.has(id)));\n if (on) {\n const adding = pageIds.filter(id => !has.has(id));\n if (adding.length > 0) setSelected([...current, ...adding]);\n } else {\n const onPage = new Set(pageIds);\n const kept = current.filter(id => !onPage.has(id));\n if (kept.length !== current.length) setSelected(kept);\n }\n },\n [latestSelected, pageIds, setSelected]\n );\n\n const count = useCallback(\n (value: number) => (formatNumber ? formatNumber(value) : String(value)),\n [formatNumber]\n );\n\n const resolvedLabels: DataTableResolvedLabels = {\n selectAll:\n labels?.selectAll ||\n (pageCount > 1 ? 'Select all rows on this page' : 'Select all rows'),\n selectRow: labels?.selectRow ?? (label => `Select ${label}`),\n sortHint: labels?.sortHint || 'column headers with buttons are sortable',\n search: labels?.search || 'Search',\n results:\n labels?.results ??\n (total =>\n total === 0\n ? 'No rows match'\n : `${count(total)} ${total === 1 ? 'row matches' : 'rows match'}`),\n pageRange:\n labels?.pageRange ??\n ((first, last, total) =>\n `Showing ${count(first)} to ${count(last)} of ${count(total)}`),\n loading: labels?.loading || 'Loading',\n pagination: labels?.pagination || undefined,\n empty: labels?.empty || 'No rows to show.',\n noResults: labels?.noResults || 'No rows match.',\n };\n\n const toCSV = useCallback(\n ({\n rows = 'filtered',\n columns: ids,\n header = true,\n delimiter = ',',\n }: DataTableCSVOptions = {}) => {\n const written = ids\n ? ids\n .map(id => columnsById.get(id))\n .filter(\n (column): column is DataTableColumn<TRow> => column !== undefined\n )\n : columns;\n const line = (fields: string[]) =>\n fields.map(field => csvField(field, delimiter)).join(delimiter);\n const lines = getRows(rows).map(row =>\n line(written.map(column => getText(row, column.id)))\n );\n if (header) lines.unshift(line(written.map(column => column.header)));\n return lines.join('\\r\\n');\n },\n [columnsById, columns, getRows, getText]\n );\n\n const sortButtonClass = prefixedClassNames(prefix, 'data-table-sort');\n\n return {\n columns,\n state: { sort, selected, page, pageSize, search, filters },\n selectionMode,\n manual,\n rowCount,\n pageCount,\n labels: resolvedLabels,\n getRows,\n getRowId,\n getValue,\n getText,\n getRowLabel,\n toCSV,\n isSelected,\n setSort,\n toggleSort,\n setSelected,\n toggleRowSelected,\n togglePageSelected,\n setPage,\n setSearch,\n setFilter,\n setFilters,\n getHeaderCellProps: column => ({\n scope: 'col',\n 'aria-sort': sort[0]?.id === column.id ? sort[0].direction : undefined,\n isAligned: column.align,\n width: column.width,\n }),\n getSortButtonProps: column => ({\n type: 'button',\n className: sortButtonClass,\n onClick: () => toggleSort(column.id),\n }),\n getRowProps: row => ({ isSelected: isSelected(row) }),\n getCellProps: (_row, column) => ({\n scope: column.isRowHeader ? 'row' : undefined,\n isAligned: column.align,\n }),\n getSelectAllProps: () => ({\n 'aria-label': resolvedLabels.selectAll,\n checked: allPageSelected,\n indeterminate: pageSelectedCount > 0 && !allPageSelected,\n disabled: pageIds.length === 0,\n onChange: () => togglePageSelected(),\n }),\n getSelectRowProps: row => ({\n 'aria-label': resolvedLabels.selectRow(getRowLabel(row)),\n checked: selectedSet.has(getRowId(row)),\n onChange: () => toggleRowSelected(row),\n }),\n getPaginationProps: () => ({\n total: pageCount,\n current: page,\n onPageChange: set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AAO,CAAC,MAAM,KAAK,CAAC;AAC9B,YAAA,QAAQ,EAAE,MAAM,kBAAkB,EAAE;SACrC,CAAC;AACF,QAAA,iBAAiB,EAAE,GAAG,KAAK;YACzB,YAAY,EAAE,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACxD,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvC,YAAA,QAAQ,EAAE,MAAM,iBAAiB,CAAC,GAAG,CAAC;SACvC,CAAC;AACF,QAAA,kBAAkB,EAAE,OAAO;AACzB,YAAA,KAAK,EAAE,SAAS;AAChB,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,YAAY,EAAE,OAAO;SACtB,CAAC;AACF,QAAA,cAAc,EAAE,OAAO;AACrB,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,QAAQ,EAAE,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;SACjD,CAAC;KACH;AACH;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
'use client';
|
|
2
3
|
import { 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":"Block.js","sources":["../../../src/elements/Block.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 * Props for the Block component.\n */\nexport interface BlockProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.block.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the block. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Block` component renders a simple container with Bulma's `.block` class, adding vertical margin between sections of content.\n *\n * @function\n * @param {BlockProps} props - Props for the Block component.\n * @returns {JSX.Element} The rendered block element.\n * @see {@link https://bulma.io/documentation/elements/block/ | Bulma Block documentation}\n */\nexport const Block: React.FC<BlockProps> = ({\n className,\n textColor,\n color,\n bgColor,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('block');\n const blockClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <div className={blockClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Block.js","sources":["../../../src/elements/Block.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 * Props for the Block component.\n */\nexport interface BlockProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.block.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the block. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Block` component renders a simple container with Bulma's `.block` class, adding vertical margin between sections of content.\n *\n * @function\n * @param {BlockProps} props - Props for the Block component.\n * @returns {JSX.Element} The rendered block element.\n * @see {@link https://bulma.io/documentation/elements/block/ | Bulma Block documentation}\n */\nexport const Block: React.FC<BlockProps> = ({\n className,\n textColor,\n color,\n bgColor,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('block');\n const blockClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <div className={blockClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AAgCA;;;;;;;AAOG;MACU,KAAK,GAAyB,CAAC,EAC1C,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC;IACnD,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;IAE5E,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,YAAY,EAAA,GAAM,IAAI,EAAA,QAAA,EACnC,QAAQ,EAAA,CACL;AAEV;;"}
|
package/dist/esm/elements/Box.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":"Box.js","sources":["../../../src/elements/Box.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n validSchemeColors,\n} from '../helpers/useBulmaClasses';\nimport { mergeBulmaStyles } from '../helpers/mergeBulmaStyles';\n\n/**\n * Props for the Box component.\n */\nexport interface BoxProps\n /** @ignore */\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled box variant (no `.box.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /**\n * Background color helper. `scheme-*` values render as a dark-mode-safe\n * inline `background-color: var(--bulma-scheme-*)` instead of a class. The\n * `scheme-invert*` values do not change text color — pair them with a\n * contrasting foreground.\n */\n bgColor?:\n | (typeof validColors)[number]\n | (typeof validSchemeColors)[number]\n | 'inherit'\n | 'current';\n /** Whether the box has a shadow (default: true). */\n hasShadow?: boolean;\n /** Content to render inside the box. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Box` component renders a bordered, padded container with an optional shadow using Bulma's `.box` class.\n *\n * @function\n * @param {BoxProps} props - Props for the Box component.\n * @returns {JSX.Element} The rendered box element.\n * @see {@link https://bulma.io/documentation/elements/box/ | Bulma Box documentation}\n */\nexport const Box: React.FC<BoxProps> = ({\n className,\n textColor,\n color,\n bgColor,\n hasShadow = true,\n children,\n style,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, bulmaHelperStyles, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('box', {\n 'is-shadowless': !hasShadow,\n });\n\n const boxClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <div\n className={boxClasses}\n style={mergeBulmaStyles(bulmaHelperStyles, style)}\n {...rest}\n >\n {children}\n </div>\n );\n};\n\nexport default Box;\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Box.js","sources":["../../../src/elements/Box.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n validSchemeColors,\n} from '../helpers/useBulmaClasses';\nimport { mergeBulmaStyles } from '../helpers/mergeBulmaStyles';\n\n/**\n * Props for the Box component.\n */\nexport interface BoxProps\n /** @ignore */\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled box variant (no `.box.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /**\n * Background color helper. `scheme-*` values render as a dark-mode-safe\n * inline `background-color: var(--bulma-scheme-*)` instead of a class. The\n * `scheme-invert*` values do not change text color — pair them with a\n * contrasting foreground.\n */\n bgColor?:\n | (typeof validColors)[number]\n | (typeof validSchemeColors)[number]\n | 'inherit'\n | 'current';\n /** Whether the box has a shadow (default: true). */\n hasShadow?: boolean;\n /** Content to render inside the box. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Box` component renders a bordered, padded container with an optional shadow using Bulma's `.box` class.\n *\n * @function\n * @param {BoxProps} props - Props for the Box component.\n * @returns {JSX.Element} The rendered box element.\n * @see {@link https://bulma.io/documentation/elements/box/ | Bulma Box documentation}\n */\nexport const Box: React.FC<BoxProps> = ({\n className,\n textColor,\n color,\n bgColor,\n hasShadow = true,\n children,\n style,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, bulmaHelperStyles, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('box', {\n 'is-shadowless': !hasShadow,\n });\n\n const boxClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <div\n className={boxClasses}\n style={mergeBulmaStyles(bulmaHelperStyles, style)}\n {...rest}\n >\n {children}\n </div>\n );\n};\n\nexport default Box;\n"],"names":["_jsx"],"mappings":";;;;;;;AA8CA;;;;;;;AAOG;AACI,MAAM,GAAG,GAAuB,CAAC,EACtC,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,GAAG,IAAI,EAChB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;IACH,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACtE,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,EAAE;QAChD,eAAe,EAAE,CAAC,SAAS;AAC5B,KAAA,CAAC;IAEF,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;IAE1E,QACEA,aACE,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,CAAC,EAAA,GAC7C,IAAI,YAEP,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 } from 'react/jsx-runtime';
|
|
3
4
|
import { forwardRef } from 'react';
|
|
4
5
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/elements/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n isCustomElement,\n type PolymorphicComponent,\n} from '../helpers/polymorphic';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * The Button component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface ButtonOwnProps extends Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor' | 'size'\n> {\n /**\n * Not accepted under this name. `useBulmaClasses` consumes any\n * `backgroundColor` key before `rest` is spread, so a custom `as` target\n * declaring one would never receive it. Use `bgColor`.\n * @internal\n */\n backgroundColor?: never;\n /** Bulma color variant for the button. `ghost` renders a link-like button; `text` renders a minimal text-only button. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'white'\n | 'light'\n | 'dark'\n | 'black'\n | 'text'\n | 'ghost';\n /** Size of the button. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Applies a lighter color variant. */\n isLight?: boolean;\n /** Makes the button rounded. */\n isRounded?: boolean;\n /**\n * Displays a loading spinner, with everything inside the button hidden\n * behind it, in forced colors (Windows' contrast themes) too. Under\n * `prefers-reduced-motion: reduce` the spinner stops and stays drawn.\n * Bulma alone hides only the label, so the rest needs bestax's CSS loaded.\n */\n isLoading?: boolean;\n /** Makes the button non-interactive. */\n isStatic?: boolean;\n /** Makes the button full-width. */\n isFullwidth?: boolean;\n /** Makes the button full-width. @deprecated Use `isFullwidth` instead — `isFullwidth` wins if both are set. */\n isFullWidth?: boolean;\n /** Applies outlined styling (requires color). */\n isOutlined?: boolean;\n /** Applies inverted styling (requires color). */\n isInverted?: boolean;\n /** Applies focused styling (visual only). */\n isFocused?: boolean;\n /** Applies active styling (visual only), with no `aria-pressed`. For a button that stays pressed, use `ToggleButton`. */\n isActive?: boolean;\n /** Applies hovered styling (visual only). */\n isHovered?: boolean;\n /** Applies disabled styling. */\n isDisabled?: boolean;\n /** Custom class name. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the Button component. The DOM attributes and the `ref` both follow\n * `as`: with `as=\"a\"` the anchor attributes are accepted, with `as=\"div\"` they\n * are not.\n *\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.\n */\nexport type ButtonProps<T extends React.ElementType = 'button'> =\n ButtonOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonOwnProps | 'as'> & {\n /** Render as a `<button>`, `<a>`, or a custom component (e.g. a router `Link`). Defaults to `'button'`; anything else renders through the anchor path, which adds `href`/`target`/`rel` and withholds the submit-override attributes (`formAction` and friends) from an `<a>`. */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `ButtonProps<T>` above — the body cannot see through `T`, so it reads the\n * widest form of the props it actually touches.\n */\ntype ButtonImplProps = ButtonOwnProps & {\n as?: React.ElementType;\n href?: string;\n target?: string;\n rel?: string;\n onClick?:\n | React.MouseEventHandler<HTMLButtonElement>\n | React.MouseEventHandler<HTMLAnchorElement>;\n};\n\nconst validButtonColors = [...validColors, 'text', 'ghost'] as const;\n\n/**\n * The `Button` component provides a flexible and highly customizable button for your Bulma React UI.\n *\n * @function\n * @param {ButtonProps} props - Props for the Button component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered button, anchor, or custom element.\n * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}\n */\n\nexport const Button = forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const {\n color,\n size,\n isLight,\n isRounded,\n isLoading,\n isStatic,\n isFullwidth,\n isFullWidth,\n isOutlined,\n isInverted,\n isFocused,\n isActive,\n isHovered,\n isDisabled,\n className,\n children,\n textColor,\n bgColor,\n as: Component = 'button',\n href,\n onClick,\n target,\n rel,\n ...bulmaProps\n } = props as ButtonImplProps;\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...bulmaProps,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('button', {\n [`is-${color}`]:\n color &&\n validButtonColors.includes(color as (typeof validButtonColors)[number]),\n [`is-${size}`]: size,\n 'is-outlined': isOutlined,\n 'is-light': isLight,\n 'is-loading': isLoading,\n 'is-static': isStatic,\n 'is-disabled': isDisabled,\n 'is-rounded': isRounded,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'is-active': isActive,\n 'is-inverted': isInverted,\n 'is-fullwidth': isFullwidth ?? isFullWidth,\n });\n\n // Combine prefixed Bulma classes with unprefixed user className and prefixed helper classes\n const buttonClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n if (Component !== 'button') {\n // Strip the form-control attributes a link-like element cannot carry, so a\n // JavaScript consumer or a spread object doesn't put them on the DOM. The\n // types no longer allow them through; this is the runtime backstop.\n //\n // Only for INTRINSIC tags. A custom component (a router Link, ...) owns its\n // prop contract, and `ComponentPropsWithoutRef<T>` promises the caller that\n // its props reach it. Stripping names by their spelling alone broke that\n // promise silently: `<Button as={Custom} name=\"x\" />` type-checked while\n // `Custom` never received the `name` it requires.\n //\n // `autoFocus` and `type` are deliberately NOT stripped: both are valid on\n // targets this list was filtering them from. `autoFocus` is a global\n // attribute (React decides per element whether to honour it, which is not\n // ours to pre-empt), and `type` on an anchor is the MIME hint that\n // `ButtonProps<'a'>` now types it as.\n //\n // The types already answer this for a TypeScript caller: `ButtonProps<T>`\n // derives from `ComponentPropsWithoutRef<T>`, so only what the target\n // accepts can be passed. What is left is a runtime backstop for JavaScript\n // consumers and spread objects.\n //\n // Keep it to the two cases where a stray attribute does something. The\n // submit-overrides belong to a submit control and never make sense on the\n // anchor path. `disabled` is the one that is VISIBLE: Bulma styles\n // `.button[disabled]` (background, border, shadow, opacity), so letting it\n // through to a `<span>` greys the element out — main stripped it, and not\n // stripping it would be a silent visual change on a types-only release.\n //\n // Everything else (`name`, `value`, `form`) is inert where it does not\n // belong, and enumerating which tags own it is what kept going wrong:\n // first all nine names on every non-button tag (so `<Button as=\"input\"\n // name=\"query\" value=\"Search\">` submitted nothing), then a form-control\n // allowlist that still lost `formAction` on an input and `value` on an\n // option. Those now ride on the types instead.\n //\n // A custom component is exempt entirely — it owns its prop contract, and\n // `ComponentPropsWithoutRef<T>` promises the caller its props arrive.\n //\n // The elements that own `disabled`, per the HTML spec. A closed set, unlike\n // the open-ended question of which tag owns which attribute.\n const SUBMIT_OVERRIDES = [\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n ];\n const OWNS_DISABLED = [\n 'button',\n 'fieldset',\n 'input',\n 'optgroup',\n 'option',\n 'select',\n 'textarea',\n ];\n\n // Two independent filters. They are not exclusive — an `<a>` owns neither\n // the submit-overrides nor `disabled`, so it takes both — and deriving them\n // from one destructure, or from one if/else, is what broke each of them in\n // turn: first the overrides came off every intrinsic (an `as=\"input\"` lost\n // `formAction`), then scoping them to the anchor let `disabled` back onto\n // it.\n const forwardedRest: Record<string, unknown> = { ...rest };\n if (typeof Component === 'string' && !isCustomElement(Component)) {\n // Meaningless anywhere but a submit control, and an anchor is not one.\n if (Component === 'a') {\n for (const key of SUBMIT_OVERRIDES) delete forwardedRest[key];\n }\n // Visible via Bulma's `.button[disabled]`, so withheld from any element\n // that does not own it.\n if (!OWNS_DISABLED.includes(Component)) delete forwardedRest.disabled;\n }\n\n return (\n <Component\n ref={ref as React.Ref<HTMLAnchorElement>}\n className={buttonClasses}\n href={href}\n target={target}\n rel={rel}\n aria-disabled={isDisabled}\n tabIndex={isDisabled ? -1 : undefined}\n onClick={\n isDisabled\n ? // Guarded, because this handler is installed into whatever `as`\n // renders and a custom component's `onClick` need not be a DOM\n // event handler at all. One declaring `onClick: (v: string) =>\n // void` calls this with a string, and an unguarded\n // `e.preventDefault()` throws `is not a function`. Blocking the\n // real event is the point; a foreign payload is simply not ours\n // to act on.\n (e: React.MouseEvent<HTMLAnchorElement>) => {\n if (typeof e?.preventDefault === 'function') e.preventDefault();\n }\n : (onClick as\n React.MouseEventHandler<HTMLAnchorElement> | undefined)\n }\n {...(forwardedRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {children}\n </Component>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n className={buttonClasses}\n disabled={isDisabled}\n onClick={\n onClick as React.MouseEventHandler<HTMLButtonElement> | undefined\n }\n {...rest}\n >\n {children}\n </button>\n );\n}) as PolymorphicComponent<ButtonOwnProps, 'button'>;\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["_jsx"],"mappings":";;;;;;;;AA+GA,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAAW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G,EAAE,GAAmC,EACxC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,UAAU,EACpB,OAAO,EACL,OAAiE,EAAA,GAE/D,IAAI,EAAA,QAAA,EAEP,QAAQ,EAAA,CACF;AAEb,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/elements/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n isCustomElement,\n type PolymorphicComponent,\n} from '../helpers/polymorphic';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * The Button component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface ButtonOwnProps extends Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor' | 'size'\n> {\n /**\n * Not accepted under this name. `useBulmaClasses` consumes any\n * `backgroundColor` key before `rest` is spread, so a custom `as` target\n * declaring one would never receive it. Use `bgColor`.\n * @internal\n */\n backgroundColor?: never;\n /** Bulma color variant for the button. `ghost` renders a link-like button; `text` renders a minimal text-only button. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'white'\n | 'light'\n | 'dark'\n | 'black'\n | 'text'\n | 'ghost';\n /** Size of the button. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Applies a lighter color variant. */\n isLight?: boolean;\n /** Makes the button rounded. */\n isRounded?: boolean;\n /**\n * Displays a loading spinner, with everything inside the button hidden\n * behind it, in forced colors (Windows' contrast themes) too. Under\n * `prefers-reduced-motion: reduce` the spinner stops and stays drawn.\n * Bulma alone hides only the label, so the rest needs bestax's CSS loaded.\n */\n isLoading?: boolean;\n /** Makes the button non-interactive. */\n isStatic?: boolean;\n /** Makes the button full-width. */\n isFullwidth?: boolean;\n /** Makes the button full-width. @deprecated Use `isFullwidth` instead — `isFullwidth` wins if both are set. */\n isFullWidth?: boolean;\n /** Applies outlined styling (requires color). */\n isOutlined?: boolean;\n /** Applies inverted styling (requires color). */\n isInverted?: boolean;\n /** Applies focused styling (visual only). */\n isFocused?: boolean;\n /** Applies active styling (visual only), with no `aria-pressed`. For a button that stays pressed, use `ToggleButton`. */\n isActive?: boolean;\n /** Applies hovered styling (visual only). */\n isHovered?: boolean;\n /** Applies disabled styling. */\n isDisabled?: boolean;\n /** Custom class name. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the Button component. The DOM attributes and the `ref` both follow\n * `as`: with `as=\"a\"` the anchor attributes are accepted, with `as=\"div\"` they\n * are not.\n *\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.\n */\nexport type ButtonProps<T extends React.ElementType = 'button'> =\n ButtonOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonOwnProps | 'as'> & {\n /** Render as a `<button>`, `<a>`, or a custom component (e.g. a router `Link`). Defaults to `'button'`; anything else renders through the anchor path, which adds `href`/`target`/`rel` and withholds the submit-override attributes (`formAction` and friends) from an `<a>`. */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `ButtonProps<T>` above — the body cannot see through `T`, so it reads the\n * widest form of the props it actually touches.\n */\ntype ButtonImplProps = ButtonOwnProps & {\n as?: React.ElementType;\n href?: string;\n target?: string;\n rel?: string;\n onClick?:\n | React.MouseEventHandler<HTMLButtonElement>\n | React.MouseEventHandler<HTMLAnchorElement>;\n};\n\nconst validButtonColors = [...validColors, 'text', 'ghost'] as const;\n\n/**\n * The `Button` component provides a flexible and highly customizable button for your Bulma React UI.\n *\n * @function\n * @param {ButtonProps} props - Props for the Button component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered button, anchor, or custom element.\n * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}\n */\n\nexport const Button = forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const {\n color,\n size,\n isLight,\n isRounded,\n isLoading,\n isStatic,\n isFullwidth,\n isFullWidth,\n isOutlined,\n isInverted,\n isFocused,\n isActive,\n isHovered,\n isDisabled,\n className,\n children,\n textColor,\n bgColor,\n as: Component = 'button',\n href,\n onClick,\n target,\n rel,\n ...bulmaProps\n } = props as ButtonImplProps;\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...bulmaProps,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('button', {\n [`is-${color}`]:\n color &&\n validButtonColors.includes(color as (typeof validButtonColors)[number]),\n [`is-${size}`]: size,\n 'is-outlined': isOutlined,\n 'is-light': isLight,\n 'is-loading': isLoading,\n 'is-static': isStatic,\n 'is-disabled': isDisabled,\n 'is-rounded': isRounded,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'is-active': isActive,\n 'is-inverted': isInverted,\n 'is-fullwidth': isFullwidth ?? isFullWidth,\n });\n\n // Combine prefixed Bulma classes with unprefixed user className and prefixed helper classes\n const buttonClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n if (Component !== 'button') {\n // Strip the form-control attributes a link-like element cannot carry, so a\n // JavaScript consumer or a spread object doesn't put them on the DOM. The\n // types no longer allow them through; this is the runtime backstop.\n //\n // Only for INTRINSIC tags. A custom component (a router Link, ...) owns its\n // prop contract, and `ComponentPropsWithoutRef<T>` promises the caller that\n // its props reach it. Stripping names by their spelling alone broke that\n // promise silently: `<Button as={Custom} name=\"x\" />` type-checked while\n // `Custom` never received the `name` it requires.\n //\n // `autoFocus` and `type` are deliberately NOT stripped: both are valid on\n // targets this list was filtering them from. `autoFocus` is a global\n // attribute (React decides per element whether to honour it, which is not\n // ours to pre-empt), and `type` on an anchor is the MIME hint that\n // `ButtonProps<'a'>` now types it as.\n //\n // The types already answer this for a TypeScript caller: `ButtonProps<T>`\n // derives from `ComponentPropsWithoutRef<T>`, so only what the target\n // accepts can be passed. What is left is a runtime backstop for JavaScript\n // consumers and spread objects.\n //\n // Keep it to the two cases where a stray attribute does something. The\n // submit-overrides belong to a submit control and never make sense on the\n // anchor path. `disabled` is the one that is VISIBLE: Bulma styles\n // `.button[disabled]` (background, border, shadow, opacity), so letting it\n // through to a `<span>` greys the element out — main stripped it, and not\n // stripping it would be a silent visual change on a types-only release.\n //\n // Everything else (`name`, `value`, `form`) is inert where it does not\n // belong, and enumerating which tags own it is what kept going wrong:\n // first all nine names on every non-button tag (so `<Button as=\"input\"\n // name=\"query\" value=\"Search\">` submitted nothing), then a form-control\n // allowlist that still lost `formAction` on an input and `value` on an\n // option. Those now ride on the types instead.\n //\n // A custom component is exempt entirely — it owns its prop contract, and\n // `ComponentPropsWithoutRef<T>` promises the caller its props arrive.\n //\n // The elements that own `disabled`, per the HTML spec. A closed set, unlike\n // the open-ended question of which tag owns which attribute.\n const SUBMIT_OVERRIDES = [\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n ];\n const OWNS_DISABLED = [\n 'button',\n 'fieldset',\n 'input',\n 'optgroup',\n 'option',\n 'select',\n 'textarea',\n ];\n\n // Two independent filters. They are not exclusive — an `<a>` owns neither\n // the submit-overrides nor `disabled`, so it takes both — and deriving them\n // from one destructure, or from one if/else, is what broke each of them in\n // turn: first the overrides came off every intrinsic (an `as=\"input\"` lost\n // `formAction`), then scoping them to the anchor let `disabled` back onto\n // it.\n const forwardedRest: Record<string, unknown> = { ...rest };\n if (typeof Component === 'string' && !isCustomElement(Component)) {\n // Meaningless anywhere but a submit control, and an anchor is not one.\n if (Component === 'a') {\n for (const key of SUBMIT_OVERRIDES) delete forwardedRest[key];\n }\n // Visible via Bulma's `.button[disabled]`, so withheld from any element\n // that does not own it.\n if (!OWNS_DISABLED.includes(Component)) delete forwardedRest.disabled;\n }\n\n return (\n <Component\n ref={ref as React.Ref<HTMLAnchorElement>}\n className={buttonClasses}\n href={href}\n target={target}\n rel={rel}\n aria-disabled={isDisabled}\n tabIndex={isDisabled ? -1 : undefined}\n onClick={\n isDisabled\n ? // Guarded, because this handler is installed into whatever `as`\n // renders and a custom component's `onClick` need not be a DOM\n // event handler at all. One declaring `onClick: (v: string) =>\n // void` calls this with a string, and an unguarded\n // `e.preventDefault()` throws `is not a function`. Blocking the\n // real event is the point; a foreign payload is simply not ours\n // to act on.\n (e: React.MouseEvent<HTMLAnchorElement>) => {\n if (typeof e?.preventDefault === 'function') e.preventDefault();\n }\n : (onClick as\n React.MouseEventHandler<HTMLAnchorElement> | undefined)\n }\n {...(forwardedRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {children}\n </Component>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n className={buttonClasses}\n disabled={isDisabled}\n onClick={\n onClick as React.MouseEventHandler<HTMLButtonElement> | undefined\n }\n {...rest}\n >\n {children}\n </button>\n );\n}) as PolymorphicComponent<ButtonOwnProps, 'button'>;\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["_jsx"],"mappings":";;;;;;;;;AA+GA,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAAW,EAAE,MAAM,EAAE,OAAO,CAAU;AAEpE;;;;;;;;AAQG;AAEI,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,MAAM,CAC9C,KAAkB,EAClB,GAA2B,EAAA;IAE3B,MAAM,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAA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AU;YACV,QAAQ;YACR,QAAQ;YACR,UAAU;SACX;;;;;;;AAQD,QAAA,MAAM,aAAa,GAA4B,EAAE,GAAG,IAAI,EAAE;QAC1D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE;;AAEhE,YAAA,IAAI,SAAS,KAAK,GAAG,EAAE;gBACrB,KAAK,MAAM,GAAG,IAAI,gBAAgB;AAAE,oBAAA,OAAO,aAAa,CAAC,GAAG,CAAC;YAC/D;;;AAGA,YAAA,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,OAAO,aAAa,CAAC,QAAQ;QACvE;AAEA,QAAA,QACEA,GAAA,CAAC,SAAS,IACR,GAAG,EAAE,GAAmC,EACxC,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EAAA,eAAA,EACO,UAAU,EACzB,QAAQ,EAAE,UAAU,GAAG,EAAE,GAAG,SAAS,EACrC,OAAO,EACL;AACE;;;;;;;oBAOE,CAAC,CAAsC,KAAI;AACzC,wBAAA,IAAI,OAAO,CAAC,EAAE,cAAc,KAAK,UAAU;4BAAE,CAAC,CAAC,cAAc,EAAE;oBACjE;kBACC,OACwD,EAAA,GAE1D,aAA+D,YAEnE,QAAQ,EAAA,CACC;IAEhB;IAEA,QACEA,gBACE,GAAG,EAAE,GAAmC,EACxC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,UAAU,EACpB,OAAO,EACL,OAAiE,EAAA,GAE/D,IAAI,EAAA,QAAA,EAEP,QAAQ,EAAA,CACF;AAEb,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
|
|
@@ -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":"Buttons.js","sources":["../../../src/elements/Buttons.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Button } from './Button';\nimport { LinkButton } from './LinkButton';\nimport { ToggleButton } from './ToggleButton';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validButtonsSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Buttons component (Bulma button group sizes).\n */\nexport type ButtonsSize = (typeof validButtonsSizes)[number];\n\n/**\n * Props for the Buttons component.\n */\nexport interface ButtonsProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'size'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper for the button group. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.buttons.is-<color>` CSS exists; color the\n * individual `Button`s instead). Prefer `textColor`, which takes precedence\n * when both are set; use `bgColor` for a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper for the button group. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Center the group of buttons. */\n isCentered?: boolean;\n /** Align the group of buttons to the right. */\n isRight?: boolean;\n /** Group buttons together as addons (removes spacing between them). */\n hasAddons?: boolean;\n /** Size of the button group. */\n size?: ButtonsSize;\n /** The button elements to render inside the group. */\n children: React.ReactNode;\n}\n\n/**\n * The `Buttons` component lets you group multiple `Button` elements together with Bulma's spacing, alignment, and add-on features.\n *\n * @function\n * @param {ButtonsProps} props - Props for the Buttons component.\n * @returns {JSX.Element} The rendered group of buttons.\n * @see {@link https://bulma.io/documentation/elements/button/#group | Bulma Button Group documentation}\n */\nconst ButtonsComponent: React.FC<ButtonsProps> = ({\n className,\n textColor,\n color,\n bgColor,\n isCentered,\n isRight,\n hasAddons,\n size,\n children,\n ...props\n}) => {\n const buttonsClasses = usePrefixedClassNames('buttons', {\n 'is-centered': isCentered,\n 'is-right': isRight,\n 'has-addons': hasAddons,\n [`are-${size}`]: size && validButtonsSizes.includes(size),\n });\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const combinedClasses = classNames(\n buttonsClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={combinedClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Buttons = withSubComponents(\n ButtonsComponent,\n {\n Button,\n LinkButton,\n ToggleButton,\n },\n 'Buttons'\n);\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Buttons.js","sources":["../../../src/elements/Buttons.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Button } from './Button';\nimport { LinkButton } from './LinkButton';\nimport { ToggleButton } from './ToggleButton';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validButtonsSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Buttons component (Bulma button group sizes).\n */\nexport type ButtonsSize = (typeof validButtonsSizes)[number];\n\n/**\n * Props for the Buttons component.\n */\nexport interface ButtonsProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'size'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper for the button group. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.buttons.is-<color>` CSS exists; color the\n * individual `Button`s instead). Prefer `textColor`, which takes precedence\n * when both are set; use `bgColor` for a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper for the button group. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Center the group of buttons. */\n isCentered?: boolean;\n /** Align the group of buttons to the right. */\n isRight?: boolean;\n /** Group buttons together as addons (removes spacing between them). */\n hasAddons?: boolean;\n /** Size of the button group. */\n size?: ButtonsSize;\n /** The button elements to render inside the group. */\n children: React.ReactNode;\n}\n\n/**\n * The `Buttons` component lets you group multiple `Button` elements together with Bulma's spacing, alignment, and add-on features.\n *\n * @function\n * @param {ButtonsProps} props - Props for the Buttons component.\n * @returns {JSX.Element} The rendered group of buttons.\n * @see {@link https://bulma.io/documentation/elements/button/#group | Bulma Button Group documentation}\n */\nconst ButtonsComponent: React.FC<ButtonsProps> = ({\n className,\n textColor,\n color,\n bgColor,\n isCentered,\n isRight,\n hasAddons,\n size,\n children,\n ...props\n}) => {\n const buttonsClasses = usePrefixedClassNames('buttons', {\n 'is-centered': isCentered,\n 'is-right': isRight,\n 'has-addons': hasAddons,\n [`are-${size}`]: size && validButtonsSizes.includes(size),\n });\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const combinedClasses = classNames(\n buttonsClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={combinedClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Buttons = withSubComponents(\n ButtonsComponent,\n {\n Button,\n LinkButton,\n ToggleButton,\n },\n 'Buttons'\n);\n"],"names":["_jsx"],"mappings":";;;;;;;;;;AAYA,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAsC/D;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAA2B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,CAAC,CAAA,IAAA,EAAO,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1D,KAAA,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAChC,cAAc,EACd,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACtC,QAAQ,EAAA,CACL;AAEV,CAAC;AAEM,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB;IACE,MAAM;IACN,UAAU;IACV,YAAY;CACb,EACD,SAAS;;"}
|
|
@@ -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":"Code.js","sources":["../../../src/elements/Code.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 * Props for the Code component.\n */\nexport interface CodeProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Code content to render inside the element. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Code` component renders a styled `<code>` element with Bulma helper class integration.\n *\n * @function\n * @param {CodeProps} props - Props for the Code component.\n * @returns {JSX.Element} The rendered code element.\n */\nexport const Code: React.FC<CodeProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const codeClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <code className={codeClasses || undefined} {...rest}>\n {children}\n </code>\n );\n};\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Code.js","sources":["../../../src/elements/Code.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 * Props for the Code component.\n */\nexport interface CodeProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Code content to render inside the element. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Code` component renders a styled `<code>` element with Bulma helper class integration.\n *\n * @function\n * @param {CodeProps} props - Props for the Code component.\n * @returns {JSX.Element} The rendered code element.\n */\nexport const Code: React.FC<CodeProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const codeClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <code className={codeClasses || undefined} {...rest}>\n {children}\n </code>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AAyBA;;;;;;AAMG;AACI,MAAM,IAAI,GAAwB,CAAC,EACxC,SAAS,EACT,SAAS,EACT,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;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE3E,IAAA,QACEA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,WAAW,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,QAAA,EAChD,QAAQ,EAAA,CACJ;AAEX;;"}
|
|
@@ -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 { forwardRef, useEffect } from 'react';
|
|
4
5
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSwatch.js","sources":["../../../src/elements/ColorSwatch.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnOnce } from '../helpers/devWarnings';\n\nconst validColorSwatchSizes = ['small', 'medium', 'large'] as const;\n\n/**\n * Props for the ColorSwatch component. The helper props, the other\n * attributes and the `ref` land on its `<span>`.\n *\n * @extraProp {React.Ref<HTMLSpanElement>} [ref] - Ref forwarded to the `<span>`.\n * @extraProp {string} [aria-label] - Names the swatch in place of `label`.\n * @extraProp {boolean} [aria-hidden] - Hides the swatch from assistive tech, for one beside text that already names the color.\n */\nexport interface ColorSwatchProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'role'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * The color it shows: any CSS color, such as `#1e6b99`,\n * `hsl(202, 67%, 36%)` or `var(--bulma-primary)`. A see-through color\n * shows a checkerboard behind it.\n */\n color: string;\n /**\n * What the color is called, such as \"Brand blue\", read as the swatch's\n * name in place of `color` as written. A `var()` reads as nothing useful,\n * so a development build warns when one has no name.\n */\n label?: string;\n /** The swatch's size. */\n size?: (typeof validColorSwatchSizes)[number];\n /** Draws a circle in place of a rounded square. */\n isRounded?: boolean;\n /**\n * Drawn on the swatch, such as an icon. It's hidden from assistive tech,\n * since the swatch is an image named by its label.\n */\n children?: React.ReactNode;\n /** Text color helper, the color of anything drawn on the swatch. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `ColorSwatch` component shows a color as a small chip, named by its label or by the color itself.\n *\n * It's an image to assistive tech, so the color is always there in words.\n * In forced colors it keeps its color, edged in the system's text color.\n *\n * @function\n * @param {ColorSwatchProps} props - Props for the ColorSwatch component.\n * @param {React.Ref<HTMLSpanElement>} ref - Forwarded ref to the `<span>`.\n * @returns {JSX.Element} The rendered swatch.\n *\n * @example\n * <ColorSwatch color=\"#1e6b99\" label=\"Brand blue\" />\n */\nexport const ColorSwatch = forwardRef<HTMLSpanElement, ColorSwatchProps>(\n (\n {\n className,\n textColor,\n color,\n label,\n size,\n isRounded,\n children,\n style,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n ...props,\n });\n\n const unnamed =\n /^\\s*var\\(/i.test(color) &&\n !label &&\n !rest['aria-label'] &&\n !rest['aria-labelledby'] &&\n !rest['aria-hidden'];\n useEffect(() => {\n if (unnamed) {\n warnOnce(\n 'ColorSwatch:unnamed-var',\n '[bestax-bulma] <ColorSwatch> shows a CSS variable with no label, ' +\n 'so a screen reader reads the var() as its name. Pass label, ' +\n 'such as \"Primary\".'\n );\n }\n }, [unnamed]);\n\n const swatchClass = usePrefixedClassNames('color-swatch', {\n [`is-${size}`]:\n !!size && (validColorSwatchSizes as readonly string[]).includes(size),\n 'is-rounded': !!isRounded,\n });\n\n return (\n <span\n ref={ref}\n className={classNames(swatchClass, bulmaHelperClasses, className)}\n style={{ ...style, ['--color-swatch-color' as string]: color }}\n {...rest}\n role=\"img\"\n aria-label={rest['aria-label'] || label || color}\n >\n {children !== undefined && children !== null && (\n <span aria-hidden=\"true\">{children}</span>\n )}\n </span>\n );\n }\n);\n\nColorSwatch.displayName = 'ColorSwatch';\n\nexport default ColorSwatch;\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColorSwatch.js","sources":["../../../src/elements/ColorSwatch.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnOnce } from '../helpers/devWarnings';\n\nconst validColorSwatchSizes = ['small', 'medium', 'large'] as const;\n\n/**\n * Props for the ColorSwatch component. The helper props, the other\n * attributes and the `ref` land on its `<span>`.\n *\n * @extraProp {React.Ref<HTMLSpanElement>} [ref] - Ref forwarded to the `<span>`.\n * @extraProp {string} [aria-label] - Names the swatch in place of `label`.\n * @extraProp {boolean} [aria-hidden] - Hides the swatch from assistive tech, for one beside text that already names the color.\n */\nexport interface ColorSwatchProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'role'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * The color it shows: any CSS color, such as `#1e6b99`,\n * `hsl(202, 67%, 36%)` or `var(--bulma-primary)`. A see-through color\n * shows a checkerboard behind it.\n */\n color: string;\n /**\n * What the color is called, such as \"Brand blue\", read as the swatch's\n * name in place of `color` as written. A `var()` reads as nothing useful,\n * so a development build warns when one has no name.\n */\n label?: string;\n /** The swatch's size. */\n size?: (typeof validColorSwatchSizes)[number];\n /** Draws a circle in place of a rounded square. */\n isRounded?: boolean;\n /**\n * Drawn on the swatch, such as an icon. It's hidden from assistive tech,\n * since the swatch is an image named by its label.\n */\n children?: React.ReactNode;\n /** Text color helper, the color of anything drawn on the swatch. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `ColorSwatch` component shows a color as a small chip, named by its label or by the color itself.\n *\n * It's an image to assistive tech, so the color is always there in words.\n * In forced colors it keeps its color, edged in the system's text color.\n *\n * @function\n * @param {ColorSwatchProps} props - Props for the ColorSwatch component.\n * @param {React.Ref<HTMLSpanElement>} ref - Forwarded ref to the `<span>`.\n * @returns {JSX.Element} The rendered swatch.\n *\n * @example\n * <ColorSwatch color=\"#1e6b99\" label=\"Brand blue\" />\n */\nexport const ColorSwatch = forwardRef<HTMLSpanElement, ColorSwatchProps>(\n (\n {\n className,\n textColor,\n color,\n label,\n size,\n isRounded,\n children,\n style,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n ...props,\n });\n\n const unnamed =\n /^\\s*var\\(/i.test(color) &&\n !label &&\n !rest['aria-label'] &&\n !rest['aria-labelledby'] &&\n !rest['aria-hidden'];\n useEffect(() => {\n if (unnamed) {\n warnOnce(\n 'ColorSwatch:unnamed-var',\n '[bestax-bulma] <ColorSwatch> shows a CSS variable with no label, ' +\n 'so a screen reader reads the var() as its name. Pass label, ' +\n 'such as \"Primary\".'\n );\n }\n }, [unnamed]);\n\n const swatchClass = usePrefixedClassNames('color-swatch', {\n [`is-${size}`]:\n !!size && (validColorSwatchSizes as readonly string[]).includes(size),\n 'is-rounded': !!isRounded,\n });\n\n return (\n <span\n ref={ref}\n className={classNames(swatchClass, bulmaHelperClasses, className)}\n style={{ ...style, ['--color-swatch-color' as string]: color }}\n {...rest}\n role=\"img\"\n aria-label={rest['aria-label'] || label || color}\n >\n {children !== undefined && children !== null && (\n <span aria-hidden=\"true\">{children}</span>\n )}\n </span>\n );\n }\n);\n\nColorSwatch.displayName = 'ColorSwatch';\n\nexport default ColorSwatch;\n"],"names":["_jsx"],"mappings":";;;;;;;;AASA,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAyCnE;;;;;;;;;;;;;AAaG;AACI,MAAM,WAAW,GAAG,UAAU,CACnC,CACE,EACE,SAAS,EACT,SAAS,EACT,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,KACD;AACF,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,OAAO,GACX,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;AACxB,QAAA,CAAC,KAAK;QACN,CAAC,IAAI,CAAC,YAAY,CAAC;QACnB,CAAC,IAAI,CAAC,iBAAiB,CAAC;AACxB,QAAA,CAAC,IAAI,CAAC,aAAa,CAAC;IACtB,SAAS,CAAC,MAAK;QACb,IAAI,OAAO,EAAE;YACX,QAAQ,CACN,yBAAyB,EACzB,mEAAmE;gBACjE,8DAA8D;AAC9D,gBAAA,oBAAoB,CACvB;QACH;AACF,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,MAAM,WAAW,GAAG,qBAAqB,CAAC,cAAc,EAAE;AACxD,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GACX,CAAC,CAAC,IAAI,IAAK,qBAA2C,CAAC,QAAQ,CAAC,IAAI,CAAC;QACvE,YAAY,EAAE,CAAC,CAAC,SAAS;AAC1B,KAAA,CAAC;AAEF,IAAA,QACEA,GAAA,CAAA,MAAA,EAAA,EACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACjE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,sBAAgC,GAAG,KAAK,EAAE,EAAA,GAC1D,IAAI,EACR,IAAI,EAAC,KAAK,EAAA,YAAA,EACE,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,IAAI,KAAK,EAAA,QAAA,EAE/C,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,KAC1CA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAA,QAAA,EAAE,QAAQ,EAAA,CAAQ,CAC3C,EAAA,CACI;AAEX,CAAC;AAGH,WAAW,CAAC,WAAW,GAAG,aAAa;;"}
|
|
@@ -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":"Content.js","sources":["../../../src/elements/Content.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 * Props for the Content component.\n */\ninterface ContentProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper (e.g., `'danger'` for `has-text-danger`). */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.content.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper (e.g., `'info'` for `has-background-info`). */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Size modifier for the content. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Content to be rendered inside the block. */\n children?: React.ReactNode;\n}\n\n// Valid size modifiers for the content class\nconst validSizes = ['small', 'medium', 'large'] as const;\n\n/**\n * The `Content` component applies Bulma’s typographic styles to its children, enhancing the appearance of HTML elements like paragraphs, headings, lists, and tables.\n *\n * @function\n * @param {ContentProps} props - Props for the Content component.\n * @returns {JSX.Element} The rendered content block.\n * @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}\n */\nexport const Content: React.FC<ContentProps> = ({\n className,\n textColor,\n color,\n bgColor,\n size,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('content', {\n [`is-${size}`]: size && size !== 'normal' && validSizes.includes(size),\n });\n\n const contentClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div className={contentClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport default Content;\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../src/elements/Content.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 * Props for the Content component.\n */\ninterface ContentProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper (e.g., `'danger'` for `has-text-danger`). */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.content.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper (e.g., `'info'` for `has-background-info`). */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Size modifier for the content. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Content to be rendered inside the block. */\n children?: React.ReactNode;\n}\n\n// Valid size modifiers for the content class\nconst validSizes = ['small', 'medium', 'large'] as const;\n\n/**\n * The `Content` component applies Bulma’s typographic styles to its children, enhancing the appearance of HTML elements like paragraphs, headings, lists, and tables.\n *\n * @function\n * @param {ContentProps} props - Props for the Content component.\n * @returns {JSX.Element} The rendered content block.\n * @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}\n */\nexport const Content: React.FC<ContentProps> = ({\n className,\n textColor,\n color,\n bgColor,\n size,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('content', {\n [`is-${size}`]: size && size !== 'normal' && validSizes.includes(size),\n });\n\n const contentClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div className={contentClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport default Content;\n"],"names":["_jsx"],"mappings":";;;;;;AAkCA;AACA,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAExD;;;;;;;AAOG;MACU,OAAO,GAA2B,CAAC,EAC9C,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACpD,QAAA,CAAC,MAAM,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvE,KAAA,CAAC;IAEF,MAAM,cAAc,GAAG,UAAU,CAC/B,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,cAAc,EAAA,GAAM,IAAI,EAAA,QAAA,EACrC,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 } from 'react/jsx-runtime';
|
|
3
4
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
5
|
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|