@allxsmith/bestax-bulma 5.20.0 → 5.23.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 (40) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/extras.css +1 -1
  4. package/dist/extras.css.map +1 -1
  5. package/dist/index.cjs +658 -86
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.esm.js +654 -87
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/types/components/Collapse.d.ts +13 -9
  10. package/dist/types/components/Collapses.d.ts +53 -0
  11. package/dist/types/components/collapsesContext.d.ts +19 -0
  12. package/dist/types/helpers/ClientOnly.d.ts +40 -0
  13. package/dist/types/helpers/inertProps.d.ts +11 -0
  14. package/dist/types/helpers/portal.d.ts +62 -0
  15. package/dist/types/helpers/shadowDom.d.ts +3 -1
  16. package/dist/types/helpers/useFocusTrap.d.ts +74 -0
  17. package/dist/types/helpers/useIsHydrated.d.ts +5 -0
  18. package/dist/types/index.d.ts +8 -0
  19. package/dist/types-cjs/components/Collapse.d.ts +13 -9
  20. package/dist/types-cjs/components/Collapses.d.ts +53 -0
  21. package/dist/types-cjs/components/collapsesContext.d.ts +19 -0
  22. package/dist/types-cjs/helpers/ClientOnly.d.ts +40 -0
  23. package/dist/types-cjs/helpers/inertProps.d.ts +11 -0
  24. package/dist/types-cjs/helpers/portal.d.ts +62 -0
  25. package/dist/types-cjs/helpers/shadowDom.d.ts +3 -1
  26. package/dist/types-cjs/helpers/useFocusTrap.d.ts +74 -0
  27. package/dist/types-cjs/helpers/useIsHydrated.d.ts +5 -0
  28. package/dist/types-cjs/index.d.ts +8 -0
  29. package/dist/versions/bestax-no-dark-mode.css +1 -1
  30. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  31. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  32. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  33. package/dist/versions/bestax-no-helpers.css +1 -1
  34. package/dist/versions/bestax-no-helpers.css.map +1 -1
  35. package/dist/versions/bestax-prefixed.css +1 -1
  36. package/dist/versions/bestax-prefixed.css.map +1 -1
  37. package/package.json +1 -1
  38. package/src/scss/components/_collapse.scss +13 -4
  39. package/dist/types/form/_pickerInternals/useFocusTrap.d.ts +0 -7
  40. package/dist/types-cjs/form/_pickerInternals/useFocusTrap.d.ts +0 -7
@@ -6,14 +6,21 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
6
6
  * @extraProp {string} [className] - Additional CSS classes.
7
7
  */
8
8
  export interface CollapseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
9
- /** Controlled open state. If provided, component is controlled. */
9
+ /**
10
+ * Controlled open state. If provided, component is controlled, and the
11
+ * trigger only reports through `onOpenChange`. Inside a `Collapses` group, a
12
+ * Collapse that sets `open` stays yours: the group neither overrides it nor
13
+ * closes it when another item opens.
14
+ */
10
15
  open?: boolean;
11
- /** Initial open state for uncontrolled usage. */
16
+ /** Initial open state for uncontrolled usage. Ignored inside a `Collapses` group, whose `defaultValue` decides. */
12
17
  defaultOpen?: boolean;
13
- /** Callback when collapse opens. */
18
+ /** Called when the trigger opens the Collapse. Fires only while the Collapse keeps its own state: not when `open` is set, and not when a `Collapses` group manages it. `onOpenChange` reports in every mode. */
14
19
  onOpen?: () => void;
15
- /** Callback when collapse closes. */
20
+ /** Called when the trigger closes the Collapse. Fires only while the Collapse keeps its own state: not when `open` is set, and not when a `Collapses` group manages it. `onOpenChange` reports in every mode. */
16
21
  onClose?: () => void;
22
+ /** Called with the state the trigger asks for (`true` to open) each time it is clicked or activated with Enter or Space, in every mode. Pair it with `open` to let the trigger drive a controlled Collapse. */
23
+ onOpenChange?: (open: boolean) => void;
17
24
  /** The clickable trigger element (header/button). */
18
25
  trigger?: React.ReactNode;
19
26
  /** Animation style, or `false` to disable. */
