@zeyos/zx 2.1.0 → 2.2.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 +39 -0
- package/README.md +15 -0
- package/dist/types/compat/base.d.ts +156 -0
- package/dist/types/compat/globals.d.ts +20 -0
- package/dist/types/compat/index.d.ts +128 -0
- package/dist/types/compat/map/basic.d.ts +175 -0
- package/dist/types/compat/map/data.d.ts +102 -0
- package/dist/types/compat/map/date-time.d.ts +80 -0
- package/dist/types/compat/map/factory.d.ts +9 -0
- package/dist/types/compat/map/form.d.ts +98 -0
- package/dist/types/compat/map/helpers.d.ts +12 -0
- package/dist/types/compat/map/http.d.ts +36 -0
- package/dist/types/compat/map/layout.d.ts +106 -0
- package/dist/types/compat/map/options.d.ts +80 -0
- package/dist/types/compat/map/select.d.ts +95 -0
- package/dist/types/compat/map/stubs.d.ts +32 -0
- package/dist/types/compat/map/utilities.d.ts +37 -0
- package/dist/types/compat-entry.d.ts +5 -0
- package/dist/types/components/badge/badge.d.ts +46 -0
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +200 -0
- package/dist/types/components/button/button.d.ts +42 -0
- package/dist/types/components/check-button/check-button.d.ts +98 -0
- package/dist/types/components/checklist/checklist.d.ts +143 -0
- package/dist/types/components/checklist/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +130 -0
- package/dist/types/components/copy/copy-button.d.ts +48 -0
- package/dist/types/components/copy/copy-input.d.ts +91 -0
- package/dist/types/components/data-filter/data-filter.d.ts +250 -0
- package/dist/types/components/data-filter/filter-core.d.ts +52 -0
- package/dist/types/components/date-picker/date-picker.d.ts +137 -0
- package/dist/types/components/date-picker/date-range-picker.d.ts +350 -0
- package/dist/types/components/date-picker/field-adapter.d.ts +6 -0
- package/dist/types/components/date-picker/month-picker.d.ts +75 -0
- package/dist/types/components/date-picker/range-field-adapter.d.ts +7 -0
- package/dist/types/components/date-picker/time-picker.d.ts +127 -0
- package/dist/types/components/datebox/date-range-box.d.ts +218 -0
- package/dist/types/components/datebox/datebox.d.ts +160 -0
- package/dist/types/components/datebox/field-adapter.d.ts +5 -0
- package/dist/types/components/dialog/dialog.d.ts +284 -0
- package/dist/types/components/dropdown/dropdown.d.ts +118 -0
- package/dist/types/components/empty-state/empty-state.d.ts +38 -0
- package/dist/types/components/field/field.d.ts +231 -0
- package/dist/types/components/field-upload/field-adapter.d.ts +5 -0
- package/dist/types/components/field-upload/field-upload.d.ts +213 -0
- package/dist/types/components/fieldset/fieldset.d.ts +125 -0
- package/dist/types/components/finder/finder.d.ts +252 -0
- package/dist/types/components/form/form.d.ts +194 -0
- package/dist/types/components/groupbox/groupbox.d.ts +89 -0
- package/dist/types/components/layout/layout.d.ts +132 -0
- package/dist/types/components/loading/inline-loading.d.ts +86 -0
- package/dist/types/components/loading/progress-bar.d.ts +168 -0
- package/dist/types/components/loading/spinner.d.ts +34 -0
- package/dist/types/components/master-panel/master-panel.d.ts +112 -0
- package/dist/types/components/menu-button/menu-button.d.ts +142 -0
- package/dist/types/components/message/message.d.ts +212 -0
- package/dist/types/components/modal/modal.d.ts +105 -0
- package/dist/types/components/multi-value-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +66 -0
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +229 -0
- package/dist/types/components/number-field/field-adapter.d.ts +5 -0
- package/dist/types/components/number-field/number-field.d.ts +292 -0
- package/dist/types/components/pagination/pagination.d.ts +267 -0
- package/dist/types/components/panel/panel.d.ts +194 -0
- package/dist/types/components/permission/permission.d.ts +93 -0
- package/dist/types/components/rating/field-adapter.d.ts +5 -0
- package/dist/types/components/rating/rating.d.ts +213 -0
- package/dist/types/components/search/search.d.ts +98 -0
- package/dist/types/components/select/field-adapter.d.ts +5 -0
- package/dist/types/components/select/filter.d.ts +11 -0
- package/dist/types/components/select/select.d.ts +235 -0
- package/dist/types/components/skeleton/skeleton.d.ts +97 -0
- package/dist/types/components/slider/field-adapter.d.ts +5 -0
- package/dist/types/components/slider/slider.d.ts +216 -0
- package/dist/types/components/split-view/split-view.d.ts +335 -0
- package/dist/types/components/stepper/stepper.d.ts +314 -0
- package/dist/types/components/stepper/steps.d.ts +131 -0
- package/dist/types/components/tabbox/tabbox.d.ts +230 -0
- package/dist/types/components/table/sort.d.ts +49 -0
- package/dist/types/components/table/table.d.ts +872 -0
- package/dist/types/components/tag-picker/field-adapter.d.ts +5 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +375 -0
- package/dist/types/components/timebox/field-adapter.d.ts +5 -0
- package/dist/types/components/timebox/timebox.d.ts +121 -0
- package/dist/types/components/toggle/field-adapter.d.ts +5 -0
- package/dist/types/components/toggle/toggle.d.ts +94 -0
- package/dist/types/components/toolbar/toolbar.d.ts +230 -0
- package/dist/types/components/tooltip/tooltip.d.ts +183 -0
- package/dist/types/components/tree/hierarchy.d.ts +113 -0
- package/dist/types/components/tree/tree.d.ts +383 -0
- package/dist/types/components/truncate/truncate.d.ts +61 -0
- package/dist/types/components/value-list/field-adapter.d.ts +5 -0
- package/dist/types/components/value-list/value-list.d.ts +143 -0
- package/dist/types/core/breakpoint.d.ts +68 -0
- package/dist/types/core/component.d.ts +115 -0
- package/dist/types/core/date.d.ts +50 -0
- package/dist/types/core/dom.d.ts +86 -0
- package/dist/types/core/export.d.ts +70 -0
- package/dist/types/core/fontawesome.d.ts +107 -0
- package/dist/types/core/format.d.ts +107 -0
- package/dist/types/core/http.d.ts +122 -0
- package/dist/types/core/i18n.d.ts +35 -0
- package/dist/types/core/icons.d.ts +137 -0
- package/dist/types/core/keyboard.d.ts +72 -0
- package/dist/types/core/position.d.ts +45 -0
- package/dist/types/core/storage.d.ts +46 -0
- package/dist/types/core/util.d.ts +117 -0
- package/dist/types/elements/define.d.ts +73 -0
- package/dist/types/elements/reflect.d.ts +27 -0
- package/dist/types/index.d.ts +79 -0
- package/dist/types/zeyos/connect.d.ts +65 -0
- package/dist/types/zeyos/form.d.ts +140 -0
- package/dist/types/zeyos/icons.d.ts +104 -0
- package/dist/types/zeyos/index.d.ts +12 -0
- package/dist/types/zeyos/modules.d.ts +110 -0
- package/dist/types/zeyos/query.d.ts +157 -0
- package/dist/types/zeyos/schema.d.ts +79 -0
- package/dist/types/zeyos/select.d.ts +167 -0
- package/dist/types/zeyos/table.d.ts +205 -0
- package/dist/zx-compat.esm.js +362 -33
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +359 -67
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +342 -43
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +68 -6
- package/dist/zx.esm.js +346 -67
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +346 -67
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +48 -2
- package/docs/llms.md +28 -0
- package/package.json +37 -9
- package/src/compat/base.js +291 -0
- package/src/compat/globals.js +165 -0
- package/src/compat/index.js +84 -0
- package/src/compat/map/basic.js +464 -0
- package/src/compat/map/data.js +232 -0
- package/src/compat/map/date-time.js +177 -0
- package/src/compat/map/factory.js +45 -0
- package/src/compat/map/form.js +330 -0
- package/src/compat/map/helpers.js +46 -0
- package/src/compat/map/http.js +117 -0
- package/src/compat/map/layout.js +256 -0
- package/src/compat/map/options.js +267 -0
- package/src/compat/map/select.js +198 -0
- package/src/compat/map/stubs.js +26 -0
- package/src/compat/map/utilities.js +113 -0
- package/src/compat-entry.js +11 -0
- package/src/components/badge/badge.css +147 -0
- package/src/components/badge/badge.js +92 -0
- package/src/components/breadcrumb/breadcrumb.css +105 -0
- package/src/components/breadcrumb/breadcrumb.js +331 -0
- package/src/components/button/button.css +104 -0
- package/src/components/button/button.js +76 -0
- package/src/components/check-button/check-button.css +66 -0
- package/src/components/check-button/check-button.js +167 -0
- package/src/components/checklist/checklist.css +65 -0
- package/src/components/checklist/checklist.js +282 -0
- package/src/components/checklist/field-adapter.js +46 -0
- package/src/components/context-menu/context-menu.css +54 -0
- package/src/components/context-menu/context-menu.js +334 -0
- package/src/components/copy/copy-button.css +27 -0
- package/src/components/copy/copy-button.js +78 -0
- package/src/components/copy/copy-input.css +59 -0
- package/src/components/copy/copy-input.js +123 -0
- package/src/components/data-filter/data-filter.css +53 -0
- package/src/components/data-filter/data-filter.js +400 -0
- package/src/components/data-filter/filter-core.js +128 -0
- package/src/components/date-picker/date-picker.css +181 -0
- package/src/components/date-picker/date-picker.js +500 -0
- package/src/components/date-picker/date-range-picker.css +264 -0
- package/src/components/date-picker/date-range-picker.js +990 -0
- package/src/components/date-picker/field-adapter.js +36 -0
- package/src/components/date-picker/month-picker.js +223 -0
- package/src/components/date-picker/range-field-adapter.js +31 -0
- package/src/components/date-picker/time-picker.css +191 -0
- package/src/components/date-picker/time-picker.js +406 -0
- package/src/components/datebox/date-range-box.css +128 -0
- package/src/components/datebox/date-range-box.js +492 -0
- package/src/components/datebox/datebox.css +108 -0
- package/src/components/datebox/datebox.js +358 -0
- package/src/components/datebox/field-adapter.js +34 -0
- package/src/components/dialog/dialog.css +74 -0
- package/src/components/dialog/dialog.js +450 -0
- package/src/components/dropdown/dropdown.css +24 -0
- package/src/components/dropdown/dropdown.js +288 -0
- package/src/components/empty-state/empty-state.css +80 -0
- package/src/components/empty-state/empty-state.js +92 -0
- package/src/components/field/field.css +127 -0
- package/src/components/field/field.js +605 -0
- package/src/components/field-upload/field-adapter.js +21 -0
- package/src/components/field-upload/field-upload.css +108 -0
- package/src/components/field-upload/field-upload.js +475 -0
- package/src/components/fieldset/fieldset.css +37 -0
- package/src/components/fieldset/fieldset.js +307 -0
- package/src/components/finder/finder.css +98 -0
- package/src/components/finder/finder.js +509 -0
- package/src/components/form/form.css +32 -0
- package/src/components/form/form.js +302 -0
- package/src/components/groupbox/groupbox.css +51 -0
- package/src/components/groupbox/groupbox.js +199 -0
- package/src/components/layout/layout.css +117 -0
- package/src/components/layout/layout.js +136 -0
- package/src/components/loading/inline-loading.css +34 -0
- package/src/components/loading/inline-loading.js +140 -0
- package/src/components/loading/progress-bar.css +115 -0
- package/src/components/loading/progress-bar.js +259 -0
- package/src/components/loading/spinner.css +58 -0
- package/src/components/loading/spinner.js +57 -0
- package/src/components/master-panel/master-panel.css +51 -0
- package/src/components/master-panel/master-panel.js +203 -0
- package/src/components/menu-button/menu-button.css +49 -0
- package/src/components/menu-button/menu-button.js +294 -0
- package/src/components/message/message.css +122 -0
- package/src/components/message/message.js +499 -0
- package/src/components/modal/modal.css +47 -0
- package/src/components/modal/modal.js +203 -0
- package/src/components/multi-value-editor/field-adapter.js +44 -0
- package/src/components/multi-value-editor/multi-value-editor.css +56 -0
- package/src/components/multi-value-editor/multi-value-editor.js +170 -0
- package/src/components/navigation-bar/navigation-bar.css +130 -0
- package/src/components/navigation-bar/navigation-bar.js +450 -0
- package/src/components/number-field/field-adapter.js +40 -0
- package/src/components/number-field/number-field.css +77 -0
- package/src/components/number-field/number-field.js +545 -0
- package/src/components/pagination/pagination.css +95 -0
- package/src/components/pagination/pagination.js +481 -0
- package/src/components/panel/panel.css +123 -0
- package/src/components/panel/panel.js +336 -0
- package/src/components/permission/permission.css +47 -0
- package/src/components/permission/permission.js +198 -0
- package/src/components/rating/field-adapter.js +34 -0
- package/src/components/rating/rating.css +97 -0
- package/src/components/rating/rating.js +395 -0
- package/src/components/search/search.css +70 -0
- package/src/components/search/search.js +193 -0
- package/src/components/select/field-adapter.js +24 -0
- package/src/components/select/filter.js +39 -0
- package/src/components/select/select.css +180 -0
- package/src/components/select/select.js +663 -0
- package/src/components/skeleton/skeleton.css +76 -0
- package/src/components/skeleton/skeleton.js +139 -0
- package/src/components/slider/field-adapter.js +36 -0
- package/src/components/slider/slider.css +181 -0
- package/src/components/slider/slider.js +399 -0
- package/src/components/split-view/split-view.css +139 -0
- package/src/components/split-view/split-view.js +806 -0
- package/src/components/stepper/stepper.css +234 -0
- package/src/components/stepper/stepper.js +459 -0
- package/src/components/stepper/steps.js +131 -0
- package/src/components/tabbox/tabbox.css +281 -0
- package/src/components/tabbox/tabbox.js +484 -0
- package/src/components/table/sort.js +85 -0
- package/src/components/table/table.css +364 -0
- package/src/components/table/table.js +1693 -0
- package/src/components/tag-picker/field-adapter.js +35 -0
- package/src/components/tag-picker/tag-picker.css +169 -0
- package/src/components/tag-picker/tag-picker.js +837 -0
- package/src/components/timebox/field-adapter.js +24 -0
- package/src/components/timebox/timebox.css +51 -0
- package/src/components/timebox/timebox.js +276 -0
- package/src/components/toggle/field-adapter.js +24 -0
- package/src/components/toggle/toggle.css +66 -0
- package/src/components/toggle/toggle.js +150 -0
- package/src/components/toolbar/toolbar.css +81 -0
- package/src/components/toolbar/toolbar.js +511 -0
- package/src/components/tooltip/tooltip.css +36 -0
- package/src/components/tooltip/tooltip.js +420 -0
- package/src/components/tree/hierarchy.js +151 -0
- package/src/components/tree/tree.css +99 -0
- package/src/components/tree/tree.js +784 -0
- package/src/components/truncate/truncate.css +20 -0
- package/src/components/truncate/truncate.js +92 -0
- package/src/components/value-list/field-adapter.js +24 -0
- package/src/components/value-list/value-list.css +108 -0
- package/src/components/value-list/value-list.js +336 -0
- package/src/core/breakpoint.js +150 -0
- package/src/core/component.js +292 -0
- package/src/core/date.js +216 -0
- package/src/core/dom.js +260 -0
- package/src/core/export.js +204 -0
- package/src/core/fontawesome.js +177 -0
- package/src/core/format.js +283 -0
- package/src/core/http.js +246 -0
- package/src/core/i18n.js +83 -0
- package/src/core/icons.js +283 -0
- package/src/core/keyboard.js +240 -0
- package/src/core/position.js +177 -0
- package/src/core/storage.js +175 -0
- package/src/core/util.js +336 -0
- package/src/elements/define.js +715 -0
- package/src/elements/reflect.js +79 -0
- package/src/index.js +131 -0
- package/src/zeyos/connect.js +142 -0
- package/src/zeyos/form.js +254 -0
- package/src/zeyos/icons.js +92 -0
- package/src/zeyos/index.js +21 -0
- package/src/zeyos/modules.js +269 -0
- package/src/zeyos/query.js +199 -0
- package/src/zeyos/schema.js +474 -0
- package/src/zeyos/select.js +175 -0
- package/src/zeyos/table.js +272 -0
- package/styles/base.css +124 -0
- package/styles/icons.css +34 -0
- package/styles/tokens/dark.css +84 -0
- package/styles/tokens/density.css +9 -0
- package/styles/tokens/global.css +80 -0
- package/styles/tokens/modules.css +109 -0
- package/styles/tokens/semantic.css +49 -0
- package/styles/zx.css +61 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export type StackOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Flow direction.
|
|
4
|
+
*/
|
|
5
|
+
direction?: 'column' | 'row';
|
|
6
|
+
/**
|
|
7
|
+
* Space between children. A number 1–8 picks the matching
|
|
8
|
+
* `--zx-space-*` step; a string is used as-is.
|
|
9
|
+
*/
|
|
10
|
+
gap?: number | string;
|
|
11
|
+
/**
|
|
12
|
+
* Cross-axis alignment.
|
|
13
|
+
*/
|
|
14
|
+
align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
15
|
+
/**
|
|
16
|
+
* Main-axis distribution.
|
|
17
|
+
*/
|
|
18
|
+
justify?: 'start' | 'center' | 'end' | 'between' | 'around';
|
|
19
|
+
/**
|
|
20
|
+
* Whether a row wraps.
|
|
21
|
+
*/
|
|
22
|
+
wrap?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the stack is laid out inline.
|
|
25
|
+
*/
|
|
26
|
+
inline?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Extra class names.
|
|
29
|
+
*/
|
|
30
|
+
class?: string;
|
|
31
|
+
};
|
|
32
|
+
export type GridOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* Column count at full width. Null fills the row with as
|
|
35
|
+
* many tracks of `min` width as fit.
|
|
36
|
+
*/
|
|
37
|
+
columns?: number | null;
|
|
38
|
+
/**
|
|
39
|
+
* Narrowest a track may get before the grid drops a
|
|
40
|
+
* column. A number is read as pixels.
|
|
41
|
+
*/
|
|
42
|
+
min?: number | string;
|
|
43
|
+
/**
|
|
44
|
+
* Space between cells, as in `stack`.
|
|
45
|
+
*/
|
|
46
|
+
gap?: number | string;
|
|
47
|
+
/**
|
|
48
|
+
* Block-axis alignment of each cell.
|
|
49
|
+
*/
|
|
50
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
51
|
+
/**
|
|
52
|
+
* Extra class names.
|
|
53
|
+
*/
|
|
54
|
+
class?: string;
|
|
55
|
+
};
|
|
56
|
+
export type AspectOptions = {
|
|
57
|
+
/**
|
|
58
|
+
* Aspect ratio of the box.
|
|
59
|
+
*/
|
|
60
|
+
ratio?: string;
|
|
61
|
+
/**
|
|
62
|
+
* How the single child fills the box.
|
|
63
|
+
*/
|
|
64
|
+
fit?: 'cover' | 'contain' | 'fill';
|
|
65
|
+
/**
|
|
66
|
+
* Extra class names.
|
|
67
|
+
*/
|
|
68
|
+
class?: string;
|
|
69
|
+
};
|
|
70
|
+
export type DomChild = import('../../core/dom.js').DomChild;
|
|
71
|
+
/**
|
|
72
|
+
* @typedef {Object} StackOptions
|
|
73
|
+
* @property {'column'|'row'} [direction='column'] Flow direction.
|
|
74
|
+
* @property {number|string} [gap=4] Space between children. A number 1–8 picks the matching
|
|
75
|
+
* `--zx-space-*` step; a string is used as-is.
|
|
76
|
+
* @property {'start'|'center'|'end'|'stretch'|'baseline'} [align] Cross-axis alignment.
|
|
77
|
+
* @property {'start'|'center'|'end'|'between'|'around'} [justify] Main-axis distribution.
|
|
78
|
+
* @property {boolean} [wrap=false] Whether a row wraps.
|
|
79
|
+
* @property {boolean} [inline=false] Whether the stack is laid out inline.
|
|
80
|
+
* @property {string} [class=''] Extra class names.
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* @typedef {Object} GridOptions
|
|
84
|
+
* @property {number|null} [columns=null] Column count at full width. Null fills the row with as
|
|
85
|
+
* many tracks of `min` width as fit.
|
|
86
|
+
* @property {number|string} [min='16rem'] Narrowest a track may get before the grid drops a
|
|
87
|
+
* column. A number is read as pixels.
|
|
88
|
+
* @property {number|string} [gap=4] Space between cells, as in `stack`.
|
|
89
|
+
* @property {'start'|'center'|'end'|'stretch'} [align] Block-axis alignment of each cell.
|
|
90
|
+
* @property {string} [class=''] Extra class names.
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* @typedef {Object} AspectOptions
|
|
94
|
+
* @property {string} [ratio='16 / 9'] Aspect ratio of the box.
|
|
95
|
+
* @property {'cover'|'contain'|'fill'} [fit='cover'] How the single child fills the box.
|
|
96
|
+
* @property {string} [class=''] Extra class names.
|
|
97
|
+
*/
|
|
98
|
+
/** @typedef {import('../../core/dom.js').DomChild} DomChild */
|
|
99
|
+
/**
|
|
100
|
+
* Creates a one-dimensional flow of children with consistent spacing.
|
|
101
|
+
*
|
|
102
|
+
* Zx ships no page grid on purpose: an ERP screen is a shell of panels, and `SplitView`,
|
|
103
|
+
* `MasterPanel`, and `Panel` already own that layer. `stack` and `grid` are the small pieces that
|
|
104
|
+
* were missing under them — the spacing every form section, toolbar row, and card list was
|
|
105
|
+
* otherwise re-inventing with an ad-hoc flex rule.
|
|
106
|
+
*
|
|
107
|
+
* @param {StackOptions} [options={}] Stack options.
|
|
108
|
+
* @param {...DomChild} children Children.
|
|
109
|
+
* @returns {HTMLDivElement}
|
|
110
|
+
*/
|
|
111
|
+
export declare function stack(options?: StackOptions, ...children: DomChild[]): HTMLDivElement;
|
|
112
|
+
/**
|
|
113
|
+
* Creates a grid that keeps its tracks readable, dropping a column when the container gets too
|
|
114
|
+
* narrow to hold them at `min` width.
|
|
115
|
+
*
|
|
116
|
+
* The reflow is intrinsic — `auto-fit` against a `min` track width — so a grid behaves the same
|
|
117
|
+
* in a full-width page, a split pane, and a modal. Nothing here consults the viewport, which is
|
|
118
|
+
* the usual reason a "responsive" grid still breaks inside a narrow panel.
|
|
119
|
+
*
|
|
120
|
+
* @param {GridOptions} [options={}] Grid options.
|
|
121
|
+
* @param {...DomChild} children Cells.
|
|
122
|
+
* @returns {HTMLDivElement}
|
|
123
|
+
*/
|
|
124
|
+
export declare function grid(options?: GridOptions, ...children: DomChild[]): HTMLDivElement;
|
|
125
|
+
/**
|
|
126
|
+
* Creates a box that holds a fixed aspect ratio whatever its width, so an image, a map, or a
|
|
127
|
+
* chart placeholder reserves its space before it loads.
|
|
128
|
+
* @param {AspectOptions} [options={}] Aspect options.
|
|
129
|
+
* @param {...DomChild} children The single child to fit.
|
|
130
|
+
* @returns {HTMLDivElement}
|
|
131
|
+
*/
|
|
132
|
+
export declare function aspect(options?: AspectOptions, ...children: DomChild[]): HTMLDivElement;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type InlineLoadingOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Initial state.
|
|
5
|
+
*/
|
|
6
|
+
status?: 'inactive' | 'active' | 'success' | 'error';
|
|
7
|
+
/**
|
|
8
|
+
* Text shown beside the indicator.
|
|
9
|
+
*/
|
|
10
|
+
description?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Indicator size.
|
|
13
|
+
*/
|
|
14
|
+
size?: 'sm' | 'md';
|
|
15
|
+
/**
|
|
16
|
+
* Whether state changes are announced through `aria-live`.
|
|
17
|
+
*/
|
|
18
|
+
live?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* State-change listener.
|
|
21
|
+
*/
|
|
22
|
+
onstatuschange?: (event: CustomEvent<{
|
|
23
|
+
status: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}>) => void;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The status line that replaces a spinner once the wait resolves — "Saving…" becoming "Saved" or
|
|
29
|
+
* "Could not save" in the same place, beside the control that started the work.
|
|
30
|
+
*
|
|
31
|
+
* The whole element is one polite live region, so a screen reader hears the outcome without the
|
|
32
|
+
* focus moving. Reach for `Message` instead when the outcome deserves a dismissible notification
|
|
33
|
+
* rather than a line of text that stays put.
|
|
34
|
+
*
|
|
35
|
+
* @fires InlineLoading#statuschange
|
|
36
|
+
* @extends {Component<InlineLoadingOptions>}
|
|
37
|
+
*/
|
|
38
|
+
export declare class InlineLoading extends Component<InlineLoadingOptions> {
|
|
39
|
+
_status: string;
|
|
40
|
+
_description: string;
|
|
41
|
+
_createdRoot: boolean;
|
|
42
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
43
|
+
static cssName: string;
|
|
44
|
+
/** @type {InlineLoadingOptions} */
|
|
45
|
+
static defaults: InlineLoadingOptions;
|
|
46
|
+
/** @returns {HTMLElement} */
|
|
47
|
+
render(): HTMLElement;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the current state.
|
|
50
|
+
* @returns {'inactive'|'active'|'success'|'error'}
|
|
51
|
+
*/
|
|
52
|
+
get(): 'inactive' | 'active' | 'success' | 'error';
|
|
53
|
+
/**
|
|
54
|
+
* Returns the current description.
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
getDescription(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Moves to a state, optionally replacing the description with it.
|
|
60
|
+
* @param {'inactive'|'active'|'success'|'error'} status Next state.
|
|
61
|
+
* @param {string} [description] Replacement description; the current one is kept when omitted.
|
|
62
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress `statuschange`.
|
|
63
|
+
* @returns {this}
|
|
64
|
+
* @fires InlineLoading#statuschange
|
|
65
|
+
*/
|
|
66
|
+
set(status: 'inactive' | 'active' | 'success' | 'error', description?: string, { silent }?: {
|
|
67
|
+
silent?: boolean;
|
|
68
|
+
}): this;
|
|
69
|
+
/**
|
|
70
|
+
* Replaces the description without changing the state.
|
|
71
|
+
* @param {string} description Text beside the indicator.
|
|
72
|
+
* @returns {this}
|
|
73
|
+
*/
|
|
74
|
+
setDescription(description: string): this;
|
|
75
|
+
/** Paints the indicator and the description for the current state. @returns {void} */
|
|
76
|
+
_sync(): void;
|
|
77
|
+
/** @returns {Node[]} */
|
|
78
|
+
_indicator(): Node[];
|
|
79
|
+
/** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
|
|
80
|
+
destroy(): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* State change.
|
|
84
|
+
* @event InlineLoading#statuschange
|
|
85
|
+
* @type {CustomEvent<{status: string, description: string}>}
|
|
86
|
+
*/
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type ProgressBarOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Completed amount, clamped to `[0, max]`.
|
|
5
|
+
*/
|
|
6
|
+
value?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Amount that counts as finished.
|
|
9
|
+
*/
|
|
10
|
+
max?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Visible name of the task.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Supporting line below the track.
|
|
17
|
+
*/
|
|
18
|
+
helperText?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Visual state of the track.
|
|
21
|
+
*/
|
|
22
|
+
status?: 'active' | 'success' | 'error';
|
|
23
|
+
/**
|
|
24
|
+
* Whether the amount done is unknown.
|
|
25
|
+
*/
|
|
26
|
+
indeterminate?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Track thickness.
|
|
29
|
+
*/
|
|
30
|
+
size?: 'md' | 'sm';
|
|
31
|
+
/**
|
|
32
|
+
* Whether the label is kept for assistive technology only.
|
|
33
|
+
*/
|
|
34
|
+
hideLabel?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the formatted value is drawn opposite the label.
|
|
37
|
+
*/
|
|
38
|
+
showValue?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Replaces the
|
|
41
|
+
* default percentage readout.
|
|
42
|
+
*/
|
|
43
|
+
formatValue?: ((value: number, max: number) => string) | null;
|
|
44
|
+
/**
|
|
45
|
+
* Value listener.
|
|
46
|
+
*/
|
|
47
|
+
onchange?: (event: CustomEvent<{
|
|
48
|
+
value: number;
|
|
49
|
+
percent: number;
|
|
50
|
+
}>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Listener for reaching `max`.
|
|
53
|
+
*/
|
|
54
|
+
oncomplete?: (event: CustomEvent<{
|
|
55
|
+
value: number;
|
|
56
|
+
}>) => void;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {Object} ProgressBarOptions
|
|
60
|
+
* @property {number} [value=0] Completed amount, clamped to `[0, max]`.
|
|
61
|
+
* @property {number} [max=100] Amount that counts as finished.
|
|
62
|
+
* @property {string} [label=''] Visible name of the task.
|
|
63
|
+
* @property {string} [helperText=''] Supporting line below the track.
|
|
64
|
+
* @property {'active'|'success'|'error'} [status='active'] Visual state of the track.
|
|
65
|
+
* @property {boolean} [indeterminate=false] Whether the amount done is unknown.
|
|
66
|
+
* @property {'md'|'sm'} [size='md'] Track thickness.
|
|
67
|
+
* @property {boolean} [hideLabel=false] Whether the label is kept for assistive technology only.
|
|
68
|
+
* @property {boolean} [showValue=true] Whether the formatted value is drawn opposite the label.
|
|
69
|
+
* @property {((value: number, max: number) => string)|null} [formatValue=null] Replaces the
|
|
70
|
+
* default percentage readout.
|
|
71
|
+
* @property {(event: CustomEvent<{value: number, percent: number}>) => void} [onchange] Value listener.
|
|
72
|
+
* @property {(event: CustomEvent<{value: number}>) => void} [oncomplete] Listener for reaching `max`.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Determinate progress track for work whose completed share is known — a file upload, a batch
|
|
76
|
+
* posting run, an import.
|
|
77
|
+
*
|
|
78
|
+
* The track carries `role="progressbar"` and its ARIA value attributes, which is what a screen
|
|
79
|
+
* reader reports; an indeterminate bar drops `aria-valuenow` rather than reporting a fake number.
|
|
80
|
+
* `status` is a display concern only: a finished-with-errors bar still reads 100%.
|
|
81
|
+
*
|
|
82
|
+
* @fires ProgressBar#change
|
|
83
|
+
* @fires ProgressBar#complete
|
|
84
|
+
* @extends {Component<ProgressBarOptions>}
|
|
85
|
+
*/
|
|
86
|
+
export declare class ProgressBar extends Component<ProgressBarOptions> {
|
|
87
|
+
_value: number;
|
|
88
|
+
_createdRoot: boolean;
|
|
89
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
90
|
+
_max: number;
|
|
91
|
+
_status: "active" | "error" | "success";
|
|
92
|
+
_indeterminate: boolean;
|
|
93
|
+
_labelId: string;
|
|
94
|
+
static cssName: string;
|
|
95
|
+
/** @type {ProgressBarOptions} */
|
|
96
|
+
static defaults: ProgressBarOptions;
|
|
97
|
+
/** @returns {HTMLElement} */
|
|
98
|
+
render(): HTMLElement;
|
|
99
|
+
/** Current value. @returns {number} */
|
|
100
|
+
get value(): number;
|
|
101
|
+
/** @param {number} next Next value. */
|
|
102
|
+
set value(next: number);
|
|
103
|
+
/**
|
|
104
|
+
* Returns the current value.
|
|
105
|
+
* @returns {number}
|
|
106
|
+
*/
|
|
107
|
+
get(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Sets the completed amount, clamped to `[0, max]`.
|
|
110
|
+
* @param {number} next Completed amount.
|
|
111
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress events.
|
|
112
|
+
* @returns {this}
|
|
113
|
+
* @fires ProgressBar#change
|
|
114
|
+
* @fires ProgressBar#complete
|
|
115
|
+
*/
|
|
116
|
+
set(next: number, { silent }?: {
|
|
117
|
+
silent?: boolean;
|
|
118
|
+
}): this;
|
|
119
|
+
/**
|
|
120
|
+
* Completed share of the track, as a number between 0 and 100.
|
|
121
|
+
* @returns {number}
|
|
122
|
+
*/
|
|
123
|
+
percent(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Replaces the upper bound, re-clamping the current value against it.
|
|
126
|
+
* @param {number} max New maximum.
|
|
127
|
+
* @returns {this}
|
|
128
|
+
*/
|
|
129
|
+
setMax(max: number): this;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the visual state, optionally replacing the helper line with it.
|
|
132
|
+
* @param {'active'|'success'|'error'} status Track state.
|
|
133
|
+
* @param {string} [helperText] Replacement helper line.
|
|
134
|
+
* @returns {this}
|
|
135
|
+
*/
|
|
136
|
+
setStatus(status: 'active' | 'success' | 'error', helperText?: string): this;
|
|
137
|
+
/**
|
|
138
|
+
* Replaces the visible task name.
|
|
139
|
+
* @param {string} label Task name.
|
|
140
|
+
* @returns {this}
|
|
141
|
+
*/
|
|
142
|
+
setLabel(label: string): this;
|
|
143
|
+
/**
|
|
144
|
+
* Replaces the supporting line below the track.
|
|
145
|
+
* @param {string} helperText Supporting line.
|
|
146
|
+
* @returns {this}
|
|
147
|
+
*/
|
|
148
|
+
setHelperText(helperText: string): this;
|
|
149
|
+
/**
|
|
150
|
+
* Switches between a known and an unknown completed share.
|
|
151
|
+
* @param {boolean} [indeterminate=true] Whether the amount done is unknown.
|
|
152
|
+
* @returns {this}
|
|
153
|
+
*/
|
|
154
|
+
setIndeterminate(indeterminate?: boolean): this;
|
|
155
|
+
/** Paints the track, the readout, and the ARIA value attributes. @returns {void} */
|
|
156
|
+
_sync(): void;
|
|
157
|
+
/** @returns {string} */
|
|
158
|
+
_format(): string;
|
|
159
|
+
/**
|
|
160
|
+
* The readout beside the label: the formatted value, prefixed by a status glyph once the run
|
|
161
|
+
* has finished one way or the other.
|
|
162
|
+
* @param {string} text Formatted value.
|
|
163
|
+
* @returns {Node[]}
|
|
164
|
+
*/
|
|
165
|
+
_readout(text: string): Node[];
|
|
166
|
+
/** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
|
|
167
|
+
destroy(): void;
|
|
168
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type SpinnerOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Ring diameter: 16px, 24px, or 40px.
|
|
4
|
+
*/
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
/**
|
|
7
|
+
* Accessible name. Empty renders a decorative ring that assistive
|
|
8
|
+
* technology skips — correct whenever a nearby element already announces the wait.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the label is also drawn beside the ring.
|
|
13
|
+
*/
|
|
14
|
+
showLabel?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Ring colour: the accent token, or `currentColor`
|
|
17
|
+
* so the ring inherits the colour of the button or badge it sits in.
|
|
18
|
+
*/
|
|
19
|
+
kind?: 'accent' | 'current';
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Creates an indeterminate activity ring for a wait whose duration is unknown.
|
|
23
|
+
*
|
|
24
|
+
* Presentational and stateless: there is nothing to update and nothing to destroy, so this is a
|
|
25
|
+
* factory rather than a component. Use `ProgressBar` when the share of work done is known, and
|
|
26
|
+
* `InlineLoading` when the wait resolves into a success or error message in place.
|
|
27
|
+
*
|
|
28
|
+
* A spinner with a `label` announces itself through `role="status"`; without one it is marked
|
|
29
|
+
* `aria-hidden`, which is what a ring inside an already-labelled button wants.
|
|
30
|
+
*
|
|
31
|
+
* @param {SpinnerOptions} [opts={}] Spinner options.
|
|
32
|
+
* @returns {HTMLSpanElement}
|
|
33
|
+
*/
|
|
34
|
+
export declare function spinner(opts?: SpinnerOptions): HTMLSpanElement;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type MasterPanelContent = string | Node | Component | null;
|
|
3
|
+
export type MasterPanelButtonDescriptor = {
|
|
4
|
+
/**
|
|
5
|
+
* Visible button label.
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Icon name from the kernel icon set.
|
|
10
|
+
*/
|
|
11
|
+
icon?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Visual intent.
|
|
14
|
+
*/
|
|
15
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
16
|
+
/**
|
|
17
|
+
* Control size.
|
|
18
|
+
*/
|
|
19
|
+
size?: 'md' | 'sm';
|
|
20
|
+
/**
|
|
21
|
+
* Whether the button is disabled.
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Native title text.
|
|
26
|
+
*/
|
|
27
|
+
title?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Click callback.
|
|
30
|
+
*/
|
|
31
|
+
onclick?: (event: MouseEvent) => void;
|
|
32
|
+
};
|
|
33
|
+
export type MasterPanelButton = Element | MasterPanelButtonDescriptor;
|
|
34
|
+
export type MasterPanelOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* Header title.
|
|
37
|
+
*/
|
|
38
|
+
title?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Scrollable body content.
|
|
41
|
+
*/
|
|
42
|
+
content?: MasterPanelContent;
|
|
43
|
+
/**
|
|
44
|
+
* Header action elements or button descriptors.
|
|
45
|
+
*/
|
|
46
|
+
buttons?: MasterPanelButton[];
|
|
47
|
+
/**
|
|
48
|
+
* ZeyOS module name used for the header accent.
|
|
49
|
+
*/
|
|
50
|
+
module?: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Optional fixed footer content.
|
|
53
|
+
*/
|
|
54
|
+
footer?: MasterPanelContent;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {Object} MasterPanelOptions
|
|
58
|
+
* @property {string} [title=''] Header title.
|
|
59
|
+
* @property {MasterPanelContent} [content=null] Scrollable body content.
|
|
60
|
+
* @property {MasterPanelButton[]} [buttons=[]] Header action elements or button descriptors.
|
|
61
|
+
* @property {string|null} [module=null] ZeyOS module name used for the header accent.
|
|
62
|
+
* @property {MasterPanelContent} [footer=null] Optional fixed footer content.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Full-height page panel with fixed header and footer bars.
|
|
66
|
+
* @extends {Component<MasterPanelOptions>}
|
|
67
|
+
*/
|
|
68
|
+
export declare class MasterPanel extends Component<MasterPanelOptions> {
|
|
69
|
+
_createdRoot: boolean;
|
|
70
|
+
_original: {
|
|
71
|
+
attributes: Array<[string, string]>;
|
|
72
|
+
children: Node[];
|
|
73
|
+
};
|
|
74
|
+
_cleaned: boolean;
|
|
75
|
+
static cssName: string;
|
|
76
|
+
/** @type {Readonly<MasterPanelOptions>} */
|
|
77
|
+
static defaults: Readonly<MasterPanelOptions>;
|
|
78
|
+
/**
|
|
79
|
+
* Creates or enhances a page-level panel.
|
|
80
|
+
* @param {Element|string|null} target Existing container, selector, or null.
|
|
81
|
+
* @param {MasterPanelOptions} [options={}] Master-panel options.
|
|
82
|
+
*/
|
|
83
|
+
constructor(target: Element | string | null, options?: MasterPanelOptions);
|
|
84
|
+
/** @returns {HTMLElement} */
|
|
85
|
+
render(): HTMLElement;
|
|
86
|
+
/**
|
|
87
|
+
* Replaces the header title.
|
|
88
|
+
* @param {string} title Next title.
|
|
89
|
+
* @returns {this}
|
|
90
|
+
*/
|
|
91
|
+
setTitle(title: string): this;
|
|
92
|
+
/**
|
|
93
|
+
* Replaces the scrollable body.
|
|
94
|
+
* @param {MasterPanelContent} content Next text, node, component, or null to clear.
|
|
95
|
+
* @returns {this}
|
|
96
|
+
*/
|
|
97
|
+
setContent(content: MasterPanelContent): this;
|
|
98
|
+
/**
|
|
99
|
+
* Replaces the header action area.
|
|
100
|
+
* @param {MasterPanelButton[]} list Button descriptors or elements.
|
|
101
|
+
* @returns {this}
|
|
102
|
+
*/
|
|
103
|
+
setButtons(list: MasterPanelButton[]): this;
|
|
104
|
+
/**
|
|
105
|
+
* Replaces or removes the fixed footer.
|
|
106
|
+
* @param {MasterPanelContent} content Next footer content, or null to remove it.
|
|
107
|
+
* @returns {this}
|
|
108
|
+
*/
|
|
109
|
+
setFooter(content: MasterPanelContent): this;
|
|
110
|
+
/** @returns {void} */
|
|
111
|
+
destroy(): void;
|
|
112
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type MenuItem = {
|
|
3
|
+
/**
|
|
4
|
+
* Item label.
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Kernel icon name.
|
|
9
|
+
*/
|
|
10
|
+
icon?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Value emitted on selection.
|
|
13
|
+
*/
|
|
14
|
+
value?: unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Whether selection is disabled.
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the action is dangerous.
|
|
21
|
+
*/
|
|
22
|
+
danger?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Selection callback.
|
|
25
|
+
*/
|
|
26
|
+
onselect?: (value: unknown, item: MenuItem, menuButton: MenuButton) => void;
|
|
27
|
+
};
|
|
28
|
+
export type MenuButtonItem = MenuItem | '-';
|
|
29
|
+
export type MenuButtonOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* Trigger label.
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Trigger icon name.
|
|
36
|
+
*/
|
|
37
|
+
icon?: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Trigger button kind.
|
|
40
|
+
*/
|
|
41
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
42
|
+
/**
|
|
43
|
+
* Menu items and separators.
|
|
44
|
+
*/
|
|
45
|
+
items?: MenuButtonItem[];
|
|
46
|
+
/**
|
|
47
|
+
* Menu placement.
|
|
48
|
+
*/
|
|
49
|
+
placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top';
|
|
50
|
+
/**
|
|
51
|
+
* Select event listener.
|
|
52
|
+
*/
|
|
53
|
+
onselect?: (event: CustomEvent<{
|
|
54
|
+
value: unknown;
|
|
55
|
+
item: MenuItem;
|
|
56
|
+
}>) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Open event listener.
|
|
59
|
+
*/
|
|
60
|
+
onopen?: (event: CustomEvent<Record<string, never>>) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Close event listener.
|
|
63
|
+
*/
|
|
64
|
+
onclose?: (event: CustomEvent<Record<string, never>>) => void;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {Object} MenuItem
|
|
68
|
+
* @property {string} label Item label.
|
|
69
|
+
* @property {string} [icon] Kernel icon name.
|
|
70
|
+
* @property {unknown} [value] Value emitted on selection.
|
|
71
|
+
* @property {boolean} [disabled=false] Whether selection is disabled.
|
|
72
|
+
* @property {boolean} [danger=false] Whether the action is dangerous.
|
|
73
|
+
* @property {(value: unknown, item: MenuItem, menuButton: MenuButton) => void} [onselect] Selection callback.
|
|
74
|
+
*/
|
|
75
|
+
/** @typedef {MenuItem|'-'} MenuButtonItem */
|
|
76
|
+
/**
|
|
77
|
+
* @typedef {Object} MenuButtonOptions
|
|
78
|
+
* @property {string} [label=''] Trigger label.
|
|
79
|
+
* @property {string|null} [icon=null] Trigger icon name.
|
|
80
|
+
* @property {'default'|'primary'|'danger'|'ghost'} [kind='default'] Trigger button kind.
|
|
81
|
+
* @property {MenuButtonItem[]} [items=[]] Menu items and separators.
|
|
82
|
+
* @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'} [placement='bottom-start'] Menu placement.
|
|
83
|
+
* @property {(event: CustomEvent<{value: unknown, item: MenuItem}>) => void} [onselect] Select event listener.
|
|
84
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
85
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close event listener.
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* APG menu-button trigger backed by an anchored Dropdown.
|
|
89
|
+
* @fires MenuButton#select
|
|
90
|
+
* @fires MenuButton#open
|
|
91
|
+
* @fires MenuButton#close
|
|
92
|
+
* @extends {Component<MenuButtonOptions>}
|
|
93
|
+
*/
|
|
94
|
+
export declare class MenuButton extends Component<MenuButtonOptions> {
|
|
95
|
+
#private;
|
|
96
|
+
static cssName: string;
|
|
97
|
+
/** @type {Readonly<MenuButtonOptions>} */
|
|
98
|
+
static defaults: Readonly<MenuButtonOptions>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates or enhances a menu trigger button.
|
|
101
|
+
* @param {HTMLButtonElement|string|null} target Existing button, selector, or null to create one.
|
|
102
|
+
* @param {MenuButtonOptions} [options={}] Menu-button options.
|
|
103
|
+
*/
|
|
104
|
+
constructor(target?: HTMLButtonElement | string | null, options?: MenuButtonOptions);
|
|
105
|
+
/**
|
|
106
|
+
* Creates a trigger when no target was provided.
|
|
107
|
+
* @returns {HTMLButtonElement}
|
|
108
|
+
*/
|
|
109
|
+
render(): HTMLButtonElement;
|
|
110
|
+
/**
|
|
111
|
+
* Replaces menu items and separators.
|
|
112
|
+
* @param {MenuButtonItem[]} items Menu definitions.
|
|
113
|
+
* @returns {this}
|
|
114
|
+
*/
|
|
115
|
+
setItems(items: MenuButtonItem[]): this;
|
|
116
|
+
/**
|
|
117
|
+
* Opens the menu.
|
|
118
|
+
* @returns {this}
|
|
119
|
+
*/
|
|
120
|
+
open(): this;
|
|
121
|
+
/**
|
|
122
|
+
* Closes the menu.
|
|
123
|
+
* @returns {this}
|
|
124
|
+
*/
|
|
125
|
+
close(): this;
|
|
126
|
+
/**
|
|
127
|
+
* Reports whether the menu is open.
|
|
128
|
+
* @returns {boolean}
|
|
129
|
+
*/
|
|
130
|
+
isOpen(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the visible trigger label.
|
|
133
|
+
* @param {string} label Trigger label.
|
|
134
|
+
* @returns {this}
|
|
135
|
+
*/
|
|
136
|
+
setLabel(label: string): this;
|
|
137
|
+
/**
|
|
138
|
+
* Destroys the menu, dropdown panel, and trigger enhancements.
|
|
139
|
+
* @returns {void}
|
|
140
|
+
*/
|
|
141
|
+
destroy(): void;
|
|
142
|
+
}
|