@molecule/app-ui 1.5.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2067 -26
- package/dist/elements.d.ts +1322 -0
- package/dist/elements.d.ts.map +1 -0
- package/dist/elements.js +28 -0
- package/dist/elements.js.map +1 -0
- package/dist/field-layout.d.ts +33 -0
- package/dist/field-layout.d.ts.map +1 -0
- package/dist/field-layout.js +34 -0
- package/dist/field-layout.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/overlay-position.d.ts +25 -0
- package/dist/overlay-position.d.ts.map +1 -0
- package/dist/overlay-position.js +77 -0
- package/dist/overlay-position.js.map +1 -0
- package/dist/overlay.d.ts +46 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +6 -0
- package/dist/overlay.js.map +1 -0
- package/dist/toast-countdown.d.ts +23 -0
- package/dist/toast-countdown.d.ts.map +1 -0
- package/dist/toast-countdown.js +56 -0
- package/dist/toast-countdown.js.map +1 -0
- package/dist/types.d.ts +56 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ 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-11-
|
|
6
|
+
Generated: 2026-11-26T04:13:52.872Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-ui
|
|
@@ -37,13 +37,1538 @@ const cm = getClassMap()
|
|
|
37
37
|
## Installation
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install @molecule/app-ui @molecule/app-bond @molecule/app-i18n
|
|
40
|
+
npm install @molecule/app-ui @molecule/app-bond @molecule/app-filesystem @molecule/app-i18n
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## API
|
|
44
44
|
|
|
45
45
|
### Interfaces
|
|
46
46
|
|
|
47
|
+
#### `ElementHandle`
|
|
48
|
+
|
|
49
|
+
What an element's `ref` receives on every renderer: a DOM element and a React Native host
|
|
50
|
+
instance both satisfy it. Measure an element with the kit's `measureElement`, never with
|
|
51
|
+
`getBoundingClientRect`.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
interface ElementHandle {
|
|
55
|
+
/** Moves focus to the element. */
|
|
56
|
+
focus(): void
|
|
57
|
+
/** Removes focus from the element. */
|
|
58
|
+
blur(): void
|
|
59
|
+
/** Selects the entire current text field value, via DOM selection or native TextInput selection. */
|
|
60
|
+
select?(): void
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### `ElementBox`
|
|
65
|
+
|
|
66
|
+
An element's box in the window, in CSS pixels on the web and density-independent pixels on native.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
interface ElementBox {
|
|
70
|
+
/** Distance from the window's left edge. */
|
|
71
|
+
x: number
|
|
72
|
+
/** Distance from the window's top edge. */
|
|
73
|
+
y: number
|
|
74
|
+
/** Width of the box. */
|
|
75
|
+
width: number
|
|
76
|
+
/** Height of the box. */
|
|
77
|
+
height: number
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### `ElementViewport`
|
|
82
|
+
|
|
83
|
+
The visible window containing a registered element.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
interface ElementViewport {
|
|
87
|
+
/** Available width, excluding the browser's scrollbar, or the native window width. */
|
|
88
|
+
readonly width: number
|
|
89
|
+
/** Full browser viewport or native window height. */
|
|
90
|
+
readonly height: number
|
|
91
|
+
/** Height excluding the browser's scrollbar. Equal to height on a device. */
|
|
92
|
+
readonly contentHeight: number
|
|
93
|
+
/** Web content uses the document scroll. Device content scrolls in an element. */
|
|
94
|
+
readonly scrollOwner: 'document' | 'element'
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### `ElementDragPoint`
|
|
99
|
+
|
|
100
|
+
One sample from the contact that owns a drag, in CSS pixels on web or dp on native.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
interface ElementDragPoint extends KitModifierKeys {
|
|
104
|
+
/** Unclamped horizontal offset from the current HTML box, SVG viewport, or native frame. */
|
|
105
|
+
readonly x: number
|
|
106
|
+
/** Unclamped vertical offset from the current HTML box, SVG viewport, or native frame. */
|
|
107
|
+
readonly y: number
|
|
108
|
+
/** Horizontal displacement from contact-down in viewport axes on either renderer. */
|
|
109
|
+
readonly dx: number
|
|
110
|
+
/** Vertical displacement from contact-down in viewport axes on either renderer. */
|
|
111
|
+
readonly dy: number
|
|
112
|
+
/** Current frame in the same window space as the renderer's `measureElement`. */
|
|
113
|
+
readonly bounds: Readonly<ElementBox>
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### `ElementDrag`
|
|
118
|
+
|
|
119
|
+
One primary contact, owned until release or interruption on web and native.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface ElementDrag {
|
|
123
|
+
/** Axis used to negotiate with an enclosing scroller on either renderer. Defaults to both. */
|
|
124
|
+
axis?: 'horizontal' | 'vertical' | 'both'
|
|
125
|
+
/** Whether touch acquires on contact or waits for a long press so an ordinary swipe can scroll. */
|
|
126
|
+
touchStart?: 'immediate' | 'longPress'
|
|
127
|
+
/** Acquires once, including a stationary mouse, pen, or touch on either renderer. */
|
|
128
|
+
onStart(point: ElementDragPoint): void
|
|
129
|
+
/** Reports motion of the owned pointer or native responder, including outside the surface. */
|
|
130
|
+
onMove?(point: ElementDragPoint): void
|
|
131
|
+
/** Reports the final position on web pointer-up or native touch release. */
|
|
132
|
+
onEnd?(point: ElementDragPoint): void
|
|
133
|
+
/** Reports the last reliable sample on web capture loss or native responder interruption. */
|
|
134
|
+
onCancel?(point: ElementDragPoint): void
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### `ElementDragProps`
|
|
139
|
+
|
|
140
|
+
Continuous manipulation of an element, through pointer capture or the native touch responder.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
interface ElementDragProps {
|
|
144
|
+
/** Binds one contact on the current box or the enclosing SVG viewport. */
|
|
145
|
+
drag?: ElementDrag
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### `BoxStyle`
|
|
150
|
+
|
|
151
|
+
Inline layout and paint that CSS and React Native apply the same way. Numbers are CSS pixels on
|
|
152
|
+
the web and density-independent pixels on native. Shorthand strings (`padding: '8px 12px'`,
|
|
153
|
+
`border: '1px solid'`), CSS grid, `calc()`, `var()` and units other than pixels and percent are
|
|
154
|
+
not accepted: write longhands, or use a ClassMap class (the nativewind ClassMap translates
|
|
155
|
+
classes for native).
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
interface BoxStyle {
|
|
159
|
+
/** `'flex'` or `'none'`; every native view is a flex container. */
|
|
160
|
+
display?: 'flex' | 'none'
|
|
161
|
+
/** Positioning scheme. */
|
|
162
|
+
position?: 'relative' | 'absolute'
|
|
163
|
+
/** Offset from the containing block's top. */
|
|
164
|
+
top?: ElementLength
|
|
165
|
+
/** Offset from the containing block's right. */
|
|
166
|
+
right?: ElementLength
|
|
167
|
+
/** Offset from the containing block's bottom. */
|
|
168
|
+
bottom?: ElementLength
|
|
169
|
+
/** Offset from the containing block's left. */
|
|
170
|
+
left?: ElementLength
|
|
171
|
+
/** Width. */
|
|
172
|
+
width?: ElementLength
|
|
173
|
+
/** Height. */
|
|
174
|
+
height?: ElementLength
|
|
175
|
+
/** Minimum width. */
|
|
176
|
+
minWidth?: ElementLength
|
|
177
|
+
/** Minimum height. */
|
|
178
|
+
minHeight?: ElementLength
|
|
179
|
+
/** Maximum width. */
|
|
180
|
+
maxWidth?: ElementLength
|
|
181
|
+
/** Maximum height. */
|
|
182
|
+
maxHeight?: ElementLength
|
|
183
|
+
/** Margin on all sides. */
|
|
184
|
+
margin?: ElementLength | 'auto'
|
|
185
|
+
/** Top margin. */
|
|
186
|
+
marginTop?: ElementLength | 'auto'
|
|
187
|
+
/** Right margin. */
|
|
188
|
+
marginRight?: ElementLength | 'auto'
|
|
189
|
+
/** Bottom margin. */
|
|
190
|
+
marginBottom?: ElementLength | 'auto'
|
|
191
|
+
/** Left margin. */
|
|
192
|
+
marginLeft?: ElementLength | 'auto'
|
|
193
|
+
/** Padding on all sides. */
|
|
194
|
+
padding?: ElementLength
|
|
195
|
+
/** Top padding. */
|
|
196
|
+
paddingTop?: ElementLength
|
|
197
|
+
/** Right padding. */
|
|
198
|
+
paddingRight?: ElementLength
|
|
199
|
+
/** Bottom padding. */
|
|
200
|
+
paddingBottom?: ElementLength
|
|
201
|
+
/** Left padding. */
|
|
202
|
+
paddingLeft?: ElementLength
|
|
203
|
+
/** Grow and shrink factor with a zero basis (`flex: 1`). */
|
|
204
|
+
flex?: number
|
|
205
|
+
/** Grow factor. */
|
|
206
|
+
flexGrow?: number
|
|
207
|
+
/** Shrink factor. */
|
|
208
|
+
flexShrink?: number
|
|
209
|
+
/** Initial main size. */
|
|
210
|
+
flexBasis?: ElementLength | 'auto'
|
|
211
|
+
/** Main axis direction. */
|
|
212
|
+
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
213
|
+
/** Whether lines wrap. */
|
|
214
|
+
flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse'
|
|
215
|
+
/** Cross-axis alignment of children. */
|
|
216
|
+
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'
|
|
217
|
+
/** Cross-axis alignment of this element. */
|
|
218
|
+
alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'
|
|
219
|
+
/** Cross-axis alignment of wrapped lines. */
|
|
220
|
+
alignContent?:
|
|
221
|
+
| 'flex-start'
|
|
222
|
+
| 'flex-end'
|
|
223
|
+
| 'center'
|
|
224
|
+
| 'stretch'
|
|
225
|
+
| 'space-between'
|
|
226
|
+
| 'space-around'
|
|
227
|
+
| 'space-evenly'
|
|
228
|
+
/** Main-axis alignment of children. */
|
|
229
|
+
justifyContent?:
|
|
230
|
+
'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'
|
|
231
|
+
/** Gap between children. */
|
|
232
|
+
gap?: number
|
|
233
|
+
/** Gap between rows. */
|
|
234
|
+
rowGap?: number
|
|
235
|
+
/** Gap between columns. */
|
|
236
|
+
columnGap?: number
|
|
237
|
+
/** Clipping of overflowing children (scrolling content belongs in a `ScrollArea`). */
|
|
238
|
+
overflow?: 'visible' | 'hidden'
|
|
239
|
+
/** Stacking order. */
|
|
240
|
+
zIndex?: number
|
|
241
|
+
/** Width-to-height ratio. */
|
|
242
|
+
aspectRatio?: number
|
|
243
|
+
/** Whether the element receives pointer and touch events. */
|
|
244
|
+
pointerEvents?: 'auto' | 'none'
|
|
245
|
+
/** Opacity, 0 to 1. */
|
|
246
|
+
opacity?: number
|
|
247
|
+
/** Background colour (a theme colour belongs in a ClassMap class). */
|
|
248
|
+
backgroundColor?: string
|
|
249
|
+
/** Border width on all sides. */
|
|
250
|
+
borderWidth?: number
|
|
251
|
+
/** Top border width. */
|
|
252
|
+
borderTopWidth?: number
|
|
253
|
+
/** Right border width. */
|
|
254
|
+
borderRightWidth?: number
|
|
255
|
+
/** Bottom border width. */
|
|
256
|
+
borderBottomWidth?: number
|
|
257
|
+
/** Left border width. */
|
|
258
|
+
borderLeftWidth?: number
|
|
259
|
+
/** Border colour on all sides. */
|
|
260
|
+
borderColor?: string
|
|
261
|
+
/** Top border colour. */
|
|
262
|
+
borderTopColor?: string
|
|
263
|
+
/** Right border colour. */
|
|
264
|
+
borderRightColor?: string
|
|
265
|
+
/** Bottom border colour. */
|
|
266
|
+
borderBottomColor?: string
|
|
267
|
+
/** Left border colour. */
|
|
268
|
+
borderLeftColor?: string
|
|
269
|
+
/** Border line style. */
|
|
270
|
+
borderStyle?: 'solid' | 'dotted' | 'dashed'
|
|
271
|
+
/** Corner radius on all corners. */
|
|
272
|
+
borderRadius?: number
|
|
273
|
+
/** Top-left corner radius. */
|
|
274
|
+
borderTopLeftRadius?: number
|
|
275
|
+
/** Top-right corner radius. */
|
|
276
|
+
borderTopRightRadius?: number
|
|
277
|
+
/** Bottom-left corner radius. */
|
|
278
|
+
borderBottomLeftRadius?: number
|
|
279
|
+
/** Bottom-right corner radius. */
|
|
280
|
+
borderBottomRightRadius?: number
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### `TextStyle`
|
|
285
|
+
|
|
286
|
+
{@link BoxStyle} plus the text properties, for a {@link TextProps} element only: on native,
|
|
287
|
+
text styles apply to a `Text` and are not inherited from a view.
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
interface TextStyle extends BoxStyle {
|
|
291
|
+
/** Text colour (a theme colour belongs in a ClassMap class). */
|
|
292
|
+
color?: string
|
|
293
|
+
/** Font size. */
|
|
294
|
+
fontSize?: number
|
|
295
|
+
/** Font weight. */
|
|
296
|
+
fontWeight?:
|
|
297
|
+
'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'
|
|
298
|
+
/** Font style. */
|
|
299
|
+
fontStyle?: 'normal' | 'italic'
|
|
300
|
+
/** Line height in pixels (a multiplier such as `1.5` belongs in a ClassMap class). */
|
|
301
|
+
lineHeight?: `${number}px`
|
|
302
|
+
/** Spacing between letters. */
|
|
303
|
+
letterSpacing?: number
|
|
304
|
+
/** Horizontal alignment. */
|
|
305
|
+
textAlign?: 'left' | 'right' | 'center' | 'justify'
|
|
306
|
+
/** Letter case. */
|
|
307
|
+
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize'
|
|
308
|
+
/** Underline and strike-through. */
|
|
309
|
+
textDecorationLine?: 'none' | 'underline' | 'line-through' | 'underline line-through'
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
#### `AriaAttributes`
|
|
314
|
+
|
|
315
|
+
The accessibility attributes both renderers apply.
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
interface AriaAttributes {
|
|
319
|
+
'aria-label'?: string
|
|
320
|
+
'aria-labelledby'?: string
|
|
321
|
+
'aria-describedby'?: string
|
|
322
|
+
'aria-hidden'?: AriaBoolean
|
|
323
|
+
'aria-disabled'?: AriaBoolean
|
|
324
|
+
'aria-expanded'?: AriaBoolean
|
|
325
|
+
'aria-selected'?: AriaBoolean
|
|
326
|
+
'aria-checked'?: AriaBoolean | 'mixed'
|
|
327
|
+
'aria-pressed'?: AriaBoolean | 'mixed'
|
|
328
|
+
'aria-busy'?: AriaBoolean
|
|
329
|
+
'aria-live'?: 'off' | 'polite' | 'assertive'
|
|
330
|
+
'aria-valuenow'?: number
|
|
331
|
+
'aria-valuemin'?: number
|
|
332
|
+
'aria-valuemax'?: number
|
|
333
|
+
'aria-valuetext'?: string
|
|
334
|
+
'aria-current'?: AriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time'
|
|
335
|
+
'aria-controls'?: string
|
|
336
|
+
'aria-haspopup'?: AriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'
|
|
337
|
+
'aria-modal'?: AriaBoolean
|
|
338
|
+
'aria-invalid'?: AriaBoolean
|
|
339
|
+
'aria-required'?: AriaBoolean
|
|
340
|
+
'aria-readonly'?: AriaBoolean
|
|
341
|
+
'aria-orientation'?: 'horizontal' | 'vertical'
|
|
342
|
+
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'
|
|
343
|
+
/** Web heading or tree depth. Native announces the depth and keeps the element's role. */
|
|
344
|
+
'aria-level'?: number
|
|
345
|
+
/** Web row total. Native exposes collection metadata or announces the localized total. */
|
|
346
|
+
'aria-rowcount'?: number
|
|
347
|
+
/** Web column total. Native exposes collection metadata or announces the localized total. */
|
|
348
|
+
'aria-colcount'?: number
|
|
349
|
+
/** One-based web row position. Native converts to collection metadata or announces the position. */
|
|
350
|
+
'aria-rowindex'?: number
|
|
351
|
+
/** One-based web column position. Native converts to collection metadata or announces the position. */
|
|
352
|
+
'aria-colindex'?: number
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
#### `ElementProps`
|
|
357
|
+
|
|
358
|
+
Props every element takes.
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
interface ElementProps extends AriaAttributes, DataAttributes {
|
|
362
|
+
/** Element id (native `nativeID`). */
|
|
363
|
+
id?: string
|
|
364
|
+
/** ClassMap classes (`cm.*`). */
|
|
365
|
+
className?: string
|
|
366
|
+
/** Accessibility role, when it differs from the one `as` implies. */
|
|
367
|
+
role?: ElementRole
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### `InteractionProps`
|
|
372
|
+
|
|
373
|
+
The interaction handlers a focusable element takes on both renderers.
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
interface InteractionProps {
|
|
377
|
+
/** Activation: a click on the web, a press on native. */
|
|
378
|
+
onClick?: MouseEventHandler
|
|
379
|
+
/** Pointer enters (native: hover in, where the device has a pointer). */
|
|
380
|
+
onMouseEnter?: MouseEventHandler
|
|
381
|
+
/** Pointer leaves (native: hover out). */
|
|
382
|
+
onMouseLeave?: MouseEventHandler
|
|
383
|
+
/** The element gains focus. */
|
|
384
|
+
onFocus?: FocusEventHandler
|
|
385
|
+
/** The element loses focus. */
|
|
386
|
+
onBlur?: FocusEventHandler
|
|
387
|
+
/** A hardware key goes down; every key action also needs a touch route. */
|
|
388
|
+
onKeyDown?: KeyboardEventHandler
|
|
389
|
+
/** A hardware key goes up. */
|
|
390
|
+
onKeyUp?: KeyboardEventHandler
|
|
391
|
+
/** Web-only: a device has no double click. */
|
|
392
|
+
onDoubleClick?: MouseEventHandler
|
|
393
|
+
/** Web-only (deprecated on the web too); a hardware key press. */
|
|
394
|
+
onKeyPress?: KeyboardEventHandler
|
|
395
|
+
/** Tab order: in it (`0`) or only programmatically focusable (`-1`). */
|
|
396
|
+
tabIndex?: number
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
#### `MousePressProps`
|
|
401
|
+
|
|
402
|
+
Mouse handlers for containers and controls with corresponding device gestures.
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
interface MousePressProps {
|
|
406
|
+
/** DOM context menu. Native calls this for a stationary long press or secondary activation. */
|
|
407
|
+
onContextMenu?: MouseEventHandler
|
|
408
|
+
/** DOM mouse down. Native calls this on press-in and observes canceled activation. */
|
|
409
|
+
onMouseDown?: MouseEventHandler
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
#### `BoxProps`
|
|
414
|
+
|
|
415
|
+
A container (native `View`; a native `Pressable` when it has a press, hover or focus handler or a
|
|
416
|
+
tab stop, as a `div` with `onClick` is). Bare text inside it is laid out as the web lays it out
|
|
417
|
+
(in a flex container, its own flex item; in any other, a line with its inline siblings). Use
|
|
418
|
+
{@link PressableProps} for a control: a button, or anything announced as one.
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
interface BoxProps<Node = unknown>
|
|
422
|
+
extends ElementProps, InteractionProps, MousePressProps, ElementDragProps {
|
|
423
|
+
/** The web tag. A label activates the first labelable control it wraps. */
|
|
424
|
+
as: BoxTag | 'label'
|
|
425
|
+
/** Tooltip text (native: the accessibility label when there is no `aria-label`). */
|
|
426
|
+
title?: string
|
|
427
|
+
/** HTML hidden state. Native excludes the box from layout, hits and accessibility while mounted. */
|
|
428
|
+
hidden?: boolean
|
|
429
|
+
/** Native groups the box and its contents as one screen-reader element when true. Web ignores this. */
|
|
430
|
+
accessibilityGroup?: boolean
|
|
431
|
+
/** Web outside mouse down. Native observes outside touches in the enclosing box tree. */
|
|
432
|
+
onPressOutside?: () => void
|
|
433
|
+
/** Observes touch-down, including on a child, without claiming it on web or native. */
|
|
434
|
+
onTouchStart?: () => void
|
|
435
|
+
/** A browser double-click, native double tap, or native assistive action. */
|
|
436
|
+
secondaryAction?: {
|
|
437
|
+
/** Localized name for the native accessibility action. The browser adds no attribute. */
|
|
438
|
+
label: string
|
|
439
|
+
/** Runs the secondary action from the browser event or native gesture or assistive action. */
|
|
440
|
+
run: () => void
|
|
441
|
+
}
|
|
442
|
+
/** Consumes plain-text paste on the web or through a native field or focused Paste command. */
|
|
443
|
+
onPasteText?: (text: string) => void
|
|
444
|
+
/** Layout and paint both renderers apply. */
|
|
445
|
+
style?: BoxStyle & {
|
|
446
|
+
/**
|
|
447
|
+
* URI painted behind the contents, centered and sized to cover the box. Web emits
|
|
448
|
+
* CSS background declarations here. Native draws a decorative image within the box.
|
|
449
|
+
* An empty URI leaves the box's background color visible.
|
|
450
|
+
*/
|
|
451
|
+
coverImage?: string
|
|
452
|
+
}
|
|
453
|
+
/** Web-only paint. */
|
|
454
|
+
webStyle?: WebStyle
|
|
455
|
+
/** Child elements. */
|
|
456
|
+
children?: Node
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### `DisclosureSummaryProps`
|
|
461
|
+
|
|
462
|
+
Attributes of the browser summary or its native pressable control.
|
|
463
|
+
|
|
464
|
+
```typescript
|
|
465
|
+
interface DisclosureSummaryProps extends ElementProps {
|
|
466
|
+
/** Layout and paint for the summary on web and device. */
|
|
467
|
+
style?: BoxStyle
|
|
468
|
+
/** CSS for the summary. Devices apply the subset they can draw. */
|
|
469
|
+
webStyle?: WebStyle
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
#### `DisclosureProps`
|
|
474
|
+
|
|
475
|
+
A disclosure with a first-child summary and a body that stays mounted while closed.
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
interface DisclosureProps<Node = unknown> extends ElementProps {
|
|
479
|
+
/** A literal details element on web and a view on device. */
|
|
480
|
+
as: 'details'
|
|
481
|
+
/** Initial open state and subsequent parent changes. Both renderers default to closed. */
|
|
482
|
+
open?: boolean
|
|
483
|
+
/** Content of the browser summary or native pressable summary. */
|
|
484
|
+
summary: Node
|
|
485
|
+
/** Attributes on the summary element or native pressable itself. */
|
|
486
|
+
summaryProps?: DisclosureSummaryProps
|
|
487
|
+
/** Reports the resulting state after the browser toggle event or a queued native transition. */
|
|
488
|
+
onToggle?: (open: boolean) => void
|
|
489
|
+
/** Layout and paint for the whole disclosure on web and device. */
|
|
490
|
+
style?: BoxStyle
|
|
491
|
+
/** CSS for the details element. Devices apply the subset they can draw. */
|
|
492
|
+
webStyle?: WebStyle
|
|
493
|
+
/** Body content. Both renderers hide it while closed and preserve its state. */
|
|
494
|
+
children?: Node
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
#### `RuleProps`
|
|
499
|
+
|
|
500
|
+
A horizontal thematic break. Web renders a void element and native draws a themed line.
|
|
501
|
+
|
|
502
|
+
```typescript
|
|
503
|
+
interface RuleProps extends ElementProps, Pick<BoxProps, 'style' | 'webStyle'> {
|
|
504
|
+
/** A literal hr on web and a separator view on device. */
|
|
505
|
+
as: 'hr'
|
|
506
|
+
/** A thematic break has no children on either renderer. */
|
|
507
|
+
children?: never
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
#### `GlyphIconProps`
|
|
512
|
+
|
|
513
|
+
A glyph of the icon font (Material Symbols): text on the web, which the font draws by ligature
|
|
514
|
+
(`<span class="…">check_circle</span>`); its codepoint on native, which draws neither ligatures
|
|
515
|
+
nor variable axes. It flows inline, as text.
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
interface GlyphIconProps extends ElementProps {
|
|
519
|
+
/** The glyph's name (`check_circle`). On native, a name the font does not draw renders nothing. */
|
|
520
|
+
name: string
|
|
521
|
+
/** Draws the filled form (the font's `FILL` axis at 1). */
|
|
522
|
+
filled?: boolean
|
|
523
|
+
/** Layout and text paint both renderers apply (`fontSize`). */
|
|
524
|
+
style?: TextStyle
|
|
525
|
+
/** CSS for the web. */
|
|
526
|
+
webStyle?: WebStyle
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### `DotPulseMotion`
|
|
531
|
+
|
|
532
|
+
Fractions of one cycle and the paint at its dimmest point.
|
|
533
|
+
|
|
534
|
+
```typescript
|
|
535
|
+
interface DotPulseMotion {
|
|
536
|
+
/** Full brightness as a fraction of the CSS keyframes and the native cycle, after zero. */
|
|
537
|
+
readonly peakAt: number
|
|
538
|
+
/** Return to dim paint in the CSS keyframes and native cycle, after the peak and at or before one. */
|
|
539
|
+
readonly restAt: number
|
|
540
|
+
/** Delay between dots as a fraction of a cycle, in the CSS animation and native driver. */
|
|
541
|
+
readonly stagger: number
|
|
542
|
+
/** Opacity from zero to one at rest, set by the stylesheet and the native view animation. */
|
|
543
|
+
readonly dimOpacity: number
|
|
544
|
+
/** Scale from zero to one at rest, set by the stylesheet and the native view animation. */
|
|
545
|
+
readonly dimScale: number
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
#### `PulseDotsProps`
|
|
550
|
+
|
|
551
|
+
Three decorative dots drawn in the inherited text colour.
|
|
552
|
+
|
|
553
|
+
```typescript
|
|
554
|
+
interface PulseDotsProps {
|
|
555
|
+
/** Dot diameter, applied to the span in CSS px and the native view in dp. */
|
|
556
|
+
size: number
|
|
557
|
+
/** Duration of one CSS animation cycle on web or one native loop iteration on device, in ms. */
|
|
558
|
+
durationMs: number
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
#### `PressableProps`
|
|
563
|
+
|
|
564
|
+
Something the user activates (native `Pressable`). A string child renders as the web tag's own
|
|
565
|
+
text and inside a native `Text`.
|
|
566
|
+
|
|
567
|
+
```typescript
|
|
568
|
+
interface PressableProps<Node = unknown>
|
|
569
|
+
extends ElementProps, InteractionProps, MousePressProps, ElementDragProps {
|
|
570
|
+
/** The web tag. */
|
|
571
|
+
as: PressableTag
|
|
572
|
+
/** A button's type: always set it, a button inside a form submits it by default. */
|
|
573
|
+
type?: 'button' | 'submit' | 'reset'
|
|
574
|
+
/** Web-only: the form field name a submit button sends. */
|
|
575
|
+
name?: string
|
|
576
|
+
/** Web-only: the value a submit button sends. */
|
|
577
|
+
value?: string
|
|
578
|
+
/** Web-only: the id of the form the button belongs to. */
|
|
579
|
+
form?: string
|
|
580
|
+
/** Whether it is disabled. */
|
|
581
|
+
disabled?: boolean
|
|
582
|
+
/** A browser double-click, device double tap, or device assistive action. */
|
|
583
|
+
secondaryAction?: BoxProps['secondaryAction']
|
|
584
|
+
/** Tooltip text (native: the accessibility label when there is no `aria-label`). */
|
|
585
|
+
title?: string
|
|
586
|
+
/** Layout and paint both renderers apply. */
|
|
587
|
+
style?: BoxStyle
|
|
588
|
+
/** Web-only paint. */
|
|
589
|
+
webStyle?: WebStyle
|
|
590
|
+
/** Content: elements, or a string or number. */
|
|
591
|
+
children?: Node
|
|
592
|
+
}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
#### `ElementLinkProps`
|
|
596
|
+
|
|
597
|
+
A link (native `Pressable` with the link role): an app path navigates through the router, a
|
|
598
|
+
URL on another origin opens outside the app. A string child renders as the link's text.
|
|
599
|
+
|
|
600
|
+
```typescript
|
|
601
|
+
interface ElementLinkProps<Node = unknown> extends ElementProps, InteractionProps {
|
|
602
|
+
/** Destination: an app path (`/settings?tab=billing`) or a URL. */
|
|
603
|
+
to: string
|
|
604
|
+
/** Replace the current history entry instead of pushing one. */
|
|
605
|
+
replace?: boolean
|
|
606
|
+
/** State stored with the new history entry. */
|
|
607
|
+
state?: unknown
|
|
608
|
+
/**
|
|
609
|
+
* Where a URL opens on the web: a browsing-context keyword or name (`_self`, `_blank`, `_parent`,
|
|
610
|
+
* `_top`, or a frame's name). On a device a URL opens outside the app whatever its target.
|
|
611
|
+
*/
|
|
612
|
+
target?: string
|
|
613
|
+
/** Relationship of a URL to the page (`'noopener noreferrer'`). */
|
|
614
|
+
rel?: string
|
|
615
|
+
/** Tooltip text (native: the accessibility label when there is no `aria-label`). */
|
|
616
|
+
title?: string
|
|
617
|
+
/** Layout and paint both renderers apply. */
|
|
618
|
+
style?: BoxStyle
|
|
619
|
+
/** Web-only paint. */
|
|
620
|
+
webStyle?: WebStyle
|
|
621
|
+
/** Content: elements, or a string or number. */
|
|
622
|
+
children?: Node
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
#### `TextFieldKeyEvent`
|
|
627
|
+
|
|
628
|
+
Keyboard input received by a browser text field or native TextInput.
|
|
629
|
+
|
|
630
|
+
```typescript
|
|
631
|
+
interface TextFieldKeyEvent extends KitKeyboardEvent {
|
|
632
|
+
/** The browser reports IME-owned keystrokes, including legacy key code 229. Device key events omit it. */
|
|
633
|
+
readonly isComposing?: boolean
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
#### `TextFieldBaseProps`
|
|
638
|
+
|
|
639
|
+
Props common to a browser text field or text area and the native TextInput.
|
|
640
|
+
|
|
641
|
+
```typescript
|
|
642
|
+
interface TextFieldBaseProps extends ElementProps, Omit<InteractionProps, 'onKeyDown'> {
|
|
643
|
+
/** `input` for one line, `textarea` for several. */
|
|
644
|
+
as: 'input' | 'textarea'
|
|
645
|
+
/**
|
|
646
|
+
* The kind of text (`input` only). A device takes a date or time as text in the web's value
|
|
647
|
+
* format (`YYYY-MM-DD`, `HH:MM`, `YYYY-MM-DDTHH:MM`), so a form receives the same value.
|
|
648
|
+
*/
|
|
649
|
+
type?:
|
|
650
|
+
| 'text'
|
|
651
|
+
| 'email'
|
|
652
|
+
| 'password'
|
|
653
|
+
| 'search'
|
|
654
|
+
| 'number'
|
|
655
|
+
| 'tel'
|
|
656
|
+
| 'url'
|
|
657
|
+
| 'date'
|
|
658
|
+
| 'time'
|
|
659
|
+
| 'datetime-local'
|
|
660
|
+
/** The on-screen keyboard to show. */
|
|
661
|
+
inputMode?: 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'
|
|
662
|
+
/** The field's text. */
|
|
663
|
+
value?: string
|
|
664
|
+
/** The text of a field whose text the caller does not hold, when it mounts. */
|
|
665
|
+
defaultValue?: string
|
|
666
|
+
/** Text shown while the field is empty. */
|
|
667
|
+
placeholder?: string
|
|
668
|
+
/** Whether the user can edit the text. */
|
|
669
|
+
readOnly?: boolean
|
|
670
|
+
/** Whether it is disabled. */
|
|
671
|
+
disabled?: boolean
|
|
672
|
+
/** Whether a form refuses to submit while the field is empty. */
|
|
673
|
+
required?: boolean
|
|
674
|
+
/** Longest text the field accepts. */
|
|
675
|
+
maxLength?: number
|
|
676
|
+
/** Shortest text a form accepts in the field. */
|
|
677
|
+
minLength?: number
|
|
678
|
+
/** Web-only: a pattern a form checks the text against. */
|
|
679
|
+
pattern?: string
|
|
680
|
+
/** Visible lines (`textarea` only). */
|
|
681
|
+
rows?: number
|
|
682
|
+
/** Web-only: visible columns (`textarea` only). */
|
|
683
|
+
cols?: number
|
|
684
|
+
/** Web-only: how a form sends the text's line breaks (`textarea` only). */
|
|
685
|
+
wrap?: 'hard' | 'soft' | 'off'
|
|
686
|
+
/**
|
|
687
|
+
* Grows the field with its text, between these line counts (`textarea` only): the field is
|
|
688
|
+
* `minRows` lines tall when nearly empty and scrolls past `maxRows`.
|
|
689
|
+
*/
|
|
690
|
+
autoGrow?: { minRows: number; maxRows?: number }
|
|
691
|
+
/** Tooltip text (native: the accessibility label when there is no `aria-label`). */
|
|
692
|
+
title?: string
|
|
693
|
+
/** The autofill hint. */
|
|
694
|
+
autoComplete?: string
|
|
695
|
+
/** Web spell checking. Native passes the boolean on devices with a spell-check control. */
|
|
696
|
+
spellCheck?: boolean
|
|
697
|
+
/** Web autocorrection hint. Native maps `'on'` and `'off'` to a boolean. */
|
|
698
|
+
autoCorrect?: 'on' | 'off'
|
|
699
|
+
/** Web return-key label. Native uses the hint when the platform supports it. */
|
|
700
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'
|
|
701
|
+
/** Moves focus to the field when it mounts. */
|
|
702
|
+
autoFocus?: boolean
|
|
703
|
+
/** Selects the field's text on focus in the browser and on a device. */
|
|
704
|
+
selectTextOnFocus?: boolean
|
|
705
|
+
/** Consumes nonempty plain-text paste before insertion and length limits on web and native. */
|
|
706
|
+
onPasteText?: (text: string) => void
|
|
707
|
+
/** Field name. */
|
|
708
|
+
name?: string
|
|
709
|
+
/**
|
|
710
|
+
* The text changed; read `(event.target as HTMLInputElement).value` on the web. Prefer
|
|
711
|
+
* {@link TextFieldProps.onValueChange}, which native can supply too.
|
|
712
|
+
*/
|
|
713
|
+
onChange?: ChangeEventHandler
|
|
714
|
+
/** The text changed, with the new text. */
|
|
715
|
+
onValueChange?: (value: string) => void
|
|
716
|
+
/** Browser key-down with composition state, or a key delivered by the device's TextInput. */
|
|
717
|
+
onKeyDown?: EventHandler<TextFieldKeyEvent>
|
|
718
|
+
/** The text changed: fires with {@link TextFieldProps.onChange} on each edit, on both renderers. */
|
|
719
|
+
onInput?: FormEventHandler
|
|
720
|
+
/** Layout, paint and text styles both renderers apply. */
|
|
721
|
+
style?: TextStyle
|
|
722
|
+
/** Web-only paint (a field's border and outline resets). */
|
|
723
|
+
webStyle?: WebStyle
|
|
724
|
+
}
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
#### `FieldBounds`
|
|
728
|
+
|
|
729
|
+
Inclusive bounds and step for a number or calendar-date field.
|
|
730
|
+
|
|
731
|
+
```typescript
|
|
732
|
+
interface FieldBounds<T> {
|
|
733
|
+
/** HTML minimum attribute. Native uses it as an inclusive lower bound and step base. */
|
|
734
|
+
min?: T
|
|
735
|
+
/** HTML maximum attribute. Native uses it as an inclusive upper bound. */
|
|
736
|
+
max?: T
|
|
737
|
+
/** Increment on both renderers, in days for dates. 'any' disables step validation. */
|
|
738
|
+
step?: number | 'any'
|
|
739
|
+
}
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
#### `RangeFieldProps`
|
|
743
|
+
|
|
744
|
+
A numeric range rendered by the browser's range input or the device's adjustable slider.
|
|
745
|
+
|
|
746
|
+
```typescript
|
|
747
|
+
interface RangeFieldProps extends ElementProps, InteractionProps {
|
|
748
|
+
/** Optional position of the fixed web type attribute. Native always uses a slider. */
|
|
749
|
+
type?: 'range'
|
|
750
|
+
/** Lower bound. The browser and device use 0 when it is omitted. */
|
|
751
|
+
min?: number
|
|
752
|
+
/** Upper bound. The browser and device use 100 when it is omitted. */
|
|
753
|
+
max?: number
|
|
754
|
+
/** Controlled value. The browser and device clamp and align it to their range. */
|
|
755
|
+
value?: number
|
|
756
|
+
/** Initial and reset value when uncontrolled. The browser and device otherwise use the midpoint. */
|
|
757
|
+
defaultValue?: number
|
|
758
|
+
/** Allowed value spacing. Both renderers default to 1. Use `'any'` for continuous values. */
|
|
759
|
+
step?: number | 'any'
|
|
760
|
+
/** Disables pointer and keyboard edits and excludes the field from forms on both renderers. */
|
|
761
|
+
disabled?: boolean
|
|
762
|
+
/** Field name used for form submission on the browser and device. */
|
|
763
|
+
name?: string
|
|
764
|
+
/** Called with the numeric value of each user edit on the browser and device. */
|
|
765
|
+
onValueChange?: (value: number) => void
|
|
766
|
+
/** Layout and paint applied by both the browser and device. */
|
|
767
|
+
style?: BoxStyle
|
|
768
|
+
/** CSS layered over `style` in the browser. The device applies the subset it can draw. */
|
|
769
|
+
webStyle?: WebStyle
|
|
770
|
+
}
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
#### `FileFieldProps`
|
|
774
|
+
|
|
775
|
+
A browse target that delivers an ordered batch of selected files.
|
|
776
|
+
|
|
777
|
+
```typescript
|
|
778
|
+
interface FileFieldProps<Node = unknown> extends ElementProps {
|
|
779
|
+
/** Content of the browse target. */
|
|
780
|
+
children?: Node
|
|
781
|
+
/** Comma-separated extensions, MIME types, MIME wildcards or `*`. */
|
|
782
|
+
accept?: string
|
|
783
|
+
/** Deliver all accepted files. Defaults to delivering the first accepted file. */
|
|
784
|
+
multiple?: boolean
|
|
785
|
+
/** Inclusive per-file limit in bytes. */
|
|
786
|
+
maxSize?: number
|
|
787
|
+
/** Prevents opening the chooser or delivering files. */
|
|
788
|
+
disabled?: boolean
|
|
789
|
+
/** Receives a nonempty batch of accepted files in selection order. */
|
|
790
|
+
onValueChange(files: readonly PickedFile[]): void
|
|
791
|
+
/** Receives a nonempty batch of files rejected by the type or size filter. */
|
|
792
|
+
onRejected?(files: readonly PickedFile[]): void
|
|
793
|
+
/** Receives a failure to open the chooser or read its selection. */
|
|
794
|
+
onPickError?(error: Error): void
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
#### `SelectFieldOption`
|
|
799
|
+
|
|
800
|
+
One selectable row in the browser's select and the device's option list.
|
|
801
|
+
|
|
802
|
+
```typescript
|
|
803
|
+
interface SelectFieldOption {
|
|
804
|
+
/** Value reported on selection and submitted by either renderer. */
|
|
805
|
+
value: string
|
|
806
|
+
/** Plain text shown by the browser and by the device. */
|
|
807
|
+
label: string
|
|
808
|
+
/** Both renderers keep the row visible but exclude it from edits and form entries. */
|
|
809
|
+
disabled?: boolean
|
|
810
|
+
/** Reflects this option's initial selection as a web reset attribute. Device uses the field value. */
|
|
811
|
+
webDefaultSelected?: true
|
|
812
|
+
}
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
#### `SelectFieldGroup`
|
|
816
|
+
|
|
817
|
+
A browser optgroup and the corresponding device list section.
|
|
818
|
+
|
|
819
|
+
```typescript
|
|
820
|
+
interface SelectFieldGroup {
|
|
821
|
+
/** The browser's optgroup label and the device's noninteractive heading. */
|
|
822
|
+
label: string
|
|
823
|
+
/** Options in display and submission order on both renderers. */
|
|
824
|
+
options: readonly SelectFieldOption[]
|
|
825
|
+
}
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
#### `FormAreaHandle`
|
|
829
|
+
|
|
830
|
+
The form element's focus and submission methods.
|
|
831
|
+
|
|
832
|
+
```typescript
|
|
833
|
+
interface FormAreaHandle extends ElementHandle {
|
|
834
|
+
/** Attempts submission through normal form validation. */
|
|
835
|
+
requestSubmit(): void
|
|
836
|
+
}
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
#### `FormAreaProps`
|
|
840
|
+
|
|
841
|
+
A form and its submission, validation and reset handlers.
|
|
842
|
+
|
|
843
|
+
```typescript
|
|
844
|
+
interface FormAreaProps<Node = unknown> extends ElementProps {
|
|
845
|
+
/** The web tag. */
|
|
846
|
+
as: 'form'
|
|
847
|
+
/** Web-only: browser submission destination. */
|
|
848
|
+
action?: string
|
|
849
|
+
/** Web-only: browser submission method. */
|
|
850
|
+
method?: 'get' | 'post' | 'dialog'
|
|
851
|
+
/** Submits even if a field fails validation. */
|
|
852
|
+
noValidate?: boolean
|
|
853
|
+
/** Whether browser autofill is enabled for the form. */
|
|
854
|
+
autoComplete?: 'on' | 'off'
|
|
855
|
+
/** Receives the event and the same entries as `new FormData(form)` on the web. */
|
|
856
|
+
onSubmit?: (event: KitEvent, entries: FormEntries) => void
|
|
857
|
+
/** Fires before uncontrolled fields return to their defaults. Calling preventDefault cancels reset. */
|
|
858
|
+
onReset?: FormEventHandler
|
|
859
|
+
/** Layout and paint both renderers apply. */
|
|
860
|
+
style?: BoxStyle
|
|
861
|
+
/** Web-only paint. */
|
|
862
|
+
webStyle?: WebStyle
|
|
863
|
+
/** The form's content. */
|
|
864
|
+
children?: Node
|
|
865
|
+
}
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
#### `FieldsetProps`
|
|
869
|
+
|
|
870
|
+
Groups controls and disables them together when necessary.
|
|
871
|
+
|
|
872
|
+
```typescript
|
|
873
|
+
interface FieldsetProps<Node = unknown> extends ElementProps {
|
|
874
|
+
/** The web tag. */
|
|
875
|
+
as: 'fieldset'
|
|
876
|
+
/** Disables the form controls inside it. */
|
|
877
|
+
disabled?: boolean
|
|
878
|
+
/** The group name. */
|
|
879
|
+
name?: string
|
|
880
|
+
/** Layout and paint both renderers apply. */
|
|
881
|
+
style?: BoxStyle
|
|
882
|
+
/** Web-only paint. */
|
|
883
|
+
webStyle?: WebStyle
|
|
884
|
+
/** The group's content. */
|
|
885
|
+
children?: Node
|
|
886
|
+
}
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
#### `CheckFieldHandle`
|
|
890
|
+
|
|
891
|
+
A checkbox or radio's state and activation methods.
|
|
892
|
+
|
|
893
|
+
```typescript
|
|
894
|
+
interface CheckFieldHandle extends ElementHandle {
|
|
895
|
+
/** Activates the control as a user click or press would. */
|
|
896
|
+
click(): void
|
|
897
|
+
/** The checked state at the time the handle is read. */
|
|
898
|
+
readonly checked: boolean
|
|
899
|
+
}
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
#### `TableBoxProps`
|
|
903
|
+
|
|
904
|
+
A table, a group of rows, or a row.
|
|
905
|
+
|
|
906
|
+
```typescript
|
|
907
|
+
interface TableBoxProps<Node = unknown> extends ElementProps, InteractionProps {
|
|
908
|
+
as: TableBoxTag
|
|
909
|
+
/** Layout and paint both renderers apply. */
|
|
910
|
+
style?: BoxStyle
|
|
911
|
+
/** Web-only paint. */
|
|
912
|
+
webStyle?: WebStyle
|
|
913
|
+
/** The table parts this element contains. */
|
|
914
|
+
children?: Node
|
|
915
|
+
}
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
#### `ImageProps`
|
|
919
|
+
|
|
920
|
+
An image (native `Image`).
|
|
921
|
+
|
|
922
|
+
```typescript
|
|
923
|
+
interface ImageProps extends ElementProps {
|
|
924
|
+
/** Image URL. */
|
|
925
|
+
src: string
|
|
926
|
+
/** Text alternative; an empty string marks a decorative image. */
|
|
927
|
+
alt: string
|
|
928
|
+
/** Rendered width. */
|
|
929
|
+
width?: number
|
|
930
|
+
/** Rendered height. */
|
|
931
|
+
height?: number
|
|
932
|
+
/** Tooltip text. */
|
|
933
|
+
title?: string
|
|
934
|
+
/** Called once the image has loaded. */
|
|
935
|
+
onLoad?: () => void
|
|
936
|
+
/** Called when the image fails to load (a broken URL, no network). */
|
|
937
|
+
onError?: () => void
|
|
938
|
+
/** Layout and paint both renderers apply. */
|
|
939
|
+
style?: BoxStyle & { objectFit?: 'cover' | 'contain' | 'fill' | 'none' }
|
|
940
|
+
/** Web-only paint. */
|
|
941
|
+
webStyle?: WebStyle
|
|
942
|
+
}
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
#### `ScrollOffset`
|
|
946
|
+
|
|
947
|
+
The physical scroll position, in CSS pixels on web or density-independent pixels on device.
|
|
948
|
+
|
|
949
|
+
```typescript
|
|
950
|
+
interface ScrollOffset {
|
|
951
|
+
/** Distance from the content's left edge on both renderers, including in RTL layouts. */
|
|
952
|
+
readonly x: number
|
|
953
|
+
/** Distance from the content's top edge on both renderers. */
|
|
954
|
+
readonly y: number
|
|
955
|
+
}
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
#### `ScrollAreaProps`
|
|
959
|
+
|
|
960
|
+
A container that scrolls its children (native `ScrollView`).
|
|
961
|
+
|
|
962
|
+
```typescript
|
|
963
|
+
interface ScrollAreaProps<Node = unknown> extends ElementProps {
|
|
964
|
+
/** The web tag. */
|
|
965
|
+
as: BoxTag
|
|
966
|
+
/** Axes enabled on device, default vertical. On web the authored overflow styles set the axes. */
|
|
967
|
+
direction?: 'vertical' | 'horizontal' | 'both'
|
|
968
|
+
/** Supplies both offsets when either changes on the web host or its native scroll view. */
|
|
969
|
+
onScroll?: (offset: ScrollOffset) => void
|
|
970
|
+
/** Focus order on the scroll area's outer frame. */
|
|
971
|
+
tabIndex?: InteractionProps['tabIndex']
|
|
972
|
+
/** Layout and paint both renderers apply. */
|
|
973
|
+
style?: BoxStyle
|
|
974
|
+
/** Web-only paint. */
|
|
975
|
+
webStyle?: WebStyle
|
|
976
|
+
/** Child elements. */
|
|
977
|
+
children?: Node
|
|
978
|
+
}
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
#### `SvgPaintProps`
|
|
982
|
+
|
|
983
|
+
Paint props every SVG shape takes.
|
|
984
|
+
|
|
985
|
+
```typescript
|
|
986
|
+
interface SvgPaintProps {
|
|
987
|
+
/** Fill colour or `'none'`. */
|
|
988
|
+
fill?: string
|
|
989
|
+
/** Fill opacity, 0 to 1. */
|
|
990
|
+
fillOpacity?: number
|
|
991
|
+
/** Stroke colour or `'none'`. */
|
|
992
|
+
stroke?: string
|
|
993
|
+
/** Stroke width. */
|
|
994
|
+
strokeWidth?: number
|
|
995
|
+
/** Stroke opacity, 0 to 1. */
|
|
996
|
+
strokeOpacity?: number
|
|
997
|
+
/** Stroke end caps. */
|
|
998
|
+
strokeLinecap?: 'butt' | 'round' | 'square'
|
|
999
|
+
/** Stroke corners. */
|
|
1000
|
+
strokeLinejoin?: 'miter' | 'round' | 'bevel'
|
|
1001
|
+
/** Dash pattern. */
|
|
1002
|
+
strokeDasharray?: string | number
|
|
1003
|
+
/** Dash offset. */
|
|
1004
|
+
strokeDashoffset?: number
|
|
1005
|
+
/** Opacity, 0 to 1. */
|
|
1006
|
+
opacity?: number
|
|
1007
|
+
/** SVG transform (`'rotate(-90 12 12)'`). */
|
|
1008
|
+
transform?: string
|
|
1009
|
+
/** ClassMap classes. */
|
|
1010
|
+
className?: string
|
|
1011
|
+
}
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
#### `SvgStyle`
|
|
1015
|
+
|
|
1016
|
+
SVG inline paint and hit-testing supported by both renderers.
|
|
1017
|
+
|
|
1018
|
+
```typescript
|
|
1019
|
+
interface SvgStyle extends Omit<SvgPaintProps, 'className' | 'transform'> {
|
|
1020
|
+
/** The CSS hit-testing mode on web and the shape's native hit-testing mode. */
|
|
1021
|
+
pointerEvents?: 'auto' | 'none'
|
|
1022
|
+
}
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
#### `SvgElementProps`
|
|
1026
|
+
|
|
1027
|
+
Identity, interaction and paint shared by an SVG canvas and its shapes.
|
|
1028
|
+
|
|
1029
|
+
```typescript
|
|
1030
|
+
interface SvgElementProps extends ElementProps, SvgPaintProps {
|
|
1031
|
+
/** DOM tab order. On a device, a nonnegative value supplies a focusable target. */
|
|
1032
|
+
tabIndex?: number
|
|
1033
|
+
/** DOM click. On a device, draws a shape that can be pressed. */
|
|
1034
|
+
onClick?: MouseEventHandler
|
|
1035
|
+
/** DOM key down. Native routes focused activation through the supplied key handler. */
|
|
1036
|
+
onKeyDown?: KeyboardEventHandler
|
|
1037
|
+
/** Inline SVG paint and hit-testing, applied by the browser and on a device. */
|
|
1038
|
+
style?: SvgStyle
|
|
1039
|
+
/** Additional CSS, applied after `style` by the browser. Shape CSS is omitted on a device. */
|
|
1040
|
+
webStyle?: WebStyle
|
|
1041
|
+
}
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
#### `SvgDefsProps`
|
|
1045
|
+
|
|
1046
|
+
Definitions in the enclosing SVG's ID namespace on both renderers.
|
|
1047
|
+
|
|
1048
|
+
```typescript
|
|
1049
|
+
interface SvgDefsProps<Node = unknown> {
|
|
1050
|
+
/** Definition elements drawn through references on web and native. */
|
|
1051
|
+
children: Node
|
|
1052
|
+
}
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
#### `SvgClipPathProps`
|
|
1056
|
+
|
|
1057
|
+
Geometry referenced by `url(#id)` as a clipping region.
|
|
1058
|
+
|
|
1059
|
+
```typescript
|
|
1060
|
+
interface SvgClipPathProps<Node = unknown> extends SvgDefsProps<Node> {
|
|
1061
|
+
/** Local ID used by the browser's and device's SVG clipping engines. */
|
|
1062
|
+
id: string
|
|
1063
|
+
}
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
#### `SvgGradientStop`
|
|
1067
|
+
|
|
1068
|
+
One gradient stop. Equal offsets retain their input order on both renderers.
|
|
1069
|
+
|
|
1070
|
+
```typescript
|
|
1071
|
+
interface SvgGradientStop {
|
|
1072
|
+
/** A fraction or percentage such as `'50%'`, passed to each renderer's stop. */
|
|
1073
|
+
offset: ElementLength
|
|
1074
|
+
/** CSS colour, including `currentColor`, which native resolves to the inherited ink. */
|
|
1075
|
+
stopColor: string
|
|
1076
|
+
/** Opacity from zero to one for the browser and native stop. */
|
|
1077
|
+
stopOpacity?: number
|
|
1078
|
+
}
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
#### `SvgLinearGradientProps`
|
|
1082
|
+
|
|
1083
|
+
A named linear paint server and its stops.
|
|
1084
|
+
|
|
1085
|
+
```typescript
|
|
1086
|
+
interface SvgLinearGradientProps {
|
|
1087
|
+
/** Local ID used by paint references on web and native. */
|
|
1088
|
+
id: string
|
|
1089
|
+
/** Horizontal start in the selected coordinate system, on web and native. */
|
|
1090
|
+
x1?: ElementLength
|
|
1091
|
+
/** Vertical start in the selected coordinate system, on web and native. */
|
|
1092
|
+
y1?: ElementLength
|
|
1093
|
+
/** Horizontal end in the selected coordinate system, on web and native. */
|
|
1094
|
+
x2?: ElementLength
|
|
1095
|
+
/** Vertical end in the selected coordinate system, on web and native. */
|
|
1096
|
+
y2?: ElementLength
|
|
1097
|
+
/** Coordinate system for the gradient on both renderers. */
|
|
1098
|
+
gradientUnits?: 'objectBoundingBox' | 'userSpaceOnUse'
|
|
1099
|
+
/** In-order stop elements for the browser's SVG painter and react-native-svg. */
|
|
1100
|
+
stops: readonly SvgGradientStop[]
|
|
1101
|
+
}
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1104
|
+
#### `SvgPatternProps`
|
|
1105
|
+
|
|
1106
|
+
A named, repeating SVG tile.
|
|
1107
|
+
|
|
1108
|
+
```typescript
|
|
1109
|
+
interface SvgPatternProps<Node = unknown> extends SvgDefsProps<Node> {
|
|
1110
|
+
/** Local ID used by paint references on web and native. */
|
|
1111
|
+
id: string
|
|
1112
|
+
/** Tile's horizontal origin for the browser and native SVG painter. */
|
|
1113
|
+
x?: ElementLength
|
|
1114
|
+
/** Tile's vertical origin for the browser and native SVG painter. */
|
|
1115
|
+
y?: ElementLength
|
|
1116
|
+
/** Tile width for the browser and native SVG painter. */
|
|
1117
|
+
width: ElementLength
|
|
1118
|
+
/** Tile height for the browser and native SVG painter. */
|
|
1119
|
+
height: ElementLength
|
|
1120
|
+
/** Coordinate system for the tile's origin and size, on both renderers. */
|
|
1121
|
+
patternUnits?: 'objectBoundingBox' | 'userSpaceOnUse'
|
|
1122
|
+
}
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
#### `SvgImageProps`
|
|
1126
|
+
|
|
1127
|
+
An image positioned in SVG user space.
|
|
1128
|
+
|
|
1129
|
+
```typescript
|
|
1130
|
+
interface SvgImageProps extends SvgElementProps {
|
|
1131
|
+
/** Literal browser URL. Native resolves relative URLs against the public document URL. */
|
|
1132
|
+
href: string
|
|
1133
|
+
/** Horizontal origin on web and native. */
|
|
1134
|
+
x?: ElementLength
|
|
1135
|
+
/** Vertical origin on web and native. */
|
|
1136
|
+
y?: ElementLength
|
|
1137
|
+
/** Image viewport width on web and native. */
|
|
1138
|
+
width: ElementLength
|
|
1139
|
+
/** Image viewport height on web and native. */
|
|
1140
|
+
height: ElementLength
|
|
1141
|
+
/** Alignment and fit of the image in its viewport on both renderers. */
|
|
1142
|
+
preserveAspectRatio?: string
|
|
1143
|
+
}
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
#### `SvgMetadata`
|
|
1147
|
+
|
|
1148
|
+
Descriptive SVG children. They precede geometry on web and name the native graphic.
|
|
1149
|
+
|
|
1150
|
+
```typescript
|
|
1151
|
+
interface SvgMetadata {
|
|
1152
|
+
/** Browser `<title>` and the device's fallback accessible name. */
|
|
1153
|
+
title?: string
|
|
1154
|
+
/** Browser `<desc>` and the device's accessible description. */
|
|
1155
|
+
description?: {
|
|
1156
|
+
/** ID that `aria-describedby` can reference on either renderer. */
|
|
1157
|
+
id?: string
|
|
1158
|
+
/** Description drawn as SVG metadata on web and spoken by the device. */
|
|
1159
|
+
text: string
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
#### `SvgProps`
|
|
1165
|
+
|
|
1166
|
+
An SVG canvas (native react-native-svg `Svg`).
|
|
1167
|
+
|
|
1168
|
+
```typescript
|
|
1169
|
+
interface SvgProps<Node = unknown> extends SvgElementProps, ElementDragProps {
|
|
1170
|
+
/** Rendered width. */
|
|
1171
|
+
width?: number | `${number}%`
|
|
1172
|
+
/** Rendered height. */
|
|
1173
|
+
height?: number | `${number}%`
|
|
1174
|
+
/** The user coordinate system (`'0 0 24 24'`). */
|
|
1175
|
+
viewBox?: string
|
|
1176
|
+
/** How the view box fits the element. */
|
|
1177
|
+
preserveAspectRatio?: string
|
|
1178
|
+
/** Whether the canvas takes keyboard focus (web). */
|
|
1179
|
+
focusable?: boolean
|
|
1180
|
+
/** The SVG namespace attribute (web; a device ignores it). */
|
|
1181
|
+
xmlns?: string
|
|
1182
|
+
/** CSS for the web, and the style a device can draw of it. */
|
|
1183
|
+
webStyle?: WebStyle
|
|
1184
|
+
/** Descriptive SVG children on web, and name and description for native accessibility. */
|
|
1185
|
+
metadata?: SvgMetadata
|
|
1186
|
+
/** The browser's `shape-rendering` presentation hint. The device uses its SVG painter. */
|
|
1187
|
+
webShapeRendering?: 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision'
|
|
1188
|
+
/** Language metadata emitted as `translate` on web and consumed before native drawing. */
|
|
1189
|
+
translate?: 'yes' | 'no'
|
|
1190
|
+
/** Shapes. */
|
|
1191
|
+
children?: Node
|
|
1192
|
+
}
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
#### `SvgMarkupProps`
|
|
1196
|
+
|
|
1197
|
+
An SVG canvas drawn from inner SVG markup (an icon set's prebuilt glyph; native react-native-svg
|
|
1198
|
+
`SvgXml`). The markup is trusted: it comes from a bonded set, never from a user.
|
|
1199
|
+
|
|
1200
|
+
```typescript
|
|
1201
|
+
interface SvgMarkupProps extends Omit<SvgProps, 'children' | 'drag' | 'metadata'> {
|
|
1202
|
+
/** The markup inside the `<svg>` element. */
|
|
1203
|
+
markup: string
|
|
1204
|
+
}
|
|
1205
|
+
```
|
|
1206
|
+
|
|
1207
|
+
#### `SvgPathProps`
|
|
1208
|
+
|
|
1209
|
+
An SVG path.
|
|
1210
|
+
|
|
1211
|
+
```typescript
|
|
1212
|
+
interface SvgPathProps extends SvgElementProps {
|
|
1213
|
+
/** Path data. */
|
|
1214
|
+
d: string
|
|
1215
|
+
/** Which areas the path fills. */
|
|
1216
|
+
fillRule?: 'nonzero' | 'evenodd'
|
|
1217
|
+
/** Which areas the path clips. */
|
|
1218
|
+
clipRule?: 'nonzero' | 'evenodd'
|
|
1219
|
+
}
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
#### `SvgRectProps`
|
|
1223
|
+
|
|
1224
|
+
An SVG rectangle.
|
|
1225
|
+
|
|
1226
|
+
```typescript
|
|
1227
|
+
interface SvgRectProps extends SvgElementProps {
|
|
1228
|
+
/** Left edge. */
|
|
1229
|
+
x?: number
|
|
1230
|
+
/** Top edge. */
|
|
1231
|
+
y?: number
|
|
1232
|
+
/** Width. */
|
|
1233
|
+
width: number
|
|
1234
|
+
/** Height. */
|
|
1235
|
+
height: number
|
|
1236
|
+
/** Corner radius on x. */
|
|
1237
|
+
rx?: number
|
|
1238
|
+
/** Corner radius on y. */
|
|
1239
|
+
ry?: number
|
|
1240
|
+
/** Web `<title>` and `<desc>` inside this rectangle, mapped to its device focus target. */
|
|
1241
|
+
metadata?: SvgMetadata
|
|
1242
|
+
/** Web presentation attribute and native hit testing. Inline `style.pointerEvents` wins. */
|
|
1243
|
+
pointerEvents?: SvgStyle['pointerEvents']
|
|
1244
|
+
/** Web mouse entry or native hover into this rectangle when pointing hardware delivers it. */
|
|
1245
|
+
onMouseEnter?: InteractionProps['onMouseEnter']
|
|
1246
|
+
}
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
#### `SvgCircleProps`
|
|
1250
|
+
|
|
1251
|
+
An SVG circle.
|
|
1252
|
+
|
|
1253
|
+
```typescript
|
|
1254
|
+
interface SvgCircleProps extends SvgElementProps {
|
|
1255
|
+
/** Centre x. The web and native SVG defaults are zero. */
|
|
1256
|
+
cx?: number
|
|
1257
|
+
/** Centre y. The web and native SVG defaults are zero. */
|
|
1258
|
+
cy?: number
|
|
1259
|
+
/** Radius. */
|
|
1260
|
+
r: number
|
|
1261
|
+
}
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
#### `SvgEllipseProps`
|
|
1265
|
+
|
|
1266
|
+
An SVG ellipse.
|
|
1267
|
+
|
|
1268
|
+
```typescript
|
|
1269
|
+
interface SvgEllipseProps extends SvgElementProps {
|
|
1270
|
+
/** Centre x. */
|
|
1271
|
+
cx: number
|
|
1272
|
+
/** Centre y. */
|
|
1273
|
+
cy: number
|
|
1274
|
+
/** Radius on x. */
|
|
1275
|
+
rx: number
|
|
1276
|
+
/** Radius on y. */
|
|
1277
|
+
ry: number
|
|
1278
|
+
}
|
|
1279
|
+
```
|
|
1280
|
+
|
|
1281
|
+
#### `SvgLineProps`
|
|
1282
|
+
|
|
1283
|
+
An SVG line.
|
|
1284
|
+
|
|
1285
|
+
```typescript
|
|
1286
|
+
interface SvgLineProps extends SvgElementProps {
|
|
1287
|
+
/** Start x. */
|
|
1288
|
+
x1: number
|
|
1289
|
+
/** Start y. */
|
|
1290
|
+
y1: number
|
|
1291
|
+
/** End x. */
|
|
1292
|
+
x2: number
|
|
1293
|
+
/** End y. */
|
|
1294
|
+
y2: number
|
|
1295
|
+
}
|
|
1296
|
+
```
|
|
1297
|
+
|
|
1298
|
+
#### `SvgPolyProps`
|
|
1299
|
+
|
|
1300
|
+
An SVG polyline or polygon.
|
|
1301
|
+
|
|
1302
|
+
```typescript
|
|
1303
|
+
interface SvgPolyProps extends SvgElementProps {
|
|
1304
|
+
/** Points (`'0,0 10,10'`). */
|
|
1305
|
+
points: string
|
|
1306
|
+
}
|
|
1307
|
+
```
|
|
1308
|
+
|
|
1309
|
+
#### `SvgGroupProps`
|
|
1310
|
+
|
|
1311
|
+
An SVG group.
|
|
1312
|
+
|
|
1313
|
+
```typescript
|
|
1314
|
+
interface SvgGroupProps<Node = unknown> extends SvgElementProps, ElementDragProps {
|
|
1315
|
+
/** Local clipping region reference for the web or native SVG painter. */
|
|
1316
|
+
clipPath?: `url(#${string})`
|
|
1317
|
+
/** Shapes. */
|
|
1318
|
+
children?: Node
|
|
1319
|
+
}
|
|
1320
|
+
```
|
|
1321
|
+
|
|
1322
|
+
#### `SvgTextProps`
|
|
1323
|
+
|
|
1324
|
+
SVG text.
|
|
1325
|
+
|
|
1326
|
+
```typescript
|
|
1327
|
+
interface SvgTextProps<Node = unknown> extends SvgElementProps {
|
|
1328
|
+
/** Anchor x. */
|
|
1329
|
+
x?: number
|
|
1330
|
+
/** Anchor y. */
|
|
1331
|
+
y?: number
|
|
1332
|
+
/** Horizontal anchor. */
|
|
1333
|
+
textAnchor?: 'start' | 'middle' | 'end'
|
|
1334
|
+
/** SVG baseline on the web. Native maps explicit baselines to `alignmentBaseline`. */
|
|
1335
|
+
dominantBaseline?: 'auto' | 'alphabetic' | 'middle' | 'central'
|
|
1336
|
+
/** Font size. */
|
|
1337
|
+
fontSize?: number
|
|
1338
|
+
/** Font weight. */
|
|
1339
|
+
fontWeight?: 'normal' | 'bold' | number
|
|
1340
|
+
/** CSS font-family on web. The device selects an available family or its system font. */
|
|
1341
|
+
fontFamily?: string
|
|
1342
|
+
/** Text. */
|
|
1343
|
+
children?: Node
|
|
1344
|
+
}
|
|
1345
|
+
```
|
|
1346
|
+
|
|
1347
|
+
#### `NativeGridClasses`
|
|
1348
|
+
|
|
1349
|
+
A CSS grid's classes ({@link NativeClassSplit.grid}), by breakpoint variant: `''` at the base
|
|
1350
|
+
size, then `sm`, `md`, … ({@link UIClassMapNativeSplit.nativeBreakpoints}). A device has no grid
|
|
1351
|
+
layout, so a native element lays its children out from these.
|
|
1352
|
+
|
|
1353
|
+
```typescript
|
|
1354
|
+
interface NativeGridClasses {
|
|
1355
|
+
/**
|
|
1356
|
+
* Its columns: a count of equal columns (`grid-cols-3` is 3), or a CSS track list
|
|
1357
|
+
* (`grid-cols-[1fr_2fr]` is `'1fr 2fr'`). No entry at the base size is one column.
|
|
1358
|
+
*/
|
|
1359
|
+
columns: Readonly<Record<string, number | string>>
|
|
1360
|
+
/**
|
|
1361
|
+
* Its explicit rows: a count of equal rows (`grid-rows-3`) or a CSS track list
|
|
1362
|
+
* (`grid-rows-[auto_1fr]`). No entry: rows only as its items need them.
|
|
1363
|
+
*/
|
|
1364
|
+
rows?: Readonly<Record<string, number | string>>
|
|
1365
|
+
/** The gap between its columns, in pixels (`gap-4` and `gap-x-4` are 16). */
|
|
1366
|
+
columnGap: Readonly<Record<string, number>>
|
|
1367
|
+
/** The gap between its rows, in pixels. */
|
|
1368
|
+
rowGap: Readonly<Record<string, number>>
|
|
1369
|
+
/** How its items sit in their rows (`items-center`); stretched when it sets none. */
|
|
1370
|
+
alignItems: Readonly<Record<string, 'start' | 'end' | 'center' | 'stretch' | 'baseline'>>
|
|
1371
|
+
}
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
#### `NativeClassSplit`
|
|
1375
|
+
|
|
1376
|
+
A class string divided for a native renderer, which has no CSS cascade (see
|
|
1377
|
+
{@link UIClassMapNativeSplit}).
|
|
1378
|
+
|
|
1379
|
+
```typescript
|
|
1380
|
+
interface NativeClassSplit {
|
|
1381
|
+
/** Classes the native view itself applies (no display class: {@link NativeClassSplit.display}). */
|
|
1382
|
+
view: string
|
|
1383
|
+
/**
|
|
1384
|
+
* The text classes in effect for the element's text, as the CSS cascade would give them (text
|
|
1385
|
+
* properties only: `visibility`, `cursor` and other inherited CSS properties do not pass down): the
|
|
1386
|
+
* inherited ones the element's own text classes (colour, font, size, line height, letter
|
|
1387
|
+
* spacing, alignment, case, decoration, white space) do not override, then its own. A native
|
|
1388
|
+
* container hands them to the text inside it.
|
|
1389
|
+
*/
|
|
1390
|
+
text: string
|
|
1391
|
+
/**
|
|
1392
|
+
* The display the classes give the element at its base size (no responsive or state variant), or
|
|
1393
|
+
* `null` when they set none: `flex`/`inline-flex` make its children flex items, `inline` and
|
|
1394
|
+
* `inline-*` put it in a line with its inline siblings, `block` takes it out of one and
|
|
1395
|
+
* `contents` lets a fieldset's children participate directly in its parent's layout.
|
|
1396
|
+
*/
|
|
1397
|
+
display:
|
|
1398
|
+
| 'block'
|
|
1399
|
+
| 'inline'
|
|
1400
|
+
| 'inline-block'
|
|
1401
|
+
| 'flex'
|
|
1402
|
+
| 'inline-flex'
|
|
1403
|
+
| 'grid'
|
|
1404
|
+
| 'inline-grid'
|
|
1405
|
+
| 'contents'
|
|
1406
|
+
| 'none'
|
|
1407
|
+
| null
|
|
1408
|
+
/** The vertical alignment requested for a native table cell. */
|
|
1409
|
+
verticalAlign?: 'middle'
|
|
1410
|
+
/**
|
|
1411
|
+
* The lines the element's text is clamped to with an ellipsis (`truncate` is 1,
|
|
1412
|
+
* `line-clamp-3` is 3), or `null`. The clamp is the element's own: it is not inherited.
|
|
1413
|
+
*/
|
|
1414
|
+
lines: number | null
|
|
1415
|
+
/**
|
|
1416
|
+
* The font weight {@link NativeClassSplit.text} sets at its base size (`font-bold` is 700), or
|
|
1417
|
+
* `null` when it sets none (the platform's normal weight). A `<strong>` draws `bolder` than it.
|
|
1418
|
+
*/
|
|
1419
|
+
weight: number | null
|
|
1420
|
+
/**
|
|
1421
|
+
* The line height in pixels for a field that grows by lines, keyed by breakpoint like the grid
|
|
1422
|
+
* classes (`''` at the base size). A bond can omit this if it does not resolve text metrics.
|
|
1423
|
+
*/
|
|
1424
|
+
lineHeight?: Readonly<Record<string, number>>
|
|
1425
|
+
/**
|
|
1426
|
+
* Whether the classes set the element's width or height (`w-5`, `h-5`, `size-5`, at any
|
|
1427
|
+
* breakpoint). On the web a class beats a replaced element's `width` and `height` attributes, so
|
|
1428
|
+
* a native image or drawing takes those attributes only for the sizes its classes leave unset.
|
|
1429
|
+
*/
|
|
1430
|
+
sized?: { width: boolean; height: boolean }
|
|
1431
|
+
/**
|
|
1432
|
+
* Classes the element gives its descendants with one tag, as a CSS descendant selector does
|
|
1433
|
+
* (`[&_p]:leading-relaxed` is `{ p: 'leading-relaxed' }`): left out of `view` and `text`, and
|
|
1434
|
+
* applied by each descendant element whose tag it names, after that element's own classes.
|
|
1435
|
+
*/
|
|
1436
|
+
descendants?: Readonly<Record<string, string>>
|
|
1437
|
+
/**
|
|
1438
|
+
* The element's grid when {@link NativeClassSplit.display} is `grid` or `inline-grid`, else
|
|
1439
|
+
* `null`. Its column and span classes are left out of `view`.
|
|
1440
|
+
*/
|
|
1441
|
+
grid?: NativeGridClasses | null
|
|
1442
|
+
/**
|
|
1443
|
+
* The columns the element spans as a grid item, by breakpoint variant (`col-span-2` is
|
|
1444
|
+
* `{ '': 2 }`; `col-span-full` is every column).
|
|
1445
|
+
*/
|
|
1446
|
+
span?: Readonly<Record<string, number | 'full'>>
|
|
1447
|
+
}
|
|
1448
|
+
```
|
|
1449
|
+
|
|
1450
|
+
#### `UIClassMapNativeSplit`
|
|
1451
|
+
|
|
1452
|
+
The ClassMap member a device ClassMap (the nativewind bond) adds so native elements can do what
|
|
1453
|
+
the CSS cascade does on the web. Web ClassMaps leave it out.
|
|
1454
|
+
|
|
1455
|
+
```typescript
|
|
1456
|
+
interface UIClassMapNativeSplit {
|
|
1457
|
+
/**
|
|
1458
|
+
* Divides a class string for a native element.
|
|
1459
|
+
*
|
|
1460
|
+
* @param className - The element's classes.
|
|
1461
|
+
* @param inheritedText - The text classes in effect for its container's text.
|
|
1462
|
+
* @param data - The element's `data-*` attributes by name without the prefix (`{ state: 'open' }`):
|
|
1463
|
+
* a class with a `data-[state=open]:` variant applies only when they match, as on the web.
|
|
1464
|
+
* @returns The view classes, the text classes in effect for its own text, and its display.
|
|
1465
|
+
*/
|
|
1466
|
+
splitForNative?(
|
|
1467
|
+
className: string,
|
|
1468
|
+
inheritedText?: string,
|
|
1469
|
+
data?: Readonly<Record<string, string | undefined>>,
|
|
1470
|
+
): NativeClassSplit
|
|
1471
|
+
/**
|
|
1472
|
+
* The text classes a browser's stylesheet gives a `<button>` (its text is centred), which a
|
|
1473
|
+
* native button hands to its text beneath the button's own classes.
|
|
1474
|
+
*/
|
|
1475
|
+
nativeButtonText?: string
|
|
1476
|
+
/**
|
|
1477
|
+
* The text classes the web's stylesheet gives the document (`html`, `body`), which every text
|
|
1478
|
+
* inherits there: native text starts from them.
|
|
1479
|
+
*/
|
|
1480
|
+
nativeRootText?: string
|
|
1481
|
+
/**
|
|
1482
|
+
* Lets the native styling runtime supply resolved text colour to paint computed in JavaScript.
|
|
1483
|
+
* The browser applies its own CSS cascade.
|
|
1484
|
+
*
|
|
1485
|
+
* @param classes - Text classes after native inheritance and overrides.
|
|
1486
|
+
* @param render - Draws the renderer's element with the resolved colour, if any.
|
|
1487
|
+
* @returns The renderer's element wrapped by the native styling runtime.
|
|
1488
|
+
*/
|
|
1489
|
+
renderNativeTextColor?(classes: string, render: (color: string | undefined) => unknown): unknown
|
|
1490
|
+
/**
|
|
1491
|
+
* The tags the web's stylesheet makes blocks although a browser draws them inline (Tailwind's
|
|
1492
|
+
* reset makes `img` and `svg` blocks): a native image or drawing with one of these tags stacks
|
|
1493
|
+
* like a block unless a class puts it in a line (`inline`, `inline-block`).
|
|
1494
|
+
*/
|
|
1495
|
+
nativeBlockTags?: readonly string[]
|
|
1496
|
+
/**
|
|
1497
|
+
* The window width, in pixels, from which each breakpoint variant applies (`sm:` from 640):
|
|
1498
|
+
* a native grid picks its columns and gaps by it.
|
|
1499
|
+
*/
|
|
1500
|
+
nativeBreakpoints?: Readonly<Record<string, number>>
|
|
1501
|
+
}
|
|
1502
|
+
```
|
|
1503
|
+
|
|
1504
|
+
#### `OverlayPosition`
|
|
1505
|
+
|
|
1506
|
+
The positioned surface's origin, and the side it ended up on.
|
|
1507
|
+
|
|
1508
|
+
```typescript
|
|
1509
|
+
interface OverlayPosition {
|
|
1510
|
+
top: number
|
|
1511
|
+
left: number
|
|
1512
|
+
placement: TooltipPlacement
|
|
1513
|
+
}
|
|
1514
|
+
```
|
|
1515
|
+
|
|
1516
|
+
#### `OverlayTarget`
|
|
1517
|
+
|
|
1518
|
+
A mounted element that a layer can use for focus or ownership.
|
|
1519
|
+
|
|
1520
|
+
```typescript
|
|
1521
|
+
interface OverlayTarget {
|
|
1522
|
+
readonly current: ElementHandle | null
|
|
1523
|
+
}
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1526
|
+
#### `OverlayFocusOptions`
|
|
1527
|
+
|
|
1528
|
+
Initial focus and focus restoration for a blocking layer.
|
|
1529
|
+
|
|
1530
|
+
```typescript
|
|
1531
|
+
interface OverlayFocusOptions {
|
|
1532
|
+
trap: true
|
|
1533
|
+
initial?: OverlayTarget
|
|
1534
|
+
restore: 'opener' | OverlayTarget | false
|
|
1535
|
+
}
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
#### `OverlayLayerOptions`
|
|
1539
|
+
|
|
1540
|
+
Registration for an overlay, independent of where its surface is presented.
|
|
1541
|
+
|
|
1542
|
+
```typescript
|
|
1543
|
+
interface OverlayLayerOptions {
|
|
1544
|
+
open: boolean
|
|
1545
|
+
kind: OverlayLayerKind
|
|
1546
|
+
surface: OverlayTarget
|
|
1547
|
+
anchor?: OverlayTarget
|
|
1548
|
+
dismissKey?: boolean
|
|
1549
|
+
dismissBackdrop?: boolean
|
|
1550
|
+
/** Dismiss outside the given elements on press start or activation. */
|
|
1551
|
+
outside?: { inside: readonly OverlayTarget[]; phase: 'start' | 'activate' }
|
|
1552
|
+
focus?: OverlayFocusOptions
|
|
1553
|
+
lockScroll?: boolean
|
|
1554
|
+
onDismiss?: (reason: OverlayDismissReason) => void
|
|
1555
|
+
}
|
|
1556
|
+
```
|
|
1557
|
+
|
|
1558
|
+
#### `OverlayAnchorGeometry`
|
|
1559
|
+
|
|
1560
|
+
Placement and collision policy for an anchored layer, in renderer-local units.
|
|
1561
|
+
|
|
1562
|
+
```typescript
|
|
1563
|
+
interface OverlayAnchorGeometry {
|
|
1564
|
+
placement: TooltipPlacement
|
|
1565
|
+
align?: 'start' | 'center' | 'end'
|
|
1566
|
+
offset: number
|
|
1567
|
+
padding: number
|
|
1568
|
+
collision: 'none' | 'shift' | 'flip-shift'
|
|
1569
|
+
}
|
|
1570
|
+
```
|
|
1571
|
+
|
|
47
1572
|
#### `UIProvider`
|
|
48
1573
|
|
|
49
1574
|
Identifies the bonded UI styling library. Providers set `name`
|
|
@@ -129,8 +1654,8 @@ interface CSSProperties {
|
|
|
129
1654
|
|
|
130
1655
|
#### `KitEvent`
|
|
131
1656
|
|
|
132
|
-
The event a UI kit hands a component's handler: the members
|
|
133
|
-
passes React's event (so `stopPropagation()` stops React parent handlers), the other kits pass the DOM event;
|
|
1657
|
+
The event a web UI kit hands a component's handler: the members shared by the web kits. React's kit
|
|
1658
|
+
passes React's event (so `stopPropagation()` stops React parent handlers), the other web kits pass the DOM event;
|
|
134
1659
|
both satisfy this type. A handler that needs a member only one of them has (`nativeEvent`, `composedPath()`,
|
|
135
1660
|
`isComposing`) takes the component's ref element (see {@link BaseProps}) and listens on it.
|
|
136
1661
|
|
|
@@ -276,7 +1801,7 @@ interface HTMLElementProps extends BaseProps {
|
|
|
276
1801
|
id?: string
|
|
277
1802
|
title?: string
|
|
278
1803
|
tabIndex?: number
|
|
279
|
-
role?:
|
|
1804
|
+
role?: ElementRole
|
|
280
1805
|
'aria-label'?: string
|
|
281
1806
|
'aria-labelledby'?: string
|
|
282
1807
|
'aria-describedby'?: string
|
|
@@ -320,6 +1845,7 @@ interface InputElementProps extends HTMLElementProps {
|
|
|
320
1845
|
maxLength?: number
|
|
321
1846
|
minLength?: number
|
|
322
1847
|
pattern?: string
|
|
1848
|
+
/** Web change event. Prefer the control's value callback for shared web and native code. */
|
|
323
1849
|
onChange?: ChangeEventHandler
|
|
324
1850
|
onInput?: FormEventHandler
|
|
325
1851
|
}
|
|
@@ -361,6 +1887,7 @@ interface TextareaElementProps extends HTMLElementProps {
|
|
|
361
1887
|
maxLength?: number
|
|
362
1888
|
minLength?: number
|
|
363
1889
|
wrap?: 'hard' | 'soft' | 'off'
|
|
1890
|
+
/** Web change event. {@link TextareaProps.onValueChange} also works on native. */
|
|
364
1891
|
onChange?: ChangeEventHandler
|
|
365
1892
|
onInput?: FormEventHandler
|
|
366
1893
|
}
|
|
@@ -376,6 +1903,7 @@ interface SelectElementProps extends HTMLElementProps {
|
|
|
376
1903
|
required?: boolean
|
|
377
1904
|
autoFocus?: boolean
|
|
378
1905
|
multiple?: boolean
|
|
1906
|
+
/** Web change event. {@link SelectProps.onValueChange} also works on native. */
|
|
379
1907
|
onChange?: ChangeEventHandler
|
|
380
1908
|
}
|
|
381
1909
|
```
|
|
@@ -457,7 +1985,7 @@ Props for the Input component (text field, email, password, etc.).
|
|
|
457
1985
|
Ref element: the native `<input>`.
|
|
458
1986
|
|
|
459
1987
|
```typescript
|
|
460
|
-
interface InputProps extends InputElementProps {
|
|
1988
|
+
interface InputProps extends InputElementProps, Pick<TextFieldProps, 'onValueChange'> {
|
|
461
1989
|
/**
|
|
462
1990
|
* Input type.
|
|
463
1991
|
*/
|
|
@@ -517,6 +2045,22 @@ interface InputProps extends InputElementProps {
|
|
|
517
2045
|
}
|
|
518
2046
|
```
|
|
519
2047
|
|
|
2048
|
+
#### `FloatingInputProps`
|
|
2049
|
+
|
|
2050
|
+
Props for the FloatingInput component: an input whose placeholder is also its label, drawn
|
|
2051
|
+
above the text.
|
|
2052
|
+
|
|
2053
|
+
Ref element: the native `<input>`.
|
|
2054
|
+
|
|
2055
|
+
```typescript
|
|
2056
|
+
interface FloatingInputProps extends InputElementProps {
|
|
2057
|
+
/**
|
|
2058
|
+
* Input type.
|
|
2059
|
+
*/
|
|
2060
|
+
type?: InputType
|
|
2061
|
+
}
|
|
2062
|
+
```
|
|
2063
|
+
|
|
520
2064
|
#### `TextareaProps`
|
|
521
2065
|
|
|
522
2066
|
Props for the Textarea component.
|
|
@@ -524,7 +2068,7 @@ Props for the Textarea component.
|
|
|
524
2068
|
Ref element: the native `<textarea>`.
|
|
525
2069
|
|
|
526
2070
|
```typescript
|
|
527
|
-
interface TextareaProps extends TextareaElementProps {
|
|
2071
|
+
interface TextareaProps extends TextareaElementProps, Pick<TextFieldProps, 'onValueChange'> {
|
|
528
2072
|
/**
|
|
529
2073
|
* Text size tier (see {@link TextareaClassOptions.size}) — pass the same
|
|
530
2074
|
* `size` as a neighboring Input for identical font sizes.
|
|
@@ -610,7 +2154,7 @@ interface SelectProps<T = string> extends SelectElementProps {
|
|
|
610
2154
|
value?: T
|
|
611
2155
|
|
|
612
2156
|
/**
|
|
613
|
-
*
|
|
2157
|
+
* Called with the selected value on web and native.
|
|
614
2158
|
*/
|
|
615
2159
|
onValueChange?: (value: T) => void
|
|
616
2160
|
|
|
@@ -653,7 +2197,7 @@ Props for the Checkbox component.
|
|
|
653
2197
|
Ref element: the native `<input type="checkbox">`.
|
|
654
2198
|
|
|
655
2199
|
```typescript
|
|
656
|
-
interface CheckboxProps extends InputElementProps {
|
|
2200
|
+
interface CheckboxProps extends InputElementProps, Pick<CheckFieldProps, 'onCheckedChange'> {
|
|
657
2201
|
/**
|
|
658
2202
|
* Checkbox label.
|
|
659
2203
|
*/
|
|
@@ -764,7 +2308,7 @@ Props for the Switch/Toggle component.
|
|
|
764
2308
|
Ref element: the `role="switch"` button.
|
|
765
2309
|
|
|
766
2310
|
```typescript
|
|
767
|
-
interface SwitchProps extends InputElementProps {
|
|
2311
|
+
interface SwitchProps extends InputElementProps, Pick<CheckFieldProps, 'onCheckedChange'> {
|
|
768
2312
|
/**
|
|
769
2313
|
* Switch label.
|
|
770
2314
|
*/
|
|
@@ -855,6 +2399,14 @@ interface ModalProps extends HTMLElementProps {
|
|
|
855
2399
|
* @default 'Close'
|
|
856
2400
|
*/
|
|
857
2401
|
closeLabel?: string
|
|
2402
|
+
|
|
2403
|
+
/**
|
|
2404
|
+
* The control that takes focus when the modal opens, such as the field a dialog exists to fill.
|
|
2405
|
+
* Without it, focus goes to the first focusable control, or to the dialog when it has none. The
|
|
2406
|
+
* modal reads it once the open dialog is in the document, so a control rendered in the
|
|
2407
|
+
* children can be named here.
|
|
2408
|
+
*/
|
|
2409
|
+
initialFocus?: OverlayTarget
|
|
858
2410
|
}
|
|
859
2411
|
```
|
|
860
2412
|
|
|
@@ -1020,6 +2572,23 @@ interface CardProps extends HTMLElementProps {
|
|
|
1020
2572
|
}
|
|
1021
2573
|
```
|
|
1022
2574
|
|
|
2575
|
+
#### `CardSectionProps`
|
|
2576
|
+
|
|
2577
|
+
Props of a card's header, title, description, content and footer.
|
|
2578
|
+
|
|
2579
|
+
```typescript
|
|
2580
|
+
interface CardSectionProps extends ElementProps {
|
|
2581
|
+
/** Tooltip text. */
|
|
2582
|
+
title?: string
|
|
2583
|
+
|
|
2584
|
+
/** CSS for the web. */
|
|
2585
|
+
style?: CSSProperties
|
|
2586
|
+
|
|
2587
|
+
/** Contents. */
|
|
2588
|
+
children?: Children
|
|
2589
|
+
}
|
|
2590
|
+
```
|
|
2591
|
+
|
|
1023
2592
|
#### `ContainerProps`
|
|
1024
2593
|
|
|
1025
2594
|
Props for the Container layout component.
|
|
@@ -2099,7 +3668,7 @@ at render time to resolve classes without knowing which styling library
|
|
|
2099
3668
|
is active.
|
|
2100
3669
|
|
|
2101
3670
|
```typescript
|
|
2102
|
-
interface UIClassMap {
|
|
3671
|
+
interface UIClassMap extends UIClassMapNativeSplit {
|
|
2103
3672
|
cn(...classes: ClassMapValue[]): string
|
|
2104
3673
|
|
|
2105
3674
|
|
|
@@ -2109,6 +3678,10 @@ interface UIClassMap {
|
|
|
2109
3678
|
select(opts?: SelectClassOptions): string
|
|
2110
3679
|
checkbox(opts?: CheckboxClassOptions): string
|
|
2111
3680
|
radio(opts?: RadioClassOptions): string
|
|
3681
|
+
checkFieldMark?: (
|
|
3682
|
+
mark: 'checked' | 'mixed' | 'radio',
|
|
3683
|
+
controlClasses?: string,
|
|
3684
|
+
) => { path: string; className: string }
|
|
2112
3685
|
switchBase(opts?: SwitchClassOptions): string
|
|
2113
3686
|
switchThumb(opts?: SwitchClassOptions): string
|
|
2114
3687
|
label(opts?: LabelClassOptions): string
|
|
@@ -2178,6 +3751,7 @@ interface UIClassMap {
|
|
|
2178
3751
|
tableRow: string
|
|
2179
3752
|
tableHead: string
|
|
2180
3753
|
tableCell: string
|
|
3754
|
+
tableCellWithCheckbox?: string
|
|
2181
3755
|
tableCaption: string
|
|
2182
3756
|
tooltipContent: string
|
|
2183
3757
|
toastViewport: string
|
|
@@ -2282,6 +3856,7 @@ interface UIClassMap {
|
|
|
2282
3856
|
progressLabelContainer: string
|
|
2283
3857
|
progressLabelText: string
|
|
2284
3858
|
progressIndeterminate: string
|
|
3859
|
+
typingPulse?: DotPulseMotion
|
|
2285
3860
|
|
|
2286
3861
|
|
|
2287
3862
|
tableWrapper: string
|
|
@@ -2396,6 +3971,7 @@ interface UIClassMap {
|
|
|
2396
3971
|
|
|
2397
3972
|
|
|
2398
3973
|
sp(property: SpacingProperty, scale: SpacingScale): string
|
|
3974
|
+
sp(property: 'm' | 'mx' | 'my' | 'mt' | 'mb' | 'ml' | 'mr', scale: SpacingScale | 'auto'): string
|
|
2399
3975
|
sp(overrides: SpacingOverrides): Record<string, string>
|
|
2400
3976
|
stack(scale: SpacingScale): string
|
|
2401
3977
|
|
|
@@ -2464,31 +4040,374 @@ interface UIClassMap {
|
|
|
2464
4040
|
authLoginSubmitFull: string
|
|
2465
4041
|
authHidden: string
|
|
2466
4042
|
authArrowIcon: string
|
|
4043
|
+
// … truncated — 214 more members: appLayout, flex1, oauthProviderLabel, pageShell, pageShellSidebar, pageShellSidebarCollapsed, pageShellTopbar, pageShellContent, pageShellSidebarToggle, sidebarUserCardTrigger, userMenuPopoverTrigger, userMenuPopoverPanel, userMenuPopoverHeader, userMenuPopoverSignOut, emptyState, emptyStateIcon, emptyStateTitle, emptyStateDescription, emptyStateAction, pageHeader, pageHeaderTitle, pageHeaderDescription, pageHeaderActions, pageHeaderBreadcrumbs, pageHeaderBreadcrumbItem, pageHeaderBreadcrumbSeparator, searchField, searchFieldIcon, searchFieldInput, searchFieldActions, searchFieldClear, searchStatusRow, searchTips, kbd, filterChip, filterChipNegated, filterChipRemove, resultList, resultItem, resultItemActive, resultBody, resultTitle, resultTitleMono, resultMeta, resultDescription, resultMark, resultAction, resultEmpty, iconGlyphFont, authBrandHeaderChipSquare, authBrandHeaderChipShadow, authBrandHeaderChipIcon, authBrandHeaderWordmark, authBrandHeaderTagline, authShellContainer, authShellDecoration, authShellCardSurface, authShellCardOuter, authShellHeadingEyebrow, authShellHeadingTitle, authShellHeadingSub, authShellFooter, authShellBackLink, authShellBackLinkAnchor, authShellPanel, chatbotTesterBotBar, chatbotTesterBotSelect, chatbotTesterInputRow, chatbotTesterInputField, chatbotTesterMessageList, chatbotTesterMessageBubble, chatbotTesterMessageBubbleUser, chatbotTesterMessageBubbleBot, chatbotTesterMessageTimeUser, chatbotTesterMessageTimeBot and 139 more; the full declaration is in node_modules/@molecule/app-ui/dist/types.d.ts
|
|
4044
|
+
```
|
|
4045
|
+
|
|
4046
|
+
_(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-ui/dist/types.d.ts`.)_
|
|
4047
|
+
|
|
4048
|
+
### Types
|
|
4049
|
+
|
|
4050
|
+
#### `ElementMeasureTarget`
|
|
4051
|
+
|
|
4052
|
+
Which part of a registered element to measure, in window coordinates.
|
|
2467
4053
|
|
|
4054
|
+
```typescript
|
|
4055
|
+
type ElementMeasureTarget =
|
|
4056
|
+
/** The element's own rendered frame on web and device. */
|
|
4057
|
+
| 'frame'
|
|
4058
|
+
/** The browser's first child element, falling back to the registered frame on either renderer. */
|
|
4059
|
+
| 'content-start'
|
|
4060
|
+
```
|
|
2468
4061
|
|
|
2469
|
-
|
|
4062
|
+
#### `ElementLength`
|
|
2470
4063
|
|
|
2471
|
-
|
|
4064
|
+
A length both renderers accept: pixels as a number, or a percentage of the parent.
|
|
2472
4065
|
|
|
4066
|
+
```typescript
|
|
4067
|
+
type ElementLength = number | `${number}%`
|
|
4068
|
+
```
|
|
2473
4069
|
|
|
2474
|
-
|
|
4070
|
+
#### `WebStyle`
|
|
2475
4071
|
|
|
4072
|
+
An element's `webStyle`: CSS for the web (resets of browser defaults such as a button's border
|
|
4073
|
+
and outline, cursors, shadows, or a consumer's `style` a kit component passes on). The web kit
|
|
4074
|
+
applies it after `style`. The native kit applies only the keys {@link TextStyle} names whose
|
|
4075
|
+
values a device can draw (`width: 200`, not `width: '10rem'`), so layout a feature means for
|
|
4076
|
+
both renderers belongs in `style`, which the compiler holds to that subset.
|
|
2476
4077
|
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
pageShellSidebarCollapsed: string
|
|
2480
|
-
pageShellTopbar: string
|
|
2481
|
-
pageShellContent: string
|
|
2482
|
-
pageShellSidebarToggle: string
|
|
2483
|
-
sidebarUserCardTrigger: string
|
|
2484
|
-
userMenuPopoverTrigger: string
|
|
2485
|
-
userMenuPopoverPanel: string
|
|
2486
|
-
// … truncated — 202 more members: userMenuPopoverHeader, userMenuPopoverSignOut, emptyState, emptyStateIcon, emptyStateTitle, emptyStateDescription, emptyStateAction, pageHeader, pageHeaderTitle, pageHeaderDescription, pageHeaderActions, pageHeaderBreadcrumbs, pageHeaderBreadcrumbItem, pageHeaderBreadcrumbSeparator, searchField, searchFieldIcon, searchFieldInput, searchFieldActions, searchFieldClear, searchStatusRow, searchTips, kbd, filterChip, filterChipNegated, filterChipRemove, resultList, resultItem, resultItemActive, resultBody, resultTitle, resultTitleMono, resultMeta, resultDescription, resultMark, resultAction, resultEmpty, iconGlyphFont, authBrandHeaderChipSquare, authBrandHeaderChipShadow, authBrandHeaderChipIcon, authBrandHeaderWordmark, authBrandHeaderTagline, authShellContainer, authShellDecoration, authShellCardSurface, authShellCardOuter, authShellHeadingEyebrow, authShellHeadingTitle, authShellHeadingSub, authShellFooter, authShellBackLink, authShellBackLinkAnchor, authShellPanel, chatbotTesterBotBar, chatbotTesterBotSelect, chatbotTesterInputRow, chatbotTesterInputField, chatbotTesterMessageList, chatbotTesterMessageBubble, chatbotTesterMessageBubbleUser, chatbotTesterMessageBubbleBot, chatbotTesterMessageTimeUser, chatbotTesterMessageTimeBot, chatbotTesterTypingIndicator, dataTableCardShell, dataTableCardTitle, dataTableCardScroller, dataTableCardTable, dataTableCardHead, dataTableCardHeaderCell, dataTableCardBody, dataTableCardSkeletonBar, dataTableCardEmptyCell, dataTableCardRowHover and 128 more; the full declaration is in node_modules/@molecule/app-ui/dist/types.d.ts
|
|
4078
|
+
```typescript
|
|
4079
|
+
type WebStyle = CSSProperties
|
|
2487
4080
|
```
|
|
2488
4081
|
|
|
2489
|
-
|
|
4082
|
+
#### `ElementRole`
|
|
2490
4083
|
|
|
2491
|
-
|
|
4084
|
+
Roles a feature gives an element (an explicit role overrides the one its `as` implies).
|
|
4085
|
+
|
|
4086
|
+
```typescript
|
|
4087
|
+
type ElementRole =
|
|
4088
|
+
| 'alert'
|
|
4089
|
+
| 'alertdialog'
|
|
4090
|
+
| 'application'
|
|
4091
|
+
| 'article'
|
|
4092
|
+
| 'banner'
|
|
4093
|
+
| 'blockquote'
|
|
4094
|
+
| 'button'
|
|
4095
|
+
| 'caption'
|
|
4096
|
+
| 'cell'
|
|
4097
|
+
| 'checkbox'
|
|
4098
|
+
| 'code'
|
|
4099
|
+
| 'columnheader'
|
|
4100
|
+
| 'combobox'
|
|
4101
|
+
| 'complementary'
|
|
4102
|
+
| 'contentinfo'
|
|
4103
|
+
| 'definition'
|
|
4104
|
+
| 'deletion'
|
|
4105
|
+
| 'dialog'
|
|
4106
|
+
| 'directory'
|
|
4107
|
+
| 'document'
|
|
4108
|
+
| 'emphasis'
|
|
4109
|
+
| 'feed'
|
|
4110
|
+
| 'figure'
|
|
4111
|
+
| 'form'
|
|
4112
|
+
| 'generic'
|
|
4113
|
+
| 'grid'
|
|
4114
|
+
| 'gridcell'
|
|
4115
|
+
| 'group'
|
|
4116
|
+
| 'heading'
|
|
4117
|
+
| 'img'
|
|
4118
|
+
| 'insertion'
|
|
4119
|
+
| 'link'
|
|
4120
|
+
| 'list'
|
|
4121
|
+
| 'listbox'
|
|
4122
|
+
| 'listitem'
|
|
4123
|
+
| 'log'
|
|
4124
|
+
| 'main'
|
|
4125
|
+
| 'marquee'
|
|
4126
|
+
| 'math'
|
|
4127
|
+
| 'menu'
|
|
4128
|
+
| 'menubar'
|
|
4129
|
+
| 'menuitem'
|
|
4130
|
+
| 'menuitemcheckbox'
|
|
4131
|
+
| 'menuitemradio'
|
|
4132
|
+
| 'meter'
|
|
4133
|
+
| 'navigation'
|
|
4134
|
+
| 'none'
|
|
4135
|
+
| 'note'
|
|
4136
|
+
| 'option'
|
|
4137
|
+
| 'paragraph'
|
|
4138
|
+
| 'presentation'
|
|
4139
|
+
| 'progressbar'
|
|
4140
|
+
| 'radio'
|
|
4141
|
+
| 'radiogroup'
|
|
4142
|
+
| 'region'
|
|
4143
|
+
| 'row'
|
|
4144
|
+
| 'rowgroup'
|
|
4145
|
+
| 'rowheader'
|
|
4146
|
+
| 'scrollbar'
|
|
4147
|
+
| 'search'
|
|
4148
|
+
| 'searchbox'
|
|
4149
|
+
| 'separator'
|
|
4150
|
+
| 'slider'
|
|
4151
|
+
| 'spinbutton'
|
|
4152
|
+
| 'status'
|
|
4153
|
+
| 'strong'
|
|
4154
|
+
| 'subscript'
|
|
4155
|
+
| 'superscript'
|
|
4156
|
+
| 'switch'
|
|
4157
|
+
| 'tab'
|
|
4158
|
+
| 'table'
|
|
4159
|
+
| 'tablist'
|
|
4160
|
+
| 'tabpanel'
|
|
4161
|
+
| 'term'
|
|
4162
|
+
| 'textbox'
|
|
4163
|
+
| 'time'
|
|
4164
|
+
| 'timer'
|
|
4165
|
+
| 'toolbar'
|
|
4166
|
+
| 'tooltip'
|
|
4167
|
+
| 'tree'
|
|
4168
|
+
| 'treegrid'
|
|
4169
|
+
| 'treeitem'
|
|
4170
|
+
```
|
|
4171
|
+
|
|
4172
|
+
#### `DataAttributes`
|
|
4173
|
+
|
|
4174
|
+
`data-*` attributes: `data-mol-id` becomes the native `testID`; the rest are web-only.
|
|
4175
|
+
|
|
4176
|
+
```typescript
|
|
4177
|
+
type DataAttributes = { [key: `data-${string}`]: string | number | boolean | undefined }
|
|
4178
|
+
```
|
|
4179
|
+
|
|
4180
|
+
#### `AriaBoolean`
|
|
4181
|
+
|
|
4182
|
+
A boolean ARIA value, as React DOM takes one: `true`/`false`, or the attribute's own spelling
|
|
4183
|
+
`'true'`/`'false'` (`aria-hidden="true"`). A device reads `'false'` as false.
|
|
4184
|
+
|
|
4185
|
+
```typescript
|
|
4186
|
+
type AriaBoolean = boolean | 'true' | 'false'
|
|
4187
|
+
```
|
|
4188
|
+
|
|
4189
|
+
#### `ForwardedElementProps`
|
|
4190
|
+
|
|
4191
|
+
Pass-through props of each element variant after the component's own keys are removed.
|
|
4192
|
+
|
|
4193
|
+
```typescript
|
|
4194
|
+
type ForwardedElementProps<P, Owned extends PropertyKey = never> = P extends unknown
|
|
4195
|
+
? Omit<P, 'as' | Owned>
|
|
4196
|
+
: never
|
|
4197
|
+
```
|
|
4198
|
+
|
|
4199
|
+
#### `BoxTag`
|
|
4200
|
+
|
|
4201
|
+
Web container tags and their native view counterparts, including paragraphs with controls.
|
|
4202
|
+
|
|
4203
|
+
```typescript
|
|
4204
|
+
type BoxTag =
|
|
4205
|
+
| 'div'
|
|
4206
|
+
| 'span'
|
|
4207
|
+
| 'p'
|
|
4208
|
+
| 'section'
|
|
4209
|
+
| 'header'
|
|
4210
|
+
| 'footer'
|
|
4211
|
+
| 'main'
|
|
4212
|
+
| 'aside'
|
|
4213
|
+
| 'nav'
|
|
4214
|
+
| 'article'
|
|
4215
|
+
| 'ul'
|
|
4216
|
+
| 'ol'
|
|
4217
|
+
| 'li'
|
|
4218
|
+
| 'dl'
|
|
4219
|
+
| 'dd'
|
|
4220
|
+
| 'figure'
|
|
4221
|
+
| 'address'
|
|
4222
|
+
```
|
|
4223
|
+
|
|
4224
|
+
#### `InlineKind`
|
|
4225
|
+
|
|
4226
|
+
How a component takes part in a line of a container that is not a flex container: inline text
|
|
4227
|
+
(it renders a text element that joins the line), an inline box (a button, a badge, an icon:
|
|
4228
|
+
it sits in the line beside text), or `null` for a block. The web reads this from CSS; React
|
|
4229
|
+
Native has no inline layout, so the native kit is told (`registerInline` in each React kit).
|
|
4230
|
+
|
|
4231
|
+
```typescript
|
|
4232
|
+
type InlineKind = 'text' | 'box' | null
|
|
4233
|
+
```
|
|
4234
|
+
|
|
4235
|
+
#### `TextTag`
|
|
4236
|
+
|
|
4237
|
+
Web tags a {@link TextProps} element renders.
|
|
4238
|
+
|
|
4239
|
+
```typescript
|
|
4240
|
+
type TextTag =
|
|
4241
|
+
| 'span'
|
|
4242
|
+
| 'p'
|
|
4243
|
+
| 'h1'
|
|
4244
|
+
| 'h2'
|
|
4245
|
+
| 'h3'
|
|
4246
|
+
| 'h4'
|
|
4247
|
+
| 'h5'
|
|
4248
|
+
| 'h6'
|
|
4249
|
+
| 'strong'
|
|
4250
|
+
| 'em'
|
|
4251
|
+
| 'small'
|
|
4252
|
+
| 'code'
|
|
4253
|
+
| 'pre'
|
|
4254
|
+
| 'kbd'
|
|
4255
|
+
| 'mark'
|
|
4256
|
+
| 'dt'
|
|
4257
|
+
| 'dd'
|
|
4258
|
+
| 'li'
|
|
4259
|
+
| 'figcaption'
|
|
4260
|
+
```
|
|
4261
|
+
|
|
4262
|
+
#### `TextProps`
|
|
4263
|
+
|
|
4264
|
+
Text (native `Text`); `h1`–`h6` read as headings on native.
|
|
4265
|
+
|
|
4266
|
+
```typescript
|
|
4267
|
+
type TextProps<Node = unknown> =
|
|
4268
|
+
| (TextCommonProps<Node> & { as: TextTag })
|
|
4269
|
+
| (TextCommonProps<Node> & {
|
|
4270
|
+
as: 'label'
|
|
4271
|
+
/** The id of the control this label names and activates. */
|
|
4272
|
+
htmlFor?: string
|
|
4273
|
+
})
|
|
4274
|
+
| (TextCommonProps<Node> & {
|
|
4275
|
+
as: 'time'
|
|
4276
|
+
/** The machine-readable date or time. */
|
|
4277
|
+
dateTime?: string
|
|
4278
|
+
})
|
|
4279
|
+
```
|
|
4280
|
+
|
|
4281
|
+
#### `PressableTag`
|
|
4282
|
+
|
|
4283
|
+
Web tags a {@link PressableProps} element renders.
|
|
4284
|
+
|
|
4285
|
+
```typescript
|
|
4286
|
+
type PressableTag = 'button' | 'div' | 'span' | 'li'
|
|
4287
|
+
```
|
|
4288
|
+
|
|
4289
|
+
#### `AnchorProps`
|
|
4290
|
+
|
|
4291
|
+
A literal anchor with no router. Web keeps the browsing context (`target`) and link
|
|
4292
|
+
relationship (`rel`), which have no device equivalent. Both renderers call `onClick` before
|
|
4293
|
+
the default action and honor `preventDefault()`.
|
|
4294
|
+
|
|
4295
|
+
```typescript
|
|
4296
|
+
type AnchorProps<Node = unknown> = Omit<ElementLinkProps<Node>, 'to' | 'replace' | 'state'> & {
|
|
4297
|
+
/**
|
|
4298
|
+
* The literal `href` on the web. A device passes absolute URLs to the OS, resolves relative
|
|
4299
|
+
* URLs against the app's configured public document URL, and stays on the current screen for
|
|
4300
|
+
* `'#'`. A relative URL with no configured base reports a diagnostic on press.
|
|
4301
|
+
*/
|
|
4302
|
+
href: string
|
|
4303
|
+
}
|
|
4304
|
+
```
|
|
4305
|
+
|
|
4306
|
+
#### `TextFieldProps`
|
|
4307
|
+
|
|
4308
|
+
Web and native text fields accept bounds only on number and date inputs.
|
|
4309
|
+
|
|
4310
|
+
```typescript
|
|
4311
|
+
type TextFieldProps = TextFieldBaseProps &
|
|
4312
|
+
(
|
|
4313
|
+
| { min?: never; max?: never; step?: never }
|
|
4314
|
+
| ({ as: 'input'; type: 'number' } & FieldBounds<number>)
|
|
4315
|
+
| ({ as: 'input'; type: 'date' } & FieldBounds<string>)
|
|
4316
|
+
)
|
|
4317
|
+
```
|
|
4318
|
+
|
|
4319
|
+
#### `SelectFieldProps`
|
|
4320
|
+
|
|
4321
|
+
A single or multiple select with the same option and value contract on web and device.
|
|
4322
|
+
|
|
4323
|
+
```typescript
|
|
4324
|
+
type SelectFieldProps = SelectFieldCommonProps &
|
|
4325
|
+
(
|
|
4326
|
+
| ({
|
|
4327
|
+
/** The browser select and the device list allow one selected option. */
|
|
4328
|
+
multiple?: false
|
|
4329
|
+
/** Reports the selected string on user edits in either renderer. */
|
|
4330
|
+
onValueChange?: (value: string) => void
|
|
4331
|
+
} & SelectFieldValue<string>)
|
|
4332
|
+
| ({
|
|
4333
|
+
/** The browser select and the device list allow multiple selected options. */
|
|
4334
|
+
multiple: true
|
|
4335
|
+
/** Reports every selected string in option order on a user edit in either renderer. */
|
|
4336
|
+
onValueChange?: (values: readonly string[]) => void
|
|
4337
|
+
} & SelectFieldValue<readonly string[]>)
|
|
4338
|
+
)
|
|
4339
|
+
```
|
|
4340
|
+
|
|
4341
|
+
#### `FormEntryValue`
|
|
4342
|
+
|
|
4343
|
+
A successful control's value, including files from a web form.
|
|
4344
|
+
|
|
4345
|
+
```typescript
|
|
4346
|
+
type FormEntryValue = string | Blob
|
|
4347
|
+
```
|
|
4348
|
+
|
|
4349
|
+
#### `FormEntries`
|
|
4350
|
+
|
|
4351
|
+
A form's successful controls in order, with repeated names preserved.
|
|
4352
|
+
|
|
4353
|
+
```typescript
|
|
4354
|
+
type FormEntries = ReadonlyArray<readonly [name: string, value: FormEntryValue]>
|
|
4355
|
+
```
|
|
4356
|
+
|
|
4357
|
+
#### `CheckFieldProps`
|
|
4358
|
+
|
|
4359
|
+
A checkbox, or a radio whose checked state is owned by its group.
|
|
4360
|
+
|
|
4361
|
+
```typescript
|
|
4362
|
+
type CheckFieldProps =
|
|
4363
|
+
| (CheckFieldCommonProps & {
|
|
4364
|
+
type: 'checkbox'
|
|
4365
|
+
checked?: boolean
|
|
4366
|
+
defaultChecked?: boolean
|
|
4367
|
+
/** Draws the mixed state. */
|
|
4368
|
+
indeterminate?: boolean
|
|
4369
|
+
})
|
|
4370
|
+
| (CheckFieldCommonProps & {
|
|
4371
|
+
type: 'radio'
|
|
4372
|
+
checked: boolean
|
|
4373
|
+
defaultChecked?: never
|
|
4374
|
+
indeterminate?: never
|
|
4375
|
+
})
|
|
4376
|
+
```
|
|
4377
|
+
|
|
4378
|
+
#### `TableBoxTag`
|
|
4379
|
+
|
|
4380
|
+
The table and row container tags.
|
|
4381
|
+
|
|
4382
|
+
```typescript
|
|
4383
|
+
type TableBoxTag = 'table' | 'thead' | 'tbody' | 'tfoot' | 'tr'
|
|
4384
|
+
```
|
|
4385
|
+
|
|
4386
|
+
#### `TableCellProps`
|
|
4387
|
+
|
|
4388
|
+
A data cell or a header cell, with optional row or column scope on headers.
|
|
4389
|
+
|
|
4390
|
+
```typescript
|
|
4391
|
+
type TableCellProps<Node = unknown> =
|
|
4392
|
+
| (TableCellCommonProps<Node> & { as: 'td'; scope?: never })
|
|
4393
|
+
| (TableCellCommonProps<Node> & { as: 'th'; scope?: 'col' | 'row' })
|
|
4394
|
+
```
|
|
4395
|
+
|
|
4396
|
+
#### `OverlayDismissReason`
|
|
4397
|
+
|
|
4398
|
+
Why the platform requested that an overlay close.
|
|
4399
|
+
|
|
4400
|
+
```typescript
|
|
4401
|
+
type OverlayDismissReason = 'escape' | 'back' | 'outside' | 'backdrop'
|
|
4402
|
+
```
|
|
4403
|
+
|
|
4404
|
+
#### `OverlayLayerKind`
|
|
4405
|
+
|
|
4406
|
+
Modal layers block dismissal below them. Toast layers are passive.
|
|
4407
|
+
|
|
4408
|
+
```typescript
|
|
4409
|
+
type OverlayLayerKind = 'modal' | 'popover' | 'tooltip' | 'toast'
|
|
4410
|
+
```
|
|
2492
4411
|
|
|
2493
4412
|
#### `Children`
|
|
2494
4413
|
|
|
@@ -2783,6 +4702,69 @@ functions while preserving the base behavior).
|
|
|
2783
4702
|
type ClassMapOverrides = Partial<UIClassMap> | ((base: UIClassMap) => Partial<UIClassMap>)
|
|
2784
4703
|
```
|
|
2785
4704
|
|
|
4705
|
+
### Classes
|
|
4706
|
+
|
|
4707
|
+
#### `ToastCountdown`
|
|
4708
|
+
|
|
4709
|
+
Auto-dismisses once, pausing independently for hover and focus.
|
|
4710
|
+
|
|
4711
|
+
```typescript
|
|
4712
|
+
class ToastCountdown {
|
|
4713
|
+
private readonly pauses = new Set<'hover' | 'focus'>()
|
|
4714
|
+
private duration = 0
|
|
4715
|
+
private remaining = 0
|
|
4716
|
+
private startedAt?: number
|
|
4717
|
+
private timer?: ReturnType<typeof setTimeout>
|
|
4718
|
+
private dismissed = false
|
|
4719
|
+
|
|
4720
|
+
constructor(private readonly onDismiss: () => void) {}
|
|
4721
|
+
|
|
4722
|
+
/** Sets the duration on mount or when it changes. Zero stays open until dismissed. */
|
|
4723
|
+
start(duration: number): void {
|
|
4724
|
+
this.stop()
|
|
4725
|
+
this.duration = duration
|
|
4726
|
+
this.remaining = duration
|
|
4727
|
+
this.resume()
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
/** Suspends the countdown until every active reason for pausing has left. */
|
|
4731
|
+
setPaused(reason: 'hover' | 'focus', paused: boolean): void {
|
|
4732
|
+
if (paused) {
|
|
4733
|
+
this.pauses.add(reason)
|
|
4734
|
+
if (this.startedAt !== undefined) {
|
|
4735
|
+
this.remaining = Math.max(0, this.remaining - (Date.now() - this.startedAt))
|
|
4736
|
+
this.stop()
|
|
4737
|
+
}
|
|
4738
|
+
} else if (this.pauses.delete(reason)) {
|
|
4739
|
+
this.resume()
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
|
|
4743
|
+
/** Hides the notification once, whether a timer or a control dismissed it. */
|
|
4744
|
+
readonly dismiss = (): void => {
|
|
4745
|
+
if (this.dismissed) return
|
|
4746
|
+
this.dismissed = true
|
|
4747
|
+
this.stop()
|
|
4748
|
+
this.onDismiss()
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4751
|
+
/** Cancels the timer during unmount or before restarting it. */
|
|
4752
|
+
readonly stop = (): void => {
|
|
4753
|
+
clearTimeout(this.timer)
|
|
4754
|
+
this.timer = undefined
|
|
4755
|
+
this.startedAt = undefined
|
|
4756
|
+
}
|
|
4757
|
+
|
|
4758
|
+
/** Schedules the remaining time once a visible toast has no active pause. */
|
|
4759
|
+
private resume(): void {
|
|
4760
|
+
if (this.duration <= 0 || this.dismissed || this.pauses.size > 0 || this.timer !== undefined)
|
|
4761
|
+
return
|
|
4762
|
+
this.startedAt = Date.now()
|
|
4763
|
+
this.timer = setTimeout(this.dismiss, this.remaining)
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4766
|
+
```
|
|
4767
|
+
|
|
2786
4768
|
### Functions
|
|
2787
4769
|
|
|
2788
4770
|
#### `molId(component, context, qualifier)`
|
|
@@ -2836,6 +4818,55 @@ function molSelectorPrefix(prefix: string): string
|
|
|
2836
4818
|
|
|
2837
4819
|
**Returns:** A CSS attribute prefix selector string.
|
|
2838
4820
|
|
|
4821
|
+
#### `fieldLayout(cm)`
|
|
4822
|
+
|
|
4823
|
+
The classes for the two wrappers a closed form control (`Input`, `Select`, `Textarea`) puts
|
|
4824
|
+
around its native element.
|
|
4825
|
+
|
|
4826
|
+
Both wrappers are flex columns. On the web, a control's top and bottom margins collapse
|
|
4827
|
+
through a block wrapper: the wrapper's neighbours move instead of the control, and a label
|
|
4828
|
+
above the control changes where the control's margin shows up. React Native keeps the margins
|
|
4829
|
+
inside. A column keeps them inside on every renderer, so a field sits at the same place in a
|
|
4830
|
+
browser and on a device.
|
|
4831
|
+
|
|
4832
|
+
- `root` goes on the outer wrapper: the field's full-width column, which holds the label, the
|
|
4833
|
+
control's row and the error or hint line.
|
|
4834
|
+
- `inner` goes on the row that holds the control and its adornments (a leading icon, a clear
|
|
4835
|
+
button), which the row positions. `Textarea` has no adornments and uses `root` alone.
|
|
4836
|
+
|
|
4837
|
+
A caller's `className`, `style`, ref and test id stay on the control itself. Moving them to a
|
|
4838
|
+
wrapper would move the caller's border, focus ring and typography with them. A wrapper that
|
|
4839
|
+
takes arbitrary children (`FormField`) keeps the plain `inputWrapper` token.
|
|
4840
|
+
|
|
4841
|
+
```typescript
|
|
4842
|
+
function fieldLayout(cm: UIClassMap): { root: string; inner: string }
|
|
4843
|
+
```
|
|
4844
|
+
|
|
4845
|
+
- `cm` — The ClassMap the control renders with.
|
|
4846
|
+
|
|
4847
|
+
**Returns:** `root`, the outer wrapper's classes, and `inner`, the control row's classes.
|
|
4848
|
+
|
|
4849
|
+
#### `calculateOverlayPosition(anchor, surface, viewport, geometry)`
|
|
4850
|
+
|
|
4851
|
+
Positions an anchored surface. All inputs use the same coordinate space.
|
|
4852
|
+
When flipping is enabled, the less obstructed side wins and ties keep the requested side.
|
|
4853
|
+
|
|
4854
|
+
```typescript
|
|
4855
|
+
function calculateOverlayPosition(
|
|
4856
|
+
anchor: ElementBox,
|
|
4857
|
+
surface: Pick<ElementBox, 'width' | 'height'>,
|
|
4858
|
+
viewport: ElementBox,
|
|
4859
|
+
{ placement, align, offset, padding, collision }: OverlayAnchorGeometry,
|
|
4860
|
+
): OverlayPosition
|
|
4861
|
+
```
|
|
4862
|
+
|
|
4863
|
+
- `anchor` — Bounds of the reference element.
|
|
4864
|
+
- `surface` — Dimensions of the surface to position.
|
|
4865
|
+
- `viewport` — Available bounds before applying padding.
|
|
4866
|
+
- `geometry` — Placement, gap, padding and collision policy.
|
|
4867
|
+
|
|
4868
|
+
**Returns:** Coordinates in the input space and the resolved placement.
|
|
4869
|
+
|
|
2839
4870
|
#### `setProvider(provider)`
|
|
2840
4871
|
|
|
2841
4872
|
Registers a UI provider as the active singleton.
|
|
@@ -2938,6 +4969,14 @@ The HTML attribute name for automation IDs.
|
|
|
2938
4969
|
const MOL_ID_ATTR: 'data-mol-id'
|
|
2939
4970
|
```
|
|
2940
4971
|
|
|
4972
|
+
#### `DEFAULT_TYPING_PULSE`
|
|
4973
|
+
|
|
4974
|
+
The motion both renderers use when the ClassMap omits its typing pulse.
|
|
4975
|
+
|
|
4976
|
+
```typescript
|
|
4977
|
+
const DEFAULT_TYPING_PULSE: DotPulseMotion
|
|
4978
|
+
```
|
|
4979
|
+
|
|
2941
4980
|
## Available Providers
|
|
2942
4981
|
|
|
2943
4982
|
| Provider | Package |
|
|
@@ -2959,11 +4998,13 @@ const MOL_ID_ATTR: 'data-mol-id'
|
|
|
2959
4998
|
Peer dependencies:
|
|
2960
4999
|
|
|
2961
5000
|
- `@molecule/app-bond` ^1.0.1
|
|
5001
|
+
- `@molecule/app-filesystem` ^1.1.0
|
|
2962
5002
|
- `@molecule/app-i18n` ^1.0.1
|
|
2963
5003
|
|
|
2964
5004
|
### Runtime Dependencies
|
|
2965
5005
|
|
|
2966
5006
|
- `@molecule/app-bond`
|
|
5007
|
+
- `@molecule/app-filesystem`
|
|
2967
5008
|
- `@molecule/app-i18n`
|
|
2968
5009
|
|
|
2969
5010
|
**Style through {@link getClassMap} — NEVER write raw CSS/Tailwind class names in a
|