@common-origin/design-system 3.1.0 → 3.3.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/client.js +1050 -722
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.d.mts +2 -2
- package/dist/components/atoms/Badge/Badge.d.ts +2 -2
- package/dist/components/atoms/Badge/Badge.mjs +15 -9
- package/dist/components/atoms/Box/Box.d.mts +3 -2
- package/dist/components/atoms/Box/Box.d.ts +3 -2
- package/dist/components/atoms/Button/Button.mjs +1 -1
- package/dist/components/atoms/Chip/shared/ChipBase.mjs +1 -1
- package/dist/components/atoms/Icon/Icon.d.mts +1 -1
- package/dist/components/atoms/Icon/Icon.d.ts +1 -1
- package/dist/components/atoms/Icon/Icon.mjs +35 -10
- package/dist/components/atoms/IconButton/IconButton.mjs +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.mts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/Tag/Tag.d.mts +1 -1
- package/dist/components/atoms/Tag/Tag.d.ts +1 -1
- package/dist/components/atoms/Tooltip/Tooltip.d.mts +7 -1
- package/dist/components/atoms/Tooltip/Tooltip.d.ts +7 -1
- package/dist/components/atoms/Tooltip/Tooltip.mjs +18 -8
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +2 -2
- package/dist/components/molecules/Alert/Alert.mjs +1 -1
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +1 -1
- package/dist/components/molecules/Dropdown/Dropdown.mjs +1 -1
- package/dist/components/molecules/List/ListItem.mjs +3 -3
- package/dist/components/molecules/Menu/Menu.d.mts +8 -1
- package/dist/components/molecules/Menu/Menu.d.ts +8 -1
- package/dist/components/molecules/Menu/Menu.mjs +12 -9
- package/dist/components/molecules/Modal/Modal.mjs +1 -1
- package/dist/components/molecules/NumberInput/NumberInput.mjs +2 -1
- package/dist/components/molecules/PasswordField/PasswordField.mjs +3 -2
- package/dist/components/molecules/SearchField/SearchField.mjs +3 -3
- package/dist/components/molecules/Sheet/Sheet.mjs +3 -3
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.mts +3 -2
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.ts +3 -2
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs +128 -41
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.mts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.d.ts +30 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs +69 -0
- package/dist/components/molecules/SidebarNavItem/sidebarNavMotion.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs +57 -43
- package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs +3 -1
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs +173 -62
- package/dist/data.js +2680 -190
- package/dist/data.js.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/statusShapes.mjs +1 -1
- package/dist/lib/statusShapes.mjs.map +1 -1
- package/dist/lib/styleUtils.d.mts +4 -0
- package/dist/lib/styleUtils.d.ts +4 -0
- package/dist/lib/styleUtils.mjs +5 -1
- package/dist/lib/styleUtils.mjs.map +1 -1
- package/dist/lib/tokenAliases.mjs +1 -0
- package/dist/lib/tokenAliases.mjs.map +1 -1
- package/dist/lib/useFloatingLayer.d.mts +8 -1
- package/dist/lib/useFloatingLayer.d.ts +8 -1
- package/dist/lib/useFloatingLayer.mjs +11 -2
- package/dist/lib/useFloatingLayer.mjs.map +1 -1
- package/dist/styles/iconSet.json.mjs +2442 -0
- package/dist/styles/iconSet.json.mjs.map +1 -0
- package/dist/styles/tokens.d.mts +93 -24
- package/dist/styles/tokens.d.ts +93 -24
- package/dist/styles/tokens.json +96 -59
- package/dist/styles/tokens.json.mjs +96 -59
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +96 -59
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +96 -59
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +93 -24
- package/dist/tokens/styles/tokens.d.ts +93 -24
- package/dist/tokens.css +1105 -74
- package/dist/types/iconSet.d.mts +6 -0
- package/dist/types/iconSet.d.ts +6 -0
- package/dist/types/iconSet.mjs +12 -0
- package/dist/types/iconSet.mjs.map +1 -0
- package/dist/types/icons.d.mts +58 -6
- package/dist/types/icons.d.ts +58 -6
- package/dist/types/icons.mjs +5 -0
- package/dist/types/icons.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import styled$module, { css } from 'styled-components';
|
|
4
|
+
const styled = styled$module.default || styled$module;
|
|
5
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
6
|
+
import { reducedMotion } from '../../../lib/styleUtils.mjs';
|
|
7
|
+
|
|
8
|
+
// How SidebarNav's pieces move between expanded and the rail (issue 348), shared by the nav, its rows
|
|
9
|
+
// and its sections so they move as one: nothing unmounts or re-lays out mid-move.
|
|
10
|
+
var semantic = tokens.semantic,
|
|
11
|
+
component = tokens.component;
|
|
12
|
+
var motion = semantic.motion,
|
|
13
|
+
space = semantic.space,
|
|
14
|
+
size = semantic.size;
|
|
15
|
+
/**
|
|
16
|
+
* SidebarNav sets this on itself: its expanded width. Content inside keeps that width while the nav
|
|
17
|
+
* narrows, so the nav's edge clips it instead of it reflowing or ellipsising mid-move.
|
|
18
|
+
*/
|
|
19
|
+
var EXPANDED_WIDTH_VAR = '--co-sidebar-nav-expanded';
|
|
20
|
+
/**
|
|
21
|
+
* SidebarNav sets this to its body's scrollbar width (0 for overlay scrollbars), measured while
|
|
22
|
+
* expanded, since a classic scrollbar narrows every row
|
|
23
|
+
*/
|
|
24
|
+
var SCROLLBAR_VAR = '--co-sidebar-nav-scrollbar';
|
|
25
|
+
/** The nav's own side padding: the rail's inner width is the rail less twice this */
|
|
26
|
+
var NAV_PADDING = space[200];
|
|
27
|
+
/** A row's left inset: centres an icon in the rail, and stays the same expanded, so icons never move */
|
|
28
|
+
var ROW_INSET = "calc((".concat(component.sidebarNav.width.rail, " - 2 * ").concat(NAV_PADDING, " - ").concat(size.icon.md, ") / 2)");
|
|
29
|
+
/**
|
|
30
|
+
* Fades content that the rail doesn't show (labels, meta text, the badge count, the header and
|
|
31
|
+
* footer). Leaving is quick and accelerates; arriving decelerates over the width's duration (0037).
|
|
32
|
+
* Hidden content also leaves the keyboard and screen readers once the fade ends.
|
|
33
|
+
*/
|
|
34
|
+
var fade = function fade(hidden) {
|
|
35
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n opacity: ", ";\n /* Shown content inherits, so anything hidden around it (a folded section) still wins */\n visibility: ", ";\n transition: ", ";\n"], ["\n opacity: ", ";\n /* Shown content inherits, so anything hidden around it (a folded section) still wins */\n visibility: ", ";\n transition: ", ";\n"
|
|
36
|
+
/**
|
|
37
|
+
* Folds something away (its height animates to nothing, with a fade), for what the rail leaves out:
|
|
38
|
+
* a section's header, a section with nothing to show, an item without an icon. Under reduced motion
|
|
39
|
+
* the height changes at once and only the fade remains (0015).
|
|
40
|
+
*/])), hidden ? 0 : 1, hidden ? 'hidden' : 'inherit', hidden ? "opacity ".concat(motion.duration.fast, " ").concat(motion.easing.accelerate, ", visibility ").concat(motion.duration.fast, " ").concat(motion.easing.accelerate) : "opacity ".concat(motion.duration.moderate, " ").concat(motion.easing.decelerate, ", visibility ").concat(motion.duration.moderate, " ").concat(motion.easing.decelerate));
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Folds something away (its height animates to nothing, with a fade), for what the rail leaves out:
|
|
44
|
+
* a section's header, a section with nothing to show, an item without an icon. Under reduced motion
|
|
45
|
+
* the height changes at once and only the fade remains (0015).
|
|
46
|
+
*/
|
|
47
|
+
var Fold = /*#__PURE__*/styled.div.withConfig({
|
|
48
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
49
|
+
return !prop.startsWith('$');
|
|
50
|
+
},
|
|
51
|
+
displayName: "sidebarNavMotion__Fold",
|
|
52
|
+
componentId: "sc-1h4byrj-0"
|
|
53
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid;\n grid-template-rows: ", ";\n ", "\n transition: grid-template-rows ", " ", ",\n ", ";\n\n /* Clipped only while folded: once open, focus rings outside a control aren't cut off */\n & > * {\n min-height: 0;\n overflow: ", ";\n }\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n"], ["\n display: grid;\n grid-template-rows: ", ";\n ", "\n transition: grid-template-rows ", " ", ",\n ", ";\n\n /* Clipped only while folded: once open, focus rings outside a control aren't cut off */\n & > * {\n min-height: 0;\n overflow: ", ";\n }\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n"])), function (_a) {
|
|
54
|
+
var $open = _a.$open;
|
|
55
|
+
return $open ? '1fr' : '0fr';
|
|
56
|
+
}, function (_a) {
|
|
57
|
+
var $open = _a.$open;
|
|
58
|
+
return fade(!$open);
|
|
59
|
+
}, motion.duration.moderate, motion.easing.decelerate, function (_a) {
|
|
60
|
+
var $open = _a.$open;
|
|
61
|
+
return $open ? "opacity ".concat(motion.duration.moderate, " ").concat(motion.easing.decelerate, ", visibility ").concat(motion.duration.moderate, " ").concat(motion.easing.decelerate) : "opacity ".concat(motion.duration.fast, " ").concat(motion.easing.accelerate, ", visibility ").concat(motion.duration.moderate, " ").concat(motion.easing.accelerate);
|
|
62
|
+
}, function (_a) {
|
|
63
|
+
var $open = _a.$open;
|
|
64
|
+
return $open ? 'visible' : 'hidden';
|
|
65
|
+
}, reducedMotion, motion.duration.fast, motion.easing.decelerate, motion.duration.fast, motion.easing.decelerate);
|
|
66
|
+
var templateObject_1, templateObject_2;
|
|
67
|
+
|
|
68
|
+
export { EXPANDED_WIDTH_VAR, Fold, NAV_PADDING, ROW_INSET, SCROLLBAR_VAR, fade };
|
|
69
|
+
//# sourceMappingURL=sidebarNavMotion.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebarNavMotion.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
-
import {
|
|
4
|
-
import { useId, useState, useEffect } from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import React, { useId, useState, useEffect } from 'react';
|
|
5
5
|
import styled$module, { css } from 'styled-components';
|
|
6
6
|
const styled = styled$module.default || styled$module;
|
|
7
7
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
8
|
import tokensJson from '../../../styles/tokens.json.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { rowRadius, interactiveRow, reducedMotion } from '../../../lib/styleUtils.mjs';
|
|
10
10
|
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
11
11
|
import { useSidebarNav } from '../SidebarNavItem/SidebarNavContext.mjs';
|
|
12
|
+
import { SidebarNavItem } from '../SidebarNavItem/SidebarNavItem.mjs';
|
|
13
|
+
import { Fold } from '../SidebarNavItem/sidebarNavMotion.mjs';
|
|
12
14
|
|
|
13
15
|
// How long the items take to show or hide: the clip lifts after this even if no transition ran
|
|
14
16
|
// (reduced motion, or a background tab)
|
|
@@ -17,46 +19,44 @@ var semantic = tokens.semantic;
|
|
|
17
19
|
var space = semantic.space,
|
|
18
20
|
color = semantic.color,
|
|
19
21
|
motion = semantic.motion,
|
|
20
|
-
radius = semantic.radius,
|
|
21
22
|
size = semantic.size,
|
|
22
23
|
border = semantic.border,
|
|
23
24
|
typography = semantic.typography;
|
|
24
|
-
|
|
25
|
+
// The space above a section is the same expanded and in the rail, so the switch never shifts rows;
|
|
26
|
+
// only the rule's colour changes: clear when the label separates the section, visible in the rail,
|
|
27
|
+
// where there's no label (issue 348)
|
|
28
|
+
var Section = /*#__PURE__*/styled(Fold).withConfig({
|
|
25
29
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
26
30
|
return !prop.startsWith('$');
|
|
27
31
|
},
|
|
28
32
|
displayName: "SidebarNavSection__Section",
|
|
29
33
|
componentId: "sc-16cbmnb-0"
|
|
30
|
-
})(
|
|
34
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-top: ", ";\n padding-top: ", ";\n border-top: ", " solid ", ";\n\n /* Nothing above to separate it from */\n &:first-child {\n margin-top: 0;\n padding-top: 0;\n border-top: none;\n }\n"], ["\n margin-top: ", ";\n padding-top: ", ";\n border-top: ", " solid ", ";\n\n /* Nothing above to separate it from */\n &:first-child {\n margin-top: 0;\n padding-top: 0;\n border-top: none;\n }\n"])), space[200], space[100], border.width.thin, function (_a) {
|
|
31
35
|
var $collapsed = _a.$collapsed;
|
|
32
|
-
return $collapsed
|
|
36
|
+
return $collapsed ? color.border["default"] : 'transparent';
|
|
33
37
|
});
|
|
34
38
|
var Header = /*#__PURE__*/styled.div.withConfig({
|
|
35
39
|
displayName: "SidebarNavSection__Header",
|
|
36
40
|
componentId: "sc-16cbmnb-1"
|
|
37
|
-
})(
|
|
41
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n min-height: ", ";\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n min-height: ", ";\n"
|
|
38
42
|
// The label's look: quiet, small and muted, so the items lead
|
|
39
43
|
])), space[100], size.row.sm);
|
|
40
44
|
// The label's look: quiet, small and muted, so the items lead
|
|
41
|
-
var labelText = css(
|
|
45
|
+
var labelText = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font: ", ";\n color: ", ";\n"], ["\n font: ", ";\n color: ", ";\n"])), typography.caption, color.text.muted);
|
|
42
46
|
var StaticLabel = /*#__PURE__*/styled.div.withConfig({
|
|
43
47
|
displayName: "SidebarNavSection__StaticLabel",
|
|
44
48
|
componentId: "sc-16cbmnb-2"
|
|
45
|
-
})(
|
|
46
|
-
var HiddenLabel = /*#__PURE__*/styled.div.withConfig({
|
|
47
|
-
displayName: "SidebarNavSection__HiddenLabel",
|
|
48
|
-
componentId: "sc-16cbmnb-3"
|
|
49
|
-
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), visuallyHidden);
|
|
49
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n flex: 1;\n min-width: 0;\n padding: 0 ", ";\n"], ["\n ", "\n flex: 1;\n min-width: 0;\n padding: 0 ", ";\n"])), labelText, space.inset.sm);
|
|
50
50
|
var Disclosure = /*#__PURE__*/styled.button.withConfig({
|
|
51
51
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
52
52
|
return !prop.startsWith('$');
|
|
53
53
|
},
|
|
54
54
|
displayName: "SidebarNavSection__Disclosure",
|
|
55
|
-
componentId: "sc-16cbmnb-
|
|
56
|
-
})(
|
|
55
|
+
componentId: "sc-16cbmnb-3"
|
|
56
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n display: flex;\n align-items: center;\n gap: ", ";\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n min-height: ", ";\n padding: 0 ", ";\n border: none;\n border-radius: ", ";\n background: none;\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ";\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n\n /* The caret points down when shown and right when hidden */\n & > span:first-child {\n transition: transform ", " ", ";\n transform: rotate(", ");\n }\n\n ", " {\n & > span:first-child {\n transition: none;\n }\n }\n"], ["\n ", "\n display: flex;\n align-items: center;\n gap: ", ";\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n min-height: ", ";\n padding: 0 ", ";\n border: none;\n border-radius: ", ";\n background: none;\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ";\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n\n /* The caret points down when shown and right when hidden */\n & > span:first-child {\n transition: transform ", " ", ";\n transform: rotate(", ");\n }\n\n ", " {\n & > span:first-child {\n transition: none;\n }\n }\n"
|
|
57
57
|
// The items' height animates from nothing to their own height with grid rows, so no
|
|
58
58
|
// "no limit" max-height is needed. Once hidden, the items leave the keyboard and screen readers.
|
|
59
|
-
])), labelText, space[100], size.row.sm, space.inset.sm,
|
|
59
|
+
])), labelText, space[100], size.row.sm, space.inset.sm, rowRadius, motion.duration.fast, motion.easing.decelerate, interactiveRow(), border.focus, border.focusOffset, motion.duration.fast, motion.easing.standard, function (_a) {
|
|
60
60
|
var $expanded = _a.$expanded;
|
|
61
61
|
return $expanded ? '0deg' : '-90deg';
|
|
62
62
|
}, reducedMotion);
|
|
@@ -67,24 +67,27 @@ var Collapse = /*#__PURE__*/styled.div.withConfig({
|
|
|
67
67
|
return !prop.startsWith('$');
|
|
68
68
|
},
|
|
69
69
|
displayName: "SidebarNavSection__Collapse",
|
|
70
|
-
componentId: "sc-16cbmnb-
|
|
71
|
-
})(
|
|
70
|
+
componentId: "sc-16cbmnb-4"
|
|
71
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: grid;\n grid-template-rows: ", ";\n opacity: ", ";\n /* Shown items inherit, so a section folded away in the rail hides them too */\n visibility: ", ";\n /* The items fold and fade together (issue 348) */\n transition: grid-template-rows ", " ", ",\n opacity ", " ", ",\n visibility ", " ", ";\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n"], ["\n display: grid;\n grid-template-rows: ", ";\n opacity: ", ";\n /* Shown items inherit, so a section folded away in the rail hides them too */\n visibility: ", ";\n /* The items fold and fade together (issue 348) */\n transition: grid-template-rows ", " ", ",\n opacity ", " ", ",\n visibility ", " ", ";\n\n ", " {\n transition: opacity ", " ", ",\n visibility ", " ", ";\n }\n"
|
|
72
72
|
// Clipped only while hidden or moving: once shown, an item's Badge can overhang its row
|
|
73
73
|
])), function (_a) {
|
|
74
74
|
var $expanded = _a.$expanded;
|
|
75
75
|
return $expanded ? '1fr' : '0fr';
|
|
76
76
|
}, function (_a) {
|
|
77
77
|
var $expanded = _a.$expanded;
|
|
78
|
-
return $expanded ?
|
|
79
|
-
},
|
|
78
|
+
return $expanded ? 1 : 0;
|
|
79
|
+
}, function (_a) {
|
|
80
|
+
var $expanded = _a.$expanded;
|
|
81
|
+
return $expanded ? 'inherit' : 'hidden';
|
|
82
|
+
}, motion.duration.moderate, motion.easing.decelerate, motion.duration.moderate, motion.easing.decelerate, motion.duration.moderate, motion.easing.decelerate, reducedMotion, motion.duration.fast, motion.easing.decelerate, motion.duration.fast, motion.easing.decelerate);
|
|
80
83
|
// Clipped only while hidden or moving: once shown, an item's Badge can overhang its row
|
|
81
84
|
var List = /*#__PURE__*/styled.ul.withConfig({
|
|
82
85
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
83
86
|
return !prop.startsWith('$');
|
|
84
87
|
},
|
|
85
88
|
displayName: "SidebarNavSection__List",
|
|
86
|
-
componentId: "sc-16cbmnb-
|
|
87
|
-
})(
|
|
89
|
+
componentId: "sc-16cbmnb-5"
|
|
90
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n min-height: 0;\n overflow: ", ";\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n"], ["\n min-height: 0;\n overflow: ", ";\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n"
|
|
88
91
|
/**
|
|
89
92
|
* A labelled group of SidebarNavItems (#328), optionally collapsible, with one optional action.
|
|
90
93
|
* In the rail its label and action are hidden and a rule separates it from the section above.
|
|
@@ -137,12 +140,14 @@ var SidebarNavSection = function SidebarNavSection(_a) {
|
|
|
137
140
|
if (!isControlled) setUncontrolledExpanded(next);
|
|
138
141
|
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(next);
|
|
139
142
|
};
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
})
|
|
143
|
+
// The rail shows items by their icons only; a section with none has nothing to show there, so it
|
|
144
|
+
// isn't drawn at all, not even its separating rule. Items wrapped in other components count as
|
|
145
|
+
// showing, since their icons can't be seen from here.
|
|
146
|
+
var showsInRail = React.Children.toArray(children).some(function (child) {
|
|
147
|
+
return ! /*#__PURE__*/React.isValidElement(child) || child.type !== SidebarNavItem || Boolean(child.props.icon);
|
|
148
|
+
});
|
|
149
|
+
// The header stays mounted, folding away in the rail; the list keeps its name from it there
|
|
150
|
+
var header = jsxs(Header, {
|
|
146
151
|
children: [collapsible ? jsxs(Disclosure, {
|
|
147
152
|
type: "button",
|
|
148
153
|
id: labelId,
|
|
@@ -162,27 +167,36 @@ var SidebarNavSection = function SidebarNavSection(_a) {
|
|
|
162
167
|
});
|
|
163
168
|
return (
|
|
164
169
|
// In a SidebarNav the body is one list, so the section is one of its items
|
|
165
|
-
|
|
170
|
+
// In the rail, a section with nothing to show folds away, rule and all
|
|
171
|
+
jsx(Section, {
|
|
166
172
|
as: inNav ? 'li' : 'div',
|
|
173
|
+
"$open": !collapsed || showsInRail,
|
|
167
174
|
"$collapsed": collapsed,
|
|
168
175
|
"data-testid": dataTestId,
|
|
169
|
-
children:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
children: jsxs("div", {
|
|
177
|
+
children: [jsx(Fold, {
|
|
178
|
+
"$open": !collapsed,
|
|
179
|
+
children: jsx("div", {
|
|
180
|
+
children: header
|
|
181
|
+
})
|
|
182
|
+
}), jsx(Collapse, {
|
|
183
|
+
"$expanded": expanded,
|
|
184
|
+
onTransitionEnd: function onTransitionEnd(event) {
|
|
185
|
+
if (event.target === event.currentTarget && event.propertyName === 'grid-template-rows') setAnimating(false);
|
|
186
|
+
},
|
|
187
|
+
children: jsx(List, {
|
|
188
|
+
id: listId,
|
|
189
|
+
"aria-labelledby": labelId,
|
|
190
|
+
"$clip": !expanded || animating,
|
|
191
|
+
children: children
|
|
192
|
+
})
|
|
193
|
+
})]
|
|
194
|
+
})
|
|
181
195
|
})
|
|
182
196
|
);
|
|
183
197
|
};
|
|
184
198
|
SidebarNavSection.displayName = 'SidebarNavSection';
|
|
185
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7
|
|
199
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
186
200
|
|
|
187
201
|
export { SidebarNavSection };
|
|
188
202
|
//# sourceMappingURL=SidebarNavSection.mjs.map
|
|
@@ -5,7 +5,7 @@ import { useRef, useState, useEffect } from 'react';
|
|
|
5
5
|
import styled$module from 'styled-components';
|
|
6
6
|
const styled = styled$module.default || styled$module;
|
|
7
7
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
-
import { forcedColors } from '../../../lib/styleUtils.mjs';
|
|
8
|
+
import { rowRadius, forcedColors } from '../../../lib/styleUtils.mjs';
|
|
9
9
|
|
|
10
10
|
var semantic = tokens.semantic;
|
|
11
11
|
var StyledTabList = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -20,7 +20,7 @@ var StyledTab = /*#__PURE__*/styled.button.withConfig({
|
|
|
20
20
|
componentId: "sc-1g9ib0y-1"
|
|
21
21
|
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n padding: ", " ", ";\n font: ", ";\n white-space: nowrap;\n cursor: ", ";\n border: none;\n background: transparent;\n transition: ", ";\n position: relative;\n \n /* Selected tab: the light-blue selected treatment plus a blue underline (decisions 0016, 0020).\n The text darkens with the fill on hover and press so every state stays at least 4.5:1. */\n border-radius: ", " ", " 0 0;\n background-color: ", ";\n color: ", ";\n\n &::after {\n content: '';\n position: absolute;\n bottom: -1px;\n left: 0;\n right: 0;\n height: ", ";\n background-color: ", ";\n transition: ", ";\n }\n\n /* Forced colours drop the fill, so the selected tab's underline carries its state in the\n system selection colour (decision 0038) */\n ", " {\n &::after {\n forced-color-adjust: none;\n background-color: ", ";\n }\n }\n\n &:hover:not(:disabled) {\n background-color: ", ";\n color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n color: ", ";\n }\n\n /* Disabled state */\n opacity: ", ";\n \n /* Focus state */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n z-index: 1;\n }\n\n"], ["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n padding: ", " ", ";\n font: ", ";\n white-space: nowrap;\n cursor: ", ";\n border: none;\n background: transparent;\n transition: ", ";\n position: relative;\n \n /* Selected tab: the light-blue selected treatment plus a blue underline (decisions 0016, 0020).\n The text darkens with the fill on hover and press so every state stays at least 4.5:1. */\n border-radius: ", " ", " 0 0;\n background-color: ", ";\n color: ", ";\n\n &::after {\n content: '';\n position: absolute;\n bottom: -1px;\n left: 0;\n right: 0;\n height: ", ";\n background-color: ", ";\n transition: ", ";\n }\n\n /* Forced colours drop the fill, so the selected tab's underline carries its state in the\n system selection colour (decision 0038) */\n ", " {\n &::after {\n forced-color-adjust: none;\n background-color: ", ";\n }\n }\n\n &:hover:not(:disabled) {\n background-color: ", ";\n color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n color: ", ";\n }\n\n /* Disabled state */\n opacity: ", ";\n \n /* Focus state */\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n z-index: 1;\n }\n\n"])), semantic.space[200], semantic.space[300], semantic.space[400], tokens.component.button.sizes.medium.font, function (props) {
|
|
22
22
|
return props.$disabled ? 'not-allowed' : 'pointer';
|
|
23
|
-
}, semantic.motion.transition.feedback,
|
|
23
|
+
}, semantic.motion.transition.feedback, rowRadius, rowRadius, function (props) {
|
|
24
24
|
return props.$isActive ? semantic.color.fill['accent-muted'] : 'transparent';
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return props.$isActive ? semantic.color.text.accent : semantic.color.text.muted;
|
|
@@ -63,7 +63,7 @@ var StyledBadge = /*#__PURE__*/styled.span.withConfig({
|
|
|
63
63
|
* onTabChange={setActiveTab}
|
|
64
64
|
* />
|
|
65
65
|
* ```
|
|
66
|
-
*/])), tokens.component.tabBar.badge.size, tokens.component.tabBar.badge.size, semantic.space[100], tokens.component.tabBar.badge.typography, tokens.component.tabBar.badge.fontWeight, semantic.radius.full, semantic.color.fill.accent, semantic.color.text
|
|
66
|
+
*/])), tokens.component.tabBar.badge.size, tokens.component.tabBar.badge.size, semantic.space[100], tokens.component.tabBar.badge.typography, tokens.component.tabBar.badge.fontWeight, semantic.radius.full, semantic.color.fill.accent, semantic.color.text['on-fill']);
|
|
67
67
|
/**
|
|
68
68
|
* TabBar component for tabbed navigation
|
|
69
69
|
*
|
|
@@ -26,7 +26,7 @@ var Trigger = /*#__PURE__*/styled.button.withConfig({
|
|
|
26
26
|
},
|
|
27
27
|
displayName: "WorkspaceSwitcher__Trigger",
|
|
28
28
|
componentId: "sc-s35ke-0"
|
|
29
|
-
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n min-height: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background: none;\n font: ", ";\n color: ", ";\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ";\n\n ", "\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n min-height: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background: none;\n font: ", ";\n color: ", ";\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ";\n\n ", "\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"])), space[200], size.row.sm, space.inset.xs, space.inset.sm, radius.
|
|
29
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n min-height: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background: none;\n font: ", ";\n color: ", ";\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ";\n\n ", "\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n min-height: ", ";\n padding: ", " ", ";\n border: none;\n border-radius: ", ";\n background: none;\n font: ", ";\n color: ", ";\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ";\n\n ", "\n\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"])), space[200], size.row.sm, space.inset.xs, space.inset.sm, radius.md, typography.label, color.text["default"], motion.duration.fast, motion.easing.decelerate, interactiveRow(), function (_a) {
|
|
30
30
|
var $collapsed = _a.$collapsed;
|
|
31
31
|
return $collapsed && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n justify-content: center;\n padding: ", ";\n "], ["\n justify-content: center;\n padding: ", ";\n "])), space.inset.xs);
|
|
32
32
|
}, border.focus, border.focusOffset);
|
|
@@ -98,6 +98,8 @@ var WorkspaceSwitcher = function WorkspaceSwitcher(_a) {
|
|
|
98
98
|
}) : trigger,
|
|
99
99
|
side: collapsed ? 'right' : 'bottom',
|
|
100
100
|
align: "start",
|
|
101
|
+
// Lines up with the full-width trigger beneath it (issue 350)
|
|
102
|
+
matchTriggerWidth: true,
|
|
101
103
|
children: [jsx(MenuGroup, {
|
|
102
104
|
label: label,
|
|
103
105
|
children: workspaces.map(function (workspace) {
|