@allxsmith/bestax-bulma 5.57.5 → 5.59.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 (112) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Avatars.js +2 -2
  4. package/dist/esm/components/Avatars.js.map +1 -1
  5. package/dist/esm/components/Badge.js +2 -2
  6. package/dist/esm/components/Badge.js.map +1 -1
  7. package/dist/esm/components/Pagination.js +2 -2
  8. package/dist/esm/components/Pagination.js.map +1 -1
  9. package/dist/esm/components/Steps.js +2 -2
  10. package/dist/esm/components/Steps.js.map +1 -1
  11. package/dist/esm/components/TreeView.js +7 -5
  12. package/dist/esm/components/TreeView.js.map +1 -1
  13. package/dist/esm/components/useDataTable.js +2 -2
  14. package/dist/esm/components/useDataTable.js.map +1 -1
  15. package/dist/esm/elements/Buttons.js +2 -0
  16. package/dist/esm/elements/Buttons.js.map +1 -1
  17. package/dist/esm/elements/IconButton.js +114 -0
  18. package/dist/esm/elements/IconButton.js.map +1 -0
  19. package/dist/esm/elements/NumberFormatter.js +42 -0
  20. package/dist/esm/elements/NumberFormatter.js.map +1 -0
  21. package/dist/esm/elements/RingProgress.js +2 -2
  22. package/dist/esm/elements/RingProgress.js.map +1 -1
  23. package/dist/esm/form/Dropzone.js +2 -2
  24. package/dist/esm/form/Dropzone.js.map +1 -1
  25. package/dist/esm/form/File.js +2 -2
  26. package/dist/esm/form/File.js.map +1 -1
  27. package/dist/esm/form/Rate.js +2 -2
  28. package/dist/esm/form/Rate.js.map +1 -1
  29. package/dist/esm/form/Slider.js +2 -2
  30. package/dist/esm/form/Slider.js.map +1 -1
  31. package/dist/esm/form/Taginput.js +2 -2
  32. package/dist/esm/form/Taginput.js.map +1 -1
  33. package/dist/esm/form/_colorInternals/pickerState.js +2 -2
  34. package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
  35. package/dist/esm/helpers/LocaleProvider.js +13 -6
  36. package/dist/esm/helpers/LocaleProvider.js.map +1 -1
  37. package/dist/esm/helpers/containerBreakpoints.js +14 -0
  38. package/dist/esm/helpers/containerBreakpoints.js.map +1 -0
  39. package/dist/esm/helpers/localeFormat.js +196 -36
  40. package/dist/esm/helpers/localeFormat.js.map +1 -1
  41. package/dist/esm/helpers/polymorphic.js.map +1 -1
  42. package/dist/esm/helpers/stackLayout.js +30 -0
  43. package/dist/esm/helpers/stackLayout.js.map +1 -0
  44. package/dist/esm/helpers/useBulmaClasses.js +8 -2
  45. package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
  46. package/dist/esm/helpers/useFlexboxClasses.js +17 -4
  47. package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
  48. package/dist/esm/helpers/useTreeView.js +54 -20
  49. package/dist/esm/helpers/useTreeView.js.map +1 -1
  50. package/dist/esm/layout/Center.js +33 -0
  51. package/dist/esm/layout/Center.js.map +1 -0
  52. package/dist/esm/layout/Container.js +2 -6
  53. package/dist/esm/layout/Container.js.map +1 -1
  54. package/dist/esm/layout/Flex.js +34 -0
  55. package/dist/esm/layout/Flex.js.map +1 -0
  56. package/dist/esm/layout/Group.js +43 -0
  57. package/dist/esm/layout/Group.js.map +1 -0
  58. package/dist/esm/layout/Stack.js +34 -0
  59. package/dist/esm/layout/Stack.js.map +1 -0
  60. package/dist/extras.css +1 -1
  61. package/dist/extras.css.map +1 -1
  62. package/dist/index.cjs +712 -212
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.esm.js +7 -0
  65. package/dist/index.esm.js.map +1 -1
  66. package/dist/types/components/TreeView.d.ts +20 -11
  67. package/dist/types/elements/Buttons.d.ts +1 -0
  68. package/dist/types/elements/IconButton.d.ts +110 -0
  69. package/dist/types/elements/NumberFormatter.d.ts +62 -0
  70. package/dist/types/helpers/LocaleProvider.d.ts +7 -0
  71. package/dist/types/helpers/containerBreakpoints.d.ts +2 -0
  72. package/dist/types/helpers/localeFormat.d.ts +30 -8
  73. package/dist/types/helpers/polymorphic.d.ts +19 -0
  74. package/dist/types/helpers/stackLayout.d.ts +62 -0
  75. package/dist/types/helpers/useBulmaClasses.d.ts +8 -2
  76. package/dist/types/helpers/useFlexboxClasses.d.ts +26 -3
  77. package/dist/types/helpers/useTreeView.d.ts +12 -6
  78. package/dist/types/index.d.ts +10 -1
  79. package/dist/types/layout/Center.d.ts +54 -0
  80. package/dist/types/layout/Flex.d.ts +92 -0
  81. package/dist/types/layout/Group.d.ts +86 -0
  82. package/dist/types/layout/Stack.d.ts +63 -0
  83. package/dist/types-cjs/components/TreeView.d.ts +20 -11
  84. package/dist/types-cjs/elements/Buttons.d.ts +1 -0
  85. package/dist/types-cjs/elements/IconButton.d.ts +110 -0
  86. package/dist/types-cjs/elements/NumberFormatter.d.ts +62 -0
  87. package/dist/types-cjs/helpers/LocaleProvider.d.ts +7 -0
  88. package/dist/types-cjs/helpers/containerBreakpoints.d.ts +2 -0
  89. package/dist/types-cjs/helpers/localeFormat.d.ts +30 -8
  90. package/dist/types-cjs/helpers/polymorphic.d.ts +19 -0
  91. package/dist/types-cjs/helpers/stackLayout.d.ts +62 -0
  92. package/dist/types-cjs/helpers/useBulmaClasses.d.ts +8 -2
  93. package/dist/types-cjs/helpers/useFlexboxClasses.d.ts +26 -3
  94. package/dist/types-cjs/helpers/useTreeView.d.ts +12 -6
  95. package/dist/types-cjs/index.d.ts +10 -1
  96. package/dist/types-cjs/layout/Center.d.ts +54 -0
  97. package/dist/types-cjs/layout/Flex.d.ts +92 -0
  98. package/dist/types-cjs/layout/Group.d.ts +86 -0
  99. package/dist/types-cjs/layout/Stack.d.ts +63 -0
  100. package/dist/versions/bestax-no-dark-mode.css +1 -1
  101. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  102. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  103. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  104. package/dist/versions/bestax-no-helpers.css +1 -1
  105. package/dist/versions/bestax-no-helpers.css.map +1 -1
  106. package/dist/versions/bestax-prefixed.css +1 -1
  107. package/dist/versions/bestax-prefixed.css.map +1 -1
  108. package/package.json +1 -1
  109. package/src/scss/elements/_iconbutton.scss +36 -0
  110. package/src/scss/elements/_index.scss +1 -0
  111. package/src/scss/layout/_index.scss +1 -0
  112. package/src/scss/layout/_stack.scss +145 -0
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { type BulmaClassesProps, type validColors, type validFlexDirections } from './useBulmaClasses.js';
3
+ /**
4
+ * The elements Stack, Group, Center and Flex can render as: Container's
5
+ * landmarks and sections, a list, a form or a fieldset.
6
+ */
7
+ export type LayoutElement = 'div' | 'main' | 'section' | 'article' | 'aside' | 'header' | 'footer' | 'nav' | 'ul' | 'ol' | 'form' | 'fieldset';
8
+ /**
9
+ * What Stack, Group, Center and Flex take in common. The helper props, the
10
+ * other attributes and the `ref` land on the root.
11
+ *
12
+ * @flexContainer The root is a flex container by its own stylesheet, so the
13
+ * flex container helper props apply with no `display` prop. The API docs
14
+ * extractor reads this tag off a component's props type or its bases, and
15
+ * the ESLint plugin's `no-inert-flex-props` takes its flex containers from it.
16
+ */
17
+ export interface LayoutOwnProps extends Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'flexDirection'> {
18
+ /**
19
+ * Not accepted. `color` here would be the deprecated presentational HTML
20
+ * attribute. Use `textColor`.
21
+ * @internal
22
+ */
23
+ color?: never;
24
+ /**
25
+ * Not accepted under this name. Use `bgColor`.
26
+ * @internal
27
+ */
28
+ backgroundColor?: never;
29
+ /** Additional CSS classes. */
30
+ className?: string;
31
+ /**
32
+ * What it lays out. The top and bottom margins Bulma gives them are
33
+ * zeroed, so `gap` is the only space between them, and a spacing helper
34
+ * such as `mt="2"` still adds to it. A `Columns` child keeps its own top and side
35
+ * margins, and takes at the bottom the one Bulma gives the last Columns in
36
+ * a container, the column gap pulled back in (none when gapless), so its
37
+ * columns line up. A `Pagination` child keeps its negative margins too,
38
+ * so its links line up.
39
+ */
40
+ children?: React.ReactNode;
41
+ /** Text color helper. */
42
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
43
+ /** Background color helper. */
44
+ bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
45
+ }
46
+ /** The props `StackLayout` reads, from whichever of the four renders it. */
47
+ export interface StackLayoutProps extends LayoutOwnProps, Omit<React.HTMLAttributes<HTMLElement>, 'color'> {
48
+ /** The element to render. */
49
+ as?: LayoutElement;
50
+ /** Flex's direction. The other three pass `undefined`, so they never reorder. */
51
+ flexDirection?: (typeof validFlexDirections)[number];
52
+ /** The modifier classes beside `stack`, as `usePrefixedClassNames` takes them. */
53
+ modifiers?: Record<string, boolean | undefined>;
54
+ }
55
+ /**
56
+ * The `.stack` element behind Stack, Group, Center and Flex.
57
+ *
58
+ * With `as="ul"` or `as="ol"` it renders `role="list"`, which Safari needs:
59
+ * WebKit stops exposing a list as one once its markers are hidden, and
60
+ * Bulma's reset hides a `<ul>`'s. Menu.List restates it for the same reason.
61
+ */
62
+ export declare const StackLayout: React.ForwardRefExoticComponent<StackLayoutProps & React.RefAttributes<HTMLElement>>;
@@ -4,7 +4,7 @@ import { BulmaColorProps, BulmaColorPropsWithScheme } from './useColorClasses.js
4
4
  import { BulmaSpacingProps } from './useSpacingClasses.js';
