@allxsmith/bestax-bulma 5.18.2 → 5.19.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 (64) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/constants.cjs +67 -6
  4. package/dist/constants.cjs.map +1 -1
  5. package/dist/constants.d.cts +30 -6
  6. package/dist/constants.esm.js +65 -7
  7. package/dist/constants.esm.js.map +1 -1
  8. package/dist/extras.css +1 -1
  9. package/dist/extras.css.map +1 -1
  10. package/dist/index.cjs +598 -52
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.esm.js +596 -53
  13. package/dist/index.esm.js.map +1 -1
  14. package/dist/types/components/Card.d.ts +2 -0
  15. package/dist/types/components/Carousel.d.ts +8 -2
  16. package/dist/types/components/Modal.d.ts +2 -0
  17. package/dist/types/components/Navbar.d.ts +24 -3
  18. package/dist/types/components/Sidebar.d.ts +2 -0
  19. package/dist/types/components/Steps.d.ts +5 -1
  20. package/dist/types/elements/Delete.d.ts +9 -1
  21. package/dist/types/elements/Link.d.ts +7 -1
  22. package/dist/types/elements/Notification.d.ts +29 -3
  23. package/dist/types/elements/Tag.d.ts +7 -1
  24. package/dist/types/elements/Td.d.ts +21 -2
  25. package/dist/types/form/DateInputBase.d.ts +9 -1
  26. package/dist/types/form/DateTimeInputBase.d.ts +11 -4
  27. package/dist/types/form/TimeInputBase.d.ts +4 -2
  28. package/dist/types/helpers/Theme.d.ts +6 -1
  29. package/dist/types/helpers/bulmaClassHelpers.d.ts +30 -6
  30. package/dist/types/helpers/shadowDom.d.ts +54 -0
  31. package/dist/types/helpers/statusRegion.d.ts +61 -0
  32. package/dist/types/helpers/useBulmaClasses.d.ts +1 -1
  33. package/dist/types/helpers/useOtherClasses.d.ts +61 -5
  34. package/dist/types-cjs/components/Card.d.ts +2 -0
  35. package/dist/types-cjs/components/Carousel.d.ts +8 -2
  36. package/dist/types-cjs/components/Modal.d.ts +2 -0
  37. package/dist/types-cjs/components/Navbar.d.ts +24 -3
  38. package/dist/types-cjs/components/Sidebar.d.ts +2 -0
  39. package/dist/types-cjs/components/Steps.d.ts +5 -1
  40. package/dist/types-cjs/elements/Delete.d.ts +9 -1
  41. package/dist/types-cjs/elements/Link.d.ts +7 -1
  42. package/dist/types-cjs/elements/Notification.d.ts +29 -3
  43. package/dist/types-cjs/elements/Tag.d.ts +7 -1
  44. package/dist/types-cjs/elements/Td.d.ts +21 -2
  45. package/dist/types-cjs/form/DateInputBase.d.ts +9 -1
  46. package/dist/types-cjs/form/DateTimeInputBase.d.ts +11 -4
  47. package/dist/types-cjs/form/TimeInputBase.d.ts +4 -2
  48. package/dist/types-cjs/helpers/Theme.d.ts +6 -1
  49. package/dist/types-cjs/helpers/bulmaClassHelpers.d.ts +30 -6
  50. package/dist/types-cjs/helpers/shadowDom.d.ts +54 -0
  51. package/dist/types-cjs/helpers/statusRegion.d.ts +61 -0
  52. package/dist/types-cjs/helpers/useBulmaClasses.d.ts +1 -1
  53. package/dist/types-cjs/helpers/useOtherClasses.d.ts +61 -5
  54. package/dist/versions/bestax-no-dark-mode.css +1 -1
  55. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  56. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  57. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  58. package/dist/versions/bestax-no-helpers.css +1 -1
  59. package/dist/versions/bestax-no-helpers.css.map +1 -1
  60. package/dist/versions/bestax-prefixed.css +1 -1
  61. package/dist/versions/bestax-prefixed.css.map +1 -1
  62. package/package.json +1 -1
  63. package/src/scss/form/_dateinput.scss +36 -10
  64. package/src/scss/form/_timeinput.scss +30 -9
@@ -156,6 +156,8 @@ export interface CardHeaderTitleProps extends React.HTMLAttributes<HTMLDivElemen
156
156
  }
157
157
  /**
158
158
  * Props for the Card.Header.Icon compound component.
159
+ * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a header icon inside a form does not submit it. Pass `'submit'` or `'reset'` and yours is used; any other value, or a spread carrying `type: undefined`, renders `'button'`.
160
+ * @extraProp {string} [aria-label='more options'] - Accessible name. Pass your own to replace it. An empty one, or a spread carrying `'aria-label': undefined`, keeps the default rather than leaving the button unnamed.
159
161
  */
