@justanarthur/modo-ui 2.0.0 → 2.2.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/blocks/desktop-shell/index.tsx +2 -1
- package/components/data-display/sparkline/examples.mdx +79 -0
- package/components/data-display/sparkline/index.tsx +158 -0
- package/components/data-display/sparkline/live-demo.tsx +36 -0
- package/components/feedback/meter/examples.mdx +25 -0
- package/components/feedback/meter/index.tsx +23 -7
- package/components/feedback/meter/timer-demo.tsx +37 -0
- package/components/inputs/checkbox/index.tsx +5 -0
- package/components/inputs/combobox/index.tsx +9 -4
- package/components/inputs/radio/index.tsx +5 -0
- package/components/inputs/select/index.tsx +23 -3
- package/components/inputs/slider/comfortable.tsx +10 -4
- package/components/inputs/slider/compact.tsx +153 -71
- package/components/inputs/slider/examples.mdx +24 -0
- package/components/inputs/slider/geometry.ts +18 -6
- package/components/inputs/slider/index.tsx +30 -8
- package/components/inputs/slider/value-display.tsx +16 -9
- package/components/inputs/switch/index.tsx +7 -2
- package/components/inputs/textarea/examples.mdx +19 -0
- package/components/inputs/textarea/index.tsx +42 -5
- package/components/navigation/sidebar/sidebar-group.tsx +2 -1
- package/components/navigation/sidebar/sidebar-menu-sub.tsx +2 -1
- package/components/navigation/sidebar/sidebar-shell.tsx +2 -1
- package/components/navigation/tree/index.tsx +2 -1
- package/components/overlays/dropdown/index.tsx +50 -8
- package/components/overlays/dropdown/submenu.tsx +41 -10
- package/components/overlays/tooltip/examples.mdx +13 -0
- package/components/overlays/tooltip/index.tsx +58 -16
- package/dist/base.css +4 -0
- package/dist/blocks/desktop-shell/index.js +28 -27
- package/dist/blocks/sidebar-app/index.js +38 -37
- package/dist/components/actions/button/index.js +4 -4
- package/dist/components/actions/copy/index.js +12 -12
- package/dist/components/containers/accordion/index.d.ts +1 -1
- package/dist/components/containers/accordion/index.js +16 -16
- package/dist/components/containers/card/index.js +14 -14
- package/dist/components/data-display/avatar/index.js +3 -3
- package/dist/components/data-display/badge/index.js +2 -2
- package/dist/components/data-display/diff/index.js +4 -4
- package/dist/components/data-display/list/index.js +3 -3
- package/dist/components/data-display/log-view/index.js +8 -8
- package/dist/components/data-display/markdown/index.js +15 -15
- package/dist/components/data-display/sparkline/index.d.ts +44 -0
- package/dist/components/data-display/sparkline/index.js +11 -0
- package/dist/components/data-display/table/index.js +9 -9
- package/dist/components/feedback/empty-state/index.js +3 -3
- package/dist/components/feedback/meter/index.d.ts +9 -1
- package/dist/components/feedback/meter/index.js +2 -2
- package/dist/components/feedback/progress/index.js +2 -2
- package/dist/components/inputs/checkbox/index.d.ts +2 -0
- package/dist/components/inputs/checkbox/index.js +13 -13
- package/dist/components/inputs/choice-list/index.js +10 -10
- package/dist/components/inputs/color-picker/index.js +22 -22
- package/dist/components/inputs/combobox/index.d.ts +1 -1
- package/dist/components/inputs/combobox/index.js +21 -21
- package/dist/components/inputs/date-time/calendar/index.js +9 -9
- package/dist/components/inputs/date-time/date-picker/index.js +28 -28
- package/dist/components/inputs/date-time/date-range-picker/index.js +28 -28
- package/dist/components/inputs/date-time/duration-picker/index.js +27 -27
- package/dist/components/inputs/date-time/month-picker/index.js +26 -26
- package/dist/components/inputs/date-time/time-picker/index.js +27 -27
- package/dist/components/inputs/editable-text/index.js +2 -2
- package/dist/components/inputs/field/index.js +5 -5
- package/dist/components/inputs/file-dropzone/index.js +8 -8
- package/dist/components/inputs/input/index.js +6 -6
- package/dist/components/inputs/key-value/index.js +12 -12
- package/dist/components/inputs/number-input/index.js +7 -7
- package/dist/components/inputs/radio/index.d.ts +2 -0
- package/dist/components/inputs/radio/index.js +12 -12
- package/dist/components/inputs/search/index.js +23 -23
- package/dist/components/inputs/select/index.d.ts +22 -4
- package/dist/components/inputs/select/index.js +22 -22
- package/dist/components/inputs/slider/index.d.ts +12 -3
- package/dist/components/inputs/slider/index.js +4 -4
- package/dist/components/inputs/switch/index.d.ts +2 -0
- package/dist/components/inputs/switch/index.js +9 -9
- package/dist/components/inputs/textarea/index.d.ts +8 -1
- package/dist/components/inputs/textarea/index.js +4 -4
- package/dist/components/navigation/breadcrumb/index.js +25 -25
- package/dist/components/navigation/navigation-menu/index.js +17 -17
- package/dist/components/navigation/pagination/index.js +16 -16
- package/dist/components/navigation/sidebar/index.js +26 -25
- package/dist/components/navigation/tabs/index.js +13 -13
- package/dist/components/navigation/tree/index.js +10 -9
- package/dist/components/overlays/alert-dialog/index.d.ts +3 -3
- package/dist/components/overlays/alert-dialog/index.js +15 -15
- package/dist/components/overlays/command/index.d.ts +1 -1
- package/dist/components/overlays/command/index.js +21 -21
- package/dist/components/overlays/context-menu/index.d.ts +20 -1
- package/dist/components/overlays/context-menu/index.js +25 -25
- package/dist/components/overlays/dialog/index.d.ts +3 -3
- package/dist/components/overlays/dialog/index.js +14 -14
- package/dist/components/overlays/dropdown/index.d.ts +30 -8
- package/dist/components/overlays/dropdown/index.js +24 -24
- package/dist/components/overlays/lightbox/index.js +12 -12
- package/dist/components/overlays/popover/index.d.ts +6 -6
- package/dist/components/overlays/popover/index.js +11 -11
- package/dist/components/overlays/preview-card/index.js +10 -10
- package/dist/components/overlays/sheet/index.d.ts +3 -3
- package/dist/components/overlays/sheet/index.js +15 -15
- package/dist/components/overlays/toast/index.d.ts +1 -1
- package/dist/components/overlays/toast/index.js +11 -11
- package/dist/components/overlays/tooltip/index.d.ts +35 -10
- package/dist/components/overlays/tooltip/index.js +8 -8
- package/dist/docs/index.js +18 -17
- package/dist/index.d.ts +330 -228
- package/dist/index.js +82 -77
- package/dist/lib/fluid-hover-highlight.js +4 -4
- package/dist/lib/focus-ring.js +2 -2
- package/dist/lib/goo-indicator.js +3 -3
- package/dist/lib/inert.d.ts +7 -0
- package/dist/lib/inert.js +6 -0
- package/dist/lib/morph-layers.js +4 -4
- package/dist/lib/morph-part.js +2 -2
- package/dist/lib/overlay.d.ts +20 -13
- package/dist/lib/overlay.js +5 -4
- package/dist/lib/popup-rows.js +2 -2
- package/dist/lib/popup-surface.js +7 -7
- package/dist/lib/scroll-column.js +6 -6
- package/dist/lib/slot.d.ts +5 -2
- package/dist/lib/slot.js +1 -1
- package/dist/lib/use-merge-split.js +4 -4
- package/dist/lib/use-morph.js +2 -2
- package/dist/preset.d.ts +1 -0
- package/dist/preset.js +1 -0
- package/dist/primitives/content/code/index.js +3 -3
- package/dist/primitives/layout/resizable/index.js +2 -2
- package/dist/primitives/layout/sortable/index.js +5 -5
- package/dist/primitives/systems/craft/index.js +3 -3
- package/dist/primitives/systems/fluid-hover/index.js +6 -6
- package/dist/primitives/systems/morph/index.js +14 -14
- package/dist/primitives/systems/motion/index.js +7 -7
- package/dist/primitives/systems/sizes/index.js +2 -2
- package/dist/shared/{components-280grw6q.js → components-09n5hgmx.js} +2 -2
- package/dist/shared/{components-1f3a7gmg.js → components-151vndgm.js} +3 -3
- package/dist/shared/{components-14wzcym0.js → components-16wx5av1.js} +6 -6
- package/dist/shared/{components-yf2gtq68.js → components-19e2wpxc.js} +9 -6
- package/dist/shared/{components-rzy6h7s4.js → components-1nqp7wqr.js} +1 -1
- package/dist/shared/components-2myjk2zf.js +8 -0
- package/dist/shared/{components-9rebr89j.js → components-2q0m4mxf.js} +2 -2
- package/dist/shared/{components-1asw2ph0.js → components-2zr49v82.js} +3 -3
- package/dist/shared/{components-wq9hrera.js → components-313rmbxy.js} +2 -2
- package/dist/shared/{components-0h2mng6m.js → components-31pkxwfz.js} +1 -1
- package/dist/shared/{components-w2at9ntm.js → components-3cvwrzc1.js} +3 -3
- package/dist/shared/{components-n0gbyp5a.js → components-4xd21p2p.js} +6 -6
- package/dist/shared/{components-t0c1rw40.js → components-7v6869ga.js} +1 -1
- package/dist/shared/{components-kwxye0an.js → components-7wjkag2j.js} +4 -2
- package/dist/shared/{components-fqsgd07c.js → components-85dz3xx3.js} +4 -4
- package/dist/shared/{components-3rvrdsa9.js → components-8qkd3659.js} +1 -1
- package/dist/shared/{components-me742146.js → components-8qwbwtv9.js} +5 -5
- package/dist/shared/{components-nxqrw789.js → components-90sfqz5t.js} +1 -1
- package/dist/shared/{components-b9bj65j3.js → components-90y8qwxv.js} +9 -9
- package/dist/shared/{components-g35n8tzm.js → components-95kp19zn.js} +1 -1
- package/dist/shared/{components-nhmgr5xc.js → components-9e5fpy3v.js} +14 -11
- package/dist/shared/{components-a1ms36qq.js → components-9hysh6d3.js} +1 -1
- package/dist/shared/{components-hcftn5r8.js → components-9s9vb2w0.js} +7 -4
- package/dist/shared/{components-vfreweq3.js → components-a3edrqpb.js} +3 -3
- package/dist/shared/{components-ee09xmkh.js → components-afj2ajea.js} +8 -5
- package/dist/shared/{components-ev0ytbqb.js → components-ajgwbabq.js} +4 -4
- package/dist/shared/{components-62510420.js → components-dr5c27yd.js} +6 -6
- package/dist/shared/{components-s90v3jpr.js → components-fqdh9ysk.js} +68 -19
- package/dist/shared/{components-2m2hg11x.js → components-gfw4zk8b.js} +8 -8
- package/dist/shared/{components-z0kz9rxj.js → components-gvwxswpr.js} +1 -1
- package/dist/shared/{components-p32aqk3q.js → components-h9se5cz5.js} +110 -73
- package/dist/shared/{components-464zs8v6.js → components-hbqyf35a.js} +41 -34
- package/dist/shared/{components-77gxngmc.js → components-jd21f3mb.js} +8 -8
- package/dist/shared/{components-xnkc892z.js → components-mamtvenk.js} +2 -2
- package/dist/shared/{components-1hga6pkn.js → components-mcnyaaep.js} +3 -3
- package/dist/shared/{components-h0x2pj2y.js → components-mpx3yq5c.js} +24 -10
- package/dist/shared/{components-j79a6jqa.js → components-nc8wggew.js} +3 -3
- package/dist/shared/{components-r5q9gdh4.js → components-nd3f803g.js} +7 -7
- package/dist/shared/{components-9ca0c92a.js → components-nehs80xd.js} +1 -1
- package/dist/shared/components-nw2k1pg9.js +98 -0
- package/dist/shared/{components-4t2cjav8.js → components-pgs3p035.js} +1 -1
- package/dist/shared/{components-91mmbrw3.js → components-ppc2dmxs.js} +2 -2
- package/dist/shared/{components-b2kjsn1s.js → components-qc1fae2s.js} +6 -6
- package/dist/shared/{components-fmyvz4r2.js → components-qd27dvgj.js} +6 -6
- package/dist/shared/{components-9z7bq8gn.js → components-qe8yp3vf.js} +3 -3
- package/dist/shared/{components-wx1dcp2n.js → components-qhk2m7fj.js} +2 -2
- package/dist/shared/{components-a1mwqxsv.js → components-qkt4h7x4.js} +8 -8
- package/dist/shared/{components-6rtawx8y.js → components-qs0cwe8p.js} +10 -10
- package/dist/shared/{components-y8m64zdw.js → components-r6ejdtpr.js} +3 -3
- package/dist/shared/{components-1bnf96sr.js → components-rj4nnqkz.js} +39 -11
- package/dist/shared/{components-gd8gmr6w.js → components-rmhdr4g1.js} +1 -1
- package/dist/shared/{components-e7zxwja1.js → components-rts2mggt.js} +1 -1
- package/dist/shared/{components-ta4e10mx.js → components-s25rehbv.js} +1 -1
- package/dist/shared/{components-chda6b23.js → components-sxstx1x7.js} +33 -4
- package/dist/shared/{components-b7p1pjcm.js → components-t4eb37vd.js} +2 -2
- package/dist/shared/{components-7xc2dne4.js → components-v3c3madd.js} +2 -2
- package/dist/shared/{components-22h8dvt1.js → components-v81eejq6.js} +3 -3
- package/dist/shared/{components-w1ysefg1.js → components-veaxns17.js} +2 -2
- package/dist/shared/{components-czvraaw9.js → components-vkrp4nb9.js} +4 -4
- package/dist/shared/{components-gsstwhtv.js → components-vv420geb.js} +6 -3
- package/dist/shared/{components-5xs8pkkj.js → components-w5p7mfb4.js} +1 -1
- package/dist/shared/{components-rgng034x.js → components-xvf8jcza.js} +25 -4
- package/dist/shared/{components-q7zk70tx.js → components-y07de1qv.js} +1 -1
- package/dist/shared/{components-0cpte6s1.js → components-yn8bw8tv.js} +11 -10
- package/dist/shared/{components-xa9fvd5b.js → components-z9gc2weg.js} +3 -3
- package/dist/shared/{components-twyj2y8c.js → components-zk1tj5za.js} +3 -3
- package/dist/shared/{components-hz6armxa.js → components-zktkxnzq.js} +7 -4
- package/dist/styles.css +10 -1
- package/dist/tailwind.css +1 -0
- package/dist/tokens.css +4 -0
- package/index.ts +1 -0
- package/lib/inert.ts +15 -0
- package/lib/overlay.tsx +49 -5
- package/lib/slot.tsx +9 -3
- package/package.json +7 -2
- package/tokens/colors.css +4 -0
- /package/dist/shared/{components-jw45ck66.js → components-02683eqd.js} +0 -0
- /package/dist/shared/{components-q0hs5rqn.js → components-6c52v58g.js} +0 -0
- /package/dist/shared/{components-y4gsk1jt.js → components-fa61vwag.js} +0 -0
- /package/dist/shared/{components-nz14rwtd.js → components-ffng9rpa.js} +0 -0
- /package/dist/shared/{components-7mj5wsv3.js → components-k9qbcmaa.js} +0 -0
- /package/dist/shared/{components-8pnvkrbw.js → components-mp7en54n.js} +0 -0
- /package/dist/shared/{components-h8v9nh5r.js → components-pbx77hzb.js} +0 -0
- /package/dist/shared/{components-c515d6xr.js → components-v1m0xjbw.js} +0 -0
- /package/dist/shared/{components-pa43g2r2.js → components-wddr0r6a.js} +0 -0
- /package/dist/shared/{components-ymq8tbq9.js → components-wqac4434.js} +0 -0
- /package/dist/shared/{components-m3vxpz2z.js → components-yy0a9b02.js} +0 -0
- /package/dist/shared/{components-92mvpt9h.js → components-zwgxvktt.js} +0 -0
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
|
|
20
20
|
// components/inputs/textarea/index.tsx
|
|
21
21
|
import { Field } from "@base-ui/react/field";
|
|
22
|
-
import { forwardRef, useRef } from "react";
|
|
22
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
23
23
|
import { jsx } from "react/jsx-runtime";
|
|
24
24
|
var PADDING_Y = {
|
|
25
25
|
default: "py-2",
|
|
@@ -41,9 +41,39 @@ var Textarea2 = forwardRef(({
|
|
|
41
41
|
...props
|
|
42
42
|
}, ref) => {
|
|
43
43
|
const [value, setValue] = useControllableState2(valueProp, defaultValue, onValueChange);
|
|
44
|
+
const domHeld = valueProp === undefined && onValueChange === undefined;
|
|
44
45
|
const textareaRef = useRef(null);
|
|
45
46
|
const box = useFieldBox2({ variant, invalid, disabled, readOnly, required, size });
|
|
46
|
-
useAutosizeTextarea2(textareaRef, { minRows, maxRows }, [value, box.size.variant]);
|
|
47
|
+
const resize = useAutosizeTextarea2(textareaRef, { minRows, maxRows }, [value, box.size.variant]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const el = textareaRef.current;
|
|
50
|
+
if (!domHeld || !el)
|
|
51
|
+
return;
|
|
52
|
+
const own = Object.getOwnPropertyDescriptor(el, "value");
|
|
53
|
+
const base = own ?? Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value");
|
|
54
|
+
const set = base?.set;
|
|
55
|
+
if (set) {
|
|
56
|
+
Object.defineProperty(el, "value", {
|
|
57
|
+
configurable: true,
|
|
58
|
+
enumerable: base.enumerable,
|
|
59
|
+
get: base.get,
|
|
60
|
+
set(next) {
|
|
61
|
+
set.call(this, next);
|
|
62
|
+
resize();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const form = el.form;
|
|
67
|
+
const onReset = () => setTimeout(resize);
|
|
68
|
+
form?.addEventListener("reset", onReset);
|
|
69
|
+
return () => {
|
|
70
|
+
form?.removeEventListener("reset", onReset);
|
|
71
|
+
if (own)
|
|
72
|
+
Object.defineProperty(el, "value", own);
|
|
73
|
+
else if (set)
|
|
74
|
+
Reflect.deleteProperty(el, "value");
|
|
75
|
+
};
|
|
76
|
+
}, [domHeld, resize]);
|
|
47
77
|
return /* @__PURE__ */ jsx("div", {
|
|
48
78
|
onMouseDown: focusControlOnPress2(textareaRef),
|
|
49
79
|
...box.props,
|
|
@@ -54,8 +84,7 @@ var Textarea2 = forwardRef(({
|
|
|
54
84
|
rows: minRows,
|
|
55
85
|
...props
|
|
56
86
|
}),
|
|
57
|
-
value,
|
|
58
|
-
onChange: (e) => setValue(e.target.value),
|
|
87
|
+
...domHeld ? { defaultValue, onChange: resize } : { value, onChange: (e) => setValue(e.target.value) },
|
|
59
88
|
disabled: box.disabled,
|
|
60
89
|
readOnly: box.readOnly,
|
|
61
90
|
required: box.required,
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
dividedColumns2,
|
|
19
19
|
ScrollColumn2
|
|
20
|
-
} from "./components-
|
|
20
|
+
} from "./components-s25rehbv.js";
|
|
21
21
|
import {
|
|
22
22
|
SizeScope2
|
|
23
|
-
} from "./components-
|
|
23
|
+
} from "./components-ffng9rpa.js";
|
|
24
24
|
|
|
25
25
|
// components/inputs/date-time/calendar/index.tsx
|
|
26
26
|
import { addDays, format as format2, isSameYear, startOfWeek } from "date-fns";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./components-xnp09586.js";
|
|
12
12
|
import {
|
|
13
13
|
FluidHoverHighlight2
|
|
14
|
-
} from "./components-
|
|
14
|
+
} from "./components-95kp19zn.js";
|
|
15
15
|
import {
|
|
16
16
|
RowOrderContext2,
|
|
17
17
|
useRowOrder2,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
} from "./components-7c4a0egq.js";
|
|
30
30
|
import {
|
|
31
31
|
SizeScope2
|
|
32
|
-
} from "./components-
|
|
32
|
+
} from "./components-ffng9rpa.js";
|
|
33
33
|
import {
|
|
34
34
|
useIcon2
|
|
35
35
|
} from "./components-jnhpgpfk.js";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
slotRender2
|
|
5
|
-
} from "./components-
|
|
5
|
+
} from "./components-7wjkag2j.js";
|
|
6
6
|
import {
|
|
7
7
|
button_default
|
|
8
|
-
} from "./components-
|
|
8
|
+
} from "./components-31pkxwfz.js";
|
|
9
9
|
import {
|
|
10
10
|
DialogTrigger2,
|
|
11
11
|
DialogClose2,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
DialogTitle2,
|
|
16
16
|
DialogDescription2,
|
|
17
17
|
DialogState2
|
|
18
|
-
} from "./components-
|
|
18
|
+
} from "./components-90y8qwxv.js";
|
|
19
19
|
|
|
20
20
|
// components/overlays/alert-dialog/index.tsx
|
|
21
21
|
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
} from "./components-45r18egt.js";
|
|
9
9
|
import {
|
|
10
10
|
GOO_BLUR_RATIO2
|
|
11
|
-
} from "./components-
|
|
11
|
+
} from "./components-mp7en54n.js";
|
|
12
12
|
import {
|
|
13
13
|
union2,
|
|
14
14
|
GooLayer2
|
|
15
|
-
} from "./components-
|
|
15
|
+
} from "./components-gvwxswpr.js";
|
|
16
16
|
|
|
17
17
|
// lib/use-merge-split.tsx
|
|
18
18
|
import { AnimatePresence, motion } from "motion/react";
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
} from "./components-xnp09586.js";
|
|
6
6
|
import {
|
|
7
7
|
GooIndicator2
|
|
8
|
-
} from "./components-
|
|
8
|
+
} from "./components-gvwxswpr.js";
|
|
9
9
|
import {
|
|
10
10
|
FluidHoverHighlight2
|
|
11
|
-
} from "./components-
|
|
11
|
+
} from "./components-95kp19zn.js";
|
|
12
12
|
import {
|
|
13
13
|
useShape2
|
|
14
14
|
} from "./components-kxpcj2ry.js";
|
|
15
15
|
import {
|
|
16
16
|
FocusRing2
|
|
17
|
-
} from "./components-
|
|
17
|
+
} from "./components-v1m0xjbw.js";
|
|
18
18
|
import {
|
|
19
19
|
mergeRefs2
|
|
20
20
|
} from "./components-bkwjvvkh.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "./components-7c4a0egq.js";
|
|
35
35
|
import {
|
|
36
36
|
SizeScope2
|
|
37
|
-
} from "./components-
|
|
37
|
+
} from "./components-ffng9rpa.js";
|
|
38
38
|
|
|
39
39
|
// components/inputs/choice-list/index.tsx
|
|
40
40
|
import { forwardRef, useRef } from "react";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
} from "./components-xnp09586.js";
|
|
9
9
|
import {
|
|
10
10
|
GooIndicator2
|
|
11
|
-
} from "./components-
|
|
11
|
+
} from "./components-gvwxswpr.js";
|
|
12
12
|
import {
|
|
13
13
|
FluidHoverHighlight2
|
|
14
|
-
} from "./components-
|
|
14
|
+
} from "./components-95kp19zn.js";
|
|
15
15
|
import {
|
|
16
16
|
mergeRefs2
|
|
17
17
|
} from "./components-bkwjvvkh.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "./components-7c4a0egq.js";
|
|
35
35
|
import {
|
|
36
36
|
SizeScope2
|
|
37
|
-
} from "./components-
|
|
37
|
+
} from "./components-ffng9rpa.js";
|
|
38
38
|
|
|
39
39
|
// components/inputs/switch/index.tsx
|
|
40
40
|
import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
|
|
@@ -87,6 +87,7 @@ var Switch2 = forwardRef(({
|
|
|
87
87
|
onCheckedChange,
|
|
88
88
|
disabled = false,
|
|
89
89
|
name,
|
|
90
|
+
required,
|
|
90
91
|
value,
|
|
91
92
|
thumbTransition,
|
|
92
93
|
size,
|
|
@@ -208,6 +209,7 @@ var Switch2 = forwardRef(({
|
|
|
208
209
|
toggle();
|
|
209
210
|
},
|
|
210
211
|
name,
|
|
212
|
+
required,
|
|
211
213
|
value,
|
|
212
214
|
disabled,
|
|
213
215
|
onPointerEnter: (e) => {
|
|
@@ -247,6 +249,7 @@ var Switch2 = forwardRef(({
|
|
|
247
249
|
/* @__PURE__ */ jsx(SwitchPrimitive.Root, {
|
|
248
250
|
checked: isChecked,
|
|
249
251
|
name,
|
|
252
|
+
required,
|
|
250
253
|
value,
|
|
251
254
|
"aria-labelledby": labelId,
|
|
252
255
|
"aria-describedby": description ? descriptionId : undefined,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./components-xnp09586.js";
|
|
15
15
|
import {
|
|
16
16
|
SizeScope2
|
|
17
|
-
} from "./components-
|
|
17
|
+
} from "./components-ffng9rpa.js";
|
|
18
18
|
|
|
19
19
|
// components/data-display/avatar/index.tsx
|
|
20
20
|
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
@@ -7,10 +7,18 @@ import {
|
|
|
7
7
|
opensInPlace2,
|
|
8
8
|
inPlaceOffset2,
|
|
9
9
|
useMorphOrigin2
|
|
10
|
-
} from "./components-
|
|
10
|
+
} from "./components-mp7en54n.js";
|
|
11
|
+
import {
|
|
12
|
+
cn2
|
|
13
|
+
} from "./components-xnp09586.js";
|
|
11
14
|
|
|
12
15
|
// lib/overlay.tsx
|
|
13
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
createContext,
|
|
18
|
+
useCallback,
|
|
19
|
+
useContext,
|
|
20
|
+
useMemo
|
|
21
|
+
} from "react";
|
|
14
22
|
import { jsx } from "react/jsx-runtime";
|
|
15
23
|
var OverlayContext2 = createContext(null);
|
|
16
24
|
function useOverlayRoot2({ open: openProp, defaultOpen = false, onOpenChange: onChange }) {
|
|
@@ -30,13 +38,26 @@ function useOverlay2(part) {
|
|
|
30
38
|
throw new Error(`${part} must be inside its overlay's root.`);
|
|
31
39
|
return state;
|
|
32
40
|
}
|
|
33
|
-
function positionerProps2({
|
|
41
|
+
function positionerProps2({
|
|
42
|
+
side,
|
|
43
|
+
align,
|
|
44
|
+
sideOffset,
|
|
45
|
+
effect,
|
|
46
|
+
hideSource,
|
|
47
|
+
alignOffset,
|
|
48
|
+
collisionPadding,
|
|
49
|
+
collisionBoundary,
|
|
50
|
+
positionerClassName
|
|
51
|
+
}, defaults) {
|
|
34
52
|
const inPlace = opensInPlace2({ effect, hideSource });
|
|
35
53
|
return {
|
|
36
54
|
side: side ?? defaults.side,
|
|
37
55
|
align: align ?? (inPlace ? "start" : defaults.align),
|
|
38
56
|
sideOffset: inPlace ? inPlaceOffset2 : sideOffset ?? defaults.sideOffset,
|
|
39
|
-
|
|
57
|
+
alignOffset,
|
|
58
|
+
collisionPadding,
|
|
59
|
+
collisionBoundary,
|
|
60
|
+
className: cn2("z-50 outline-none", positionerClassName)
|
|
40
61
|
};
|
|
41
62
|
}
|
|
42
63
|
var PortalContainerContext = createContext(null);
|
|
@@ -27,26 +27,26 @@ import {
|
|
|
27
27
|
} from "./components-45r18egt.js";
|
|
28
28
|
import {
|
|
29
29
|
useMorph2
|
|
30
|
-
} from "./components-
|
|
30
|
+
} from "./components-mp7en54n.js";
|
|
31
31
|
import {
|
|
32
32
|
OverlayContext2,
|
|
33
33
|
useOverlayRoot2,
|
|
34
34
|
useOverlay2,
|
|
35
35
|
positionerProps2,
|
|
36
36
|
usePortalContainer2
|
|
37
|
-
} from "./components-
|
|
37
|
+
} from "./components-xvf8jcza.js";
|
|
38
38
|
import {
|
|
39
39
|
SizeScope2
|
|
40
|
-
} from "./components-
|
|
40
|
+
} from "./components-ffng9rpa.js";
|
|
41
41
|
import {
|
|
42
42
|
useIcon2
|
|
43
43
|
} from "./components-jnhpgpfk.js";
|
|
44
44
|
import {
|
|
45
45
|
GooIndicator2
|
|
46
|
-
} from "./components-
|
|
46
|
+
} from "./components-gvwxswpr.js";
|
|
47
47
|
import {
|
|
48
48
|
FluidHoverHighlight2
|
|
49
|
-
} from "./components-
|
|
49
|
+
} from "./components-95kp19zn.js";
|
|
50
50
|
import {
|
|
51
51
|
useMergeRefs2
|
|
52
52
|
} from "./components-bkwjvvkh.js";
|
|
@@ -61,10 +61,10 @@ import {
|
|
|
61
61
|
rowLabelBoxClass2,
|
|
62
62
|
RowIcon2,
|
|
63
63
|
CheckMark2
|
|
64
|
-
} from "./components-
|
|
64
|
+
} from "./components-6c52v58g.js";
|
|
65
65
|
import {
|
|
66
66
|
PopupSurface2
|
|
67
|
-
} from "./components-
|
|
67
|
+
} from "./components-90sfqz5t.js";
|
|
68
68
|
import {
|
|
69
69
|
useFluidHover2,
|
|
70
70
|
useRegisterFluidHoverItem2
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
useSelectionRuns2,
|
|
74
74
|
useMergeSplitBlocks2,
|
|
75
75
|
SelectionBackgrounds2
|
|
76
|
-
} from "./components-
|
|
76
|
+
} from "./components-veaxns17.js";
|
|
77
77
|
import {
|
|
78
78
|
ScrollArea2
|
|
79
79
|
} from "./components-esy5nsvc.js";
|
|
@@ -698,7 +698,7 @@ var Combobox2 = Object.assign(function Combobox({
|
|
|
698
698
|
onOpenChange,
|
|
699
699
|
filter,
|
|
700
700
|
query: queryProp,
|
|
701
|
-
defaultQuery
|
|
701
|
+
defaultQuery,
|
|
702
702
|
onQueryChange,
|
|
703
703
|
loading = false,
|
|
704
704
|
loadingLabel = "Loading…",
|
|
@@ -722,7 +722,8 @@ var Combobox2 = Object.assign(function Combobox({
|
|
|
722
722
|
const controlledValues = useMemo2(() => value === undefined ? undefined : toValues(value), [value]);
|
|
723
723
|
const [values, setValues] = useControllableState2(controlledValues, toValues(defaultValue));
|
|
724
724
|
const queryDetails = useRef3(null);
|
|
725
|
-
const
|
|
725
|
+
const picked = isMultiple || defaultQuery !== undefined ? undefined : items.find((item) => itemValue(item) === values[0]);
|
|
726
|
+
const [inputValue, setInputValue] = useControllableState2(queryProp, defaultQuery ?? (picked ? itemLabel(picked) : ""), (next) => onQueryChange?.(next, queryDetails.current));
|
|
726
727
|
const [highlight, setHighlight] = useState2(null);
|
|
727
728
|
const [createdItems, setCreatedItems] = useState2([]);
|
|
728
729
|
const root = useOverlayRoot2({ open, defaultOpen, onOpenChange });
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./components-wwd093xg.js";
|
|
26
26
|
import {
|
|
27
27
|
calendar_default
|
|
28
|
-
} from "./components-
|
|
28
|
+
} from "./components-t4eb37vd.js";
|
|
29
29
|
import {
|
|
30
30
|
readDateValue,
|
|
31
31
|
writeDateValue,
|
|
@@ -37,10 +37,10 @@ import {
|
|
|
37
37
|
invalidOf,
|
|
38
38
|
PickerShell,
|
|
39
39
|
PickerInput
|
|
40
|
-
} from "./components-
|
|
40
|
+
} from "./components-qkt4h7x4.js";
|
|
41
41
|
import {
|
|
42
42
|
TimeColumns
|
|
43
|
-
} from "./components-
|
|
43
|
+
} from "./components-rts2mggt.js";
|
|
44
44
|
|
|
45
45
|
// components/inputs/date-time/date-range-picker/index.tsx
|
|
46
46
|
import { format, set } from "date-fns";
|
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
holdExit2,
|
|
15
15
|
useMorphOrigin2,
|
|
16
16
|
useMorph2
|
|
17
|
-
} from "./components-
|
|
17
|
+
} from "./components-mp7en54n.js";
|
|
18
18
|
import {
|
|
19
19
|
cn2
|
|
20
20
|
} from "./components-xnp09586.js";
|
|
21
21
|
import {
|
|
22
22
|
MorphSurface2
|
|
23
|
-
} from "./components-
|
|
23
|
+
} from "./components-313rmbxy.js";
|
|
24
24
|
import {
|
|
25
25
|
useShape2
|
|
26
26
|
} from "./components-kxpcj2ry.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from "./components-wwd093xg.js";
|
|
38
38
|
import {
|
|
39
39
|
button_default
|
|
40
|
-
} from "./components-
|
|
40
|
+
} from "./components-31pkxwfz.js";
|
|
41
41
|
|
|
42
42
|
// components/overlays/lightbox/index.tsx
|
|
43
43
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
@@ -8,16 +8,16 @@ import {
|
|
|
8
8
|
} from "./components-xnp09586.js";
|
|
9
9
|
import {
|
|
10
10
|
GooIndicator2
|
|
11
|
-
} from "./components-
|
|
11
|
+
} from "./components-gvwxswpr.js";
|
|
12
12
|
import {
|
|
13
13
|
FluidHoverHighlight2
|
|
14
|
-
} from "./components-
|
|
14
|
+
} from "./components-95kp19zn.js";
|
|
15
15
|
import {
|
|
16
16
|
useShape2
|
|
17
17
|
} from "./components-kxpcj2ry.js";
|
|
18
18
|
import {
|
|
19
19
|
FocusRing2
|
|
20
|
-
} from "./components-
|
|
20
|
+
} from "./components-v1m0xjbw.js";
|
|
21
21
|
import {
|
|
22
22
|
mergeRefs2
|
|
23
23
|
} from "./components-bkwjvvkh.js";
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
} from "./components-y09nr7fe.js";
|
|
45
45
|
import {
|
|
46
46
|
SizeScope2
|
|
47
|
-
} from "./components-
|
|
47
|
+
} from "./components-ffng9rpa.js";
|
|
48
48
|
|
|
49
49
|
// components/inputs/radio/index.tsx
|
|
50
50
|
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
@@ -84,6 +84,7 @@ var RadioGroup2 = forwardRef(({
|
|
|
84
84
|
defaultValue,
|
|
85
85
|
onValueChange: onValueChangeProp,
|
|
86
86
|
name,
|
|
87
|
+
required,
|
|
87
88
|
disabled = false,
|
|
88
89
|
size,
|
|
89
90
|
className,
|
|
@@ -123,6 +124,7 @@ var RadioGroup2 = forwardRef(({
|
|
|
123
124
|
value: value ?? null,
|
|
124
125
|
onValueChange: (v) => setValue(v),
|
|
125
126
|
name,
|
|
127
|
+
required,
|
|
126
128
|
disabled,
|
|
127
129
|
className: cn2("flex flex-col gap-2", className),
|
|
128
130
|
...props,
|
|
@@ -167,6 +169,7 @@ var RadioGroup2 = forwardRef(({
|
|
|
167
169
|
value: value ?? null,
|
|
168
170
|
onValueChange: (v) => setValue(v),
|
|
169
171
|
name,
|
|
172
|
+
required,
|
|
170
173
|
disabled,
|
|
171
174
|
render: content
|
|
172
175
|
}) : content
|
package/dist/styles.css
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
}
|
|
63
63
|
/* layer: theme */
|
|
64
64
|
@layer theme{
|
|
65
|
-
:root, :host { --
|
|
65
|
+
:root, :host { --spacing: 0.25rem; --default-transition-timingFunction: cubic-bezier(0.4, 0, 0.2, 1); --default-transition-duration: 150ms; --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace; --font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif; --container-2xl: 42rem; --radius-md: 0.375rem; --radius-3xl: 1.5rem; --radius-xl: 0.75rem; --ease-DEFAULT: cubic-bezier(0.4, 0, 0.2, 1); --leading-tight: 1.25; --radius-DEFAULT: 0.25rem; --ease-out: cubic-bezier(0, 0, 0.2, 1); --radius-sm: 0.25rem; --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); --leading-relaxed: 1.625; --radius-none: 0; --radius-2xl: 1rem; --leading-none: 1; --container-sm: 24rem; --radius-xs: 0.125rem; --leading-snug: 1.375; --leading-normal: 1.5; --radius-lg: 0.5rem; --default-font-family: var(--font-sans); --default-monoFont-family: var(--font-mono); }
|
|
66
66
|
}
|
|
67
67
|
/* layer: base */
|
|
68
68
|
@layer base{
|
|
@@ -587,6 +587,7 @@
|
|
|
587
587
|
.h-2\.5{height:calc(var(--spacing) * 2.5);}
|
|
588
588
|
.h-24,
|
|
589
589
|
.h24{height:calc(var(--spacing) * 24);}
|
|
590
|
+
.h-40{height:calc(var(--spacing) * 40);}
|
|
590
591
|
.h-5{height:calc(var(--spacing) * 5);}
|
|
591
592
|
.h-56{height:calc(var(--spacing) * 56);}
|
|
592
593
|
.h-6{height:calc(var(--spacing) * 6);}
|
|
@@ -674,6 +675,7 @@
|
|
|
674
675
|
.w-8{width:calc(var(--spacing) * 8);}
|
|
675
676
|
.w-80{width:calc(var(--spacing) * 80);}
|
|
676
677
|
.w-9{width:calc(var(--spacing) * 9);}
|
|
678
|
+
.w-fit{width:fit-content;}
|
|
677
679
|
.w-full{width:100%;}
|
|
678
680
|
.w-max{width:max-content;}
|
|
679
681
|
.w-px{width:1px;}
|
|
@@ -705,6 +707,7 @@
|
|
|
705
707
|
.cursor-col-resize{cursor:col-resize;}
|
|
706
708
|
.cursor-row-resize{cursor:row-resize;}
|
|
707
709
|
.cursor-ew-resize{cursor:ew-resize;}
|
|
710
|
+
.cursor-ns-resize{cursor:ns-resize;}
|
|
708
711
|
.cursor-zoom-in{cursor:zoom-in;}
|
|
709
712
|
.cursor-zoom-out{cursor:zoom-out;}
|
|
710
713
|
.group\/card:focus-within .group-focus-within\/card\:pointer-events-auto,
|
|
@@ -805,6 +808,7 @@
|
|
|
805
808
|
.data-\[ending-style\]\:data-\[activation-direction\=right\]\:-translate-x-4[data-activation-direction=right][data-ending-style],
|
|
806
809
|
.data-\[starting-style\]\:data-\[activation-direction\=left\]\:-translate-x-4[data-activation-direction=left][data-starting-style]{--un-translate-x:calc(var(--spacing) * -4);translate:var(--un-translate-x) var(--un-translate-y);}
|
|
807
810
|
.translate-y-0\.5{--un-translate-y:calc(var(--spacing) * 0.5);translate:var(--un-translate-x) var(--un-translate-y);}
|
|
811
|
+
.translate-y-1\/2{--un-translate-y:50%;translate:var(--un-translate-x) var(--un-translate-y);}
|
|
808
812
|
.after\:-translate-x-1\/2::after{--un-translate-x:-50%;translate:var(--un-translate-x) var(--un-translate-y);}
|
|
809
813
|
.-rotate-45{rotate:-45deg;}
|
|
810
814
|
.-rotate-90{rotate:-90deg;}
|
|
@@ -977,6 +981,7 @@
|
|
|
977
981
|
.overflow-y-auto{overflow-y:auto;}
|
|
978
982
|
.overflow-y-hidden{overflow-y:hidden;}
|
|
979
983
|
.fill-current{fill:currentColor;}
|
|
984
|
+
.fill-current\/16{fill:color-mix(in oklab, currentColor 16%, transparent);}
|
|
980
985
|
.fill-picker-edge{fill:color-mix(in srgb, var(--picker-edge) var(--un-fill-opacity), transparent);}
|
|
981
986
|
.\[\&_svg\]\:stroke-\[1\.5\] svg{stroke-width:1.5;}
|
|
982
987
|
.\[\&_svg\]\:stroke-\[2\] svg,
|
|
@@ -1215,6 +1220,10 @@
|
|
|
1215
1220
|
light, darker in dark), so a card resting in it lifts out: ShellCard. */
|
|
1216
1221
|
--sunken: light-dark(oklch(0.955 0 0), oklch(0.17 0 0));
|
|
1217
1222
|
|
|
1223
|
+
/* True black in both schemes, for a surface that has to match hardware
|
|
1224
|
+
(a display notch, a bezel) rather than the theme. */
|
|
1225
|
+
--ink: oklch(0 0 0);
|
|
1226
|
+
|
|
1218
1227
|
/* ── Interactive states ── */
|
|
1219
1228
|
--accent: light-dark(oklch(0.922 0 0), oklch(0.439 0 0));
|
|
1220
1229
|
--accent-foreground: light-dark(oklch(0.205 0 0), oklch(0.97 0 0));
|
package/dist/tailwind.css
CHANGED
package/dist/tokens.css
CHANGED
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
light, darker in dark), so a card resting in it lifts out: ShellCard. */
|
|
50
50
|
--sunken: light-dark(oklch(0.955 0 0), oklch(0.17 0 0));
|
|
51
51
|
|
|
52
|
+
/* True black in both schemes, for a surface that has to match hardware
|
|
53
|
+
(a display notch, a bezel) rather than the theme. */
|
|
54
|
+
--ink: oklch(0 0 0);
|
|
55
|
+
|
|
52
56
|
/* ── Interactive states ── */
|
|
53
57
|
--accent: light-dark(oklch(0.922 0 0), oklch(0.439 0 0));
|
|
54
58
|
--accent-foreground: light-dark(oklch(0.205 0 0), oklch(0.97 0 0));
|
package/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './components/data-display/kbd'
|
|
|
12
12
|
export * from './components/data-display/list'
|
|
13
13
|
export * from './components/data-display/log-view'
|
|
14
14
|
export * from './components/data-display/markdown'
|
|
15
|
+
export * from './components/data-display/sparkline'
|
|
15
16
|
export * from './components/data-display/table'
|
|
16
17
|
export * from './components/feedback/empty-state'
|
|
17
18
|
export * from './components/feedback/meter'
|
package/lib/inert.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): `inert` that holds on
|
|
3
|
+
* React 18 and 19. React 18 has no `inert` prop and passes it through as an
|
|
4
|
+
* unknown attribute, so it needs a string (`''`); React 19 reads it as a
|
|
5
|
+
* boolean and drops `''`, with a warning.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { version } from 'react'
|
|
9
|
+
|
|
10
|
+
const INERT = (Number.parseInt(version, 10) >= 19 ? true : '') as unknown as boolean
|
|
11
|
+
|
|
12
|
+
/** Spread onto an element to make it inert while `on`. */
|
|
13
|
+
export function inertProps(on: boolean) {
|
|
14
|
+
return on ? { inert: INERT } : {}
|
|
15
|
+
}
|
package/lib/overlay.tsx
CHANGED
|
@@ -10,9 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
'use client'
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import type { Popover } from '@base-ui/react/popover'
|
|
14
|
+
import {
|
|
15
|
+
type ComponentProps,
|
|
16
|
+
createContext,
|
|
17
|
+
type ReactNode,
|
|
18
|
+
type RefObject,
|
|
19
|
+
useCallback,
|
|
20
|
+
useContext,
|
|
21
|
+
useMemo,
|
|
22
|
+
} from 'react'
|
|
14
23
|
import { useControllableState } from './use-controllable-state'
|
|
15
24
|
import { inPlaceOffset, type MorphOrigin, type MorphProps, opensInPlace, useMorphOrigin } from './use-morph'
|
|
25
|
+
import { cn } from './utils'
|
|
16
26
|
|
|
17
27
|
type Side = 'top' | 'right' | 'bottom' | 'left'
|
|
18
28
|
type Align = 'start' | 'center' | 'end'
|
|
@@ -32,6 +42,23 @@ interface AnchorProps {
|
|
|
32
42
|
container?: HTMLElement | null
|
|
33
43
|
}
|
|
34
44
|
|
|
45
|
+
type Positioner = ComponentProps<typeof Popover.Positioner>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The finer positioning props a content may add to `AnchorProps`, forwarded
|
|
49
|
+
* to Base UI's `Positioner` by `positionerProps`. Documented once.
|
|
50
|
+
*/
|
|
51
|
+
interface CollisionProps {
|
|
52
|
+
/** Shift along the aligned edge in px, after `align`, or Base UI's function of side, align and sizes. Defaults to `0`. */
|
|
53
|
+
alignOffset?: Positioner['alignOffset']
|
|
54
|
+
/** Space kept between the panel and the edge of its collision boundary, in px or per side. Defaults to `5`. */
|
|
55
|
+
collisionPadding?: Positioner['collisionPadding']
|
|
56
|
+
/** The area the panel stays inside: an element, several, or a rect. Defaults to `'clipping-ancestors'`. */
|
|
57
|
+
collisionBoundary?: Positioner['collisionBoundary']
|
|
58
|
+
/** Classes for the positioner, the element that carries the panel's place and stacking (a `z-index` over a host's own layers). */
|
|
59
|
+
positionerClassName?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
35
62
|
/** What an overlay's parts read from its root. */
|
|
36
63
|
interface OverlayState {
|
|
37
64
|
open: boolean
|
|
@@ -89,15 +116,32 @@ function useOverlay(part: string): OverlayState {
|
|
|
89
116
|
* when the panel opens in place. Spread them on the `Positioner`.
|
|
90
117
|
*/
|
|
91
118
|
function positionerProps(
|
|
92
|
-
{
|
|
119
|
+
{
|
|
120
|
+
side,
|
|
121
|
+
align,
|
|
122
|
+
sideOffset,
|
|
123
|
+
effect,
|
|
124
|
+
hideSource,
|
|
125
|
+
alignOffset,
|
|
126
|
+
collisionPadding,
|
|
127
|
+
collisionBoundary,
|
|
128
|
+
positionerClassName,
|
|
129
|
+
}: AnchorProps & MorphProps & CollisionProps,
|
|
93
130
|
defaults: { side: Side; align: Align; sideOffset: number },
|
|
94
|
-
) {
|
|
131
|
+
): Pick<Positioner, 'sideOffset' | 'alignOffset' | 'collisionPadding' | 'collisionBoundary'> & {
|
|
132
|
+
side: Side
|
|
133
|
+
align: Align
|
|
134
|
+
className: string
|
|
135
|
+
} {
|
|
95
136
|
const inPlace = opensInPlace({ effect, hideSource })
|
|
96
137
|
return {
|
|
97
138
|
side: side ?? defaults.side,
|
|
98
139
|
align: align ?? (inPlace ? 'start' : defaults.align),
|
|
99
140
|
sideOffset: inPlace ? inPlaceOffset : (sideOffset ?? defaults.sideOffset),
|
|
100
|
-
|
|
141
|
+
alignOffset,
|
|
142
|
+
collisionPadding,
|
|
143
|
+
collisionBoundary,
|
|
144
|
+
className: cn('z-50 outline-none', positionerClassName),
|
|
101
145
|
}
|
|
102
146
|
}
|
|
103
147
|
|
|
@@ -114,5 +158,5 @@ function usePortalContainer(container?: HTMLElement | null) {
|
|
|
114
158
|
return container ?? scoped ?? undefined
|
|
115
159
|
}
|
|
116
160
|
|
|
117
|
-
export type { Align, AnchorProps, OpenChangeDetails, OverlayRootProps, OverlayState, Side }
|
|
161
|
+
export type { Align, AnchorProps, CollisionProps, OpenChangeDetails, OverlayRootProps, OverlayState, Side }
|
|
118
162
|
export { OverlayContext, PortalContainer, positionerProps, useOverlay, useOverlayRoot, usePortalContainer }
|
package/lib/slot.tsx
CHANGED
|
@@ -25,7 +25,7 @@ import { mergeRefs } from './merge-refs'
|
|
|
25
25
|
import { cn } from './utils'
|
|
26
26
|
|
|
27
27
|
interface SlotProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
28
|
-
/** The element that becomes the control, e.g. a Button. */
|
|
28
|
+
/** The element that becomes the control, e.g. a Button. `children` fill it when it has none of its own. */
|
|
29
29
|
render?: ReactElement
|
|
30
30
|
/** Compose onto the single child instead. Defaults to `false`. */
|
|
31
31
|
asChild?: boolean
|
|
@@ -33,9 +33,15 @@ interface SlotProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
33
33
|
children?: ReactNode
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The element a Base UI part renders as: `render`, else `asChild`'s child, else none. `children` fill
|
|
38
|
+
* a `render` element that has none of its own (`render={<button/>}` + children); its own children win.
|
|
39
|
+
*/
|
|
37
40
|
function slotRender(render: ReactElement | undefined, asChild: boolean | undefined, children: ReactNode) {
|
|
38
|
-
if (render)
|
|
41
|
+
if (render) {
|
|
42
|
+
const own = (render.props as { children?: ReactNode }).children
|
|
43
|
+
return children === undefined || own !== undefined ? render : cloneElement(render, undefined, children)
|
|
44
|
+
}
|
|
39
45
|
return asChild && isValidElement(children) ? children : undefined
|
|
40
46
|
}
|
|
41
47
|
|