@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.
Files changed (150) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/DESIGN-SYSTEM.md +96 -0
  3. package/README.md +29 -39
  4. package/dist/types/components/account-menu/account-menu.d.ts +144 -0
  5. package/dist/types/components/app-sidebar/app-sidebar.d.ts +243 -0
  6. package/dist/types/components/avatar/avatar.d.ts +100 -0
  7. package/dist/types/components/card/card.d.ts +128 -0
  8. package/dist/types/components/chart/chart.d.ts +322 -0
  9. package/dist/types/components/date-picker/month-picker.d.ts +6 -0
  10. package/dist/types/components/dialog/dialog.d.ts +9 -0
  11. package/dist/types/components/dock/dock.d.ts +495 -0
  12. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  13. package/dist/types/components/field/field.d.ts +14 -0
  14. package/dist/types/components/field-upload/field-upload.d.ts +37 -4
  15. package/dist/types/components/form/form.d.ts +25 -3
  16. package/dist/types/components/grid/grid.d.ts +172 -0
  17. package/dist/types/components/launcher/launcher.d.ts +359 -0
  18. package/dist/types/components/layout/layout.d.ts +4 -4
  19. package/dist/types/components/menu-button/menu-button.d.ts +10 -2
  20. package/dist/types/components/modal/modal.d.ts +25 -0
  21. package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +7 -1
  22. package/dist/types/components/questionnaire/items.d.ts +327 -0
  23. package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
  24. package/dist/types/components/select/select.d.ts +51 -0
  25. package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
  26. package/dist/types/components/sheet/sheet.d.ts +294 -0
  27. package/dist/types/components/split-view/split-view.d.ts +2 -21
  28. package/dist/types/components/table/table.d.ts +223 -15
  29. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  30. package/dist/types/components/value-list/value-list.d.ts +24 -3
  31. package/dist/types/core/dom.d.ts +122 -0
  32. package/dist/types/core/drag-axis.d.ts +111 -0
  33. package/dist/types/core/position.d.ts +4 -2
  34. package/dist/types/index.d.ts +13 -2
  35. package/dist/types/internal/app-rail.d.ts +265 -0
  36. package/dist/types/zeyos/icons.d.ts +5 -0
  37. package/dist/types/zeyos/index.d.ts +2 -1
  38. package/dist/types/zeyos/launcher.d.ts +147 -0
  39. package/dist/types/zeyos/select.d.ts +39 -0
  40. package/dist/zx-zeyos.esm.js +1870 -133
  41. package/dist/zx-zeyos.esm.min.js +1 -1
  42. package/dist/zx.css +2006 -267
  43. package/dist/zx.esm.js +8987 -2757
  44. package/dist/zx.esm.min.js +3 -3
  45. package/dist/zx.global.js +8987 -2757
  46. package/dist/zx.global.min.js +3 -3
  47. package/dist/zx.min.css +1 -1
  48. package/docs/api.json +4396 -2344
  49. package/docs/llms.md +463 -86
  50. package/docs/llms.txt +32 -19
  51. package/package.json +10 -17
  52. package/src/components/account-menu/account-menu.css +70 -0
  53. package/src/components/account-menu/account-menu.js +208 -0
  54. package/src/components/app-rail/app-rail.css +107 -0
  55. package/src/components/app-sidebar/app-sidebar.css +80 -0
  56. package/src/components/app-sidebar/app-sidebar.js +588 -0
  57. package/src/components/avatar/avatar.css +61 -0
  58. package/src/components/avatar/avatar.js +222 -0
  59. package/src/components/button/button.css +0 -1
  60. package/src/components/card/card.css +149 -0
  61. package/src/components/card/card.js +285 -0
  62. package/src/components/chart/chart.css +61 -0
  63. package/src/components/chart/chart.js +523 -0
  64. package/src/components/date-picker/month-picker.js +9 -0
  65. package/src/components/dialog/dialog.js +11 -4
  66. package/src/components/dock/dock.css +228 -0
  67. package/src/components/dock/dock.js +977 -0
  68. package/src/components/dropdown/dropdown.js +1 -1
  69. package/src/components/field/field.js +2 -0
  70. package/src/components/field-upload/field-upload.js +9 -4
  71. package/src/components/form/form.js +6 -3
  72. package/src/components/grid/grid.css +6 -0
  73. package/src/components/grid/grid.js +220 -0
  74. package/src/components/launcher/launcher.css +210 -0
  75. package/src/components/launcher/launcher.js +765 -0
  76. package/src/components/layout/layout.js +2 -2
  77. package/src/components/menu-button/menu-button.js +27 -2
  78. package/src/components/modal/modal.css +5 -1
  79. package/src/components/modal/modal.js +37 -2
  80. package/src/components/multi-value-editor/multi-value-editor.js +2 -1
  81. package/src/components/questionnaire/items.js +370 -0
  82. package/src/components/questionnaire/questionnaire.css +387 -0
  83. package/src/components/questionnaire/questionnaire.js +1033 -0
  84. package/src/components/select/field-adapter.js +9 -4
  85. package/src/components/select/select.css +144 -11
  86. package/src/components/select/select.js +259 -27
  87. package/src/components/sheet/sheet-stack.js +304 -0
  88. package/src/components/sheet/sheet.css +351 -0
  89. package/src/components/sheet/sheet.js +551 -0
  90. package/src/components/split-view/split-view.js +76 -161
  91. package/src/components/table/table.css +43 -0
  92. package/src/components/table/table.js +531 -52
  93. package/src/components/tooltip/tooltip.js +5 -2
  94. package/src/components/value-list/value-list.js +6 -3
  95. package/src/core/dom.js +322 -0
  96. package/src/core/drag-axis.js +203 -0
  97. package/src/core/position.js +68 -22
  98. package/src/index.js +20 -2
  99. package/src/internal/app-rail.js +718 -0
  100. package/src/zeyos/icons.js +8 -3
  101. package/src/zeyos/index.js +7 -1
  102. package/src/zeyos/launcher.js +338 -0
  103. package/src/zeyos/modules.js +1 -0
  104. package/src/zeyos/select.js +115 -1
  105. package/styles/tokens/dark.css +2 -3
  106. package/styles/tokens/global.css +6 -6
  107. package/styles/tokens/modules.css +1 -0
  108. package/styles/tokens/semantic.css +5 -3
  109. package/styles/tokens/themes.css +1 -1
  110. package/styles/zx.css +11 -1
  111. package/MIGRATION.md +0 -598
  112. package/dist/types/compat/base.d.ts +0 -156
  113. package/dist/types/compat/globals.d.ts +0 -20
  114. package/dist/types/compat/index.d.ts +0 -128
  115. package/dist/types/compat/map/basic.d.ts +0 -175
  116. package/dist/types/compat/map/data.d.ts +0 -102
  117. package/dist/types/compat/map/date-time.d.ts +0 -80
  118. package/dist/types/compat/map/factory.d.ts +0 -9
  119. package/dist/types/compat/map/form.d.ts +0 -98
  120. package/dist/types/compat/map/helpers.d.ts +0 -12
  121. package/dist/types/compat/map/http.d.ts +0 -36
  122. package/dist/types/compat/map/layout.d.ts +0 -106
  123. package/dist/types/compat/map/options.d.ts +0 -80
  124. package/dist/types/compat/map/select.d.ts +0 -95
  125. package/dist/types/compat/map/stubs.d.ts +0 -32
  126. package/dist/types/compat/map/utilities.d.ts +0 -37
  127. package/dist/types/compat-entry.d.ts +0 -5
  128. package/dist/types/components/permission/permission.d.ts +0 -96
  129. package/dist/zx-compat.esm.js +0 -17484
  130. package/dist/zx-compat.esm.min.js +0 -1
  131. package/dist/zx-compat.global.js +0 -23635
  132. package/dist/zx-compat.global.min.js +0 -3
  133. package/src/compat/base.js +0 -291
  134. package/src/compat/globals.js +0 -165
  135. package/src/compat/index.js +0 -84
  136. package/src/compat/map/basic.js +0 -464
  137. package/src/compat/map/data.js +0 -232
  138. package/src/compat/map/date-time.js +0 -177
  139. package/src/compat/map/factory.js +0 -45
  140. package/src/compat/map/form.js +0 -330
  141. package/src/compat/map/helpers.js +0 -46
  142. package/src/compat/map/http.js +0 -117
  143. package/src/compat/map/layout.js +0 -256
  144. package/src/compat/map/options.js +0 -267
  145. package/src/compat/map/select.js +0 -198
  146. package/src/compat/map/stubs.js +0 -26
  147. package/src/compat/map/utilities.js +0 -113
  148. package/src/compat-entry.js +0 -11
  149. package/src/components/permission/permission.css +0 -47
  150. package/src/components/permission/permission.js +0 -201
