@namroodinc/liquid-editorial 0.11.0 → 0.13.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/README.md +44 -20
- package/UPGRADING.md +322 -0
- package/dist/chunks/{Avatar-DPnrvkwd.cjs → Avatar-BY0dAItT.cjs} +2 -2
- package/dist/chunks/{Avatar-DPnrvkwd.cjs.map → Avatar-BY0dAItT.cjs.map} +1 -1
- package/dist/chunks/{Avatar-BK8IdL5W.js → Avatar-UjhjcHh5.js} +2 -2
- package/dist/chunks/{Avatar-BK8IdL5W.js.map → Avatar-UjhjcHh5.js.map} +1 -1
- package/dist/chunks/{Board-Cnyqrc-R.js → Board-BCS7sDXg.js} +13 -5
- package/dist/chunks/{Board-Cnyqrc-R.js.map → Board-BCS7sDXg.js.map} +1 -1
- package/dist/chunks/{Board-DFuJt2Oh.cjs → Board-CNVy8gHI.cjs} +2 -2
- package/dist/chunks/Board-CNVy8gHI.cjs.map +1 -0
- package/dist/chunks/CollectionView-CIJdNwcq.cjs +2 -0
- package/dist/chunks/CollectionView-CIJdNwcq.cjs.map +1 -0
- package/dist/chunks/{CollectionView-Vj84E26b.js → CollectionView-JRNdXHti.js} +5 -5
- package/dist/chunks/CollectionView-JRNdXHti.js.map +1 -0
- package/dist/chunks/{ColourField-DkO8tjeB.js → ColourField-BTj9NHgI.js} +147 -153
- package/dist/chunks/ColourField-BTj9NHgI.js.map +1 -0
- package/dist/chunks/ColourField-DuoVeXjG.cjs +2 -0
- package/dist/chunks/ColourField-DuoVeXjG.cjs.map +1 -0
- package/dist/chunks/DatePicker-BYpGsfL4.cjs +2 -0
- package/dist/chunks/DatePicker-BYpGsfL4.cjs.map +1 -0
- package/dist/chunks/{DatePicker-B8tllGYy.js → DatePicker-Cb5WspIC.js} +22 -22
- package/dist/chunks/DatePicker-Cb5WspIC.js.map +1 -0
- package/dist/chunks/{Drawer-DTtgAZO2.js → Drawer-Ck5XKT_V.js} +4 -4
- package/dist/chunks/Drawer-Ck5XKT_V.js.map +1 -0
- package/dist/chunks/Drawer-DdIH9jpe.cjs +2 -0
- package/dist/chunks/Drawer-DdIH9jpe.cjs.map +1 -0
- package/dist/chunks/EntryPicker-CCCoJxbd.cjs +2 -0
- package/dist/chunks/EntryPicker-CCCoJxbd.cjs.map +1 -0
- package/dist/chunks/{EntryPicker-KxHZzZsh.js → EntryPicker-DLCP4S-q.js} +4 -4
- package/dist/chunks/EntryPicker-DLCP4S-q.js.map +1 -0
- package/dist/chunks/{FormEditor-BJcAIVcL.cjs → FormEditor-ArvjKtJJ.cjs} +2 -2
- package/dist/chunks/{FormEditor-BJcAIVcL.cjs.map → FormEditor-ArvjKtJJ.cjs.map} +1 -1
- package/dist/chunks/{FormEditor-CdLqPaKK.js → FormEditor-DnNBv9Xf.js} +16 -16
- package/dist/chunks/{FormEditor-CdLqPaKK.js.map → FormEditor-DnNBv9Xf.js.map} +1 -1
- package/dist/chunks/{Message-CyLq9ef-.js → Message-C73sJfdo.js} +4 -8
- package/dist/chunks/{Message-CyLq9ef-.js.map → Message-C73sJfdo.js.map} +1 -1
- package/dist/chunks/{Message-D3b8HDhm.cjs → Message-CIKSTXp8.cjs} +2 -2
- package/dist/chunks/{Message-D3b8HDhm.cjs.map → Message-CIKSTXp8.cjs.map} +1 -1
- package/dist/chunks/RichTextEditor--kMao88d.cjs +2 -0
- package/dist/chunks/RichTextEditor--kMao88d.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-DmNM63Wg.js → RichTextEditor-CvbboqJY.js} +397 -380
- package/dist/chunks/RichTextEditor-CvbboqJY.js.map +1 -0
- package/dist/chunks/{dialogLabel-D18maX-p.js → dialogLabel-DT7rCr3_.js} +19 -19
- package/dist/chunks/{dialogLabel-D18maX-p.js.map → dialogLabel-DT7rCr3_.js.map} +1 -1
- package/dist/chunks/{dialogLabel-2HRYMHbF.cjs → dialogLabel-_-MTckE_.cjs} +2 -2
- package/dist/chunks/{dialogLabel-2HRYMHbF.cjs.map → dialogLabel-_-MTckE_.cjs.map} +1 -1
- package/dist/chunks/overlayLayer-iGhuAByk.cjs +2 -0
- package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +1 -0
- package/dist/chunks/{overlayLayer-IuoPVwTO.js → overlayLayer-lU4iWSjO.js} +32 -28
- package/dist/chunks/overlayLayer-lU4iWSjO.js.map +1 -0
- package/dist/chunks/{group-7Z_xRlQx.js → style-7Z_xRlQx.js} +1 -1
- package/dist/chunks/{group-7Z_xRlQx.js.map → style-7Z_xRlQx.js.map} +1 -1
- package/dist/chunks/{group-nulIa2_8.cjs → style-nulIa2_8.cjs} +1 -1
- package/dist/chunks/{group-nulIa2_8.cjs.map → style-nulIa2_8.cjs.map} +1 -1
- package/dist/chunks/use-picker-session-Bue5MJHQ.cjs +2 -0
- package/dist/chunks/use-picker-session-Bue5MJHQ.cjs.map +1 -0
- package/dist/chunks/{use-picker-session-BDEWL2jK.js → use-picker-session-DUO4G8Cs.js} +4 -4
- package/dist/chunks/use-picker-session-DUO4G8Cs.js.map +1 -0
- package/dist/chunks/{useTooltip-BXAvQwt4.cjs → useTooltip-C7ON4nkV.cjs} +2 -2
- package/dist/chunks/{useTooltip-BXAvQwt4.cjs.map → useTooltip-C7ON4nkV.cjs.map} +1 -1
- package/dist/chunks/{useTooltip-BrC7FdeH.js → useTooltip-DnJEFBLg.js} +2 -2
- package/dist/chunks/{useTooltip-BrC7FdeH.js.map → useTooltip-DnJEFBLg.js.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.cjs.map +1 -1
- package/dist/components/AssetCard/index.d.cts.map +1 -1
- package/dist/components/AssetCard/index.d.ts.map +1 -1
- package/dist/components/AssetCard/index.js +16 -16
- package/dist/components/AssetCard/index.js.map +1 -1
- package/dist/components/AssetCard/style.css +47 -46
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.cjs.map +1 -1
- package/dist/components/AssetGrid/index.d.cts +0 -2
- package/dist/components/AssetGrid/index.d.cts.map +1 -1
- package/dist/components/AssetGrid/index.d.ts +0 -2
- package/dist/components/AssetGrid/index.d.ts.map +1 -1
- package/dist/components/AssetGrid/index.js +15 -15
- package/dist/components/AssetGrid/index.js.map +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Avatar/style.css +26 -5
- package/dist/components/Badge/index.cjs +1 -1
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.cts +2 -3
- package/dist/components/Badge/index.d.cts.map +1 -1
- package/dist/components/Badge/index.d.ts +2 -3
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/style.css +29 -35
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Board/style.css +37 -16
- package/dist/components/Button/style.css +17 -12
- package/dist/components/ButtonGroup/index.cjs.map +1 -1
- package/dist/components/ButtonGroup/index.d.cts +1 -1
- package/dist/components/ButtonGroup/index.d.ts +1 -1
- package/dist/components/ButtonGroup/index.js.map +1 -1
- package/dist/components/ButtonGroup/style.css +4 -20
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +3 -3
- package/dist/components/Choice/index.js.map +1 -1
- package/dist/components/Choice/style.css +34 -22
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/CollectionView/style.css +8 -11
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.d.cts.map +1 -1
- package/dist/components/ColourField/index.d.ts.map +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/ColourField/style.css +31 -20
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DatePicker/style.css +10 -3
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/Drawer/style.css +10 -23
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.js +4 -4
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EditLayout/style.css +5 -6
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/style.css +46 -20
- package/dist/components/Field/style.css +6 -5
- package/dist/components/FormEditor/README.md +28 -19
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/style.css +1 -0
- package/dist/components/ImageCropper/style.css +20 -20
- package/dist/components/LimitReading/style.css +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/style.css +3 -3
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/style.css +6 -6
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +58 -55
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Popover/style.css +2 -2
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
- package/dist/components/RichTextEditor/style.css +123 -75
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.d.cts.map +1 -1
- package/dist/components/SelectionCard/index.d.ts.map +1 -1
- package/dist/components/SelectionCard/index.js +7 -3
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/SelectionCard/style.css +30 -48
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.cjs.map +1 -1
- package/dist/components/SideNav/index.d.cts +3 -3
- package/dist/components/SideNav/index.d.ts +3 -3
- package/dist/components/SideNav/index.js +15 -3
- package/dist/components/SideNav/index.js.map +1 -1
- package/dist/components/SideNav/style.css +19 -13
- package/dist/components/Skeleton/style.css +1 -1
- package/dist/components/Slider/style.css +19 -32
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.cjs.map +1 -1
- package/dist/components/SortableList/index.js +6 -2
- package/dist/components/SortableList/index.js.map +1 -1
- package/dist/components/SortableList/style.css +20 -5
- package/dist/components/Stepper/style.css +8 -9
- package/dist/components/SubNav/index.cjs.map +1 -1
- package/dist/components/SubNav/index.d.cts +2 -2
- package/dist/components/SubNav/index.d.ts +2 -2
- package/dist/components/SubNav/index.js.map +1 -1
- package/dist/components/SubNav/style.css +3 -8
- package/dist/components/Switch/index.cjs +1 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js +3 -2
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/style.css +26 -6
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.cjs.map +1 -1
- package/dist/components/Table/index.js +2 -2
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/style.css +34 -22
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.js +1 -1
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TagsInput/style.css +12 -5
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Time/style.css +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Toast/style.css +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.cjs.map +1 -1
- package/dist/components/TopNav/index.d.cts +4 -4
- package/dist/components/TopNav/index.d.ts +4 -4
- package/dist/components/TopNav/index.js +5 -1
- package/dist/components/TopNav/index.js.map +1 -1
- package/dist/components/TopNav/style.css +6 -9
- package/dist/elements.css +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -44
- package/dist/internal/dialogFocus.d.cts +2 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +2 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/dist/message.css +13 -17
- package/dist/tokens.css +112 -280
- package/package.json +1 -1
- package/dist/chunks/Board-DFuJt2Oh.cjs.map +0 -1
- package/dist/chunks/CollectionView-BNYx29b1.cjs +0 -2
- package/dist/chunks/CollectionView-BNYx29b1.cjs.map +0 -1
- package/dist/chunks/CollectionView-Vj84E26b.js.map +0 -1
- package/dist/chunks/ColourField--rS9KDpq.cjs +0 -2
- package/dist/chunks/ColourField--rS9KDpq.cjs.map +0 -1
- package/dist/chunks/ColourField-DkO8tjeB.js.map +0 -1
- package/dist/chunks/DatePicker-B8tllGYy.js.map +0 -1
- package/dist/chunks/DatePicker-OiqjoO-f.cjs +0 -2
- package/dist/chunks/DatePicker-OiqjoO-f.cjs.map +0 -1
- package/dist/chunks/Drawer-BDX9_qHA.cjs +0 -2
- package/dist/chunks/Drawer-BDX9_qHA.cjs.map +0 -1
- package/dist/chunks/Drawer-DTtgAZO2.js.map +0 -1
- package/dist/chunks/EntryPicker-BI_7g2Wg.cjs +0 -2
- package/dist/chunks/EntryPicker-BI_7g2Wg.cjs.map +0 -1
- package/dist/chunks/EntryPicker-KxHZzZsh.js.map +0 -1
- package/dist/chunks/RichTextEditor-BXyhSeJd.cjs +0 -2
- package/dist/chunks/RichTextEditor-BXyhSeJd.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-DmNM63Wg.js.map +0 -1
- package/dist/chunks/overlayLayer-IuoPVwTO.js.map +0 -1
- package/dist/chunks/overlayLayer-seJG-EFn.cjs +0 -2
- package/dist/chunks/overlayLayer-seJG-EFn.cjs.map +0 -1
- package/dist/chunks/use-picker-session-BDEWL2jK.js.map +0 -1
- package/dist/chunks/use-picker-session-C4FGinLN.cjs +0 -2
- package/dist/chunks/use-picker-session-C4FGinLN.cjs.map +0 -1
- package/dist/components/ColourField/focus.d.cts +0 -3
- package/dist/components/ColourField/focus.d.cts.map +0 -1
- package/dist/components/ColourField/focus.d.ts +0 -3
- package/dist/components/ColourField/focus.d.ts.map +0 -1
|
@@ -12,16 +12,22 @@
|
|
|
12
12
|
display: flex;
|
|
13
13
|
align-items: center;
|
|
14
14
|
gap: var(--space-3);
|
|
15
|
-
border:
|
|
15
|
+
border: 0;
|
|
16
16
|
border-radius: var(--radius-md);
|
|
17
|
-
background: var(--
|
|
17
|
+
background: var(--field-bg);
|
|
18
18
|
padding: var(--space-3);
|
|
19
19
|
font-size: var(--font-size-sm);
|
|
20
20
|
user-select: none;
|
|
21
21
|
transition: background-color var(--duration-fast) var(--ease-standard);
|
|
22
|
+
|
|
23
|
+
--field-bg: var(--fill-card);
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/* Painted fills other than the ground are named in --field-paint, so
|
|
27
|
+
* neutral badges and controls in the row step from them. */
|
|
24
28
|
.ds-sortable-item:hover {
|
|
29
|
+
--field-paint: var(--field-hover);
|
|
30
|
+
|
|
25
31
|
background: var(--field-hover);
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -37,14 +43,23 @@
|
|
|
37
43
|
cursor: grabbing;
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
/* A custom overlay is the preview; the row stays behind as
|
|
46
|
+
/* A custom overlay is the preview; the row stays behind as a recessed slot.
|
|
47
|
+
* Its handle stays visible because it holds focus through a keyboard drag. */
|
|
41
48
|
.ds-sortable-item[data-dragging="placeholder"] {
|
|
42
|
-
|
|
49
|
+
--field-paint: var(--field-pressed);
|
|
50
|
+
|
|
51
|
+
background: var(--field-pressed);
|
|
52
|
+
color: var(--color-text-muted);
|
|
43
53
|
}
|
|
44
54
|
|
|
55
|
+
/* The pointer always rests on the overlay, so it keeps the list's rest
|
|
56
|
+
* fill instead of the hover step. It copies none of the item's classes or
|
|
57
|
+
* data attributes; renderDragOverlay content carries any tone. */
|
|
45
58
|
.ds-sortable-item[data-overlay] {
|
|
59
|
+
--field-paint: initial;
|
|
60
|
+
|
|
46
61
|
box-shadow: var(--shadow-lg);
|
|
47
|
-
background: var(--
|
|
62
|
+
background: var(--field-bg);
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
/* The overlay content is inert, so the pointer lands on dnd-kit's wrapper. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
@layer components {
|
|
2
2
|
.ds-stepper {
|
|
3
|
+
--stepper-indicator: color-mix(in srgb, var(--color-text) 60%, var(--field-bg));
|
|
4
|
+
|
|
3
5
|
inline-size: 100%;
|
|
4
6
|
}
|
|
5
7
|
|
|
@@ -39,8 +41,7 @@
|
|
|
39
41
|
|
|
40
42
|
.ds-stepper__connector {
|
|
41
43
|
flex: 1 1 0;
|
|
42
|
-
background: var(--
|
|
43
|
-
opacity: 0.35;
|
|
44
|
+
background: var(--stepper-indicator);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
.ds-stepper__step:first-child .ds-stepper__connector[data-side="start"],
|
|
@@ -86,10 +87,10 @@
|
|
|
86
87
|
font-size: var(--font-size-sm);
|
|
87
88
|
font-weight: var(--font-weight-bold);
|
|
88
89
|
line-height: 1;
|
|
89
|
-
border:
|
|
90
|
+
border: 0;
|
|
90
91
|
border-radius: var(--radius-pill);
|
|
91
|
-
background: var(--
|
|
92
|
-
color: var(--color-text);
|
|
92
|
+
background: var(--stepper-indicator);
|
|
93
|
+
color: var(--color-text-on-solid);
|
|
93
94
|
transition: background-color var(--duration-fast) var(--ease-standard);
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -101,19 +102,17 @@
|
|
|
101
102
|
|
|
102
103
|
.ds-stepper__step[data-status="complete"] .ds-stepper__marker:not(.ds-button) {
|
|
103
104
|
background: var(--color-primary);
|
|
104
|
-
border-color: var(--color-primary);
|
|
105
105
|
color: var(--color-text-on-solid);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/* The current step is soft, so it never reads as one more completed step. */
|
|
108
109
|
.ds-stepper__step[data-status="current"] .ds-stepper__marker:not(.ds-button) {
|
|
109
110
|
background: var(--color-primary-soft);
|
|
110
|
-
border-color: var(--color-primary);
|
|
111
111
|
color: var(--color-primary-text);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
.ds-stepper__step[data-status="upcoming"] .ds-stepper__marker:not(.ds-button) {
|
|
115
|
-
color: var(--
|
|
116
|
-
border-color: var(--color-border-muted);
|
|
115
|
+
color: var(--field-bg);
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
.ds-stepper__text {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","Icon","Badge","Button","require_Icon","require_components_Button_index","require_components_Badge_index","react","react_jsx_runtime","SubNav","rest","label","className","actions","SubNavItem","isActive","icon","count","SubNavButton","disabled"],"sources":["../../../src/components/SubNav/index.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { Badge } from \"../Badge\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport interface SubNavProps extends HTMLAttributes<HTMLElement> {\n /** Accessible name — say what the set switches, e.g. \"Article sections\". */\n label: string;\n /** Controls parked at the end of the row, e.g. a view switch. */\n actions?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * The second level: views inside one page — Content, Settings, Revisions.
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","Icon","Badge","Button","require_Icon","require_components_Button_index","require_components_Badge_index","react","react_jsx_runtime","SubNav","rest","label","className","actions","SubNavItem","isActive","icon","count","SubNavButton","disabled"],"sources":["../../../src/components/SubNav/index.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { Badge } from \"../Badge\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport interface SubNavProps extends HTMLAttributes<HTMLElement> {\n /** Accessible name — say what the set switches, e.g. \"Article sections\". */\n label: string;\n /** Controls parked at the end of the row, e.g. a view switch. */\n actions?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * The second level: views inside one page — Content, Settings, Revisions. The\n * active item uses stronger text without a rule or selection rail.\n */\nexport const SubNav = forwardRef<HTMLElement, SubNavProps>(function SubNav(\n { label, actions, className, children, ...rest },\n ref,\n) {\n return (\n <nav\n ref={ref}\n aria-label={label}\n className={[\"ds-subnav\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ul className=\"ds-subnav__list\">{children}</ul>\n {actions && <div className=\"ds-subnav__actions\">{actions}</div>}\n </nav>\n );\n});\n\ninterface SubNavItemBase {\n label: string;\n icon?: IconName;\n isActive?: boolean;\n /** A count beside the label — kept quiet, never a status colour. */\n count?: number;\n}\n\nexport interface SubNavItemProps\n extends SubNavItemBase, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"children\"> {}\n\n/** One view, as a link. Use `SubNavButton` when the view is client state. */\nexport const SubNavItem = forwardRef<HTMLAnchorElement, SubNavItemProps>(function SubNavItem(\n { label, icon, isActive, count, className, ...rest },\n ref,\n) {\n return (\n <li className=\"ds-subnav__row\">\n <a\n ref={ref}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-current={isActive ? \"page\" : undefined}\n {...rest}\n >\n {icon && <Icon name={icon} />}\n {label}\n {count !== undefined && (\n <Badge\n className=\"ds-subnav__count\"\n shape=\"count\"\n size=\"sm\"\n appearance=\"soft\"\n isCountExact\n >\n {count}\n </Badge>\n )}\n </a>\n </li>\n );\n});\n\nexport interface SubNavButtonProps\n extends SubNavItemBase, Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"type\"> {}\n\n/** One view, as a control — for panes switched in place rather than routed. */\nexport const SubNavButton = forwardRef<HTMLButtonElement, SubNavButtonProps>(function SubNavButton(\n { label, icon, isActive, count, disabled, className, ...rest },\n ref,\n) {\n return (\n <li className=\"ds-subnav__row\">\n <Button\n ref={ref}\n variant=\"simple\"\n iconStart={icon}\n isDisabled={disabled}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-pressed={isActive}\n {...rest}\n >\n {label}\n {count !== undefined && (\n <Badge\n className=\"ds-subnav__count\"\n shape=\"count\"\n size=\"sm\"\n appearance=\"soft\"\n isCountExact\n >\n {count}\n </Badge>\n )}\n </Button>\n </li>\n );\n});\n"],"mappings":"A,4OAyBA,IAAaS,GAAA,EAAST,EAAAA,WAAAA,CAAqC,SACzD,CAAE,QAAO,UAAS,YAAW,WAAU,GAAGU,GAC1C,EACA,CACA,OACE,EAAAF,EAAA,KAAA,CAAC,MAAD,CACO,MACL,aAAYG,EACZ,UA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AClE,cAAaG,GAAY,IAAA,GACzB,eAAcA,EACd,GAAIL,EARN,SAAA,CAUGC,EACAM,IAAU,IAAA,KACT,EAAAT,EAAA,IAAA,CAACN,EAAAA,MAAD,CACE,UAAU,mBACV,MAAM,QACN,KAAK,KACL,WAAW,OACX,aAAA,GAEC,SAAAe,CACI,CAAA,CAEH,C,EACN,CAAA,CAER,CAAC,E"}
|
|
@@ -8,8 +8,8 @@ export interface SubNavProps extends HTMLAttributes<HTMLElement> {
|
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* The second level: views inside one page — Content, Settings, Revisions.
|
|
12
|
-
*
|
|
11
|
+
* The second level: views inside one page — Content, Settings, Revisions. The
|
|
12
|
+
* active item uses stronger text without a rule or selection rail.
|
|
13
13
|
*/
|
|
14
14
|
export declare const SubNav: import("react").ForwardRefExoticComponent<SubNavProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
15
|
interface SubNavItemBase {
|
|
@@ -8,8 +8,8 @@ export interface SubNavProps extends HTMLAttributes<HTMLElement> {
|
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* The second level: views inside one page — Content, Settings, Revisions.
|
|
12
|
-
*
|
|
11
|
+
* The second level: views inside one page — Content, Settings, Revisions. The
|
|
12
|
+
* active item uses stronger text without a rule or selection rail.
|
|
13
13
|
*/
|
|
14
14
|
export declare const SubNav: import("react").ForwardRefExoticComponent<SubNavProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
15
|
interface SubNavItemBase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Icon","SubNav","forwardRef","rest","label","className","actions","SubNavItem","isActive","icon","count","Badge","SubNavButton","Button","disabled"],"sources":["../../../src/components/SubNav/index.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { Badge } from \"../Badge\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport interface SubNavProps extends HTMLAttributes<HTMLElement> {\n /** Accessible name — say what the set switches, e.g. \"Article sections\". */\n label: string;\n /** Controls parked at the end of the row, e.g. a view switch. */\n actions?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * The second level: views inside one page — Content, Settings, Revisions.
|
|
1
|
+
{"version":3,"file":"index.js","names":["Icon","SubNav","forwardRef","rest","label","className","actions","SubNavItem","isActive","icon","count","Badge","SubNavButton","Button","disabled"],"sources":["../../../src/components/SubNav/index.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { Badge } from \"../Badge\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport interface SubNavProps extends HTMLAttributes<HTMLElement> {\n /** Accessible name — say what the set switches, e.g. \"Article sections\". */\n label: string;\n /** Controls parked at the end of the row, e.g. a view switch. */\n actions?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * The second level: views inside one page — Content, Settings, Revisions. The\n * active item uses stronger text without a rule or selection rail.\n */\nexport const SubNav = forwardRef<HTMLElement, SubNavProps>(function SubNav(\n { label, actions, className, children, ...rest },\n ref,\n) {\n return (\n <nav\n ref={ref}\n aria-label={label}\n className={[\"ds-subnav\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ul className=\"ds-subnav__list\">{children}</ul>\n {actions && <div className=\"ds-subnav__actions\">{actions}</div>}\n </nav>\n );\n});\n\ninterface SubNavItemBase {\n label: string;\n icon?: IconName;\n isActive?: boolean;\n /** A count beside the label — kept quiet, never a status colour. */\n count?: number;\n}\n\nexport interface SubNavItemProps\n extends SubNavItemBase, Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"children\"> {}\n\n/** One view, as a link. Use `SubNavButton` when the view is client state. */\nexport const SubNavItem = forwardRef<HTMLAnchorElement, SubNavItemProps>(function SubNavItem(\n { label, icon, isActive, count, className, ...rest },\n ref,\n) {\n return (\n <li className=\"ds-subnav__row\">\n <a\n ref={ref}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-current={isActive ? \"page\" : undefined}\n {...rest}\n >\n {icon && <Icon name={icon} />}\n {label}\n {count !== undefined && (\n <Badge\n className=\"ds-subnav__count\"\n shape=\"count\"\n size=\"sm\"\n appearance=\"soft\"\n isCountExact\n >\n {count}\n </Badge>\n )}\n </a>\n </li>\n );\n});\n\nexport interface SubNavButtonProps\n extends SubNavItemBase, Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"type\"> {}\n\n/** One view, as a control — for panes switched in place rather than routed. */\nexport const SubNavButton = forwardRef<HTMLButtonElement, SubNavButtonProps>(function SubNavButton(\n { label, icon, isActive, count, disabled, className, ...rest },\n ref,\n) {\n return (\n <li className=\"ds-subnav__row\">\n <Button\n ref={ref}\n variant=\"simple\"\n iconStart={icon}\n isDisabled={disabled}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-pressed={isActive}\n {...rest}\n >\n {label}\n {count !== undefined && (\n <Badge\n className=\"ds-subnav__count\"\n shape=\"count\"\n size=\"sm\"\n appearance=\"soft\"\n isCountExact\n >\n {count}\n </Badge>\n )}\n </Button>\n </li>\n );\n});\n"],"mappings":";;;;;;AAyBA,IAAaC,IAASC,EAAqC,SACzD,EAAE,UAAO,YAAS,cAAW,aAAU,GAAGC,KAC1C,GACA;CACA,OACE,kBAAC,OAAD;EACO;EACL,cAAYC;EACZ,WAAW,CAAC,aAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC5D,GAAIF;EAJN,UAAA,CAME,kBAAC,MAAD;GAAI,WAA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end: var(--rule-width) solid var(--rule-color);
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
.ds-subnav__list {
|
|
@@ -36,13 +35,10 @@
|
|
|
36
35
|
text-decoration: none;
|
|
37
36
|
white-space: nowrap;
|
|
38
37
|
cursor: pointer;
|
|
39
|
-
|
|
40
|
-
transition:
|
|
41
|
-
color var(--duration-fast) var(--ease-standard),
|
|
42
|
-
box-shadow var(--duration-fast) var(--ease-standard);
|
|
38
|
+
transition: color var(--duration-fast) var(--ease-standard);
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
/* SubNavButton
|
|
41
|
+
/* SubNavButton shares the same navigation layout as links. */
|
|
46
42
|
.ds-subnav__item.ds-button {
|
|
47
43
|
height: auto;
|
|
48
44
|
padding: 0 var(--space-3);
|
|
@@ -60,14 +56,13 @@
|
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
.ds-subnav__item:focus-visible {
|
|
63
|
-
outline: var(--
|
|
59
|
+
outline: var(--focus-width) solid var(--color-focus);
|
|
64
60
|
outline-offset: -2px;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
.ds-subnav__item[data-active] {
|
|
68
64
|
color: var(--color-text);
|
|
69
65
|
font-weight: var(--font-weight-bold);
|
|
70
|
-
box-shadow: inset 0 calc(-1 * var(--rail-width)) 0 0 var(--rail-color);
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
.ds-subnav__actions {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(...e){return e.filter(Boolean).join(` `)}var i=(0,t.forwardRef)(function({isSelected:i,defaultSelected:a=!1,onSelectedChange:o,isDisabled:s=!1,required:c,className:l,children:u,onClick:d,...f},p){let[m,h]=(0,t.useState)(a),g=i??m
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(...e){return e.filter(Boolean).join(` `)}var i=(0,t.forwardRef)(function({isSelected:i,defaultSelected:a=!1,onSelectedChange:o,isDisabled:s=!1,required:c,className:l,children:u,onClick:d,...f},p){let[m,h]=(0,t.useState)(a),g=i??m,_=f[`aria-invalid`]===!0||f[`aria-invalid`]===`true`;return(0,n.jsxs)(`label`,{className:r(`ds-switch`,l),children:[(0,n.jsx)(e.Button,{ref:p,variant:g?_?`danger`:`primary`:`neutral`,"data-invalid":_&&!g||void 0,size:`sm`,role:`switch`,"aria-checked":g,"aria-required":c||void 0,isDisabled:s,className:`ds-switch__track`,onClick:e=>{if(d?.(e),e.defaultPrevented)return;let t=!g;i===void 0&&h(t),o?.(t)},...f,children:(0,n.jsx)(`span`,{className:`ds-switch__knob`,"aria-hidden":`true`})}),u&&(0,n.jsx)(`span`,{className:`ds-switch__label`,children:u})]})});exports.Switch=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useState","Button","require_components_Button_index","react","react_jsx_runtime","cx","parts","Switch","rest","internal","setInternal","defaultSelected","current","isSelected","className","required","onClick","event","next","onSelectedChange","children"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import { forwardRef, useState, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Button } from \"../Button\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface SwitchProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"value\" | \"disabled\"\n> {\n /** Required state when bound to Field. */\n required?: boolean;\n isSelected?: boolean;\n defaultSelected?: boolean;\n onSelectedChange?: (isSelected: boolean) => void;\n isDisabled?: boolean;\n /** Label to the right of the track. Omit it and pass `aria-label`. */\n children?: ReactNode;\n}\n\n/** An immediate on/off — it commits as it is pressed, no Save behind it. */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n {\n isSelected,\n defaultSelected = false,\n onSelectedChange,\n isDisabled = false,\n required,\n className,\n children,\n onClick,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState(defaultSelected);\n const current = isSelected ?? internal;\n\n return (\n <label className={cx(\"ds-switch\", className)}>\n <Button\n ref={ref}\n variant={current ? \"primary\" : \"neutral\"}\n size=\"sm\"\n role=\"switch\"\n aria-checked={current}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n className=\"ds-switch__track\"\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) {\n return;\n }\n const next = !current;\n if (isSelected === undefined) {\n setInternal(next);\n }\n onSelectedChange?.(next);\n }}\n {...rest}\n >\n <span\n className=\"ds-switch__knob\"\n aria-hidden=\"true\"\n />\n </Button>\n {children && <span className=\"ds-switch__label\">{children}</span>}\n </label>\n );\n});\n"],"mappings":"A,gKAIA,SAASM,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAiBA,IAAaC,GAAA,EAASR,EAAAA,WAAAA,CAA2C,SAC/D,CACE,aACA,kBAAkB,GAClB,mBACA,aAAa,GACb,WACA,YACA,WACA,UACA,GAAGS,GAEL,EACA,CACA,GAAM,CAACC,EAAUC,IAAA,EAAeV,EAAAA,SAAAA,CAASW,CAAe,EAClDC,EAAUC,GAAcJ,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useState","Button","require_components_Button_index","react","react_jsx_runtime","cx","parts","Switch","rest","internal","setInternal","defaultSelected","current","isSelected","invalid","className","required","onClick","event","next","onSelectedChange","children"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import { forwardRef, useState, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Button } from \"../Button\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface SwitchProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"value\" | \"disabled\"\n> {\n /** Required state when bound to Field. */\n required?: boolean;\n isSelected?: boolean;\n defaultSelected?: boolean;\n onSelectedChange?: (isSelected: boolean) => void;\n isDisabled?: boolean;\n /** Label to the right of the track. Omit it and pass `aria-label`. */\n children?: ReactNode;\n}\n\n/** An immediate on/off — it commits as it is pressed, no Save behind it. */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n {\n isSelected,\n defaultSelected = false,\n onSelectedChange,\n isDisabled = false,\n required,\n className,\n children,\n onClick,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState(defaultSelected);\n const current = isSelected ?? internal;\n const invalid = rest[\"aria-invalid\"] === true || rest[\"aria-invalid\"] === \"true\";\n\n return (\n <label className={cx(\"ds-switch\", className)}>\n <Button\n ref={ref}\n variant={current ? (invalid ? \"danger\" : \"primary\") : \"neutral\"}\n data-invalid={(invalid && !current) || undefined}\n size=\"sm\"\n role=\"switch\"\n aria-checked={current}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n className=\"ds-switch__track\"\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) {\n return;\n }\n const next = !current;\n if (isSelected === undefined) {\n setInternal(next);\n }\n onSelectedChange?.(next);\n }}\n {...rest}\n >\n <span\n className=\"ds-switch__knob\"\n aria-hidden=\"true\"\n />\n </Button>\n {children && <span className=\"ds-switch__label\">{children}</span>}\n </label>\n );\n});\n"],"mappings":"A,gKAIA,SAASM,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAiBA,IAAaC,GAAA,EAASR,EAAAA,WAAAA,CAA2C,SAC/D,CACE,aACA,kBAAkB,GAClB,mBACA,aAAa,GACb,WACA,YACA,WACA,UACA,GAAGS,GAEL,EACA,CACA,GAAM,CAACC,EAAUC,IAAA,EAAeV,EAAAA,SAA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,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,aAAa,CAAC;AAMrB,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,UAAU,CAClC;IACC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,MAAM,2GAmDjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,aAAa,CAAC;AAMrB,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,UAAU,CAClC;IACC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,aAAa,CAAC;AAMrB,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,UAAU,CAClC;IACC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,MAAM,2GAmDjB,CAAC"}
|
|
@@ -6,12 +6,13 @@ function a(...e) {
|
|
|
6
6
|
return e.filter(Boolean).join(" ");
|
|
7
7
|
}
|
|
8
8
|
var o = t(function({ isSelected: t, defaultSelected: o = !1, onSelectedChange: s, isDisabled: c = !1, required: l, className: u, children: d, onClick: f, ...p }, m) {
|
|
9
|
-
let [h, g] = n(o), _ = t ?? h;
|
|
9
|
+
let [h, g] = n(o), _ = t ?? h, v = p["aria-invalid"] === !0 || p["aria-invalid"] === "true";
|
|
10
10
|
return /* @__PURE__ */ i("label", {
|
|
11
11
|
className: a("ds-switch", u),
|
|
12
12
|
children: [/* @__PURE__ */ r(e, {
|
|
13
13
|
ref: m,
|
|
14
|
-
variant: _ ? "primary" : "neutral",
|
|
14
|
+
variant: _ ? v ? "danger" : "primary" : "neutral",
|
|
15
|
+
"data-invalid": v && !_ || void 0,
|
|
15
16
|
size: "sm",
|
|
16
17
|
role: "switch",
|
|
17
18
|
"aria-checked": _,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["cx","parts","Switch","forwardRef","rest","internal","setInternal","useState","defaultSelected","current","isSelected","className","Button","required","onClick","event","next","onSelectedChange","children"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import { forwardRef, useState, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Button } from \"../Button\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface SwitchProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"value\" | \"disabled\"\n> {\n /** Required state when bound to Field. */\n required?: boolean;\n isSelected?: boolean;\n defaultSelected?: boolean;\n onSelectedChange?: (isSelected: boolean) => void;\n isDisabled?: boolean;\n /** Label to the right of the track. Omit it and pass `aria-label`. */\n children?: ReactNode;\n}\n\n/** An immediate on/off — it commits as it is pressed, no Save behind it. */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n {\n isSelected,\n defaultSelected = false,\n onSelectedChange,\n isDisabled = false,\n required,\n className,\n children,\n onClick,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState(defaultSelected);\n const current = isSelected ?? internal;\n\n return (\n <label className={cx(\"ds-switch\", className)}>\n <Button\n ref={ref}\n variant={current ? \"primary\" : \"neutral\"}\n size=\"sm\"\n role=\"switch\"\n aria-checked={current}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n className=\"ds-switch__track\"\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) {\n return;\n }\n const next = !current;\n if (isSelected === undefined) {\n setInternal(next);\n }\n onSelectedChange?.(next);\n }}\n {...rest}\n >\n <span\n className=\"ds-switch__knob\"\n aria-hidden=\"true\"\n />\n </Button>\n {children && <span className=\"ds-switch__label\">{children}</span>}\n </label>\n );\n});\n"],"mappings":";;;;AAIA,SAASA,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAiBA,IAAaC,IAASC,EAA2C,SAC/D,EACE,eACA,qBAAkB,IAClB,qBACA,gBAAa,IACb,aACA,cACA,aACA,YACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAUC,KAAeC,EAASC,CAAe,GAClDC,IAAUC,KAAcL;
|
|
1
|
+
{"version":3,"file":"index.js","names":["cx","parts","Switch","forwardRef","rest","internal","setInternal","useState","defaultSelected","current","isSelected","invalid","className","Button","required","onClick","event","next","onSelectedChange","children"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import { forwardRef, useState, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Button } from \"../Button\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface SwitchProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"value\" | \"disabled\"\n> {\n /** Required state when bound to Field. */\n required?: boolean;\n isSelected?: boolean;\n defaultSelected?: boolean;\n onSelectedChange?: (isSelected: boolean) => void;\n isDisabled?: boolean;\n /** Label to the right of the track. Omit it and pass `aria-label`. */\n children?: ReactNode;\n}\n\n/** An immediate on/off — it commits as it is pressed, no Save behind it. */\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch(\n {\n isSelected,\n defaultSelected = false,\n onSelectedChange,\n isDisabled = false,\n required,\n className,\n children,\n onClick,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState(defaultSelected);\n const current = isSelected ?? internal;\n const invalid = rest[\"aria-invalid\"] === true || rest[\"aria-invalid\"] === \"true\";\n\n return (\n <label className={cx(\"ds-switch\", className)}>\n <Button\n ref={ref}\n variant={current ? (invalid ? \"danger\" : \"primary\") : \"neutral\"}\n data-invalid={(invalid && !current) || undefined}\n size=\"sm\"\n role=\"switch\"\n aria-checked={current}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n className=\"ds-switch__track\"\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) {\n return;\n }\n const next = !current;\n if (isSelected === undefined) {\n setInternal(next);\n }\n onSelectedChange?.(next);\n }}\n {...rest}\n >\n <span\n className=\"ds-switch__knob\"\n aria-hidden=\"true\"\n />\n </Button>\n {children && <span className=\"ds-switch__label\">{children}</span>}\n </label>\n );\n});\n"],"mappings":";;;;AAIA,SAASA,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAiBA,IAAaC,IAASC,EAA2C,SAC/D,EACE,eACA,qBAAkB,IAClB,qBACA,gBAAa,IACb,aACA,cACA,aACA,YACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAUC,KAAeC,EAASC,CAAe,GAClDC,IAAUC,KAAcL,GACxBM,IAAUP,EAAK,oBAAoB,MAAQA,EAAK,oBAAoB;CAE1E,OACE,kBAAC,SAAD;EAAO,WAAWJ,EAAG,aAAaY,CAAS;EAA3C,UAAA,CACE,kBAACC,GAAD;GACO;GACL,SAASJ,IAAWE,IAAU,WAAW,YAAa;GACtD,gBAAeA,KAAW,CAACF,KAAY,KAAA;GACvC,MAAK;GACL,MAAK;GACL,gBAAcA;GACd,iBAAeK,KAAY,KAAA;GACf;GACZ,WAAU;GACV,UAAU,MAAU;IAElB,IADAC,IAAUC,CAAK,GACXA,EAAM,kBACR;IAEF,IAAMC,IAAO,CAACR;IAId,AAHIC,MAAe,KAAA,KACjBJ,EAAYW,CAAI,GAElBC,IAAmBD,CAAI;GACzB;GACA,GAAIb;GAEJ,UAAA,kBAAC,QAAD;IACE,WAAU;IACV,eAAY;GACb,CAAA;EACK,CAAA,GACPe,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC"}
|
|
@@ -15,14 +15,34 @@
|
|
|
15
15
|
border-radius: var(--radius-pill);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/* An off switch is an indicator. Button's neutral variant paints it, read
|
|
19
|
+
* from the indicator ladder instead of the control ladder. */
|
|
20
|
+
.ds-switch__track[aria-checked="false"] {
|
|
21
|
+
--fill-control: var(--fill-indicator);
|
|
22
|
+
--fill-control-hover: var(--fill-indicator-hover);
|
|
23
|
+
--fill-control-pressed: var(--fill-indicator-pressed);
|
|
24
|
+
|
|
25
|
+
box-shadow: var(--indicator-edge);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-switch__track[aria-checked="false"][data-invalid] {
|
|
29
|
+
--fill-control: var(--field-invalid);
|
|
30
|
+
--fill-control-hover: var(--field-invalid);
|
|
31
|
+
--fill-control-pressed: var(--field-invalid);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-switch__track[aria-checked="true"] {
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
.ds-switch__knob {
|
|
19
39
|
position: absolute;
|
|
20
40
|
inset-block-start: 50%;
|
|
21
|
-
inset-inline-start:
|
|
41
|
+
inset-inline-start: 4px;
|
|
22
42
|
inline-size: var(--switch-knob-size);
|
|
23
43
|
block-size: var(--switch-knob-size);
|
|
24
44
|
border-radius: var(--radius-pill);
|
|
25
|
-
background: var(--
|
|
45
|
+
background: var(--color-text-muted);
|
|
26
46
|
translate: 0 -50%;
|
|
27
47
|
transition:
|
|
28
48
|
translate var(--duration-fast) var(--ease-standard),
|
|
@@ -34,11 +54,11 @@
|
|
|
34
54
|
translate: calc(var(--switch-width) - var(--switch-knob-size) - 8px) -50%;
|
|
35
55
|
}
|
|
36
56
|
|
|
37
|
-
.ds-
|
|
38
|
-
|
|
57
|
+
.ds-switch:dir(rtl) .ds-switch__track[aria-checked="true"] .ds-switch__knob {
|
|
58
|
+
translate: calc(-1 * (var(--switch-width) - var(--switch-knob-size) - 8px)) -50%;
|
|
39
59
|
}
|
|
40
60
|
|
|
41
|
-
.ds-
|
|
42
|
-
|
|
61
|
+
.ds-switch__label {
|
|
62
|
+
font-size: var(--font-size-sm);
|
|
43
63
|
}
|
|
44
64
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CD3oeiNA.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(...e){return e.filter(Boolean).join(` `)}var i=(0,t.forwardRef)(function({className:e,children:t,...i},a){return(0,n.jsx)(`div`,{ref:a,className:r(`ds-table-frame`,`ds-field-surface`,e),...i,children:t})}),a=(0,t.forwardRef)(function({start:e,end:t,className:i,...a},o){return(0,n.jsxs)(`div`,{ref:o,className:r(`ds-table-toolbar`,i),...a,children:[(0,n.jsx)(`div`,{className:`ds-table-toolbar__group`,children:e}),(0,n.jsx)(`div`,{className:`ds-table-toolbar__group`,children:t})]})});function o(e){return t.Children.toArray(e).some(e=>(0,t.isValidElement)(e)&&(e.type!==t.Fragment||o(e.props.children)))}var s=(0,t.createContext)({emptyMessage:`No data found.`}),c=(0,t.forwardRef)(function({emptyMessage:e=`No data found.`,isEmpty:t,className:i,children:a,...o},c){return(0,n.jsx)(s.Provider,{value:{emptyMessage:e,isEmpty:t},children:(0,n.jsx)(`div`,{className:`ds-table-frame__scroll`,children:(0,n.jsx)(`table`,{...o,ref:c,className:r(`ds-table`,i),children:a})})})}),l=(0,t.forwardRef)(function({className:e,...t},r){return(0,n.jsx)(`thead`,{ref:r,className:e,...t})}),u=(0,t.forwardRef)(function({className:e,children:r,...i},a){let{emptyMessage:c,isEmpty:l}=(0,t.useContext)(s);return(0,n.jsx)(`tbody`,{ref:a,className:e,...i,children:l??!o(r)?(0,n.jsx)(d,{children:(0,n.jsx)(p,{colSpan:1e3,className:`ds-table__empty-cell`,children:(0,n.jsx)(m,{title:c,role:`status`})})}):r})}),d=(0,t.forwardRef)(function({isSelected:e=!1,isInteractive:t=!1,className:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CD3oeiNA.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(...e){return e.filter(Boolean).join(` `)}var i=(0,t.forwardRef)(function({className:e,children:t,...i},a){return(0,n.jsx)(`div`,{ref:a,className:r(`ds-table-frame`,`ds-field-surface`,e),...i,children:t})}),a=(0,t.forwardRef)(function({start:e,end:t,className:i,...a},o){return(0,n.jsxs)(`div`,{ref:o,className:r(`ds-table-toolbar`,`ds-field-surface`,i),...a,children:[(0,n.jsx)(`div`,{className:`ds-table-toolbar__group`,children:e}),(0,n.jsx)(`div`,{className:`ds-table-toolbar__group`,children:t})]})});function o(e){return t.Children.toArray(e).some(e=>(0,t.isValidElement)(e)&&(e.type!==t.Fragment||o(e.props.children)))}var s=(0,t.createContext)({emptyMessage:`No data found.`}),c=(0,t.forwardRef)(function({emptyMessage:e=`No data found.`,isEmpty:t,className:i,children:a,...o},c){return(0,n.jsx)(s.Provider,{value:{emptyMessage:e,isEmpty:t},children:(0,n.jsx)(`div`,{className:`ds-table-frame__scroll`,children:(0,n.jsx)(`table`,{...o,ref:c,className:r(`ds-table`,i),children:a})})})}),l=(0,t.forwardRef)(function({className:e,...t},r){return(0,n.jsx)(`thead`,{ref:r,className:e,...t})}),u=(0,t.forwardRef)(function({className:e,children:r,...i},a){let{emptyMessage:c,isEmpty:l}=(0,t.useContext)(s);return(0,n.jsx)(`tbody`,{ref:a,className:e,...i,children:l??!o(r)?(0,n.jsx)(d,{children:(0,n.jsx)(p,{colSpan:1e3,className:`ds-table__empty-cell`,children:(0,n.jsx)(m,{title:c,role:`status`})})}):r})}),d=(0,t.forwardRef)(function({isSelected:e=!1,isInteractive:t=!1,className:i,...a},o){return(0,n.jsx)(`tr`,{ref:o,"data-selected":e||void 0,"data-interactive":t||void 0,tabIndex:t?0:void 0,className:r(`ds-field-surface`,i),...a})}),f=(0,t.forwardRef)(function({align:e=`start`,width:t=`auto`,className:r,...i},a){return(0,n.jsx)(`th`,{ref:a,scope:`col`,"data-align":e,"data-width":t,className:r,...i})}),p=(0,t.forwardRef)(function({align:e=`start`,width:t=`auto`,emphasis:r=`default`,className:i,...a},o){return(0,n.jsx)(`td`,{ref:o,"data-align":e,"data-width":t,"data-emphasis":r==="default"?void 0:r,className:i,...a})}),m=(0,t.forwardRef)(function({icon:t=`info`,title:i=`No data found.`,description:a,action:o,className:s,...c},l){return(0,n.jsxs)(`div`,{ref:l,className:r(`ds-table-empty`,s),...c,children:[(0,n.jsx)(e.t,{name:t,size:24}),(0,n.jsx)(`span`,{style:{color:`var(--color-text)`,fontWeight:`var(--font-weight-bold)`},children:i}),a&&(0,n.jsx)(`span`,{children:a}),o]})});exports.Table=c,exports.TableBody=u,exports.TableCell=p,exports.TableEmpty=m,exports.TableFrame=i,exports.TableHead=l,exports.TableHeaderCell=f,exports.TableRow=d,exports.TableToolbar=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","Children","isValidElement","Fragment","createContext","useContext","Icon","require_Icon","react","react_jsx_runtime","cx","parts","TableFrame","rest","className","TableToolbar","start","end","hasBodyContent","children","child","TableContext","Table","TableHead","TableBody","isEmpty","TableRow","TableCell","TableEmpty","emptyMessage","isSelected","isInteractive","TableHeaderCell","align","width","emphasis","icon","title","description","action"],"sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["import {\n Children,\n Fragment,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n type HTMLAttributes,\n type ReactNode,\n type TableHTMLAttributes,\n type TdHTMLAttributes,\n type ThHTMLAttributes,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface TableFrameProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n}\n\n/** The 3px collection frame every table, list and board sits inside. */\nexport const TableFrame = forwardRef<HTMLDivElement, TableFrameProps>(function TableFrame(\n { className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-frame\", \"ds-field-surface\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nexport interface TableToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** Left side — usually a select-all checkbox, a title and a count badge. */\n start?: ReactNode;\n /** Right side — filters and the one primary action. */\n end?: ReactNode;\n}\n\n/** The band above the rules: selection, title, count, filters, primary action. */\nexport const TableToolbar = forwardRef<HTMLDivElement, TableToolbarProps>(function TableToolbar(\n { start, end, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-toolbar\", className)}\n {...rest}\n >\n <div className=\"ds-table-toolbar__group\">{start}</div>\n <div className=\"ds-table-toolbar__group\">{end}</div>\n </div>\n );\n});\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n /** Message shown when a body has no rows. */\n emptyMessage?: string;\n /** Override empty-child detection when rows are rendered by custom components. */\n isEmpty?: boolean;\n children?: ReactNode;\n}\n\nfunction hasBodyContent(children: ReactNode): boolean {\n return Children.toArray(children).some(\n (child) =>\n isValidElement<{ children?: ReactNode }>(child) &&\n (child.type !== Fragment || hasBodyContent(child.props.children)),\n );\n}\n\nconst TableContext = createContext<{\n emptyMessage: string;\n isEmpty?: boolean;\n}>({ emptyMessage: \"No data found.\" });\n\n/** The rules layer. Always render it inside a `TableFrame`. */\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table(\n { emptyMessage = \"No data found.\", isEmpty, className, children, ...rest },\n ref,\n) {\n return (\n <TableContext.Provider value={{ emptyMessage, isEmpty }}>\n <div className=\"ds-table-frame__scroll\">\n <table\n {...rest}\n ref={ref}\n className={cx(\"ds-table\", className)}\n >\n {children}\n </table>\n </div>\n </TableContext.Provider>\n );\n});\n\nexport const TableHead = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableHead({ className, ...rest }, ref) {\n return (\n <thead\n ref={ref}\n className={className}\n {...rest}\n />\n );\n});\n\nexport const TableBody = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableBody({ className, children, ...rest }, ref) {\n const { emptyMessage, isEmpty } = useContext(TableContext);\n return (\n <tbody\n ref={ref}\n className={className}\n {...rest}\n >\n {(isEmpty ?? !hasBodyContent(children)) ? (\n <TableRow>\n {/* HTML's maximum span covers the row without inspecting columns. */}\n <TableCell\n colSpan={1000}\n className=\"ds-table__empty-cell\"\n >\n <TableEmpty\n title={emptyMessage}\n role=\"status\"\n />\n </TableCell>\n </TableRow>\n ) : (\n children\n )}\n </tbody>\n );\n});\n\nexport interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n /** Paints the soft fill and the solid rail. Never changes the row's size. */\n isSelected?: boolean;\n /** Marks the row clickable: hover fill plus a pointer cursor. */\n isInteractive?: boolean;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(\n { isSelected = false, isInteractive = false, className, ...rest },\n ref,\n) {\n return (\n <tr\n ref={ref}\n data-selected={isSelected || undefined}\n data-interactive={isInteractive || undefined}\n tabIndex={isInteractive ? 0 : undefined}\n className={className}\n {...rest}\n />\n );\n});\n\nexport type TableAlign = \"start\" | \"end\";\nexport type TableCellWidth = \"auto\" | \"control\";\n\nexport interface TableHeaderCellProps extends Omit<\n ThHTMLAttributes<HTMLTableCellElement>,\n \"align\"\n> {\n align?: TableAlign;\n width?: TableCellWidth;\n}\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n function TableHeaderCell({ align = \"start\", width = \"auto\", className, ...rest }, ref) {\n return (\n <th\n ref={ref}\n scope=\"col\"\n data-align={align}\n data-width={width}\n className={className}\n {...rest}\n />\n );\n },\n);\n\nexport type TableCellEmphasis = \"default\" | \"primary\" | \"muted\";\n\nexport interface TableCellProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n align?: TableAlign;\n width?: TableCellWidth;\n /** `primary` is the row's identity cell — one per row, never two. */\n emphasis?: TableCellEmphasis;\n}\n\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = \"start\", width = \"auto\", emphasis = \"default\", className, ...rest },\n ref,\n) {\n return (\n <td\n ref={ref}\n data-align={align}\n data-width={width}\n data-emphasis={emphasis === \"default\" ? undefined : emphasis}\n className={className}\n {...rest}\n />\n );\n});\n\nexport interface TableEmptyProps extends HTMLAttributes<HTMLDivElement> {\n icon?: IconName;\n title?: string;\n description?: string;\n /** One action at most — the thing that ends the empty state. */\n action?: ReactNode;\n}\n\n/** What the frame shows when the collection has no rows. */\nexport const TableEmpty = forwardRef<HTMLDivElement, TableEmptyProps>(function TableEmpty(\n { icon = \"info\", title = \"No data found.\", description, action, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-empty\", className)}\n {...rest}\n >\n <Icon\n name={icon}\n size={24}\n />\n <span style={{ color: \"var(--color-text)\", fontWeight: \"var(--font-weight-bold)\" }}>\n {title}\n </span>\n {description && <span>{description}</span>}\n {action}\n </div>\n );\n});\n"],"mappings":"A,2KAiBA,SAASU,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAOA,IAAaC,GAAA,EAAaZ,EAAAA,WAAAA,CAA4C,SACpE,CAAE,YAAW,WAAU,GAAGa,GAC1B,EACA,CACA,OACE,EAAAJ,EAAA,IAAA,CAAC,MAAD,CACO,MACL,UAAWC,EAAG,iBAAkB,mBAAoBI,CAAS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YC,EACZ,gBAAeC,IAAa,UAAY,IAAA,GAAYA,EACzC,YACX,GAAItB,CACL,CAAA,CAEL,CAAC,EAWYe,GAAA,EAAa5B,EAAAA,WAAAA,CAA4C,SACpE,CAAE,OAAO,OAAQ,QAAQ,iBAAkB,cAAa,SAAQ,YAAW,GAAGa,GAC9E,EACA,CACA,OACE,EAAAJ,EAAA,KAAA,CAAC,MAAD,CACO,MACL,UAAWC,EAAG,iBAAkBI,CAAS,EACzC,GAAID,EAHN,SAAA,EAKE,EAAAJ,EAAA,IAAA,CAACH,EAAAA,EAAD,CACE,KAAM8B,EACN,KAAM,EACP,CAAA,GACD,EAAA3B,EAAA,IAAA,CAAC,OAAD,CAAM,MAAO,CAAE,MAAO,oBAAqB,WAAY,yBAA0B,EAC9E,SAAA4B,CACG,CAAA,EACLC,IAAe,EAAA7B,EAAA,IAAA,CAAC,OAAD,CAAA,SAAO6B,CAAkB,CAAA,EACxCC,CACE,C,EAET,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","Children","isValidElement","Fragment","createContext","useContext","Icon","require_Icon","react","react_jsx_runtime","cx","parts","TableFrame","rest","className","TableToolbar","start","end","hasBodyContent","children","child","TableContext","Table","TableHead","TableBody","isEmpty","TableRow","TableCell","TableEmpty","emptyMessage","isSelected","isInteractive","TableHeaderCell","align","width","emphasis","icon","title","description","action"],"sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["import {\n Children,\n Fragment,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n type HTMLAttributes,\n type ReactNode,\n type TableHTMLAttributes,\n type TdHTMLAttributes,\n type ThHTMLAttributes,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface TableFrameProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n}\n\n/** The 3px collection frame every table, list and board sits inside. */\nexport const TableFrame = forwardRef<HTMLDivElement, TableFrameProps>(function TableFrame(\n { className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-frame\", \"ds-field-surface\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nexport interface TableToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** Left side — usually a select-all checkbox, a title and a count badge. */\n start?: ReactNode;\n /** Right side — filters and the one primary action. */\n end?: ReactNode;\n}\n\n/** The band above the rules: selection, title, count, filters, primary action. */\nexport const TableToolbar = forwardRef<HTMLDivElement, TableToolbarProps>(function TableToolbar(\n { start, end, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-toolbar\", \"ds-field-surface\", className)}\n {...rest}\n >\n <div className=\"ds-table-toolbar__group\">{start}</div>\n <div className=\"ds-table-toolbar__group\">{end}</div>\n </div>\n );\n});\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n /** Message shown when a body has no rows. */\n emptyMessage?: string;\n /** Override empty-child detection when rows are rendered by custom components. */\n isEmpty?: boolean;\n children?: ReactNode;\n}\n\nfunction hasBodyContent(children: ReactNode): boolean {\n return Children.toArray(children).some(\n (child) =>\n isValidElement<{ children?: ReactNode }>(child) &&\n (child.type !== Fragment || hasBodyContent(child.props.children)),\n );\n}\n\nconst TableContext = createContext<{\n emptyMessage: string;\n isEmpty?: boolean;\n}>({ emptyMessage: \"No data found.\" });\n\n/** The rules layer. Always render it inside a `TableFrame`. */\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table(\n { emptyMessage = \"No data found.\", isEmpty, className, children, ...rest },\n ref,\n) {\n return (\n <TableContext.Provider value={{ emptyMessage, isEmpty }}>\n <div className=\"ds-table-frame__scroll\">\n <table\n {...rest}\n ref={ref}\n className={cx(\"ds-table\", className)}\n >\n {children}\n </table>\n </div>\n </TableContext.Provider>\n );\n});\n\nexport const TableHead = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableHead({ className, ...rest }, ref) {\n return (\n <thead\n ref={ref}\n className={className}\n {...rest}\n />\n );\n});\n\nexport const TableBody = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableBody({ className, children, ...rest }, ref) {\n const { emptyMessage, isEmpty } = useContext(TableContext);\n return (\n <tbody\n ref={ref}\n className={className}\n {...rest}\n >\n {(isEmpty ?? !hasBodyContent(children)) ? (\n <TableRow>\n {/* HTML's maximum span covers the row without inspecting columns. */}\n <TableCell\n colSpan={1000}\n className=\"ds-table__empty-cell\"\n >\n <TableEmpty\n title={emptyMessage}\n role=\"status\"\n />\n </TableCell>\n </TableRow>\n ) : (\n children\n )}\n </tbody>\n );\n});\n\nexport interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n /** Paints the soft fill and the solid rail. Never changes the row's size. */\n isSelected?: boolean;\n /** Marks the row clickable: hover fill plus a pointer cursor. */\n isInteractive?: boolean;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(\n { isSelected = false, isInteractive = false, className, ...rest },\n ref,\n) {\n return (\n <tr\n ref={ref}\n data-selected={isSelected || undefined}\n data-interactive={isInteractive || undefined}\n tabIndex={isInteractive ? 0 : undefined}\n className={cx(\"ds-field-surface\", className)}\n {...rest}\n />\n );\n});\n\nexport type TableAlign = \"start\" | \"end\";\nexport type TableCellWidth = \"auto\" | \"control\";\n\nexport interface TableHeaderCellProps extends Omit<\n ThHTMLAttributes<HTMLTableCellElement>,\n \"align\"\n> {\n align?: TableAlign;\n width?: TableCellWidth;\n}\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n function TableHeaderCell({ align = \"start\", width = \"auto\", className, ...rest }, ref) {\n return (\n <th\n ref={ref}\n scope=\"col\"\n data-align={align}\n data-width={width}\n className={className}\n {...rest}\n />\n );\n },\n);\n\nexport type TableCellEmphasis = \"default\" | \"primary\" | \"muted\";\n\nexport interface TableCellProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n align?: TableAlign;\n width?: TableCellWidth;\n /** `primary` is the row's identity cell — one per row, never two. */\n emphasis?: TableCellEmphasis;\n}\n\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = \"start\", width = \"auto\", emphasis = \"default\", className, ...rest },\n ref,\n) {\n return (\n <td\n ref={ref}\n data-align={align}\n data-width={width}\n data-emphasis={emphasis === \"default\" ? undefined : emphasis}\n className={className}\n {...rest}\n />\n );\n});\n\nexport interface TableEmptyProps extends HTMLAttributes<HTMLDivElement> {\n icon?: IconName;\n title?: string;\n description?: string;\n /** One action at most — the thing that ends the empty state. */\n action?: ReactNode;\n}\n\n/** What the frame shows when the collection has no rows. */\nexport const TableEmpty = forwardRef<HTMLDivElement, TableEmptyProps>(function TableEmpty(\n { icon = \"info\", title = \"No data found.\", description, action, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-empty\", className)}\n {...rest}\n >\n <Icon\n name={icon}\n size={24}\n />\n <span style={{ color: \"var(--color-text)\", fontWeight: \"var(--font-weight-bold)\" }}>\n {title}\n </span>\n {description && <span>{description}</span>}\n {action}\n </div>\n );\n});\n"],"mappings":"A,2KAiBA,SAASU,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAOA,IAAaC,GAAA,EAAaZ,EAAAA,WAAAA,CAA4C,SACpE,CAAE,YAAW,WAAU,GAAGa,GAC1B,EACA,CACA,OACE,EAAAJ,EAAA,IAAA,CAAC,MAAD,CACO,MACL,UAAWC,EAAG,iBAAkB,mBAAoBI,CAAS,EAC7D,GAAID,EAEH,UACE,CAAA,CAET,CAAC,EAUYE,GAAA,EAAef,EAAAA,WAAAA,CAA8C,SACxE,CAAE,QAAO,MAAK,YAAW,GAAGa,GAC5B,EACA,CACA,OACE,EAAAJ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AA,WAAAA,CAA4C,SACpE,CAAE,OAAO,OAAQ,QAAQ,iBAAkB,cAAa,SAAQ,YAAW,GAAGa,GAC9E,EACA,CACA,OACE,EAAAJ,EAAA,KAAA,CAAC,MAAD,CACO,MACL,UAAWC,EAAG,iBAAkBI,CAAS,EACzC,GAAID,EAHN,SAAA,EAKE,EAAAJ,EAAA,IAAA,CAACH,EAAAA,EAAD,CACE,KAAM8B,EACN,KAAM,EACP,CAAA,GACD,EAAA3B,EAAA,IAAA,CAAC,OAAD,CAAM,MAAO,CAAE,MAAO,oBAAqB,WAAY,yBAA0B,EAC9E,SAAA4B,CACG,CAAA,EACLC,IAAe,EAAA7B,EAAA,IAAA,CAAC,OAAD,CAAA,SAAO6B,CAAkB,CAAA,EACxCC,CACE,C,EAET,CAAC,E"}
|
|
@@ -15,7 +15,7 @@ var u = i(function({ className: e, children: t, ...n }, r) {
|
|
|
15
15
|
}), d = i(function({ start: e, end: t, className: n, ...r }, i) {
|
|
16
16
|
return /* @__PURE__ */ c("div", {
|
|
17
17
|
ref: i,
|
|
18
|
-
className: l("ds-table-toolbar", n),
|
|
18
|
+
className: l("ds-table-toolbar", "ds-field-surface", n),
|
|
19
19
|
...r,
|
|
20
20
|
children: [/* @__PURE__ */ s("div", {
|
|
21
21
|
className: "ds-table-toolbar__group",
|
|
@@ -72,7 +72,7 @@ var p = r({ emptyMessage: "No data found." }), m = i(function({ emptyMessage: e
|
|
|
72
72
|
"data-selected": e || void 0,
|
|
73
73
|
"data-interactive": t || void 0,
|
|
74
74
|
tabIndex: t ? 0 : void 0,
|
|
75
|
-
className: n,
|
|
75
|
+
className: l("ds-field-surface", n),
|
|
76
76
|
...r
|
|
77
77
|
});
|
|
78
78
|
}), v = i(function({ align: e = "start", width: t = "auto", className: n, ...r }, i) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Icon","cx","parts","TableFrame","forwardRef","rest","className","TableToolbar","start","end","hasBodyContent","Children","children","isValidElement","child","Fragment","TableContext","createContext","Table","TableHead","TableBody","useContext","isEmpty","TableRow","TableCell","TableEmpty","emptyMessage","isSelected","isInteractive","TableHeaderCell","align","width","emphasis","icon","title","description","action"],"sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["import {\n Children,\n Fragment,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n type HTMLAttributes,\n type ReactNode,\n type TableHTMLAttributes,\n type TdHTMLAttributes,\n type ThHTMLAttributes,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface TableFrameProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n}\n\n/** The 3px collection frame every table, list and board sits inside. */\nexport const TableFrame = forwardRef<HTMLDivElement, TableFrameProps>(function TableFrame(\n { className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-frame\", \"ds-field-surface\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nexport interface TableToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** Left side — usually a select-all checkbox, a title and a count badge. */\n start?: ReactNode;\n /** Right side — filters and the one primary action. */\n end?: ReactNode;\n}\n\n/** The band above the rules: selection, title, count, filters, primary action. */\nexport const TableToolbar = forwardRef<HTMLDivElement, TableToolbarProps>(function TableToolbar(\n { start, end, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-toolbar\", className)}\n {...rest}\n >\n <div className=\"ds-table-toolbar__group\">{start}</div>\n <div className=\"ds-table-toolbar__group\">{end}</div>\n </div>\n );\n});\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n /** Message shown when a body has no rows. */\n emptyMessage?: string;\n /** Override empty-child detection when rows are rendered by custom components. */\n isEmpty?: boolean;\n children?: ReactNode;\n}\n\nfunction hasBodyContent(children: ReactNode): boolean {\n return Children.toArray(children).some(\n (child) =>\n isValidElement<{ children?: ReactNode }>(child) &&\n (child.type !== Fragment || hasBodyContent(child.props.children)),\n );\n}\n\nconst TableContext = createContext<{\n emptyMessage: string;\n isEmpty?: boolean;\n}>({ emptyMessage: \"No data found.\" });\n\n/** The rules layer. Always render it inside a `TableFrame`. */\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table(\n { emptyMessage = \"No data found.\", isEmpty, className, children, ...rest },\n ref,\n) {\n return (\n <TableContext.Provider value={{ emptyMessage, isEmpty }}>\n <div className=\"ds-table-frame__scroll\">\n <table\n {...rest}\n ref={ref}\n className={cx(\"ds-table\", className)}\n >\n {children}\n </table>\n </div>\n </TableContext.Provider>\n );\n});\n\nexport const TableHead = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableHead({ className, ...rest }, ref) {\n return (\n <thead\n ref={ref}\n className={className}\n {...rest}\n />\n );\n});\n\nexport const TableBody = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableBody({ className, children, ...rest }, ref) {\n const { emptyMessage, isEmpty } = useContext(TableContext);\n return (\n <tbody\n ref={ref}\n className={className}\n {...rest}\n >\n {(isEmpty ?? !hasBodyContent(children)) ? (\n <TableRow>\n {/* HTML's maximum span covers the row without inspecting columns. */}\n <TableCell\n colSpan={1000}\n className=\"ds-table__empty-cell\"\n >\n <TableEmpty\n title={emptyMessage}\n role=\"status\"\n />\n </TableCell>\n </TableRow>\n ) : (\n children\n )}\n </tbody>\n );\n});\n\nexport interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n /** Paints the soft fill and the solid rail. Never changes the row's size. */\n isSelected?: boolean;\n /** Marks the row clickable: hover fill plus a pointer cursor. */\n isInteractive?: boolean;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(\n { isSelected = false, isInteractive = false, className, ...rest },\n ref,\n) {\n return (\n <tr\n ref={ref}\n data-selected={isSelected || undefined}\n data-interactive={isInteractive || undefined}\n tabIndex={isInteractive ? 0 : undefined}\n className={className}\n {...rest}\n />\n );\n});\n\nexport type TableAlign = \"start\" | \"end\";\nexport type TableCellWidth = \"auto\" | \"control\";\n\nexport interface TableHeaderCellProps extends Omit<\n ThHTMLAttributes<HTMLTableCellElement>,\n \"align\"\n> {\n align?: TableAlign;\n width?: TableCellWidth;\n}\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n function TableHeaderCell({ align = \"start\", width = \"auto\", className, ...rest }, ref) {\n return (\n <th\n ref={ref}\n scope=\"col\"\n data-align={align}\n data-width={width}\n className={className}\n {...rest}\n />\n );\n },\n);\n\nexport type TableCellEmphasis = \"default\" | \"primary\" | \"muted\";\n\nexport interface TableCellProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n align?: TableAlign;\n width?: TableCellWidth;\n /** `primary` is the row's identity cell — one per row, never two. */\n emphasis?: TableCellEmphasis;\n}\n\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = \"start\", width = \"auto\", emphasis = \"default\", className, ...rest },\n ref,\n) {\n return (\n <td\n ref={ref}\n data-align={align}\n data-width={width}\n data-emphasis={emphasis === \"default\" ? undefined : emphasis}\n className={className}\n {...rest}\n />\n );\n});\n\nexport interface TableEmptyProps extends HTMLAttributes<HTMLDivElement> {\n icon?: IconName;\n title?: string;\n description?: string;\n /** One action at most — the thing that ends the empty state. */\n action?: ReactNode;\n}\n\n/** What the frame shows when the collection has no rows. */\nexport const TableEmpty = forwardRef<HTMLDivElement, TableEmptyProps>(function TableEmpty(\n { icon = \"info\", title = \"No data found.\", description, action, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-empty\", className)}\n {...rest}\n >\n <Icon\n name={icon}\n size={24}\n />\n <span style={{ color: \"var(--color-text)\", fontWeight: \"var(--font-weight-bold)\" }}>\n {title}\n </span>\n {description && <span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ACO;EACL,WAAWJ,EAAG,kBAAkBK,CAAS;EACzC,GAAID;EAHN,UAAA;GAKE,kBAACL,GAAD;IACE,MAAMiC;IACN,MAAM;GACP,CAAA;GACD,kBAAC,QAAD;IAAM,OAAO;KAAE,OAAO;KAAqB,YAAY;IAA0B;IAC9E,UAAAC;GACG,CAAA;GACLC,KAAe,kBAAC,QAAD,EAAA,UAAOA,EAAkB,CAAA;GACxCC;EACE;;AAET,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Icon","cx","parts","TableFrame","forwardRef","rest","className","TableToolbar","start","end","hasBodyContent","Children","children","isValidElement","child","Fragment","TableContext","createContext","Table","TableHead","TableBody","useContext","isEmpty","TableRow","TableCell","TableEmpty","emptyMessage","isSelected","isInteractive","TableHeaderCell","align","width","emphasis","icon","title","description","action"],"sources":["../../../src/components/Table/index.tsx"],"sourcesContent":["import {\n Children,\n Fragment,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n type HTMLAttributes,\n type ReactNode,\n type TableHTMLAttributes,\n type TdHTMLAttributes,\n type ThHTMLAttributes,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface TableFrameProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n}\n\n/** The 3px collection frame every table, list and board sits inside. */\nexport const TableFrame = forwardRef<HTMLDivElement, TableFrameProps>(function TableFrame(\n { className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-frame\", \"ds-field-surface\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nexport interface TableToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /** Left side — usually a select-all checkbox, a title and a count badge. */\n start?: ReactNode;\n /** Right side — filters and the one primary action. */\n end?: ReactNode;\n}\n\n/** The band above the rules: selection, title, count, filters, primary action. */\nexport const TableToolbar = forwardRef<HTMLDivElement, TableToolbarProps>(function TableToolbar(\n { start, end, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-toolbar\", \"ds-field-surface\", className)}\n {...rest}\n >\n <div className=\"ds-table-toolbar__group\">{start}</div>\n <div className=\"ds-table-toolbar__group\">{end}</div>\n </div>\n );\n});\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n /** Message shown when a body has no rows. */\n emptyMessage?: string;\n /** Override empty-child detection when rows are rendered by custom components. */\n isEmpty?: boolean;\n children?: ReactNode;\n}\n\nfunction hasBodyContent(children: ReactNode): boolean {\n return Children.toArray(children).some(\n (child) =>\n isValidElement<{ children?: ReactNode }>(child) &&\n (child.type !== Fragment || hasBodyContent(child.props.children)),\n );\n}\n\nconst TableContext = createContext<{\n emptyMessage: string;\n isEmpty?: boolean;\n}>({ emptyMessage: \"No data found.\" });\n\n/** The rules layer. Always render it inside a `TableFrame`. */\nexport const Table = forwardRef<HTMLTableElement, TableProps>(function Table(\n { emptyMessage = \"No data found.\", isEmpty, className, children, ...rest },\n ref,\n) {\n return (\n <TableContext.Provider value={{ emptyMessage, isEmpty }}>\n <div className=\"ds-table-frame__scroll\">\n <table\n {...rest}\n ref={ref}\n className={cx(\"ds-table\", className)}\n >\n {children}\n </table>\n </div>\n </TableContext.Provider>\n );\n});\n\nexport const TableHead = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableHead({ className, ...rest }, ref) {\n return (\n <thead\n ref={ref}\n className={className}\n {...rest}\n />\n );\n});\n\nexport const TableBody = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableBody({ className, children, ...rest }, ref) {\n const { emptyMessage, isEmpty } = useContext(TableContext);\n return (\n <tbody\n ref={ref}\n className={className}\n {...rest}\n >\n {(isEmpty ?? !hasBodyContent(children)) ? (\n <TableRow>\n {/* HTML's maximum span covers the row without inspecting columns. */}\n <TableCell\n colSpan={1000}\n className=\"ds-table__empty-cell\"\n >\n <TableEmpty\n title={emptyMessage}\n role=\"status\"\n />\n </TableCell>\n </TableRow>\n ) : (\n children\n )}\n </tbody>\n );\n});\n\nexport interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n /** Paints the soft fill and the solid rail. Never changes the row's size. */\n isSelected?: boolean;\n /** Marks the row clickable: hover fill plus a pointer cursor. */\n isInteractive?: boolean;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(\n { isSelected = false, isInteractive = false, className, ...rest },\n ref,\n) {\n return (\n <tr\n ref={ref}\n data-selected={isSelected || undefined}\n data-interactive={isInteractive || undefined}\n tabIndex={isInteractive ? 0 : undefined}\n className={cx(\"ds-field-surface\", className)}\n {...rest}\n />\n );\n});\n\nexport type TableAlign = \"start\" | \"end\";\nexport type TableCellWidth = \"auto\" | \"control\";\n\nexport interface TableHeaderCellProps extends Omit<\n ThHTMLAttributes<HTMLTableCellElement>,\n \"align\"\n> {\n align?: TableAlign;\n width?: TableCellWidth;\n}\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n function TableHeaderCell({ align = \"start\", width = \"auto\", className, ...rest }, ref) {\n return (\n <th\n ref={ref}\n scope=\"col\"\n data-align={align}\n data-width={width}\n className={className}\n {...rest}\n />\n );\n },\n);\n\nexport type TableCellEmphasis = \"default\" | \"primary\" | \"muted\";\n\nexport interface TableCellProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n align?: TableAlign;\n width?: TableCellWidth;\n /** `primary` is the row's identity cell — one per row, never two. */\n emphasis?: TableCellEmphasis;\n}\n\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = \"start\", width = \"auto\", emphasis = \"default\", className, ...rest },\n ref,\n) {\n return (\n <td\n ref={ref}\n data-align={align}\n data-width={width}\n data-emphasis={emphasis === \"default\" ? undefined : emphasis}\n className={className}\n {...rest}\n />\n );\n});\n\nexport interface TableEmptyProps extends HTMLAttributes<HTMLDivElement> {\n icon?: IconName;\n title?: string;\n description?: string;\n /** One action at most — the thing that ends the empty state. */\n action?: ReactNode;\n}\n\n/** What the frame shows when the collection has no rows. */\nexport const TableEmpty = forwardRef<HTMLDivElement, TableEmptyProps>(function TableEmpty(\n { icon = \"info\", title = \"No data found.\", description, action, className, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cx(\"ds-table-empty\", className)}\n {...rest}\n >\n <Icon\n name={icon}\n size={24}\n />\n <span style={{ color: \"var(--color-text)\", fontWeight: \"var(--font-weight-bold)\" }}>\n {title}\n </span>\n {description && <span>{description}</span>}\n {action}\n </div>\n );\n});\n"],"mappings":";;;;AAiBA,SAASC,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAOA,IAAaC,IAAaC,EAA4C,SACpE,EAAE,cAAW,aAAU,GAAGC,KAC1B,GACA;CACA,OACE,kBAAC,OAAD;EACO;EACL,WAAWJ,EAAG,kBAAkB,oBAAoBK,CAAS;EAC7D,GAAID;EAEH;CACE,CAAA;AAET,CAAC,GAUYE,IAAeH,EAA8C,SACxE,EAAE,UAAO,QAAK,cAAW,GAAGC,KAC5B,GACA;CACA,OACE,kBAAC,OAAD;EACO;EACL,WAAWJ,EAAG,oBAAoB,oBAAoBK,CAAS;EAC/D,GAAID;EAHN,UAAA,CAKE,kBAAC,OAAD;GAAK,WAAU;GAA2B,UAAAG;EAAW,CAAA,GACrD,kBAAC,OAAD;GAAK,WAAU;GAA2B,UAAAC;EAAS,CAAA,CAChD;;AAET,CAAC;AAUD,SAASC,EAAe,GAA8B;CACpD,OAAOC,EAAS,QAAQC,CAAQ,CAAC,CAAC,MAC/B,MACCC,EAAyCC,CAAK,MAC7CA,EAAM,SAASC,KAAYL,EAAeI,EAAM,MAAM,QAAQ,EACnE;AACF;AAEA,IAAME,IAAeC,EAGlB,EA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