@flipdish/ui-library 0.53.0 → 0.54.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 (115) hide show
  1. package/dist/components/atoms/CloseButton/index.cjs +1 -0
  2. package/dist/components/atoms/CloseButton/index.cjs.map +1 -1
  3. package/dist/components/atoms/CloseButton/index.d.ts.map +1 -1
  4. package/dist/components/atoms/CloseButton/index.js +1 -0
  5. package/dist/components/atoms/CloseButton/index.js.map +1 -1
  6. package/dist/components/layouts/AppShell/hooks/usePageAreaBounds.cjs.map +1 -0
  7. package/dist/components/layouts/AppShell/hooks/usePageAreaBounds.d.ts.map +1 -0
  8. package/dist/components/layouts/AppShell/hooks/usePageAreaBounds.js.map +1 -0
  9. package/dist/components/layouts/AppShell/hooks/usePageCover.cjs.map +1 -0
  10. package/dist/components/layouts/AppShell/hooks/usePageCover.d.ts.map +1 -0
  11. package/dist/components/layouts/AppShell/hooks/usePageCover.js.map +1 -0
  12. package/dist/components/layouts/AppShell/index.cjs +40 -0
  13. package/dist/components/layouts/AppShell/index.cjs.map +1 -0
  14. package/dist/components/layouts/AppShell/index.d.ts +40 -0
  15. package/dist/components/layouts/AppShell/index.d.ts.map +1 -0
  16. package/dist/components/layouts/AppShell/index.js +38 -0
  17. package/dist/components/layouts/AppShell/index.js.map +1 -0
  18. package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.cjs.map +1 -0
  19. package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.d.ts.map +1 -0
  20. package/dist/components/layouts/PageHubLayout/components/PageHubLayoutSectionNav.js.map +1 -0
  21. package/dist/components/layouts/PageHubLayout/index.cjs +65 -0
  22. package/dist/components/layouts/PageHubLayout/index.cjs.map +1 -0
  23. package/dist/components/layouts/PageHubLayout/index.d.ts +56 -0
  24. package/dist/components/layouts/PageHubLayout/index.d.ts.map +1 -0
  25. package/dist/components/layouts/PageHubLayout/index.js +63 -0
  26. package/dist/components/layouts/PageHubLayout/index.js.map +1 -0
  27. package/dist/components/layouts/PageHubLayout/pageHubLayout.types.d.ts.map +1 -0
  28. package/dist/components/layouts/PageHubLayout/utilities/pageHubLayout.utils.cjs.map +1 -0
  29. package/dist/components/{templates/PageHubLayout → layouts/PageHubLayout/utilities}/pageHubLayout.utils.d.ts +1 -1
  30. package/dist/components/layouts/PageHubLayout/utilities/pageHubLayout.utils.d.ts.map +1 -0
  31. package/dist/components/layouts/PageHubLayout/utilities/pageHubLayout.utils.js.map +1 -0
  32. package/dist/components/layouts/PageLayout/index.cjs +31 -0
  33. package/dist/components/layouts/PageLayout/index.cjs.map +1 -0
  34. package/dist/components/layouts/PageLayout/index.d.ts +44 -0
  35. package/dist/components/layouts/PageLayout/index.d.ts.map +1 -0
  36. package/dist/components/layouts/PageLayout/index.js +29 -0
  37. package/dist/components/layouts/PageLayout/index.js.map +1 -0
  38. package/dist/components/layouts/WidgetLayout/index.cjs +42 -0
  39. package/dist/components/layouts/WidgetLayout/index.cjs.map +1 -0
  40. package/dist/components/layouts/WidgetLayout/index.d.ts +57 -0
  41. package/dist/components/layouts/WidgetLayout/index.d.ts.map +1 -0
  42. package/dist/components/layouts/WidgetLayout/index.js +40 -0
  43. package/dist/components/layouts/WidgetLayout/index.js.map +1 -0
  44. package/dist/components/molecules/Dropdown/components/DropdownSelectionIndicator.cjs +29 -0
  45. package/dist/components/molecules/Dropdown/components/DropdownSelectionIndicator.cjs.map +1 -0
  46. package/dist/components/molecules/Dropdown/components/DropdownSelectionIndicator.d.ts +9 -0
  47. package/dist/components/molecules/Dropdown/components/DropdownSelectionIndicator.d.ts.map +1 -0
  48. package/dist/components/molecules/Dropdown/components/DropdownSelectionIndicator.js +27 -0
  49. package/dist/components/molecules/Dropdown/components/DropdownSelectionIndicator.js.map +1 -0
  50. package/dist/components/molecules/Dropdown/index.cjs +4 -30
  51. package/dist/components/molecules/Dropdown/index.cjs.map +1 -1
  52. package/dist/components/molecules/Dropdown/index.d.ts +1 -1
  53. package/dist/components/molecules/Dropdown/index.d.ts.map +1 -1
  54. package/dist/components/molecules/Dropdown/index.js +6 -32
  55. package/dist/components/molecules/Dropdown/index.js.map +1 -1
  56. package/dist/components/molecules/Dropdown/utilities/dropdown.utils.cjs +24 -0
  57. package/dist/components/molecules/Dropdown/utilities/dropdown.utils.cjs.map +1 -0
  58. package/dist/components/molecules/Dropdown/utilities/dropdown.utils.d.ts +10 -0
  59. package/dist/components/molecules/Dropdown/utilities/dropdown.utils.d.ts.map +1 -0
  60. package/dist/components/molecules/Dropdown/utilities/dropdown.utils.js +22 -0
  61. package/dist/components/molecules/Dropdown/utilities/dropdown.utils.js.map +1 -0
  62. package/dist/components/templates/AppShell/index.cjs +3 -34
  63. package/dist/components/templates/AppShell/index.cjs.map +1 -1
  64. package/dist/components/templates/AppShell/index.d.ts +7 -39
  65. package/dist/components/templates/AppShell/index.d.ts.map +1 -1
  66. package/dist/components/templates/AppShell/index.js +3 -34
  67. package/dist/components/templates/AppShell/index.js.map +1 -1
  68. package/dist/components/templates/PageHubLayout/index.cjs +3 -59
  69. package/dist/components/templates/PageHubLayout/index.cjs.map +1 -1
  70. package/dist/components/templates/PageHubLayout/index.d.ts +7 -55
  71. package/dist/components/templates/PageHubLayout/index.d.ts.map +1 -1
  72. package/dist/components/templates/PageHubLayout/index.js +3 -59
  73. package/dist/components/templates/PageHubLayout/index.js.map +1 -1
  74. package/dist/components/templates/PageLayout/index.cjs +3 -25
  75. package/dist/components/templates/PageLayout/index.cjs.map +1 -1
  76. package/dist/components/templates/PageLayout/index.d.ts +5 -42
  77. package/dist/components/templates/PageLayout/index.d.ts.map +1 -1
  78. package/dist/components/templates/PageLayout/index.js +3 -25
  79. package/dist/components/templates/PageLayout/index.js.map +1 -1
  80. package/dist/components/templates/WidgetLayout/index.cjs +3 -36
  81. package/dist/components/templates/WidgetLayout/index.cjs.map +1 -1
  82. package/dist/components/templates/WidgetLayout/index.d.ts +7 -56
  83. package/dist/components/templates/WidgetLayout/index.d.ts.map +1 -1
  84. package/dist/components/templates/WidgetLayout/index.js +3 -36
  85. package/dist/components/templates/WidgetLayout/index.js.map +1 -1
  86. package/dist/native/components/layouts/AppShell/index.d.ts +12 -0
  87. package/dist/native/components/layouts/PageHubLayout/index.d.ts +12 -0
  88. package/dist/native/components/layouts/PageLayout/index.d.ts +12 -0
  89. package/dist/native/components/layouts/WidgetLayout/index.d.ts +12 -0
  90. package/package.json +10 -1
  91. package/dist/components/templates/AppShell/hooks/usePageAreaBounds.cjs.map +0 -1
  92. package/dist/components/templates/AppShell/hooks/usePageAreaBounds.d.ts.map +0 -1
  93. package/dist/components/templates/AppShell/hooks/usePageAreaBounds.js.map +0 -1
  94. package/dist/components/templates/AppShell/hooks/usePageCover.cjs.map +0 -1
  95. package/dist/components/templates/AppShell/hooks/usePageCover.d.ts.map +0 -1
  96. package/dist/components/templates/AppShell/hooks/usePageCover.js.map +0 -1
  97. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.cjs.map +0 -1
  98. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.d.ts.map +0 -1
  99. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.js.map +0 -1
  100. package/dist/components/templates/PageHubLayout/pageHubLayout.types.d.ts.map +0 -1
  101. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.cjs.map +0 -1
  102. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.d.ts.map +0 -1
  103. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.js.map +0 -1
  104. /package/dist/components/{templates → layouts}/AppShell/hooks/usePageAreaBounds.cjs +0 -0
  105. /package/dist/components/{templates → layouts}/AppShell/hooks/usePageAreaBounds.d.ts +0 -0
  106. /package/dist/components/{templates → layouts}/AppShell/hooks/usePageAreaBounds.js +0 -0
  107. /package/dist/components/{templates → layouts}/AppShell/hooks/usePageCover.cjs +0 -0
  108. /package/dist/components/{templates → layouts}/AppShell/hooks/usePageCover.d.ts +0 -0
  109. /package/dist/components/{templates → layouts}/AppShell/hooks/usePageCover.js +0 -0
  110. /package/dist/components/{templates → layouts}/PageHubLayout/components/PageHubLayoutSectionNav.cjs +0 -0
  111. /package/dist/components/{templates → layouts}/PageHubLayout/components/PageHubLayoutSectionNav.d.ts +0 -0
  112. /package/dist/components/{templates → layouts}/PageHubLayout/components/PageHubLayoutSectionNav.js +0 -0
  113. /package/dist/components/{templates → layouts}/PageHubLayout/pageHubLayout.types.d.ts +0 -0
  114. /package/dist/components/{templates/PageHubLayout → layouts/PageHubLayout/utilities}/pageHubLayout.utils.cjs +0 -0
  115. /package/dist/components/{templates/PageHubLayout → layouts/PageHubLayout/utilities}/pageHubLayout.utils.js +0 -0