@@ -0,0 +1,449 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { Field } from '../field/field.js';
3
+ import { ProgressBar } from '../loading/progress-bar.js';
4
+ export type QuestionnaireItem = import('./items.js').QuestionnaireItem;
5
+ export type QuestionnaireChoice = import('./items.js').QuestionnaireChoice;
6
+ export type NormalizedItem = import('./items.js').NormalizedItem;
7
+ export type QuestionnaireProgress = import('./items.js').QuestionnaireProgress;
8
+ export type QuestionnaireAdvance = 'manual' | 'auto';
9
+ export type QuestionnaireStatus = 'asking' | 'review' | 'complete';
10
+ export type QuestionnaireOptions = {
11
+ /**
12
+ * Ordered question definitions.
13
+ */
14
+ items?: QuestionnaireItem[];
15
+ /**
16
+ * Answers to start from. Together with `active`
17
+ * this is the resume pair: hand back what a previous session collected.
18
+ */
19
+ answers?: Record<string, unknown>;
20
+ /**
21
+ * Item to open, defaulting to the first visible one.
22
+ */
23
+ active?: string | null;
24
+ /**
25
+ * Whether the progress bar and counter are shown.
26
+ */
27
+ progress?: boolean;
28
+ /**
29
+ * Whether a summary of every answer is shown before submitting.
30
+ */
31
+ review?: boolean;
32
+ /**
33
+ * `auto` moves on by itself once a
34
+ * single-choice question is answered.
35
+ */
36
+ advance?: QuestionnaireAdvance;
37
+ /**
38
+ * Whether `1`–`9` and `a`–`z` pick an answer.
39
+ */
40
+ shortcuts?: boolean;
41
+ /**
42
+ * Whether the Back action is offered.
43
+ */
44
+ allowBack?: boolean;
45
+ /**
46
+ * Localized messages.
47
+ */
48
+ msg?: Record<string, string> | Record<string, Record<string, string>>;
49
+ /**
50
+ * Answer listener.
51
+ */
52
+ onchange?: (event: CustomEvent<QuestionnaireChangeDetail>) => void;
53
+ /**
54
+ * Navigation listener.
55
+ */
56
+ onnavigate?: (event: CustomEvent<QuestionnaireNavigateDetail>) => void;
57
+ /**
58
+ * Skip listener.
59
+ */
60
+ onskip?: (event: CustomEvent<QuestionnaireSkipDetail>) => void;
61
+ /**
62
+ * Validation listener.
63
+ */
64
+ oninvalid?: (event: CustomEvent<QuestionnaireInvalidDetail>) => void;
65
+ /**
66
+ * Submit listener.
67
+ */
68
+ onsubmit?: (event: CustomEvent<QuestionnaireSubmitDetail>) => void;
69
+ /**
70
+ * Completion listener.
71
+ */
72
+ oncomplete?: (event: CustomEvent<QuestionnaireCompleteDetail>) => void;
73
+ };
74
+ export type QuestionnaireChangeDetail = {
75
+ /**
76
+ * Item whose answer changed.
77
+ */
78
+ name: string;
79
+ /**
80
+ * The new answer.
81
+ */
82
+ value: unknown;
83
+ /**
84
+ * Every visible answer after the change.
85
+ */
86
+ answers: Record<string, unknown>;
87
+ };
88
+ export type QuestionnaireNavigateDetail = {
89
+ /**
90
+ * Item being left, or null.
91
+ */
92
+ from: string | null;
93
+ /**
94
+ * Item being opened, or null when the review screen is being entered.
95
+ */
96
+ to: string | null;
97
+ /**
98
+ * What triggered the move.
99
+ */
100
+ reason: 'next' | 'previous' | 'skip' | 'goto' | 'review';
101
+ };
102
+ export type QuestionnaireSkipDetail = {
103
+ name: string;
104
+ };
105
+ export type QuestionnaireInvalidDetail = {
106
+ name: string;
107
+ message: string;
108
+ };
109
+ export type QuestionnaireSubmitDetail = {
110
+ answers: Record<string, unknown>;
111
+ path: string[];
112
+ };
113
+ export type QuestionnaireCompleteDetail = {
114
+ answers: Record<string, unknown>;
115
+ path: string[];
116
+ };
117
+ /**
118
+ * @typedef {Object} QuestionnaireOptions
119
+ * @property {QuestionnaireItem[]} [items=[]] Ordered question definitions.
120
+ * @property {Record<string, unknown>} [answers={}] Answers to start from. Together with `active`
121
+ * this is the resume pair: hand back what a previous session collected.
122
+ * @property {string|null} [active=null] Item to open, defaulting to the first visible one.
123
+ * @property {boolean} [progress=true] Whether the progress bar and counter are shown.
124
+ * @property {boolean} [review=false] Whether a summary of every answer is shown before submitting.
125
+ * @property {QuestionnaireAdvance} [advance='manual'] `auto` moves on by itself once a
126
+ * single-choice question is answered.
127
+ * @property {boolean} [shortcuts=true] Whether `1`–`9` and `a`–`z` pick an answer.
128
+ * @property {boolean} [allowBack=true] Whether the Back action is offered.
129
+ * @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
130
+ * @property {(event: CustomEvent<QuestionnaireChangeDetail>) => void} [onchange] Answer listener.
131
+ * @property {(event: CustomEvent<QuestionnaireNavigateDetail>) => void} [onnavigate] Navigation listener.
132
+ * @property {(event: CustomEvent<QuestionnaireSkipDetail>) => void} [onskip] Skip listener.
133
+ * @property {(event: CustomEvent<QuestionnaireInvalidDetail>) => void} [oninvalid] Validation listener.
134
+ * @property {(event: CustomEvent<QuestionnaireSubmitDetail>) => void} [onsubmit] Submit listener.
135
+ * @property {(event: CustomEvent<QuestionnaireCompleteDetail>) => void} [oncomplete] Completion listener.
136
+ */
137
+ /**
138
+ * @typedef {Object} QuestionnaireChangeDetail
139
+ * @property {string} name Item whose answer changed.
140
+ * @property {unknown} value The new answer.
141
+ * @property {Record<string, unknown>} answers Every visible answer after the change.
142
+ */
143
+ /**
144
+ * @typedef {Object} QuestionnaireNavigateDetail
145
+ * @property {string|null} from Item being left, or null.
146
+ * @property {string|null} to Item being opened, or null when the review screen is being entered.
147
+ * @property {'next'|'previous'|'skip'|'goto'|'review'} reason What triggered the move.
148
+ */
149
+ /** @typedef {{name: string}} QuestionnaireSkipDetail */
150
+ /** @typedef {{name: string, message: string}} QuestionnaireInvalidDetail */
151
+ /** @typedef {{answers: Record<string, unknown>, path: string[]}} QuestionnaireSubmitDetail */
152
+ /** @typedef {{answers: Record<string, unknown>, path: string[]}} QuestionnaireCompleteDetail */
153
+ /**
154
+ * A guided, one-question-at-a-time flow: onboarding intake, a service-call checklist, an audit
155
+ * form, a feedback survey. The questionnaire owns the ordered items, the active one, the answers,
156
+ * validation, progress and navigation; the page, card, dialog or drawer around it owns closing,
157
+ * persistence and transport.
158
+ *
159
+ * Three things separate it from a `Form` with one `Fieldset` per question. It **branches**: an item
160
+ * carries a `when` predicate and a `next` target, conditions cascade, and Back retraces the path
161
+ * actually walked rather than an array index. Its answer control is **any registered Zx `Field`
162
+ * type**, so a question can ask for a date, a number, a rating or an upload instead of a choice.
163
+ * And its `validate` may be asynchronous, which is what lets a question be gated on a server check.
164
+ *
165
+ * The root is a real `<form>` and choices are native radios and checkboxes carrying the item name,
166
+ * so `new FormData(questionnaire.toElement())` reads the answers, arrow-key navigation inside a
167
+ * choice group is the browser's rather than ours, and nothing depends on JavaScript for semantics.
168
+ *
169
+ * @fires Questionnaire#change
170
+ * @fires Questionnaire#navigate
171
+ * @fires Questionnaire#skip
172
+ * @fires Questionnaire#invalid
173
+ * @fires Questionnaire#submit
174
+ * @fires Questionnaire#complete
175
+ * @extends {Component<QuestionnaireOptions>}
176
+ */
177
+ export declare class Questionnaire extends Component<QuestionnaireOptions> {
178
+ _createdRoot: boolean;
179
+ _snapshot: import("../../core/dom.js").TargetSnapshot;
180
+ _destroyed: boolean;
181
+ /** @type {NormalizedItem[]} */
182
+ _items: NormalizedItem[];
183
+ /** @type {Map<string, Array<string|number>>} */
184
+ _selected: Map<string, Array<string | number>>;
185
+ /** @type {Map<string, string>} */
186
+ _freeform: Map<string, string>;
187
+ /** @type {Map<string, Field>} */
188
+ _fields: Map<string, Field>;
189
+ /** @type {string[]} */
190
+ _path: string[];
191
+ /** @type {QuestionnaireStatus} */
192
+ _status: QuestionnaireStatus;
193
+ _returnToReview: any;
194
+ _busy: boolean;
195
+ _error: string;
196
+ _advanceTimer: number;
197
+ _uid: string;
198
+ _form: HTMLElement;
199
+ _progressHost: HTMLElement;
200
+ _itemHost: HTMLElement;
201
+ _reviewHost: HTMLElement;
202
+ _actionsHost: HTMLElement;
203
+ _bar: ProgressBar;
204
+ _back: HTMLButtonElement;
205
+ _skip: HTMLButtonElement;
206
+ _forward: HTMLButtonElement;
207
+ static cssName: string;
208
+ /** @type {QuestionnaireOptions & {msg: Record<string, string>}} */
209
+ static defaults: QuestionnaireOptions & {
210
+ msg: Record<string, string>;
211
+ };
212
+ /**
213
+ * Builds the questionnaire. Runs inside the base constructor, so every piece of instance state
214
+ * is initialized here rather than in class fields.
215
+ * @returns {HTMLElement}
216
+ */
217
+ render(): HTMLElement;
218
+ /**
219
+ * Replaces the whole item list. Answers survive for items that are still present, and so does
220
+ * the active item; when it is gone the first visible item takes over. This is a structural
221
+ * change, so it never emits `navigate`.
222
+ * @param {QuestionnaireItem[]} list Item definitions.
223
+ * @returns {this}
224
+ * @throws {TypeError} When the list, an item, or a name is malformed, or a name repeats.
225
+ */
226
+ setItems(list: QuestionnaireItem[]): this;
227
+ /**
228
+ * Returns the normalized items, including ones currently conditioned out.
229
+ * @returns {NormalizedItem[]}
230
+ */
231
+ getItems(): NormalizedItem[];
232
+ /**
233
+ * Opens an item without validating the one being left — what the review screen's Edit action
234
+ * does. An item already on the path truncates it, so Back keeps working; a new one is appended.
235
+ * @param {string} name Item name.
236
+ * @returns {boolean} False when the move was vetoed or the item is conditioned out.
237
+ * @throws {RangeError} When no item carries that name.
238
+ * @fires Questionnaire#navigate
239
+ */
240
+ goTo(name: string): boolean;
241
+ /**
242
+ * Validates the active item and moves on: to the branch target, then the review screen, then
243
+ * submission. Returns a promise because an item's `validate` may be asynchronous.
244
+ * @returns {Promise<boolean>} False when validation failed or the move was vetoed.
245
+ * @fires Questionnaire#navigate
246
+ * @fires Questionnaire#invalid
247
+ */
248
+ next(): Promise<boolean>;
249
+ /**
250
+ * Steps back along the path actually walked — which is not `index - 1` once a branch has been
251
+ * taken. From the review screen it reopens the last question.
252
+ * @returns {boolean} False at the start of the questionnaire, or when the move was vetoed.
253
+ * @fires Questionnaire#navigate
254
+ */
255
+ previous(): boolean;
256
+ /**
257
+ * Clears the active item's answer and moves on without validating it. Skipping the last
258
+ * question submits, so this is a promise for the same reason `submit()` is.
259
+ * @returns {Promise<boolean>} False when the item is not skippable or the move was vetoed.
260
+ * @fires Questionnaire#skip
261
+ * @fires Questionnaire#navigate
262
+ */
263
+ skip(): Promise<boolean>;
264
+ /**
265
+ * Validates the active item (unless already on the review screen) and submits.
266
+ * @returns {Promise<boolean>} False when validation failed or `submit` was prevented.
267
+ * @fires Questionnaire#submit
268
+ * @fires Questionnaire#complete
269
+ */
270
+ submit(): Promise<boolean>;
271
+ /**
272
+ * Returns the answers of every visible question that carries one, in declaration order.
273
+ * Questions conditioned out are left out, so an abandoned branch never submits stale data.
274
+ * @returns {Record<string, unknown>}
275
+ */
276
+ getAnswers(): Record<string, unknown>;
277
+ /**
278
+ * Returns one answer, whether or not its question is currently visible.
279
+ * @param {string} name Item name.
280
+ * @returns {unknown}
281
+ */
282
+ getAnswer(name: string): unknown;
283
+ /**
284
+ * Sets several answers at once.
285
+ * @param {Record<string, unknown>} values Answers keyed by item name.
286
+ * @param {{silent?: boolean}} [options={}] Set `silent` to suppress `change`.
287
+ * @returns {this}
288
+ * @fires Questionnaire#change
289
+ */
290
+ setAnswers(values: Record<string, unknown>, { silent }?: {
291
+ silent?: boolean;
292
+ }): this;
293
+ /**
294
+ * Sets one answer. A value matching a choice selects it; anything else lands in the freeform
295
+ * input when the item has one.
296
+ * @param {string} name Item name.
297
+ * @param {unknown} value New answer, or null to clear it.
298
+ * @param {{silent?: boolean}} [options={}] Set `silent` to suppress `change`.
299
+ * @returns {this}
300
+ * @throws {RangeError} When no item carries that name.
301
+ * @fires Questionnaire#change
302
+ */
303
+ setAnswer(name: string, value: unknown, { silent }?: {
304
+ silent?: boolean;
305
+ }): this;
306
+ /**
307
+ * Returns the active item name, or null on the review or completion screen.
308
+ * @returns {string|null}
309
+ */
310
+ getActive(): string | null;
311
+ /**
312
+ * Returns the item names visited so far, active last. This is the questionnaire's memory of the
313
+ * route through the branches.
314
+ * @returns {string[]}
315
+ */
316
+ getPath(): string[];
317
+ /**
318
+ * Returns progress along the path walked. `total` is exact while the flow is static and an
319
+ * estimate once a function `next` can jump somewhere the forward walk cannot predict.
320
+ * @returns {QuestionnaireProgress}
321
+ */
322
+ getProgress(): QuestionnaireProgress;
323
+ /**
324
+ * Returns everything a caller needs to resume this questionnaire later.
325
+ * @returns {{active: string|null, status: QuestionnaireStatus, answers: Record<string, unknown>, path: string[], progress: QuestionnaireProgress}}
326
+ */
327
+ getState(): {
328
+ active: string | null;
329
+ status: QuestionnaireStatus;
330
+ answers: Record<string, unknown>;
331
+ path: string[];
332
+ progress: QuestionnaireProgress;
333
+ };
334
+ /**
335
+ * Returns the visible answers as form data, with one entry per value of a multiple-choice item —
336
+ * the same shape `new FormData(questionnaire.toElement())` produces.
337
+ * @returns {FormData}
338
+ */
339
+ toFormData(): FormData;
340
+ /**
341
+ * Clears every answer and returns to the first visible question.
342
+ * @returns {this}
343
+ */
344
+ reset(): this;
345
+ /**
346
+ * Moves focus to the active question, which is what a screen reader announces after a move.
347
+ * @returns {this}
348
+ */
349
+ focus(): this;
350
+ /** @returns {void} */
351
+ destroy(): void;
352
+ /** @returns {NormalizedItem|null} */
353
+ _activeItem(): NormalizedItem | null;
354
+ /**
355
+ * Every answer given, including ones on branches that are currently conditioned out — walking
356
+ * back into a branch restores what was typed there. `resolveFlow()` filters this down.
357
+ * @returns {Record<string, unknown>}
358
+ */
359
+ _rawAnswers(): Record<string, unknown>;
360
+ /** @param {NormalizedItem} item @returns {unknown} */
361
+ _answerOf(item: NormalizedItem): unknown;
362
+ /**
363
+ * Returns the item's Field, building it on first use. Fields are cached rather than rebuilt per
364
+ * paint, so what a reader typed survives walking away from the question and back.
365
+ * @param {NormalizedItem} item Item carrying `field` options.
366
+ * @returns {Field}
367
+ */
368
+ _field(item: NormalizedItem): Field;
369
+ /** @param {string} name @param {QuestionnaireNavigateDetail['reason']} reason @returns {boolean} */
370
+ _navigate(name: string, reason: QuestionnaireNavigateDetail['reason']): boolean;
371
+ /** @returns {boolean} */
372
+ _enterReview(): boolean;
373
+ /** @returns {Promise<boolean>} */
374
+ _validateActive(): Promise<boolean>;
375
+ /** @param {boolean} busy @returns {void} */
376
+ _setBusy(busy: boolean): void;
377
+ /** @returns {void} */
378
+ _paint(): void;
379
+ /** @returns {void} */
380
+ _syncState(): void;
381
+ /** @returns {void} */
382
+ _paintProgress(): void;
383
+ /** @returns {void} */
384
+ _paintItem(): void;
385
+ /** @param {NormalizedItem} item @returns {HTMLElement} */
386
+ _choices(item: NormalizedItem): HTMLElement;
387
+ /** @param {NormalizedItem} item @returns {void} */
388
+ _paintError(item: NormalizedItem): void;
389
+ /** @returns {void} */
390
+ _paintReview(): void;
391
+ /** @param {NormalizedItem} item @param {unknown} value @returns {string} */
392
+ _formatAnswer(item: NormalizedItem, value: unknown): string;
393
+ /** @returns {void} */
394
+ _paintActions(): void;
395
+ /**
396
+ * @param {string} action @param {string} label @param {string|null} glyph
397
+ * @param {'default'|'primary'|'ghost'} kind @returns {HTMLButtonElement}
398
+ */
399
+ _action(action: string, label: string, glyph: string | null, kind: 'default' | 'primary' | 'ghost'): HTMLButtonElement;
400
+ /** @param {Event} event @returns {void} */
401
+ _onControlChange(event: Event): void;
402
+ /** @param {Event} event @returns {void} */
403
+ _onFreeformInput(event: Event): void;
404
+ /** @param {Event} event @returns {void} */
405
+ _onActionClick(event: Event): void;
406
+ /** @param {Event} event @returns {void} */
407
+ _onReviewClick(event: Event): void;
408
+ /** @param {KeyboardEvent} event @returns {void} */
409
+ _onKeydown(event: KeyboardEvent): void;
410
+ /** @param {NormalizedItem} item @returns {void} */
411
+ _maybeAutoAdvance(item: NormalizedItem): void;
412
+ /** @param {NormalizedItem} item @returns {void} */
413
+ _emitChange(item: NormalizedItem): void;
414
+ /** @returns {void} */
415
+ _focusItem(): void;
416
+ /** @returns {void} */
417
+ _focusControl(): void;
418
+ }
419
+ /**
420
+ * An answer changed.
421
+ * @event Questionnaire#change
422
+ * @type {CustomEvent<QuestionnaireChangeDetail>}
423
+ */
424
+ /**
425
+ * A move between questions, into the review screen, or back. Preventable: call
426
+ * `event.preventDefault()` to refuse the move.
427
+ * @event Questionnaire#navigate
428
+ * @type {CustomEvent<QuestionnaireNavigateDetail>}
429
+ */
430
+ /**
431
+ * A skippable question was skipped, clearing its answer.
432
+ * @event Questionnaire#skip
433
+ * @type {CustomEvent<QuestionnaireSkipDetail>}
434
+ */
435
+ /**
436
+ * Validation of the active question failed.
437
+ * @event Questionnaire#invalid
438
+ * @type {CustomEvent<QuestionnaireInvalidDetail>}
439
+ */
440
+ /**
441
+ * The questionnaire is being submitted. Preventable.
442
+ * @event Questionnaire#submit
443
+ * @type {CustomEvent<QuestionnaireSubmitDetail>}
444
+ */
445
+ /**
446
+ * Submission was not prevented and the questionnaire is finished.
447
+ * @event Questionnaire#complete
448
+ * @type {CustomEvent<QuestionnaireCompleteDetail>}
449
+ */
@@ -3,6 +3,14 @@ export type Primitive = string | number | boolean | symbol | bigint | null | und
3
3
  export type SelectItem = Record<string, any> | Primitive;
