@uniflowed/ui 0.0.0-alpha.18 → 0.0.0-alpha.37
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 +61 -54
- package/alert-dialog.js +43 -17
- package/alert.js +142 -0
- package/avatar.js +276 -0
- package/breadcrumb.js +138 -0
- package/checkbox.js +45 -39
- package/collapsible.js +41 -36
- package/context-menu.js +32 -24
- package/dialog.js +143 -119
- package/drawer.js +121 -89
- package/field.js +71 -37
- package/hover-card.js +23 -27
- package/index.js +567 -31
- package/input-otp.js +8 -8
- package/interactions.js +2163 -0
- package/internal/merge-props.js +85 -1
- package/menu.js +236 -213
- package/menubar.js +91 -89
- package/package.json +8 -40
- package/pagination.js +29 -17
- package/popover.js +59 -55
- package/progress.js +21 -16
- package/radio-group.js +79 -75
- package/separator.js +97 -0
- package/sheet.js +41 -17
- package/sidebar.js +10 -10
- package/skeleton.js +159 -0
- package/slider.js +89 -89
- package/switch.js +37 -31
- package/table.js +90 -67
- package/tabs.js +100 -91
- package/toast.js +23 -55
- package/toggle-group.js +52 -49
- package/toggle.js +38 -25
- package/tooltip.js +26 -37
package/tooltip.js
CHANGED
|
@@ -75,7 +75,7 @@ import { useStableCallback } from "@uniflowed/hooks/lifecycle";
|
|
|
75
75
|
|
|
76
76
|
import type { Align, LogicalSide } from "./internal/anchor.js";
|
|
77
77
|
import type { DelayGroup, HoverIntent } from "./internal/hover-intent.js";
|
|
78
|
-
import type { Rest } from "./internal/merge-props.js";
|
|
78
|
+
import type { RenderProp, Rest } from "./internal/merge-props.js";
|
|
79
79
|
import { composeRefs, withProps, withoutComposed } from "./internal/merge-props.js";
|
|
80
80
|
import {
|
|
81
81
|
DEFAULT_CLOSE_DELAY,
|
|
@@ -243,11 +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
|
-
export component TooltipTrigger(
|
|
247
|
-
children?: React.Node,
|
|
248
|
-
render?: (props: Rest) => React.Node,
|
|
249
|
-
...rest: Rest
|
|
250
|
-
) {
|
|
246
|
+
export component TooltipTrigger(children?: React.Node, render?: RenderProp, ...rest: Rest) {
|
|
251
247
|
const tooltip = useTooltip("Tooltip.Trigger");
|
|
252
248
|
const { closeDelay, dismissed, intent, openDelay, setOpen, triggerRef } = tooltip;
|
|
253
249
|
useFocusableTrigger(triggerRef, "Tooltip.Trigger");
|
|
@@ -301,25 +297,16 @@ export component TooltipTrigger(
|
|
|
301
297
|
});
|
|
302
298
|
// Only while it is there. `aria-describedby` pointing at an element that has
|
|
303
299
|
// been removed is the dangling reference this package keeps coming back to.
|
|
304
|
-
const
|
|
300
|
+
const props = withProps(withoutComposed(rest, ["ref"]), {
|
|
305
301
|
"aria-describedby": tooltip.open ? `${tooltip.base}-body` : undefined,
|
|
302
|
+
children,
|
|
306
303
|
ref: attach,
|
|
307
|
-
};
|
|
304
|
+
});
|
|
308
305
|
|
|
309
306
|
if (render != null) {
|
|
310
|
-
return render(
|
|
307
|
+
return render(props);
|
|
311
308
|
}
|
|
312
|
-
|
|
313
|
-
return (
|
|
314
|
-
<button
|
|
315
|
-
{...withoutComposed(rest, ["ref"])}
|
|
316
|
-
aria-describedby={ours["aria-describedby"]}
|
|
317
|
-
ref={attach}
|
|
318
|
-
type="button"
|
|
319
|
-
>
|
|
320
|
-
{children}
|
|
321
|
-
</button>
|
|
322
|
-
);
|
|
309
|
+
return <button {...props} type="button" />;
|
|
323
310
|
}
|
|
324
311
|
|
|
325
312
|
/**
|
|
@@ -337,6 +324,7 @@ export component TooltipBody(
|
|
|
337
324
|
alignOffset?: number = 0,
|
|
338
325
|
avoidCollisions?: boolean = true,
|
|
339
326
|
collisionPadding?: number = 0,
|
|
327
|
+
render?: RenderProp,
|
|
340
328
|
side?: LogicalSide = "top",
|
|
341
329
|
sideOffset?: number = 0,
|
|
342
330
|
...rest: Rest
|
|
@@ -391,21 +379,22 @@ export component TooltipBody(
|
|
|
391
379
|
return null;
|
|
392
380
|
}
|
|
393
381
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
382
|
+
const props = withProps(withoutComposed(rest, ["ref"]), {
|
|
383
|
+
children,
|
|
384
|
+
"data-align": anchored.align,
|
|
385
|
+
"data-side": anchored.side,
|
|
386
|
+
"data-state": "open",
|
|
387
|
+
id: `${tooltip.base}-body`,
|
|
388
|
+
ref: composeRefs(rest.ref, (element) => {
|
|
389
|
+
bodyRef.current = element;
|
|
390
|
+
}),
|
|
391
|
+
role: "tooltip",
|
|
392
|
+
// No `tabIndex`. A tooltip the keyboard can land in is a stop the reader
|
|
393
|
+
// did not ask for and cannot leave the way they expect.
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
if (render != null) {
|
|
397
|
+
return render(props);
|
|
398
|
+
}
|
|
399
|
+
return <div {...props} />;
|
|
411
400
|
}
|