@@ -46,12 +53,9 @@ export interface CollapseProps extends Omit<React.HTMLAttributes<HTMLDivElement>
46
53
  * </Collapse>
47
54
  *
48
55
  * @example
49
- * // Controlled collapse
56
+ * // Controlled collapse, driven by its own trigger
50
57
  * const [isOpen, setIsOpen] = useState(false);
51
- * <Collapse
52
- * open={isOpen}
53
- * trigger={<button onClick={() => setIsOpen(!isOpen)}>Toggle</button>}
54
- * >
58
+ * <Collapse open={isOpen} onOpenChange={setIsOpen} trigger={<strong>Toggle</strong>}>
55
59
  * <p>Content</p>
56
60
  * </Collapse>
57
61
  *
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ /**
4
+ * Props shared by both modes of the Collapses component.
5
+ */
6
+ interface CollapsesBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'defaultValue' | 'onChange'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
7
+ /** Joins the items into one block, with no gap between them and only the outer corners rounded. The joins show on `bordered` items. */
8
+ seamless?: boolean;
9
+ /** Additional CSS classes to apply. */
10
+ className?: string;
11
+ /** The `Collapse` items. Each child element is one item, indexed from 0 in order, with the children of a fragment counted one by one. A child that sets its own `open` keeps it: the group leaves that item alone. */
12
+ children?: React.ReactNode;
13
+ }
14
+ /**
15
+ * Props for Collapses in single mode, the accordion: opening one item closes the others.
16
+ */
17
+ export interface CollapsesSingleProps extends CollapsesBaseProps {
18
+ /**
19
+ * Lets items open independently. Without it, opening one item closes the others.
20
+ * @defaultValue false
21
+ */
22
+ multiple?: false;
23
+ /** Controlled open items: the index of the open item, or `null` for none. With `multiple`, an array of indexes. An index is a position among the children, so rendering an item conditionally or reordering them moves the open state onto a neighbour: render every item and hide one with `visibility="hidden"`, or keep `value` in step yourself. */
24
+ value?: number | null;
25
+ /** Open items for uncontrolled use, as an index or `null` (the default, none open). With `multiple`, an array of indexes, empty by default. Indexes are positions among the children, as for `value`. */
26
+ defaultValue?: number | null;
27
+ /** Called with the new open items each time a trigger asks for a change, whether or not `value` is set: an index or `null`, or with `multiple` an array of indexes in ascending order. Indexes are positions among the children, as for `value`. */
28
+ onChange?: (value: number | null) => void;
29
+ }
30
+ /**
31
+ * Props for Collapses with `multiple`: items open and close independently.
32
+ */
33
+ export interface CollapsesMultipleProps extends CollapsesBaseProps {
34
+ /**
35
+ * Lets items open independently. Without it, opening one item closes the others.
36
+ * @defaultValue false
37
+ */
38
+ multiple: true;
39
+ /** Controlled open items: the index of the open item, or `null` for none. With `multiple`, an array of indexes. An index is a position among the children, so rendering an item conditionally or reordering them moves the open state onto a neighbour: render every item and hide one with `visibility="hidden"`, or keep `value` in step yourself. */
40
+ value?: number[];
41
+ /** Open items for uncontrolled use, as an index or `null` (the default, none open). With `multiple`, an array of indexes, empty by default. Indexes are positions among the children, as for `value`. */
42
+ defaultValue?: number[];
43
+ /** Called with the new open items each time a trigger asks for a change, whether or not `value` is set: an index or `null`, or with `multiple` an array of indexes in ascending order. Indexes are positions among the children, as for `value`. */
44
+ onChange?: (value: number[]) => void;
45
+ }
46
+ /**
47
+ * Props for the Collapses component, a discriminated union on `multiple`: the open items are an index (or `null`) in single mode and an array of indexes with `multiple`.
48
+ */
49
+ export type CollapsesProps = CollapsesSingleProps | CollapsesMultipleProps;
50
+ export declare const Collapses: React.FC<CollapsesProps> & {
51
+ Collapse: React.FC<import("./Collapse.js").CollapseProps>;
52
+ };
53
+ export default Collapses;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * What a `Collapses` group hands the item it wraps: whether that item is open,
3
+ * and how to ask the group for a change.
4
+ *
5
+ * This module is internal. `index.ts` re-exports `Collapse` and `Collapses`
6
+ * whole, so the context lives here, where neither re-export reaches it.
7
+ */
8
+ export interface CollapsesItemContextValue {
9
+ /** Whether the group has this item open. */
10
+ open: boolean;
11
+ /** Asks the group to open (`true`) or close (`false`) this item. */
12
+ setOpen: (open: boolean) => void;
13
+ }
14
+ /**
15
+ * `null` outside a group. A `Collapse` also resets it to `null` for its own
16
+ * subtree, so a Collapse nested in an item's content keeps its own state
17
+ * instead of answering to its ancestor's slot in the group.
18
+ */
19
+ export declare const CollapsesItemContext: import("react").Context<CollapsesItemContextValue | null>;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ /**
3
+ * Props for the ClientOnly component.
4
+ */
5
+ export interface ClientOnlyProps {
6
+ /**
7
+ * Content to render once the page has hydrated. A function is called only
8
+ * then, so an inline expression that reads `window`, `document` or
9
+ * `localStorage` never runs on the server.
10
+ */
11
+ children?: React.ReactNode | (() => React.ReactNode);
12
+ /**
13
+ * Rendered on the server and during hydration instead of `children`, such
14
+ * as a placeholder the same size as the content so the layout doesn't
15
+ * shift when it arrives.
16
+ * @defaultValue null
17
+ */
18
+ fallback?: React.ReactNode;
19
+ }
20
+ /**
21
+ * Renders its children only in the browser, after hydration, and a `fallback` until then, so content that depends on browser-only state doesn't cause a hydration mismatch.
22
+ *
23
+ * The server render and the hydrating client render both show `fallback`,
24
+ * which keeps them identical; the children replace it in the commit that
25
+ * follows. In an app without server rendering the children show on the first
26
+ * render.
27
+ *
28
+ * @function
29
+ * @param {ClientOnlyProps} props - Props for the ClientOnly component.
30
+ * @returns The children once hydrated, otherwise the fallback.
31
+ *
32
+ * @example
33
+ * // The server's time zone is not the reader's.
34
+ * <ClientOnly fallback={<Skeleton variant="lines" lines={1} />}>
35
+ * {() => (
36
+ * <p>Times are shown in {Intl.DateTimeFormat().resolvedOptions().timeZone}.</p>
37
+ * )}
38
+ * </ClientOnly>
39
+ */
40
+ export declare function ClientOnly({ children, fallback }: ClientOnlyProps): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ /**
3
+ * The prop that makes an element inert, spelled for the React in use, or
4
+ * nothing when `inert` is false.
5
+ *
6
+ * Both majors must render `inert=""`, and each warns on the other's spelling
7
+ * and then drops the attribute. React 19 treats `inert` as a boolean and
8
+ * rejects the empty string. React 18 does not know the attribute, so it
9
+ * passes a string through and rejects `true`.
10
+ */
11
+ export declare const inertProps: (inert: boolean, major?: number) => React.HTMLAttributes<HTMLElement>;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  /**
2
3
  * Resolves a portal target: an `HTMLElement` is used directly, a non-empty
3
4
  * `string` is treated as a `document.querySelector` selector (falling back to
@@ -13,3 +14,64 @@
13
14
  * @returns The resolved DOM node to portal into.
14
15
  */