4
4
  export type SelectValueReader = string | ((item: SelectItem) => unknown);
5
5
  export type SelectLabelReader = string | ((item: SelectItem) => string);
6
+ export type SelectAction = {
7
+ id: string | number;
8
+ label: string;
9
+ icon?: string | Node;
10
+ description?: string;
11
+ group?: string;
12
+ invoke?: (detail: SelectActionDetail) => void;
13
+ };
6
14
  export type SelectOptions = {
7
15
  /**
8
16
  * Available values.
@@ -28,6 +36,22 @@ export type SelectOptions = {
28
36
  * Selected-value renderer.
29
37
  */
30
38
  renderValue?: ((item: SelectItem) => string) | null;
39
+ /**
40
+ * Decorative content before the selected text.
41
+ */
42
+ renderValueAdornment?: ((item: SelectItem) => Node | string | null) | null;
43
+ /**
44
+ * Clear-row renderer.
45
+ */
46
+ renderNone?: ((label: string) => Node | string) | null;
47
+ /**
48
+ * Clear-row label independent from the input placeholder.
49
+ */
50
+ noneLabel?: string | null;
51
+ /**
52
+ * Command rows that emit `action` without changing value.
53
+ */
54
+ actions?: SelectAction[];
31
55
  /**
32
56
  * Initially selected ID or item.
33
57
  */
@@ -92,6 +116,10 @@ export type SelectOptions = {
92
116
  * Async-loaded listener.
93
117
  */
94
118
  onloaded?: (event: CustomEvent<SelectLoadedDetail>) => void;
119
+ /**
120
+ * Preventable command-row listener.
121
+ */
122
+ onaction?: (event: CustomEvent<SelectActionDetail>) => void;
95
123
  };
96
124
  export type SelectChangeDetail = {
97
125
  value: unknown;
@@ -103,9 +131,16 @@ export type SelectQueryDetail = {
103
131
  export type SelectLoadedDetail = {
104
132
  items: SelectItem[];
105
133
  };
134
+ export type SelectActionDetail = {
135
+ id: string | number;
136
+ action: SelectAction;
137
+ query: string;
138
+ select: Select;
139
+ };
106
140
  export type SelectOptionEntry = {
107
141
  item: SelectItem | null;
108
142
  clear: boolean;
143
+ action: SelectAction | null;
109
144
  element: HTMLElement;
110
145
  };
111
146
  export type SelectSetOptions = {
@@ -126,6 +161,7 @@ export declare class Select extends Component<SelectOptions> {
126
161
  _visibleItems: any[];
127
162
  _fixedItems: any[] | SelectItem[];
128
163
  _visibleFixed: any[] | SelectItem[];
164
+ _actions: any[] | SelectAction[];
129
165
  _selected: SelectItem;
130
166
  _optionEntries: any[];
131
167
  _activeIndex: number;
@@ -171,6 +207,8 @@ export declare class Select extends Component<SelectOptions> {
171
207
  * @returns {this}
172
208
  */
173
209
  setFixedItems(items: SelectItem[]): this;
210
+ /** Replaces command rows without changing the selected value. @param {SelectAction[]} actions @returns {this} */
211
+ setActions(actions: SelectAction[]): this;
174
212
  /**
175
213
  * Restores the configured initial value.
176
214
  * @param {{silent?: boolean}} [options={}] Reset behavior.
@@ -196,6 +234,15 @@ export declare class Select extends Component<SelectOptions> {
196
234
  * @returns {Select}
197
235
  */
198
236
  static priority(target: Element | string | null, options?: SelectOptions): Select;
237
+ /**
238
+ * Creates a status picker with shape- and color-distinct workflow indicators.
239
+ * @param {Element|string|null} target Component target.
240
+ * @param {SelectOptions & {items?: Array<Record<string, any>>}} [options={}] Select overrides and status items.
241
+ * @returns {Select}
242
+ */
243
+ static status(target: Element | string | null, options?: SelectOptions & {
244
+ items?: Array<Record<string, any>>;
245
+ }): Select;
199
246
  /**
200
247
  * Creates the record-permission picker: the fixed Private and Public choices above the groups a
201
248
  * record can be shared with. The value is the tri-state ZeyOS stores — `false` for private,
@@ -228,6 +275,8 @@ export declare class Select extends Component<SelectOptions> {
228
275
  _renderOptions(): void;
229
276
  /** @param {SelectItem|null} item @param {boolean} clear @param {string} [label] @returns {void} */
230
277
  _appendOption(item: SelectItem | null, clear: boolean, label?: string): void;
278
+ /** @param {SelectAction} action @returns {void} */
279
+ _appendAction(action: SelectAction): void;
231
280
  /** @param {SelectItem|null} item @returns {Node|string} */
232
281
  _renderItem(item: SelectItem | null): Node | string;
233
282
  /** @param {string} query @returns {void} */
@@ -241,6 +290,8 @@ export declare class Select extends Component<SelectOptions> {
241
290
  /** @returns {void} */
242
291
  _syncInputValue(): void;
243
292
  /** @returns {void} */
293
+ _syncValueAdornment(): void;
294
+ /** @returns {void} */
244
295
  _syncDisabled(): void;
245
296
  /** @param {unknown} candidate @returns {SelectItem|null} */
246
297
  _findItem(candidate: unknown): SelectItem | null;