@zeyos/zx 4.4.0 → 5.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 (182) hide show
  1. package/CHANGELOG.md +283 -0
  2. package/README.md +42 -10
  3. package/dist/types/components/activity-list/activity-list.d.ts +22 -0
  4. package/dist/types/components/app-sidebar/app-sidebar.d.ts +5 -3
  5. package/dist/types/components/avatar/avatar.d.ts +46 -7
  6. package/dist/types/components/badge/badge.d.ts +21 -1
  7. package/dist/types/components/button/button.d.ts +15 -0
  8. package/dist/types/components/chart/chart.d.ts +10 -0
  9. package/dist/types/components/checklist/checklist.d.ts +9 -0
  10. package/dist/types/components/code-editor/code-editor.d.ts +6 -17
  11. package/dist/types/components/datebox/date-range-box.d.ts +5 -1
  12. package/dist/types/components/datebox/datebox.d.ts +7 -2
  13. package/dist/types/components/dialog/dialog.d.ts +46 -6
  14. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  15. package/dist/types/components/entity-ref/entity-ref.d.ts +2 -2
  16. package/dist/types/components/field/field.d.ts +24 -2
  17. package/dist/types/components/fieldset/fieldset.d.ts +19 -1
  18. package/dist/types/components/file-item/file-item.d.ts +34 -6
  19. package/dist/types/components/form/form.d.ts +12 -1
  20. package/dist/types/components/kanban-view/kanban-card.d.ts +8 -0
  21. package/dist/types/components/launcher/launcher.d.ts +260 -15
  22. package/dist/types/components/list-toolbar/list-toolbar.d.ts +1 -1
  23. package/dist/types/components/menu-button/menu-button.d.ts +33 -5
  24. package/dist/types/components/message/message.d.ts +119 -17
  25. package/dist/types/components/modal/modal.d.ts +13 -2
  26. package/dist/types/components/select/color.d.ts +12 -0
  27. package/dist/types/components/select/glyphs.d.ts +124 -0
  28. package/dist/types/components/select/select.d.ts +11 -3
  29. package/dist/types/components/stat-tile/stat-tile.d.ts +16 -5
  30. package/dist/types/components/tabbox/tabbox.d.ts +9 -0
  31. package/dist/types/components/table/table.d.ts +46 -1
  32. package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
  33. package/dist/types/components/tree/tree.d.ts +13 -0
  34. package/dist/types/core/breakpoint.d.ts +1 -1
  35. package/dist/types/core/icons.d.ts +23 -25
  36. package/dist/types/core/motion.d.ts +59 -0
  37. package/dist/types/core/overlay-host.d.ts +15 -1
  38. package/dist/types/index.d.ts +5 -3
  39. package/dist/types/zeyos/connect.d.ts +6 -0
  40. package/dist/types/zeyos/form.d.ts +50 -9
  41. package/dist/types/zeyos/index.d.ts +1 -1
  42. package/dist/types/zeyos/query.d.ts +79 -0
  43. package/dist/types/zeyos/schema.d.ts +24 -1
  44. package/dist/types/zeyos/table.d.ts +100 -14
  45. package/dist/types/zeyos/view.d.ts +10 -0
  46. package/dist/zx-zeyos.esm.js +1621 -443
  47. package/dist/zx-zeyos.esm.min.js +53 -5
  48. package/dist/zx.css +1411 -660
  49. package/dist/zx.esm.js +1976 -703
  50. package/dist/zx.esm.min.js +56 -8
  51. package/dist/zx.global.js +1978 -705
  52. package/dist/zx.global.min.js +56 -8
  53. package/dist/zx.min.css +1 -1
  54. package/docs/api.json +219 -34
  55. package/docs/llms.md +472 -110
  56. package/docs/llms.txt +3 -3
  57. package/package.json +1 -1
  58. package/src/components/account-menu/account-menu.css +35 -10
  59. package/src/components/activity-item/activity-item.css +1 -1
  60. package/src/components/activity-item/activity-item.js +3 -0
  61. package/src/components/activity-list/activity-list.css +38 -3
  62. package/src/components/activity-list/activity-list.js +34 -0
  63. package/src/components/app-icon/app-icon.css +1 -1
  64. package/src/components/app-rail/app-rail.css +40 -79
  65. package/src/components/app-sidebar/app-sidebar.css +109 -174
  66. package/src/components/app-sidebar/app-sidebar.js +21 -6
  67. package/src/components/aurora/aurora.css +5 -3
  68. package/src/components/avatar/avatar.css +32 -7
  69. package/src/components/avatar/avatar.js +72 -8
  70. package/src/components/badge/badge.css +54 -2
  71. package/src/components/badge/badge.js +29 -2
  72. package/src/components/button/button.css +67 -9
  73. package/src/components/button/button.js +38 -0
  74. package/src/components/calendar/calendar.css +46 -46
  75. package/src/components/card/card.css +2 -2
  76. package/src/components/card-view/card-view.css +9 -7
  77. package/src/components/chart/chart.css +4 -1
  78. package/src/components/chart/chart.js +12 -0
  79. package/src/components/check-button/check-button.css +10 -2
  80. package/src/components/checklist/checklist.css +9 -2
  81. package/src/components/checklist/checklist.js +11 -5
  82. package/src/components/checklist/field-adapter.js +3 -1
  83. package/src/components/code-editor/code-editor.css +6 -5
  84. package/src/components/code-editor/code-editor.js +19 -1
  85. package/src/components/context-menu/context-menu.css +9 -4
  86. package/src/components/copy/copy-button.css +6 -0
  87. package/src/components/copy/copy-input.css +8 -3
  88. package/src/components/data-filter/data-filter.css +5 -4
  89. package/src/components/date-picker/date-picker.css +6 -6
  90. package/src/components/date-picker/date-range-picker.css +3 -3
  91. package/src/components/date-picker/time-picker.css +1 -1
  92. package/src/components/datebox/date-range-box.css +79 -2
  93. package/src/components/datebox/date-range-box.js +13 -2
  94. package/src/components/datebox/datebox.css +79 -2
  95. package/src/components/datebox/datebox.js +13 -2
  96. package/src/components/dialog/dialog.css +26 -0
  97. package/src/components/dialog/dialog.js +99 -17
  98. package/src/components/dropdown/dropdown.css +1 -1
  99. package/src/components/dropdown/dropdown.js +5 -3
  100. package/src/components/empty-state/empty-state.css +2 -2
  101. package/src/components/entity-ref/entity-ref.css +1 -1
  102. package/src/components/entity-ref/entity-ref.js +1 -1
  103. package/src/components/field/field.css +28 -9
  104. package/src/components/field/field.js +68 -26
  105. package/src/components/field-upload/field-upload.css +1 -1
  106. package/src/components/fieldset/fieldset.css +5 -3
  107. package/src/components/fieldset/fieldset.js +28 -5
  108. package/src/components/file-item/file-item.js +144 -10
  109. package/src/components/filter/filter.js +7 -3
  110. package/src/components/filter-panel/filter-panel.css +1 -1
  111. package/src/components/finder/finder.css +15 -13
  112. package/src/components/form/form.css +5 -4
  113. package/src/components/form/form.js +11 -2
  114. package/src/components/grid/grid.css +1 -1
  115. package/src/components/groupbox/groupbox.css +1 -1
  116. package/src/components/kanban-view/kanban-card.js +11 -3
  117. package/src/components/kanban-view/kanban-view.css +39 -15
  118. package/src/components/kanban-view/kanban-view.js +4 -4
  119. package/src/components/launcher/launcher.css +107 -25
  120. package/src/components/launcher/launcher.js +503 -41
  121. package/src/components/list-toolbar/list-toolbar.css +13 -8
  122. package/src/components/list-toolbar/list-toolbar.js +1 -1
  123. package/src/components/master-panel/master-panel.css +2 -0
  124. package/src/components/menu-button/menu-button.css +9 -4
  125. package/src/components/menu-button/menu-button.js +65 -9
  126. package/src/components/message/message.css +33 -3
  127. package/src/components/message/message.js +217 -15
  128. package/src/components/modal/modal.js +18 -3
  129. package/src/components/navigation-bar/navigation-bar.css +18 -9
  130. package/src/components/number-field/field-adapter.js +1 -0
  131. package/src/components/number-field/number-field.css +70 -0
  132. package/src/components/number-field/number-field.js +2 -0
  133. package/src/components/pagination/pagination.css +8 -6
  134. package/src/components/panel/panel.css +1 -1
  135. package/src/components/rating/rating.css +7 -0
  136. package/src/components/select/color.js +22 -0
  137. package/src/components/select/field-adapter.js +2 -0
  138. package/src/components/select/glyphs.js +165 -0
  139. package/src/components/select/select.css +138 -45
  140. package/src/components/select/select.js +83 -47
  141. package/src/components/sheet/sheet.css +11 -8
  142. package/src/components/slider/slider.css +16 -2
  143. package/src/components/slider/slider.js +1 -1
  144. package/src/components/sort-control/sort-control.css +4 -1
  145. package/src/components/stat-tile/stat-tile.css +41 -46
  146. package/src/components/stat-tile/stat-tile.js +17 -6
  147. package/src/components/tabbox/tabbox.css +32 -27
  148. package/src/components/tabbox/tabbox.js +5 -1
  149. package/src/components/table/table.css +104 -29
  150. package/src/components/table/table.js +90 -16
  151. package/src/components/tag-picker/tag-picker.css +83 -5
  152. package/src/components/tag-picker/tag-picker.js +25 -8
  153. package/src/components/timebox/timebox.css +22 -2
  154. package/src/components/toggle/toggle.css +12 -1
  155. package/src/components/toolbar/toolbar.js +2 -2
  156. package/src/components/tooltip/tooltip.css +4 -0
  157. package/src/components/tooltip/tooltip.js +10 -3
  158. package/src/components/tree/tree.css +25 -16
  159. package/src/components/tree/tree.js +31 -0
  160. package/src/components/value-list/value-list.css +3 -3
  161. package/src/components/view/record-view.js +1 -1
  162. package/src/core/breakpoint.js +1 -1
  163. package/src/core/icons.js +193 -60
  164. package/src/core/motion.js +147 -0
  165. package/src/core/overlay-host.js +21 -2
  166. package/src/index.js +5 -3
  167. package/src/internal/app-rail.js +1 -2
  168. package/src/zeyos/connect.js +6 -2
  169. package/src/zeyos/form.js +67 -27
  170. package/src/zeyos/index.js +1 -1
  171. package/src/zeyos/query.js +153 -0
  172. package/src/zeyos/schema.js +144 -27
  173. package/src/zeyos/table.js +68 -5
  174. package/src/zeyos/view.js +6 -0
  175. package/styles/base.css +56 -0
  176. package/styles/icons.css +11 -1
  177. package/styles/tokens/dark.css +113 -37
  178. package/styles/tokens/global.css +121 -27
  179. package/styles/tokens/semantic.css +100 -31
  180. package/styles/tokens/themes.css +7 -6
  181. package/styles/zx.css +0 -1
  182. package/styles/tokens/density.css +0 -9