15
16
  export declare function resolvePortalContainer(container?: string | HTMLElement): HTMLElement;
17
+ /**
18
+ * Props for the Portal component.
19
+ */
20
+ export interface PortalProps {
21
+ /** Content to render into the container. */
22
+ children?: React.ReactNode;
23
+ /**
24
+ * Where the content goes: an element, or a `document.querySelector`
25
+ * selector. Omitted, empty, or a selector that matches nothing, it goes to
26
+ * `document.body`. A selector is looked up again on each render, so the
27
+ * content follows the target when it changes. Moving to another target
28
+ * remounts the children and resets their state, which includes a selector
29
+ * that only starts matching after the content has shown in `document.body`.
30
+ * Render the target first, or pass the element once you have it.
31
+ */
32
+ container?: string | HTMLElement;
33
+ /**
34
+ * Render the children in place instead, on the server as well as the
35
+ * client. Lets a component that portals only sometimes keep a single code
36
+ * path.
37
+ * @defaultValue false
38
+ */
39
+ disabled?: boolean;
40
+ }
41
+ /**
42
+ * Renders its children into another part of the page, `document.body` unless `container` says otherwise, so floating content escapes an ancestor's `overflow`, `transform` or stacking context.
43
+ *
44
+ * React's server renderer can't render a portal, so `Portal` renders nothing
45
+ * on the server and during hydration, and mounts its children in the commit
46
+ * that follows. The first client render then matches the server markup. In an app
47
+ * without server rendering it portals on the first render.
48
+ *
49
+ * React context, such as `ConfigProvider`'s class prefix, reaches the
50
+ * portaled children, and their React events bubble through the React tree.
51
+ * CSS inheritance follows the DOM instead: a scoped (non-`isRoot`) `Theme`
52
+ * sets its variables on a wrapper element the portaled content has left, so
53
+ * that content sees the page-level theme. Point `container` at an element
54
+ * inside the themed area to keep it.
55
+ *
56
+ * Tab order and focus follow the DOM too. Content portaled from inside a
57
+ * focus trap is no longer inside the trapped element, so the trap neither
58
+ * reaches it nor holds focus there: render nested overlays inside the
59
+ * trapped element, or give them a trap of their own.
60
+ *
61
+ * @function
62
+ * @param {PortalProps} props - Props for the Portal component.
63
+ * @returns The portal, the children in place when `disabled`, or nothing
64
+ * before hydration.
65
+ *
66
+ * @example
67
+ * <Portal>
68
+ * <div className="box">Rendered at the end of document.body</div>
69
+ * </Portal>
70
+ *
71
+ * @example
72
+ * // Into a dedicated overlay root
73
+ * <Portal container="#overlays">
74
+ * <CommandPalette />
75
+ * </Portal>
76
+ */
77
+ export declare function Portal({ children, container, disabled }: PortalProps): React.JSX.Element | null;
@@ -49,6 +49,8 @@ export declare function getActiveElementInTree(node: Node | null | undefined): E
49
49
  * opener sits in. A closed shadow root cannot be entered, so focus inside one