160
162
  export interface CardHeaderIconProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
161
163
  /** Bulma color modifier (text color helper). */
@@ -38,11 +38,17 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
38
38
  repeat?: boolean;
39
39
  /** Enable drag/swipe navigation. Default: true. */
40
40
  hasDrag?: boolean;
41
- /** Show navigation arrows. Default: true. */
41
+ /**
42
+ * Show navigation arrows. Default: true. They render `type="button"`, so a
43
+ * carousel inside a form is not submitted by moving between slides.
44
+ */
42
45
  arrow?: boolean;
43
46
  /** Only show arrows on hover. */
44
47
  arrowHover?: boolean;
45
- /** Show slide indicators. Default: true. */
48
+ /**
49
+ * Show slide indicators. Default: true. They render `type="button"`, so a
50
+ * carousel inside a form is not submitted by picking a slide.
51
+ */
46
52
  indicator?: boolean;
47
53
  /** Position indicators inside carousel. */
48
54
  indicatorInside?: boolean;
@@ -103,6 +103,8 @@ export interface ModalCardFootProps extends React.HTMLAttributes<HTMLElement> {
103
103
  }
104
104
  /**
105
105
  * Props for Modal.Close component.
106
+ * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a close button inside a form does not submit it. Pass `'submit'` or `'reset'` and yours is used; any other value, or a spread carrying `type: undefined`, renders `'button'`.
107
+ * @extraProp {string} [aria-label='close'] - Accessible name. Pass your own to replace it. An empty one, or a spread carrying `'aria-label': undefined`, keeps the default rather than leaving the button unnamed.
106
108
  */
107
109
  export interface ModalCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
108
110
  /** Additional CSS classes. */
@@ -86,7 +86,13 @@ export interface NavbarItemOwnProps extends Omit<BulmaClassesProps, 'color' | 'b
86
86
  * @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.
87
87
  */
88
88
  export type NavbarItemProps<T extends React.ElementType = 'a'> = NavbarItemOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof NavbarItemOwnProps | 'as'> & {
89
- /** Render as another intrinsic element (`'span'`, `'div'`) or a custom component (e.g. a router link). Defaults to `'a'`. */
89
+ /**
90
+ * Render as another intrinsic element (`'span'`, `'div'`, `'button'`) or a custom component (e.g. a router link). Defaults to `'a'`.
91
+ *
92
+ * `'button'` renders `type="button"`, so an item inside a form does not submit it. Pass
93
+ * `type="submit"` or `type="reset"` and yours is used; any other value, or a spread
94
+ * carrying `type: undefined`, renders `type="button"`.
95
+ */
90
96
  as?: T;
91
97
  };
92
98
  /**
@@ -101,6 +107,7 @@ export declare const NavbarItem: PolymorphicComponent<NavbarItemOwnProps, "a">;
101
107
  /**
102
108
  * Props for the NavbarBurger component.
103
109
  * @extraProp {React.Ref<HTMLButtonElement>} [ref] - Ref forwarded to the burger button element.
110
+ * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a burger inside a form does not submit it. Pass `'submit'` or `'reset'` and yours is used; any other value, or a spread carrying `type: undefined`, renders `'button'`.
104
111
  */
105
112
  export interface NavbarBurgerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
106
113
  /** Additional CSS classes. */
@@ -122,9 +129,19 @@ export interface NavbarBurgerProps extends React.ButtonHTMLAttributes<HTMLButton
122
129
  * draws an extra bar.
123
130
  */
124
131
  children?: React.ReactNode;
125
- /** Aria label for accessibility. */
132
+ /**
133
+ * Accessible name. Pass your own to replace it. An empty one, or a spread
134
+ * carrying `'aria-label': undefined`, keeps the default rather than leaving
135
+ * the button unnamed.
136
+ * @defaultValue 'menu'
137
+ */
126
138
  'aria-label'?: string;
127
- /** Aria expanded state. */
139
+ /**
140
+ * Expanded state for assistive technology. It follows `active` unless you
141
+ * pass `true` or `false`; a spread carrying `'aria-expanded': undefined`
142
+ * still follows `active`.
143
+ * @defaultValue active
144
+ */
128
145
  'aria-expanded'?: boolean;
129
146
  /** Click handler. */
130
147
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
@@ -254,6 +271,10 @@ export type NavbarLinkProps<T extends React.ElementType = 'a'> = NavbarLinkOwnPr
254
271
  * If your custom component renders something non-interactive, pass `role="button"` and
255
272
  * it takes that fallback too — `tabIndex` and click included. The keyboard path is
256
273
  * attached either way.
274
+ *
275
+ * `'button'` renders `type="button"`, so a link inside a form does not submit it. Pass
276
+ * `type="submit"` or `type="reset"` and yours is used; any other value, or a spread
277
+ * carrying `type: undefined`, renders `type="button"`.
257
278
  */
