@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,13 @@
|
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
export interface SidebarNavContextValue {
|
|
3
|
+
/** The nav is the icon rail: rows show their icon only */
|
|
4
|
+
collapsed: boolean;
|
|
5
|
+
/** A router's link component for internal URLs, set once on SidebarNav (decision 0008) */
|
|
6
|
+
linkComponent?: ComponentType<any>;
|
|
7
|
+
/** SidebarNav draws one gliding hover highlight, so rows don't colour their own hover (0053) */
|
|
8
|
+
glide: boolean;
|
|
9
|
+
/** Inside a SidebarNav, whose body is one list: a section is one of its items */
|
|
10
|
+
inNav?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const SidebarNavContext: import("react").Context<SidebarNavContextValue>;
|
|
13
|
+
export declare const useSidebarNav: () => SidebarNavContextValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
export interface SidebarNavContextValue {
|
|
3
|
+
/** The nav is the icon rail: rows show their icon only */
|
|
4
|
+
collapsed: boolean;
|
|
5
|
+
/** A router's link component for internal URLs, set once on SidebarNav (decision 0008) */
|
|
6
|
+
linkComponent?: ComponentType<any>;
|
|
7
|
+
/** SidebarNav draws one gliding hover highlight, so rows don't colour their own hover (0053) */
|
|
8
|
+
glide: boolean;
|
|
9
|
+
/** Inside a SidebarNav, whose body is one list: a section is one of its items */
|
|
10
|
+
inNav?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const SidebarNavContext: import("react").Context<SidebarNavContextValue>;
|
|
13
|
+
export declare const useSidebarNav: () => SidebarNavContextValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
var SidebarNavContext = /*#__PURE__*/createContext({
|
|
5
|
+
collapsed: false,
|
|
6
|
+
glide: false
|
|
7
|
+
});
|
|
8
|
+
var useSidebarNav = function useSidebarNav() {
|
|
9
|
+
return useContext(SidebarNavContext);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { SidebarNavContext, useSidebarNav };
|
|
13
|
+
//# sourceMappingURL=SidebarNavContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarNavContext.mjs","sources":["../../../../src/components/molecules/SidebarNavItem/SidebarNavContext.ts"],"sourcesContent":["import { createContext, useContext, type ComponentType } from 'react'\n\n// What SidebarNav (#331) tells the rows and sections inside it. Outside a SidebarNav, the\n// defaults apply: expanded, plain links, and each row's own hover colour.\nexport interface SidebarNavContextValue {\n /** The nav is the icon rail: rows show their icon only */\n collapsed: boolean\n /** A router's link component for internal URLs, set once on SidebarNav (decision 0008) */\n linkComponent?: ComponentType<any> // eslint-disable-line @typescript-eslint/no-explicit-any\n /** SidebarNav draws one gliding hover highlight, so rows don't colour their own hover (0053) */\n glide: boolean\n /** Inside a SidebarNav, whose body is one list: a section is one of its items */\n inNav?: boolean\n}\n\nexport const SidebarNavContext = createContext<SidebarNavContextValue>({ collapsed: false, glide: false })\n\nexport const useSidebarNav = () => useContext(SidebarNavContext)\n"],"names":["SidebarNavContext","createContext","collapsed","glide","useSidebarNav","useContext"],"mappings":";;;AAeaA,IAAAA,iBAAiB,gBAAGC,aAAa,CAAyB;AAAEC,EAAAA,SAAS,EAAE,KAAK;AAAEC,EAAAA,KAAK,EAAE,KAAA;AAAK,CAAE,EAAC;IAE7FC,aAAa,GAAG,SAAhBA,aAAaA,GAAS;EAAA,OAAAC,UAAU,CAACL,iBAAiB,CAAC,CAAA;AAA7B;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconName } from '../../../types/icons.mjs';
|
|
3
|
+
export interface SidebarNavItemProps {
|
|
4
|
+
/** The item's label. In the rail it becomes the accessible name and shows in a Tooltip. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** A leading icon. Items without one are hidden in the rail. */
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/**
|
|
9
|
+
* Where the item goes. With a `url` the item is a link (using SidebarNav's `linkComponent`
|
|
10
|
+
* for internal URLs, decision 0008); without one it's a button for `onClick`.
|
|
11
|
+
*/
|
|
12
|
+
url?: string;
|
|
13
|
+
/** Called when the item is activated. Without a `url`, the item is a button. */
|
|
14
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The page the user is on: `aria-current="page"` and the light-blue selected treatment
|
|
17
|
+
* (decisions 0016, 0030).
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
current?: boolean;
|
|
21
|
+
/** Quiet text at the end of the row, such as "3/10". Hidden in the rail. */
|
|
22
|
+
meta?: string;
|
|
23
|
+
/**
|
|
24
|
+
* New or unread items (decision 0045): a count, or `'dot'` for "something new". Shown as an
|
|
25
|
+
* accent Badge count at the end of the row, or as a dot inside the icon's corner in the rail, and
|
|
26
|
+
* added to the item's name.
|
|
27
|
+
*/
|
|
28
|
+
badge?: number | 'dot';
|
|
29
|
+
/**
|
|
30
|
+
* How the badge reads in the item's name, such as "3 unread".
|
|
31
|
+
* @default "{count} new", or "new" for a dot
|
|
32
|
+
*/
|
|
33
|
+
badgeLabel?: string;
|
|
34
|
+
/** Test identifier for the item's link or button */
|
|
35
|
+
'data-testid'?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One row of a SidebarNav (#327): a link to a page, or a button for an action such as "New chat".
|
|
39
|
+
* Renders an `li`, so it sits in SidebarNav's or a SidebarNavSection's list.
|
|
40
|
+
*/
|
|
41
|
+
export declare const SidebarNavItem: {
|
|
42
|
+
({ label, icon, url, onClick, current, meta, badge, badgeLabel, "data-testid": dataTestId, }: SidebarNavItemProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconName } from '../../../types/icons';
|
|
3
|
+
export interface SidebarNavItemProps {
|
|
4
|
+
/** The item's label. In the rail it becomes the accessible name and shows in a Tooltip. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** A leading icon. Items without one are hidden in the rail. */
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/**
|
|
9
|
+
* Where the item goes. With a `url` the item is a link (using SidebarNav's `linkComponent`
|
|
10
|
+
* for internal URLs, decision 0008); without one it's a button for `onClick`.
|
|
11
|
+
*/
|
|
12
|
+
url?: string;
|
|
13
|
+
/** Called when the item is activated. Without a `url`, the item is a button. */
|
|
14
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The page the user is on: `aria-current="page"` and the light-blue selected treatment
|
|
17
|
+
* (decisions 0016, 0030).
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
current?: boolean;
|
|
21
|
+
/** Quiet text at the end of the row, such as "3/10". Hidden in the rail. */
|
|
22
|
+
meta?: string;
|
|
23
|
+
/**
|
|
24
|
+
* New or unread items (decision 0045): a count, or `'dot'` for "something new". Shown as an
|
|
25
|
+
* accent Badge count at the end of the row, or as a dot inside the icon's corner in the rail, and
|
|
26
|
+
* added to the item's name.
|
|
27
|
+
*/
|
|
28
|
+
badge?: number | 'dot';
|
|
29
|
+
/**
|
|
30
|
+
* How the badge reads in the item's name, such as "3 unread".
|
|
31
|
+
* @default "{count} new", or "new" for a dot
|
|
32
|
+
*/
|
|
33
|
+
badgeLabel?: string;
|
|
34
|
+
/** Test identifier for the item's link or button */
|
|
35
|
+
'data-testid'?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One row of a SidebarNav (#327): a link to a page, or a button for an action such as "New chat".
|
|
39
|
+
* Renders an `li`, so it sits in SidebarNav's or a SidebarNavSection's list.
|
|
40
|
+
*/
|
|
41
|
+
export declare const SidebarNavItem: {
|
|
42
|
+
({ label, icon, url, onClick, current, meta, badge, badgeLabel, "data-testid": dataTestId, }: SidebarNavItemProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module, { css } from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
+
import { rowRadius, interactiveRow } from '../../../lib/styleUtils.mjs';
|
|
8
|
+
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
9
|
+
import { Tooltip } from '../../atoms/Tooltip/Tooltip.mjs';
|
|
10
|
+
import { Badge } from '../../atoms/Badge/Badge.mjs';
|
|
11
|
+
import { useSidebarNav } from './SidebarNavContext.mjs';
|
|
12
|
+
import { ROW_INSET, EXPANDED_WIDTH_VAR, SCROLLBAR_VAR, NAV_PADDING, fade, Fold } from './sidebarNavMotion.mjs';
|
|
13
|
+
|
|
14
|
+
var semantic = tokens.semantic;
|
|
15
|
+
var space = semantic.space,
|
|
16
|
+
color = semantic.color,
|
|
17
|
+
motion = semantic.motion,
|
|
18
|
+
size = semantic.size,
|
|
19
|
+
border = semantic.border,
|
|
20
|
+
typography = semantic.typography;
|
|
21
|
+
// Anything without a scheme (https:, mailto:) or a protocol-relative start is the app's own URL,
|
|
22
|
+
// relative ones included, so it goes through the router's link
|
|
23
|
+
var isInternalUrl = function isInternalUrl(url) {
|
|
24
|
+
return !/^[a-z][a-z\d+.-]*:/i.test(url) && !url.startsWith('//');
|
|
25
|
+
};
|
|
26
|
+
var Row = /*#__PURE__*/styled.a.withConfig({
|
|
27
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
28
|
+
return !prop.startsWith('$');
|
|
29
|
+
},
|
|
30
|
+
displayName: "SidebarNavItem__Row",
|
|
31
|
+
componentId: "sc-1nfqk5n-0"
|
|
32
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n box-sizing: border-box;\n width: 100%;\n /* The row's height is its token, with the content centred (as controls, 0034): vertical\n padding would hold a compact row above its 24px (0051) */\n min-height: ", ";\n /* The left inset is the same expanded and in the rail, so the icon never moves (issue 348); the row\n clips what the rail doesn't show as the nav narrows */\n padding: 0 ", " 0 ", ";\n overflow: hidden;\n border: none;\n border-radius: ", ";\n background: none;\n font: ", ";\n color: ", ";\n text-align: left;\n text-decoration: none;\n cursor: pointer;\n transition: background-color ", " ", ",\n color ", " ", ";\n\n /* The shared row states (0030); the current page takes the light-blue selected ladder */\n ", "\n\n /* Inside SidebarNav one highlight glides to the hovered row, so an unselected row stays clear\n underneath it; pressed and selected rows keep their own fills (0053) */\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 /* The row's height is its token, with the content centred (as controls, 0034): vertical\n padding would hold a compact row above its 24px (0051) */\n min-height: ", ";\n /* The left inset is the same expanded and in the rail, so the icon never moves (issue 348); the row\n clips what the rail doesn't show as the nav narrows */\n padding: 0 ", " 0 ", ";\n overflow: hidden;\n border: none;\n border-radius: ", ";\n background: none;\n font: ", ";\n color: ", ";\n text-align: left;\n text-decoration: none;\n cursor: pointer;\n transition: background-color ", " ", ",\n color ", " ", ";\n\n /* The shared row states (0030); the current page takes the light-blue selected ladder */\n ", "\n\n /* Inside SidebarNav one highlight glides to the hovered row, so an unselected row stays clear\n underneath it; pressed and selected rows keep their own fills (0053) */\n ", "\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: calc(-1 * ", ");\n }\n"
|
|
33
|
+
// The row's content keeps the nav's expanded width (when it's in a SidebarNav), so the nav's edge
|
|
34
|
+
// clips it as the nav narrows, instead of the label reflowing or ellipsising mid-move
|
|
35
|
+
])), space[200], size.row.sm, space.inset.sm, ROW_INSET, rowRadius, typography.small, color.text["default"], motion.duration.fast, motion.easing.decelerate, motion.duration.fast, motion.easing.decelerate, function (_a) {
|
|
36
|
+
var $current = _a.$current;
|
|
37
|
+
return interactiveRow({
|
|
38
|
+
selected: $current
|
|
39
|
+
});
|
|
40
|
+
}, function (_a) {
|
|
41
|
+
var $glide = _a.$glide,
|
|
42
|
+
$current = _a.$current;
|
|
43
|
+
return $glide && !$current && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover:not(:active) {\n background-color: transparent;\n }\n "], ["\n &:hover:not(:active) {\n background-color: transparent;\n }\n "])));
|
|
44
|
+
}, border.focus, border.focusOffset);
|
|
45
|
+
// The row's content keeps the nav's expanded width (when it's in a SidebarNav), so the nav's edge
|
|
46
|
+
// clips it as the nav narrows, instead of the label reflowing or ellipsising mid-move
|
|
47
|
+
var Inner = /*#__PURE__*/styled.span.withConfig({
|
|
48
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
49
|
+
return !prop.startsWith('$');
|
|
50
|
+
},
|
|
51
|
+
displayName: "SidebarNavItem__Inner",
|
|
52
|
+
componentId: "sc-1nfqk5n-1"
|
|
53
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex: 1 0 auto;\n align-items: center;\n gap: ", ";\n min-width: 0;\n /* The row's content width when expanded: the nav's width less any scrollbar, its padding, the row's\n insets and, beside an icon, the icon and its gap */\n width: calc(\n var(", ", 0px) - var(", ", 0px) - 2 * ", " - ", " - ", "\n ", "\n );\n"], ["\n display: flex;\n flex: 1 0 auto;\n align-items: center;\n gap: ", ";\n min-width: 0;\n /* The row's content width when expanded: the nav's width less any scrollbar, its padding, the row's\n insets and, beside an icon, the icon and its gap */\n width: calc(\n var(", ", 0px) - var(", ", 0px) - 2 * ", " - ", " - ", "\n ", "\n );\n"])), space[200], EXPANDED_WIDTH_VAR, SCROLLBAR_VAR, NAV_PADDING, ROW_INSET, space.inset.sm, function (_a) {
|
|
54
|
+
var $withIcon = _a.$withIcon;
|
|
55
|
+
return $withIcon ? "- ".concat(size.icon.md, " - ").concat(space[200]) : '';
|
|
56
|
+
});
|
|
57
|
+
var Label = /*#__PURE__*/styled.span.withConfig({
|
|
58
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
59
|
+
return !prop.startsWith('$');
|
|
60
|
+
},
|
|
61
|
+
displayName: "SidebarNavItem__Label",
|
|
62
|
+
componentId: "sc-1nfqk5n-2"
|
|
63
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex: 1;\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n ", "\n"], ["\n flex: 1;\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n ", "\n"])), function (_a) {
|
|
64
|
+
var $hidden = _a.$hidden;
|
|
65
|
+
return fade($hidden);
|
|
66
|
+
});
|
|
67
|
+
var Meta = /*#__PURE__*/styled.span.withConfig({
|
|
68
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
69
|
+
return !prop.startsWith('$');
|
|
70
|
+
},
|
|
71
|
+
displayName: "SidebarNavItem__Meta",
|
|
72
|
+
componentId: "sc-1nfqk5n-3"
|
|
73
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n flex-shrink: 0;\n font: ", ";\n color: ", ";\n ", "\n"], ["\n flex-shrink: 0;\n font: ", ";\n color: ", ";\n ", "\n"
|
|
74
|
+
// A badge needs something to sit on: the icon, or this mark at the end of an item without one
|
|
75
|
+
// Badge normally sits centred on its anchor's top-right corner (0045). At the end of the row the
|
|
76
|
+
// count is laid out in place instead, so a count of any width ("3", "12", "99+") stays inside the
|
|
77
|
+
// row in every density and never reaches the rows around it
|
|
78
|
+
])), typography.caption, color.text.muted, function (_a) {
|
|
79
|
+
var $hidden = _a.$hidden;
|
|
80
|
+
return fade($hidden);
|
|
81
|
+
});
|
|
82
|
+
// A badge needs something to sit on: the icon, or this mark at the end of an item without one
|
|
83
|
+
// Badge normally sits centred on its anchor's top-right corner (0045). At the end of the row the
|
|
84
|
+
// count is laid out in place instead, so a count of any width ("3", "12", "99+") stays inside the
|
|
85
|
+
// row in every density and never reaches the rows around it
|
|
86
|
+
var EndSlot = /*#__PURE__*/styled.span.withConfig({
|
|
87
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
88
|
+
return !prop.startsWith('$');
|
|
89
|
+
},
|
|
90
|
+
displayName: "SidebarNavItem__EndSlot",
|
|
91
|
+
componentId: "sc-1nfqk5n-4"
|
|
92
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: inline-flex;\n flex-shrink: 0;\n ", "\n\n & [role='status'] {\n position: static;\n transform: none;\n }\n"], ["\n display: inline-flex;\n flex-shrink: 0;\n ", "\n\n & [role='status'] {\n position: static;\n transform: none;\n }\n"])), function (_a) {
|
|
93
|
+
var $hidden = _a.$hidden;
|
|
94
|
+
return fade($hidden);
|
|
95
|
+
});
|
|
96
|
+
var EndAnchor = /*#__PURE__*/styled.span.withConfig({
|
|
97
|
+
displayName: "SidebarNavItem__EndAnchor",
|
|
98
|
+
componentId: "sc-1nfqk5n-5"
|
|
99
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: inline-flex;\n width: 0;\n height: 0;\n"], ["\n display: inline-flex;\n width: 0;\n height: 0;\n"
|
|
100
|
+
// In the rail there's no room for a count, so a dot sits inside the icon's top-right corner
|
|
101
|
+
])));
|
|
102
|
+
// In the rail there's no room for a count, so a dot sits inside the icon's top-right corner
|
|
103
|
+
var IconBox = /*#__PURE__*/styled.span.withConfig({
|
|
104
|
+
displayName: "SidebarNavItem__IconBox",
|
|
105
|
+
componentId: "sc-1nfqk5n-6"
|
|
106
|
+
})(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n"], ["\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n"])));
|
|
107
|
+
var Corner = /*#__PURE__*/styled.span.withConfig({
|
|
108
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
109
|
+
return !prop.startsWith('$');
|
|
110
|
+
},
|
|
111
|
+
displayName: "SidebarNavItem__Corner",
|
|
112
|
+
componentId: "sc-1nfqk5n-7"
|
|
113
|
+
})(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: absolute;\n top: 25%;\n right: 25%;\n display: inline-flex;\n ", "\n"], ["\n position: absolute;\n top: 25%;\n right: 25%;\n display: inline-flex;\n ", "\n"
|
|
114
|
+
// An item folds away in the rail when it has no icon to show there
|
|
115
|
+
])), function (_a) {
|
|
116
|
+
var $hidden = _a.$hidden;
|
|
117
|
+
return fade($hidden);
|
|
118
|
+
});
|
|
119
|
+
// An item folds away in the rail when it has no icon to show there
|
|
120
|
+
var Item = /*#__PURE__*/styled(Fold).attrs({
|
|
121
|
+
as: 'li'
|
|
122
|
+
}).withConfig({
|
|
123
|
+
displayName: "SidebarNavItem__Item",
|
|
124
|
+
componentId: "sc-1nfqk5n-8"
|
|
125
|
+
})(templateObject_10 || (templateObject_10 = __makeTemplateObject([""], [""
|
|
126
|
+
/**
|
|
127
|
+
* One row of a SidebarNav (#327): a link to a page, or a button for an action such as "New chat".
|
|
128
|
+
* Renders an `li`, so it sits in SidebarNav's or a SidebarNavSection's list.
|
|
129
|
+
*/])));
|
|
130
|
+
/**
|
|
131
|
+
* One row of a SidebarNav (#327): a link to a page, or a button for an action such as "New chat".
|
|
132
|
+
* Renders an `li`, so it sits in SidebarNav's or a SidebarNavSection's list.
|
|
133
|
+
*/
|
|
134
|
+
var SidebarNavItem = function SidebarNavItem(_a) {
|
|
135
|
+
var label = _a.label,
|
|
136
|
+
icon = _a.icon,
|
|
137
|
+
url = _a.url,
|
|
138
|
+
onClick = _a.onClick,
|
|
139
|
+
_b = _a.current,
|
|
140
|
+
current = _b === void 0 ? false : _b,
|
|
141
|
+
meta = _a.meta,
|
|
142
|
+
badge = _a.badge,
|
|
143
|
+
badgeLabel = _a.badgeLabel,
|
|
144
|
+
dataTestId = _a["data-testid"];
|
|
145
|
+
var _c = useSidebarNav(),
|
|
146
|
+
collapsed = _c.collapsed,
|
|
147
|
+
linkComponent = _c.linkComponent,
|
|
148
|
+
glide = _c.glide;
|
|
149
|
+
var hasBadge = badge === 'dot' || typeof badge === 'number' && badge > 0;
|
|
150
|
+
var badgeText = badgeLabel !== null && badgeLabel !== void 0 ? badgeLabel : badge === 'dot' ? 'new' : "".concat(badge, " new");
|
|
151
|
+
// The badge's own text would make a noisy name, so a badged item is named outright; so is an
|
|
152
|
+
// item in the rail, where the label isn't shown
|
|
153
|
+
var name = hasBadge ? "".concat(label, ", ").concat(badgeText) : collapsed ? label : undefined;
|
|
154
|
+
var count = typeof badge === 'number' ? badge : 0;
|
|
155
|
+
// Everything stays mounted and fades, so collapsing and expanding never jump (issue 348). Hidden
|
|
156
|
+
// content leaves screen readers once its fade ends; the rail names the row with aria-label.
|
|
157
|
+
var content = jsxs(Fragment, {
|
|
158
|
+
children: [icon && jsxs(IconBox, {
|
|
159
|
+
children: [jsx(Icon, {
|
|
160
|
+
name: icon,
|
|
161
|
+
size: "md",
|
|
162
|
+
iconColor: "inherit"
|
|
163
|
+
}), hasBadge && jsx(Corner, {
|
|
164
|
+
"$hidden": !collapsed,
|
|
165
|
+
children: jsx(Badge, {
|
|
166
|
+
variant: "accent",
|
|
167
|
+
dot: true,
|
|
168
|
+
"aria-label": badgeText,
|
|
169
|
+
children: jsx("span", {})
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
}), jsxs(Inner, {
|
|
173
|
+
"$withIcon": Boolean(icon),
|
|
174
|
+
children: [jsx(Label, {
|
|
175
|
+
"$hidden": collapsed,
|
|
176
|
+
children: label
|
|
177
|
+
}), meta && jsx(Meta, {
|
|
178
|
+
"$hidden": collapsed,
|
|
179
|
+
children: meta
|
|
180
|
+
}), hasBadge && jsx(EndSlot, {
|
|
181
|
+
"$hidden": collapsed,
|
|
182
|
+
children: jsx(Badge, {
|
|
183
|
+
variant: "accent",
|
|
184
|
+
dot: badge === 'dot',
|
|
185
|
+
count: count,
|
|
186
|
+
"aria-label": badgeText,
|
|
187
|
+
children: jsx(EndAnchor, {})
|
|
188
|
+
})
|
|
189
|
+
})]
|
|
190
|
+
})]
|
|
191
|
+
});
|
|
192
|
+
var shared = {
|
|
193
|
+
$current: current,
|
|
194
|
+
$glide: glide,
|
|
195
|
+
// The icon is decorative (0028)
|
|
196
|
+
'aria-label': name,
|
|
197
|
+
'data-testid': dataTestId,
|
|
198
|
+
// SidebarNav's gliding highlight finds rows by this (0053)
|
|
199
|
+
'data-sidebar-row': '',
|
|
200
|
+
onClick: onClick
|
|
201
|
+
};
|
|
202
|
+
var row = url ? jsx(Row, __assign({}, shared, linkComponent && isInternalUrl(url) ? {
|
|
203
|
+
as: linkComponent
|
|
204
|
+
} : {}, {
|
|
205
|
+
href: url,
|
|
206
|
+
"aria-current": current ? 'page' : undefined,
|
|
207
|
+
children: content
|
|
208
|
+
})) :
|
|
209
|
+
// aria-current="page" marks a link to the current page; a button isn't one
|
|
210
|
+
jsx(Row, __assign({}, shared, {
|
|
211
|
+
as: "button",
|
|
212
|
+
type: "button",
|
|
213
|
+
children: content
|
|
214
|
+
}));
|
|
215
|
+
return (
|
|
216
|
+
// The Tooltip is always there, turned off while the label is visible, so collapsing never
|
|
217
|
+
// remounts the row (which would lose focus and skip its transitions)
|
|
218
|
+
jsx(Item, {
|
|
219
|
+
"$open": !collapsed || Boolean(icon),
|
|
220
|
+
children: jsx("div", {
|
|
221
|
+
children: jsx(Tooltip, {
|
|
222
|
+
text: label,
|
|
223
|
+
side: "right",
|
|
224
|
+
disabled: !collapsed,
|
|
225
|
+
children: row
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
SidebarNavItem.displayName = 'SidebarNavItem';
|
|
232
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
233
|
+
|
|
234
|
+
export { SidebarNavItem };
|
|
235
|
+
//# sourceMappingURL=SidebarNavItem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarNavItem.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SidebarNav sets this on itself: its expanded width. Content inside keeps that width while the nav
|
|
3
|
+
* narrows, so the nav's edge clips it instead of it reflowing or ellipsising mid-move.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EXPANDED_WIDTH_VAR = "--co-sidebar-nav-expanded";
|
|
6
|
+
/**
|
|
7
|
+
* SidebarNav sets this to its body's scrollbar width (0 for overlay scrollbars), measured while
|
|
8
|
+
* expanded, since a classic scrollbar narrows every row
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCROLLBAR_VAR = "--co-sidebar-nav-scrollbar";
|
|
11
|
+
/** The nav's own side padding: the rail's inner width is the rail less twice this */
|
|
12
|
+
export declare const NAV_PADDING: string;
|
|
13
|
+
/** A row's left inset: centres an icon in the rail, and stays the same expanded, so icons never move */
|
|
14
|
+
export declare const ROW_INSET: string;
|
|
15
|
+
/**
|
|
16
|
+
* Fades content that the rail doesn't show (labels, meta text, the badge count, the header and
|
|
17
|
+
* footer). Leaving is quick and accelerates; arriving decelerates over the width's duration (0037).
|
|
18
|
+
* Hidden content also leaves the keyboard and screen readers once the fade ends.
|
|
19
|
+
*/
|
|
20
|
+
export declare const fade: (hidden: boolean) => import("styled-components").RuleSet<object>;
|
|
21
|
+
/**
|
|
22
|
+
* Folds something away (its height animates to nothing, with a fade), for what the rail leaves out:
|
|
23
|
+
* a section's header, a section with nothing to show, an item without an icon. Under reduced motion
|
|
24
|
+
* the height changes at once and only the fade remains (0015).
|
|
25
|
+
*/
|
|
26
|
+
export declare const Fold: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
27
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types.js").CSSPropertiesWithVars | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
$open: boolean;
|
|
30
|
+
}>> & string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SidebarNav sets this on itself: its expanded width. Content inside keeps that width while the nav
|
|
3
|
+
* narrows, so the nav's edge clips it instead of it reflowing or ellipsising mid-move.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EXPANDED_WIDTH_VAR = "--co-sidebar-nav-expanded";
|
|
6
|
+
/**
|
|
7
|
+
* SidebarNav sets this to its body's scrollbar width (0 for overlay scrollbars), measured while
|
|
8
|
+
* expanded, since a classic scrollbar narrows every row
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCROLLBAR_VAR = "--co-sidebar-nav-scrollbar";
|
|
11
|
+
/** The nav's own side padding: the rail's inner width is the rail less twice this */
|
|
12
|
+
export declare const NAV_PADDING: string;
|
|
13
|
+
/** A row's left inset: centres an icon in the rail, and stays the same expanded, so icons never move */
|
|
14
|
+
export declare const ROW_INSET: string;
|
|
15
|
+
/**
|
|
16
|
+
* Fades content that the rail doesn't show (labels, meta text, the badge count, the header and
|
|
17
|
+
* footer). Leaving is quick and accelerates; arriving decelerates over the width's duration (0037).
|
|
18
|
+
* Hidden content also leaves the keyboard and screen readers once the fade ends.
|
|
19
|
+
*/
|
|
20
|
+
export declare const fade: (hidden: boolean) => import("styled-components").RuleSet<object>;
|
|
21
|
+
/**
|
|
22
|
+
* Folds something away (its height animates to nothing, with a fade), for what the rail leaves out:
|
|
23
|
+
* a section's header, a section with nothing to show, an item without an icon. Under reduced motion
|
|
24
|
+
* the height changes at once and only the fade remains (0015).
|
|
25
|
+
*/
|
|
26
|
+
export declare const Fold: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
27
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
$open: boolean;
|
|
30
|
+
}>> & string;
|
|
@@ -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":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SidebarNavSectionProps {
|
|
3
|
+
/** The section's visible label, which also names its list */
|
|
4
|
+
label: string;
|
|
5
|
+
/** The section's `SidebarNavItem`s */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the label is a disclosure button that shows and hides the items.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
collapsible?: boolean;
|
|
12
|
+
/** Whether the items are shown (controlled). Use with `onExpandedChange`. */
|
|
13
|
+
expanded?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the items start shown (uncontrolled).
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
defaultExpanded?: boolean;
|
|
19
|
+
/** Called when a collapsible section is shown or hidden */
|
|
20
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* One action for the section, such as an IconButton for "New chat" or "Search". Hidden in the
|
|
23
|
+
* rail.
|
|
24
|
+
*/
|
|
25
|
+
action?: React.ReactElement;
|
|
26
|
+
/** Test identifier for the section */
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A labelled group of SidebarNavItems (#328), optionally collapsible, with one optional action.
|
|
31
|
+
* In the rail its label and action are hidden and a rule separates it from the section above.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SidebarNavSection: {
|
|
34
|
+
({ label, children, collapsible, expanded: expandedProp, defaultExpanded, onExpandedChange, action, "data-testid": dataTestId, }: SidebarNavSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SidebarNavSectionProps {
|
|
3
|
+
/** The section's visible label, which also names its list */
|
|
4
|
+
label: string;
|
|
5
|
+
/** The section's `SidebarNavItem`s */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the label is a disclosure button that shows and hides the items.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
collapsible?: boolean;
|
|
12
|
+
/** Whether the items are shown (controlled). Use with `onExpandedChange`. */
|
|
13
|
+
expanded?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the items start shown (uncontrolled).
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
defaultExpanded?: boolean;
|
|
19
|
+
/** Called when a collapsible section is shown or hidden */
|
|
20
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* One action for the section, such as an IconButton for "New chat" or "Search". Hidden in the
|
|
23
|
+
* rail.
|
|
24
|
+
*/
|
|
25
|
+
action?: React.ReactElement;
|
|
26
|
+
/** Test identifier for the section */
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A labelled group of SidebarNavItems (#328), optionally collapsible, with one optional action.
|
|
31
|
+
* In the rail its label and action are hidden and a rule separates it from the section above.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SidebarNavSection: {
|
|
34
|
+
({ label, children, collapsible, expanded: expandedProp, defaultExpanded, onExpandedChange, action, "data-testid": dataTestId, }: SidebarNavSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|