@allxsmith/bestax-bulma 5.33.1 → 5.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/EmptyState.js +139 -0
  4. package/dist/esm/components/EmptyState.js.map +1 -0
  5. package/dist/esm/elements/Buttons.js.map +1 -1
  6. package/dist/esm/elements/SubTitle.js.map +1 -1
  7. package/dist/esm/elements/Title.js.map +1 -1
  8. package/dist/extras.css +1 -1
  9. package/dist/extras.css.map +1 -1
  10. package/dist/index.cjs +1079 -948
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.esm.js +1 -0
  13. package/dist/index.esm.js.map +1 -1
  14. package/dist/types/components/EmptyState.d.ts +149 -0
  15. package/dist/types/elements/Buttons.d.ts +1 -1
  16. package/dist/types/elements/SubTitle.d.ts +13 -2
  17. package/dist/types/elements/Title.d.ts +11 -2
  18. package/dist/types/index.d.ts +1 -0
  19. package/dist/types-cjs/components/EmptyState.d.ts +149 -0
  20. package/dist/types-cjs/elements/Buttons.d.ts +1 -1
  21. package/dist/types-cjs/elements/SubTitle.d.ts +13 -2
  22. package/dist/types-cjs/elements/Title.d.ts +11 -2
  23. package/dist/types-cjs/index.d.ts +1 -0
  24. package/dist/versions/bestax-no-dark-mode.css +1 -1
  25. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  26. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  27. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  28. package/dist/versions/bestax-no-helpers.css +1 -1
  29. package/dist/versions/bestax-no-helpers.css.map +1 -1
  30. package/dist/versions/bestax-prefixed.css +1 -1
  31. package/dist/versions/bestax-prefixed.css.map +1 -1
  32. package/package.json +1 -1
  33. package/src/scss/components/_emptystate.scss +243 -0
  34. package/src/scss/components/_index.scss +1 -0
