@tidbcloud/uikit 2.3.3 → 2.4.1

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 (102) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/biz/AppShell/AppPageShell.cjs +105 -0
  3. package/dist/biz/AppShell/AppPageShell.d.cts +20 -0
  4. package/dist/biz/AppShell/AppPageShell.d.mts +20 -0
  5. package/dist/biz/AppShell/AppPageShell.mjs +105 -0
  6. package/dist/biz/AppShell/AppShell.cjs +83 -0
  7. package/dist/biz/AppShell/AppShell.d.cts +45 -0
  8. package/dist/biz/AppShell/AppShell.d.mts +45 -0
  9. package/dist/biz/AppShell/AppShell.mjs +83 -0
  10. package/dist/biz/AppShell/container/AppShellBody.cjs +30 -0
  11. package/dist/biz/AppShell/container/AppShellBody.d.cts +5 -0
  12. package/dist/biz/AppShell/container/AppShellBody.d.mts +5 -0
  13. package/dist/biz/AppShell/container/AppShellBody.mjs +30 -0
  14. package/dist/biz/AppShell/container/AppShellMain.cjs +36 -0
  15. package/dist/biz/AppShell/container/AppShellMain.d.cts +5 -0
  16. package/dist/biz/AppShell/container/AppShellMain.d.mts +5 -0
  17. package/dist/biz/AppShell/container/AppShellMain.mjs +36 -0
  18. package/dist/biz/AppShell/container/AppShellRoot.cjs +13 -0
  19. package/dist/biz/AppShell/container/AppShellRoot.d.cts +1 -0
  20. package/dist/biz/AppShell/container/AppShellRoot.d.mts +1 -0
  21. package/dist/biz/AppShell/container/AppShellRoot.mjs +13 -0
  22. package/dist/biz/AppShell/index.d.cts +7 -0
  23. package/dist/biz/AppShell/index.d.mts +7 -0
  24. package/dist/biz/AppShell/navbar/ExpandNavbarButton.cjs +44 -0
  25. package/dist/biz/AppShell/navbar/ExpandNavbarButton.d.cts +6 -0
  26. package/dist/biz/AppShell/navbar/ExpandNavbarButton.d.mts +6 -0
  27. package/dist/biz/AppShell/navbar/ExpandNavbarButton.mjs +44 -0
  28. package/dist/biz/AppShell/navbar/ExpandNavbarButtonPlaceholder.cjs +32 -0
  29. package/dist/biz/AppShell/navbar/ExpandNavbarButtonPlaceholder.d.cts +1 -0
  30. package/dist/biz/AppShell/navbar/ExpandNavbarButtonPlaceholder.d.mts +1 -0
  31. package/dist/biz/AppShell/navbar/ExpandNavbarButtonPlaceholder.mjs +32 -0
  32. package/dist/biz/AppShell/navbar/FooterNavItemBase.cjs +8 -0
  33. package/dist/biz/AppShell/navbar/FooterNavItemBase.d.cts +7 -0
  34. package/dist/biz/AppShell/navbar/FooterNavItemBase.d.mts +7 -0
  35. package/dist/biz/AppShell/navbar/FooterNavItemBase.mjs +8 -0
  36. package/dist/biz/AppShell/navbar/NavItemBase.cjs +21 -0
  37. package/dist/biz/AppShell/navbar/NavItemBase.d.cts +12 -0
  38. package/dist/biz/AppShell/navbar/NavItemBase.d.mts +12 -0
  39. package/dist/biz/AppShell/navbar/NavItemBase.mjs +21 -0
  40. package/dist/biz/AppShell/navbar/Navbar.cjs +61 -0
  41. package/dist/biz/AppShell/navbar/Navbar.d.cts +11 -0
  42. package/dist/biz/AppShell/navbar/Navbar.d.mts +11 -0
  43. package/dist/biz/AppShell/navbar/Navbar.mjs +61 -0
  44. package/dist/biz/AppShell/navbar/NavbarHeader.cjs +58 -0
  45. package/dist/biz/AppShell/navbar/NavbarHeader.d.cts +8 -0
  46. package/dist/biz/AppShell/navbar/NavbarHeader.d.mts +8 -0
  47. package/dist/biz/AppShell/navbar/NavbarHeader.mjs +58 -0
  48. package/dist/biz/AppShell/navbar/NavbarSection.cjs +32 -0
  49. package/dist/biz/AppShell/navbar/NavbarSection.d.cts +16 -0
  50. package/dist/biz/AppShell/navbar/NavbarSection.d.mts +16 -0
  51. package/dist/biz/AppShell/navbar/NavbarSection.mjs +32 -0
  52. package/dist/biz/AppShell/navbar/SubNavItemBase.cjs +23 -0
  53. package/dist/biz/AppShell/navbar/SubNavItemBase.d.cts +7 -0
  54. package/dist/biz/AppShell/navbar/SubNavItemBase.d.mts +7 -0
  55. package/dist/biz/AppShell/navbar/SubNavItemBase.mjs +23 -0
  56. package/dist/biz/AppShell/navbar/context/NavMenuPortal.cjs +28 -0
  57. package/dist/biz/AppShell/navbar/context/NavMenuPortal.d.cts +1 -0
  58. package/dist/biz/AppShell/navbar/context/NavMenuPortal.d.mts +1 -0
  59. package/dist/biz/AppShell/navbar/context/NavMenuPortal.mjs +28 -0
  60. package/dist/biz/AppShell/navbar/context/nav-menu-ref-context.cjs +5 -0
  61. package/dist/biz/AppShell/navbar/context/nav-menu-ref-context.d.cts +1 -0
  62. package/dist/biz/AppShell/navbar/context/nav-menu-ref-context.d.mts +1 -0
  63. package/dist/biz/AppShell/navbar/context/nav-menu-ref-context.mjs +5 -0
  64. package/dist/biz/PageShell/{index.cjs → LegacyPageShell.cjs} +2 -2
  65. package/dist/biz/PageShell/LegacyPageShell.d.cts +85 -0
  66. package/dist/biz/PageShell/LegacyPageShell.d.mts +85 -0
  67. package/dist/biz/PageShell/{index.mjs → LegacyPageShell.mjs} +2 -2
  68. package/dist/biz/PageShell/index.d.cts +1 -85
  69. package/dist/biz/PageShell/index.d.mts +1 -85
  70. package/dist/biz/PageShellBase/PageShellBaseBackButton.cjs +32 -0
  71. package/dist/biz/PageShellBase/PageShellBaseBackButton.d.cts +5 -0
  72. package/dist/biz/PageShellBase/PageShellBaseBackButton.d.mts +5 -0
  73. package/dist/biz/PageShellBase/PageShellBaseBackButton.mjs +32 -0
  74. package/dist/biz/PageShellBase/PageShellBaseBody.cjs +30 -0
  75. package/dist/biz/PageShellBase/PageShellBaseBody.d.cts +4 -0
  76. package/dist/biz/PageShellBase/PageShellBaseBody.d.mts +4 -0
  77. package/dist/biz/PageShellBase/PageShellBaseBody.mjs +30 -0
  78. package/dist/biz/PageShellBase/PageShellBaseHeader.cjs +50 -0
  79. package/dist/biz/PageShellBase/PageShellBaseHeader.d.cts +17 -0
  80. package/dist/biz/PageShellBase/PageShellBaseHeader.d.mts +17 -0
  81. package/dist/biz/PageShellBase/PageShellBaseHeader.mjs +50 -0
  82. package/dist/biz/PageShellBase/PageShellBaseRoot.cjs +14 -0
  83. package/dist/biz/PageShellBase/PageShellBaseRoot.d.cts +4 -0
  84. package/dist/biz/PageShellBase/PageShellBaseRoot.d.mts +4 -0
  85. package/dist/biz/PageShellBase/PageShellBaseRoot.mjs +14 -0
  86. package/dist/biz/PageShellBase/PageShellBaseTitle.cjs +23 -0
  87. package/dist/biz/PageShellBase/PageShellBaseTitle.d.cts +4 -0
  88. package/dist/biz/PageShellBase/PageShellBaseTitle.d.mts +4 -0
  89. package/dist/biz/PageShellBase/PageShellBaseTitle.mjs +23 -0
  90. package/dist/biz/PageShellBase/page-shell-base.cjs +25 -0
  91. package/dist/biz/PageShellBase/page-shell-base.d.cts +14 -0
  92. package/dist/biz/PageShellBase/page-shell-base.d.mts +14 -0
  93. package/dist/biz/PageShellBase/page-shell-base.mjs +25 -0
  94. package/dist/biz/index.cjs +35 -9
  95. package/dist/biz/index.d.cts +2 -0
  96. package/dist/biz/index.d.mts +2 -0
  97. package/dist/biz/index.mjs +27 -1
  98. package/dist/primitive/index.d.cts +1 -1
  99. package/dist/primitive/index.d.mts +1 -1
  100. package/dist/theme/theme.cjs +24 -2
  101. package/dist/theme/theme.mjs +24 -2
  102. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tidbcloud/uikit
