@allxsmith/bestax-bulma 5.27.0 → 5.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/columns/Column.js +48 -0
- package/dist/esm/columns/Column.js.map +1 -0
- package/dist/esm/columns/Columns.js +53 -0
- package/dist/esm/columns/Columns.js.map +1 -0
- package/dist/esm/components/Avatar.js +299 -0
- package/dist/esm/components/Avatar.js.map +1 -0
- package/dist/esm/components/Avatars.js +81 -0
- package/dist/esm/components/Avatars.js.map +1 -0
- package/dist/esm/components/Badge.js +105 -0
- package/dist/esm/components/Badge.js.map +1 -0
- package/dist/esm/components/Breadcrumb.js +36 -0
- package/dist/esm/components/Breadcrumb.js.map +1 -0
- package/dist/esm/components/Card.js +252 -0
- package/dist/esm/components/Card.js.map +1 -0
- package/dist/esm/components/Carousel.js +351 -0
- package/dist/esm/components/Carousel.js.map +1 -0
- package/dist/esm/components/Collapse.js +193 -0
- package/dist/esm/components/Collapse.js.map +1 -0
- package/dist/esm/components/Collapses.js +99 -0
- package/dist/esm/components/Collapses.js.map +1 -0
- package/dist/esm/components/Dialog.js +230 -0
- package/dist/esm/components/Dialog.js.map +1 -0
- package/dist/esm/components/Dropdown.js +362 -0
- package/dist/esm/components/Dropdown.js.map +1 -0
- package/dist/esm/components/Loading.js +87 -0
- package/dist/esm/components/Loading.js.map +1 -0
- package/dist/esm/components/Menu.js +117 -0
- package/dist/esm/components/Menu.js.map +1 -0
- package/dist/esm/components/Message.js +56 -0
- package/dist/esm/components/Message.js.map +1 -0
- package/dist/esm/components/Modal.js +354 -0
- package/dist/esm/components/Modal.js.map +1 -0
- package/dist/esm/components/Navbar.js +287 -0
- package/dist/esm/components/Navbar.js.map +1 -0
- package/dist/esm/components/Pagination.js +191 -0
- package/dist/esm/components/Pagination.js.map +1 -0
- package/dist/esm/components/Panel.js +100 -0
- package/dist/esm/components/Panel.js.map +1 -0
- package/dist/esm/components/Popover.js +298 -0
- package/dist/esm/components/Popover.js.map +1 -0
- package/dist/esm/components/Reveal.js +157 -0
- package/dist/esm/components/Reveal.js.map +1 -0
- package/dist/esm/components/Sidebar.js +209 -0
- package/dist/esm/components/Sidebar.js.map +1 -0
- package/dist/esm/components/Steps.js +128 -0
- package/dist/esm/components/Steps.js.map +1 -0
- package/dist/esm/components/Tabs.js +335 -0
- package/dist/esm/components/Tabs.js.map +1 -0
- package/dist/esm/components/Toast.js +322 -0
- package/dist/esm/components/Toast.js.map +1 -0
- package/dist/esm/components/Tooltip.js +202 -0
- package/dist/esm/components/Tooltip.js.map +1 -0
- package/dist/esm/components/collapsesContext.js +12 -0
- package/dist/esm/components/collapsesContext.js.map +1 -0
- package/dist/esm/elements/Block.js +29 -0
- package/dist/esm/elements/Block.js.map +1 -0
- package/dist/esm/elements/Box.js +32 -0
- package/dist/esm/elements/Box.js.map +1 -0
- package/dist/esm/elements/Button.js +139 -0
- package/dist/esm/elements/Button.js.map +1 -0
- package/dist/esm/elements/Buttons.js +42 -0
- package/dist/esm/elements/Buttons.js.map +1 -0
- package/dist/esm/elements/Code.js +25 -0
- package/dist/esm/elements/Code.js.map +1 -0
- package/dist/esm/elements/Content.js +33 -0
- package/dist/esm/elements/Content.js.map +1 -0
- package/dist/esm/elements/Delete.js +35 -0
- package/dist/esm/elements/Delete.js.map +1 -0
- package/dist/esm/elements/Divider.js +27 -0
- package/dist/esm/elements/Divider.js.map +1 -0
- package/dist/esm/elements/Emphasis.js +25 -0
- package/dist/esm/elements/Emphasis.js.map +1 -0
- package/dist/esm/elements/Figure.js +58 -0
- package/dist/esm/elements/Figure.js.map +1 -0
- package/dist/esm/elements/Icon.js +256 -0
- package/dist/esm/elements/Icon.js.map +1 -0
- package/dist/esm/elements/IconText.js +36 -0
- package/dist/esm/elements/IconText.js.map +1 -0
- package/dist/esm/elements/Image.js +46 -0
- package/dist/esm/elements/Image.js.map +1 -0
- package/dist/esm/elements/Link.js +36 -0
- package/dist/esm/elements/Link.js.map +1 -0
- package/dist/esm/elements/LinkButton.js +37 -0
- package/dist/esm/elements/LinkButton.js.map +1 -0
- package/dist/esm/elements/ListItem.js +28 -0
- package/dist/esm/elements/ListItem.js.map +1 -0
- package/dist/esm/elements/Loader.js +37 -0
- package/dist/esm/elements/Loader.js.map +1 -0
- package/dist/esm/elements/Notification.js +316 -0
- package/dist/esm/elements/Notification.js.map +1 -0
- package/dist/esm/elements/OrderedList.js +31 -0
- package/dist/esm/elements/OrderedList.js.map +1 -0
- package/dist/esm/elements/Paragraph.js +28 -0
- package/dist/esm/elements/Paragraph.js.map +1 -0
- package/dist/esm/elements/Pre.js +25 -0
- package/dist/esm/elements/Pre.js.map +1 -0
- package/dist/esm/elements/Progress.js +33 -0
- package/dist/esm/elements/Progress.js.map +1 -0
- package/dist/esm/elements/Skeleton.js +30 -0
- package/dist/esm/elements/Skeleton.js.map +1 -0
- package/dist/esm/elements/Span.js +28 -0
- package/dist/esm/elements/Span.js.map +1 -0
- package/dist/esm/elements/Strong.js +25 -0
- package/dist/esm/elements/Strong.js.map +1 -0
- package/dist/esm/elements/SubTitle.js +51 -0
- package/dist/esm/elements/SubTitle.js.map +1 -0
- package/dist/esm/elements/Table.js +51 -0
- package/dist/esm/elements/Table.js.map +1 -0
- package/dist/esm/elements/Tag.js +49 -0
- package/dist/esm/elements/Tag.js.map +1 -0
- package/dist/esm/elements/Tags.js +34 -0
- package/dist/esm/elements/Tags.js.map +1 -0
- package/dist/esm/elements/Tbody.js +26 -0
- package/dist/esm/elements/Tbody.js.map +1 -0
- package/dist/esm/elements/Td.js +61 -0
- package/dist/esm/elements/Td.js.map +1 -0
- package/dist/esm/elements/Tfoot.js +26 -0
- package/dist/esm/elements/Tfoot.js.map +1 -0
- package/dist/esm/elements/Th.js +34 -0
- package/dist/esm/elements/Th.js.map +1 -0
- package/dist/esm/elements/Thead.js +26 -0
- package/dist/esm/elements/Thead.js.map +1 -0
- package/dist/esm/elements/Title.js +44 -0
- package/dist/esm/elements/Title.js.map +1 -0
- package/dist/esm/elements/Tr.js +31 -0
- package/dist/esm/elements/Tr.js.map +1 -0
- package/dist/esm/elements/UnorderedList.js +31 -0
- package/dist/esm/elements/UnorderedList.js.map +1 -0
- package/dist/esm/elements/iconProps.js +49 -0
- package/dist/esm/elements/iconProps.js.map +1 -0
- package/dist/esm/form/Autocomplete.js +279 -0
- package/dist/esm/form/Autocomplete.js.map +1 -0
- package/dist/esm/form/Checkbox.js +111 -0
- package/dist/esm/form/Checkbox.js.map +1 -0
- package/dist/esm/form/Checkboxes.js +90 -0
- package/dist/esm/form/Checkboxes.js.map +1 -0
- package/dist/esm/form/Control.js +79 -0
- package/dist/esm/form/Control.js.map +1 -0
- package/dist/esm/form/DateInput.js +88 -0
- package/dist/esm/form/DateInput.js.map +1 -0
- package/dist/esm/form/DateInputBase.js +263 -0
- package/dist/esm/form/DateInputBase.js.map +1 -0
- package/dist/esm/form/DateRangeInput.js +77 -0
- package/dist/esm/form/DateRangeInput.js.map +1 -0
- package/dist/esm/form/DateRangeInputBase.js +301 -0
- package/dist/esm/form/DateRangeInputBase.js.map +1 -0
- package/dist/esm/form/DateTimeInput.js +88 -0
- package/dist/esm/form/DateTimeInput.js.map +1 -0
- package/dist/esm/form/DateTimeInputBase.js +333 -0
- package/dist/esm/form/DateTimeInputBase.js.map +1 -0
- package/dist/esm/form/Field.js +167 -0
- package/dist/esm/form/Field.js.map +1 -0
- package/dist/esm/form/File.js +112 -0
- package/dist/esm/form/File.js.map +1 -0
- package/dist/esm/form/FormContext.js +194 -0
- package/dist/esm/form/FormContext.js.map +1 -0
- package/dist/esm/form/Input.js +88 -0
- package/dist/esm/form/Input.js.map +1 -0
- package/dist/esm/form/InputBase.js +40 -0
- package/dist/esm/form/InputBase.js.map +1 -0
- package/dist/esm/form/Numberinput.js +201 -0
- package/dist/esm/form/Numberinput.js.map +1 -0
- package/dist/esm/form/Radio.js +108 -0
- package/dist/esm/form/Radio.js.map +1 -0
- package/dist/esm/form/Radios.js +92 -0
- package/dist/esm/form/Radios.js.map +1 -0
- package/dist/esm/form/Rate.js +280 -0
- package/dist/esm/form/Rate.js.map +1 -0
- package/dist/esm/form/Select.js +81 -0
- package/dist/esm/form/Select.js.map +1 -0
- package/dist/esm/form/SelectBase.js +54 -0
- package/dist/esm/form/SelectBase.js.map +1 -0
- package/dist/esm/form/Slider.js +461 -0
- package/dist/esm/form/Slider.js.map +1 -0
- package/dist/esm/form/Switch.js +96 -0
- package/dist/esm/form/Switch.js.map +1 -0
- package/dist/esm/form/Taginput.js +351 -0
- package/dist/esm/form/Taginput.js.map +1 -0
- package/dist/esm/form/TextArea.js +77 -0
- package/dist/esm/form/TextArea.js.map +1 -0
- package/dist/esm/form/TextAreaBase.js +45 -0
- package/dist/esm/form/TextAreaBase.js.map +1 -0
- package/dist/esm/form/TimeInput.js +84 -0
- package/dist/esm/form/TimeInput.js.map +1 -0
- package/dist/esm/form/TimeInputBase.js +246 -0
- package/dist/esm/form/TimeInputBase.js.map +1 -0
- package/dist/esm/form/_pickerInternals/Calendar.js +760 -0
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -0
- package/dist/esm/form/_pickerInternals/PickerPopover.js +95 -0
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -0
- package/dist/esm/form/_pickerInternals/TimeWheels.js +721 -0
- package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -0
- package/dist/esm/form/_pickerInternals/audioTick.js +109 -0
- package/dist/esm/form/_pickerInternals/audioTick.js.map +1 -0
- package/dist/esm/form/_pickerInternals/dateUtils.js +267 -0
- package/dist/esm/form/_pickerInternals/dateUtils.js.map +1 -0
- package/dist/esm/form/_pickerInternals/formatters.js +322 -0
- package/dist/esm/form/_pickerInternals/formatters.js.map +1 -0
- package/dist/esm/form/_pickerInternals/haptics.js +38 -0
- package/dist/esm/form/_pickerInternals/haptics.js.map +1 -0
- package/dist/esm/form/_pickerInternals/nativeInputSupport.js +25 -0
- package/dist/esm/form/_pickerInternals/nativeInputSupport.js.map +1 -0
- package/dist/esm/form/_pickerInternals/pickerTypes.js +50 -0
- package/dist/esm/form/_pickerInternals/pickerTypes.js.map +1 -0
- package/dist/esm/form/_pickerInternals/segmentMap.js +315 -0
- package/dist/esm/form/_pickerInternals/segmentMap.js.map +1 -0
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +49 -0
- package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -0
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +427 -0
- package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -0
- package/dist/esm/form/controlLoading.js +18 -0
- package/dist/esm/form/controlLoading.js.map +1 -0
- package/dist/esm/form/useAutoLabelId.js +88 -0
- package/dist/esm/form/useAutoLabelId.js.map +1 -0
- package/dist/esm/grid/Cell.js +35 -0
- package/dist/esm/grid/Cell.js.map +1 -0
- package/dist/esm/grid/Grid.js +51 -0
- package/dist/esm/grid/Grid.js.map +1 -0
- package/dist/esm/helpers/ClientOnly.js +33 -0
- package/dist/esm/helpers/ClientOnly.js.map +1 -0
- package/dist/esm/helpers/Config.js +60 -0
- package/dist/esm/helpers/Config.js.map +1 -0
- package/dist/esm/helpers/Theme.js +947 -0
- package/dist/esm/helpers/Theme.js.map +1 -0
- package/dist/esm/helpers/anchorAttrs.js +72 -0
- package/dist/esm/helpers/anchorAttrs.js.map +1 -0
- package/dist/esm/helpers/bulmaClassHelpers.js +415 -0
- package/dist/esm/helpers/bulmaClassHelpers.js.map +1 -0
- package/dist/esm/helpers/buttonType.js +24 -0
- package/dist/esm/helpers/buttonType.js.map +1 -0
- package/dist/esm/helpers/classNames.js +137 -0
- package/dist/esm/helpers/classNames.js.map +1 -0
- package/dist/esm/helpers/colorDeprecations.js +50 -0
- package/dist/esm/helpers/colorDeprecations.js.map +1 -0
- package/dist/esm/helpers/devWarnings.js +27 -0
- package/dist/esm/helpers/devWarnings.js.map +1 -0
- package/dist/esm/helpers/inertProps.js +27 -0
- package/dist/esm/helpers/inertProps.js.map +1 -0
- package/dist/esm/helpers/mergeBulmaStyles.js +20 -0
- package/dist/esm/helpers/mergeBulmaStyles.js.map +1 -0
- package/dist/esm/helpers/polymorphic.js +18 -0
- package/dist/esm/helpers/polymorphic.js.map +1 -0
- package/dist/esm/helpers/portal.js +76 -0
- package/dist/esm/helpers/portal.js.map +1 -0
- package/dist/esm/helpers/positionStacks.js +45 -0
- package/dist/esm/helpers/positionStacks.js.map +1 -0
- package/dist/esm/helpers/scrollLock.js +38 -0
- package/dist/esm/helpers/scrollLock.js.map +1 -0
- package/dist/esm/helpers/shadowDom.js +71 -0
- package/dist/esm/helpers/shadowDom.js.map +1 -0
- package/dist/esm/helpers/statusRegion.js +282 -0
- package/dist/esm/helpers/statusRegion.js.map +1 -0
- package/dist/esm/helpers/useAnchoredPosition.js +86 -0
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -0
- package/dist/esm/helpers/useBulmaClasses.js +158 -0
- package/dist/esm/helpers/useBulmaClasses.js.map +1 -0
- package/dist/esm/helpers/useClientLayoutEffect.js +13 -0
- package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -0
- package/dist/esm/helpers/useColorClasses.js +84 -0
- package/dist/esm/helpers/useColorClasses.js.map +1 -0
- package/dist/esm/helpers/useFlexboxClasses.js +92 -0
- package/dist/esm/helpers/useFlexboxClasses.js.map +1 -0
- package/dist/esm/helpers/useFocusTrap.js +470 -0
- package/dist/esm/helpers/useFocusTrap.js.map +1 -0
- package/dist/esm/helpers/useIsHydrated.js +31 -0
- package/dist/esm/helpers/useIsHydrated.js.map +1 -0
- package/dist/esm/helpers/useOtherClasses.js +115 -0
- package/dist/esm/helpers/useOtherClasses.js.map +1 -0
- package/dist/esm/helpers/useSpacingClasses.js +82 -0
- package/dist/esm/helpers/useSpacingClasses.js.map +1 -0
- package/dist/esm/helpers/useTypographyClasses.js +93 -0
- package/dist/esm/helpers/useTypographyClasses.js.map +1 -0
- package/dist/esm/helpers/useVisibilityClasses.js +134 -0
- package/dist/esm/helpers/useVisibilityClasses.js.map +1 -0
- package/dist/esm/helpers/withSubComponents.js +24 -0
- package/dist/esm/helpers/withSubComponents.js.map +1 -0
- package/dist/esm/layout/Container.js +48 -0
- package/dist/esm/layout/Container.js.map +1 -0
- package/dist/esm/layout/Footer.js +33 -0
- package/dist/esm/layout/Footer.js.map +1 -0
- package/dist/esm/layout/Hero.js +90 -0
- package/dist/esm/layout/Hero.js.map +1 -0
- package/dist/esm/layout/Level.js +110 -0
- package/dist/esm/layout/Level.js.map +1 -0
- package/dist/esm/layout/Media.js +86 -0
- package/dist/esm/layout/Media.js.map +1 -0
- package/dist/esm/layout/Section.js +30 -0
- package/dist/esm/layout/Section.js.map +1 -0
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +187 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +115 -17516
- package/dist/index.esm.js.map +1 -1
- package/dist/types/elements/Icon.d.ts +10 -7
- package/dist/types/form/Autocomplete.d.ts +1 -1
- package/dist/types/form/Checkboxes.d.ts +1 -1
- package/dist/types/form/DateInput.d.ts +1 -1
- package/dist/types/form/DateInputBase.d.ts +3 -4
- package/dist/types/form/DateRangeInput.d.ts +1 -1
- package/dist/types/form/DateTimeInput.d.ts +1 -1
- package/dist/types/form/DateTimeInputBase.d.ts +3 -4
- package/dist/types/form/Field.d.ts +2 -2
- package/dist/types/form/File.d.ts +4 -4
- package/dist/types/form/FormContext.d.ts +24 -2
- package/dist/types/form/Numberinput.d.ts +1 -1
- package/dist/types/form/Radios.d.ts +1 -1
- package/dist/types/form/Rate.d.ts +1 -1
- package/dist/types/form/Slider.d.ts +1 -1
- package/dist/types/form/Taginput.d.ts +1 -1
- package/dist/types/form/TimeInput.d.ts +1 -1
- package/dist/types/form/useAutoLabelId.d.ts +25 -4
- package/dist/types/helpers/Config.d.ts +3 -4
- package/dist/types/helpers/Theme.d.ts +44 -40
- package/dist/types-cjs/elements/Icon.d.ts +10 -7
- package/dist/types-cjs/form/Autocomplete.d.ts +1 -1
- package/dist/types-cjs/form/Checkboxes.d.ts +1 -1
- package/dist/types-cjs/form/DateInput.d.ts +1 -1
- package/dist/types-cjs/form/DateInputBase.d.ts +3 -4
- package/dist/types-cjs/form/DateRangeInput.d.ts +1 -1
- package/dist/types-cjs/form/DateTimeInput.d.ts +1 -1
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +3 -4
- package/dist/types-cjs/form/Field.d.ts +2 -2
- package/dist/types-cjs/form/File.d.ts +4 -4
- package/dist/types-cjs/form/FormContext.d.ts +24 -2
- package/dist/types-cjs/form/Numberinput.d.ts +1 -1
- package/dist/types-cjs/form/Radios.d.ts +1 -1
- package/dist/types-cjs/form/Rate.d.ts +1 -1
- package/dist/types-cjs/form/Slider.d.ts +1 -1
- package/dist/types-cjs/form/Taginput.d.ts +1 -1
- package/dist/types-cjs/form/TimeInput.d.ts +1 -1
- package/dist/types-cjs/form/useAutoLabelId.d.ts +25 -4
- package/dist/types-cjs/helpers/Config.d.ts +3 -4
- package/dist/types-cjs/helpers/Theme.d.ts +44 -40
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/form/_dateinput.scss +37 -6
- package/src/scss/form/_datetimeinput.scss +7 -2
- package/src/scss/form/_picker-popover.scss +1 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `Block` component renders a simple container with Bulma's `.block` class, adding vertical margin between sections of content.
|
|
8
|
+
*
|
|
9
|
+
* @function
|
|
10
|
+
* @param {BlockProps} props - Props for the Block component.
|
|
11
|
+
* @returns {JSX.Element} The rendered block element.
|
|
12
|
+
* @see {@link https://bulma.io/documentation/elements/block/ | Bulma Block documentation}
|
|
13
|
+
*/
|
|
14
|
+
const Block = ({ className, textColor, color, bgColor, children, ...props }) => {
|
|
15
|
+
/**
|
|
16
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
17
|
+
*/
|
|
18
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
19
|
+
color: textColor ?? color,
|
|
20
|
+
backgroundColor: bgColor,
|
|
21
|
+
...props,
|
|
22
|
+
});
|
|
23
|
+
const bulmaClasses = usePrefixedClassNames('block');
|
|
24
|
+
const blockClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
25
|
+
return (jsx("div", { className: blockClasses, ...rest, children: children }));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { Block };
|
|
29
|
+
//# sourceMappingURL=Block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Block.js","sources":["../../../src/elements/Block.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Block component.\n */\nexport interface BlockProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.block.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the block. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Block` component renders a simple container with Bulma's `.block` class, adding vertical margin between sections of content.\n *\n * @function\n * @param {BlockProps} props - Props for the Block component.\n * @returns {JSX.Element} The rendered block element.\n * @see {@link https://bulma.io/documentation/elements/block/ | Bulma Block documentation}\n */\nexport const Block: React.FC<BlockProps> = ({\n className,\n textColor,\n color,\n bgColor,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('block');\n const blockClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <div className={blockClasses} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;AAgCA;;;;;;;AAOG;MACU,KAAK,GAAyB,CAAC,EAC1C,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC;IACnD,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;IAE5E,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,YAAY,EAAA,GAAM,IAAI,EAAA,QAAA,EACnC,QAAQ,EAAA,CACL;AAEV;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
import { mergeBulmaStyles } from '../helpers/mergeBulmaStyles.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `Box` component renders a bordered, padded container with an optional shadow using Bulma's `.box` class.
|
|
9
|
+
*
|
|
10
|
+
* @function
|
|
11
|
+
* @param {BoxProps} props - Props for the Box component.
|
|
12
|
+
* @returns {JSX.Element} The rendered box element.
|
|
13
|
+
* @see {@link https://bulma.io/documentation/elements/box/ | Bulma Box documentation}
|
|
14
|
+
*/
|
|
15
|
+
const Box = ({ className, textColor, color, bgColor, hasShadow = true, children, style, ...props }) => {
|
|
16
|
+
/**
|
|
17
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
18
|
+
*/
|
|
19
|
+
const { bulmaHelperClasses, bulmaHelperStyles, rest } = useBulmaClasses({
|
|
20
|
+
color: textColor ?? color,
|
|
21
|
+
backgroundColor: bgColor,
|
|
22
|
+
...props,
|
|
23
|
+
});
|
|
24
|
+
const bulmaClasses = usePrefixedClassNames('box', {
|
|
25
|
+
'is-shadowless': !hasShadow,
|
|
26
|
+
});
|
|
27
|
+
const boxClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
28
|
+
return (jsx("div", { className: boxClasses, style: mergeBulmaStyles(bulmaHelperStyles, style), ...rest, children: children }));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { Box };
|
|
32
|
+
//# sourceMappingURL=Box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.js","sources":["../../../src/elements/Box.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n validSchemeColors,\n} from '../helpers/useBulmaClasses';\nimport { mergeBulmaStyles } from '../helpers/mergeBulmaStyles';\n\n/**\n * Props for the Box component.\n */\nexport interface BoxProps\n /** @ignore */\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled box variant (no `.box.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /**\n * Background color helper. `scheme-*` values render as a dark-mode-safe\n * inline `background-color: var(--bulma-scheme-*)` instead of a class. The\n * `scheme-invert*` values do not change text color — pair them with a\n * contrasting foreground.\n */\n bgColor?:\n | (typeof validColors)[number]\n | (typeof validSchemeColors)[number]\n | 'inherit'\n | 'current';\n /** Whether the box has a shadow (default: true). */\n hasShadow?: boolean;\n /** Content to render inside the box. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Box` component renders a bordered, padded container with an optional shadow using Bulma's `.box` class.\n *\n * @function\n * @param {BoxProps} props - Props for the Box component.\n * @returns {JSX.Element} The rendered box element.\n * @see {@link https://bulma.io/documentation/elements/box/ | Bulma Box documentation}\n */\nexport const Box: React.FC<BoxProps> = ({\n className,\n textColor,\n color,\n bgColor,\n hasShadow = true,\n children,\n style,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, bulmaHelperStyles, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('box', {\n 'is-shadowless': !hasShadow,\n });\n\n const boxClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <div\n className={boxClasses}\n style={mergeBulmaStyles(bulmaHelperStyles, style)}\n {...rest}\n >\n {children}\n </div>\n );\n};\n\nexport default Box;\n"],"names":["_jsx"],"mappings":";;;;;;AA8CA;;;;;;;AAOG;AACI,MAAM,GAAG,GAAuB,CAAC,EACtC,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,GAAG,IAAI,EAChB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;IACH,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACtE,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,EAAE;QAChD,eAAe,EAAE,CAAC,SAAS;AAC5B,KAAA,CAAC;IAEF,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;IAE1E,QACEA,aACE,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,CAAC,EAAA,GAC7C,IAAI,YAEP,QAAQ,EAAA,CACL;AAEV;;"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
5
|
+
import { isCustomElement } from '../helpers/polymorphic.js';
|
|
6
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
7
|
+
import { validColors } from '../helpers/bulmaClassHelpers.js';
|
|
8
|
+
|
|
9
|
+
const validButtonColors = [...validColors, 'text', 'ghost'];
|
|
10
|
+
/**
|
|
11
|
+
* The `Button` component provides a flexible and highly customizable button for your Bulma React UI.
|
|
12
|
+
*
|
|
13
|
+
* @function
|
|
14
|
+
* @param {ButtonProps} props - Props for the Button component.
|
|
15
|
+
* @param {React.Ref} ref - Forwarded ref to the element `as` renders.
|
|
16
|
+
* @returns {JSX.Element} The rendered button, anchor, or custom element.
|
|
17
|
+
* @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}
|
|
18
|
+
*/
|
|
19
|
+
const Button = forwardRef(function Button(props, ref) {
|
|
20
|
+
const { color, size, isLight, isRounded, isLoading, isStatic, isFullwidth, isFullWidth, isOutlined, isInverted, isFocused, isActive, isHovered, isDisabled, className, children, textColor, bgColor, as: Component = 'button', href, onClick, target, rel, ...bulmaProps } = props;
|
|
21
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
22
|
+
color: textColor,
|
|
23
|
+
backgroundColor: bgColor,
|
|
24
|
+
...bulmaProps,
|
|
25
|
+
});
|
|
26
|
+
// Generate Bulma classes with prefix
|
|
27
|
+
const bulmaClasses = usePrefixedClassNames('button', {
|
|
28
|
+
[`is-${color}`]: color &&
|
|
29
|
+
validButtonColors.includes(color),
|
|
30
|
+
[`is-${size}`]: size,
|
|
31
|
+
'is-outlined': isOutlined,
|
|
32
|
+
'is-light': isLight,
|
|
33
|
+
'is-loading': isLoading,
|
|
34
|
+
'is-static': isStatic,
|
|
35
|
+
'is-disabled': isDisabled,
|
|
36
|
+
'is-rounded': isRounded,
|
|
37
|
+
'is-hovered': isHovered,
|
|
38
|
+
'is-focused': isFocused,
|
|
39
|
+
'is-active': isActive,
|
|
40
|
+
'is-inverted': isInverted,
|
|
41
|
+
'is-fullwidth': isFullwidth ?? isFullWidth,
|
|
42
|
+
});
|
|
43
|
+
// Combine prefixed Bulma classes with unprefixed user className and prefixed helper classes
|
|
44
|
+
const buttonClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
45
|
+
if (Component !== 'button') {
|
|
46
|
+
// Strip the form-control attributes a link-like element cannot carry, so a
|
|
47
|
+
// JavaScript consumer or a spread object doesn't put them on the DOM. The
|
|
48
|
+
// types no longer allow them through; this is the runtime backstop.
|
|
49
|
+
//
|
|
50
|
+
// Only for INTRINSIC tags. A custom component (a router Link, ...) owns its
|
|
51
|
+
// prop contract, and `ComponentPropsWithoutRef<T>` promises the caller that
|
|
52
|
+
// its props reach it. Stripping names by their spelling alone broke that
|
|
53
|
+
// promise silently: `<Button as={Custom} name="x" />` type-checked while
|
|
54
|
+
// `Custom` never received the `name` it requires.
|
|
55
|
+
//
|
|
56
|
+
// `autoFocus` and `type` are deliberately NOT stripped: both are valid on
|
|
57
|
+
// targets this list was filtering them from. `autoFocus` is a global
|
|
58
|
+
// attribute (React decides per element whether to honour it, which is not
|
|
59
|
+
// ours to pre-empt), and `type` on an anchor is the MIME hint that
|
|
60
|
+
// `ButtonProps<'a'>` now types it as.
|
|
61
|
+
//
|
|
62
|
+
// The types already answer this for a TypeScript caller: `ButtonProps<T>`
|
|
63
|
+
// derives from `ComponentPropsWithoutRef<T>`, so only what the target
|
|
64
|
+
// accepts can be passed. What is left is a runtime backstop for JavaScript
|
|
65
|
+
// consumers and spread objects.
|
|
66
|
+
//
|
|
67
|
+
// Keep it to the two cases where a stray attribute does something. The
|
|
68
|
+
// submit-overrides belong to a submit control and never make sense on the
|
|
69
|
+
// anchor path. `disabled` is the one that is VISIBLE: Bulma styles
|
|
70
|
+
// `.button[disabled]` (background, border, shadow, opacity), so letting it
|
|
71
|
+
// through to a `<span>` greys the element out — main stripped it, and not
|
|
72
|
+
// stripping it would be a silent visual change on a types-only release.
|
|
73
|
+
//
|
|
74
|
+
// Everything else (`name`, `value`, `form`) is inert where it does not
|
|
75
|
+
// belong, and enumerating which tags own it is what kept going wrong:
|
|
76
|
+
// first all nine names on every non-button tag (so `<Button as="input"
|
|
77
|
+
// name="query" value="Search">` submitted nothing), then a form-control
|
|
78
|
+
// allowlist that still lost `formAction` on an input and `value` on an
|
|
79
|
+
// option. Those now ride on the types instead.
|
|
80
|
+
//
|
|
81
|
+
// A custom component is exempt entirely — it owns its prop contract, and
|
|
82
|
+
// `ComponentPropsWithoutRef<T>` promises the caller its props arrive.
|
|
83
|
+
//
|
|
84
|
+
// The elements that own `disabled`, per the HTML spec. A closed set, unlike
|
|
85
|
+
// the open-ended question of which tag owns which attribute.
|
|
86
|
+
const SUBMIT_OVERRIDES = [
|
|
87
|
+
'formAction',
|
|
88
|
+
'formEncType',
|
|
89
|
+
'formMethod',
|
|
90
|
+
'formNoValidate',
|
|
91
|
+
'formTarget',
|
|
92
|
+
];
|
|
93
|
+
const OWNS_DISABLED = [
|
|
94
|
+
'button',
|
|
95
|
+
'fieldset',
|
|
96
|
+
'input',
|
|
97
|
+
'optgroup',
|
|
98
|
+
'option',
|
|
99
|
+
'select',
|
|
100
|
+
'textarea',
|
|
101
|
+
];
|
|
102
|
+
// Two independent filters. They are not exclusive — an `<a>` owns neither
|
|
103
|
+
// the submit-overrides nor `disabled`, so it takes both — and deriving them
|
|
104
|
+
// from one destructure, or from one if/else, is what broke each of them in
|
|
105
|
+
// turn: first the overrides came off every intrinsic (an `as="input"` lost
|
|
106
|
+
// `formAction`), then scoping them to the anchor let `disabled` back onto
|
|
107
|
+
// it.
|
|
108
|
+
const forwardedRest = { ...rest };
|
|
109
|
+
if (typeof Component === 'string' && !isCustomElement(Component)) {
|
|
110
|
+
// Meaningless anywhere but a submit control, and an anchor is not one.
|
|
111
|
+
if (Component === 'a') {
|
|
112
|
+
for (const key of SUBMIT_OVERRIDES)
|
|
113
|
+
delete forwardedRest[key];
|
|
114
|
+
}
|
|
115
|
+
// Visible via Bulma's `.button[disabled]`, so withheld from any element
|
|
116
|
+
// that does not own it.
|
|
117
|
+
if (!OWNS_DISABLED.includes(Component))
|
|
118
|
+
delete forwardedRest.disabled;
|
|
119
|
+
}
|
|
120
|
+
return (jsx(Component, { ref: ref, className: buttonClasses, href: href, target: target, rel: rel, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : undefined, onClick: isDisabled
|
|
121
|
+
? // Guarded, because this handler is installed into whatever `as`
|
|
122
|
+
// renders and a custom component's `onClick` need not be a DOM
|
|
123
|
+
// event handler at all. One declaring `onClick: (v: string) =>
|
|
124
|
+
// void` calls this with a string, and an unguarded
|
|
125
|
+
// `e.preventDefault()` throws `is not a function`. Blocking the
|
|
126
|
+
// real event is the point; a foreign payload is simply not ours
|
|
127
|
+
// to act on.
|
|
128
|
+
(e) => {
|
|
129
|
+
if (typeof e?.preventDefault === 'function')
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
}
|
|
132
|
+
: onClick, ...forwardedRest, children: children }));
|
|
133
|
+
}
|
|
134
|
+
return (jsx("button", { ref: ref, className: buttonClasses, disabled: isDisabled, onClick: onClick, ...rest, children: children }));
|
|
135
|
+
});
|
|
136
|
+
Button.displayName = 'Button';
|
|
137
|
+
|
|
138
|
+
export { Button };
|
|
139
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/elements/Button.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n isCustomElement,\n type PolymorphicComponent,\n} from '../helpers/polymorphic';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * The Button component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface ButtonOwnProps extends Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor' | 'size'\n> {\n /**\n * Not accepted under this name. `useBulmaClasses` consumes any\n * `backgroundColor` key before `rest` is spread, so a custom `as` target\n * declaring one would never receive it. Use `bgColor`.\n * @internal\n */\n backgroundColor?: never;\n /** Bulma color variant for the button. `ghost` renders a link-like button; `text` renders a minimal text-only button. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'white'\n | 'light'\n | 'dark'\n | 'black'\n | 'text'\n | 'ghost';\n /** Size of the button. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Applies a lighter color variant. */\n isLight?: boolean;\n /** Makes the button rounded. */\n isRounded?: boolean;\n /**\n * Displays a loading spinner.\n * Under `prefers-reduced-motion: reduce` the spinner stops and stays\n * drawn (with bestax's CSS loaded).\n */\n isLoading?: boolean;\n /** Makes the button non-interactive. */\n isStatic?: boolean;\n /** Makes the button full-width. */\n isFullwidth?: boolean;\n /** Makes the button full-width. @deprecated Use `isFullwidth` instead — `isFullwidth` wins if both are set. */\n isFullWidth?: boolean;\n /** Applies outlined styling (requires color). */\n isOutlined?: boolean;\n /** Applies inverted styling (requires color). */\n isInverted?: boolean;\n /** Applies focused styling (visual only). */\n isFocused?: boolean;\n /** Applies active styling (visual only). */\n isActive?: boolean;\n /** Applies hovered styling (visual only). */\n isHovered?: boolean;\n /** Applies disabled styling. */\n isDisabled?: boolean;\n /** Custom class name. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the Button component. The DOM attributes and the `ref` both follow\n * `as`: with `as=\"a\"` the anchor attributes are accepted, with `as=\"div\"` they\n * are not.\n *\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.\n */\nexport type ButtonProps<T extends React.ElementType = 'button'> =\n ButtonOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof ButtonOwnProps | 'as'> & {\n /** Render as a `<button>`, `<a>`, or a custom component (e.g. a router `Link`). Defaults to `'button'`; anything else renders through the anchor path, which adds `href`/`target`/`rel` and withholds the submit-override attributes (`formAction` and friends) from an `<a>`. */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `ButtonProps<T>` above — the body cannot see through `T`, so it reads the\n * widest form of the props it actually touches.\n */\ntype ButtonImplProps = ButtonOwnProps & {\n as?: React.ElementType;\n href?: string;\n target?: string;\n rel?: string;\n onClick?:\n | React.MouseEventHandler<HTMLButtonElement>\n | React.MouseEventHandler<HTMLAnchorElement>;\n};\n\nconst validButtonColors = [...validColors, 'text', 'ghost'] as const;\n\n/**\n * The `Button` component provides a flexible and highly customizable button for your Bulma React UI.\n *\n * @function\n * @param {ButtonProps} props - Props for the Button component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered button, anchor, or custom element.\n * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}\n */\n\nexport const Button = forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const {\n color,\n size,\n isLight,\n isRounded,\n isLoading,\n isStatic,\n isFullwidth,\n isFullWidth,\n isOutlined,\n isInverted,\n isFocused,\n isActive,\n isHovered,\n isDisabled,\n className,\n children,\n textColor,\n bgColor,\n as: Component = 'button',\n href,\n onClick,\n target,\n rel,\n ...bulmaProps\n } = props as ButtonImplProps;\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...bulmaProps,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('button', {\n [`is-${color}`]:\n color &&\n validButtonColors.includes(color as (typeof validButtonColors)[number]),\n [`is-${size}`]: size,\n 'is-outlined': isOutlined,\n 'is-light': isLight,\n 'is-loading': isLoading,\n 'is-static': isStatic,\n 'is-disabled': isDisabled,\n 'is-rounded': isRounded,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'is-active': isActive,\n 'is-inverted': isInverted,\n 'is-fullwidth': isFullwidth ?? isFullWidth,\n });\n\n // Combine prefixed Bulma classes with unprefixed user className and prefixed helper classes\n const buttonClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n if (Component !== 'button') {\n // Strip the form-control attributes a link-like element cannot carry, so a\n // JavaScript consumer or a spread object doesn't put them on the DOM. The\n // types no longer allow them through; this is the runtime backstop.\n //\n // Only for INTRINSIC tags. A custom component (a router Link, ...) owns its\n // prop contract, and `ComponentPropsWithoutRef<T>` promises the caller that\n // its props reach it. Stripping names by their spelling alone broke that\n // promise silently: `<Button as={Custom} name=\"x\" />` type-checked while\n // `Custom` never received the `name` it requires.\n //\n // `autoFocus` and `type` are deliberately NOT stripped: both are valid on\n // targets this list was filtering them from. `autoFocus` is a global\n // attribute (React decides per element whether to honour it, which is not\n // ours to pre-empt), and `type` on an anchor is the MIME hint that\n // `ButtonProps<'a'>` now types it as.\n //\n // The types already answer this for a TypeScript caller: `ButtonProps<T>`\n // derives from `ComponentPropsWithoutRef<T>`, so only what the target\n // accepts can be passed. What is left is a runtime backstop for JavaScript\n // consumers and spread objects.\n //\n // Keep it to the two cases where a stray attribute does something. The\n // submit-overrides belong to a submit control and never make sense on the\n // anchor path. `disabled` is the one that is VISIBLE: Bulma styles\n // `.button[disabled]` (background, border, shadow, opacity), so letting it\n // through to a `<span>` greys the element out — main stripped it, and not\n // stripping it would be a silent visual change on a types-only release.\n //\n // Everything else (`name`, `value`, `form`) is inert where it does not\n // belong, and enumerating which tags own it is what kept going wrong:\n // first all nine names on every non-button tag (so `<Button as=\"input\"\n // name=\"query\" value=\"Search\">` submitted nothing), then a form-control\n // allowlist that still lost `formAction` on an input and `value` on an\n // option. Those now ride on the types instead.\n //\n // A custom component is exempt entirely — it owns its prop contract, and\n // `ComponentPropsWithoutRef<T>` promises the caller its props arrive.\n //\n // The elements that own `disabled`, per the HTML spec. A closed set, unlike\n // the open-ended question of which tag owns which attribute.\n const SUBMIT_OVERRIDES = [\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n ];\n const OWNS_DISABLED = [\n 'button',\n 'fieldset',\n 'input',\n 'optgroup',\n 'option',\n 'select',\n 'textarea',\n ];\n\n // Two independent filters. They are not exclusive — an `<a>` owns neither\n // the submit-overrides nor `disabled`, so it takes both — and deriving them\n // from one destructure, or from one if/else, is what broke each of them in\n // turn: first the overrides came off every intrinsic (an `as=\"input\"` lost\n // `formAction`), then scoping them to the anchor let `disabled` back onto\n // it.\n const forwardedRest: Record<string, unknown> = { ...rest };\n if (typeof Component === 'string' && !isCustomElement(Component)) {\n // Meaningless anywhere but a submit control, and an anchor is not one.\n if (Component === 'a') {\n for (const key of SUBMIT_OVERRIDES) delete forwardedRest[key];\n }\n // Visible via Bulma's `.button[disabled]`, so withheld from any element\n // that does not own it.\n if (!OWNS_DISABLED.includes(Component)) delete forwardedRest.disabled;\n }\n\n return (\n <Component\n ref={ref as React.Ref<HTMLAnchorElement>}\n className={buttonClasses}\n href={href}\n target={target}\n rel={rel}\n aria-disabled={isDisabled}\n tabIndex={isDisabled ? -1 : undefined}\n onClick={\n isDisabled\n ? // Guarded, because this handler is installed into whatever `as`\n // renders and a custom component's `onClick` need not be a DOM\n // event handler at all. One declaring `onClick: (v: string) =>\n // void` calls this with a string, and an unguarded\n // `e.preventDefault()` throws `is not a function`. Blocking the\n // real event is the point; a foreign payload is simply not ours\n // to act on.\n (e: React.MouseEvent<HTMLAnchorElement>) => {\n if (typeof e?.preventDefault === 'function') e.preventDefault();\n }\n : (onClick as\n React.MouseEventHandler<HTMLAnchorElement> | undefined)\n }\n {...(forwardedRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {children}\n </Component>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n className={buttonClasses}\n disabled={isDisabled}\n onClick={\n onClick as React.MouseEventHandler<HTMLButtonElement> | undefined\n }\n {...rest}\n >\n {children}\n </button>\n );\n}) as PolymorphicComponent<ButtonOwnProps, 'button'>;\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["_jsx"],"mappings":";;;;;;;;AA8GA,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAAW,EAAE,MAAM,EAAE,OAAO,CAAU;AAEpE;;;;;;;;AAQG;AAEI,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,MAAM,CAC9C,KAAkB,EAClB,GAA2B,EAAA;IAE3B,MAAM,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,EAAE,EAAE,SAAS,GAAG,QAAQ,EACxB,IAAI,EACJ,OAAO,EACP,MAAM,EACN,GAAG,EACH,GAAG,UAAU,EACd,GAAG,KAAwB;AAE5B,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,UAAU;AACd,KAAA,CAAC;;AAGF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,EAAE;AACnD,QAAA,CAAC,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GACZ,KAAK;AACL,YAAA,iBAAiB,CAAC,QAAQ,CAAC,KAA2C,CAAC;AACzE,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GAAG,IAAI;AACpB,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,WAAW,EAAE,QAAQ;AACrB,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,WAAW,EAAE,QAAQ;AACrB,QAAA,aAAa,EAAE,UAAU;QACzB,cAAc,EAAE,WAAW,IAAI,WAAW;AAC3C,KAAA,CAAC;;IAGF,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE7E,IAAA,IAAI,SAAS,KAAK,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyC1B,QAAA,MAAM,gBAAgB,GAAG;YACvB,YAAY;YACZ,aAAa;YACb,YAAY;YACZ,gBAAgB;YAChB,YAAY;SACb;AACD,QAAA,MAAM,aAAa,GAAG;YACpB,QAAQ;YACR,UAAU;YACV,OAAO;YACP,UAAU;YACV,QAAQ;YACR,QAAQ;YACR,UAAU;SACX;;;;;;;AAQD,QAAA,MAAM,aAAa,GAA4B,EAAE,GAAG,IAAI,EAAE;QAC1D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE;;AAEhE,YAAA,IAAI,SAAS,KAAK,GAAG,EAAE;gBACrB,KAAK,MAAM,GAAG,IAAI,gBAAgB;AAAE,oBAAA,OAAO,aAAa,CAAC,GAAG,CAAC;YAC/D;;;AAGA,YAAA,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,OAAO,aAAa,CAAC,QAAQ;QACvE;AAEA,QAAA,QACEA,GAAA,CAAC,SAAS,IACR,GAAG,EAAE,GAAmC,EACxC,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,EAAA,eAAA,EACO,UAAU,EACzB,QAAQ,EAAE,UAAU,GAAG,EAAE,GAAG,SAAS,EACrC,OAAO,EACL;AACE;;;;;;;oBAOE,CAAC,CAAsC,KAAI;AACzC,wBAAA,IAAI,OAAO,CAAC,EAAE,cAAc,KAAK,UAAU;4BAAE,CAAC,CAAC,cAAc,EAAE;oBACjE;kBACC,OACwD,EAAA,GAE1D,aAA+D,YAEnE,QAAQ,EAAA,CACC;IAEhB;IAEA,QACEA,gBACE,GAAG,EAAE,GAAmC,EACxC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,UAAU,EACpB,OAAO,EACL,OAAiE,EAAA,GAE/D,IAAI,EAAA,QAAA,EAEP,QAAQ,EAAA,CACF;AAEb,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { withSubComponents } from '../helpers/withSubComponents.js';
|
|
5
|
+
import { Button } from './Button.js';
|
|
6
|
+
import { LinkButton } from './LinkButton.js';
|
|
7
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
8
|
+
|
|
9
|
+
const validButtonsSizes = ['small', 'medium', 'large'];
|
|
10
|
+
/**
|
|
11
|
+
* The `Buttons` component lets you group multiple `Button` elements together with Bulma's spacing, alignment, and add-on features.
|
|
12
|
+
*
|
|
13
|
+
* @function
|
|
14
|
+
* @param {ButtonsProps} props - Props for the Buttons component.
|
|
15
|
+
* @returns {JSX.Element} The rendered group of buttons.
|
|
16
|
+
* @see {@link https://bulma.io/documentation/elements/button/#group | Bulma Button Group documentation}
|
|
17
|
+
*/
|
|
18
|
+
const ButtonsComponent = ({ className, textColor, color, bgColor, isCentered, isRight, hasAddons, size, children, ...props }) => {
|
|
19
|
+
const buttonsClasses = usePrefixedClassNames('buttons', {
|
|
20
|
+
'is-centered': isCentered,
|
|
21
|
+
'is-right': isRight,
|
|
22
|
+
'has-addons': hasAddons,
|
|
23
|
+
[`are-${size}`]: size && validButtonsSizes.includes(size),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
27
|
+
*/
|
|
28
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
29
|
+
color: textColor ?? color,
|
|
30
|
+
backgroundColor: bgColor,
|
|
31
|
+
...props,
|
|
32
|
+
});
|
|
33
|
+
const combinedClasses = classNames(buttonsClasses, className, bulmaHelperClasses);
|
|
34
|
+
return (jsx("div", { className: combinedClasses, ...rest, children: children }));
|
|
35
|
+
};
|
|
36
|
+
const Buttons = withSubComponents(ButtonsComponent, {
|
|
37
|
+
Button,
|
|
38
|
+
LinkButton,
|
|
39
|
+
}, 'Buttons');
|
|
40
|
+
|
|
41
|
+
export { Buttons };
|
|
42
|
+
//# sourceMappingURL=Buttons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Buttons.js","sources":["../../../src/elements/Buttons.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Button } from './Button';\nimport { LinkButton } from './LinkButton';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validButtonsSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Buttons component (Bulma button group sizes).\n */\nexport type ButtonsSize = (typeof validButtonsSizes)[number];\n\n/**\n * Props for the Buttons component.\n */\ninterface ButtonsProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'size'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper for the button group. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.buttons.is-<color>` CSS exists; color the\n * individual `Button`s instead). Prefer `textColor`, which takes precedence\n * when both are set; use `bgColor` for a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper for the button group. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Center the group of buttons. */\n isCentered?: boolean;\n /** Align the group of buttons to the right. */\n isRight?: boolean;\n /** Group buttons together as addons (removes spacing between them). */\n hasAddons?: boolean;\n /** Size of the button group. */\n size?: ButtonsSize;\n /** The button elements to render inside the group. */\n children: React.ReactNode;\n}\n\n/**\n * The `Buttons` component lets you group multiple `Button` elements together with Bulma's spacing, alignment, and add-on features.\n *\n * @function\n * @param {ButtonsProps} props - Props for the Buttons component.\n * @returns {JSX.Element} The rendered group of buttons.\n * @see {@link https://bulma.io/documentation/elements/button/#group | Bulma Button Group documentation}\n */\nconst ButtonsComponent: React.FC<ButtonsProps> = ({\n className,\n textColor,\n color,\n bgColor,\n isCentered,\n isRight,\n hasAddons,\n size,\n children,\n ...props\n}) => {\n const buttonsClasses = usePrefixedClassNames('buttons', {\n 'is-centered': isCentered,\n 'is-right': isRight,\n 'has-addons': hasAddons,\n [`are-${size}`]: size && validButtonsSizes.includes(size),\n });\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const combinedClasses = classNames(\n buttonsClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={combinedClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Buttons = withSubComponents(\n ButtonsComponent,\n {\n Button,\n LinkButton,\n },\n 'Buttons'\n);\n"],"names":["_jsx"],"mappings":";;;;;;;;AAWA,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAsC/D;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAA2B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,CAAC,CAAA,IAAA,EAAO,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1D,KAAA,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAChC,cAAc,EACd,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACtC,QAAQ,EAAA,CACL;AAEV,CAAC;AAEM,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB;IACE,MAAM;IACN,UAAU;CACX,EACD,SAAS;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `Code` component renders a styled `<code>` element with Bulma helper class integration.
|
|
8
|
+
*
|
|
9
|
+
* @function
|
|
10
|
+
* @param {CodeProps} props - Props for the Code component.
|
|
11
|
+
* @returns {JSX.Element} The rendered code element.
|
|
12
|
+
*/
|
|
13
|
+
const Code = ({ className, textColor, bgColor, children, ...props }) => {
|
|
14
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
15
|
+
color: textColor,
|
|
16
|
+
backgroundColor: bgColor,
|
|
17
|
+
...props,
|
|
18
|
+
});
|
|
19
|
+
const bulmaClasses = usePrefixedClassNames();
|
|
20
|
+
const codeClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
21
|
+
return (jsx("code", { className: codeClasses || undefined, ...rest, children: children }));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { Code };
|
|
25
|
+
//# sourceMappingURL=Code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.js","sources":["../../../src/elements/Code.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Code component.\n */\nexport interface CodeProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Code content to render inside the element. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Code` component renders a styled `<code>` element with Bulma helper class integration.\n *\n * @function\n * @param {CodeProps} props - Props for the Code component.\n * @returns {JSX.Element} The rendered code element.\n */\nexport const Code: React.FC<CodeProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const codeClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <code className={codeClasses || undefined} {...rest}>\n {children}\n </code>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;AAyBA;;;;;;AAMG;AACI,MAAM,IAAI,GAAwB,CAAC,EACxC,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE3E,IAAA,QACEA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,WAAW,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,QAAA,EAChD,QAAQ,EAAA,CACJ;AAEX;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
|
|
6
|
+
// Valid size modifiers for the content class
|
|
7
|
+
const validSizes = ['small', 'medium', 'large'];
|
|
8
|
+
/**
|
|
9
|
+
* The `Content` component applies Bulma’s typographic styles to its children, enhancing the appearance of HTML elements like paragraphs, headings, lists, and tables.
|
|
10
|
+
*
|
|
11
|
+
* @function
|
|
12
|
+
* @param {ContentProps} props - Props for the Content component.
|
|
13
|
+
* @returns {JSX.Element} The rendered content block.
|
|
14
|
+
* @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}
|
|
15
|
+
*/
|
|
16
|
+
const Content = ({ className, textColor, color, bgColor, size, children, ...props }) => {
|
|
17
|
+
/**
|
|
18
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
19
|
+
*/
|
|
20
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
21
|
+
color: textColor ?? color,
|
|
22
|
+
backgroundColor: bgColor,
|
|
23
|
+
...props,
|
|
24
|
+
});
|
|
25
|
+
const bulmaClasses = usePrefixedClassNames('content', {
|
|
26
|
+
[`is-${size}`]: size && size !== 'normal' && validSizes.includes(size),
|
|
27
|
+
});
|
|
28
|
+
const contentClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
29
|
+
return (jsx("div", { className: contentClasses, ...rest, children: children }));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { Content };
|
|
33
|
+
//# sourceMappingURL=Content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../src/elements/Content.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Content component.\n */\ninterface ContentProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper (e.g., `'danger'` for `has-text-danger`). */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.content.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper (e.g., `'info'` for `has-background-info`). */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Size modifier for the content. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /** Content to be rendered inside the block. */\n children?: React.ReactNode;\n}\n\n// Valid size modifiers for the content class\nconst validSizes = ['small', 'medium', 'large'] as const;\n\n/**\n * The `Content` component applies Bulma’s typographic styles to its children, enhancing the appearance of HTML elements like paragraphs, headings, lists, and tables.\n *\n * @function\n * @param {ContentProps} props - Props for the Content component.\n * @returns {JSX.Element} The rendered content block.\n * @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}\n */\nexport const Content: React.FC<ContentProps> = ({\n className,\n textColor,\n color,\n bgColor,\n size,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('content', {\n [`is-${size}`]: size && size !== 'normal' && validSizes.includes(size),\n });\n\n const contentClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div className={contentClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport default Content;\n"],"names":["_jsx"],"mappings":";;;;;AAkCA;AACA,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAExD;;;;;;;AAOG;MACU,OAAO,GAA2B,CAAC,EAC9C,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACpD,QAAA,CAAC,MAAM,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvE,KAAA,CAAC;IAEF,MAAM,cAAc,GAAG,UAAU,CAC/B,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,cAAc,EAAA,GAAM,IAAI,EAAA,QAAA,EACrC,QAAQ,EAAA,CACL;AAEV;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
import { buttonType } from '../helpers/buttonType.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `Delete` component provides a Bulma-styled close/delete button for dismissing modals, notifications, tags, messages, and more.
|
|
9
|
+
*
|
|
10
|
+
* It renders `type="button"`, so a delete button inside a form does not submit it.
|
|
11
|
+
*
|
|
12
|
+
* @function
|
|
13
|
+
* @param {DeleteProps} props - Props for the Delete component.
|
|
14
|
+
* @returns {JSX.Element} The rendered delete button.
|
|
15
|
+
* @see {@link https://bulma.io/documentation/elements/delete/ | Bulma Delete documentation}
|
|
16
|
+
*/
|
|
17
|
+
const Delete = ({ className, textColor, color, bgColor, onClick, size, ariaLabel, disabled = false, ...props }) => {
|
|
18
|
+
/**
|
|
19
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
20
|
+
*/
|
|
21
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
22
|
+
color: textColor ?? color,
|
|
23
|
+
backgroundColor: bgColor,
|
|
24
|
+
...props,
|
|
25
|
+
});
|
|
26
|
+
const bulmaClasses = usePrefixedClassNames('delete', {
|
|
27
|
+
[`is-${size}`]: size,
|
|
28
|
+
'is-disabled': disabled,
|
|
29
|
+
});
|
|
30
|
+
const classes = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
31
|
+
return (jsx("button", { className: classes, onClick: onClick, disabled: disabled, ...rest, "aria-label": rest['aria-label'] || ariaLabel || 'Close', type: buttonType(rest.type) }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { Delete };
|
|
35
|
+
//# sourceMappingURL=Delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Delete.js","sources":["../../../src/elements/Delete.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { buttonType } from '../helpers/buttonType';\n\n/**\n * Props for the Delete component.\n */\ninterface DeleteProps\n extends React.HTMLAttributes<HTMLButtonElement>, BulmaClassesProps {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.delete.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Click handler for the button. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Size modifier for the delete button. */\n size?: 'small' | 'medium' | 'large';\n /**\n * Accessible name for the button. An `aria-label` you pass takes precedence\n * over it, unless it is empty or arrives as `undefined` through a spread.\n * An empty `ariaLabel` falls back to the default too, so the button is never\n * left unnamed.\n * @defaultValue 'Close'\n */\n ariaLabel?: string;\n /** Whether the button is disabled (default: false). */\n disabled?: boolean;\n}\n\n/**\n * The `Delete` component provides a Bulma-styled close/delete button for dismissing modals, notifications, tags, messages, and more.\n *\n * It renders `type=\"button\"`, so a delete button inside a form does not submit it.\n *\n * @function\n * @param {DeleteProps} props - Props for the Delete component.\n * @returns {JSX.Element} The rendered delete button.\n * @see {@link https://bulma.io/documentation/elements/delete/ | Bulma Delete documentation}\n */\nexport const Delete: React.FC<DeleteProps> = ({\n className,\n textColor,\n color,\n bgColor,\n onClick,\n size,\n ariaLabel,\n disabled = false,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('delete', {\n [`is-${size}`]: size,\n 'is-disabled': disabled,\n });\n\n const classes = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <button\n className={classes}\n onClick={onClick}\n disabled={disabled}\n {...rest}\n // After the spread, reading through it: a key the spread carries with no\n // value would otherwise erase the default, leaving a nameless button\n // that submits the form around it. An empty label falls back too: the\n // button is drawn as an icon, so `''` would leave it unnamed. A caller's\n // own value still wins; `buttonType` says more.\n aria-label={rest['aria-label'] || ariaLabel || 'Close'}\n type={buttonType((rest as { type?: unknown }).type)}\n />\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AA2CA;;;;;;;;;AASG;AACI,MAAM,MAAM,GAA0B,CAAC,EAC5C,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,EAAE;AACnD,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GAAG,IAAI;AACpB,QAAA,aAAa,EAAE,QAAQ;AACxB,KAAA,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAEvE,IAAA,QACEA,GAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAAA,GACd,IAAI,EAAA,YAAA,EAMI,IAAI,CAAC,YAAY,CAAC,IAAI,SAAS,IAAI,OAAO,EACtD,IAAI,EAAE,UAAU,CAAE,IAA2B,CAAC,IAAI,CAAC,EAAA,CACnD;AAEN;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `Divider` component renders a styled horizontal rule (`<hr>`) element with Bulma helper class integration.
|
|
8
|
+
*
|
|
9
|
+
* @function
|
|
10
|
+
* @param {DividerProps} props - Props for the Divider component.
|
|
11
|
+
* @returns {JSX.Element} The rendered hr element.
|
|
12
|
+
*/
|
|
13
|
+
const Divider = ({ className, bgColor, ...props }) => {
|
|
14
|
+
/**
|
|
15
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
16
|
+
*/
|
|
17
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
18
|
+
backgroundColor: bgColor,
|
|
19
|
+
...props,
|
|
20
|
+
});
|
|
21
|
+
const bulmaClasses = usePrefixedClassNames();
|
|
22
|
+
const dividerClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
23
|
+
return jsx("hr", { className: dividerClasses || undefined, ...rest });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { Divider };
|
|
27
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","sources":["../../../src/elements/Divider.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Divider component.\n */\nexport interface DividerProps\n extends\n React.HTMLAttributes<HTMLHRElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `Divider` component renders a styled horizontal rule (`<hr>`) element with Bulma helper class integration.\n *\n * @function\n * @param {DividerProps} props - Props for the Divider component.\n * @returns {JSX.Element} The rendered hr element.\n */\nexport const Divider: React.FC<DividerProps> = ({\n className,\n bgColor,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const dividerClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return <hr className={dividerClasses || undefined} {...rest} />;\n};\n"],"names":["_jsx"],"mappings":";;;;;AAqBA;;;;;;AAMG;AACI,MAAM,OAAO,GAA2B,CAAC,EAC9C,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,cAAc,GAAG,UAAU,CAC/B,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;IAED,OAAOA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,cAAc,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,CAAI;AACjE;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `Emphasis` component renders a styled `<em>` element with Bulma helper class integration.
|
|
8
|
+
*
|
|
9
|
+
* @function
|
|
10
|
+
* @param {EmphasisProps} props - Props for the Emphasis component.
|
|
11
|
+
* @returns {JSX.Element} The rendered em element.
|
|
12
|
+
*/
|
|
13
|
+
const Emphasis = ({ className, textColor, bgColor, children, ...props }) => {
|
|
14
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
15
|
+
color: textColor,
|
|
16
|
+
backgroundColor: bgColor,
|
|
17
|
+
...props,
|
|
18
|
+
});
|
|
19
|
+
const bulmaClasses = usePrefixedClassNames();
|
|
20
|
+
const emphasisClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
21
|
+
return (jsx("em", { className: emphasisClasses || undefined, ...rest, children: children }));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { Emphasis };
|
|
25
|
+
//# sourceMappingURL=Emphasis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emphasis.js","sources":["../../../src/elements/Emphasis.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Emphasis component.\n */\nexport interface EmphasisProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the em element. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Emphasis` component renders a styled `<em>` element with Bulma helper class integration.\n *\n * @function\n * @param {EmphasisProps} props - Props for the Emphasis component.\n * @returns {JSX.Element} The rendered em element.\n */\nexport const Emphasis: React.FC<EmphasisProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const emphasisClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <em className={emphasisClasses || undefined} {...rest}>\n {children}\n </em>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;AAyBA;;;;;;AAMG;AACI,MAAM,QAAQ,GAA4B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,eAAe,GAAG,UAAU,CAChC,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;AAED,IAAA,QACEA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,eAAe,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,QAAA,EAClD,QAAQ,EAAA,CACN;AAET;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
|
|
4
|
+
import { withSubComponents } from '../helpers/withSubComponents.js';
|
|
5
|
+
import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* FigureCaption component for rendering a styled figcaption element.
|
|
9
|
+
*
|
|
10
|
+
* A FigureCaption wraps the HTML `<figcaption>` element with Bulma helper class integration.
|
|
11
|
+
* Use it inside Figure components to provide captions for images or other media.
|
|
12
|
+
*
|
|
13
|
+
* @function
|
|
14
|
+
* @param {FigureCaptionProps} props - Props for the FigureCaption component.
|
|
15
|
+
* @returns {JSX.Element} The rendered figcaption element.
|
|
16
|
+
*/
|
|
17
|
+
const FigureCaption = ({ className, textColor, bgColor, children, ...props }) => {
|
|
18
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
19
|
+
color: textColor,
|
|
20
|
+
backgroundColor: bgColor,
|
|
21
|
+
...props,
|
|
22
|
+
});
|
|
23
|
+
const bulmaClasses = usePrefixedClassNames();
|
|
24
|
+
const captionClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
25
|
+
return (jsx("figcaption", { className: captionClasses || undefined, ...rest, children: children }));
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The `Figure` component renders a styled `<figure>` element with Bulma helper class integration.
|
|
29
|
+
*
|
|
30
|
+
* @function
|
|
31
|
+
* @param {FigureProps} props - Props for the Figure component.
|
|
32
|
+
* @returns {JSX.Element} The rendered figure element.
|
|
33
|
+
*/
|
|
34
|
+
const FigureComponent = ({ className, textColor, bgColor, children, ...props }) => {
|
|
35
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
36
|
+
color: textColor,
|
|
37
|
+
backgroundColor: bgColor,
|
|
38
|
+
...props,
|
|
39
|
+
});
|
|
40
|
+
const bulmaClasses = usePrefixedClassNames();
|
|
41
|
+
const figureClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
|
|
42
|
+
return (jsx("figure", { className: figureClasses || undefined, ...rest, children: children }));
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Figure component with Caption subcomponent.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <Figure>
|
|
49
|
+
* <img src="image.jpg" alt="Description" />
|
|
50
|
+
* <Figure.Caption>Image caption text</Figure.Caption>
|
|
51
|
+
* </Figure>
|
|
52
|
+
*/
|
|
53
|
+
const Figure = withSubComponents(FigureComponent, {
|
|
54
|
+
Caption: FigureCaption,
|
|
55
|
+
}, 'Figure');
|
|
56
|
+
|
|
57
|
+
export { Figure };
|
|
58
|
+
//# sourceMappingURL=Figure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Figure.js","sources":["../../../src/elements/Figure.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';\n\n/**\n * Props for the FigureCaption component.\n */\nexport interface FigureCaptionProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color (Bulma color, 'inherit', or 'current'). */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color (Bulma color, 'inherit', or 'current'). */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to be rendered inside the figcaption. */\n children?: React.ReactNode;\n}\n\n/**\n * FigureCaption component for rendering a styled figcaption element.\n *\n * A FigureCaption wraps the HTML `<figcaption>` element with Bulma helper class integration.\n * Use it inside Figure components to provide captions for images or other media.\n *\n * @function\n * @param {FigureCaptionProps} props - Props for the FigureCaption component.\n * @returns {JSX.Element} The rendered figcaption element.\n */\nconst FigureCaption: React.FC<FigureCaptionProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const captionClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <figcaption className={captionClasses || undefined} {...rest}>\n {children}\n </figcaption>\n );\n};\n\n/**\n * Props for the Figure component.\n */\nexport interface FigureProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the figure. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Figure` component renders a styled `<figure>` element with Bulma helper class integration.\n *\n * @function\n * @param {FigureProps} props - Props for the Figure component.\n * @returns {JSX.Element} The rendered figure element.\n */\nconst FigureComponent: React.FC<FigureProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const figureClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <figure className={figureClasses || undefined} {...rest}>\n {children}\n </figure>\n );\n};\n\n/**\n * Figure component with Caption subcomponent.\n *\n * @example\n * <Figure>\n * <img src=\"image.jpg\" alt=\"Description\" />\n * <Figure.Caption>Image caption text</Figure.Caption>\n * </Figure>\n */\nexport const Figure = withSubComponents(\n FigureComponent,\n {\n Caption: FigureCaption,\n },\n 'Figure'\n);\n"],"names":["_jsx"],"mappings":";;;;;;AA0BA;;;;;;;;;AASG;AACH,MAAM,aAAa,GAAiC,CAAC,EACnD,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,cAAc,GAAG,UAAU,CAC/B,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;AAED,IAAA,QACEA,GAAA,CAAA,YAAA,EAAA,EAAY,SAAS,EAAE,cAAc,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,QAAA,EACzD,QAAQ,EAAA,CACE;AAEjB,CAAC;AAmBD;;;;;;AAMG;AACH,MAAM,eAAe,GAA0B,CAAC,EAC9C,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE7E,IAAA,QACEA,GAAA,CAAA,QAAA,EAAA,EAAQ,SAAS,EAAE,aAAa,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,QAAA,EACpD,QAAQ,EAAA,CACF;AAEb,CAAC;AAED;;;;;;;;AAQG;AACI,MAAM,MAAM,GAAG,iBAAiB,CACrC,eAAe,EACf;AACE,IAAA,OAAO,EAAE,aAAa;CACvB,EACD,QAAQ;;"}
|