@guardian/stand 0.0.65 → 0.0.67

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.
Files changed (78) hide show
  1. package/dist/Badge.cjs +5 -0
  2. package/dist/Badge.d.cts +5 -0
  3. package/dist/Badge.d.ts +5 -0
  4. package/dist/Badge.js +3 -0
  5. package/dist/SidebarStepperNavigation.cjs +7 -0
  6. package/dist/SidebarStepperNavigation.d.cts +5 -0
  7. package/dist/SidebarStepperNavigation.d.ts +5 -0
  8. package/dist/SidebarStepperNavigation.js +4 -0
  9. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  10. package/dist/components/Avatar/Avatar.cjs +4 -2
  11. package/dist/components/Avatar/Avatar.js +4 -2
  12. package/dist/components/AvatarButton/AvatarButton.cjs +2 -1
  13. package/dist/components/AvatarButton/AvatarButton.js +2 -1
  14. package/dist/components/AvatarLink/AvatarLink.cjs +2 -1
  15. package/dist/components/AvatarLink/AvatarLink.js +2 -1
  16. package/dist/components/Badge/Badge.cjs +18 -0
  17. package/dist/components/Badge/Badge.d.cts +5 -0
  18. package/dist/components/Badge/Badge.d.ts +5 -0
  19. package/dist/components/Badge/Badge.js +18 -0
  20. package/dist/components/Badge/styles.cjs +26 -0
  21. package/dist/components/Badge/styles.d.cts +9 -0
  22. package/dist/components/Badge/styles.d.ts +9 -0
  23. package/dist/components/Badge/styles.js +25 -0
  24. package/dist/components/Badge/types.d.cts +23 -0
  25. package/dist/components/Badge/types.d.ts +23 -0
  26. package/dist/components/Byline/Byline.cjs +4 -2
  27. package/dist/components/Byline/Byline.js +4 -2
  28. package/dist/components/Byline/Preview.cjs +13 -11
  29. package/dist/components/Byline/Preview.js +13 -11
  30. package/dist/components/Grid/Grid.cjs +4 -2
  31. package/dist/components/Grid/Grid.js +4 -2
  32. package/dist/components/HtmlPreviewLoader/styles.cjs +4 -3
  33. package/dist/components/HtmlPreviewLoader/styles.js +4 -3
  34. package/dist/components/Layout/Layout.cjs +4 -2
  35. package/dist/components/Layout/Layout.js +4 -2
  36. package/dist/components/Menu/Menu.cjs +4 -2
  37. package/dist/components/Menu/Menu.js +4 -2
  38. package/dist/components/Modal/Modal.cjs +6 -3
  39. package/dist/components/Modal/Modal.js +6 -3
  40. package/dist/components/SidebarStepperNavigation/SidebarStepperNavigation.cjs +161 -0
  41. package/dist/components/SidebarStepperNavigation/SidebarStepperNavigation.d.cts +5 -0
  42. package/dist/components/SidebarStepperNavigation/SidebarStepperNavigation.d.ts +5 -0
  43. package/dist/components/SidebarStepperNavigation/SidebarStepperNavigation.js +161 -0
  44. package/dist/components/SidebarStepperNavigation/styles.cjs +96 -0
  45. package/dist/components/SidebarStepperNavigation/styles.d.cts +8 -0
  46. package/dist/components/SidebarStepperNavigation/styles.d.ts +8 -0
  47. package/dist/components/SidebarStepperNavigation/styles.js +88 -0
  48. package/dist/components/SidebarStepperNavigation/types.cjs +9 -0
  49. package/dist/components/SidebarStepperNavigation/types.d.cts +26 -0
  50. package/dist/components/SidebarStepperNavigation/types.d.ts +26 -0
  51. package/dist/components/SidebarStepperNavigation/types.js +9 -0
  52. package/dist/components/Tabs/Tabs.cjs +2 -1
  53. package/dist/components/Tabs/Tabs.js +2 -1
  54. package/dist/components/TagPicker/styles.cjs +4 -2
  55. package/dist/components/TagPicker/styles.js +4 -2
  56. package/dist/components/TagTable/styles.cjs +2 -1
  57. package/dist/components/TagTable/styles.js +2 -1
  58. package/dist/components/TopBar/TopBarItem/TopBarItem.cjs +2 -1
  59. package/dist/components/TopBar/TopBarItem/TopBarItem.js +2 -1
  60. package/dist/components/Typography/Typography.cjs +2 -1
  61. package/dist/components/Typography/Typography.js +2 -1
  62. package/dist/index.cjs +4 -0
  63. package/dist/index.d.cts +3 -1
  64. package/dist/index.d.ts +3 -1
  65. package/dist/index.js +3 -1
  66. package/dist/styleD/build/css/component/badge.css +69 -0
  67. package/dist/styleD/build/css/component/sidebarStepperNavigation.css +51 -0
  68. package/dist/styleD/build/typescript/component/badge.cjs +137 -0
  69. package/dist/styleD/build/typescript/component/badge.d.cts +162 -0
  70. package/dist/styleD/build/typescript/component/badge.d.ts +162 -0
  71. package/dist/styleD/build/typescript/component/badge.js +137 -0
  72. package/dist/styleD/build/typescript/component/sidebarStepperNavigation.cjs +68 -0
  73. package/dist/styleD/build/typescript/component/sidebarStepperNavigation.d.cts +85 -0
  74. package/dist/styleD/build/typescript/component/sidebarStepperNavigation.d.ts +85 -0
  75. package/dist/styleD/build/typescript/component/sidebarStepperNavigation.js +68 -0
  76. package/dist/util/useId.cjs +16 -0
  77. package/dist/util/useId.js +14 -0
  78. package/package.json +48 -19
