@ttoss/fsl-ui 0.2.4

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +30 -0
  4. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +129 -0
  5. package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +61 -0
  6. package/dist/components/Breadcrumbs/Breadcrumbs.d.mts +61 -0
  7. package/dist/components/Breadcrumbs/Breadcrumbs.mjs +126 -0
  8. package/dist/components/Button/Button.cjs +80 -0
  9. package/dist/components/Button/Button.d.cts +68 -0
  10. package/dist/components/Button/Button.d.mts +68 -0
  11. package/dist/components/Button/Button.mjs +79 -0
  12. package/dist/components/Checkbox/Checkbox.cjs +183 -0
  13. package/dist/components/Checkbox/Checkbox.d.cts +45 -0
  14. package/dist/components/Checkbox/Checkbox.d.mts +45 -0
  15. package/dist/components/Checkbox/Checkbox.mjs +182 -0
  16. package/dist/components/CheckboxGroup/CheckboxGroup.cjs +97 -0
  17. package/dist/components/CheckboxGroup/CheckboxGroup.d.cts +56 -0
  18. package/dist/components/CheckboxGroup/CheckboxGroup.d.mts +56 -0
  19. package/dist/components/CheckboxGroup/CheckboxGroup.mjs +96 -0
  20. package/dist/components/FileTrigger/FileTrigger.cjs +51 -0
  21. package/dist/components/FileTrigger/FileTrigger.d.cts +52 -0
  22. package/dist/components/FileTrigger/FileTrigger.d.mts +52 -0
  23. package/dist/components/FileTrigger/FileTrigger.mjs +50 -0
  24. package/dist/components/GridList/GridList.cjs +220 -0
  25. package/dist/components/GridList/GridList.d.cts +72 -0
  26. package/dist/components/GridList/GridList.d.mts +72 -0
  27. package/dist/components/GridList/GridList.mjs +217 -0
  28. package/dist/components/Group/Group.cjs +77 -0
  29. package/dist/components/Group/Group.d.cts +61 -0
  30. package/dist/components/Group/Group.d.mts +61 -0
  31. package/dist/components/Group/Group.mjs +74 -0
  32. package/dist/components/Icon/Icon.cjs +52 -0
  33. package/dist/components/Icon/Icon.mjs +52 -0
  34. package/dist/components/Icon/glyphs.cjs +72 -0
  35. package/dist/components/Icon/glyphs.mjs +63 -0
  36. package/dist/components/Link/Link.cjs +62 -0
  37. package/dist/components/Link/Link.d.cts +38 -0
  38. package/dist/components/Link/Link.d.mts +38 -0
  39. package/dist/components/Link/Link.mjs +61 -0
  40. package/dist/components/ListBox/ListBox.cjs +126 -0
  41. package/dist/components/ListBox/ListBox.d.cts +63 -0
  42. package/dist/components/ListBox/ListBox.d.mts +63 -0
  43. package/dist/components/ListBox/ListBox.mjs +123 -0
  44. package/dist/components/Meter/Meter.cjs +126 -0
  45. package/dist/components/Meter/Meter.d.cts +63 -0
  46. package/dist/components/Meter/Meter.d.mts +63 -0
  47. package/dist/components/Meter/Meter.mjs +125 -0
  48. package/dist/components/NumberField/NumberField.cjs +221 -0
  49. package/dist/components/NumberField/NumberField.d.cts +68 -0
  50. package/dist/components/NumberField/NumberField.d.mts +68 -0
  51. package/dist/components/NumberField/NumberField.mjs +220 -0
  52. package/dist/components/ProgressBar/ProgressBar.cjs +132 -0
  53. package/dist/components/ProgressBar/ProgressBar.d.cts +56 -0
  54. package/dist/components/ProgressBar/ProgressBar.d.mts +56 -0
  55. package/dist/components/ProgressBar/ProgressBar.mjs +129 -0
  56. package/dist/components/RadioGroup/RadioGroup.cjs +218 -0
  57. package/dist/components/RadioGroup/RadioGroup.d.cts +82 -0
  58. package/dist/components/RadioGroup/RadioGroup.d.mts +82 -0
  59. package/dist/components/RadioGroup/RadioGroup.mjs +215 -0
  60. package/dist/components/Select/Select.cjs +253 -0
  61. package/dist/components/Select/Select.d.cts +86 -0
  62. package/dist/components/Select/Select.d.mts +86 -0
  63. package/dist/components/Select/Select.mjs +250 -0
  64. package/dist/components/Separator/Separator.cjs +64 -0
  65. package/dist/components/Separator/Separator.d.cts +44 -0
  66. package/dist/components/Separator/Separator.d.mts +44 -0
  67. package/dist/components/Separator/Separator.mjs +63 -0
  68. package/dist/components/Slider/Slider.cjs +160 -0
  69. package/dist/components/Slider/Slider.d.cts +45 -0
  70. package/dist/components/Slider/Slider.d.mts +45 -0
  71. package/dist/components/Slider/Slider.mjs +159 -0
  72. package/dist/components/Switch/Switch.cjs +176 -0
  73. package/dist/components/Switch/Switch.d.cts +43 -0
  74. package/dist/components/Switch/Switch.d.mts +43 -0
  75. package/dist/components/Switch/Switch.mjs +175 -0
  76. package/dist/components/Tabs/Tabs.cjs +180 -0
  77. package/dist/components/Tabs/Tabs.d.cts +85 -0
  78. package/dist/components/Tabs/Tabs.d.mts +85 -0
  79. package/dist/components/Tabs/Tabs.mjs +173 -0
  80. package/dist/components/Toast/Toast.cjs +218 -0
  81. package/dist/components/Toast/Toast.d.cts +96 -0
  82. package/dist/components/Toast/Toast.d.mts +96 -0
  83. package/dist/components/Toast/Toast.mjs +214 -0
  84. package/dist/components/ToggleButton/ToggleButton.cjs +125 -0
  85. package/dist/components/ToggleButton/ToggleButton.d.cts +43 -0
  86. package/dist/components/ToggleButton/ToggleButton.d.mts +43 -0
  87. package/dist/components/ToggleButton/ToggleButton.mjs +124 -0
  88. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.cjs +48 -0
  89. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.cts +41 -0
  90. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.mts +41 -0
  91. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.mjs +47 -0
  92. package/dist/components/Toolbar/Toolbar.cjs +67 -0
  93. package/dist/components/Toolbar/Toolbar.d.cts +60 -0
  94. package/dist/components/Toolbar/Toolbar.d.mts +60 -0
  95. package/dist/components/Toolbar/Toolbar.mjs +66 -0
  96. package/dist/composites/Accordion/Accordion.cjs +279 -0
  97. package/dist/composites/Accordion/Accordion.d.cts +176 -0
  98. package/dist/composites/Accordion/Accordion.d.mts +176 -0
  99. package/dist/composites/Accordion/Accordion.mjs +270 -0
  100. package/dist/composites/ConfirmationDialog/ConfirmationDialog.cjs +206 -0
  101. package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.cts +166 -0
  102. package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.mts +166 -0
  103. package/dist/composites/ConfirmationDialog/ConfirmationDialog.mjs +203 -0
  104. package/dist/composites/Dialog/Dialog.cjs +372 -0
  105. package/dist/composites/Dialog/Dialog.d.cts +234 -0
  106. package/dist/composites/Dialog/Dialog.d.mts +234 -0
  107. package/dist/composites/Dialog/Dialog.mjs +360 -0
  108. package/dist/composites/Disclosure/Disclosure.cjs +214 -0
  109. package/dist/composites/Disclosure/Disclosure.d.cts +118 -0
  110. package/dist/composites/Disclosure/Disclosure.d.mts +118 -0
  111. package/dist/composites/Disclosure/Disclosure.mjs +207 -0
  112. package/dist/composites/Form/Form.cjs +161 -0
  113. package/dist/composites/Form/Form.d.cts +176 -0
  114. package/dist/composites/Form/Form.d.mts +176 -0
  115. package/dist/composites/Form/Form.mjs +156 -0
  116. package/dist/composites/Menu/Menu.cjs +190 -0
  117. package/dist/composites/Menu/Menu.d.cts +158 -0
  118. package/dist/composites/Menu/Menu.d.mts +158 -0
  119. package/dist/composites/Menu/Menu.mjs +186 -0
  120. package/dist/composites/Popover/Popover.cjs +80 -0
  121. package/dist/composites/Popover/Popover.d.cts +56 -0
  122. package/dist/composites/Popover/Popover.d.mts +56 -0
  123. package/dist/composites/Popover/Popover.mjs +78 -0
  124. package/dist/composites/SearchField/SearchField.cjs +194 -0
  125. package/dist/composites/SearchField/SearchField.d.cts +81 -0
  126. package/dist/composites/SearchField/SearchField.d.mts +81 -0
  127. package/dist/composites/SearchField/SearchField.mjs +189 -0
  128. package/dist/composites/TagGroup/TagGroup.cjs +212 -0
  129. package/dist/composites/TagGroup/TagGroup.d.cts +84 -0
  130. package/dist/composites/TagGroup/TagGroup.d.mts +84 -0
  131. package/dist/composites/TagGroup/TagGroup.mjs +209 -0
  132. package/dist/composites/TextArea/TextArea.cjs +190 -0
  133. package/dist/composites/TextArea/TextArea.d.cts +95 -0
  134. package/dist/composites/TextArea/TextArea.d.mts +95 -0
  135. package/dist/composites/TextArea/TextArea.mjs +181 -0
  136. package/dist/composites/TextField/TextField.cjs +200 -0
  137. package/dist/composites/TextField/TextField.d.cts +111 -0
  138. package/dist/composites/TextField/TextField.d.mts +111 -0
  139. package/dist/composites/TextField/TextField.mjs +191 -0
  140. package/dist/composites/Tooltip/Tooltip.cjs +79 -0
  141. package/dist/composites/Tooltip/Tooltip.d.cts +53 -0
  142. package/dist/composites/Tooltip/Tooltip.d.mts +53 -0
  143. package/dist/composites/Tooltip/Tooltip.mjs +77 -0
  144. package/dist/composites/Wizard/Wizard.cjs +333 -0
  145. package/dist/composites/Wizard/Wizard.d.cts +206 -0
  146. package/dist/composites/Wizard/Wizard.d.mts +206 -0
  147. package/dist/composites/Wizard/Wizard.mjs +324 -0
  148. package/dist/composites/scope.cjs +124 -0
  149. package/dist/composites/scope.mjs +121 -0
  150. package/dist/index.cjs +186 -0
  151. package/dist/index.d.cts +37 -0
  152. package/dist/index.d.mts +37 -0
  153. package/dist/index.mjs +39 -0
  154. package/dist/semantics/componentMeta.d.cts +37 -0
  155. package/dist/semantics/componentMeta.d.mts +37 -0
  156. package/dist/semantics/index.cjs +16 -0
  157. package/dist/semantics/index.d.cts +4 -0
  158. package/dist/semantics/index.d.mts +4 -0
  159. package/dist/semantics/index.mjs +3 -0
  160. package/dist/semantics/taxonomy.cjs +150 -0
  161. package/dist/semantics/taxonomy.d.cts +153 -0
  162. package/dist/semantics/taxonomy.d.mts +153 -0
  163. package/dist/semantics/taxonomy.mjs +140 -0
  164. package/dist/tokens/escapeHatch.cjs +13 -0
  165. package/dist/tokens/escapeHatch.mjs +13 -0
  166. package/dist/tokens/focusRing.cjs +28 -0
  167. package/dist/tokens/focusRing.mjs +28 -0
  168. package/dist/tokens/keyframes.cjs +76 -0
  169. package/dist/tokens/keyframes.mjs +75 -0
  170. package/dist/tokens/resolveInteractiveStyle.cjs +41 -0
  171. package/dist/tokens/resolveInteractiveStyle.mjs +41 -0
  172. package/llms.txt +142 -0
  173. package/package.json +70 -0
  174. package/src/tokens/CONTRACT.md +505 -0
