@canonical/react-ds-app 0.38.0 → 0.42.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/esm/lib/ContentLayout/styles.css +1 -1
- package/dist/esm/lib/SideNavigation/SideNavigation.js +45 -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 +48 -2
- 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 +45 -21
- 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 +13 -3
- 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 +66 -28
- package/dist/esm/lib/SideNavigation/common/Item/Item.js +10 -14
- package/dist/esm/lib/SideNavigation/common/Item/Item.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/Item/styles.css +71 -36
- 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 +63 -21
- package/dist/esm/lib/SideNavigation/common/NavTree/NavTree.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/NavTree/styles.css +7 -30
- 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 +272 -19
- package/dist/types/lib/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
- package/dist/types/lib/ContentLayout/ContentLayout.d.ts.map +1 -1
- package/dist/types/lib/ContentLayout/types.d.ts +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 +6 -1
- 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 +5 -8
- 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 +5 -8
- 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/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 +18 -7
- 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 +168 -24
- package/dist/types/lib/SideNavigation/types.d.ts.map +1 -1
- package/dist/types/lib/ViewLayout/ViewLayout.d.ts.map +1 -1
- package/package.json +22 -22
|
@@ -1,54 +1,198 @@
|
|
|
1
1
|
import type { IconName } from "@canonical/ds-assets";
|
|
2
|
-
import type { _DistributiveOmit, Item } from "@canonical/ds-types";
|
|
3
2
|
import type { LinkComponentProps } from "@canonical/react-ds-global";
|
|
4
3
|
import type { ComponentProps, ComponentType, ReactNode } from "react";
|
|
4
|
+
import type { ContextSwitcherProps } from "./common/ContextSwitcher/types.js";
|
|
5
5
|
export type { LinkComponentProps };
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - `slot` — trailing content for **leaf** items (end slot): a badge, count,
|
|
12
|
-
* etc. Ignored when the item has subitems — those show a disclosure caret
|
|
13
|
-
* automatically (`end = hasSubitems ? caret : slot`).
|
|
14
|
-
*
|
|
15
|
-
* No discriminated union to author: the caret-vs-slot choice is structural,
|
|
16
|
-
* derived from whether the item has `items`.
|
|
7
|
+
* A single navigable, non-expandable row — the leaf of the content tree.
|
|
8
|
+
* Renders as a link (via `LinkComponent`) when `url` is set, otherwise a
|
|
9
|
+
* plain non-navigable label. The content tree carries links and labels
|
|
10
|
+
* only — interactive rows are Footer-only, so a leaf has no `onClick`.
|
|
17
11
|
*/
|
|
18
|
-
export
|
|
12
|
+
export interface LeafNavItem {
|
|
13
|
+
/** Unique identifier when no `url` is present (e.g. a non-navigable label). */
|
|
14
|
+
key?: string;
|
|
15
|
+
/** Navigation target. Renders as a link via `LinkComponent`; omitted (or absent) renders a plain label. */
|
|
16
|
+
url?: string;
|
|
17
|
+
/** Display text. Text only, matching the base WD405 `Item` contract — not JSX. */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Whether the item is interactive. A disabled item's `url` is not rendered as a link. */
|
|
20
|
+
disabled?: boolean;
|
|
19
21
|
/** Leading icon (start slot), by ds-assets icon name. */
|
|
20
22
|
icon?: IconName;
|
|
21
|
-
/** Trailing content
|
|
23
|
+
/** Trailing content (end slot): a badge, count, etc. */
|
|
22
24
|
slot?: ReactNode;
|
|
23
|
-
/** Subitems. Presence drives the disclosure caret (vs the leaf `slot`). */
|
|
24
|
-
items?: NavItem[];
|
|
25
25
|
/** CSS class name applied to this item's row, in addition to the base classes. */
|
|
26
26
|
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A collapsible row that discloses its own children instead of navigating.
|
|
30
|
+
* Cannot have a `url` and depth is exactly one
|
|
31
|
+
* level — children are always `LeafNavItem` and cannot themselves expand.
|
|
32
|
+
* No `slot` either: the end slot is always the disclosure caret.
|
|
33
|
+
*/
|
|
34
|
+
export type ExpandableNavItem = Omit<LeafNavItem, "url" | "slot"> & {
|
|
35
|
+
/** Children revealed on expand. Always leaves — see the depth-1 note above. */
|
|
36
|
+
items: LeafNavItem[];
|
|
27
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* A single content-tree entry: either a plain/navigable row or one that
|
|
40
|
+
* discloses further (leaf-only) children.
|
|
41
|
+
*/
|
|
42
|
+
export type NavItem = LeafNavItem | ExpandableNavItem;
|
|
43
|
+
/**
|
|
44
|
+
* A named collection of `NavItem` entries with an optional header
|
|
45
|
+
* (`SideNavigation.GroupHeader`) — the shape of `root`'s direct children.
|
|
46
|
+
*/
|
|
47
|
+
export interface NavGroup {
|
|
48
|
+
/**
|
|
49
|
+
* Required identity: the shared navigation tree (`useNavigationTree`)
|
|
50
|
+
* indexes every node by `key` or `url`, and a group never has a `url`.
|
|
51
|
+
*/
|
|
52
|
+
key: string;
|
|
53
|
+
/** Group header text, rendered via `SideNavigation.GroupHeader`. Omitted when absent. */
|
|
54
|
+
label?: string;
|
|
55
|
+
/** The group's navigation entries. */
|
|
56
|
+
items?: NavItem[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The root passed to `root`: itself never rendered, only its `NavGroup`
|
|
60
|
+
* children are. (The footer's data shape is `FooterRoot` — a flat
|
|
61
|
+
* `FooterItem` list, no groups.)
|
|
62
|
+
*/
|
|
63
|
+
export interface NavRoot {
|
|
64
|
+
/** Required — see `NavGroup.key`: every tree node needs an identity. */
|
|
65
|
+
key: string;
|
|
66
|
+
items?: NavGroup[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A single footer-tree leaf row. The Footer is the one place a navigation
|
|
70
|
+
* row may render as a button: `control` picks between the link (default
|
|
71
|
+
* when `url` is set) and the `"button"` action row. Items are free-form —
|
|
72
|
+
* the component supplies no closed vocabulary or defaults. A toggle-style
|
|
73
|
+
* row composes `ItemButton` plus a `slot` (e.g. a state badge) rather than
|
|
74
|
+
* a `checked`/`onCheckedChange` circuit.
|
|
75
|
+
*/
|
|
76
|
+
export interface LeafFooterItem {
|
|
77
|
+
/** Display text. Required — the component supplies no default labels. */
|
|
78
|
+
label: string;
|
|
79
|
+
/** Leading icon (start slot), by ds-assets icon name. */
|
|
80
|
+
icon?: IconName;
|
|
81
|
+
/** Navigable footer items render as a link when this is set. */
|
|
82
|
+
url?: string;
|
|
83
|
+
/** Selects the rendered row: `"link"` (default when `url` is set) or `"button"` (an action row). */
|
|
84
|
+
control?: "link" | "button";
|
|
85
|
+
/** `control: "button"` (the default without a `url`) — called when activated. */
|
|
86
|
+
onClick?: () => void;
|
|
87
|
+
/** Trailing content (e.g. an unread-count badge). */
|
|
88
|
+
slot?: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A collapsible footer row that discloses its own (always-leaf) children —
|
|
92
|
+
* the footer's flavour of `ExpandableNavItem`: no `url`/`control`/`onClick`
|
|
93
|
+
* (an expandable row is neither a page nor an action) and no `slot` (the
|
|
94
|
+
* end slot is the caret). Depth is one level.
|
|
95
|
+
*/
|
|
96
|
+
export type ExpandableFooterItem = Omit<LeafFooterItem, "url" | "control" | "onClick" | "slot"> & {
|
|
97
|
+
/** Children revealed on expand — always `LeafFooterItem` leaves. */
|
|
98
|
+
items: LeafFooterItem[];
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* A single footer-tree entry: a leaf row (link or action) or one that
|
|
102
|
+
* discloses further (leaf-only) children.
|
|
103
|
+
*/
|
|
104
|
+
export type FooterItem = LeafFooterItem | ExpandableFooterItem;
|
|
105
|
+
/** The footer's data root — the footer's only data surface. Its direct
|
|
106
|
+
* `items` render as the footer's rows. */
|
|
107
|
+
export interface FooterRoot {
|
|
108
|
+
key: string;
|
|
109
|
+
items?: FooterItem[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Internal. `useNavigationTree` (`@canonical/react-hooks`) is generic over
|
|
113
|
+
* one homogeneous item shape for the whole tree — this is that shape: the
|
|
114
|
+
* union of every field any tier can carry, so `NavRoot`/`NavGroup`/`NavItem`
|
|
115
|
+
* all assign to it without casts at the call site. Carries the same
|
|
116
|
+
* key-or-url identity requirement as the WD405 `Item` (`getItemId` looks
|
|
117
|
+
* every node up by one of the two). Exported only because `NavTree` lives
|
|
118
|
+
* in a different module — not part of the public API.
|
|
119
|
+
*/
|
|
120
|
+
type _AnyNavNodeFields = {
|
|
121
|
+
label?: string;
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
icon?: IconName;
|
|
124
|
+
slot?: ReactNode;
|
|
125
|
+
className?: string;
|
|
126
|
+
items?: _AnyNavNode[];
|
|
127
|
+
};
|
|
128
|
+
export type _AnyNavNode = _AnyNavNodeFields & ({
|
|
129
|
+
key: string;
|
|
130
|
+
url?: undefined;
|
|
131
|
+
} | {
|
|
132
|
+
key?: string;
|
|
133
|
+
url: string;
|
|
134
|
+
});
|
|
28
135
|
type OwnProps = {
|
|
29
136
|
/** Brand content (logo/wordmark) rendered in the header. */
|
|
30
137
|
brand?: ReactNode;
|
|
31
138
|
/** Optional application name/wordmark shown beside the brand in the header. */
|
|
32
139
|
applicationName?: ReactNode;
|
|
140
|
+
/**
|
|
141
|
+
* Skip-link target: the `href` the visually hidden "Skip to main content"
|
|
142
|
+
* link points at, letting keyboard users bypass the navigation block.
|
|
143
|
+
* Defaults to `"#main-content"`; set it to the app's actual main-content
|
|
144
|
+
* id. The link always renders.
|
|
145
|
+
*/
|
|
146
|
+
skipTo?: string;
|
|
33
147
|
/** Main navigation, as a root NavItem. Its direct children are rendered. */
|
|
34
|
-
root?:
|
|
35
|
-
/**
|
|
36
|
-
|
|
148
|
+
root?: NavRoot;
|
|
149
|
+
/**
|
|
150
|
+
* The footer's only data surface: free-form leaves (`LeafFooterItem`) and
|
|
151
|
+
* depth-1 expandables (`ExpandableFooterItem`), rendered as the footer's
|
|
152
|
+
* rows in the order given. Omit (or pass empty) to hide the footer.
|
|
153
|
+
*/
|
|
154
|
+
footerRoot?: FooterRoot;
|
|
37
155
|
/**
|
|
38
156
|
* Component used to render navigable items (those with a `url`). Receives
|
|
39
|
-
* `LinkComponentProps`. Defaults to `"a"
|
|
40
|
-
*
|
|
157
|
+
* `LinkComponentProps`. Defaults to `"a"`; pass a router `Link` to
|
|
158
|
+
* integrate with client-side navigation.
|
|
41
159
|
*/
|
|
42
160
|
LinkComponent?: ComponentType<LinkComponentProps> | "a";
|
|
43
161
|
/**
|
|
44
|
-
* Live current location, used to resolve which item is active
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* state updates on navigation.
|
|
162
|
+
* Live current location, used to resolve which item is active (marked
|
|
163
|
+
* `aria-current`, ancestors expanded). Keep it in sync with the
|
|
164
|
+
* consumer's router so the active state updates on navigation.
|
|
48
165
|
*/
|
|
49
166
|
currentUrl?: string;
|
|
50
167
|
/** Initial expanded (rail) state when uncontrolled. Defaults to `true`. */
|
|
51
168
|
defaultExpanded?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Binds the Ctrl+B rail-collapse shortcut. Defaults to `true`;
|
|
171
|
+
* pass `false` to opt out.
|
|
172
|
+
*/
|
|
173
|
+
keyboardShortcut?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* The context-switcher region's props (typed slot), rendered as its own
|
|
176
|
+
* region between the Header and Content in a plain `<div>` — a
|
|
177
|
+
* `role="menu"` select-like widget is not navigation, so it sits outside
|
|
178
|
+
* the `<nav>` landmark. Omitted renders no region. See
|
|
179
|
+
* `ContextSwitcherProps`.
|
|
180
|
+
*/
|
|
181
|
+
contextSwitcher?: ContextSwitcherProps;
|
|
52
182
|
};
|
|
183
|
+
/**
|
|
184
|
+
* SideNavigation's root is a plain `<div>` layout container — Header, the
|
|
185
|
+
* optional ContextSwitcher region, the `<nav>` landmark (rendered by
|
|
186
|
+
* `Content`), and Footer. The navigation landmark belongs to `Content`
|
|
187
|
+
* alone (branding, the context switcher, and the footer's actions are not
|
|
188
|
+
* navigation); `aria-label` is forwarded there and defaults to
|
|
189
|
+
* `"Main navigation"`. Native attribute pass-through follows the root
|
|
190
|
+
* element (`ComponentProps<"div">`).
|
|
191
|
+
*
|
|
192
|
+
* Consumption pattern: data-driven only — pass props and all four regions
|
|
193
|
+
* build. Every subcomponent is private
|
|
194
|
+
* (`cs:react.component.subcomponent_export_api`): nothing is dot-static
|
|
195
|
+
* exported, and subcomponents render exclusively from data.
|
|
196
|
+
*/
|
|
53
197
|
export type SideNavigationProps = OwnProps & Omit<ComponentProps<"div">, keyof OwnProps>;
|
|
54
198
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/SideNavigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/SideNavigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2GAA2G;IAC3G,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,wDAAwD;IACxD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,MAAM,CAAC,GAAG;IAClE,+EAA+E;IAC/E,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAEtD;;;GAGG;A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e,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ViewLayout.d.ts","sourceRoot":"","sources":["../../../../src/lib/ViewLayout/ViewLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,UAAU,6CAKb,eAAe,KAAG,KAAK,CAAC,YAU1B,CAAC;eAEa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-ds-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"test:vitest:watch": "vitest"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@canonical/ds-assets": "^0.
|
|
43
|
-
"@canonical/ds-types": "^0.
|
|
44
|
-
"@canonical/ds-utils": "^0.
|
|
45
|
-
"@canonical/react-ds-global": "^0.
|
|
46
|
-
"@canonical/react-hooks": "^0.
|
|
47
|
-
"@canonical/storybook-config": "^0.
|
|
48
|
-
"@canonical/styles": "^0.
|
|
42
|
+
"@canonical/ds-assets": "^0.42.0",
|
|
43
|
+
"@canonical/ds-types": "^0.42.0",
|
|
44
|
+
"@canonical/ds-utils": "^0.42.0",
|
|
45
|
+
"@canonical/react-ds-global": "^0.42.0",
|
|
46
|
+
"@canonical/react-hooks": "^0.42.0",
|
|
47
|
+
"@canonical/storybook-config": "^0.42.0",
|
|
48
|
+
"@canonical/styles": "^0.42.0",
|
|
49
49
|
"react": "^19.2.4",
|
|
50
50
|
"react-dom": "^19.2.4"
|
|
51
51
|
},
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@biomejs/biome": "2.5.
|
|
66
|
-
"@canonical/biome-config": "^0.
|
|
65
|
+
"@biomejs/biome": "2.5.14",
|
|
66
|
+
"@canonical/biome-config": "^0.42.0",
|
|
67
67
|
"@canonical/design-tokens": "0.10.0",
|
|
68
|
-
"@canonical/router-core": "^0.
|
|
69
|
-
"@canonical/router-react": "^0.
|
|
70
|
-
"@canonical/storybook-addon-utils": "^0.
|
|
71
|
-
"@canonical/storybook-helpers": "^0.
|
|
72
|
-
"@canonical/typescript-config-react": "^0.
|
|
73
|
-
"@canonical/vitest-config-react": "^0.
|
|
74
|
-
"@canonical/webarchitect": "^0.
|
|
68
|
+
"@canonical/router-core": "^0.42.0",
|
|
69
|
+
"@canonical/router-react": "^0.42.0",
|
|
70
|
+
"@canonical/storybook-addon-utils": "^0.42.0",
|
|
71
|
+
"@canonical/storybook-helpers": "^0.42.0",
|
|
72
|
+
"@canonical/typescript-config-react": "^0.42.0",
|
|
73
|
+
"@canonical/vitest-config-react": "^0.42.0",
|
|
74
|
+
"@canonical/webarchitect": "^0.42.0",
|
|
75
75
|
"@chromatic-com/storybook": "^5.0.1",
|
|
76
|
-
"@storybook/addon-docs": "^10.
|
|
77
|
-
"@storybook/react-vite": "^10.
|
|
76
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
77
|
+
"@storybook/react-vite": "^10.6.0",
|
|
78
78
|
"@testing-library/jest-dom": "^7.0.0",
|
|
79
79
|
"@testing-library/react": "^16.3.2",
|
|
80
80
|
"@types/node": "^26.0.0",
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
"copyfiles": "^2.4.1",
|
|
85
85
|
"globals": "^17.4.0",
|
|
86
86
|
"jsdom": "^28.1.0",
|
|
87
|
-
"storybook": "^10.
|
|
88
|
-
"typescript": "^
|
|
87
|
+
"storybook": "^10.6.0",
|
|
88
|
+
"typescript": "^7.0.2",
|
|
89
89
|
"vite": "^8.0.1",
|
|
90
90
|
"vitest": "^4.0.18"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "75c2b17029ba899be3fa645be28290ac6fcb83a9"
|
|
93
93
|
}
|