@fragments-sdk/ui 0.15.1 → 0.16.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.
- package/dist/assets/ui.css +42 -34
- package/dist/components/AppShell/AppShell.module.scss.cjs +15 -21
- package/dist/components/AppShell/AppShell.module.scss.js +15 -21
- package/dist/components/AppShell/index.cjs +52 -13
- package/dist/components/AppShell/index.d.ts +55 -27
- package/dist/components/AppShell/index.d.ts.map +1 -1
- package/dist/components/AppShell/index.js +52 -13
- package/dist/components/CodeBlock/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/Form/index.cjs +1 -1
- package/dist/components/Form/index.d.ts +1 -1
- package/dist/components/Form/index.d.ts.map +1 -1
- package/dist/components/Form/index.js +1 -1
- package/dist/components/Menu/index.d.ts +1 -2
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/NavigationMenu/useNavigationMenu.cjs +6 -3
- package/dist/components/NavigationMenu/useNavigationMenu.d.ts.map +1 -1
- package/dist/components/NavigationMenu/useNavigationMenu.js +6 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/utils/seed-derivation.d.ts.map +1 -1
- package/dist/utils/theme-presets.d.ts.map +1 -1
- package/fragments.json +1 -1
- package/package.json +2 -2
- package/src/components/AppShell/AppShell.module.scss +29 -20
- package/src/components/AppShell/index.tsx +123 -36
- package/src/components/CodeBlock/index.tsx +0 -1
- package/src/components/DatePicker/index.tsx +1 -1
- package/src/components/Form/index.tsx +1 -1
- package/src/components/Menu/index.tsx +1 -1
- package/src/components/NavigationMenu/useNavigationMenu.ts +6 -3
- package/src/index.ts +1 -0
- package/src/utils/seed-derivation.ts +0 -9
- package/src/utils/theme-presets.ts +0 -1
package/dist/assets/ui.css
CHANGED
|
@@ -6511,7 +6511,7 @@
|
|
|
6511
6511
|
overflow: visible;
|
|
6512
6512
|
outline: none;
|
|
6513
6513
|
box-shadow: 0 0 0 var(--fui-focus-ring-offset, 2px) var(--fui-bg-primary, #ffffff), 0 0 0 calc(var(--fui-focus-ring-offset, 2px) + var(--fui-focus-ring-width, 2px)) var(--fui-focus-ring-color, #18181b);
|
|
6514
|
-
}.
|
|
6514
|
+
}._root_1cmf1_1 {
|
|
6515
6515
|
display: grid;
|
|
6516
6516
|
min-height: 100vh;
|
|
6517
6517
|
min-height: 100dvh;
|
|
@@ -6522,7 +6522,7 @@
|
|
|
6522
6522
|
transition: grid-template-columns var(--fui-transition-normal, 200ms) ease;
|
|
6523
6523
|
}
|
|
6524
6524
|
@media (max-width: 767px) {
|
|
6525
|
-
.
|
|
6525
|
+
._root_1cmf1_1 {
|
|
6526
6526
|
grid-template-areas: "header" "main" "aside";
|
|
6527
6527
|
grid-template-columns: 1fr;
|
|
6528
6528
|
grid-template-rows: var(--appshell-header-height, 56px) 1fr auto;
|
|
@@ -6530,21 +6530,17 @@
|
|
|
6530
6530
|
}
|
|
6531
6531
|
}
|
|
6532
6532
|
|
|
6533
|
-
.
|
|
6533
|
+
._sidebarLayout_1cmf1_20 {
|
|
6534
6534
|
grid-template-areas: "sidebar header header" "sidebar main aside";
|
|
6535
6535
|
}
|
|
6536
6536
|
@media (max-width: 767px) {
|
|
6537
|
-
.
|
|
6537
|
+
._sidebarLayout_1cmf1_20 {
|
|
6538
6538
|
grid-template-areas: "header" "main" "aside";
|
|
6539
6539
|
grid-template-columns: 1fr;
|
|
6540
6540
|
}
|
|
6541
6541
|
}
|
|
6542
6542
|
|
|
6543
|
-
.
|
|
6544
|
-
background-color: var(--fui-bg-primary, #ffffff);
|
|
6545
|
-
}
|
|
6546
|
-
|
|
6547
|
-
._header_1vko5_34 {
|
|
6543
|
+
._header_1cmf1_30 {
|
|
6548
6544
|
grid-area: header;
|
|
6549
6545
|
position: sticky;
|
|
6550
6546
|
top: 0;
|
|
@@ -6553,11 +6549,7 @@
|
|
|
6553
6549
|
background-color: var(--fui-bg-primary, #ffffff);
|
|
6554
6550
|
}
|
|
6555
6551
|
|
|
6556
|
-
.
|
|
6557
|
-
background-color: var(--fui-bg-primary, #ffffff);
|
|
6558
|
-
}
|
|
6559
|
-
|
|
6560
|
-
._sidebar_1vko5_20 {
|
|
6552
|
+
._sidebar_1cmf1_20 {
|
|
6561
6553
|
grid-area: sidebar;
|
|
6562
6554
|
position: sticky;
|
|
6563
6555
|
top: var(--appshell-header-height, 56px);
|
|
@@ -6567,7 +6559,7 @@
|
|
|
6567
6559
|
overflow: hidden;
|
|
6568
6560
|
}
|
|
6569
6561
|
@media (max-width: 767px) {
|
|
6570
|
-
.
|
|
6562
|
+
._sidebar_1cmf1_20 {
|
|
6571
6563
|
position: fixed;
|
|
6572
6564
|
top: 0;
|
|
6573
6565
|
left: 0;
|
|
@@ -6577,76 +6569,74 @@
|
|
|
6577
6569
|
height: 100dvh;
|
|
6578
6570
|
z-index: 51;
|
|
6579
6571
|
}
|
|
6580
|
-
.
|
|
6572
|
+
._sidebar_1cmf1_20 > .root {
|
|
6581
6573
|
width: var(--appshell-sidebar-expanded-width, 240px);
|
|
6582
6574
|
}
|
|
6583
6575
|
}
|
|
6584
|
-
.
|
|
6576
|
+
._sidebar_1cmf1_20 .root {
|
|
6585
6577
|
height: 100%;
|
|
6586
6578
|
}
|
|
6587
6579
|
@media (max-width: 767px) {
|
|
6588
|
-
.
|
|
6580
|
+
._sidebar_1cmf1_20 .root {
|
|
6589
6581
|
height: 100vh;
|
|
6590
6582
|
height: 100dvh;
|
|
6591
6583
|
}
|
|
6592
6584
|
}
|
|
6593
6585
|
|
|
6594
|
-
.
|
|
6586
|
+
._sidebarFullHeight_1cmf1_73 {
|
|
6595
6587
|
top: 0;
|
|
6596
6588
|
height: 100vh;
|
|
6597
6589
|
height: 100dvh;
|
|
6598
6590
|
z-index: var(--fui-header-z-index, 40);
|
|
6599
6591
|
}
|
|
6600
|
-
.
|
|
6592
|
+
._sidebarFullHeight_1cmf1_73 .root {
|
|
6601
6593
|
height: 100%;
|
|
6602
6594
|
}
|
|
6603
6595
|
|
|
6604
|
-
.
|
|
6605
|
-
background-color: var(--fui-bg-primary, #ffffff);
|
|
6606
|
-
}
|
|
6607
|
-
|
|
6608
|
-
._main_1vko5_95 {
|
|
6596
|
+
._main_1cmf1_83 {
|
|
6609
6597
|
grid-area: main;
|
|
6610
6598
|
min-height: 0;
|
|
6611
6599
|
min-width: 0;
|
|
6612
6600
|
background-color: var(--fui-bg-primary, #ffffff);
|
|
6613
6601
|
}
|
|
6614
6602
|
|
|
6615
|
-
.
|
|
6603
|
+
._mainFloating_1cmf1_90 {
|
|
6604
|
+
margin: var(--fui-space-2, 1rem) var(--fui-space-2, 1rem) var(--fui-space-2, 1rem) 0;
|
|
6616
6605
|
border-radius: var(--fui-radius-xl, 0.857rem);
|
|
6617
6606
|
background-color: var(--fui-bg-secondary, #f4f4f5);
|
|
6618
6607
|
overflow: hidden;
|
|
6619
6608
|
}
|
|
6620
6609
|
@media (max-width: 767px) {
|
|
6621
|
-
.
|
|
6610
|
+
._mainFloating_1cmf1_90 {
|
|
6611
|
+
margin: var(--fui-space-2, 1rem) 0;
|
|
6622
6612
|
border-radius: var(--fui-radius-lg, 0.571rem);
|
|
6623
6613
|
width: 100%;
|
|
6624
6614
|
}
|
|
6625
6615
|
}
|
|
6626
6616
|
|
|
6627
|
-
.
|
|
6617
|
+
._paddingSm_1cmf1_104 {
|
|
6628
6618
|
padding: var(--fui-space-3);
|
|
6629
6619
|
}
|
|
6630
6620
|
|
|
6631
|
-
.
|
|
6621
|
+
._paddingMd_1cmf1_108 {
|
|
6632
6622
|
padding: var(--fui-space-4);
|
|
6633
6623
|
}
|
|
6634
6624
|
@media (min-width: 768px) {
|
|
6635
|
-
.
|
|
6625
|
+
._paddingMd_1cmf1_108 {
|
|
6636
6626
|
padding: var(--fui-space-6);
|
|
6637
6627
|
}
|
|
6638
6628
|
}
|
|
6639
6629
|
|
|
6640
|
-
.
|
|
6630
|
+
._paddingLg_1cmf1_117 {
|
|
6641
6631
|
padding: var(--fui-space-6);
|
|
6642
6632
|
}
|
|
6643
6633
|
@media (min-width: 768px) {
|
|
6644
|
-
.
|
|
6634
|
+
._paddingLg_1cmf1_117 {
|
|
6645
6635
|
padding: var(--fui-space-8);
|
|
6646
6636
|
}
|
|
6647
6637
|
}
|
|
6648
6638
|
|
|
6649
|
-
.
|
|
6639
|
+
._aside_1cmf1_126 {
|
|
6650
6640
|
grid-area: aside;
|
|
6651
6641
|
position: sticky;
|
|
6652
6642
|
top: var(--appshell-header-height, 56px);
|
|
@@ -6659,12 +6649,30 @@
|
|
|
6659
6649
|
overflow: hidden;
|
|
6660
6650
|
}
|
|
6661
6651
|
@media (max-width: 767px) {
|
|
6662
|
-
.
|
|
6652
|
+
._aside_1cmf1_126 {
|
|
6663
6653
|
position: static;
|
|
6664
6654
|
width: 100%;
|
|
6665
6655
|
height: auto;
|
|
6666
6656
|
border-top: 1px solid var(--fui-border, rgba(0, 0, 0, 0.08));
|
|
6667
6657
|
}
|
|
6658
|
+
}
|
|
6659
|
+
|
|
6660
|
+
._asideFloating_1cmf1_147 {
|
|
6661
|
+
width: auto;
|
|
6662
|
+
height: calc(100vh - var(--appshell-header-height, 56px) - var(--fui-space-2, 1rem) * 2);
|
|
6663
|
+
height: calc(100dvh - var(--appshell-header-height, 56px) - var(--fui-space-2, 1rem) * 2);
|
|
6664
|
+
margin: var(--fui-space-2, 1rem) var(--fui-space-2, 1rem) var(--fui-space-2, 1rem) 0;
|
|
6665
|
+
border-radius: var(--fui-radius-xl, 0.857rem);
|
|
6666
|
+
background-color: var(--fui-bg-secondary, #f4f4f5);
|
|
6667
|
+
overflow: hidden;
|
|
6668
|
+
}
|
|
6669
|
+
@media (max-width: 767px) {
|
|
6670
|
+
._asideFloating_1cmf1_147 {
|
|
6671
|
+
margin: var(--fui-space-2, 1rem) 0;
|
|
6672
|
+
border-radius: var(--fui-radius-lg, 0.571rem);
|
|
6673
|
+
width: 100%;
|
|
6674
|
+
height: auto;
|
|
6675
|
+
}
|
|
6668
6676
|
}._stack_ixv42_1 {
|
|
6669
6677
|
display: flex;
|
|
6670
6678
|
}
|
|
@@ -1,39 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const root = "
|
|
4
|
-
const sidebarLayout = "
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const paddingLg = "_paddingLg_1vko5_127";
|
|
16
|
-
const aside = "_aside_1vko5_136";
|
|
3
|
+
const root = "_root_1cmf1_1";
|
|
4
|
+
const sidebarLayout = "_sidebarLayout_1cmf1_20";
|
|
5
|
+
const header = "_header_1cmf1_30";
|
|
6
|
+
const sidebar = "_sidebar_1cmf1_20";
|
|
7
|
+
const sidebarFullHeight = "_sidebarFullHeight_1cmf1_73";
|
|
8
|
+
const main = "_main_1cmf1_83";
|
|
9
|
+
const mainFloating = "_mainFloating_1cmf1_90";
|
|
10
|
+
const paddingSm = "_paddingSm_1cmf1_104";
|
|
11
|
+
const paddingMd = "_paddingMd_1cmf1_108";
|
|
12
|
+
const paddingLg = "_paddingLg_1cmf1_117";
|
|
13
|
+
const aside = "_aside_1cmf1_126";
|
|
14
|
+
const asideFloating = "_asideFloating_1cmf1_147";
|
|
17
15
|
const styles = {
|
|
18
16
|
root,
|
|
19
17
|
sidebarLayout,
|
|
20
|
-
sidebarFloatingLayout,
|
|
21
18
|
header,
|
|
22
|
-
headerFloating,
|
|
23
19
|
sidebar,
|
|
24
20
|
sidebarFullHeight,
|
|
25
|
-
sidebarFloating,
|
|
26
21
|
main,
|
|
27
22
|
mainFloating,
|
|
28
23
|
paddingSm,
|
|
29
24
|
paddingMd,
|
|
30
25
|
paddingLg,
|
|
31
|
-
aside
|
|
26
|
+
aside,
|
|
27
|
+
asideFloating
|
|
32
28
|
};
|
|
33
29
|
exports.aside = aside;
|
|
30
|
+
exports.asideFloating = asideFloating;
|
|
34
31
|
exports.default = styles;
|
|
35
32
|
exports.header = header;
|
|
36
|
-
exports.headerFloating = headerFloating;
|
|
37
33
|
exports.main = main;
|
|
38
34
|
exports.mainFloating = mainFloating;
|
|
39
35
|
exports.paddingLg = paddingLg;
|
|
@@ -41,7 +37,5 @@ exports.paddingMd = paddingMd;
|
|
|
41
37
|
exports.paddingSm = paddingSm;
|
|
42
38
|
exports.root = root;
|
|
43
39
|
exports.sidebar = sidebar;
|
|
44
|
-
exports.sidebarFloating = sidebarFloating;
|
|
45
|
-
exports.sidebarFloatingLayout = sidebarFloatingLayout;
|
|
46
40
|
exports.sidebarFullHeight = sidebarFullHeight;
|
|
47
41
|
exports.sidebarLayout = sidebarLayout;
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
const root = "
|
|
2
|
-
const sidebarLayout = "
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const paddingLg = "_paddingLg_1vko5_127";
|
|
14
|
-
const aside = "_aside_1vko5_136";
|
|
1
|
+
const root = "_root_1cmf1_1";
|
|
2
|
+
const sidebarLayout = "_sidebarLayout_1cmf1_20";
|
|
3
|
+
const header = "_header_1cmf1_30";
|
|
4
|
+
const sidebar = "_sidebar_1cmf1_20";
|
|
5
|
+
const sidebarFullHeight = "_sidebarFullHeight_1cmf1_73";
|
|
6
|
+
const main = "_main_1cmf1_83";
|
|
7
|
+
const mainFloating = "_mainFloating_1cmf1_90";
|
|
8
|
+
const paddingSm = "_paddingSm_1cmf1_104";
|
|
9
|
+
const paddingMd = "_paddingMd_1cmf1_108";
|
|
10
|
+
const paddingLg = "_paddingLg_1cmf1_117";
|
|
11
|
+
const aside = "_aside_1cmf1_126";
|
|
12
|
+
const asideFloating = "_asideFloating_1cmf1_147";
|
|
15
13
|
const styles = {
|
|
16
14
|
root,
|
|
17
15
|
sidebarLayout,
|
|
18
|
-
sidebarFloatingLayout,
|
|
19
16
|
header,
|
|
20
|
-
headerFloating,
|
|
21
17
|
sidebar,
|
|
22
18
|
sidebarFullHeight,
|
|
23
|
-
sidebarFloating,
|
|
24
19
|
main,
|
|
25
20
|
mainFloating,
|
|
26
21
|
paddingSm,
|
|
27
22
|
paddingMd,
|
|
28
23
|
paddingLg,
|
|
29
|
-
aside
|
|
24
|
+
aside,
|
|
25
|
+
asideFloating
|
|
30
26
|
};
|
|
31
27
|
export {
|
|
32
28
|
aside,
|
|
29
|
+
asideFloating,
|
|
33
30
|
styles as default,
|
|
34
31
|
header,
|
|
35
|
-
headerFloating,
|
|
36
32
|
main,
|
|
37
33
|
mainFloating,
|
|
38
34
|
paddingLg,
|
|
@@ -40,8 +36,6 @@ export {
|
|
|
40
36
|
paddingSm,
|
|
41
37
|
root,
|
|
42
38
|
sidebar,
|
|
43
|
-
sidebarFloating,
|
|
44
|
-
sidebarFloatingLayout,
|
|
45
39
|
sidebarFullHeight,
|
|
46
40
|
sidebarLayout
|
|
47
41
|
};
|
|
@@ -21,8 +21,19 @@ function _interopNamespaceDefault(e) {
|
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
24
|
+
function resolveStructure(layout) {
|
|
25
|
+
if (layout === "sidebar" || layout === "sidebar-floating" || layout === "floating") return "sidebar";
|
|
26
|
+
return "default";
|
|
27
|
+
}
|
|
28
|
+
function resolveSlotVariant(explicit, layout, slot) {
|
|
29
|
+
if (explicit !== void 0) return explicit;
|
|
30
|
+
if ((layout === "sidebar-floating" || layout === "floating") && (slot === "main" || slot === "sidebar")) return "floating";
|
|
31
|
+
if (layout === "floating" && slot === "aside") return "floating";
|
|
32
|
+
return "default";
|
|
33
|
+
}
|
|
24
34
|
const AppShellContext = React__namespace.createContext({
|
|
25
35
|
layout: "default",
|
|
36
|
+
structure: "default",
|
|
26
37
|
headerHeight: "56px",
|
|
27
38
|
sidebarWidth: "240px",
|
|
28
39
|
sidebarCollapsedWidth: "64px",
|
|
@@ -79,6 +90,7 @@ function AppShellInner({
|
|
|
79
90
|
children,
|
|
80
91
|
className,
|
|
81
92
|
layout,
|
|
93
|
+
structure,
|
|
82
94
|
style: styleProp,
|
|
83
95
|
...htmlProps
|
|
84
96
|
}) {
|
|
@@ -86,8 +98,7 @@ function AppShellInner({
|
|
|
86
98
|
const { collapsed, isMobile, collapsible } = index.useSidebar();
|
|
87
99
|
const classes = [
|
|
88
100
|
AppShell_module.default.root,
|
|
89
|
-
|
|
90
|
-
layout === "sidebar-floating" && AppShell_module.default.sidebarFloatingLayout,
|
|
101
|
+
structure === "sidebar" && AppShell_module.default.sidebarLayout,
|
|
91
102
|
className
|
|
92
103
|
].filter(Boolean).join(" ");
|
|
93
104
|
const actualSidebarWidth = isMobile ? "0px" : collapsible === "icon" && collapsed ? appShell.sidebarCollapsedWidth : collapsible === "offcanvas" && collapsed ? "0px" : appShell.sidebarWidth;
|
|
@@ -104,12 +115,16 @@ function AppShellInner({
|
|
|
104
115
|
function AppShellRoot({
|
|
105
116
|
children,
|
|
106
117
|
layout = "default",
|
|
118
|
+
bg,
|
|
107
119
|
className,
|
|
120
|
+
style: styleProp,
|
|
108
121
|
...htmlProps
|
|
109
122
|
}) {
|
|
123
|
+
const structure = resolveStructure(layout);
|
|
110
124
|
const config = React__namespace.useMemo(() => extractConfigFromChildren(children), [children]);
|
|
111
125
|
const contextValue = {
|
|
112
126
|
layout,
|
|
127
|
+
structure,
|
|
113
128
|
headerHeight: config.headerHeight,
|
|
114
129
|
sidebarWidth: config.sidebarWidth,
|
|
115
130
|
sidebarCollapsedWidth: config.sidebarCollapsedWidth,
|
|
@@ -123,26 +138,25 @@ function AppShellRoot({
|
|
|
123
138
|
collapsedWidth: config.sidebarCollapsedWidth,
|
|
124
139
|
collapsible: config.sidebarCollapsible,
|
|
125
140
|
defaultCollapsed: config.sidebarDefaultCollapsed,
|
|
126
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(AppShellInner, { className, layout, ...htmlProps, children })
|
|
141
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(AppShellInner, { className, layout, structure, style: { ...bg ? { backgroundColor: bg } : {}, ...styleProp }, ...htmlProps, children })
|
|
127
142
|
}
|
|
128
143
|
) });
|
|
129
144
|
}
|
|
130
145
|
function AppShellHeader({
|
|
131
146
|
children,
|
|
132
147
|
height = "56px",
|
|
148
|
+
bg,
|
|
133
149
|
className,
|
|
134
150
|
style: styleProp,
|
|
135
151
|
...htmlProps
|
|
136
152
|
}) {
|
|
137
|
-
const { layout } = useAppShell();
|
|
138
153
|
const classes = [
|
|
139
154
|
AppShell_module.default.header,
|
|
140
|
-
(layout === "sidebar" || layout === "sidebar-floating") && AppShell_module.default.headerSidebar,
|
|
141
|
-
layout === "sidebar-floating" && AppShell_module.default.headerFloating,
|
|
142
155
|
className
|
|
143
156
|
].filter(Boolean).join(" ");
|
|
144
157
|
const style = {
|
|
145
158
|
"--header-height": height,
|
|
159
|
+
...bg ? { backgroundColor: bg } : {},
|
|
146
160
|
...styleProp
|
|
147
161
|
};
|
|
148
162
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...htmlProps, className: classes, style, children });
|
|
@@ -154,19 +168,26 @@ function AppShellSidebar({
|
|
|
154
168
|
collapsible = "icon",
|
|
155
169
|
position = "left",
|
|
156
170
|
defaultCollapsed = false,
|
|
171
|
+
variant,
|
|
172
|
+
bg,
|
|
157
173
|
"aria-label": ariaLabel,
|
|
158
174
|
className,
|
|
175
|
+
style: styleProp,
|
|
159
176
|
...htmlProps
|
|
160
177
|
}) {
|
|
161
178
|
const isMobile = useIsMobile();
|
|
162
|
-
const { layout } = useAppShell();
|
|
179
|
+
const { layout, structure } = useAppShell();
|
|
180
|
+
const resolvedVariant = resolveSlotVariant(variant, layout, "sidebar");
|
|
163
181
|
const classes = [
|
|
164
182
|
AppShell_module.default.sidebar,
|
|
165
|
-
|
|
166
|
-
|
|
183
|
+
structure === "sidebar" && AppShell_module.default.sidebarFullHeight,
|
|
184
|
+
resolvedVariant === "floating" && AppShell_module.default.sidebarFloating,
|
|
167
185
|
className
|
|
168
186
|
].filter(Boolean).join(" ");
|
|
169
|
-
|
|
187
|
+
const style = {
|
|
188
|
+
...styleProp
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...htmlProps, className: classes, style, children: [
|
|
170
191
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
171
192
|
index.Sidebar,
|
|
172
193
|
{
|
|
@@ -176,6 +197,7 @@ function AppShellSidebar({
|
|
|
176
197
|
collapsible,
|
|
177
198
|
defaultCollapsed,
|
|
178
199
|
"aria-label": ariaLabel,
|
|
200
|
+
style: bg ? { backgroundColor: bg } : void 0,
|
|
179
201
|
children
|
|
180
202
|
}
|
|
181
203
|
),
|
|
@@ -185,33 +207,50 @@ function AppShellSidebar({
|
|
|
185
207
|
function AppShellMain({
|
|
186
208
|
children,
|
|
187
209
|
padding = "md",
|
|
210
|
+
variant,
|
|
211
|
+
bg,
|
|
188
212
|
className,
|
|
213
|
+
style: styleProp,
|
|
189
214
|
id = "main-content",
|
|
190
215
|
...htmlProps
|
|
191
216
|
}) {
|
|
192
217
|
const { layout } = useAppShell();
|
|
218
|
+
const resolvedVariant = resolveSlotVariant(variant, layout, "main");
|
|
193
219
|
const classes = [
|
|
194
220
|
AppShell_module.default.main,
|
|
195
221
|
padding !== "none" && AppShell_module.default[`padding${padding.charAt(0).toUpperCase() + padding.slice(1)}`],
|
|
196
|
-
|
|
222
|
+
resolvedVariant === "floating" && AppShell_module.default.mainFloating,
|
|
197
223
|
className
|
|
198
224
|
].filter(Boolean).join(" ");
|
|
199
|
-
|
|
225
|
+
const style = {
|
|
226
|
+
...bg ? { backgroundColor: bg } : {},
|
|
227
|
+
...styleProp
|
|
228
|
+
};
|
|
229
|
+
return /* @__PURE__ */ jsxRuntime.jsx("main", { ...htmlProps, className: classes, style, id, children });
|
|
200
230
|
}
|
|
201
231
|
function AppShellAside({
|
|
202
232
|
children,
|
|
203
233
|
width = "280px",
|
|
204
234
|
visible = true,
|
|
235
|
+
variant,
|
|
236
|
+
bg,
|
|
205
237
|
className,
|
|
206
238
|
style: styleProp,
|
|
207
239
|
...htmlProps
|
|
208
240
|
}) {
|
|
241
|
+
const { layout } = useAppShell();
|
|
242
|
+
const resolvedVariant = resolveSlotVariant(variant, layout, "aside");
|
|
209
243
|
if (!visible) {
|
|
210
244
|
return null;
|
|
211
245
|
}
|
|
212
|
-
const classes = [
|
|
246
|
+
const classes = [
|
|
247
|
+
AppShell_module.default.aside,
|
|
248
|
+
resolvedVariant === "floating" && AppShell_module.default.asideFloating,
|
|
249
|
+
className
|
|
250
|
+
].filter(Boolean).join(" ");
|
|
213
251
|
const style = {
|
|
214
252
|
"--aside-width": width,
|
|
253
|
+
...bg ? { backgroundColor: bg } : {},
|
|
215
254
|
...styleProp
|
|
216
255
|
};
|
|
217
256
|
return /* @__PURE__ */ jsxRuntime.jsx("aside", { ...htmlProps, className: classes, style, children });
|
|
@@ -1,44 +1,59 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type SidebarCollapsible } from '../Sidebar';
|
|
3
3
|
/**
|
|
4
|
+
* Structural layout — controls CSS grid areas.
|
|
5
|
+
*
|
|
4
6
|
* ```
|
|
5
|
-
* 'default' 'sidebar'
|
|
6
|
-
* ┌──────────────┐ ┌────┬─────────┐
|
|
7
|
-
* │ Header │ │ │ Header │
|
|
8
|
-
* ├────┬─────────┤ │Side├─────────┤
|
|
9
|
-
* │ │ │ │bar │ │
|
|
10
|
-
* │Side│ Main │ │ │ Main │
|
|
11
|
-
* │bar │ │ │ │ │
|
|
12
|
-
* └────┴─────────┘ └────┴─────────┘
|
|
7
|
+
* 'default' 'sidebar'
|
|
8
|
+
* ┌──────────────┐ ┌────┬─────────┐
|
|
9
|
+
* │ Header │ │ │ Header │
|
|
10
|
+
* ├────┬─────────┤ │Side├─────────┤
|
|
11
|
+
* │ │ │ │bar │ │
|
|
12
|
+
* │Side│ Main │ │ │ Main │
|
|
13
|
+
* │bar │ │ │ │ │
|
|
14
|
+
* └────┴─────────┘ └────┴─────────┘
|
|
13
15
|
* ```
|
|
16
|
+
*
|
|
17
|
+
* Combine with `variant="floating"` on individual slots for floating effects:
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <AppShell layout="sidebar">
|
|
21
|
+
* <AppShell.Sidebar variant="floating" />
|
|
22
|
+
* <AppShell.Main variant="floating" />
|
|
23
|
+
* <AppShell.Aside variant="floating" />
|
|
24
|
+
* </AppShell>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Legacy values `'sidebar-floating'` and `'floating'` are still accepted
|
|
28
|
+
* for backwards compatibility and internally expand to the appropriate
|
|
29
|
+
* per-slot variants.
|
|
14
30
|
*/
|
|
15
|
-
export type AppShellLayout = 'default' | 'sidebar' | 'sidebar-floating';
|
|
31
|
+
export type AppShellLayout = 'default' | 'sidebar' | 'sidebar-floating' | 'floating';
|
|
32
|
+
/** Visual treatment for individual layout slots. */
|
|
33
|
+
export type AppShellSlotVariant = 'default' | 'floating';
|
|
16
34
|
export interface AppShellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
17
35
|
children: React.ReactNode;
|
|
18
36
|
/**
|
|
19
|
-
* Layout
|
|
20
|
-
*
|
|
21
|
-
* ```
|
|
22
|
-
* 'default' 'sidebar' 'sidebar-floating'
|
|
23
|
-
* ┌──────────────┐ ┌────┬─────────┐ ┌────┬─────────┐
|
|
24
|
-
* │ Header │ │ │ Header │ │ │ Header │
|
|
25
|
-
* ├────┬─────────┤ │Side├─────────┤ │Side├╌╌╌╌╌╌╌╌╌┤
|
|
26
|
-
* │ │ │ │bar │ │ │bar │┌───────┐│
|
|
27
|
-
* │Side│ Main │ │ │ Main │ │ ││ Main ││
|
|
28
|
-
* │bar │ │ │ │ │ │ │└───────┘│
|
|
29
|
-
* └────┴─────────┘ └────┴─────────┘ └────┴─────────┘
|
|
30
|
-
* ```
|
|
37
|
+
* Layout structure:
|
|
31
38
|
*
|
|
32
39
|
* - `'default'`: Header spans full width, sidebar below (default)
|
|
33
40
|
* - `'sidebar'`: Sidebar is full height, header sits beside it
|
|
34
|
-
*
|
|
41
|
+
*
|
|
42
|
+
* Legacy presets (still work, prefer per-slot `variant` props instead):
|
|
43
|
+
*
|
|
44
|
+
* - `'sidebar-floating'`: Expands to `layout="sidebar"` with floating sidebar + main
|
|
45
|
+
* - `'floating'`: Expands to `layout="sidebar"` with floating sidebar + main + aside
|
|
35
46
|
*/
|
|
36
47
|
layout?: AppShellLayout;
|
|
48
|
+
/** Background color for the shell container (accepts any CSS color value or token) */
|
|
49
|
+
bg?: string;
|
|
37
50
|
}
|
|
38
51
|
export interface AppShellHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
39
52
|
children: React.ReactNode;
|
|
40
53
|
/** Header height (default: '56px') */
|
|
41
54
|
height?: string;
|
|
55
|
+
/** Background color override (accepts any CSS color value or token) */
|
|
56
|
+
bg?: string;
|
|
42
57
|
}
|
|
43
58
|
export interface AppShellSidebarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
44
59
|
children: React.ReactNode;
|
|
@@ -52,11 +67,19 @@ export interface AppShellSidebarProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
52
67
|
position?: 'left' | 'right';
|
|
53
68
|
/** Default collapsed state */
|
|
54
69
|
defaultCollapsed?: boolean;
|
|
70
|
+
/** Visual treatment: `'floating'` blends sidebar with the shell background */
|
|
71
|
+
variant?: AppShellSlotVariant;
|
|
72
|
+
/** Background color override (accepts any CSS color value or token) */
|
|
73
|
+
bg?: string;
|
|
55
74
|
}
|
|
56
75
|
export interface AppShellMainProps extends React.HTMLAttributes<HTMLElement> {
|
|
57
76
|
children: React.ReactNode;
|
|
58
77
|
/** Content padding */
|
|
59
78
|
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
79
|
+
/** Visual treatment: `'floating'` adds rounded corners and elevated background */
|
|
80
|
+
variant?: AppShellSlotVariant;
|
|
81
|
+
/** Background color override (accepts any CSS color value or token) */
|
|
82
|
+
bg?: string;
|
|
60
83
|
}
|
|
61
84
|
export interface AppShellAsideProps extends React.HTMLAttributes<HTMLElement> {
|
|
62
85
|
children: React.ReactNode;
|
|
@@ -64,9 +87,14 @@ export interface AppShellAsideProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
64
87
|
width?: string;
|
|
65
88
|
/** Control visibility */
|
|
66
89
|
visible?: boolean;
|
|
90
|
+
/** Visual treatment: `'floating'` adds rounded corners and elevated background */
|
|
91
|
+
variant?: AppShellSlotVariant;
|
|
92
|
+
/** Background color override (accepts any CSS color value or token) */
|
|
93
|
+
bg?: string;
|
|
67
94
|
}
|
|
68
95
|
interface AppShellContextValue {
|
|
69
96
|
layout: AppShellLayout;
|
|
97
|
+
structure: 'default' | 'sidebar';
|
|
70
98
|
headerHeight: string;
|
|
71
99
|
sidebarWidth: string;
|
|
72
100
|
sidebarCollapsedWidth: string;
|
|
@@ -78,23 +106,23 @@ declare function useAppShell(): AppShellContextValue;
|
|
|
78
106
|
* AppShell - Root layout wrapper
|
|
79
107
|
* Automatically wraps children with SidebarProvider
|
|
80
108
|
*/
|
|
81
|
-
declare function AppShellRoot({ children, layout, className, ...htmlProps }: AppShellProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
declare function AppShellRoot({ children, layout, bg, className, style: styleProp, ...htmlProps }: AppShellProps): import("react/jsx-runtime").JSX.Element;
|
|
82
110
|
/**
|
|
83
111
|
* AppShell.Header - Fixed header slot
|
|
84
112
|
*/
|
|
85
|
-
declare function AppShellHeader({ children, height, className, style: styleProp, ...htmlProps }: AppShellHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
113
|
+
declare function AppShellHeader({ children, height, bg, className, style: styleProp, ...htmlProps }: AppShellHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
86
114
|
/**
|
|
87
115
|
* AppShell.Sidebar - Sidebar slot (delegates to Sidebar component)
|
|
88
116
|
*/
|
|
89
|
-
declare function AppShellSidebar({ children, width, collapsedWidth, collapsible, position, defaultCollapsed, 'aria-label': ariaLabel, className, ...htmlProps }: AppShellSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
117
|
+
declare function AppShellSidebar({ children, width, collapsedWidth, collapsible, position, defaultCollapsed, variant, bg, 'aria-label': ariaLabel, className, style: styleProp, ...htmlProps }: AppShellSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
90
118
|
/**
|
|
91
119
|
* AppShell.Main - Scrollable main content area
|
|
92
120
|
*/
|
|
93
|
-
declare function AppShellMain({ children, padding, className, id, ...htmlProps }: AppShellMainProps): import("react/jsx-runtime").JSX.Element;
|
|
121
|
+
declare function AppShellMain({ children, padding, variant, bg, className, style: styleProp, id, ...htmlProps }: AppShellMainProps): import("react/jsx-runtime").JSX.Element;
|
|
94
122
|
/**
|
|
95
123
|
* AppShell.Aside - Optional right sidebar panel
|
|
96
124
|
*/
|
|
97
|
-
declare function AppShellAside({ children, width, visible, className, style: styleProp, ...htmlProps }: AppShellAsideProps): import("react/jsx-runtime").JSX.Element | null;
|
|
125
|
+
declare function AppShellAside({ children, width, visible, variant, bg, className, style: styleProp, ...htmlProps }: AppShellAsideProps): import("react/jsx-runtime").JSX.Element | null;
|
|
98
126
|
export declare const AppShell: typeof AppShellRoot & {
|
|
99
127
|
Header: typeof AppShellHeader;
|
|
100
128
|
Sidebar: typeof AppShellSidebar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,E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