258
279
  as?: T;
259
280
  };
@@ -50,6 +50,8 @@ interface SidebarTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {
50
50
  /**
51
51
  * Props for the SidebarClose component.
52
52
  * Extends standard button attributes.
53
+ * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a close button inside a form does not submit it. Pass `'submit'` or `'reset'` and yours is used; any other value, or a spread carrying `type: undefined`, renders `'button'`.
54
+ * @extraProp {string} [aria-label='Close'] - Accessible name. Pass your own to replace it. An empty one, or a spread carrying `'aria-label': undefined`, keeps the default rather than leaving the button unnamed.
53
55
  */
54
56
  type SidebarCloseProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
55
57
  /**
@@ -50,7 +50,11 @@ export interface StepsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
50
50
  mobileMode?: 'minimal' | 'compact' | 'right';
51
51
  /** Displays step numbers in the markers. */
52
52
  showStepNumbers?: boolean;
53
- /** Shows previous/next navigation buttons. */
53
+ /**
54
+ * Shows previous/next navigation buttons. They render `type="button"`, so a
55
+ * multi-step form wrapped around the steps is not submitted by moving
56
+ * between them.
57
+ */
54
58
  hasNavigation?: boolean;
55
59
  /** Label for the previous button. */
56
60
  prevLabel?: string;
@@ -21,7 +21,13 @@ interface DeleteProps extends React.HTMLAttributes<HTMLButtonElement>, BulmaClas
21
21
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
22
22
  /** Size modifier for the delete button. */
23
23
  size?: 'small' | 'medium' | 'large';
24
- /** ARIA label for accessibility (default: 'Close'). */
24
+ /**
25
+ * Accessible name for the button. An `aria-label` you pass takes precedence
26
+ * over it, unless it is empty or arrives as `undefined` through a spread.
27
+ * An empty `ariaLabel` falls back to the default too, so the button is never
28
+ * left unnamed.
29
+ * @defaultValue 'Close'
30
+ */
25
31
  ariaLabel?: string;
26
32
  /** Whether the button is disabled (default: false). */
27
33
  disabled?: boolean;
@@ -29,6 +35,8 @@ interface DeleteProps extends React.HTMLAttributes<HTMLButtonElement>, BulmaClas
29
35
  /**
30
36
  * The `Delete` component provides a Bulma-styled close/delete button for dismissing modals, notifications, tags, messages, and more.
31
37
  *
38
+ * It renders `type="button"`, so a delete button inside a form does not submit it.
39
+ *
32
40
  * @function
33
41
  * @param {DeleteProps} props - Props for the Delete component.
34
42
  * @returns {JSX.Element} The rendered delete button.
@@ -40,7 +40,13 @@ export interface LinkOwnProps extends Omit<BulmaClassesProps, 'color' | 'backgro
40
40
  * @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.
41
41
  */
42
42
  export type LinkProps<T extends React.ElementType = 'a'> = LinkOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof LinkOwnProps | 'as'> & {
43
- /** Render as another intrinsic element (`'span'`, `'button'`) or a custom component (e.g. a router `Link`) instead of `<a>`. Defaults to `'a'`. */
43
+ /**
44
+ * Render as another intrinsic element (`'span'`, `'button'`) or a custom component (e.g. a router `Link`) instead of `<a>`. Defaults to `'a'`.
45
+ *
46
+ * `'button'` renders `type="button"`, so a link inside a form does not submit it. Pass
47
+ * `type="submit"` or `type="reset"` and yours is used; any other value, or a spread
48
+ * carrying `type: undefined`, renders `type="button"`.
49
+ */
44
50
  as?: T;
45
51
  };
46
52
  /**
@@ -20,7 +20,10 @@ export interface NotificationProps extends React.HTMLAttributes<HTMLDivElement>,
20
20
  textColor?: (typeof validColors)[number] | 'inherit' | 'current';
21
21
  /** Use the light color variant. */
22
22
  isLight?: boolean;
23
- /** Shows a close (delete) button in the notification. */
23
+ /**
24
+ * Shows a close (delete) button in the notification. It renders
25
+ * `type="button"`, so it does not submit a form around it.
26
+ */
24
27
  hasDelete?: boolean;
25
28
  /** Callback fired when the delete button is clicked. */
26
29
  onDelete?: () => void;
@@ -42,7 +45,18 @@ export type NotificationPosition = 'top-left' | 'top' | 'top-right' | 'bottom-le
42
45
  * Options for showing a programmatic notification.
43
46
  */
44
47
  export interface NotificationOptions {
45
- /** The message to display. */
48
+ /**
49
+ * The message to display.
50
+ *
51
+ * For a notification other than `danger` and `warning`, NotificationContainer
52
+ * announces the text the message renders, with an element's `aria-label`,
53
+ * or an image's `alt`, standing in for what's inside it, a break between
54
+ * block-level elements, and parts that are `aria-hidden`, `hidden` or
55
+ * inline-styled `display: none` left out. Other ways of naming or hiding
56
+ * content, such as `aria-labelledby`, CSS-generated content or a
57
+ * stylesheet's `display: none`, aren't followed, so a message that relies on
58
+ * them can be announced differently from what a screen reader would read.
59
+ */
46
60
  message: string | React.ReactNode;
47
61
  /**
48
62
  * Bulma color modifier for the notification (renders `is-<color>`).
@@ -147,9 +161,21 @@ export declare const notification: {
147
161
  * container's `position`, so the container renders a stack for each position
148
162
  * in use.
149
163
  *
164
+ * It keeps a visually hidden `role="status"` live region in the page from the
165
+ * moment it mounts, even while nothing is showing, and announces every
166
+ * notification other than `danger` and `warning` through it, a moment after
167
+ * the notification appears. Those notifications carry no `role="status"` of
168
+ * their own, so `getByRole('status')` finds the region, not the notification.
169
+ * The text stays in the region briefly, even if the notification closes in
170
+ * the meantime, and while both are up the page holds two copies of it. A
171
+ * polite notification that closes before its announcement is written, a
172
+ * moment after it appears, isn't announced at all. `danger` and `warning`
173
+ * notifications announce themselves as assertive alerts. The region is hidden
174
+ * with inline styles, so it needs no stylesheet.
175
+ *
150
176
  * @function
151
177
  * @param {{ position?: NotificationPosition }} props - Container props.
152
- * @returns {JSX.Element | null} The rendered notification container, or null if empty.
178
+ * @returns {JSX.Element | null} The rendered notification container, or null on the server and while hydrating.
153
179
  */
154
180
  export declare const NotificationContainer: React.FC<{
155
181
  /**
@@ -24,7 +24,13 @@ export interface TagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'c
24
24
  isLight?: boolean;
25
25
  /** Renders a rounded tag. */
26
26
  isRounded?: boolean;
27
- /** Renders a delete-style tag (delete button). */
27
+ /**
28
+ * Renders a delete-style tag (delete button). The button renders
29
+ * `type="button"`, so it does not submit a form around it, and is named
30
+ * "Delete tag" unless you pass an `aria-label`. An empty one, or a spread
31
+ * carrying `'aria-label': undefined`, keeps that name rather than leaving
32
+ * the button unnamed.
33
+ */
28
34
  isDelete?: boolean;
29
35
  /** Adds hover effect to the tag. */
30
36
  isHoverable?: boolean;
@@ -3,10 +3,29 @@
3
3
  */
4
4
  import React from 'react';
5
5
  import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
6
- /** Valid Bulma color values for table cells. */
6
+ /**
7
+ * The values the table `color` prop accepts, as a readonly tuple.
8
+ *
9
+ * `TableColor` is typed from it, and `Tr`, `Th` and `Td` all take a
10
+ * `TableColor`, so the tuple and those props list the same values. Map over
11
+ * it to build a color picker, or check a value that arrives at runtime before
12
+ * passing it in: the components add no color class for a value outside the
13
+ * tuple.
14
+ *
15
+ * @example
16
+ * import { Tr, Td, validTableColors } from '@allxsmith/bestax-bulma';
17
+ *
18
+ * <Tr>
19
+ * {validTableColors.map(color => (
20
+ * <Td key={color} color={color}>
21
+ * {color}
22
+ * </Td>
23
+ * ))}
24
+ * </Tr>;
25
+ */
7
26
  export declare const validTableColors: readonly ["primary", "link", "info", "success", "warning", "danger", "black", "dark", "light", "white"];
8
27
  /**
9
- * Valid color values for the Td component (Bulma table cell colors).
28
+ * The color values `Tr`, `Th` and `Td` accept, typed from `validTableColors`.
10
29
  */
11
30
  export type TableColor = (typeof validTableColors)[number];
12
31
  /**
@@ -52,7 +52,15 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
52
52
  position?: PickerPosition;
53
53
  /** Render the popover into `document.body` via portal. */
54
54
  appendToBody?: boolean;
55
- /** Bulma color modifier. */
55
+ /**
56
+ * Bulma color modifier for the input, also carried by the calendar, where it
57
+ * colors the selected date. Today's date and the keyboard focus ring take
58
+ * the color's `-on-scheme` variant, which Bulma adjusts to contrast with the
59
+ * background, so pale colors stay readable; that makes `'primary'` a shade
60
+ * off the unset calendar, which uses plain `primary` for both. Unset, the
61
+ * calendar uses its `--bulma-dateinput-*` variables, which follow `primary`
62
+ * by default.
63
+ */
56
64
  color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
57
65
  /** Size variant. */
58
66
  size?: 'small' | 'medium' | 'large';
@@ -54,10 +54,17 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
54
54
  /** Render the popover into `document.body` via portal. */
55
55
  appendToBody?: boolean;
56
56
  /**
57
- * Bulma color modifier for the input, also carried by the time wheels, where
58
- * it colors the selection band and the keyboard focus ring. Unset, the
59
- * wheels use `--bulma-timeinput-wheel-selected-bg`, which defaults to
60
- * `primary`. The calendar does not take it.
57
+ * Bulma color modifier for the input, also carried by the calendar and the
58
+ * time wheels, where it colors the selected date and the selection band.
59
+ * Today's date and the calendar's keyboard focus ring take the color's
60
+ * `-on-scheme` variant, which Bulma adjusts to contrast with the background,
61
+ * so pale colors stay readable; that makes `'primary'` a shade off the unset
62
+ * calendar, which uses plain `primary` for them. A focused wheel's ring is
63
+ * drawn inside the band in the color's `-invert`, like the selected value,
64
+ * so it shows on the fill. Unset, they use their
65
+ * `--bulma-dateinput-*` and `--bulma-timeinput-wheel-*` variables, which
66
+ * follow `primary` by default. The footer's time pill and Done button stay
67
+ * `primary` either way.
61
68
  */
62
69
  color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
63
70
  /** Size variant. */
@@ -54,8 +54,10 @@ export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
54
54
  appendToBody?: boolean;
55
55
  /**
56
56
  * Bulma color modifier for the input, also carried by the wheels, where it
57
- * colors the selection band and the keyboard focus ring. Unset, the wheels
58
- * use `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.
57
+ * colors the selection band. A focused wheel's keyboard focus ring is drawn
58
+ * inside the band in the color's `-invert`, like the selected value, so it
59
+ * shows on the fill. Unset, the wheels use
60
+ * `--bulma-timeinput-wheel-selected-bg`, which defaults to `primary`.
59
61
  */
60
62
  color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';
61
63
  /** Size variant. */
@@ -77,7 +77,12 @@ export interface ThemeProps extends Omit<BulmaClassesProps, 'color' | 'backgroun
77
77
  * written at `:root`, which squares everything on the page that takes its
78
78
  * radius from it.
79
79
  *
80
- * For any other radius, set the variable through `bulmaVars`
80
+ * The sizes (`small`, `normal`, `large`, `rounded`) add their
81
+ * `has-radius-<value>` class to the wrapper div and set no variable, so
82
+ * they round the wrapper and leave what is inside it alone. Under `isRoot`
83
+ * there is no wrapper, so they do nothing, and say so in development.
84
+ *
85
+ * To change the radius of what is inside, set the variable through `bulmaVars`
81
86
  * (`bulmaVars={{ '--bulma-radius': '6px' }}`). This prop used to write the
82
87
  * variable for every value, so any other non-empty string still does, but
83
88
  * that route is deprecated and logs a warning in development. A number or
@@ -104,10 +104,31 @@ export declare const validViewports: readonly ["mobile", "tablet", "tablet-only"
104
104
  */
105
105
  export declare const validFloats: readonly ["left", "right"];
106
106
  /**
107
- * Valid Bulma overflow classes.
108
- * @example 'clipped'
107
+ * Valid Bulma overflow values for one axis, taken by `overflowX` and
108
+ * `overflowY`. Each renders `is-overflow-x-<value>` or `is-overflow-y-<value>`.
109
+ * @example 'auto', 'hidden', 'scroll'
109
110
  */
110
- export declare const validOverflows: readonly ["clipped"];
111
+ export declare const validAxisOverflows: readonly ["auto", "clip", "hidden", "scroll", "visible"];
112
+ /**
113
+ * Valid Bulma overflow values for `overflow`.
114
+ *
115
+ * `clipped` renders `is-clipped`, the helper `overflow` started with. Every
116
+ * other value renders `is-overflow-<value>`.
117
+ * @example 'clipped', 'auto', 'hidden'
118
+ */
119
+ export declare const validOverflows: readonly ["clipped", "auto", "clip", "hidden", "scroll", "visible"];
120
+ /**
121
+ * Valid Bulma position values, taken by `pos`. Each renders
122
+ * `is-position-<value>`.
123
+ * @example 'relative', 'absolute', 'sticky'
124
+ */
125
+ export declare const validPositions: readonly ["absolute", "fixed", "relative", "static", "sticky"];
126
+ /**
127
+ * Valid Bulma aspect ratios, taken by `aspectRatio`. Each renders
128
+ * `is-aspect-ratio-<value>`.
129
+ * @example '1by1', '4by3', '16by9'
130
+ */
131
+ export declare const validAspectRatios: readonly ["1by1", "5by4", "4by3", "3by2", "5by3", "16by9", "2by1", "3by1", "4by5", "3by4", "2by3", "3by5", "9by16", "1by2", "1by3"];
111
132
  /**
112
133
  * Valid Bulma interaction classes.
113
134
  * @example 'unselectable', 'clickable'
@@ -132,10 +153,13 @@ export declare const validCursors: readonly ["pointer", "help"];
132
153
  */
133
154
  export declare const cursorClasses: Record<(typeof validCursors)[number], string>;
134
155
  /**
135
- * Valid Bulma border-radius helper classes.
136
- * @example 'radiusless'
156
+ * Valid Bulma border-radius helper values.
157
+ *
158
+ * `radiusless` renders `is-radiusless` and removes the radius. The sizes
159
+ * render `has-radius-<value>` and set one from Bulma's radius scale.
160
+ * @example 'radiusless', 'small', 'rounded'
137
161
  */
138
- export declare const validRadii: readonly ["radiusless"];
162
+ export declare const validRadii: readonly ["radiusless", "small", "normal", "large", "rounded"];
139
163
  /**
140
164
  * Valid Bulma shadow helper classes.
141
165
  * @example 'shadowless'
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Event and focus checks that still hold when a component renders inside a
3
+ * shadow root.
4
+ *
5
+ * Code outside a shadow root cannot see into it. A listener on `document`
6
+ * reads an event from inside one with its `target` set to the shadow host,
7
+ * and `document.activeElement` names the host instead of the element that has
8
+ * focus. A component asking either question from `document` then takes a
9
+ * click on its own menu for an outside click, or cannot tell which of its
10
+ * items is focused. A web component or a sandboxed preview puts a component
11
+ * in exactly that position.
12
+ *
13
+ * Focus comes in two questions, and each has its own function here. "Is focus
14
+ * inside me, and on which of my elements?" is `getActiveElementInTree`. "Which
15
+ * element has focus, wherever it is?", the one to record before moving focus
16
+ * away and restore to later, is `getDeepestActiveElement`.
17
+ */
18
+ /**
19
+ * Whether `event` happened inside `node`. The event's composed path still
20
+ * holds the element that was really clicked, where a `document` listener
21
+ * reads the shadow host as the event's `target`.
22
+ *
23
+ * @param event - An event read by a listener outside `node`, usually on `document`.
24
+ * @param node - The component's element, or nothing while it is unmounted.
25
+ * @returns True when `node` is on the event's path.
26
+ */
27
+ export declare function isEventInside(event: Event, node: Node | null | undefined): boolean;
28
+ /**
29
+ * The focused element as `node`'s own tree sees it: its shadow root's
30
+ * `activeElement` when `node` is inside one, `document.activeElement` when it
31
+ * is not. The result is comparable with `node` and its descendants, which
32
+ * live in that same tree, so use it to ask whether focus is inside `node`.
33
+ * Focus inside a shadow root nested within `node` reads as that root's host,
34
+ * which `node` contains.
35
+ *
36
+ * A shadow root with nothing focused inside reports `null`, and a detached
37
+ * node has no document above it. Both fall back to `document.activeElement`,
38
+ * so focus elsewhere on the page still reads as outside `node`.
39
+ *
40
+ * @param node - An element of the component, or nothing while it is unmounted.
41
+ * @returns The focused element in `node`'s tree, or the document's.
42
+ */
43
+ export declare function getActiveElementInTree(node: Node | null | undefined): Element | null;
44
+ /**
45
+ * The element that really has focus, followed down from
46
+ * `document.activeElement` through every open shadow root on the way. Use it
47
+ * to record where focus was before moving it, so it can be restored to that
48
+ * element later: the tree a component renders into need not be the tree its
49
+ * opener sits in. A closed shadow root cannot be entered, so focus inside one
50
+ * reads as its host.
51
+ *
52
+ * @returns The focused element, or `null` when the document has none.
53
+ */
54
+ export declare function getDeepestActiveElement(): Element | null;
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ /**
3
+ * How long after an item appears its announcement is written, in ms. The wait
4
+ * lets a screen reader register a region the container has only just mounted,
5
+ * and items shown in quick succession are written, and read out, together.
6
+ */
7
+ export declare const announceDelay = 100;
8
+ /**
9
+ * How long an announcement stays in the region once written, in ms. That's
10
+ * long enough for a screen reader to pick it up. Clearing it after keeps a
11
+ * second copy of the item's text from sitting in the page, where someone
12
+ * reading through the page, or a test looking the text up, would find it
13
+ * again.
14
+ */
15
+ export declare const announcementLifetime = 1000;
16
+ /**
17
+ * Reads an element out roughly the way a screen reader would: its text, with
18
+ * an element's `aria-label`, or an image's `alt`, standing in for what's
19
+ * inside it, a break between block-level elements, and parts that are
20
+ * `aria-hidden`, `hidden` or inline-styled `display: none` left out. It isn't
21
+ * the full accessible name computation, so `aria-labelledby`, CSS-generated
22
+ * content, content hidden by a stylesheet and other ways of naming or hiding
23
+ * content aren't followed.
24
+ *
25
+ * @function spokenText
26
+ * @param element - The element to read.
27
+ * @returns Its text, with runs of whitespace collapsed and the ends trimmed.
28
+ */
29
+ export declare function spokenText(element: Element): string;
30
+ /**
31
+ * Props for StatusRegion.
32
+ */
33
+ export interface StatusRegionProps<Item extends {
34
+ id: string;
35
+ }> {
36
+ /** The items to announce politely, in the order they were shown. */
37
+ items: readonly Item[];
38
+ /**
39
+ * The text to announce for an item, or nothing to skip it, as
40
+ * `useAnnouncements` takes it.
41
+ */
42
+ describe: (item: Item) => string | null;
43
+ }
44
+ /**
45
+ * A visually hidden, polite `status` live region that a programmatic
46
+ * container announces its items through. The container renders it from the
47
+ * moment it mounts, whether or not it has anything to show, so the region is
48
+ * already in the page when an announcement is written into it.
49
+ *
50
+ * The announcements are this component's own state, so writing and clearing
51
+ * them re-renders the region and leaves the container's items alone. Each one
52
+ * is its own keyed node, so a re-render that leaves the announcements alone
53
+ * leaves the region's content alone too, and nothing is read out twice.
54
+ *
55
+ * @function StatusRegion
56
+ * @param props - The items to announce, and the text to announce for each.
57
+ * @returns The region.
58
+ */
59
+ export declare function StatusRegion<Item extends {
60
+ id: string;
61
+ }>({ items, describe, }: StatusRegionProps<Item>): React.ReactElement;
@@ -50,7 +50,7 @@ export declare const useBulmaClasses: <T extends object>(props: BulmaClassesProp
50
50
  bulmaHelperStyles?: CSSProperties;
51
51
  rest: Omit<T, keyof BulmaClassesProps>;
52
52
  };
53
- export { validColors, validColorShades, validSchemeColors, validSizes, validTextSizes, validAlignments, validTextTransforms, validTextWeights, validFontFamilies, validDisplays, validVisibilities, validFlexDirections, validFlexWraps, validJustifyContents, validAlignContents, validAlignItems, validAlignSelfs, validFlexGrowShrink, validViewports, validFloats, validOverflows, validInteractions, validCursors, validRadii, validShadows, validResponsives, } from './bulmaClassHelpers.js';
53
+ export { validColors, validColorShades, validSchemeColors, validSizes, validTextSizes, validAlignments, validTextTransforms, validTextWeights, validFontFamilies, validDisplays, validVisibilities, validFlexDirections, validFlexWraps, validJustifyContents, validAlignContents, validAlignItems, validAlignSelfs, validFlexGrowShrink, validViewports, validFloats, validOverflows, validAxisOverflows, validInteractions, validCursors, validRadii, validShadows, validResponsives, validPositions, validAspectRatios, } from './bulmaClassHelpers.js';
54
54
  export type { BulmaViewportProps, BulmaDisplayProps };
55
55
  export * from './useColorClasses.js';
56
56
  export * from './useSpacingClasses.js';
@@ -1,19 +1,48 @@
1
- import { validCursors, validFloats, validInteractions, validOverflows, validRadii, validResponsives, validShadows } from './bulmaClassHelpers.js';
1
+ import { validAspectRatios, validAxisOverflows, validCursors, validFloats, validInteractions, validOverflows, validPositions, validRadii, validResponsives, validShadows } from './bulmaClassHelpers.js';
2
2
  /**
3
3
  * Props for applying miscellaneous Bulma helper classes.
4
4
  */
5
5
  export interface BulmaOtherProps {
6
6
  /** Float direction (e.g., 'left', 'right'). */
7
7
  float?: (typeof validFloats)[number];
8
- /** Overflow behavior (e.g., 'clipped'). */
8
+ /**
9
+ * Overflow behavior on both axes. `clipped` renders `is-clipped`; the CSS
10
+ * keywords (`auto`, `clip`, `hidden`, `scroll`, `visible`) render
11
+ * `is-overflow-<value>`.
12
+ *
13
+ * Beside `overflowX` or `overflowY`, the axis prop wins on its own axis and
14
+ * `overflow` sets only the other one, with `clipped` counting as `hidden`:
15
+ * `overflow="hidden" overflowY="auto"` clips sideways and scrolls down.
16
+ */
9
17
  overflow?: (typeof validOverflows)[number];
18
+ /**
19
+ * Horizontal overflow behavior (e.g., 'auto', 'hidden'). Wins over
20
+ * `overflow` on this axis.
21
+ */
22
+ overflowX?: (typeof validAxisOverflows)[number];
23
+ /**
24
+ * Vertical overflow behavior (e.g., 'auto', 'scroll'). Wins over `overflow`
25
+ * on this axis.
26
+ */
27
+ overflowY?: (typeof validAxisOverflows)[number];
10
28
  /** Applies overlay styling if true. */
11
29
  overlay?: boolean;
12
30
  /** Interaction behavior (e.g., 'unselectable', 'clickable'). */
13
31
  interaction?: (typeof validInteractions)[number];
14
32
  /** Cursor style (e.g., 'pointer', 'help'). */
15
33
  cursor?: (typeof validCursors)[number];
16
- /** Border radius style (e.g., 'radiusless'). */
34
+ /**
35
+ * Border radius. `radiusless` removes it (`is-radiusless`). `small`,
36
+ * `normal`, `large` and `rounded` set one from Bulma's radius scale
37
+ * (`has-radius-<value>`), where `rounded` is the pill shape.
38
+ *
39
+ * The class lands on the component's root element, so where an inner
40
+ * element draws the radius, such as the `<img>` in `Image` or the
41
+ * `<select>` in `Select`, that element keeps its own. The sizes are not
42
+ * `!important`, unlike `radiusless`, so a component rule more specific than
43
+ * one class still wins: an `isRounded` control stays a pill, and a joined
44
+ * addon keeps its square inner corners.
45
+ */
17
46
  radius?: (typeof validRadii)[number];
18
47
  /** Shadow style (e.g., 'shadowless'). */
19
48
  shadow?: (typeof validShadows)[number];
@@ -23,15 +52,42 @@ export interface BulmaOtherProps {
23
52
  skeleton?: boolean;
24
53
  /** Applies clearfix to fix floating children if true. */
25
54
  clearfix?: boolean;
26
- /** Applies position: relative if true. */
55
+ /**
56
+ * CSS `position` (`is-position-<value>`).
57
+ *
58
+ * Named `pos` because several components already have a `position` prop
59
+ * of their own, for where they place a popup or a toast.
60
+ *
61
+ * It sets `position` and nothing else, so an element that is `absolute`,
62
+ * `fixed` or `sticky` still needs its offsets (`top`, `left`, …) from your
63
+ * own CSS. `sticky` in particular does nothing until one is set.
64
+ *
65
+ * When `pos` is set it decides the position, and `relative` adds nothing.
66
+ */
67
+ pos?: (typeof validPositions)[number];
68
+ /**
69
+ * Applies position: relative if true (`is-relative`). The shortcut for
70
+ * `pos="relative"`, kept working as it always has; `pos` wins when both are
71
+ * set.
72
+ */
27
73
  relative?: boolean;
28
74
  /** Applies height: 100% if true. */
29
75
  fullHeight?: boolean;
76
+ /**
77
+ * Fixed width-to-height ratio (`is-aspect-ratio-<value>`), e.g. `16by9`.
78
+ * The height follows the width, so leave the height unset. Content taller
79
+ * than the ratio allows grows the element unless `overflow` or `overflowY`
80
+ * makes it scroll or clip.
81
+ *
82
+ * On `Image`, prefer its own `size` ratios, which also fit the picture to
83
+ * the box; this class sizes only the wrapper.
84
+ */
85
+ aspectRatio?: (typeof validAspectRatios)[number];
30
86
  }
31
87
  /**
32
88
  * A hook that generates miscellaneous Bulma helper classes (float, overflow,
33
89
  * overlay, interaction, cursor, radius, shadow, responsive, skeleton,
34
- * clearfix, relative, and full height).
90
+ * clearfix, position, full height, and aspect ratio).
35
91
  *
36
92
  * @function useOtherClasses
37
93
  * @param props - Miscellaneous Bulma helper props.
@@ -156,6 +156,8 @@ export interface CardHeaderTitleProps extends React.HTMLAttributes<HTMLDivElemen
156
156
  }
157
157
  /**
158
158
  * Props for the Card.Header.Icon compound component.
159
+ * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a header icon inside a form does not submit it. Pass `'submit'` or `'reset'` and yours is used; any other value, or a spread carrying `type: undefined`, renders `'button'`.
160
+ * @extraProp {string} [aria-label='more options'] - Accessible name. Pass your own to replace it. An empty one, or a spread carrying `'aria-label': undefined`, keeps the default rather than leaving the button unnamed.
159
161
  */
160
162
  export interface CardHeaderIconProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
161
163
  /** Bulma color modifier (text color helper). */