@mistriwork/ui 1.0.0-rc.58 → 1.0.0-rc.60
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 +46 -12
- package/dist/Avatar.js +3 -3
- package/dist/Button.d.ts +4 -14
- package/dist/Button.js +26 -13
- package/dist/Carousel.d.ts +6 -5
- package/dist/Carousel.js +58 -67
- package/dist/Choices.d.ts +2 -9
- package/dist/Choices.js +127 -64
- package/dist/DateField.d.ts +9 -4
- package/dist/DateField.js +102 -119
- package/dist/Drawer.d.ts +1 -19
- package/dist/Drawer.js +8 -9
- package/dist/DropMenu.d.ts +8 -21
- package/dist/DropMenu.js +84 -30
- package/dist/Dropdown.d.ts +9 -8
- package/dist/Dropdown.js +69 -65
- package/dist/Field.d.ts +2 -1
- package/dist/Field.js +12 -18
- package/dist/FileField.d.ts +3 -10
- package/dist/FileField.js +12 -9
- package/dist/FormParts.d.ts +17 -10
- package/dist/FormParts.js +26 -41
- package/dist/HeroBlocks.d.ts +7 -3
- package/dist/HeroBlocks.js +11 -6
- package/dist/Modal.d.ts +6 -17
- package/dist/Modal.js +90 -21
- package/dist/Pagination.d.ts +1 -12
- package/dist/Pagination.js +17 -3
- package/dist/Popover.d.ts +1 -15
- package/dist/Popover.js +10 -15
- package/dist/Resizable.d.ts +3 -21
- package/dist/Resizable.js +14 -91
- package/dist/ScrollArea.d.ts +4 -2
- package/dist/ScrollArea.js +11 -11
- package/dist/Select.d.ts +1 -6
- package/dist/Select.js +16 -7
- package/dist/SensitiveField.d.ts +1 -8
- package/dist/SensitiveField.js +6 -4
- package/dist/Slider.d.ts +1 -5
- package/dist/Slider.js +13 -5
- package/dist/Switch.d.ts +1 -11
- package/dist/Switch.js +10 -9
- package/dist/Tabs.d.ts +3 -3
- package/dist/Tabs.js +3 -3
- package/dist/TextArea.d.ts +4 -6
- package/dist/TextArea.js +14 -5
- package/dist/TextField.d.ts +5 -9
- package/dist/TextField.js +67 -9
- package/dist/Tooltip.d.ts +1 -21
- package/dist/Tooltip.js +13 -31
- package/dist/Typeahead.d.ts +15 -18
- package/dist/Typeahead.js +151 -86
- package/dist/UiKit.d.ts +63 -4
- package/dist/UiKit.js +46 -5
- package/dist/behaviors/DaysParts.js +28 -0
- package/dist/behaviors/EditableParts.js +21 -0
- package/dist/behaviors/PickParts.js +30 -0
- package/dist/behaviors/ScrubParts.js +21 -0
- package/dist/behaviors/SortableParts.js +32 -0
- package/dist/behaviors/SpansParts.js +12 -0
- package/dist/behaviors/TransferParts.js +37 -0
- package/dist/behaviors/TurnsParts.js +31 -0
- package/dist/behaviors/WidthsParts.js +27 -0
- package/dist/behaviors/days.js +216 -0
- package/dist/behaviors/dress.js +86 -0
- package/dist/behaviors/editable.js +104 -0
- package/dist/behaviors/heard.js +22 -0
- package/dist/behaviors/index.d.ts +310 -0
- package/dist/behaviors/index.js +44 -0
- package/dist/behaviors/pick.js +158 -0
- package/dist/behaviors/scrub.js +152 -0
- package/dist/behaviors/sortable.js +170 -0
- package/dist/behaviors/spans.js +240 -0
- package/dist/behaviors/testing.js +48 -0
- package/dist/behaviors/transfer.js +202 -0
- package/dist/behaviors/turns.js +106 -0
- package/dist/behaviors/widths.js +150 -0
- package/dist/behaviors.css +309 -0
- package/dist/changeDetails.d.ts +4 -8
- package/dist/changeDetails.js +0 -6
- package/dist/conformance.js +107 -1
- package/dist/controls.css +36 -0
- package/dist/fieldFrame.d.ts +2 -15
- package/dist/fieldFrame.js +1 -17
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -5
- package/dist/internal/Frame.d.ts +6 -0
- package/dist/internal/Frame.js +25 -0
- package/dist/internal/HelpTip.d.ts +5 -0
- package/dist/internal/HelpTip.js +37 -0
- package/dist/internal/layers.d.ts +21 -0
- package/dist/internal/layers.js +66 -0
- package/dist/internal/popups.d.ts +12 -10
- package/dist/internal/popups.js +18 -14
- package/dist/internal/told.d.ts +14 -0
- package/dist/internal/told.js +20 -0
- package/dist/internal/uiKitContext.js +6 -4
- package/dist/preferences.css +2 -3
- package/dist/style.css +5 -16
- package/dist/styles/extras.css +463 -0
- package/dist/styles/forms.css +346 -0
- package/dist/styles/guard.css +114 -0
- package/dist/styles/kit-fields.css +181 -0
- package/dist/styles/kit-parts.css +130 -0
- package/dist/styles/kit.css +558 -0
- package/dist/styles/layers.css +4 -0
- package/dist/styles/looks.css +374 -0
- package/dist/styles/m-tokens.css +173 -0
- package/dist/styles/overlays.css +107 -0
- package/dist/styles/parts.css +456 -0
- package/dist/styles/screens.css +76 -0
- package/dist/styles/ui-sdk.css +1635 -0
- package/dist/tokens.css +15 -4
- package/dist/uiKitSlots.d.ts +1 -1
- package/dist/uiKitSlots.js +18 -2
- package/package.json +13 -11
- package/dist/forms.css +0 -225
- package/dist/hero.css +0 -23
- package/dist/internal/anchor.d.ts +0 -19
- package/dist/internal/anchor.js +0 -52
- package/dist/primitives.css +0 -200
- package/dist/standalone.css +0 -478
package/dist/Resizable.d.ts
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resizable panels: two or more panes side by side (or stacked), divided
|
|
3
|
-
* by a handle the reader drags or walks with the keyboard. Plain React —
|
|
4
|
-
* Base UI has no resizable, and a flex row with a draggable divider is all
|
|
5
|
-
* one is. The panes are the caller's array; each names its own `minSize`
|
|
6
|
-
* in percent (10 by default) and its starting `defaultSize`, and sizes
|
|
7
|
-
* that do not add to 100 are scaled to it, so a caller who writes 1 and 2
|
|
8
|
-
* gets a third and two thirds. Controlled with `sizes`/`onSizesChange`,
|
|
9
|
-
* uncontrolled with the panels' `defaultSize`s.
|
|
10
|
-
*
|
|
11
|
-
* A handle is a separator, not a button: `role="separator"`,
|
|
12
|
-
* `aria-orientation`, `aria-valuenow`/`min`/`max` in percent, and the two
|
|
13
|
-
* panes it divides named by `aria-controls`. Arrow keys move it 5 points
|
|
14
|
-
* (10 with Shift), Home and End take it to its ends, and a pointer drag
|
|
15
|
-
* moves it by the pointer's share of the container — the same handle for
|
|
16
|
-
* mouse, pen and touch, so no reader needs a mouse to resize. The panes
|
|
17
|
-
* themselves never shrink below their minimum, and a drag that would push
|
|
18
|
-
* a neighbour below its minimum stops at that neighbour's edge.
|
|
19
|
-
*/
|
|
20
1
|
import { type ReactNode } from 'react';
|
|
21
|
-
import {
|
|
2
|
+
import type { ChangeDetails } from './changeDetails.js';
|
|
22
3
|
export interface ResizablePanel {
|
|
23
4
|
/** The pane's accessible name, said by its handle's controls. */
|
|
24
5
|
label?: string;
|
|
@@ -45,5 +26,6 @@ interface ResizableWords {
|
|
|
45
26
|
/** A pane's stand-in name when it has no `label`: "panel 2". */
|
|
46
27
|
panel: (number: number) => string;
|
|
47
28
|
}
|
|
48
|
-
|
|
29
|
+
declare function DefaultResizable({ panels, direction, sizes, onSizesChange, ariaLabel, words: given, className }: ResizableProps): import("react").JSX.Element | null;
|
|
30
|
+
export declare const Resizable: typeof DefaultResizable;
|
|
49
31
|
export {};
|
package/dist/Resizable.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* Resizable panels: two or more panes side by side (or stacked), divided
|
|
4
|
-
* by a handle the reader drags or walks with the keyboard
|
|
5
|
-
*
|
|
6
|
-
* one is. The panes are the caller's array; each names its own `minSize`
|
|
4
|
+
* by a handle the reader drags or walks with the keyboard, over UI SDK's
|
|
5
|
+
* Resizable. The panes are the caller's array; each names its own `minSize`
|
|
7
6
|
* in percent (10 by default) and its starting `defaultSize`, and sizes
|
|
8
7
|
* that do not add to 100 are scaled to it, so a caller who writes 1 and 2
|
|
9
8
|
* gets a third and two thirds. Controlled with `sizes`/`onSizesChange`,
|
|
@@ -18,8 +17,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
17
|
* themselves never shrink below their minimum, and a drag that would push
|
|
19
18
|
* a neighbour below its minimum stops at that neighbour's edge.
|
|
20
19
|
*/
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { Resizable as Group, ResizableHandle, ResizablePanel } from '@ui-sdk/react/resizable';
|
|
21
|
+
import { Fragment, useState } from 'react';
|
|
22
|
+
import { told } from './internal/told.js';
|
|
23
|
+
import { slotted } from './internal/uiKitContext.js';
|
|
23
24
|
const ENGLISH = {
|
|
24
25
|
resize: (before, after) => `Resize ${before} and ${after}`,
|
|
25
26
|
panel: (number) => `panel ${number}`,
|
|
@@ -31,93 +32,15 @@ function initialSizes(panels) {
|
|
|
31
32
|
return given.map((size) => (size / total) * 100);
|
|
32
33
|
return panels.map(() => 100 / panels.length);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const total = clamped.reduce((sum, size) => sum + size, 0);
|
|
38
|
-
return total ? clamped.map((size) => (size / total) * 100) : clamped;
|
|
39
|
-
}
|
|
40
|
-
export function Resizable({ panels, direction = 'horizontal', sizes, onSizesChange, ariaLabel, words: given, className }) {
|
|
35
|
+
/* The sizes are shares of the whole, in the panes' order. A pane scrolls inside itself on purpose and says so
|
|
36
|
+
(`data-scrolls`), for the check that looks for a page scrolling twice (gradeProbe.ts). */
|
|
37
|
+
function DefaultResizable({ panels, direction = 'horizontal', sizes, onSizesChange, ariaLabel, words: given, className }) {
|
|
41
38
|
const words = { ...ENGLISH, ...given };
|
|
42
|
-
const [
|
|
43
|
-
const containerRef = useRef(null);
|
|
44
|
-
const dragRef = useRef(null);
|
|
45
|
-
const baseId = useId();
|
|
39
|
+
const [start] = useState(() => initialSizes(panels));
|
|
46
40
|
if (panels.length < 2)
|
|
47
41
|
return null;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const setSizes = (next, event) => {
|
|
51
|
-
const clamped = clampSizes(panels, next);
|
|
52
|
-
if (sizes === undefined)
|
|
53
|
-
setUncontrolled(clamped);
|
|
54
|
-
onSizesChange?.(clamped, changeDetails('resize', event));
|
|
55
|
-
};
|
|
56
|
-
/** Move handle `i` so pane `i` grows by `delta` points and pane `i + 1` shrinks by the same. */
|
|
57
|
-
const move = (i, delta, event) => {
|
|
58
|
-
const next = [...current];
|
|
59
|
-
const low = mins[i] - current[i];
|
|
60
|
-
const high = current[i + 1] - mins[i + 1];
|
|
61
|
-
const applied = Math.min(Math.max(delta, low), high);
|
|
62
|
-
next[i] = current[i] + applied;
|
|
63
|
-
next[i + 1] = current[i + 1] - applied;
|
|
64
|
-
setSizes(next, event);
|
|
65
|
-
};
|
|
66
|
-
const onHandleKeyDown = (i) => (event) => {
|
|
67
|
-
const horizontal = direction === 'horizontal';
|
|
68
|
-
const step = event.shiftKey ? 10 : 5;
|
|
69
|
-
if (event.key === (horizontal ? 'ArrowRight' : 'ArrowDown')) {
|
|
70
|
-
event.preventDefault();
|
|
71
|
-
move(i, step, event);
|
|
72
|
-
}
|
|
73
|
-
else if (event.key === (horizontal ? 'ArrowLeft' : 'ArrowUp')) {
|
|
74
|
-
event.preventDefault();
|
|
75
|
-
move(i, -step, event);
|
|
76
|
-
}
|
|
77
|
-
else if (event.key === 'Home') {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
move(i, -(current[i] - mins[i]), event);
|
|
80
|
-
}
|
|
81
|
-
else if (event.key === 'End') {
|
|
82
|
-
event.preventDefault();
|
|
83
|
-
move(i, current[i + 1] - mins[i + 1], event);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const onPointerDown = (i) => (event) => {
|
|
87
|
-
const container = containerRef.current;
|
|
88
|
-
if (!container)
|
|
89
|
-
return;
|
|
90
|
-
const rect = container.getBoundingClientRect();
|
|
91
|
-
const horizontal = direction === 'horizontal';
|
|
92
|
-
const pos = horizontal ? event.clientX - rect.left : event.clientY - rect.top;
|
|
93
|
-
const span = horizontal ? rect.width : rect.height;
|
|
94
|
-
dragRef.current = { handle: i, start: span ? (pos / span) * 100 : 0, sizes: current };
|
|
95
|
-
event.target.setPointerCapture?.(event.pointerId);
|
|
96
|
-
};
|
|
97
|
-
const onPointerMove = (event) => {
|
|
98
|
-
const drag = dragRef.current;
|
|
99
|
-
const container = containerRef.current;
|
|
100
|
-
if (!drag || !container)
|
|
101
|
-
return;
|
|
102
|
-
const rect = container.getBoundingClientRect();
|
|
103
|
-
const horizontal = direction === 'horizontal';
|
|
104
|
-
const pos = horizontal ? event.clientX - rect.left : event.clientY - rect.top;
|
|
105
|
-
const span = horizontal ? rect.width : rect.height;
|
|
106
|
-
if (!span)
|
|
107
|
-
return;
|
|
108
|
-
const delta = (pos / span) * 100 - drag.start;
|
|
109
|
-
const next = [...drag.sizes];
|
|
110
|
-
const low = mins[drag.handle] - drag.sizes[drag.handle];
|
|
111
|
-
const high = drag.sizes[drag.handle + 1] - mins[drag.handle + 1];
|
|
112
|
-
const applied = Math.min(Math.max(delta, low), high);
|
|
113
|
-
next[drag.handle] = drag.sizes[drag.handle] + applied;
|
|
114
|
-
next[drag.handle + 1] = drag.sizes[drag.handle + 1] - applied;
|
|
115
|
-
setSizes(next, event);
|
|
116
|
-
};
|
|
117
|
-
const onPointerUp = () => {
|
|
118
|
-
dragRef.current = null;
|
|
119
|
-
};
|
|
120
|
-
return (_jsx("div", { ref: containerRef, className: ['ui-resizable', direction === 'vertical' ? 'ui-resizable-vertical' : 'ui-resizable-horizontal', className]
|
|
121
|
-
.filter(Boolean)
|
|
122
|
-
.join(' '), role: "group", "aria-label": ariaLabel, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, children: panels.map((panel, i) => (_jsxs(Fragment, { children: [_jsx("div", { id: `${baseId}-panel-${i}`, className: "ui-resizable-panel", style: { flex: `${current[i]} 1 0` }, role: "group", "aria-label": panel.label, "data-scrolls": "", children: panel.children }), i < panels.length - 1 ? (_jsx("div", { className: "ui-resizable-handle", role: "separator", "aria-orientation": direction === 'horizontal' ? 'vertical' : 'horizontal', "aria-valuenow": Math.round(current[i]), "aria-valuemin": mins[i], "aria-valuemax": 100 - mins[i + 1], "aria-controls": `${baseId}-panel-${i} ${baseId}-panel-${i + 1}`, "aria-label": words.resize(panels[i]?.label ?? words.panel(i + 1), panels[i + 1]?.label ?? words.panel(i + 2)), tabIndex: 0, onKeyDown: onHandleKeyDown(i), onPointerDown: onPointerDown(i) })) : null] }, i))) }));
|
|
42
|
+
const name = (place) => panels[place]?.label ?? words.panel(place + 1);
|
|
43
|
+
return (_jsx(Group, { role: "group", orientation: direction, "aria-label": ariaLabel, className: className, step: 5, largeStep: 10, layout: sizes ? [...sizes] : undefined, defaultLayout: sizes ? undefined : start, onLayoutChange: (layout, details) => onSizesChange?.(layout, told('resize', details)), children: panels.map((panel, place) => (_jsxs(Fragment, { children: [place > 0 && _jsx(ResizableHandle, { "aria-label": words.resize(name(place - 1), name(place)) }), _jsx(ResizablePanel, { minSize: panel.minSize ?? 10, role: "group", "aria-label": panel.label, "data-scrolls": "", children: panel.children })] }, place))) }));
|
|
123
44
|
}
|
|
45
|
+
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
46
|
+
export const Resizable = slotted('Resizable', DefaultResizable, { onSizesChange: [1, 'resize'] });
|
package/dist/ScrollArea.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A scroll area: a region that scrolls inside itself, with its own
|
|
3
|
-
* thumb, instead of growing the page around it. Over
|
|
3
|
+
* thumb, instead of growing the page around it. Over UI SDK's ScrollArea,
|
|
4
4
|
* which gives it the viewport, the thumb that tracks it and the corner
|
|
5
5
|
* where two thumbs meet. Where its content overflows, the viewport is a
|
|
6
6
|
* tab stop with the region's name, so a keyboard reader can reach it and
|
|
@@ -26,4 +26,6 @@ export interface ScrollAreaProps {
|
|
|
26
26
|
maxHeight?: string;
|
|
27
27
|
className?: string;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
declare function DefaultScrollArea({ children, ariaLabel, orientation, maxHeight, className }: ScrollAreaProps): import("react").JSX.Element;
|
|
30
|
+
export declare const ScrollArea: typeof DefaultScrollArea;
|
|
31
|
+
export {};
|
package/dist/ScrollArea.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* A scroll area: a region that scrolls inside itself, with its own
|
|
4
|
-
* thumb, instead of growing the page around it. Over
|
|
4
|
+
* thumb, instead of growing the page around it. Over UI SDK's ScrollArea,
|
|
5
5
|
* which gives it the viewport, the thumb that tracks it and the corner
|
|
6
6
|
* where two thumbs meet. Where its content overflows, the viewport is a
|
|
7
7
|
* tab stop with the region's name, so a keyboard reader can reach it and
|
|
@@ -18,12 +18,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
* whenever the box resizes.
|
|
19
19
|
*/
|
|
20
20
|
import { useEffect, useRef, useState } from 'react';
|
|
21
|
-
import {
|
|
22
|
-
|
|
21
|
+
import { slotted } from './internal/uiKitContext.js';
|
|
22
|
+
import { ScrollArea as Scroller, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, } from '@ui-sdk/react/scroll-area';
|
|
23
|
+
function DefaultScrollArea({ children, ariaLabel, orientation = 'vertical', maxHeight, className }) {
|
|
23
24
|
const vertical = orientation === 'vertical' || orientation === 'both';
|
|
24
25
|
const horizontal = orientation === 'horizontal' || orientation === 'both';
|
|
25
26
|
const viewportRef = useRef(null);
|
|
26
|
-
const contentRef = useRef(null);
|
|
27
27
|
const [overflows, setOverflows] = useState(false);
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
const viewport = viewportRef.current;
|
|
@@ -45,9 +45,8 @@ export function ScrollArea({ children, ariaLabel, orientation = 'vertical', maxH
|
|
|
45
45
|
if (typeof ResizeObserver !== 'undefined') {
|
|
46
46
|
observer = new ResizeObserver(measure);
|
|
47
47
|
observer.observe(viewport);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
observer.observe(content);
|
|
48
|
+
if (viewport.firstElementChild)
|
|
49
|
+
observer.observe(viewport.firstElementChild);
|
|
51
50
|
}
|
|
52
51
|
window.addEventListener('resize', measure);
|
|
53
52
|
return () => {
|
|
@@ -55,8 +54,9 @@ export function ScrollArea({ children, ariaLabel, orientation = 'vertical', maxH
|
|
|
55
54
|
window.removeEventListener('resize', measure);
|
|
56
55
|
};
|
|
57
56
|
}, [vertical, horizontal, children]);
|
|
58
|
-
return (_jsxs(
|
|
59
|
-
/*
|
|
60
|
-
|
|
61
|
-
role: "region", "aria-label": ariaLabel, "data-scrolls": "", style: maxHeight ? { maxHeight } : undefined, children: _jsx(BaseScrollArea.Content, { ref: contentRef, className: "ui-scroll-area-content", children: children }) }), vertical ? (_jsx(BaseScrollArea.Scrollbar, { className: "ui-scroll-area-scrollbar ui-scroll-area-scrollbar-vertical", orientation: "vertical", children: _jsx(BaseScrollArea.Thumb, { className: "ui-scroll-area-thumb" }) })) : null, horizontal ? (_jsx(BaseScrollArea.Scrollbar, { className: "ui-scroll-area-scrollbar ui-scroll-area-scrollbar-horizontal", orientation: "horizontal", children: _jsx(BaseScrollArea.Thumb, { className: "ui-scroll-area-thumb" }) })) : null, vertical && horizontal ? _jsx(BaseScrollArea.Corner, { className: "ui-scroll-area-corner" }) : null] }));
|
|
57
|
+
return (_jsxs(Scroller, { className: className, children: [_jsx(ScrollAreaViewport, { ref: viewportRef, tabIndex: overflows ? 0 : -1,
|
|
58
|
+
/* A named scroll region needs the region role, or the label is dropped. */
|
|
59
|
+
role: "region", "aria-label": ariaLabel, "data-scrolls": "", style: maxHeight ? { maxHeight } : undefined, children: _jsx(ScrollAreaContent, { children: children }) }), vertical ? (_jsx(ScrollAreaScrollbar, { orientation: "vertical", children: _jsx(ScrollAreaThumb, {}) })) : null, horizontal ? (_jsx(ScrollAreaScrollbar, { orientation: "horizontal", children: _jsx(ScrollAreaThumb, {}) })) : null, vertical && horizontal ? _jsx(ScrollAreaCorner, {}) : null] }));
|
|
62
60
|
}
|
|
61
|
+
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
62
|
+
export const ScrollArea = slotted('ScrollArea', DefaultScrollArea);
|
package/dist/Select.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The listbox of a form: one choice, or several, in a field. It is the Dropdown (Base UI's Select) dressed as a field
|
|
3
|
-
* box, so the keyboard is the one it has: ArrowDown opens it, the arrows move, Enter and Space choose, Escape closes and
|
|
4
|
-
* returns focus to the box. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
5
|
-
*/
|
|
6
1
|
import { type ReactNode, type Ref } from 'react';
|
|
7
2
|
import { type DropdownChange, type DropdownItem } from './Dropdown.js';
|
|
8
|
-
import {
|
|
3
|
+
import type { FieldFrame } from './fieldFrame.js';
|
|
9
4
|
interface ListFrame extends FieldFrame {
|
|
10
5
|
options: DropdownItem[];
|
|
11
6
|
/** What the box says while nothing is chosen ("Choose"). */
|
package/dist/Select.js
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* The listbox of a form: one choice, or several, in a field. It is the Dropdown (
|
|
4
|
-
*
|
|
3
|
+
* The listbox of a form: one choice, or several, in a field. It is the Dropdown (UI SDK's Select) in a field's frame,
|
|
4
|
+
* so the keyboard is the one it has: ArrowDown opens it, the arrows move, Enter and Space choose, Escape closes and
|
|
5
5
|
* returns focus to the box. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
6
6
|
*/
|
|
7
|
+
import { useFieldControl } from '@ui-sdk/react/field';
|
|
7
8
|
import { useId } from 'react';
|
|
8
9
|
import { Dropdown, MultiDropdown } from './Dropdown.js';
|
|
9
|
-
import {
|
|
10
|
-
import { frameOf } from './fieldFrame.js';
|
|
10
|
+
import { Frame } from './internal/Frame.js';
|
|
11
11
|
import { slotted } from './internal/uiKitContext.js';
|
|
12
|
+
function Wired({ children }) {
|
|
13
|
+
const said = useFieldControl()?.props({});
|
|
14
|
+
const text = (value) => (typeof value === 'string' && value ? value : undefined);
|
|
15
|
+
return (_jsx(_Fragment, { children: children({
|
|
16
|
+
label: text(said?.['aria-labelledby']),
|
|
17
|
+
describedBy: text(said?.['aria-describedby']),
|
|
18
|
+
invalid: said?.['aria-invalid'] === true || said?.['aria-invalid'] === 'true' || undefined,
|
|
19
|
+
}) }));
|
|
20
|
+
}
|
|
12
21
|
/** One choice from a list, under a field box. */
|
|
13
22
|
function DefaultSelect(props) {
|
|
14
23
|
const valueId = useId();
|
|
15
|
-
return (_jsx(
|
|
24
|
+
return (_jsx(Frame, { ...props, children: _jsx(Wired, { children: ({ label, describedBy, invalid }) => (_jsx(Dropdown, { items: props.options, value: props.value, onChange: props.onChange, id: props.id, ariaLabelledBy: label && `${label} ${valueId}`, ariaDescribedBy: describedBy, ariaInvalid: invalid, valueId: valueId, buttonRef: props.buttonRef, placeholder: props.placeholder, disabled: props.disabled })) }) }));
|
|
16
25
|
}
|
|
17
26
|
/** Several choices, each with a checkbox; the closed box says them as "Acura, Alfa Romeo". */
|
|
18
27
|
function DefaultMultiSelect(props) {
|
|
19
28
|
const valueId = useId();
|
|
20
|
-
return (_jsx(
|
|
29
|
+
return (_jsx(Frame, { ...props, children: _jsx(Wired, { children: ({ label, describedBy, invalid }) => (_jsx(MultiDropdown, { items: props.options, value: props.value, onChange: props.onChange, id: props.id, ariaLabelledBy: label && `${label} ${valueId}`, ariaDescribedBy: describedBy, ariaInvalid: invalid, valueId: valueId, buttonRef: props.buttonRef, placeholder: props.placeholder, disabled: props.disabled })) }) }));
|
|
21
30
|
}
|
|
22
31
|
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
23
32
|
export const Select = slotted('Select', DefaultSelect, { onChange: [1, 'item-press'] });
|
package/dist/SensitiveField.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A number kept out of sight (an SSN, say): dots until Show is pressed, typed at the end. Show is a button of its own,
|
|
3
|
-
* after the box: two controls do not share a box (docs/design.md). The intake style draws it over the box's inline end,
|
|
4
|
-
* in room the box keeps for it, so it reads as part of the field and is still its own Tab stop. The value lives in the caller's state alone:
|
|
5
|
-
* this never logs it, stores it or writes it anywhere, the box turns off autofill and spellcheck, and while hidden the
|
|
6
|
-
* dots are all the page holds. Preview: @mistriwork/ui is Preview at 1.0.
|
|
7
|
-
*/
|
|
8
1
|
import { type ReactNode } from 'react';
|
|
9
|
-
import {
|
|
2
|
+
import type { FieldFrame } from './fieldFrame.js';
|
|
10
3
|
import { type Mask } from './masks.js';
|
|
11
4
|
import { type ChangeDetails } from './changeDetails.js';
|
|
12
5
|
export interface SensitiveFieldProps extends FieldFrame {
|
package/dist/SensitiveField.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* A number kept out of sight (an SSN, say): dots until Show is pressed, typed at the end. Show is a button of its own,
|
|
4
4
|
* after the box: two controls do not share a box (docs/design.md). The intake style draws it over the box's inline end,
|
|
@@ -6,13 +6,13 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
6
6
|
* this never logs it, stores it or writes it anywhere, the box turns off autofill and spellcheck, and while hidden the
|
|
7
7
|
* dots are all the page holds. Preview: @mistriwork/ui is Preview at 1.0.
|
|
8
8
|
*/
|
|
9
|
+
import { Input } from '@ui-sdk/react/input';
|
|
9
10
|
import { useState } from 'react';
|
|
10
11
|
import { Button } from './Button.js';
|
|
11
|
-
import { Field } from './Field.js';
|
|
12
|
-
import { frameOf } from './fieldFrame.js';
|
|
13
12
|
import { digits } from './masks.js';
|
|
14
13
|
import { ValidMark } from './TextField.js';
|
|
15
14
|
import { changeDetails } from './changeDetails.js';
|
|
15
|
+
import { Frame } from './internal/Frame.js';
|
|
16
16
|
import { slotted } from './internal/uiKitContext.js';
|
|
17
17
|
function DefaultSensitiveField(props) {
|
|
18
18
|
const [shown, setShown] = useState(false);
|
|
@@ -25,7 +25,9 @@ function DefaultSensitiveField(props) {
|
|
|
25
25
|
const kept = formatted.slice(0, typed.replace(/[^•]/g, '').length);
|
|
26
26
|
props.onChange(props.mask.parse(digits(kept) + digits(typed)), details);
|
|
27
27
|
};
|
|
28
|
-
return (
|
|
28
|
+
return (_jsxs(Frame, { ...props, children: [_jsxs("div", { "data-slot": "field-with-action", children: [_jsxs("div", { "data-slot": "field-box", "data-has-mark": props.valid === undefined ? undefined : '', children: [_jsx(Input, { id: props.id, "data-hidden": shown ? undefined : '', value: display, inputMode: props.mask.inputMode ?? 'numeric', autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, "data-1p-ignore": "", "data-lpignore": "true", "aria-required": props.required || undefined,
|
|
29
|
+
// React's own change, as the text box hears it (TextField.tsx says why).
|
|
30
|
+
onChange: (event) => change(event.target.value, changeDetails('input-change', event)), onBlur: props.onBlur }), props.valid ? _jsx(ValidMark, { icon: props.validIcon }) : null] }), _jsx(Button, { intent: "quiet", onClick: () => setShown(!shown), children: shown ? props.hideLabel : props.showLabel })] }), props.note ? (_jsxs("p", { "data-slot": "field-note", children: [props.noteIcon, props.note] })) : null] }));
|
|
29
31
|
}
|
|
30
32
|
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
31
33
|
export const SensitiveField = slotted('SensitiveField', DefaultSensitiveField, { onChange: [1, 'input-change'] });
|
package/dist/Slider.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An amount set by a slider and read out in a box above it, with the range's ends labelled. The slider is the native
|
|
3
|
-
* range input, so the arrows, Home, End and Page keys are the browser's. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
4
|
-
*/
|
|
5
1
|
import type { ReactNode } from 'react';
|
|
6
|
-
import { type FieldFrame } from './fieldFrame.js';
|
|
7
2
|
import { type ChangeDetails } from './changeDetails.js';
|
|
3
|
+
import type { FieldFrame } from './fieldFrame.js';
|
|
8
4
|
export interface SliderProps extends FieldFrame {
|
|
9
5
|
value: number;
|
|
10
6
|
onChange: (value: number, details: ChangeDetails<'slide'>) => void;
|
package/dist/Slider.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* An amount set by a slider and read out in a box above it, with the range's ends labelled. The slider is the
|
|
4
|
+
* browser's own range input, so the arrows, Home, End and the Page keys are the platform's, and it is the control of
|
|
5
|
+
* UI SDK's field around it, which hands it its id, its name and what describes it as it does a text box. It is not
|
|
6
|
+
* UI SDK's slider: that one is a track and a thumb over an input of its own whose id it decides, where this control
|
|
7
|
+
* is one labelable element that takes the id a caller gives it. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
8
|
+
*/
|
|
9
|
+
import { FieldControl } from '@ui-sdk/react/field';
|
|
5
10
|
import { changeDetails } from './changeDetails.js';
|
|
11
|
+
import { grouped } from './masks.js';
|
|
12
|
+
import { Frame } from './internal/Frame.js';
|
|
6
13
|
import { slotted } from './internal/uiKitContext.js';
|
|
7
14
|
function DefaultSlider(props) {
|
|
8
15
|
const say = props.format ?? grouped;
|
|
9
16
|
const span = props.max - props.min;
|
|
17
|
+
// The filled share of the track, for the stylesheet to draw (a range's own fill cannot be dressed everywhere).
|
|
10
18
|
const share = span > 0 ? ((props.value - props.min) / span) * 100 : 0;
|
|
11
|
-
return (
|
|
19
|
+
return (_jsxs(Frame, { ...props, children: [_jsx("div", { "data-slot": "slider-readout", "aria-hidden": "true", children: say(props.value) }), _jsx(FieldControl, { id: props.id, type: "range", "data-kind": "range", min: props.min, max: props.max, step: props.step, value: props.value, disabled: props.disabled, "aria-valuetext": say(props.value), style: { '--range-share': `${share}%` }, onChange: (event) => props.onChange(Number(event.target.value), changeDetails('slide', event)) }), _jsxs("div", { "data-slot": "slider-ends", "aria-hidden": "true", children: [_jsx("span", { children: say(props.min) }), _jsx("span", { children: say(props.max) })] })] }));
|
|
12
20
|
}
|
|
13
21
|
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
14
22
|
export const Slider = slotted('Slider', DefaultSlider, { onChange: [1, 'slide'] });
|
package/dist/Switch.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A switch: one on/off choice, said as a switch, not a checkbox. Over Base
|
|
3
|
-
* UI's Switch, which gives it the role, the keyboard (Space toggles, as a
|
|
4
|
-
* checkbox does) and the checked state; the label beside it is a click
|
|
5
|
-
* target too, and a description under it never is. Controlled with
|
|
6
|
-
* `checked`/`onCheckedChange`, uncontrolled with `defaultChecked`.
|
|
7
|
-
* Busy is not disabled here either (Button.tsx): a disabled switch drops
|
|
8
|
-
* the focus it holds, so a switch that is working says `aria-disabled`
|
|
9
|
-
* and refuses the press itself.
|
|
10
|
-
*/
|
|
11
1
|
import { type ReactNode, type Ref } from 'react';
|
|
12
|
-
import {
|
|
2
|
+
import type { ChangeDetails } from './changeDetails.js';
|
|
13
3
|
export interface SwitchProps {
|
|
14
4
|
/** The label beside the switch; its click toggles, as the switch's own does. */
|
|
15
5
|
label?: ReactNode;
|
package/dist/Switch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* A switch: one on/off choice, said as a switch, not a checkbox. Over
|
|
4
|
-
*
|
|
3
|
+
* A switch: one on/off choice, said as a switch, not a checkbox. Over UI
|
|
4
|
+
* SDK's Switch, which gives it the role, the keyboard (Space toggles, as a
|
|
5
5
|
* checkbox does) and the checked state; the label beside it is a click
|
|
6
6
|
* target too, and a description under it never is. Controlled with
|
|
7
7
|
* `checked`/`onCheckedChange`, uncontrolled with `defaultChecked`.
|
|
@@ -9,20 +9,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
* the focus it holds, so a switch that is working says `aria-disabled`
|
|
10
10
|
* and refuses the press itself.
|
|
11
11
|
*/
|
|
12
|
+
import { Switch as Toggle, SwitchThumb } from '@ui-sdk/react/switch';
|
|
12
13
|
import { useId } from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import { fromBaseUi } from './changeDetails.js';
|
|
14
|
+
import { told } from './internal/told.js';
|
|
15
15
|
import { slotted } from './internal/uiKitContext.js';
|
|
16
16
|
function DefaultSwitch({ label, description, checked, defaultChecked, onCheckedChange, disabled = false, busy = false, id, className, ref, }) {
|
|
17
17
|
/* The label names the switch by its id; a caller who gives none gets
|
|
18
|
-
a generated one, never
|
|
18
|
+
a generated one, never UI SDK's own, which the label cannot know. */
|
|
19
19
|
const generatedId = useId();
|
|
20
20
|
const switchId = id ?? generatedId;
|
|
21
|
-
return (_jsxs("span", {
|
|
21
|
+
return (_jsxs("span", { "data-slot": "switch-row", className: className, children: [_jsx(Toggle, { id: switchId, ref: ref, checked: checked, defaultChecked: defaultChecked, disabled: disabled, "aria-disabled": busy || undefined, onCheckedChange: (next, details) => {
|
|
22
|
+
// Refused in UI SDK's own words, so an uncontrolled switch does not move either.
|
|
22
23
|
if (busy)
|
|
23
|
-
return;
|
|
24
|
-
onCheckedChange?.(next,
|
|
25
|
-
}, children: _jsx(
|
|
24
|
+
return details.cancel();
|
|
25
|
+
onCheckedChange?.(next, told('toggle', details));
|
|
26
|
+
}, children: _jsx(SwitchThumb, {}) }), label !== undefined || description !== undefined ? (_jsxs("span", { "data-slot": "switch-copy", children: [label !== undefined ? _jsx("label", { htmlFor: switchId, children: label }) : null, description !== undefined ? _jsx("span", { "data-slot": "switch-description", children: description }) : null] })) : null] }));
|
|
26
27
|
}
|
|
27
28
|
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
28
29
|
export const Switch = slotted('Switch', DefaultSwitch, { onCheckedChange: [1, 'toggle'] });
|
package/dist/Tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tabs: one panel at a time, chosen from a row. Over
|
|
2
|
+
* Tabs: one panel at a time, chosen from a row. Over UI SDK's Tabs, which
|
|
3
3
|
* gives it the tablist, the arrow-key walk between tabs and the panel that
|
|
4
4
|
* belongs to the chosen one; a disabled tab is skipped by that walk, never
|
|
5
5
|
* a dead end. Controlled with `value`/`onValueChange`, uncontrolled with
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* the caller keeps in step.
|
|
8
8
|
*/
|
|
9
9
|
import type { ReactNode } from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import type { ChangeDetails } from './changeDetails.js';
|
|
11
11
|
export interface TabItem {
|
|
12
12
|
value: string;
|
|
13
13
|
label: ReactNode;
|
|
@@ -18,7 +18,7 @@ export interface TabsProps {
|
|
|
18
18
|
tabs: readonly TabItem[];
|
|
19
19
|
value?: string;
|
|
20
20
|
defaultValue?: string;
|
|
21
|
-
/** `select` when a person chose the tab;
|
|
21
|
+
/** `select` when a person chose the tab; `disabled`, `missing` or `initial` when the chosen tab went away. */
|
|
22
22
|
onValueChange?: (value: string, details: ChangeDetails<'select' | 'disabled' | 'missing' | 'initial'>) => void;
|
|
23
23
|
className?: string;
|
|
24
24
|
/** The tablist's accessible name ("Settings sections"). Give one: a tab list without a name is read as "tab list" and
|
package/dist/Tabs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Tabs as
|
|
3
|
-
import {
|
|
2
|
+
import { Tabs as TabSet, TabsIndicator, TabsList, TabsPanel, TabsTab } from '@ui-sdk/react/tabs';
|
|
3
|
+
import { told } from './internal/told.js';
|
|
4
4
|
import { slotted } from './internal/uiKitContext.js';
|
|
5
5
|
function DefaultTabs({ tabs, value, defaultValue, onValueChange, className, ariaLabel }) {
|
|
6
|
-
return (_jsxs(
|
|
6
|
+
return (_jsxs(TabSet, { className: className, value: value, defaultValue: value === undefined ? (defaultValue ?? tabs.find((tab) => !tab.disabled)?.value) : undefined, onValueChange: onValueChange && ((next, details) => next !== null && onValueChange(String(next), told('select', details))), children: [_jsxs(TabsList, { "aria-label": ariaLabel, children: [tabs.map((tab) => (_jsx(TabsTab, { value: tab.value, disabled: tab.disabled, children: tab.label }, tab.value))), _jsx(TabsIndicator, {})] }), tabs.map((tab) => (_jsx(TabsPanel, { value: tab.value, "data-kind": "kit", children: tab.children }, tab.value)))] }));
|
|
7
7
|
}
|
|
8
8
|
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
9
9
|
export const Tabs = slotted('Tabs', DefaultTabs, { onValueChange: [1, 'select'] });
|
package/dist/TextArea.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A box of several lines, in the same frame as a TextField: a Field's label, hint and problem wired to a textarea, which
|
|
3
|
-
* the reader may stretch down. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
4
|
-
*/
|
|
5
1
|
import type { ReactNode, Ref } from 'react';
|
|
6
|
-
import {
|
|
2
|
+
import type { FieldFrame } from './fieldFrame.js';
|
|
7
3
|
import { type ChangeDetails } from './changeDetails.js';
|
|
8
4
|
export interface TextAreaProps extends FieldFrame {
|
|
9
5
|
value: string;
|
|
@@ -21,4 +17,6 @@ export interface TextAreaProps extends FieldFrame {
|
|
|
21
17
|
/** Something drawn under the box: a count, say. */
|
|
22
18
|
after?: ReactNode;
|
|
23
19
|
}
|
|
24
|
-
|
|
20
|
+
declare function DefaultTextArea(props: TextAreaProps): ReactNode;
|
|
21
|
+
export declare const TextArea: typeof DefaultTextArea;
|
|
22
|
+
export {};
|
package/dist/TextArea.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A box of several lines, in the same frame as a TextField: a frame's label, hint and problem wired to a textarea by
|
|
4
|
+
* UI SDK's field, which the reader may stretch down. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
5
|
+
*/
|
|
6
|
+
import { Textarea } from '@ui-sdk/react/textarea';
|
|
4
7
|
import { changeDetails } from './changeDetails.js';
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
import { Frame } from './internal/Frame.js';
|
|
9
|
+
import { slotted } from './internal/uiKitContext.js';
|
|
10
|
+
function DefaultTextArea(props) {
|
|
11
|
+
return (_jsxs(Frame, { ...props, children: [_jsx(Textarea, { id: props.id, ref: props.inputRef, name: props.name, value: props.value, rows: props.rows ?? 3, maxLength: props.maxLength, autoComplete: props.autoComplete ?? 'off', placeholder: props.placeholder, disabled: props.disabled, readOnly: props.readOnly, "aria-required": props.required || undefined,
|
|
12
|
+
// React's own change, as the text box hears it (TextField.tsx says why).
|
|
13
|
+
onChange: (event) => props.onChange(event.target.value, changeDetails('input-change', event)), onBlur: props.onBlur }), props.after] }));
|
|
7
14
|
}
|
|
15
|
+
/* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
|
|
16
|
+
export const TextArea = slotted('TextArea', DefaultTextArea, { onChange: [1, 'input-change'] });
|
package/dist/TextField.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* hint and problem are wired into the box; a valid mark stands at its inline end in space that is always reserved, so
|
|
4
|
-
* it arrives without moving the text. Props only. Preview: @mistriwork/ui is Preview at 1.0.
|
|
5
|
-
*/
|
|
6
|
-
import type { ReactNode, Ref } from 'react';
|
|
7
|
-
import { type FieldFrame } from './fieldFrame.js';
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import type { FieldFrame } from './fieldFrame.js';
|
|
8
3
|
import { type Mask } from './masks.js';
|
|
9
4
|
import { type ChangeDetails } from './changeDetails.js';
|
|
10
5
|
/** The mark at a box's inline end: drawn in CSS unless a picture is lent. Decorative: validity is `aria-invalid`'s to say. */
|
|
11
|
-
|
|
6
|
+
declare function DefaultValidMark({ icon }: {
|
|
12
7
|
icon?: ReactNode;
|
|
13
8
|
}): ReactNode;
|
|
14
9
|
export interface TextFieldProps extends FieldFrame {
|
|
@@ -38,11 +33,12 @@ export interface MaskedFieldProps extends Omit<TextFieldProps, 'value' | 'onChan
|
|
|
38
33
|
onChange: (raw: string, details: ChangeDetails<'input-change'>) => void;
|
|
39
34
|
}
|
|
40
35
|
/** A box that shows its value through a mask and keeps the raw one: `masks.phone`, `masks.date` (typed MM/DD/YYYY), `masks.ssn`… */
|
|
41
|
-
declare function DefaultMaskedField({ mask, value, onChange, ...rest }: MaskedFieldProps): ReactNode;
|
|
36
|
+
declare function DefaultMaskedField({ mask, value, onChange, inputRef, ...rest }: MaskedFieldProps): ReactNode;
|
|
42
37
|
/** Whole money, drawn `$2,500` (or `25,000` with `symbol=""`). The value is the digits. */
|
|
43
38
|
declare function DefaultMoneyField({ symbol, ...rest }: Omit<MaskedFieldProps, 'mask'> & {
|
|
44
39
|
symbol?: string;
|
|
45
40
|
}): ReactNode;
|
|
41
|
+
export declare const ValidMark: typeof DefaultValidMark;
|
|
46
42
|
export declare const TextField: typeof DefaultTextField;
|
|
47
43
|
export declare const MaskedField: typeof DefaultMaskedField;
|
|
48
44
|
export declare const MoneyField: typeof DefaultMoneyField;
|