50
50
  * reads as its host.
51
51
  *
52
+ * @param doc - The document to start from: the component's own, when it may
53
+ * render into one other than the page's (an iframe's). Defaults to `document`.
52
54
  * @returns The focused element, or `null` when the document has none.
53
55
  */
54
- export declare function getDeepestActiveElement(): Element | null;
56
+ export declare function getDeepestActiveElement(doc?: Document): Element | null;
@@ -0,0 +1,74 @@
1
+ import type { RefObject } from 'react';
2
+ /**
3
+ * Options for `useFocusTrap`.
4
+ */
5
+ export interface UseFocusTrapOptions {
6
+ /**
7
+ * Whether the trap is on. Turning it on moves focus into the container;
8
+ * turning it off (or unmounting) releases Tab and restores focus.
9
+ * @defaultValue true
10
+ */
11
+ active?: boolean;
12
+ /**
13
+ * The element to focus when the trap turns on. Without it, or while it
14
+ * points at nothing, focus goes to the first tab stop inside the container,
15
+ * and to the container itself when there is none.
16
+ */
17
+ initialFocusRef?: RefObject<HTMLElement | null>;
18
+ /**
19
+ * Where focus goes when the trap turns off. `true` returns it to the element
20
+ * that had focus when the trap turned on; a ref sends it to that element
21
+ * instead; `false` leaves it alone. Focus is only moved while the trap still
22
+ * holds it, so a click that already put focus somewhere else outside the
23
+ * container keeps it there.
24
+ *
25
+ * `true` reads focus after the container's content has mounted, so content
26
+ * that focuses itself as it mounts (an `autoFocus` input) hides the element
27
+ * that opened it. And some browsers don't focus a button when it is
28
+ * clicked. For a panel opened from a button, pass the button's ref.
29
+ * @defaultValue true
30
+ */
31
+ restoreFocus?: boolean | RefObject<HTMLElement | null>;
32
+ }
33
+ /**
34
+ * Keeps keyboard focus inside a container while it is active: focus moves in
35
+ * when the trap turns on, Tab and Shift+Tab wrap between the first and last
36
+ * tab stops, and focus goes back where it came from when the trap turns off.
37
+ *
38
+ * Tab stops are what the browser's Tab visits, in document order: links,
39
+ * form controls, frames, media with controls, a `<details>` summary, editable
40
+ * regions, anything with `tabIndex={0}`, and the content of open shadow
41
+ * roots. Hidden, disabled, inert and `tabIndex={-1}` elements are skipped,
42
+ * and a radio group counts once. Give the container `tabIndex={-1}` so it can
43
+ * hold focus itself when nothing inside can. The trap listens on the
44
+ * container, so a trap nested inside another handles Tab first and the outer
45
+ * one stands aside.
46
+ *
47
+ * The trap is about Tab. If a Tab it let through still takes focus out (a
48
+ * browser can leave out a stop the page has, such as links when its settings
49
+ * say to), it sends focus back to the other end. A pointer or a script moving
50
+ * focus out is left alone, because pulling focus back from a click is modal
51
+ * behaviour, and a modal also has to block the page behind it, which `Modal`
52
+ * does. Content the container renders through a portal lives elsewhere in
53
+ * the DOM, so it is outside the trap: render nested overlays inside the
54
+ * container, or give them a trap of their own.
55
+ *
56
+ * The container has to be in the DOM when the trap turns on. The trap waits
57
+ * for hydration, so a container that only appears once the page has
58
+ * hydrated, the way portaled content does, still has it attach in the commit
59
+ * where the container appears.
60
+ *
61
+ * @function useFocusTrap
62
+ * @param containerRef - Ref to the element focus stays inside.
63
+ * @param options - When the trap is on, and where focus starts and ends.
64
+ *
65
+ * @example
66
+ * const panelRef = useRef<HTMLDivElement>(null);
67
+ * useFocusTrap(panelRef, { active: isOpen });
68
+ * return isOpen ? (
69
+ * <div ref={panelRef} role="dialog" aria-label="Filters" tabIndex={-1}>
70
+ * …
71
+ * </div>
72
+ * ) : null;
73
+ */
74
+ export declare function useFocusTrap(containerRef: RefObject<HTMLElement | null>, options?: UseFocusTrapOptions): void;
@@ -6,6 +6,11 @@
6
6
  * DOM-only behaviour (such as portalling) past hydration so the first client
