@flipdish/ui-library 0.43.1 → 0.44.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 (65) hide show
  1. package/dist/components/organisms/SidePanel/components/SidePanelRegion.cjs +1 -1
  2. package/dist/components/organisms/SidePanel/components/SidePanelRegion.js +1 -1
  3. package/dist/components/organisms/SidebarNavigation/hooks/useRailBounds.cjs +48 -0
  4. package/dist/components/organisms/SidebarNavigation/hooks/useRailBounds.cjs.map +1 -0
  5. package/dist/components/organisms/SidebarNavigation/hooks/useRailBounds.d.ts +19 -0
  6. package/dist/components/organisms/SidebarNavigation/hooks/useRailBounds.d.ts.map +1 -0
  7. package/dist/components/organisms/SidebarNavigation/hooks/useRailBounds.js +46 -0
  8. package/dist/components/organisms/SidebarNavigation/hooks/useRailBounds.js.map +1 -0
  9. package/dist/components/organisms/SidebarNavigation/index.cjs +10 -5
  10. package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
  11. package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
  12. package/dist/components/organisms/SidebarNavigation/index.js +10 -5
  13. package/dist/components/organisms/SidebarNavigation/index.js.map +1 -1
  14. package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs +27 -9
  15. package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs.map +1 -1
  16. package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts +5 -4
  17. package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts.map +1 -1
  18. package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js +28 -10
  19. package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js.map +1 -1
  20. package/dist/components/organisms/SlideoutMenu/index.cjs +2 -1
  21. package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
  22. package/dist/components/organisms/SlideoutMenu/index.d.ts +12 -2
  23. package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
  24. package/dist/components/organisms/SlideoutMenu/index.js +2 -1
  25. package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
  26. package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.cjs +14 -0
  27. package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.cjs.map +1 -0
  28. package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.d.ts +9 -0
  29. package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.d.ts.map +1 -0
  30. package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.js +12 -0
  31. package/dist/components/organisms/SlideoutMenu/providers/PageArea.context.js.map +1 -0
  32. package/dist/components/templates/AppShell/index.cjs +11 -7
  33. package/dist/components/templates/AppShell/index.cjs.map +1 -1
  34. package/dist/components/templates/AppShell/index.d.ts +2 -1
  35. package/dist/components/templates/AppShell/index.d.ts.map +1 -1
  36. package/dist/components/templates/AppShell/index.js +11 -7
  37. package/dist/components/templates/AppShell/index.js.map +1 -1
  38. package/dist/{components/organisms/SidePanel/hooks → hooks/__internal__/usePanelFocus}/usePanelFocus.cjs +56 -8
  39. package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.cjs.map +1 -0
  40. package/dist/{components/organisms/SidePanel/hooks → hooks/__internal__/usePanelFocus}/usePanelFocus.d.ts +12 -3
  41. package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.d.ts.map +1 -0
  42. package/dist/{components/organisms/SidePanel/hooks → hooks/__internal__/usePanelFocus}/usePanelFocus.js +56 -8
  43. package/dist/hooks/__internal__/usePanelFocus/usePanelFocus.js.map +1 -0
  44. package/dist/providers/ThemeProvider/index.cjs +8 -0
  45. package/dist/providers/ThemeProvider/index.cjs.map +1 -1
  46. package/dist/providers/ThemeProvider/index.d.ts +7 -0
  47. package/dist/providers/ThemeProvider/index.d.ts.map +1 -1
  48. package/dist/providers/ThemeProvider/index.js +8 -1
  49. package/dist/providers/ThemeProvider/index.js.map +1 -1
  50. package/dist/utilities/__internal__/inertUtils/inert.utils.cjs +46 -0
  51. package/dist/utilities/__internal__/inertUtils/inert.utils.cjs.map +1 -0
  52. package/dist/utilities/__internal__/inertUtils/inert.utils.d.ts +18 -0
  53. package/dist/utilities/__internal__/inertUtils/inert.utils.d.ts.map +1 -0
  54. package/dist/utilities/__internal__/inertUtils/inert.utils.js +43 -0
  55. package/dist/utilities/__internal__/inertUtils/inert.utils.js.map +1 -0
  56. package/dist/utilities/__internal__/viewportUtils/viewport.utils.cjs +37 -0
  57. package/dist/utilities/__internal__/viewportUtils/viewport.utils.cjs.map +1 -0
  58. package/dist/utilities/__internal__/viewportUtils/viewport.utils.d.ts +17 -0
  59. package/dist/utilities/__internal__/viewportUtils/viewport.utils.d.ts.map +1 -0
  60. package/dist/utilities/__internal__/viewportUtils/viewport.utils.js +34 -0
  61. package/dist/utilities/__internal__/viewportUtils/viewport.utils.js.map +1 -0
  62. package/package.json +2 -1
  63. package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs.map +0 -1
  64. package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts.map +0 -1
  65. package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js.map +0 -1