@@ -1,40 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var cx = require('@flipdish/ui-library/utilities/cx');
5
- var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
6
- var React = require('react');
7
- var PageCover_context = require('../../organisms/SidePanel/providers/PageCover.context.cjs');
8
- var OverlayBounds_context = require('../../organisms/SlideoutMenu/providers/OverlayBounds.context.cjs');
9
- var PageArea_context = require('../../organisms/SlideoutMenu/providers/PageArea.context.cjs');
10
- var usePageAreaBounds = require('./hooks/usePageAreaBounds.cjs');
11
- var usePageCover = require('./hooks/usePageCover.cjs');
3
+ var AppShell$1 = require('@flipdish/ui-library/components/layouts/AppShell');
12
4
 
13
- /**
14
- * Layout-only template for an app shell: navigation beside a column that stacks the header
15
- * above the page, with an optional side panel under the header. The shell is window-height and
16
- * only the page area scrolls; it holds no state, so the app owns navigation, search and panel
17
- * state.
18
- *
19
- * @summary window-height app shell layout with a scrolling page area
20
- */
21
- const AppShell = ({ sidebar, header, panel, children, scrollAreaProps, className, 'data-testid': dataTestId }) => {
22
- const appShellTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'app-shell', rootName: 'app-shell' });
23
- // A `SidePanel` in the `panel` slot calls the setter while it covers the page area below `lg`.
24
- const { scrollAreaRef, setPageCovered } = usePageCover.usePageCover(scrollAreaProps?.ref);
25
- // A `SlideoutMenu` anywhere in the shell reads the page area so it covers that box and nothing else, and below `lg` makes the
26
- // row under that box inert: the page and a side panel covering it, which the slideout then covers in turn.
27
- const pageAreaBounds = usePageAreaBounds.usePageAreaBounds(scrollAreaRef);
28
- const pageRowRef = React.useRef(null);
29
- return (
30
- // A column below `lg`, so a navigation that renders its own mobile top bar stacks above the content.
31
- jsxRuntime.jsx("div", { "data-testid": appShellTestId, className: cx.cx('flex h-dvh w-full flex-col overflow-hidden bg-primary lg:flex-row', className), children: jsxRuntime.jsx(OverlayBounds_context.OverlayBoundsContext.Provider, { value: pageAreaBounds, children: jsxRuntime.jsxs(PageArea_context.PageAreaContext.Provider, { value: pageRowRef, children: [sidebar, jsxRuntime.jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [header, jsxRuntime.jsxs("div", { ref: pageRowRef, className: "relative flex min-h-0 flex-1 overflow-clip", children: [jsxRuntime.jsx("div", { id: scrollAreaProps?.id, ref: scrollAreaRef, "data-testid": scrollAreaProps?.['data-testid'] ?? testIdUtils.joinTestId(appShellTestId, 'scroll-area'),
32
- // Focusable so keyboard users can scroll a page that has no focusable content of its own (axe: scrollable-region-focusable).
33
- // biome-ignore lint/a11y/noNoninteractiveTabindex: a scrollable region must be reachable by keyboard
34
- tabIndex: 0,
35
- // isolate keeps the page's own stacked content (sticky headers) under a panel that covers it.
36
- className: "isolate flex min-w-0 flex-1 flex-col overflow-y-auto outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2", children: children }), jsxRuntime.jsx(PageCover_context.PageCoverContext.Provider, { value: setPageCovered, children: panel })] })] })] }) }) }));
37
- };
5
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/AppShell`. Removed in the next major. */
6
+ const AppShell = AppShell$1.AppShell;
38
7
 
39
8
  exports.AppShell = AppShell;
40
9
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/AppShell/index.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","usePageCover","usePageAreaBounds","useRef","_jsx","cx","OverlayBoundsContext","_jsxs","PageAreaContext","joinTestId","PageCoverContext"],"mappings":";;;;;;;;;;;;AA2CA;;;;;;;AAOG;MACU,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAiB,KAAe;AAChJ,IAAA,MAAM,cAAc,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;;AAE7G,IAAA,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAGC,yBAAY,CAAC,eAAe,EAAE,GAAG,CAAC;;;AAG5E,IAAA,MAAM,cAAc,GAAGC,mCAAiB,CAAC,aAAa,CAAC;AACvD,IAAA,MAAM,UAAU,GAAGC,YAAM,CAAiB,IAAI,CAAC;IAE/C;;AAEE,IAAAC,cAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAkB,cAAc,EAAE,SAAS,EAAEC,KAAE,CAAC,mEAAmE,EAAE,SAAS,CAAC,EAAA,QAAA,EAC7HD,cAAA,CAACE,0CAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,cAAc,EAAA,QAAA,EAClDC,eAAA,CAACC,gCAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,UAAU,EAAA,QAAA,EAAA,CACxC,OAAO,EAGRD,yBAAK,SAAS,EAAC,sCAAsC,EAAA,QAAA,EAAA,CAClD,MAAM,EAGPA,eAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAC,4CAA4C,EAAA,QAAA,EAAA,CAC1EH,cAAA,CAAA,KAAA,EAAA,EACE,EAAE,EAAE,eAAe,EAAE,EAAE,EACvB,GAAG,EAAE,aAAa,EAAA,aAAA,EACL,eAAe,GAAG,aAAa,CAAC,IAAIK,sBAAU,CAAC,cAAc,EAAE,aAAa,CAAC;;;AAG1F,wCAAA,QAAQ,EAAE,CAAC;;wCAEX,SAAS,EAAC,iIAAiI,EAAA,QAAA,EAE1I,QAAQ,GACL,EAENL,cAAA,CAACM,kCAAgB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,cAAc,EAAA,QAAA,EAAG,KAAK,EAAA,CAA6B,CAAA,EAAA,CACjF,IACF,CAAA,EAAA,CACmB,EAAA,CACG,EAAA,CAC5B;AAEV;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/AppShell/index.tsx"],"sourcesContent":[null],"names":["AppShellNext"],"mappings":";;;;AAUA;AACO,MAAM,QAAQ,GAAGA;;"}
@@ -1,40 +1,8 @@
1
- import type { ReactNode, Ref } from 'react';
2
- export interface AppShellScrollAreaProps {
3
- /** `id` for the scrolling element, e.g. for a scroll-to-top helper that looks it up. */
4
- id?: string;
5
- /** Ref to the scrolling element, e.g. to reset `scrollTop` on navigation or attach a scroll listener. */
6
- ref?: Ref<HTMLDivElement>;
7
- /** Overrides the scrolling element's `data-testid` (defaults to `<root>--scroll-area`). */
8
- 'data-testid'?: string;
9
- }
10
- export interface AppShellProps {
11
- /** Primary navigation, rendered first beside the content column. Compose `<SidebarNavigation>` here. */
12
- sidebar?: ReactNode;
13
- /** Top bar, rendered at the top of the content column. It stays in place while the page area scrolls, outside the box a `SlideoutMenu` covers. Compose `<ApplicationHeader>` here. */
14
- header?: ReactNode;
15
- /**
16
- * Side panel rendered under the header. From `lg` it sits beside the page area, which narrows to make
17
- * room. Below `lg` it covers the page area, which is then out of reach of keyboard and assistive
18
- * technology until the panel closes, as the panel itself is while a `SlideoutMenu` covers both. Compose
19
- * one `<SidePanel>` here and switch its content.
20
- */
21
- panel?: ReactNode;
22
- /** Page content, normally a `<PageLayout>`. Rendered inside the shell's scroll area. */
23
- children: ReactNode;
24
- /** Hooks for the element that scrolls the page content, since the document itself does not scroll. */
25
- scrollAreaProps?: AppShellScrollAreaProps;
26
- /** Extra classes merged onto the root element. */
27
- className?: string;
28
- /** Overrides the `data-testid` (defaults to `fd-app-shell`). */
29
- 'data-testid'?: string;
30
- }
31
- /**
32
- * Layout-only template for an app shell: navigation beside a column that stacks the header
33
- * above the page, with an optional side panel under the header. The shell is window-height and
34
- * only the page area scrolls; it holds no state, so the app owns navigation, search and panel
35
- * state.
36
- *
37
- * @summary window-height app shell layout with a scrolling page area
38
- */
39
- export declare const AppShell: ({ sidebar, header, panel, children, scrollAreaProps, className, "data-testid": dataTestId }: AppShellProps) => ReactNode;
1
+ import { type AppShellProps as AppShellPropsNext, type AppShellScrollAreaProps as AppShellScrollAreaPropsNext } from '@flipdish/ui-library/components/layouts/AppShell';
2
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/AppShell`. Removed in the next major. */
3
+ export declare const AppShell: ({ sidebar, header, panel, children, scrollAreaProps, className, "data-testid": dataTestId }: AppShellPropsNext) => import("react").ReactNode;
4
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/AppShell`. Removed in the next major. */
5
+ export type AppShellProps = AppShellPropsNext;
6
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/AppShell`. Removed in the next major. */
7
+ export type AppShellScrollAreaProps = AppShellScrollAreaPropsNext;
40
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/AppShell/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAQ5C,MAAM,WAAW,uBAAuB;IACtC,wFAAwF;IACxF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yGAAyG;IACzG,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,2FAA2F;IAC3F,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,wGAAwG;IACxG,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,sLAAsL;IACtL,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,wFAAwF;IACxF,QAAQ,EAAE,SAAS,CAAC;IACpB,sGAAsG;IACtG,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,6FAA6F,aAAa,KAAG,SA0CrI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/AppShell/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,uBAAuB,IAAI,2BAA2B,EAC5D,MAAM,kDAAkD,CAAC;AAE1D,6GAA6G;AAC7G,eAAO,MAAM,QAAQ,+IAAe,CAAC;AACrC,6GAA6G;AAC7G,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAC9C,6GAA6G;AAC7G,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,CAAC"}
@@ -1,38 +1,7 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { cx } from '@flipdish/ui-library/utilities/cx';
3
- import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
4
- import { useRef } from 'react';
5
- import { PageCoverContext } from '../../organisms/SidePanel/providers/PageCover.context.js';
6
- import { OverlayBoundsContext } from '../../organisms/SlideoutMenu/providers/OverlayBounds.context.js';
7
- import { PageAreaContext } from '../../organisms/SlideoutMenu/providers/PageArea.context.js';
8
- import { usePageAreaBounds } from './hooks/usePageAreaBounds.js';
9
- import { usePageCover } from './hooks/usePageCover.js';
1
+ import { AppShell as AppShell$1 } from '@flipdish/ui-library/components/layouts/AppShell';
10
2
 