@@ -22,6 +22,12 @@ export type ChartSpec = {
22
22
  * Engine-specific options.
23
23
  */
24
24
  options: Record<string, unknown>;
25
+ /**
26
+ * Whether the chart must not animate: the operating system asks
27
+ * for reduced motion, or the host sits inside a `data-zx-motion="reduced"` region. An adapter turns
28
+ * its engine's own animation off when this is true; `ChartJsAdapter` sets `animation: false`.
29
+ */
30
+ reducedMotion: boolean;
25
31
  /**
26
32
  * Point-selection callback.
27
33
  */
@@ -155,6 +161,9 @@ export type ChartOptions = {
155
161
  * @property {string} type Chart type.
156
162
  * @property {ChartData} data Chart data.
157
163
  * @property {Record<string, unknown>} options Engine-specific options.
164
+ * @property {boolean} reducedMotion Whether the chart must not animate: the operating system asks
165
+ * for reduced motion, or the host sits inside a `data-zx-motion="reduced"` region. An adapter turns
166
+ * its engine's own animation off when this is true; `ChartJsAdapter` sets `animation: false`.
158
167
  * @property {(detail: ChartSelectDetail) => void} onSelect Point-selection callback.
159
168
  */
160
169
  /**
@@ -223,6 +232,7 @@ export declare class Chart extends Component<ChartOptions> {
223
232
  _handle: ChartHandle;
224
233
  _destroyed: boolean;
225
234
  _observer: ResizeObserver;
235
+ _stopWatchingMotion: () => void;
226
236
  static cssName: string;
227
237
  /** @type {Readonly<ChartOptions>} */
228
238
  static defaults: Readonly<ChartOptions>;
@@ -29,6 +29,12 @@ export type ChecklistOptions = {
29
29
  * Fallback initial checked state.
30
30
  */
31
31
  defaultChecked?: boolean;
32
+ /**
33
+ * Whether the heading is left out. The group keeps the
34
+ * heading text as its accessible name (`aria-label`); a Field labelling the checklist names it
35
+ * instead, which is why the `checklist` field type sets this.
36
+ */
37
+ hideLabel?: boolean;
32
38
  /**
33
39
  * Async item loader.
34
40
  */
@@ -62,6 +68,9 @@ export type ChecklistLoadedDetail = {
62
68
  * @property {boolean} [search=true] Whether the search field is shown.
63
69
  * @property {number} [height=280] Maximum list height in pixels.
64
70
  * @property {boolean} [defaultChecked=false] Fallback initial checked state.
71
+ * @property {boolean} [hideLabel=false] Whether the heading is left out. The group keeps the
72
+ * heading text as its accessible name (`aria-label`); a Field labelling the checklist names it
73
+ * instead, which is why the `checklist` field type sets this.
65
74
  * @property {(() => Promise<ChecklistItem[]>|ChecklistItem[])|null} [load=null] Async item loader.
66
75
  * @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
67
76
  * @property {(event: CustomEvent<ChecklistChangeDetail>) => void} [onchange] Change listener.
@@ -61,27 +61,14 @@ export type CodeEditorOptions = {
61
61
  value: string;
62
62
  }>) => void;
63
63
  };
64
- /**
65
- * @typedef {Object} CodeEditorOptions
66
- * @property {unknown} [value=''] Initial text.
67
- * @property {string} [name=''] Form field name.
68
- * @property {string} [language='text'] Language identifier shown to the user and exposed as data.
69
- * @property {string} [label='Code editor'] Accessible editor label.
70
- * @property {string} [placeholder=''] Placeholder text.
71
- * @property {number} [rows=12] Visible textarea rows.
72
- * @property {string} [indent='\t'] Text inserted by Tab and removed by Shift+Tab.
73
- * @property {'off'|'soft'|'hard'} [wrap='off'] Textarea wrapping behavior.
74
- * @property {boolean} [spellcheck=false] Whether browser spellcheck is enabled.
75
- * @property {boolean} [readOnly=false] Whether content can be selected but not changed.
76
- * @property {boolean} [disabled=false] Whether the editor is disabled.
77
- * @property {boolean} [status=true] Whether the line/column status is visible.
78
- * @property {(event: CustomEvent<{value:string}>) => void} [oninput] Input listener.
79
- * @property {(event: CustomEvent<{value:string}>) => void} [onchange] Change listener.
80
- */
81
64
  /**
82
65
  * Dependency-free source editor for structured text, Markdown, JSON and code. It deliberately uses
83
66
  * a native textarea: values remain text-safe, browser undo and IME behavior stay intact, and Tab /
84
67
  * Shift+Tab provide predictable indentation without a third-party editor runtime.
68
+ *
69
+ * Capturing Tab is what a code surface has to do, and it would be a keyboard trap if nothing undid
70
+ * it: Escape releases the capture until the next keystroke in the editor, so Escape then Tab (or
71
+ * Shift+Tab) moves focus out of the editor as it would leave any other field.
85
72
  * @fires CodeEditor#input
86
73
  * @fires CodeEditor#change
87
74
  * @extends {Component<CodeEditorOptions>}
@@ -95,6 +82,8 @@ export declare class CodeEditor extends Component<CodeEditorOptions> {
95
82
  _position: HTMLElement;
96
83
  _header: HTMLElement;
97
84
  _input: HTMLTextAreaElement;
85
+ /** Set by Escape: the next Tab moves focus instead of indenting. */
86
+ _tabReleased: boolean;
98
87
  static cssName: string;
99
88
  /** @type {CodeEditorOptions} */
100
89
  static defaults: CodeEditorOptions;
@@ -29,7 +29,8 @@ export type DateRangeBoxOptions = {
29
29
  */
30
30
  placeholder?: string | null;
31
31
  /**
32
- * Show a clear button while a range is present.
32
+ * Show a clear button while a range is present and the box is
33
+ * enabled; without it the input keeps no room for one.
33
34
  */
34
35
  clearable?: boolean;
35
36
  /**
@@ -119,6 +120,7 @@ export declare function formatRangeText(range: DateRange | null, format: string,
119
120
  export declare class DateRangeBox extends Component<DateRangeBoxOptions> {
120
121
  _originalState: string;
121
122
  _originalAriaDisabled: string;
123
+ _originalClearable: string;
122
124
  _format: string;
123
125
  _separator: string;
124
126
  _disabled: boolean;
@@ -209,6 +211,8 @@ export declare class DateRangeBox extends Component<DateRangeBoxOptions> {
209
211
  _placeholder(): string;
210
212
  /** @returns {void} */
211
213
  _syncDisplay(): void;
214
+ /** A disabled box offers no clear button: there is nothing it could do. @returns {void} */
215
+ _syncClear(): void;
212
216
  /** @returns {void} */
213
217
  _syncDisabled(): void;
214
218
  /** @returns {void} */
@@ -26,7 +26,8 @@ export type DateboxOptions = {
26
26
  */
27
27
  placeholder?: string | null;
28
28
  /**
29
- * Show a clear button when a value is present.
29
+ * Show a clear button while a value is present and the box is
30
+ * enabled; without it the input keeps no room for one.
30
31
  */
31
32
  clearable?: boolean;
32
33
  /**
@@ -66,7 +67,8 @@ export type DateboxUnit = 'date' | 'seconds';
66
67
  * @property {Date|null} [min=null] Earliest selectable date.
67
68
  * @property {Date|null} [max=null] Latest selectable date.
68
69
  * @property {string|null} [placeholder=null] Input placeholder; null derives one from the format.
69
- * @property {boolean} [clearable=true] Show a clear button when a value is present.
70
+ * @property {boolean} [clearable=true] Show a clear button while a value is present and the box is
71
+ * enabled; without it the input keeps no room for one.
70
72
  * @property {boolean} [disabled=false] Disable all controls.
71
73
  * @property {(event: CustomEvent<{date: Date|null}>) => void} [onchange] Change listener.
72
74
  * @property {(event: CustomEvent<{text: string}>) => void} [oninvalid] Invalid-input listener.
@@ -86,6 +88,7 @@ export type DateboxUnit = 'date' | 'seconds';
86
88
  export declare class Datebox extends Component<DateboxOptions> {
87
89
  _originalState: string;
88
90
  _originalAriaDisabled: string;
91
+ _originalClearable: string;
89
92
  _format: string;
90
93
  _disabled: boolean;
91
94
  _open: boolean;
@@ -142,6 +145,8 @@ export declare class Datebox extends Component<DateboxOptions> {
142
145
  _normalizeValue(value: Date | number | string | null | unknown): Date | null;
143
146
  /** @returns {void} */
144
147
  _syncDisplay(): void;
148
+ /** A disabled box offers no clear button: there is nothing it could do. @returns {void} */
149
+ _syncClear(): void;
145
150
  /** @returns {void} */
146
151
  _syncDisabled(): void;
147
152
  /** @returns {void} */
@@ -50,7 +50,7 @@ export type DialogOptions = {
50
50
  toElement: () => Node | null;
51
51
  } | null;
52
52
  /**
53
- * Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
53
+ * Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
54
54
  */
55
55
  scope?: Element | string | null;
56
56
  /**
@@ -137,6 +137,14 @@ export type ConfirmOptions = {
137
137
  * Whether the confirmation action is dangerous.
138
138
  */
139
139
  danger?: boolean;
140
+ /**
141
+ * Text the reader must type before the confirm button
142
+ * enables — the name of what is about to be deleted, say. The dialog adds an input labelled
143
+ * "Type <confirmText> to confirm" (message `dialog.typeToConfirm`, `%1` standing for the text),
144
+ * focuses it, and enables the confirm button, and Enter, only while its value matches exactly,
145
+ * ignoring surrounding spaces.
146
+ */
147
+ confirmText?: string | null;
140
148
  };
141
149
  export type PromptOptions = {
142
150
  /**
@@ -155,6 +163,14 @@ export type PromptOptions = {
155
163
  * Input placeholder.
156
164
  */
157
165
  placeholder?: string;
166
+ /**
167
+ * Confirmation label.
168
+ */
169
+ okLabel?: string;
170
+ /**
171
+ * Cancellation label.
172
+ */
173
+ cancelLabel?: string;
158
174
  };
159
175
  /** @typedef {'default'|'primary'|'danger'|'ghost'} DialogButtonKind */
160
176
  /**
@@ -173,7 +189,7 @@ export type PromptOptions = {
173
189
  * @property {DialogButton[]} [buttons=[]] Footer buttons.
174
190
  * @property {boolean} [closable=true] Whether Escape and the header button may close the dialog.
175
191
  * @property {Node|string|number|{toElement: () => Node|null}|null} [content=null] Body content.
176
- * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
192
+ * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
177
193
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
178
194
  * @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
179
195
  * @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
@@ -204,6 +220,11 @@ export type PromptOptions = {
204
220
  * @property {string} [okLabel='OK'] Confirmation label.
205
221
  * @property {string} [cancelLabel='Cancel'] Cancellation label.
206
222
  * @property {boolean} [danger=false] Whether the confirmation action is dangerous.
223
+ * @property {string|null} [confirmText=null] Text the reader must type before the confirm button
224
+ * enables — the name of what is about to be deleted, say. The dialog adds an input labelled
225
+ * "Type <confirmText> to confirm" (message `dialog.typeToConfirm`, `%1` standing for the text),
226
+ * focuses it, and enables the confirm button, and Enter, only while its value matches exactly,
227
+ * ignoring surrounding spaces.
207
228
  */
208
229
  /**
209
230
  * @typedef {Object} PromptOptions
@@ -211,6 +232,8 @@ export type PromptOptions = {
211
232
  * @property {Node|string|number|null} [message=''] Prompt message.
212
233
  * @property {string} [value=''] Initial input value.
213
234
  * @property {string} [placeholder=''] Input placeholder.
235
+ * @property {string} [okLabel='OK'] Confirmation label.
236
+ * @property {string} [cancelLabel='Cancel'] Cancellation label.
214
237
  */
215
238
  /**
216
239
  * Structured modal with a title, body, footer actions, and switchable views.
@@ -285,17 +308,18 @@ export declare class Dialog extends Modal {
285
308
  */
286
309
  static alert({ title, message, okLabel }?: AlertOptions): Promise<void>;
287
310
  /**
288
- * Opens a confirmation dialog.
311
+ * Opens a confirmation dialog. With `confirmText` it becomes a type-to-confirm dialog: the
312
+ * confirm button stays disabled until the reader has typed that text.
289
313
  * @param {ConfirmOptions} [options={}] Confirmation options.
290
- * @returns {Promise<boolean>}
314
+ * @returns {Promise<boolean>} True when confirmed; false on Cancel, Escape, or the close button.
291
315
  */
292
- static confirm({ title, message, okLabel, cancelLabel, danger }?: ConfirmOptions): Promise<boolean>;
316
+ static confirm({ title, message, okLabel, cancelLabel, danger, confirmText }?: ConfirmOptions): Promise<boolean>;
293
317
  /**
294
318
  * Opens a single-line text prompt.
295
319
  * @param {PromptOptions} [options={}] Prompt options.
296
320
  * @returns {Promise<string|null>}
297
321
  */
298
- static prompt({ title, message, value, placeholder }?: PromptOptions): Promise<string | null>;
322
+ static prompt({ title, message, value, placeholder, okLabel, cancelLabel }?: PromptOptions): Promise<string | null>;
299
323
  /**
300
324
  * Applies the dialog width. Subclasses that size themselves on a different axis override this.
301
325
  *
@@ -313,6 +337,22 @@ export declare class Dialog extends Modal {
313
337
  */
314
338
  _message(key: string, fallback: string): string;
315
339
  }
340
+ /**
341
+ * Reports whether what the reader typed confirms a type-to-confirm dialog: the same text, exactly
342
+ * — case and inner spacing included — once surrounding spaces are ignored on both sides.
343
+ * @param {unknown} typed Input value.
344
+ * @param {unknown} expected Text the dialog asks for.
345
+ * @returns {boolean}
346
+ */
347
+ export declare function typedConfirmation(typed: unknown, expected: unknown): boolean;
348
+ /**
349
+ * Splits the type-to-confirm message around `%1`, where the text to type goes. A translation that
350
+ * leaves `%1` out gets the text after it, following a space; a second `%1` is filled in as text.
351
+ * @param {string} template Message such as "Type %1 to confirm".
352
+ * @param {string} expected Text to type.
353
+ * @returns {[string, string]} The text before and after the text to type.
354
+ */
355
+ export declare function typeToConfirmParts(template: string, expected: string): [string, string];
316
356
  /**
317
357
  * Copies footer-button descriptors without mutating the caller's array or objects, and settles
318
358
  * the two booleans the footer renders from.
@@ -29,7 +29,7 @@ export type DropdownOptions = {
29
29
  */
30
30
  closeOnSelect?: boolean;
31
31
  /**
32
- * Element whose nearest Zx theme scope owns the panel; defaults to the anchor.
32
+ * Element whose nearest Zx theme scope owns the panel; defaults to the anchor. Resolved on every open, so an anchor connected after construction still gets its scope.
33
33
  */
34
34
  scope?: Element | string | null;
35
35
  /**
@@ -49,7 +49,7 @@ export type DropdownOptions = {
49
49
  * @property {boolean} [matchWidth=false] Whether the panel matches the anchor width.
50
50
  * @property {'click'|'manual'} [openOn='click'] Trigger behavior.
51
51
  * @property {boolean} [closeOnSelect=false] Whether a click within the panel closes it.
52
- * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the panel; defaults to the anchor.
52
+ * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the panel; defaults to the anchor. Resolved on every open, so an anchor connected after construction still gets its scope.
53
53
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
54
54
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close event listener.
55
55
  */
@@ -115,7 +115,7 @@ export type EntityRefOptions = {
115
115
  */
116
116
  actions?: EntityRefActionEntry[];
117
117
  /**
118
- * Density-independent identity size.
118
+ * Size of the icon and the identity text.
119
119
  */
120
120
  size?: 'sm' | 'md' | 'lg';
121
121
  /**
@@ -230,7 +230,7 @@ export type EntityRefState = {
230
230
  * @property {EntityRefMetadata[]} [metadata=[]] Labelled dense metadata.
231
231
  * @property {EntityRefLinkValue} [link=null] Optional native primary link.
232
232
  * @property {EntityRefActionEntry[]} [actions=[]] Secondary controls; element actions keep their own behavior.
233
- * @property {'sm'|'md'|'lg'} [size='md'] Density-independent identity size.
233
+ * @property {'sm'|'md'|'lg'} [size='md'] Size of the icon and the identity text.
234
234
  * @property {boolean} [wrap=false] Whether long identity text may wrap instead of truncating.
235
235
  * @property {string} [actionsLabel='Entity actions'] Accessible name for secondary actions.
236
236
  * @property {(event: CustomEvent<{id: unknown, entity: Readonly<EntityRefState>, href: string, event: MouseEvent}>) => void} [onactivate]
@@ -1,9 +1,15 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  export type FieldOptions = {
3
3
  /**
4
- * Control ID and logical field identifier.
4
+ * DOM id of the control. Generated when omitted; a Fieldset
5
+ * derives it from its `idPrefix` and the field key, so a key never becomes a DOM id by itself.
5
6
  */
6
7
  id?: string | null;
8
+ /**
9
+ * Field name: the `name` of a native control and the key the
10
+ * field is filed under. A Fieldset sets it to the field key; a standalone field falls back to `id`.
11
+ */
12
+ name?: string | null;
7
13
  /**
8
14
  * Registered field type.
9
15
  */
@@ -88,6 +94,12 @@ export type FieldAdapter = {
88
94
  * Release adapter-owned resources.
89
95
  */
90
96
  destroy?: () => void;
97
+ /**
98
+ * The element the field's label, description, and validity
99
+ * belong to when it is not `el` — the text input inside a composite control. Left out, a
100
+ * wrapper that cannot be labelled hands them to the first unnamed form control inside it.
101
+ */
102
+ labelTarget?: Element;
91
103
  };
92
104
  export type FieldAdapterFactory = (field: Field, options: Readonly<FieldOptions>) => FieldAdapter;
93
105
  export type NumericCoercion = {
@@ -96,7 +108,10 @@ export type NumericCoercion = {
96
108
  };
97
109
  /**
98
110
  * @typedef {Object} FieldOptions
99
- * @property {string|null} [id=null] Control ID and logical field identifier.
111
+ * @property {string|null} [id=null] DOM id of the control. Generated when omitted; a Fieldset
112
+ * derives it from its `idPrefix` and the field key, so a key never becomes a DOM id by itself.
113
+ * @property {string|null} [name=null] Field name: the `name` of a native control and the key the
114
+ * field is filed under. A Fieldset sets it to the field key; a standalone field falls back to `id`.
100
115
  * @property {string} [type='text'] Registered field type.
101
116
  * @property {string} [label=''] Visible label.
102
117
  * @property {string} [description=''] Supporting description.
@@ -119,6 +134,9 @@ export type NumericCoercion = {
119
134
  * @property {() => void} focus Focus the control.
120
135
  * @property {(disabled: boolean) => void} setDisabled Set disabled state.
121
136
  * @property {() => void} [destroy] Release adapter-owned resources.
137
+ * @property {Element} [labelTarget] The element the field's label, description, and validity
138
+ * belong to when it is not `el` — the text input inside a composite control. Left out, a
139
+ * wrapper that cannot be labelled hands them to the first unnamed form control inside it.
122
140
  */
123
141
  /** @typedef {(field: Field, options: Readonly<FieldOptions>) => FieldAdapter} FieldAdapterFactory */
124
142
  /** @typedef {{valid: boolean, value: number|string}} NumericCoercion */
@@ -133,8 +151,12 @@ export declare class Field extends Component<FieldOptions> {
133
151
  _ownedComponents: Set<any>;
134
152
  _ownedNodes: any[];
135
153
  _rootAttributes: Map<string, string>;
154
+ /** @type {string} The control's DOM id: `options.id`, or a generated one. */
136
155
  controlId: string;
156
+ /** @type {string} The field name (`options.name`, else `options.id`), '' when there is none. */
157
+ name: string;
137
158
  adapter: FieldAdapter;
159
+ _labelled: Element;
138
160
  _baseDescribedBy: string;
139
161
  _descriptionId: string;
140
162
  _highlightId: string;
@@ -13,6 +13,12 @@ export type FieldsetOptions = {
13
13
  * Initial fields.
14
14
  */
15
15
  fields?: Record<string, FieldOptions | Field | Element | Component>;
16
+ /**
17
+ * Prefix of the DOM ids generated for the fields, as
18
+ * `<idPrefix>-<key>`. Null generates one per instance, so the same fieldset mounted twice
19
+ * never repeats an id and a field key never collides with an element id elsewhere on the page.
20
+ */
21
+ idPrefix?: string | null;
16
22
  };
17
23
  export type FieldOptions = import('../field/field.js').FieldOptions;
18
24
  /**
@@ -20,6 +26,9 @@ export type FieldOptions = import('../field/field.js').FieldOptions;
20
26
  * @property {string} [title=''] Legend text.
21
27
  * @property {1|2|3} [columns=1] Grid column count.
22
28
  * @property {Record<string, FieldOptions|Field|Element|Component>} [fields={}] Initial fields.
29
+ * @property {string|null} [idPrefix=null] Prefix of the DOM ids generated for the fields, as
30
+ * `<idPrefix>-<key>`. Null generates one per instance, so the same fieldset mounted twice
31
+ * never repeats an id and a field key never collides with an element id elsewhere on the page.
23
32
  */
24
33
  /** @typedef {import('../field/field.js').FieldOptions} FieldOptions */
25
34
  /**
@@ -32,6 +41,7 @@ export declare class Fieldset extends Component<FieldsetOptions> {
32
41
  _origins: Map<any, any>;
33
42
  _fieldIdAttributes: Map<any, any>;
34
43
  _ownedNodes: any[];
44
+ _idPrefix: string;
35
45
  _columnAttribute: string;
36
46
  _grid: HTMLElement;
37
47
  static cssName: string;
@@ -40,7 +50,9 @@ export declare class Fieldset extends Component<FieldsetOptions> {
40
50
  /** @returns {HTMLElement} */
41
51
  render(): HTMLElement;
42
52
  /**
43
- * Adds a field from options, an existing field, an element, or a component.
53
+ * Adds a field from options, an existing field, an element, or a component. The key becomes the
54
+ * field's `name` and its `data-field-id`; the control's DOM id is `<idPrefix>-<key>`, unless the
55
+ * field options give an `id` of their own that differs from the key.
44
56
  * @param {string} id Logical field identifier.
45
57
  * @param {FieldOptions|Field|Element|Component} field Field source.
46
58
  * @returns {Field}
@@ -118,6 +130,12 @@ export declare class Fieldset extends Component<FieldsetOptions> {
118
130
  * @returns {this}
119
131
  */
120
132
  clearHighlights(): this;
133
+ /**
134
+ * The DOM id generated for a field key: unique per instance unless `idPrefix` was given.
135
+ * @param {string} key Field key.
136
+ * @returns {string}
137
+ */
138
+ _controlId(key: string): string;
121
139
  /** @param {Field} field @returns {void} */
122
140
  _releaseField(field: Field): void;
123
141
  /** @returns {void} */
@@ -20,15 +20,22 @@ export type FileItemOptions = {
20
20
  */
21
21
  size?: number | string | null;
22
22
  /**
23
- * MIME type.
23
+ * MIME type. Shown as a readable type ("PDF", "Image"), never as
24
+ * the raw string, and used to pick the icon.
24
25
  */
25
26
  mime?: string;
27
+ /**
28
+ * Type shown beside the size; null derives it from the
29
+ * MIME type (or the name's extension when the MIME type is unfamiliar), an empty string hides it.
30
+ */
31
+ typeLabel?: string | null;
26
32
  /**
27
33
  * Optional supporting text before generated metadata.
28
34
  */
29
35
  subtitle?: EntityRefContent;
30
36
  /**
31
- * File icon name, node, component, or lazy renderer.
37
+ * File icon name, node, component, or lazy renderer. The
38
+ * generic `'file'` glyph gives way to one for the MIME type when the active icon set has it.
32
39
  */
33
40
  icon?: EntityRefIcon;
34
41
  /**
@@ -60,9 +67,9 @@ export type FileItemOptions = {
60
67
  */
61
68
  indeterminate?: boolean;
62
69
  /**
63
- * File-identity presentation size.
70
+ * Size of the file's icon and name.
64
71
  */
65
- density?: 'sm' | 'md' | 'lg';
72
+ identitySize?: 'sm' | 'md' | 'lg';
66
73
  /**
67
74
  * Whether long identity text may wrap.
68
75
  */
@@ -112,6 +119,10 @@ export type FileItemState = {
112
119
  * MIME type.
113
120
  */
114
121
  mime: string;
122
+ /**
123
+ * Explicit type label, or null for the one derived from `mime`.
124
+ */
125
+ typeLabel: string | null;
115
126
  /**
116
127
  * Supporting content.
117
128
  */
@@ -149,9 +160,9 @@ export type FileItemState = {
149
160
  */
150
161
  indeterminate: boolean;
151
162
  /**
152
- * Identity size.
163
+ * Size of the file's icon and name.
153
164
  */
154
- density: 'sm' | 'md' | 'lg';
165
+ identitySize: 'sm' | 'md' | 'lg';
155
166
  /**
156
167
  * Wrapping state.
157
168
  */
@@ -230,5 +241,22 @@ export declare class FileItem extends Component<FileItemOptions> {
230
241
  * @returns {FileItemState}
231
242
  */
232
243
  export declare function normalizeFileItem(values?: Partial<FileItemOptions> | null | undefined): FileItemState;
244
+ /**
245
+ * A readable name for a file's type: "PDF", "CSV", "Image", "Spreadsheet". An unfamiliar MIME type
246
+ * falls back to the name's extension in capitals ("EXE"); without a MIME type, or with neither,
247
+ * the result is empty — a raw MIME string is never shown.
248
+ * @param {string} mime MIME type, possibly with parameters (`text/csv; charset=utf-8`).
249
+ * @param {string} [name=''] File name, consulted only when the MIME type is unfamiliar.
250
+ * @returns {string}
251
+ */
252
+ export declare function fileTypeLabel(mime: string, name?: string): string;
253
+ /**
254
+ * The icon name for a MIME type: a type-specific glyph when the active icon set can draw one,
255
+ * `'file'` otherwise. Font Awesome resolves every name it is given; the bundled inline set only
256
+ * those it carries or that `registerIcons()` added, so a missing glyph never shows a placeholder.
257
+ * @param {string} mime MIME type, possibly with parameters.
258
+ * @returns {string}
259
+ */
260
+ export declare function fileTypeIcon(mime: string): string;
233
261
  /** Fired before a native file link continues. @event FileItem#activate @type {CustomEvent<{id: unknown, file: Readonly<FileItemState>, href: string, event: MouseEvent}>} */
234
262
  /** Fired before a descriptor action callback runs. @event FileItem#action @type {CustomEvent<{id: string, fileId: unknown, action: object, file: Readonly<FileItemState>, event: MouseEvent}>} */
@@ -51,6 +51,12 @@ export type FormOptions = {
51
51
  * Native `novalidate` state.
52
52
  */
53
53
  novalidate?: boolean;
54
+ /**
55
+ * Prefix of the DOM ids generated for the fields of the
56
+ * fieldsets this form builds, as `<idPrefix>-<key>`. Null generates one per form instance, so a
57
+ * form mounted twice never repeats an id. A fieldset's own `idPrefix` wins.
58
+ */
59
+ idPrefix?: string | null;
54
60
  /**
55
61
  * Submit listener.
56
62
  */
@@ -88,6 +94,9 @@ export type FormOptions = {
88
94
  * @property {Array<Fieldset|import('../fieldset/fieldset.js').FieldsetOptions>} [fieldsets=[]] Initial fieldsets.
89
95
  * @property {FormAction[]} [actions=[]] Form action descriptors.
90
96
  * @property {boolean} [novalidate=true] Native `novalidate` state.
97
+ * @property {string|null} [idPrefix=null] Prefix of the DOM ids generated for the fields of the
98
+ * fieldsets this form builds, as `<idPrefix>-<key>`. Null generates one per form instance, so a
99
+ * form mounted twice never repeats an id. A fieldset's own `idPrefix` wins.
91
100
  * @property {(event: CustomEvent<{values: Record<string, unknown>}>) => void} [onsubmit] Submit listener.
92
101
  * @property {(event: CustomEvent<{errors: Record<string, string>}>) => void} [oninvalid] Invalid listener.
93
102
  * @property {(event: CustomEvent<{id: string, value: unknown}>) => void} [onchange] Field change listener.
@@ -104,6 +113,7 @@ export declare class Form extends Component<FormOptions> {
104
113
  _ownedFieldsets: Set<any>;
105
114
  _origins: Map<any, any>;
106
115
  _ownedNodes: any[];
116
+ _idPrefix: string;
107
117
  _novalidateAttribute: string;
108
118
  _body: HTMLElement;
109
119
  _actions: HTMLElement;
@@ -126,7 +136,8 @@ export declare class Form extends Component<FormOptions> {
126
136
  /** @returns {HTMLElement} */
127
137
  render(): HTMLElement;
128
138
  /**
129
- * Adds an existing fieldset or constructs one from options.
139
+ * Adds an existing fieldset or constructs one from options. A constructed fieldset generates its
140
+ * field ids from the form's `idPrefix` unless its options carry their own.
130
141
  * @param {Fieldset|import('../fieldset/fieldset.js').FieldsetOptions} fieldset Fieldset source.
131
142
  * @returns {Fieldset}
132
143
  */
@@ -52,6 +52,12 @@ export type KanbanAssignee = {
52
52
  * Fallback initials.
53
53
  */
54
54
  initials: string;
55
+ /**
56
+ * Fallback tint: a descriptor's own
57
+ * `tone` when it names one of `AVATAR_TONES`, otherwise `avatarTone(name)` — the colour the same
58
+ * person has in every Avatar.
59
+ */
60
+ tone: import('../avatar/avatar.js').AvatarTone;
55
61
  };
56
62
  /**
57
63
  * Normalizes one indicator value into the descriptor the badge is built from. A plain value
@@ -88,6 +94,8 @@ export declare function createKanbanProgress(progress: KanbanProgress, label: st
88
94
  /**
89
95
  * Normalizes one or more responsible people. Names, name lists, and descriptor objects all
90
96
  * resolve to the same shape, and an unsafe image URL degrades to initials rather than failing.
97
+ * A descriptor may name its `tone`; otherwise the tone is derived from the name exactly as Avatar
98
+ * derives it.
91
99
  * @param {unknown} value Raw field value.
92
100
  * @returns {KanbanAssignee[]} Normalized people, in the order supplied.
93
101
  */