5
5
  import { BulmaTypographyProps } from './useTypographyClasses.js';
6
6
  import { BulmaVisibilityProps } from './useVisibilityClasses.js';
7
- import { BulmaFlexboxProps } from './useFlexboxClasses.js';
7
+ import { BulmaFlexboxProps, type UseFlexboxClassesOptions } from './useFlexboxClasses.js';
8
8
  import { BulmaOtherProps } from './useOtherClasses.js';
9
9
  /**
10
10
  * Props for applying Bulma helper classes to components.
@@ -31,8 +31,14 @@ export type BulmaClassesPropsWithScheme = Omit<BulmaClassesProps, keyof BulmaCol
31
31
  * `background-color: var(--bulma-scheme-*)` style (`undefined` for all other
32
32
  * inputs). Merge it with a user `style` prop via `mergeBulmaStyles`.
33
33
  *
34
+ * The flex container props (`flexDirection`, `flexWrap`, `justifyContent`,
35
+ * `alignContent`, `alignItems`) emit a class only on a flex container: when a
36
+ * `display` prop is `flex` or `inline-flex`, or when `options.flexContainer`
37
+ * says the element's own stylesheet makes it one.
38
+ *
34
39
  * @function useBulmaClasses
35
40
  * @param props - Combination of BulmaClassesPropsWithScheme and additional props.
41
+ * @param options - Passed to `useFlexboxClasses`: whether the element is a flex container without a display prop.
36
42
  * @returns An object containing the Bulma helper classes, optional helper
37
43
  * styles, and unhandled props.
38
44
  * @example
@@ -45,7 +51,7 @@ export type BulmaClassesPropsWithScheme = Omit<BulmaClassesProps, keyof BulmaCol
45
51
  * // bulmaHelperStyles: { backgroundColor: 'var(--bulma-scheme-main-bis)' }
46
52
  * // rest: { className: 'custom-class' }
47
53
  */
