@molecule/app-ui-angular 1.0.1 → 1.0.3
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/LICENSE +111 -24
- package/README.md +2348 -791
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-10-16T23:38:45.669Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-ui-angular
|
|
10
10
|
|
|
11
|
-
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
-
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
-
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
-
|
|
15
11
|
Angular UI components for molecule.dev.
|
|
16
12
|
|
|
17
13
|
Provides standalone Angular components implementing a SUBSET of the
|
|
@@ -24,6 +20,10 @@ component with a `mol-*` selector. Layout/data components (Card, Table,
|
|
|
24
20
|
Tabs, Accordion, Dropdown, Icon, …) are not implemented for Angular yet;
|
|
25
21
|
compose them from ClassMap classes via `getClassMap()`.
|
|
26
22
|
|
|
23
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
24
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
25
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
26
|
+
|
|
27
27
|
## Quick Start
|
|
28
28
|
|
|
29
29
|
```ts
|
|
@@ -68,280 +68,385 @@ npm install @molecule/app-ui-angular @angular/core @angular/platform-browser @mo
|
|
|
68
68
|
|
|
69
69
|
### Interfaces
|
|
70
70
|
|
|
71
|
-
#### `
|
|
71
|
+
#### `CSSProperties`
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Framework-agnostic CSS properties.
|
|
74
|
+
Mirrors React.CSSProperties but without React dependency.
|
|
74
75
|
|
|
75
76
|
```typescript
|
|
76
|
-
interface
|
|
77
|
-
|
|
78
|
-
* Item value/id.
|
|
79
|
-
*/
|
|
80
|
-
value: T
|
|
81
|
-
/**
|
|
82
|
-
* Item header/trigger.
|
|
83
|
-
*/
|
|
84
|
-
header: Children
|
|
85
|
-
/**
|
|
86
|
-
* Item content.
|
|
87
|
-
*/
|
|
88
|
-
content: Children
|
|
89
|
-
/**
|
|
90
|
-
* Whether the item is disabled.
|
|
91
|
-
*/
|
|
92
|
-
disabled?: boolean
|
|
77
|
+
interface CSSProperties {
|
|
78
|
+
[key: string]: string | number | undefined
|
|
93
79
|
}
|
|
94
80
|
```
|
|
95
81
|
|
|
96
|
-
#### `
|
|
82
|
+
#### `BaseProps`
|
|
97
83
|
|
|
98
|
-
|
|
84
|
+
Base props shared by all components.
|
|
99
85
|
|
|
100
86
|
```typescript
|
|
101
|
-
interface
|
|
87
|
+
interface BaseProps {
|
|
102
88
|
/**
|
|
103
|
-
*
|
|
89
|
+
* Additional CSS class name(s).
|
|
104
90
|
*/
|
|
105
|
-
|
|
91
|
+
className?: string
|
|
106
92
|
/**
|
|
107
|
-
*
|
|
93
|
+
* Inline styles.
|
|
108
94
|
*/
|
|
109
|
-
|
|
95
|
+
style?: CSSProperties
|
|
110
96
|
/**
|
|
111
|
-
*
|
|
97
|
+
* Test ID for automated testing.
|
|
112
98
|
*/
|
|
113
|
-
|
|
99
|
+
testId?: string
|
|
114
100
|
/**
|
|
115
|
-
*
|
|
101
|
+
* Automation ID for AI agents and E2E tests. Maps to the `data-mol-id`
|
|
102
|
+
* HTML attribute. Use `molId()` from `./automation.js` to generate
|
|
103
|
+
* semantic IDs. (Tooling only — screen readers do not expose `data-*`
|
|
104
|
+
* attributes; accessible names come from labels/`aria-*`.)
|
|
116
105
|
*/
|
|
117
|
-
|
|
106
|
+
automationId?: string
|
|
118
107
|
/**
|
|
119
|
-
* Whether
|
|
108
|
+
* Whether the component is disabled.
|
|
120
109
|
*/
|
|
121
|
-
|
|
110
|
+
disabled?: boolean
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### `HTMLElementProps`
|
|
115
|
+
|
|
116
|
+
Base props for HTML elements.
|
|
117
|
+
Framework bindings should extend this with framework-specific attributes.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
interface HTMLElementProps extends BaseProps {
|
|
121
|
+
id?: string
|
|
122
|
+
title?: string
|
|
123
|
+
tabIndex?: number
|
|
124
|
+
role?: string
|
|
125
|
+
'aria-label'?: string
|
|
126
|
+
'aria-labelledby'?: string
|
|
127
|
+
'aria-describedby'?: string
|
|
128
|
+
'aria-hidden'?: boolean
|
|
129
|
+
'aria-disabled'?: boolean
|
|
130
|
+
'aria-expanded'?: boolean
|
|
131
|
+
'aria-selected'?: boolean
|
|
132
|
+
'aria-checked'?: boolean | 'mixed'
|
|
133
|
+
'aria-pressed'?: boolean | 'mixed'
|
|
134
|
+
'aria-invalid'?: boolean
|
|
135
|
+
'aria-required'?: boolean
|
|
136
|
+
'aria-readonly'?: boolean
|
|
137
|
+
'aria-busy'?: boolean
|
|
138
|
+
'aria-live'?: 'off' | 'polite' | 'assertive'
|
|
139
|
+
onClick?: MouseEventHandler
|
|
140
|
+
onDoubleClick?: MouseEventHandler
|
|
141
|
+
onMouseEnter?: MouseEventHandler
|
|
142
|
+
onMouseLeave?: MouseEventHandler
|
|
143
|
+
onFocus?: FocusEventHandler
|
|
144
|
+
onBlur?: FocusEventHandler
|
|
145
|
+
onKeyDown?: KeyboardEventHandler
|
|
146
|
+
onKeyUp?: KeyboardEventHandler
|
|
147
|
+
onKeyPress?: KeyboardEventHandler
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### `InputElementProps`
|
|
152
|
+
|
|
153
|
+
Base props for input elements.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
interface InputElementProps extends HTMLElementProps {
|
|
157
|
+
name?: string
|
|
158
|
+
value?: string | number | readonly string[]
|
|
159
|
+
defaultValue?: string | number | readonly string[]
|
|
160
|
+
placeholder?: string
|
|
161
|
+
required?: boolean
|
|
162
|
+
readOnly?: boolean
|
|
163
|
+
autoFocus?: boolean
|
|
164
|
+
autoComplete?: string
|
|
165
|
+
maxLength?: number
|
|
166
|
+
minLength?: number
|
|
167
|
+
pattern?: string
|
|
168
|
+
onChange?: ChangeEventHandler
|
|
169
|
+
onInput?: FormEventHandler
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### `ButtonElementProps`
|
|
174
|
+
|
|
175
|
+
Base props for button elements.
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
interface ButtonElementProps extends HTMLElementProps {
|
|
122
179
|
/**
|
|
123
|
-
*
|
|
180
|
+
* Defaults to `'button'` in every framework binding, so a button never submits a
|
|
181
|
+
* form by accident. A form's primary action must set `type="submit"`: Enter then
|
|
182
|
+
* submits the form, and tests that select `button[type="submit"]` find it.
|
|
124
183
|
*/
|
|
125
|
-
|
|
184
|
+
type?: 'button' | 'submit' | 'reset'
|
|
185
|
+
name?: string
|
|
186
|
+
value?: string
|
|
187
|
+
form?: string
|
|
126
188
|
}
|
|
127
189
|
```
|
|
128
190
|
|
|
129
|
-
#### `
|
|
191
|
+
#### `TextareaElementProps`
|
|
130
192
|
|
|
131
|
-
|
|
193
|
+
Base props for textarea elements.
|
|
132
194
|
|
|
133
195
|
```typescript
|
|
134
|
-
interface
|
|
196
|
+
interface TextareaElementProps extends HTMLElementProps {
|
|
197
|
+
name?: string
|
|
198
|
+
value?: string
|
|
199
|
+
defaultValue?: string
|
|
200
|
+
placeholder?: string
|
|
201
|
+
required?: boolean
|
|
202
|
+
readOnly?: boolean
|
|
203
|
+
autoFocus?: boolean
|
|
204
|
+
rows?: number
|
|
205
|
+
cols?: number
|
|
206
|
+
maxLength?: number
|
|
207
|
+
minLength?: number
|
|
208
|
+
wrap?: 'hard' | 'soft' | 'off'
|
|
209
|
+
onChange?: ChangeEventHandler
|
|
210
|
+
onInput?: FormEventHandler
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### `SelectElementProps`
|
|
215
|
+
|
|
216
|
+
Base props for select elements.
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
interface SelectElementProps extends HTMLElementProps {
|
|
220
|
+
name?: string
|
|
221
|
+
required?: boolean
|
|
222
|
+
autoFocus?: boolean
|
|
223
|
+
multiple?: boolean
|
|
224
|
+
onChange?: ChangeEventHandler
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### `FormElementProps`
|
|
229
|
+
|
|
230
|
+
Base props for form elements.
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
interface FormElementProps extends HTMLElementProps {
|
|
234
|
+
action?: string
|
|
235
|
+
method?: 'get' | 'post'
|
|
236
|
+
encType?: string
|
|
237
|
+
target?: string
|
|
238
|
+
noValidate?: boolean
|
|
239
|
+
autoComplete?: 'on' | 'off'
|
|
240
|
+
onSubmit?: FormEventHandler
|
|
241
|
+
onReset?: FormEventHandler
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### `ButtonProps`
|
|
246
|
+
|
|
247
|
+
Props for the Button component.
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
interface ButtonProps extends ButtonElementProps {
|
|
135
251
|
/**
|
|
136
|
-
*
|
|
252
|
+
* Button content.
|
|
137
253
|
*/
|
|
138
254
|
children?: Children
|
|
139
255
|
/**
|
|
140
|
-
*
|
|
256
|
+
* Visual variant.
|
|
141
257
|
*/
|
|
142
|
-
|
|
258
|
+
variant?: ButtonVariant
|
|
143
259
|
/**
|
|
144
|
-
*
|
|
260
|
+
* Color scheme.
|
|
145
261
|
*/
|
|
146
|
-
|
|
262
|
+
color?: ColorVariant
|
|
147
263
|
/**
|
|
148
|
-
*
|
|
264
|
+
* Button size.
|
|
149
265
|
*/
|
|
150
|
-
|
|
266
|
+
size?: ButtonSize
|
|
151
267
|
/**
|
|
152
|
-
* Whether the
|
|
268
|
+
* Whether the button is in a loading state.
|
|
153
269
|
*/
|
|
154
|
-
|
|
270
|
+
loading?: boolean
|
|
155
271
|
/**
|
|
156
|
-
*
|
|
272
|
+
* Loading text to display.
|
|
157
273
|
*/
|
|
158
|
-
|
|
274
|
+
loadingText?: string
|
|
159
275
|
/**
|
|
160
|
-
*
|
|
276
|
+
* Whether the button takes full width.
|
|
161
277
|
*/
|
|
162
|
-
|
|
278
|
+
fullWidth?: boolean
|
|
163
279
|
/**
|
|
164
|
-
*
|
|
165
|
-
* @default 'Dismiss'
|
|
280
|
+
* Icon to display before the label.
|
|
166
281
|
*/
|
|
167
|
-
|
|
282
|
+
leftIcon?: Children
|
|
283
|
+
/**
|
|
284
|
+
* Icon to display after the label.
|
|
285
|
+
*/
|
|
286
|
+
rightIcon?: Children
|
|
168
287
|
}
|
|
169
288
|
```
|
|
170
289
|
|
|
171
|
-
#### `
|
|
290
|
+
#### `InputProps`
|
|
172
291
|
|
|
173
|
-
Props for the
|
|
292
|
+
Props for the Input component (text field, email, password, etc.).
|
|
174
293
|
|
|
175
294
|
```typescript
|
|
176
|
-
interface
|
|
295
|
+
interface InputProps extends InputElementProps {
|
|
177
296
|
/**
|
|
178
|
-
*
|
|
297
|
+
* Input type.
|
|
179
298
|
*/
|
|
180
|
-
|
|
299
|
+
type?: InputType
|
|
181
300
|
/**
|
|
182
|
-
*
|
|
301
|
+
* Input size.
|
|
183
302
|
*/
|
|
184
|
-
|
|
303
|
+
size?: Size
|
|
185
304
|
/**
|
|
186
|
-
*
|
|
305
|
+
* Horizontal text alignment inside the input (see
|
|
306
|
+
* {@link InputClassOptions.align}). Defaults to the bond's own style.
|
|
187
307
|
*/
|
|
188
|
-
|
|
308
|
+
align?: 'left' | 'center'
|
|
189
309
|
/**
|
|
190
|
-
*
|
|
310
|
+
* Label text.
|
|
191
311
|
*/
|
|
192
|
-
|
|
312
|
+
label?: string
|
|
193
313
|
/**
|
|
194
|
-
*
|
|
314
|
+
* Error message.
|
|
195
315
|
*/
|
|
196
|
-
|
|
316
|
+
error?: string
|
|
197
317
|
/**
|
|
198
|
-
*
|
|
318
|
+
* Hint/help text.
|
|
199
319
|
*/
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
#### `BadgeProps`
|
|
205
|
-
|
|
206
|
-
Props for the Badge component (status labels, counts, tags).
|
|
207
|
-
|
|
208
|
-
```typescript
|
|
209
|
-
interface BadgeProps extends HTMLElementProps {
|
|
320
|
+
hint?: string
|
|
210
321
|
/**
|
|
211
|
-
*
|
|
322
|
+
* Element to display on the left.
|
|
212
323
|
*/
|
|
213
|
-
|
|
324
|
+
leftElement?: Children
|
|
214
325
|
/**
|
|
215
|
-
*
|
|
326
|
+
* Element to display on the right.
|
|
216
327
|
*/
|
|
217
|
-
|
|
328
|
+
rightElement?: Children
|
|
218
329
|
/**
|
|
219
|
-
*
|
|
330
|
+
* Whether to show a clear button.
|
|
220
331
|
*/
|
|
221
|
-
|
|
332
|
+
clearable?: boolean
|
|
222
333
|
/**
|
|
223
|
-
*
|
|
334
|
+
* Called when the clear button is clicked.
|
|
224
335
|
*/
|
|
225
|
-
|
|
336
|
+
onClear?: () => void
|
|
226
337
|
/**
|
|
227
|
-
*
|
|
338
|
+
* Accessible label for the clear button.
|
|
339
|
+
* @default 'Clear'
|
|
228
340
|
*/
|
|
229
|
-
|
|
341
|
+
clearLabel?: string
|
|
230
342
|
}
|
|
231
343
|
```
|
|
232
344
|
|
|
233
|
-
#### `
|
|
345
|
+
#### `TextareaProps`
|
|
234
346
|
|
|
235
|
-
|
|
347
|
+
Props for the Textarea component.
|
|
236
348
|
|
|
237
349
|
```typescript
|
|
238
|
-
interface
|
|
350
|
+
interface TextareaProps extends TextareaElementProps {
|
|
239
351
|
/**
|
|
240
|
-
*
|
|
352
|
+
* Text size tier (see {@link TextareaClassOptions.size}) — pass the same
|
|
353
|
+
* `size` as a neighboring Input for identical font sizes.
|
|
241
354
|
*/
|
|
242
|
-
|
|
355
|
+
size?: Size
|
|
243
356
|
/**
|
|
244
|
-
*
|
|
357
|
+
* Label text.
|
|
245
358
|
*/
|
|
246
|
-
|
|
359
|
+
label?: string
|
|
247
360
|
/**
|
|
248
|
-
*
|
|
361
|
+
* Error message.
|
|
249
362
|
*/
|
|
250
|
-
|
|
363
|
+
error?: string
|
|
251
364
|
/**
|
|
252
|
-
*
|
|
253
|
-
* HTML attribute. Use `molId()` from `./automation.js` to generate
|
|
254
|
-
* semantic IDs. (Tooling only — screen readers do not expose `data-*`
|
|
255
|
-
* attributes; accessible names come from labels/`aria-*`.)
|
|
365
|
+
* Hint/help text.
|
|
256
366
|
*/
|
|
257
|
-
|
|
367
|
+
hint?: string
|
|
258
368
|
/**
|
|
259
|
-
* Whether the
|
|
369
|
+
* Whether the textarea auto-resizes.
|
|
260
370
|
*/
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
interface ButtonElementProps extends HTMLElementProps {
|
|
271
|
-
type?: 'button' | 'submit' | 'reset'
|
|
272
|
-
name?: string
|
|
273
|
-
value?: string
|
|
274
|
-
form?: string
|
|
371
|
+
autoResize?: boolean
|
|
372
|
+
/**
|
|
373
|
+
* Minimum number of rows.
|
|
374
|
+
*/
|
|
375
|
+
minRows?: number
|
|
376
|
+
/**
|
|
377
|
+
* Maximum number of rows.
|
|
378
|
+
*/
|
|
379
|
+
maxRows?: number
|
|
275
380
|
}
|
|
276
381
|
```
|
|
277
382
|
|
|
278
|
-
#### `
|
|
383
|
+
#### `SelectOption`
|
|
279
384
|
|
|
280
|
-
|
|
385
|
+
A single option in a Select dropdown.
|
|
281
386
|
|
|
282
387
|
```typescript
|
|
283
|
-
interface
|
|
388
|
+
interface SelectOption<T = string> {
|
|
284
389
|
/**
|
|
285
|
-
*
|
|
390
|
+
* Option value.
|
|
286
391
|
*/
|
|
287
|
-
|
|
392
|
+
value: T
|
|
288
393
|
/**
|
|
289
|
-
*
|
|
394
|
+
* Display label.
|
|
290
395
|
*/
|
|
291
|
-
|
|
396
|
+
label: string
|
|
292
397
|
/**
|
|
293
|
-
*
|
|
398
|
+
* Whether the option is disabled.
|
|
294
399
|
*/
|
|
295
|
-
|
|
400
|
+
disabled?: boolean
|
|
296
401
|
/**
|
|
297
|
-
*
|
|
402
|
+
* Option group (for grouped selects).
|
|
298
403
|
*/
|
|
299
|
-
|
|
404
|
+
group?: string
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
#### `SelectProps`
|
|
409
|
+
|
|
410
|
+
Props for the Select dropdown component (single or multi-select).
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
interface SelectProps<T = string> extends SelectElementProps {
|
|
300
414
|
/**
|
|
301
|
-
*
|
|
415
|
+
* Select options.
|
|
302
416
|
*/
|
|
303
|
-
|
|
417
|
+
options: SelectOption<T>[]
|
|
304
418
|
/**
|
|
305
|
-
*
|
|
419
|
+
* Current value.
|
|
306
420
|
*/
|
|
307
|
-
|
|
421
|
+
value?: T
|
|
308
422
|
/**
|
|
309
|
-
*
|
|
423
|
+
* Change handler (with typed value).
|
|
310
424
|
*/
|
|
311
|
-
|
|
425
|
+
onValueChange?: (value: T) => void
|
|
312
426
|
/**
|
|
313
|
-
*
|
|
427
|
+
* Select size.
|
|
314
428
|
*/
|
|
315
|
-
|
|
429
|
+
size?: Size
|
|
316
430
|
/**
|
|
317
|
-
*
|
|
431
|
+
* Label text.
|
|
318
432
|
*/
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
#### `CardProps`
|
|
324
|
-
|
|
325
|
-
Props for the Card container component (elevated, outlined, or filled surface).
|
|
326
|
-
|
|
327
|
-
```typescript
|
|
328
|
-
interface CardProps extends HTMLElementProps {
|
|
433
|
+
label?: string
|
|
329
434
|
/**
|
|
330
|
-
*
|
|
435
|
+
* Placeholder text.
|
|
331
436
|
*/
|
|
332
|
-
|
|
437
|
+
placeholder?: string
|
|
333
438
|
/**
|
|
334
|
-
*
|
|
439
|
+
* Error message.
|
|
335
440
|
*/
|
|
336
|
-
|
|
441
|
+
error?: string
|
|
337
442
|
/**
|
|
338
|
-
*
|
|
443
|
+
* Hint/help text.
|
|
339
444
|
*/
|
|
340
|
-
|
|
445
|
+
hint?: string
|
|
341
446
|
/**
|
|
342
|
-
*
|
|
447
|
+
* Whether to allow clearing the selection.
|
|
343
448
|
*/
|
|
344
|
-
|
|
449
|
+
clearable?: boolean
|
|
345
450
|
}
|
|
346
451
|
```
|
|
347
452
|
|
|
@@ -374,290 +479,95 @@ interface CheckboxProps extends InputElementProps {
|
|
|
374
479
|
}
|
|
375
480
|
```
|
|
376
481
|
|
|
377
|
-
#### `
|
|
482
|
+
#### `RadioOption`
|
|
378
483
|
|
|
379
|
-
|
|
484
|
+
A single option in a RadioGroup.
|
|
380
485
|
|
|
381
486
|
```typescript
|
|
382
|
-
interface
|
|
383
|
-
/**
|
|
384
|
-
* Container content.
|
|
385
|
-
*/
|
|
386
|
-
children?: Children
|
|
487
|
+
interface RadioOption<T = string> {
|
|
387
488
|
/**
|
|
388
|
-
*
|
|
489
|
+
* Option value.
|
|
389
490
|
*/
|
|
390
|
-
|
|
491
|
+
value: T
|
|
391
492
|
/**
|
|
392
|
-
*
|
|
493
|
+
* Display label.
|
|
393
494
|
*/
|
|
394
|
-
|
|
495
|
+
label: Children
|
|
395
496
|
/**
|
|
396
|
-
*
|
|
497
|
+
* Whether the option is disabled.
|
|
397
498
|
*/
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
#### `CSSProperties`
|
|
403
|
-
|
|
404
|
-
Framework-agnostic CSS properties.
|
|
405
|
-
Mirrors React.CSSProperties but without React dependency.
|
|
406
|
-
|
|
407
|
-
```typescript
|
|
408
|
-
interface CSSProperties {
|
|
409
|
-
[key: string]: string | number | undefined
|
|
499
|
+
disabled?: boolean
|
|
410
500
|
}
|
|
411
501
|
```
|
|
412
502
|
|
|
413
|
-
#### `
|
|
503
|
+
#### `RadioGroupProps`
|
|
414
504
|
|
|
415
|
-
|
|
505
|
+
Props for the RadioGroup component.
|
|
416
506
|
|
|
417
507
|
```typescript
|
|
418
|
-
interface
|
|
508
|
+
interface RadioGroupProps<T = string> extends BaseProps {
|
|
419
509
|
/**
|
|
420
|
-
*
|
|
510
|
+
* Radio options.
|
|
421
511
|
*/
|
|
422
|
-
|
|
512
|
+
options: RadioOption<T>[]
|
|
423
513
|
/**
|
|
424
|
-
*
|
|
514
|
+
* Current value.
|
|
425
515
|
*/
|
|
426
|
-
|
|
516
|
+
value?: T
|
|
427
517
|
/**
|
|
428
|
-
*
|
|
518
|
+
* Change handler.
|
|
429
519
|
*/
|
|
430
|
-
|
|
520
|
+
onChange?: (value: T) => void
|
|
431
521
|
/**
|
|
432
|
-
*
|
|
522
|
+
* Radio size.
|
|
433
523
|
*/
|
|
434
|
-
|
|
524
|
+
size?: Size
|
|
435
525
|
/**
|
|
436
|
-
*
|
|
526
|
+
* Group label.
|
|
437
527
|
*/
|
|
438
|
-
|
|
528
|
+
label?: string
|
|
439
529
|
/**
|
|
440
|
-
*
|
|
530
|
+
* Shared `name` attribute for the group's radio inputs (used for native
|
|
531
|
+
* form submission). When omitted, a unique per-instance name is generated
|
|
532
|
+
* so separate groups never merge — the visible `label` is deliberately
|
|
533
|
+
* NOT used as the name, because two groups with the same label (e.g. two
|
|
534
|
+
* "Size" pickers) would otherwise form ONE native radio group and
|
|
535
|
+
* deselect each other.
|
|
441
536
|
*/
|
|
442
|
-
|
|
537
|
+
name?: string
|
|
538
|
+
/**
|
|
539
|
+
* Layout direction.
|
|
540
|
+
*/
|
|
541
|
+
direction?: 'horizontal' | 'vertical'
|
|
542
|
+
/**
|
|
543
|
+
* Error message.
|
|
544
|
+
*/
|
|
545
|
+
error?: string
|
|
443
546
|
}
|
|
444
547
|
```
|
|
445
548
|
|
|
446
|
-
#### `
|
|
549
|
+
#### `SwitchProps`
|
|
447
550
|
|
|
448
|
-
|
|
551
|
+
Props for the Switch/Toggle component.
|
|
449
552
|
|
|
450
553
|
```typescript
|
|
451
|
-
interface
|
|
452
|
-
action?: string
|
|
453
|
-
method?: 'get' | 'post'
|
|
454
|
-
encType?: string
|
|
455
|
-
target?: string
|
|
456
|
-
noValidate?: boolean
|
|
457
|
-
autoComplete?: 'on' | 'off'
|
|
458
|
-
onSubmit?: FormEventHandler
|
|
459
|
-
onReset?: FormEventHandler
|
|
460
|
-
}
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
#### `FormFieldProps`
|
|
464
|
-
|
|
465
|
-
Form field wrapper props.
|
|
466
|
-
|
|
467
|
-
```typescript
|
|
468
|
-
interface FormFieldProps extends HTMLElementProps {
|
|
469
|
-
/**
|
|
470
|
-
* Field content.
|
|
471
|
-
*/
|
|
472
|
-
children?: Children
|
|
473
|
-
/**
|
|
474
|
-
* Field label.
|
|
475
|
-
*/
|
|
476
|
-
label?: string
|
|
477
|
-
/**
|
|
478
|
-
* Field name.
|
|
479
|
-
*/
|
|
480
|
-
name?: string
|
|
481
|
-
/**
|
|
482
|
-
* Error message.
|
|
483
|
-
*/
|
|
484
|
-
error?: string
|
|
485
|
-
/**
|
|
486
|
-
* Hint/help text.
|
|
487
|
-
*/
|
|
488
|
-
hint?: string
|
|
489
|
-
/**
|
|
490
|
-
* Whether the field is required.
|
|
491
|
-
*/
|
|
492
|
-
required?: boolean
|
|
493
|
-
}
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
#### `FormProps`
|
|
497
|
-
|
|
498
|
-
Props for the Form component (wraps inputs with submission handling and validation).
|
|
499
|
-
|
|
500
|
-
```typescript
|
|
501
|
-
interface FormProps extends FormElementProps {
|
|
502
|
-
/**
|
|
503
|
-
* Form content.
|
|
504
|
-
*/
|
|
505
|
-
children?: Children
|
|
506
|
-
/**
|
|
507
|
-
* Submit handler with form data.
|
|
508
|
-
*/
|
|
509
|
-
onFormSubmit?: (data: Record<string, unknown>) => void | Promise<void>
|
|
510
|
-
/**
|
|
511
|
-
* Whether the form is submitting.
|
|
512
|
-
*/
|
|
513
|
-
submitting?: boolean
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
#### `GridProps`
|
|
518
|
-
|
|
519
|
-
Grid container props.
|
|
520
|
-
|
|
521
|
-
```typescript
|
|
522
|
-
interface GridProps extends HTMLElementProps {
|
|
523
|
-
/**
|
|
524
|
-
* Grid content.
|
|
525
|
-
*/
|
|
526
|
-
children?: Children
|
|
527
|
-
/**
|
|
528
|
-
* Number of columns.
|
|
529
|
-
*/
|
|
530
|
-
columns?: number | string
|
|
531
|
-
/**
|
|
532
|
-
* Number of rows.
|
|
533
|
-
*/
|
|
534
|
-
rows?: number | string
|
|
535
|
-
/**
|
|
536
|
-
* Gap between items.
|
|
537
|
-
*/
|
|
538
|
-
gap?: Size | string | number
|
|
539
|
-
/**
|
|
540
|
-
* Column gap.
|
|
541
|
-
*/
|
|
542
|
-
columnGap?: Size | string | number
|
|
554
|
+
interface SwitchProps extends InputElementProps {
|
|
543
555
|
/**
|
|
544
|
-
*
|
|
556
|
+
* Switch label.
|
|
545
557
|
*/
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
#### `HTMLElementProps`
|
|
551
|
-
|
|
552
|
-
Base props for HTML elements.
|
|
553
|
-
Framework bindings should extend this with framework-specific attributes.
|
|
554
|
-
|
|
555
|
-
```typescript
|
|
556
|
-
interface HTMLElementProps extends BaseProps {
|
|
557
|
-
id?: string
|
|
558
|
-
title?: string
|
|
559
|
-
tabIndex?: number
|
|
560
|
-
role?: string
|
|
561
|
-
'aria-label'?: string
|
|
562
|
-
'aria-labelledby'?: string
|
|
563
|
-
'aria-describedby'?: string
|
|
564
|
-
'aria-hidden'?: boolean
|
|
565
|
-
'aria-disabled'?: boolean
|
|
566
|
-
'aria-expanded'?: boolean
|
|
567
|
-
'aria-selected'?: boolean
|
|
568
|
-
'aria-checked'?: boolean | 'mixed'
|
|
569
|
-
'aria-pressed'?: boolean | 'mixed'
|
|
570
|
-
'aria-invalid'?: boolean
|
|
571
|
-
'aria-required'?: boolean
|
|
572
|
-
'aria-readonly'?: boolean
|
|
573
|
-
'aria-busy'?: boolean
|
|
574
|
-
'aria-live'?: 'off' | 'polite' | 'assertive'
|
|
575
|
-
onClick?: MouseEventHandler
|
|
576
|
-
onDoubleClick?: MouseEventHandler
|
|
577
|
-
onMouseEnter?: MouseEventHandler
|
|
578
|
-
onMouseLeave?: MouseEventHandler
|
|
579
|
-
onFocus?: FocusEventHandler
|
|
580
|
-
onBlur?: FocusEventHandler
|
|
581
|
-
onKeyDown?: KeyboardEventHandler
|
|
582
|
-
onKeyUp?: KeyboardEventHandler
|
|
583
|
-
onKeyPress?: KeyboardEventHandler
|
|
584
|
-
}
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
#### `InputElementProps`
|
|
588
|
-
|
|
589
|
-
Base props for input elements.
|
|
590
|
-
|
|
591
|
-
```typescript
|
|
592
|
-
interface InputElementProps extends HTMLElementProps {
|
|
593
|
-
name?: string
|
|
594
|
-
value?: string | number | readonly string[]
|
|
595
|
-
defaultValue?: string | number | readonly string[]
|
|
596
|
-
placeholder?: string
|
|
597
|
-
required?: boolean
|
|
598
|
-
readOnly?: boolean
|
|
599
|
-
autoFocus?: boolean
|
|
600
|
-
autoComplete?: string
|
|
601
|
-
maxLength?: number
|
|
602
|
-
minLength?: number
|
|
603
|
-
pattern?: string
|
|
604
|
-
onChange?: ChangeEventHandler
|
|
605
|
-
onInput?: FormEventHandler
|
|
606
|
-
}
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
#### `InputProps`
|
|
610
|
-
|
|
611
|
-
Props for the Input component (text field, email, password, etc.).
|
|
612
|
-
|
|
613
|
-
```typescript
|
|
614
|
-
interface InputProps extends InputElementProps {
|
|
558
|
+
label?: Children
|
|
615
559
|
/**
|
|
616
|
-
*
|
|
560
|
+
* Whether the switch is on.
|
|
617
561
|
*/
|
|
618
|
-
|
|
562
|
+
checked?: boolean
|
|
619
563
|
/**
|
|
620
|
-
*
|
|
564
|
+
* Switch size.
|
|
621
565
|
*/
|
|
622
566
|
size?: Size
|
|
623
567
|
/**
|
|
624
|
-
*
|
|
625
|
-
* {@link InputClassOptions.align}). Defaults to the bond's own style.
|
|
626
|
-
*/
|
|
627
|
-
align?: 'left' | 'center'
|
|
628
|
-
/**
|
|
629
|
-
* Label text.
|
|
630
|
-
*/
|
|
631
|
-
label?: string
|
|
632
|
-
/**
|
|
633
|
-
* Error message.
|
|
634
|
-
*/
|
|
635
|
-
error?: string
|
|
636
|
-
/**
|
|
637
|
-
* Hint/help text.
|
|
638
|
-
*/
|
|
639
|
-
hint?: string
|
|
640
|
-
/**
|
|
641
|
-
* Element to display on the left.
|
|
642
|
-
*/
|
|
643
|
-
leftElement?: Children
|
|
644
|
-
/**
|
|
645
|
-
* Element to display on the right.
|
|
646
|
-
*/
|
|
647
|
-
rightElement?: Children
|
|
648
|
-
/**
|
|
649
|
-
* Whether to show a clear button.
|
|
650
|
-
*/
|
|
651
|
-
clearable?: boolean
|
|
652
|
-
/**
|
|
653
|
-
* Called when the clear button is clicked.
|
|
654
|
-
*/
|
|
655
|
-
onClear?: () => void
|
|
656
|
-
/**
|
|
657
|
-
* Accessible label for the clear button.
|
|
658
|
-
* @default 'Clear'
|
|
568
|
+
* Color when on.
|
|
659
569
|
*/
|
|
660
|
-
|
|
570
|
+
color?: ColorVariant
|
|
661
571
|
}
|
|
662
572
|
```
|
|
663
573
|
|
|
@@ -719,235 +629,235 @@ interface ModalProps extends HTMLElementProps {
|
|
|
719
629
|
}
|
|
720
630
|
```
|
|
721
631
|
|
|
722
|
-
#### `
|
|
632
|
+
#### `SpinnerProps`
|
|
723
633
|
|
|
724
|
-
Props for the
|
|
634
|
+
Props for the Spinner/loading indicator component.
|
|
725
635
|
|
|
726
636
|
```typescript
|
|
727
|
-
interface
|
|
728
|
-
/**
|
|
729
|
-
* Current page (1-indexed).
|
|
730
|
-
*/
|
|
731
|
-
page: number
|
|
732
|
-
/**
|
|
733
|
-
* Total number of pages.
|
|
734
|
-
*/
|
|
735
|
-
totalPages: number
|
|
736
|
-
/**
|
|
737
|
-
* Page change handler.
|
|
738
|
-
*/
|
|
739
|
-
onChange: (page: number) => void
|
|
740
|
-
/**
|
|
741
|
-
* Number of sibling pages to show.
|
|
742
|
-
*/
|
|
743
|
-
siblings?: number
|
|
744
|
-
/**
|
|
745
|
-
* Number of boundary pages to show.
|
|
746
|
-
*/
|
|
747
|
-
boundaries?: number
|
|
637
|
+
interface SpinnerProps extends BaseProps {
|
|
748
638
|
/**
|
|
749
|
-
*
|
|
639
|
+
* Spinner size.
|
|
750
640
|
*/
|
|
751
641
|
size?: Size
|
|
752
642
|
/**
|
|
753
|
-
*
|
|
643
|
+
* Spinner color.
|
|
754
644
|
*/
|
|
755
|
-
|
|
645
|
+
color?: ColorVariant | string
|
|
756
646
|
/**
|
|
757
|
-
*
|
|
647
|
+
* Loading label (for accessibility).
|
|
758
648
|
*/
|
|
759
|
-
|
|
649
|
+
label?: string
|
|
760
650
|
/**
|
|
761
|
-
*
|
|
651
|
+
* Spinner thickness.
|
|
762
652
|
*/
|
|
763
|
-
|
|
764
|
-
nav?: string
|
|
765
|
-
first?: string
|
|
766
|
-
previous?: string
|
|
767
|
-
next?: string
|
|
768
|
-
last?: string
|
|
769
|
-
goToPage?: (page: number) => string
|
|
770
|
-
}
|
|
653
|
+
thickness?: number
|
|
771
654
|
}
|
|
772
655
|
```
|
|
773
656
|
|
|
774
|
-
#### `
|
|
657
|
+
#### `AvatarProps`
|
|
775
658
|
|
|
776
|
-
Props for the
|
|
659
|
+
Props for the Avatar component.
|
|
777
660
|
|
|
778
661
|
```typescript
|
|
779
|
-
interface
|
|
662
|
+
interface AvatarProps extends HTMLElementProps {
|
|
780
663
|
/**
|
|
781
|
-
*
|
|
664
|
+
* Image source URL.
|
|
782
665
|
*/
|
|
783
|
-
|
|
666
|
+
src?: string
|
|
784
667
|
/**
|
|
785
|
-
*
|
|
668
|
+
* Alt text for the image.
|
|
786
669
|
*/
|
|
787
|
-
|
|
670
|
+
alt?: string
|
|
788
671
|
/**
|
|
789
|
-
*
|
|
790
|
-
*/
|
|
791
|
-
onChange?: (value: T) => void
|
|
792
|
-
/**
|
|
793
|
-
* Radio size.
|
|
794
|
-
*/
|
|
795
|
-
size?: Size
|
|
796
|
-
/**
|
|
797
|
-
* Group label.
|
|
672
|
+
* Name for fallback initials.
|
|
798
673
|
*/
|
|
799
|
-
|
|
674
|
+
name?: string
|
|
800
675
|
/**
|
|
801
|
-
*
|
|
802
|
-
* form submission). When omitted, a unique per-instance name is generated
|
|
803
|
-
* so separate groups never merge — the visible `label` is deliberately
|
|
804
|
-
* NOT used as the name, because two groups with the same label (e.g. two
|
|
805
|
-
* "Size" pickers) would otherwise form ONE native radio group and
|
|
806
|
-
* deselect each other.
|
|
676
|
+
* Avatar size.
|
|
807
677
|
*/
|
|
808
|
-
|
|
678
|
+
size?: Size | number
|
|
809
679
|
/**
|
|
810
|
-
*
|
|
680
|
+
* Whether the avatar is rounded.
|
|
811
681
|
*/
|
|
812
|
-
|
|
682
|
+
rounded?: boolean
|
|
813
683
|
/**
|
|
814
|
-
*
|
|
684
|
+
* Fallback element when no image.
|
|
815
685
|
*/
|
|
816
|
-
|
|
686
|
+
fallback?: Children
|
|
817
687
|
}
|
|
818
688
|
```
|
|
819
689
|
|
|
820
|
-
#### `
|
|
690
|
+
#### `BadgeProps`
|
|
821
691
|
|
|
822
|
-
|
|
692
|
+
Props for the Badge component (status labels, counts, tags).
|
|
823
693
|
|
|
824
694
|
```typescript
|
|
825
|
-
interface
|
|
695
|
+
interface BadgeProps extends HTMLElementProps {
|
|
826
696
|
/**
|
|
827
|
-
*
|
|
697
|
+
* Badge content.
|
|
828
698
|
*/
|
|
829
|
-
|
|
699
|
+
children?: Children
|
|
830
700
|
/**
|
|
831
|
-
*
|
|
701
|
+
* Badge color.
|
|
832
702
|
*/
|
|
833
|
-
|
|
703
|
+
color?: ColorVariant
|
|
834
704
|
/**
|
|
835
|
-
*
|
|
705
|
+
* Badge variant.
|
|
836
706
|
*/
|
|
837
|
-
|
|
707
|
+
variant?: 'solid' | 'outline' | 'subtle'
|
|
708
|
+
/**
|
|
709
|
+
* Badge size.
|
|
710
|
+
*/
|
|
711
|
+
size?: Size
|
|
712
|
+
/**
|
|
713
|
+
* Whether the badge is rounded.
|
|
714
|
+
*/
|
|
715
|
+
rounded?: boolean
|
|
838
716
|
}
|
|
839
717
|
```
|
|
840
718
|
|
|
841
|
-
#### `
|
|
719
|
+
#### `TooltipProps`
|
|
842
720
|
|
|
843
|
-
|
|
721
|
+
Props for the Tooltip component (hover/focus popover with informational text).
|
|
844
722
|
|
|
845
723
|
```typescript
|
|
846
|
-
interface
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
724
|
+
interface TooltipProps extends HTMLElementProps {
|
|
725
|
+
/**
|
|
726
|
+
* Tooltip content.
|
|
727
|
+
*/
|
|
728
|
+
content: Children
|
|
729
|
+
/**
|
|
730
|
+
* Element that triggers the tooltip.
|
|
731
|
+
*/
|
|
732
|
+
children: Children
|
|
733
|
+
/**
|
|
734
|
+
* Tooltip placement.
|
|
735
|
+
*/
|
|
736
|
+
placement?: TooltipPlacement
|
|
737
|
+
/**
|
|
738
|
+
* Delay before showing (ms).
|
|
739
|
+
*/
|
|
740
|
+
delay?: number
|
|
741
|
+
/**
|
|
742
|
+
* Whether the tooltip has an arrow.
|
|
743
|
+
*/
|
|
744
|
+
hasArrow?: boolean
|
|
852
745
|
}
|
|
853
746
|
```
|
|
854
747
|
|
|
855
|
-
#### `
|
|
748
|
+
#### `CardProps`
|
|
856
749
|
|
|
857
|
-
|
|
750
|
+
Props for the Card container component (elevated, outlined, or filled surface).
|
|
858
751
|
|
|
859
752
|
```typescript
|
|
860
|
-
interface
|
|
753
|
+
interface CardProps extends HTMLElementProps {
|
|
861
754
|
/**
|
|
862
|
-
*
|
|
755
|
+
* Card content.
|
|
863
756
|
*/
|
|
864
|
-
|
|
757
|
+
children?: Children
|
|
865
758
|
/**
|
|
866
|
-
*
|
|
759
|
+
* Card variant.
|
|
867
760
|
*/
|
|
868
|
-
|
|
761
|
+
variant?: 'elevated' | 'outlined' | 'filled'
|
|
869
762
|
/**
|
|
870
|
-
* Whether the
|
|
763
|
+
* Whether the card is interactive (clickable).
|
|
871
764
|
*/
|
|
872
|
-
|
|
765
|
+
interactive?: boolean
|
|
873
766
|
/**
|
|
874
|
-
*
|
|
767
|
+
* Padding size.
|
|
875
768
|
*/
|
|
876
|
-
|
|
769
|
+
padding?: Size | 'none'
|
|
877
770
|
}
|
|
878
771
|
```
|
|
879
772
|
|
|
880
|
-
#### `
|
|
773
|
+
#### `ContainerProps`
|
|
881
774
|
|
|
882
|
-
Props for the
|
|
775
|
+
Props for the Container layout component.
|
|
883
776
|
|
|
884
777
|
```typescript
|
|
885
|
-
interface
|
|
778
|
+
interface ContainerProps extends HTMLElementProps {
|
|
886
779
|
/**
|
|
887
|
-
*
|
|
780
|
+
* Container content.
|
|
888
781
|
*/
|
|
889
|
-
|
|
782
|
+
children?: Children
|
|
890
783
|
/**
|
|
891
|
-
*
|
|
784
|
+
* Maximum width.
|
|
892
785
|
*/
|
|
893
|
-
|
|
786
|
+
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | string
|
|
894
787
|
/**
|
|
895
|
-
*
|
|
788
|
+
* Whether to center the container.
|
|
896
789
|
*/
|
|
897
|
-
|
|
790
|
+
centered?: boolean
|
|
898
791
|
/**
|
|
899
|
-
*
|
|
792
|
+
* Horizontal padding.
|
|
900
793
|
*/
|
|
901
|
-
|
|
794
|
+
paddingX?: Size | string
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
#### `FlexProps`
|
|
799
|
+
|
|
800
|
+
Flex container props.
|
|
801
|
+
|
|
802
|
+
```typescript
|
|
803
|
+
interface FlexProps extends HTMLElementProps {
|
|
902
804
|
/**
|
|
903
|
-
*
|
|
805
|
+
* Flex content.
|
|
904
806
|
*/
|
|
905
|
-
|
|
807
|
+
children?: Children
|
|
906
808
|
/**
|
|
907
|
-
*
|
|
809
|
+
* Flex direction.
|
|
908
810
|
*/
|
|
909
|
-
|
|
811
|
+
direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
910
812
|
/**
|
|
911
|
-
*
|
|
813
|
+
* Justify content.
|
|
912
814
|
*/
|
|
913
|
-
|
|
815
|
+
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'
|
|
914
816
|
/**
|
|
915
|
-
*
|
|
817
|
+
* Align items.
|
|
916
818
|
*/
|
|
917
|
-
|
|
819
|
+
align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'
|
|
918
820
|
/**
|
|
919
|
-
*
|
|
821
|
+
* Flex wrap.
|
|
920
822
|
*/
|
|
921
|
-
|
|
823
|
+
wrap?: 'wrap' | 'nowrap' | 'wrap-reverse'
|
|
824
|
+
/**
|
|
825
|
+
* Gap between items.
|
|
826
|
+
*/
|
|
827
|
+
gap?: Size | string | number
|
|
922
828
|
}
|
|
923
829
|
```
|
|
924
830
|
|
|
925
|
-
#### `
|
|
831
|
+
#### `GridProps`
|
|
926
832
|
|
|
927
|
-
|
|
833
|
+
Grid container props.
|
|
928
834
|
|
|
929
835
|
```typescript
|
|
930
|
-
interface
|
|
836
|
+
interface GridProps extends HTMLElementProps {
|
|
931
837
|
/**
|
|
932
|
-
*
|
|
838
|
+
* Grid content.
|
|
933
839
|
*/
|
|
934
|
-
|
|
840
|
+
children?: Children
|
|
935
841
|
/**
|
|
936
|
-
*
|
|
842
|
+
* Number of columns.
|
|
937
843
|
*/
|
|
938
|
-
|
|
844
|
+
columns?: number | string
|
|
939
845
|
/**
|
|
940
|
-
*
|
|
846
|
+
* Number of rows.
|
|
941
847
|
*/
|
|
942
|
-
|
|
848
|
+
rows?: number | string
|
|
943
849
|
/**
|
|
944
|
-
*
|
|
850
|
+
* Gap between items.
|
|
945
851
|
*/
|
|
946
|
-
|
|
852
|
+
gap?: Size | string | number
|
|
947
853
|
/**
|
|
948
|
-
*
|
|
854
|
+
* Column gap.
|
|
949
855
|
*/
|
|
950
|
-
|
|
856
|
+
columnGap?: Size | string | number
|
|
857
|
+
/**
|
|
858
|
+
* Row gap.
|
|
859
|
+
*/
|
|
860
|
+
rowGap?: Size | string | number
|
|
951
861
|
}
|
|
952
862
|
```
|
|
953
863
|
|
|
@@ -968,175 +878,174 @@ interface SpacerProps extends BaseProps {
|
|
|
968
878
|
}
|
|
969
879
|
```
|
|
970
880
|
|
|
971
|
-
#### `
|
|
881
|
+
#### `FormProps`
|
|
972
882
|
|
|
973
|
-
Props for the
|
|
883
|
+
Props for the Form component (wraps inputs with submission handling and validation).
|
|
974
884
|
|
|
975
885
|
```typescript
|
|
976
|
-
interface
|
|
977
|
-
/**
|
|
978
|
-
* Spinner size.
|
|
979
|
-
*/
|
|
980
|
-
size?: Size
|
|
886
|
+
interface FormProps extends FormElementProps {
|
|
981
887
|
/**
|
|
982
|
-
*
|
|
888
|
+
* Form content.
|
|
983
889
|
*/
|
|
984
|
-
|
|
890
|
+
children?: Children
|
|
985
891
|
/**
|
|
986
|
-
*
|
|
892
|
+
* Submit handler with form data.
|
|
987
893
|
*/
|
|
988
|
-
|
|
894
|
+
onFormSubmit?: (data: Record<string, unknown>) => void | Promise<void>
|
|
989
895
|
/**
|
|
990
|
-
*
|
|
896
|
+
* Whether the form is submitting.
|
|
991
897
|
*/
|
|
992
|
-
|
|
898
|
+
submitting?: boolean
|
|
993
899
|
}
|
|
994
900
|
```
|
|
995
901
|
|
|
996
|
-
#### `
|
|
902
|
+
#### `FormFieldProps`
|
|
997
903
|
|
|
998
|
-
|
|
904
|
+
Form field wrapper props.
|
|
999
905
|
|
|
1000
906
|
```typescript
|
|
1001
|
-
interface
|
|
907
|
+
interface FormFieldProps extends HTMLElementProps {
|
|
1002
908
|
/**
|
|
1003
|
-
*
|
|
909
|
+
* Field content.
|
|
1004
910
|
*/
|
|
1005
|
-
|
|
911
|
+
children?: Children
|
|
1006
912
|
/**
|
|
1007
|
-
*
|
|
913
|
+
* Field label.
|
|
1008
914
|
*/
|
|
1009
|
-
|
|
915
|
+
label?: string
|
|
1010
916
|
/**
|
|
1011
|
-
*
|
|
917
|
+
* Field name.
|
|
1012
918
|
*/
|
|
1013
|
-
|
|
919
|
+
name?: string
|
|
1014
920
|
/**
|
|
1015
|
-
*
|
|
921
|
+
* Error message.
|
|
1016
922
|
*/
|
|
1017
|
-
|
|
923
|
+
error?: string
|
|
924
|
+
/**
|
|
925
|
+
* Hint/help text.
|
|
926
|
+
*/
|
|
927
|
+
hint?: string
|
|
928
|
+
/**
|
|
929
|
+
* Whether the field is required.
|
|
930
|
+
*/
|
|
931
|
+
required?: boolean
|
|
1018
932
|
}
|
|
1019
933
|
```
|
|
1020
934
|
|
|
1021
|
-
#### `
|
|
935
|
+
#### `AlertProps`
|
|
1022
936
|
|
|
1023
|
-
|
|
937
|
+
Props for the Alert component.
|
|
1024
938
|
|
|
1025
939
|
```typescript
|
|
1026
|
-
interface
|
|
940
|
+
interface AlertProps extends HTMLElementProps {
|
|
1027
941
|
/**
|
|
1028
|
-
*
|
|
942
|
+
* Alert content.
|
|
1029
943
|
*/
|
|
1030
|
-
|
|
944
|
+
children?: Children
|
|
1031
945
|
/**
|
|
1032
|
-
*
|
|
1033
|
-
*/
|
|
1034
|
-
label: Children
|
|
1035
|
-
/**
|
|
1036
|
-
* Tab content.
|
|
1037
|
-
*/
|
|
1038
|
-
content?: Children
|
|
1039
|
-
/**
|
|
1040
|
-
* Whether the tab is disabled.
|
|
1041
|
-
*/
|
|
1042
|
-
disabled?: boolean
|
|
1043
|
-
/**
|
|
1044
|
-
* Icon to display.
|
|
946
|
+
* Alert title.
|
|
1045
947
|
*/
|
|
1046
|
-
|
|
1047
|
-
}
|
|
1048
|
-
```
|
|
1049
|
-
|
|
1050
|
-
#### `TableColumn`
|
|
1051
|
-
|
|
1052
|
-
Table column definition.
|
|
1053
|
-
|
|
1054
|
-
```typescript
|
|
1055
|
-
interface TableColumn<T> {
|
|
948
|
+
title?: string
|
|
1056
949
|
/**
|
|
1057
|
-
*
|
|
950
|
+
* Alert status/type.
|
|
1058
951
|
*/
|
|
1059
|
-
|
|
952
|
+
status?: ColorVariant
|
|
1060
953
|
/**
|
|
1061
|
-
*
|
|
954
|
+
* Alert variant.
|
|
1062
955
|
*/
|
|
1063
|
-
|
|
956
|
+
variant?: 'solid' | 'subtle' | 'outline' | 'left-accent'
|
|
1064
957
|
/**
|
|
1065
|
-
*
|
|
958
|
+
* Whether the alert is dismissible.
|
|
1066
959
|
*/
|
|
1067
|
-
|
|
960
|
+
dismissible?: boolean
|
|
1068
961
|
/**
|
|
1069
|
-
*
|
|
962
|
+
* Called when dismissed.
|
|
1070
963
|
*/
|
|
1071
|
-
|
|
964
|
+
onDismiss?: () => void
|
|
1072
965
|
/**
|
|
1073
|
-
*
|
|
966
|
+
* Icon to display.
|
|
1074
967
|
*/
|
|
1075
|
-
|
|
968
|
+
icon?: Children
|
|
1076
969
|
/**
|
|
1077
|
-
*
|
|
970
|
+
* Accessible label for the dismiss button.
|
|
971
|
+
* @default 'Dismiss'
|
|
1078
972
|
*/
|
|
1079
|
-
|
|
973
|
+
dismissLabel?: string
|
|
1080
974
|
}
|
|
1081
975
|
```
|
|
1082
976
|
|
|
1083
|
-
#### `
|
|
977
|
+
#### `ToastProps`
|
|
1084
978
|
|
|
1085
|
-
Props for the
|
|
979
|
+
Props for the Toast/notification component.
|
|
1086
980
|
|
|
1087
981
|
```typescript
|
|
1088
|
-
interface
|
|
982
|
+
interface ToastProps extends HTMLElementProps {
|
|
1089
983
|
/**
|
|
1090
|
-
*
|
|
984
|
+
* Toast content.
|
|
1091
985
|
*/
|
|
1092
|
-
|
|
986
|
+
children?: Children
|
|
1093
987
|
/**
|
|
1094
|
-
*
|
|
988
|
+
* Toast title.
|
|
1095
989
|
*/
|
|
1096
|
-
|
|
990
|
+
title?: string
|
|
1097
991
|
/**
|
|
1098
|
-
*
|
|
992
|
+
* Toast description.
|
|
1099
993
|
*/
|
|
1100
|
-
|
|
994
|
+
description?: string
|
|
1101
995
|
/**
|
|
1102
|
-
*
|
|
996
|
+
* Toast status/type.
|
|
1103
997
|
*/
|
|
1104
|
-
|
|
998
|
+
status?: ColorVariant
|
|
1105
999
|
/**
|
|
1106
|
-
*
|
|
1000
|
+
* Duration in milliseconds (0 for persistent).
|
|
1107
1001
|
*/
|
|
1108
|
-
|
|
1002
|
+
duration?: number
|
|
1109
1003
|
/**
|
|
1110
|
-
* Whether
|
|
1004
|
+
* Whether the toast is dismissible.
|
|
1111
1005
|
*/
|
|
1112
|
-
|
|
1006
|
+
dismissible?: boolean
|
|
1113
1007
|
/**
|
|
1114
|
-
*
|
|
1008
|
+
* Called when dismissed.
|
|
1115
1009
|
*/
|
|
1116
|
-
|
|
1010
|
+
onDismiss?: () => void
|
|
1117
1011
|
/**
|
|
1118
|
-
*
|
|
1012
|
+
* Toast position.
|
|
1119
1013
|
*/
|
|
1120
|
-
|
|
1014
|
+
position?: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left'
|
|
1121
1015
|
/**
|
|
1122
|
-
*
|
|
1016
|
+
* Accessible label for the close button.
|
|
1017
|
+
* @default 'Close'
|
|
1123
1018
|
*/
|
|
1124
|
-
|
|
1019
|
+
closeLabel?: string
|
|
1020
|
+
}
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
#### `TabItem`
|
|
1024
|
+
|
|
1025
|
+
A single tab in a Tabs component.
|
|
1026
|
+
|
|
1027
|
+
```typescript
|
|
1028
|
+
interface TabItem<T = string> {
|
|
1125
1029
|
/**
|
|
1126
|
-
*
|
|
1030
|
+
* Tab value/id.
|
|
1127
1031
|
*/
|
|
1128
|
-
|
|
1129
|
-
key: string
|
|
1130
|
-
direction: 'asc' | 'desc'
|
|
1131
|
-
}
|
|
1032
|
+
value: T
|
|
1132
1033
|
/**
|
|
1133
|
-
*
|
|
1034
|
+
* Tab label.
|
|
1134
1035
|
*/
|
|
1135
|
-
|
|
1036
|
+
label: Children
|
|
1136
1037
|
/**
|
|
1137
|
-
*
|
|
1038
|
+
* Tab content.
|
|
1138
1039
|
*/
|
|
1139
|
-
|
|
1040
|
+
content?: Children
|
|
1041
|
+
/**
|
|
1042
|
+
* Whether the tab is disabled.
|
|
1043
|
+
*/
|
|
1044
|
+
disabled?: boolean
|
|
1045
|
+
/**
|
|
1046
|
+
* Icon to display.
|
|
1047
|
+
*/
|
|
1048
|
+
icon?: Children
|
|
1140
1049
|
}
|
|
1141
1050
|
```
|
|
1142
1051
|
|
|
@@ -1177,160 +1086,240 @@ interface TabsProps<T = string> extends BaseProps {
|
|
|
1177
1086
|
}
|
|
1178
1087
|
```
|
|
1179
1088
|
|
|
1180
|
-
#### `
|
|
1089
|
+
#### `AccordionItem`
|
|
1181
1090
|
|
|
1182
|
-
|
|
1091
|
+
A single item in an Accordion component.
|
|
1183
1092
|
|
|
1184
1093
|
```typescript
|
|
1185
|
-
interface
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1094
|
+
interface AccordionItem<T = string> {
|
|
1095
|
+
/**
|
|
1096
|
+
* Item value/id.
|
|
1097
|
+
*/
|
|
1098
|
+
value: T
|
|
1099
|
+
/**
|
|
1100
|
+
* Item header/trigger.
|
|
1101
|
+
*/
|
|
1102
|
+
header: Children
|
|
1103
|
+
/**
|
|
1104
|
+
* Item content.
|
|
1105
|
+
*/
|
|
1106
|
+
content: Children
|
|
1107
|
+
/**
|
|
1108
|
+
* Whether the item is disabled.
|
|
1109
|
+
*/
|
|
1110
|
+
disabled?: boolean
|
|
1200
1111
|
}
|
|
1201
1112
|
```
|
|
1202
1113
|
|
|
1203
|
-
#### `
|
|
1114
|
+
#### `AccordionProps`
|
|
1204
1115
|
|
|
1205
|
-
Props for the
|
|
1116
|
+
Props for the Accordion component.
|
|
1206
1117
|
|
|
1207
1118
|
```typescript
|
|
1208
|
-
interface
|
|
1209
|
-
/**
|
|
1210
|
-
* Text size tier (see {@link TextareaClassOptions.size}) — pass the same
|
|
1211
|
-
* `size` as a neighboring Input for identical font sizes.
|
|
1212
|
-
*/
|
|
1213
|
-
size?: Size
|
|
1119
|
+
interface AccordionProps<T = string> extends BaseProps {
|
|
1214
1120
|
/**
|
|
1215
|
-
*
|
|
1121
|
+
* Accordion items.
|
|
1216
1122
|
*/
|
|
1217
|
-
|
|
1123
|
+
items: AccordionItem<T>[]
|
|
1218
1124
|
/**
|
|
1219
|
-
*
|
|
1125
|
+
* Expanded item(s).
|
|
1220
1126
|
*/
|
|
1221
|
-
|
|
1127
|
+
value?: T | T[]
|
|
1222
1128
|
/**
|
|
1223
|
-
*
|
|
1129
|
+
* Default expanded item(s).
|
|
1224
1130
|
*/
|
|
1225
|
-
|
|
1131
|
+
defaultValue?: T | T[]
|
|
1226
1132
|
/**
|
|
1227
|
-
*
|
|
1133
|
+
* Change handler.
|
|
1228
1134
|
*/
|
|
1229
|
-
|
|
1135
|
+
onChange?: (value: T | T[]) => void
|
|
1230
1136
|
/**
|
|
1231
|
-
*
|
|
1137
|
+
* Whether multiple items can be expanded.
|
|
1232
1138
|
*/
|
|
1233
|
-
|
|
1139
|
+
multiple?: boolean
|
|
1234
1140
|
/**
|
|
1235
|
-
*
|
|
1141
|
+
* Whether items can be collapsed.
|
|
1236
1142
|
*/
|
|
1237
|
-
|
|
1143
|
+
collapsible?: boolean
|
|
1238
1144
|
}
|
|
1239
1145
|
```
|
|
1240
1146
|
|
|
1241
|
-
#### `
|
|
1147
|
+
#### `TableColumn`
|
|
1242
1148
|
|
|
1243
|
-
|
|
1149
|
+
Table column definition.
|
|
1244
1150
|
|
|
1245
1151
|
```typescript
|
|
1246
|
-
interface
|
|
1247
|
-
/**
|
|
1248
|
-
* Toast content.
|
|
1249
|
-
*/
|
|
1250
|
-
children?: Children
|
|
1251
|
-
/**
|
|
1252
|
-
* Toast title.
|
|
1253
|
-
*/
|
|
1254
|
-
title?: string
|
|
1255
|
-
/**
|
|
1256
|
-
* Toast description.
|
|
1257
|
-
*/
|
|
1258
|
-
description?: string
|
|
1152
|
+
interface TableColumn<T> {
|
|
1259
1153
|
/**
|
|
1260
|
-
*
|
|
1154
|
+
* Column key (data property).
|
|
1261
1155
|
*/
|
|
1262
|
-
|
|
1156
|
+
key: keyof T | string
|
|
1263
1157
|
/**
|
|
1264
|
-
*
|
|
1158
|
+
* Column header.
|
|
1265
1159
|
*/
|
|
1266
|
-
|
|
1160
|
+
header: Children
|
|
1267
1161
|
/**
|
|
1268
|
-
*
|
|
1162
|
+
* Custom cell renderer.
|
|
1269
1163
|
*/
|
|
1270
|
-
|
|
1164
|
+
render?: (value: unknown, row: T, index: number) => Children
|
|
1271
1165
|
/**
|
|
1272
|
-
*
|
|
1166
|
+
* Column width.
|
|
1273
1167
|
*/
|
|
1274
|
-
|
|
1168
|
+
width?: string | number
|
|
1275
1169
|
/**
|
|
1276
|
-
*
|
|
1170
|
+
* Whether the column is sortable.
|
|
1277
1171
|
*/
|
|
1278
|
-
|
|
1172
|
+
sortable?: boolean
|
|
1279
1173
|
/**
|
|
1280
|
-
*
|
|
1281
|
-
* @default 'Close'
|
|
1174
|
+
* Text alignment.
|
|
1282
1175
|
*/
|
|
1283
|
-
|
|
1176
|
+
align?: 'left' | 'center' | 'right'
|
|
1284
1177
|
}
|
|
1285
1178
|
```
|
|
1286
1179
|
|
|
1287
|
-
#### `
|
|
1180
|
+
#### `TableProps`
|
|
1288
1181
|
|
|
1289
|
-
Props for the
|
|
1182
|
+
Props for the Table component.
|
|
1290
1183
|
|
|
1291
1184
|
```typescript
|
|
1292
|
-
interface
|
|
1185
|
+
interface TableProps<T> extends HTMLElementProps {
|
|
1293
1186
|
/**
|
|
1294
|
-
*
|
|
1187
|
+
* Table data.
|
|
1295
1188
|
*/
|
|
1296
|
-
|
|
1189
|
+
data: T[]
|
|
1297
1190
|
/**
|
|
1298
|
-
*
|
|
1191
|
+
* Column definitions.
|
|
1299
1192
|
*/
|
|
1300
|
-
|
|
1193
|
+
columns: TableColumn<T>[]
|
|
1301
1194
|
/**
|
|
1302
|
-
*
|
|
1195
|
+
* Row key extractor.
|
|
1303
1196
|
*/
|
|
1304
|
-
|
|
1197
|
+
rowKey?: keyof T | ((row: T) => string | number)
|
|
1305
1198
|
/**
|
|
1306
|
-
*
|
|
1199
|
+
* Whether to show borders.
|
|
1307
1200
|
*/
|
|
1308
|
-
|
|
1201
|
+
bordered?: boolean
|
|
1309
1202
|
/**
|
|
1310
|
-
* Whether
|
|
1203
|
+
* Whether rows are striped.
|
|
1311
1204
|
*/
|
|
1312
|
-
|
|
1205
|
+
striped?: boolean
|
|
1206
|
+
/**
|
|
1207
|
+
* Whether rows are hoverable.
|
|
1208
|
+
*/
|
|
1209
|
+
hoverable?: boolean
|
|
1210
|
+
/**
|
|
1211
|
+
* Table size.
|
|
1212
|
+
*/
|
|
1213
|
+
size?: Size
|
|
1214
|
+
/**
|
|
1215
|
+
* Empty state content.
|
|
1216
|
+
*/
|
|
1217
|
+
emptyContent?: Children
|
|
1218
|
+
/**
|
|
1219
|
+
* Loading state.
|
|
1220
|
+
*/
|
|
1221
|
+
loading?: boolean
|
|
1222
|
+
/**
|
|
1223
|
+
* Sort configuration.
|
|
1224
|
+
*/
|
|
1225
|
+
sort?: {
|
|
1226
|
+
key: string
|
|
1227
|
+
direction: 'asc' | 'desc'
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Sort change handler.
|
|
1231
|
+
*/
|
|
1232
|
+
onSort?: (key: string, direction: 'asc' | 'desc') => void
|
|
1233
|
+
/**
|
|
1234
|
+
* Row click handler.
|
|
1235
|
+
*/
|
|
1236
|
+
onRowClick?: (row: T, index: number) => void
|
|
1313
1237
|
}
|
|
1314
1238
|
```
|
|
1315
1239
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
#### `ButtonVariant`
|
|
1240
|
+
#### `PaginationProps`
|
|
1319
1241
|
|
|
1320
|
-
|
|
1242
|
+
Props for the Pagination component (page navigation with current page, total, page size, and change callbacks).
|
|
1321
1243
|
|
|
1322
1244
|
```typescript
|
|
1323
|
-
|
|
1245
|
+
interface PaginationProps extends BaseProps {
|
|
1246
|
+
/**
|
|
1247
|
+
* Current page (1-indexed).
|
|
1248
|
+
*/
|
|
1249
|
+
page: number
|
|
1250
|
+
/**
|
|
1251
|
+
* Total number of pages.
|
|
1252
|
+
*/
|
|
1253
|
+
totalPages: number
|
|
1254
|
+
/**
|
|
1255
|
+
* Page change handler.
|
|
1256
|
+
*/
|
|
1257
|
+
onChange: (page: number) => void
|
|
1258
|
+
/**
|
|
1259
|
+
* Number of sibling pages to show.
|
|
1260
|
+
*/
|
|
1261
|
+
siblings?: number
|
|
1262
|
+
/**
|
|
1263
|
+
* Number of boundary pages to show.
|
|
1264
|
+
*/
|
|
1265
|
+
boundaries?: number
|
|
1266
|
+
/**
|
|
1267
|
+
* Pagination size.
|
|
1268
|
+
*/
|
|
1269
|
+
size?: Size
|
|
1270
|
+
/**
|
|
1271
|
+
* Whether to show first/last buttons.
|
|
1272
|
+
*/
|
|
1273
|
+
showFirstLast?: boolean
|
|
1274
|
+
/**
|
|
1275
|
+
* Whether to show previous/next buttons.
|
|
1276
|
+
*/
|
|
1277
|
+
showPrevNext?: boolean
|
|
1278
|
+
/**
|
|
1279
|
+
* Accessible labels for pagination controls.
|
|
1280
|
+
*/
|
|
1281
|
+
labels?: {
|
|
1282
|
+
nav?: string
|
|
1283
|
+
first?: string
|
|
1284
|
+
previous?: string
|
|
1285
|
+
next?: string
|
|
1286
|
+
last?: string
|
|
1287
|
+
goToPage?: (page: number) => string
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1324
1290
|
```
|
|
1325
1291
|
|
|
1326
|
-
#### `
|
|
1292
|
+
#### `SkeletonProps`
|
|
1327
1293
|
|
|
1328
|
-
|
|
1294
|
+
Props for the Skeleton loading placeholder component.
|
|
1329
1295
|
|
|
1330
1296
|
```typescript
|
|
1331
|
-
|
|
1297
|
+
interface SkeletonProps extends BaseProps {
|
|
1298
|
+
/**
|
|
1299
|
+
* Skeleton width.
|
|
1300
|
+
*/
|
|
1301
|
+
width?: string | number
|
|
1302
|
+
/**
|
|
1303
|
+
* Skeleton height.
|
|
1304
|
+
*/
|
|
1305
|
+
height?: string | number
|
|
1306
|
+
/**
|
|
1307
|
+
* Whether the skeleton is circular.
|
|
1308
|
+
*/
|
|
1309
|
+
circle?: boolean
|
|
1310
|
+
/**
|
|
1311
|
+
* Border radius.
|
|
1312
|
+
*/
|
|
1313
|
+
borderRadius?: string | number
|
|
1314
|
+
/**
|
|
1315
|
+
* Animation type.
|
|
1316
|
+
*/
|
|
1317
|
+
animation?: 'pulse' | 'wave' | 'none'
|
|
1318
|
+
}
|
|
1332
1319
|
```
|
|
1333
1320
|
|
|
1321
|
+
### Types
|
|
1322
|
+
|
|
1334
1323
|
#### `Children`
|
|
1335
1324
|
|
|
1336
1325
|
Framework-agnostic child content.
|
|
@@ -1340,20 +1329,30 @@ Use `unknown` to allow any framework's node type (ReactNode, VNode, etc.).
|
|
|
1340
1329
|
type Children = unknown
|
|
1341
1330
|
```
|
|
1342
1331
|
|
|
1343
|
-
#### `
|
|
1332
|
+
#### `EventHandler`
|
|
1344
1333
|
|
|
1345
|
-
|
|
1334
|
+
Framework-agnostic event handler.
|
|
1346
1335
|
|
|
1347
1336
|
```typescript
|
|
1348
|
-
type
|
|
1337
|
+
type EventHandler<E = Event> = (event: E) => void
|
|
1349
1338
|
```
|
|
1350
1339
|
|
|
1351
|
-
|
|
1340
|
+
- `event` — The DOM event object.
|
|
1352
1341
|
|
|
1353
|
-
|
|
1342
|
+
#### `MouseEventHandler`
|
|
1343
|
+
|
|
1344
|
+
Framework-agnostic mouse event handler.
|
|
1354
1345
|
|
|
1355
1346
|
```typescript
|
|
1356
|
-
type
|
|
1347
|
+
type MouseEventHandler = EventHandler<MouseEvent>
|
|
1348
|
+
```
|
|
1349
|
+
|
|
1350
|
+
#### `KeyboardEventHandler`
|
|
1351
|
+
|
|
1352
|
+
Framework-agnostic keyboard event handler.
|
|
1353
|
+
|
|
1354
|
+
```typescript
|
|
1355
|
+
type KeyboardEventHandler = EventHandler<KeyboardEvent>
|
|
1357
1356
|
```
|
|
1358
1357
|
|
|
1359
1358
|
#### `FocusEventHandler`
|
|
@@ -1364,6 +1363,14 @@ Framework-agnostic focus event handler.
|
|
|
1364
1363
|
type FocusEventHandler = EventHandler<FocusEvent>
|
|
1365
1364
|
```
|
|
1366
1365
|
|
|
1366
|
+
#### `ChangeEventHandler`
|
|
1367
|
+
|
|
1368
|
+
Framework-agnostic change event handler.
|
|
1369
|
+
|
|
1370
|
+
```typescript
|
|
1371
|
+
type ChangeEventHandler = EventHandler<Event>
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1367
1374
|
#### `FormEventHandler`
|
|
1368
1375
|
|
|
1369
1376
|
Framework-agnostic form event handler.
|
|
@@ -1372,113 +1379,1485 @@ Framework-agnostic form event handler.
|
|
|
1372
1379
|
type FormEventHandler = EventHandler<Event>
|
|
1373
1380
|
```
|
|
1374
1381
|
|
|
1382
|
+
#### `Size`
|
|
1383
|
+
|
|
1384
|
+
Standard size scale used across all molecule UI components (buttons, inputs, badges, etc.).
|
|
1385
|
+
|
|
1386
|
+
```typescript
|
|
1387
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
1388
|
+
```
|
|
1389
|
+
|
|
1390
|
+
#### `ColorVariant`
|
|
1391
|
+
|
|
1392
|
+
Semantic color variants used across components for status indication.
|
|
1393
|
+
|
|
1394
|
+
```typescript
|
|
1395
|
+
type ColorVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
#### `ButtonVariant`
|
|
1399
|
+
|
|
1400
|
+
Button visual variant styles.
|
|
1401
|
+
|
|
1402
|
+
```typescript
|
|
1403
|
+
type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link'
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1375
1406
|
#### `InputType`
|
|
1376
1407
|
|
|
1377
1408
|
Allowed HTML input type attribute values for the Input component.
|
|
1378
1409
|
|
|
1379
|
-
```typescript
|
|
1380
|
-
type InputType =
|
|
1381
|
-
| 'text'
|
|
1382
|
-
| 'email'
|
|
1383
|
-
| 'password'
|
|
1384
|
-
| 'number'
|
|
1385
|
-
| 'tel'
|
|
1386
|
-
| 'url'
|
|
1387
|
-
| 'search'
|
|
1388
|
-
| 'date'
|
|
1389
|
-
| 'time'
|
|
1390
|
-
| 'datetime-local'
|
|
1410
|
+
```typescript
|
|
1411
|
+
type InputType =
|
|
1412
|
+
| 'text'
|
|
1413
|
+
| 'email'
|
|
1414
|
+
| 'password'
|
|
1415
|
+
| 'number'
|
|
1416
|
+
| 'tel'
|
|
1417
|
+
| 'url'
|
|
1418
|
+
| 'search'
|
|
1419
|
+
| 'date'
|
|
1420
|
+
| 'time'
|
|
1421
|
+
| 'datetime-local'
|
|
1422
|
+
```
|
|
1423
|
+
|
|
1424
|
+
#### `ModalSize`
|
|
1425
|
+
|
|
1426
|
+
Modal size variants including full-screen.
|
|
1427
|
+
|
|
1428
|
+
```typescript
|
|
1429
|
+
type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
#### `TooltipPlacement`
|
|
1433
|
+
|
|
1434
|
+
Position where a tooltip renders relative to its trigger element (top, bottom, left, right, and corner variants).
|
|
1435
|
+
|
|
1436
|
+
```typescript
|
|
1437
|
+
type TooltipPlacement =
|
|
1438
|
+
'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'
|
|
1439
|
+
```
|
|
1440
|
+
|
|
1441
|
+
### Classes
|
|
1442
|
+
|
|
1443
|
+
#### `MoleculeAlert`
|
|
1444
|
+
|
|
1445
|
+
Angular Alert UI component with UIClassMap-driven styling.
|
|
1446
|
+
|
|
1447
|
+
```typescript
|
|
1448
|
+
@Component({
|
|
1449
|
+
selector: 'mol-alert',
|
|
1450
|
+
standalone: true,
|
|
1451
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1452
|
+
template: `
|
|
1453
|
+
<div role="alert" [class]="alertClasses" [style]="style" [attr.data-testid]="testId">
|
|
1454
|
+
@if (showIcon) {
|
|
1455
|
+
<span [class]="cm.alertIconWrapper">
|
|
1456
|
+
<span [innerHTML]="statusIconSvg"></span>
|
|
1457
|
+
</span>
|
|
1458
|
+
}
|
|
1459
|
+
<div [class]="cm.alertContent">
|
|
1460
|
+
@if (title) {
|
|
1461
|
+
<h5 [class]="titleClass">{{ title }}</h5>
|
|
1462
|
+
}
|
|
1463
|
+
<div [class]="descriptionClass">
|
|
1464
|
+
<ng-content></ng-content>
|
|
1465
|
+
</div>
|
|
1466
|
+
</div>
|
|
1467
|
+
@if (dismissible) {
|
|
1468
|
+
<button
|
|
1469
|
+
type="button"
|
|
1470
|
+
(click)="dismiss.emit()"
|
|
1471
|
+
[class]="cm.alertDismiss"
|
|
1472
|
+
[attr.aria-label]="dismissAriaLabel"
|
|
1473
|
+
>
|
|
1474
|
+
<span [innerHTML]="dismissIconSvg"></span>
|
|
1475
|
+
</button>
|
|
1476
|
+
}
|
|
1477
|
+
</div>
|
|
1478
|
+
`,
|
|
1479
|
+
})
|
|
1480
|
+
/**
|
|
1481
|
+
* Molecule Alert class.
|
|
1482
|
+
*/
|
|
1483
|
+
export class MoleculeAlert {
|
|
1484
|
+
@Input() title?: string
|
|
1485
|
+
@Input() status: ColorVariant = 'info'
|
|
1486
|
+
@Input() variant?: 'solid' | 'subtle' | 'outline' | 'left-accent'
|
|
1487
|
+
@Input() dismissible = false
|
|
1488
|
+
@Input() dismissLabel?: string
|
|
1489
|
+
@Input() className?: string
|
|
1490
|
+
@Input() style?: Record<string, string>
|
|
1491
|
+
@Input() testId?: string
|
|
1492
|
+
|
|
1493
|
+
@Output() dismiss = new EventEmitter<void>()
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Retrieves the current UI class map.
|
|
1497
|
+
* @returns The UIClassMap instance for styling.
|
|
1498
|
+
*/
|
|
1499
|
+
get cm(): UIClassMap {
|
|
1500
|
+
return getClassMap()
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Computes the accessible dismiss button label.
|
|
1505
|
+
* @returns The localized aria-label for the dismiss button.
|
|
1506
|
+
*/
|
|
1507
|
+
get dismissAriaLabel(): string {
|
|
1508
|
+
return this.dismissLabel || t('ui.alert.dismiss', undefined, { defaultValue: 'Dismiss' })
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Retrieves the CSS class for the alert title.
|
|
1513
|
+
* @returns The title class name string.
|
|
1514
|
+
*/
|
|
1515
|
+
get titleClass(): string {
|
|
1516
|
+
return this.cm.alertTitle
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Retrieves the CSS class for the alert description.
|
|
1521
|
+
* @returns The description class name string.
|
|
1522
|
+
*/
|
|
1523
|
+
get descriptionClass(): string {
|
|
1524
|
+
return this.cm.alertDescription
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* Determines the icon type based on the alert status.
|
|
1529
|
+
* @returns The mapped icon type string.
|
|
1530
|
+
*/
|
|
1531
|
+
get iconType(): string {
|
|
1532
|
+
return statusVariantMap[this.status] || 'default'
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Determines whether the status icon should be shown.
|
|
1537
|
+
* @returns True if the icon type is not default.
|
|
1538
|
+
*/
|
|
1539
|
+
get showIcon(): boolean {
|
|
1540
|
+
return this.iconType !== 'default'
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
private statusIconMap: Record<string, IconName> = {
|
|
1544
|
+
info: 'info-circle',
|
|
1545
|
+
success: 'check-circle',
|
|
1546
|
+
warning: 'exclamation-triangle',
|
|
1547
|
+
error: 'x-circle',
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Generates the SVG markup for the status icon.
|
|
1552
|
+
* @returns The SVG string for the current status icon.
|
|
1553
|
+
*/
|
|
1554
|
+
get statusIconSvg(): string {
|
|
1555
|
+
const name = this.statusIconMap[this.iconType]
|
|
1556
|
+
return name ? getIconSvg(name, this.cm.iconMd) : ''
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* Generates the SVG markup for the dismiss icon.
|
|
1561
|
+
* @returns The SVG string for the dismiss button icon.
|
|
1562
|
+
*/
|
|
1563
|
+
get dismissIconSvg(): string {
|
|
1564
|
+
return getIconSvg('x-mark', this.cm.iconSm)
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* Computes the combined CSS classes for the alert container.
|
|
1569
|
+
* @returns The alert container class name string.
|
|
1570
|
+
*/
|
|
1571
|
+
get alertClasses(): string {
|
|
1572
|
+
const cmVariant = statusVariantMap[this.status] || 'default'
|
|
1573
|
+
return this.cm.cn(this.cm.alert({ variant: cmVariant }), this.className)
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
#### `MoleculeBadge`
|
|
1579
|
+
|
|
1580
|
+
Angular Badge UI component with UIClassMap-driven styling.
|
|
1581
|
+
|
|
1582
|
+
```typescript
|
|
1583
|
+
@Component({
|
|
1584
|
+
selector: 'mol-badge',
|
|
1585
|
+
standalone: true,
|
|
1586
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1587
|
+
template: `
|
|
1588
|
+
<span [class]="badgeClasses" [style]="style" [attr.data-testid]="testId">
|
|
1589
|
+
<ng-content></ng-content>
|
|
1590
|
+
</span>
|
|
1591
|
+
`,
|
|
1592
|
+
})
|
|
1593
|
+
/**
|
|
1594
|
+
* Molecule Badge class.
|
|
1595
|
+
*/
|
|
1596
|
+
export class MoleculeBadge {
|
|
1597
|
+
@Input() color: ColorVariant = 'primary'
|
|
1598
|
+
@Input() variant: 'solid' | 'outline' | 'subtle' = 'solid'
|
|
1599
|
+
@Input() size?: Size
|
|
1600
|
+
@Input() rounded = true
|
|
1601
|
+
@Input() className?: string
|
|
1602
|
+
@Input() style?: Record<string, string>
|
|
1603
|
+
@Input() testId?: string
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* Retrieves the current UI class map.
|
|
1607
|
+
* @returns The UIClassMap instance for styling.
|
|
1608
|
+
*/
|
|
1609
|
+
private get cm(): UIClassMap {
|
|
1610
|
+
return getClassMap()
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* Computes the combined CSS classes for the badge element.
|
|
1615
|
+
* @returns The badge class name string.
|
|
1616
|
+
*/
|
|
1617
|
+
get badgeClasses(): string {
|
|
1618
|
+
return this.cm.cn(
|
|
1619
|
+
this.cm.badge({ variant: this.color, size: this.size }),
|
|
1620
|
+
!this.rounded && this.cm.badgeSquare,
|
|
1621
|
+
this.className,
|
|
1622
|
+
)
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
```
|
|
1626
|
+
|
|
1627
|
+
#### `MoleculeButton`
|
|
1628
|
+
|
|
1629
|
+
Angular Button UI component with UIClassMap-driven styling.
|
|
1630
|
+
|
|
1631
|
+
```typescript
|
|
1632
|
+
@Component({
|
|
1633
|
+
selector: 'mol-button',
|
|
1634
|
+
standalone: true,
|
|
1635
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1636
|
+
host: { style: 'display: contents' },
|
|
1637
|
+
template: `
|
|
1638
|
+
<button
|
|
1639
|
+
[type]="type"
|
|
1640
|
+
[class]="classes"
|
|
1641
|
+
[style]="style"
|
|
1642
|
+
[attr.data-testid]="testId"
|
|
1643
|
+
[disabled]="disabled || loading"
|
|
1644
|
+
[attr.aria-busy]="loading"
|
|
1645
|
+
(click)="handleClick.emit($event)"
|
|
1646
|
+
>
|
|
1647
|
+
@if (loading) {
|
|
1648
|
+
<span [class]="cm.buttonSpinner"></span>
|
|
1649
|
+
}
|
|
1650
|
+
@if (loading && loadingText) {
|
|
1651
|
+
{{ loadingText }}
|
|
1652
|
+
} @else {
|
|
1653
|
+
<ng-content></ng-content>
|
|
1654
|
+
}
|
|
1655
|
+
</button>
|
|
1656
|
+
`,
|
|
1657
|
+
})
|
|
1658
|
+
/**
|
|
1659
|
+
* Molecule Button class.
|
|
1660
|
+
*/
|
|
1661
|
+
export class MoleculeButton {
|
|
1662
|
+
@Input() variant: ButtonVariant = 'solid'
|
|
1663
|
+
@Input() color: ColorVariant = 'primary'
|
|
1664
|
+
@Input() size: Size = 'md'
|
|
1665
|
+
@Input() loading = false
|
|
1666
|
+
@Input() loadingText?: string
|
|
1667
|
+
@Input() fullWidth = false
|
|
1668
|
+
@Input() className?: string
|
|
1669
|
+
@Input() style?: Record<string, string>
|
|
1670
|
+
@Input() testId?: string
|
|
1671
|
+
@Input() disabled = false
|
|
1672
|
+
@Input() type: 'button' | 'submit' | 'reset' = 'button'
|
|
1673
|
+
|
|
1674
|
+
@Output() handleClick = new EventEmitter<MouseEvent>()
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Retrieves the current UI class map.
|
|
1678
|
+
* @returns The UIClassMap instance for styling.
|
|
1679
|
+
*/
|
|
1680
|
+
get cm(): UIClassMap {
|
|
1681
|
+
return getClassMap()
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Computes the combined CSS classes for the button element.
|
|
1686
|
+
* @returns The button class name string.
|
|
1687
|
+
*/
|
|
1688
|
+
get classes(): string {
|
|
1689
|
+
return this.cm.cn(
|
|
1690
|
+
this.cm.button({
|
|
1691
|
+
variant: this.variant,
|
|
1692
|
+
color: this.color,
|
|
1693
|
+
size: this.size,
|
|
1694
|
+
fullWidth: this.fullWidth,
|
|
1695
|
+
}),
|
|
1696
|
+
this.className,
|
|
1697
|
+
)
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
```
|
|
1701
|
+
|
|
1702
|
+
#### `MoleculeCheckbox`
|
|
1703
|
+
|
|
1704
|
+
Angular Checkbox UI component with UIClassMap-driven styling.
|
|
1705
|
+
|
|
1706
|
+
```typescript
|
|
1707
|
+
@Component({
|
|
1708
|
+
selector: 'mol-checkbox',
|
|
1709
|
+
standalone: true,
|
|
1710
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1711
|
+
template: `
|
|
1712
|
+
<div [class]="cm.formFieldWrapper">
|
|
1713
|
+
<label [class]="cm.controlLabel">
|
|
1714
|
+
<input
|
|
1715
|
+
type="checkbox"
|
|
1716
|
+
[id]="checkboxId"
|
|
1717
|
+
[name]="name"
|
|
1718
|
+
[checked]="checked"
|
|
1719
|
+
[disabled]="disabled"
|
|
1720
|
+
[attr.data-state]="checked ? 'checked' : 'unchecked'"
|
|
1721
|
+
[attr.aria-invalid]="!!error"
|
|
1722
|
+
[class]="checkboxClasses"
|
|
1723
|
+
[style]="style"
|
|
1724
|
+
[attr.data-testid]="testId"
|
|
1725
|
+
(change)="handleChange.emit($event)"
|
|
1726
|
+
/>
|
|
1727
|
+
@if (label) {
|
|
1728
|
+
<span [class]="labelClasses">{{ label }}</span>
|
|
1729
|
+
}
|
|
1730
|
+
</label>
|
|
1731
|
+
@if (error) {
|
|
1732
|
+
<p [class]="errorClasses">{{ error }}</p>
|
|
1733
|
+
}
|
|
1734
|
+
</div>
|
|
1735
|
+
`,
|
|
1736
|
+
})
|
|
1737
|
+
/**
|
|
1738
|
+
* Molecule Checkbox class.
|
|
1739
|
+
*/
|
|
1740
|
+
export class MoleculeCheckbox {
|
|
1741
|
+
@Input() label?: string
|
|
1742
|
+
@Input() checked = false
|
|
1743
|
+
@Input() indeterminate = false
|
|
1744
|
+
@Input() size?: Size
|
|
1745
|
+
@Input() error?: string
|
|
1746
|
+
@Input() className?: string
|
|
1747
|
+
@Input() style?: Record<string, string>
|
|
1748
|
+
@Input() testId?: string
|
|
1749
|
+
@Input() disabled = false
|
|
1750
|
+
@Input() name?: string
|
|
1751
|
+
@Input() id?: string
|
|
1752
|
+
|
|
1753
|
+
@Output() handleChange = new EventEmitter<Event>()
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* Retrieves the current UI class map.
|
|
1757
|
+
* @returns The UIClassMap instance for styling.
|
|
1758
|
+
*/
|
|
1759
|
+
get cm(): UIClassMap {
|
|
1760
|
+
return getClassMap()
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* Resolves the checkbox input element ID.
|
|
1765
|
+
* @returns The resolved ID from the id or name input.
|
|
1766
|
+
*/
|
|
1767
|
+
get checkboxId(): string {
|
|
1768
|
+
return this.id || this.name || ''
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Computes the combined CSS classes for the checkbox input.
|
|
1773
|
+
* @returns The checkbox class name string.
|
|
1774
|
+
*/
|
|
1775
|
+
get checkboxClasses(): string {
|
|
1776
|
+
return this.cm.cn(this.cm.checkbox({ error: !!this.error }), this.className)
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* Computes the CSS classes for the checkbox label text.
|
|
1781
|
+
* @returns The label class name string.
|
|
1782
|
+
*/
|
|
1783
|
+
get labelClasses(): string {
|
|
1784
|
+
return this.cm.cn(this.cm.controlText, this.disabled && this.cm.controlDisabled)
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
/**
|
|
1788
|
+
* Computes the CSS classes for the error message.
|
|
1789
|
+
* @returns The error class name string.
|
|
1790
|
+
*/
|
|
1791
|
+
get errorClasses(): string {
|
|
1792
|
+
return this.cm.cn(this.cm.formError, this.cm.sp('mt', 1))
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
#### `MoleculeInput`
|
|
1798
|
+
|
|
1799
|
+
Angular Input UI component with UIClassMap-driven styling.
|
|
1800
|
+
|
|
1801
|
+
```typescript
|
|
1802
|
+
@Component({
|
|
1803
|
+
selector: 'mol-input',
|
|
1804
|
+
standalone: true,
|
|
1805
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1806
|
+
template: `
|
|
1807
|
+
<div [class]="cm.inputWrapper">
|
|
1808
|
+
@if (label) {
|
|
1809
|
+
<label [attr.for]="inputId" [class]="labelClasses">
|
|
1810
|
+
{{ label }}
|
|
1811
|
+
</label>
|
|
1812
|
+
}
|
|
1813
|
+
<div [class]="cm.inputInner">
|
|
1814
|
+
<input
|
|
1815
|
+
[type]="type"
|
|
1816
|
+
[id]="inputId"
|
|
1817
|
+
[name]="name"
|
|
1818
|
+
[value]="value"
|
|
1819
|
+
[placeholder]="placeholder"
|
|
1820
|
+
[disabled]="disabled"
|
|
1821
|
+
[required]="required"
|
|
1822
|
+
[readOnly]="readOnly"
|
|
1823
|
+
[attr.aria-invalid]="!!error"
|
|
1824
|
+
[attr.aria-describedby]="ariaDescribedBy"
|
|
1825
|
+
[class]="inputClasses"
|
|
1826
|
+
[style]="style"
|
|
1827
|
+
[attr.data-testid]="testId"
|
|
1828
|
+
[attr.maxlength]="maxLength"
|
|
1829
|
+
[attr.minlength]="minLength"
|
|
1830
|
+
[attr.pattern]="pattern"
|
|
1831
|
+
[attr.autocomplete]="autoComplete"
|
|
1832
|
+
(input)="handleInput.emit($event)"
|
|
1833
|
+
(change)="handleChange.emit($event)"
|
|
1834
|
+
(focus)="handleFocus.emit($event)"
|
|
1835
|
+
(blur)="handleBlur.emit($event)"
|
|
1836
|
+
/>
|
|
1837
|
+
@if (clearable && value) {
|
|
1838
|
+
<div [class]="cm.inputClearButton">
|
|
1839
|
+
<button
|
|
1840
|
+
type="button"
|
|
1841
|
+
(click)="handleClear.emit()"
|
|
1842
|
+
[class]="cm.inputClearButton"
|
|
1843
|
+
[attr.aria-label]="clearAriaLabel"
|
|
1844
|
+
>
|
|
1845
|
+
<span [innerHTML]="clearIconSvg"></span>
|
|
1846
|
+
</button>
|
|
1847
|
+
</div>
|
|
1848
|
+
}
|
|
1849
|
+
</div>
|
|
1850
|
+
@if (error) {
|
|
1851
|
+
<p [id]="inputId + '-error'" [class]="formErrorClass">
|
|
1852
|
+
{{ error }}
|
|
1853
|
+
</p>
|
|
1854
|
+
}
|
|
1855
|
+
@if (hint && !error) {
|
|
1856
|
+
<p [id]="inputId + '-hint'" [class]="formHintClass">
|
|
1857
|
+
{{ hint }}
|
|
1858
|
+
</p>
|
|
1859
|
+
}
|
|
1860
|
+
</div>
|
|
1861
|
+
`,
|
|
1862
|
+
})
|
|
1863
|
+
/**
|
|
1864
|
+
* Molecule Input class.
|
|
1865
|
+
*/
|
|
1866
|
+
export class MoleculeInput {
|
|
1867
|
+
@Input() type: InputType = 'text'
|
|
1868
|
+
@Input() size: Size = 'md'
|
|
1869
|
+
@Input() label?: string
|
|
1870
|
+
@Input() error?: string
|
|
1871
|
+
@Input() hint?: string
|
|
1872
|
+
@Input() clearable = false
|
|
1873
|
+
@Input() clearLabel?: string
|
|
1874
|
+
@Input() className?: string
|
|
1875
|
+
@Input() style?: Record<string, string>
|
|
1876
|
+
@Input() testId?: string
|
|
1877
|
+
@Input() disabled = false
|
|
1878
|
+
@Input() required = false
|
|
1879
|
+
@Input() readOnly = false
|
|
1880
|
+
@Input() value?: string | number
|
|
1881
|
+
@Input() placeholder?: string
|
|
1882
|
+
@Input() name?: string
|
|
1883
|
+
@Input() id?: string
|
|
1884
|
+
@Input() maxLength?: number
|
|
1885
|
+
@Input() minLength?: number
|
|
1886
|
+
@Input() pattern?: string
|
|
1887
|
+
@Input() autoComplete?: string
|
|
1888
|
+
|
|
1889
|
+
@Output() handleInput = new EventEmitter<Event>()
|
|
1890
|
+
@Output() handleChange = new EventEmitter<Event>()
|
|
1891
|
+
@Output() handleFocus = new EventEmitter<FocusEvent>()
|
|
1892
|
+
@Output() handleBlur = new EventEmitter<FocusEvent>()
|
|
1893
|
+
@Output() handleClear = new EventEmitter<void>()
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Retrieves the current UI class map.
|
|
1897
|
+
* @returns The UIClassMap instance for styling.
|
|
1898
|
+
*/
|
|
1899
|
+
get cm(): UIClassMap {
|
|
1900
|
+
return getClassMap()
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Computes the accessible clear button label.
|
|
1905
|
+
* @returns The localized aria-label for the clear button.
|
|
1906
|
+
*/
|
|
1907
|
+
get clearAriaLabel(): string {
|
|
1908
|
+
return this.clearLabel || t('ui.input.clear', undefined, { defaultValue: 'Clear' })
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
/**
|
|
1912
|
+
* Retrieves the CSS class for form error messages.
|
|
1913
|
+
* @returns The form error class name string.
|
|
1914
|
+
*/
|
|
1915
|
+
get formErrorClass(): string {
|
|
1916
|
+
return this.cm.formError
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* Retrieves the CSS class for form hint messages.
|
|
1921
|
+
* @returns The form hint class name string.
|
|
1922
|
+
*/
|
|
1923
|
+
get formHintClass(): string {
|
|
1924
|
+
return this.cm.formHint
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* Resolves the input element ID.
|
|
1929
|
+
* @returns The resolved ID from the id or name input.
|
|
1930
|
+
*/
|
|
1931
|
+
get inputId(): string {
|
|
1932
|
+
return this.id || this.name || ''
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Computes the aria-describedby attribute value.
|
|
1937
|
+
* @returns The ID of the describing element, or null if none.
|
|
1938
|
+
*/
|
|
1939
|
+
get ariaDescribedBy(): string | null {
|
|
1940
|
+
if (this.error) return `${this.inputId}-error`
|
|
1941
|
+
if (this.hint) return `${this.inputId}-hint`
|
|
1942
|
+
return null
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
* Computes the CSS classes for the input label.
|
|
1947
|
+
* @returns The label class name string.
|
|
1948
|
+
*/
|
|
1949
|
+
get labelClasses(): string {
|
|
1950
|
+
return this.cm.cn(this.cm.label({ required: this.required }), this.cm.labelBlock)
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* Computes the combined CSS classes for the input element.
|
|
1955
|
+
* @returns The input class name string.
|
|
1956
|
+
*/
|
|
1957
|
+
get inputClasses(): string {
|
|
1958
|
+
return this.cm.cn(
|
|
1959
|
+
this.cm.input({ error: !!this.error, size: this.size }),
|
|
1960
|
+
this.clearable && this.cm.inputPadRight,
|
|
1961
|
+
this.className,
|
|
1962
|
+
)
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
/**
|
|
1966
|
+
* Generates the SVG markup for the clear button icon.
|
|
1967
|
+
* @returns The SVG string for the clear icon.
|
|
1968
|
+
*/
|
|
1969
|
+
get clearIconSvg(): string {
|
|
1970
|
+
return getIconSvg('x-mark', this.cm.iconSm)
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
```
|
|
1974
|
+
|
|
1975
|
+
#### `MoleculeModal`
|
|
1976
|
+
|
|
1977
|
+
Angular Modal UI component with UIClassMap-driven styling.
|
|
1978
|
+
|
|
1979
|
+
`centered` (default `true`) vertically centers the dialog; `centered:
|
|
1980
|
+
false` top-anchors it instead, via `getModalWrapperStyle()`.
|
|
1981
|
+
|
|
1982
|
+
```typescript
|
|
1983
|
+
@Component({
|
|
1984
|
+
selector: 'mol-modal',
|
|
1985
|
+
standalone: true,
|
|
1986
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1987
|
+
template: `
|
|
1988
|
+
@if (open) {
|
|
1989
|
+
<!-- Overlay background -->
|
|
1990
|
+
<div [class]="overlayClass" aria-hidden="true"></div>
|
|
1991
|
+
|
|
1992
|
+
<!-- Centering wrapper -->
|
|
1993
|
+
<div [class]="wrapperClass" [style]="wrapperStyle" (click)="onOverlayClick($event)">
|
|
1994
|
+
<!-- Content -->
|
|
1995
|
+
<div
|
|
1996
|
+
role="dialog"
|
|
1997
|
+
aria-modal="true"
|
|
1998
|
+
[attr.aria-labelledby]="title ? 'modal-title' : null"
|
|
1999
|
+
[class]="contentClasses"
|
|
2000
|
+
[style]="style"
|
|
2001
|
+
[attr.data-testid]="testId"
|
|
2002
|
+
(click)="$event.stopPropagation()"
|
|
2003
|
+
>
|
|
2004
|
+
@if (title || showCloseButton) {
|
|
2005
|
+
<div [class]="headerClass">
|
|
2006
|
+
@if (title) {
|
|
2007
|
+
<h2 id="modal-title" [class]="titleClass">{{ title }}</h2>
|
|
2008
|
+
} @else if (showCloseButton) {
|
|
2009
|
+
<div></div>
|
|
2010
|
+
}
|
|
2011
|
+
@if (showCloseButton) {
|
|
2012
|
+
<button
|
|
2013
|
+
type="button"
|
|
2014
|
+
(click)="close.emit()"
|
|
2015
|
+
[class]="closeClass"
|
|
2016
|
+
[attr.aria-label]="closeAriaLabel"
|
|
2017
|
+
>
|
|
2018
|
+
<span [innerHTML]="closeIconSvg"></span>
|
|
2019
|
+
</button>
|
|
2020
|
+
}
|
|
2021
|
+
</div>
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
<div [class]="bodyClass">
|
|
2025
|
+
<ng-content></ng-content>
|
|
2026
|
+
</div>
|
|
2027
|
+
|
|
2028
|
+
@if (hasFooter) {
|
|
2029
|
+
<div [class]="footerClass">
|
|
2030
|
+
<ng-content select="[modal-footer]"></ng-content>
|
|
2031
|
+
</div>
|
|
2032
|
+
}
|
|
2033
|
+
</div>
|
|
2034
|
+
</div>
|
|
2035
|
+
}
|
|
2036
|
+
`,
|
|
2037
|
+
})
|
|
2038
|
+
/**
|
|
2039
|
+
* Molecule Modal class.
|
|
2040
|
+
*/
|
|
2041
|
+
export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
|
|
2042
|
+
@Input() open = false
|
|
2043
|
+
@Input() title?: string
|
|
2044
|
+
@Input() size: ModalSize = 'md'
|
|
2045
|
+
@Input() showCloseButton = true
|
|
2046
|
+
@Input() closeLabel?: string
|
|
2047
|
+
@Input() closeOnOverlayClick = true
|
|
2048
|
+
@Input() closeOnEscape = true
|
|
2049
|
+
@Input() centered = true
|
|
2050
|
+
@Input() preventScroll = true
|
|
2051
|
+
@Input() hasFooter = false
|
|
2052
|
+
@Input() className?: string
|
|
2053
|
+
@Input() style?: Record<string, string>
|
|
2054
|
+
@Input() testId?: string
|
|
2055
|
+
|
|
2056
|
+
@Output() close = new EventEmitter<void>()
|
|
2057
|
+
|
|
2058
|
+
/**
|
|
2059
|
+
* Retrieves the current UI class map.
|
|
2060
|
+
* @returns The UIClassMap instance for styling.
|
|
2061
|
+
*/
|
|
2062
|
+
get cm(): UIClassMap {
|
|
2063
|
+
return getClassMap()
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* Computes the accessible close button label.
|
|
2068
|
+
* @returns The localized aria-label for the close button.
|
|
2069
|
+
*/
|
|
2070
|
+
get closeAriaLabel(): string {
|
|
2071
|
+
return this.closeLabel || t('ui.modal.close', undefined, { defaultValue: 'Close' })
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
private boundEscapeHandler = this.handleEscape.bind(this)
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* Retrieves the CSS class for the modal wrapper.
|
|
2078
|
+
* @returns The wrapper class name string.
|
|
2079
|
+
*/
|
|
2080
|
+
get wrapperClass(): string {
|
|
2081
|
+
return this.cm.dialogWrapper
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
/**
|
|
2085
|
+
* Retrieves the inline style for the modal centering wrapper.
|
|
2086
|
+
* @returns An inline style object, or `undefined` when centered.
|
|
2087
|
+
*/
|
|
2088
|
+
get wrapperStyle(): Record<string, string> | undefined {
|
|
2089
|
+
return getModalWrapperStyle(this.centered)
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
/**
|
|
2093
|
+
* Retrieves the CSS class for the modal body.
|
|
2094
|
+
* @returns The body class name string.
|
|
2095
|
+
*/
|
|
2096
|
+
get bodyClass(): string {
|
|
2097
|
+
return this.cm.dialogBody
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
/**
|
|
2101
|
+
* Retrieves the CSS class for the modal overlay.
|
|
2102
|
+
* @returns The overlay class name string.
|
|
2103
|
+
*/
|
|
2104
|
+
get overlayClass(): string {
|
|
2105
|
+
return this.cm.dialogOverlay
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* Retrieves the CSS class for the modal header.
|
|
2110
|
+
* @returns The header class name string.
|
|
2111
|
+
*/
|
|
2112
|
+
get headerClass(): string {
|
|
2113
|
+
return this.cm.dialogHeader
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
/**
|
|
2117
|
+
* Retrieves the CSS class for the modal footer.
|
|
2118
|
+
* @returns The footer class name string.
|
|
2119
|
+
*/
|
|
2120
|
+
get footerClass(): string {
|
|
2121
|
+
return this.cm.dialogFooter
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* Retrieves the CSS class for the modal title.
|
|
2126
|
+
* @returns The title class name string.
|
|
2127
|
+
*/
|
|
2128
|
+
get titleClass(): string {
|
|
2129
|
+
return this.cm.dialogTitle
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
/**
|
|
2133
|
+
* Retrieves the CSS class for the close button.
|
|
2134
|
+
* @returns The close button class name string.
|
|
2135
|
+
*/
|
|
2136
|
+
get closeClass(): string {
|
|
2137
|
+
return this.cm.dialogClose
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
private sanitizer = inject(DomSanitizer)
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* Generates the SVG markup for the close button icon.
|
|
2144
|
+
* @returns The sanitized SVG for the close icon.
|
|
2145
|
+
*/
|
|
2146
|
+
get closeIconSvg(): SafeHtml {
|
|
2147
|
+
return this.sanitizer.bypassSecurityTrustHtml(getIconSvg('x-mark', this.cm.iconMd))
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
/**
|
|
2151
|
+
* Computes the combined CSS classes for the modal content.
|
|
2152
|
+
* @returns The modal content class name string.
|
|
2153
|
+
*/
|
|
2154
|
+
get contentClasses(): string {
|
|
2155
|
+
return this.cm.cn(this.cm.modal({ size: this.size }), this.className)
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
/**
|
|
2159
|
+
* Initializes event listeners on component creation.
|
|
2160
|
+
*/
|
|
2161
|
+
ngOnInit(): void {
|
|
2162
|
+
this.updateListeners()
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* Handles input property changes.
|
|
2167
|
+
* @param changes - The changed input properties.
|
|
2168
|
+
*/
|
|
2169
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
2170
|
+
if (changes['open']) {
|
|
2171
|
+
this.updateListeners()
|
|
2172
|
+
this.updateBodyScroll()
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* Cleans up event listeners and body scroll on component destruction.
|
|
2178
|
+
*/
|
|
2179
|
+
ngOnDestroy(): void {
|
|
2180
|
+
document.removeEventListener('keydown', this.boundEscapeHandler)
|
|
2181
|
+
if (this.preventScroll) {
|
|
2182
|
+
document.body.style.overflow = ''
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* Adds or removes the keyboard escape listener based on open state.
|
|
2188
|
+
*/
|
|
2189
|
+
private updateListeners(): void {
|
|
2190
|
+
if (this.open) {
|
|
2191
|
+
document.addEventListener('keydown', this.boundEscapeHandler)
|
|
2192
|
+
} else {
|
|
2193
|
+
document.removeEventListener('keydown', this.boundEscapeHandler)
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* Updates the document body overflow based on open state.
|
|
2199
|
+
*/
|
|
2200
|
+
private updateBodyScroll(): void {
|
|
2201
|
+
if (this.preventScroll) {
|
|
2202
|
+
document.body.style.overflow = this.open ? 'hidden' : ''
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* Handles escape key press to close the modal.
|
|
2208
|
+
* @param e - The keyboard event.
|
|
2209
|
+
*/
|
|
2210
|
+
private handleEscape(e: KeyboardEvent): void {
|
|
2211
|
+
if (this.closeOnEscape && e.key === 'Escape') {
|
|
2212
|
+
this.close.emit()
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* Handles overlay click to close the modal.
|
|
2218
|
+
* @param event - The mouse event from the overlay click.
|
|
2219
|
+
*/
|
|
2220
|
+
onOverlayClick(event: MouseEvent): void {
|
|
2221
|
+
if (this.closeOnOverlayClick && event.target === event.currentTarget) {
|
|
2222
|
+
this.close.emit()
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
```
|
|
2227
|
+
|
|
2228
|
+
#### `MoleculeRadioGroup`
|
|
2229
|
+
|
|
2230
|
+
Angular RadioGroup UI component with UIClassMap-driven styling.
|
|
2231
|
+
|
|
2232
|
+
```typescript
|
|
2233
|
+
@Component({
|
|
2234
|
+
selector: 'mol-radio-group',
|
|
2235
|
+
standalone: true,
|
|
2236
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2237
|
+
template: `
|
|
2238
|
+
<div
|
|
2239
|
+
[class]="className"
|
|
2240
|
+
[style]="style"
|
|
2241
|
+
[attr.data-testid]="testId"
|
|
2242
|
+
role="radiogroup"
|
|
2243
|
+
[attr.aria-label]="label"
|
|
2244
|
+
>
|
|
2245
|
+
@if (label) {
|
|
2246
|
+
<div [class]="groupLabelClasses">{{ label }}</div>
|
|
2247
|
+
}
|
|
2248
|
+
<div [class]="directionClasses">
|
|
2249
|
+
@for (option of options; track option.value) {
|
|
2250
|
+
<label [class]="getOptionLabelClasses(option)">
|
|
2251
|
+
<input
|
|
2252
|
+
type="radio"
|
|
2253
|
+
[name]="label"
|
|
2254
|
+
[value]="option.value"
|
|
2255
|
+
[checked]="value === option.value"
|
|
2256
|
+
[disabled]="disabled || option.disabled"
|
|
2257
|
+
[attr.data-state]="value === option.value ? 'checked' : 'unchecked'"
|
|
2258
|
+
[class]="radioClasses"
|
|
2259
|
+
(change)="onRadioChange(option.value)"
|
|
2260
|
+
/>
|
|
2261
|
+
<span [class]="cm.controlText">{{ option.label }}</span>
|
|
2262
|
+
</label>
|
|
2263
|
+
}
|
|
2264
|
+
</div>
|
|
2265
|
+
@if (error) {
|
|
2266
|
+
<p [class]="errorClasses">{{ error }}</p>
|
|
2267
|
+
}
|
|
2268
|
+
</div>
|
|
2269
|
+
`,
|
|
2270
|
+
})
|
|
2271
|
+
/**
|
|
2272
|
+
* Molecule Radio Group class.
|
|
2273
|
+
*/
|
|
2274
|
+
export class MoleculeRadioGroup {
|
|
2275
|
+
@Input() options: RadioOption<string>[] = []
|
|
2276
|
+
@Input() value?: string
|
|
2277
|
+
@Input() size?: Size
|
|
2278
|
+
@Input() label?: string
|
|
2279
|
+
@Input() direction: 'horizontal' | 'vertical' = 'vertical'
|
|
2280
|
+
@Input() error?: string
|
|
2281
|
+
@Input() className?: string
|
|
2282
|
+
@Input() style?: Record<string, string>
|
|
2283
|
+
@Input() testId?: string
|
|
2284
|
+
@Input() disabled = false
|
|
2285
|
+
|
|
2286
|
+
@Output() valueChange = new EventEmitter<string>()
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* Retrieves the current UI class map.
|
|
2290
|
+
* @returns The UIClassMap instance for styling.
|
|
2291
|
+
*/
|
|
2292
|
+
get cm(): UIClassMap {
|
|
2293
|
+
return getClassMap()
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* Computes the CSS classes for the radio group label.
|
|
2298
|
+
* @returns The group label class name string.
|
|
2299
|
+
*/
|
|
2300
|
+
get groupLabelClasses(): string {
|
|
2301
|
+
return this.cm.cn(this.cm.label({}), this.cm.radioGroupLabel)
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* Computes the CSS classes for the layout direction.
|
|
2306
|
+
* @returns The direction layout class name string.
|
|
2307
|
+
*/
|
|
2308
|
+
get directionClasses(): string {
|
|
2309
|
+
return this.cm.radioGroupLayout(this.direction)
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
/**
|
|
2313
|
+
* Computes the CSS classes for radio input elements.
|
|
2314
|
+
* @returns The radio input class name string.
|
|
2315
|
+
*/
|
|
2316
|
+
get radioClasses(): string {
|
|
2317
|
+
return this.cm.cn(this.cm.radio({ error: !!this.error }), this.cm.cursorPointer)
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* Computes the CSS classes for the error message.
|
|
2322
|
+
* @returns The error class name string.
|
|
2323
|
+
*/
|
|
2324
|
+
get errorClasses(): string {
|
|
2325
|
+
return this.cm.cn(this.cm.formError, this.cm.sp('mt', 1))
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Computes the CSS classes for an individual radio option label.
|
|
2330
|
+
* @param option - The radio option to compute classes for.
|
|
2331
|
+
* @returns The option label class name string.
|
|
2332
|
+
*/
|
|
2333
|
+
getOptionLabelClasses(option: RadioOption<string>): string {
|
|
2334
|
+
const isDisabled = this.disabled || option.disabled
|
|
2335
|
+
return this.cm.cn(this.cm.controlLabel, isDisabled && this.cm.controlDisabled)
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* Handles radio option selection change.
|
|
2340
|
+
* @param optionValue - The value of the selected radio option.
|
|
2341
|
+
*/
|
|
2342
|
+
onRadioChange(optionValue: string): void {
|
|
2343
|
+
this.valueChange.emit(optionValue)
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
1391
2346
|
```
|
|
1392
2347
|
|
|
1393
|
-
#### `
|
|
2348
|
+
#### `MoleculeSelect`
|
|
1394
2349
|
|
|
1395
|
-
|
|
2350
|
+
Angular Select UI component with UIClassMap-driven styling.
|
|
1396
2351
|
|
|
1397
2352
|
```typescript
|
|
1398
|
-
|
|
1399
|
-
|
|
2353
|
+
@Component({
|
|
2354
|
+
selector: 'mol-select',
|
|
2355
|
+
standalone: true,
|
|
2356
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2357
|
+
template: `
|
|
2358
|
+
<div [class]="cm.inputWrapper">
|
|
2359
|
+
@if (label) {
|
|
2360
|
+
<label [attr.for]="selectId" [class]="labelClasses">
|
|
2361
|
+
{{ label }}
|
|
2362
|
+
</label>
|
|
2363
|
+
}
|
|
2364
|
+
<div [class]="cm.inputInner">
|
|
2365
|
+
<select
|
|
2366
|
+
[id]="selectId"
|
|
2367
|
+
[name]="name"
|
|
2368
|
+
[value]="value"
|
|
2369
|
+
[disabled]="disabled"
|
|
2370
|
+
[required]="required"
|
|
2371
|
+
[attr.aria-invalid]="!!error"
|
|
2372
|
+
[attr.aria-describedby]="ariaDescribedBy"
|
|
2373
|
+
[class]="selectClasses"
|
|
2374
|
+
[attr.data-testid]="testId"
|
|
2375
|
+
(change)="onSelectChange($event)"
|
|
2376
|
+
>
|
|
2377
|
+
@if (placeholder) {
|
|
2378
|
+
<option value="" disabled>{{ placeholder }}</option>
|
|
2379
|
+
}
|
|
2380
|
+
@if (clearable) {
|
|
2381
|
+
<option value="">--</option>
|
|
2382
|
+
}
|
|
2383
|
+
@for (option of options; track option.value) {
|
|
2384
|
+
<option [value]="option.value" [disabled]="option.disabled">
|
|
2385
|
+
{{ option.label }}
|
|
2386
|
+
</option>
|
|
2387
|
+
}
|
|
2388
|
+
</select>
|
|
2389
|
+
</div>
|
|
2390
|
+
@if (error) {
|
|
2391
|
+
<p [id]="selectId + '-error'" [class]="formErrorClass">
|
|
2392
|
+
{{ error }}
|
|
2393
|
+
</p>
|
|
2394
|
+
}
|
|
2395
|
+
@if (hint && !error) {
|
|
2396
|
+
<p [id]="selectId + '-hint'" [class]="formHintClass">
|
|
2397
|
+
{{ hint }}
|
|
2398
|
+
</p>
|
|
2399
|
+
}
|
|
2400
|
+
</div>
|
|
2401
|
+
`,
|
|
2402
|
+
})
|
|
2403
|
+
/**
|
|
2404
|
+
* Molecule Select class.
|
|
2405
|
+
*/
|
|
2406
|
+
export class MoleculeSelect {
|
|
2407
|
+
@Input() options: SelectOption<string>[] = []
|
|
2408
|
+
@Input() value?: string
|
|
2409
|
+
@Input() size: Size = 'md'
|
|
2410
|
+
@Input() label?: string
|
|
2411
|
+
@Input() placeholder?: string
|
|
2412
|
+
@Input() error?: string
|
|
2413
|
+
@Input() hint?: string
|
|
2414
|
+
@Input() clearable = false
|
|
2415
|
+
@Input() className?: string
|
|
2416
|
+
@Input() testId?: string
|
|
2417
|
+
@Input() disabled = false
|
|
2418
|
+
@Input() required = false
|
|
2419
|
+
@Input() name?: string
|
|
2420
|
+
@Input() id?: string
|
|
2421
|
+
|
|
2422
|
+
@Output() valueChange = new EventEmitter<string>()
|
|
2423
|
+
@Output() handleChange = new EventEmitter<Event>()
|
|
2424
|
+
|
|
2425
|
+
/**
|
|
2426
|
+
* Retrieves the current UI class map.
|
|
2427
|
+
* @returns The UIClassMap instance for styling.
|
|
2428
|
+
*/
|
|
2429
|
+
get cm(): UIClassMap {
|
|
2430
|
+
return getClassMap()
|
|
2431
|
+
}
|
|
1400
2432
|
|
|
1401
|
-
|
|
2433
|
+
/**
|
|
2434
|
+
* Retrieves the CSS class for form error messages.
|
|
2435
|
+
* @returns The form error class name string.
|
|
2436
|
+
*/
|
|
2437
|
+
get formErrorClass(): string {
|
|
2438
|
+
return this.cm.formError
|
|
2439
|
+
}
|
|
1402
2440
|
|
|
1403
|
-
|
|
2441
|
+
/**
|
|
2442
|
+
* Retrieves the CSS class for form hint messages.
|
|
2443
|
+
* @returns The form hint class name string.
|
|
2444
|
+
*/
|
|
2445
|
+
get formHintClass(): string {
|
|
2446
|
+
return this.cm.formHint
|
|
2447
|
+
}
|
|
1404
2448
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
2449
|
+
/**
|
|
2450
|
+
* Resolves the select element ID.
|
|
2451
|
+
* @returns The resolved ID from the id or name input.
|
|
2452
|
+
*/
|
|
2453
|
+
get selectId(): string {
|
|
2454
|
+
return this.id || this.name || ''
|
|
2455
|
+
}
|
|
1408
2456
|
|
|
1409
|
-
|
|
2457
|
+
/**
|
|
2458
|
+
* Computes the aria-describedby attribute value.
|
|
2459
|
+
* @returns The ID of the describing element, or null if none.
|
|
2460
|
+
*/
|
|
2461
|
+
get ariaDescribedBy(): string | null {
|
|
2462
|
+
if (this.error) return `${this.selectId}-error`
|
|
2463
|
+
if (this.hint) return `${this.selectId}-hint`
|
|
2464
|
+
return null
|
|
2465
|
+
}
|
|
1410
2466
|
|
|
1411
|
-
|
|
2467
|
+
/**
|
|
2468
|
+
* Computes the CSS classes for the select label.
|
|
2469
|
+
* @returns The label class name string.
|
|
2470
|
+
*/
|
|
2471
|
+
get labelClasses(): string {
|
|
2472
|
+
return this.cm.cn(this.cm.label({ required: this.required }), this.cm.labelBlock)
|
|
2473
|
+
}
|
|
1412
2474
|
|
|
1413
|
-
|
|
1414
|
-
|
|
2475
|
+
/**
|
|
2476
|
+
* Computes the combined CSS classes for the select element.
|
|
2477
|
+
* @returns The select class name string.
|
|
2478
|
+
*/
|
|
2479
|
+
get selectClasses(): string {
|
|
2480
|
+
return this.cm.cn(
|
|
2481
|
+
this.cm.select({ error: !!this.error, size: this.size }),
|
|
2482
|
+
this.cm.selectNative,
|
|
2483
|
+
this.className,
|
|
2484
|
+
)
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* Handles select value change events.
|
|
2489
|
+
* @param event - The change event from the select element.
|
|
2490
|
+
*/
|
|
2491
|
+
onSelectChange(event: Event): void {
|
|
2492
|
+
const target = event.target as HTMLSelectElement
|
|
2493
|
+
this.handleChange.emit(event)
|
|
2494
|
+
this.valueChange.emit(target.value)
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
1415
2497
|
```
|
|
1416
2498
|
|
|
1417
|
-
#### `
|
|
2499
|
+
#### `MoleculeSpinner`
|
|
1418
2500
|
|
|
1419
|
-
|
|
2501
|
+
Angular Spinner UI component with UIClassMap-driven styling.
|
|
1420
2502
|
|
|
1421
2503
|
```typescript
|
|
1422
|
-
|
|
1423
|
-
|
|
2504
|
+
@Component({
|
|
2505
|
+
selector: 'mol-spinner',
|
|
2506
|
+
standalone: true,
|
|
2507
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2508
|
+
template: `
|
|
2509
|
+
<div
|
|
2510
|
+
role="status"
|
|
2511
|
+
[attr.aria-label]="spinnerLabel"
|
|
2512
|
+
[class]="spinnerClasses"
|
|
2513
|
+
[style]="computedStyle"
|
|
2514
|
+
[attr.data-testid]="testId"
|
|
2515
|
+
>
|
|
2516
|
+
@if (label) {
|
|
2517
|
+
<span [class]="cm.srOnly">{{ label }}</span>
|
|
2518
|
+
}
|
|
2519
|
+
</div>
|
|
2520
|
+
`,
|
|
2521
|
+
})
|
|
2522
|
+
/**
|
|
2523
|
+
* Molecule Spinner class.
|
|
2524
|
+
*/
|
|
2525
|
+
export class MoleculeSpinner {
|
|
2526
|
+
@Input() size: Size = 'md'
|
|
2527
|
+
@Input() color?: ColorVariant | string
|
|
2528
|
+
@Input() label?: string
|
|
2529
|
+
@Input() className?: string
|
|
2530
|
+
@Input() style?: Record<string, string>
|
|
2531
|
+
@Input() testId?: string
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* Retrieves the current UI class map.
|
|
2535
|
+
* @returns The UIClassMap instance for styling.
|
|
2536
|
+
*/
|
|
2537
|
+
get cm(): UIClassMap {
|
|
2538
|
+
return getClassMap()
|
|
2539
|
+
}
|
|
1424
2540
|
|
|
1425
|
-
|
|
2541
|
+
/**
|
|
2542
|
+
* Computes the accessible spinner label.
|
|
2543
|
+
* @returns The localized aria-label for the spinner.
|
|
2544
|
+
*/
|
|
2545
|
+
get spinnerLabel(): string {
|
|
2546
|
+
return this.label || t('ui.spinner.loading', undefined, { defaultValue: 'Loading' })
|
|
2547
|
+
}
|
|
1426
2548
|
|
|
1427
|
-
|
|
2549
|
+
/**
|
|
2550
|
+
* Computes the combined CSS classes for the spinner element.
|
|
2551
|
+
* @returns The spinner class name string.
|
|
2552
|
+
*/
|
|
2553
|
+
get spinnerClasses(): string {
|
|
2554
|
+
return this.cm.cn(this.cm.spinner({ size: this.size }), this.className)
|
|
2555
|
+
}
|
|
1428
2556
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
2557
|
+
/**
|
|
2558
|
+
* Computes the merged inline styles including custom color.
|
|
2559
|
+
* @returns The computed style object with optional custom border color.
|
|
2560
|
+
*/
|
|
2561
|
+
get computedStyle(): Record<string, string> {
|
|
2562
|
+
const base: Record<string, string> = { ...this.style }
|
|
2563
|
+
if (
|
|
2564
|
+
this.color &&
|
|
2565
|
+
typeof this.color === 'string' &&
|
|
2566
|
+
!['primary', 'secondary', 'success', 'warning', 'error', 'info'].includes(this.color)
|
|
2567
|
+
) {
|
|
2568
|
+
base['borderColor'] = this.color
|
|
2569
|
+
base['borderTopColor'] = 'transparent'
|
|
2570
|
+
}
|
|
2571
|
+
return base
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
1432
2574
|
```
|
|
1433
2575
|
|
|
1434
|
-
|
|
2576
|
+
#### `MoleculeSwitch`
|
|
1435
2577
|
|
|
1436
|
-
|
|
2578
|
+
Angular Switch UI component with UIClassMap-driven styling.
|
|
1437
2579
|
|
|
1438
|
-
|
|
2580
|
+
```typescript
|
|
2581
|
+
@Component({
|
|
2582
|
+
selector: 'mol-switch',
|
|
2583
|
+
standalone: true,
|
|
2584
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2585
|
+
template: `
|
|
2586
|
+
<label [class]="wrapperClasses">
|
|
2587
|
+
<button
|
|
2588
|
+
type="button"
|
|
2589
|
+
role="switch"
|
|
2590
|
+
[attr.aria-checked]="checked"
|
|
2591
|
+
[disabled]="disabled"
|
|
2592
|
+
[attr.data-state]="state"
|
|
2593
|
+
[class]="switchClasses"
|
|
2594
|
+
[style]="style"
|
|
2595
|
+
[attr.data-testid]="testId"
|
|
2596
|
+
(click)="onToggle()"
|
|
2597
|
+
>
|
|
2598
|
+
<span [attr.data-state]="state" [class]="thumbClasses"></span>
|
|
2599
|
+
</button>
|
|
2600
|
+
@if (label) {
|
|
2601
|
+
<span [class]="cm.controlText">{{ label }}</span>
|
|
2602
|
+
}
|
|
2603
|
+
</label>
|
|
2604
|
+
`,
|
|
2605
|
+
})
|
|
2606
|
+
/**
|
|
2607
|
+
* Molecule Switch class.
|
|
2608
|
+
*/
|
|
2609
|
+
export class MoleculeSwitch {
|
|
2610
|
+
@Input() label?: string
|
|
2611
|
+
@Input() checked = false
|
|
2612
|
+
@Input() size: Size = 'md'
|
|
2613
|
+
@Input() color?: ColorVariant
|
|
2614
|
+
@Input() className?: string
|
|
2615
|
+
@Input() style?: Record<string, string>
|
|
2616
|
+
@Input() testId?: string
|
|
2617
|
+
@Input() disabled = false
|
|
2618
|
+
|
|
2619
|
+
@Output() checkedChange = new EventEmitter<boolean>()
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Retrieves the current UI class map.
|
|
2623
|
+
* @returns The UIClassMap instance for styling.
|
|
2624
|
+
*/
|
|
2625
|
+
get cm(): UIClassMap {
|
|
2626
|
+
return getClassMap()
|
|
2627
|
+
}
|
|
1439
2628
|
|
|
1440
|
-
|
|
2629
|
+
/**
|
|
2630
|
+
* Computes the current checked/unchecked state string.
|
|
2631
|
+
* @returns The state string, either "checked" or "unchecked".
|
|
2632
|
+
*/
|
|
2633
|
+
get state(): string {
|
|
2634
|
+
return this.checked ? 'checked' : 'unchecked'
|
|
2635
|
+
}
|
|
1441
2636
|
|
|
1442
|
-
|
|
2637
|
+
/**
|
|
2638
|
+
* Computes the CSS classes for the switch wrapper label.
|
|
2639
|
+
* @returns The wrapper class name string.
|
|
2640
|
+
*/
|
|
2641
|
+
get wrapperClasses(): string {
|
|
2642
|
+
return this.cm.cn(this.cm.controlLabel, this.disabled && this.cm.controlDisabled)
|
|
2643
|
+
}
|
|
1443
2644
|
|
|
1444
|
-
|
|
2645
|
+
/**
|
|
2646
|
+
* Computes the combined CSS classes for the switch button.
|
|
2647
|
+
* @returns The switch class name string.
|
|
2648
|
+
*/
|
|
2649
|
+
get switchClasses(): string {
|
|
2650
|
+
return this.cm.cn(this.cm.switchBase({ size: this.size }), this.className)
|
|
2651
|
+
}
|
|
1445
2652
|
|
|
1446
|
-
|
|
2653
|
+
/**
|
|
2654
|
+
* Computes the CSS classes for the switch thumb indicator.
|
|
2655
|
+
* @returns The thumb class name string.
|
|
2656
|
+
*/
|
|
2657
|
+
get thumbClasses(): string {
|
|
2658
|
+
return this.cm.switchThumb({ size: this.size })
|
|
2659
|
+
}
|
|
1447
2660
|
|
|
1448
|
-
|
|
2661
|
+
/**
|
|
2662
|
+
* Handles the switch toggle action.
|
|
2663
|
+
*/
|
|
2664
|
+
onToggle(): void {
|
|
2665
|
+
if (!this.disabled) {
|
|
2666
|
+
this.checkedChange.emit(!this.checked)
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
```
|
|
1449
2671
|
|
|
1450
|
-
|
|
2672
|
+
#### `MoleculeToast`
|
|
1451
2673
|
|
|
1452
|
-
|
|
2674
|
+
Angular Toast UI component with UIClassMap-driven styling.
|
|
1453
2675
|
|
|
1454
|
-
|
|
2676
|
+
```typescript
|
|
2677
|
+
@Component({
|
|
2678
|
+
selector: 'mol-toast',
|
|
2679
|
+
standalone: true,
|
|
2680
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2681
|
+
template: `
|
|
2682
|
+
@if (isVisible) {
|
|
2683
|
+
<div
|
|
2684
|
+
role="alert"
|
|
2685
|
+
data-state="open"
|
|
2686
|
+
[class]="toastClasses"
|
|
2687
|
+
[style]="style"
|
|
2688
|
+
[attr.data-testid]="testId"
|
|
2689
|
+
>
|
|
2690
|
+
@if (showIcon) {
|
|
2691
|
+
<span [class]="cm.toastIconWrapper">
|
|
2692
|
+
<span [innerHTML]="statusIconSvg"></span>
|
|
2693
|
+
</span>
|
|
2694
|
+
}
|
|
2695
|
+
<div [class]="cm.toastContentWrapper">
|
|
2696
|
+
@if (title) {
|
|
2697
|
+
<div [class]="titleClass">{{ title }}</div>
|
|
2698
|
+
}
|
|
2699
|
+
@if (description) {
|
|
2700
|
+
<div [class]="descriptionClass">{{ description }}</div>
|
|
2701
|
+
} @else {
|
|
2702
|
+
<div [class]="descriptionClass">
|
|
2703
|
+
<ng-content></ng-content>
|
|
2704
|
+
</div>
|
|
2705
|
+
}
|
|
2706
|
+
</div>
|
|
2707
|
+
@if (dismissible) {
|
|
2708
|
+
<button
|
|
2709
|
+
type="button"
|
|
2710
|
+
(click)="onDismiss()"
|
|
2711
|
+
[class]="closeButtonClass"
|
|
2712
|
+
[attr.aria-label]="closeAriaLabel"
|
|
2713
|
+
>
|
|
2714
|
+
<span [innerHTML]="dismissIconSvg"></span>
|
|
2715
|
+
</button>
|
|
2716
|
+
}
|
|
2717
|
+
</div>
|
|
2718
|
+
}
|
|
2719
|
+
`,
|
|
2720
|
+
})
|
|
2721
|
+
/**
|
|
2722
|
+
* Molecule Toast class.
|
|
2723
|
+
*/
|
|
2724
|
+
export class MoleculeToast implements OnInit, OnDestroy {
|
|
2725
|
+
@Input() title?: string
|
|
2726
|
+
@Input() description?: string
|
|
2727
|
+
@Input() status: ColorVariant = 'info'
|
|
2728
|
+
@Input() duration = 5000
|
|
2729
|
+
@Input() dismissible = true
|
|
2730
|
+
@Input() closeLabel?: string
|
|
2731
|
+
@Input() position: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left' =
|
|
2732
|
+
'bottom-right'
|
|
2733
|
+
@Input() className?: string
|
|
2734
|
+
@Input() style?: Record<string, string>
|
|
2735
|
+
@Input() testId?: string
|
|
2736
|
+
|
|
2737
|
+
@Output() dismiss = new EventEmitter<void>()
|
|
2738
|
+
|
|
2739
|
+
isVisible = true
|
|
2740
|
+
private timer?: ReturnType<typeof setTimeout>
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Retrieves the current UI class map.
|
|
2744
|
+
* @returns The UIClassMap instance for styling.
|
|
2745
|
+
*/
|
|
2746
|
+
get cm(): UIClassMap {
|
|
2747
|
+
return getClassMap()
|
|
2748
|
+
}
|
|
1455
2749
|
|
|
1456
|
-
|
|
2750
|
+
/**
|
|
2751
|
+
* Computes the accessible close button label.
|
|
2752
|
+
* @returns The localized aria-label for the close button.
|
|
2753
|
+
*/
|
|
2754
|
+
get closeAriaLabel(): string {
|
|
2755
|
+
return this.closeLabel || t('ui.toast.close', undefined, { defaultValue: 'Close' })
|
|
2756
|
+
}
|
|
1457
2757
|
|
|
1458
|
-
|
|
2758
|
+
/**
|
|
2759
|
+
* Retrieves the CSS class for the toast title.
|
|
2760
|
+
* @returns The title class name string.
|
|
2761
|
+
*/
|
|
2762
|
+
get titleClass(): string {
|
|
2763
|
+
return this.cm.toastTitle
|
|
2764
|
+
}
|
|
1459
2765
|
|
|
1460
|
-
|
|
1461
|
-
|
|
2766
|
+
/**
|
|
2767
|
+
* Retrieves the CSS class for the toast description.
|
|
2768
|
+
* @returns The description class name string.
|
|
2769
|
+
*/
|
|
2770
|
+
get descriptionClass(): string {
|
|
2771
|
+
return this.cm.toastDescription
|
|
2772
|
+
}
|
|
1462
2773
|
|
|
1463
|
-
|
|
2774
|
+
/**
|
|
2775
|
+
* Retrieves the CSS class for the close button.
|
|
2776
|
+
* @returns The close button class name string.
|
|
2777
|
+
*/
|
|
2778
|
+
get closeButtonClass(): string {
|
|
2779
|
+
return this.cm.toastClose
|
|
2780
|
+
}
|
|
1464
2781
|
|
|
1465
|
-
|
|
2782
|
+
/**
|
|
2783
|
+
* Determines the icon type based on the toast status.
|
|
2784
|
+
* @returns The mapped icon type string.
|
|
2785
|
+
*/
|
|
2786
|
+
get iconType(): string {
|
|
2787
|
+
return statusVariantMap[this.status] || 'default'
|
|
2788
|
+
}
|
|
1466
2789
|
|
|
1467
|
-
|
|
2790
|
+
/**
|
|
2791
|
+
* Determines whether the status icon should be shown.
|
|
2792
|
+
* @returns True if the icon type is not default.
|
|
2793
|
+
*/
|
|
2794
|
+
get showIcon(): boolean {
|
|
2795
|
+
return this.iconType !== 'default'
|
|
2796
|
+
}
|
|
1468
2797
|
|
|
1469
|
-
|
|
2798
|
+
private statusIconMap: Record<string, IconName> = {
|
|
2799
|
+
info: 'info-circle',
|
|
2800
|
+
success: 'check-circle',
|
|
2801
|
+
warning: 'exclamation-triangle',
|
|
2802
|
+
error: 'x-circle',
|
|
2803
|
+
}
|
|
1470
2804
|
|
|
1471
|
-
|
|
2805
|
+
/**
|
|
2806
|
+
* Generates the SVG markup for the status icon.
|
|
2807
|
+
* @returns The SVG string for the current status icon.
|
|
2808
|
+
*/
|
|
2809
|
+
get statusIconSvg(): string {
|
|
2810
|
+
const name = this.statusIconMap[this.iconType]
|
|
2811
|
+
return name ? getIconSvg(name, this.cm.iconMd) : ''
|
|
2812
|
+
}
|
|
1472
2813
|
|
|
1473
|
-
|
|
2814
|
+
/**
|
|
2815
|
+
* Generates the SVG markup for the dismiss icon.
|
|
2816
|
+
* @returns The SVG string for the dismiss button icon.
|
|
2817
|
+
*/
|
|
2818
|
+
get dismissIconSvg(): string {
|
|
2819
|
+
return getIconSvg('x-mark', this.cm.iconSm)
|
|
2820
|
+
}
|
|
1474
2821
|
|
|
1475
|
-
|
|
2822
|
+
/**
|
|
2823
|
+
* Computes the combined CSS classes for the toast container.
|
|
2824
|
+
* @returns The toast class name string.
|
|
2825
|
+
*/
|
|
2826
|
+
get toastClasses(): string {
|
|
2827
|
+
const variant = statusVariantMap[this.status] || 'default'
|
|
2828
|
+
return this.cm.cn(this.cm.toast({ variant }), this.className)
|
|
2829
|
+
}
|
|
1476
2830
|
|
|
1477
|
-
|
|
2831
|
+
/**
|
|
2832
|
+
* Starts the auto-dismiss timer on component creation.
|
|
2833
|
+
*/
|
|
2834
|
+
ngOnInit(): void {
|
|
2835
|
+
if (this.duration > 0) {
|
|
2836
|
+
this.timer = setTimeout(() => {
|
|
2837
|
+
this.isVisible = false
|
|
2838
|
+
this.dismiss.emit()
|
|
2839
|
+
}, this.duration)
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
1478
2842
|
|
|
1479
|
-
|
|
2843
|
+
/**
|
|
2844
|
+
* Clears the auto-dismiss timer on component destruction.
|
|
2845
|
+
*/
|
|
2846
|
+
ngOnDestroy(): void {
|
|
2847
|
+
if (this.timer) {
|
|
2848
|
+
clearTimeout(this.timer)
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
1480
2851
|
|
|
1481
|
-
|
|
2852
|
+
/**
|
|
2853
|
+
* Handles the dismiss action by hiding the toast.
|
|
2854
|
+
*/
|
|
2855
|
+
onDismiss(): void {
|
|
2856
|
+
this.isVisible = false
|
|
2857
|
+
this.dismiss.emit()
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
```
|
|
1482
2861
|
|
|
1483
2862
|
#### `MoleculeTooltip`
|
|
1484
2863
|
|
|
@@ -1487,32 +2866,185 @@ Angular Tooltip UI component with UIClassMap-driven styling.
|
|
|
1487
2866
|
Wraps child content and shows a tooltip on hover/focus. `hasArrow` renders
|
|
1488
2867
|
a small themed pointer at the resolved `placement` edge.
|
|
1489
2868
|
|
|
1490
|
-
### Functions
|
|
1491
|
-
|
|
1492
|
-
#### `cn(inputs)`
|
|
1493
|
-
|
|
1494
|
-
Merge class names, filtering out falsy values.
|
|
1495
|
-
|
|
1496
2869
|
```typescript
|
|
1497
|
-
|
|
1498
|
-
|
|
2870
|
+
@Component({
|
|
2871
|
+
selector: 'mol-tooltip',
|
|
2872
|
+
standalone: true,
|
|
2873
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2874
|
+
template: `
|
|
2875
|
+
<div
|
|
2876
|
+
#trigger
|
|
2877
|
+
[class]="cm.tooltipTrigger"
|
|
2878
|
+
(mouseenter)="show()"
|
|
2879
|
+
(mouseleave)="hide()"
|
|
2880
|
+
(focus)="show()"
|
|
2881
|
+
(blur)="hide()"
|
|
2882
|
+
>
|
|
2883
|
+
<ng-content></ng-content>
|
|
2884
|
+
</div>
|
|
2885
|
+
@if (isVisible) {
|
|
2886
|
+
<!--
|
|
2887
|
+
Outer positioned wrapper carries the top/left/z-index placement; the
|
|
2888
|
+
arrow renders as its SIBLING (not nested inside the visible box),
|
|
2889
|
+
because tooltipContent sets overflow-hidden — an arrow meant to poke
|
|
2890
|
+
past the box's own edge would be clipped invisible if it were a
|
|
2891
|
+
descendant of that element instead.
|
|
2892
|
+
-->
|
|
2893
|
+
<div [style]="positionStyle">
|
|
2894
|
+
<div
|
|
2895
|
+
#tooltipEl
|
|
2896
|
+
role="tooltip"
|
|
2897
|
+
[class]="tooltipClasses"
|
|
2898
|
+
[style]="style"
|
|
2899
|
+
[attr.data-testid]="testId"
|
|
2900
|
+
>
|
|
2901
|
+
{{ content }}
|
|
2902
|
+
</div>
|
|
2903
|
+
@if (hasArrow) {
|
|
2904
|
+
<span aria-hidden="true" [style]="arrowStyle"></span>
|
|
2905
|
+
}
|
|
2906
|
+
</div>
|
|
2907
|
+
}
|
|
2908
|
+
`,
|
|
2909
|
+
})
|
|
2910
|
+
/**
|
|
2911
|
+
* Molecule Tooltip class.
|
|
2912
|
+
*/
|
|
2913
|
+
export class MoleculeTooltip implements OnDestroy {
|
|
2914
|
+
@Input() content = ''
|
|
2915
|
+
@Input() placement: TooltipPlacement = 'top'
|
|
2916
|
+
@Input() delay = 0
|
|
2917
|
+
@Input() hasArrow = false
|
|
2918
|
+
@Input() className?: string
|
|
2919
|
+
@Input() style?: Record<string, string>
|
|
2920
|
+
@Input() testId?: string
|
|
2921
|
+
|
|
2922
|
+
@ViewChild('trigger') triggerRef?: ElementRef<HTMLDivElement>
|
|
2923
|
+
@ViewChild('tooltipEl') tooltipRef?: ElementRef<HTMLDivElement>
|
|
2924
|
+
|
|
2925
|
+
isVisible = false
|
|
2926
|
+
positionStyle: Record<string, string> = {}
|
|
2927
|
+
private timeoutId?: ReturnType<typeof setTimeout>
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* Retrieves the current UI class map.
|
|
2931
|
+
* @returns The UIClassMap instance for styling.
|
|
2932
|
+
*/
|
|
2933
|
+
get cm(): UIClassMap {
|
|
2934
|
+
return getClassMap()
|
|
2935
|
+
}
|
|
1499
2936
|
|
|
1500
|
-
|
|
2937
|
+
/**
|
|
2938
|
+
* Computes the combined CSS classes for the tooltip content.
|
|
2939
|
+
* @returns The tooltip class name string.
|
|
2940
|
+
*/
|
|
2941
|
+
get tooltipClasses(): string {
|
|
2942
|
+
return this.cm.cn(this.cm.tooltipContent, this.className)
|
|
2943
|
+
}
|
|
1501
2944
|
|
|
1502
|
-
|
|
2945
|
+
/**
|
|
2946
|
+
* Retrieves the inline style for the tooltip's arrow element.
|
|
2947
|
+
* @returns Inline style positioning the rotated-square arrow.
|
|
2948
|
+
*/
|
|
2949
|
+
get arrowStyle(): Record<string, string> {
|
|
2950
|
+
return getTooltipArrowStyle(this.placement)
|
|
2951
|
+
}
|
|
1503
2952
|
|
|
1504
|
-
|
|
2953
|
+
/**
|
|
2954
|
+
* Shows the tooltip with optional delay.
|
|
2955
|
+
*/
|
|
2956
|
+
show(): void {
|
|
2957
|
+
if (this.delay > 0) {
|
|
2958
|
+
this.timeoutId = setTimeout(() => {
|
|
2959
|
+
this.isVisible = true
|
|
2960
|
+
this.updatePosition()
|
|
2961
|
+
}, this.delay)
|
|
2962
|
+
} else {
|
|
2963
|
+
this.isVisible = true
|
|
2964
|
+
requestAnimationFrame(() => this.updatePosition())
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
1505
2967
|
|
|
1506
|
-
|
|
2968
|
+
/**
|
|
2969
|
+
* Hides the tooltip and cancels any pending delay.
|
|
2970
|
+
*/
|
|
2971
|
+
hide(): void {
|
|
2972
|
+
if (this.timeoutId) {
|
|
2973
|
+
clearTimeout(this.timeoutId)
|
|
2974
|
+
}
|
|
2975
|
+
this.isVisible = false
|
|
2976
|
+
}
|
|
1507
2977
|
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
2978
|
+
/**
|
|
2979
|
+
* Clears pending timeouts on component destruction.
|
|
2980
|
+
*/
|
|
2981
|
+
ngOnDestroy(): void {
|
|
2982
|
+
if (this.timeoutId) {
|
|
2983
|
+
clearTimeout(this.timeoutId)
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
1511
2986
|
|
|
1512
|
-
|
|
1513
|
-
|
|
2987
|
+
/**
|
|
2988
|
+
* Calculates and applies the tooltip position relative to the trigger.
|
|
2989
|
+
*/
|
|
2990
|
+
private updatePosition(): void {
|
|
2991
|
+
if (!this.triggerRef?.nativeElement || !this.tooltipRef?.nativeElement) return
|
|
2992
|
+
|
|
2993
|
+
const triggerRect = this.triggerRef.nativeElement.getBoundingClientRect()
|
|
2994
|
+
const tooltipRect = this.tooltipRef.nativeElement.getBoundingClientRect()
|
|
2995
|
+
const offset = 8
|
|
2996
|
+
|
|
2997
|
+
const { top, left, width, height } = triggerRect
|
|
2998
|
+
const tooltipWidth = tooltipRect.width
|
|
2999
|
+
const tooltipHeight = tooltipRect.height
|
|
3000
|
+
|
|
3001
|
+
const positions: Record<TooltipPlacement, { top: number; left: number }> = {
|
|
3002
|
+
top: {
|
|
3003
|
+
top: top + window.scrollY - tooltipHeight - offset,
|
|
3004
|
+
left: left + window.scrollX + width / 2 - tooltipWidth / 2,
|
|
3005
|
+
},
|
|
3006
|
+
bottom: {
|
|
3007
|
+
top: top + window.scrollY + height + offset,
|
|
3008
|
+
left: left + window.scrollX + width / 2 - tooltipWidth / 2,
|
|
3009
|
+
},
|
|
3010
|
+
left: {
|
|
3011
|
+
top: top + window.scrollY + height / 2 - tooltipHeight / 2,
|
|
3012
|
+
left: left + window.scrollX - tooltipWidth - offset,
|
|
3013
|
+
},
|
|
3014
|
+
right: {
|
|
3015
|
+
top: top + window.scrollY + height / 2 - tooltipHeight / 2,
|
|
3016
|
+
left: left + window.scrollX + width + offset,
|
|
3017
|
+
},
|
|
3018
|
+
'top-start': {
|
|
3019
|
+
top: top + window.scrollY - tooltipHeight - offset,
|
|
3020
|
+
left: left + window.scrollX,
|
|
3021
|
+
},
|
|
3022
|
+
'top-end': {
|
|
3023
|
+
top: top + window.scrollY - tooltipHeight - offset,
|
|
3024
|
+
left: left + window.scrollX + width - tooltipWidth,
|
|
3025
|
+
},
|
|
3026
|
+
'bottom-start': {
|
|
3027
|
+
top: top + window.scrollY + height + offset,
|
|
3028
|
+
left: left + window.scrollX,
|
|
3029
|
+
},
|
|
3030
|
+
'bottom-end': {
|
|
3031
|
+
top: top + window.scrollY + height + offset,
|
|
3032
|
+
left: left + window.scrollX + width - tooltipWidth,
|
|
3033
|
+
},
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
const pos = positions[this.placement]
|
|
3037
|
+
this.positionStyle = {
|
|
3038
|
+
position: 'absolute',
|
|
3039
|
+
top: `${pos.top}px`,
|
|
3040
|
+
left: `${pos.left}px`,
|
|
3041
|
+
zIndex: '9999',
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
```
|
|
1514
3046
|
|
|
1515
|
-
|
|
3047
|
+
### Functions
|
|
1516
3048
|
|
|
1517
3049
|
#### `getModalWrapperStyle(centered)`
|
|
1518
3050
|
|
|
@@ -1556,6 +3088,31 @@ function getTooltipArrowStyle(placement: TooltipPlacement): Record<string, strin
|
|
|
1556
3088
|
|
|
1557
3089
|
**Returns:** Inline style positioning the rotated-square arrow for that placement.
|
|
1558
3090
|
|
|
3091
|
+
#### `getIconSvg(name, className)`
|
|
3092
|
+
|
|
3093
|
+
Generates SVG markup string from an icon name.
|
|
3094
|
+
|
|
3095
|
+
```typescript
|
|
3096
|
+
function getIconSvg(name: IconName, className: string): string
|
|
3097
|
+
```
|
|
3098
|
+
|
|
3099
|
+
- `name` — Icon name from the icon set
|
|
3100
|
+
- `className` — CSS class for sizing
|
|
3101
|
+
|
|
3102
|
+
**Returns:** SVG markup string
|
|
3103
|
+
|
|
3104
|
+
#### `cn(inputs)`
|
|
3105
|
+
|
|
3106
|
+
Merge class names, filtering out falsy values.
|
|
3107
|
+
|
|
3108
|
+
```typescript
|
|
3109
|
+
function cn(inputs?: (string | false | null | undefined)[]): string
|
|
3110
|
+
```
|
|
3111
|
+
|
|
3112
|
+
- `inputs` — The inputs.
|
|
3113
|
+
|
|
3114
|
+
**Returns:** The resulting string.
|
|
3115
|
+
|
|
1559
3116
|
## Injection Notes
|
|
1560
3117
|
|
|
1561
3118
|
### Requirements
|