11
- /**
12
- * Layout-only template for an app shell: navigation beside a column that stacks the header
13
- * above the page, with an optional side panel under the header. The shell is window-height and
14
- * only the page area scrolls; it holds no state, so the app owns navigation, search and panel
15
- * state.
16
- *
17
- * @summary window-height app shell layout with a scrolling page area
18
- */
19
- const AppShell = ({ sidebar, header, panel, children, scrollAreaProps, className, 'data-testid': dataTestId }) => {
20
- const appShellTestId = useResolvedTestId({ testId: dataTestId, segment: 'app-shell', rootName: 'app-shell' });
21
- // A `SidePanel` in the `panel` slot calls the setter while it covers the page area below `lg`.
22
- const { scrollAreaRef, setPageCovered } = usePageCover(scrollAreaProps?.ref);
23
- // A `SlideoutMenu` anywhere in the shell reads the page area so it covers that box and nothing else, and below `lg` makes the
24
- // row under that box inert: the page and a side panel covering it, which the slideout then covers in turn.
25
- const pageAreaBounds = usePageAreaBounds(scrollAreaRef);
26
- const pageRowRef = useRef(null);
27
- return (
28
- // A column below `lg`, so a navigation that renders its own mobile top bar stacks above the content.
29
- jsx("div", { "data-testid": appShellTestId, className: cx('flex h-dvh w-full flex-col overflow-hidden bg-primary lg:flex-row', className), children: jsx(OverlayBoundsContext.Provider, { value: pageAreaBounds, children: jsxs(PageAreaContext.Provider, { value: pageRowRef, children: [sidebar, jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [header, jsxs("div", { ref: pageRowRef, className: "relative flex min-h-0 flex-1 overflow-clip", children: [jsx("div", { id: scrollAreaProps?.id, ref: scrollAreaRef, "data-testid": scrollAreaProps?.['data-testid'] ?? joinTestId(appShellTestId, 'scroll-area'),
30
- // Focusable so keyboard users can scroll a page that has no focusable content of its own (axe: scrollable-region-focusable).
31
- // biome-ignore lint/a11y/noNoninteractiveTabindex: a scrollable region must be reachable by keyboard
32
- tabIndex: 0,
33
- // isolate keeps the page's own stacked content (sticky headers) under a panel that covers it.
34
- className: "isolate flex min-w-0 flex-1 flex-col overflow-y-auto outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2", children: children }), jsx(PageCoverContext.Provider, { value: setPageCovered, children: panel })] })] })] }) }) }));
35
- };
3
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/AppShell`. Removed in the next major. */
4
+ const AppShell = AppShell$1;
36
5
 
37
6
  export { AppShell };
38
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/templates/AppShell/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AA2CA;;;;;;;AAOG;MACU,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAiB,KAAe;AAChJ,IAAA,MAAM,cAAc,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;;AAE7G,IAAA,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC,eAAe,EAAE,GAAG,CAAC;;;AAG5E,IAAA,MAAM,cAAc,GAAG,iBAAiB,CAAC,aAAa,CAAC;AACvD,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC;IAE/C;;AAEE,IAAAA,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAkB,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,mEAAmE,EAAE,SAAS,CAAC,EAAA,QAAA,EAC7HA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,cAAc,EAAA,QAAA,EAClDC,IAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,UAAU,EAAA,QAAA,EAAA,CACxC,OAAO,EAGRA,cAAK,SAAS,EAAC,sCAAsC,EAAA,QAAA,EAAA,CAClD,MAAM,EAGPA,IAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAC,4CAA4C,EAAA,QAAA,EAAA,CAC1ED,GAAA,CAAA,KAAA,EAAA,EACE,EAAE,EAAE,eAAe,EAAE,EAAE,EACvB,GAAG,EAAE,aAAa,EAAA,aAAA,EACL,eAAe,GAAG,aAAa,CAAC,IAAI,UAAU,CAAC,cAAc,EAAE,aAAa,CAAC;;;AAG1F,wCAAA,QAAQ,EAAE,CAAC;;wCAEX,SAAS,EAAC,iIAAiI,EAAA,QAAA,EAE1I,QAAQ,GACL,EAENA,GAAA,CAAC,gBAAgB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,cAAc,EAAA,QAAA,EAAG,KAAK,EAAA,CAA6B,CAAA,EAAA,CACjF,IACF,CAAA,EAAA,CACmB,EAAA,CACG,EAAA,CAC5B;AAEV;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/templates/AppShell/index.tsx"],"sourcesContent":[null],"names":["AppShellNext"],"mappings":";;AAUA;AACO,MAAM,QAAQ,GAAGA;;"}
@@ -1,65 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var Skeleton = require('@flipdish/ui-library/components/atoms/Skeleton');
5
- var Select = require('@flipdish/ui-library/components/molecules/Select');
6
- var PageLayout = require('@flipdish/ui-library/components/templates/PageLayout');
7
- var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
8
- var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
9
- var React = require('react');
10
- var PageHubLayoutSectionNav = require('./components/PageHubLayoutSectionNav.cjs');
11
- var pageHubLayout_utils = require('./pageHubLayout.utils.cjs');
3
+ var PageHubLayout$1 = require('@flipdish/ui-library/components/layouts/PageHubLayout');
12
4
 
13
- /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
14
- const DefaultSectionError = ({ testId }) => (jsxRuntime.jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-2xl text-center", children: [jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-primary", children: "Something went wrong" }), jsxRuntime.jsx("p", { className: "text-md text-tertiary", children: "An unexpected error occurred while loading this section." })] }));
15
- /** English status copy — consumers localise via `sectionFallback`. TODO(i18n): source from ui-library's translation layer once one exists. */
16
- const DEFAULT_SECTION_LOADING_TEXT = 'Loading section';
17
- const DefaultSectionFallback = ({ testId, onShownChange }) => {
18
- React.useEffect(() => {
19
- onShownChange(true);
20
- return () => onShownChange(false);
21
- }, [onShownChange]);
22
- return (jsxRuntime.jsxs("div", { "aria-busy": "true", "data-testid": testId, className: "flex w-full flex-col gap-4", children: [jsxRuntime.jsx(Skeleton.Skeleton, { width: "40%", height: 20 }), jsxRuntime.jsx(Skeleton.SkeletonText, { lines: 4 })] }));
23
- };
24
- /** Runs `render` as a component, so a throw lands in the section boundary rather than in the layout's own render. */
25
- const PageHubLayoutSectionContent = ({ render }) => render();
26
- /**
27
- * Page template for a hub of sections: a `PageLayout` whose content is a section navigation beside
28
- * the selected section, each section rendered from config inside its own error and Suspense boundary. Reach for
29
- * it instead of `PageLayout` when one page hosts several feature areas picked from a left-hand list,
30
- * such as a settings hub; the list becomes a select below `lg`.
31
- *
32
- * @summary page template with section navigation and content
33
- */
34
- const PageHubLayout = ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, 'data-testid': dataTestId, ...pageLayoutProps }) => {
35
- const pageHubLayoutTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'page-hub-layout', rootName: 'page-hub-layout' });
36
- // Uncontrolled fallback so the desktop navigation and the mobile select always agree on the selection.
37
- const [internalSelectedSection, setInternalSelectedSection] = React.useState(defaultSelectedSection);
38
- const [isDefaultFallbackShown, setIsDefaultFallbackShown] = React.useState(false);
39
- const activeSection = pageHubLayout_utils.resolveSelectedSection(sections, selectedSection ?? internalSelectedSection);
40
- const selectSection = (id) => {
41
- setInternalSelectedSection(id);
42
- // Re-picking the current section is not a change; the select already ignores it, so the navigation does too.
43
- if (id !== activeSection?.id)
44
- onSectionChange?.(id);
45
- };
46
- const selectFromSelect = (key) => {
47
- const pickedId = pageHubLayout_utils.resolvePickedSectionId(sections, key);
48
- if (pickedId !== undefined)
49
- selectSection(pickedId);
50
- };
51
- return (jsxRuntime.jsx(PageLayout.PageLayout, { ...pageLayoutProps, pageName: pageName, renderError: renderError, onError: onError, "data-testid": pageHubLayoutTestId, children: jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-md lg:flex-row lg:items-start", children: [jsxRuntime.jsx(PageHubLayoutSectionNav.PageHubLayoutSectionNav, { className: "max-lg:hidden", sections: sections, selectedSection: activeSection?.id, onSelect: selectSection, "aria-label": navigationLabel, "data-testid": testIdUtils.joinTestId(pageHubLayoutTestId, 'sections') }), jsxRuntime.jsx(Select.Select, { className: "w-full lg:hidden", size: "md", "aria-label": navigationLabel, value: activeSection?.id ?? null, onChange: selectFromSelect, "data-testid": testIdUtils.joinTestId(pageHubLayoutTestId, 'sections-select'), children: sections.map((section) => (
52
- // Spread, not `href={section.href}`: react-aria copies an `href` key that is present but undefined onto the option as `href=""`.
53
- jsxRuntime.jsx(Select.Select.Item, { id: section.id, label: section.label, isDisabled: section.isDisabled, ...(section.href ? { href: section.href } : {}) }, section.id))) }), jsxRuntime.jsxs("div", { "data-testid": testIdUtils.joinTestId(pageHubLayoutTestId, 'content'), className: "w-full min-w-0 flex-1", children: [jsxRuntime.jsx("output", { className: "sr-only", children: isDefaultFallbackShown ? DEFAULT_SECTION_LOADING_TEXT : '' }), activeSection && (
54
- // Keyed by section so a section that threw is replaced, not left showing its fallback, when the user moves on.
55
- jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { identifier: `${pageName}/${activeSection.id}`, onError: onError, renderFallback: (error) => {
56
- // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
57
- const customFallback = renderError?.({ error, pageName, sectionId: activeSection.id });
58
- if (customFallback !== undefined)
59
- return customFallback;
60
- return jsxRuntime.jsx(DefaultSectionError, { testId: testIdUtils.joinTestId(pageHubLayoutTestId, 'section-error') });
61
- }, children: jsxRuntime.jsx(React.Suspense, { fallback: sectionFallback !== undefined ? (sectionFallback) : (jsxRuntime.jsx(DefaultSectionFallback, { testId: testIdUtils.joinTestId(pageHubLayoutTestId, 'section-loading'), onShownChange: setIsDefaultFallbackShown })), children: jsxRuntime.jsx(PageHubLayoutSectionContent, { render: activeSection.render }) }) }, activeSection.id))] })] }) }));
62
- };
5
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageHubLayout`. Removed in the next major. */
6
+ const PageHubLayout = PageHubLayout$1.PageHubLayout;
63
7
 