@@ -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 { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { forwardRef } from 'react';
4
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
5
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
6
+ import { withSubComponents } from '../helpers/withSubComponents.js';
7
+ import { Buttons } from '../elements/Buttons.js';
8
+ import { Icon } from '../elements/Icon.js';
9
+ import { Paragraph } from '../elements/Paragraph.js';
10
+ import { Title } from '../elements/Title.js';
11
+
12
+ const validEmptyStateColors = [
13
+ 'primary',
14
+ 'link',
15
+ 'info',
16
+ 'success',
17
+ 'warning',
18
+ 'danger',
19
+ ];
20
+ const validEmptyStateHeadings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
21
+ const validEmptyStateSizes = ['small', 'medium', 'large'];
22
+ /**
23
+ * The circle the picture sits in, hidden from assistive tech whatever is in it.
24
+ *
25
+ * @function
26
+ * @param {EmptyStateIndicatorProps} props - Props for EmptyState.Indicator.
27
+ * @returns {JSX.Element} The rendered indicator.
28
+ */
29
+ const EmptyStateIndicator = ({ className, textColor, bgColor, children, ...props }) => {
30
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
31
+ color: textColor,
32
+ backgroundColor: bgColor,
33
+ ...props,
34
+ });
35
+ const indicatorClass = usePrefixedClassNames('empty-state-indicator');
36
+ // Hidden after the rest of the props, so nothing passed in can expose the
37
+ // picture: the title says what it means.
38
+ return (jsx("div", { className: classNames(indicatorClass, bulmaHelperClasses, className), ...rest, "aria-hidden": "true", children: children }));
39
+ };
40
+ EmptyStateIndicator.displayName = 'EmptyState.Indicator';
41
+ /**
42
+ * The heading, a Bulma `Title` at the level `as` sets, `h2` by default, and at the EmptyState's size.
43
+ *
44
+ * @function
45
+ * @param {EmptyStateTitleProps} props - Props for EmptyState.Title.
46
+ * @returns {JSX.Element} The rendered heading.
47
+ */
48
+ const EmptyStateTitle = ({ as = 'h2', className, ...props }) => {
49
+ // `size` isn't in the type, but on `Title` it picks the tag, so it's kept
50
+ // off even when it's passed anyway. The level is `as` alone.
51
+ const { size: _size, ...rest } = props;
52
+ const titleClass = usePrefixedClassNames('empty-state-title');
53
+ const level = validEmptyStateHeadings.includes(as) ? as : 'h2';
54
+ return (jsx(Title, { as: level, className: classNames(titleClass, className), ...rest }));
55
+ };
56
+ EmptyStateTitle.displayName = 'EmptyState.Title';
57
+ /**
58
+ * A sentence or two under the title, in the color of the text around it.
59
+ *
60
+ * @function
61
+ * @param {EmptyStateDescriptionProps} props - Props for EmptyState.Description.
62
+ * @returns {JSX.Element} The rendered description.
63
+ */
64
+ const EmptyStateDescription = ({ className, ...props }) => {
65
+ const descriptionClass = usePrefixedClassNames('empty-state-description');
66
+ return (jsx(Paragraph, { className: classNames(descriptionClass, className), ...props }));
67
+ };
68
+ EmptyStateDescription.displayName = 'EmptyState.Description';
69
+ /**
70
+ * A row of buttons, centered under the text or at the start of the line beside the indicator.
71
+ *
72
+ * @function
73
+ * @param {EmptyStateActionsProps} props - Props for EmptyState.Actions.
74
+ * @returns {JSX.Element} The rendered row of buttons.
75
+ */
76
+ const EmptyStateActions = ({ className, ...props }) => {
77
+ const actionsClass = usePrefixedClassNames('empty-state-actions');
78
+ return jsx(Buttons, { className: classNames(actionsClass, className), ...props });
79
+ };
80
+ EmptyStateActions.displayName = 'EmptyState.Actions';
81
+ /** Whether a shorthand prop was given something to render. */
82
+ const isGiven = (node) => node !== undefined &&
83
+ node !== null &&
84
+ typeof node !== 'boolean' &&
85
+ node !== '';
86
+ /**
87
+ * The `EmptyState` component renders the block an app shows where content would be: an empty list, a search with no results, or a first-run screen.
88
+ *
89
+ * It's a column of a picture in a circle, a heading, a line of text and the
90
+ * actions, with one layout whether it's written with the `icon`, `title` and
91
+ * `description` props or with the parts. The children always render as
92
+ * written, after the parts the props render.
93
+ *
94
+ * It has no role and no live region. It arrives already filled and goes away
95
+ * when results come back, so it can't announce a search that matched
96
+ * nothing: keep a `role="status"` region beside the search field for that,
97
+ * in the page the whole time. While the data loads, show a `Skeleton` or a
98
+ * `Loader` instead, so "No projects yet" doesn't flash first, and show a
99
+ * load that failed in a `Message` or a `Notification`.
100
+ *
101
+ * @function
102
+ * @param {EmptyStateProps} props - Props for the EmptyState component.
103
+ * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root `<div>`.
104
+ * @returns {JSX.Element} The rendered empty state.
105
+ *
106
+ * @example
107
+ * <EmptyState
108
+ * icon="folder-open"
109
+ * title="No projects yet"
110
+ * description="Projects you create or join show up here."
111
+ * >
112
+ * <Button color="primary">New project</Button>
113
+ * </EmptyState>
114
+ */
115
+ const EmptyStateRoot = forwardRef(({ className, icon, title, titleAs = 'h2', description, children, color, variant = 'light', size = 'normal', align = 'center', textColor, bgColor, ...props }, ref) => {
116
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
117
+ color: textColor,
118
+ backgroundColor: bgColor,
119
+ ...props,
120
+ });
121
+ const rootClass = usePrefixedClassNames('empty-state', {
122
+ [`is-${size}`]: validEmptyStateSizes.includes(size),
123
+ 'is-left': align === 'left',
124
+ [`is-${color}`]: !!color && validEmptyStateColors.includes(color),
125
+ 'is-filled': variant === 'filled',
126
+ });
127
+ // The props' parts first, each only when it's given, then the children
128
+ // exactly as they were written: nothing here looks at them.
129
+ return (jsxs("div", { ref: ref, className: classNames(rootClass, bulmaHelperClasses, className), ...rest, children: [isGiven(icon) && (jsx(EmptyStateIndicator, { children: typeof icon === 'string' ? jsx(Icon, { name: icon }) : icon })), isGiven(title) && (jsx(EmptyStateTitle, { as: titleAs, children: title })), isGiven(description) && (jsx(EmptyStateDescription, { children: description })), children] }));
130
+ });
131
+ const EmptyState = withSubComponents(EmptyStateRoot, {
132
+ Indicator: EmptyStateIndicator,
133
+ Title: EmptyStateTitle,
134
+ Description: EmptyStateDescription,
135
+ Actions: EmptyStateActions,
136
+ }, 'EmptyState');
137
+
138
+ export { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIndicator, EmptyStateTitle };
139
+ //# sourceMappingURL=EmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyState.js","sources":["../../../src/components/EmptyState.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Buttons, ButtonsProps } from '../elements/Buttons';\nimport { Icon } from '../elements/Icon';\nimport { Paragraph, ParagraphProps } from '../elements/Paragraph';\nimport { Title, TitleProps } from '../elements/Title';\n\nconst validEmptyStateColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n] as const;\n/** The Bulma colors the indicator takes. */\nexport type EmptyStateColor = (typeof validEmptyStateColors)[number];\n\nconst validEmptyStateHeadings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\n/** A title's heading level. It's always a heading, so there's no `p`. */\nexport type EmptyStateHeading = (typeof validEmptyStateHeadings)[number];\n\nconst validEmptyStateSizes = ['small', 'medium', 'large'] as const;\n\n/**\n * Props for the EmptyState component. The helper props, the other attributes\n * and the `ref` land on the root `<div>`. The native `title` attribute isn't\n * one of them, since `title` here is the heading.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root `<div>`.\n */\nexport interface EmptyStateProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'title'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * The picture in the indicator's circle. A string is an `Icon` name, drawn\n * from the icon library `ConfigProvider` sets. Anything else (an `<Icon>`\n * with its own `variant` or `library`, an SVG, an `<img>`) renders as it is.\n * It's decorative and hidden from assistive tech, so the title says what\n * it means.\n */\n icon?: React.ReactNode;\n /**\n * The heading, rendered as `EmptyState.Title`. It's always a real heading,\n * at the level `titleAs` sets.\n */\n title?: React.ReactNode;\n /**\n * The heading level for `title`: the level under the heading of the list\n * it stands in for, such as `h3` for a list under an `h2`. Only this sets\n * the level, and the size comes from `size`.\n */\n titleAs?: EmptyStateHeading;\n /** A sentence or two under the title, rendered as `EmptyState.Description`. */\n description?: React.ReactNode;\n /**\n * Rendered as written, after whatever `icon`, `title` and `description`\n * render. One button can go straight in, and it sits centered under the\n * text. Group two or more in `EmptyState.Actions`, or they stack. Without\n * the props, write the parts here in the order they're shown:\n * `EmptyState.Indicator`, `.Title`, `.Description`, then the actions.\n */\n children?: React.ReactNode;\n /**\n * The indicator's color. It colors the circle and its icon, not the text.\n * Without it the circle is neutral, since an empty list isn't a status.\n */\n color?: EmptyStateColor;\n /**\n * `light` is a soft tint of `color` behind the icon in the color. `filled`\n * is the color itself, with the icon in its invert.\n */\n variant?: 'light' | 'filled';\n /** Sizes the indicator, the title, the description and the spacing together. */\n size?: 'small' | 'normal' | 'medium' | 'large';\n /**\n * `center` stacks everything in a centered column. `left` puts the\n * indicator beside the text, at the start of the line, so on the right in\n * a right-to-left page, and keeps the block at least as tall as the circle\n * whatever block padding is in effect. Without an indicator, it only puts\n * the text at the start of the line. In `left`, the padding at the start\n * of the line is what makes room for the indicator, so pad it with `py`\n * rather than `p` or `px`.\n */\n align?: 'center' | 'left';\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/** Props for EmptyState.Indicator, the circle the picture sits in. */\nexport interface EmptyStateIndicatorProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * The picture: an `Icon`, an SVG or an `<img>`. The indicator is hidden\n * from assistive tech, an `Icon` with an `ariaLabel` included, so anything\n * it means goes in the title or the description.\n */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * Props for EmptyState.Title. It renders `Title` with `as` and never `size`,\n * so the level is `as` alone and the size comes from the EmptyState.\n */\nexport interface EmptyStateTitleProps extends Omit<\n TitleProps,\n 'as' | 'size' | 'isSpaced'\n> {\n /**\n * The heading level: the level under the heading of the list the empty\n * state stands in for.\n */\n as?: EmptyStateHeading;\n}\n\n/** Props for EmptyState.Description, a `<p>` under the title. */\nexport type EmptyStateDescriptionProps = ParagraphProps;\n\n/**\n * Props for EmptyState.Actions, the row of buttons. It renders `Buttons`,\n * and the EmptyState aligns it, so `isCentered` and `isRight` are left out.\n */\nexport type EmptyStateActionsProps = Omit<\n ButtonsProps,\n 'isCentered' | 'isRight'\n>;\n\n/**\n * The circle the picture sits in, hidden from assistive tech whatever is in it.\n *\n * @function\n * @param {EmptyStateIndicatorProps} props - Props for EmptyState.Indicator.\n * @returns {JSX.Element} The rendered indicator.\n */\nexport const EmptyStateIndicator: React.FC<EmptyStateIndicatorProps> = ({\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 });\n const indicatorClass = usePrefixedClassNames('empty-state-indicator');\n\n // Hidden after the rest of the props, so nothing passed in can expose the\n // picture: the title says what it means.\n return (\n <div\n className={classNames(indicatorClass, bulmaHelperClasses, className)}\n {...rest}\n aria-hidden=\"true\"\n >\n {children}\n </div>\n );\n};\n\nEmptyStateIndicator.displayName = 'EmptyState.Indicator';\n\n/**\n * The heading, a Bulma `Title` at the level `as` sets, `h2` by default, and at the EmptyState's size.\n *\n * @function\n * @param {EmptyStateTitleProps} props - Props for EmptyState.Title.\n * @returns {JSX.Element} The rendered heading.\n */\nexport const EmptyStateTitle: React.FC<EmptyStateTitleProps> = ({\n as = 'h2',\n className,\n ...props\n}) => {\n // `size` isn't in the type, but on `Title` it picks the tag, so it's kept\n // off even when it's passed anyway. The level is `as` alone.\n const { size: _size, ...rest } = props as typeof props & { size?: unknown };\n const titleClass = usePrefixedClassNames('empty-state-title');\n const level = validEmptyStateHeadings.includes(as) ? as : 'h2';\n\n return (\n <Title as={level} className={classNames(titleClass, className)} {...rest} />\n );\n};\n\nEmptyStateTitle.displayName = 'EmptyState.Title';\n\n/**\n * A sentence or two under the title, in the color of the text around it.\n *\n * @function\n * @param {EmptyStateDescriptionProps} props - Props for EmptyState.Description.\n * @returns {JSX.Element} The rendered description.\n */\nexport const EmptyStateDescription: React.FC<EmptyStateDescriptionProps> = ({\n className,\n ...props\n}) => {\n const descriptionClass = usePrefixedClassNames('empty-state-description');\n return (\n <Paragraph className={classNames(descriptionClass, className)} {...props} />\n );\n};\n\nEmptyStateDescription.displayName = 'EmptyState.Description';\n\n/**\n * A row of buttons, centered under the text or at the start of the line beside the indicator.\n *\n * @function\n * @param {EmptyStateActionsProps} props - Props for EmptyState.Actions.\n * @returns {JSX.Element} The rendered row of buttons.\n */\nexport const EmptyStateActions: React.FC<EmptyStateActionsProps> = ({\n className,\n ...props\n}) => {\n const actionsClass = usePrefixedClassNames('empty-state-actions');\n return <Buttons className={classNames(actionsClass, className)} {...props} />;\n};\n\nEmptyStateActions.displayName = 'EmptyState.Actions';\n\n/** Whether a shorthand prop was given something to render. */\nconst isGiven = (node: React.ReactNode) =>\n node !== undefined &&\n node !== null &&\n typeof node !== 'boolean' &&\n node !== '';\n\n/**\n * The `EmptyState` component renders the block an app shows where content would be: an empty list, a search with no results, or a first-run screen.\n *\n * It's a column of a picture in a circle, a heading, a line of text and the\n * actions, with one layout whether it's written with the `icon`, `title` and\n * `description` props or with the parts. The children always render as\n * written, after the parts the props render.\n *\n * It has no role and no live region. It arrives already filled and goes away\n * when results come back, so it can't announce a search that matched\n * nothing: keep a `role=\"status\"` region beside the search field for that,\n * in the page the whole time. While the data loads, show a `Skeleton` or a\n * `Loader` instead, so \"No projects yet\" doesn't flash first, and show a\n * load that failed in a `Message` or a `Notification`.\n *\n * @function\n * @param {EmptyStateProps} props - Props for the EmptyState component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root `<div>`.\n * @returns {JSX.Element} The rendered empty state.\n *\n * @example\n * <EmptyState\n * icon=\"folder-open\"\n * title=\"No projects yet\"\n * description=\"Projects you create or join show up here.\"\n * >\n * <Button color=\"primary\">New project</Button>\n * </EmptyState>\n */\nconst EmptyStateRoot = forwardRef<HTMLDivElement, EmptyStateProps>(\n (\n {\n className,\n icon,\n title,\n titleAs = 'h2',\n description,\n children,\n color,\n variant = 'light',\n size = 'normal',\n align = 'center',\n textColor,\n bgColor,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n const rootClass = usePrefixedClassNames('empty-state', {\n [`is-${size}`]: (validEmptyStateSizes as readonly string[]).includes(\n size\n ),\n 'is-left': align === 'left',\n [`is-${color}`]:\n !!color && (validEmptyStateColors as readonly string[]).includes(color),\n 'is-filled': variant === 'filled',\n });\n\n // The props' parts first, each only when it's given, then the children\n // exactly as they were written: nothing here looks at them.\n return (\n <div\n ref={ref}\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n >\n {isGiven(icon) && (\n <EmptyStateIndicator>\n {typeof icon === 'string' ? <Icon name={icon} /> : icon}\n </EmptyStateIndicator>\n )}\n {isGiven(title) && (\n <EmptyStateTitle as={titleAs}>{title}</EmptyStateTitle>\n )}\n {isGiven(description) && (\n <EmptyStateDescription>{description}</EmptyStateDescription>\n )}\n {children}\n </div>\n );\n }\n);\n\nexport const EmptyState = withSubComponents(\n EmptyStateRoot,\n {\n Indicator: EmptyStateIndicator,\n Title: EmptyStateTitle,\n Description: EmptyStateDescription,\n Actions: EmptyStateActions,\n },\n 'EmptyState'\n);\n\nexport default EmptyState;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;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AAC9B,IAAA,KAAK,EAAE,eAAe;AACtB,IAAA,WAAW,EAAE,qBAAqB;AAClC,IAAA,OAAO,EAAE,iBAAiB;CAC3B,EACD,YAAY;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Buttons.js","sources":["../../../src/elements/Buttons.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Button } from './Button';\nimport { LinkButton } from './LinkButton';\nimport { ToggleButton } from './ToggleButton';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validButtonsSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Buttons component (Bulma button group sizes).\n */\nexport type ButtonsSize = (typeof validButtonsSizes)[number];\n\n/**\n * Props for the Buttons component.\n */\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 ToggleButton,\n },\n 'Buttons'\n);\n"],"names":["_jsx"],"mappings":";;;;;;;;;AAYA,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAsC/D;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAA2B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,CAAC,CAAA,IAAA,EAAO,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1D,KAAA,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAChC,cAAc,EACd,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACtC,QAAQ,EAAA,CACL;AAEV,CAAC;AAEM,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB;IACE,MAAM;IACN,UAAU;IACV,YAAY;CACb,EACD,SAAS;;"}
1
+ {"version":3,"file":"Buttons.js","sources":["../../../src/elements/Buttons.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Button } from './Button';\nimport { LinkButton } from './LinkButton';\nimport { ToggleButton } from './ToggleButton';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validButtonsSizes = ['small', 'medium', 'large'] as const;\n/**\n * Valid size values for the Buttons component (Bulma button group sizes).\n */\nexport type ButtonsSize = (typeof validButtonsSizes)[number];\n\n/**\n * Props for the Buttons component.\n */\nexport interface ButtonsProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'size'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper for the button group. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.buttons.is-<color>` CSS exists; color the\n * individual `Button`s instead). Prefer `textColor`, which takes precedence\n * when both are set; use `bgColor` for a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper for the button group. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Center the group of buttons. */\n isCentered?: boolean;\n /** Align the group of buttons to the right. */\n isRight?: boolean;\n /** Group buttons together as addons (removes spacing between them). */\n hasAddons?: boolean;\n /** Size of the button group. */\n size?: ButtonsSize;\n /** The button elements to render inside the group. */\n children: React.ReactNode;\n}\n\n/**\n * The `Buttons` component lets you group multiple `Button` elements together with Bulma's spacing, alignment, and add-on features.\n *\n * @function\n * @param {ButtonsProps} props - Props for the Buttons component.\n * @returns {JSX.Element} The rendered group of buttons.\n * @see {@link https://bulma.io/documentation/elements/button/#group | Bulma Button Group documentation}\n */\nconst ButtonsComponent: React.FC<ButtonsProps> = ({\n className,\n textColor,\n color,\n bgColor,\n isCentered,\n isRight,\n hasAddons,\n size,\n children,\n ...props\n}) => {\n const buttonsClasses = usePrefixedClassNames('buttons', {\n 'is-centered': isCentered,\n 'is-right': isRight,\n 'has-addons': hasAddons,\n [`are-${size}`]: size && validButtonsSizes.includes(size),\n });\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const combinedClasses = classNames(\n buttonsClasses,\n className,\n bulmaHelperClasses\n );\n\n return (\n <div className={combinedClasses} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const Buttons = withSubComponents(\n ButtonsComponent,\n {\n Button,\n LinkButton,\n ToggleButton,\n },\n 'Buttons'\n);\n"],"names":["_jsx"],"mappings":";;;;;;;;;AAYA,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAsC/D;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAA2B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,CAAC,CAAA,IAAA,EAAO,IAAI,CAAA,CAAE,GAAG,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1D,KAAA,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAChC,cAAc,EACd,SAAS,EACT,kBAAkB,CACnB;IAED,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACtC,QAAQ,EAAA,CACL;AAEV,CAAC;AAEM,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB;IACE,MAAM;IACN,UAAU;IACV,YAAY;CACb,EACD,SAAS;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubTitle.js","sources":["../../../src/elements/SubTitle.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validSubTitleSizes = ['1', '2', '3', '4', '5', '6'] as const;\n/**\n * Valid size values for the SubTitle component (Bulma subtitle sizes): `'1'`–`'6'` as a string or number (`3` and `'3'` are equivalent).\n */\nexport type SubTitleSize =\n '1' | '2' | '3' | '4' | '5' | '6' | 1 | 2 | 3 | 4 | 5 | 6;\n\nconst validSubTitleElements = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'p',\n] as const;\n/**\n * Valid HTML elements for the SubTitle component.\n */\nexport type SubTitleElement = (typeof validSubTitleElements)[number];\n\n/**\n * Props for the SubTitle component.\n * @extraProp {boolean} [skeleton] - Applies the `is-skeleton` class to the entire component.\n */\nexport interface SubTitleProps\n extends\n Omit<\n React.HTMLAttributes<HTMLHeadingElement | HTMLParagraphElement>,\n 'color'\n >,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Size of the subtitle (Bulma sizes `1`-`6`, as a string or number). */\n size?: SubTitleSize;\n /** HTML element to render as (h1-h6 or p). */\n as?: SubTitleElement;\n /** Applies the `has-skeleton` class to part of the content. */\n hasSkeleton?: boolean;\n /** Subtitle content. */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `SubTitle` component renders a Bulma-styled subtitle (secondary heading), supporting sizes `1-6` and rendering as any heading or paragraph element (`h1-h6`, `p`).\n *\n * @function\n * @param {SubTitleProps} props - Props for the SubTitle component.\n * @returns {JSX.Element} The rendered subtitle element.\n * @see {@link https://bulma.io/documentation/elements/title/#subtitle | Bulma Subtitle documentation}\n */\nexport const SubTitle: React.FC<SubTitleProps> = ({\n className,\n size,\n as = 'h1',\n hasSkeleton,\n textColor,\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,\n backgroundColor: bgColor,\n ...props,\n });\n\n // Validate 'as' prop at runtime\n const element = validSubTitleElements.includes(as) ? as : 'h1';\n\n // Validate 'size' prop at runtime (numeric sizes normalize to strings)\n const normalized = size == null ? undefined : String(size);\n const validSize =\n normalized && (validSubTitleSizes as readonly string[]).includes(normalized)\n ? (normalized as (typeof validSubTitleSizes)[number])\n : undefined;\n\n const bulmaClasses = usePrefixedClassNames('subtitle', {\n [`is-${validSize}`]: validSize,\n 'has-skeleton': hasSkeleton,\n });\n\n const subTitleClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n // Determine the tag based on 'element' and 'validSize'\n const Tag: React.ElementType =\n element === 'p' ? 'p' : validSize ? `h${validSize}` : element;\n\n return (\n <Tag className={subTitleClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\nexport default SubTitle;\n"],"names":["_jsx"],"mappings":";;;;;AAQA,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU;AAOlE,MAAM,qBAAqB,GAAG;IAC5B,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,GAAG;CACK;AAiCV;;;;;;;AAOG;AACI,MAAM,QAAQ,GAA4B,CAAC,EAChD,SAAS,EACT,IAAI,EACJ,EAAE,GAAG,IAAI,EACT,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;;AAGF,IAAA,MAAM,OAAO,GAAG,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;;AAG9D,IAAA,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1D,MAAM,SAAS,GACb,UAAU,IAAK,kBAAwC,CAAC,QAAQ,CAAC,UAAU;AACzE,UAAG;UACD,SAAS;AAEf,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,UAAU,EAAE;AACrD,QAAA,CAAC,CAAA,GAAA,EAAM,SAAS,CAAA,CAAE,GAAG,SAAS;AAC9B,QAAA,cAAc,EAAE,WAAW;AAC5B,KAAA,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAChC,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;;IAGD,MAAM,GAAG,GACP,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,SAAS,GAAG,CAAA,CAAA,EAAI,SAAS,EAAE,GAAG,OAAO;AAE/D,IAAA,QACEA,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACtC,QAAQ,EAAA,CACL;AAEV;;"}
1
+ {"version":3,"file":"SubTitle.js","sources":["../../../src/elements/SubTitle.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validSubTitleSizes = ['1', '2', '3', '4', '5', '6'] as const;\n/**\n * Valid size values for the SubTitle component (Bulma subtitle sizes): `'1'`–`'6'` as a string or number (`3` and `'3'` are equivalent).\n */\nexport type SubTitleSize =\n '1' | '2' | '3' | '4' | '5' | '6' | 1 | 2 | 3 | 4 | 5 | 6;\n\nconst validSubTitleElements = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'p',\n] as const;\n/**\n * Valid HTML elements for the SubTitle component.\n */\nexport type SubTitleElement = (typeof validSubTitleElements)[number];\n\n/**\n * Props for the SubTitle component.\n * @extraProp {boolean} [skeleton] - Applies the `is-skeleton` class to the entire component.\n */\nexport interface SubTitleProps\n extends\n Omit<\n React.HTMLAttributes<HTMLHeadingElement | HTMLParagraphElement>,\n 'color'\n >,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * Size of the subtitle (Bulma sizes `1`-`6`, as a string or number). It\n * also picks the heading level: unless `as` is `p`, `size=\"5\"` renders an\n * `<h5>`, whatever `as` says. For a heading whose level and size differ,\n * set the level with `as` and the size with the `textSize` helper.\n */\n size?: SubTitleSize;\n /**\n * HTML element to render as (`h1`-`h6` or `p`). With neither `as` nor\n * `size` set it's an `<h1>`, so a subtitle that isn't a heading of its own\n * takes `as=\"p\"`. A `size` overrides `as` unless it's `p`, so\n * `as=\"h3\" size=\"5\"` renders an `<h5>`. To keep the level `as` sets, size\n * the subtitle with the `textSize` helper instead.\n */\n as?: SubTitleElement;\n /** Applies the `has-skeleton` class to part of the content. */\n hasSkeleton?: boolean;\n /** Subtitle content. */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `SubTitle` component renders a Bulma-styled subtitle (secondary heading), supporting sizes `1-6` and rendering as any heading or paragraph element (`h1-h6`, `p`).\n *\n * @function\n * @param {SubTitleProps} props - Props for the SubTitle component.\n * @returns {JSX.Element} The rendered subtitle element.\n * @see {@link https://bulma.io/documentation/elements/title/#subtitle | Bulma Subtitle documentation}\n */\nexport const SubTitle: React.FC<SubTitleProps> = ({\n className,\n size,\n as = 'h1',\n hasSkeleton,\n textColor,\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,\n backgroundColor: bgColor,\n ...props,\n });\n\n // Validate 'as' prop at runtime\n const element = validSubTitleElements.includes(as) ? as : 'h1';\n\n // Validate 'size' prop at runtime (numeric sizes normalize to strings)\n const normalized = size == null ? undefined : String(size);\n const validSize =\n normalized && (validSubTitleSizes as readonly string[]).includes(normalized)\n ? (normalized as (typeof validSubTitleSizes)[number])\n : undefined;\n\n const bulmaClasses = usePrefixedClassNames('subtitle', {\n [`is-${validSize}`]: validSize,\n 'has-skeleton': hasSkeleton,\n });\n\n const subTitleClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n // Determine the tag based on 'element' and 'validSize'\n const Tag: React.ElementType =\n element === 'p' ? 'p' : validSize ? `h${validSize}` : element;\n\n return (\n <Tag className={subTitleClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\nexport default SubTitle;\n"],"names":["_jsx"],"mappings":";;;;;AAQA,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU;AAOlE,MAAM,qBAAqB,GAAG;IAC5B,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,GAAG;CACK;AA4CV;;;;;;;AAOG;AACI,MAAM,QAAQ,GAA4B,CAAC,EAChD,SAAS,EACT,IAAI,EACJ,EAAE,GAAG,IAAI,EACT,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;;AAGF,IAAA,MAAM,OAAO,GAAG,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;;AAG9D,IAAA,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1D,MAAM,SAAS,GACb,UAAU,IAAK,kBAAwC,CAAC,QAAQ,CAAC,UAAU;AACzE,UAAG;UACD,SAAS;AAEf,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,UAAU,EAAE;AACrD,QAAA,CAAC,CAAA,GAAA,EAAM,SAAS,CAAA,CAAE,GAAG,SAAS;AAC9B,QAAA,cAAc,EAAE,WAAW;AAC5B,KAAA,CAAC;IAEF,MAAM,eAAe,GAAG,UAAU,CAChC,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;;IAGD,MAAM,GAAG,GACP,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,SAAS,GAAG,CAAA,CAAA,EAAI,SAAS,EAAE,GAAG,OAAO;AAE/D,IAAA,QACEA,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACtC,QAAQ,EAAA,CACL;AAEV;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Title.js","sources":["../../../src/elements/Title.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validTitleSizes = ['1', '2', '3', '4', '5', '6'] as const;\n/**\n * Valid size values for the Title component (Bulma title sizes): `'1'`–`'6'` as a string or number (`3` and `'3'` are equivalent).\n */\nexport type TitleSize =\n '1' | '2' | '3' | '4' | '5' | '6' | 1 | 2 | 3 | 4 | 5 | 6;\n\nconst validTitleElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'] as const;\n/**\n * Valid HTML elements for the Title component.\n */\nexport type TitleElement = (typeof validTitleElements)[number];\n\n/**\n * Props for the Title component.\n * @extraProp {boolean} [skeleton] - Applies the `is-skeleton` class to the entire component.\n */\nexport interface TitleProps\n extends\n Omit<\n React.HTMLAttributes<HTMLHeadingElement | HTMLParagraphElement>,\n 'color'\n >,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Size of the title (Bulma sizes `1`-`6`, as a string or number). */\n size?: TitleSize;\n /** Adds margin below the title. */\n isSpaced?: boolean;\n /** HTML element to render as (h1-h6 or p). */\n as?: TitleElement;\n /** Applies the `has-skeleton` class to part of the content. */\n hasSkeleton?: boolean;\n /** Title content. */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `Title` component renders a Bulma-styled title (heading), supporting sizes `1`-`6`, spacing, and rendering as any heading or paragraph element (`h1`-`h6`, `p`).\n *\n * @function\n * @param {TitleProps} props - Props for the Title component.\n * @returns {JSX.Element} The rendered title element.\n * @see {@link https://bulma.io/documentation/elements/title/ | Bulma Title documentation}\n */\nexport const Title: React.FC<TitleProps> = ({\n className,\n size,\n isSpaced,\n as = 'h1',\n hasSkeleton,\n textColor,\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,\n backgroundColor: bgColor,\n ...props,\n });\n\n // Validate 'as' prop at runtime\n const element = validTitleElements.includes(as) ? as : 'h1';\n\n // Validate 'size' prop at runtime (numeric sizes normalize to strings)\n const normalized = size == null ? undefined : String(size);\n const validSize =\n normalized && (validTitleSizes as readonly string[]).includes(normalized)\n ? (normalized as (typeof validTitleSizes)[number])\n : undefined;\n\n const bulmaClasses = usePrefixedClassNames('title', {\n [`is-${validSize}`]: validSize,\n 'is-spaced': isSpaced,\n 'has-skeleton': hasSkeleton,\n });\n\n const titleClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n // Determine the tag based on 'element' and 'validSize'\n const Tag: React.ElementType =\n element === 'p' ? 'p' : validSize ? `h${validSize}` : element;\n\n return (\n <Tag className={titleClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\nexport default Title;\n"],"names":["_jsx"],"mappings":";;;;;AAQA,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU;AAO/D,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAU;AAmC7E;;;;;;;AAOG;AACI,MAAM,KAAK,GAAyB,CAAC,EAC1C,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,EAAE,GAAG,IAAI,EACT,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;;AAGF,IAAA,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;;AAG3D,IAAA,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1D,MAAM,SAAS,GACb,UAAU,IAAK,eAAqC,CAAC,QAAQ,CAAC,UAAU;AACtE,UAAG;UACD,SAAS;AAEf,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,EAAE;AAClD,QAAA,CAAC,CAAA,GAAA,EAAM,SAAS,CAAA,CAAE,GAAG,SAAS;AAC9B,QAAA,WAAW,EAAE,QAAQ;AACrB,QAAA,cAAc,EAAE,WAAW;AAC5B,KAAA,CAAC;IAEF,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;;IAG5E,MAAM,GAAG,GACP,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,SAAS,GAAG,CAAA,CAAA,EAAI,SAAS,EAAE,GAAG,OAAO;AAE/D,IAAA,QACEA,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,YAAY,EAAA,GAAM,IAAI,EAAA,QAAA,EACnC,QAAQ,EAAA,CACL;AAEV;;"}
1
+ {"version":3,"file":"Title.js","sources":["../../../src/elements/Title.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\nconst validTitleSizes = ['1', '2', '3', '4', '5', '6'] as const;\n/**\n * Valid size values for the Title component (Bulma title sizes): `'1'`–`'6'` as a string or number (`3` and `'3'` are equivalent).\n */\nexport type TitleSize =\n '1' | '2' | '3' | '4' | '5' | '6' | 1 | 2 | 3 | 4 | 5 | 6;\n\nconst validTitleElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'] as const;\n/**\n * Valid HTML elements for the Title component.\n */\nexport type TitleElement = (typeof validTitleElements)[number];\n\n/**\n * Props for the Title component.\n * @extraProp {boolean} [skeleton] - Applies the `is-skeleton` class to the entire component.\n */\nexport interface TitleProps\n extends\n Omit<\n React.HTMLAttributes<HTMLHeadingElement | HTMLParagraphElement>,\n 'color'\n >,\n Omit<BulmaClassesProps, 'backgroundColor' | 'color'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * Size of the title (Bulma sizes `1`-`6`, as a string or number). It also\n * picks the heading level: unless `as` is `p`, `size=\"4\"` renders an\n * `<h4>`, whatever `as` says. For a heading whose level and size differ,\n * set the level with `as` and the size with the `textSize` helper.\n */\n size?: TitleSize;\n /** Adds margin below the title. */\n isSpaced?: boolean;\n /**\n * HTML element to render as (`h1`-`h6` or `p`). A `size` overrides it\n * unless it's `p`, so `as=\"h2\" size=\"4\"` renders an `<h4>`. To keep the\n * level `as` sets, size the title with the `textSize` helper instead.\n */\n as?: TitleElement;\n /** Applies the `has-skeleton` class to part of the content. */\n hasSkeleton?: boolean;\n /** Title content. */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `Title` component renders a Bulma-styled title (heading), supporting sizes `1`-`6`, spacing, and rendering as any heading or paragraph element (`h1`-`h6`, `p`).\n *\n * @function\n * @param {TitleProps} props - Props for the Title component.\n * @returns {JSX.Element} The rendered title element.\n * @see {@link https://bulma.io/documentation/elements/title/ | Bulma Title documentation}\n */\nexport const Title: React.FC<TitleProps> = ({\n className,\n size,\n isSpaced,\n as = 'h1',\n hasSkeleton,\n textColor,\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,\n backgroundColor: bgColor,\n ...props,\n });\n\n // Validate 'as' prop at runtime\n const element = validTitleElements.includes(as) ? as : 'h1';\n\n // Validate 'size' prop at runtime (numeric sizes normalize to strings)\n const normalized = size == null ? undefined : String(size);\n const validSize =\n normalized && (validTitleSizes as readonly string[]).includes(normalized)\n ? (normalized as (typeof validTitleSizes)[number])\n : undefined;\n\n const bulmaClasses = usePrefixedClassNames('title', {\n [`is-${validSize}`]: validSize,\n 'is-spaced': isSpaced,\n 'has-skeleton': hasSkeleton,\n });\n\n const titleClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n // Determine the tag based on 'element' and 'validSize'\n const Tag: React.ElementType =\n element === 'p' ? 'p' : validSize ? `h${validSize}` : element;\n\n return (\n <Tag className={titleClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\nexport default Title;\n"],"names":["_jsx"],"mappings":";;;;;AAQA,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU;AAO/D,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAU;AA4C7E;;;;;;;AAOG;AACI,MAAM,KAAK,GAAyB,CAAC,EAC1C,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,EAAE,GAAG,IAAI,EACT,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AAC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