@@ -1,20 +1,46 @@
1
1
  import { useRef, useState, useEffect, useLayoutEffect, useCallback } from 'react';
2
- import { getFocusedElement } from '../../../../utilities/__internal__/focusUtils/focus.utils.js';
2
+ import { getFocusedElement } from '../../../utilities/__internal__/focusUtils/focus.utils.js';
3
+ import { coverElement, lastCoverOf } from '../../../utilities/__internal__/inertUtils/inert.utils.js';
3
4
 
4
5
  /** The element before the panel when it can take focus, such as `AppShell`'s scroll area. */
5
6
  const focusableSiblingBefore = (panel) => {
6
7
  const sibling = panel.previousElementSibling;
7
8
  return sibling instanceof HTMLElement && sibling.tabIndex >= 0 ? sibling : null;
8
9
  };
10
+ /** Whether a hand-back can land: a control, or a region given a `tabindex`, that no cover has taken out of reach. */
11
+ const canTakeFocus = (element) => element instanceof HTMLElement && (element.tabIndex >= 0 || element.hasAttribute('tabindex')) && element.closest('[inert]') === null;
12
+ /**
13
+ * What covers an element under an inert ancestor: the last panel to cover that ancestor, else the sibling after it, as a
14
+ * side panel sits after the page it covers. Nothing when that cannot take focus, such as a plain wrapper.
15
+ */
16
+ const coverOver = (element) => {
17
+ const covered = element.closest('[inert]');
18
+ if (!(covered instanceof HTMLElement))
19
+ return null;
20
+ const candidate = lastCoverOf(covered) ?? covered.nextElementSibling;
21
+ return canTakeFocus(candidate) ? candidate : null;
22
+ };
23
+ /**
24
+ * What the panel covers: the given element, unless the panel sits inside it, as overlays do without a scoped anchor, when
25
+ * nothing is; without one, the panel's siblings.
26
+ */
27
+ const resolveCovered = (panel, coveredRef) => {
28
+ if (!coveredRef)
29
+ return panel.parentElement;
30
+ const covered = coveredRef.current;
31
+ return covered && !covered.contains(panel) ? covered : null;
32
+ };
9
33
  /**
10
34
  * Hands focus into the panel when it opens and back to the control that opened it when it closes,
11
- * and makes a leaving panel inert. Managed by hand, not with a focus scope: a scope would also
12
- * reroute Tab at the panel's edges, as a popover does.
35
+ * makes a leaving panel inert, and takes what the panel covers out of reach while it covers it.
36
+ * Managed by hand, not with a focus scope: a scope would also reroute Tab at the panel's edges, as
37
+ * a popover does.
13
38
  *
39
+ * @param options See `UsePanelFocusOptions`.
14
40
  * @returns a capture-phase focus handler to spread onto the panel element, and `setOpener`, which points the hand-back on
15
41
  * close at another control after a content swap
16
42
  */
