@zeyos/zx 2.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +138 -0
- package/DESIGN-SYSTEM.md +96 -0
- package/README.md +29 -39
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +243 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/card/card.d.ts +128 -0
- package/dist/types/components/chart/chart.d.ts +322 -0
- package/dist/types/components/date-picker/month-picker.d.ts +6 -0
- package/dist/types/components/dialog/dialog.d.ts +9 -0
- package/dist/types/components/dock/dock.d.ts +495 -0
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +14 -0
- package/dist/types/components/field-upload/field-upload.d.ts +37 -4
- package/dist/types/components/form/form.d.ts +25 -3
- package/dist/types/components/grid/grid.d.ts +172 -0
- package/dist/types/components/launcher/launcher.d.ts +359 -0
- package/dist/types/components/layout/layout.d.ts +4 -4
- package/dist/types/components/menu-button/menu-button.d.ts +10 -2
- package/dist/types/components/modal/modal.d.ts +25 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +7 -1
- package/dist/types/components/questionnaire/items.d.ts +327 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
- package/dist/types/components/select/select.d.ts +51 -0
- package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
- package/dist/types/components/sheet/sheet.d.ts +294 -0
- package/dist/types/components/split-view/split-view.d.ts +2 -21
- package/dist/types/components/table/table.d.ts +223 -15
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/value-list/value-list.d.ts +24 -3
- package/dist/types/core/dom.d.ts +122 -0
- package/dist/types/core/drag-axis.d.ts +111 -0
- package/dist/types/core/position.d.ts +4 -2
- package/dist/types/index.d.ts +13 -2
- package/dist/types/internal/app-rail.d.ts +265 -0
- package/dist/types/zeyos/icons.d.ts +5 -0
- package/dist/types/zeyos/index.d.ts +2 -1
- package/dist/types/zeyos/launcher.d.ts +147 -0
- package/dist/types/zeyos/select.d.ts +39 -0
- package/dist/zx-zeyos.esm.js +1870 -133
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2006 -267
- package/dist/zx.esm.js +8987 -2757
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8987 -2757
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +4396 -2344
- package/docs/llms.md +463 -86
- package/docs/llms.txt +32 -19
- package/package.json +10 -17
- package/src/components/account-menu/account-menu.css +70 -0
- package/src/components/account-menu/account-menu.js +208 -0
- package/src/components/app-rail/app-rail.css +107 -0
- package/src/components/app-sidebar/app-sidebar.css +80 -0
- package/src/components/app-sidebar/app-sidebar.js +588 -0
- package/src/components/avatar/avatar.css +61 -0
- package/src/components/avatar/avatar.js +222 -0
- package/src/components/button/button.css +0 -1
- package/src/components/card/card.css +149 -0
- package/src/components/card/card.js +285 -0
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +523 -0
- package/src/components/date-picker/month-picker.js +9 -0
- package/src/components/dialog/dialog.js +11 -4
- package/src/components/dock/dock.css +228 -0
- package/src/components/dock/dock.js +977 -0
- package/src/components/dropdown/dropdown.js +1 -1
- package/src/components/field/field.js +2 -0
- package/src/components/field-upload/field-upload.js +9 -4
- package/src/components/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +220 -0
- package/src/components/launcher/launcher.css +210 -0
- package/src/components/launcher/launcher.js +765 -0
- package/src/components/layout/layout.js +2 -2
- package/src/components/menu-button/menu-button.js +27 -2
- package/src/components/modal/modal.css +5 -1
- package/src/components/modal/modal.js +37 -2
- package/src/components/multi-value-editor/multi-value-editor.js +2 -1
- package/src/components/questionnaire/items.js +370 -0
- package/src/components/questionnaire/questionnaire.css +387 -0
- package/src/components/questionnaire/questionnaire.js +1033 -0
- package/src/components/select/field-adapter.js +9 -4
- package/src/components/select/select.css +144 -11
- package/src/components/select/select.js +259 -27
- package/src/components/sheet/sheet-stack.js +304 -0
- package/src/components/sheet/sheet.css +351 -0
- package/src/components/sheet/sheet.js +551 -0
- package/src/components/split-view/split-view.js +76 -161
- package/src/components/table/table.css +43 -0
- package/src/components/table/table.js +531 -52
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +322 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +20 -2
- package/src/internal/app-rail.js +718 -0
- package/src/zeyos/icons.js +8 -3
- package/src/zeyos/index.js +7 -1
- package/src/zeyos/launcher.js +338 -0
- package/src/zeyos/modules.js +1 -0
- package/src/zeyos/select.js +115 -1
- package/styles/tokens/dark.css +2 -3
- package/styles/tokens/global.css +6 -6
- package/styles/tokens/modules.css +1 -0
- package/styles/tokens/semantic.css +5 -3
- package/styles/tokens/themes.css +1 -1
- package/styles/zx.css +11 -1
- package/MIGRATION.md +0 -598
- package/dist/types/compat/base.d.ts +0 -156
- package/dist/types/compat/globals.d.ts +0 -20
- package/dist/types/compat/index.d.ts +0 -128
- package/dist/types/compat/map/basic.d.ts +0 -175
- package/dist/types/compat/map/data.d.ts +0 -102
- package/dist/types/compat/map/date-time.d.ts +0 -80
- package/dist/types/compat/map/factory.d.ts +0 -9
- package/dist/types/compat/map/form.d.ts +0 -98
- package/dist/types/compat/map/helpers.d.ts +0 -12
- package/dist/types/compat/map/http.d.ts +0 -36
- package/dist/types/compat/map/layout.d.ts +0 -106
- package/dist/types/compat/map/options.d.ts +0 -80
- package/dist/types/compat/map/select.d.ts +0 -95
- package/dist/types/compat/map/stubs.d.ts +0 -32
- package/dist/types/compat/map/utilities.d.ts +0 -37
- package/dist/types/compat-entry.d.ts +0 -5
- package/dist/types/components/permission/permission.d.ts +0 -96
- package/dist/zx-compat.esm.js +0 -17484
- package/dist/zx-compat.esm.min.js +0 -1
- package/dist/zx-compat.global.js +0 -23635
- package/dist/zx-compat.global.min.js +0 -3
- package/src/compat/base.js +0 -291
- package/src/compat/globals.js +0 -165
- package/src/compat/index.js +0 -84
- package/src/compat/map/basic.js +0 -464
- package/src/compat/map/data.js +0 -232
- package/src/compat/map/date-time.js +0 -177
- package/src/compat/map/factory.js +0 -45
- package/src/compat/map/form.js +0 -330
- package/src/compat/map/helpers.js +0 -46
- package/src/compat/map/http.js +0 -117
- package/src/compat/map/layout.js +0 -256
- package/src/compat/map/options.js +0 -267
- package/src/compat/map/select.js +0 -198
- package/src/compat/map/stubs.js +0 -26
- package/src/compat/map/utilities.js +0 -113
- package/src/compat-entry.js +0 -11
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -201
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { AppRailPresenter as MinimizedPresenter } from '../../internal/app-rail.js';
|
|
3
|
+
export type AppNavItem = import('../../internal/app-rail.js').AppNavItem;
|
|
4
|
+
export type AppNavSelectDetail = import('../../internal/app-rail.js').AppNavSelectDetail;
|
|
5
|
+
export type AppSidebarOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Application navigation tree.
|
|
8
|
+
*/
|
|
9
|
+
items?: AppNavItem[];
|
|
10
|
+
/**
|
|
11
|
+
* Active item id.
|
|
12
|
+
*/
|
|
13
|
+
active?: string | number | null;
|
|
14
|
+
/**
|
|
15
|
+
* Initially expanded branch ids.
|
|
16
|
+
*/
|
|
17
|
+
expanded?: Array<string | number>;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the minimized presentation is shown.
|
|
20
|
+
*/
|
|
21
|
+
collapsed?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether vertical navigation exposes a mode toggle.
|
|
24
|
+
*/
|
|
25
|
+
collapsible?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Navigation flow; horizontal is always minimized.
|
|
28
|
+
*/
|
|
29
|
+
orientation?: 'vertical' | 'horizontal';
|
|
30
|
+
/**
|
|
31
|
+
* Workspace edge occupied by navigation.
|
|
32
|
+
*/
|
|
33
|
+
side?: 'left' | 'right' | 'top' | 'bottom';
|
|
34
|
+
/**
|
|
35
|
+
* Navigation accessible label.
|
|
36
|
+
*/
|
|
37
|
+
label?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Expanded header content.
|
|
40
|
+
*/
|
|
41
|
+
header?: Node | string | number | {
|
|
42
|
+
toElement: () => Node | null;
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
* Expanded sticky footer content.
|
|
46
|
+
*/
|
|
47
|
+
footer?: Node | string | number | {
|
|
48
|
+
toElement: () => Node | null;
|
|
49
|
+
} | null;
|
|
50
|
+
/**
|
|
51
|
+
* Minimized leading content.
|
|
52
|
+
*/
|
|
53
|
+
railHeader?: Node | string | number | {
|
|
54
|
+
toElement: () => Node | null;
|
|
55
|
+
} | null;
|
|
56
|
+
/**
|
|
57
|
+
* Minimized trailing content.
|
|
58
|
+
*/
|
|
59
|
+
railFooter?: Node | string | number | {
|
|
60
|
+
toElement: () => Node | null;
|
|
61
|
+
} | null;
|
|
62
|
+
/**
|
|
63
|
+
* Minimized flyout hover-open delay.
|
|
64
|
+
*/
|
|
65
|
+
openDelay?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Minimized flyout crossing grace.
|
|
68
|
+
*/
|
|
69
|
+
closeDelay?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Optional host icon renderer.
|
|
72
|
+
*/
|
|
73
|
+
renderIcon?: (item: AppNavItem, context: Record<string, any>) => Node | null;
|
|
74
|
+
/**
|
|
75
|
+
* Preventable action listener.
|
|
76
|
+
*/
|
|
77
|
+
onselect?: (event: CustomEvent<AppNavSelectDetail>) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Branch-state listener.
|
|
80
|
+
*/
|
|
81
|
+
onbranchchange?: (event: CustomEvent<{
|
|
82
|
+
item: AppNavItem | null;
|
|
83
|
+
id: string | number | null;
|
|
84
|
+
expanded: boolean | null;
|
|
85
|
+
ids: Array<string | number>;
|
|
86
|
+
}>) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Presentation-state listener.
|
|
89
|
+
*/
|
|
90
|
+
oncollapsechange?: (event: CustomEvent<{
|
|
91
|
+
collapsed: boolean;
|
|
92
|
+
}>) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Minimized flyout-state listener.
|
|
95
|
+
*/
|
|
96
|
+
onflyoutchange?: (event: CustomEvent<{
|
|
97
|
+
item: AppNavItem;
|
|
98
|
+
id: string | number;
|
|
99
|
+
open: boolean;
|
|
100
|
+
}>) => void;
|
|
101
|
+
};
|
|
102
|
+
/** @typedef {import('../../internal/app-rail.js').AppNavItem} AppNavItem */
|
|
103
|
+
/** @typedef {import('../../internal/app-rail.js').AppNavSelectDetail} AppNavSelectDetail */
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {Object} AppSidebarOptions
|
|
106
|
+
* @property {AppNavItem[]} [items=[]] Application navigation tree.
|
|
107
|
+
* @property {string|number|null} [active=null] Active item id.
|
|
108
|
+
* @property {Array<string|number>} [expanded=[]] Initially expanded branch ids.
|
|
109
|
+
* @property {boolean} [collapsed=false] Whether the minimized presentation is shown.
|
|
110
|
+
* @property {boolean} [collapsible=true] Whether vertical navigation exposes a mode toggle.
|
|
111
|
+
* @property {'vertical'|'horizontal'} [orientation='vertical'] Navigation flow; horizontal is always minimized.
|
|
112
|
+
* @property {'left'|'right'|'top'|'bottom'} [side='left'] Workspace edge occupied by navigation.
|
|
113
|
+
* @property {string} [label='Applications'] Navigation accessible label.
|
|
114
|
+
* @property {Node|string|number|{toElement: () => Node|null}|null} [header=null] Expanded header content.
|
|
115
|
+
* @property {Node|string|number|{toElement: () => Node|null}|null} [footer=null] Expanded sticky footer content.
|
|
116
|
+
* @property {Node|string|number|{toElement: () => Node|null}|null} [railHeader=null] Minimized leading content.
|
|
117
|
+
* @property {Node|string|number|{toElement: () => Node|null}|null} [railFooter=null] Minimized trailing content.
|
|
118
|
+
* @property {number} [openDelay=80] Minimized flyout hover-open delay.
|
|
119
|
+
* @property {number} [closeDelay=160] Minimized flyout crossing grace.
|
|
120
|
+
* @property {(item: AppNavItem, context: Record<string, any>) => Node|null} [renderIcon] Optional host icon renderer.
|
|
121
|
+
* @property {(event: CustomEvent<AppNavSelectDetail>) => void} [onselect] Preventable action listener.
|
|
122
|
+
* @property {(event: CustomEvent<{item: AppNavItem|null, id: string|number|null, expanded: boolean|null, ids: Array<string|number>}>) => void} [onbranchchange] Branch-state listener.
|
|
123
|
+
* @property {(event: CustomEvent<{collapsed: boolean}>) => void} [oncollapsechange] Presentation-state listener.
|
|
124
|
+
* @property {(event: CustomEvent<{item: AppNavItem, id: string|number, open: boolean}>) => void} [onflyoutchange] Minimized flyout-state listener.
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* One application navigation component. Vertical expanded descendants render inline; minimized
|
|
128
|
+
* vertical and horizontal descendants use pointer-, focus-, and keyboard-accessible flyouts.
|
|
129
|
+
* @fires AppSidebar#select
|
|
130
|
+
* @fires AppSidebar#branchchange
|
|
131
|
+
* @fires AppSidebar#collapsechange
|
|
132
|
+
* @fires AppSidebar#flyoutchange
|
|
133
|
+
* @extends {Component<AppSidebarOptions>}
|
|
134
|
+
*/
|
|
135
|
+
export declare class AppSidebar extends Component<AppSidebarOptions> {
|
|
136
|
+
_rail: MinimizedPresenter;
|
|
137
|
+
_railExpandButton: HTMLElement;
|
|
138
|
+
_createdRoot: boolean;
|
|
139
|
+
_original: {
|
|
140
|
+
attributes: string[][];
|
|
141
|
+
children: ChildNode[];
|
|
142
|
+
};
|
|
143
|
+
_items: import("../../internal/app-rail.js").AppNavItem[];
|
|
144
|
+
_active: string | number;
|
|
145
|
+
_expanded: Set<string>;
|
|
146
|
+
_collapsed: boolean;
|
|
147
|
+
_orientation: any;
|
|
148
|
+
_side: "bottom" | "left" | "right" | "top";
|
|
149
|
+
_modeAbort: AbortController;
|
|
150
|
+
static cssName: string;
|
|
151
|
+
/** @type {Readonly<AppSidebarOptions>} */
|
|
152
|
+
static defaults: Readonly<AppSidebarOptions>;
|
|
153
|
+
/**
|
|
154
|
+
* Creates or enhances an application-navigation host.
|
|
155
|
+
* @param {Element|string|null} [target=null] Navigation target.
|
|
156
|
+
* @param {AppSidebarOptions} [options={}] Navigation options.
|
|
157
|
+
*/
|
|
158
|
+
constructor(target?: Element | string | null, options?: AppSidebarOptions);
|
|
159
|
+
/** @returns {HTMLElement} */
|
|
160
|
+
render(): HTMLElement;
|
|
161
|
+
/** Replaces the navigation tree in the active presentation. @param {AppNavItem[]} items @returns {this} */
|
|
162
|
+
setItems(items: AppNavItem[]): this;
|
|
163
|
+
/** Returns a shallow copy of normalized items. @returns {AppNavItem[]} */
|
|
164
|
+
getItems(): AppNavItem[];
|
|
165
|
+
/** Sets the active id without routing. @param {string|number|null} id @returns {this} */
|
|
166
|
+
setActive(id: string | number | null): this;
|
|
167
|
+
/** Replaces expanded branch ids. @param {Array<string|number>} ids @param {{silent?: boolean}} [options={}] @returns {this} */
|
|
168
|
+
setExpanded(ids: Array<string | number>, { silent }?: {
|
|
169
|
+
silent?: boolean;
|
|
170
|
+
}): this;
|
|
171
|
+
/** Returns expanded branch ids in navigation order. @returns {Array<string|number>} */
|
|
172
|
+
getExpanded(): Array<string | number>;
|
|
173
|
+
/** Toggles one inline branch. @param {string|number} id @param {{silent?: boolean}} [options={}] @returns {this} */
|
|
174
|
+
toggleBranch(id: string | number, { silent }?: {
|
|
175
|
+
silent?: boolean;
|
|
176
|
+
}): this;
|
|
177
|
+
/** Shows the expanded vertical presentation. @param {{silent?: boolean}} [options={}] @returns {this} */
|
|
178
|
+
expand(options?: {
|
|
179
|
+
silent?: boolean;
|
|
180
|
+
}): this;
|
|
181
|
+
/** Shows the minimized presentation. @param {{silent?: boolean}} [options={}] @returns {this} */
|
|
182
|
+
collapse(options?: {
|
|
183
|
+
silent?: boolean;
|
|
184
|
+
}): this;
|
|
185
|
+
/** Sets the saved vertical expanded/minimized state. @param {boolean} collapsed @param {{silent?: boolean}} [options={}] @returns {this} */
|
|
186
|
+
setCollapsed(collapsed: boolean, { silent }?: {
|
|
187
|
+
silent?: boolean;
|
|
188
|
+
}): this;
|
|
189
|
+
/** Reports the effective presentation state; horizontal navigation is always minimized. @returns {boolean} */
|
|
190
|
+
isCollapsed(): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Changes navigation flow/edge without replacing state.
|
|
193
|
+
* @param {{orientation?: 'vertical'|'horizontal', side?: 'left'|'right'|'top'|'bottom'}} layout
|
|
194
|
+
* @param {{silent?: boolean}} [options]
|
|
195
|
+
* @returns {this}
|
|
196
|
+
*/
|
|
197
|
+
setLayout(layout?: {
|
|
198
|
+
orientation?: 'vertical' | 'horizontal';
|
|
199
|
+
side?: 'left' | 'right' | 'top' | 'bottom';
|
|
200
|
+
}, { silent }?: {
|
|
201
|
+
silent?: boolean;
|
|
202
|
+
}): this;
|
|
203
|
+
/** Opens a minimized descendant flyout. @param {string|number} id @param {{focus?: boolean}} [options={}] @returns {this} */
|
|
204
|
+
openFlyout(id: string | number, options?: {
|
|
205
|
+
focus?: boolean;
|
|
206
|
+
}): this;
|
|
207
|
+
/** Closes a minimized descendant flyout. @param {string|number} id @returns {this} */
|
|
208
|
+
closeFlyout(id: string | number): this;
|
|
209
|
+
/** Closes every minimized flyout. @returns {this} */
|
|
210
|
+
closeAllFlyouts(): this;
|
|
211
|
+
/** Reports whether a minimized flyout is open. @param {string|number} id @returns {boolean} */
|
|
212
|
+
isFlyoutOpen(id: string | number): boolean;
|
|
213
|
+
/** Focuses the first navigation action. @returns {this} */
|
|
214
|
+
focus(): this;
|
|
215
|
+
/** Destroys flyouts and restores/removes the host. @returns {void} */
|
|
216
|
+
destroy(): void;
|
|
217
|
+
/** Mounts exactly one expanded tree or minimized flyout presentation. @returns {void} */
|
|
218
|
+
_renderMode(): void;
|
|
219
|
+
/** @returns {void} */
|
|
220
|
+
_renderExpanded(): void;
|
|
221
|
+
/** @returns {void} */
|
|
222
|
+
_renderRail(): void;
|
|
223
|
+
/** @param {EventTarget} target @param {string} type @param {EventListener} listener @returns {void} */
|
|
224
|
+
_listenMode(target: EventTarget, type: string, listener: EventListener): void;
|
|
225
|
+
/** @returns {void} */
|
|
226
|
+
_renderTree(): void;
|
|
227
|
+
/** @param {AppNavItem} item @param {number} level @returns {HTMLElement} */
|
|
228
|
+
_treeRow(item: AppNavItem, level: number): HTMLElement;
|
|
229
|
+
/** @param {Event} event @returns {void} */
|
|
230
|
+
_onTreeClick(event: Event): void;
|
|
231
|
+
/** @param {KeyboardEvent} event @returns {void} */
|
|
232
|
+
_onTreeKeydown(event: KeyboardEvent): void;
|
|
233
|
+
/** @param {AppNavItem} item @param {Event} event @returns {void} */
|
|
234
|
+
_select(item: AppNavItem, event: Event): void;
|
|
235
|
+
/** @returns {void} */
|
|
236
|
+
_syncActive(): void;
|
|
237
|
+
/** @returns {void} */
|
|
238
|
+
_reconcileExpanded(): void;
|
|
239
|
+
}
|
|
240
|
+
/** Fired when a destination/action is activated. @event AppSidebar#select @type {CustomEvent<AppNavSelectDetail>} */
|
|
241
|
+
/** Fired when an inline branch changes. @event AppSidebar#branchchange @type {CustomEvent<{item: AppNavItem|null, id: string|number|null, expanded: boolean|null, ids: Array<string|number>}>} */
|
|
242
|
+
/** Fired when expanded/minimized presentation changes. @event AppSidebar#collapsechange @type {CustomEvent<{collapsed: boolean}>} */
|
|
243
|
+
/** Fired when a minimized flyout changes. @event AppSidebar#flyoutchange @type {CustomEvent<{item: AppNavItem, id: string|number, open: boolean}>} */
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type AvatarOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Image URL.
|
|
5
|
+
*/
|
|
6
|
+
src?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Name used to derive fallback initials.
|
|
9
|
+
*/
|
|
10
|
+
name?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Explicit fallback initials.
|
|
13
|
+
*/
|
|
14
|
+
initials?: string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Accessible label; null makes the avatar decorative.
|
|
17
|
+
*/
|
|
18
|
+
label?: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Preset (`sm`, `md`, `lg`) or pixel size.
|
|
21
|
+
*/
|
|
22
|
+
size?: string | number;
|
|
23
|
+
/**
|
|
24
|
+
* Avatar shape.
|
|
25
|
+
*/
|
|
26
|
+
shape?: 'circle' | 'rounded' | 'square';
|
|
27
|
+
/**
|
|
28
|
+
* Optional presence state.
|
|
29
|
+
*/
|
|
30
|
+
status?: 'online' | 'away' | 'busy' | 'offline' | null;
|
|
31
|
+
/**
|
|
32
|
+
* Text alternative for the presence state.
|
|
33
|
+
*/
|
|
34
|
+
statusLabel?: string | null;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {Object} AvatarOptions
|
|
38
|
+
* @property {string|null} [src=null] Image URL.
|
|
39
|
+
* @property {string} [name=''] Name used to derive fallback initials.
|
|
40
|
+
* @property {string|null} [initials=null] Explicit fallback initials.
|
|
41
|
+
* @property {string|null} [label=null] Accessible label; null makes the avatar decorative.
|
|
42
|
+
* @property {string|number} [size='md'] Preset (`sm`, `md`, `lg`) or pixel size.
|
|
43
|
+
* @property {'circle'|'rounded'|'square'} [shape='circle'] Avatar shape.
|
|
44
|
+
* @property {'online'|'away'|'busy'|'offline'|null} [status=null] Optional presence state.
|
|
45
|
+
* @property {string|null} [statusLabel=null] Text alternative for the presence state.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Stable-size user image with deterministic initials fallback and optional presence state.
|
|
49
|
+
* @extends {Component<AvatarOptions>}
|
|
50
|
+
*/
|
|
51
|
+
export declare class Avatar extends Component<AvatarOptions> {
|
|
52
|
+
_createdRoot: boolean;
|
|
53
|
+
_original: {
|
|
54
|
+
attributes: string[][];
|
|
55
|
+
children: ChildNode[];
|
|
56
|
+
};
|
|
57
|
+
_state: {
|
|
58
|
+
src: string;
|
|
59
|
+
name: string;
|
|
60
|
+
initials: string;
|
|
61
|
+
label: string;
|
|
62
|
+
size: string | number;
|
|
63
|
+
shape: "circle" | "rounded" | "square";
|
|
64
|
+
status: "away" | "busy" | "offline" | "online";
|
|
65
|
+
statusLabel: string;
|
|
66
|
+
};
|
|
67
|
+
static cssName: string;
|
|
68
|
+
/** @type {Readonly<AvatarOptions>} */
|
|
69
|
+
static defaults: Readonly<AvatarOptions>;
|
|
70
|
+
/** @returns {HTMLElement} */
|
|
71
|
+
render(): HTMLElement;
|
|
72
|
+
/**
|
|
73
|
+
* Replaces avatar identity and presentation values.
|
|
74
|
+
* @param {Partial<AvatarOptions>} values New values.
|
|
75
|
+
* @returns {this}
|
|
76
|
+
*/
|
|
77
|
+
set(values?: Partial<AvatarOptions>): this;
|
|
78
|
+
/** Sets the presence state and its text alternative. @param {AvatarOptions['status']} status @param {string|null} [label=null] @returns {this} */
|
|
79
|
+
setStatus(status: AvatarOptions['status'], label?: string | null): this;
|
|
80
|
+
/** Returns whether the image is currently visible. @returns {boolean} */
|
|
81
|
+
hasImage(): boolean;
|
|
82
|
+
/** Restores an enhanced target or removes an owned root. @returns {void} */
|
|
83
|
+
destroy(): void;
|
|
84
|
+
/** @returns {void} */
|
|
85
|
+
_sync(): void;
|
|
86
|
+
/** Synchronizes the standalone accessible name, including valid presence text. @returns {void} */
|
|
87
|
+
_syncLabel(): void;
|
|
88
|
+
/** @param {boolean} visible @returns {void} */
|
|
89
|
+
_showImage(visible: boolean): void;
|
|
90
|
+
/** Ignores a late load/error from a source that has already been replaced. @returns {boolean} */
|
|
91
|
+
_isCurrentImageSource(): boolean;
|
|
92
|
+
/** @returns {void} */
|
|
93
|
+
_syncStatus(): void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Derives at most two uppercase initials from the first and last words of a name.
|
|
97
|
+
* @param {unknown} name Name-like value.
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
export declare function avatarInitials(name: unknown): string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type CardContent = string | Node | Component | null;
|
|
3
|
+
export type ButtonOptions = import('../button/button.js').ButtonOptions;
|
|
4
|
+
export type CardAction = Element | ButtonOptions;
|
|
5
|
+
export type CardLinkDescriptor = {
|
|
6
|
+
/**
|
|
7
|
+
* Native link destination; executable/data schemes are rejected.
|
|
8
|
+
*/
|
|
9
|
+
href: string;
|
|
10
|
+
/**
|
|
11
|
+
* Native browsing context.
|
|
12
|
+
*/
|
|
13
|
+
target?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Native link relationship.
|
|
16
|
+
*/
|
|
17
|
+
rel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Native click listener.
|
|
20
|
+
*/
|
|
21
|
+
onclick?: (event: MouseEvent) => void;
|
|
22
|
+
};
|
|
23
|
+
export type CardLink = string | CardLinkDescriptor | null;
|
|
24
|
+
export type CardOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* Card title.
|
|
27
|
+
*/
|
|
28
|
+
title?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional image, avatar, icon, or other media.
|
|
31
|
+
*/
|
|
32
|
+
media?: CardContent;
|
|
33
|
+
/**
|
|
34
|
+
* Main card content; enhanced children are adopted by default.
|
|
35
|
+
*/
|
|
36
|
+
content?: CardContent;
|
|
37
|
+
/**
|
|
38
|
+
* Secondary native controls beside the title.
|
|
39
|
+
*/
|
|
40
|
+
actions?: CardAction[];
|
|
41
|
+
/**
|
|
42
|
+
* Optional metadata or trailing content.
|
|
43
|
+
*/
|
|
44
|
+
footer?: CardContent;
|
|
45
|
+
/**
|
|
46
|
+
* Optional native primary link rendered around the title.
|
|
47
|
+
*/
|
|
48
|
+
link?: CardLink;
|
|
49
|
+
/**
|
|
50
|
+
* Surface treatment.
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'outlined' | 'raised' | 'filled';
|
|
53
|
+
/**
|
|
54
|
+
* Media/content arrangement.
|
|
55
|
+
*/
|
|
56
|
+
orientation?: 'vertical' | 'horizontal';
|
|
57
|
+
/**
|
|
58
|
+
* Semantic title heading level.
|
|
59
|
+
*/
|
|
60
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
61
|
+
};
|
|
62
|
+
/** @typedef {string|Node|Component|null} CardContent */
|
|
63
|
+
/** @typedef {import('../button/button.js').ButtonOptions} ButtonOptions */
|
|
64
|
+
/** @typedef {Element|ButtonOptions} CardAction */
|
|
65
|
+
/**
|
|
66
|
+
* @typedef {Object} CardLinkDescriptor
|
|
67
|
+
* @property {string} href Native link destination; executable/data schemes are rejected.
|
|
68
|
+
* @property {string} [target] Native browsing context.
|
|
69
|
+
* @property {string} [rel] Native link relationship.
|
|
70
|
+
* @property {(event: MouseEvent) => void} [onclick] Native click listener.
|
|
71
|
+
*/
|
|
72
|
+
/** @typedef {string|CardLinkDescriptor|null} CardLink */
|
|
73
|
+
/**
|
|
74
|
+
* @typedef {Object} CardOptions
|
|
75
|
+
* @property {string} [title=''] Card title.
|
|
76
|
+
* @property {CardContent} [media=null] Optional image, avatar, icon, or other media.
|
|
77
|
+
* @property {CardContent} [content=null] Main card content; enhanced children are adopted by default.
|
|
78
|
+
* @property {CardAction[]} [actions=[]] Secondary native controls beside the title.
|
|
79
|
+
* @property {CardContent} [footer=null] Optional metadata or trailing content.
|
|
80
|
+
* @property {CardLink} [link=null] Optional native primary link rendered around the title.
|
|
81
|
+
* @property {'outlined'|'raised'|'filled'} [variant='outlined'] Surface treatment.
|
|
82
|
+
* @property {'vertical'|'horizontal'} [orientation='vertical'] Media/content arrangement.
|
|
83
|
+
* @property {1|2|3|4|5|6} [headingLevel=3] Semantic title heading level.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* Semantic content or record surface with optional media, native primary link, actions, and footer.
|
|
87
|
+
* The root is never interactive: linked cards keep a real title anchor, so secondary controls are
|
|
88
|
+
* siblings rather than invalid nested actions.
|
|
89
|
+
* @extends {Component<CardOptions>}
|
|
90
|
+
*/
|
|
91
|
+
export declare class Card extends Component<CardOptions> {
|
|
92
|
+
_createdRoot: boolean;
|
|
93
|
+
_original: import("../../core/dom.js").TargetSnapshot;
|
|
94
|
+
_cleaned: boolean;
|
|
95
|
+
_title: string;
|
|
96
|
+
_link: CardLinkDescriptor;
|
|
97
|
+
_actionAbort: AbortController;
|
|
98
|
+
_linkAbort: AbortController;
|
|
99
|
+
static cssName: string;
|
|
100
|
+
/** @type {Readonly<CardOptions>} */
|
|
101
|
+
static defaults: Readonly<CardOptions>;
|
|
102
|
+
/**
|
|
103
|
+
* Creates or enhances one card.
|
|
104
|
+
* @param {Element|string|null} [target=null] Existing card container, selector, or null.
|
|
105
|
+
* @param {CardOptions} [options={}] Card options.
|
|
106
|
+
*/
|
|
107
|
+
constructor(target?: Element | string | null, options?: CardOptions);
|
|
108
|
+
/** @returns {HTMLElement} */
|
|
109
|
+
render(): HTMLElement;
|
|
110
|
+
/** Replaces the card title. @param {string} title Next title. @returns {this} */
|
|
111
|
+
setTitle(title: string): this;
|
|
112
|
+
/** Replaces or removes the media region. @param {CardContent} content Media. @returns {this} */
|
|
113
|
+
setMedia(content: CardContent): this;
|
|
114
|
+
/** Replaces or clears the main content. @param {CardContent} content Content. @returns {this} */
|
|
115
|
+
setContent(content: CardContent): this;
|
|
116
|
+
/** Replaces the secondary action controls. @param {CardAction[]} actions Actions. @returns {this} */
|
|
117
|
+
setActions(actions: CardAction[]): this;
|
|
118
|
+
/** Replaces or removes the footer. @param {CardContent} content Footer. @returns {this} */
|
|
119
|
+
setFooter(content: CardContent): this;
|
|
120
|
+
/** Sets or removes the title's native primary link. @param {CardLink} link Link. @returns {this} */
|
|
121
|
+
setLink(link: CardLink): this;
|
|
122
|
+
/** Restores an enhanced target exactly, or removes an owned card. @returns {void} */
|
|
123
|
+
destroy(): void;
|
|
124
|
+
/** @returns {void} */
|
|
125
|
+
_renderHeading(): void;
|
|
126
|
+
/** @returns {void} */
|
|
127
|
+
_syncHeader(): void;
|
|
128
|
+
}
|