7
7
  * render matches the server markup instead of tripping hydration recovery.
8
8
  *
9
+ * Only a component that hydrates ever sees `false` on the client. One that
10
+ * mounts later (after a route change, or in an app with no server rendering)
11
+ * gets `true` on its first render, so it pays for no extra render. It
12
+ * subscribes to nothing, so no later render flips it back.
13
+ *
9
14
  * @function useIsHydrated
10
15
  * @returns `true` once the hydrating render has completed, otherwise `false`.
11
16
  */
@@ -15,6 +15,7 @@ export * from './components/Panel.js';
15
15
  export * from './components/Tabs.js';
16
16
  export * from './components/Loading.js';
17
17
  export * from './components/Collapse.js';
18
+ export * from './components/Collapses.js';
18
19
  export * from './components/Tooltip.js';
19
20
  export * from './components/Steps.js';
20
21
  export * from './components/Sidebar.js';
@@ -106,6 +107,13 @@ export * from './helpers/mergeBulmaStyles.js';
106
107
  export * from './helpers/useBulmaClasses.js';
107
108
  export * from './helpers/Theme.js';
108
109
  export * from './helpers/Config.js';
110
+ export { ClientOnly } from './helpers/ClientOnly.js';
111
+ export type { ClientOnlyProps } from './helpers/ClientOnly.js';
112
+ export { useIsHydrated } from './helpers/useIsHydrated.js';
113
+ export { Portal } from './helpers/portal.js';
114
+ export type { PortalProps } from './helpers/portal.js';
115
+ export { useFocusTrap } from './helpers/useFocusTrap.js';
116
+ export type { UseFocusTrapOptions } from './helpers/useFocusTrap.js';
109
117
  export * from './layout/Container.js';
110
118
  export * from './layout/Footer.js';
111
119
  export * from './layout/Hero.js';
@@ -6,14 +6,21 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
6
6
  * @extraProp {string} [className] - Additional CSS classes.