@@ -0,0 +1,333 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ const require_Button = require('../../components/Button/Button.cjs');
4
+ const require_scope = require('../scope.cjs');
5
+ let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let react = require("react");
8
+ react = require_runtime.__toESM(react);
9
+
10
+ //#region src/composites/Wizard/Wizard.tsx
11
+ /**
12
+ * Tag a component as a Wizard slot. Returns the same component augmented
13
+ * with a typed `.composition` literal — no cast, no post-declaration
14
+ * mutation in the caller.
15
+ */
16
+ var defineWizardSlot = (Component, composition) => {
17
+ return Object.assign(Component, {
18
+ composition
19
+ });
20
+ };
21
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
22
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
23
+ var readComposition = type => {
24
+ if (type === null || typeof type !== "object" && typeof type !== "function") return;
25
+ const candidate = type.composition;
26
+ if (candidate === "step" || candidate === "summary" || candidate === "navigation") return candidate;
27
+ };
28
+ var getChildComposition = child => {
29
+ if (!react.isValidElement(child)) return void 0;
30
+ let type = child.type;
31
+ for (let depth = 0; depth < 8; depth++) {
32
+ const direct = readComposition(type);
33
+ if (direct !== void 0) return direct;
34
+ if (typeof type !== "object" || type === null) return void 0;
35
+ const wrapped = type;
36
+ if (wrapped.$$typeof === REACT_MEMO_TYPE) {
37
+ type = wrapped.type;
38
+ continue;
39
+ }
40
+ if (wrapped.$$typeof === REACT_FORWARD_REF_TYPE) {
41
+ type = wrapped.render;
42
+ continue;
43
+ }
44
+ return;
45
+ }
46
+ };
47
+ var wizardScope = require_scope.createCompositeScope("Wizard");
48
+ var VISUALLY_HIDDEN_STYLE = {
49
+ position: "absolute",
50
+ width: "1px",
51
+ height: "1px",
52
+ padding: 0,
53
+ margin: "-1px",
54
+ overflow: "hidden",
55
+ clipPath: "inset(50%)",
56
+ whiteSpace: "nowrap",
57
+ border: 0
58
+ };
59
+ /**
60
+ * Default step announcement — an English fallback, documented per the
61
+ * package i18n rule (CONTRIBUTING §6 / ADR-001): supplementary AT feedback
62
+ * may ship a default; localized hosts override via
63
+ * {@link WizardProps.announceStep}.
64
+ */
65
+ var defaultAnnounceStep = ({
66
+ currentStep,
67
+ totalSteps,
68
+ isComplete
69
+ }) => {
70
+ if (isComplete) return "Complete";
71
+ return `Step ${currentStep + 1} of ${totalSteps}`;
72
+ };
73
+ /**
74
+ * Formal semantic identity — Wizard root (Structure entity, root part).
75
+ */
76
+ var wizardMeta = {
77
+ displayName: "Wizard",
78
+ entity: "Structure",
79
+ structure: "root"
80
+ };
81
+ /**
82
+ * A step-at-a-time Structure composite. The host reads each child's
83
+ * fixed `composition` identity at runtime to decide which single step
84
+ * to render, whether to swap in the summary view, and whether to render
85
+ * the navigation row. This is the canonical evidence that FSL
86
+ * `Composition` drives behavior from *fixed-identity sub-parts*
87
+ * (complementing `DialogActions`, which drives behavior from *runtime
88
+ * values on leaves*).
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * const [step, setStep] = React.useState(0);
93
+ * return (
94
+ * <Wizard currentStep={step} onStepChange={setStep} aria-label="Onboarding">
95
+ * <WizardStep>First step content</WizardStep>
96
+ * <WizardStep>Second step content</WizardStep>
97
+ * <WizardStep>Third step content</WizardStep>
98
+ * <WizardSummary>All done!</WizardSummary>
99
+ * <WizardNavigation prevLabel="Back" nextLabel="Next" finishLabel="Finish" />
100
+ * </Wizard>
101
+ * );
102
+ * ```
103
+ */
104
+ var Wizard = ({
105
+ currentStep,
106
+ defaultStep = 0,
107
+ onStepChange,
108
+ announceStep = defaultAnnounceStep,
109
+ children,
110
+ ...props
111
+ }) => {
112
+ const [internalStep, setInternalStep] = react.useState(defaultStep);
113
+ const step = currentStep ?? internalStep;
114
+ const rootRef = react.useRef(null);
115
+ const setStep = react.useCallback(next => {
116
+ if (currentStep === void 0) setInternalStep(next);
117
+ onStepChange?.(next);
118
+ }, [currentStep, onStepChange]);
119
+ const classified = react.useMemo(() => {
120
+ const steps = [];
121
+ let summary = null;
122
+ let navigation = null;
123
+ const unknown = [];
124
+ react.Children.forEach(children, child => {
125
+ const composition = getChildComposition(child);
126
+ if (composition === "step" && react.isValidElement(child)) steps.push(child);else if (composition === "summary" && react.isValidElement(child)) summary = child;else if (composition === "navigation" && react.isValidElement(child)) navigation = child;else unknown.push(child);
127
+ });
128
+ return {
129
+ steps,
130
+ summary,
131
+ navigation,
132
+ unknown
133
+ };
134
+ }, [children]);
135
+ const totalSteps = classified.steps.length;
136
+ const safeStep = Math.max(0, Math.min(step, totalSteps));
137
+ const isComplete = safeStep >= totalSteps && totalSteps > 0;
138
+ const goTo = react.useCallback(next => {
139
+ setStep(Math.max(0, Math.min(next, totalSteps)));
140
+ }, [setStep, totalSteps]);
141
+ const goNext = react.useCallback(() => {
142
+ return goTo(safeStep + 1);
143
+ }, [goTo, safeStep]);
144
+ const goPrev = react.useCallback(() => {
145
+ return goTo(safeStep - 1);
146
+ }, [goTo, safeStep]);
147
+ const contextValue = react.useMemo(() => {
148
+ return {
149
+ currentStep: safeStep,
150
+ totalSteps,
151
+ isFirst: safeStep === 0,
152
+ isLast: totalSteps > 0 && safeStep === totalSteps - 1,
153
+ isComplete,
154
+ goNext,
155
+ goPrev,
156
+ goTo
157
+ };
158
+ }, [safeStep, totalSteps, isComplete, goNext, goPrev, goTo]);
159
+ const activeStep = isComplete ? classified.summary : classified.steps[safeStep] ?? null;
160
+ const prevStepRef = react.useRef(safeStep);
161
+ react.useEffect(() => {
162
+ if (prevStepRef.current === safeStep) return;
163
+ prevStepRef.current = safeStep;
164
+ rootRef.current?.querySelector("[data-part=\"content\"]")?.focus();
165
+ }, [safeStep]);
166
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(wizardScope.Provider, {
167
+ value: contextValue,
168
+ children: /* @__PURE__ */(0, react_jsx_runtime.jsxs)("section", {
169
+ ...props,
170
+ ref: rootRef,
171
+ "data-scope": "wizard",
172
+ "data-part": "root",
173
+ "data-current-step": safeStep,
174
+ "data-total-steps": totalSteps,
175
+ "data-complete": isComplete ? "true" : void 0,
176
+ style: {
177
+ boxSizing: "border-box",
178
+ display: "flex",
179
+ flexDirection: "column",
180
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.md,
181
+ ..._ttoss_fsl_theme_vars.vars.text.body.md
182
+ },
183
+ children: [/* @__PURE__ */(0, react_jsx_runtime.jsx)("div", {
184
+ "data-scope": "wizard",
185
+ "data-part": "status",
186
+ "aria-live": "polite",
187
+ style: VISUALLY_HIDDEN_STYLE,
188
+ children: totalSteps > 0 ? announceStep({
189
+ currentStep: safeStep,
190
+ totalSteps,
191
+ isComplete
192
+ }) : null
193
+ }), activeStep, classified.navigation, classified.unknown]
194
+ })
195
+ });
196
+ };
197
+ Wizard.displayName = wizardMeta.displayName;
198
+ /**
199
+ * Formal semantic identity — a step body inside a {@link Wizard}.
200
+ */
201
+ var wizardStepMeta = {
202
+ displayName: "WizardStep",
203
+ entity: "Structure",
204
+ structure: "content",
205
+ composition: "step"
206
+ };
207
+ /**
208
+ * A single step's body inside a Wizard. Only the step at the current
209
+ * index is rendered — selection is the Wizard host's runtime dispatch
210
+ * on this component's fixed `composition` identity.
211
+ */
212
+ var WizardStepBase = props => {
213
+ wizardScope.use(wizardStepMeta.displayName);
214
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)("div", {
215
+ tabIndex: -1,
216
+ ...props,
217
+ "data-scope": "wizard",
218
+ "data-part": "content",
219
+ "data-composition": "step",
220
+ style: {
221
+ boxSizing: "border-box",
222
+ display: "flex",
223
+ flexDirection: "column",
224
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.sm
225
+ }
226
+ });
227
+ };
228
+ WizardStepBase.displayName = wizardStepMeta.displayName;
229
+ var WizardStep = defineWizardSlot(WizardStepBase, "step");
230
+ /**
231
+ * Formal semantic identity — summary view shown after the last step.
232
+ */
233
+ var wizardSummaryMeta = {
234
+ displayName: "WizardSummary",
235
+ entity: "Structure",
236
+ structure: "content",
237
+ composition: "summary"
238
+ };
239
+ /**
240
+ * A summary view shown once the user has advanced past the last
241
+ * {@link WizardStep}. Selection is the Wizard host's runtime dispatch on
242
+ * this component's fixed `composition` identity — rendered if and only if
243
+ * `currentStep === totalSteps`.
244
+ */
245
+ var WizardSummaryBase = props => {
246
+ wizardScope.use(wizardSummaryMeta.displayName);
247
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)("div", {
248
+ tabIndex: -1,
249
+ ...props,
250
+ "data-scope": "wizard",
251
+ "data-part": "content",
252
+ "data-composition": "summary",
253
+ style: {
254
+ boxSizing: "border-box",
255
+ display: "flex",
256
+ flexDirection: "column",
257
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.sm
258
+ }
259
+ });
260
+ };
261
+ WizardSummaryBase.displayName = wizardSummaryMeta.displayName;
262
+ var WizardSummary = defineWizardSlot(WizardSummaryBase, "summary");
263
+ /**
264
+ * Formal semantic identity — the navigation slot inside a {@link Wizard}.
265
+ */
266
+ var wizardNavigationMeta = {
267
+ displayName: "WizardNavigation",
268
+ entity: "Structure",
269
+ structure: "actions",
270
+ composition: "navigation"
271
+ };
272
+ /**
273
+ * Default navigation row for a {@link Wizard}. Reads wizard state from
274
+ * React context — rendering is otherwise deterministic: `Back` is
275
+ * disabled on the first step; the primary button switches label from
276
+ * the next label to the finish label on the last step and fires
277
+ * `onFinish` before advancing. All labels are caller-supplied — the
278
+ * package ships no user-facing copy (CONTRIBUTING §6 / ADR-001).
279
+ */
280
+ var WizardNavigationBase = ({
281
+ prevLabel,
282
+ nextLabel,
283
+ finishLabel,
284
+ onFinish,
285
+ children
286
+ }) => {
287
+ const ctx = wizardScope.use(wizardNavigationMeta.displayName);
288
+ const content = children ? children(ctx) : /* @__PURE__ */(0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, {
289
+ children: [/* @__PURE__ */(0, react_jsx_runtime.jsx)(require_Button.Button, {
290
+ evaluation: "muted",
291
+ onPress: ctx.goPrev,
292
+ isDisabled: ctx.isFirst || ctx.isComplete,
293
+ children: prevLabel
294
+ }), /* @__PURE__ */(0, react_jsx_runtime.jsx)(require_Button.Button, {
295
+ evaluation: "primary",
296
+ composition: "primaryAction",
297
+ consequence: ctx.isLast ? "committing" : "neutral",
298
+ isDisabled: ctx.isComplete,
299
+ onPress: () => {
300
+ if (ctx.isLast) onFinish?.();
301
+ ctx.goNext();
302
+ },
303
+ children: ctx.isLast ? finishLabel : nextLabel
304
+ })]
305
+ });
306
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)("div", {
307
+ "data-scope": "wizard",
308
+ "data-part": "actions",
309
+ "data-composition": "navigation",
310
+ style: {
311
+ boxSizing: "border-box",
312
+ display: "flex",
313
+ flexDirection: "row",
314
+ alignItems: "center",
315
+ justifyContent: "flex-end",
316
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.inline.md,
317
+ marginBlockStart: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.sm
318
+ },
319
+ children: content
320
+ });
321
+ };
322
+ WizardNavigationBase.displayName = wizardNavigationMeta.displayName;
323
+ var WizardNavigation = defineWizardSlot(WizardNavigationBase, "navigation");
324
+
325
+ //#endregion
326
+ exports.Wizard = Wizard;
327
+ exports.WizardNavigation = WizardNavigation;
328
+ exports.WizardStep = WizardStep;
329
+ exports.WizardSummary = WizardSummary;
330
+ exports.wizardMeta = wizardMeta;
331
+ exports.wizardNavigationMeta = wizardNavigationMeta;
332
+ exports.wizardStepMeta = wizardStepMeta;
333
+ exports.wizardSummaryMeta = wizardSummaryMeta;
@@ -0,0 +1,206 @@
1
+
2
+ import * as React from "react";
3
+
4
+ //#region src/composites/Wizard/Wizard.d.ts
5
+ type WizardSlotComposition = 'step' | 'summary' | 'navigation';
6
+ type WizardSlotComponent<P, K extends WizardSlotComposition> = React.ComponentType<P> & {
7
+ composition: K;
8
+ };
9
+ /**
10
+ * Public state surface shared by the {@link Wizard} host with its
11
+ * sub-parts. Consumed by {@link WizardNavigationProps.children} as a
12
+ * render-prop signature so authors can compose custom navigation while
13
+ * still observing the same state machine the default row uses.
14
+ */
15
+ interface WizardState {
16
+ currentStep: number;
17
+ totalSteps: number;
18
+ isFirst: boolean;
19
+ isLast: boolean;
20
+ isComplete: boolean;
21
+ goNext: () => void;
22
+ goPrev: () => void;
23
+ goTo: (step: number) => void;
24
+ }
25
+ /**
26
+ * Formal semantic identity — Wizard root (Structure entity, root part).
27
+ */
28
+ declare const wizardMeta: {
29
+ readonly displayName: "Wizard";
30
+ readonly entity: "Structure";
31
+ readonly structure: "root";
32
+ };
33
+ /**
34
+ * Props for {@link Wizard}.
35
+ *
36
+ * The Wizard root carries no `evaluation` prop: under the evidence rule
37
+ * (CONTRIBUTING §2.3) a dimension only appears on a component if a runtime
38
+ * dispatches on it. The Wizard root renders a transparent `<section>` —
39
+ * no color tokens are read here — so adding `evaluation` would reserve API
40
+ * surface for a speculative future consumer. Re-introduce it the day a
41
+ * real consumer (e.g. wizard frame chrome) needs it.
42
+ *
43
+ * The composite owns its layout; the root does not accept `style` or
44
+ * `className`. Pass them on a wrapping element instead. See CONTRIBUTING
45
+ * §4.
46
+ */
47
+ interface WizardProps {
48
+ /**
49
+ * Controlled current step index (0-based). When the user has advanced
50
+ * past the last step, `currentStep === numberOfSteps` — this is the
51
+ * terminal state that renders the {@link WizardSummary} sub-part (if
52
+ * provided). Pair with {@link WizardProps.onStepChange}.
53
+ */
54
+ currentStep?: number;
55
+ /**
56
+ * Initial step index when rendering uncontrolled.
57
+ * @default 0
58
+ */
59
+ defaultStep?: number;
60
+ /**
61
+ * Fires whenever the active step changes — controlled or uncontrolled.
62
+ */
63
+ onStepChange?: (step: number) => void;
64
+ /**
65
+ * Accessible name for the wizard region (rendered as `aria-label`).
66
+ * Always provide one (or `aria-labelledby`) — the wizard renders a
67
+ * `<section>` landmark and screen-reader users navigate by its name.
68
+ */
69
+ 'aria-label'?: string;
70
+ /**
71
+ * Builds the text announced by the wizard's visually-hidden
72
+ * `aria-live=polite` region whenever the active step changes.
73
+ * The default is an English fallback (`"Step 2 of 3"` / `"Complete"`) —
74
+ * localized hosts supply their own copy here (CONTRIBUTING §6).
75
+ */
76
+ announceStep?: (state: {
77
+ currentStep: number;
78
+ totalSteps: number;
79
+ isComplete: boolean;
80
+ }) => string;
81
+ /**
82
+ * Expected children: any number of {@link WizardStep} (in order), an
83
+ * optional {@link WizardSummary}, and an optional {@link WizardNavigation}.
84
+ * Children are dispatched on their fixed `composition` identity.
85
+ */
86
+ children?: React.ReactNode;
87
+ }
88
+ /**
89
+ * A step-at-a-time Structure composite. The host reads each child's
90
+ * fixed `composition` identity at runtime to decide which single step
91
+ * to render, whether to swap in the summary view, and whether to render
92
+ * the navigation row. This is the canonical evidence that FSL
93
+ * `Composition` drives behavior from *fixed-identity sub-parts*
94
+ * (complementing `DialogActions`, which drives behavior from *runtime
95
+ * values on leaves*).
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * const [step, setStep] = React.useState(0);
100
+ * return (
101
+ * <Wizard currentStep={step} onStepChange={setStep} aria-label="Onboarding">
102
+ * <WizardStep>First step content</WizardStep>
103
+ * <WizardStep>Second step content</WizardStep>
104
+ * <WizardStep>Third step content</WizardStep>
105
+ * <WizardSummary>All done!</WizardSummary>
106
+ * <WizardNavigation prevLabel="Back" nextLabel="Next" finishLabel="Finish" />
107
+ * </Wizard>
108
+ * );
109
+ * ```
110
+ */
111
+ declare const Wizard: {
112
+ ({
113
+ currentStep,
114
+ defaultStep,
115
+ onStepChange,
116
+ announceStep,
117
+ children,
118
+ ...props
119
+ }: WizardProps): import("react/jsx-runtime").JSX.Element;
120
+ displayName: "Wizard";
121
+ };
122
+ /**
123
+ * Formal semantic identity — a step body inside a {@link Wizard}.
124
+ */
125
+ declare const wizardStepMeta: {
126
+ readonly displayName: "WizardStep";
127
+ readonly entity: "Structure";
128
+ readonly structure: "content";
129
+ readonly composition: "step";
130
+ };
131
+ /**
132
+ * Props for {@link WizardStep}.
133
+ */
134
+ interface WizardStepProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {
135
+ /**
136
+ * Optional accessible label for this step (rendered as `aria-label`).
137
+ */
138
+ 'aria-label'?: string;
139
+ /** Step body — freeform content (fields, descriptions, media). */
140
+ children?: React.ReactNode;
141
+ }
142
+ declare const WizardStep: WizardSlotComponent<WizardStepProps, "step">;
143
+ /**
144
+ * Formal semantic identity — summary view shown after the last step.
145
+ */
146
+ declare const wizardSummaryMeta: {
147
+ readonly displayName: "WizardSummary";
148
+ readonly entity: "Structure";
149
+ readonly structure: "content";
150
+ readonly composition: "summary";
151
+ };
152
+ /**
153
+ * Props for {@link WizardSummary}.
154
+ */
155
+ type WizardSummaryProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className'>;
156
+ declare const WizardSummary: WizardSlotComponent<WizardSummaryProps, "summary">;
157
+ /**
158
+ * Formal semantic identity — the navigation slot inside a {@link Wizard}.
159
+ */
160
+ declare const wizardNavigationMeta: {
161
+ readonly displayName: "WizardNavigation";
162
+ readonly entity: "Structure";
163
+ readonly structure: "actions";
164
+ readonly composition: "navigation";
165
+ };
166
+ interface WizardNavigationCommonProps {
167
+ /**
168
+ * Fires when the user advances past the last step (first click of
169
+ * `Finish`). The Wizard host transitions to the `isComplete` state
170
+ * and renders the {@link WizardSummary} if one is provided.
171
+ */
172
+ onFinish?: () => void;
173
+ }
174
+ interface WizardNavigationLabelProps extends WizardNavigationCommonProps {
175
+ /**
176
+ * Label for the "previous step" button. **Required** — flow-critical
177
+ * labels have no English default (CONTRIBUTING §6 / ADR-001); the
178
+ * caller supplies localized copy.
179
+ */
180
+ prevLabel: React.ReactNode;
181
+ /** Label for the "next step" button. **Required** — see `prevLabel`. */
182
+ nextLabel: React.ReactNode;
183
+ /** Label for the final-step button. **Required** — see `prevLabel`. */
184
+ finishLabel: React.ReactNode;
185
+ children?: never;
186
+ }
187
+ interface WizardNavigationRenderProps extends WizardNavigationCommonProps {
188
+ /**
189
+ * Replace the default button row with a render-prop so the host can
190
+ * compose custom controls while still reading wizard state from the
191
+ * same context (validation gating, async next, etc.). When provided,
192
+ * the label props do not apply — the render-prop owns all copy.
193
+ */
194
+ children: (state: WizardState) => React.ReactNode;
195
+ prevLabel?: never;
196
+ nextLabel?: never;
197
+ finishLabel?: never;
198
+ }
199
+ /**
200
+ * Props for {@link WizardNavigation} — either the default row with
201
+ * caller-supplied labels, or a render-prop that owns the whole row.
202
+ */
203
+ type WizardNavigationProps = WizardNavigationLabelProps | WizardNavigationRenderProps;
204
+ declare const WizardNavigation: WizardSlotComponent<WizardNavigationProps, "navigation">;
205
+ //#endregion
206
+ export { Wizard, WizardNavigation, WizardNavigationProps, WizardProps, WizardStep, WizardStepProps, WizardSummary, WizardSummaryProps, wizardMeta, wizardNavigationMeta, wizardStepMeta, wizardSummaryMeta };