@@ -43,11 +43,12 @@ const DialogRoot = ({ children, theme = {}, cssOverrides, ...props }) => {
43
43
  });
44
44
  };
45
45
  const DialogHeader = ({ variant = "headingLg", element = "h2", theme = {}, cssOverrides, ...props }) => {
46
+ const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.title, theme);
46
47
  return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
47
48
  slot: "title",
48
49
  variant,
49
50
  element,
50
- cssOverrides: [require_styles.dialogHeadingStyles(require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.title, theme)), ...cssOverrides == null ? [] : Array.isArray(cssOverrides) ? cssOverrides : [cssOverrides]],
51
+ cssOverrides: [require_styles.dialogHeadingStyles(mergedTheme), ...cssOverrides == null ? [] : Array.isArray(cssOverrides) ? cssOverrides : [cssOverrides]],
51
52
  ...props
52
53
  });
53
54
  };
@@ -69,18 +70,20 @@ const DialogButtons = ({ children, theme = {}, cssOverrides, ...props }) => {
69
70
  });
70
71
  };
71
72
  const DialogContent = ({ children, theme = {}, cssOverrides, ...props }) => {
73
+ const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.children, theme);
72
74
  return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
73
- css: [require_styles.dialogContentStyles(require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.children, theme)), cssOverrides],
75
+ css: [require_styles.dialogContentStyles(mergedTheme), cssOverrides],
74
76
  ...props,
75
77
  children
76
78
  });
77
79
  };
78
80
  const DialogDismiss = ({ theme = {}, size = "lg", symbol = "close", variant = "tertiary", ...props }) => {
81
+ const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.dismiss, theme);
79
82
  return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_IconButton.IconButton, {
80
83
  size,
81
84
  symbol,
82
85
  variant,
83
- cssOverrides: require_styles.dialogDismissStyles(require_mergeDeep.mergeDeep(require_styles.defaultDialogTheme.dismiss, theme)),
86
+ cssOverrides: require_styles.dialogDismissStyles(mergedTheme),
84
87
  slot: "close",
85
88
  ...props
86
89
  });
@@ -41,11 +41,12 @@ const DialogRoot = ({ children, theme = {}, cssOverrides, ...props }) => {
41
41
  });
42
42
  };
43
43
  const DialogHeader = ({ variant = "headingLg", element = "h2", theme = {}, cssOverrides, ...props }) => {
44
+ const mergedTheme = mergeDeep(defaultDialogTheme.title, theme);
44
45
  return /* @__PURE__ */ jsx(Typography, {
45
46
  slot: "title",
46
47
  variant,
47
48
  element,
48
- cssOverrides: [dialogHeadingStyles(mergeDeep(defaultDialogTheme.title, theme)), ...cssOverrides == null ? [] : Array.isArray(cssOverrides) ? cssOverrides : [cssOverrides]],
49
+ cssOverrides: [dialogHeadingStyles(mergedTheme), ...cssOverrides == null ? [] : Array.isArray(cssOverrides) ? cssOverrides : [cssOverrides]],
49
50
  ...props
50
51
  });
51
52
  };
@@ -67,18 +68,20 @@ const DialogButtons = ({ children, theme = {}, cssOverrides, ...props }) => {
67
68
  });
68
69
  };
69
70
  const DialogContent = ({ children, theme = {}, cssOverrides, ...props }) => {
71
+ const mergedTheme = mergeDeep(defaultDialogTheme.children, theme);
70
72
  return /* @__PURE__ */ jsx("div", {
71
- css: [dialogContentStyles(mergeDeep(defaultDialogTheme.children, theme)), cssOverrides],
73
+ css: [dialogContentStyles(mergedTheme), cssOverrides],
72
74
  ...props,
73
75
  children
74
76
  });
75
77
  };