17
- const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount, contentKey }) => {
43
+ const usePanelFocus = ({ panelRef, isPresent, isDesktop, coveredRef, shouldFocusOnMount, contentKey }) => {
18
44
  const openerRef = useRef(null);
19
45
  const previousIsPresent = useRef(null);
20
46
  const previousIsDesktop = useRef(isDesktop);
@@ -46,22 +72,44 @@ const usePanelFocus = ({ panelRef, isPresent, isDesktop, shouldFocusOnMount, con
46
72
  if (isLeaving && hasFocusInside) {
47
73
  const opener = openerRef.current;
48
74
  // The opener may have unmounted meanwhile, such as a header button that only renders at one breakpoint.
49
- (opener?.isConnected ? opener : focusableSiblingBefore(panel))?.focus();
75
+ const target = opener?.isConnected ? opener : focusableSiblingBefore(panel);
76
+ target?.focus();
77
+ // An opener under a cover, a side panel or another panel over the page below `lg`, refuses focus: what covers it takes it instead.
78
+ if (target && getFocusedElement() !== target)
79
+ coverOver(target)?.focus();
50
80
  }
51
81
  // A leaving panel must not be reachable while another opens; set last, since inert drops any focus inside it.
52
82
  if (!isPresent)
53
83
  panel.inert = true;
54
84
  }, [panelRef, isPresent, shouldFocusOnMount, focusedBeforeMount]);
85
+ // Before the cover below is applied, so focus leaves the page while the page can still be read as holding it.
55
86
  useEffect(() => {
56
87
  const hasStartedCoveringPage = previousIsDesktop.current && !isDesktop;
57
88
  previousIsDesktop.current = isDesktop;
58
89
  const panel = panelRef.current;
59
90
  const focused = getFocusedElement();
60
- // The page beside the panel is about to go out of reach, so focus must not be left in it.
61
- if (hasStartedCoveringPage && panel && focused && !panel.contains(focused) && panel.parentElement?.contains(focused)) {
91
+ // The page the panel covers is about to go out of reach, so focus must not be left in it, where inert would drop it on nothing.
92
+ const covered = panel && resolveCovered(panel, coveredRef);
93
+ if (hasStartedCoveringPage && panel && focused && !panel.contains(focused) && covered?.contains(focused)) {
62
94
  panel.focus({ preventScroll: true });
63
95
  }
64
- }, [panelRef, isDesktop]);
96
+ }, [panelRef, coveredRef, isDesktop]);
97
+ // React runs every cleanup before any effect in a commit, so the cover lifts before the hand-back above lands focus in the
98
+ // page. Covers are counted per element, so two panels over the same page restore its own `inert` only when the last lifts.
99
+ const isCovering = isPresent && !isDesktop;
100
+ useEffect(() => {
101
+ const panel = panelRef.current;
102
+ // Only a given element is covered; the panel's siblings are the layout's to cover, as `AppShell` does for a side panel.
103
+ const covered = isCovering && panel && coveredRef ? resolveCovered(panel, coveredRef) : null;
104
+ if (!panel || !covered)
105
+ return;
106
+ // An area chosen while the panel is open, such as the app root arriving a commit late, may hold focus the hand-off above
107
+ // did not see: it moves into the panel before the area goes out of reach.
108
+ const focused = getFocusedElement();
109
+ if (focused && covered.contains(focused))
110
+ panel.focus({ preventScroll: true });
111
+ return coverElement(covered, panel);
112
+ }, [panelRef, coveredRef, isCovering]);
65
113
  // Swapping content unmounts whatever held focus, which drops it on the page. The region takes it, so Tab stays inside and
66
114
  // closing can still hand it back. Content that focuses itself on mount (an `autoFocus` input) has done so by now and keeps it.
67
115
  const previousContentKey = useRef(contentKey);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePanelFocus.js","sources":["../../../../src/hooks/__internal__/usePanelFocus/usePanelFocus.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;AAED;AACA,MAAM,YAAY,GAAG,CAAC,OAAmC,KACvD,OAAO,YAAY,WAAW,KAAK,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI;AAEtI;;;AAGG;AACH,MAAM,SAAS,GAAG,CAAC,OAAoB,KAAwB;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;AAC1C,IAAA,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC;AAAE,QAAA,OAAO,IAAI;IAClD,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,kBAAkB;AAEpE,IAAA,OAAO,YAAY,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI;AACnD,CAAC;AAED;;;AAGG;AACH,MAAM,cAAc,GAAG,CAAC,KAAkB,EAAE,UAAqD,KAAwB;AACvH,IAAA,IAAI,CAAC,UAAU;QA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Aa,CAAC,QAAQ,CAAC,IAAI,CAAC;AAAE,YAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AAChI,IAAA,CAAC;;AAGD,IAAA,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,OAAoB,KAAI;AACrD,QAAA,SAAS,CAAC,OAAO,GAAG,OAAO;IAC7B,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE;AACtC;;"}
@@ -17,6 +17,13 @@ const useTheme = () => {
17
17
  }
18
18
  return context;
19
19
  };
20
+ /**
21
+ * The element the app's theme cascades from: in a micro-frontend, its whole mount. Unlike `useTheme` it never throws,
22
+ * so a component can adapt to the app's root without requiring the provider.
23
+ *
24
+ * @returns The themed root, or `null` outside a `ThemeProvider` or before it has mounted.
25
+ */
26
+ const useThemeRoot = () => React.useContext(ThemeContext)?.themeRoot ?? null;
20
27
  // Providers currently mirroring onto <html>, so a page with several (a Storybook docs page mounts one per
21
28
  // story) only loses the attribute when the last one unmounts.
22
29
  let documentThemeWriters = 0;
