@zeyos/zx 2.3.0 → 4.0.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/CHANGELOG.md +138 -0
- package/DESIGN-SYSTEM.md +96 -0
- package/README.md +29 -39
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +243 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/card/card.d.ts +128 -0
- package/dist/types/components/chart/chart.d.ts +322 -0
- package/dist/types/components/date-picker/month-picker.d.ts +6 -0
- package/dist/types/components/dialog/dialog.d.ts +9 -0
- package/dist/types/components/dock/dock.d.ts +495 -0
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +14 -0
- package/dist/types/components/field-upload/field-upload.d.ts +37 -4
- package/dist/types/components/form/form.d.ts +25 -3
- package/dist/types/components/grid/grid.d.ts +172 -0
- package/dist/types/components/launcher/launcher.d.ts +359 -0
- package/dist/types/components/layout/layout.d.ts +4 -4
- package/dist/types/components/menu-button/menu-button.d.ts +10 -2
- package/dist/types/components/modal/modal.d.ts +25 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +7 -1
- package/dist/types/components/questionnaire/items.d.ts +327 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
- package/dist/types/components/select/select.d.ts +51 -0
- package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
- package/dist/types/components/sheet/sheet.d.ts +294 -0
- package/dist/types/components/split-view/split-view.d.ts +2 -21
- package/dist/types/components/table/table.d.ts +223 -15
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/value-list/value-list.d.ts +24 -3
- package/dist/types/core/dom.d.ts +122 -0
- package/dist/types/core/drag-axis.d.ts +111 -0
- package/dist/types/core/position.d.ts +4 -2
- package/dist/types/index.d.ts +13 -2
- package/dist/types/internal/app-rail.d.ts +265 -0
- package/dist/types/zeyos/icons.d.ts +5 -0
- package/dist/types/zeyos/index.d.ts +2 -1
- package/dist/types/zeyos/launcher.d.ts +147 -0
- package/dist/types/zeyos/select.d.ts +39 -0
- package/dist/zx-zeyos.esm.js +1870 -133
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2006 -267
- package/dist/zx.esm.js +8987 -2757
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8987 -2757
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +4396 -2344
- package/docs/llms.md +463 -86
- package/docs/llms.txt +32 -19
- package/package.json +10 -17
- package/src/components/account-menu/account-menu.css +70 -0
- package/src/components/account-menu/account-menu.js +208 -0
- package/src/components/app-rail/app-rail.css +107 -0
- package/src/components/app-sidebar/app-sidebar.css +80 -0
- package/src/components/app-sidebar/app-sidebar.js +588 -0
- package/src/components/avatar/avatar.css +61 -0
- package/src/components/avatar/avatar.js +222 -0
- package/src/components/button/button.css +0 -1
- package/src/components/card/card.css +149 -0
- package/src/components/card/card.js +285 -0
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +523 -0
- package/src/components/date-picker/month-picker.js +9 -0
- package/src/components/dialog/dialog.js +11 -4
- package/src/components/dock/dock.css +228 -0
- package/src/components/dock/dock.js +977 -0
- package/src/components/dropdown/dropdown.js +1 -1
- package/src/components/field/field.js +2 -0
- package/src/components/field-upload/field-upload.js +9 -4
- package/src/components/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +220 -0
- package/src/components/launcher/launcher.css +210 -0
- package/src/components/launcher/launcher.js +765 -0
- package/src/components/layout/layout.js +2 -2
- package/src/components/menu-button/menu-button.js +27 -2
- package/src/components/modal/modal.css +5 -1
- package/src/components/modal/modal.js +37 -2
- package/src/components/multi-value-editor/multi-value-editor.js +2 -1
- package/src/components/questionnaire/items.js +370 -0
- package/src/components/questionnaire/questionnaire.css +387 -0
- package/src/components/questionnaire/questionnaire.js +1033 -0
- package/src/components/select/field-adapter.js +9 -4
- package/src/components/select/select.css +144 -11
- package/src/components/select/select.js +259 -27
- package/src/components/sheet/sheet-stack.js +304 -0
- package/src/components/sheet/sheet.css +351 -0
- package/src/components/sheet/sheet.js +551 -0
- package/src/components/split-view/split-view.js +76 -161
- package/src/components/table/table.css +43 -0
- package/src/components/table/table.js +531 -52
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +322 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +20 -2
- package/src/internal/app-rail.js +718 -0
- package/src/zeyos/icons.js +8 -3
- package/src/zeyos/index.js +7 -1
- package/src/zeyos/launcher.js +338 -0
- package/src/zeyos/modules.js +1 -0
- package/src/zeyos/select.js +115 -1
- package/styles/tokens/dark.css +2 -3
- package/styles/tokens/global.css +6 -6
- package/styles/tokens/modules.css +1 -0
- package/styles/tokens/semantic.css +5 -3
- package/styles/tokens/themes.css +1 -1
- package/styles/zx.css +11 -1
- package/MIGRATION.md +0 -598
- package/dist/types/compat/base.d.ts +0 -156
- package/dist/types/compat/globals.d.ts +0 -20
- package/dist/types/compat/index.d.ts +0 -128
- package/dist/types/compat/map/basic.d.ts +0 -175
- package/dist/types/compat/map/data.d.ts +0 -102
- package/dist/types/compat/map/date-time.d.ts +0 -80
- package/dist/types/compat/map/factory.d.ts +0 -9
- package/dist/types/compat/map/form.d.ts +0 -98
- package/dist/types/compat/map/helpers.d.ts +0 -12
- package/dist/types/compat/map/http.d.ts +0 -36
- package/dist/types/compat/map/layout.d.ts +0 -106
- package/dist/types/compat/map/options.d.ts +0 -80
- package/dist/types/compat/map/select.d.ts +0 -95
- package/dist/types/compat/map/stubs.d.ts +0 -32
- package/dist/types/compat/map/utilities.d.ts +0 -37
- package/dist/types/compat-entry.d.ts +0 -5
- package/dist/types/components/permission/permission.d.ts +0 -96
- package/dist/zx-compat.esm.js +0 -17484
- package/dist/zx-compat.esm.min.js +0 -1
- package/dist/zx-compat.global.js +0 -23635
- package/dist/zx-compat.global.min.js +0 -3
- package/src/compat/base.js +0 -291
- package/src/compat/globals.js +0 -165
- package/src/compat/index.js +0 -84
- package/src/compat/map/basic.js +0 -464
- package/src/compat/map/data.js +0 -232
- package/src/compat/map/date-time.js +0 -177
- package/src/compat/map/factory.js +0 -45
- package/src/compat/map/form.js +0 -330
- package/src/compat/map/helpers.js +0 -46
- package/src/compat/map/http.js +0 -117
- package/src/compat/map/layout.js +0 -256
- package/src/compat/map/options.js +0 -267
- package/src/compat/map/select.js +0 -198
- package/src/compat/map/stubs.js +0 -26
- package/src/compat/map/utilities.js +0 -113
- package/src/compat-entry.js +0 -11
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -201
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure questionnaire logic: normalization, visibility, branch resolution, validation, and
|
|
3
|
+
* progress. Nothing here touches the DOM, so the rules a branching questionnaire lives or dies by
|
|
4
|
+
* are testable in Node.
|
|
5
|
+
* @module questionnaire/items
|
|
6
|
+
*/
|
|
7
|
+
export type QuestionnaireChoice = {
|
|
8
|
+
/**
|
|
9
|
+
* Answer value, unique within its item.
|
|
10
|
+
*/
|
|
11
|
+
value: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* Visible answer text.
|
|
14
|
+
*/
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Supporting line under the label.
|
|
18
|
+
*/
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Icon name drawn before the label.
|
|
22
|
+
*/
|
|
23
|
+
icon?: string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Shortcut key. Assigned `1`–`9` then `a`–`z` when omitted.
|
|
26
|
+
*/
|
|
27
|
+
key?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the choice can be picked.
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether picking it clears every other choice of a
|
|
34
|
+
* `multiple` item — the "None of the above" behaviour.
|
|
35
|
+
*/
|
|
36
|
+
exclusive?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type QuestionnaireInput = {
|
|
39
|
+
/**
|
|
40
|
+
* Accessible name of the freeform control.
|
|
41
|
+
*/
|
|
42
|
+
label?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Placeholder text. Never a substitute for the label.
|
|
45
|
+
*/
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether to render a `textarea`.
|
|
49
|
+
*/
|
|
50
|
+
multiline?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Native maximum length, 0 for none.
|
|
53
|
+
*/
|
|
54
|
+
maxLength?: number;
|
|
55
|
+
};
|
|
56
|
+
export type QuestionnaireItem = {
|
|
57
|
+
/**
|
|
58
|
+
* Unique key. Doubles as the native input name.
|
|
59
|
+
*/
|
|
60
|
+
name: string;
|
|
61
|
+
/**
|
|
62
|
+
* The question. Rendered as the item's `<legend>`.
|
|
63
|
+
*/
|
|
64
|
+
prompt: string;
|
|
65
|
+
/**
|
|
66
|
+
* Supporting line, associated via `aria-describedby`.
|
|
67
|
+
*/
|
|
68
|
+
description?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Grouping label shown in the counter and the review list.
|
|
71
|
+
*/
|
|
72
|
+
section?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Whether an answer is needed to advance.
|
|
75
|
+
*/
|
|
76
|
+
required?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether several choices can be picked at once.
|
|
79
|
+
*/
|
|
80
|
+
multiple?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the Skip action is offered.
|
|
83
|
+
*/
|
|
84
|
+
skippable?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Fixed answers.
|
|
87
|
+
*/
|
|
88
|
+
choices?: QuestionnaireChoice[];
|
|
89
|
+
/**
|
|
90
|
+
* Freeform answer offered beside the choices.
|
|
91
|
+
*/
|
|
92
|
+
input?: QuestionnaireInput | null;
|
|
93
|
+
/**
|
|
94
|
+
* Any registered Zx `Field` type used as the answer control.
|
|
95
|
+
*/
|
|
96
|
+
field?: any | null;
|
|
97
|
+
/**
|
|
98
|
+
* Visibility predicate.
|
|
99
|
+
*/
|
|
100
|
+
when?: ((answers: Record<string, unknown>) => boolean) | null;
|
|
101
|
+
/**
|
|
102
|
+
* Branch target: an item name, or a function returning one.
|
|
103
|
+
*/
|
|
104
|
+
next?: string | ((answer: unknown, answers: Record<string, unknown>) => string | null) | null;
|
|
105
|
+
/**
|
|
106
|
+
* Extra validation returning an error message, or null when the answer is acceptable.
|
|
107
|
+
*/
|
|
108
|
+
validate?: ((answer: unknown, answers: Record<string, unknown>) => string | null | Promise<string | null>) | null;
|
|
109
|
+
};
|
|
110
|
+
export type NormalizedItem = {
|
|
111
|
+
/**
|
|
112
|
+
* Unique key.
|
|
113
|
+
*/
|
|
114
|
+
name: string;
|
|
115
|
+
/**
|
|
116
|
+
* The question.
|
|
117
|
+
*/
|
|
118
|
+
prompt: string;
|
|
119
|
+
/**
|
|
120
|
+
* Supporting line, or null.
|
|
121
|
+
*/
|
|
122
|
+
description: string | null;
|
|
123
|
+
/**
|
|
124
|
+
* Grouping label, empty when ungrouped.
|
|
125
|
+
*/
|
|
126
|
+
section: string;
|
|
127
|
+
/**
|
|
128
|
+
* Whether an answer is needed.
|
|
129
|
+
*/
|
|
130
|
+
required: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether several choices can be picked.
|
|
133
|
+
*/
|
|
134
|
+
multiple: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether Skip is offered.
|
|
137
|
+
*/
|
|
138
|
+
skippable: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Fixed answers with shortcut keys assigned.
|
|
141
|
+
*/
|
|
142
|
+
choices: NormalizedChoice[];
|
|
143
|
+
/**
|
|
144
|
+
* Freeform answer, or null.
|
|
145
|
+
*/
|
|
146
|
+
input: Required<QuestionnaireInput> | null;
|
|
147
|
+
/**
|
|
148
|
+
* Field options, or null.
|
|
149
|
+
*/
|
|
150
|
+
field: any | null;
|
|
151
|
+
/**
|
|
152
|
+
* Visibility predicate.
|
|
153
|
+
*/
|
|
154
|
+
when: ((answers: Record<string, unknown>) => boolean) | null;
|
|
155
|
+
/**
|
|
156
|
+
* Branch target.
|
|
157
|
+
*/
|
|
158
|
+
next: string | ((answer: unknown, answers: Record<string, unknown>) => string | null) | null;
|
|
159
|
+
/**
|
|
160
|
+
* Extra validation.
|
|
161
|
+
*/
|
|
162
|
+
validate: ((answer: unknown, answers: Record<string, unknown>) => string | null | Promise<string | null>) | null;
|
|
163
|
+
};
|
|
164
|
+
export type NormalizedChoice = {
|
|
165
|
+
/**
|
|
166
|
+
* Answer value.
|
|
167
|
+
*/
|
|
168
|
+
value: string | number;
|
|
169
|
+
/**
|
|
170
|
+
* Visible answer text.
|
|
171
|
+
*/
|
|
172
|
+
label: string;
|
|
173
|
+
/**
|
|
174
|
+
* Supporting line, or null.
|
|
175
|
+
*/
|
|
176
|
+
description: string | null;
|
|
177
|
+
/**
|
|
178
|
+
* Icon name, or null.
|
|
179
|
+
*/
|
|
180
|
+
icon: string | null;
|
|
181
|
+
/**
|
|
182
|
+
* Shortcut key, a single lowercase character, or empty when the item has
|
|
183
|
+
* more choices than there are keys to hand out.
|
|
184
|
+
*/
|
|
185
|
+
key: string;
|
|
186
|
+
/**
|
|
187
|
+
* Whether the choice can be picked.
|
|
188
|
+
*/
|
|
189
|
+
disabled: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Whether picking it clears the other choices.
|
|
192
|
+
*/
|
|
193
|
+
exclusive: boolean;
|
|
194
|
+
};
|
|
195
|
+
export type ResolvedFlow = {
|
|
196
|
+
/**
|
|
197
|
+
* Answers of visible items only, in declaration order.
|
|
198
|
+
*/
|
|
199
|
+
answers: Record<string, unknown>;
|
|
200
|
+
/**
|
|
201
|
+
* Items whose conditions currently pass.
|
|
202
|
+
*/
|
|
203
|
+
visible: NormalizedItem[];
|
|
204
|
+
};
|
|
205
|
+
export type QuestionnaireProgress = {
|
|
206
|
+
/**
|
|
207
|
+
* Zero-based position of the active item along the path walked so far.
|
|
208
|
+
*/
|
|
209
|
+
index: number;
|
|
210
|
+
/**
|
|
211
|
+
* How many items on the path carry an answer.
|
|
212
|
+
*/
|
|
213
|
+
answered: number;
|
|
214
|
+
/**
|
|
215
|
+
* Path length plus the items still reachable. An estimate whenever a
|
|
216
|
+
* function `next` is involved, since a dynamic jump is unknowable before the answer exists.
|
|
217
|
+
*/
|
|
218
|
+
total: number;
|
|
219
|
+
/**
|
|
220
|
+
* Completion share of `total`, 0–100.
|
|
221
|
+
*/
|
|
222
|
+
percent: number;
|
|
223
|
+
/**
|
|
224
|
+
* Section of the active item, empty when ungrouped.
|
|
225
|
+
*/
|
|
226
|
+
section: string;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Normalizes and validates a list of item definitions. Never mutates its input.
|
|
230
|
+
* @param {QuestionnaireItem[]} list Item definitions.
|
|
231
|
+
* @returns {NormalizedItem[]}
|
|
232
|
+
* @throws {TypeError} When the list, an item, or a name is malformed, or a name repeats.
|
|
233
|
+
*/
|
|
234
|
+
export declare function normalizeItems(list: QuestionnaireItem[]): NormalizedItem[];
|
|
235
|
+
/**
|
|
236
|
+
* Normalizes an item's choices and hands out the shortcut keys. Explicit keys are reserved before
|
|
237
|
+
* any are assigned, so adding one to the third choice never renumbers the others.
|
|
238
|
+
* @param {QuestionnaireChoice[]} list Choice definitions.
|
|
239
|
+
* @param {string} [itemName=''] Owning item name, used in error messages.
|
|
240
|
+
* @returns {NormalizedChoice[]}
|
|
241
|
+
* @throws {TypeError} When the list or a choice is malformed, or a value repeats.
|
|
242
|
+
*/
|
|
243
|
+
export declare function normalizeChoices(list: QuestionnaireChoice[], itemName?: string): NormalizedChoice[];
|
|
244
|
+
/**
|
|
245
|
+
* Reports whether an item's `when` predicate passes for a given set of answers. An item without
|
|
246
|
+
* one is always visible, and a predicate that throws hides nothing — a broken condition must not
|
|
247
|
+
* strand the reader mid-questionnaire.
|
|
248
|
+
* @param {NormalizedItem} item Item to test.
|
|
249
|
+
* @param {Record<string, unknown>} answers Answers visible to the predicate.
|
|
250
|
+
* @returns {boolean}
|
|
251
|
+
*/
|
|
252
|
+
export declare function isVisible(item: NormalizedItem, answers: Record<string, unknown>): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Resolves visibility and the effective answers in one forward pass.
|
|
255
|
+
*
|
|
256
|
+
* Conditions have to cascade: if "VAT id" is conditioned out because the customer turned out to be
|
|
257
|
+
* a private buyer, a question conditioned on the VAT id must disappear with it. Walking the items
|
|
258
|
+
* in declaration order and letting each predicate see only the answers of *visible* items before
|
|
259
|
+
* it gives exactly that, and terminates — a predicate can never depend on its own visibility.
|
|
260
|
+
*
|
|
261
|
+
* The raw store keeps answers to conditioned-out items, so walking back into a branch restores
|
|
262
|
+
* what was typed there; they are simply not part of the resolved answers.
|
|
263
|
+
* @param {NormalizedItem[]} items All items.
|
|
264
|
+
* @param {Record<string, unknown>} raw Every answer given, including hidden ones.
|
|
265
|
+
* @returns {ResolvedFlow}
|
|
266
|
+
*/
|
|
267
|
+
export declare function resolveFlow(items: NormalizedItem[], raw: Record<string, unknown>): ResolvedFlow;
|
|
268
|
+
/**
|
|
269
|
+
* Returns the items whose conditions currently pass, in declaration order.
|
|
270
|
+
* @param {NormalizedItem[]} items All items.
|
|
271
|
+
* @param {Record<string, unknown>} raw Every answer given.
|
|
272
|
+
* @returns {NormalizedItem[]}
|
|
273
|
+
*/
|
|
274
|
+
export declare function visibleItems(items: NormalizedItem[], raw: Record<string, unknown>): NormalizedItem[];
|
|
275
|
+
/**
|
|
276
|
+
* Resolves which item follows the given one.
|
|
277
|
+
*
|
|
278
|
+
* A `next` of `null` falls through to the next visible item in declaration order. A string, or a
|
|
279
|
+
* function returning a string, names a target: when that target is currently hidden the walk
|
|
280
|
+
* continues forward from it rather than stranding the reader on an invisible question.
|
|
281
|
+
* @param {NormalizedItem[]} items All items.
|
|
282
|
+
* @param {NormalizedItem} item Item being left.
|
|
283
|
+
* @param {Record<string, unknown>} raw Every answer given.
|
|
284
|
+
* @returns {string|null} Name of the next item, or null at the end of the questionnaire.
|
|
285
|
+
* @throws {RangeError} When `next` names an item that does not exist.
|
|
286
|
+
*/
|
|
287
|
+
export declare function resolveNext(items: NormalizedItem[], item: NormalizedItem, raw: Record<string, unknown>): string | null;
|
|
288
|
+
/**
|
|
289
|
+
* Reports whether an answer counts as absent. An empty string, an empty array, null, and undefined
|
|
290
|
+
* are all "no answer"; `false` and `0` are answers.
|
|
291
|
+
* @param {unknown} value Answer value.
|
|
292
|
+
* @returns {boolean}
|
|
293
|
+
*/
|
|
294
|
+
export declare function isEmptyAnswer(value: unknown): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Runs the synchronous part of validation: the required check. An item's own `validate` may be
|
|
297
|
+
* asynchronous and is awaited by the component instead.
|
|
298
|
+
* @param {NormalizedItem} item Item to check.
|
|
299
|
+
* @param {unknown} answer Current answer.
|
|
300
|
+
* @param {(key: string) => string} message Message resolver, called with a message key.
|
|
301
|
+
* @returns {string|null} Error message, or null when the answer passes.
|
|
302
|
+
*/
|
|
303
|
+
export declare function validateAnswer(item: NormalizedItem, answer: unknown, message: (key: string) => string): string | null;
|
|
304
|
+
/**
|
|
305
|
+
* Applies "None of the above" exclusivity to a multiple-choice selection.
|
|
306
|
+
*
|
|
307
|
+
* Picking an exclusive choice drops everything else; picking anything else drops the exclusive
|
|
308
|
+
* ones. The result is returned in choice order, so the answer never depends on click order.
|
|
309
|
+
* @param {NormalizedChoice[]} choices The item's choices.
|
|
310
|
+
* @param {Array<string|number>} selected Values currently selected.
|
|
311
|
+
* @param {string|number|null} [toggled=null] Value the reader just switched on.
|
|
312
|
+
* @returns {Array<string|number>}
|
|
313
|
+
*/
|
|
314
|
+
export declare function applyExclusive(choices: NormalizedChoice[], selected: Array<string | number>, toggled?: string | number | null): Array<string | number>;
|
|
315
|
+
/**
|
|
316
|
+
* Computes progress along the path actually walked.
|
|
317
|
+
*
|
|
318
|
+
* The index is the position within `path`, not within `items`: once a branch has been taken, the
|
|
319
|
+
* declaration index says nothing about how far the reader has come. `total` adds the items still
|
|
320
|
+
* reachable under the current answers, which is exact for static flows and an estimate as soon as
|
|
321
|
+
* a function `next` can jump somewhere the walk cannot predict.
|
|
322
|
+
* @param {NormalizedItem[]} items All items.
|
|
323
|
+
* @param {Record<string, unknown>} raw Every answer given.
|
|
324
|
+
* @param {string[]} path Item names visited so far, active item last.
|
|
325
|
+
* @returns {QuestionnaireProgress}
|
|
326
|
+
*/
|
|
327
|
+
export declare function progressOf(items: NormalizedItem[], raw: Record<string, unknown>, path: string[]): QuestionnaireProgress;
|