7
7
  */
8
8
  export interface CollapseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
9
- /** Controlled open state. If provided, component is controlled. */
9
+ /**
10
+ * Controlled open state. If provided, component is controlled, and the
11
+ * trigger only reports through `onOpenChange`. Inside a `Collapses` group, a
12
+ * Collapse that sets `open` stays yours: the group neither overrides it nor
13
+ * closes it when another item opens.
14
+ */
10
15
  open?: boolean;
11
- /** Initial open state for uncontrolled usage. */
16
+ /** Initial open state for uncontrolled usage. Ignored inside a `Collapses` group, whose `defaultValue` decides. */
12
17
  defaultOpen?: boolean;
13
- /** Callback when collapse opens. */
18
+ /** Called when the trigger opens the Collapse. Fires only while the Collapse keeps its own state: not when `open` is set, and not when a `Collapses` group manages it. `onOpenChange` reports in every mode. */
14
19
  onOpen?: () => void;
15
- /** Callback when collapse closes. */
20
+ /** Called when the trigger closes the Collapse. Fires only while the Collapse keeps its own state: not when `open` is set, and not when a `Collapses` group manages it. `onOpenChange` reports in every mode. */
16
21
  onClose?: () => void;
22
+ /** Called with the state the trigger asks for (`true` to open) each time it is clicked or activated with Enter or Space, in every mode. Pair it with `open` to let the trigger drive a controlled Collapse. */
23
+ onOpenChange?: (open: boolean) => void;
17
24
  /** The clickable trigger element (header/button). */
18
25
  trigger?: React.ReactNode;
19
26
  /** Animation style, or `false` to disable. */
@@ -46,12 +53,9 @@ export interface CollapseProps extends Omit<React.HTMLAttributes<HTMLDivElement>
46
53
  * </Collapse>
47
54
  *
48
55
  * @example
49
- * // Controlled collapse
56
+ * // Controlled collapse, driven by its own trigger
50
57
  * const [isOpen, setIsOpen] = useState(false);
51
- * <Collapse
52
- * open={isOpen}
53
- * trigger={<button onClick={() => setIsOpen(!isOpen)}>Toggle</button>}
54
- * >
58
+ * <Collapse open={isOpen} onOpenChange={setIsOpen} trigger={<strong>Toggle</strong>}>
55
59
  * <p>Content</p>
56
60
  * </Collapse>