48
- export declare const useBulmaClasses: <T extends object>(props: BulmaClassesPropsWithScheme & T) => {
54
+ export declare const useBulmaClasses: <T extends object>(props: BulmaClassesPropsWithScheme & T, options?: UseFlexboxClassesOptions) => {
49
55
  bulmaHelperClasses: string;
50
56
  bulmaHelperStyles?: CSSProperties;
51
57
  rest: Omit<T, keyof BulmaClassesProps>;
@@ -22,11 +22,25 @@ export interface BulmaFlexboxProps extends BulmaDisplayProps {
22
22
  /** Flex shrink value (e.g., '0', '1', '2', '3', '4', '5'). */
23
23
  flexShrink?: (typeof validFlexGrowShrink)[number];
24
24
  }
25
+ /**
26
+ * Options for `useFlexboxClasses`, which `useBulmaClasses` passes through.
27
+ */
28
+ export interface UseFlexboxClassesOptions {
29
+ /**
30
+ * Whether the element is a flex container by its own CSS, as `Stack` and
31
+ * `Group` are, so the container helpers apply with no `display` prop. It
32
+ * adds no display class: the element's own stylesheet has to make it a flex
33
+ * container.
34
+ * @defaultValue false
35
+ */
36
+ flexContainer?: boolean;
37
+ }
25
38
  /**
26
39
  * A hook that generates Bulma flexbox helper classes. Flex container helpers
27
40
  * (direction, wrap, justify/align content, align items) are only emitted when
28
- * one of the display props indicates a flex display; flex item helpers
29
- * (align self, grow, shrink) are always emitted.
41
+ * one of the display props indicates a flex display, or when `options` says
42
+ * the element is a flex container by its own CSS; flex item helpers (align
43
+ * self, grow, shrink) are always emitted.
30
44
  *
31
45
  * Note: this hook reads the display props purely as a gate and never emits
32
46
  * display classes — `is-flex` and friends come from useVisibilityClasses (or
@@ -34,6 +48,7 @@ export interface BulmaFlexboxProps extends BulmaDisplayProps {
34
48
  *
35
49
  * @function useFlexboxClasses
36
50
  * @param props - Flexbox-related Bulma helper props.
51
+ * @param options - Whether the element is a flex container without a display prop.
37
52
  * @returns A space-separated string of flexbox helper classes.
38
53
  * @example
39
54
  * const flexboxClasses = useFlexboxClasses({
@@ -42,5 +57,13 @@ export interface BulmaFlexboxProps extends BulmaDisplayProps {
42
57
  * });
43
58
  * // flexboxClasses: 'is-justify-content-center'
44
59
  * // ('is-flex' itself comes from useVisibilityClasses/useBulmaClasses)
60
+ *
61
+ * @example
62
+ * // An element whose own stylesheet makes it a flex container
63
+ * const flexboxClasses = useFlexboxClasses(
64
+ * { alignItems: 'center' },
65
+ * { flexContainer: true }
66
+ * );
67
+ * // flexboxClasses: 'is-align-items-center'
45
68
  */
46
- export declare const useFlexboxClasses: (props: BulmaFlexboxProps) => string;
69
+ export declare const useFlexboxClasses: (props: BulmaFlexboxProps, options?: UseFlexboxClassesOptions) => string;
@@ -30,7 +30,8 @@ export interface TreeViewPosition {
30
30
  }
31
31
  /**
32
32
  * What an item shows of the selection: `selected` in a `single` tree,
33
- * `checked` in a `checkbox` tree, and neither with `none`.
33
+ * `checked` in a `checkbox` or `checkbox-independent` tree, and neither with
34
+ * `none`.
34
35
  */
35
36
  export interface TreeViewItemState {
36
37
  selected?: boolean;
@@ -55,9 +56,12 @@ export interface TreeViewEngine {
55
56
  treeRef: React.MutableRefObject<HTMLUListElement | null>;
56
57
  /**
57
58
  * Whether a closed item still renders its children, drawing nothing, so a
58
- * check knows everything under it. Only a checkbox tree needs to.
59
+ * check knows everything under it. Only a `checkbox` tree needs to: a check
60
+ * in a `checkbox-independent` tree reaches nothing under it.
59
61
  */
60
62
  rendersClosed: boolean;
63
+ /** Whether any number of items can be checked, in either checkbox mode. */
64
+ multiselectable: boolean;
61
65
  /** The item that holds `tabIndex={0}`. */
62
66
  tabStop: string | null;
63
67
  isOpen: (value: string) => boolean;
@@ -97,10 +101,12 @@ export interface TreeViewEngine {
97
101
  * browser (#1171), read off the page once the tree has mounted.
98
102
  *
99
103
  * Every item registers its value, its parent and whether it's disabled from
100
- * a layout effect. In a checkbox tree a closed item's children still render
101
- * and register while drawing nothing, so the registry knows every item and a
102
- * check reaches all of them. The keys read the items on the page, in
103
- * document order, each time they need them.
104
+ * a layout effect. In a `checkbox` tree a closed item's children still
105
+ * render and register while drawing nothing, so the registry knows every item
106
+ * and a check reaches all of them. A `checkbox-independent` tree reads each
107
+ * box off the checked list alone, so a check adds or takes out its own value
108
+ * and nothing else. The keys read the items on the page, in document order,
109
+ * each time they need them.
104
110
  *
105
111
  * @function useTreeView
106
112
  * @param options - The TreeView's props.
@@ -48,6 +48,7 @@ export * from './elements/Divider.js';
48
48
  export * from './elements/Emphasis.js';
49
49
  export * from './elements/Figure.js';
50
50
  export * from './elements/Icon.js';
51
+ export * from './elements/IconButton.js';
51
52
  export * from './elements/IconText.js';
52
53
  export * from './elements/Image.js';
53
54
  export * from './elements/Kbd.js';
@@ -55,6 +56,7 @@ export * from './elements/Link.js';
55
56
  export * from './elements/ListItem.js';
56
57
  export * from './elements/Loader.js';
57
58
  export * from './elements/Notification.js';
59
+ export * from './elements/NumberFormatter.js';
58
60
  export * from './elements/OrderedList.js';
59
61
  export * from './elements/Paragraph.js';
60
62
  export * from './elements/Pre.js';
@@ -132,7 +134,7 @@ export type { FormFieldProps } from './form/fieldProps.js';
132
134
  export * from './grid/Cell.js';
133
135
  export * from './grid/Grid.js';
134
136
  export * from './helpers/classNames.js';
135
- export type { ConstrainedPolymorphicComponentWithoutRef, PolymorphicComponent, PolymorphicComponentWithoutRef, PolymorphicProps, PolymorphicRef, } from './helpers/polymorphic.js';
137
+ export type { ConstrainedPolymorphicComponent, ConstrainedPolymorphicComponentWithoutRef, PolymorphicComponent, PolymorphicComponentWithoutRef, PolymorphicProps, PolymorphicRef, } from './helpers/polymorphic.js';
136
138
  export * from './helpers/mergeBulmaStyles.js';
137
139
  export * from './helpers/useBulmaClasses.js';
138
140
  export * from './helpers/Theme.js';
@@ -144,12 +146,19 @@ export { Portal } from './helpers/portal.js';
144
146
  export type { PortalProps } from './helpers/portal.js';
145
147
  export { LocaleProvider, useLocale } from './helpers/LocaleProvider.js';
146
148
  export type { LocaleContextValue, LocaleProviderProps, TextDirection, } from './helpers/LocaleProvider.js';
149
+ export { useNumberFormat } from './helpers/localeFormat.js';
150
+ export type { NumberFormatFunction } from './helpers/localeFormat.js';
147
151
  export { useFocusTrap } from './helpers/useFocusTrap.js';
148
152
  export type { UseFocusTrapOptions } from './helpers/useFocusTrap.js';
153
+ export * from './layout/Center.js';
149
154
  export * from './layout/Container.js';
155
+ export * from './layout/Flex.js';
150
156
  export * from './layout/Footer.js';
157
+ export * from './layout/Group.js';
151
158
  export * from './layout/Hero.js';
152
159
  export * from './layout/Level.js';
153
160
  export * from './layout/Media.js';
154
161
  export * from './layout/Section.js';
155
162
  export * from './layout/Splitter.js';
163
+ export * from './layout/Stack.js';
164
+ export type { LayoutElement } from './helpers/stackLayout.js';
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import type { ConstrainedPolymorphicComponent } from '../helpers/polymorphic.js';
3
+ import { type LayoutElement, type LayoutOwnProps } from '../helpers/stackLayout.js';
4
+ import type { BulmaGapStep, validDisplays } from '../helpers/useBulmaClasses.js';
5
+ /**
6
+ * The Center component's own props, beside the attributes of the element
7
+ * `as` renders.
8
+ */
9
+ export interface CenterOwnProps extends LayoutOwnProps {
10
+ /**
11
+ * Space between children, when there are several. None by default. Needs
12
+ * Bulma's helper classes: under `bestax-no-helpers.css` the default stays.
13
+ */
14
+ gap?: BulmaGapStep;
15
+ /**
16
+ * `'inline-flex'` sizes it to its content, to center something inside a line
17
+ * of text. Needs Bulma's helper classes: under `bestax-no-helpers.css` the
18
+ * default stays.
19
+ */
20
+ display?: (typeof validDisplays)[number] | 'none';
21
+ }
22
+ /**
23
+ * Props for the Center component. The attributes and the `ref` follow `as`.
24
+ *
25
+ * @extraProp {PolymorphicRef<LayoutElement>} [ref] - Ref forwarded to the element `as` renders.
26
+ */
27
+ export type CenterProps<T extends LayoutElement = LayoutElement> = CenterOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof CenterOwnProps | 'as'> & {
28
+ /**
29
+ * The element to render. With `ul` or `ol`, give it `li` children: it
30
+ * restates `role="list"`, which Bulma's list reset takes away in Safari.
31
+ * @defaultValue 'div'
32
+ */
33
+ as?: T;
34
+ };
35
+ /**
36
+ * The `Center` component centers its content on both axes.
37
+ *
38
+ * Use it for a loader, an icon or an empty state in the middle of a box, a
39
+ * card or a section. Give it a height, or put it in something that has one,
40
+ * to center down the middle as well as across. Several children sit side by
41
+ * side in the middle, with no gap unless you set one.
42
+ *
43
+ * @function
44
+ * @param {CenterProps} props - Props for the Center component.
45
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
46
+ * @returns {JSX.Element} The rendered center.
47
+ *
48
+ * @example
49
+ * <Center p="6">
50
+ * <Loader />
51
+ * </Center>
52
+ */
53
+ export declare const Center: ConstrainedPolymorphicComponent<CenterOwnProps, LayoutElement, "div">;
54
+ export default Center;
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import type { ConstrainedPolymorphicComponent } from '../helpers/polymorphic.js';
3
+ import { type LayoutElement, type LayoutOwnProps } from '../helpers/stackLayout.js';
4
+ import type { BulmaGapStep, validAlignContents, validAlignItems, validFlexDirections, validFlexWraps, validJustifyContents } from '../helpers/useBulmaClasses.js';
5
+ /**
6
+ * The Flex component's own props, beside the attributes of the element `as`
7
+ * renders.
8
+ */
9
+ export interface FlexOwnProps extends LayoutOwnProps {
10
+ /**
11
+ * The main axis. `row-reverse` and `column-reverse` change only what's seen:
12
+ * reading and Tab order still follow the children's order (WCAG 1.3.2 and
13
+ * 2.4.3). Needs Bulma's helper classes: under `bestax-no-helpers.css` the
14
+ * default stays.
15
+ * @defaultValue 'row'
16
+ */
17
+ flexDirection?: (typeof validFlexDirections)[number];
18
+ /**
19
+ * Whether children move to a new line when they don't fit. Needs Bulma's
20
+ * helper classes: under `bestax-no-helpers.css` the default stays.
21
+ * @defaultValue 'nowrap'
22
+ */
23
+ flexWrap?: (typeof validFlexWraps)[number];
24
+ /**
25
+ * How each child sits across the main axis. Needs Bulma's helper classes:
26
+ * under `bestax-no-helpers.css` the default stays.
27
+ * @defaultValue 'stretch'
28
+ */
29
+ alignItems?: (typeof validAlignItems)[number];
30
+ /**
31
+ * Where the children sit along the main axis. Needs Bulma's helper classes:
32
+ * under `bestax-no-helpers.css` the default stays.
33
+ */
34
+ justifyContent?: (typeof validJustifyContents)[number];
35
+ /**
36
+ * How wrapped lines share the space across the main axis. Needs Bulma's
37
+ * helper classes: under `bestax-no-helpers.css` the default stays.
38
+ */
39
+ alignContent?: (typeof validAlignContents)[number];
40
+ /**
41
+ * Space between children, a step of Bulma's gap scale. None by default. Needs
42
+ * Bulma's helper classes: under `bestax-no-helpers.css` the default stays.
43
+ */
44
+ gap?: BulmaGapStep;
45
+ /**
46
+ * Space between wrapped lines, when it differs from `gap`. Needs Bulma's
47
+ * helper classes: under `bestax-no-helpers.css` the default stays.
48
+ */
49
+ rowGap?: BulmaGapStep;
50
+ /**
51
+ * Space between children along a row, when it differs from `gap`. Needs
52
+ * Bulma's helper classes: under `bestax-no-helpers.css` the default stays.
53
+ */
54
+ columnGap?: BulmaGapStep;
55
+ }
56
+ /**
57
+ * Props for the Flex component. The attributes and the `ref` follow `as`, so
58
+ * `as="form"` takes `action` and `as="fieldset"` takes `disabled`.
59
+ *
60
+ * @extraProp {PolymorphicRef<LayoutElement>} [ref] - Ref forwarded to the element `as` renders.
61
+ */
62
+ export type FlexProps<T extends LayoutElement = LayoutElement> = FlexOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof FlexOwnProps | 'as'> & {
63
+ /**
64
+ * The element to render. With `ul` or `ol`, give it `li` children: it
65
+ * restates `role="list"`, which Bulma's list reset takes away in Safari.
66
+ * @defaultValue 'div'
67
+ */
68
+ as?: T;
69
+ };
70
+ /**
71
+ * The `Flex` component is a flex container with CSS's own defaults, taking the flex container's properties as props.
72
+ *
73
+ * It's a row that doesn't wrap, with its children stretched across it and no
74
+ * gap, until you set otherwise. Use it for a layout of your own, such as a
75
+ * fixed side beside a growing one, with `flexGrow` and `flexShrink` on the
76
+ * children. Its children's own block margins are zeroed, so the gap is the
77
+ * only space. For a column of blocks or a row of controls with Bulma's
78
+ * spacing already in place, `Stack` and `Group` start closer.
79
+ *
80
+ * @function
81
+ * @param {FlexProps} props - Props for the Flex component.
82
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
83
+ * @returns {JSX.Element} The rendered flex container.
84
+ *
85
+ * @example
86
+ * <Flex gap="4" alignItems="flex-start">
87
+ * <Box flexShrink="0">…</Box>
88
+ * <Box flexGrow="1">…</Box>
89
+ * </Flex>
90
+ */
91
+ export declare const Flex: ConstrainedPolymorphicComponent<FlexOwnProps, LayoutElement, "div">;
92
+ export default Flex;
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import type { ConstrainedPolymorphicComponent } from '../helpers/polymorphic.js';
3
+ import { type LayoutElement, type LayoutOwnProps } from '../helpers/stackLayout.js';
4
+ import type { BulmaGapStep, validAlignItems, validFlexWraps, validJustifyContents } from '../helpers/useBulmaClasses.js';
5
+ import type { ContainerBreakpoint } from './Container.js';
6
+ /**
7
+ * The Group component's own props, beside the attributes of the element `as`
8
+ * renders.
9
+ */
10
+ export interface GroupOwnProps extends LayoutOwnProps {
11
+ /**
12
+ * Space between children, a step of Bulma's gap scale. Unset, it's
13
+ * `--bulma-stack-horizontal-gap`, half of Bulma's block spacing. Needs
14
+ * Bulma's helper classes: under `bestax-no-helpers.css` the default stays.
15
+ */
16
+ gap?: BulmaGapStep;
17
+ /**
18
+ * How each child sits across the row. While `breakpoint` stacks them, it's
19
+ * where each sits across the column. Needs Bulma's helper classes: under
20
+ * `bestax-no-helpers.css` the default stays.
21
+ * @defaultValue 'center'
22
+ */
23
+ alignItems?: (typeof validAlignItems)[number];
24
+ /**
25
+ * Where the children sit along the row: `'space-between'` pushes the ends
26
+ * apart. Needs Bulma's helper classes: under `bestax-no-helpers.css` the
27
+ * default stays.
28
+ */
29
+ justifyContent?: (typeof validJustifyContents)[number];
30
+ /**
31
+ * Whether children move to a new row when they don't fit. Needs Bulma's
32
+ * helper classes: under `bestax-no-helpers.css` the default stays.
33
+ * @defaultValue 'wrap'
34
+ */
35
+ flexWrap?: (typeof validFlexWraps)[number];
36
+ /**
37
+ * The children share the row equally, and fill the column while
38
+ * `breakpoint` stacks them (Bulma's `is-fullwidth`).
39
+ */
40
+ isFullwidth?: boolean;
41
+ /**
42
+ * Stacks the children below this Bulma breakpoint and sets them in a row
43
+ * from it up, the breakpoints Container's `breakpoint` takes. Unset, a row
44
+ * at every width. It's the job Columns and Level do with booleans:
45
+ * `'tablet'` is where they turn into a row by default, `'desktop'` is
46
+ * Columns' `isDesktop`, and leaving it unset is their `isMobile`.
47
+ */
48
+ breakpoint?: ContainerBreakpoint;
49
+ }
50
+ /**
51
+ * Props for the Group component. The attributes and the `ref` follow `as`, so
52
+ * `as="form"` takes `action` and `as="fieldset"` takes `disabled`.
53
+ *
54
+ * @extraProp {PolymorphicRef<LayoutElement>} [ref] - Ref forwarded to the element `as` renders.
55
+ */
56
+ export type GroupProps<T extends LayoutElement = LayoutElement> = GroupOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof GroupOwnProps | 'as'> & {
57
+ /**
58
+ * The element to render. With `ul` or `ol`, give it `li` children: it
59
+ * restates `role="list"`, which Bulma's list reset takes away in Safari.
60
+ * @defaultValue 'div'
61
+ */
62
+ as?: T;
63
+ };
64
+ /**
65
+ * The `Group` component lays its children out in a row that wraps, centered on each other, with half of Bulma's block spacing between them.
66
+ *
67
+ * Use it for a row of buttons, tags or avatars beside some text, or a toolbar
68
+ * with `justifyContent="space-between"` pushing its ends apart. The children's
69
+ * own block margins are zeroed, so the gap is the only space. With
70
+ * `breakpoint`, it's a column on narrow screens and a row from that
71
+ * breakpoint up. For controls joined into one, with no gap and shared
72
+ * borders, use `hasAddons` on Field or Buttons instead.
73
+ *
74
+ * @function
75
+ * @param {GroupProps} props - Props for the Group component.
76
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
77
+ * @returns {JSX.Element} The rendered group.
78
+ *
79
+ * @example
80
+ * <Group justifyContent="space-between">
81
+ * <Title as="h2" size="4">Invoices</Title>
82
+ * <Button color="primary">New invoice</Button>
83
+ * </Group>
84
+ */
85
+ export declare const Group: ConstrainedPolymorphicComponent<GroupOwnProps, LayoutElement, "div">;
86
+ export default Group;
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import type { ConstrainedPolymorphicComponent } from '../helpers/polymorphic.js';
3
+ import { type LayoutElement, type LayoutOwnProps } from '../helpers/stackLayout.js';
4
+ import type { BulmaGapStep, validAlignItems, validJustifyContents } from '../helpers/useBulmaClasses.js';
5
+ /**
6
+ * The Stack component's own props, beside the attributes of the element `as`
7
+ * renders.
8
+ */
9
+ export interface StackOwnProps extends LayoutOwnProps {
10
+ /**
11
+ * Space between children, a step of Bulma's gap scale (`'2'` is 1rem). Unset,
12
+ * it's `--bulma-stack-gap`, Bulma's block spacing. Needs Bulma's helper
13
+ * classes: under `bestax-no-helpers.css` the default stays.
14
+ */
15
+ gap?: BulmaGapStep;
16
+ /**
17
+ * How each child sits across the column. `'stretch'` makes each as wide as
18
+ * the Stack. Needs Bulma's helper classes: under `bestax-no-helpers.css` the
19
+ * default stays.
20
+ * @defaultValue 'stretch'
21
+ */
22
+ alignItems?: (typeof validAlignItems)[number];
23
+ /**
24
+ * Where the children sit down the column, when it's taller than they are.
25
+ * Needs Bulma's helper classes: under `bestax-no-helpers.css` the default
26
+ * stays.
27
+ */
28
+ justifyContent?: (typeof validJustifyContents)[number];
29
+ }
30
+ /**
31
+ * Props for the Stack component. The attributes and the `ref` follow `as`, so
32
+ * `as="form"` takes `action` and `as="fieldset"` takes `disabled`.
33
+ *
34
+ * @extraProp {PolymorphicRef<LayoutElement>} [ref] - Ref forwarded to the element `as` renders.
35
+ */
36
+ export type StackProps<T extends LayoutElement = LayoutElement> = StackOwnProps & Omit<React.ComponentPropsWithoutRef<T>, keyof StackOwnProps | 'as'> & {
37
+ /**
38
+ * The element to render. With `ul` or `ol`, give it `li` children: it
39
+ * restates `role="list"`, which Bulma's list reset takes away in Safari.
40
+ * @defaultValue 'div'
41
+ */
42
+ as?: T;
43
+ };
44
+ /**
45
+ * The `Stack` component lays its children out in a column, with Bulma's block spacing between them and the margins Bulma gives them zeroed.
46
+ *
47
+ * A Stack of Boxes, Cards or Notifications looks like Bulma's own stacked
48
+ * blocks, spaced by the gap alone, so there are no margins to undo. A `gap`
49
+ * step replaces the default spacing. It's always a column, top to bottom.
50
+ *
51
+ * @function
52
+ * @param {StackProps} props - Props for the Stack component.
53
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
54
+ * @returns {JSX.Element} The rendered stack.
55
+ *
56
+ * @example
57
+ * <Stack>
58
+ * <Notification color="info">Your changes are saved.</Notification>
59
+ * <Box>…</Box>
60
+ * </Stack>
61
+ */
62
+ export declare const Stack: ConstrainedPolymorphicComponent<StackOwnProps, LayoutElement, "div">;
63
+ export default Stack;