@arshad-shah/cynosure 0.3.0 → 0.4.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 +3 -3
- package/dist/adapters/astro/index.d.ts +52 -0
- package/dist/adapters/astro/index.js +27 -0
- package/dist/adapters/astro/index.js.map +1 -0
- package/dist/adapters/vite/index.d.ts +11 -0
- package/dist/adapters/vite/index.js +33 -12
- package/dist/adapters/vite/index.js.map +1 -1
- package/dist/brands/googleplay.d.ts +2 -0
- package/dist/brands/googleplay.js +17 -0
- package/dist/brands/googleplay.js.map +1 -0
- package/dist/brands/index.d.ts +1 -0
- package/dist/brands/index.js +132 -130
- package/dist/components/Announcer/Announcer.js +5 -5
- package/dist/components/Announcer/Announcer.js.map +1 -1
- package/dist/components/AppShell/AppShell.js +50 -53
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Avatar/Avatar.js +20 -20
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Button/Button.d.ts +17 -3
- package/dist/components/Button/Button.js +51 -44
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.js +69 -69
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Card/Card.d.ts +8 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +4 -4
- package/dist/components/Checkbox/Checkbox.js +33 -8
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checklist/Checklist.js +21 -21
- package/dist/components/Checklist/Checklist.js.map +1 -1
- package/dist/components/Choice/Choice.d.ts +73 -0
- package/dist/components/Choice/Choice.js +41 -0
- package/dist/components/Choice/Choice.js.map +1 -0
- package/dist/components/Choice/index.d.ts +1 -0
- package/dist/components/ColorField/ColorField.js +198 -207
- package/dist/components/ColorField/ColorField.js.map +1 -1
- package/dist/components/Combobox/Combobox.js +86 -115
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/Container/Container.d.ts +2 -2
- package/dist/components/Container/Container.js +17 -13
- package/dist/components/Container/Container.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.js +29 -28
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/DeviceFrame/DeviceFrame.d.ts +63 -0
- package/dist/components/DeviceFrame/DeviceFrame.js +54 -0
- package/dist/components/DeviceFrame/DeviceFrame.js.map +1 -0
- package/dist/components/DeviceFrame/index.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +10 -1
- package/dist/components/Dialog/Dialog.js +82 -77
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +5 -2
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/Field/Field.js +31 -33
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/FileDrop/FileDrop.js +14 -14
- package/dist/components/FileDrop/FileDrop.js.map +1 -1
- package/dist/components/FloatingToolbar/FloatingToolbar.js +7 -6
- package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +32 -11
- package/dist/components/Grid/Grid.js +68 -46
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/Grid/index.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +4 -2
- package/dist/components/Heading/Heading.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +16 -1
- package/dist/components/IconButton/IconButton.js +14 -10
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/IconTile/IconTile.d.ts +45 -0
- package/dist/components/IconTile/IconTile.js +25 -0
- package/dist/components/IconTile/IconTile.js.map +1 -0
- package/dist/components/IconTile/index.d.ts +1 -0
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/Inline/Inline.d.ts +3 -3
- package/dist/components/Inline/Inline.js +12 -22
- package/dist/components/Inline/Inline.js.map +1 -1
- package/dist/components/KeyValueEditor/KeyValueEditor.js +37 -36
- package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
- package/dist/components/Link/Link.d.ts +9 -1
- package/dist/components/Link/Link.js +20 -18
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/List/List.d.ts +73 -0
- package/dist/components/List/List.js +64 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/List/index.d.ts +1 -0
- package/dist/components/Notice/Notice.js +12 -11
- package/dist/components/Notice/Notice.js.map +1 -1
- package/dist/components/OptionList/OptionList.d.ts +69 -0
- package/dist/components/OptionList/OptionList.js +75 -0
- package/dist/components/OptionList/OptionList.js.map +1 -0
- package/dist/components/OptionList/index.d.ts +1 -0
- package/dist/components/PageHeader/PageHeader.d.ts +6 -0
- package/dist/components/PageHeader/PageHeader.js +27 -27
- package/dist/components/PageHeader/PageHeader.js.map +1 -1
- package/dist/components/Pagination/Pagination.js +31 -30
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/QRCode/QRCode.d.ts +56 -0
- package/dist/components/QRCode/QRCode.js +48 -0
- package/dist/components/QRCode/QRCode.js.map +1 -0
- package/dist/components/QRCode/index.d.ts +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +32 -24
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/Section/Section.d.ts +57 -0
- package/dist/components/Section/Section.js +27 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/Section/index.d.ts +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +12 -12
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.js +106 -133
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Sheet/Sheet.js +12 -7
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/SideNav/SideNav.js +55 -53
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SiteFooter/SiteFooter.d.ts +66 -0
- package/dist/components/SiteFooter/SiteFooter.js +80 -0
- package/dist/components/SiteFooter/SiteFooter.js.map +1 -0
- package/dist/components/SiteFooter/index.d.ts +1 -0
- package/dist/components/SiteHeader/SiteHeader.d.ts +78 -0
- package/dist/components/SiteHeader/SiteHeader.js +114 -0
- package/dist/components/SiteHeader/SiteHeader.js.map +1 -0
- package/dist/components/SiteHeader/index.d.ts +1 -0
- package/dist/components/SkipLink/SkipLink.d.ts +42 -0
- package/dist/components/SkipLink/SkipLink.js +43 -0
- package/dist/components/SkipLink/SkipLink.js.map +1 -0
- package/dist/components/SkipLink/index.d.ts +1 -0
- package/dist/components/SortableList/SortableList.js +13 -13
- package/dist/components/SortableList/SortableList.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +16 -7
- package/dist/components/Stack/Stack.js +25 -18
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/index.d.ts +1 -1
- package/dist/components/Stack/space.d.ts +29 -0
- package/dist/components/Stack/space.js +16 -5
- package/dist/components/Stack/space.js.map +1 -1
- package/dist/components/Stat/Stat.d.ts +88 -0
- package/dist/components/Stat/Stat.js +105 -0
- package/dist/components/Stat/Stat.js.map +1 -0
- package/dist/components/Stat/index.d.ts +1 -0
- package/dist/components/Steps/Steps.d.ts +10 -4
- package/dist/components/Steps/Steps.js +31 -30
- package/dist/components/Steps/Steps.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +4 -4
- package/dist/components/Switch/Switch.js +18 -7
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Table/Table.js +11 -12
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +4 -1
- package/dist/components/Tabs/Tabs.js +71 -70
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/TagInput/TagInput.js +76 -97
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +4 -0
- package/dist/components/TextField/TextField.js +30 -29
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +7 -1
- package/dist/components/ThemeToggle/ThemeToggle.js +33 -30
- package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -1
- package/dist/components/Toast/Toast.js +22 -20
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +6 -1
- package/dist/components/Tooltip/Tooltip.js +19 -19
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +17 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/foundations/ChoiceBase/ChoiceBase.js +8 -8
- package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
- package/dist/foundations/HiddenValue/HiddenValue.js +5 -5
- package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
- package/dist/foundations/Icon/Icon.d.ts +6 -1
- package/dist/foundations/Icon/Icon.js +15 -14
- package/dist/foundations/Icon/Icon.js.map +1 -1
- package/dist/foundations/image-outcome.d.ts +8 -3
- package/dist/foundations/image-outcome.js +12 -8
- package/dist/foundations/image-outcome.js.map +1 -1
- package/dist/foundations/printing.d.ts +6 -0
- package/dist/foundations/printing.js +17 -0
- package/dist/foundations/printing.js.map +1 -0
- package/dist/foundations/qr.d.ts +42 -0
- package/dist/foundations/qr.js +246 -0
- package/dist/foundations/qr.js.map +1 -0
- package/dist/icons/book-marked.d.ts +2 -0
- package/dist/icons/book-marked.js +14 -0
- package/dist/icons/book-marked.js.map +1 -0
- package/dist/icons/calendar-days.d.ts +2 -0
- package/dist/icons/calendar-days.js +24 -0
- package/dist/icons/calendar-days.js.map +1 -0
- package/dist/icons/check-square.d.ts +2 -0
- package/dist/icons/check-square.js +14 -0
- package/dist/icons/check-square.js.map +1 -0
- package/dist/icons/crescent.d.ts +2 -0
- package/dist/icons/crescent.js +14 -0
- package/dist/icons/crescent.js.map +1 -0
- package/dist/icons/index.d.ts +10 -0
- package/dist/icons/index.js +436 -416
- package/dist/icons/kaaba.d.ts +2 -0
- package/dist/icons/kaaba.js +14 -0
- package/dist/icons/kaaba.js.map +1 -0
- package/dist/icons/keywords.d.ts +11 -1
- package/dist/icons/keywords.js +89 -1
- package/dist/icons/keywords.js.map +1 -1
- package/dist/icons/list-tree.d.ts +2 -0
- package/dist/icons/list-tree.js +14 -0
- package/dist/icons/list-tree.js.map +1 -0
- package/dist/icons/mosque.d.ts +2 -0
- package/dist/icons/mosque.js +14 -0
- package/dist/icons/mosque.js.map +1 -0
- package/dist/icons/prayer-beads.d.ts +2 -0
- package/dist/icons/prayer-beads.js +67 -0
- package/dist/icons/prayer-beads.js.map +1 -0
- package/dist/icons/qr-code.d.ts +2 -0
- package/dist/icons/qr-code.js +38 -0
- package/dist/icons/qr-code.js.map +1 -0
- package/dist/icons/refresh-cw.d.ts +2 -0
- package/dist/icons/refresh-cw.js +14 -0
- package/dist/icons/refresh-cw.js.map +1 -0
- package/dist/icons/types.d.ts +1 -1
- package/dist/icons/types.js +2 -1
- package/dist/icons/types.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.js +274 -241
- package/dist/styles/announcer.css +1 -1
- package/dist/styles/app-shell.css +1 -1
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/choice-base.css +1 -0
- package/dist/styles/choice.css +1 -1
- package/dist/styles/color-field.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/copy-button.css +1 -1
- package/dist/styles/date-field.css +1 -1
- package/dist/styles/device-frame.css +1 -0
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/disclosure.css +1 -1
- package/dist/styles/field.css +1 -1
- package/dist/styles/file-drop.css +1 -1
- package/dist/styles/floating-toolbar.css +1 -1
- package/dist/styles/generated-css.d.ts +1 -1
- package/dist/styles/generated-css.js +1 -1
- package/dist/styles/generated-css.js.map +1 -1
- package/dist/styles/grid.css +1 -1
- package/dist/styles/heading.css +1 -1
- package/dist/styles/icon-tile.css +1 -0
- package/dist/styles/icon.css +1 -1
- package/dist/styles/inline.css +1 -0
- package/dist/styles/key-value-editor.css +1 -1
- package/dist/styles/link.css +1 -1
- package/dist/styles/list.css +1 -0
- package/dist/styles/manifest.json +715 -0
- package/dist/styles/notice.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/option-list.css +1 -0
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/qr-code.css +1 -0
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/section.css +1 -0
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/sheet.css +1 -1
- package/dist/styles/side-nav.css +1 -1
- package/dist/styles/site-footer.css +1 -0
- package/dist/styles/site-header.css +1 -0
- package/dist/styles/skip-link.css +1 -0
- package/dist/styles/sortable-list.css +1 -1
- package/dist/styles/stack.css +1 -1
- package/dist/styles/stat.css +1 -0
- package/dist/styles/steps.css +1 -1
- package/dist/styles/switch.css +1 -0
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/tag-input.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/time-field.css +1 -1
- package/dist/styles/toast.css +1 -1
- package/dist/styles/visually-hidden.css +1 -0
- package/dist/styles.css +1 -1
- package/dist/tokens/create-theme.js +137 -108
- package/dist/tokens/create-theme.js.map +1 -1
- package/package.json +6 -1
- package/dist/components/Checkbox/ChoiceRow.d.ts +0 -39
- package/dist/components/Checkbox/ChoiceRow.js +0 -58
- package/dist/components/Checkbox/ChoiceRow.js.map +0 -1
- package/dist/styles/hidden-value.css +0 -1
- package/dist/styles/iconbutton.css +0 -1
- package/dist/styles/search-field.css +0 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ButtonBase as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { chevronDown as
|
|
5
|
-
import { LinkBase as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Tooltip as
|
|
8
|
-
import { IconButton as
|
|
9
|
-
import { useEffect as
|
|
10
|
-
import { Fragment as
|
|
11
|
-
var
|
|
12
|
-
function
|
|
2
|
+
import { ButtonBase as D } from "../../foundations/ButtonBase/ButtonBase.js";
|
|
3
|
+
import { Icon as E } from "../../foundations/Icon/Icon.js";
|
|
4
|
+
import { chevronDown as q } from "../../icons/chevron-down.js";
|
|
5
|
+
import { LinkBase as z } from "../../foundations/LinkBase/LinkBase.js";
|
|
6
|
+
import { Button as G } from "../Button/Button.js";
|
|
7
|
+
import { Tooltip as H } from "../Tooltip/Tooltip.js";
|
|
8
|
+
import { IconButton as J } from "../IconButton/IconButton.js";
|
|
9
|
+
import { useEffect as K, useId as O, useState as Q } from "react";
|
|
10
|
+
import { Fragment as R, jsx as s, jsxs as k } from "react/jsx-runtime";
|
|
11
|
+
var F = (i) => !("id" in i), L = (i) => "kind" in i;
|
|
12
|
+
function x(i, d, l = []) {
|
|
13
13
|
if (!d) return null;
|
|
14
14
|
for (const o of i) {
|
|
15
15
|
if (o.id === d) return l;
|
|
16
|
-
const v = o.items &&
|
|
16
|
+
const v = o.items && x(o.items, d, [...l, o.id]);
|
|
17
17
|
if (v) return v;
|
|
18
18
|
}
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
const h =
|
|
24
|
-
|
|
25
|
-
y &&
|
|
21
|
+
var U = (i) => /* @__PURE__ */ s(z, { ...i });
|
|
22
|
+
function ie({ label: i, items: d, current: l, onNavigate: o, renderLink: v = U, collapsed: r = !1, onCollapsedChange: A, defaultExpanded: M = [], layout: S = "column", size: p = "md", className: w, style: P }) {
|
|
23
|
+
const h = O(), c = S === "bar", b = r && !c, C = d.flatMap((e) => F(e) ? e.items : [e]), B = C.filter((e) => !L(e)), [j, m] = Q(() => /* @__PURE__ */ new Set([...M, ...x(B, l) ?? []])), y = x(B, l)?.join(" ");
|
|
24
|
+
K(() => {
|
|
25
|
+
y && m((e) => y.split(" ").every((n) => e.has(n)) ? e : /* @__PURE__ */ new Set([...e, ...y.split(" ")]));
|
|
26
26
|
}, [y]);
|
|
27
|
-
const
|
|
27
|
+
const T = (e) => m((n) => {
|
|
28
28
|
const t = new Set(n);
|
|
29
29
|
return t.delete(e) || t.add(e), t;
|
|
30
|
-
}),
|
|
31
|
-
e.icon && /* @__PURE__ */ s(
|
|
30
|
+
}), N = (e, n) => /* @__PURE__ */ k(R, { children: [
|
|
31
|
+
e.icon && /* @__PURE__ */ s(E, {
|
|
32
32
|
icon: e.icon,
|
|
33
33
|
className: "cy-side-nav-icon"
|
|
34
34
|
}),
|
|
35
35
|
/* @__PURE__ */ s("span", {
|
|
36
|
-
className:
|
|
36
|
+
className: `cy-side-nav-label cy-reset${b ? " cy-visually-hidden" : ""}`,
|
|
37
37
|
children: e.label
|
|
38
38
|
}),
|
|
39
39
|
e.badge != null && /* @__PURE__ */ s("span", {
|
|
40
40
|
className: "cy-side-nav-badge cy-reset",
|
|
41
41
|
children: e.badge
|
|
42
42
|
}),
|
|
43
|
-
n && !c && /* @__PURE__ */ s(
|
|
44
|
-
icon:
|
|
43
|
+
n && !c && /* @__PURE__ */ s(E, {
|
|
44
|
+
icon: q,
|
|
45
45
|
className: "cy-side-nav-chevron"
|
|
46
46
|
})
|
|
47
|
-
] }),
|
|
47
|
+
] }), W = (e) => {
|
|
48
48
|
const n = {
|
|
49
49
|
className: "cy-side-nav-action",
|
|
50
50
|
variant: "solid",
|
|
@@ -52,32 +52,33 @@ function ae({ label: i, items: d, current: l, onNavigate: o, renderLink: v = R,
|
|
|
52
52
|
disabled: e.disabled,
|
|
53
53
|
onClick: e.onClick
|
|
54
54
|
};
|
|
55
|
-
return c || r ? /* @__PURE__ */ s(
|
|
55
|
+
return c || r ? /* @__PURE__ */ s(J, {
|
|
56
56
|
...n,
|
|
57
57
|
icon: e.icon,
|
|
58
58
|
label: e.label,
|
|
59
59
|
size: c ? "lg" : p,
|
|
60
|
-
tooltipPlacement: c ? "top" : "end"
|
|
61
|
-
|
|
60
|
+
tooltipPlacement: c ? "top" : "end",
|
|
61
|
+
wrapperClassName: "cy-side-nav-tip"
|
|
62
|
+
}) : /* @__PURE__ */ s(G, {
|
|
62
63
|
...n,
|
|
63
64
|
icon: e.icon,
|
|
64
65
|
size: p,
|
|
65
66
|
fullWidth: !0,
|
|
66
67
|
children: e.label
|
|
67
68
|
});
|
|
68
|
-
},
|
|
69
|
+
}, I = (e) => {
|
|
69
70
|
const n = e.id === l;
|
|
70
71
|
if (e.items && !c) {
|
|
71
|
-
const u =
|
|
72
|
-
return /* @__PURE__ */ s(
|
|
72
|
+
const u = j.has(e.id);
|
|
73
|
+
return /* @__PURE__ */ s(D, {
|
|
73
74
|
className: "cy-side-nav-link cy-reset",
|
|
74
75
|
"aria-expanded": r ? void 0 : u,
|
|
75
76
|
"aria-controls": r ? void 0 : `${h}-${e.id}`,
|
|
76
77
|
"aria-disabled": e.disabled || void 0,
|
|
77
78
|
onClick: () => {
|
|
78
|
-
e.disabled || (r ? (
|
|
79
|
+
e.disabled || (r ? (m((g) => /* @__PURE__ */ new Set([...g, e.id])), A?.(!1)) : T(e.id));
|
|
79
80
|
},
|
|
80
|
-
children:
|
|
81
|
+
children: N(e, !0)
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
const t = (u) => {
|
|
@@ -92,60 +93,61 @@ function ae({ label: i, items: d, current: l, onNavigate: o, renderLink: v = R,
|
|
|
92
93
|
className: "cy-side-nav-link cy-reset",
|
|
93
94
|
...n ? { "aria-current": "page" } : {},
|
|
94
95
|
onClick: t,
|
|
95
|
-
children:
|
|
96
|
-
}) : /* @__PURE__ */ s(
|
|
96
|
+
children: N(e)
|
|
97
|
+
}) : /* @__PURE__ */ s(D, {
|
|
97
98
|
className: "cy-side-nav-link cy-reset",
|
|
98
99
|
"aria-current": n ? "page" : void 0,
|
|
99
100
|
"aria-disabled": e.disabled || void 0,
|
|
100
101
|
onClick: t,
|
|
101
|
-
children:
|
|
102
|
+
children: N(e)
|
|
102
103
|
});
|
|
103
|
-
},
|
|
104
|
+
}, $ = (e, n, t, u, g) => /* @__PURE__ */ s("ul", {
|
|
104
105
|
className: "cy-side-nav-list cy-reset",
|
|
105
106
|
id: t,
|
|
106
107
|
hidden: u,
|
|
107
108
|
"aria-labelledby": g,
|
|
108
109
|
"data-depth": n,
|
|
109
|
-
children: e.map((a) =>
|
|
110
|
+
children: e.map((a) => L(a) ? /* @__PURE__ */ s("li", {
|
|
110
111
|
className: "cy-side-nav-item cy-reset",
|
|
111
112
|
"data-action": "",
|
|
112
|
-
children:
|
|
113
|
-
}, a.id) : /* @__PURE__ */
|
|
113
|
+
children: W(a)
|
|
114
|
+
}, a.id) : /* @__PURE__ */ k("li", {
|
|
114
115
|
className: "cy-side-nav-item cy-reset",
|
|
115
|
-
children: [r && !c ? /* @__PURE__ */ s(
|
|
116
|
+
children: [r && !c ? /* @__PURE__ */ s(H, {
|
|
116
117
|
content: a.label,
|
|
117
118
|
placement: "end",
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
className: "cy-side-nav-tip",
|
|
120
|
+
children: I(a)
|
|
121
|
+
}) : I(a), a.items && !r && !c && $(a.items, n + 1, `${h}-${a.id}`, !j.has(a.id))]
|
|
120
122
|
}, a.id))
|
|
121
123
|
}), f = [];
|
|
122
|
-
if (c) f.push({ items:
|
|
124
|
+
if (c) f.push({ items: C });
|
|
123
125
|
else for (const e of d) {
|
|
124
126
|
const n = f[f.length - 1];
|
|
125
|
-
|
|
127
|
+
F(e) ? f.push({ section: e }) : n && "items" in n ? n.items.push(e) : f.push({ items: [e] });
|
|
126
128
|
}
|
|
127
129
|
return /* @__PURE__ */ s("nav", {
|
|
128
|
-
className:
|
|
130
|
+
className: w ? `cy-side-nav ${w}` : "cy-side-nav",
|
|
129
131
|
"aria-label": i,
|
|
130
132
|
"data-size": p,
|
|
131
|
-
"data-collapsed":
|
|
132
|
-
"data-layout":
|
|
133
|
-
style:
|
|
134
|
-
children: f.map((e, n) => "section" in e ? /* @__PURE__ */
|
|
133
|
+
"data-collapsed": b ? "" : void 0,
|
|
134
|
+
"data-layout": S,
|
|
135
|
+
style: P,
|
|
136
|
+
children: f.map((e, n) => "section" in e ? /* @__PURE__ */ k("div", {
|
|
135
137
|
className: "cy-side-nav-section cy-reset",
|
|
136
138
|
children: [/* @__PURE__ */ s("span", {
|
|
137
|
-
className:
|
|
139
|
+
className: `cy-side-nav-heading cy-reset${b ? " cy-visually-hidden" : ""}`,
|
|
138
140
|
id: `${h}-s${n}`,
|
|
139
141
|
children: e.section.label
|
|
140
|
-
}),
|
|
142
|
+
}), $(e.section.items, 0, void 0, !1, `${h}-s${n}`)]
|
|
141
143
|
}, `section-${e.section.label}`) : /* @__PURE__ */ s("div", {
|
|
142
144
|
className: "cy-side-nav-section cy-reset",
|
|
143
|
-
children:
|
|
145
|
+
children: $(e.items, 0)
|
|
144
146
|
}, n))
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
export {
|
|
148
|
-
|
|
150
|
+
ie as SideNav
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
//# sourceMappingURL=SideNav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNav.js","names":["_Fragment","ButtonBase","Icon","chevronDown","LinkBase","Button","Tooltip","IconButton","useEffect","useId","useState","Fragment$1","jsx","jsxs","isSection","entry","isAction","ancestors","items","id","trail","item","found","defaultLink","props","SideNav","label","current","onNavigate","renderLink","collapsed","onCollapsedChange","defaultExpanded","layout","size","className","style","bar","all","places","expanded","setExpanded","path","open","g","toggle","group","next","content","action","shared","control","isCurrent","o","onClick","event","list","entries","depth","listId","hidden","labelledBy","blocks","last","block","i"],"sources":["../../../src/components/SideNav/SideNav.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useState,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { chevronDown } from \"../../icons/chevron-down.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Tooltip } from \"../Tooltip/Tooltip.js\";\n\nexport interface SideNavTokens {\n /** Width of the expanded navigation. */\n width: string;\n /** Width of the collapsed, icon-only rail. */\n railWidth: string;\n /** Corner radius of item highlights. */\n radius: string;\n /** Diameter of the round action button in the bar. */\n actionSize: string;\n /** How far the action button rises above the bar's row. */\n actionLift: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n sideNav: SideNavTokens;\n }\n}\n\nexport interface NavItem {\n id: string;\n label: string;\n /** A link. Without it the item is a button that calls `onNavigate` (or, with `items`, a group). */\n href?: string;\n icon?: IconData;\n /** A count or status after the label, e.g. a Badge. Read as part of the item's name. */\n badge?: ReactNode;\n /** Child items: the item becomes a group that expands and collapses. */\n items?: NavItem[];\n disabled?: boolean;\n}\n\nexport interface NavSection {\n /** Heading shown above the section's items. */\n label: string;\n items: NavItem[];\n}\n\n/**\n * A primary action among the items, such as \"Add\": a button, not a place. It is never the current page (even when\n * its `id` equals `current`), does not call `onNavigate`, and belongs at the top level, not in a section or group.\n * In a bar it is a raised round accent button showing only the icon; in the column, a filled accent button with the\n * icon and label; in the collapsed rail, a filled icon button. Give a navigation one at most.\n */\nexport interface NavAction {\n /** Marks the entry as an action instead of a destination. */\n kind: \"action\";\n /** Unique among the entries. */\n id: string;\n /** The button's accessible name; its visible text in the column, a tooltip in the bar and the rail. */\n label: string;\n /** The Facet icon shown in the button. */\n icon: IconData;\n /** Called when the action is pressed. */\n onClick: (event: MouseEvent<HTMLElement>) => void;\n /** The button cannot be pressed. */\n disabled?: boolean;\n}\n\nexport type NavEntry = NavItem | NavSection | NavAction;\n\n/** What `renderLink` receives: spread it onto your router's link component. */\nexport interface NavLinkProps {\n /** The item's `href`. */\n href: string;\n /** The item's styling; keep it on the link. */\n className: string;\n /** Set to \"page\" on the current item. */\n \"aria-current\"?: \"page\";\n /** Calls `onNavigate` with the item's id; keep it on the link. */\n onClick: (event: MouseEvent<HTMLElement>) => void;\n /** The item's icon, label and badge. */\n children: ReactNode;\n}\n\nexport interface SideNavProps {\n /** Accessible name of the navigation landmark, e.g. \"Main\". */\n label: string;\n /**\n * Items and sections (`{ label, items }`), in order. One entry may be a primary action\n * (`{ kind: \"action\", id, label, icon, onClick }`): a button that sits where it is placed.\n */\n items: NavEntry[];\n /** `id` of the page being shown: marked `aria-current=\"page\"`; groups holding it start expanded. */\n current?: string | undefined;\n /** Called when an item is chosen (links too: call `event.preventDefault()` to route on the client). */\n onNavigate?: ((id: string, event: MouseEvent<HTMLElement>) => void) | undefined;\n /** Render links with your router: `(props) => <RouterLink to={props.href} {...props} />`. Default: a plain link. */\n renderLink?: (props: NavLinkProps) => ReactElement;\n /**\n * Icon-only rail; labels show in tooltips and stay the accessible names. Give top-level items icons. Groups do not\n * open inside the rail: choosing one calls `onCollapsedChange(false)` so you can widen the navigation.\n */\n collapsed?: boolean;\n /** Called with `false` when a group is chosen in the collapsed rail. */\n onCollapsedChange?: (collapsed: boolean) => void;\n /** Group ids expanded at first (groups holding `current` always are). */\n defaultExpanded?: string[];\n /**\n * `column` (default): the vertical navigation. `bar`: one row of top-level items, icon over label, for a phone's\n * bottom tab bar (AppShell's `tabs`). Section headings are left out, and a group is one item that calls `onNavigate`\n * with its id (a bar has no room to open it). Give a bar three to five items, each with an icon.\n */\n layout?: \"column\" | \"bar\";\n /** Height and text size of the items. Default \"md\". */\n size?: Size;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-side-nav-* tokens. */\n style?: CSSProperties;\n}\n\nconst isSection = (entry: NavEntry): entry is NavSection => !(\"id\" in entry);\nconst isAction = (entry: NavItem | NavAction): entry is NavAction => \"kind\" in entry;\n\n/** Ids of the groups that lead to `id`. */\nfunction ancestors(items: NavItem[], id: string | undefined, trail: string[] = []): string[] | null {\n if (!id) return null;\n for (const item of items) {\n if (item.id === id) return trail;\n const found = item.items && ancestors(item.items, id, [...trail, item.id]);\n if (found) return found;\n }\n return null;\n}\n\nconst defaultLink = (props: NavLinkProps) => <LinkBase {...props} />;\n\n/** Vertical site or app navigation: links in sections, expandable groups, the current page marked, an icon rail. */\nexport function SideNav({\n label,\n items,\n current,\n onNavigate,\n renderLink = defaultLink,\n collapsed = false,\n onCollapsedChange,\n defaultExpanded = [],\n layout = \"column\",\n size = \"md\",\n className,\n style,\n}: SideNavProps) {\n const id = useId();\n const bar = layout === \"bar\";\n const all = items.flatMap((entry) => (isSection(entry) ? entry.items : [entry]));\n const places = all.filter((entry) => !isAction(entry)) as NavItem[];\n const [expanded, setExpanded] = useState(\n () => new Set([...defaultExpanded, ...(ancestors(places, current) ?? [])]),\n );\n const path = ancestors(places, current)?.join(\" \");\n // Navigating somewhere else opens the groups on the way to it (never closes any).\n useEffect(() => {\n if (!path) return;\n setExpanded((open) =>\n path.split(\" \").every((g) => open.has(g)) ? open : new Set([...open, ...path.split(\" \")]),\n );\n }, [path]);\n\n const toggle = (group: string) =>\n setExpanded((open) => {\n const next = new Set(open);\n if (!next.delete(group)) next.add(group);\n return next;\n });\n\n const content = (item: NavItem, group?: boolean) => (\n <>\n {item.icon && <Icon icon={item.icon} className=\"cy-side-nav-icon\" />}\n <span className=\"cy-side-nav-label cy-reset\">{item.label}</span>\n {item.badge != null && <span className=\"cy-side-nav-badge cy-reset\">{item.badge}</span>}\n {group && !bar && <Icon icon={chevronDown} className=\"cy-side-nav-chevron\" />}\n </>\n );\n\n // The primary action: Cynosure's own buttons, so it presses, focuses and names itself like any other button.\n const action = (item: NavAction) => {\n const shared = {\n className: \"cy-side-nav-action\",\n variant: \"solid\",\n tone: \"accent\",\n disabled: item.disabled,\n onClick: item.onClick,\n } as const;\n return bar || collapsed ? (\n <IconButton\n {...shared}\n icon={item.icon}\n label={item.label}\n size={bar ? \"lg\" : size}\n tooltipPlacement={bar ? \"top\" : \"end\"}\n />\n ) : (\n <Button {...shared} icon={item.icon} size={size} fullWidth>\n {item.label}\n </Button>\n );\n };\n\n const control = (item: NavItem): ReactElement<Record<string, unknown>> => {\n const isCurrent = item.id === current;\n if (item.items && !bar) {\n const open = expanded.has(item.id);\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-expanded={collapsed ? undefined : open}\n aria-controls={collapsed ? undefined : `${id}-${item.id}`}\n aria-disabled={item.disabled || undefined}\n onClick={() => {\n if (item.disabled) return;\n if (collapsed) {\n // The rail has no room for children: ask for the full navigation with this group open.\n setExpanded((o) => new Set([...o, item.id]));\n onCollapsedChange?.(false);\n } else toggle(item.id);\n }}\n >\n {content(item, true)}\n </ButtonBase>\n );\n }\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n onNavigate?.(item.id, event);\n };\n if (item.href && !item.disabled)\n return renderLink({\n href: item.href,\n className: \"cy-side-nav-link cy-reset\",\n ...(isCurrent ? { \"aria-current\": \"page\" as const } : {}),\n onClick,\n children: content(item),\n }) as ReactElement<Record<string, unknown>>;\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-current={isCurrent ? \"page\" : undefined}\n aria-disabled={item.disabled || undefined}\n onClick={onClick}\n >\n {content(item)}\n </ButtonBase>\n );\n };\n\n const list = (\n entries: (NavItem | NavAction)[],\n depth: number,\n listId?: string,\n hidden?: boolean,\n labelledBy?: string,\n ) => (\n <ul\n className=\"cy-side-nav-list cy-reset\"\n id={listId}\n hidden={hidden}\n aria-labelledby={labelledBy}\n data-depth={depth}\n >\n {entries.map((item) =>\n isAction(item) ? (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\" data-action=\"\">\n {action(item)}\n </li>\n ) : (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\">\n {collapsed && !bar ? (\n <Tooltip content={item.label} placement=\"end\">\n {control(item)}\n </Tooltip>\n ) : (\n control(item)\n )}\n {item.items &&\n !collapsed &&\n !bar &&\n list(item.items, depth + 1, `${id}-${item.id}`, !expanded.has(item.id))}\n </li>\n ),\n )}\n </ul>\n );\n\n // Consecutive plain items share one list; each section gets its own heading and list.\n const blocks: ({ section: NavSection } | { items: (NavItem | NavAction)[] })[] = [];\n if (bar) blocks.push({ items: all });\n else\n for (const entry of items) {\n const last = blocks[blocks.length - 1];\n if (isSection(entry)) blocks.push({ section: entry });\n else if (last && \"items\" in last) last.items.push(entry);\n else blocks.push({ items: [entry] });\n }\n\n return (\n <nav\n className={className ? `cy-side-nav ${className}` : \"cy-side-nav\"}\n aria-label={label}\n data-size={size}\n data-collapsed={collapsed && !bar ? \"\" : undefined}\n data-layout={layout}\n style={style}\n >\n {blocks.map((block, i) =>\n \"section\" in block ? (\n <div key={`section-${block.section.label}`} className=\"cy-side-nav-section cy-reset\">\n <span className=\"cy-side-nav-heading cy-reset\" id={`${id}-s${i}`}>\n {block.section.label}\n </span>\n {list(block.section.items, 0, undefined, false, `${id}-s${i}`)}\n </div>\n ) : (\n <div key={i} className=\"cy-side-nav-section cy-reset\">\n {list(block.items, 0)}\n </div>\n ),\n )}\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;AAmIA,IAAMc,IAAA,CAAaC,MAAyC,EAAE,QAAQA,IAChEC,IAAA,CAAYD,MAAmD,UAAUA;AAG/E,SAASE,EAAUC,GAAkBC,GAAwBC,IAAkB,CAAC,GAAoB;AAClG,MAAI,CAACD,EAAI,QAAO;AAChB,aAAWE,KAAQH,GAAO;AACxB,QAAIG,EAAK,OAAOF,EAAI,QAAOC;AAC3B,UAAME,IAAQD,EAAK,SAASJ,EAAUI,EAAK,OAA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,EAAC,OAAD;AAAA,MAA4C,WAAU;AAAA,MAAtD,UAAA,CACE,gBAAAD,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAA+B,IAAI,GAAGO,CAAA,KAAO8C,CAAA;AAAA,QAC1D,UAAAD,EAAM,QAAQ;AAAA,MACX,CAAA,GACLR,EAAKQ,EAAM,QAAQ,OAAO,GAAG,QAAW,IAAO,GAAG7C,CAAA,KAAO8C,CAAA,EAAG,CAC1D;AAAA,IALK,GAAA,WAAWD,EAAM,QAAQ,KAAA,EAK9B,IAEL,gBAAApD,EAAC,OAAD;AAAA,MAAa,WAAU;AAAA,MACpB,UAAA4C,EAAKQ,EAAM,OAAO,CAAC;AAAA,IACjB,GAFKC,CAEL,CAET;AAAA,EACG,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"SideNav.js","names":["_Fragment","ButtonBase","Icon","chevronDown","LinkBase","Button","Tooltip","IconButton","useEffect","useId","useState","Fragment$1","jsx","jsxs","isSection","entry","isAction","ancestors","items","id","trail","item","found","defaultLink","props","SideNav","label","current","onNavigate","renderLink","collapsed","onCollapsedChange","defaultExpanded","layout","size","className","style","bar","rail","all","places","expanded","setExpanded","path","open","g","toggle","group","next","content","action","shared","control","isCurrent","o","onClick","event","list","entries","depth","listId","hidden","labelledBy","blocks","last","block","i"],"sources":["../../../src/components/SideNav/SideNav.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useState,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { chevronDown } from \"../../icons/chevron-down.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Tooltip } from \"../Tooltip/Tooltip.js\";\n\nexport interface SideNavTokens {\n /** Width of the expanded navigation. */\n width: string;\n /** Width of the collapsed, icon-only rail. */\n railWidth: string;\n /** Corner radius of item highlights. */\n radius: string;\n /** Diameter of the round action button in the bar. */\n actionSize: string;\n /** How far the action button rises above the bar's row. */\n actionLift: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n sideNav: SideNavTokens;\n }\n}\n\nexport interface NavItem {\n id: string;\n label: string;\n /** A link. Without it the item is a button that calls `onNavigate` (or, with `items`, a group). */\n href?: string;\n icon?: IconData;\n /** A count or status after the label, e.g. a Badge. Read as part of the item's name. */\n badge?: ReactNode;\n /** Child items: the item becomes a group that expands and collapses. */\n items?: NavItem[];\n disabled?: boolean;\n}\n\nexport interface NavSection {\n /** Heading shown above the section's items. */\n label: string;\n items: NavItem[];\n}\n\n/**\n * A primary action among the items, such as \"Add\": a button, not a place. It is never the current page (even when\n * its `id` equals `current`), does not call `onNavigate`, and belongs at the top level, not in a section or group.\n * In a bar it is a raised round accent button showing only the icon; in the column, a filled accent button with the\n * icon and label; in the collapsed rail, a filled icon button. Give a navigation one at most.\n */\nexport interface NavAction {\n /** Marks the entry as an action instead of a destination. */\n kind: \"action\";\n /** Unique among the entries. */\n id: string;\n /** The button's accessible name; its visible text in the column, a tooltip in the bar and the rail. */\n label: string;\n /** The Facet icon shown in the button. */\n icon: IconData;\n /** Called when the action is pressed. */\n onClick: (event: MouseEvent<HTMLElement>) => void;\n /** The button cannot be pressed. */\n disabled?: boolean;\n}\n\nexport type NavEntry = NavItem | NavSection | NavAction;\n\n/** What `renderLink` receives: spread it onto your router's link component. */\nexport interface NavLinkProps {\n /** The item's `href`. */\n href: string;\n /** The item's styling; keep it on the link. */\n className: string;\n /** Set to \"page\" on the current item. */\n \"aria-current\"?: \"page\";\n /** Calls `onNavigate` with the item's id; keep it on the link. */\n onClick: (event: MouseEvent<HTMLElement>) => void;\n /** The item's icon, label and badge. */\n children: ReactNode;\n}\n\nexport interface SideNavProps {\n /** Accessible name of the navigation landmark, e.g. \"Main\". */\n label: string;\n /**\n * Items and sections (`{ label, items }`), in order. One entry may be a primary action\n * (`{ kind: \"action\", id, label, icon, onClick }`): a button that sits where it is placed.\n */\n items: NavEntry[];\n /** `id` of the page being shown: marked `aria-current=\"page\"`; groups holding it start expanded. */\n current?: string | undefined;\n /** Called when an item is chosen (links too: call `event.preventDefault()` to route on the client). */\n onNavigate?: ((id: string, event: MouseEvent<HTMLElement>) => void) | undefined;\n /** Render links with your router: `(props) => <RouterLink to={props.href} {...props} />`. Default: a plain link. */\n renderLink?: (props: NavLinkProps) => ReactElement;\n /**\n * Icon-only rail; labels show in tooltips and stay the accessible names. Give top-level items icons. Groups do not\n * open inside the rail: choosing one calls `onCollapsedChange(false)` so you can widen the navigation.\n */\n collapsed?: boolean;\n /** Called with `false` when a group is chosen in the collapsed rail. */\n onCollapsedChange?: (collapsed: boolean) => void;\n /** Group ids expanded at first (groups holding `current` always are). */\n defaultExpanded?: string[];\n /**\n * `column` (default): the vertical navigation. `bar`: one row of top-level items, icon over label, for a phone's\n * bottom tab bar (AppShell's `tabs`). Section headings are left out, and a group is one item that calls `onNavigate`\n * with its id (a bar has no room to open it). Give a bar three to five items, each with an icon.\n */\n layout?: \"column\" | \"bar\";\n /** Height and text size of the items. Default \"md\". */\n size?: Size;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-side-nav-* tokens. */\n style?: CSSProperties;\n}\n\nconst isSection = (entry: NavEntry): entry is NavSection => !(\"id\" in entry);\nconst isAction = (entry: NavItem | NavAction): entry is NavAction => \"kind\" in entry;\n\n/** Ids of the groups that lead to `id`. */\nfunction ancestors(items: NavItem[], id: string | undefined, trail: string[] = []): string[] | null {\n if (!id) return null;\n for (const item of items) {\n if (item.id === id) return trail;\n const found = item.items && ancestors(item.items, id, [...trail, item.id]);\n if (found) return found;\n }\n return null;\n}\n\nconst defaultLink = (props: NavLinkProps) => <LinkBase {...props} />;\n\n/** Vertical site or app navigation: links in sections, expandable groups, the current page marked, an icon rail. */\nexport function SideNav({\n label,\n items,\n current,\n onNavigate,\n renderLink = defaultLink,\n collapsed = false,\n onCollapsedChange,\n defaultExpanded = [],\n layout = \"column\",\n size = \"md\",\n className,\n style,\n}: SideNavProps) {\n const id = useId();\n const bar = layout === \"bar\";\n // The collapsed rail: icons only, the labels and headings hidden from sight (still their names).\n const rail = collapsed && !bar;\n const all = items.flatMap((entry) => (isSection(entry) ? entry.items : [entry]));\n const places = all.filter((entry) => !isAction(entry)) as NavItem[];\n const [expanded, setExpanded] = useState(\n () => new Set([...defaultExpanded, ...(ancestors(places, current) ?? [])]),\n );\n const path = ancestors(places, current)?.join(\" \");\n // Navigating somewhere else opens the groups on the way to it (never closes any).\n useEffect(() => {\n if (!path) return;\n setExpanded((open) =>\n path.split(\" \").every((g) => open.has(g)) ? open : new Set([...open, ...path.split(\" \")]),\n );\n }, [path]);\n\n const toggle = (group: string) =>\n setExpanded((open) => {\n const next = new Set(open);\n if (!next.delete(group)) next.add(group);\n return next;\n });\n\n const content = (item: NavItem, group?: boolean) => (\n <>\n {item.icon && <Icon icon={item.icon} className=\"cy-side-nav-icon\" />}\n {/* In the rail the label is hidden from sight, still the row's name. */}\n <span className={`cy-side-nav-label cy-reset${rail ? \" cy-visually-hidden\" : \"\"}`}>{item.label}</span>\n {item.badge != null && <span className=\"cy-side-nav-badge cy-reset\">{item.badge}</span>}\n {group && !bar && <Icon icon={chevronDown} className=\"cy-side-nav-chevron\" />}\n </>\n );\n\n // The primary action: Cynosure's own buttons, so it presses, focuses and names itself like any other button.\n const action = (item: NavAction) => {\n const shared = {\n className: \"cy-side-nav-action\",\n variant: \"solid\",\n tone: \"accent\",\n disabled: item.disabled,\n onClick: item.onClick,\n } as const;\n return bar || collapsed ? (\n <IconButton\n {...shared}\n icon={item.icon}\n label={item.label}\n size={bar ? \"lg\" : size}\n tooltipPlacement={bar ? \"top\" : \"end\"}\n wrapperClassName=\"cy-side-nav-tip\"\n />\n ) : (\n <Button {...shared} icon={item.icon} size={size} fullWidth>\n {item.label}\n </Button>\n );\n };\n\n const control = (item: NavItem): ReactElement<Record<string, unknown>> => {\n const isCurrent = item.id === current;\n if (item.items && !bar) {\n const open = expanded.has(item.id);\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-expanded={collapsed ? undefined : open}\n aria-controls={collapsed ? undefined : `${id}-${item.id}`}\n aria-disabled={item.disabled || undefined}\n onClick={() => {\n if (item.disabled) return;\n if (collapsed) {\n // The rail has no room for children: ask for the full navigation with this group open.\n setExpanded((o) => new Set([...o, item.id]));\n onCollapsedChange?.(false);\n } else toggle(item.id);\n }}\n >\n {content(item, true)}\n </ButtonBase>\n );\n }\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n onNavigate?.(item.id, event);\n };\n if (item.href && !item.disabled)\n return renderLink({\n href: item.href,\n className: \"cy-side-nav-link cy-reset\",\n ...(isCurrent ? { \"aria-current\": \"page\" as const } : {}),\n onClick,\n children: content(item),\n }) as ReactElement<Record<string, unknown>>;\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-current={isCurrent ? \"page\" : undefined}\n aria-disabled={item.disabled || undefined}\n onClick={onClick}\n >\n {content(item)}\n </ButtonBase>\n );\n };\n\n const list = (\n entries: (NavItem | NavAction)[],\n depth: number,\n listId?: string,\n hidden?: boolean,\n labelledBy?: string,\n ) => (\n <ul\n className=\"cy-side-nav-list cy-reset\"\n id={listId}\n hidden={hidden}\n aria-labelledby={labelledBy}\n data-depth={depth}\n >\n {entries.map((item) =>\n isAction(item) ? (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\" data-action=\"\">\n {action(item)}\n </li>\n ) : (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\">\n {collapsed && !bar ? (\n <Tooltip content={item.label} placement=\"end\" className=\"cy-side-nav-tip\">\n {control(item)}\n </Tooltip>\n ) : (\n control(item)\n )}\n {item.items &&\n !collapsed &&\n !bar &&\n list(item.items, depth + 1, `${id}-${item.id}`, !expanded.has(item.id))}\n </li>\n ),\n )}\n </ul>\n );\n\n // Consecutive plain items share one list; each section gets its own heading and list.\n const blocks: ({ section: NavSection } | { items: (NavItem | NavAction)[] })[] = [];\n if (bar) blocks.push({ items: all });\n else\n for (const entry of items) {\n const last = blocks[blocks.length - 1];\n if (isSection(entry)) blocks.push({ section: entry });\n else if (last && \"items\" in last) last.items.push(entry);\n else blocks.push({ items: [entry] });\n }\n\n return (\n <nav\n className={className ? `cy-side-nav ${className}` : \"cy-side-nav\"}\n aria-label={label}\n data-size={size}\n data-collapsed={rail ? \"\" : undefined}\n data-layout={layout}\n style={style}\n >\n {blocks.map((block, i) =>\n \"section\" in block ? (\n <div key={`section-${block.section.label}`} className=\"cy-side-nav-section cy-reset\">\n <span\n className={`cy-side-nav-heading cy-reset${rail ? \" cy-visually-hidden\" : \"\"}`}\n id={`${id}-s${i}`}\n >\n {block.section.label}\n </span>\n {list(block.section.items, 0, undefined, false, `${id}-s${i}`)}\n </div>\n ) : (\n <div key={i} className=\"cy-side-nav-section cy-reset\">\n {list(block.items, 0)}\n </div>\n ),\n )}\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;AAmIA,IAAMc,IAAA,CAAaC,MAAyC,EAAE,QAAQA,IAChEC,IAAA,CAAYD,MAAmD,UAAUA;AAG/E,SAASE,EAAUC,GAAkBC,GAAwBC,IAAkB,CAAC,GAAoB;AAClG,MAAI,CAACD,EAAI,QAAO;AAChB,aAAWE,KAAQH,GAAO;AACxB,QAAIG,EAAK,OAAOF,EAAI,QAAOC;AAC3B,UAAME,IAAQD,EAAK,SAASJ,EAAUI,EAAK,OAAOF,GAAI,CAAC,GAAGC,GAAOC,EAAK,EAAE,CAAC;AACzE,QAAIC,EAAO,QAAOA;AAAA,EACpB;AACA,SAAO;AACT;AAEA,IAAMC,IAAA,CAAeC,MAAwB,gBAAAZ,EAACR,GAAD,E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QACE,WAAW,+BAA+B0B,IAAO,wBAAwB,EAAA;AAAA,QACzE,IAAI,GAAGnB,CAAA,KAAO+C,CAAA;AAAA,QAEb,UAAAD,EAAM,QAAQ;AAAA,MACX,CAAA,GACLR,EAAKQ,EAAM,QAAQ,OAAO,GAAG,QAAW,IAAO,GAAG9C,CAAA,KAAO+C,CAAA,EAAG,CAC1D;AAAA,IARK,GAAA,WAAWD,EAAM,QAAQ,KAAA,EAQ9B,IAEL,gBAAArD,EAAC,OAAD;AAAA,MAAa,WAAU;AAAA,MACpB,UAAA6C,EAAKQ,EAAM,OAAO,CAAC;AAAA,IACjB,GAFKC,CAEL,CAET;AAAA,EACG,CAAA;AAET"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type ContainerProps } from "../Container/Container.js";
|
|
3
|
+
export interface SiteFooterTokens {
|
|
4
|
+
/** Background of the footer. */
|
|
5
|
+
background: string;
|
|
6
|
+
/** Colour of the hairline above the footer and above its bottom row. */
|
|
7
|
+
border: string;
|
|
8
|
+
/** Space above and below the footer's content, and between its rows. */
|
|
9
|
+
paddingBlock: string;
|
|
10
|
+
/** Least width of a link column before the columns wrap onto another row. */
|
|
11
|
+
columnMinWidth: string;
|
|
12
|
+
}
|
|
13
|
+
declare module "../../tokens/schema.js" {
|
|
14
|
+
interface ComponentTokens {
|
|
15
|
+
siteFooter: SiteFooterTokens;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** A column of footer links under a heading. */
|
|
19
|
+
export interface SiteFooterColumn {
|
|
20
|
+
/** The column's heading, e.g. "Product". */
|
|
21
|
+
title: string;
|
|
22
|
+
/** The column's links, in order. */
|
|
23
|
+
links: {
|
|
24
|
+
/** The link text. */
|
|
25
|
+
label: string;
|
|
26
|
+
/** Where it goes. */
|
|
27
|
+
href: string;
|
|
28
|
+
/** Opens in a new tab, with an icon and announced text. */
|
|
29
|
+
external?: boolean;
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
export interface SiteFooterLabels {
|
|
33
|
+
/** Name of the navigation landmark that holds the link columns. Default: "Footer". */
|
|
34
|
+
nav: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SiteFooterProps {
|
|
37
|
+
/** The logo or the site's name, at the top of the inline start. */
|
|
38
|
+
brand?: ReactNode;
|
|
39
|
+
/** A sentence under the brand about the site or the company. */
|
|
40
|
+
tagline?: ReactNode;
|
|
41
|
+
/** Link columns, as data: a heading and its links. They sit side by side and wrap onto more rows when narrow. */
|
|
42
|
+
columns?: SiteFooterColumn[];
|
|
43
|
+
/** Heading level of the column titles, to fit the page outline. Default 2. */
|
|
44
|
+
headingLevel?: 2 | 3 | 4;
|
|
45
|
+
/** The bottom row's start: copyright and legal links. */
|
|
46
|
+
legal?: ReactNode;
|
|
47
|
+
/** The bottom row's end: links to the site's social accounts, usually IconButtons with `href`. */
|
|
48
|
+
social?: ReactNode;
|
|
49
|
+
/** Widest the content gets: the `size` of its Container, to line up with the page. Default "lg". */
|
|
50
|
+
size?: ContainerProps["size"];
|
|
51
|
+
/** Replace the built-in English text: `nav`, the name of the links' navigation landmark. */
|
|
52
|
+
labels?: Partial<SiteFooterLabels>;
|
|
53
|
+
/** Set on the `footer` element. */
|
|
54
|
+
id?: string | undefined;
|
|
55
|
+
/** Names the footer, when a page has more than one. */
|
|
56
|
+
"aria-label"?: string | undefined;
|
|
57
|
+
/** Added to the `footer` element, for layout. */
|
|
58
|
+
className?: string | undefined;
|
|
59
|
+
/** Layout only. Restyle through --cy-site-footer-* tokens. */
|
|
60
|
+
style?: CSSProperties;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The bottom of a website: the brand and a tagline, columns of links, and a bottom row for the copyright, legal links
|
|
64
|
+
* and social links. Columns and rows stack on narrow screens.
|
|
65
|
+
*/
|
|
66
|
+
export declare const SiteFooter: import("react").ForwardRefExoticComponent<SiteFooterProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Link as u } from "../Link/Link.js";
|
|
3
|
+
import { Container as F } from "../Container/Container.js";
|
|
4
|
+
import { Heading as L } from "../Heading/Heading.js";
|
|
5
|
+
import { Text as b } from "../Text/Text.js";
|
|
6
|
+
import { forwardRef as S, useId as g } from "react";
|
|
7
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
8
|
+
var j = { nav: "Footer" }, C = S(function({ brand: r, tagline: s, columns: i = [], headingLevel: y = 2, legal: c, social: a, size: h = "lg", labels: v, className: d, style: N, ...p }, x) {
|
|
9
|
+
const $ = {
|
|
10
|
+
...j,
|
|
11
|
+
...v
|
|
12
|
+
}, n = g(), f = r || s || i.length > 0;
|
|
13
|
+
return /* @__PURE__ */ e("footer", {
|
|
14
|
+
ref: x,
|
|
15
|
+
...p,
|
|
16
|
+
className: `cy-site-footer${d ? ` ${d}` : ""}`,
|
|
17
|
+
style: N,
|
|
18
|
+
children: /* @__PURE__ */ t(F, {
|
|
19
|
+
size: h,
|
|
20
|
+
className: "cy-site-footer-inner",
|
|
21
|
+
children: [f && /* @__PURE__ */ t("div", {
|
|
22
|
+
className: "cy-site-footer-top cy-reset",
|
|
23
|
+
children: [(r || s) && /* @__PURE__ */ t("div", {
|
|
24
|
+
className: "cy-site-footer-brand cy-reset",
|
|
25
|
+
children: [r && /* @__PURE__ */ e("div", {
|
|
26
|
+
className: "cy-site-footer-logo",
|
|
27
|
+
children: r
|
|
28
|
+
}), s && /* @__PURE__ */ e(b, {
|
|
29
|
+
as: "p",
|
|
30
|
+
tone: "muted",
|
|
31
|
+
className: "cy-site-footer-tagline",
|
|
32
|
+
children: s
|
|
33
|
+
})]
|
|
34
|
+
}), i.length > 0 && /* @__PURE__ */ e("nav", {
|
|
35
|
+
"aria-label": $.nav,
|
|
36
|
+
className: "cy-site-footer-nav cy-reset",
|
|
37
|
+
children: i.map((l, m) => /* @__PURE__ */ t("div", {
|
|
38
|
+
className: "cy-site-footer-column cy-reset",
|
|
39
|
+
children: [/* @__PURE__ */ e(L, {
|
|
40
|
+
level: y,
|
|
41
|
+
size: "xs",
|
|
42
|
+
id: `${n}-${m}`,
|
|
43
|
+
className: "cy-site-footer-title",
|
|
44
|
+
children: l.title
|
|
45
|
+
}), /* @__PURE__ */ e("ul", {
|
|
46
|
+
"aria-labelledby": `${n}-${m}`,
|
|
47
|
+
className: "cy-site-footer-links cy-reset",
|
|
48
|
+
children: l.links.map((o) => /* @__PURE__ */ e("li", {
|
|
49
|
+
className: "cy-site-footer-item cy-reset",
|
|
50
|
+
children: /* @__PURE__ */ e(u, {
|
|
51
|
+
href: o.href,
|
|
52
|
+
tone: "neutral",
|
|
53
|
+
size: "md",
|
|
54
|
+
external: o.external ?? !1,
|
|
55
|
+
className: "cy-site-footer-link",
|
|
56
|
+
children: o.label
|
|
57
|
+
})
|
|
58
|
+
}, o.href))
|
|
59
|
+
})]
|
|
60
|
+
}, l.title))
|
|
61
|
+
})]
|
|
62
|
+
}), (c || a) && /* @__PURE__ */ t("div", {
|
|
63
|
+
className: "cy-site-footer-bottom cy-reset",
|
|
64
|
+
"data-divided": f ? "" : void 0,
|
|
65
|
+
children: [c && /* @__PURE__ */ e("div", {
|
|
66
|
+
className: "cy-site-footer-legal",
|
|
67
|
+
children: c
|
|
68
|
+
}), a && /* @__PURE__ */ e("div", {
|
|
69
|
+
className: "cy-site-footer-social cy-reset",
|
|
70
|
+
children: a
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
C as SiteFooter
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=SiteFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SiteFooter.js","names":["Link","Container","Heading","Text","forwardRef","useId","jsx","jsxs","DEFAULT_LABELS","SiteFooter","brand","tagline","columns","headingLevel","legal","social","size","labels","className","style","rest","ref","text","id","top","column","i","link"],"sources":["../../../src/components/SiteFooter/SiteFooter.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type ReactNode, useId } from \"react\";\nimport { Container, type ContainerProps } from \"../Container/Container.js\";\nimport { Heading } from \"../Heading/Heading.js\";\nimport { Link } from \"../Link/Link.js\";\nimport { Text } from \"../Text/Text.js\";\n\nexport interface SiteFooterTokens {\n /** Background of the footer. */\n background: string;\n /** Colour of the hairline above the footer and above its bottom row. */\n border: string;\n /** Space above and below the footer's content, and between its rows. */\n paddingBlock: string;\n /** Least width of a link column before the columns wrap onto another row. */\n columnMinWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n siteFooter: SiteFooterTokens;\n }\n}\n\n/** A column of footer links under a heading. */\nexport interface SiteFooterColumn {\n /** The column's heading, e.g. \"Product\". */\n title: string;\n /** The column's links, in order. */\n links: {\n /** The link text. */\n label: string;\n /** Where it goes. */\n href: string;\n /** Opens in a new tab, with an icon and announced text. */\n external?: boolean;\n }[];\n}\n\nexport interface SiteFooterLabels {\n /** Name of the navigation landmark that holds the link columns. Default: \"Footer\". */\n nav: string;\n}\n\nexport interface SiteFooterProps {\n /** The logo or the site's name, at the top of the inline start. */\n brand?: ReactNode;\n /** A sentence under the brand about the site or the company. */\n tagline?: ReactNode;\n /** Link columns, as data: a heading and its links. They sit side by side and wrap onto more rows when narrow. */\n columns?: SiteFooterColumn[];\n /** Heading level of the column titles, to fit the page outline. Default 2. */\n headingLevel?: 2 | 3 | 4;\n /** The bottom row's start: copyright and legal links. */\n legal?: ReactNode;\n /** The bottom row's end: links to the site's social accounts, usually IconButtons with `href`. */\n social?: ReactNode;\n /** Widest the content gets: the `size` of its Container, to line up with the page. Default \"lg\". */\n size?: ContainerProps[\"size\"];\n /** Replace the built-in English text: `nav`, the name of the links' navigation landmark. */\n labels?: Partial<SiteFooterLabels>;\n /** Set on the `footer` element. */\n id?: string | undefined;\n /** Names the footer, when a page has more than one. */\n \"aria-label\"?: string | undefined;\n /** Added to the `footer` element, for layout. */\n className?: string | undefined;\n /** Layout only. Restyle through --cy-site-footer-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: SiteFooterLabels = { nav: \"Footer\" };\n\n/**\n * The bottom of a website: the brand and a tagline, columns of links, and a bottom row for the copyright, legal links\n * and social links. Columns and rows stack on narrow screens.\n */\nexport const SiteFooter = forwardRef<HTMLElement, SiteFooterProps>(function SiteFooter(\n {\n brand,\n tagline,\n columns = [],\n headingLevel = 2,\n legal,\n social,\n size = \"lg\",\n labels,\n className,\n style,\n ...rest\n },\n ref,\n) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const top = brand || tagline || columns.length > 0;\n return (\n <footer ref={ref} {...rest} className={`cy-site-footer${className ? ` ${className}` : \"\"}`} style={style}>\n <Container size={size} className=\"cy-site-footer-inner\">\n {top && (\n <div className=\"cy-site-footer-top cy-reset\">\n {(brand || tagline) && (\n <div className=\"cy-site-footer-brand cy-reset\">\n {brand && <div className=\"cy-site-footer-logo\">{brand}</div>}\n {tagline && (\n <Text as=\"p\" tone=\"muted\" className=\"cy-site-footer-tagline\">\n {tagline}\n </Text>\n )}\n </div>\n )}\n {columns.length > 0 && (\n <nav aria-label={text.nav} className=\"cy-site-footer-nav cy-reset\">\n {columns.map((column, i) => (\n <div key={column.title} className=\"cy-site-footer-column cy-reset\">\n <Heading\n level={headingLevel}\n size=\"xs\"\n id={`${id}-${i}`}\n className=\"cy-site-footer-title\"\n >\n {column.title}\n </Heading>\n <ul aria-labelledby={`${id}-${i}`} className=\"cy-site-footer-links cy-reset\">\n {column.links.map((link) => (\n <li key={link.href} className=\"cy-site-footer-item cy-reset\">\n <Link\n href={link.href}\n tone=\"neutral\"\n size=\"md\"\n external={link.external ?? false}\n className=\"cy-site-footer-link\"\n >\n {link.label}\n </Link>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </nav>\n )}\n </div>\n )}\n {(legal || social) && (\n <div className=\"cy-site-footer-bottom cy-reset\" data-divided={top ? \"\" : undefined}>\n {legal && <div className=\"cy-site-footer-legal\">{legal}</div>}\n {social && <div className=\"cy-site-footer-social cy-reset\">{social}</div>}\n </div>\n )}\n </Container>\n </footer>\n );\n});\n"],"mappings":";;;;;;;AAsEA,IAAMQ,IAAmC,EAAE,KAAK,SAAS,GAM5CC,IAAaL,EAAyC,SACjE,EACE,OAAAM,GACA,SAAAC,GACA,SAAAC,IAAU,CAAC,GACX,cAAAC,IAAe,GACf,OAAAC,GACA,QAAAC,GACA,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,GACA,GAAGC,EAAA,GAELC,GACA;AACA,QAAMC,IAAO;AAAA,IAAE,GAAGd;AAAA,IAAgB,GAAGS;AAAA,EAAO,GACtCM,IAAKlB,EAAM,GACXmB,IAAMd,KAASC,KAAWC,EAAQ,SAAS;AACjD,SACE,gBAAAN,EAAC,UAAD;AAAA,IAAa,KAAAe;AAAA,IAAK,GAAID;AAAA,IAAM,WAAW,iBAAiBF,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IAAa,OAAAC;AAAA,IACjG,UAAA,gBAAAZ,EAACN,GAAD;AAAA,MAAiB,MAAAe;AAAA,MAAM,WAAU;AAAA,MAAjC,UAAA,CACGQ,KACC,gBAAAjB,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QAAf,UAAA,EACIG,KAASC,MACT,gBAAAJ,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAf,UAAA,CACGG,KAAS,gBAAAJ,EAAC,OAAD;AAAA,YAAK,WAAU;AAAA,YAAuB,UAAAI;AAAA,UAAW,CAAA,GAC1DC,KACC,gBAAAL,EAACH,GAAD;AAAA,YAAM,IAAG;AAAA,YAAI,MAAK;AAAA,YAAQ,WAAU;AAAA,YACjC,UAAAQ;AAAA,UACG,CAAA,CAEL;AAAA,QAEN,CAAA,GAAAC,EAAQ,SAAS,KAChB,gBAAAN,E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@
|
|
|
1
|
+
export { SiteFooter, type SiteFooterColumn, type SiteFooterLabels, type SiteFooterProps, type SiteFooterTokens, } from "./SiteFooter.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type ContainerProps } from "../Container/Container.js";
|
|
3
|
+
export interface SiteHeaderTokens {
|
|
4
|
+
/** Least height of the bar. */
|
|
5
|
+
height: string;
|
|
6
|
+
/** Background of the bar. A sticky bar mixes it with some transparency and blurs the page behind. */
|
|
7
|
+
background: string;
|
|
8
|
+
/** Colour of the hairline under the bar. */
|
|
9
|
+
border: string;
|
|
10
|
+
/** Blur of the page seen through a sticky bar. */
|
|
11
|
+
blur: string;
|
|
12
|
+
/** Text colour of the navigation links. */
|
|
13
|
+
linkColor: string;
|
|
14
|
+
/** Text colour of the link to the current page. */
|
|
15
|
+
linkCurrentColor: string;
|
|
16
|
+
/** Background of a hovered link and of the link to the current page. */
|
|
17
|
+
linkHighlight: string;
|
|
18
|
+
}
|
|
19
|
+
declare module "../../tokens/schema.js" {
|
|
20
|
+
interface ComponentTokens {
|
|
21
|
+
siteHeader: SiteHeaderTokens;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** One link of the site navigation. */
|
|
25
|
+
export interface SiteHeaderLink {
|
|
26
|
+
/** The link text. */
|
|
27
|
+
label: string;
|
|
28
|
+
/** Where it goes. */
|
|
29
|
+
href: string;
|
|
30
|
+
/** This link is the page being shown: it is marked `aria-current="page"`. */
|
|
31
|
+
current?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface SiteHeaderLabels {
|
|
34
|
+
/** Name of the navigation landmark, in the bar and in the menu. Default: "Main". */
|
|
35
|
+
nav: string;
|
|
36
|
+
/** The menu button shown on narrow screens. Default: "Open menu". */
|
|
37
|
+
openMenu: string;
|
|
38
|
+
/** Title of the menu sheet. Default: "Menu". */
|
|
39
|
+
menu: string;
|
|
40
|
+
/** The skip link. Default: "Skip to content". */
|
|
41
|
+
skip: string;
|
|
42
|
+
}
|
|
43
|
+
export interface SiteHeaderProps {
|
|
44
|
+
/** The logo or the site's name, at the inline start. Give a logo image its text alternative. */
|
|
45
|
+
brand?: ReactNode;
|
|
46
|
+
/** Where the brand links to. `false` shows the brand without a link. Default "/". */
|
|
47
|
+
brandHref?: string | false;
|
|
48
|
+
/** The site navigation, as data. Each link is a real link; the `current` one is marked for assistive technology. */
|
|
49
|
+
nav?: SiteHeaderLink[];
|
|
50
|
+
/** Controls at the inline end, such as a ThemeToggle, a search button or a sign-in Button. They stay in the bar. */
|
|
51
|
+
actions?: ReactNode;
|
|
52
|
+
/** Keep the bar at the top of the window while the page scrolls, over a blurred view of the page. Default true. */
|
|
53
|
+
sticky?: boolean;
|
|
54
|
+
/** Render a SkipLink before the bar, the first stop of the Tab order. Default true. */
|
|
55
|
+
skipLink?: boolean;
|
|
56
|
+
/** Where the skip link goes: `#` and the id of the page's main content. Default "#main". */
|
|
57
|
+
skipTo?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Width of the header below which the navigation moves into a menu opened from a button: `sm` 40rem, `md` 48rem,
|
|
60
|
+
* `lg` 64rem. CSS only, so the right layout shows before any script runs. Default "md".
|
|
61
|
+
*/
|
|
62
|
+
collapseBelow?: "sm" | "md" | "lg";
|
|
63
|
+
/** Widest the bar's content gets: the `size` of its Container, to line up with the page. Default "lg". */
|
|
64
|
+
size?: ContainerProps["size"];
|
|
65
|
+
/** Replace the built-in English text: the landmark name, the menu button, the menu title and the skip link. */
|
|
66
|
+
labels?: Partial<SiteHeaderLabels>;
|
|
67
|
+
/** Set on the `header` element. */
|
|
68
|
+
id?: string | undefined;
|
|
69
|
+
/** Added to the `header` element, for layout. */
|
|
70
|
+
className?: string | undefined;
|
|
71
|
+
/** Layout only. Restyle through --cy-site-header-* tokens. */
|
|
72
|
+
style?: CSSProperties;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The top bar of a website that scrolls as a document: a skip link, the brand, the site navigation and actions. On
|
|
76
|
+
* narrow screens the navigation moves into a menu sheet. For an app frame with a side navigation, use AppShell.
|
|
77
|
+
*/
|
|
78
|
+
export declare const SiteHeader: import("react").ForwardRefExoticComponent<SiteHeaderProps & import("react").RefAttributes<HTMLElement>>;
|