@allxsmith/bestax-bulma 5.56.0 → 5.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/esm/columns/Column.js +1 -0
- package/dist/esm/columns/Column.js.map +1 -1
- package/dist/esm/columns/Columns.js +1 -0
- package/dist/esm/columns/Columns.js.map +1 -1
- package/dist/esm/components/Avatar.js +1 -0
- package/dist/esm/components/Avatar.js.map +1 -1
- package/dist/esm/components/Avatars.js +1 -0
- package/dist/esm/components/Avatars.js.map +1 -1
- package/dist/esm/components/Badge.js +1 -0
- package/dist/esm/components/Badge.js.map +1 -1
- package/dist/esm/components/Breadcrumb.js +1 -0
- package/dist/esm/components/Breadcrumb.js.map +1 -1
- package/dist/esm/components/Card.js +1 -0
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/Carousel.js +1 -0
- package/dist/esm/components/Carousel.js.map +1 -1
- package/dist/esm/components/Collapse.js +1 -0
- package/dist/esm/components/Collapse.js.map +1 -1
- package/dist/esm/components/Collapses.js +1 -0
- package/dist/esm/components/Collapses.js.map +1 -1
- package/dist/esm/components/Command.js +1 -0
- package/dist/esm/components/Command.js.map +1 -1
- package/dist/esm/components/ContextMenu.js +1 -0
- package/dist/esm/components/ContextMenu.js.map +1 -1
- package/dist/esm/components/DataTable.js +1 -0
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/Dialog.js +1 -0
- package/dist/esm/components/Dialog.js.map +1 -1
- package/dist/esm/components/Dropdown.js +5 -1
- package/dist/esm/components/Dropdown.js.map +1 -1
- package/dist/esm/components/EmptyState.js +1 -0
- package/dist/esm/components/EmptyState.js.map +1 -1
- package/dist/esm/components/HoverCard.js +1 -0
- package/dist/esm/components/HoverCard.js.map +1 -1
- package/dist/esm/components/Loading.js +1 -0
- package/dist/esm/components/Loading.js.map +1 -1
- package/dist/esm/components/Menu.js +1 -0
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Message.js +1 -0
- package/dist/esm/components/Message.js.map +1 -1
- package/dist/esm/components/Modal.js +1 -0
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Navbar.js +1 -0
- package/dist/esm/components/Navbar.js.map +1 -1
- package/dist/esm/components/Pagination.js +1 -0
- package/dist/esm/components/Pagination.js.map +1 -1
- package/dist/esm/components/Panel.js +1 -0
- package/dist/esm/components/Panel.js.map +1 -1
- package/dist/esm/components/Popover.js +1 -0
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/Reveal.js +1 -0
- package/dist/esm/components/Reveal.js.map +1 -1
- package/dist/esm/components/ScrollArea.js +1 -0
- package/dist/esm/components/ScrollArea.js.map +1 -1
- package/dist/esm/components/SegmentedControl.js +1 -0
- package/dist/esm/components/SegmentedControl.js.map +1 -1
- package/dist/esm/components/Sidebar.js +1 -0
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/components/Steps.js +1 -0
- package/dist/esm/components/Steps.js.map +1 -1
- package/dist/esm/components/Tabs.js +1 -0
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/components/Timeline.js +1 -0
- package/dist/esm/components/Timeline.js.map +1 -1
- package/dist/esm/components/Toast.js +1 -0
- package/dist/esm/components/Toast.js.map +1 -1
- package/dist/esm/components/Tooltip.js +1 -0
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/TreeView.js +1 -0
- package/dist/esm/components/TreeView.js.map +1 -1
- package/dist/esm/components/collapsesContext.js +1 -0
- package/dist/esm/components/collapsesContext.js.map +1 -1
- package/dist/esm/components/useDataTable.js +1 -0
- package/dist/esm/components/useDataTable.js.map +1 -1
- package/dist/esm/elements/Block.js +1 -0
- package/dist/esm/elements/Block.js.map +1 -1
- package/dist/esm/elements/Box.js +1 -0
- package/dist/esm/elements/Box.js.map +1 -1
- package/dist/esm/elements/Button.js +1 -0
- package/dist/esm/elements/Button.js.map +1 -1
- package/dist/esm/elements/Buttons.js +1 -0
- package/dist/esm/elements/Buttons.js.map +1 -1
- package/dist/esm/elements/Code.js +1 -0
- package/dist/esm/elements/Code.js.map +1 -1
- package/dist/esm/elements/ColorSwatch.js +1 -0
- package/dist/esm/elements/ColorSwatch.js.map +1 -1
- package/dist/esm/elements/Content.js +1 -0
- package/dist/esm/elements/Content.js.map +1 -1
- package/dist/esm/elements/Delete.js +1 -0
- package/dist/esm/elements/Delete.js.map +1 -1
- package/dist/esm/elements/DescriptionList.js +1 -0
- package/dist/esm/elements/DescriptionList.js.map +1 -1
- package/dist/esm/elements/Divider.js +1 -0
- package/dist/esm/elements/Divider.js.map +1 -1
- package/dist/esm/elements/Emphasis.js +1 -0
- package/dist/esm/elements/Emphasis.js.map +1 -1
- package/dist/esm/elements/Figure.js +1 -0
- package/dist/esm/elements/Figure.js.map +1 -1
- package/dist/esm/elements/Icon.js +1 -0
- package/dist/esm/elements/Icon.js.map +1 -1
- package/dist/esm/elements/IconText.js +1 -0
- package/dist/esm/elements/IconText.js.map +1 -1
- package/dist/esm/elements/Image.js +1 -0
- package/dist/esm/elements/Image.js.map +1 -1
- package/dist/esm/elements/Kbd.js +1 -0
- package/dist/esm/elements/Kbd.js.map +1 -1
- package/dist/esm/elements/Link.js +1 -0
- package/dist/esm/elements/Link.js.map +1 -1
- package/dist/esm/elements/LinkButton.js +1 -0
- package/dist/esm/elements/LinkButton.js.map +1 -1
- package/dist/esm/elements/ListItem.js +1 -0
- package/dist/esm/elements/ListItem.js.map +1 -1
- package/dist/esm/elements/Loader.js +1 -0
- package/dist/esm/elements/Loader.js.map +1 -1
- package/dist/esm/elements/Notification.js +1 -0
- package/dist/esm/elements/Notification.js.map +1 -1
- package/dist/esm/elements/OrderedList.js +1 -0
- package/dist/esm/elements/OrderedList.js.map +1 -1
- package/dist/esm/elements/Paragraph.js +1 -0
- package/dist/esm/elements/Paragraph.js.map +1 -1
- package/dist/esm/elements/Pre.js +1 -0
- package/dist/esm/elements/Pre.js.map +1 -1
- package/dist/esm/elements/Progress.js +1 -0
- package/dist/esm/elements/Progress.js.map +1 -1
- package/dist/esm/elements/RingProgress.js +1 -0
- package/dist/esm/elements/RingProgress.js.map +1 -1
- package/dist/esm/elements/Skeleton.js +1 -0
- package/dist/esm/elements/Skeleton.js.map +1 -1
- package/dist/esm/elements/Span.js +1 -0
- package/dist/esm/elements/Span.js.map +1 -1
- package/dist/esm/elements/Strong.js +1 -0
- package/dist/esm/elements/Strong.js.map +1 -1
- package/dist/esm/elements/SubTitle.js +1 -0
- package/dist/esm/elements/SubTitle.js.map +1 -1
- package/dist/esm/elements/Table.js +1 -0
- package/dist/esm/elements/Table.js.map +1 -1
- package/dist/esm/elements/Tag.js +1 -0
- package/dist/esm/elements/Tag.js.map +1 -1
- package/dist/esm/elements/Tags.js +1 -0
- package/dist/esm/elements/Tags.js.map +1 -1
- package/dist/esm/elements/Tbody.js +1 -0
- package/dist/esm/elements/Tbody.js.map +1 -1
- package/dist/esm/elements/Td.js +1 -0
- package/dist/esm/elements/Td.js.map +1 -1
- package/dist/esm/elements/Tfoot.js +1 -0
- package/dist/esm/elements/Tfoot.js.map +1 -1
- package/dist/esm/elements/Th.js +1 -0
- package/dist/esm/elements/Th.js.map +1 -1
- package/dist/esm/elements/Thead.js +1 -0
- package/dist/esm/elements/Thead.js.map +1 -1
- package/dist/esm/elements/Title.js +1 -0
- package/dist/esm/elements/Title.js.map +1 -1
- package/dist/esm/elements/ToggleButton.js +1 -0
- package/dist/esm/elements/ToggleButton.js.map +1 -1
- package/dist/esm/elements/Tr.js +1 -0
- package/dist/esm/elements/Tr.js.map +1 -1
- package/dist/esm/elements/UnorderedList.js +1 -0
- package/dist/esm/elements/UnorderedList.js.map +1 -1
- package/dist/esm/elements/iconProps.js +1 -0
- package/dist/esm/elements/iconProps.js.map +1 -1
- package/dist/esm/form/Autocomplete.js +1 -0
- package/dist/esm/form/Autocomplete.js.map +1 -1
- package/dist/esm/form/Checkbox.js +1 -0
- package/dist/esm/form/Checkbox.js.map +1 -1
- package/dist/esm/form/CheckboxCard.js +1 -0
- package/dist/esm/form/CheckboxCard.js.map +1 -1
- package/dist/esm/form/Checkboxes.js +1 -0
- package/dist/esm/form/Checkboxes.js.map +1 -1
- package/dist/esm/form/ColorInput.js +1 -0
- package/dist/esm/form/ColorInput.js.map +1 -1
- package/dist/esm/form/ColorInputBase.js +1 -0
- package/dist/esm/form/ColorInputBase.js.map +1 -1
- package/dist/esm/form/ColorPicker.js +1 -0
- package/dist/esm/form/ColorPicker.js.map +1 -1
- package/dist/esm/form/Combobox.js +1 -0
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/Control.js +1 -0
- package/dist/esm/form/Control.js.map +1 -1
- package/dist/esm/form/DateInput.js +1 -0
- package/dist/esm/form/DateInput.js.map +1 -1
- package/dist/esm/form/DateInputBase.js +1 -0
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInput.js +1 -0
- package/dist/esm/form/DateRangeInput.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js +1 -0
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInput.js +1 -0
- package/dist/esm/form/DateTimeInput.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +1 -0
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Dropzone.js +1 -0
- package/dist/esm/form/Dropzone.js.map +1 -1
- package/dist/esm/form/Field.js +1 -0
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/Fieldset.js +1 -0
- package/dist/esm/form/Fieldset.js.map +1 -1
- package/dist/esm/form/File.js +1 -0
- package/dist/esm/form/File.js.map +1 -1
- package/dist/esm/form/FormContext.js +1 -0
- package/dist/esm/form/FormContext.js.map +1 -1
- package/dist/esm/form/Input.js +1 -0
- package/dist/esm/form/Input.js.map +1 -1
- package/dist/esm/form/InputBase.js +1 -0
- package/dist/esm/form/InputBase.js.map +1 -1
- package/dist/esm/form/Numberinput.js +1 -0
- package/dist/esm/form/Numberinput.js.map +1 -1
- package/dist/esm/form/PinInput.js +1 -0
- package/dist/esm/form/PinInput.js.map +1 -1
- package/dist/esm/form/Radio.js +1 -0
- package/dist/esm/form/Radio.js.map +1 -1
- package/dist/esm/form/RadioCard.js +1 -0
- package/dist/esm/form/RadioCard.js.map +1 -1
- package/dist/esm/form/Radios.js +1 -0
- package/dist/esm/form/Radios.js.map +1 -1
- package/dist/esm/form/Rate.js +1 -0
- package/dist/esm/form/Rate.js.map +1 -1
- package/dist/esm/form/Select.js +1 -0
- package/dist/esm/form/Select.js.map +1 -1
- package/dist/esm/form/SelectBase.js +1 -0
- package/dist/esm/form/SelectBase.js.map +1 -1
- package/dist/esm/form/Slider.js +1 -0
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/Switch.js +1 -0
- package/dist/esm/form/Switch.js.map +1 -1
- package/dist/esm/form/Taginput.js +1 -0
- package/dist/esm/form/Taginput.js.map +1 -1
- package/dist/esm/form/TextArea.js +1 -0
- package/dist/esm/form/TextArea.js.map +1 -1
- package/dist/esm/form/TextAreaBase.js +1 -0
- package/dist/esm/form/TextAreaBase.js.map +1 -1
- package/dist/esm/form/TimeInput.js +1 -0
- package/dist/esm/form/TimeInput.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +1 -0
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/_colorInternals/EyeDropperButton.js +1 -0
- package/dist/esm/form/_colorInternals/EyeDropperButton.js.map +1 -1
- package/dist/esm/form/_colorInternals/pickerState.js +1 -0
- package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +1 -0
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +1 -0
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/form/_pickerInternals/TimeWheels.js +1 -0
- package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +1 -0
- package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +1 -0
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -1
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +1 -0
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -1
- package/dist/esm/form/controlLoading.js +1 -0
- package/dist/esm/form/controlLoading.js.map +1 -1
- package/dist/esm/form/groupFieldset.js +1 -0
- package/dist/esm/form/groupFieldset.js.map +1 -1
- package/dist/esm/form/useAutoLabelId.js +1 -0
- package/dist/esm/form/useAutoLabelId.js.map +1 -1
- package/dist/esm/grid/Cell.js +1 -0
- package/dist/esm/grid/Cell.js.map +1 -1
- package/dist/esm/grid/Grid.js +1 -0
- package/dist/esm/grid/Grid.js.map +1 -1
- package/dist/esm/helpers/ClientOnly.js +1 -0
- package/dist/esm/helpers/ClientOnly.js.map +1 -1
- package/dist/esm/helpers/Config.js +1 -0
- package/dist/esm/helpers/Config.js.map +1 -1
- package/dist/esm/helpers/LocaleProvider.js +1 -0
- package/dist/esm/helpers/LocaleProvider.js.map +1 -1
- package/dist/esm/helpers/Theme.js +1 -0
- package/dist/esm/helpers/Theme.js.map +1 -1
- package/dist/esm/helpers/flattenChildren.js +1 -0
- package/dist/esm/helpers/flattenChildren.js.map +1 -1
- package/dist/esm/helpers/inertProps.js +1 -0
- package/dist/esm/helpers/inertProps.js.map +1 -1
- package/dist/esm/helpers/localeFormat.js +1 -0
- package/dist/esm/helpers/localeFormat.js.map +1 -1
- package/dist/esm/helpers/overlayStack.js +1 -0
- package/dist/esm/helpers/overlayStack.js.map +1 -1
- package/dist/esm/helpers/portal.js +1 -0
- package/dist/esm/helpers/portal.js.map +1 -1
- package/dist/esm/helpers/scrollLock.js +1 -0
- package/dist/esm/helpers/scrollLock.js.map +1 -1
- package/dist/esm/helpers/statusRegion.js +1 -0
- package/dist/esm/helpers/statusRegion.js.map +1 -1
- package/dist/esm/helpers/typeahead.js +1 -0
- package/dist/esm/helpers/typeahead.js.map +1 -1
- package/dist/esm/helpers/useAnchoredPosition.js +1 -0
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
- package/dist/esm/helpers/useBulmaClasses.js +1 -0
- package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
- package/dist/esm/helpers/useClientLayoutEffect.js +1 -0
- package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -1
- package/dist/esm/helpers/useColorClasses.js +1 -0
- package/dist/esm/helpers/useColorClasses.js.map +1 -1
- package/dist/esm/helpers/useComboboxEngine.js +1 -0
- package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
- package/dist/esm/helpers/useContextMenuTrigger.js +1 -0
- package/dist/esm/helpers/useContextMenuTrigger.js.map +1 -1
- package/dist/esm/helpers/useFlexboxClasses.js +1 -0
- package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
- package/dist/esm/helpers/useFocusTrap.js +1 -0
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/esm/helpers/useHoverOpen.js +1 -0
- package/dist/esm/helpers/useHoverOpen.js.map +1 -1
- package/dist/esm/helpers/useInertSiblings.js +1 -0
- package/dist/esm/helpers/useInertSiblings.js.map +1 -1
- package/dist/esm/helpers/useIsHydrated.js +1 -0
- package/dist/esm/helpers/useIsHydrated.js.map +1 -1
- package/dist/esm/helpers/useLatestRef.js +1 -0
- package/dist/esm/helpers/useLatestRef.js.map +1 -1
- package/dist/esm/helpers/useMenuKeys.js +1 -0
- package/dist/esm/helpers/useMenuKeys.js.map +1 -1
- package/dist/esm/helpers/useOtherClasses.js +1 -0
- package/dist/esm/helpers/useOtherClasses.js.map +1 -1
- package/dist/esm/helpers/useSpacingClasses.js +1 -0
- package/dist/esm/helpers/useSpacingClasses.js.map +1 -1
- package/dist/esm/helpers/useTreeView.js +1 -0
- package/dist/esm/helpers/useTreeView.js.map +1 -1
- package/dist/esm/helpers/useTypographyClasses.js +1 -0
- package/dist/esm/helpers/useTypographyClasses.js.map +1 -1
- package/dist/esm/helpers/useVisibilityClasses.js +1 -0
- package/dist/esm/helpers/useVisibilityClasses.js.map +1 -1
- package/dist/esm/layout/Container.js +1 -0
- package/dist/esm/layout/Container.js.map +1 -1
- package/dist/esm/layout/Footer.js +1 -0
- package/dist/esm/layout/Footer.js.map +1 -1
- package/dist/esm/layout/Hero.js +1 -0
- package/dist/esm/layout/Hero.js.map +1 -1
- package/dist/esm/layout/Level.js +1 -0
- package/dist/esm/layout/Level.js.map +1 -1
- package/dist/esm/layout/Media.js +1 -0
- package/dist/esm/layout/Media.js.map +1 -1
- package/dist/esm/layout/Section.js +1 -0
- package/dist/esm/layout/Section.js.map +1 -1
- package/dist/esm/layout/Splitter.js +1 -0
- package/dist/esm/layout/Splitter.js.map +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/package.json +28 -27
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@allxsmith/bestax-bulma)
|
|
4
4
|
[](https://www.npmjs.com/package/@allxsmith/bestax-bulma)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
|
-
[](https://github.com/allxsmith/bestax/blob/main/bulma-ui/
|
|
6
|
+
[](https://github.com/allxsmith/bestax/blob/main/bulma-ui/vitest.config.ts)
|
|
7
7
|
[](https://bulma.io)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](https://socket.dev/npm/package/@allxsmith/bestax-bulma/overview)
|
|
@@ -113,7 +113,7 @@ import { Theme } from '@allxsmith/bestax-bulma';
|
|
|
113
113
|
- **Tree-shakeable ESM**
|
|
114
114
|
Import only what you use; your bundler drops the rest. A CJS build is there for `require`.
|
|
115
115
|
- **99% unit test coverage**
|
|
116
|
-
Enforced in CI by the [
|
|
116
|
+
Enforced in CI by the [Vitest config](https://github.com/allxsmith/bestax/blob/main/bulma-ui/vitest.config.ts) — not just claimed.
|
|
117
117
|
- **100% TypeScript**
|
|
118
118
|
Full type safety for you and your team.
|
|
119
119
|
- **Active developer support**
|
|
@@ -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":"Column.js","sources":["../../../src/columns/Column.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 * Possible values for Bulma column size: a number 1–12 (as a number or a numeric string, `7` and `\"7\"` are equivalent) or a named fraction.\n */\nexport type BulmaColumnSize =\n | number\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8'\n | '9'\n | '10'\n | '11'\n | '12'\n | 'full'\n | 'half'\n | 'one-third'\n | 'two-thirds'\n | 'one-quarter'\n | 'three-quarters'\n | 'one-fifth'\n | 'two-fifths'\n | 'three-fifths'\n | 'four-fifths';\n\n/**\n * Props for the Column component.\n */\nexport interface ColumnProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes for the column. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the column. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n\n /** Column size (see Bulma docs). */\n size?: BulmaColumnSize;\n /** Size for mobile breakpoint. */\n sizeMobile?: BulmaColumnSize;\n /** Size for tablet breakpoint. */\n sizeTablet?: BulmaColumnSize;\n /** Size for desktop breakpoint. */\n sizeDesktop?: BulmaColumnSize;\n /** Size for widescreen breakpoint. */\n sizeWidescreen?: BulmaColumnSize;\n /** Size for fullhd breakpoint. */\n sizeFullhd?: BulmaColumnSize;\n\n /** Offset for column. */\n offset?: BulmaColumnSize;\n /** Offset for mobile. */\n offsetMobile?: BulmaColumnSize;\n /** Offset for tablet. */\n offsetTablet?: BulmaColumnSize;\n /** Offset for desktop. */\n offsetDesktop?: BulmaColumnSize;\n /** Offset for widescreen. */\n offsetWidescreen?: BulmaColumnSize;\n /** Offset for fullhd. */\n offsetFullhd?: BulmaColumnSize;\n\n /** Column is only as wide as its content. */\n isNarrow?: boolean;\n /** The column is narrow on mobile. */\n isNarrowMobile?: boolean;\n /** The column is narrow on tablet. */\n isNarrowTablet?: boolean;\n /** The column is narrow on touch devices. */\n isNarrowTouch?: boolean;\n /** The column is narrow on desktop. */\n isNarrowDesktop?: boolean;\n /** The column is narrow on widescreen. */\n isNarrowWidescreen?: boolean;\n /** The column is narrow on fullhd. */\n isNarrowFullhd?: boolean;\n\n /** Children to render inside the column. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Column` component provides a single responsive layout column using Bulma's flexbox-based column system.\n *\n * @function\n * @param {ColumnProps} props - Props for the Column component.\n * @returns {JSX.Element} The rendered column.\n * @see {@link https://bulma.io/documentation/columns/ | Bulma Columns documentation}\n */\nexport const Column: React.FC<ColumnProps> = ({\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n size,\n sizeMobile,\n sizeTablet,\n sizeDesktop,\n sizeWidescreen,\n sizeFullhd,\n offset,\n offsetMobile,\n offsetTablet,\n offsetDesktop,\n offsetWidescreen,\n offsetFullhd,\n isNarrow,\n isNarrowMobile,\n isNarrowTablet,\n isNarrowTouch,\n isNarrowDesktop,\n isNarrowWidescreen,\n isNarrowFullhd,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('column');\n\n // Build column-specific classes with prefixes\n const columnSpecificClasses = usePrefixedClassNames('', {\n [`is-${size}`]: size !== undefined && size !== null,\n [`is-${sizeMobile}-mobile`]:\n sizeMobile !== undefined && sizeMobile !== null,\n [`is-${sizeTablet}-tablet`]:\n sizeTablet !== undefined && sizeTablet !== null,\n [`is-${sizeDesktop}-desktop`]:\n sizeDesktop !== undefined && sizeDesktop !== null,\n [`is-${sizeWidescreen}-widescreen`]:\n sizeWidescreen !== undefined && sizeWidescreen !== null,\n [`is-${sizeFullhd}-fullhd`]:\n sizeFullhd !== undefined && sizeFullhd !== null,\n [`is-offset-${offset}`]: offset !== undefined && offset !== null,\n [`is-offset-${offsetMobile}-mobile`]:\n offsetMobile !== undefined && offsetMobile !== null,\n [`is-offset-${offsetTablet}-tablet`]:\n offsetTablet !== undefined && offsetTablet !== null,\n [`is-offset-${offsetDesktop}-desktop`]:\n offsetDesktop !== undefined && offsetDesktop !== null,\n [`is-offset-${offsetWidescreen}-widescreen`]:\n offsetWidescreen !== undefined && offsetWidescreen !== null,\n [`is-offset-${offsetFullhd}-fullhd`]:\n offsetFullhd !== undefined && offsetFullhd !== null,\n 'is-narrow': !!isNarrow,\n 'is-narrow-mobile': !!isNarrowMobile,\n 'is-narrow-tablet': !!isNarrowTablet,\n 'is-narrow-touch': !!isNarrowTouch,\n 'is-narrow-desktop': !!isNarrowDesktop,\n 'is-narrow-widescreen': !!isNarrowWidescreen,\n 'is-narrow-fullhd': !!isNarrowFullhd,\n });\n\n const columnClasses = classNames(\n mainClass,\n columnSpecificClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={columnClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Column.js","sources":["../../../src/columns/Column.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 * Possible values for Bulma column size: a number 1–12 (as a number or a numeric string, `7` and `\"7\"` are equivalent) or a named fraction.\n */\nexport type BulmaColumnSize =\n | number\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8'\n | '9'\n | '10'\n | '11'\n | '12'\n | 'full'\n | 'half'\n | 'one-third'\n | 'two-thirds'\n | 'one-quarter'\n | 'three-quarters'\n | 'one-fifth'\n | 'two-fifths'\n | 'three-fifths'\n | 'four-fifths';\n\n/**\n * Props for the Column component.\n */\nexport interface ColumnProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes for the column. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the column. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n\n /** Column size (see Bulma docs). */\n size?: BulmaColumnSize;\n /** Size for mobile breakpoint. */\n sizeMobile?: BulmaColumnSize;\n /** Size for tablet breakpoint. */\n sizeTablet?: BulmaColumnSize;\n /** Size for desktop breakpoint. */\n sizeDesktop?: BulmaColumnSize;\n /** Size for widescreen breakpoint. */\n sizeWidescreen?: BulmaColumnSize;\n /** Size for fullhd breakpoint. */\n sizeFullhd?: BulmaColumnSize;\n\n /** Offset for column. */\n offset?: BulmaColumnSize;\n /** Offset for mobile. */\n offsetMobile?: BulmaColumnSize;\n /** Offset for tablet. */\n offsetTablet?: BulmaColumnSize;\n /** Offset for desktop. */\n offsetDesktop?: BulmaColumnSize;\n /** Offset for widescreen. */\n offsetWidescreen?: BulmaColumnSize;\n /** Offset for fullhd. */\n offsetFullhd?: BulmaColumnSize;\n\n /** Column is only as wide as its content. */\n isNarrow?: boolean;\n /** The column is narrow on mobile. */\n isNarrowMobile?: boolean;\n /** The column is narrow on tablet. */\n isNarrowTablet?: boolean;\n /** The column is narrow on touch devices. */\n isNarrowTouch?: boolean;\n /** The column is narrow on desktop. */\n isNarrowDesktop?: boolean;\n /** The column is narrow on widescreen. */\n isNarrowWidescreen?: boolean;\n /** The column is narrow on fullhd. */\n isNarrowFullhd?: boolean;\n\n /** Children to render inside the column. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Column` component provides a single responsive layout column using Bulma's flexbox-based column system.\n *\n * @function\n * @param {ColumnProps} props - Props for the Column component.\n * @returns {JSX.Element} The rendered column.\n * @see {@link https://bulma.io/documentation/columns/ | Bulma Columns documentation}\n */\nexport const Column: React.FC<ColumnProps> = ({\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n size,\n sizeMobile,\n sizeTablet,\n sizeDesktop,\n sizeWidescreen,\n sizeFullhd,\n offset,\n offsetMobile,\n offsetTablet,\n offsetDesktop,\n offsetWidescreen,\n offsetFullhd,\n isNarrow,\n isNarrowMobile,\n isNarrowTablet,\n isNarrowTouch,\n isNarrowDesktop,\n isNarrowWidescreen,\n isNarrowFullhd,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const mainClass = usePrefixedClassNames('column');\n\n // Build column-specific classes with prefixes\n const columnSpecificClasses = usePrefixedClassNames('', {\n [`is-${size}`]: size !== undefined && size !== null,\n [`is-${sizeMobile}-mobile`]:\n sizeMobile !== undefined && sizeMobile !== null,\n [`is-${sizeTablet}-tablet`]:\n sizeTablet !== undefined && sizeTablet !== null,\n [`is-${sizeDesktop}-desktop`]:\n sizeDesktop !== undefined && sizeDesktop !== null,\n [`is-${sizeWidescreen}-widescreen`]:\n sizeWidescreen !== undefined && sizeWidescreen !== null,\n [`is-${sizeFullhd}-fullhd`]:\n sizeFullhd !== undefined && sizeFullhd !== null,\n [`is-offset-${offset}`]: offset !== undefined && offset !== null,\n [`is-offset-${offsetMobile}-mobile`]:\n offsetMobile !== undefined && offsetMobile !== null,\n [`is-offset-${offsetTablet}-tablet`]:\n offsetTablet !== undefined && offsetTablet !== null,\n [`is-offset-${offsetDesktop}-desktop`]:\n offsetDesktop !== undefined && offsetDesktop !== null,\n [`is-offset-${offsetWidescreen}-widescreen`]:\n offsetWidescreen !== undefined && offsetWidescreen !== null,\n [`is-offset-${offsetFullhd}-fullhd`]:\n offsetFullhd !== undefined && offsetFullhd !== null,\n 'is-narrow': !!isNarrow,\n 'is-narrow-mobile': !!isNarrowMobile,\n 'is-narrow-tablet': !!isNarrowTablet,\n 'is-narrow-touch': !!isNarrowTouch,\n 'is-narrow-desktop': !!isNarrowDesktop,\n 'is-narrow-widescreen': !!isNarrowWidescreen,\n 'is-narrow-fullhd': !!isNarrowFullhd,\n });\n\n const columnClasses = classNames(\n mainClass,\n columnSpecificClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={columnClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AAiGA;;;;;;;AAOG;AACI,MAAM,MAAM,GAA0B,CAAC,EAC5C,SAAS,EACT,SAAS,EACT,KAAK,EAAE,WAAW,EAClB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,UAAU,EACV,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,cAAc,EACd,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,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,KAA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,IAAI,gBAAgB,KAAK,IAAI;QAC7D,CAAC,CAAA,UAAA,EAAa,YAAY,CAAA,OAAA,CAAS,GACjC,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,IAAI;QACrD,WAAW,EAAE,CAAC,CAAC,QAAQ;QACvB,kBAAkB,EAAE,CAAC,CAAC,cAAc;QACpC,kBAAkB,EAAE,CAAC,CAAC,cAAc;QACpC,iBAAiB,EAAE,CAAC,CAAC,aAAa;QAClC,mBAAmB,EAAE,CAAC,CAAC,eAAe;QACtC,sBAAsB,EAAE,CAAC,CAAC,kBAAkB;QAC5C,kBAAkB,EAAE,CAAC,CAAC,cAAc;AACrC,KAAA,CAAC;AAEF,IAAA,MAAM,aAAa,GAAG,UAAU,CAC9B,SAAS,EACT,qBAAqB,EACrB,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,aAAa,EAAA,GAAM,IAAI,EAAA,QAAA,EACpC,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 { withSubComponents } from '../helpers/withSubComponents.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Columns.js","sources":["../../../src/columns/Columns.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport type { BulmaGapValue } from '../grid/Grid';\nimport { Column } from './Column';\n\n/**\n * Possible values for the Bulma columns gap size.\n * @deprecated Use {@link BulmaGapValue} instead — `gapSize*` and `gap*` share\n * the same 0-8 scale.\n */\nexport type BulmaGapSize = BulmaGapValue;\n\n/**\n * Props for the Columns component.\n */\nexport interface ColumnsProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n // The column and row gap helpers are left out, as the `gap` helper is: the\n // gutter is padding inside each column, so CSS `gap` would add to it, and\n // only from the tablet width up, where `.columns` is flex.\n Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor' | 'columnGap' | 'rowGap'\n > {\n /** Additional CSS classes for the columns container. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for all columns. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for all columns. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Horizontally center columns within the container. */\n isCentered?: boolean;\n /** Remove gap between columns. */\n isGapless?: boolean;\n /** Allow columns to wrap to multiple lines. */\n isMultiline?: boolean;\n /** Vertically center columns within the container. */\n isVCentered?: boolean;\n /** Apply columns layout on mobile and up. */\n isMobile?: boolean;\n /** Apply columns layout on desktop and up. */\n isDesktop?: boolean;\n\n /**\n * Gap size for all breakpoints, the columns gutter (`is-<value>`). Whole\n * steps of the same scale as `Grid`'s `gap` prop; wins over `gapSize` if\n * both are set.\n *\n * This is not the `gap` helper prop other components take, which renders\n * `is-gap-<value>`: on `Columns` the gutter is padding inside each column,\n * so the helper's CSS `gap` would add to it rather than replace it.\n */\n gap?: BulmaGapValue;\n /** Gap size for mobile. Wins over `gapSizeMobile` if both are set. */\n gapMobile?: BulmaGapValue;\n /** Gap size for tablet. Wins over `gapSizeTablet` if both are set. */\n gapTablet?: BulmaGapValue;\n /** Gap size for desktop. Wins over `gapSizeDesktop` if both are set. */\n gapDesktop?: BulmaGapValue;\n /** Gap size for widescreen. Wins over `gapSizeWidescreen` if both are set. */\n gapWidescreen?: BulmaGapValue;\n /** Gap size for fullhd. Wins over `gapSizeFullhd` if both are set. */\n gapFullhd?: BulmaGapValue;\n\n /** Gap size for all breakpoints. @deprecated Use `gap` instead — `gap` wins if both are set. */\n gapSize?: BulmaGapSize;\n /** Gap size for mobile. @deprecated Use `gapMobile` instead — `gapMobile` wins if both are set. */\n gapSizeMobile?: BulmaGapSize;\n /** Gap size for tablet. @deprecated Use `gapTablet` instead — `gapTablet` wins if both are set. */\n gapSizeTablet?: BulmaGapSize;\n /** Gap size for desktop. @deprecated Use `gapDesktop` instead — `gapDesktop` wins if both are set. */\n gapSizeDesktop?: BulmaGapSize;\n /** Gap size for widescreen. @deprecated Use `gapWidescreen` instead — `gapWidescreen` wins if both are set. */\n gapSizeWidescreen?: BulmaGapSize;\n /** Gap size for fullhd. @deprecated Use `gapFullhd` instead — `gapFullhd` wins if both are set. */\n gapSizeFullhd?: BulmaGapSize;\n\n /** Columns to render within the container. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Columns` component provides Bulma's flexible, responsive grid container for aligning and distributing [`Column`](./column.md) components.\n *\n * @function\n * @param {ColumnsProps} props - Props for the Columns component.\n * @returns {JSX.Element} The rendered columns container.\n * @see {@link https://bulma.io/documentation/columns/ | Bulma Columns documentation}\n */\nconst ColumnsComponent: React.FC<ColumnsProps> = ({\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n isCentered,\n isGapless,\n isMultiline,\n isVCentered,\n isMobile,\n isDesktop,\n gap,\n gapMobile,\n gapTablet,\n gapDesktop,\n gapWidescreen,\n gapFullhd,\n gapSize,\n gapSizeMobile,\n gapSizeTablet,\n gapSizeDesktop,\n gapSizeWidescreen,\n gapSizeFullhd,\n children,\n ...props\n}) => {\n const resolvedGap = gap ?? gapSize;\n const resolvedGapMobile = gapMobile ?? gapSizeMobile;\n const resolvedGapTablet = gapTablet ?? gapSizeTablet;\n const resolvedGapDesktop = gapDesktop ?? gapSizeDesktop;\n const resolvedGapWidescreen = gapWidescreen ?? gapSizeWidescreen;\n const resolvedGapFullhd = gapFullhd ?? gapSizeFullhd;\n\n // Untyped code can still pass the gap helpers ColumnsProps leaves out. They\n // are dropped here, so they render no class and never reach the DOM.\n const {\n columnGap: _columnGap,\n rowGap: _rowGap,\n ...helperProps\n } = props as typeof props & { columnGap?: unknown; rowGap?: unknown };\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...helperProps,\n });\n\n const mainClass = usePrefixedClassNames('columns');\n\n // Build gap classes with prefixes\n const gapClasses = usePrefixedClassNames('', {\n [`is-${resolvedGap}`]: resolvedGap !== undefined && resolvedGap !== null,\n [`is-${resolvedGapMobile}-mobile`]:\n resolvedGapMobile !== undefined && resolvedGapMobile !== null,\n [`is-${resolvedGapTablet}-tablet`]:\n resolvedGapTablet !== undefined && resolvedGapTablet !== null,\n [`is-${resolvedGapDesktop}-desktop`]:\n resolvedGapDesktop !== undefined && resolvedGapDesktop !== null,\n [`is-${resolvedGapWidescreen}-widescreen`]:\n resolvedGapWidescreen !== undefined && resolvedGapWidescreen !== null,\n [`is-${resolvedGapFullhd}-fullhd`]:\n resolvedGapFullhd !== undefined && resolvedGapFullhd !== null,\n 'is-centered': !!isCentered,\n 'is-gapless': !!isGapless,\n 'is-multiline': !!isMultiline,\n 'is-vcentered': !!isVCentered,\n 'is-mobile': !!isMobile,\n 'is-desktop': !!isDesktop,\n });\n\n const columnsClasses = classNames(\n mainClass,\n gapClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={columnsClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Columns = withSubComponents(\n ColumnsComponent,\n { Column },\n 'Columns'\n);\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Columns.js","sources":["../../../src/columns/Columns.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport type { BulmaGapValue } from '../grid/Grid';\nimport { Column } from './Column';\n\n/**\n * Possible values for the Bulma columns gap size.\n * @deprecated Use {@link BulmaGapValue} instead — `gapSize*` and `gap*` share\n * the same 0-8 scale.\n */\nexport type BulmaGapSize = BulmaGapValue;\n\n/**\n * Props for the Columns component.\n */\nexport interface ColumnsProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n // The column and row gap helpers are left out, as the `gap` helper is: the\n // gutter is padding inside each column, so CSS `gap` would add to it, and\n // only from the tablet width up, where `.columns` is flex.\n Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor' | 'columnGap' | 'rowGap'\n > {\n /** Additional CSS classes for the columns container. */\n className?: string;\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for all columns. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for all columns. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Horizontally center columns within the container. */\n isCentered?: boolean;\n /** Remove gap between columns. */\n isGapless?: boolean;\n /** Allow columns to wrap to multiple lines. */\n isMultiline?: boolean;\n /** Vertically center columns within the container. */\n isVCentered?: boolean;\n /** Apply columns layout on mobile and up. */\n isMobile?: boolean;\n /** Apply columns layout on desktop and up. */\n isDesktop?: boolean;\n\n /**\n * Gap size for all breakpoints, the columns gutter (`is-<value>`). Whole\n * steps of the same scale as `Grid`'s `gap` prop; wins over `gapSize` if\n * both are set.\n *\n * This is not the `gap` helper prop other components take, which renders\n * `is-gap-<value>`: on `Columns` the gutter is padding inside each column,\n * so the helper's CSS `gap` would add to it rather than replace it.\n */\n gap?: BulmaGapValue;\n /** Gap size for mobile. Wins over `gapSizeMobile` if both are set. */\n gapMobile?: BulmaGapValue;\n /** Gap size for tablet. Wins over `gapSizeTablet` if both are set. */\n gapTablet?: BulmaGapValue;\n /** Gap size for desktop. Wins over `gapSizeDesktop` if both are set. */\n gapDesktop?: BulmaGapValue;\n /** Gap size for widescreen. Wins over `gapSizeWidescreen` if both are set. */\n gapWidescreen?: BulmaGapValue;\n /** Gap size for fullhd. Wins over `gapSizeFullhd` if both are set. */\n gapFullhd?: BulmaGapValue;\n\n /** Gap size for all breakpoints. @deprecated Use `gap` instead — `gap` wins if both are set. */\n gapSize?: BulmaGapSize;\n /** Gap size for mobile. @deprecated Use `gapMobile` instead — `gapMobile` wins if both are set. */\n gapSizeMobile?: BulmaGapSize;\n /** Gap size for tablet. @deprecated Use `gapTablet` instead — `gapTablet` wins if both are set. */\n gapSizeTablet?: BulmaGapSize;\n /** Gap size for desktop. @deprecated Use `gapDesktop` instead — `gapDesktop` wins if both are set. */\n gapSizeDesktop?: BulmaGapSize;\n /** Gap size for widescreen. @deprecated Use `gapWidescreen` instead — `gapWidescreen` wins if both are set. */\n gapSizeWidescreen?: BulmaGapSize;\n /** Gap size for fullhd. @deprecated Use `gapFullhd` instead — `gapFullhd` wins if both are set. */\n gapSizeFullhd?: BulmaGapSize;\n\n /** Columns to render within the container. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Columns` component provides Bulma's flexible, responsive grid container for aligning and distributing [`Column`](./column.md) components.\n *\n * @function\n * @param {ColumnsProps} props - Props for the Columns component.\n * @returns {JSX.Element} The rendered columns container.\n * @see {@link https://bulma.io/documentation/columns/ | Bulma Columns documentation}\n */\nconst ColumnsComponent: React.FC<ColumnsProps> = ({\n className,\n textColor,\n color: _fieldColor,\n bgColor,\n isCentered,\n isGapless,\n isMultiline,\n isVCentered,\n isMobile,\n isDesktop,\n gap,\n gapMobile,\n gapTablet,\n gapDesktop,\n gapWidescreen,\n gapFullhd,\n gapSize,\n gapSizeMobile,\n gapSizeTablet,\n gapSizeDesktop,\n gapSizeWidescreen,\n gapSizeFullhd,\n children,\n ...props\n}) => {\n const resolvedGap = gap ?? gapSize;\n const resolvedGapMobile = gapMobile ?? gapSizeMobile;\n const resolvedGapTablet = gapTablet ?? gapSizeTablet;\n const resolvedGapDesktop = gapDesktop ?? gapSizeDesktop;\n const resolvedGapWidescreen = gapWidescreen ?? gapSizeWidescreen;\n const resolvedGapFullhd = gapFullhd ?? gapSizeFullhd;\n\n // Untyped code can still pass the gap helpers ColumnsProps leaves out. They\n // are dropped here, so they render no class and never reach the DOM.\n const {\n columnGap: _columnGap,\n rowGap: _rowGap,\n ...helperProps\n } = props as typeof props & { columnGap?: unknown; rowGap?: unknown };\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...helperProps,\n });\n\n const mainClass = usePrefixedClassNames('columns');\n\n // Build gap classes with prefixes\n const gapClasses = usePrefixedClassNames('', {\n [`is-${resolvedGap}`]: resolvedGap !== undefined && resolvedGap !== null,\n [`is-${resolvedGapMobile}-mobile`]:\n resolvedGapMobile !== undefined && resolvedGapMobile !== null,\n [`is-${resolvedGapTablet}-tablet`]:\n resolvedGapTablet !== undefined && resolvedGapTablet !== null,\n [`is-${resolvedGapDesktop}-desktop`]:\n resolvedGapDesktop !== undefined && resolvedGapDesktop !== null,\n [`is-${resolvedGapWidescreen}-widescreen`]:\n resolvedGapWidescreen !== undefined && resolvedGapWidescreen !== null,\n [`is-${resolvedGapFullhd}-fullhd`]:\n resolvedGapFullhd !== undefined && resolvedGapFullhd !== null,\n 'is-centered': !!isCentered,\n 'is-gapless': !!isGapless,\n 'is-multiline': !!isMultiline,\n 'is-vcentered': !!isVCentered,\n 'is-mobile': !!isMobile,\n 'is-desktop': !!isDesktop,\n });\n\n const columnsClasses = classNames(\n mainClass,\n gapClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={columnsClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Columns = withSubComponents(\n ColumnsComponent,\n { Column },\n 'Columns'\n);\n"],"names":["_jsx"],"mappings":";;;;;;;;AA0FA;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAA2B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,KAAK,EAAE,WAAW,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,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M,kBAAkB,CAAA,QAAA,CAAU,GACjC,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,KAAK,IAAI;QACjE,CAAC,CAAA,GAAA,EAAM,qBAAqB,CAAA,WAAA,CAAa,GACvC,qBAAqB,KAAK,SAAS,IAAI,qBAAqB,KAAK,IAAI;QACvE,CAAC,CAAA,GAAA,EAAM,iBAAiB,CAAA,OAAA,CAAS,GAC/B,iBAAiB,KAAK,SAAS,IAAI,iBAAiB,KAAK,IAAI;QAC/D,aAAa,EAAE,CAAC,CAAC,UAAU;QAC3B,YAAY,EAAE,CAAC,CAAC,SAAS;QACzB,cAAc,EAAE,CAAC,CAAC,WAAW;QAC7B,cAAc,EAAE,CAAC,CAAC,WAAW;QAC7B,WAAW,EAAE,CAAC,CAAC,QAAQ;QACvB,YAAY,EAAE,CAAC,CAAC,SAAS;AAC1B,KAAA,CAAC;AAEF,IAAA,MAAM,cAAc,GAAG,UAAU,CAC/B,SAAS,EACT,UAAU,EACV,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,cAAc,EAAA,GAAM,IAAI,EAAA,QAAA,EACrC,QAAQ,EAAA,CACL;AAEV,CAAC;AAEM,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB,EAAE,MAAM,EAAE,EACV,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 { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
4
5
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { buttonType } from '../helpers/buttonType';\nimport {\n isCustomElement,\n type PolymorphicComponent,\n} from '../helpers/polymorphic';\nimport { warnOnce } from '../helpers/devWarnings';\n\nconst avatarColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n] as const;\n\n/** Valid color values for the Avatar component. */\nexport type AvatarColor = (typeof avatarColors)[number];\n\nconst autoAvatarColors: AvatarColor[] = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n];\n\nconst avatarSizes = [\n '16x16',\n '24x24',\n '32x32',\n '48x48',\n '64x64',\n '96x96',\n '128x128',\n] as const;\n\n/** Valid preset size values for the Avatar component. */\nexport type AvatarSize = (typeof avatarSizes)[number];\n\n/**\n * The roles a caller can use to say \"this avatar is not a control\", and so claim\n * the non-interactive treatment for a custom `as` target we would otherwise have\n * to guess about.\n *\n * Read by VALUE, not by presence. Any role at all used to count, which let\n * `role=\"button\"` — a claim of the opposite — route a real control into the\n * decorative branch and come out `aria-hidden` and nameless. `img` is what the\n * fallback itself applies; `presentation` and `none` are the standard ways to say\n * an element carries no semantics, which is what pairs with `alt=\"\"`.\n */\nconst NON_INTERACTIVE_ROLES: readonly string[] = [\n 'img',\n 'presentation',\n 'none',\n];\n\n/**\n * Elements other than `a` that declare `target` themselves, so on them it is\n * the element's own attribute and not a link attribute Avatar withholds for\n * want of one. The link attribute warning leaves `target` out on these, the way\n * it leaves `rel` out everywhere. `area` and `base` are void elements, which\n * Avatar's content rules out, so `form` is the one a caller can reach.\n */\nconst ELEMENTS_WITH_OWN_TARGET: readonly React.ElementType[] = [\n 'form',\n 'area',\n 'base',\n];\n\n/** Valid shape values for the Avatar component. */\nexport type AvatarShape = 'circle' | 'rounded' | 'square';\n\n/**\n * Derives a small set of initials from a name (e.g. \"Ada Lovelace\" -> \"AL\").\n */\nfunction getInitialsFromName(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return '';\n // Iterate by code point (Array.from) so astral-plane characters (emoji, some\n // CJK) don't get split into half surrogates.\n if (words.length === 1) {\n return Array.from(words[0]).slice(0, 2).join('').toUpperCase();\n }\n const first = Array.from(words[0])[0];\n const last = Array.from(words[words.length - 1])[0];\n return (first + last).toUpperCase();\n}\n\n/**\n * Deterministically hashes a string to pick one of the auto avatar colors.\n */\nfunction getAutoColor(name: string): AvatarColor {\n let hash = 0;\n for (let i = 0; i < name.length; i++) {\n hash = (hash << 5) - hash + name.charCodeAt(i);\n hash |= 0;\n }\n const index = Math.abs(hash) % autoAvatarColors.length;\n return autoAvatarColors[index];\n}\n\n/**\n * Default generic avatar icon shown when there is no image, name, initials, or icon.\n */\nfunction DefaultAvatarIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" width=\"60%\" height=\"60%\" aria-hidden=\"true\">\n <path\n fill=\"currentColor\"\n d=\"M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-4.42 0-9 2.24-9 5v2a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-2c0-2.76-4.58-5-9-5Z\"\n />\n </svg>\n );\n}\n\n/**\n * The Avatar component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface AvatarOwnProps extends Omit<BulmaClassesProps, 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Image URL. On load error (or if absent), falls back to initials, then `icon`. */\n src?: string;\n /**\n * Alternate text for the image (used for the accessible name in every render mode). An\n * explicit `alt=\"\"` marks a non-interactive avatar as decorative.\n *\n * A link or button avatar is never decorative — it keeps an accessible name — and a custom\n * component passed to `as` counts as one unless it states otherwise, so `alt=\"\"` on a custom\n * wrapper needs that signal alongside it. `as` documents which props carry it.\n */\n alt?: string;\n /** Derives initials and a deterministic background color when no `src` is shown. */\n name?: string;\n /** Explicit initials override (else derived from `name`). */\n initials?: string;\n /** Final fallback, rendered when there is no `src`, `name`, or `initials`. */\n icon?: React.ReactNode;\n /** Preset size, or a pixel size when a number. */\n size?: AvatarSize | number;\n /** Avatar shape. Default `'circle'`. */\n shape?: AvatarShape;\n /** Background color for initials/icon avatars (else auto-derived from `name`). */\n color?: AvatarColor;\n /**\n * When set, renders the avatar as a link: an `<a>` unless `as` names the element itself. An\n * `as` target declaring its own `href` supersedes this one, and its type and its requiredness\n * are what apply.\n *\n * It is passed on only to a target that can be a link: an `a`, a custom element, or a\n * component. Any other `as` you pass, such as `'figure'` or `'div'`, still accepts it but\n * renders without it, because an `href` is not valid HTML on those elements, and a\n * development build logs a console warning naming what was dropped. To make such an avatar a\n * link, render it `as=\"a\"` or pass a link component to `as`. An empty `href` asks for no link:\n * with no `as` it renders a `<figure>`, and it draws no warning.\n */\n href?: string;\n /** Anchor target, passed on only where `href` is (an `a`, a custom element, or a component) and superseded by the target's own declaration the way `href` is. Any other `as` you pass renders without it, with the same development warning as `href`, except `'form'`: it declares its own `target`, so there the attribute is still withheld but draws no warning. */\n target?: string;\n /** Anchor rel, passed on only where `href` is (an `a`, a custom element, or a component) and superseded by the target's own declaration the way `href` is. */\n rel?: string;\n /** Extra props forwarded to the underlying `<img>` (e.g. `loading`, `crossOrigin`); its `onError` is chained before the fallback fires. */\n imageProps?: React.ImgHTMLAttributes<HTMLImageElement>;\n /** Inline styles, merged after the size style. */\n style?: React.CSSProperties;\n /**\n * Not accepted. Avatar always renders its own content — the image, the\n * initials, or the icon — so anything a caller passed would be replaced. It\n * is declared unavailable rather than derived from `as`, which would let a\n * target requiring `children` compel a value it then never receives.\n * @internal\n */\n children?: never;\n}\n\n/**\n * The own props Avatar hands to the element `as` names rather than consuming.\n *\n * They are what *chooses* the element when `as` is absent — an `<a>` with an\n * `href`, a `<figure>` without one — so Avatar has to accept them before `as` is\n * known. Declaring them is only half of it. `PolymorphicProps` explains what\n * naming them here buys, and what leaving them unnamed cost (#665).\n */\ntype AvatarForwardedProp = 'href' | 'target' | 'rel';\n\n/**\n * Props for the Avatar component. The DOM attributes and the `ref` both follow\n * `as`.\n *\n * `href`, `target` and `rel` are Avatar's own props only for a target that has\n * none of its own: `<Avatar href=\"/x\" />` needs no `as`, while\n * `<Avatar as={NextLink} />` takes `next/link`'s `href` — required, and a URL\n * object as readily as a string.\n *\n * The type parameter defaults to `'figure'`, not to `React.ElementType`.\n * Defaulting to the constraint sounds truer to a runtime default that is\n * conditional, but `ComponentPropsWithoutRef<React.ElementType>` spreads across\n * every element at once and accepts anything — which is the false-positive this\n * whole change exists to remove. `'figure'` is the element a no-`href` avatar\n * actually renders, and the anchor props it can additionally take are declared\n * above.\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 AvatarProps<T extends React.ElementType = 'figure'> = Omit<\n AvatarOwnProps,\n Extract<AvatarForwardedProp, keyof React.ComponentPropsWithoutRef<T>>\n> &\n Omit<\n React.ComponentPropsWithoutRef<T>,\n Exclude<keyof AvatarOwnProps, AvatarForwardedProp> | 'as'\n > & {\n /**\n * Element/component to render as. Defaults to `'a'` when `href` is set, else `'figure'`.\n *\n * This also decides whether the avatar is treated as interactive, which is what keeps\n * `role=\"img\"` and the `alt=\"\"` decorative opt-out off a link or button. A custom\n * component counts — a router link takes `to` rather than this component's `href`, so\n * its own props cannot say — while `'a'`, `'button'`, and a custom element given an\n * `href` count for the reason they read.\n *\n * If your custom component renders something that really is just a picture, say so with\n * `role=\"img\"` and it is treated as one, `alt=\"\"` included. A truthy `aria-hidden` says it\n * too, and so do `role=\"presentation\"` and `role=\"none\"` — though ARIA's own conflict\n * resolution drops those two whenever the avatar still carries a name, so prefer\n * `role=\"img\"`. A role claiming the opposite, such as `\"button\"`, says nothing here, and\n * neither does an `href`: that settles it on its own. A genuine `'a'`/`'button'`/`href`\n * avatar keeps its accessible name either way.\n *\n * `'button'` renders `type=\"button\"` unless you pass `type=\"submit\"` or `type=\"reset\"`, so\n * an avatar inside a form does not submit it.\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `AvatarProps<T>` above — the body cannot see through `T`, so it names the\n * handful of DOM props it actually reads back off `rest`.\n */\ntype AvatarImplProps = AvatarOwnProps & {\n as?: React.ElementType;\n role?: React.AriaRole;\n 'aria-hidden'?: React.AriaAttributes['aria-hidden'];\n 'aria-label'?: string;\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n};\n\n/**\n * The `Avatar` component represents a person or entity as a compact image.\n *\n * @function\n * @param {AvatarProps} props - Props for the Avatar component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered avatar element.\n *\n * @example\n * <Avatar src=\"/users/ada.jpg\" name=\"Ada Lovelace\" size=\"64x64\" />\n * @example\n * <Avatar name=\"Grace Hopper\" />\n */\nexport const Avatar = forwardRef(function Avatar(\n avatarProps: AvatarProps,\n ref: React.Ref<HTMLElement>\n) {\n const {\n className,\n src,\n alt,\n name,\n initials,\n icon,\n size,\n shape = 'circle',\n color,\n as,\n href,\n target,\n rel,\n imageProps,\n style,\n ...props\n } = avatarProps as AvatarImplProps;\n // Tracks the src that failed to load. A src change clears the latch during\n // render (React's \"reset state when props change\" pattern) so a previously\n // failed src is retried when switched back to. The img is additionally\n // keyed by src so a swap discards the old DOM node — a late error event\n // from the previous request can't fire on a retained node and latch the\n // replacement src as failed.\n const [erroredSrc, setErroredSrc] = useState<string | undefined>(undefined);\n const [prevSrc, setPrevSrc] = useState(src);\n if (src !== prevSrc) {\n setPrevSrc(src);\n setErroredSrc(undefined);\n }\n const imgRef = useRef<HTMLImageElement>(null);\n\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n const showImage = !!src && src !== erroredSrc;\n\n // Catch images that failed before hydration: in SSR/static pages a broken\n // image can finish loading before React attaches its onError, so it never\n // fires. A complete image with no intrinsic width is a load failure.\n useEffect(() => {\n const img = imgRef.current;\n if (img && img.complete && img.naturalWidth === 0) {\n setErroredSrc(src);\n }\n }, [src]);\n\n const resolvedInitials = initials\n ? initials.toUpperCase()\n : name\n ? getInitialsFromName(name)\n : '';\n const showInitials = !showImage && !!resolvedInitials;\n const showIcon = !showImage && !showInitials && !!icon;\n const showDefaultIcon = !showImage && !showInitials && !showIcon;\n\n const resolvedColor = color ?? (name ? getAutoColor(name) : undefined);\n\n const isPresetSize = typeof size === 'string' && avatarSizes.includes(size);\n const sizeStyle =\n typeof size === 'number'\n ? { width: size, height: size, fontSize: size / 2.5 }\n : undefined;\n\n const avatarClasses = usePrefixedClassNames('avatar', {\n [`is-${size}`]: isPresetSize,\n [`is-${shape}`]: shape,\n [`is-${resolvedColor}`]:\n resolvedColor && !showImage && avatarColors.includes(resolvedColor),\n });\n\n const combinedClasses = classNames(\n avatarClasses,\n bulmaHelperClasses,\n className\n );\n\n const initialsClass = usePrefixedClassNames('avatar-initials');\n\n const Tag: React.ElementType = as ?? (href ? 'a' : 'figure');\n // A custom component counts as interactive whether or not it was given OUR\n // href: a router link takes `to`, creates the anchor itself, and cannot be\n // classified from the props it arrives with (#668). Marking a real link as a\n // picture is the worse failure — and `alt=\"\"` would go further and mark it\n // decorative (aria-hidden), leaving it nameless.\n //\n // A custom ELEMENT still needs the href. A hyphenated tag renders a real DOM\n // element of that name, so nothing is hidden from us: without a link to follow\n // it is still a picture. `Navbar.Link` draws the same line for `role=\"button\"`.\n //\n // Where we are guessing, the caller settles it: an explicit `role` or\n // `aria-hidden` states the semantics, so a custom component that really is a\n // wrapper gets `role=\"img\"` and its `alt=\"\"` opt-out back. `role` alone would\n // be a half-override — interactivity also drives the decorative opt-out and the\n // name fallback, and overriding one of the three is worse than overriding none.\n //\n // An `href` ENDS the guess, so it outranks the signal. `as=\"a\"`, `as=\"button\"`\n // and a target we were handed an href for are known to be interactive, and there\n // the rule that an interactive element always carries an accessible name is not\n // the caller's to waive: without this, `as={RouterLink} href=\"/x\" role=\"img\"`\n // with `alt=\"\"` rendered a real anchor as `aria-hidden` and nameless — the very\n // failure #668 is about. `Navbar.Link` orders the same two the same way.\n //\n // The signal has to MEAN what it is used for, so both halves read a value rather\n // than a presence — the way `Navbar.Link` reads `role === 'button'`. A role only\n // claims to be a picture if it says so: `role=\"button\"` or `role=\"link\"` is the\n // opposite claim, and taking any role as the signal handed an interactive-role\n // element `aria-hidden` and no name. Likewise `aria-hidden={false}` denies\n // hiding, so only a truthy one counts.\n const ariaHidden = rest['aria-hidden'];\n const statesItIsNotAControl =\n (rest.role !== undefined && NON_INTERACTIVE_ROLES.includes(rest.role)) ||\n ariaHidden === true ||\n ariaHidden === 'true';\n\n const customTargetStatesSemantics =\n typeof Tag !== 'string' && href == null && statesItIsNotAControl;\n\n const isInteractive =\n Tag === 'a' ||\n Tag === 'button' ||\n (typeof Tag !== 'string' && !customTargetStatesSemantics) ||\n (isCustomElement(Tag) && href != null);\n\n // Only forward link attributes when rendering an anchor or a custom (non-DOM)\n // component; a plain `as=\"div\"` must not receive a stray `href`/`target`/`rel`.\n const isLinkLike =\n Tag === 'a' || typeof Tag !== 'string' || isCustomElement(Tag);\n // A plain element like a `div` declares no `href` or `target`, so the type\n // accepts them as Avatar's own while the drop below withholds them, and\n // without this they would vanish in silence (#733). Forwarding them would put\n // them where HTML has no such attribute, so the drop stays and development\n // reports it instead, naming only the ones actually passed.\n //\n // `rel` is withheld too but left out here. React declares it on every\n // element, so on a plain `as` it is that element's own attribute, and\n // \"render it as a link\" would be the wrong advice for it. `target` is the\n // same on an element that declares it, such as `form`, so it is left out\n // there. Whether to forward either one to such an element is a separate\n // question from this warning.\n //\n // Only for an `as` the caller wrote. Without one the element is Avatar's own\n // choice, and a message naming an `as` they never passed sends them looking\n // for it. A value counts when it is truthy, the same test that picks `'a'`\n // over `'figure'`, so an empty `href` from data asks for no link and draws no\n // warning. The key is the element plus the attributes passed, so a re-render\n // or a list of avatars warns once, while a different combination on the same\n // element still gets its own warning rather than hiding behind the first.\n //\n // Development-only is `warnOnce`'s job, as it is for the colour warnings, so\n // this block has no production check of its own. One here would have to read\n // `process` safely, and a `typeof process` test is not something a bundler\n // replaces: in a browser it is false, and the warning never fired in the\n // development builds it exists for. The cost is that production still\n // collects the attributes and builds the message for an avatar that needs\n // it, which is small and limited to the case the warning is about.\n if (as != null && !isLinkLike) {\n const dropped = Object.entries({\n href,\n target: ELEMENTS_WITH_OWN_TARGET.includes(as) ? undefined : target,\n })\n .filter(([, value]) => value)\n .map(([key]) => key);\n if (dropped.length > 0) {\n warnOnce(\n `Avatar:link-props-on-${as}:${dropped.join('+')}`,\n `[bestax-bulma] <Avatar as=\"${as}\" ${dropped.join(' ')}>: this ` +\n `<${as}> renders without ` +\n `${dropped.map(key => `\"${key}\"`).join(' and ')}, because Avatar ` +\n `passes link attributes on only to a target that can be a link (an ` +\n `\"a\", a custom element, or a component). To make it a link, render ` +\n `it as=\"a\" or pass a link component to \"as\".`\n );\n }\n }\n // Present-only, not `{ href, target, rel }`. An unconditional spread hands the\n // target these keys whatever the caller passed, and a key existing is not free:\n // a target that tests for one sees a link where there is none, and one that\n // spreads its own `{...rest}` onward passes the nothing along. It is NOT about\n // a destructuring default, which an explicit `undefined` triggers just as an\n // absent key does. What stops a target that REQUIRES one from being rendered\n // without it is the type (#665) — this is the smaller half, and the backstop for\n // the callers a type does not reach: a plain-JavaScript one and a loose spread,\n // the same pair `Button` and `Menu.Item` keep their own filters for.\n const linkProps = isLinkLike\n ? {\n ...(href !== undefined && { href }),\n ...(target !== undefined && { target }),\n ...(rel !== undefined && { rel }),\n }\n : {};\n\n // alt coalesces with ?? (not ||) so an explicit alt=\"\" survives as the\n // standard decorative marker instead of being overridden by name.\n const accessibleName = alt ?? name;\n // The decorative opt-out never applies to an interactive avatar — a link or\n // button must always expose an accessible name.\n const isDecorative = alt === '' && !isInteractive;\n\n const a11yDefaults: {\n 'aria-label'?: string;\n role?: 'img';\n 'aria-hidden'?: true;\n } = showImage\n ? isInteractive && !accessibleName\n ? // The img alt normally names the control; with no alt/name (an API\n // returning only a photo URL) the link/button would be nameless.\n { 'aria-label': name || 'Avatar' }\n : {}\n : isDecorative\n ? { 'aria-hidden': true }\n : {\n ...(isInteractive ? {} : { role: 'img' as const }),\n 'aria-label': accessibleName || name || 'Avatar',\n };\n\n // Each default yields to a value the caller passed, and is applied after\n // `rest` reading through it rather than spread before it. React treats an\n // `undefined` attribute as \"remove it\", and a spread carrying the key with no\n // value is how that arrives, so a default spread first was erased by it: an\n // `aria-label: undefined` left a button avatar nameless, and `role` and\n // `aria-hidden` went the same way. The button `type` below has the same\n // shape (#690).\n const a11yProps = Object.fromEntries(\n Object.entries(a11yDefaults).map(([key, fallback]) => [\n key,\n rest[key as keyof typeof a11yDefaults] ?? fallback,\n ])\n );\n\n return (\n <Tag\n ref={ref}\n className={combinedClasses}\n style={{ ...sizeStyle, ...style }}\n {...linkProps}\n {...rest}\n {...a11yProps}\n // A clickable avatar inside a form must not submit it, and `<button>`\n // defaults to type=\"submit\". A caller's `submit` or `reset` still wins.\n // Anything else becomes `button`, since HTML reads a value it does not\n // define for a button as submit too; `buttonType` says more.\n //\n // After `rest`, reading through it rather than before it: React treats\n // `type={undefined}` as \"remove the attribute\", and a spread carrying the\n // key with no value is how that arrives. Spreading the default first let\n // such a spread erase it (#690), so the guard only held for callers who\n // passed nothing. `Dropdown.Item` and `Menu.Item` apply their button\n // type after the spread too.\n {...(Tag === 'button' ? { type: buttonType(rest.type) } : {})}\n >\n {showImage && (\n <img\n key={src}\n {...imageProps}\n ref={imgRef}\n src={src}\n alt={accessibleName ?? ''}\n onError={e => {\n imageProps?.onError?.(e);\n setErroredSrc(src);\n }}\n />\n )}\n {showInitials && (\n <span className={initialsClass}>{resolvedInitials}</span>\n )}\n {showIcon && icon}\n {showDefaultIcon && <DefaultAvatarIcon />}\n </Tag>\n );\n}) as PolymorphicComponent<AvatarOwnProps, 'figure', AvatarForwardedProp>;\n\nAvatar.displayName = 'Avatar';\n\nexport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,GAAG,CAAC,CAAC;oBACxB,aAAa,CAAC,GAAG,CAAC;AACpB,gBAAA,CAAC,EAAA,EARI,GAAG,CASR,CACH,EACA,YAAY,KACXA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,aAAa,EAAA,QAAA,EAAG,gBAAgB,EAAA,CAAQ,CAC1D,EACA,QAAQ,IAAI,IAAI,EAChB,eAAe,IAAIA,GAAA,CAAC,iBAAiB,EAAA,EAAA,CAAG,CAAA,EAAA,CACrC;AAEV,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { buttonType } from '../helpers/buttonType';\nimport {\n isCustomElement,\n type PolymorphicComponent,\n} from '../helpers/polymorphic';\nimport { warnOnce } from '../helpers/devWarnings';\n\nconst avatarColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n] as const;\n\n/** Valid color values for the Avatar component. */\nexport type AvatarColor = (typeof avatarColors)[number];\n\nconst autoAvatarColors: AvatarColor[] = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n];\n\nconst avatarSizes = [\n '16x16',\n '24x24',\n '32x32',\n '48x48',\n '64x64',\n '96x96',\n '128x128',\n] as const;\n\n/** Valid preset size values for the Avatar component. */\nexport type AvatarSize = (typeof avatarSizes)[number];\n\n/**\n * The roles a caller can use to say \"this avatar is not a control\", and so claim\n * the non-interactive treatment for a custom `as` target we would otherwise have\n * to guess about.\n *\n * Read by VALUE, not by presence. Any role at all used to count, which let\n * `role=\"button\"` — a claim of the opposite — route a real control into the\n * decorative branch and come out `aria-hidden` and nameless. `img` is what the\n * fallback itself applies; `presentation` and `none` are the standard ways to say\n * an element carries no semantics, which is what pairs with `alt=\"\"`.\n */\nconst NON_INTERACTIVE_ROLES: readonly string[] = [\n 'img',\n 'presentation',\n 'none',\n];\n\n/**\n * Elements other than `a` that declare `target` themselves, so on them it is\n * the element's own attribute and not a link attribute Avatar withholds for\n * want of one. The link attribute warning leaves `target` out on these, the way\n * it leaves `rel` out everywhere. `area` and `base` are void elements, which\n * Avatar's content rules out, so `form` is the one a caller can reach.\n */\nconst ELEMENTS_WITH_OWN_TARGET: readonly React.ElementType[] = [\n 'form',\n 'area',\n 'base',\n];\n\n/** Valid shape values for the Avatar component. */\nexport type AvatarShape = 'circle' | 'rounded' | 'square';\n\n/**\n * Derives a small set of initials from a name (e.g. \"Ada Lovelace\" -> \"AL\").\n */\nfunction getInitialsFromName(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return '';\n // Iterate by code point (Array.from) so astral-plane characters (emoji, some\n // CJK) don't get split into half surrogates.\n if (words.length === 1) {\n return Array.from(words[0]).slice(0, 2).join('').toUpperCase();\n }\n const first = Array.from(words[0])[0];\n const last = Array.from(words[words.length - 1])[0];\n return (first + last).toUpperCase();\n}\n\n/**\n * Deterministically hashes a string to pick one of the auto avatar colors.\n */\nfunction getAutoColor(name: string): AvatarColor {\n let hash = 0;\n for (let i = 0; i < name.length; i++) {\n hash = (hash << 5) - hash + name.charCodeAt(i);\n hash |= 0;\n }\n const index = Math.abs(hash) % autoAvatarColors.length;\n return autoAvatarColors[index];\n}\n\n/**\n * Default generic avatar icon shown when there is no image, name, initials, or icon.\n */\nfunction DefaultAvatarIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" width=\"60%\" height=\"60%\" aria-hidden=\"true\">\n <path\n fill=\"currentColor\"\n d=\"M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-4.42 0-9 2.24-9 5v2a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-2c0-2.76-4.58-5-9-5Z\"\n />\n </svg>\n );\n}\n\n/**\n * The Avatar component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface AvatarOwnProps extends Omit<BulmaClassesProps, 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Image URL. On load error (or if absent), falls back to initials, then `icon`. */\n src?: string;\n /**\n * Alternate text for the image (used for the accessible name in every render mode). An\n * explicit `alt=\"\"` marks a non-interactive avatar as decorative.\n *\n * A link or button avatar is never decorative — it keeps an accessible name — and a custom\n * component passed to `as` counts as one unless it states otherwise, so `alt=\"\"` on a custom\n * wrapper needs that signal alongside it. `as` documents which props carry it.\n */\n alt?: string;\n /** Derives initials and a deterministic background color when no `src` is shown. */\n name?: string;\n /** Explicit initials override (else derived from `name`). */\n initials?: string;\n /** Final fallback, rendered when there is no `src`, `name`, or `initials`. */\n icon?: React.ReactNode;\n /** Preset size, or a pixel size when a number. */\n size?: AvatarSize | number;\n /** Avatar shape. Default `'circle'`. */\n shape?: AvatarShape;\n /** Background color for initials/icon avatars (else auto-derived from `name`). */\n color?: AvatarColor;\n /**\n * When set, renders the avatar as a link: an `<a>` unless `as` names the element itself. An\n * `as` target declaring its own `href` supersedes this one, and its type and its requiredness\n * are what apply.\n *\n * It is passed on only to a target that can be a link: an `a`, a custom element, or a\n * component. Any other `as` you pass, such as `'figure'` or `'div'`, still accepts it but\n * renders without it, because an `href` is not valid HTML on those elements, and a\n * development build logs a console warning naming what was dropped. To make such an avatar a\n * link, render it `as=\"a\"` or pass a link component to `as`. An empty `href` asks for no link:\n * with no `as` it renders a `<figure>`, and it draws no warning.\n */\n href?: string;\n /** Anchor target, passed on only where `href` is (an `a`, a custom element, or a component) and superseded by the target's own declaration the way `href` is. Any other `as` you pass renders without it, with the same development warning as `href`, except `'form'`: it declares its own `target`, so there the attribute is still withheld but draws no warning. */\n target?: string;\n /** Anchor rel, passed on only where `href` is (an `a`, a custom element, or a component) and superseded by the target's own declaration the way `href` is. */\n rel?: string;\n /** Extra props forwarded to the underlying `<img>` (e.g. `loading`, `crossOrigin`); its `onError` is chained before the fallback fires. */\n imageProps?: React.ImgHTMLAttributes<HTMLImageElement>;\n /** Inline styles, merged after the size style. */\n style?: React.CSSProperties;\n /**\n * Not accepted. Avatar always renders its own content — the image, the\n * initials, or the icon — so anything a caller passed would be replaced. It\n * is declared unavailable rather than derived from `as`, which would let a\n * target requiring `children` compel a value it then never receives.\n * @internal\n */\n children?: never;\n}\n\n/**\n * The own props Avatar hands to the element `as` names rather than consuming.\n *\n * They are what *chooses* the element when `as` is absent — an `<a>` with an\n * `href`, a `<figure>` without one — so Avatar has to accept them before `as` is\n * known. Declaring them is only half of it. `PolymorphicProps` explains what\n * naming them here buys, and what leaving them unnamed cost (#665).\n */\ntype AvatarForwardedProp = 'href' | 'target' | 'rel';\n\n/**\n * Props for the Avatar component. The DOM attributes and the `ref` both follow\n * `as`.\n *\n * `href`, `target` and `rel` are Avatar's own props only for a target that has\n * none of its own: `<Avatar href=\"/x\" />` needs no `as`, while\n * `<Avatar as={NextLink} />` takes `next/link`'s `href` — required, and a URL\n * object as readily as a string.\n *\n * The type parameter defaults to `'figure'`, not to `React.ElementType`.\n * Defaulting to the constraint sounds truer to a runtime default that is\n * conditional, but `ComponentPropsWithoutRef<React.ElementType>` spreads across\n * every element at once and accepts anything — which is the false-positive this\n * whole change exists to remove. `'figure'` is the element a no-`href` avatar\n * actually renders, and the anchor props it can additionally take are declared\n * above.\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 AvatarProps<T extends React.ElementType = 'figure'> = Omit<\n AvatarOwnProps,\n Extract<AvatarForwardedProp, keyof React.ComponentPropsWithoutRef<T>>\n> &\n Omit<\n React.ComponentPropsWithoutRef<T>,\n Exclude<keyof AvatarOwnProps, AvatarForwardedProp> | 'as'\n > & {\n /**\n * Element/component to render as. Defaults to `'a'` when `href` is set, else `'figure'`.\n *\n * This also decides whether the avatar is treated as interactive, which is what keeps\n * `role=\"img\"` and the `alt=\"\"` decorative opt-out off a link or button. A custom\n * component counts — a router link takes `to` rather than this component's `href`, so\n * its own props cannot say — while `'a'`, `'button'`, and a custom element given an\n * `href` count for the reason they read.\n *\n * If your custom component renders something that really is just a picture, say so with\n * `role=\"img\"` and it is treated as one, `alt=\"\"` included. A truthy `aria-hidden` says it\n * too, and so do `role=\"presentation\"` and `role=\"none\"` — though ARIA's own conflict\n * resolution drops those two whenever the avatar still carries a name, so prefer\n * `role=\"img\"`. A role claiming the opposite, such as `\"button\"`, says nothing here, and\n * neither does an `href`: that settles it on its own. A genuine `'a'`/`'button'`/`href`\n * avatar keeps its accessible name either way.\n *\n * `'button'` renders `type=\"button\"` unless you pass `type=\"submit\"` or `type=\"reset\"`, so\n * an avatar inside a form does not submit it.\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `AvatarProps<T>` above — the body cannot see through `T`, so it names the\n * handful of DOM props it actually reads back off `rest`.\n */\ntype AvatarImplProps = AvatarOwnProps & {\n as?: React.ElementType;\n role?: React.AriaRole;\n 'aria-hidden'?: React.AriaAttributes['aria-hidden'];\n 'aria-label'?: string;\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n};\n\n/**\n * The `Avatar` component represents a person or entity as a compact image.\n *\n * @function\n * @param {AvatarProps} props - Props for the Avatar component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered avatar element.\n *\n * @example\n * <Avatar src=\"/users/ada.jpg\" name=\"Ada Lovelace\" size=\"64x64\" />\n * @example\n * <Avatar name=\"Grace Hopper\" />\n */\nexport const Avatar = forwardRef(function Avatar(\n avatarProps: AvatarProps,\n ref: React.Ref<HTMLElement>\n) {\n const {\n className,\n src,\n alt,\n name,\n initials,\n icon,\n size,\n shape = 'circle',\n color,\n as,\n href,\n target,\n rel,\n imageProps,\n style,\n ...props\n } = avatarProps as AvatarImplProps;\n // Tracks the src that failed to load. A src change clears the latch during\n // render (React's \"reset state when props change\" pattern) so a previously\n // failed src is retried when switched back to. The img is additionally\n // keyed by src so a swap discards the old DOM node — a late error event\n // from the previous request can't fire on a retained node and latch the\n // replacement src as failed.\n const [erroredSrc, setErroredSrc] = useState<string | undefined>(undefined);\n const [prevSrc, setPrevSrc] = useState(src);\n if (src !== prevSrc) {\n setPrevSrc(src);\n setErroredSrc(undefined);\n }\n const imgRef = useRef<HTMLImageElement>(null);\n\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n const showImage = !!src && src !== erroredSrc;\n\n // Catch images that failed before hydration: in SSR/static pages a broken\n // image can finish loading before React attaches its onError, so it never\n // fires. A complete image with no intrinsic width is a load failure.\n useEffect(() => {\n const img = imgRef.current;\n if (img && img.complete && img.naturalWidth === 0) {\n setErroredSrc(src);\n }\n }, [src]);\n\n const resolvedInitials = initials\n ? initials.toUpperCase()\n : name\n ? getInitialsFromName(name)\n : '';\n const showInitials = !showImage && !!resolvedInitials;\n const showIcon = !showImage && !showInitials && !!icon;\n const showDefaultIcon = !showImage && !showInitials && !showIcon;\n\n const resolvedColor = color ?? (name ? getAutoColor(name) : undefined);\n\n const isPresetSize = typeof size === 'string' && avatarSizes.includes(size);\n const sizeStyle =\n typeof size === 'number'\n ? { width: size, height: size, fontSize: size / 2.5 }\n : undefined;\n\n const avatarClasses = usePrefixedClassNames('avatar', {\n [`is-${size}`]: isPresetSize,\n [`is-${shape}`]: shape,\n [`is-${resolvedColor}`]:\n resolvedColor && !showImage && avatarColors.includes(resolvedColor),\n });\n\n const combinedClasses = classNames(\n avatarClasses,\n bulmaHelperClasses,\n className\n );\n\n const initialsClass = usePrefixedClassNames('avatar-initials');\n\n const Tag: React.ElementType = as ?? (href ? 'a' : 'figure');\n // A custom component counts as interactive whether or not it was given OUR\n // href: a router link takes `to`, creates the anchor itself, and cannot be\n // classified from the props it arrives with (#668). Marking a real link as a\n // picture is the worse failure — and `alt=\"\"` would go further and mark it\n // decorative (aria-hidden), leaving it nameless.\n //\n // A custom ELEMENT still needs the href. A hyphenated tag renders a real DOM\n // element of that name, so nothing is hidden from us: without a link to follow\n // it is still a picture. `Navbar.Link` draws the same line for `role=\"button\"`.\n //\n // Where we are guessing, the caller settles it: an explicit `role` or\n // `aria-hidden` states the semantics, so a custom component that really is a\n // wrapper gets `role=\"img\"` and its `alt=\"\"` opt-out back. `role` alone would\n // be a half-override — interactivity also drives the decorative opt-out and the\n // name fallback, and overriding one of the three is worse than overriding none.\n //\n // An `href` ENDS the guess, so it outranks the signal. `as=\"a\"`, `as=\"button\"`\n // and a target we were handed an href for are known to be interactive, and there\n // the rule that an interactive element always carries an accessible name is not\n // the caller's to waive: without this, `as={RouterLink} href=\"/x\" role=\"img\"`\n // with `alt=\"\"` rendered a real anchor as `aria-hidden` and nameless — the very\n // failure #668 is about. `Navbar.Link` orders the same two the same way.\n //\n // The signal has to MEAN what it is used for, so both halves read a value rather\n // than a presence — the way `Navbar.Link` reads `role === 'button'`. A role only\n // claims to be a picture if it says so: `role=\"button\"` or `role=\"link\"` is the\n // opposite claim, and taking any role as the signal handed an interactive-role\n // element `aria-hidden` and no name. Likewise `aria-hidden={false}` denies\n // hiding, so only a truthy one counts.\n const ariaHidden = rest['aria-hidden'];\n const statesItIsNotAControl =\n (rest.role !== undefined && NON_INTERACTIVE_ROLES.includes(rest.role)) ||\n ariaHidden === true ||\n ariaHidden === 'true';\n\n const customTargetStatesSemantics =\n typeof Tag !== 'string' && href == null && statesItIsNotAControl;\n\n const isInteractive =\n Tag === 'a' ||\n Tag === 'button' ||\n (typeof Tag !== 'string' && !customTargetStatesSemantics) ||\n (isCustomElement(Tag) && href != null);\n\n // Only forward link attributes when rendering an anchor or a custom (non-DOM)\n // component; a plain `as=\"div\"` must not receive a stray `href`/`target`/`rel`.\n const isLinkLike =\n Tag === 'a' || typeof Tag !== 'string' || isCustomElement(Tag);\n // A plain element like a `div` declares no `href` or `target`, so the type\n // accepts them as Avatar's own while the drop below withholds them, and\n // without this they would vanish in silence (#733). Forwarding them would put\n // them where HTML has no such attribute, so the drop stays and development\n // reports it instead, naming only the ones actually passed.\n //\n // `rel` is withheld too but left out here. React declares it on every\n // element, so on a plain `as` it is that element's own attribute, and\n // \"render it as a link\" would be the wrong advice for it. `target` is the\n // same on an element that declares it, such as `form`, so it is left out\n // there. Whether to forward either one to such an element is a separate\n // question from this warning.\n //\n // Only for an `as` the caller wrote. Without one the element is Avatar's own\n // choice, and a message naming an `as` they never passed sends them looking\n // for it. A value counts when it is truthy, the same test that picks `'a'`\n // over `'figure'`, so an empty `href` from data asks for no link and draws no\n // warning. The key is the element plus the attributes passed, so a re-render\n // or a list of avatars warns once, while a different combination on the same\n // element still gets its own warning rather than hiding behind the first.\n //\n // Development-only is `warnOnce`'s job, as it is for the colour warnings, so\n // this block has no production check of its own. One here would have to read\n // `process` safely, and a `typeof process` test is not something a bundler\n // replaces: in a browser it is false, and the warning never fired in the\n // development builds it exists for. The cost is that production still\n // collects the attributes and builds the message for an avatar that needs\n // it, which is small and limited to the case the warning is about.\n if (as != null && !isLinkLike) {\n const dropped = Object.entries({\n href,\n target: ELEMENTS_WITH_OWN_TARGET.includes(as) ? undefined : target,\n })\n .filter(([, value]) => value)\n .map(([key]) => key);\n if (dropped.length > 0) {\n warnOnce(\n `Avatar:link-props-on-${as}:${dropped.join('+')}`,\n `[bestax-bulma] <Avatar as=\"${as}\" ${dropped.join(' ')}>: this ` +\n `<${as}> renders without ` +\n `${dropped.map(key => `\"${key}\"`).join(' and ')}, because Avatar ` +\n `passes link attributes on only to a target that can be a link (an ` +\n `\"a\", a custom element, or a component). To make it a link, render ` +\n `it as=\"a\" or pass a link component to \"as\".`\n );\n }\n }\n // Present-only, not `{ href, target, rel }`. An unconditional spread hands the\n // target these keys whatever the caller passed, and a key existing is not free:\n // a target that tests for one sees a link where there is none, and one that\n // spreads its own `{...rest}` onward passes the nothing along. It is NOT about\n // a destructuring default, which an explicit `undefined` triggers just as an\n // absent key does. What stops a target that REQUIRES one from being rendered\n // without it is the type (#665) — this is the smaller half, and the backstop for\n // the callers a type does not reach: a plain-JavaScript one and a loose spread,\n // the same pair `Button` and `Menu.Item` keep their own filters for.\n const linkProps = isLinkLike\n ? {\n ...(href !== undefined && { href }),\n ...(target !== undefined && { target }),\n ...(rel !== undefined && { rel }),\n }\n : {};\n\n // alt coalesces with ?? (not ||) so an explicit alt=\"\" survives as the\n // standard decorative marker instead of being overridden by name.\n const accessibleName = alt ?? name;\n // The decorative opt-out never applies to an interactive avatar — a link or\n // button must always expose an accessible name.\n const isDecorative = alt === '' && !isInteractive;\n\n const a11yDefaults: {\n 'aria-label'?: string;\n role?: 'img';\n 'aria-hidden'?: true;\n } = showImage\n ? isInteractive && !accessibleName\n ? // The img alt normally names the control; with no alt/name (an API\n // returning only a photo URL) the link/button would be nameless.\n { 'aria-label': name || 'Avatar' }\n : {}\n : isDecorative\n ? { 'aria-hidden': true }\n : {\n ...(isInteractive ? {} : { role: 'img' as const }),\n 'aria-label': accessibleName || name || 'Avatar',\n };\n\n // Each default yields to a value the caller passed, and is applied after\n // `rest` reading through it rather than spread before it. React treats an\n // `undefined` attribute as \"remove it\", and a spread carrying the key with no\n // value is how that arrives, so a default spread first was erased by it: an\n // `aria-label: undefined` left a button avatar nameless, and `role` and\n // `aria-hidden` went the same way. The button `type` below has the same\n // shape (#690).\n const a11yProps = Object.fromEntries(\n Object.entries(a11yDefaults).map(([key, fallback]) => [\n key,\n rest[key as keyof typeof a11yDefaults] ?? fallback,\n ])\n );\n\n return (\n <Tag\n ref={ref}\n className={combinedClasses}\n style={{ ...sizeStyle, ...style }}\n {...linkProps}\n {...rest}\n {...a11yProps}\n // A clickable avatar inside a form must not submit it, and `<button>`\n // defaults to type=\"submit\". A caller's `submit` or `reset` still wins.\n // Anything else becomes `button`, since HTML reads a value it does not\n // define for a button as submit too; `buttonType` says more.\n //\n // After `rest`, reading through it rather than before it: React treats\n // `type={undefined}` as \"remove the attribute\", and a spread carrying the\n // key with no value is how that arrives. Spreading the default first let\n // such a spread erase it (#690), so the guard only held for callers who\n // passed nothing. `Dropdown.Item` and `Menu.Item` apply their button\n // type after the spread too.\n {...(Tag === 'button' ? { type: buttonType(rest.type) } : {})}\n >\n {showImage && (\n <img\n key={src}\n {...imageProps}\n ref={imgRef}\n src={src}\n alt={accessibleName ?? ''}\n onError={e => {\n imageProps?.onError?.(e);\n setErroredSrc(src);\n }}\n />\n )}\n {showInitials && (\n <span className={initialsClass}>{resolvedInitials}</span>\n )}\n {showIcon && icon}\n {showDefaultIcon && <DefaultAvatarIcon />}\n </Tag>\n );\n}) as PolymorphicComponent<AvatarOwnProps, 'figure', AvatarForwardedProp>;\n\nAvatar.displayName = 'Avatar';\n\nexport default Avatar;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAUA,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;CACC;AAKV,MAAM,gBAAgB,GAAkB;IACtC,SAAS;IACT,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;CACT;AAED,MAAM,WAAW,GAAG;IAClB,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;CACD;AAKV;;;;;;;;;;AAUG;AACH,MAAM,qBAAqB,GAAsB;IAC/C,KAAK;IACL,cAAc;IACd,MAAM;CACP;AAED;;;;;;AAMG;AACH,MAAM,wBAAwB,GAAiC;IAC7D,MAAM;IACN,MAAM;IACN,MAAM;CACP;AAKD;;AAEG;AACH,SAAS,mBAAmB,CAAC,IAAY,EAAA;AACvC,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AACtD,IAAA,IAAI,KAAK,CAAC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,EAAA,EACF,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,EAAE,EAAA,GAC7B,SAAS,EAAA,GACT,IAAI,EAAA,GACJ,SAAS,EAAA,IAYR,GAAG,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,EAAA,QAAA,EAAA,CAE5D,SAAS,KACRD,gBAEM,UAAU,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,cAAc,IAAI,EAAE,EACzB,OAAO,EAAE,CAAC,IAAG;AACX,oBAAA,UAAU,EAAE,OAAO,GAAG,CAAC,CAAC;oBACxB,aAAa,CAAC,GAAG,CAAC;AACpB,gBAAA,CAAC,EAAA,EARI,GAAG,CASR,CACH,EACA,YAAY,KACXA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,aAAa,EAAA,QAAA,EAAG,gBAAgB,EAAA,CAAQ,CAC1D,EACA,QAAQ,IAAI,IAAI,EAChB,eAAe,IAAIA,GAAA,CAAC,iBAAiB,EAAA,EAAA,CAAG,CAAA,EAAA,CACrC;AAEV,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 { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatars.js","sources":["../../../src/components/Avatars.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { useNumberFormat } from '../helpers/localeFormat';\nimport { Avatar, AvatarProps } from './Avatar';\n\n/** Valid overlap spacing values for the Avatars component. */\nexport type AvatarsSpacing = 'sm' | 'md' | 'lg';\n\n/**\n * Props for the Avatars component.\n */\nexport interface AvatarsProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Show only the first `max` children, replacing the overflow with a \"+N\" surplus avatar. A single overflow avatar is shown directly rather than as a pointless \"+1\". */\n max?: number;\n /** Uniform size applied to every child `Avatar` (and the surplus avatar). */\n size?: AvatarProps['size'];\n /** Uniform shape applied to every child `Avatar` (and the surplus avatar); a child's own `shape` wins when this is unset. */\n shape?: AvatarProps['shape'];\n /** Space between avatars: a preset or a pixel `number`. The overlap distance, or the gap when `spaced`. */\n spacing?: AvatarsSpacing | number;\n /** Lay the avatars out side by side (non-overlapping), using `spacing` as the gap. */\n spaced?: boolean;\n /** Builds the surplus avatar's accessible name from the hidden count, for localization. Default: `` `${count} more` ``. Inside a `LocaleProvider` with a `locale`, the visible `+count` and the count in the default name are written the way that locale writes numbers. */\n surplusLabel?: (count: number) => string;\n /** `Avatar` elements to render inside the group. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Avatars` component renders an overlapping/stacked group of `Avatar`s, the \"members\" list pattern.\n *\n * @function\n * @param {AvatarsProps} props - Props for the Avatars component.\n * @returns {JSX.Element} The rendered avatars group.\n *\n * @example\n * <Avatars max={3} size=\"48x48\">\n * {members.map(m => <Avatar key={m.id} src={m.photo} name={m.name} />)}\n * </Avatars>\n */\nconst AvatarsComponent: React.FC<AvatarsProps> = ({\n className,\n max,\n size,\n shape,\n spacing = 'md',\n spaced = false,\n surplusLabel,\n style,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });\n const formatNumber = useNumberFormat();\n\n // A preset spacing maps to a class; a numeric spacing sets the CSS var inline\n // (mirrors Sidebar's inline --bulma-* width var).\n const isPresetSpacing = typeof spacing === 'string';\n const avatarsClasses = usePrefixedClassNames('avatars', {\n [`is-spacing-${spacing}`]: isPresetSpacing,\n 'is-spaced': spaced,\n });\n const spacingStyle: React.CSSProperties | undefined =\n typeof spacing === 'number'\n ? ({ '--bulma-avatars-spacing': `${spacing}px` } as React.CSSProperties)\n : undefined;\n\n const surplusClass = usePrefixedClassNames('is-surplus');\n\n const combinedClasses = classNames(\n avatarsClasses,\n bulmaHelperClasses,\n className\n );\n\n // Fragments are opened up, so the avatars inside one count toward `max` and\n // take the group's size and shape one by one. Text between them is dropped.\n const childArray = flattenChildren(children).filter(\n (child): child is React.ReactElement<AvatarProps> =>\n React.isValidElement(child)\n );\n\n const maxCount =\n typeof max === 'number' && Number.isInteger(max) && max >= 0\n ? max\n : undefined;\n const overshoot = maxCount !== undefined ? childArray.length - maxCount : 0;\n // A \"+1\" surplus bubble occupies the same slot the hidden avatar would, so\n // only collapse into a surplus when it stands in for two or more avatars; a\n // single overflow avatar is shown directly.\n const clamp = maxCount !== undefined && overshoot >= 2;\n const visibleChildren = clamp ? childArray.slice(0, maxCount) : childArray;\n const overflowCount = clamp ? overshoot : 0;\n\n return (\n <div\n className={combinedClasses}\n style={{ ...spacingStyle, ...style }}\n {...rest}\n >\n {visibleChildren.map(child =>\n // Conditional-spread so an unset group size/shape doesn't clobber a\n // child that set its own.\n React.cloneElement(child, {\n ...(size !== undefined ? { size } : {}),\n ...(shape !== undefined ? { shape } : {}),\n })\n )}\n {overflowCount > 0 && (\n <Avatar\n initials={\n formatNumber\n ? formatNumber(overflowCount, { signDisplay: 'always' })\n : `+${overflowCount}`\n }\n alt={\n // `||` (not a plain ternary): an empty string from surplusLabel\n // would make the bubble decorative (alt=\"\") and hide the count\n // from assistive tech — fall back to the default label instead.\n surplusLabel?.(overflowCount) ||\n `${formatNumber ? formatNumber(overflowCount) : overflowCount} more`\n }\n size={size}\n shape={shape}\n className={surplusClass}\n />\n )}\n </div>\n );\n};\n\nexport const Avatars = withSubComponents(\n AvatarsComponent,\n { Avatar },\n 'Avatars'\n);\n\nexport default Avatars;\n"],"names":["_jsxs","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatars.js","sources":["../../../src/components/Avatars.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { useNumberFormat } from '../helpers/localeFormat';\nimport { Avatar, AvatarProps } from './Avatar';\n\n/** Valid overlap spacing values for the Avatars component. */\nexport type AvatarsSpacing = 'sm' | 'md' | 'lg';\n\n/**\n * Props for the Avatars component.\n */\nexport interface AvatarsProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Show only the first `max` children, replacing the overflow with a \"+N\" surplus avatar. A single overflow avatar is shown directly rather than as a pointless \"+1\". */\n max?: number;\n /** Uniform size applied to every child `Avatar` (and the surplus avatar). */\n size?: AvatarProps['size'];\n /** Uniform shape applied to every child `Avatar` (and the surplus avatar); a child's own `shape` wins when this is unset. */\n shape?: AvatarProps['shape'];\n /** Space between avatars: a preset or a pixel `number`. The overlap distance, or the gap when `spaced`. */\n spacing?: AvatarsSpacing | number;\n /** Lay the avatars out side by side (non-overlapping), using `spacing` as the gap. */\n spaced?: boolean;\n /** Builds the surplus avatar's accessible name from the hidden count, for localization. Default: `` `${count} more` ``. Inside a `LocaleProvider` with a `locale`, the visible `+count` and the count in the default name are written the way that locale writes numbers. */\n surplusLabel?: (count: number) => string;\n /** `Avatar` elements to render inside the group. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Avatars` component renders an overlapping/stacked group of `Avatar`s, the \"members\" list pattern.\n *\n * @function\n * @param {AvatarsProps} props - Props for the Avatars component.\n * @returns {JSX.Element} The rendered avatars group.\n *\n * @example\n * <Avatars max={3} size=\"48x48\">\n * {members.map(m => <Avatar key={m.id} src={m.photo} name={m.name} />)}\n * </Avatars>\n */\nconst AvatarsComponent: React.FC<AvatarsProps> = ({\n className,\n max,\n size,\n shape,\n spacing = 'md',\n spaced = false,\n surplusLabel,\n style,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });\n const formatNumber = useNumberFormat();\n\n // A preset spacing maps to a class; a numeric spacing sets the CSS var inline\n // (mirrors Sidebar's inline --bulma-* width var).\n const isPresetSpacing = typeof spacing === 'string';\n const avatarsClasses = usePrefixedClassNames('avatars', {\n [`is-spacing-${spacing}`]: isPresetSpacing,\n 'is-spaced': spaced,\n });\n const spacingStyle: React.CSSProperties | undefined =\n typeof spacing === 'number'\n ? ({ '--bulma-avatars-spacing': `${spacing}px` } as React.CSSProperties)\n : undefined;\n\n const surplusClass = usePrefixedClassNames('is-surplus');\n\n const combinedClasses = classNames(\n avatarsClasses,\n bulmaHelperClasses,\n className\n );\n\n // Fragments are opened up, so the avatars inside one count toward `max` and\n // take the group's size and shape one by one. Text between them is dropped.\n const childArray = flattenChildren(children).filter(\n (child): child is React.ReactElement<AvatarProps> =>\n React.isValidElement(child)\n );\n\n const maxCount =\n typeof max === 'number' && Number.isInteger(max) && max >= 0\n ? max\n : undefined;\n const overshoot = maxCount !== undefined ? childArray.length - maxCount : 0;\n // A \"+1\" surplus bubble occupies the same slot the hidden avatar would, so\n // only collapse into a surplus when it stands in for two or more avatars; a\n // single overflow avatar is shown directly.\n const clamp = maxCount !== undefined && overshoot >= 2;\n const visibleChildren = clamp ? childArray.slice(0, maxCount) : childArray;\n const overflowCount = clamp ? overshoot : 0;\n\n return (\n <div\n className={combinedClasses}\n style={{ ...spacingStyle, ...style }}\n {...rest}\n >\n {visibleChildren.map(child =>\n // Conditional-spread so an unset group size/shape doesn't clobber a\n // child that set its own.\n React.cloneElement(child, {\n ...(size !== undefined ? { size } : {}),\n ...(shape !== undefined ? { shape } : {}),\n })\n )}\n {overflowCount > 0 && (\n <Avatar\n initials={\n formatNumber\n ? formatNumber(overflowCount, { signDisplay: 'always' })\n : `+${overflowCount}`\n }\n alt={\n // `||` (not a plain ternary): an empty string from surplusLabel\n // would make the bubble decorative (alt=\"\") and hide the count\n // from assistive tech — fall back to the default label instead.\n surplusLabel?.(overflowCount) ||\n `${formatNumber ? formatNumber(overflowCount) : overflowCount} more`\n }\n size={size}\n shape={shape}\n className={surplusClass}\n />\n )}\n </div>\n );\n};\n\nexport const Avatars = withSubComponents(\n AvatarsComponent,\n { Avatar },\n 'Avatars'\n);\n\nexport default Avatars;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AAoCA;;;;;;;;;;;AAWG;AACH,MAAM,gBAAgB,GAA2B,CAAC,EAChD,SAAS,EACT,GAAG,EACH,IAAI,EACJ,KAAK,EACL,OAAO,GAAG,IAAI,EACd,MAAM,GAAG,KAAK,EACd,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;AAClE,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;;;AAItC,IAAA,MAAM,eAAe,GAAG,OAAO,OAAO,KAAK,QAAQ;AACnD,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,CAAC,CAAA,WAAA,EAAc,OAAO,CAAA,CAAE,GAAG,eAAe;AAC1C,QAAA,WAAW,EAAE,MAAM;AACpB,KAAA,CAAC;AACF,IAAA,MAAM,YAAY,GAChB,OAAO,OAAO,KAAK;AACjB,UAAG,EAAE,yBAAyB,E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CAAC,MAAM,EAAA,EACL,QAAQ,EACN;sBACI,YAAY,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE;AACvD,sBAAE,CAAA,CAAA,EAAI,aAAa,CAAA,CAAE,EAEzB,GAAG;;;;gBAID,YAAY,GAAG,aAAa,CAAC;AAC7B,oBAAA,CAAA,EAAG,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA,KAAA,CAAO,EAEtE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,YAAY,EAAA,CACvB,CACH,CAAA,EAAA,CACG;AAEV,CAAC;AAEM,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB,EAAE,MAAM,EAAE,EACV,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, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
import { useMemo } from 'react';
|
|
4
5
|
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useNumberFormat } from '../helpers/localeFormat';\n\nconst badgeColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n] as const;\n\n/** Valid color values for the Badge component. */\nexport type BadgeColor = (typeof badgeColors)[number];\n\n/** Valid corner position values for the Badge component. */\nexport type BadgePosition =\n 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\n\n/** Valid overlap adjustment values for the Badge component. */\nexport type BadgeOverlap = 'circle' | 'square';\n\n/**\n * Props for the Badge component.\n */\nexport interface BadgeProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'content'>,\n Omit<BulmaClassesProps, 'color'> {\n /** Additional CSS classes for the root — the wrapper when `children` are present, else the badge pill. */\n className?: string;\n /** Additional CSS classes applied to the badge pill itself (unprefixed, like `Tooltip`'s `tooltipClassName`). */\n badgeClassName?: string;\n /** Count, short text, or a custom node to display; omit with `dot` for a plain dot. `max`/`showZero` apply only to numeric content. A numeric count is written the way the `locale` of a `LocaleProvider` around it writes numbers. */\n content?: React.ReactNode;\n /** Numeric `content` above this renders as `\"{max}+\"`. A negative or non-integer value falls back to the default. */\n max?: number;\n /** Render a small dot with no content. */\n dot?: boolean;\n /** Show the badge when `content` is `0`. Default `false`. */\n showZero?: boolean;\n /** Status color. Default `'danger'`. */\n color?: BadgeColor;\n /** Corner to overlay the badge on, relative to `children`. Ignored for standalone badges (no `children`). */\n position?: BadgePosition;\n /** Nudges the offset for a round (`'circle'`) vs rectangular (`'square'`) child. Ignored for standalone badges (no `children`). */\n overlap?: BadgeOverlap;\n /** Processing/pulse animation; no-ops under `prefers-reduced-motion: reduce`. */\n pulse?: boolean;\n /** Hide the badge pill without unmounting it (the wrapper and `children` stay visible). */\n invisible?: boolean;\n /** The element the badge overlays. Omit to render a standalone badge. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Badge` component is a small status/count indicator overlaid on the corner of another element, or rendered standalone.\n *\n * @function\n * @param {BadgeProps} props - Props for the Badge component.\n * @returns {JSX.Element | null} The rendered badge (and children, if provided).\n *\n * @example\n * <Badge dot color=\"success\" overlap=\"circle\">\n * <Avatar src=\"/users/ada.jpg\" name=\"Ada\" />\n * </Badge>\n * @example\n * <Badge content={128} max={99} color=\"danger\">\n * <Icon name=\"bell\" />\n * </Badge>\n */\nexport const Badge: React.FC<BadgeProps> = ({\n className,\n badgeClassName,\n content,\n max = 99,\n dot = false,\n showZero = false,\n color = 'danger',\n position = 'top-right',\n overlap = 'square',\n pulse = false,\n invisible = false,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n const hasChildren = children != null && children !== false;\n\n const isZero = typeof content === 'number' && content === 0;\n const hasContent =\n content != null &&\n content !== false &&\n content !== true &&\n content !== '' &&\n (!isZero || showZero);\n // A hidden zero keeps the pill mounted (visually hidden via .is-zero) so the\n // role=\"status\" live region exists before a 0 -> 1 change — mutating text in\n // an existing region is reliably announced, inserting an already-populated\n // region is not.\n const zeroPlaceholder = isZero && !showZero && !dot && !invisible;\n const shouldRender = dot || hasContent || invisible || zeroPlaceholder;\n\n // A negative or non-integer max is nonsensical; fall back to the default\n // rather than render e.g. \"-1+\" (mirrors Avatars' max sanitization).\n const sanitizedMax = Number.isInteger(max) && max >= 0 ? max : 99;\n const formatNumber = useNumberFormat();\n\n const displayValue = useMemo<React.ReactNode>(() => {\n if (dot || !hasContent) return undefined;\n // max only applies to numeric content; any other node renders verbatim.\n if (typeof content === 'number') {\n const write = formatNumber ?? String;\n return content > sanitizedMax\n ? `${write(sanitizedMax)}+`\n : write(content);\n }\n return content;\n }, [dot, hasContent, content, sanitizedMax, formatNumber]);\n\n // Only primitive content produces a meaningful aria-label; a custom node\n // supplies its own accessible text, so we leave role=\"status\" unlabeled.\n const ariaLabel =\n typeof displayValue === 'string' || typeof displayValue === 'number'\n ? String(displayValue)\n : undefined;\n\n // Both prefixed-classname hooks stay above the early returns (Rules of Hooks).\n const wrapperClass = usePrefixedClassNames('badge-wrapper');\n const badgeClasses = usePrefixedClassNames('badge', {\n [`is-${color}`]: !!color && badgeColors.includes(color),\n // Corner position / overlap only mean anything inside a wrapper; emitting\n // them on a standalone badge shifts it out of normal flow via the transform.\n [`is-${position}`]: !!position && hasChildren,\n [`is-overlap-${overlap}`]: !!overlap && hasChildren,\n 'is-standalone': !hasChildren,\n 'is-dot': dot,\n 'is-pulse': pulse,\n 'is-invisible': invisible,\n 'is-zero': zeroPlaceholder,\n });\n\n // badgeClassName is a plain (unprefixed) slot merged onto the pill, mirroring\n // Tooltip's tooltipClassName. Standalone badges have no wrapper, so the pill\n // is the root and takes className/helpers/rest directly.\n const pillClass = hasChildren\n ? classNames(badgeClasses, badgeClassName)\n : classNames(badgeClasses, badgeClassName, bulmaHelperClasses, className);\n\n const a11yProps = dot\n ? { 'aria-hidden': true as const }\n : {\n role: 'status' as const,\n ...(ariaLabel !== undefined ? { 'aria-label': ariaLabel } : {}),\n };\n\n const indicator = shouldRender ? (\n <span className={pillClass} {...a11yProps} {...(hasChildren ? {} : rest)}>\n {!dot && displayValue}\n </span>\n ) : null;\n\n if (!hasChildren) {\n return indicator;\n }\n\n // Always render the wrapper when there are children so the root keeps\n // className/helpers/rest (data-testid, id, onClick, ...) even when the badge\n // itself is hidden.\n return (\n <span\n className={classNames(wrapperClass, bulmaHelperClasses, className)}\n {...rest}\n >\n {children}\n {indicator}\n </span>\n );\n};\n\nBadge.displayName = 'Badge';\n\nexport default Badge;\n"],"names":["_jsx","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useNumberFormat } from '../helpers/localeFormat';\n\nconst badgeColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n] as const;\n\n/** Valid color values for the Badge component. */\nexport type BadgeColor = (typeof badgeColors)[number];\n\n/** Valid corner position values for the Badge component. */\nexport type BadgePosition =\n 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\n\n/** Valid overlap adjustment values for the Badge component. */\nexport type BadgeOverlap = 'circle' | 'square';\n\n/**\n * Props for the Badge component.\n */\nexport interface BadgeProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'content'>,\n Omit<BulmaClassesProps, 'color'> {\n /** Additional CSS classes for the root — the wrapper when `children` are present, else the badge pill. */\n className?: string;\n /** Additional CSS classes applied to the badge pill itself (unprefixed, like `Tooltip`'s `tooltipClassName`). */\n badgeClassName?: string;\n /** Count, short text, or a custom node to display; omit with `dot` for a plain dot. `max`/`showZero` apply only to numeric content. A numeric count is written the way the `locale` of a `LocaleProvider` around it writes numbers. */\n content?: React.ReactNode;\n /** Numeric `content` above this renders as `\"{max}+\"`. A negative or non-integer value falls back to the default. */\n max?: number;\n /** Render a small dot with no content. */\n dot?: boolean;\n /** Show the badge when `content` is `0`. Default `false`. */\n showZero?: boolean;\n /** Status color. Default `'danger'`. */\n color?: BadgeColor;\n /** Corner to overlay the badge on, relative to `children`. Ignored for standalone badges (no `children`). */\n position?: BadgePosition;\n /** Nudges the offset for a round (`'circle'`) vs rectangular (`'square'`) child. Ignored for standalone badges (no `children`). */\n overlap?: BadgeOverlap;\n /** Processing/pulse animation; no-ops under `prefers-reduced-motion: reduce`. */\n pulse?: boolean;\n /** Hide the badge pill without unmounting it (the wrapper and `children` stay visible). */\n invisible?: boolean;\n /** The element the badge overlays. Omit to render a standalone badge. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Badge` component is a small status/count indicator overlaid on the corner of another element, or rendered standalone.\n *\n * @function\n * @param {BadgeProps} props - Props for the Badge component.\n * @returns {JSX.Element | null} The rendered badge (and children, if provided).\n *\n * @example\n * <Badge dot color=\"success\" overlap=\"circle\">\n * <Avatar src=\"/users/ada.jpg\" name=\"Ada\" />\n * </Badge>\n * @example\n * <Badge content={128} max={99} color=\"danger\">\n * <Icon name=\"bell\" />\n * </Badge>\n */\nexport const Badge: React.FC<BadgeProps> = ({\n className,\n badgeClassName,\n content,\n max = 99,\n dot = false,\n showZero = false,\n color = 'danger',\n position = 'top-right',\n overlap = 'square',\n pulse = false,\n invisible = false,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n const hasChildren = children != null && children !== false;\n\n const isZero = typeof content === 'number' && content === 0;\n const hasContent =\n content != null &&\n content !== false &&\n content !== true &&\n content !== '' &&\n (!isZero || showZero);\n // A hidden zero keeps the pill mounted (visually hidden via .is-zero) so the\n // role=\"status\" live region exists before a 0 -> 1 change — mutating text in\n // an existing region is reliably announced, inserting an already-populated\n // region is not.\n const zeroPlaceholder = isZero && !showZero && !dot && !invisible;\n const shouldRender = dot || hasContent || invisible || zeroPlaceholder;\n\n // A negative or non-integer max is nonsensical; fall back to the default\n // rather than render e.g. \"-1+\" (mirrors Avatars' max sanitization).\n const sanitizedMax = Number.isInteger(max) && max >= 0 ? max : 99;\n const formatNumber = useNumberFormat();\n\n const displayValue = useMemo<React.ReactNode>(() => {\n if (dot || !hasContent) return undefined;\n // max only applies to numeric content; any other node renders verbatim.\n if (typeof content === 'number') {\n const write = formatNumber ?? String;\n return content > sanitizedMax\n ? `${write(sanitizedMax)}+`\n : write(content);\n }\n return content;\n }, [dot, hasContent, content, sanitizedMax, formatNumber]);\n\n // Only primitive content produces a meaningful aria-label; a custom node\n // supplies its own accessible text, so we leave role=\"status\" unlabeled.\n const ariaLabel =\n typeof displayValue === 'string' || typeof displayValue === 'number'\n ? String(displayValue)\n : undefined;\n\n // Both prefixed-classname hooks stay above the early returns (Rules of Hooks).\n const wrapperClass = usePrefixedClassNames('badge-wrapper');\n const badgeClasses = usePrefixedClassNames('badge', {\n [`is-${color}`]: !!color && badgeColors.includes(color),\n // Corner position / overlap only mean anything inside a wrapper; emitting\n // them on a standalone badge shifts it out of normal flow via the transform.\n [`is-${position}`]: !!position && hasChildren,\n [`is-overlap-${overlap}`]: !!overlap && hasChildren,\n 'is-standalone': !hasChildren,\n 'is-dot': dot,\n 'is-pulse': pulse,\n 'is-invisible': invisible,\n 'is-zero': zeroPlaceholder,\n });\n\n // badgeClassName is a plain (unprefixed) slot merged onto the pill, mirroring\n // Tooltip's tooltipClassName. Standalone badges have no wrapper, so the pill\n // is the root and takes className/helpers/rest directly.\n const pillClass = hasChildren\n ? classNames(badgeClasses, badgeClassName)\n : classNames(badgeClasses, badgeClassName, bulmaHelperClasses, className);\n\n const a11yProps = dot\n ? { 'aria-hidden': true as const }\n : {\n role: 'status' as const,\n ...(ariaLabel !== undefined ? { 'aria-label': ariaLabel } : {}),\n };\n\n const indicator = shouldRender ? (\n <span className={pillClass} {...a11yProps} {...(hasChildren ? {} : rest)}>\n {!dot && displayValue}\n </span>\n ) : null;\n\n if (!hasChildren) {\n return indicator;\n }\n\n // Always render the wrapper when there are children so the root keeps\n // className/helpers/rest (data-testid, id, onClick, ...) even when the badge\n // itself is hidden.\n return (\n <span\n className={classNames(wrapperClass, bulmaHelperClasses, className)}\n {...rest}\n >\n {children}\n {indicator}\n </span>\n );\n};\n\nBadge.displayName = 'Badge';\n\nexport default Badge;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;AAKA,MAAM,WAAW,GAAG;IAClB,SAAS;IACT,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;CACC;AA6CV;;;;;;;;;;;;;;;AAeG;MACU,KAAK,GAAyB,CAAC,EAC1C,SAAS,EACT,cAAc,EACd,OAAO,EACP,GAAG,GAAG,EAAE,EACR,GAAG,GAAG,KAAK,EACX,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,QAAQ,EAChB,QAAQ,GAAG,WAAW,EACtB,OAAO,GAAG,QAAQ,EAClB,KAAK,GAAG,KAAK,EACb,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;IAE3D,MAAM,WAAW,GAAG,QAAQ,IAAI,IAAI,IAAI,QAAQ,KAAK,KAAK;IAE1D,MAAM,MAAM,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC;AAC3D,IAAA,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,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":"Breadcrumb.js","sources":["../../../src/components/Breadcrumb.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\n\nconst validBreadcrumbAlignments = ['centered', 'right'] as const;\n/**\n * Valid alignment values for the Breadcrumb component.\n */\nexport type BreadcrumbAlignment = (typeof validBreadcrumbAlignments)[number];\n\nconst validBreadcrumbSeparators = [\n 'arrow',\n 'bullet',\n 'dot',\n 'succeeds',\n] as const;\n/**\n * Valid separator values for the Breadcrumb component.\n */\nexport type BreadcrumbSeparator = (typeof validBreadcrumbSeparators)[number];\n\nconst validBreadcrumbSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Breadcrumb component.\n */\nexport type BreadcrumbSize = (typeof validBreadcrumbSizes)[number];\n\n/**\n * Props for the Breadcrumb component.\n */\nexport interface BreadcrumbProps\n extends\n Omit<React.HTMLAttributes<HTMLElement>, 'color'>,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Alignment of the breadcrumb (`is-centered`, `is-right`). */\n alignment?: BreadcrumbAlignment;\n /** Type of separator between breadcrumb items. */\n separator?: BreadcrumbSeparator;\n /** Breadcrumb size. */\n size?: BreadcrumbSize;\n /** Breadcrumb items (`<li>`s with `<a>` or `<span>`). */\n children?: React.ReactNode;\n}\n\n/**\n * The `Breadcrumb` component renders a Bulma-styled breadcrumb navigation.\n *\n * @function\n * @param {BreadcrumbProps} props - Props for the Breadcrumb component.\n * @returns {JSX.Element} The rendered breadcrumb element.\n * @see {@link https://bulma.io/documentation/components/breadcrumb/ | Bulma Breadcrumb documentation}\n */\nexport const Breadcrumb: React.FC<BreadcrumbProps> = ({\n className,\n alignment,\n separator,\n size,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('breadcrumb', {\n [`is-${alignment}`]:\n alignment && validBreadcrumbAlignments.includes(alignment),\n [`has-${separator}-separator`]:\n separator && validBreadcrumbSeparators.includes(separator),\n [`is-${size}`]: size && validBreadcrumbSizes.includes(size),\n });\n\n // Combine prefixed Bulma classes with unprefixed user className and prefixed helper classes\n const breadcrumbClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <nav className={breadcrumbClasses} aria-label=\"breadcrumbs\" {...rest}>\n <ul>{children}</ul>\n </nav>\n );\n};\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","sources":["../../../src/components/Breadcrumb.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\n\nconst validBreadcrumbAlignments = ['centered', 'right'] as const;\n/**\n * Valid alignment values for the Breadcrumb component.\n */\nexport type BreadcrumbAlignment = (typeof validBreadcrumbAlignments)[number];\n\nconst validBreadcrumbSeparators = [\n 'arrow',\n 'bullet',\n 'dot',\n 'succeeds',\n] as const;\n/**\n * Valid separator values for the Breadcrumb component.\n */\nexport type BreadcrumbSeparator = (typeof validBreadcrumbSeparators)[number];\n\nconst validBreadcrumbSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Breadcrumb component.\n */\nexport type BreadcrumbSize = (typeof validBreadcrumbSizes)[number];\n\n/**\n * Props for the Breadcrumb component.\n */\nexport interface BreadcrumbProps\n extends\n Omit<React.HTMLAttributes<HTMLElement>, 'color'>,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Alignment of the breadcrumb (`is-centered`, `is-right`). */\n alignment?: BreadcrumbAlignment;\n /** Type of separator between breadcrumb items. */\n separator?: BreadcrumbSeparator;\n /** Breadcrumb size. */\n size?: BreadcrumbSize;\n /** Breadcrumb items (`<li>`s with `<a>` or `<span>`). */\n children?: React.ReactNode;\n}\n\n/**\n * The `Breadcrumb` component renders a Bulma-styled breadcrumb navigation.\n *\n * @function\n * @param {BreadcrumbProps} props - Props for the Breadcrumb component.\n * @returns {JSX.Element} The rendered breadcrumb element.\n * @see {@link https://bulma.io/documentation/components/breadcrumb/ | Bulma Breadcrumb documentation}\n */\nexport const Breadcrumb: React.FC<BreadcrumbProps> = ({\n className,\n alignment,\n separator,\n size,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('breadcrumb', {\n [`is-${alignment}`]:\n alignment && validBreadcrumbAlignments.includes(alignment),\n [`has-${separator}-separator`]:\n separator && validBreadcrumbSeparators.includes(separator),\n [`is-${size}`]: size && validBreadcrumbSizes.includes(size),\n });\n\n // Combine prefixed Bulma classes with unprefixed user className and prefixed helper classes\n const breadcrumbClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <nav className={breadcrumbClasses} aria-label=\"breadcrumbs\" {...rest}>\n <ul>{children}</ul>\n </nav>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AAIA,MAAM,yBAAyB,GAAG,CAAC,UAAU,EAAE,OAAO,CAAU;AAMhE,MAAM,yBAAyB,GAAG;IAChC,OAAO;IACP,QAAQ;IACR,KAAK;IACL,UAAU;CACF;AAMV,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAyBlE;;;;;;;AAOG;MACU,UAAU,GAA8B,CAAC,EACpD,SAAS,EACT,SAAS,EACT,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;;AAGlE,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,YAAY,EAAE;AACvD,QAAA,CAAC,CAAA,GAAA,EAAM,SAAS,CAAA,CAAE,GAChB,SAAS,IAAI,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC5D,QAAA,CAAC,CAAA,IAAA,EAAO,SAAS,CAAA,UAAA,CAAY,GAC3B,SAAS,IAAI,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC5D,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC5D,KAAA,CAAC;;IAGF,MAAM,iBAAiB,GAAG,UAAU,CAClC,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;AAED,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,EAAA,YAAA,EAAa,aAAa,EAAA,GAAK,IAAI,YAClEA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAK,QAAQ,EAAA,CAAM,EAAA,CACf;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, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { classNames, usePrefixedClassNames, prefixedClassNames } from '../helpers/classNames.js';
|