@uniflowed/ui 0.2.0 → 0.4.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/accordion.js +22 -9
- package/alert-dialog.js +41 -19
- package/alert.js +14 -8
- package/avatar.js +14 -8
- package/breadcrumb.js +24 -6
- package/calendar.js +22 -5
- package/carousel.js +24 -6
- package/collapsible.js +14 -3
- package/color-picker.js +22 -5
- package/combobox.js +30 -21
- package/context-menu.js +31 -2
- package/date-picker.js +37 -11
- package/date-range-picker.js +25 -8
- package/dialog.js +31 -10
- package/drawer.js +47 -34
- package/field.js +24 -6
- package/hover-card.js +14 -3
- package/index.js +89 -740
- package/input-otp.js +20 -4
- package/interactions.js +0 -1
- package/internal/focus.js +13 -4
- package/internal/roving-focus.js +12 -3
- package/menu.js +36 -13
- package/menubar.js +32 -5
- package/navigation-menu.js +24 -6
- package/number-field.js +20 -12
- package/package.json +5 -5
- package/pagination.js +22 -5
- package/popover.js +14 -4
- package/radio-group.js +15 -4
- package/range-calendar.js +20 -2
- package/resizable.js +14 -3
- package/scroll-area.js +14 -3
- package/select.js +30 -13
- package/sheet.js +39 -18
- package/sidebar.js +31 -16
- package/skeleton.js +13 -3
- package/slider.js +15 -4
- package/table.js +32 -10
- package/tabs.js +15 -9
- package/toast.js +24 -6
- package/toggle-group.js +14 -3
- package/tooltip.js +21 -5
package/table.js
CHANGED
|
@@ -127,7 +127,7 @@ hook useTable(part: string): TableState {
|
|
|
127
127
|
* `announceSort` is the wording of the announcement, for an application with a
|
|
128
128
|
* translation table. The default is English.
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
component TableRoot(
|
|
131
131
|
children: React.Node,
|
|
132
132
|
sort?: Sort | null,
|
|
133
133
|
defaultSort?: Sort | null = null,
|
|
@@ -225,7 +225,7 @@ export component TableRoot(
|
|
|
225
225
|
* what a screen reader reads when a reader lands on it. A heading above the
|
|
226
226
|
* table looks the same and is not the table's name.
|
|
227
227
|
*/
|
|
228
|
-
|
|
228
|
+
component TableCaption(children: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
229
229
|
const table = useTable("Table.Caption");
|
|
230
230
|
const register = table.registerCaption;
|
|
231
231
|
|
|
@@ -247,7 +247,7 @@ export component TableCaption(children: React.Node, render?: RenderProp, ...rest
|
|
|
247
247
|
* It tells the root that it exists, because `aria-rowcount` and every row's
|
|
248
248
|
* `aria-rowindex` count header rows and a table without one counts differently.
|
|
249
249
|
*/
|
|
250
|
-
|
|
250
|
+
component TableHeader(children: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
251
251
|
const table = useTable("Table.Header");
|
|
252
252
|
const register = table.registerHeader;
|
|
253
253
|
|
|
@@ -266,7 +266,7 @@ export component TableHeader(children: React.Node, render?: RenderProp, ...rest:
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
/** The data rows. */
|
|
269
|
-
|
|
269
|
+
component TableBody(children: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
270
270
|
const props = withProps(rest, { children });
|
|
271
271
|
return (
|
|
272
272
|
<HeaderContext.Provider value={false}>
|
|
@@ -291,7 +291,7 @@ export component TableBody(children: React.Node, render?: RenderProp, ...rest: R
|
|
|
291
291
|
* adding them anyway is a second source of truth that can disagree with the
|
|
292
292
|
* document.
|
|
293
293
|
*/
|
|
294
|
-
|
|
294
|
+
component TableRow(
|
|
295
295
|
children: React.Node,
|
|
296
296
|
index?: number | null = null,
|
|
297
297
|
render?: RenderProp,
|
|
@@ -332,7 +332,7 @@ export component TableRow(
|
|
|
332
332
|
* Not `"none"` on the others: eleven headers each announcing "not sorted" is
|
|
333
333
|
* eleven announcements of nothing, on every pass through the table.
|
|
334
334
|
*/
|
|
335
|
-
|
|
335
|
+
component TableHead(
|
|
336
336
|
children: React.Node,
|
|
337
337
|
column?: string | null = null,
|
|
338
338
|
render?: RenderProp,
|
|
@@ -395,7 +395,7 @@ export component TableHead(
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
/** One cell. */
|
|
398
|
-
|
|
398
|
+
component TableCell(children: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
399
399
|
const props = withProps(rest, { children });
|
|
400
400
|
if (render != null) {
|
|
401
401
|
return render(withProps(props, { role: "cell" }));
|
|
@@ -411,7 +411,7 @@ export component TableCell(children: React.Node, render?: RenderProp, ...rest: R
|
|
|
411
411
|
* moves down the year column. A table of records usually has one and almost
|
|
412
412
|
* never marks it.
|
|
413
413
|
*/
|
|
414
|
-
|
|
414
|
+
component TableRowHeader(children: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
415
415
|
const props = withProps(rest, { children, scope: "row" });
|
|
416
416
|
if (render != null) {
|
|
417
417
|
return render(withProps(props, { role: "rowheader" }));
|
|
@@ -449,7 +449,7 @@ export component TableRowHeader(children: React.Node, render?: RenderProp, ...re
|
|
|
449
449
|
* wants a `Checkbox` of their own, which they should write — this part exists
|
|
450
450
|
* for the type of `checked`, not for the markup.
|
|
451
451
|
*/
|
|
452
|
-
|
|
452
|
+
component TableSelectAll(
|
|
453
453
|
checked: boolean | "mixed",
|
|
454
454
|
onCheckedChange: (checked: boolean) => void,
|
|
455
455
|
label?: string = "Select all rows",
|
|
@@ -482,7 +482,7 @@ export component TableSelectAll(
|
|
|
482
482
|
* Named props rather than `...rest: Rest`, for the reason `Table.SelectAll`
|
|
483
483
|
* gives above.
|
|
484
484
|
*/
|
|
485
|
-
|
|
485
|
+
component TableRowSelect(
|
|
486
486
|
label: string,
|
|
487
487
|
checked: boolean,
|
|
488
488
|
onCheckedChange: (checked: boolean) => void,
|
|
@@ -506,3 +506,25 @@ export component TableRowSelect(
|
|
|
506
506
|
function defaultAnnouncement(column: string, direction: "ascending" | "descending"): string {
|
|
507
507
|
return `Sorted by ${column}, ${direction}.`;
|
|
508
508
|
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* The parts, under the names the `Table` namespace gives them.
|
|
512
|
+
*
|
|
513
|
+
* `index.js` re-exports this module whole — `export * as Table from "./table.js"` —
|
|
514
|
+
* so a caller writes `<Table.Root>`, and the namespace is the prefix. Each
|
|
515
|
+
* part is still *declared* as `TableRoot`, so React DevTools, a component
|
|
516
|
+
* stack and an error name the part a reader can find rather than one of forty
|
|
517
|
+
* `Root`s.
|
|
518
|
+
*/
|
|
519
|
+
export {
|
|
520
|
+
TableRoot as Root,
|
|
521
|
+
TableCaption as Caption,
|
|
522
|
+
TableHeader as Header,
|
|
523
|
+
TableBody as Body,
|
|
524
|
+
TableRow as Row,
|
|
525
|
+
TableHead as Head,
|
|
526
|
+
TableRowHeader as RowHeader,
|
|
527
|
+
TableCell as Cell,
|
|
528
|
+
TableSelectAll as SelectAll,
|
|
529
|
+
TableRowSelect as RowSelect,
|
|
530
|
+
};
|
package/tabs.js
CHANGED
|
@@ -87,7 +87,7 @@ hook useTabs(part: string): TabsState {
|
|
|
87
87
|
* distinction every one of these components needs: a form library owns the
|
|
88
88
|
* value, and a page that just wants tabs does not.
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
component TabsRoot(
|
|
91
91
|
children: React.Node,
|
|
92
92
|
defaultValue: string,
|
|
93
93
|
value?: string,
|
|
@@ -145,7 +145,7 @@ export component TabsRoot(
|
|
|
145
145
|
* tabs push themselves into as they mount answers with mount order, which stops
|
|
146
146
|
* being document order the first time a tab is conditional.
|
|
147
147
|
*/
|
|
148
|
-
|
|
148
|
+
component TabsList(children: renders* TabsTab, render?: RenderProp, ...rest: Rest) {
|
|
149
149
|
const tabs = useTabs("Tabs.List");
|
|
150
150
|
const props = withProps(withoutComposed(rest, ["onKeyDown"]), {
|
|
151
151
|
// A screen reader announces the axis, and it is also what tells a reader
|
|
@@ -186,7 +186,7 @@ export component TabsList(children: renders* TabsTab, render?: RenderProp, ...re
|
|
|
186
186
|
* the section exists and is unavailable, where a native `disabled` would leave a
|
|
187
187
|
* gap they cannot ask about. The keyboard steps over it either way.
|
|
188
188
|
*/
|
|
189
|
-
|
|
189
|
+
component TabsTab(
|
|
190
190
|
value: string,
|
|
191
191
|
children: React.Node,
|
|
192
192
|
disabled?: boolean = false,
|
|
@@ -249,12 +249,7 @@ export component TabsTab(
|
|
|
249
249
|
* subscription rather than "the selected value equals mine", because a caller
|
|
250
250
|
* may render a subset of panels, or none at all until data arrives.
|
|
251
251
|
*/
|
|
252
|
-
|
|
253
|
-
value: string,
|
|
254
|
-
children: React.Node,
|
|
255
|
-
render?: RenderProp,
|
|
256
|
-
...rest: Rest
|
|
257
|
-
) {
|
|
252
|
+
component TabsPanel(value: string, children: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
258
253
|
const tabs = useTabs("Tabs.Panel");
|
|
259
254
|
const register = tabs.registerPanel;
|
|
260
255
|
const selected = tabs.selected === value;
|
|
@@ -287,3 +282,14 @@ export component TabsPanel(
|
|
|
287
282
|
}
|
|
288
283
|
return <div {...props} />;
|
|
289
284
|
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The parts, under the names the `Tabs` namespace gives them.
|
|
288
|
+
*
|
|
289
|
+
* `index.js` re-exports this module whole — `export * as Tabs from "./tabs.js"` —
|
|
290
|
+
* so a caller writes `<Tabs.Root>`, and the namespace is the prefix. Each
|
|
291
|
+
* part is still *declared* as `TabsRoot`, so React DevTools, a component
|
|
292
|
+
* stack and an error name the part a reader can find rather than one of forty
|
|
293
|
+
* `Root`s.
|
|
294
|
+
*/
|
|
295
|
+
export { TabsRoot as Root, TabsList as List, TabsTab as Tab, TabsPanel as Panel };
|
package/toast.js
CHANGED
|
@@ -349,7 +349,7 @@ const ToastPartsContext: React.Context<ToastParts | null> = createContext(null);
|
|
|
349
349
|
* so a `<div>` where a notification belongs is a type error rather than a
|
|
350
350
|
* stack of notifications a reader cannot dismiss.
|
|
351
351
|
*/
|
|
352
|
-
|
|
352
|
+
component ToastRegion(
|
|
353
353
|
children: (notification: Notification) => renders ToastRoot,
|
|
354
354
|
label?: string = "Notifications",
|
|
355
355
|
limit?: number = 3,
|
|
@@ -427,7 +427,7 @@ export component ToastRegion(
|
|
|
427
427
|
* an id that is not in the document makes a screen reader announce nothing at
|
|
428
428
|
* all.
|
|
429
429
|
*/
|
|
430
|
-
|
|
430
|
+
component ToastRoot(children: React.Node, ...rest: Rest) {
|
|
431
431
|
const notification = useNotification("Toast.Root");
|
|
432
432
|
const base = useId();
|
|
433
433
|
const elementRef = useElementRef<HTMLElement>();
|
|
@@ -499,7 +499,7 @@ export component ToastRoot(children: React.Node, ...rest: Rest) {
|
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
/** What the notification is about, and the name of its group. */
|
|
502
|
-
|
|
502
|
+
component ToastTitle(children: React.Node, ...rest: Rest) {
|
|
503
503
|
const parts = useToastParts("Toast.Title");
|
|
504
504
|
useRegistration(parts.registerTitle);
|
|
505
505
|
|
|
@@ -511,7 +511,7 @@ export component ToastTitle(children: React.Node, ...rest: Rest) {
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
/** The rest of it, and the group's description. */
|
|
514
|
-
|
|
514
|
+
component ToastDescription(children: React.Node, ...rest: Rest) {
|
|
515
515
|
const parts = useToastParts("Toast.Description");
|
|
516
516
|
useRegistration(parts.registerDescription);
|
|
517
517
|
|
|
@@ -532,7 +532,7 @@ export component ToastDescription(children: React.Node, ...rest: Rest) {
|
|
|
532
532
|
* countdown stopping while focus is inside is what makes the button reachable
|
|
533
533
|
* at all; it is not a promise that four seconds was enough time to decide.
|
|
534
534
|
*/
|
|
535
|
-
|
|
535
|
+
component ToastAction(children: React.Node, ...rest: Rest) {
|
|
536
536
|
const notification = useNotification("Toast.Action");
|
|
537
537
|
const passed = withoutComposed(rest, ["onClick"]);
|
|
538
538
|
|
|
@@ -561,7 +561,7 @@ export component ToastAction(children: React.Node, ...rest: Rest) {
|
|
|
561
561
|
* `aria-label` that says "Dismiss" over a button that says "Close" breaks the
|
|
562
562
|
* speech reader who says "click Close" out loud.
|
|
563
563
|
*/
|
|
564
|
-
|
|
564
|
+
component ToastClose(children?: React.Node, label?: string = "Dismiss", ...rest: Rest) {
|
|
565
565
|
const notification = useNotification("Toast.Close");
|
|
566
566
|
const passed = withoutComposed(rest, ["onClick"]);
|
|
567
567
|
|
|
@@ -592,3 +592,21 @@ hook useRegistration(register: (present: boolean) => void): void {
|
|
|
592
592
|
return () => register(false);
|
|
593
593
|
}, [register]);
|
|
594
594
|
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* The parts, under the names the `Toast` namespace gives them.
|
|
598
|
+
*
|
|
599
|
+
* `index.js` re-exports this module whole — `export * as Toast from "./toast.js"` —
|
|
600
|
+
* so a caller writes `<Toast.Region>`, and the namespace is the prefix. Each
|
|
601
|
+
* part is still *declared* as `ToastRegion`, so React DevTools, a component
|
|
602
|
+
* stack and an error name the part a reader can find rather than one of forty
|
|
603
|
+
* `Region`s.
|
|
604
|
+
*/
|
|
605
|
+
export {
|
|
606
|
+
ToastRegion as Region,
|
|
607
|
+
ToastRoot as Root,
|
|
608
|
+
ToastTitle as Title,
|
|
609
|
+
ToastDescription as Description,
|
|
610
|
+
ToastAction as Action,
|
|
611
|
+
ToastClose as Close,
|
|
612
|
+
};
|
package/toggle-group.js
CHANGED
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
} from "./internal/merge-props.js";
|
|
71
71
|
import { moveOnKey, useFirstItem } from "./internal/roving-focus.js";
|
|
72
72
|
import type { Orientation, RovingSet } from "./internal/roving-focus.js";
|
|
73
|
-
import { RadioGroupItem, RadioGroupRoot } from "./radio-group.js";
|
|
73
|
+
import { Item as RadioGroupItem, Root as RadioGroupRoot } from "./radio-group.js";
|
|
74
74
|
import { useControlled } from "./internal/controlled-state.js";
|
|
75
75
|
|
|
76
76
|
/** Whether the set holds one answer or any number of them. */
|
|
@@ -128,7 +128,7 @@ hook useToggleGroup(part: string): ToggleGroupState {
|
|
|
128
128
|
* Uncontrolled by default and controlled the moment `value` is passed, like
|
|
129
129
|
* everything else here.
|
|
130
130
|
*/
|
|
131
|
-
|
|
131
|
+
component ToggleGroupRoot(
|
|
132
132
|
children: renders* ToggleGroupItem,
|
|
133
133
|
type?: ToggleGroupType = "multiple",
|
|
134
134
|
defaultValue?: $ReadOnlyArray<string> = NOTHING,
|
|
@@ -224,7 +224,7 @@ export component ToggleGroupRoot(
|
|
|
224
224
|
* a reader is told the set has two members when it has three and cannot ask
|
|
225
225
|
* where the third went. The arrow keys step over it either way.
|
|
226
226
|
*/
|
|
227
|
-
|
|
227
|
+
component ToggleGroupItem(
|
|
228
228
|
value: string,
|
|
229
229
|
children?: React.Node,
|
|
230
230
|
disabled?: boolean = false,
|
|
@@ -282,3 +282,14 @@ export component ToggleGroupItem(
|
|
|
282
282
|
|
|
283
283
|
return <button {...itemProps} type="button" />;
|
|
284
284
|
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The parts, under the names the `ToggleGroup` namespace gives them.
|
|
288
|
+
*
|
|
289
|
+
* `index.js` re-exports this module whole — `export * as ToggleGroup from "./toggle-group.js"` —
|
|
290
|
+
* so a caller writes `<ToggleGroup.Root>`, and the namespace is the prefix. Each
|
|
291
|
+
* part is still *declared* as `ToggleGroupRoot`, so React DevTools, a component
|
|
292
|
+
* stack and an error name the part a reader can find rather than one of forty
|
|
293
|
+
* `Root`s.
|
|
294
|
+
*/
|
|
295
|
+
export { ToggleGroupRoot as Root, ToggleGroupItem as Item };
|
package/tooltip.js
CHANGED
|
@@ -150,7 +150,7 @@ hook useTooltip(part: string): TooltipState {
|
|
|
150
150
|
* Renders no element: it is a context and a clock, and a `<div>` around a
|
|
151
151
|
* toolbar is the caller's business.
|
|
152
152
|
*/
|
|
153
|
-
|
|
153
|
+
component TooltipProvider(
|
|
154
154
|
children: React.Node,
|
|
155
155
|
delayDuration?: number = DEFAULT_OPEN_DELAY,
|
|
156
156
|
skipDelayDuration?: number = DEFAULT_SKIP_DELAY,
|
|
@@ -168,7 +168,7 @@ export component TooltipProvider(
|
|
|
168
168
|
* `delayDuration`, and to 700ms when there is no provider — a tooltip on its
|
|
169
169
|
* own is a complete tooltip and needs nothing around it.
|
|
170
170
|
*/
|
|
171
|
-
|
|
171
|
+
component TooltipRoot(
|
|
172
172
|
children: React.Node,
|
|
173
173
|
closeDelay?: number = DEFAULT_CLOSE_DELAY,
|
|
174
174
|
defaultOpen?: boolean = false,
|
|
@@ -243,7 +243,7 @@ export component TooltipRoot(
|
|
|
243
243
|
* `render` function that forgets to spread something still gets a working
|
|
244
244
|
* tooltip; see the module header.
|
|
245
245
|
*/
|
|
246
|
-
|
|
246
|
+
component TooltipTrigger(children?: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
247
247
|
const tooltip = useTooltip("Tooltip.Trigger");
|
|
248
248
|
const { closeDelay, dismissedRef, intent, openDelay, setOpen, triggerRef } = tooltip;
|
|
249
249
|
useFocusableTrigger(triggerRef, "Tooltip.Trigger");
|
|
@@ -320,7 +320,7 @@ export component TooltipTrigger(children?: React.Node, render?: RenderProp, ...r
|
|
|
320
320
|
* takes focus, holds no tab stop, and answers `Escape` from wherever focus
|
|
321
321
|
* happens to be.
|
|
322
322
|
*/
|
|
323
|
-
|
|
323
|
+
component TooltipBody(
|
|
324
324
|
children: React.Node,
|
|
325
325
|
align?: Align = "center",
|
|
326
326
|
alignOffset?: number = 0,
|
|
@@ -389,7 +389,7 @@ export component TooltipBody(
|
|
|
389
389
|
id: `${tooltip.base}-body`,
|
|
390
390
|
// React calls callback refs during commit; placement effects read it later.
|
|
391
391
|
// uf-lint-disable-next-line react-compiler/refs
|
|
392
|
-
ref: composeRefs(rest.ref, (element) => {
|
|
392
|
+
ref: composeRefs(rest.ref, (element: HTMLElement | null) => {
|
|
393
393
|
bodyRef.current = element;
|
|
394
394
|
}),
|
|
395
395
|
role: "tooltip",
|
|
@@ -402,3 +402,19 @@ export component TooltipBody(
|
|
|
402
402
|
}
|
|
403
403
|
return <div {...props} />;
|
|
404
404
|
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The parts, under the names the `Tooltip` namespace gives them.
|
|
408
|
+
*
|
|
409
|
+
* `index.js` re-exports this module whole — `export * as Tooltip from "./tooltip.js"` —
|
|
410
|
+
* so a caller writes `<Tooltip.Provider>`, and the namespace is the prefix. Each
|
|
411
|
+
* part is still *declared* as `TooltipProvider`, so React DevTools, a component
|
|
412
|
+
* stack and an error name the part a reader can find rather than one of forty
|
|
413
|
+
* `Provider`s.
|
|
414
|
+
*/
|
|
415
|
+
export {
|
|
416
|
+
TooltipProvider as Provider,
|
|
417
|
+
TooltipRoot as Root,
|
|
418
|
+
TooltipTrigger as Trigger,
|
|
419
|
+
TooltipBody as Body,
|
|
420
|
+
};
|