64
8
  exports.PageHubLayout = PageHubLayout;
65
9
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","useEffect","Skeleton","SkeletonText","useResolvedTestId","useState","resolveSelectedSection","resolvePickedSectionId","PageLayout","PageHubLayoutSectionNav","joinTestId","Select","ErrorBoundary","Suspense"],"mappings":";;;;;;;;;;;;AAsDA;AACA,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAuB,MAC1DA,eAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,iBAAc,MAAM,EAAE,SAAS,EAAC,4DAA4D,EAAA,QAAA,EAAA,CAC3GC,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,sBAAA,EAAA,CAA0B,EAC5EA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAAA,0DAAA,EAAA,CAA6D,CAAA,EAAA,CAC7F,CACP;AAED;AACA,MAAM,4BAA4B,GAAG,iBA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,MAAM,EAAA,CAAI,EAAA,CACpD,EAAA,EApBN,aAAa,CAAC,EAAE,CAqBP,CACjB,CAAA,EAAA,CACG,CAAA,EAAA,CACF,EAAA,CACK;AAEjB;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"sourcesContent":[null],"names":["PageHubLayoutNext"],"mappings":";;;;AAUA;AACO,MAAM,aAAa,GAAGA;;"}
@@ -1,56 +1,8 @@
1
- import { type PageLayoutProps } from '@flipdish/ui-library/components/templates/PageLayout';
2
- import type { ReactNode } from 'react';
3
- import type { PageHubLayoutSection } from './pageHubLayout.types';
4
- export type { PageHubLayoutSection } from './pageHubLayout.types';
5
- export interface PageHubLayoutProps extends Omit<PageLayoutProps, 'children' | 'renderError' | 'data-testid'> {
6
- /**
7
- * The hub's sections, in navigation order. Each one is an entry in the section navigation and a
8
- * `render` for its content; only the selected section's `render` runs.
9
- */
10
- sections: PageHubLayoutSection[];
11
- /**
12
- * Accessible name for the section navigation and its mobile select, e.g. "Settings sections". Must
13
- * differ from the header's title, which already names the `PageHeader` tab navigation.
14
- */
15
- navigationLabel: string;
16
- /**
17
- * Controlled selected section id, usually read from the router. An id that matches no enabled
18
- * section falls back to the first enabled one.
19
- */
20
- selectedSection?: string;
21
- /** Initially selected section id (uncontrolled). Defaults to the first enabled section. */
22
- defaultSelectedSection?: string;
23
- /**
24
- * Called with the section id when the user picks a different section that has no `href`, from the
25
- * navigation or the mobile select. Re-picking the current section does not call it, and a section
26
- * with `href` navigates as a link instead and never calls it.
27
- */
28
- onSectionChange?: (id: string) => void;
29
- /**
30
- * Shown in the content pane while the selected section suspends, such as a `React.lazy` section
31
- * whose chunk is loading. Replaces the default skeleton; the header and navigation stay in place.
32
- */
33
- sectionFallback?: ReactNode;
34
- /**
35
- * Replaces the default fallback shown when content throws. Receives the thrown error, `pageName`
36
- * and, when the selected section threw, its `sectionId`; without one the page-level boundary caught it.
37
- * Return `null` to render nothing, or `undefined` to keep the default fallback.
38
- */
39
- renderError?: (props: {
40
- error: Error;
41
- pageName: string;
42
- sectionId?: string;
43
- }) => ReactNode;
44
- /** Overrides the `data-testid` (defaults to `fd-page-hub-layout`). */
45
- 'data-testid'?: string;
46
- }
47
- /**
48
- * Page template for a hub of sections: a `PageLayout` whose content is a section navigation beside
49
- * the selected section, each section rendered from config inside its own error and Suspense boundary. Reach for
50
- * it instead of `PageLayout` when one page hosts several feature areas picked from a left-hand list,
51
- * such as a settings hub; the list becomes a select below `lg`.
52
- *
53
- * @summary page template with section navigation and content
54
- */
55
- export declare const PageHubLayout: ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, "data-testid": dataTestId, ...pageLayoutProps }: PageHubLayoutProps) => ReactNode;
1
+ import { type PageHubLayoutProps as PageHubLayoutPropsNext, type PageHubLayoutSection as PageHubLayoutSectionNext } from '@flipdish/ui-library/components/layouts/PageHubLayout';
2
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageHubLayout`. Removed in the next major. */
3
+ export declare const PageHubLayout: ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, "data-testid": dataTestId, ...pageLayoutProps }: PageHubLayoutPropsNext) => import("react").ReactNode;
4
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageHubLayout`. Removed in the next major. */
5
+ export type PageHubLayoutProps = PageHubLayoutPropsNext;
6
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageHubLayout`. Removed in the next major. */
7
+ export type PageHubLayoutSection = PageHubLayoutSectionNext;
56
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAGxG,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,OAAO,CAAC;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AAC"}
@@ -1,63 +1,7 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Skeleton, SkeletonText } from '@flipdish/ui-library/components/atoms/Skeleton';
3
- import { Select } from '@flipdish/ui-library/components/molecules/Select';
4
- import { PageLayout } from '@flipdish/ui-library/components/templates/PageLayout';
5
- import { ErrorBoundary } from '@flipdish/ui-library/providers/ErrorBoundary';
6
- import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
7
- import { useState, Suspense, useEffect } from 'react';
8
- import { PageHubLayoutSectionNav } from './components/PageHubLayoutSectionNav.js';
9
- import { resolveSelectedSection, resolvePickedSectionId } from './pageHubLayout.utils.js';
1
+ import { PageHubLayout as PageHubLayout$1 } from '@flipdish/ui-library/components/layouts/PageHubLayout';
10
2
 
11
- /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
12
- const DefaultSectionError = ({ testId }) => (jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-2xl text-center", children: [jsx("h2", { className: "text-lg font-semibold text-primary", children: "Something went wrong" }), jsx("p", { className: "text-md text-tertiary", children: "An unexpected error occurred while loading this section." })] }));
13
- /** English status copy — consumers localise via `sectionFallback`. TODO(i18n): source from ui-library's translation layer once one exists. */
14
- const DEFAULT_SECTION_LOADING_TEXT = 'Loading section';
15
- const DefaultSectionFallback = ({ testId, onShownChange }) => {
16
- useEffect(() => {
17
- onShownChange(true);
18
- return () => onShownChange(false);
19
- }, [onShownChange]);
20
- return (jsxs("div", { "aria-busy": "true", "data-testid": testId, className: "flex w-full flex-col gap-4", children: [jsx(Skeleton, { width: "40%", height: 20 }), jsx(SkeletonText, { lines: 4 })] }));
21
- };
22
- /** Runs `render` as a component, so a throw lands in the section boundary rather than in the layout's own render. */
23
- const PageHubLayoutSectionContent = ({ render }) => render();
24
- /**
25
- * Page template for a hub of sections: a `PageLayout` whose content is a section navigation beside
26
- * the selected section, each section rendered from config inside its own error and Suspense boundary. Reach for
27
- * it instead of `PageLayout` when one page hosts several feature areas picked from a left-hand list,
28
- * such as a settings hub; the list becomes a select below `lg`.
29
- *
30
- * @summary page template with section navigation and content
31
- */
32
- const PageHubLayout = ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, 'data-testid': dataTestId, ...pageLayoutProps }) => {
33
- const pageHubLayoutTestId = useResolvedTestId({ testId: dataTestId, segment: 'page-hub-layout', rootName: 'page-hub-layout' });
34
- // Uncontrolled fallback so the desktop navigation and the mobile select always agree on the selection.
35
- const [internalSelectedSection, setInternalSelectedSection] = useState(defaultSelectedSection);
36
- const [isDefaultFallbackShown, setIsDefaultFallbackShown] = useState(false);
37
- const activeSection = resolveSelectedSection(sections, selectedSection ?? internalSelectedSection);
38
- const selectSection = (id) => {
39
- setInternalSelectedSection(id);
40
- // Re-picking the current section is not a change; the select already ignores it, so the navigation does too.
41
- if (id !== activeSection?.id)
42
- onSectionChange?.(id);
43
- };
44
- const selectFromSelect = (key) => {
45
- const pickedId = resolvePickedSectionId(sections, key);
46
- if (pickedId !== undefined)
47
- selectSection(pickedId);
48
- };
49
- return (jsx(PageLayout, { ...pageLayoutProps, pageName: pageName, renderError: renderError, onError: onError, "data-testid": pageHubLayoutTestId, children: jsxs("div", { className: "flex w-full flex-col gap-md lg:flex-row lg:items-start", children: [jsx(PageHubLayoutSectionNav, { className: "max-lg:hidden", sections: sections, selectedSection: activeSection?.id, onSelect: selectSection, "aria-label": navigationLabel, "data-testid": joinTestId(pageHubLayoutTestId, 'sections') }), jsx(Select, { className: "w-full lg:hidden", size: "md", "aria-label": navigationLabel, value: activeSection?.id ?? null, onChange: selectFromSelect, "data-testid": joinTestId(pageHubLayoutTestId, 'sections-select'), children: sections.map((section) => (
50
- // Spread, not `href={section.href}`: react-aria copies an `href` key that is present but undefined onto the option as `href=""`.
51
- jsx(Select.Item, { id: section.id, label: section.label, isDisabled: section.isDisabled, ...(section.href ? { href: section.href } : {}) }, section.id))) }), jsxs("div", { "data-testid": joinTestId(pageHubLayoutTestId, 'content'), className: "w-full min-w-0 flex-1", children: [jsx("output", { className: "sr-only", children: isDefaultFallbackShown ? DEFAULT_SECTION_LOADING_TEXT : '' }), activeSection && (
52
- // Keyed by section so a section that threw is replaced, not left showing its fallback, when the user moves on.
53
- jsx(ErrorBoundary, { identifier: `${pageName}/${activeSection.id}`, onError: onError, renderFallback: (error) => {
54
- // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
55
- const customFallback = renderError?.({ error, pageName, sectionId: activeSection.id });
56
- if (customFallback !== undefined)
57
- return customFallback;
58
- return jsx(DefaultSectionError, { testId: joinTestId(pageHubLayoutTestId, 'section-error') });
59
- }, children: jsx(Suspense, { fallback: sectionFallback !== undefined ? (sectionFallback) : (jsx(DefaultSectionFallback, { testId: joinTestId(pageHubLayoutTestId, 'section-loading'), onShownChange: setIsDefaultFallbackShown })), children: jsx(PageHubLayoutSectionContent, { render: activeSection.render }) }) }, activeSection.id))] })] }) }));
60
- };
3
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageHubLayout`. Removed in the next major. */
4
+ const PageHubLayout = PageHubLayout$1;
61
5
 