57
61
  *
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ /**
4
+ * Props shared by both modes of the Collapses component.
5
+ */
6
+ interface CollapsesBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'defaultValue' | 'onChange'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
7
+ /** Joins the items into one block, with no gap between them and only the outer corners rounded. The joins show on `bordered` items. */
8
+ seamless?: boolean;
9
+ /** Additional CSS classes to apply. */
10
+ className?: string;
11
+ /** The `Collapse` items. Each child element is one item, indexed from 0 in order, with the children of a fragment counted one by one. A child that sets its own `open` keeps it: the group leaves that item alone. */
12
+ children?: React.ReactNode;
13
+ }
14
+ /**
15
+ * Props for Collapses in single mode, the accordion: opening one item closes the others.
16
+ */
17
+ export interface CollapsesSingleProps extends CollapsesBaseProps {
18
+ /**
19
+ * Lets items open independently. Without it, opening one item closes the others.
20
+ * @defaultValue false
21
+ */
22
+ multiple?: false;
23
+ /** Controlled open items: the index of the open item, or `null` for none. With `multiple`, an array of indexes. An index is a position among the children, so rendering an item conditionally or reordering them moves the open state onto a neighbour: render every item and hide one with `visibility="hidden"`, or keep `value` in step yourself. */
24
+ value?: number | null;
25
+ /** Open items for uncontrolled use, as an index or `null` (the default, none open). With `multiple`, an array of indexes, empty by default. Indexes are positions among the children, as for `value`. */
26
+ defaultValue?: number | null;
27
+ /** Called with the new open items each time a trigger asks for a change, whether or not `value` is set: an index or `null`, or with `multiple` an array of indexes in ascending order. Indexes are positions among the children, as for `value`. */
28
+ onChange?: (value: number | null) => void;
29
+ }
30
+ /**
31
+ * Props for Collapses with `multiple`: items open and close independently.
32
+ */
33
+ export interface CollapsesMultipleProps extends CollapsesBaseProps {
34
+ /**
35
+ * Lets items open independently. Without it, opening one item closes the others.
36
+ * @defaultValue false
37
+ */
38
+ multiple: true;
39
+ /** Controlled open items: the index of the open item, or `null` for none. With `multiple`, an array of indexes. An index is a position among the children, so rendering an item conditionally or reordering them moves the open state onto a neighbour: render every item and hide one with `visibility="hidden"`, or keep `value` in step yourself. */
40
+ value?: number[];
41
+ /** Open items for uncontrolled use, as an index or `null` (the default, none open). With `multiple`, an array of indexes, empty by default. Indexes are positions among the children, as for `value`. */
42
+ defaultValue?: number[];
43
+ /** Called with the new open items each time a trigger asks for a change, whether or not `value` is set: an index or `null`, or with `multiple` an array of indexes in ascending order. Indexes are positions among the children, as for `value`. */
44
+ onChange?: (value: number[]) => void;
45
+ }
46
+ /**
47
+ * Props for the Collapses component, a discriminated union on `multiple`: the open items are an index (or `null`) in single mode and an array of indexes with `multiple`.
48
+ */
49
+ export type CollapsesProps = CollapsesSingleProps | CollapsesMultipleProps;
50
+ export declare const Collapses: React.FC<CollapsesProps> & {
51
+ Collapse: React.FC<import("./Collapse.js").CollapseProps>;
52
+ };
53
+ export default Collapses;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * What a `Collapses` group hands the item it wraps: whether that item is open,
3
+ * and how to ask the group for a change.
4
+ *
5
+ * This module is internal. `index.ts` re-exports `Collapse` and `Collapses`
6
+ * whole, so the context lives here, where neither re-export reaches it.
7
+ */
8
+ export interface CollapsesItemContextValue {
9
+ /** Whether the group has this item open. */
10
+ open: boolean;
11
+ /** Asks the group to open (`true`) or close (`false`) this item. */
12
+ setOpen: (open: boolean) => void;
13
+ }
14
+ /**
15
+ * `null` outside a group. A `Collapse` also resets it to `null` for its own
16
+ * subtree, so a Collapse nested in an item's content keeps its own state
17
+ * instead of answering to its ancestor's slot in the group.
18
+ */
19
+ export declare const CollapsesItemContext: import("react").Context<CollapsesItemContextValue | null>;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ /**
3
+ * Props for the ClientOnly component.
4
+ */
5
+ export interface ClientOnlyProps {
6
+ /**
7
+ * Content to render once the page has hydrated. A function is called only
8
+ * then, so an inline expression that reads `window`, `document` or
9
+ * `localStorage` never runs on the server.
10
+ */
11
+ children?: React.ReactNode | (() => React.ReactNode);
12
+ /**
13
+ * Rendered on the server and during hydration instead of `children`, such
14
+ * as a placeholder the same size as the content so the layout doesn't
15
+ * shift when it arrives.
16
+ * @defaultValue null
17
+ */
18
+ fallback?: React.ReactNode;
19
+ }
20
+ /**
21
+ * Renders its children only in the browser, after hydration, and a `fallback` until then, so content that depends on browser-only state doesn't cause a hydration mismatch.
22
+ *
23
+ * The server render and the hydrating client render both show `fallback`,
24
+ * which keeps them identical; the children replace it in the commit that
25
+ * follows. In an app without server rendering the children show on the first
26
+ * render.
27
+ *
28
+ * @function
29
+ * @param {ClientOnlyProps} props - Props for the ClientOnly component.
30
+ * @returns The children once hydrated, otherwise the fallback.
31
+ *
32
+ * @example
33
+ * // The server's time zone is not the reader's.
34
+ * <ClientOnly fallback={<Skeleton variant="lines" lines={1} />}>
35
+ * {() => (
36
+ * <p>Times are shown in {Intl.DateTimeFormat().resolvedOptions().timeZone}.</p>
37
+ * )}
38
+ * </ClientOnly>
39
+ */
40
+ export declare function ClientOnly({ children, fallback }: ClientOnlyProps): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ /**
3
+ * The prop that makes an element inert, spelled for the React in use, or
4
+ * nothing when `inert` is false.
5
+ *
6
+ * Both majors must render `inert=""`, and each warns on the other's spelling
7
+ * and then drops the attribute. React 19 treats `inert` as a boolean and
8
+ * rejects the empty string. React 18 does not know the attribute, so it
9
+ * passes a string through and rejects `true`.
10
+ */
11
+ export declare const inertProps: (inert: boolean, major?: number) => React.HTMLAttributes<HTMLElement>;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  /**
2
3
  * Resolves a portal target: an `HTMLElement` is used directly, a non-empty
3
4
  * `string` is treated as a `document.querySelector` selector (falling back to
@@ -13,3 +14,64 @@
13
14
  * @returns The resolved DOM node to portal into.
14
15
  */
