@canonical/react-ds-app 0.37.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/esm/lib/ApplicationLayout/styles.css +27 -24
- package/dist/esm/lib/ContentLayout/styles.css +13 -10
- package/dist/esm/lib/SideNavigation/SideNavigation.js +51 -9
- package/dist/esm/lib/SideNavigation/SideNavigation.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/CollapseToggle/CollapseToggle.js +14 -6
- package/dist/esm/lib/SideNavigation/common/CollapseToggle/CollapseToggle.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/CollapseToggle/styles.css +52 -3
- package/dist/esm/lib/SideNavigation/common/Content/Content.js +9 -5
- package/dist/esm/lib/SideNavigation/common/Content/Content.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/Content/styles.css +55 -28
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.js +70 -0
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/index.js +2 -0
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/index.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/styles.css +94 -0
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/types.js +2 -0
- package/dist/esm/lib/SideNavigation/common/ContextSwitcher/types.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/Footer/Footer.js +46 -6
- package/dist/esm/lib/SideNavigation/common/Footer/Footer.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/Footer/styles.css +17 -4
- package/dist/esm/lib/SideNavigation/common/Group/Group.js +14 -0
- package/dist/esm/lib/SideNavigation/common/Group/Group.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/Group/index.js +2 -0
- package/dist/esm/lib/SideNavigation/common/Group/index.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/Group/styles.css +18 -0
- package/dist/esm/lib/SideNavigation/common/Group/types.js +2 -0
- package/dist/esm/lib/SideNavigation/common/Group/types.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/GroupHeader.js +17 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/GroupHeader.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/index.js +2 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/index.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/styles.css +31 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/types.js +2 -0
- package/dist/esm/lib/SideNavigation/common/GroupHeader/types.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/Header/Header.js +4 -2
- package/dist/esm/lib/SideNavigation/common/Header/Header.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/Header/styles.css +73 -32
- package/dist/esm/lib/SideNavigation/common/Item/Item.js +9 -13
- package/dist/esm/lib/SideNavigation/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/Item/styles.css +86 -46
- package/dist/esm/lib/SideNavigation/common/ItemButton/ItemButton.js +18 -0
- package/dist/esm/lib/SideNavigation/common/ItemButton/ItemButton.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ItemButton/index.js +2 -0
- package/dist/esm/lib/SideNavigation/common/ItemButton/index.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ItemButton/styles.css +79 -0
- package/dist/esm/lib/SideNavigation/common/ItemButton/types.js +2 -0
- package/dist/esm/lib/SideNavigation/common/ItemButton/types.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/ItemExpandable.js +71 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/ItemExpandable.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/index.js +2 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/index.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/styles.css +121 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/types.js +2 -0
- package/dist/esm/lib/SideNavigation/common/ItemExpandable/types.js.map +1 -0
- package/dist/esm/lib/SideNavigation/common/NavTree/NavTree.js +64 -22
- package/dist/esm/lib/SideNavigation/common/NavTree/NavTree.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/NavTree/styles.css +10 -28
- package/dist/esm/lib/SideNavigation/common/index.js +5 -0
- package/dist/esm/lib/SideNavigation/common/index.js.map +1 -1
- package/dist/esm/lib/SideNavigation/helpItem.js +29 -0
- package/dist/esm/lib/SideNavigation/helpItem.js.map +1 -0
- package/dist/esm/lib/SideNavigation/hooks/useCollapseShortcut/index.js +2 -0
- package/dist/esm/lib/SideNavigation/hooks/useCollapseShortcut/index.js.map +1 -0
- package/dist/esm/lib/SideNavigation/hooks/useCollapseShortcut/types.js +2 -0
- package/dist/esm/lib/SideNavigation/hooks/useCollapseShortcut/types.js.map +1 -0
- package/dist/esm/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.js +45 -0
- package/dist/esm/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.js.map +1 -0
- package/dist/esm/lib/SideNavigation/index.js +1 -0
- package/dist/esm/lib/SideNavigation/index.js.map +1 -1
- package/dist/esm/lib/SideNavigation/styles.css +280 -24
- package/dist/esm/lib/ViewLayout/styles.css +25 -22
- package/dist/types/lib/ApplicationLayout/types.d.ts +5 -3
- package/dist/types/lib/ApplicationLayout/types.d.ts.map +1 -1
- package/dist/types/lib/ContentLayout/types.d.ts +5 -3
- package/dist/types/lib/ContentLayout/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/SideNavigation.d.ts +22 -1
- package/dist/types/lib/SideNavigation/SideNavigation.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/CollapseToggle/CollapseToggle.d.ts +9 -2
- package/dist/types/lib/SideNavigation/common/CollapseToggle/CollapseToggle.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/CollapseToggle/types.d.ts +10 -3
- package/dist/types/lib/SideNavigation/common/CollapseToggle/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Content/Content.d.ts +8 -4
- package/dist/types/lib/SideNavigation/common/Content/Content.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Content/types.d.ts +8 -9
- package/dist/types/lib/SideNavigation/common/Content/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.d.ts +20 -0
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/index.d.ts +3 -0
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/index.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/types.d.ts +52 -0
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/types.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/Footer/Footer.d.ts +8 -4
- package/dist/types/lib/SideNavigation/common/Footer/Footer.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Footer/types.d.ts +9 -10
- package/dist/types/lib/SideNavigation/common/Footer/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Group/Group.d.ts +13 -0
- package/dist/types/lib/SideNavigation/common/Group/Group.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/Group/index.d.ts +3 -0
- package/dist/types/lib/SideNavigation/common/Group/index.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/Group/types.d.ts +10 -0
- package/dist/types/lib/SideNavigation/common/Group/types.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/GroupHeader/GroupHeader.d.ts +13 -0
- package/dist/types/lib/SideNavigation/common/GroupHeader/GroupHeader.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/GroupHeader/index.d.ts +3 -0
- package/dist/types/lib/SideNavigation/common/GroupHeader/index.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/GroupHeader/types.d.ts +8 -0
- package/dist/types/lib/SideNavigation/common/GroupHeader/types.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/Header/Header.d.ts +3 -1
- package/dist/types/lib/SideNavigation/common/Header/Header.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Header/types.d.ts +5 -3
- package/dist/types/lib/SideNavigation/common/Header/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Item/Item.d.ts +8 -9
- package/dist/types/lib/SideNavigation/common/Item/Item.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Item/types.d.ts +19 -8
- package/dist/types/lib/SideNavigation/common/Item/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/ItemButton/ItemButton.d.ts +17 -0
- package/dist/types/lib/SideNavigation/common/ItemButton/ItemButton.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ItemButton/index.d.ts +3 -0
- package/dist/types/lib/SideNavigation/common/ItemButton/index.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ItemButton/types.d.ts +17 -0
- package/dist/types/lib/SideNavigation/common/ItemButton/types.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ItemExpandable/ItemExpandable.d.ts +26 -0
- package/dist/types/lib/SideNavigation/common/ItemExpandable/ItemExpandable.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ItemExpandable/index.d.ts +3 -0
- package/dist/types/lib/SideNavigation/common/ItemExpandable/index.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/ItemExpandable/types.d.ts +32 -0
- package/dist/types/lib/SideNavigation/common/ItemExpandable/types.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/common/NavTree/NavTree.d.ts +12 -13
- package/dist/types/lib/SideNavigation/common/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/NavTree/types.d.ts +7 -5
- package/dist/types/lib/SideNavigation/common/NavTree/types.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/index.d.ts +5 -0
- package/dist/types/lib/SideNavigation/common/index.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/helpItem.d.ts +20 -0
- package/dist/types/lib/SideNavigation/helpItem.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/index.d.ts +3 -0
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/index.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/types.d.ts +14 -0
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/types.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.d.ts +14 -0
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.d.ts.map +1 -0
- package/dist/types/lib/SideNavigation/index.d.ts +1 -0
- package/dist/types/lib/SideNavigation/index.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/types.d.ts +172 -27
- package/dist/types/lib/SideNavigation/types.d.ts.map +1 -1
- package/dist/types/lib/ViewLayout/types.d.ts +5 -3
- package/dist/types/lib/ViewLayout/types.d.ts.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ContextSwitcher/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,56 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Item } from "../Item/index.js";
|
|
3
|
+
import { ItemButton } from "../ItemButton/index.js";
|
|
4
|
+
import { ItemExpandable } from "../ItemExpandable/index.js";
|
|
3
5
|
import "./styles.css";
|
|
4
6
|
const componentCssClassName = "ds footer";
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
8
|
+
* Renders one footer leaf row. The Footer is the one place a navigation row
|
|
9
|
+
* may be a button. Three-way dispatch: a navigable item (`url` set,
|
|
10
|
+
* `control` not `"button"`) renders as `Item` (a link via `LinkComponent`,
|
|
11
|
+
* active when current); an action item (`control: "button"`, or `onClick`
|
|
12
|
+
* with no `url`) renders as `ItemButton`; anything else — a label-only row
|
|
13
|
+
* like a logged-in username — renders as `Item`'s plain label row, NOT an
|
|
14
|
+
* inert `<button>` announced as an action that does nothing. Explicit
|
|
15
|
+
* `control` always wins over the `url`-presence inference, so an action
|
|
16
|
+
* item may carry a `url` yet render as a button. Toggle-style rows compose
|
|
17
|
+
* `ItemButton` plus a `slot` — there is no dedicated switch.
|
|
18
|
+
*/
|
|
19
|
+
const renderFooterItem = (item, currentUrl, LinkComponent) => {
|
|
20
|
+
// `label` is the row's identity (required on LeafFooterItem), so it is
|
|
21
|
+
// the element key — reordering the authored list preserves each row's
|
|
22
|
+
// state. Two same-labelled rows in one footer collide; that's ambiguous
|
|
23
|
+
// UI, left to the consumer to avoid.
|
|
24
|
+
if (item.control !== "button" && item.url) {
|
|
25
|
+
const active = item.url === currentUrl;
|
|
26
|
+
return (_jsx(Item, { url: item.url, icon: item.icon, slot: item.slot, LinkComponent: LinkComponent, active: active, children: item.label }, item.label));
|
|
27
|
+
}
|
|
28
|
+
if (item.control === "button" || item.onClick) {
|
|
29
|
+
return (_jsx(ItemButton, { icon: item.icon, slot: item.slot, onClick: item.onClick, children: item.label }, item.label));
|
|
30
|
+
}
|
|
31
|
+
return (_jsx(Item, { icon: item.icon, slot: item.slot, children: item.label }, item.label));
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* SideNavigation.Footer — optional region pinned to the bottom, reserved
|
|
35
|
+
* for user-related content. Data-only: `root` is the footer's only data
|
|
36
|
+
* surface — free-form leaves (`LeafFooterItem`, buttons via
|
|
37
|
+
* `control`/`onClick`) and depth-1 expandables (`ExpandableFooterItem`,
|
|
38
|
+
* whose children disclose through the same native `<details>` disclosure
|
|
39
|
+
* the content tree uses). A certificate-user application, for instance,
|
|
40
|
+
* composes the `certificate` icon and omits the logout item itself.
|
|
9
41
|
*
|
|
10
42
|
* @implements ds:apps.subcomponent.side-navigation-footer
|
|
11
43
|
*/
|
|
12
|
-
const Footer = ({ className, root, LinkComponent = "a", currentUrl,
|
|
13
|
-
|
|
44
|
+
const Footer = ({ className, root, LinkComponent = "a", currentUrl, ...props }) => {
|
|
45
|
+
const list = root?.items ?? [];
|
|
46
|
+
return (_jsx("footer", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: list.length > 0 ? (_jsx("ul", { className: "list", children: list.map((entry) => "items" in entry && entry.items.length > 0 ? (_jsx(ItemExpandable, { heading: entry.label, icon: entry.icon, collapseOnChildClick: true,
|
|
47
|
+
// Seed from whether a child row is the current location;
|
|
48
|
+
// the disclosure's one-way sync re-opens it on navigation.
|
|
49
|
+
// The `url !== undefined` guard matters: without it, a
|
|
50
|
+
// label-only child (no `url`) matches an unset `currentUrl`
|
|
51
|
+
// (`undefined === undefined`) and the disclosure seeds open
|
|
52
|
+
// whenever `currentUrl` isn't wired.
|
|
53
|
+
defaultExpanded: entry.items.some((child) => child.url !== undefined && child.url === currentUrl), children: entry.items.map((child) => renderFooterItem(child, currentUrl, LinkComponent)) }, entry.label)) : (renderFooterItem(entry, currentUrl, LinkComponent))) })) : null }));
|
|
14
54
|
};
|
|
15
55
|
export default Footer;
|
|
16
56
|
//# sourceMappingURL=Footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Footer/Footer.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Footer.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Footer/Footer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,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ated by @canonical/summon-component:react v0.1.0
|
|
1
|
+
/* Generated by @canonical/summon-component:react v0.1.0
|
|
2
|
+
* Layer: ds.components.apps (@canonical/styles README, "Cascade layers"). */
|
|
3
|
+
@layer ds.components.apps {
|
|
4
|
+
.ds.footer {
|
|
5
|
+
/* 0.5rem of bottom spacing. */
|
|
6
|
+
padding-block-end: var(--dimension-100);
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
/* Flat list reset — the footer's rows are always a flat list (leaves and
|
|
9
|
+
depth-1 expandables; no groups), so this owns the structure reset
|
|
10
|
+
directly. */
|
|
11
|
+
& > .list {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
list-style: none;
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
6
19
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { GroupHeader } from "../GroupHeader/index.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
const componentCssClassName = "ds side-navigation-group";
|
|
5
|
+
/**
|
|
6
|
+
* SideNavigation.Group — a named collection of navigation entries, with an
|
|
7
|
+
* optional SideNavigation.GroupHeader. One of NavTree's direct content
|
|
8
|
+
* entries.
|
|
9
|
+
*
|
|
10
|
+
* @implements ds:apps.subcomponent.side-navigation-group
|
|
11
|
+
*/
|
|
12
|
+
const Group = ({ label, children, className, ...props }) => (_jsxs("section", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: [label != null && _jsx(GroupHeader, { children: label }), _jsx("ul", { className: "list", children: children })] }));
|
|
13
|
+
export default Group;
|
|
14
|
+
//# sourceMappingURL=Group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Group/Group.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,KAAK,GAAG,CAAC,EACb,KAAK,EACL,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACG,EAAsB,EAAE,CAAC,CACpC,mBACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KACnE,KAAK,aAER,KAAK,IAAI,IAAI,IAAI,KAAC,WAAW,cAAE,KAAK,GAAe,EACpD,aAAI,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAM,IAC5B,CACX,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* Generated by @canonical/summon-component:react v0.1.0
|
|
2
|
+
* Layer: ds.components.apps (@canonical/styles README, "Cascade layers"). */
|
|
3
|
+
@layer ds.components.apps {
|
|
4
|
+
.ds.side-navigation-group {
|
|
5
|
+
/* Vertical rhythm between groups is owned by the scroller, not the group:
|
|
6
|
+
Content's flex `gap: 0.5rem` spaces adjacent Groups (and GroupHeader
|
|
7
|
+
carries its own top padding for the gap above a group's first item),
|
|
8
|
+
so this rule declares no spacing of its own. */
|
|
9
|
+
|
|
10
|
+
> .list {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
list-style: none;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Group/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./styles.css";
|
|
3
|
+
const componentCssClassName = "ds side-navigation-group-header";
|
|
4
|
+
/**
|
|
5
|
+
* SideNavigation.GroupHeader — the optional label above a
|
|
6
|
+
* SideNavigation.Group's entries. Purely presentational; rendered by Group
|
|
7
|
+
* when its `label` is set.
|
|
8
|
+
*
|
|
9
|
+
* @implements ds:apps.subcomponent.side-navigation-group-header
|
|
10
|
+
*/
|
|
11
|
+
const GroupHeader = ({ children, className, ...props }) => (_jsx("span", { className: [componentCssClassName, className].filter(Boolean).join(" "),
|
|
12
|
+
// `title` — native tooltip fallback for a truncated header.
|
|
13
|
+
// Only meaningful when the header is plain text
|
|
14
|
+
// (the common case — Group always passes its string `label` here).
|
|
15
|
+
title: typeof children === "string" ? children : undefined, ...props, children: children }));
|
|
16
|
+
export default GroupHeader;
|
|
17
|
+
//# sourceMappingURL=GroupHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupHeader.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/GroupHeader/GroupHeader.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACS,EAAsB,EAAE,CAAC,CAC1C,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;IACvE,4DAA4D;IAC5D,gDAAgD;IAChD,mEAAmE;IACnE,KAAK,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,KACtD,KAAK,YAER,QAAQ,GACJ,CACR,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/GroupHeader/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Generated by @canonical/summon-component:react v0.1.0
|
|
2
|
+
* Layer: ds.components.apps (@canonical/styles README, "Cascade layers"). */
|
|
3
|
+
@layer ds.components.apps {
|
|
4
|
+
.ds.side-navigation-group-header {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: baseline;
|
|
7
|
+
color: var(--color-text-muted);
|
|
8
|
+
font-family: var(--typography-text-tertiary-bold-font-family);
|
|
9
|
+
font-size: var(--typography-text-tertiary-bold-font-size);
|
|
10
|
+
font-weight: var(--typography-text-tertiary-bold-font-weight);
|
|
11
|
+
line-height: var(--typography-text-tertiary-bold-line-height);
|
|
12
|
+
letter-spacing: var(--typography-text-tertiary-bold-letter-spacing);
|
|
13
|
+
padding-top: var(--sidenav-icon-gap);
|
|
14
|
+
padding-inline: var(--sidenav-inset-inline); /* 0.5 rem */
|
|
15
|
+
/* Figma's group-heading component sets its text style's case to `UPPER`
|
|
16
|
+
(a literal transform of the authored string, confirmed against the
|
|
17
|
+
source file — not a font feature): "Header" renders as "HEADER", not
|
|
18
|
+
via small-caps. `typography.heading.5` supplies the
|
|
19
|
+
size/weight/line-height/letter-spacing but is a `font-variant:
|
|
20
|
+
small-caps` treatment, which (for a mixed-case label like "Hardware")
|
|
21
|
+
renders differently — only the leading capital stays full-height, the
|
|
22
|
+
rest becomes reduced-height caps — not uniform block capitals. Layering
|
|
23
|
+
`text-transform: uppercase` here reproduces the spec's literal case
|
|
24
|
+
without revisiting which token supplies the rest of the type scale. */
|
|
25
|
+
text-transform: uppercase;
|
|
26
|
+
/* Group headers are single-line and truncate. */
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/GroupHeader/types.ts"],"names":[],"mappings":""}
|
|
@@ -5,12 +5,14 @@ const componentCssClassName = "ds side-navigation-header";
|
|
|
5
5
|
/**
|
|
6
6
|
* SideNavigation.Header — top region holding the brand (the `brand` node, at the
|
|
7
7
|
* start) and the collapse toggle (at the end). The toggle is omitted when no
|
|
8
|
-
* `onToggle` handler is provided.
|
|
8
|
+
* `onToggle` handler is provided. Collapsed: the layout
|
|
9
|
+
* switches to a centred column — the toggle relocates below the logo rather
|
|
10
|
+
* than beside it — driven by `data-expanded` on the root.
|
|
9
11
|
*
|
|
10
12
|
* @implements ds:apps.subcomponent.side-navigation-header
|
|
11
13
|
*/
|
|
12
14
|
const Header = ({ className, brand, applicationName, expanded, onToggle, collapseControls, ...props }) => {
|
|
13
|
-
return (_jsxs("header", { className: [componentCssClassName, className].filter(Boolean).join(" "), ...props, children: [_jsx("div", { className: "brand", children: brand }), applicationName != null && (_jsx("
|
|
15
|
+
return (_jsxs("header", { className: [componentCssClassName, className].filter(Boolean).join(" "), "data-expanded": expanded, ...props, children: [_jsxs("div", { className: "brand-container", children: [_jsx("div", { className: "brand", children: brand }), applicationName != null && (_jsx("h1", { className: "title", children: applicationName }))] }), onToggle && (_jsx(CollapseToggle, { expanded: expanded, "aria-controls": collapseControls, onClick: onToggle }))] }));
|
|
14
16
|
};
|
|
15
17
|
export default Header;
|
|
16
18
|
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Header/Header.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Header/Header.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,SAAS,EACT,KAAK,EACL,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,GAAG,KAAK,EACI,EAAsB,EAAE;IACpC,OAAO,CACL,kBACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,mBACxD,QAAQ,KACnB,KAAK,aAET,eAAK,SAAS,EAAC,iBAAiB,aAC9B,cAAK,SAAS,EAAC,OAAO,YAAE,KAAK,GAAO,EAInC,eAAe,IAAI,IAAI,IAAI,CAC1B,aAAI,SAAS,EAAC,OAAO,YAAE,eAAe,GAAM,CAC7C,IACG,EACL,QAAQ,IAAI,CACX,KAAC,cAAc,IACb,QAAQ,EAAE,QAAQ,mBACH,gBAAgB,EAC/B,OAAO,EAAE,QAAQ,GACjB,CACH,IACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,37 +1,78 @@
|
|
|
1
|
-
/* Generated by @canonical/summon-component:react v0.1.0
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
same row height as the items below) keeps the header on the rail's rhythm.
|
|
9
|
-
align-items: start tops every cell so the brand rectangle fills from the
|
|
10
|
-
top and the title/toggle sit at the top of the row. */
|
|
11
|
-
block-size: calc(var(--space-baseline) * 5); /* 40px — 5bU */
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
align-items: start;
|
|
14
|
-
gap: var(--dimension-100); /* 0.5rem */
|
|
15
|
-
|
|
16
|
-
/* Pin each part to its column explicitly so the toggle stays in the end
|
|
17
|
-
column even when the optional title is absent. */
|
|
18
|
-
.brand {
|
|
19
|
-
/* Start column, aligned with the item icons below. Tops-align with the rest
|
|
20
|
-
of the row (align-items: start); the brand's own margin/padding handles
|
|
21
|
-
its vertical placement, not a stretched cell. */
|
|
22
|
-
grid-column: 1;
|
|
1
|
+
/* Generated by @canonical/summon-component:react v0.1.0
|
|
2
|
+
* Layer: ds.components.apps (@canonical/styles README, "Cascade layers"). */
|
|
3
|
+
@layer ds.components.apps {
|
|
4
|
+
.ds.side-navigation-header {
|
|
5
|
+
/* Logo at the start, collapse toggle at the end. Both top-align at the
|
|
6
|
+
same 0.5rem inset so the collapse icon lines up with the logo and,
|
|
7
|
+
below it, every item's leading icon. */
|
|
23
8
|
display: flex;
|
|
24
|
-
align-items:
|
|
25
|
-
|
|
9
|
+
align-items: baseline;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
/* 0.5rem — deliberate deviation from the upstream 24.04 design's 1rem
|
|
12
|
+
to the right of the collapse button, keeping the header reading tight
|
|
13
|
+
like the rest of the rail. */
|
|
14
|
+
gap: var(--dimension-100);
|
|
26
15
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
.brand-container {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: baseline;
|
|
19
|
+
gap: var(--dimension-050);
|
|
20
|
+
padding-inline: var(--sidenav-inset-inline);
|
|
21
|
+
|
|
22
|
+
.brand {
|
|
23
|
+
block-size: var(--sidenav-logo-block-size);
|
|
24
|
+
inline-size: var(--sidenav-logo-inline-size);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* `.title` (the <h1> beside the logo) is a sibling of `.brand`, not its
|
|
28
|
+
descendant — the collapsed-state `[data-expanded="false"] .title`
|
|
29
|
+
override below needs to reach the same specificity family, or the
|
|
30
|
+
cascade order between them isn't guaranteed. Single-line, truncating:
|
|
31
|
+
a long application name must not wrap and push the header taller
|
|
32
|
+
than its baseline. Its line-height is the logo's box height so the
|
|
33
|
+
row stays exactly as tall as the logo. */
|
|
34
|
+
.title {
|
|
35
|
+
min-width: 0;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
line-height: var(--sidenav-logo-block-size);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Collapsed: a centred column — logo on top, the collapse
|
|
44
|
+
toggle relocates below it rather than beside it. DOM order already
|
|
45
|
+
places the toggle last, so switching the axis alone moves it there; no
|
|
46
|
+
title has room, so it's dropped entirely rather than left to overflow
|
|
47
|
+
a rail this narrow. The rearrangement is instant by design — no
|
|
48
|
+
`transition` property here. */
|
|
49
|
+
&[data-expanded="false"] {
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
justify-content: flex-start;
|
|
53
|
+
|
|
54
|
+
.title {
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Responsive: the header keeps its normal
|
|
60
|
+
row layout on mobile — collapsed there means "menu closed", not "narrow
|
|
61
|
+
icon rail", so the centred-column rearrangement above doesn't apply. */
|
|
62
|
+
@media (width < 620px) {
|
|
63
|
+
align-items: flex-start;
|
|
64
|
+
padding-inline-end: 0;
|
|
65
|
+
|
|
66
|
+
&[data-expanded="false"] {
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
align-items: stretch;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
padding-block-end: var(--dimension-100);
|
|
32
71
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
72
|
+
.title {
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
36
77
|
}
|
|
37
78
|
}
|
|
@@ -5,24 +5,20 @@ const componentCssClassName = "ds side-navigation-item";
|
|
|
5
5
|
/**
|
|
6
6
|
* SideNavigation.Item — the default renderer for a single navigation item.
|
|
7
7
|
*
|
|
8
|
-
* A flat leaf row, NOT recursive
|
|
9
|
-
*
|
|
8
|
+
* A flat leaf row, NOT recursive — an entry with children is a
|
|
9
|
+
* SideNavigation.ItemExpandable instead. The row is
|
|
10
|
+
* `[icon] [content] [end]` over a shared grid template (so the icon aligns
|
|
10
11
|
* with the header logo). An item with a `url` renders as a link via
|
|
11
|
-
* `LinkComponent` (default `"a"`); otherwise a non-navigable label.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* behaviour is deferred);
|
|
16
|
-
* - leaf → the optional `slot` (a badge, count, …), or nothing.
|
|
12
|
+
* `LinkComponent` (default `"a"`); otherwise a non-navigable label. The end
|
|
13
|
+
* slot is the optional `slot` (a badge, count, …), or nothing. Content is
|
|
14
|
+
* composed via `children`, matching `Button`'s own convention — pass
|
|
15
|
+
* anything, not only text.
|
|
17
16
|
*
|
|
18
17
|
* @implements ds:apps.subcomponent.side-navigation-item
|
|
19
18
|
*/
|
|
20
|
-
const Item = ({ url,
|
|
21
|
-
// NavItem fields not spread to the DOM.
|
|
22
|
-
key: _key, items, className, ...props }) => {
|
|
19
|
+
const Item = ({ url, children, icon, slot, disabled = false, active = false, LinkComponent = "a", className, ...props }) => {
|
|
23
20
|
const Link = LinkComponent;
|
|
24
|
-
const
|
|
25
|
-
const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "start p", children: icon ? _jsx(Icon, { icon: icon }) : null }), _jsx("span", { className: "label p", children: label }), hasSubitems ? (_jsx(Icon, { icon: "chevron-down", className: "end caret" })) : slot ? (_jsx("span", { className: "end slot", children: slot })) : null] }));
|
|
21
|
+
const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "start", children: icon ? _jsx(Icon, { width: 16, height: 16, icon: icon }) : null }), _jsx("span", { className: "label", title: typeof children === "string" ? children : undefined, children: children }), slot ? _jsx("span", { className: "end slot", children: slot }) : null] }));
|
|
26
22
|
return (_jsx("li", { className: [componentCssClassName, className].filter(Boolean).join(" "), "data-disabled": disabled || undefined, "data-active": active || undefined, ...props, children: url ? (_jsx(Link, { className: "row", href: disabled ? undefined : url, "aria-current": active ? "page" : undefined, children: content })) : (_jsx("span", { className: "row", "aria-current": active ? "page" : undefined, children: content })) }));
|
|
27
23
|
};
|
|
28
24
|
export default Item;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Item/Item.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Item/Item.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,KAAK,EACd,aAAa,GAAG,GAAG,EACnB,SAAS,EACT,GAAG,KAAK,EACE,EAAsB,EAAE;IAClC,MAAM,IAAI,GAAG,aAAa,CAAC;IAE3B,MAAM,OAAO,GAAG,CACd,8BAGE,eAAM,SAAS,EAAC,OAAO,Y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|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
/* Generated by @canonical/summon-component:react v0.1.0
|
|
2
|
+
* Layer: ds.components.apps (@canonical/styles README, "Cascade layers"). */
|
|
3
|
+
@layer ds.components.apps {
|
|
4
|
+
.ds.side-navigation-item {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
list-style: none;
|
|
9
|
+
height: var(--dimension-400);
|
|
10
|
+
|
|
11
|
+
/* The row: link or label. [icon] [label] [end], 0.5rem gap, 0.5rem inset —
|
|
12
|
+
shares --sidenav-inset-inline/--sidenav-icon-gap with the header so the
|
|
13
|
+
leading icon lines up with the logo above it. Fixed row height
|
|
14
|
+
(`--dimension-400`, 2rem) — reverses the intrinsic, padding-driven
|
|
15
|
+
height this file previously read. */
|
|
16
|
+
& > .row {
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-columns: var(--sidenav-icon-column-inline-size) 1fr auto;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--sidenav-icon-gap); /* 0.5rem */
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
padding-inline: var(--sidenav-inset-inline); /* 0.5rem */
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
text-decoration: none;
|
|
26
|
+
color: var(--color-text);
|
|
27
|
+
background: var(--sidenav-row-background);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Hover changes the background only — text/icon colour stays constant
|
|
31
|
+
across states. Disabled items never hover/press. */
|
|
32
|
+
&:not([data-disabled]) > .row {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
background: var(--sidenav-row-background-hover);
|
|
37
|
+
}
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
text-align: center;
|
|
39
|
+
&:active {
|
|
40
|
+
background: var(--sidenav-row-background-active);
|
|
41
|
+
}
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
&:focus-visible {
|
|
44
|
+
outline: 2px solid currentColor;
|
|
45
|
+
outline-offset: -2px;
|
|
46
|
+
}
|
|
36
47
|
}
|
|
37
|
-
}
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
&[data-active] > .row {
|
|
50
|
+
background: var(--sidenav-row-background-active);
|
|
51
|
+
box-shadow: inset var(--dimension-stroke-thickness-medium) 0 0 0
|
|
52
|
+
var(--color-icon);
|
|
53
|
+
}
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
/* Declared after [data-active] so a disabled+active item (edge case) still
|
|
56
|
+
reads as disabled. */
|
|
57
|
+
&[data-disabled] > .row {
|
|
58
|
+
color: var(--color-text-disabled);
|
|
59
|
+
background: var(--sidenav-row-background-disabled);
|
|
60
|
+
cursor: default;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Leading icon slot — always reserved (empty when absent) so labels align
|
|
64
|
+
whether or not a row has an icon. */
|
|
65
|
+
& .start {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
color: var(--color-icon);
|
|
70
|
+
width: var(--dimension-250);
|
|
71
|
+
height: var(--dimension-250);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&[data-disabled] .start {
|
|
75
|
+
color: var(--color-icon-disabled);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Label → middle (1fr) column. */
|
|
79
|
+
/* Item labels are single-line and truncate. */
|
|
80
|
+
& .label {
|
|
81
|
+
min-width: 0;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
}
|
|
48
86
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
87
|
+
/* Trailing slot (e.g. a badge) → end (auto) column. */
|
|
88
|
+
& .end {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
}
|
|
53
93
|
}
|
|
54
94
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@canonical/react-ds-global";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
const componentCssClassName = "ds side-navigation-item-button";
|
|
5
|
+
/**
|
|
6
|
+
* SideNavigation.ItemButton — a navigation row that performs an action
|
|
7
|
+
* instead of navigating (e.g. "Log out", "Create context"). Buttons are a
|
|
8
|
+
* Footer-only row kind: the content tree accepts links and plain labels,
|
|
9
|
+
* so an `ItemButton` belongs in a `SideNavigation.Footer` — rendered from
|
|
10
|
+
* a `control: "button"` footer item or composed via the Footer's
|
|
11
|
+
* `children`. Content is composed via `children`,
|
|
12
|
+
* matching `Button`'s own convention.
|
|
13
|
+
*
|
|
14
|
+
* @implements ds:apps.subcomponent.side-navigation-item-button
|
|
15
|
+
*/
|
|
16
|
+
const ItemButton = ({ children, icon, slot, className, ...props }) => (_jsx("li", { className: [componentCssClassName, className].filter(Boolean).join(" "), children: _jsxs("button", { className: "row", ...props, type: "button", children: [_jsx("span", { className: "start", children: icon ? _jsx(Icon, { width: 16, height: 16, icon: icon }) : null }), _jsx("span", { className: "label", title: typeof children === "string" ? children : undefined, children: children }), slot ? _jsx("span", { className: "end slot", children: slot }) : null] }) }));
|
|
17
|
+
export default ItemButton;
|
|
18
|
+
//# sourceMappingURL=ItemButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemButton.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ItemButton/ItemButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,gCAAgC,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,GAAG,CAAC,EAClB,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACQ,EAAsB,EAAE,CAAC,CACzC,aAAI,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YACzE,kBAAQ,SAAS,EAAC,KAAK,KAAK,KAAK,EAAE,IAAI,EAAC,QAAQ,aAG9C,eAAM,SAAS,EAAC,OAAO,YACpB,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,GACrD,EAEP,eACE,SAAS,EAAC,OAAO,EACjB,KAAK,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAEzD,QAAQ,GACJ,EACN,IAAI,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,UAAU,YAAE,IAAI,GAAQ,CAAC,CAAC,CAAC,IAAI,IAChD,GACN,CACN,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ItemButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|