62
6
  export { PageHubLayout };
63
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AAsDA;AACA,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAuB,MAC1DA,IAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,iBAAc,MAAM,EAAE,SAAS,EAAC,4DAA4D,EAAA,QAAA,EAAA,CAC3GC,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,sBAAA,EAAA,CAA0B,EAC5EA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC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I,EAAA,QAAA,EAGHA,GAAA,CAAC,2BAA2B,EAAA,EAAC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAA,CAAI,EAAA,CACpD,EAAA,EApBN,aAAa,CAAC,EAAE,CAqBP,CACjB,CAAA,EAAA,CACG,CAAA,EAAA,CACF,EAAA,CACK;AAEjB;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"sourcesContent":[null],"names":["PageHubLayoutNext"],"mappings":";;AAUA;AACO,MAAM,aAAa,GAAGA;;"}
@@ -1,31 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
5
- var cx = require('@flipdish/ui-library/utilities/cx');
6
- var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
3
+ var PageLayout$1 = require('@flipdish/ui-library/components/layouts/PageLayout');
7
4
 
8
- /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
9
- const DefaultPageError = ({ testId }) => (jsxRuntime.jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-2xl text-center", children: [jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-primary", children: "Something went wrong" }), jsxRuntime.jsx("p", { className: "text-md text-tertiary", children: "An unexpected error occurred while loading this page." })] }));
10
- /**
11
- * Page-shaped template for app page chrome: a full-width `<main>` that owns the gutters (16px
12
- * on mobile, 24px from `lg`) and the header-to-content gap, an optional header region and an
13
- * error boundary keyed by `pageName`. The boundary wraps `children` only, so the header's
14
- * breadcrumbs stay usable when content throws; an app-level boundary still catches header
15
- * errors.
16
- *
17
- * @summary app-shell page template with a page-scoped error boundary
18
- */
19
- const PageLayout = ({ pageName, header, children, renderError, onError, className, 'data-testid': dataTestId, }) => {
20
- const pageLayoutTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'page-layout', rootName: 'page-layout' });
21
- return (jsxRuntime.jsxs("main", { "data-testid": pageLayoutTestId, className: cx.cx('flex w-full flex-col gap-md p-md lg:p-xl', className), children: [header, jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { identifier: pageName, onError: onError, renderFallback: (error) => {
22
- // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
23
- const customFallback = renderError?.({ error, pageName });
24
- if (customFallback !== undefined)
25
- return customFallback;
26
- return jsxRuntime.jsx(DefaultPageError, { testId: testIdUtils.joinTestId(pageLayoutTestId, 'error') });
27
- }, children: children })] }));
28
- };
5
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageLayout`. Removed in the next major. */
6
+ const PageLayout = PageLayout$1.PageLayout;
29
7
 
30
8
  exports.PageLayout = PageLayout;
31
9
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/PageLayout/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","useResolvedTestId","cx","ErrorBoundary","joinTestId"],"mappings":";;;;;;;AAoCA;AACA,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAuB,MACvDA,eAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,iBAAc,MAAM,EAAE,SAAS,EAAC,4DAA4D,EAAA,QAAA,EAAA,CAC3GC,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,sBAAA,EAAA,CAA0B,EAC5EA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAAA,uDAAA,EAAA,CAA0D,CAAA,EAAA,CAC1F,CACP;AAED;;;;;;;;AAQG;MACU,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAa,EAAE,UAAU,GACT,KAAe;AAC/B,IAAA,MAAM,gBAAgB,GAAGC,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAEnH,IAAA,QACEF,eAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAmB,gBAAgB,EAAE,SAAS,EAAEG,KAAE,CAAC,0CAA0C,EAAE,SAAS,CAAC,aACtG,MAAM,EAEPF,cAAA,CAACG,2BAAa,EAAA,EACZ,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,KAAK,KAAI;;oBAExB,MAAM,cAAc,GAAG,WAAW,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;oBACzD,IAAI,cAAc,KAAK,SAAS;AAAE,wBAAA,OAAO,cAAc;AACvD,oBAAA,OAAOH,cAAA,CAAC,gBAAgB,EAAA,EAAC,MAAM,EAAEI,sBAAU,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAA,CAAI;AAC5E,gBAAA,CAAC,EAAA,QAAA,EAEA,QAAQ,EAAA,CACK,CAAA,EAAA,CACX;AAEX;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/PageLayout/index.tsx"],"sourcesContent":[null],"names":["PageLayoutNext"],"mappings":";;;;AAMA;AACO,MAAM,UAAU,GAAGA;;"}
@@ -1,43 +1,6 @@
1
- import type { ErrorInfo, ReactNode } from 'react';
2
- export interface PageLayoutProps {
3
- /**
4
- * Stable, human-readable name of the page (e.g. "CollectionSettings"). Tags the
5
- * page-level error boundary so a thrown error can be attributed to a specific page
6
- * in logs/RUM, and is forwarded to `renderError` and `onError`.
7
- */
8
- pageName: string;
9
- /**
10
- * Header region. Compose `<PageHeader>` (or a feature wrapper around it) here.
11
- * Rendered OUTSIDE the error boundary so page chrome (breadcrumbs, back link)
12
- * stays usable when the content below throws.
13
- */
14
- header?: ReactNode;
15
- /** Page content, rendered INSIDE the error boundary. */
16
- children: ReactNode;
17
- /**
18
- * Replaces the default fallback shown when a child throws. Receives the thrown
19
- * error and `pageName` so consumers can render localised copy. Return `null` to
20
- * render nothing, or `undefined` to keep the default fallback.
21
- */
22
- renderError?: (props: {
23
- error: Error;
24
- pageName: string;
25
- }) => ReactNode;
26
- /** Called when a child throws — wire app-level reporting (e.g. Datadog RUM) here. */
27
- onError?: (error: Error, info: ErrorInfo) => void;
28
- /** Extra classes merged onto the root `<main>`. */
29
- className?: string;
30
- /** Overrides the `data-testid` (defaults to `fd-page-layout`). */
31
- 'data-testid'?: string;
32
- }
33
- /**
34
- * Page-shaped template for app page chrome: a full-width `<main>` that owns the gutters (16px
35
- * on mobile, 24px from `lg`) and the header-to-content gap, an optional header region and an
36
- * error boundary keyed by `pageName`. The boundary wraps `children` only, so the header's
37
- * breadcrumbs stay usable when content throws; an app-level boundary still catches header
38
- * errors.
39
- *
40
- * @summary app-shell page template with a page-scoped error boundary
41
- */
42
- export declare const PageLayout: ({ pageName, header, children, renderError, onError, className, "data-testid": dataTestId, }: PageLayoutProps) => ReactNode;
1
+ import { type PageLayoutProps as PageLayoutPropsNext } from '@flipdish/ui-library/components/layouts/PageLayout';
2
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageLayout`. Removed in the next major. */
3
+ export declare const PageLayout: ({ pageName, header, children, renderError, onError, className, "data-testid": dataTestId, }: PageLayoutPropsNext) => import("react").ReactNode;
4
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageLayout`. Removed in the next major. */
5
+ export type PageLayoutProps = PageLayoutPropsNext;
43
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/PageLayout/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,wDAAwD;IACxD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IACvE,qFAAqF;IACrF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAUD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAI,6FAQxB,eAAe,KAAG,SAqBpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/PageLayout/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAgC,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAE/I,+GAA+G;AAC/G,eAAO,MAAM,UAAU,iJAAiB,CAAC;AACzC,+GAA+G;AAC/G,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
@@ -1,29 +1,7 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { ErrorBoundary } from '@flipdish/ui-library/providers/ErrorBoundary';
3
- import { cx } from '@flipdish/ui-library/utilities/cx';
4
- import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
1
+ import { PageLayout as PageLayout$1 } from '@flipdish/ui-library/components/layouts/PageLayout';
5
2
 
6
- /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
7
- const DefaultPageError = ({ testId }) => (jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-2xl text-center", children: [jsx("h2", { className: "text-lg font-semibold text-primary", children: "Something went wrong" }), jsx("p", { className: "text-md text-tertiary", children: "An unexpected error occurred while loading this page." })] }));
8
- /**
9
- * Page-shaped template for app page chrome: a full-width `<main>` that owns the gutters (16px
10
- * on mobile, 24px from `lg`) and the header-to-content gap, an optional header region and an
11
- * error boundary keyed by `pageName`. The boundary wraps `children` only, so the header's
12
- * breadcrumbs stay usable when content throws; an app-level boundary still catches header
13
- * errors.
14
- *
15
- * @summary app-shell page template with a page-scoped error boundary
16
- */
17
- const PageLayout = ({ pageName, header, children, renderError, onError, className, 'data-testid': dataTestId, }) => {
18
- const pageLayoutTestId = useResolvedTestId({ testId: dataTestId, segment: 'page-layout', rootName: 'page-layout' });
19
- return (jsxs("main", { "data-testid": pageLayoutTestId, className: cx('flex w-full flex-col gap-md p-md lg:p-xl', className), children: [header, jsx(ErrorBoundary, { identifier: pageName, onError: onError, renderFallback: (error) => {
20
- // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
21
- const customFallback = renderError?.({ error, pageName });
22
- if (customFallback !== undefined)
23
- return customFallback;
24
- return jsx(DefaultPageError, { testId: joinTestId(pageLayoutTestId, 'error') });
25
- }, children: children })] }));
26
- };
3
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/PageLayout`. Removed in the next major. */
4
+ const PageLayout = PageLayout$1;
27
5
 
