@common-origin/design-system 3.0.0 → 3.2.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 +2622 -830
- 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/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 +47 -0
- package/dist/components/atoms/Tooltip/Tooltip.d.ts +47 -0
- package/dist/components/atoms/Tooltip/Tooltip.mjs +214 -0
- package/dist/components/atoms/Tooltip/Tooltip.mjs.map +1 -0
- package/dist/components/atoms/Tooltip/index.d.mts +2 -0
- package/dist/components/atoms/Tooltip/index.d.ts +2 -0
- package/dist/components/atoms/index.d.mts +1 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/index.d.mts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +3 -2
- package/dist/components/molecules/Alert/Alert.mjs +2 -2
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +1 -1
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +1 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs +1 -1
- package/dist/components/molecules/List/List.d.mts +2 -0
- package/dist/components/molecules/List/List.d.ts +2 -0
- package/dist/components/molecules/List/ListItem.d.mts +2 -0
- package/dist/components/molecules/List/ListItem.d.ts +2 -0
- package/dist/components/molecules/List/ListItem.mjs +7 -7
- package/dist/components/molecules/Menu/Menu.d.mts +124 -0
- package/dist/components/molecules/Menu/Menu.d.ts +124 -0
- package/dist/components/molecules/Menu/Menu.mjs +476 -0
- package/dist/components/molecules/Menu/Menu.mjs.map +1 -0
- package/dist/components/molecules/Menu/index.d.mts +2 -0
- package/dist/components/molecules/Menu/index.d.ts +2 -0
- 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 +5 -3
- package/dist/components/molecules/Sheet/Sheet.mjs +3 -3
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.mts +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.d.ts +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs +13 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavContext.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.mts +44 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.d.ts +44 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs +235 -0
- package/dist/components/molecules/SidebarNavItem/SidebarNavItem.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavItem/index.d.mts +2 -0
- package/dist/components/molecules/SidebarNavItem/index.d.ts +2 -0
- 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.d.mts +36 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.d.ts +36 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs +202 -0
- package/dist/components/molecules/SidebarNavSection/SidebarNavSection.mjs.map +1 -0
- package/dist/components/molecules/SidebarNavSection/index.d.mts +2 -0
- package/dist/components/molecules/SidebarNavSection/index.d.ts +2 -0
- package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +1 -1
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.mts +39 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.d.ts +39 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs +133 -0
- package/dist/components/molecules/WorkspaceSwitcher/WorkspaceSwitcher.mjs.map +1 -0
- package/dist/components/molecules/WorkspaceSwitcher/index.d.mts +2 -0
- package/dist/components/molecules/WorkspaceSwitcher/index.d.ts +2 -0
- package/dist/components/molecules/index.d.mts +4 -0
- package/dist/components/molecules/index.d.ts +4 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.d.mts +52 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.d.ts +52 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs +346 -0
- package/dist/components/organisms/SidebarNav/SidebarNav.mjs.map +1 -0
- package/dist/components/organisms/SidebarNav/index.d.mts +2 -0
- package/dist/components/organisms/SidebarNav/index.d.ts +2 -0
- package/dist/components/organisms/index.d.mts +1 -0
- package/dist/components/organisms/index.d.ts +1 -0
- package/dist/data.js +155 -68
- package/dist/data.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/floatingPosition.d.mts +43 -0
- package/dist/lib/floatingPosition.d.ts +43 -0
- package/dist/lib/floatingPosition.mjs +86 -0
- package/dist/lib/floatingPosition.mjs.map +1 -0
- package/dist/lib/keyboardFocus.d.mts +6 -0
- package/dist/lib/keyboardFocus.d.ts +6 -0
- package/dist/lib/keyboardFocus.mjs +17 -0
- package/dist/lib/keyboardFocus.mjs.map +1 -0
- 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 +32 -0
- package/dist/lib/useFloatingLayer.d.ts +32 -0
- package/dist/lib/useFloatingLayer.mjs +95 -0
- package/dist/lib/useFloatingLayer.mjs.map +1 -0
- package/dist/styles/icons.json +30 -1
- package/dist/styles/icons.json.mjs +34 -3
- package/dist/styles/icons.json.mjs.map +1 -1
- package/dist/styles/tokens.d.mts +139 -32
- package/dist/styles/tokens.d.ts +139 -32
- package/dist/styles/tokens.json +122 -66
- package/dist/styles/tokens.json.mjs +122 -66
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +122 -66
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +122 -66
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +139 -32
- package/dist/tokens/styles/tokens.d.ts +139 -32
- package/dist/tokens.css +1137 -86
- package/dist/types/icons.d.mts +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.mjs.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import React, { useId, useState, useEffect } from 'react';
|
|
5
|
+
import styled$module, { css } from 'styled-components';
|
|
6
|
+
const styled = styled$module.default || styled$module;
|
|
7
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
+
import tokensJson from '../../../styles/tokens.json.mjs';
|
|
9
|
+
import { rowRadius, interactiveRow, reducedMotion } from '../../../lib/styleUtils.mjs';
|
|
10
|
+
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
11
|
+
import { useSidebarNav } from '../SidebarNavItem/SidebarNavContext.mjs';
|
|
12
|
+
import { SidebarNavItem } from '../SidebarNavItem/SidebarNavItem.mjs';
|
|
13
|
+
import { Fold } from '../SidebarNavItem/sidebarNavMotion.mjs';
|
|
14
|
+
|
|
15
|
+
// How long the items take to show or hide: the clip lifts after this even if no transition ran
|
|
16
|
+
// (reduced motion, or a background tab)
|
|
17
|
+
var COLLAPSE_MS = parseInt(tokensJson.semantic.motion.duration.moderate, 10);
|
|
18
|
+
var semantic = tokens.semantic;
|
|
19
|
+
var space = semantic.space,
|
|
20
|
+
color = semantic.color,
|
|
21
|
+
motion = semantic.motion,
|
|
22
|
+
size = semantic.size,
|
|
23
|
+
border = semantic.border,
|
|
24
|
+
typography = semantic.typography;
|
|
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({
|
|
29
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
30
|
+
return !prop.startsWith('$');
|
|
31
|
+
},
|
|
32
|
+
displayName: "SidebarNavSection__Section",
|
|
33
|
+
componentId: "sc-16cbmnb-0"
|
|
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) {
|
|
35
|
+
var $collapsed = _a.$collapsed;
|
|
36
|
+
return $collapsed ? color.border["default"] : 'transparent';
|
|
37
|
+
});
|
|
38
|
+
var Header = /*#__PURE__*/styled.div.withConfig({
|
|
39
|
+
displayName: "SidebarNavSection__Header",
|
|
40
|
+
componentId: "sc-16cbmnb-1"
|
|
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"
|
|
42
|
+
// The label's look: quiet, small and muted, so the items lead
|
|
43
|
+
])), space[100], size.row.sm);
|
|
44
|
+
// The label's look: quiet, small and muted, so the items lead
|
|
45
|
+
var labelText = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font: ", ";\n color: ", ";\n"], ["\n font: ", ";\n color: ", ";\n"])), typography.caption, color.text.muted);
|
|
46
|
+
var StaticLabel = /*#__PURE__*/styled.div.withConfig({
|
|
47
|
+
displayName: "SidebarNavSection__StaticLabel",
|
|
48
|
+
componentId: "sc-16cbmnb-2"
|
|
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
|
+
var Disclosure = /*#__PURE__*/styled.button.withConfig({
|
|
51
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
52
|
+
return !prop.startsWith('$');
|
|
53
|
+
},
|
|
54
|
+
displayName: "SidebarNavSection__Disclosure",
|
|
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
|
+
// The items' height animates from nothing to their own height with grid rows, so no
|
|
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, rowRadius, motion.duration.fast, motion.easing.decelerate, interactiveRow(), border.focus, border.focusOffset, motion.duration.fast, motion.easing.standard, function (_a) {
|
|
60
|
+
var $expanded = _a.$expanded;
|
|
61
|
+
return $expanded ? '0deg' : '-90deg';
|
|
62
|
+
}, reducedMotion);
|
|
63
|
+
// The items' height animates from nothing to their own height with grid rows, so no
|
|
64
|
+
// "no limit" max-height is needed. Once hidden, the items leave the keyboard and screen readers.
|
|
65
|
+
var Collapse = /*#__PURE__*/styled.div.withConfig({
|
|
66
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
67
|
+
return !prop.startsWith('$');
|
|
68
|
+
},
|
|
69
|
+
displayName: "SidebarNavSection__Collapse",
|
|
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
|
+
// Clipped only while hidden or moving: once shown, an item's Badge can overhang its row
|
|
73
|
+
])), function (_a) {
|
|
74
|
+
var $expanded = _a.$expanded;
|
|
75
|
+
return $expanded ? '1fr' : '0fr';
|
|
76
|
+
}, function (_a) {
|
|
77
|
+
var $expanded = _a.$expanded;
|
|
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);
|
|
83
|
+
// Clipped only while hidden or moving: once shown, an item's Badge can overhang its row
|
|
84
|
+
var List = /*#__PURE__*/styled.ul.withConfig({
|
|
85
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
86
|
+
return !prop.startsWith('$');
|
|
87
|
+
},
|
|
88
|
+
displayName: "SidebarNavSection__List",
|
|
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"
|
|
91
|
+
/**
|
|
92
|
+
* A labelled group of SidebarNavItems (#328), optionally collapsible, with one optional action.
|
|
93
|
+
* In the rail its label and action are hidden and a rule separates it from the section above.
|
|
94
|
+
*/])), function (_a) {
|
|
95
|
+
var $clip = _a.$clip;
|
|
96
|
+
return $clip ? 'hidden' : 'visible';
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* A labelled group of SidebarNavItems (#328), optionally collapsible, with one optional action.
|
|
100
|
+
* In the rail its label and action are hidden and a rule separates it from the section above.
|
|
101
|
+
*/
|
|
102
|
+
var SidebarNavSection = function SidebarNavSection(_a) {
|
|
103
|
+
var label = _a.label,
|
|
104
|
+
children = _a.children,
|
|
105
|
+
_b = _a.collapsible,
|
|
106
|
+
collapsible = _b === void 0 ? false : _b,
|
|
107
|
+
expandedProp = _a.expanded,
|
|
108
|
+
_c = _a.defaultExpanded,
|
|
109
|
+
defaultExpanded = _c === void 0 ? true : _c,
|
|
110
|
+
onExpandedChange = _a.onExpandedChange,
|
|
111
|
+
action = _a.action,
|
|
112
|
+
dataTestId = _a["data-testid"];
|
|
113
|
+
var _d = useSidebarNav(),
|
|
114
|
+
collapsed = _d.collapsed,
|
|
115
|
+
inNav = _d.inNav;
|
|
116
|
+
var labelId = useId();
|
|
117
|
+
var listId = useId();
|
|
118
|
+
var _e = useState(defaultExpanded),
|
|
119
|
+
uncontrolledExpanded = _e[0],
|
|
120
|
+
setUncontrolledExpanded = _e[1];
|
|
121
|
+
var _f = useState(false),
|
|
122
|
+
animating = _f[0],
|
|
123
|
+
setAnimating = _f[1];
|
|
124
|
+
var isControlled = expandedProp !== undefined;
|
|
125
|
+
var userExpanded = isControlled ? expandedProp : uncontrolledExpanded;
|
|
126
|
+
// The rail has no disclosure button, so a section always shows its items there
|
|
127
|
+
var expanded = !collapsible || collapsed || userExpanded;
|
|
128
|
+
useEffect(function () {
|
|
129
|
+
if (!animating) return;
|
|
130
|
+
var timer = setTimeout(function () {
|
|
131
|
+
return setAnimating(false);
|
|
132
|
+
}, COLLAPSE_MS);
|
|
133
|
+
return function () {
|
|
134
|
+
return clearTimeout(timer);
|
|
135
|
+
};
|
|
136
|
+
}, [animating]);
|
|
137
|
+
var toggle = function toggle() {
|
|
138
|
+
var next = !expanded;
|
|
139
|
+
setAnimating(true);
|
|
140
|
+
if (!isControlled) setUncontrolledExpanded(next);
|
|
141
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(next);
|
|
142
|
+
};
|
|
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, {
|
|
151
|
+
children: [collapsible ? jsxs(Disclosure, {
|
|
152
|
+
type: "button",
|
|
153
|
+
id: labelId,
|
|
154
|
+
"aria-expanded": expanded,
|
|
155
|
+
"aria-controls": listId,
|
|
156
|
+
"$expanded": expanded,
|
|
157
|
+
onClick: toggle,
|
|
158
|
+
children: [jsx(Icon, {
|
|
159
|
+
name: "caretDown",
|
|
160
|
+
size: "sm",
|
|
161
|
+
iconColor: "inherit"
|
|
162
|
+
}), label]
|
|
163
|
+
}) : jsx(StaticLabel, {
|
|
164
|
+
id: labelId,
|
|
165
|
+
children: label
|
|
166
|
+
}), action]
|
|
167
|
+
});
|
|
168
|
+
return (
|
|
169
|
+
// In a SidebarNav the body is one list, so the section is one of its items
|
|
170
|
+
// In the rail, a section with nothing to show folds away, rule and all
|
|
171
|
+
jsx(Section, {
|
|
172
|
+
as: inNav ? 'li' : 'div',
|
|
173
|
+
"$open": !collapsed || showsInRail,
|
|
174
|
+
"$collapsed": collapsed,
|
|
175
|
+
"data-testid": dataTestId,
|
|
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
|
+
})
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
SidebarNavSection.displayName = 'SidebarNavSection';
|
|
199
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
200
|
+
|
|
201
|
+
export { SidebarNavSection };
|
|
202
|
+
//# sourceMappingURL=SidebarNavSection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarNavSection.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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
|
*
|
|
@@ -16,7 +16,7 @@ import { interactiveRow } from '../../../lib/styleUtils.mjs';
|
|
|
16
16
|
var StyledContainer = /*#__PURE__*/styled.div.withConfig({
|
|
17
17
|
displayName: "TransactionListItem__StyledContainer",
|
|
18
18
|
componentId: "sc-7yunm0-0"
|
|
19
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n min-height: ", ";\n padding: ", "
|
|
19
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n min-height: ", ";\n padding: ", "; /* follows density with the row's height (decision 0051) */\n background-color: ", ";\n border-bottom: ", " solid ", ";\n gap: ", ";\n transition: background-color ", " ", ";\n \n /* A clickable row uses the shared row states (decision 0030) */\n ", "\n"], ["\n display: flex;\n align-items: center;\n min-height: ", ";\n padding: ", "; /* follows density with the row's height (decision 0051) */\n background-color: ", ";\n border-bottom: ", " solid ", ";\n gap: ", ";\n transition: background-color ", " ", ";\n \n /* A clickable row uses the shared row states (decision 0030) */\n ", "\n"])), tokens.semantic.size.row.lg, tokens.semantic.space.inset.md, tokens.semantic.surface.base, tokens.semantic.border.width.thin, tokens.semantic.color.border["default"], tokens.semantic.space[300], tokens.semantic.motion.duration.moderate, tokens.semantic.motion.easing.decelerate, function (_a) {
|
|
20
20
|
var $clickable = _a.$clickable;
|
|
21
21
|
return $clickable && "\n cursor: pointer;\n ".concat(interactiveRow(), "\n \n &:focus-visible {\n outline: ").concat(tokens.semantic.border.focus, ";\n outline-offset: calc(-1 * ").concat(tokens.semantic.border.focusOffset, ");\n }\n ");
|
|
22
22
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Workspace {
|
|
3
|
+
/** Identifies the workspace in `value` and `onChange` */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The workspace's name */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The workspace's logo or picture, shown in its Avatar */
|
|
8
|
+
picture?: string;
|
|
9
|
+
/** Secondary text in the menu, such as the plan */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceSwitcherProps {
|
|
13
|
+
/** The workspaces to choose from */
|
|
14
|
+
workspaces: Workspace[];
|
|
15
|
+
/** The current workspace's id */
|
|
16
|
+
value: string;
|
|
17
|
+
/** Called with a workspace's id when it's chosen */
|
|
18
|
+
onChange: (id: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The label of the workspaces group in the menu.
|
|
21
|
+
* @default 'Workspaces'
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Actions after the workspaces, such as `<MenuItem>Create workspace</MenuItem>`. They can use
|
|
26
|
+
* everything a Menu item supports.
|
|
27
|
+
*/
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/** Test identifier for the trigger */
|
|
30
|
+
'data-testid'?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Shows the current workspace and switches between workspaces (#330), from SidebarNav's header.
|
|
34
|
+
* Built on Menu: a labelled group of the workspaces as radio items, then any actions.
|
|
35
|
+
*/
|
|
36
|
+
export declare const WorkspaceSwitcher: {
|
|
37
|
+
({ workspaces, value, onChange, label, children, "data-testid": dataTestId, }: WorkspaceSwitcherProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
+
displayName: string;
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Workspace {
|
|
3
|
+
/** Identifies the workspace in `value` and `onChange` */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The workspace's name */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The workspace's logo or picture, shown in its Avatar */
|
|
8
|
+
picture?: string;
|
|
9
|
+
/** Secondary text in the menu, such as the plan */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceSwitcherProps {
|
|
13
|
+
/** The workspaces to choose from */
|
|
14
|
+
workspaces: Workspace[];
|
|
15
|
+
/** The current workspace's id */
|
|
16
|
+
value: string;
|
|
17
|
+
/** Called with a workspace's id when it's chosen */
|
|
18
|
+
onChange: (id: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The label of the workspaces group in the menu.
|
|
21
|
+
* @default 'Workspaces'
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Actions after the workspaces, such as `<MenuItem>Create workspace</MenuItem>`. They can use
|
|
26
|
+
* everything a Menu item supports.
|
|
27
|
+
*/
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/** Test identifier for the trigger */
|
|
30
|
+
'data-testid'?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Shows the current workspace and switches between workspaces (#330), from SidebarNav's header.
|
|
34
|
+
* Built on Menu: a labelled group of the workspaces as radio items, then any actions.
|
|
35
|
+
*/
|
|
36
|
+
export declare const WorkspaceSwitcher: {
|
|
37
|
+
({ workspaces, value, onChange, label, children, "data-testid": dataTestId, }: WorkspaceSwitcherProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
+
displayName: string;
|
|
39
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import styled$module, { css } from 'styled-components';
|
|
6
|
+
const styled = styled$module.default || styled$module;
|
|
7
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
+
import { interactiveRow } from '../../../lib/styleUtils.mjs';
|
|
9
|
+
import { Avatar } from '../../atoms/Avatar/Avatar.mjs';
|
|
10
|
+
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
11
|
+
import { Tooltip } from '../../atoms/Tooltip/Tooltip.mjs';
|
|
12
|
+
import { Menu, MenuGroup, MenuItemRadio, MenuDivider } from '../Menu/Menu.mjs';
|
|
13
|
+
import { useSidebarNav } from '../SidebarNavItem/SidebarNavContext.mjs';
|
|
14
|
+
|
|
15
|
+
var semantic = tokens.semantic;
|
|
16
|
+
var space = semantic.space,
|
|
17
|
+
color = semantic.color,
|
|
18
|
+
motion = semantic.motion,
|
|
19
|
+
radius = semantic.radius,
|
|
20
|
+
size = semantic.size,
|
|
21
|
+
border = semantic.border,
|
|
22
|
+
typography = semantic.typography;
|
|
23
|
+
var Trigger = /*#__PURE__*/styled.button.withConfig({
|
|
24
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
25
|
+
return !prop.startsWith('$');
|
|
26
|
+
},
|
|
27
|
+
displayName: "WorkspaceSwitcher__Trigger",
|
|
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.md, typography.label, color.text["default"], motion.duration.fast, motion.easing.decelerate, interactiveRow(), function (_a) {
|
|
30
|
+
var $collapsed = _a.$collapsed;
|
|
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
|
+
}, border.focus, border.focusOffset);
|
|
33
|
+
var Name = /*#__PURE__*/styled.span.withConfig({
|
|
34
|
+
displayName: "WorkspaceSwitcher__Name",
|
|
35
|
+
componentId: "sc-s35ke-1"
|
|
36
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex: 1;\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n"], ["\n flex: 1;\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n"])));
|
|
37
|
+
var Decoration = /*#__PURE__*/styled.span.withConfig({
|
|
38
|
+
displayName: "WorkspaceSwitcher__Decoration",
|
|
39
|
+
componentId: "sc-s35ke-2"
|
|
40
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: inline-flex;\n flex-shrink: 0;\n color: ", ";\n"], ["\n display: inline-flex;\n flex-shrink: 0;\n color: ", ";\n"
|
|
41
|
+
/**
|
|
42
|
+
* Shows the current workspace and switches between workspaces (#330), from SidebarNav's header.
|
|
43
|
+
* Built on Menu: a labelled group of the workspaces as radio items, then any actions.
|
|
44
|
+
*/])), color.text.muted);
|
|
45
|
+
/**
|
|
46
|
+
* Shows the current workspace and switches between workspaces (#330), from SidebarNav's header.
|
|
47
|
+
* Built on Menu: a labelled group of the workspaces as radio items, then any actions.
|
|
48
|
+
*/
|
|
49
|
+
var WorkspaceSwitcher = function WorkspaceSwitcher(_a) {
|
|
50
|
+
var workspaces = _a.workspaces,
|
|
51
|
+
value = _a.value,
|
|
52
|
+
onChange = _a.onChange,
|
|
53
|
+
_b = _a.label,
|
|
54
|
+
label = _b === void 0 ? 'Workspaces' : _b,
|
|
55
|
+
children = _a.children,
|
|
56
|
+
dataTestId = _a["data-testid"];
|
|
57
|
+
var collapsed = useSidebarNav().collapsed;
|
|
58
|
+
var match = workspaces.find(function (workspace) {
|
|
59
|
+
return workspace.id === value;
|
|
60
|
+
});
|
|
61
|
+
var fallback = !match && workspaces.length > 0 ? workspaces[0].name : undefined;
|
|
62
|
+
// Showing the first keeps the header usable, but the app's value is wrong, so say so, once per value
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
if (fallback) console.warn("WorkspaceSwitcher: no workspace has the id \"".concat(value, "\"; showing \"").concat(fallback, "\""));
|
|
65
|
+
}, [value, fallback]);
|
|
66
|
+
var current = match !== null && match !== void 0 ? match : workspaces[0];
|
|
67
|
+
if (!current) return null;
|
|
68
|
+
var trigger = jsxs(Trigger, {
|
|
69
|
+
type: "button",
|
|
70
|
+
"$collapsed": collapsed,
|
|
71
|
+
"aria-label": collapsed ? current.name : undefined,
|
|
72
|
+
"data-testid": dataTestId,
|
|
73
|
+
children: [jsx(Decoration, {
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: jsx(Avatar, {
|
|
76
|
+
name: current.name,
|
|
77
|
+
picture: current.picture,
|
|
78
|
+
size: "xs"
|
|
79
|
+
})
|
|
80
|
+
}), !collapsed && jsxs(Fragment, {
|
|
81
|
+
children: [jsx(Name, {
|
|
82
|
+
children: current.name
|
|
83
|
+
}), jsx(Decoration, {
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
children: jsx(Icon, {
|
|
86
|
+
name: "caretDown",
|
|
87
|
+
size: "sm",
|
|
88
|
+
iconColor: "inherit"
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
return jsxs(Menu, {
|
|
94
|
+
trigger: collapsed ? jsx(Tooltip, {
|
|
95
|
+
text: current.name,
|
|
96
|
+
side: "right",
|
|
97
|
+
children: trigger
|
|
98
|
+
}) : trigger,
|
|
99
|
+
side: collapsed ? 'right' : 'bottom',
|
|
100
|
+
align: "start",
|
|
101
|
+
// Lines up with the full-width trigger beneath it (issue 350)
|
|
102
|
+
matchTriggerWidth: true,
|
|
103
|
+
children: [jsx(MenuGroup, {
|
|
104
|
+
label: label,
|
|
105
|
+
children: workspaces.map(function (workspace) {
|
|
106
|
+
return jsx(MenuItemRadio, {
|
|
107
|
+
checked: workspace.id === current.id,
|
|
108
|
+
// Choosing the current workspace again changes nothing
|
|
109
|
+
onSelect: function onSelect() {
|
|
110
|
+
return workspace.id !== current.id && onChange(workspace.id);
|
|
111
|
+
},
|
|
112
|
+
icon: jsx(Avatar, {
|
|
113
|
+
name: workspace.name,
|
|
114
|
+
picture: workspace.picture,
|
|
115
|
+
size: "xs"
|
|
116
|
+
}),
|
|
117
|
+
description: workspace.description,
|
|
118
|
+
textValue: workspace.name,
|
|
119
|
+
children: workspace.name
|
|
120
|
+
}, workspace.id);
|
|
121
|
+
})
|
|
122
|
+
}), children && jsxs(Fragment, {
|
|
123
|
+
children: [jsx(MenuDivider, {}), jsx(MenuGroup, {
|
|
124
|
+
children: children
|
|
125
|
+
})]
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
WorkspaceSwitcher.displayName = 'WorkspaceSwitcher';
|
|
130
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
131
|
+
|
|
132
|
+
export { WorkspaceSwitcher };
|
|
133
|
+
//# sourceMappingURL=WorkspaceSwitcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceSwitcher.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -14,6 +14,9 @@ export * from './EmptyState/index.mjs';
|
|
|
14
14
|
export * from './FeatureBlock/index.mjs';
|
|
15
15
|
export * from './Dropdown/index.mjs';
|
|
16
16
|
export * from './List/index.mjs';
|
|
17
|
+
export * from './Menu/index.mjs';
|
|
18
|
+
export * from './SidebarNavItem/index.mjs';
|
|
19
|
+
export * from './SidebarNavSection/index.mjs';
|
|
17
20
|
export * from './Modal/index.mjs';
|
|
18
21
|
export * from './NumberInput/index.mjs';
|
|
19
22
|
export * from './PasswordField/index.mjs';
|
|
@@ -23,3 +26,4 @@ export * from './Slider/index.mjs';
|
|
|
23
26
|
export * from './TabBar/index.mjs';
|
|
24
27
|
export * from './TextField/index.mjs';
|
|
25
28
|
export * from './TransactionListItem/index.mjs';
|
|
29
|
+
export * from './WorkspaceSwitcher/index.mjs';
|
|
@@ -14,6 +14,9 @@ export * from './EmptyState';
|
|
|
14
14
|
export * from './FeatureBlock';
|
|
15
15
|
export * from './Dropdown';
|
|
16
16
|
export * from './List';
|
|
17
|
+
export * from './Menu';
|
|
18
|
+
export * from './SidebarNavItem';
|
|
19
|
+
export * from './SidebarNavSection';
|
|
17
20
|
export * from './Modal';
|
|
18
21
|
export * from './NumberInput';
|
|
19
22
|
export * from './PasswordField';
|
|
@@ -23,3 +26,4 @@ export * from './Slider';
|
|
|
23
26
|
export * from './TabBar';
|
|
24
27
|
export * from './TextField';
|
|
25
28
|
export * from './TransactionListItem';
|
|
29
|
+
export * from './WorkspaceSwitcher';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SidebarNavContextValue } from '../../molecules/SidebarNavItem/SidebarNavContext.mjs';
|
|
3
|
+
export type SidebarNavWidth = 'narrow' | 'default' | 'wide';
|
|
4
|
+
export interface SidebarNavProps {
|
|
5
|
+
/** Names the navigation landmark, such as "Main" or "Workspace" */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* The body: SidebarNavItems and SidebarNavSections, in order, wrapped in components or Fragments
|
|
9
|
+
* if you like. It's one list, and scrolls when it's too tall.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Content above the body, such as a WorkspaceSwitcher. The collapse toggle sits beside it. */
|
|
13
|
+
header?: React.ReactNode;
|
|
14
|
+
/** Content below the body, such as an upgrade prompt. Hidden in the rail. */
|
|
15
|
+
footer?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The expanded width. Collapsed, it's always the rail.
|
|
18
|
+
* @default 'default'
|
|
19
|
+
*/
|
|
20
|
+
width?: SidebarNavWidth;
|
|
21
|
+
/** Whether it's the icon rail (controlled). Use with `onCollapsedChange`. */
|
|
22
|
+
collapsed?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether it starts as the rail (uncontrolled). Saving the state between visits is the
|
|
25
|
+
* product's job.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
defaultCollapsed?: boolean;
|
|
29
|
+
/** Called when the toggle collapses or expands it */
|
|
30
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether it has a collapse toggle. Turn it off where it can't collapse, such as inside a Sheet.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
collapsible?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A router's link component for internal URLs, such as Next's `Link`, used by every item
|
|
38
|
+
* (decision 0008). Without one, items render plain links.
|
|
39
|
+
*/
|
|
40
|
+
linkComponent?: SidebarNavContextValue['linkComponent'];
|
|
41
|
+
/** Test identifier for the nav */
|
|
42
|
+
'data-testid'?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A product's sidebar navigation (#331): a header, a scrolling body of items and sections, and a
|
|
46
|
+
* footer, that collapses to an icon rail. Row heights follow density (0051); the width is a prop.
|
|
47
|
+
* On small screens, place it in a Sheet with `collapsible={false}`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SidebarNav: {
|
|
50
|
+
({ label, children, header, footer, width, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, collapsible, linkComponent, "data-testid": dataTestId, }: SidebarNavProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SidebarNavContextValue } from '../../molecules/SidebarNavItem/SidebarNavContext';
|
|
3
|
+
export type SidebarNavWidth = 'narrow' | 'default' | 'wide';
|
|
4
|
+
export interface SidebarNavProps {
|
|
5
|
+
/** Names the navigation landmark, such as "Main" or "Workspace" */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* The body: SidebarNavItems and SidebarNavSections, in order, wrapped in components or Fragments
|
|
9
|
+
* if you like. It's one list, and scrolls when it's too tall.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Content above the body, such as a WorkspaceSwitcher. The collapse toggle sits beside it. */
|
|
13
|
+
header?: React.ReactNode;
|
|
14
|
+
/** Content below the body, such as an upgrade prompt. Hidden in the rail. */
|
|
15
|
+
footer?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The expanded width. Collapsed, it's always the rail.
|
|
18
|
+
* @default 'default'
|
|
19
|
+
*/
|
|
20
|
+
width?: SidebarNavWidth;
|
|
21
|
+
/** Whether it's the icon rail (controlled). Use with `onCollapsedChange`. */
|
|
22
|
+
collapsed?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether it starts as the rail (uncontrolled). Saving the state between visits is the
|
|
25
|
+
* product's job.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
defaultCollapsed?: boolean;
|
|
29
|
+
/** Called when the toggle collapses or expands it */
|
|
30
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether it has a collapse toggle. Turn it off where it can't collapse, such as inside a Sheet.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
collapsible?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A router's link component for internal URLs, such as Next's `Link`, used by every item
|
|
38
|
+
* (decision 0008). Without one, items render plain links.
|
|
39
|
+
*/
|
|
40
|
+
linkComponent?: SidebarNavContextValue['linkComponent'];
|
|
41
|
+
/** Test identifier for the nav */
|
|
42
|
+
'data-testid'?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A product's sidebar navigation (#331): a header, a scrolling body of items and sections, and a
|
|
46
|
+
* footer, that collapses to an icon rail. Row heights follow density (0051); the width is a prop.
|
|
47
|
+
* On small screens, place it in a Sheet with `collapsible={false}`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SidebarNav: {
|
|
50
|
+
({ label, children, header, footer, width, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, collapsible, linkComponent, "data-testid": dataTestId, }: SidebarNavProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
};
|