2
2
 
3
+ ## 2.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor(biz/app-shell): extract back button props for cleaner prop handling ([#542](https://github.com/tidbcloud/tidbcloud-uikit/pull/542))
8
+
9
+ ## 2.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - feat(biz): add new AppShell and PageShell ([#540](https://github.com/tidbcloud/tidbcloud-uikit/pull/540))
14
+
3
15
  ## 2.3.3
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ ;/* empty css */
5
+ ;/* empty css */
6
+ ;/* empty css */
7
+ ;/* empty css */
8
+ ;/* empty css */
9
+ require("clsx");
10
+ const styles = require("../../utils/styles.cjs");
11
+ const PageShellBaseBackButton = require("../PageShellBase/PageShellBaseBackButton.cjs");
12
+ const PageShellBaseBody = require("../PageShellBase/PageShellBaseBody.cjs");
13
+ const PageShellBaseHeader = require("../PageShellBase/PageShellBaseHeader.cjs");
14
+ const PageShellBaseRoot = require("../PageShellBase/PageShellBaseRoot.cjs");
15
+ const PageShellBaseTitle = require("../PageShellBase/PageShellBaseTitle.cjs");
16
+ const ExpandNavbarButtonPlaceholder = require("./navbar/ExpandNavbarButtonPlaceholder.cjs");
17
+ const Group = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Group/Group.cjs");
18
+ const DEFAULT_PAGE_MAX_WIDTH = 1920;
19
+ const AppPageShell = ({
20
+ withHeader = true,
21
+ headerProps,
22
+ bodyProps,
23
+ wrapperProps,
24
+ maxWidth = `${DEFAULT_PAGE_MAX_WIDTH}px`,
25
+ ...rest
26
+ }) => {
27
+ if (!withHeader) {
28
+ return /* @__PURE__ */ jsxRuntime.jsx(
29
+ PageShellBaseRoot.PageShellBaseRoot,
30
+ {
31
+ ...bodyProps,
32
+ sx: styles.mergeSxList([
33
+ {
34
+ "--app-shell-page-max-width": maxWidth
35
+ },
36
+ {
37
+ height: "100%",
38
+ maxWidth: `min(100%, ${maxWidth})`,
39
+ margin: "0 auto",
40
+ padding: 24
41
+ },
42
+ bodyProps == null ? void 0 : bodyProps.sx
43
+ ]),
44
+ children: rest.children
45
+ }
46
+ );
47
+ }
48
+ const { withBack, onBackClick, ...headerPropsWithoutBack } = headerProps ?? {};
49
+ return /* @__PURE__ */ jsxRuntime.jsxs(
50
+ PageShellBaseRoot.PageShellBaseRoot,
51
+ {
52
+ ...wrapperProps,
53
+ sx: styles.mergeSxList([
54
+ {
55
+ "--app-shell-page-max-width": maxWidth
56
+ },
57
+ (theme) => ({
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ height: "100%",
61
+ maxWidth: `min(100%, ${maxWidth})`,
62
+ margin: "0 auto",
63
+ minWidth: `calc(${theme.breakpoints.md} - var(--app-shell-navbar-offset))`
64
+ }),
65
+ wrapperProps == null ? void 0 : wrapperProps.sx
66
+ ]),
67
+ children: [
68
+ /* @__PURE__ */ jsxRuntime.jsx(
69
+ PageShellBaseHeader.PageShellBaseHeader,
70
+ {
71
+ ...headerPropsWithoutBack,
72
+ leftSection: /* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { wrap: "nowrap", gap: 0, children: [
73
+ /* @__PURE__ */ jsxRuntime.jsx(ExpandNavbarButtonPlaceholder.ExpandNavbarButtonPlaceholder, {}),
74
+ withBack && /* @__PURE__ */ jsxRuntime.jsx(PageShellBaseBackButton.PageShellBaseBackButton, { onClick: onBackClick, mr: "md" })
75
+ ] }),
76
+ sx: styles.mergeSxList([
77
+ (theme) => ({
78
+ backgroundColor: theme.colors.carbon[1],
79
+ flexShrink: 0
80
+ }),
81
+ headerProps == null ? void 0 : headerProps.sx
82
+ ]),
83
+ children: /* @__PURE__ */ jsxRuntime.jsx(PageShellBaseTitle.PageShellBaseTitle, { children: rest.title })
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsxRuntime.jsx(
87
+ PageShellBaseBody.PageShellBaseBody,
88
+ {
89
+ ...bodyProps,
90
+ sx: styles.mergeSxList([
91
+ {
92
+ paddingTop: 0,
93
+ paddingBottom: 64,
94
+ flex: 1
95
+ },
96
+ bodyProps == null ? void 0 : bodyProps.sx
97
+ ]),
98
+ children: rest.children
99
+ }
100
+ )
101
+ ]
102
+ }
103
+ );
104
+ };
105
+ exports.AppPageShell = AppPageShell;
@@ -0,0 +1,20 @@
1
+ import { PageShellBaseRootProps, PageShellBaseHeaderProps, PageShellBaseBodyProps } from '../PageShellBase/page-shell-base.cjs';
2
+ export interface AppPageShellProps {
3
+ maxWidth?: string;
4
+ withHeader?: boolean;
5
+ title?: React.ReactNode;
6
+ children?: React.ReactNode;
7
+ wrapperProps?: PageShellBaseRootProps;
8
+ headerProps?: PageShellBaseHeaderProps & {
9
+ /**
10
+ * Determines whether the back button should be rendered
11
+ */
12
+ withBack?: boolean;
13
+ /**
14
+ * Called when the back button is clicked
15
+ */
16
+ onBackClick?: () => void;
17
+ };
18
+ bodyProps?: PageShellBaseBodyProps;
19
+ }
20
+ export declare const AppPageShell: ({ withHeader, headerProps, bodyProps, wrapperProps, maxWidth, ...rest }: AppPageShellProps) => import("react/jsx-runtime.js").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { PageShellBaseRootProps, PageShellBaseHeaderProps, PageShellBaseBodyProps } from '../PageShellBase/page-shell-base.mjs';
2
+ export interface AppPageShellProps {
3
+ maxWidth?: string;
4
+ withHeader?: boolean;
5
+ title?: React.ReactNode;
6
+ children?: React.ReactNode;
7
+ wrapperProps?: PageShellBaseRootProps;
8
+ headerProps?: PageShellBaseHeaderProps & {
9
+ /**
10
+ * Determines whether the back button should be rendered
11
+ */
12
+ withBack?: boolean;
13
+ /**
14
+ * Called when the back button is clicked
15
+ */
16
+ onBackClick?: () => void;
17
+ };
18
+ bodyProps?: PageShellBaseBodyProps;
19
+ }
20
+ export declare const AppPageShell: ({ withHeader, headerProps, bodyProps, wrapperProps, maxWidth, ...rest }: AppPageShellProps) => import("react/jsx-runtime.js").JSX.Element;
@@ -0,0 +1,105 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ /* empty css */
3
+ /* empty css */
4
+ /* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ import "clsx";
8
+ import { mergeSxList } from "../../utils/styles.mjs";
9
+ import { PageShellBaseBackButton } from "../PageShellBase/PageShellBaseBackButton.mjs";
10
+ import { PageShellBaseBody } from "../PageShellBase/PageShellBaseBody.mjs";
11
+ import { PageShellBaseHeader } from "../PageShellBase/PageShellBaseHeader.mjs";
12
+ import { PageShellBaseRoot } from "../PageShellBase/PageShellBaseRoot.mjs";
13
+ import { PageShellBaseTitle } from "../PageShellBase/PageShellBaseTitle.mjs";
14
+ import { ExpandNavbarButtonPlaceholder } from "./navbar/ExpandNavbarButtonPlaceholder.mjs";
15
+ import { Group } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Group/Group.mjs";
16
+ const DEFAULT_PAGE_MAX_WIDTH = 1920;
17
+ const AppPageShell = ({
18
+ withHeader = true,
19
+ headerProps,
20
+ bodyProps,
21
+ wrapperProps,
22
+ maxWidth = `${DEFAULT_PAGE_MAX_WIDTH}px`,
23
+ ...rest
24
+ }) => {
25
+ if (!withHeader) {
26
+ return /* @__PURE__ */ jsx(
27
+ PageShellBaseRoot,
28
+ {
29
+ ...bodyProps,
30
+ sx: mergeSxList([
31
+ {
32
+ "--app-shell-page-max-width": maxWidth
33
+ },
34
+ {
35
+ height: "100%",
36
+ maxWidth: `min(100%, ${maxWidth})`,
37
+ margin: "0 auto",
38
+ padding: 24
39
+ },
40
+ bodyProps == null ? void 0 : bodyProps.sx
41
+ ]),
42
+ children: rest.children
43
+ }
44
+ );
45
+ }
46
+ const { withBack, onBackClick, ...headerPropsWithoutBack } = headerProps ?? {};
47
+ return /* @__PURE__ */ jsxs(
48
+ PageShellBaseRoot,
49
+ {
50
+ ...wrapperProps,
51
+ sx: mergeSxList([
52
+ {
53
+ "--app-shell-page-max-width": maxWidth
54
+ },
55
+ (theme) => ({
56
+ display: "flex",
57
+ flexDirection: "column",
58
+ height: "100%",
59
+ maxWidth: `min(100%, ${maxWidth})`,
60
+ margin: "0 auto",
61
+ minWidth: `calc(${theme.breakpoints.md} - var(--app-shell-navbar-offset))`
62
+ }),
63
+ wrapperProps == null ? void 0 : wrapperProps.sx
64
+ ]),
65
+ children: [
66
+ /* @__PURE__ */ jsx(
67
+ PageShellBaseHeader,
68
+ {
69
+ ...headerPropsWithoutBack,
70
+ leftSection: /* @__PURE__ */ jsxs(Group, { wrap: "nowrap", gap: 0, children: [
71
+ /* @__PURE__ */ jsx(ExpandNavbarButtonPlaceholder, {}),
72
+ withBack && /* @__PURE__ */ jsx(PageShellBaseBackButton, { onClick: onBackClick, mr: "md" })
73
+ ] }),
74
+ sx: mergeSxList([
75
+ (theme) => ({
76
+ backgroundColor: theme.colors.carbon[1],
77
+ flexShrink: 0
78
+ }),
79
+ headerProps == null ? void 0 : headerProps.sx
80
+ ]),
81
+ children: /* @__PURE__ */ jsx(PageShellBaseTitle, { children: rest.title })
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsx(
85
+ PageShellBaseBody,
86
+ {
87
+ ...bodyProps,
88
+ sx: mergeSxList([
89
+ {
90
+ paddingTop: 0,
91
+ paddingBottom: 64,
92
+ flex: 1
93
+ },
94
+ bodyProps == null ? void 0 : bodyProps.sx
95
+ ]),
96
+ children: rest.children
97
+ }
98
+ )
99
+ ]
100
+ }
101
+ );
102
+ };
103
+ export {
104
+ AppPageShell
105
+ };
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ ;/* empty css */
6
+ ;/* empty css */
7
+ ;/* empty css */
8
+ ;/* empty css */
9
+ ;/* empty css */
10
+ const AppShellBody = require("./container/AppShellBody.cjs");
11
+ const AppShellMain = require("./container/AppShellMain.cjs");
12
+ const AppShellRoot = require("./container/AppShellRoot.cjs");
13
+ const navMenuRefContext = require("./navbar/context/nav-menu-ref-context.cjs");
14
+ const ExpandNavbarButton = require("./navbar/ExpandNavbarButton.cjs");
15
+ const Navbar = require("./navbar/Navbar.cjs");
16
+ const NavbarHeader = require("./navbar/NavbarHeader.cjs");
17
+ const NavbarSection = require("./navbar/NavbarSection.cjs");
18
+ const Box = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.cjs");
19
+ const Stack = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Stack/Stack.cjs");
20
+ const Divider = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Divider/Divider.cjs");
21
+ const DEFAULT_NAVBAR_WIDTH = 240;
22
+ const AppShell = ({ banner, navbar, children }) => {
23
+ const navMenuRef = React.useRef(null);
24
+ const bannerRef = React.useRef(null);
25
+ const [withBanner, setWithBanner] = React.useState(false);
26
+ const [navbarCollapsed, setNavbarCollapsed] = React.useState(false);
27
+ const navbarWidth = navbar.width ?? DEFAULT_NAVBAR_WIDTH;
28
+ const handleNavbarCollapse = React.useCallback(() => {
29
+ var _a;
30
+ setNavbarCollapsed(true);
31
+ (_a = navbar.onCollapse) == null ? void 0 : _a.call(navbar);
32
+ }, [navbar.onCollapse]);
33
+ const handleNavbarExpand = React.useCallback(() => {
34
+ var _a;
35
+ setNavbarCollapsed(false);
36
+ (_a = navbar.onExpand) == null ? void 0 : _a.call(navbar);
37
+ }, [navbar.onExpand]);
38
+ React.useEffect(() => {
39
+ var _a;
40
+ if (bannerRef.current) {
41
+ setWithBanner(((_a = bannerRef.current.children) == null ? void 0 : _a.length) > 0);
42
+ }
43
+ }, [banner]);
44
+ return /* @__PURE__ */ jsxRuntime.jsxs(AppShellRoot.AppShellRoot, { children: [
45
+ /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { ref: bannerRef, className: "tiui-app-shell-banner", children: banner }),
46
+ /* @__PURE__ */ jsxRuntime.jsxs(
47
+ AppShellMain.AppShellMain,
48
+ {
49
+ mod: { "height-flex": withBanner },
50
+ style: {
51
+ "--app-shell-transition-duration": "200ms",
52
+ "--app-shell-transition-timing-function": "ease",
53
+ "--app-shell-navbar-width": `${navbarWidth}px`,
54
+ "--app-shell-navbar-offset": navbarCollapsed ? "0px" : `${navbarWidth}px`,
55
+ "--app-shell-navbar-collapsed": navbarCollapsed ? "1" : "0"
56
+ },
57
+ children: [
58
+ navbarCollapsed && /* @__PURE__ */ jsxRuntime.jsx(ExpandNavbarButton.ExpandNavbarButton, { logo: navbar.logo, onClick: handleNavbarExpand }),
59
+ /* @__PURE__ */ jsxRuntime.jsxs(Navbar.Navbar, { withBorder: true, hidden: navbarCollapsed, children: [
60
+ /* @__PURE__ */ jsxRuntime.jsx(NavbarSection.NavbarSection, { children: /* @__PURE__ */ jsxRuntime.jsx(
61
+ NavbarHeader.NavbarHeader,
62
+ {
63
+ logo: navbar.logo,
64
+ onLogoClick: navbar.onLogoClick,
65
+ onToggleCollapse: handleNavbarCollapse,
66
+ px: "md",
67
+ py: 8
68
+ }
69
+ ) }),
70
+ /* @__PURE__ */ jsxRuntime.jsx(NavbarSection.NavbarSection, { children: /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { className: "tiui-app-shell-navbar-above-menu", px: "md", children: navbar.aboveMenu }) }),
71
+ /* @__PURE__ */ jsxRuntime.jsx(NavbarSection.NavbarSection, { className: "tiui-app-shell-navbar-menu-section", grow: true, scrollable: true, py: 8, children: /* @__PURE__ */ jsxRuntime.jsx(Stack.Stack, { ref: navMenuRef, className: "tiui-app-shell-navbar-menu", gap: 8, px: "md" }) }),
72
+ /* @__PURE__ */ jsxRuntime.jsxs(NavbarSection.NavbarSection, { px: "md", pb: "8", children: [
73
+ /* @__PURE__ */ jsxRuntime.jsx(Divider.Divider, { mx: "-md", mb: 8 }),
74
+ /* @__PURE__ */ jsxRuntime.jsx(Stack.Stack, { className: "tiui-app-shell-navbar-footer", gap: 8, children: navbar.footer })
75
+ ] })
76
+ ] }),
77
+ /* @__PURE__ */ jsxRuntime.jsx(AppShellBody.AppShellBody, { children: /* @__PURE__ */ jsxRuntime.jsx(navMenuRefContext.NavMenuRefContext.Provider, { value: navMenuRef, children }) })
78
+ ]
79
+ }
80
+ )
81
+ ] });
82
+ };
83
+ exports.AppShell = AppShell;
@@ -0,0 +1,45 @@
1
+ interface AppShellProps {
2
+ /**
3
+ * The banner to display at the top of the app
4
+ */
5
+ banner?: React.ReactNode;
6
+ /**
7
+ * Sections of the navbar for user to customize
8
+ */
9
+ navbar: {
10
+ /**
11
+ * Custom width of the navbar
12
+ */
13
+ width?: number;
14
+ /**
15
+ * The logo to display in the navbar
16
+ */
17
+ logo: React.ReactNode;
18
+ /**
19
+ * Custom content rendered in the navbar section between the header and the main menu.
20
+ */
21
+ aboveMenu: React.ReactNode;
22
+ /**
23
+ * The footer section of the navbar
24
+ */
25
+ footer: React.ReactNode;
26
+ /**
27
+ * The callback function to handle logo click
28
+ */
29
+ onLogoClick?: () => void;
30
+ /**
31
+ * Trigger when the navbar is collapsed
32
+ */
33
+ onCollapse?: () => void;
34
+ /**
35
+ * Trigger when the navbar is expanded
36
+ */
37
+ onExpand?: () => void;
38
+ };
39
+ }
40
+ /**
41
+ * The app shell component is purely for display
42
+ * and not related to any business feature
43
+ */
44
+ export declare const AppShell: ({ banner, navbar, children }: React.PropsWithChildren<AppShellProps>) => import("react/jsx-runtime.js").JSX.Element;
45
+ export {};
@@ -0,0 +1,45 @@
1
+ interface AppShellProps {
2
+ /**
3
+ * The banner to display at the top of the app
4
+ */
5
+ banner?: React.ReactNode;
6
+ /**
7
+ * Sections of the navbar for user to customize
8
+ */
9
+ navbar: {
10
+ /**
11
+ * Custom width of the navbar
12
+ */
13
+ width?: number;
14
+ /**
15
+ * The logo to display in the navbar
16
+ */
17
+ logo: React.ReactNode;
18
+ /**
19
+ * Custom content rendered in the navbar section between the header and the main menu.
20
+ */
21
+ aboveMenu: React.ReactNode;
22
+ /**
23
+ * The footer section of the navbar
24
+ */
25
+ footer: React.ReactNode;
26
+ /**
27
+ * The callback function to handle logo click
28
+ */
29
+ onLogoClick?: () => void;
30
+ /**
31
+ * Trigger when the navbar is collapsed
32
+ */
33
+ onCollapse?: () => void;
34
+ /**
35
+ * Trigger when the navbar is expanded
36
+ */
37
+ onExpand?: () => void;
38
+ };
39
+ }
40
+ /**
41
+ * The app shell component is purely for display
42
+ * and not related to any business feature
43
+ */
44
+ export declare const AppShell: ({ banner, navbar, children }: React.PropsWithChildren<AppShellProps>) => import("react/jsx-runtime.js").JSX.Element;
45
+ export {};
@@ -0,0 +1,83 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useRef, useState, useCallback, useEffect } from "react";
3
+ /* empty css */
4
+ /* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ /* empty css */
8
+ import { AppShellBody } from "./container/AppShellBody.mjs";
9
+ import { AppShellMain } from "./container/AppShellMain.mjs";
10
+ import { AppShellRoot } from "./container/AppShellRoot.mjs";
11
+ import { NavMenuRefContext } from "./navbar/context/nav-menu-ref-context.mjs";
12
+ import { ExpandNavbarButton } from "./navbar/ExpandNavbarButton.mjs";
13
+ import { Navbar } from "./navbar/Navbar.mjs";
14
+ import { NavbarHeader } from "./navbar/NavbarHeader.mjs";
15
+ import { NavbarSection } from "./navbar/NavbarSection.mjs";
16
+ import { Box } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.mjs";
17
+ import { Stack } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Stack/Stack.mjs";
18
+ import { Divider } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Divider/Divider.mjs";
19
+ const DEFAULT_NAVBAR_WIDTH = 240;
20
+ const AppShell = ({ banner, navbar, children }) => {
21
+ const navMenuRef = useRef(null);
22
+ const bannerRef = useRef(null);
23
+ const [withBanner, setWithBanner] = useState(false);
24
+ const [navbarCollapsed, setNavbarCollapsed] = useState(false);
25
+ const navbarWidth = navbar.width ?? DEFAULT_NAVBAR_WIDTH;
26
+ const handleNavbarCollapse = useCallback(() => {
27
+ var _a;
28
+ setNavbarCollapsed(true);
29
+ (_a = navbar.onCollapse) == null ? void 0 : _a.call(navbar);
30
+ }, [navbar.onCollapse]);
31
+ const handleNavbarExpand = useCallback(() => {
32
+ var _a;
33
+ setNavbarCollapsed(false);
34
+ (_a = navbar.onExpand) == null ? void 0 : _a.call(navbar);
35
+ }, [navbar.onExpand]);
36
+ useEffect(() => {
37
+ var _a;
38
+ if (bannerRef.current) {
39
+ setWithBanner(((_a = bannerRef.current.children) == null ? void 0 : _a.length) > 0);
40
+ }
41
+ }, [banner]);
42
+ return /* @__PURE__ */ jsxs(AppShellRoot, { children: [
43
+ /* @__PURE__ */ jsx(Box, { ref: bannerRef, className: "tiui-app-shell-banner", children: banner }),
44
+ /* @__PURE__ */ jsxs(
45
+ AppShellMain,
46
+ {
47
+ mod: { "height-flex": withBanner },
48
+ style: {
49
+ "--app-shell-transition-duration": "200ms",
50
+ "--app-shell-transition-timing-function": "ease",
51
+ "--app-shell-navbar-width": `${navbarWidth}px`,
52
+ "--app-shell-navbar-offset": navbarCollapsed ? "0px" : `${navbarWidth}px`,
53
+ "--app-shell-navbar-collapsed": navbarCollapsed ? "1" : "0"
54
+ },
55
+ children: [
56
+ navbarCollapsed && /* @__PURE__ */ jsx(ExpandNavbarButton, { logo: navbar.logo, onClick: handleNavbarExpand }),
57
+ /* @__PURE__ */ jsxs(Navbar, { withBorder: true, hidden: navbarCollapsed, children: [
58
+ /* @__PURE__ */ jsx(NavbarSection, { children: /* @__PURE__ */ jsx(
59
+ NavbarHeader,
60
+ {
61
+ logo: navbar.logo,
62
+ onLogoClick: navbar.onLogoClick,
63
+ onToggleCollapse: handleNavbarCollapse,
64
+ px: "md",
65
+ py: 8
66
+ }
67
+ ) }),
68
+ /* @__PURE__ */ jsx(NavbarSection, { children: /* @__PURE__ */ jsx(Box, { className: "tiui-app-shell-navbar-above-menu", px: "md", children: navbar.aboveMenu }) }),
69
+ /* @__PURE__ */ jsx(NavbarSection, { className: "tiui-app-shell-navbar-menu-section", grow: true, scrollable: true, py: 8, children: /* @__PURE__ */ jsx(Stack, { ref: navMenuRef, className: "tiui-app-shell-navbar-menu", gap: 8, px: "md" }) }),
70
+ /* @__PURE__ */ jsxs(NavbarSection, { px: "md", pb: "8", children: [
71
+ /* @__PURE__ */ jsx(Divider, { mx: "-md", mb: 8 }),
72
+ /* @__PURE__ */ jsx(Stack, { className: "tiui-app-shell-navbar-footer", gap: 8, children: navbar.footer })
73
+ ] })
74
+ ] }),
75
+ /* @__PURE__ */ jsx(AppShellBody, { children: /* @__PURE__ */ jsx(NavMenuRefContext.Provider, { value: navMenuRef, children }) })
76
+ ]
77
+ }
78
+ )
79
+ ] });
80
+ };
81
+ export {
82
+ AppShell
83
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ ;/* empty css */
5
+ ;/* empty css */
6
+ ;/* empty css */
7
+ ;/* empty css */
8
+ ;/* empty css */
9
+ const clsx = require("clsx");
10
+ const styles = require("../../../utils/styles.cjs");
11
+ const Box = require("../../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.cjs");
12
+ const AppShellBody = ({ className, sx, ...rest }) => {
13
+ return /* @__PURE__ */ jsxRuntime.jsx(
14
+ Box.Box,
15
+ {
16
+ component: "main",
17
+ ...rest,
18
+ className: clsx.clsx(className, "tiui-app-shell-body"),
19
+ sx: styles.mergeSxList([
20
+ (theme) => ({
21
+ flex: 1,
22
+ overflowX: "auto",
23
+ backgroundColor: theme.colors.carbon[1]
24
+ }),
25
+ sx
26
+ ])
27
+ }
28
+ );
29
+ };
30
+ exports.AppShellBody = AppShellBody;
@@ -0,0 +1,5 @@
1
+ import { BoxProps, ElementProps } from '../../../primitive/index.cjs';
2
+ interface AppShellBodyProps extends BoxProps, ElementProps<'main'> {
3
+ }
4
+ export declare const AppShellBody: ({ className, sx, ...rest }: AppShellBodyProps) => import("react/jsx-runtime.js").JSX.Element;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ import { BoxProps, ElementProps } from '../../../primitive/index.mjs';
2
+ interface AppShellBodyProps extends BoxProps, ElementProps<'main'> {
3
+ }
4
+ export declare const AppShellBody: ({ className, sx, ...rest }: AppShellBodyProps) => import("react/jsx-runtime.js").JSX.Element;
5
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ /* empty css */
3
+ /* empty css */
4
+ /* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ import { clsx } from "clsx";
8
+ import { mergeSxList } from "../../../utils/styles.mjs";
9
+ import { Box } from "../../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.mjs";
10
+ const AppShellBody = ({ className, sx, ...rest }) => {
11
+ return /* @__PURE__ */ jsx(
12
+ Box,
13
+ {
14
+ component: "main",
15
+ ...rest,
16
+ className: clsx(className, "tiui-app-shell-body"),
17
+ sx: mergeSxList([
18
+ (theme) => ({
19
+ flex: 1,
20
+ overflowX: "auto",
21
+ backgroundColor: theme.colors.carbon[1]
22
+ }),
23
+ sx
24
+ ])
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ AppShellBody
30
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ ;/* empty css */
5
+ ;/* empty css */
6
+ ;/* empty css */
7
+ ;/* empty css */
8
+ ;/* empty css */
9
+ const clsx = require("clsx");
10
+ const styles = require("../../../utils/styles.cjs");
11
+ const Group = require("../../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Group/Group.cjs");
12
+ const AppShellMain = ({ className, sx, ...rest }) => {
13
+ return /* @__PURE__ */ jsxRuntime.jsx(
14
+ Group.Group,
15
+ {
16
+ gap: 0,
17
+ wrap: "nowrap",
18
+ align: "stretch",
19
+ ...rest,
20
+ className: clsx.clsx(className, "tiui-app-shell-main"),
21
+ sx: styles.mergeSxList([
22
+ {
23
+ position: "relative",
24
+ height: "100%",
25
+ minHeight: 0,
26
+ overflow: "hidden",
27
+ "&:where([data-height-flex])": {
28
+ flex: 1
29
+ }
30
+ },
31
+ sx
32
+ ])
33
+ }
34
+ );
35
+ };
36
+ exports.AppShellMain = AppShellMain;
@@ -0,0 +1,5 @@
1
+ import { BoxProps, ElementProps } from '../../../primitive/index.cjs';
2
+ interface AppShellMainProps extends BoxProps, ElementProps<'div'> {
3
+ }
4
+ export declare const AppShellMain: ({ className, sx, ...rest }: AppShellMainProps) => import("react/jsx-runtime.js").JSX.Element;
5
+ export {};