28
6
  export { PageLayout };
29
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/templates/PageLayout/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;AAoCA;AACA,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAuB,MACvDA,IAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,iBAAc,MAAM,EAAE,SAAS,EAAC,4DAA4D,EAAA,QAAA,EAAA,CAC3GC,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,sBAAA,EAAA,CAA0B,EAC5EA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAAA,uDAAA,EAAA,CAA0D,CAAA,EAAA,CAC1F,CACP;AAED;;;;;;;;AAQG;MACU,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAa,EAAE,UAAU,GACT,KAAe;AAC/B,IAAA,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAEnH,IAAA,QACED,IAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAmB,gBAAgB,EAAE,SAAS,EAAE,EAAE,CAAC,0CAA0C,EAAE,SAAS,CAAC,aACtG,MAAM,EAEPC,GAAA,CAAC,aAAa,EAAA,EACZ,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,KAAK,KAAI;;oBAExB,MAAM,cAAc,GAAG,WAAW,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;oBACzD,IAAI,cAAc,KAAK,SAAS;AAAE,wBAAA,OAAO,cAAc;AACvD,oBAAA,OAAOA,GAAA,CAAC,gBAAgB,EAAA,EAAC,MAAM,EAAE,UAAU,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAA,CAAI;AAC5E,gBAAA,CAAC,EAAA,QAAA,EAEA,QAAQ,EAAA,CACK,CAAA,EAAA,CACX;AAEX;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/templates/PageLayout/index.tsx"],"sourcesContent":[null],"names":["PageLayoutNext"],"mappings":";;AAMA;AACO,MAAM,UAAU,GAAGA;;"}
@@ -1,42 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
5
- var cx = require('@flipdish/ui-library/utilities/cx');
6
- var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
3
+ var WidgetLayout$1 = require('@flipdish/ui-library/components/layouts/WidgetLayout');
7
4
 
