@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
@@ -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';