@@ -85,4 +92,5 @@ const ThemeProvider = ({ children, defaultTheme = 'system', storageKey, themeMod
85
92
 
86
93
  exports.ThemeProvider = ThemeProvider;
87
94
  exports.useTheme = useTheme;
95
+ exports.useThemeRoot = useThemeRoot;
88
96
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/providers/ThemeProvider/index.tsx"],"sourcesContent":[null],"names":["createContext","useContext","useState","useEffect","useMemo","_jsx"],"mappings":";;;;;AAcA,MAAM,YAAY,GAAGA,mBAAa,CAA+B,SAAS,CAAC;AAE3E;;;;;AAKG;AACI,MAAM,QAAQ,GAAG,MAAuB;AAC7C,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,YAAY,CAAC;AAExC,IAAA,IAAI,OAAO,KAAK,SAAS,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;AAEA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CAAC,CAAC;AAEvI,IAAA,QACEC,cAAA,CAAC,YAAY,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EACxCA,cAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,YAAY,EAAA,YAAA,EAAc,YAAY,EAAA,gBAAA,EAAkB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EACtG,QAAQ,EAAA,CACL,EAAA,CACgB;AAE5B;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/providers/ThemeProvider/index.tsx"],"sourcesContent":[null],"names":["createContext","useContext","useState","useEffect","useMemo","_jsx"],"mappings":";;;;;AAcA,MAAM,YAAY,GAAGA,mBAAa,CAA+B,SAAS,CAAC;AAE3E;;;;;AAKG;AACI,MAAM,QAAQ,GAAG,MAAuB;AAC7C,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,YAAY,CAAC;AAExC,IAAA,IAAI,OAAO,KAAK,SAAS,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;AAEA,IAAA,OAAO,OAAO;AAChB;AAEA;;;;;AAKG;AACI,MAAM,YAAY,GAAG,MAA0BA,gBAAU,CAAC,YAAY,CAAC,EAAE,SAAS,IAAI;AAE7F;AACA;AACA,IAAI,oBAAoB,GAAG,CAAC;AAE5B,MAAM,uBAAuB,GAAG,MAAuB;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,OAAO;AACjD,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO;AACrF,CAAC;AAkCD;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,CAAC,EAC5B,QAAQ,EACR,YAAY,GAAG,QAAQ,EACvB,UAAU,EACV,iBAAiB,EACjB,OAAO,EAAE,WAAW,EACpB,iBAAiB,EAAE,qBAAqB,GACrB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AK;AACb,QAAA,IAAI,iBAAiB;YAAE;AACvB,QAAA,IAAI,WAAW,KAAK,QAAQ,EAAE;AAC5B,YAAA,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC;QAC7C;aAAO;AACL,YAAA,YAAY,CAAC,OAAO,CAAC,kBAAkB,EAAE,WAAW,CAAC;QACvD;IACF,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;IAExDA,eAAS,CAAC,MAAK;QACb,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC;AACpE,QAAA,MAAM,YAAY,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AACrF,QAAA,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC;QACnD,OAAO,MAAM,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC;IACrE,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,MAAM,YAAY,GAAGC,aAAO,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AAEvI,IAAA,QACEC,cAAA,CAAC,YAAY,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EACxCA,cAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,YAAY,EAAA,YAAA,EAAc,YAAY,EAAA,gBAAA,EAAkB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EACtG,QAAQ,EAAA,CACL,EAAA,CACgB;AAE5B;;;;"}
@@ -13,6 +13,13 @@ interface ThemeContextType {
13
13
  * element carrying `data-theme`.
14
14
  */
15
15
  export declare const useTheme: () => ThemeContextType;
16
+ /**
17
+ * The element the app's theme cascades from: in a micro-frontend, its whole mount. Unlike `useTheme` it never throws,
18
+ * so a component can adapt to the app's root without requiring the provider.
19
+ *
20
+ * @returns The themed root, or `null` outside a `ThemeProvider` or before it has mounted.
21
+ */
22
+ export declare const useThemeRoot: () => HTMLElement | null;
16
23
  interface ThemeProviderProps {
17
24
  children: ReactNode;
18
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/ThemeProvider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzC,UAAU,gBAAgB;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAID;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAO,gBAQ3B,CAAC;AAWF,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,4HAO3B,kBAAkB,gCA0DpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/ThemeProvider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzC,UAAU,gBAAgB;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAID;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAO,gBAQ3B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAO,WAAW,GAAG,IAAmD,CAAC;AAWlG,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,4HAO3B,kBAAkB,gCA0DpB,CAAC"}
@@ -15,6 +15,13 @@ const useTheme = () => {
15
15
  }
16
16
  return context;
17
17
  };
18
+ /**
19
+ * The element the app's theme cascades from: in a micro-frontend, its whole mount. Unlike `useTheme` it never throws,
20
+ * so a component can adapt to the app's root without requiring the provider.
21
+ *
22
+ * @returns The themed root, or `null` outside a `ThemeProvider` or before it has mounted.
23
+ */
24
+ const useThemeRoot = () => useContext(ThemeContext)?.themeRoot ?? null;
18
25
  // Providers currently mirroring onto <html>, so a page with several (a Storybook docs page mounts one per
19
26
  // story) only loses the attribute when the last one unmounts.
20
27
  let documentThemeWriters = 0;
@@ -81,5 +88,5 @@ const ThemeProvider = ({ children, defaultTheme = 'system', storageKey, themeMod
81
88
  return (jsx(ThemeContext.Provider, { value: contextValue, children: jsx("div", { ref: setThemeRoot, "data-theme": resolvedMode, "data-mfe-scope": scopeId, style: { display: 'contents' }, children: children }) }));
82
89
  };
83
90
 
84
- export { ThemeProvider, useTheme };
91
+ export { ThemeProvider, useTheme, useThemeRoot };
85
92
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/providers/ThemeProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;AAcA,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC;AAE3E;;;;;AAKG;AACI,MAAM,QAAQ,GAAG,MAAuB;AAC7C,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC;AAExC,IAAA,IAAI,OAAO,KAAK,SAAS,EAAE;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;AAEA,IAAA,OAAO,OAAO;AAChB;AAEA;AACA;AACA,IAAI,oBAAoB,GAAG,CAAC;AAE5B,MAAM,uBAAuB,GAAG,MAAuB;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,OAAO;AACjD,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO;AACrF,CAAC;AAkCD;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,CAAC,EAC5B,QAAQ,EACR,YAAY,GAAG,QAAQ,EACvB,UAAU,EACV,iBAAiB,EACjB,OAAO,EAAE,WAAW,EACpB,iBAAiB,EAAE,qBAAqB,GACrB,KAAI;;AAEvB,IAAA,MAAM,OAAO,GAAG,WAAW,IAAI,SAAS;AACxC,IAAA,MAAM,iBAAiB,GAAG,qBAAqB,KAAK,iBAAiB,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,CAAC;AAC7G,IAAA,MAAM,kBAAkB,GAAG,UAAU,KAAK,OAAO,GA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EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AAEvI,IAAA,QACEA,GAAA,CAAC,YAAY,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EACxCA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,YAAY,EAAA,YAAA,EAAc,YAAY,EAAA,gBAAA,EAAkB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EACtG,QAAQ,EAAA,CACL,EAAA,CACgB;AAE5B;;"}
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ /** Covers in force per element, who holds each, and the `inert` the element had before the first, so the last to lift restores it. */
4
+ const covers = new WeakMap();
5
+ /**
6
+ * Makes an element inert for one cover among possibly several, such as two panels over the same page. The element's own
7
+ * `inert` is read at the first cover and restored only when the last lifts, whatever order the covers lift in, so nothing
8
+ * else may write `inert` on the element meanwhile.
9
+ *
10
+ * @param element The element to take out of reach.
11
+ * @param by The panel covering it, which `lastCoverOf` reports so focus can be handed to it.
12
+ * @returns Lifts this cover; calling it twice is harmless.
13
+ */
14
+ const coverElement = (element, by) => {
15
+ // The attribute rather than the property: a browser reflects one into the other, and `[inert]` selectors then see the cover.
16
+ const active = covers.get(element) ?? { by: [], wasInert: element.hasAttribute('inert') };
17
+ if (active.by.length === 0)
18
+ element.setAttribute('inert', '');
19
+ active.by.push(by);
20
+ covers.set(element, active);
21
+ let lifted = false;
22
+ return () => {
23
+ if (lifted)
24
+ return;
25
+ lifted = true;
26
+ active.by.splice(active.by.lastIndexOf(by), 1);
27
+ if (active.by.length > 0)
28
+ return;
29
+ covers.delete(element);
30
+ if (active.wasInert)
31
+ element.setAttribute('inert', '');
32
+ else
33
+ element.removeAttribute('inert');
34
+ };
35
+ };
36
+ /**
37
+ * The panel most recently covering an element and still over it.
38
+ *
39
+ * @param element The covered element.
40
+ * @returns That panel, or `null` when no cover from `coverElement` is in force.
41
+ */
42
+ const lastCoverOf = (element) => covers.get(element)?.by.slice(-1)[0] ?? null;
43
+
44
+ exports.coverElement = coverElement;
45
+ exports.lastCoverOf = lastCoverOf;
46
+ //# sourceMappingURL=inert.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inert.utils.cjs","sources":["../../../../src/utilities/__internal__/inertUtils/inert.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA,MAAM,MAAM,GAAG,IAAI,OAAO,EAAyD;AAEnF;;;;;;;;AAQG;MACU,YAAY,GAAG,CAAC,OAAoB,EAAE,EAAe,KAAkB;;IAElF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AACzF,IAAA,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;AAC7D,IAAA,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;AAClB,IAAA,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC;IAE3B,IAAI,MAAM,GAAG,KAAK;AAClB,IAAA,OAAO,MAAK;AACV,QAAA,IAAI,MAAM;YAAE;QACZ,MAAM,GAAG,IAAI;AACb,QAAA,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9C,QAAA,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE;AAC1B,QAAA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACtB,IAAI,MAAM,CAAC,QAAQ;AAAE,YAAA,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;;AACjD,YAAA,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC;AACvC,IAAA,CAAC;AACH;AAEA;;;;;AAKG;AACI,MAAM,WAAW,GAAG,CAAC,OAAoB,KAAyB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;;;"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Makes an element inert for one cover among possibly several, such as two panels over the same page. The element's own
3
+ * `inert` is read at the first cover and restored only when the last lifts, whatever order the covers lift in, so nothing
4
+ * else may write `inert` on the element meanwhile.
5
+ *
6
+ * @param element The element to take out of reach.
7
+ * @param by The panel covering it, which `lastCoverOf` reports so focus can be handed to it.
8
+ * @returns Lifts this cover; calling it twice is harmless.
9
+ */
10
+ export declare const coverElement: (element: HTMLElement, by: HTMLElement) => (() => void);
11
+ /**
12
+ * The panel most recently covering an element and still over it.
13
+ *
14
+ * @param element The covered element.
15
+ * @returns That panel, or `null` when no cover from `coverElement` is in force.
16
+ */
17
+ export declare const lastCoverOf: (element: HTMLElement) => HTMLElement | null;
18
+ //# sourceMappingURL=inert.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inert.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/inertUtils/inert.utils.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,WAAW,EAAE,IAAI,WAAW,KAAG,CAAC,MAAM,IAAI,CAiB/E,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,WAAW,KAAG,WAAW,GAAG,IAAoD,CAAC"}
@@ -0,0 +1,43 @@
1
+ /** Covers in force per element, who holds each, and the `inert` the element had before the first, so the last to lift restores it. */
2
+ const covers = new WeakMap();
3
+ /**
4
+ * Makes an element inert for one cover among possibly several, such as two panels over the same page. The element's own
5
+ * `inert` is read at the first cover and restored only when the last lifts, whatever order the covers lift in, so nothing
6
+ * else may write `inert` on the element meanwhile.
7
+ *
8
+ * @param element The element to take out of reach.
9
+ * @param by The panel covering it, which `lastCoverOf` reports so focus can be handed to it.
10
+ * @returns Lifts this cover; calling it twice is harmless.
11
+ */
12
+ const coverElement = (element, by) => {
13
+ // The attribute rather than the property: a browser reflects one into the other, and `[inert]` selectors then see the cover.
14
+ const active = covers.get(element) ?? { by: [], wasInert: element.hasAttribute('inert') };
15
+ if (active.by.length === 0)
16
+ element.setAttribute('inert', '');
17
+ active.by.push(by);
18
+ covers.set(element, active);
19
+ let lifted = false;
20
+ return () => {
21
+ if (lifted)
22
+ return;
23
+ lifted = true;
24
+ active.by.splice(active.by.lastIndexOf(by), 1);
25
+ if (active.by.length > 0)
26
+ return;
27
+ covers.delete(element);
28
+ if (active.wasInert)
29
+ element.setAttribute('inert', '');
30
+ else
31
+ element.removeAttribute('inert');
32
+ };
33
+ };
34
+ /**
35
+ * The panel most recently covering an element and still over it.
36
+ *
37
+ * @param element The covered element.
38
+ * @returns That panel, or `null` when no cover from `coverElement` is in force.
39
+ */
40
+ const lastCoverOf = (element) => covers.get(element)?.by.slice(-1)[0] ?? null;
41
+
42
+ export { coverElement, lastCoverOf };
43
+ //# sourceMappingURL=inert.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inert.utils.js","sources":["../../../../src/utilities/__internal__/inertUtils/inert.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,MAAM,MAAM,GAAG,IAAI,OAAO,EAAyD;AAEnF;;;;;;;;AAQG;MACU,YAAY,GAAG,CAAC,OAAoB,EAAE,EAAe,KAAkB;;IAElF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;AACzF,IAAA,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;AAC7D,IAAA,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;AAClB,IAAA,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC;IAE3B,IAAI,MAAM,GAAG,KAAK;AAClB,IAAA,OAAO,MAAK;AACV,QAAA,IAAI,MAAM;YAAE;QACZ,MAAM,GAAG,IAAI;AACb,QAAA,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9C,QAAA,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE;AAC1B,QAAA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACtB,IAAI,MAAM,CAAC,QAAQ;AAAE,YAAA,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;;AACjD,YAAA,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC;AACvC,IAAA,CAAC;AACH;AAEA;;;;;AAKG;AACI,MAAM,WAAW,GAAG,CAAC,OAAoB,KAAyB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;;"}
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Subscribes to the viewport resizing. Element sizes are better observed with `useResizeObserver`; this is for
5
+ * boxes that move with the viewport without resizing, such as a fixed element measured against it.
6
+ *
7
+ * @param onResize Called once per viewport resize.
8
+ * @returns Removes the subscription.
9
+ */
10
+ const subscribeToViewportResize = (onResize) => {
11
+ window.addEventListener('resize', onResize);
12
+ return () => window.removeEventListener('resize', onResize);
13
+ };
14
+ /**
15
+ * Calls back on every animation frame until unsubscribed. For a box that can move without any event reporting it, such
16
+ * as a host restyling an ancestor; keep the subscription short-lived, since it costs a measurement per frame.
17
+ *
18
+ * @param onFrame Called once per frame.
19
+ * @returns Cancels the pending frame and stops the loop.
20
+ */
21
+ const subscribeToAnimationFrames = (onFrame) => {
22
+ // Cancelling only the pending frame is not enough: an unsubscribe from inside `onFrame` lands while that frame runs.
23
+ let active = true;
24
+ let frame = window.requestAnimationFrame(function tick() {
25
+ onFrame();
26
+ if (active)
27
+ frame = window.requestAnimationFrame(tick);
28
+ });
29
+ return () => {
30
+ active = false;
31
+ window.cancelAnimationFrame(frame);
32
+ };
33
+ };
34
+
35
+ exports.subscribeToAnimationFrames = subscribeToAnimationFrames;
36
+ exports.subscribeToViewportResize = subscribeToViewportResize;
37
+ //# sourceMappingURL=viewport.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport.utils.cjs","sources":["../../../../src/utilities/__internal__/viewportUtils/viewport.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;AAMG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAoB,KAAkB;AAC9E,IAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC3C,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC7D;AAEA;;;;;;AAMG;AACI,MAAM,0BAA0B,GAAG,CAAC,OAAmB,KAAkB;;IAE9E,IAAI,MAAM,GAAG,IAAI;AACjB,IAAA,IAAI,KAAK,GAAG,MAAM,CAAC,qBAAqB,CAAC,SAAS,IAAI,GAAA;AACpD,QAAA,OAAO,EAAE;AACT,QAAA,IAAI,MAAM;AAAE,YAAA,KAAK,GAAG,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC;AACxD,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,MAAK;QACV,MAAM,GAAG,KAAK;AACd,QAAA,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC;AACpC,IAAA,CAAC;AACH;;;"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Subscribes to the viewport resizing. Element sizes are better observed with `useResizeObserver`; this is for
3
+ * boxes that move with the viewport without resizing, such as a fixed element measured against it.
4
+ *
5
+ * @param onResize Called once per viewport resize.
6
+ * @returns Removes the subscription.
7
+ */
8
+ export declare const subscribeToViewportResize: (onResize: () => void) => (() => void);
9
+ /**
10
+ * Calls back on every animation frame until unsubscribed. For a box that can move without any event reporting it, such
11
+ * as a host restyling an ancestor; keep the subscription short-lived, since it costs a measurement per frame.
12
+ *
13
+ * @param onFrame Called once per frame.
14
+ * @returns Cancels the pending frame and stops the loop.
15
+ */
16
+ export declare const subscribeToAnimationFrames: (onFrame: () => void) => (() => void);
17
+ //# sourceMappingURL=viewport.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/viewportUtils/viewport.utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAG3E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAW3E,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Subscribes to the viewport resizing. Element sizes are better observed with `useResizeObserver`; this is for
3
+ * boxes that move with the viewport without resizing, such as a fixed element measured against it.
4
+ *
5
+ * @param onResize Called once per viewport resize.
6
+ * @returns Removes the subscription.
7
+ */
8
+ const subscribeToViewportResize = (onResize) => {
9
+ window.addEventListener('resize', onResize);
10
+ return () => window.removeEventListener('resize', onResize);
11
+ };
12
+ /**
13
+ * Calls back on every animation frame until unsubscribed. For a box that can move without any event reporting it, such
14
+ * as a host restyling an ancestor; keep the subscription short-lived, since it costs a measurement per frame.
15
+ *
16
+ * @param onFrame Called once per frame.
17
+ * @returns Cancels the pending frame and stops the loop.
18
+ */
19
+ const subscribeToAnimationFrames = (onFrame) => {
20
+ // Cancelling only the pending frame is not enough: an unsubscribe from inside `onFrame` lands while that frame runs.
21
+ let active = true;
22
+ let frame = window.requestAnimationFrame(function tick() {
23
+ onFrame();
24
+ if (active)
25
+ frame = window.requestAnimationFrame(tick);
26
+ });
27
+ return () => {
28
+ active = false;
29
+ window.cancelAnimationFrame(frame);
30
+ };
31
+ };
32
+
33
+ export { subscribeToAnimationFrames, subscribeToViewportResize };
34
+ //# sourceMappingURL=viewport.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport.utils.js","sources":["../../../../src/utilities/__internal__/viewportUtils/viewport.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;AAMG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAoB,KAAkB;AAC9E,IAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC3C,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC7D;AAEA;;;;;;AAMG;AACI,MAAM,0BAA0B,GAAG,CAAC,OAAmB,KAAkB;;IAE9E,IAAI,MAAM,GAAG,IAAI;AACjB,IAAA,IAAI,KAAK,GAAG,MAAM,CAAC,qBAAqB,CAAC,SAAS,IAAI,GAAA;AACpD,QAAA,OAAO,EAAE;AACT,QAAA,IAAI,MAAM;AAAE,YAAA,KAAK,GAAG,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC;AACxD,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,MAAK;QACV,MAAM,GAAG,KAAK;AACd,QAAA,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC;AACpC,IAAA,CAAC;AACH;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/ui-library",
3
- "version": "0.43.1",
3
+ "version": "0.44.0",
4
4
  "description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
5
5
  "type": "module",
6
6
  "imports": {
@@ -284,6 +284,7 @@
284
284
  "build:web": "rollup -c && tsc -p tsconfig.build.json",
285
285
  "build:native": "rollup -c rollup.native.config.js && tsc -p tsconfig.build.native.json && node scripts/finalise-native-types.mjs && node scripts/emit-native-stubs.mjs",
286
286
  "lint:imports": "node scripts/check-deep-imports.mjs",
287
+ "lint:utilities": "node scripts/check-utilities.mjs --from-styles",
287
288
  "typecheck": "tsc --noEmit",
288
289
  "test": "vitest run --project unit",
289
290
  "test:watch": "vitest --project unit",
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePanelFocus.cjs","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"sourcesContent":[null],"names":["useRef","useState","getFocusedElement","useEffect","useLayoutEffect","useCallback"],"mappings":";;;;;AAMA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;AAcD;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,UAAU,EAAwB,KAAI;AACxH,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAqB,IAAI,CAAC;AAClD,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAiB,IAAI,CAAC;AACtD,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAC,SAAS,CAAC;;IAE3C,MAAM,CAAC,kBAAkB,CAAC,GAAGC,cAAQ,CAAqBC,6BAAiB,CAAC;IAE5EC,eAAS,CAAC,MAAK;AACb,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO;AAC9B,QAAA,IAAI,CAAC,KAAK;YAAE;AAEZ,QAAA,MAAM,QAAQ,GAAG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AAE;AACtC;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePanelFocus.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxC,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB,wGAAwG;IACxG,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6GAA6G;IAC7G,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,oEAAoE,oBAAoB;4BA6DrF,UAAU,CAAC,WAAW,CAAC;yBAMd,WAAW;CAKpD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePanelFocus.js","sources":["../../../../../src/components/organisms/SidePanel/hooks/usePanelFocus.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAMA;AACA,MAAM,sBAAsB,GAAG,CAAC,KAAkB,KAAwB;AACxE,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB;AAE5C,IAAA,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI;AACjF,CAAC;AAcD;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,UAAU,EAAwB,KAAI;AACxH,IAAA,MAAM,SAAS,GAAG,MAAM,CAAqB,IAAI,CAAC;AAClD,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAiB,IAAI,CAAC;AACtD,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CA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