15
16
  export declare function resolvePortalContainer(container?: string | HTMLElement): HTMLElement;
17
+ /**
18
+ * Props for the Portal component.
19
+ */
20
+ export interface PortalProps {
21
+ /** Content to render into the container. */
22
+ children?: React.ReactNode;
23
+ /**
24
+ * Where the content goes: an element, or a `document.querySelector`
25
+ * selector. Omitted, empty, or a selector that matches nothing, it goes to
26
+ * `document.body`. A selector is looked up again on each render, so the
27
+ * content follows the target when it changes. Moving to another target
28
+ * remounts the children and resets their state, which includes a selector
29
+ * that only starts matching after the content has shown in `document.body`.
30
+ * Render the target first, or pass the element once you have it.
31
+ */
32
+ container?: string | HTMLElement;
33
+ /**
34
+ * Render the children in place instead, on the server as well as the
35
+ * client. Lets a component that portals only sometimes keep a single code
36
+ * path.
37
+ * @defaultValue false
38
+ */
39
+ disabled?: boolean;
40
+ }
41
+ /**
42
+ * Renders its children into another part of the page, `document.body` unless `container` says otherwise, so floating content escapes an ancestor's `overflow`, `transform` or stacking context.
43
+ *
44
+ * React's server renderer can't render a portal, so `Portal` renders nothing
45
+ * on the server and during hydration, and mounts its children in the commit
46
+ * that follows. The first client render then matches the server markup. In an app
47
+ * without server rendering it portals on the first render.
48
+ *
49
+ * React context, such as `ConfigProvider`'s class prefix, reaches the
50
+ * portaled children, and their React events bubble through the React tree.
51
+ * CSS inheritance follows the DOM instead: a scoped (non-`isRoot`) `Theme`
52
+ * sets its variables on a wrapper element the portaled content has left, so
53
+ * that content sees the page-level theme. Point `container` at an element
54
+ * inside the themed area to keep it.
55
+ *
56
+ * Tab order and focus follow the DOM too. Content portaled from inside a
57
+ * focus trap is no longer inside the trapped element, so the trap neither
58
+ * reaches it nor holds focus there: render nested overlays inside the
59
+ * trapped element, or give them a trap of their own.
60
+ *
61
+ * @function
62
+ * @param {PortalProps} props - Props for the Portal component.
63
+ * @returns The portal, the children in place when `disabled`, or nothing
64
+ * before hydration.
65
+ *
66
+ * @example
67
+ * <Portal>
68
+ * <div className="box">Rendered at the end of document.body</div>
69
+ * </Portal>
70
+ *
71
+ * @example
72
+ * // Into a dedicated overlay root
73
+ * <Portal container="#overlays">
74
+ * <CommandPalette />
75
+ * </Portal>
76
+ */
77
+ export declare function Portal({ children, container, disabled }: PortalProps): React.JSX.Element | null;
@@ -49,6 +49,8 @@ export declare function getActiveElementInTree(node: Node | null | undefined): E
49
49
  * opener sits in. A closed shadow root cannot be entered, so focus inside one
50
50
  * reads as its host.
51
51
  *
52
+ * @param doc - The document to start from: the component's own, when it may
53
+ * render into one other than the page's (an iframe's). Defaults to `document`.
52
54
  * @returns The focused element, or `null` when the document has none.
53
55
  */
54
- export declare function getDeepestActiveElement(): Element | null;
56
+ export declare function getDeepestActiveElement(doc?: Document): Element | null;