8
- /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
9
- const DefaultWidgetError = ({ testId }) => (jsxRuntime.jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-xl text-center", children: [jsxRuntime.jsx("h2", { className: "font-semibold text-md text-primary", children: "Something went wrong" }), jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: "An unexpected error occurred in this widget." })] }));
10
- /**
11
- * Widget-shaped template for a micro-frontend mounted beside a page: a named `region` that fills
12
- * the height its host gives it, with pinned `header` and `footer` slots around a content area
13
- * that scrolls internally, and an error boundary keyed by `widgetName`. Reach for it instead of
14
- * `PageLayout` whenever the host page already owns `<main>` and the document must not scroll.
15
- *
16
- * @summary bounded-height widget template with pinned header and footer
17
- */
18
- const WidgetLayout = ({ widgetName, label, header, footer, children, renderError, onError, scrollAreaProps, className, 'data-testid': dataTestId, }) => {
19
- const widgetLayoutTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'widget-layout', rootName: 'widget-layout' });
20
- const scrollAreaTestId = scrollAreaProps?.['data-testid'] ?? testIdUtils.joinTestId(widgetLayoutTestId, 'scroll-area');
21
- // A `<section>` with an accessible name is a `region` landmark; without a name it is a plain `div`, so a
22
- // host that already provides the landmark does not get a nested, same-named one.
23
- const Root = label ? 'section' : 'div';
24
- return (
25
- // `h-full`, never a viewport unit: the host supplies the bounded height, and WebView viewport units can
26
- // disagree with the visible area. `min-h-0` lets the scroll region shrink below its content's height.
27
- jsxRuntime.jsxs(Root, { "aria-label": label, "data-testid": widgetLayoutTestId, className: cx.cx('flex h-full min-h-0 w-full flex-col gap-md p-md pb-[max(var(--spacing-md),env(safe-area-inset-bottom))]', className), children: [header, jsxRuntime.jsx("div", { id: scrollAreaProps?.id, ref: scrollAreaProps?.ref, "data-testid": scrollAreaTestId,
28
- // Focusable so keyboard users can scroll content that has no focusable element of its own (axe: scrollable-region-focusable).
29
- // biome-ignore lint/a11y/noNoninteractiveTabindex: a scrollable region must be reachable by keyboard
30
- tabIndex: 0,
31
- // `overscroll-contain` keeps a scroll that reaches the end from chaining to the host page.
32
- className: cx.cx('min-h-0 flex-1 overflow-y-auto overscroll-contain outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2', scrollAreaProps?.className), children: jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { identifier: widgetName, onError: onError, renderFallback: (error) => {
33
- // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
34
- const customFallback = renderError?.({ error, widgetName });
35
- if (customFallback !== undefined)
36
- return customFallback;
37
- return jsxRuntime.jsx(DefaultWidgetError, { testId: testIdUtils.joinTestId(widgetLayoutTestId, 'error') });
38
- }, children: children }) }), footer] }));
39
- };
5
+ /** @deprecated Import from `@flipdish/ui-library/components/layouts/WidgetLayout`. Removed in the next major. */
6
+ const WidgetLayout = WidgetLayout$1.WidgetLayout;
40
7
 
41
8
  exports.WidgetLayout = WidgetLayout;
42
9
  //# sourceMappingURL=index.cjs.map