76
78
  const DialogDismiss = ({ theme = {}, size = "lg", symbol = "close", variant = "tertiary", ...props }) => {
79
+ const mergedTheme = mergeDeep(defaultDialogTheme.dismiss, theme);
77
80
  return /* @__PURE__ */ jsx(IconButton, {
78
81
  size,
79
82
  symbol,
80
83
  variant,
81
- cssOverrides: dialogDismissStyles(mergeDeep(defaultDialogTheme.dismiss, theme)),
84
+ cssOverrides: dialogDismissStyles(mergedTheme),
82
85
  slot: "close",
83
86
  ...props
84
87
  });
@@ -0,0 +1,161 @@
1
+ const require_mergeDeep = require("../../util/mergeDeep.cjs");
2
+ const require_Icon = require("../Icon/Icon.cjs");
3
+ const require_Typography = require("../Typography/Typography.cjs");
4
+ const require_useId = require("../../util/useId.cjs");
5
+ const require_styles = require("./styles.cjs");
6
+ let react = require("react");
7
+ let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
8
+ let react_aria_components = require("react-aria-components");
9
+ //#region src/components/SidebarStepperNavigation/SidebarStepperNavigation.tsx
10
+ function StatusRow({ label, icon, iconColor, isDisabled, theme }) {
11
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
12
+ css: require_styles.statusRowStyles(theme),
13
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
14
+ variant: "bodySm",
15
+ element: "span",
16
+ theme: { color: isDisabled ? theme.statusRow.shared.text.disabledColor : theme.statusRow.shared.text.color },
17
+ children: label
18
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Icon.Icon, {
19
+ fill: isDisabled ? theme.statusRow.shared.text.disabledColor : iconColor,
20
+ size: "sm",
21
+ theme: { sm: { size: theme.statusRow.shared.icon.size } },
22
+ symbol: icon
23
+ })]
24
+ });
25
+ }
26
+ function CompletionCaption({ status, isDisabled, theme }) {
27
+ switch (status) {
28
+ case "no-fields": return null;
29
+ case "optional": return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(StatusRow, {
30
+ label: "Optional",
31
+ isDisabled,
32
+ iconColor: theme.statusRow.shared.icon.optionalColor,
33
+ icon: "circle",
34
+ theme
35
+ });
36
+ case "complete": return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(StatusRow, {
37
+ label: "Complete",
38
+ isDisabled,
39
+ iconColor: theme.statusRow.shared.icon.completeColor,
40
+ icon: "check_circle",
41
+ theme
42
+ });
43
+ case "incomplete": return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(StatusRow, {
44
+ label: "Incomplete",
45
+ isDisabled,
46
+ iconColor: theme.statusRow.shared.icon.incompleteColor,
47
+ icon: "warning",
48
+ theme
49
+ });
50
+ }
51
+ }
52
+ function buildStepAriaLabel(description, isCurrent, status) {
53
+ return [
54
+ description,
55
+ (() => {
56
+ switch (status) {
57
+ case "complete": return "complete";
58
+ case "incomplete": return "incomplete";
59
+ case "optional": return "optional";
60
+ default: return;
61
+ }
62
+ })(),
63
+ isCurrent ? "current step" : void 0
64
+ ].filter(Boolean).join(", ");
65
+ }
66
+ function getStepNumberColor(theme, isHovered, isCurrent, isDisabled) {
67
+ if (isHovered || isCurrent) return theme.step.shared.text.inverseColor;
68
+ if (isDisabled) return theme.step.shared.text.disabledColor;
69
+ return theme.step.shared.text.color;
70
+ }
71
+ function StepNumber({ stepNumber, isHovered, isCurrent, isDisabled, theme }) {
72
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
73
+ element: "div",
74
+ theme: { color: getStepNumberColor(theme, isHovered, isCurrent, isDisabled) },
75
+ cssOverrides: require_styles.stepNumberStyles(theme, isHovered, isCurrent),
76
+ children: stepNumber
77
+ });
78
+ }
79
+ function Step({ isDisabled, isCurrent, stepNumber, stepStatus, onPress, ariaLabel, description, theme }) {
80
+ const descriptionTypographyColor = isCurrent || !isDisabled ? theme.step.shared.text.color : theme.step.shared.text.disabledColor;
81
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.Button, {
82
+ css: [require_styles.buttonStyleReset, require_styles.stepButtonStyles(theme, isCurrent, isDisabled)],
83
+ isDisabled,
84
+ "aria-label": ariaLabel,
85
+ "aria-current": isCurrent ? "step" : void 0,
86
+ onPress,
87
+ children: ({ isHovered }) => /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(StepNumber, {
88
+ stepNumber,
89
+ isHovered,
90
+ isCurrent,
91
+ isDisabled,
92
+ theme
93
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
94
+ css: require_styles.stepContentStyles(theme),
95
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
96
+ element: "div",
97
+ theme: { color: descriptionTypographyColor },
98
+ variant: "headingMd",
99
+ children: description
100
+ }), stepStatus !== void 0 && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(CompletionCaption, {
101
+ status: stepStatus,
102
+ isDisabled: isDisabled && !isCurrent,
103
+ theme
104
+ })]
105
+ })] })
106
+ });
107
+ }
108
+ function SidebarStepperNavigation({ currentStepId, stepNavConfig, onPress, stepNavTitle = "Steps", theme = {}, cssOverrides, className }) {
109
+ const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultSidebarStepperNavigationTheme, theme);
110
+ const [isOpen, setIsOpen] = (0, react.useState)(false);
111
+ const stepNavId = require_useId.useId("sidebar-stepper-navigation");
112
+ const currentStep = stepNavConfig.steps.find((step) => step.id === currentStepId);
113
+ const visibleSteps = stepNavConfig.steps.filter((step) => !step.parentStepId && step.stepVisible !== false);
114
+ const isCurrent = (step) => step.id === currentStep?.id || step.id === currentStep?.parentStepId;
115
+ const canNavigateTo = (step) => Boolean(!currentStep || currentStep.canSkipFrom && stepNavConfig.isNonLinear && step.canSkipTo && !isCurrent(step));
116
+ const currentStepLabel = currentStep?.label ?? currentStep?.id;
117
+ const mobileToggleLabel = currentStepLabel ? `${stepNavTitle} / ${currentStepLabel}` : stepNavTitle;
118
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(react_aria_components.Button, {
119
+ onPress: () => setIsOpen((open) => !open),
120
+ "aria-expanded": isOpen,
121
+ "aria-controls": stepNavId,
122
+ css: [require_styles.buttonStyleReset, require_styles.mobileToggleStyles(mergedTheme)],
123
+ children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Typography.Typography, {
124
+ element: "div",
125
+ variant: "bodyBoldSm",
126
+ children: mobileToggleLabel
127
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Icon.Icon, {
128
+ size: "md",
129
+ symbol: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"
130
+ })]
131
+ }), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("nav", {
132
+ css: [require_styles.navigationStyles(mergedTheme, isOpen), cssOverrides],
133
+ "aria-label": stepNavTitle,
134
+ id: stepNavId,
135
+ className,
136
+ children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("ol", {
137
+ css: require_styles.listStyles,
138
+ children: visibleSteps.map((step, index) => {
139
+ const stepStatus = step.stepStatus;
140
+ const description = step.label ?? step.id;
141
+ const stepIsCurrent = isCurrent(step);
142
+ const stepIsDisabled = !stepIsCurrent && !canNavigateTo(step);
143
+ const onStepPress = () => {
144
+ if (!stepIsDisabled && !stepIsCurrent) onPress(step.id);
145
+ };
146
+ return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(Step, {
147
+ isDisabled: stepIsDisabled,
148
+ onPress: onStepPress,
149
+ stepNumber: index + 1,
150
+ isCurrent: stepIsCurrent,
151
+ stepStatus,
152
+ theme: mergedTheme,
153
+ ariaLabel: buildStepAriaLabel(description, stepIsCurrent, stepStatus),
154
+ description
155
+ }) }, step.id);
156
+ })
157
+ })
158
+ })] });
159
+ }
160
+ //#endregion
161
+ exports.SidebarStepperNavigation = SidebarStepperNavigation;
@@ -0,0 +1,5 @@
1
+ import { SidebarStepperNavigationProps } from "./types.cjs";
2
+ //#region src/components/SidebarStepperNavigation/SidebarStepperNavigation.d.ts
3
+ declare function SidebarStepperNavigation({ currentStepId, stepNavConfig, onPress, stepNavTitle, theme, cssOverrides, className }: SidebarStepperNavigationProps): import("@emotion/react/jsx-runtime").JSX.Element;
4
+ //#endregion
5
+ export { SidebarStepperNavigation };
@@ -0,0 +1,5 @@
1
+ import { SidebarStepperNavigationProps } from "./types.js";
2
+ //#region src/components/SidebarStepperNavigation/SidebarStepperNavigation.d.ts
3
+ declare function SidebarStepperNavigation({ currentStepId, stepNavConfig, onPress, stepNavTitle, theme, cssOverrides, className }: SidebarStepperNavigationProps): import("@emotion/react/jsx-runtime").JSX.Element;
4
+ //#endregion
5
+ export { SidebarStepperNavigation };
@@ -0,0 +1,161 @@
1
+ import { mergeDeep } from "../../util/mergeDeep.js";
2
+ import { Icon } from "../Icon/Icon.js";
3
+ import { Typography } from "../Typography/Typography.js";
4
+ import { useId } from "../../util/useId.js";
5
+ import { buttonStyleReset, defaultSidebarStepperNavigationTheme, listStyles, mobileToggleStyles, navigationStyles, statusRowStyles, stepButtonStyles, stepContentStyles, stepNumberStyles } from "./styles.js";
6
+ import { useState } from "react";
7
+ import { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";
8
+ import { Button } from "react-aria-components";
9
+ //#region src/components/SidebarStepperNavigation/SidebarStepperNavigation.tsx
10
+ function StatusRow({ label, icon, iconColor, isDisabled, theme }) {
11
+ return /* @__PURE__ */ jsxs("div", {
12
+ css: statusRowStyles(theme),
13
+ children: [/* @__PURE__ */ jsx(Typography, {
14
+ variant: "bodySm",
15
+ element: "span",
16
+ theme: { color: isDisabled ? theme.statusRow.shared.text.disabledColor : theme.statusRow.shared.text.color },
17
+ children: label
18
+ }), /* @__PURE__ */ jsx(Icon, {
19
+ fill: isDisabled ? theme.statusRow.shared.text.disabledColor : iconColor,
20
+ size: "sm",
21
+ theme: { sm: { size: theme.statusRow.shared.icon.size } },
22
+ symbol: icon
23
+ })]
24
+ });
25
+ }
26
+ function CompletionCaption({ status, isDisabled, theme }) {
27
+ switch (status) {
28
+ case "no-fields": return null;
29
+ case "optional": return /* @__PURE__ */ jsx(StatusRow, {
30
+ label: "Optional",
31
+ isDisabled,
32
+ iconColor: theme.statusRow.shared.icon.optionalColor,
33
+ icon: "circle",
34
+ theme
35
+ });
36
+ case "complete": return /* @__PURE__ */ jsx(StatusRow, {
37
+ label: "Complete",
38
+ isDisabled,
39
+ iconColor: theme.statusRow.shared.icon.completeColor,
40
+ icon: "check_circle",
41
+ theme
42
+ });
43
+ case "incomplete": return /* @__PURE__ */ jsx(StatusRow, {
44
+ label: "Incomplete",
45
+ isDisabled,
46
+ iconColor: theme.statusRow.shared.icon.incompleteColor,
47
+ icon: "warning",
48
+ theme
49
+ });
50
+ }
51
+ }
52
+ function buildStepAriaLabel(description, isCurrent, status) {
53
+ return [
54
+ description,
55
+ (() => {
56
+ switch (status) {
57
+ case "complete": return "complete";
58
+ case "incomplete": return "incomplete";
59
+ case "optional": return "optional";
60
+ default: return;
61
+ }
62
+ })(),
63
+ isCurrent ? "current step" : void 0
64
+ ].filter(Boolean).join(", ");
65
+ }
66
+ function getStepNumberColor(theme, isHovered, isCurrent, isDisabled) {
67
+ if (isHovered || isCurrent) return theme.step.shared.text.inverseColor;
68
+ if (isDisabled) return theme.step.shared.text.disabledColor;
69
+ return theme.step.shared.text.color;
70
+ }
71
+ function StepNumber({ stepNumber, isHovered, isCurrent, isDisabled, theme }) {
72
+ return /* @__PURE__ */ jsx(Typography, {
73
+ element: "div",
74
+ theme: { color: getStepNumberColor(theme, isHovered, isCurrent, isDisabled) },
75
+ cssOverrides: stepNumberStyles(theme, isHovered, isCurrent),
76
+ children: stepNumber
77
+ });
78
+ }
79
+ function Step({ isDisabled, isCurrent, stepNumber, stepStatus, onPress, ariaLabel, description, theme }) {
80
+ const descriptionTypographyColor = isCurrent || !isDisabled ? theme.step.shared.text.color : theme.step.shared.text.disabledColor;
81
+ return /* @__PURE__ */ jsx(Button, {
82
+ css: [buttonStyleReset, stepButtonStyles(theme, isCurrent, isDisabled)],
83
+ isDisabled,
84
+ "aria-label": ariaLabel,
85
+ "aria-current": isCurrent ? "step" : void 0,
86
+ onPress,
87
+ children: ({ isHovered }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(StepNumber, {
88
+ stepNumber,
89
+ isHovered,
90
+ isCurrent,
91
+ isDisabled,
92
+ theme
93
+ }), /* @__PURE__ */ jsxs("div", {
94
+ css: stepContentStyles(theme),
95
+ children: [/* @__PURE__ */ jsx(Typography, {
96
+ element: "div",
97
+ theme: { color: descriptionTypographyColor },
98
+ variant: "headingMd",
99
+ children: description
100
+ }), stepStatus !== void 0 && /* @__PURE__ */ jsx(CompletionCaption, {
101
+ status: stepStatus,
102
+ isDisabled: isDisabled && !isCurrent,
103
+ theme
104
+ })]
105
+ })] })
106
+ });
107
+ }
108
+ function SidebarStepperNavigation({ currentStepId, stepNavConfig, onPress, stepNavTitle = "Steps", theme = {}, cssOverrides, className }) {
109
+ const mergedTheme = mergeDeep(defaultSidebarStepperNavigationTheme, theme);
110
+ const [isOpen, setIsOpen] = useState(false);
111
+ const stepNavId = useId("sidebar-stepper-navigation");
112
+ const currentStep = stepNavConfig.steps.find((step) => step.id === currentStepId);
113
+ const visibleSteps = stepNavConfig.steps.filter((step) => !step.parentStepId && step.stepVisible !== false);
114
+ const isCurrent = (step) => step.id === currentStep?.id || step.id === currentStep?.parentStepId;
115
+ const canNavigateTo = (step) => Boolean(!currentStep || currentStep.canSkipFrom && stepNavConfig.isNonLinear && step.canSkipTo && !isCurrent(step));
116
+ const currentStepLabel = currentStep?.label ?? currentStep?.id;
117
+ const mobileToggleLabel = currentStepLabel ? `${stepNavTitle} / ${currentStepLabel}` : stepNavTitle;
118
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Button, {
119
+ onPress: () => setIsOpen((open) => !open),
120
+ "aria-expanded": isOpen,
121
+ "aria-controls": stepNavId,
122
+ css: [buttonStyleReset, mobileToggleStyles(mergedTheme)],
123
+ children: [/* @__PURE__ */ jsx(Typography, {
124
+ element: "div",
125
+ variant: "bodyBoldSm",
126
+ children: mobileToggleLabel
127
+ }), /* @__PURE__ */ jsx(Icon, {
128
+ size: "md",
129
+ symbol: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"
130
+ })]
131
+ }), /* @__PURE__ */ jsx("nav", {
132
+ css: [navigationStyles(mergedTheme, isOpen), cssOverrides],
133
+ "aria-label": stepNavTitle,
134
+ id: stepNavId,
135
+ className,
136
+ children: /* @__PURE__ */ jsx("ol", {
137
+ css: listStyles,
138
+ children: visibleSteps.map((step, index) => {
139
+ const stepStatus = step.stepStatus;
140
+ const description = step.label ?? step.id;
141
+ const stepIsCurrent = isCurrent(step);
142
+ const stepIsDisabled = !stepIsCurrent && !canNavigateTo(step);
143
+ const onStepPress = () => {
144
+ if (!stepIsDisabled && !stepIsCurrent) onPress(step.id);
145
+ };
146
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Step, {
147
+ isDisabled: stepIsDisabled,
148
+ onPress: onStepPress,
149
+ stepNumber: index + 1,
150
+ isCurrent: stepIsCurrent,
151
+ stepStatus,
152
+ theme: mergedTheme,
153
+ ariaLabel: buildStepAriaLabel(description, stepIsCurrent, stepStatus),
154
+ description
155
+ }) }, step.id);
156
+ })
157
+ })
158
+ })] });
159
+ }
160
+ //#endregion
161
+ export { SidebarStepperNavigation };
@@ -0,0 +1,96 @@
1
+ const require_mq = require("../../styleD/utils/semantic/mq.cjs");
2
+ const require_sidebarStepperNavigation = require("../../styleD/build/typescript/component/sidebarStepperNavigation.cjs");
3
+ let _emotion_react = require("@emotion/react");
4
+ //#region src/components/SidebarStepperNavigation/styles.ts
5
+ const defaultSidebarStepperNavigationTheme = require_sidebarStepperNavigation.componentSidebarStepperNavigation;
6
+ const buttonStyleReset = _emotion_react.css`
7
+ appearance: none;
8
+ -webkit-appearance: none;
9
+ background-color: transparent;
10
+ font: inherit;
11
+ color: inherit;
12
+ border: none;
13
+ padding: 0;
14
+ margin: 0;
15
+ `;
16
+ const mobileToggleStyles = (theme) => _emotion_react.css`
17
+ border-bottom: ${theme.mobileToggle.shared.border};
18
+ display: ${theme.mobileToggle.shared.display};
19
+ align-items: ${theme.mobileToggle.shared.alignItems};
20
+ justify-content: ${theme.mobileToggle.shared.justifyContent};
21
+ height: ${theme.mobileToggle.shared.height};
22
+ padding: 0 ${theme.mobileToggle.shared.paddingInline};
23
+ width: ${theme.mobileToggle.shared.width};
24
+ background-color: ${theme.mobileToggle.shared.backgroundColor};
25
+
26
+ ${require_mq.from.md} {
27
+ display: none;
28
+ }
29
+
30
+ &[data-hovered] {
31
+ background-color: ${theme.mobileToggle.shared.hovered.backgroundColor};
32
+ }
33
+
34
+ &[data-pressed] {
35
+ background-color: ${theme.mobileToggle.shared.pressed.backgroundColor};
36
+ }
37
+ `;
38
+ const navigationStyles = (theme, isOpen) => _emotion_react.css`
39
+ border-right: ${theme.navigation.shared.border};
40
+ display: ${isOpen ? "flex" : "none"};
41
+ flex-direction: ${theme.navigation.shared.flexDirection};
42
+ height: ${theme.navigation.shared.height};
43
+
44
+ ${require_mq.from.md} {
45
+ display: flex;
46
+ }
47
+ `;
48
+ const listStyles = _emotion_react.css`
49
+ list-style: none;
50
+ padding: 0;
51
+ margin: 0;
52
+ `;
53
+ const statusRowStyles = (theme) => _emotion_react.css`
54
+ display: ${theme.statusRow.shared.display};
55
+ gap: ${theme.statusRow.shared.gap};
56
+ align-items: ${theme.statusRow.shared.alignItems};
57
+ `;
58
+ const stepNumberStyles = (theme, isHovered, isCurrent) => _emotion_react.css`
59
+ width: ${theme.step.shared.numberColumnWidth};
60
+ height: ${theme.stepNumber.shared.height};
61
+ background-color: ${isCurrent || isHovered ? theme.stepNumber.shared.backgroundColor : "transparent"};
62
+ display: ${theme.stepNumber.shared.display};
63
+ align-items: ${theme.stepNumber.shared.alignItems};
64
+ justify-content: ${theme.stepNumber.shared.justifyContent};
65
+ `;
66
+ const stepButtonStyles = (theme, isCurrent, isDisabled) => _emotion_react.css`
67
+ background-color: ${isCurrent ? theme.step.shared.currentBackgroundColor : theme.step.shared.backgroundColor};
68
+ height: ${theme.step.shared.height};
69
+ cursor: ${isDisabled ? theme.step.shared.disabledCursor : theme.step.shared.cursor};
70
+ border-bottom: ${theme.step.shared.border};
71
+ display: grid;
72
+ grid-template-columns: ${theme.step.shared.numberColumnWidth} 1fr;
73
+ text-align: left;
74
+ width: 100%;
75
+
76
+ &[data-pressed] {
77
+ background-color: ${theme.step.shared.currentBackgroundColor};
78
+ }
79
+ `;
80
+ const stepContentStyles = (theme) => _emotion_react.css`
81
+ gap: ${theme.stepContent.shared.gap};
82
+ display: ${theme.stepContent.shared.display};
83
+ flex-direction: ${theme.stepContent.shared.flexDirection};
84
+ justify-content: ${theme.stepContent.shared.justifyContent};
85
+ margin-left: ${theme.stepContent.shared.marginLeft};
86
+ `;
87
+ //#endregion
88
+ exports.buttonStyleReset = buttonStyleReset;
89
+ exports.defaultSidebarStepperNavigationTheme = defaultSidebarStepperNavigationTheme;
90
+ exports.listStyles = listStyles;
91
+ exports.mobileToggleStyles = mobileToggleStyles;
92
+ exports.navigationStyles = navigationStyles;
93
+ exports.statusRowStyles = statusRowStyles;
94
+ exports.stepButtonStyles = stepButtonStyles;
95
+ exports.stepContentStyles = stepContentStyles;
96
+ exports.stepNumberStyles = stepNumberStyles;
@@ -0,0 +1,8 @@
1
+ import { DeepPartial, Prettify } from "../../util/types.cjs";
2
+ import { ComponentSidebarStepperNavigation } from "../../styleD/build/typescript/component/sidebarStepperNavigation.cjs";
3
+ import { SerializedStyles } from "@emotion/react";
4
+ //#region src/components/SidebarStepperNavigation/styles.d.ts
5
+ type SidebarStepperNavigationTheme = Prettify<ComponentSidebarStepperNavigation>;
6
+ type PartialSidebarStepperNavigationTheme = Prettify<DeepPartial<SidebarStepperNavigationTheme>>;
7
+ //#endregion
8
+ export { PartialSidebarStepperNavigationTheme, SidebarStepperNavigationTheme };
@@ -0,0 +1,8 @@
1
+ import { DeepPartial, Prettify } from "../../util/types.js";
2
+ import { ComponentSidebarStepperNavigation } from "../../styleD/build/typescript/component/sidebarStepperNavigation.js";
3
+ import { SerializedStyles } from "@emotion/react";
4
+ //#region src/components/SidebarStepperNavigation/styles.d.ts
5
+ type SidebarStepperNavigationTheme = Prettify<ComponentSidebarStepperNavigation>;
6
+ type PartialSidebarStepperNavigationTheme = Prettify<DeepPartial<SidebarStepperNavigationTheme>>;
7
+ //#endregion
8
+ export { PartialSidebarStepperNavigationTheme, SidebarStepperNavigationTheme };
@@ -0,0 +1,88 @@
1
+ import { from } from "../../styleD/utils/semantic/mq.js";
2
+ import { componentSidebarStepperNavigation } from "../../styleD/build/typescript/component/sidebarStepperNavigation.js";
3
+ import { css } from "@emotion/react";
4
+ //#region src/components/SidebarStepperNavigation/styles.ts
5
+ const defaultSidebarStepperNavigationTheme = componentSidebarStepperNavigation;
6
+ const buttonStyleReset = css`
7
+ appearance: none;
8
+ -webkit-appearance: none;
9
+ background-color: transparent;
10
+ font: inherit;
11
+ color: inherit;
12
+ border: none;
13
+ padding: 0;
14
+ margin: 0;
15
+ `;
16
+ const mobileToggleStyles = (theme) => css`
17
+ border-bottom: ${theme.mobileToggle.shared.border};
18
+ display: ${theme.mobileToggle.shared.display};
19
+ align-items: ${theme.mobileToggle.shared.alignItems};
20
+ justify-content: ${theme.mobileToggle.shared.justifyContent};
21
+ height: ${theme.mobileToggle.shared.height};
22
+ padding: 0 ${theme.mobileToggle.shared.paddingInline};
23
+ width: ${theme.mobileToggle.shared.width};
24
+ background-color: ${theme.mobileToggle.shared.backgroundColor};
25
+
26
+ ${from.md} {
27
+ display: none;
28
+ }
29
+
30
+ &[data-hovered] {
31
+ background-color: ${theme.mobileToggle.shared.hovered.backgroundColor};
32
+ }
33
+
34
+ &[data-pressed] {
35
+ background-color: ${theme.mobileToggle.shared.pressed.backgroundColor};
36
+ }
37
+ `;
38
+ const navigationStyles = (theme, isOpen) => css`
39
+ border-right: ${theme.navigation.shared.border};
40
+ display: ${isOpen ? "flex" : "none"};
41
+ flex-direction: ${theme.navigation.shared.flexDirection};
42
+ height: ${theme.navigation.shared.height};
43
+
44
+ ${from.md} {
45
+ display: flex;
46
+ }
47
+ `;
48
+ const listStyles = css`
49
+ list-style: none;
50
+ padding: 0;
51
+ margin: 0;
52
+ `;
53
+ const statusRowStyles = (theme) => css`
54
+ display: ${theme.statusRow.shared.display};
55
+ gap: ${theme.statusRow.shared.gap};
56
+ align-items: ${theme.statusRow.shared.alignItems};
57
+ `;
58
+ const stepNumberStyles = (theme, isHovered, isCurrent) => css`
59
+ width: ${theme.step.shared.numberColumnWidth};
60
+ height: ${theme.stepNumber.shared.height};
61
+ background-color: ${isCurrent || isHovered ? theme.stepNumber.shared.backgroundColor : "transparent"};
62
+ display: ${theme.stepNumber.shared.display};
63
+ align-items: ${theme.stepNumber.shared.alignItems};
64
+ justify-content: ${theme.stepNumber.shared.justifyContent};
65
+ `;
66
+ const stepButtonStyles = (theme, isCurrent, isDisabled) => css`
67
+ background-color: ${isCurrent ? theme.step.shared.currentBackgroundColor : theme.step.shared.backgroundColor};
68
+ height: ${theme.step.shared.height};
69
+ cursor: ${isDisabled ? theme.step.shared.disabledCursor : theme.step.shared.cursor};
70
+ border-bottom: ${theme.step.shared.border};
71
+ display: grid;
72
+ grid-template-columns: ${theme.step.shared.numberColumnWidth} 1fr;
73
+ text-align: left;
74
+ width: 100%;
75
+
76
+ &[data-pressed] {
77
+ background-color: ${theme.step.shared.currentBackgroundColor};
78
+ }
79
+ `;
80
+ const stepContentStyles = (theme) => css`
81
+ gap: ${theme.stepContent.shared.gap};
82
+ display: ${theme.stepContent.shared.display};
83
+ flex-direction: ${theme.stepContent.shared.flexDirection};
84
+ justify-content: ${theme.stepContent.shared.justifyContent};
85
+ margin-left: ${theme.stepContent.shared.marginLeft};
86
+ `;
87
+ //#endregion
88
+ export { buttonStyleReset, defaultSidebarStepperNavigationTheme, listStyles, mobileToggleStyles, navigationStyles, statusRowStyles, stepButtonStyles, stepContentStyles, stepNumberStyles };
@@ -0,0 +1,9 @@
1
+ //#region src/components/SidebarStepperNavigation/types.ts
2
+ const StepStatus = [
3
+ "complete",
4
+ "incomplete",
5
+ "optional",
6
+ "no-fields"
7
+ ];
8
+ //#endregion
9
+ exports.StepStatus = StepStatus;
@@ -0,0 +1,26 @@
1
+ import { DefaultProps } from "../../util/types.cjs";
2
+ import { SidebarStepperNavigationTheme } from "./styles.cjs";
3
+ //#region src/components/SidebarStepperNavigation/types.d.ts
4
+ declare const StepStatus: readonly ["complete", "incomplete", "optional", "no-fields"];
5
+ type StepStatus = (typeof StepStatus)[number];
6
+ type StepNavStep = {
7
+ id: string;
8
+ label?: string;
9
+ parentStepId?: string;
10
+ canSkipTo?: boolean;
11
+ canSkipFrom?: boolean;
12
+ stepStatus?: StepStatus;
13
+ stepVisible?: boolean;
14
+ };
15
+ type StepNavConfig = {
16
+ steps: StepNavStep[];
17
+ isNonLinear: boolean;
18
+ };
19
+ interface SidebarStepperNavigationProps extends DefaultProps<SidebarStepperNavigationTheme> {
20
+ currentStepId?: string;
21
+ stepNavConfig: StepNavConfig;
22
+ onPress: (stepId: string) => void;
23
+ stepNavTitle?: string;
24
+ }
25
+ //#endregion
26
+ export { SidebarStepperNavigationProps, StepNavConfig, StepNavStep, StepStatus };