@moontra/moonui 2.2.4 → 2.2.5
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/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +390 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +390 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1413,8 +1413,6 @@ var CheckboxWithLabel = t.forwardRef(({
|
|
|
1413
1413
|
] });
|
|
1414
1414
|
});
|
|
1415
1415
|
CheckboxWithLabel.displayName = "CheckboxWithLabel";
|
|
1416
|
-
|
|
1417
|
-
// ../../node_modules/@radix-ui/primitive/dist/index.mjs
|
|
1418
1416
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
1419
1417
|
return function handleEvent(event) {
|
|
1420
1418
|
originalEventHandler?.(event);
|
|
@@ -1681,7 +1679,7 @@ function usePresence(present) {
|
|
|
1681
1679
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
1682
1680
|
const handleAnimationEnd = (event) => {
|
|
1683
1681
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1684
|
-
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
1682
|
+
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
1685
1683
|
if (event.target === node && isCurrentAnimation) {
|
|
1686
1684
|
send("ANIMATION_END");
|
|
1687
1685
|
if (!prevPresentRef.current) {
|
|
@@ -3231,6 +3229,88 @@ function D(_) {
|
|
|
3231
3229
|
function W(_, C, h) {
|
|
3232
3230
|
return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
|
|
3233
3231
|
}
|
|
3232
|
+
var NODES2 = [
|
|
3233
|
+
"a",
|
|
3234
|
+
"button",
|
|
3235
|
+
"div",
|
|
3236
|
+
"form",
|
|
3237
|
+
"h2",
|
|
3238
|
+
"h3",
|
|
3239
|
+
"img",
|
|
3240
|
+
"input",
|
|
3241
|
+
"label",
|
|
3242
|
+
"li",
|
|
3243
|
+
"nav",
|
|
3244
|
+
"ol",
|
|
3245
|
+
"p",
|
|
3246
|
+
"select",
|
|
3247
|
+
"span",
|
|
3248
|
+
"svg",
|
|
3249
|
+
"ul"
|
|
3250
|
+
];
|
|
3251
|
+
var Primitive2 = NODES2.reduce((primitive, node) => {
|
|
3252
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
3253
|
+
const Node = t.forwardRef((props, forwardedRef) => {
|
|
3254
|
+
const { asChild, ...primitiveProps } = props;
|
|
3255
|
+
const Comp = asChild ? Slot : node;
|
|
3256
|
+
if (typeof window !== "undefined") {
|
|
3257
|
+
window[Symbol.for("radix-ui")] = true;
|
|
3258
|
+
}
|
|
3259
|
+
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
3260
|
+
});
|
|
3261
|
+
Node.displayName = `Primitive.${node}`;
|
|
3262
|
+
return { ...primitive, [node]: Node };
|
|
3263
|
+
}, {});
|
|
3264
|
+
var useLayoutEffect22 = globalThis?.document ? t.useLayoutEffect : () => {
|
|
3265
|
+
};
|
|
3266
|
+
|
|
3267
|
+
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
3268
|
+
var useReactId2 = t[" useId ".trim().toString()] || (() => void 0);
|
|
3269
|
+
var count2 = 0;
|
|
3270
|
+
function useId3(deterministicId) {
|
|
3271
|
+
const [id, setId] = t.useState(useReactId2());
|
|
3272
|
+
useLayoutEffect22(() => {
|
|
3273
|
+
if (!deterministicId)
|
|
3274
|
+
setId((reactId) => reactId ?? String(count2++));
|
|
3275
|
+
}, [deterministicId]);
|
|
3276
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
3277
|
+
}
|
|
3278
|
+
function setRef2(ref, value) {
|
|
3279
|
+
if (typeof ref === "function") {
|
|
3280
|
+
return ref(value);
|
|
3281
|
+
} else if (ref !== null && ref !== void 0) {
|
|
3282
|
+
ref.current = value;
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
function composeRefs2(...refs) {
|
|
3286
|
+
return (node) => {
|
|
3287
|
+
let hasCleanup = false;
|
|
3288
|
+
const cleanups = refs.map((ref) => {
|
|
3289
|
+
const cleanup = setRef2(ref, node);
|
|
3290
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
3291
|
+
hasCleanup = true;
|
|
3292
|
+
}
|
|
3293
|
+
return cleanup;
|
|
3294
|
+
});
|
|
3295
|
+
if (hasCleanup) {
|
|
3296
|
+
return () => {
|
|
3297
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
3298
|
+
const cleanup = cleanups[i];
|
|
3299
|
+
if (typeof cleanup == "function") {
|
|
3300
|
+
cleanup();
|
|
3301
|
+
} else {
|
|
3302
|
+
setRef2(refs[i], null);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
function useComposedRefs2(...refs) {
|
|
3310
|
+
return t.useCallback(composeRefs2(...refs), refs);
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
// ../../node_modules/cmdk/dist/index.mjs
|
|
3234
3314
|
var N = '[cmdk-group=""]';
|
|
3235
3315
|
var Y2 = '[cmdk-group-items=""]';
|
|
3236
3316
|
var be = '[cmdk-group-heading=""]';
|
|
@@ -3248,7 +3328,7 @@ var me = t.forwardRef((r, o) => {
|
|
|
3248
3328
|
let n = L(() => {
|
|
3249
3329
|
var e, a;
|
|
3250
3330
|
return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
3251
|
-
}), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 =
|
|
3331
|
+
}), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId3(), q = useId3(), _ = useId3(), I = t.useRef(null), v = ke();
|
|
3252
3332
|
k2(() => {
|
|
3253
3333
|
if (R !== void 0) {
|
|
3254
3334
|
let e = R.trim();
|
|
@@ -3383,7 +3463,7 @@ var me = t.forwardRef((r, o) => {
|
|
|
3383
3463
|
}, se = (e) => {
|
|
3384
3464
|
e.preventDefault(), e.metaKey ? X8(0) : e.altKey ? re(-1) : Q(-1);
|
|
3385
3465
|
};
|
|
3386
|
-
return t.createElement(
|
|
3466
|
+
return t.createElement(Primitive2.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
|
|
3387
3467
|
var s;
|
|
3388
3468
|
(s = O.onKeyDown) == null || s.call(O, e);
|
|
3389
3469
|
let a = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
@@ -3428,7 +3508,7 @@ var me = t.forwardRef((r, o) => {
|
|
|
3428
3508
|
});
|
|
3429
3509
|
var he = t.forwardRef((r, o) => {
|
|
3430
3510
|
var _, I;
|
|
3431
|
-
let n =
|
|
3511
|
+
let n = useId3(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
|
|
3432
3512
|
k2(() => {
|
|
3433
3513
|
if (!p2)
|
|
3434
3514
|
return d.item(n, c == null ? void 0 : c.id);
|
|
@@ -3449,23 +3529,23 @@ var he = t.forwardRef((r, o) => {
|
|
|
3449
3529
|
if (!x)
|
|
3450
3530
|
return null;
|
|
3451
3531
|
let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
|
|
3452
|
-
return t.createElement(
|
|
3532
|
+
return t.createElement(Primitive2.div, { ref: composeRefs2(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
|
|
3453
3533
|
});
|
|
3454
3534
|
var Ee = t.forwardRef((r, o) => {
|
|
3455
|
-
let { heading: n, children: u2, forceMount: c, ...d } = r, f =
|
|
3535
|
+
let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId3(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId3(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
|
|
3456
3536
|
k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
|
|
3457
3537
|
let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
|
|
3458
|
-
return t.createElement(
|
|
3538
|
+
return t.createElement(Primitive2.div, { ref: composeRefs2(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
|
|
3459
3539
|
});
|
|
3460
3540
|
var ye = t.forwardRef((r, o) => {
|
|
3461
3541
|
let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search);
|
|
3462
|
-
return !n && !d ? null : t.createElement(
|
|
3542
|
+
return !n && !d ? null : t.createElement(Primitive2.div, { ref: composeRefs2(c, o), ...u2, "cmdk-separator": "", role: "separator" });
|
|
3463
3543
|
});
|
|
3464
3544
|
var Se = t.forwardRef((r, o) => {
|
|
3465
3545
|
let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
|
|
3466
3546
|
return t.useEffect(() => {
|
|
3467
3547
|
r.value != null && d.setState("search", r.value);
|
|
3468
|
-
}, [r.value]), t.createElement(
|
|
3548
|
+
}, [r.value]), t.createElement(Primitive2.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
|
|
3469
3549
|
c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
|
|
3470
3550
|
} });
|
|
3471
3551
|
});
|
|
@@ -3483,16 +3563,16 @@ var Ce = t.forwardRef((r, o) => {
|
|
|
3483
3563
|
cancelAnimationFrame(x), C.unobserve(m2);
|
|
3484
3564
|
};
|
|
3485
3565
|
}
|
|
3486
|
-
}, []), t.createElement(
|
|
3566
|
+
}, []), t.createElement(Primitive2.div, { ref: composeRefs2(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs2(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
|
|
3487
3567
|
});
|
|
3488
3568
|
var xe = t.forwardRef((r, o) => {
|
|
3489
3569
|
let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
|
|
3490
3570
|
return t.createElement(DialogPrimitive.Root, { open: n, onOpenChange: u2 }, t.createElement(DialogPrimitive.Portal, { container: f }, t.createElement(DialogPrimitive.Overlay, { "cmdk-overlay": "", className: c }), t.createElement(DialogPrimitive.Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
|
|
3491
3571
|
});
|
|
3492
|
-
var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(
|
|
3572
|
+
var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive2.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
|
|
3493
3573
|
var Pe = t.forwardRef((r, o) => {
|
|
3494
3574
|
let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
|
|
3495
|
-
return t.createElement(
|
|
3575
|
+
return t.createElement(Primitive2.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
|
|
3496
3576
|
});
|
|
3497
3577
|
var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
|
|
3498
3578
|
function we(r, o) {
|
|
@@ -4645,16 +4725,16 @@ var extent = (columnId, _leafRows, childRows) => {
|
|
|
4645
4725
|
return [min2, max2];
|
|
4646
4726
|
};
|
|
4647
4727
|
var mean = (columnId, leafRows) => {
|
|
4648
|
-
let
|
|
4728
|
+
let count4 = 0;
|
|
4649
4729
|
let sum2 = 0;
|
|
4650
4730
|
leafRows.forEach((row) => {
|
|
4651
4731
|
let value = row.getValue(columnId);
|
|
4652
4732
|
if (value != null && (value = +value) >= value) {
|
|
4653
|
-
++
|
|
4733
|
+
++count4, sum2 += value;
|
|
4654
4734
|
}
|
|
4655
4735
|
});
|
|
4656
|
-
if (
|
|
4657
|
-
return sum2 /
|
|
4736
|
+
if (count4)
|
|
4737
|
+
return sum2 / count4;
|
|
4658
4738
|
return;
|
|
4659
4739
|
};
|
|
4660
4740
|
var median = (columnId, leafRows) => {
|
|
@@ -4678,7 +4758,7 @@ var unique = (columnId, leafRows) => {
|
|
|
4678
4758
|
var uniqueCount = (columnId, leafRows) => {
|
|
4679
4759
|
return new Set(leafRows.map((d) => d.getValue(columnId))).size;
|
|
4680
4760
|
};
|
|
4681
|
-
var
|
|
4761
|
+
var count3 = (_columnId, leafRows) => {
|
|
4682
4762
|
return leafRows.length;
|
|
4683
4763
|
};
|
|
4684
4764
|
var aggregationFns = {
|
|
@@ -4690,7 +4770,7 @@ var aggregationFns = {
|
|
|
4690
4770
|
median,
|
|
4691
4771
|
unique,
|
|
4692
4772
|
uniqueCount,
|
|
4693
|
-
count:
|
|
4773
|
+
count: count3
|
|
4694
4774
|
};
|
|
4695
4775
|
var ColumnGrouping = {
|
|
4696
4776
|
getDefaultColumnDef: () => {
|
|
@@ -10069,6 +10149,188 @@ function RichTextEditor({
|
|
|
10069
10149
|
)
|
|
10070
10150
|
] });
|
|
10071
10151
|
}
|
|
10152
|
+
function useStateMachine2(initialState, machine) {
|
|
10153
|
+
return t.useReducer((state, event) => {
|
|
10154
|
+
const nextState = machine[state][event];
|
|
10155
|
+
return nextState ?? state;
|
|
10156
|
+
}, initialState);
|
|
10157
|
+
}
|
|
10158
|
+
var Presence2 = (props) => {
|
|
10159
|
+
const { present, children } = props;
|
|
10160
|
+
const presence = usePresence2(present);
|
|
10161
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : t.Children.only(children);
|
|
10162
|
+
const ref = useComposedRefs2(presence.ref, getElementRef2(child));
|
|
10163
|
+
const forceMount = typeof children === "function";
|
|
10164
|
+
return forceMount || presence.isPresent ? t.cloneElement(child, { ref }) : null;
|
|
10165
|
+
};
|
|
10166
|
+
Presence2.displayName = "Presence";
|
|
10167
|
+
function usePresence2(present) {
|
|
10168
|
+
const [node, setNode] = t.useState();
|
|
10169
|
+
const stylesRef = t.useRef(null);
|
|
10170
|
+
const prevPresentRef = t.useRef(present);
|
|
10171
|
+
const prevAnimationNameRef = t.useRef("none");
|
|
10172
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
10173
|
+
const [state, send] = useStateMachine2(initialState, {
|
|
10174
|
+
mounted: {
|
|
10175
|
+
UNMOUNT: "unmounted",
|
|
10176
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
10177
|
+
},
|
|
10178
|
+
unmountSuspended: {
|
|
10179
|
+
MOUNT: "mounted",
|
|
10180
|
+
ANIMATION_END: "unmounted"
|
|
10181
|
+
},
|
|
10182
|
+
unmounted: {
|
|
10183
|
+
MOUNT: "mounted"
|
|
10184
|
+
}
|
|
10185
|
+
});
|
|
10186
|
+
t.useEffect(() => {
|
|
10187
|
+
const currentAnimationName = getAnimationName2(stylesRef.current);
|
|
10188
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
10189
|
+
}, [state]);
|
|
10190
|
+
useLayoutEffect22(() => {
|
|
10191
|
+
const styles = stylesRef.current;
|
|
10192
|
+
const wasPresent = prevPresentRef.current;
|
|
10193
|
+
const hasPresentChanged = wasPresent !== present;
|
|
10194
|
+
if (hasPresentChanged) {
|
|
10195
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
10196
|
+
const currentAnimationName = getAnimationName2(styles);
|
|
10197
|
+
if (present) {
|
|
10198
|
+
send("MOUNT");
|
|
10199
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
10200
|
+
send("UNMOUNT");
|
|
10201
|
+
} else {
|
|
10202
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
10203
|
+
if (wasPresent && isAnimating) {
|
|
10204
|
+
send("ANIMATION_OUT");
|
|
10205
|
+
} else {
|
|
10206
|
+
send("UNMOUNT");
|
|
10207
|
+
}
|
|
10208
|
+
}
|
|
10209
|
+
prevPresentRef.current = present;
|
|
10210
|
+
}
|
|
10211
|
+
}, [present, send]);
|
|
10212
|
+
useLayoutEffect22(() => {
|
|
10213
|
+
if (node) {
|
|
10214
|
+
let timeoutId;
|
|
10215
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
10216
|
+
const handleAnimationEnd = (event) => {
|
|
10217
|
+
const currentAnimationName = getAnimationName2(stylesRef.current);
|
|
10218
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
10219
|
+
if (event.target === node && isCurrentAnimation) {
|
|
10220
|
+
send("ANIMATION_END");
|
|
10221
|
+
if (!prevPresentRef.current) {
|
|
10222
|
+
const currentFillMode = node.style.animationFillMode;
|
|
10223
|
+
node.style.animationFillMode = "forwards";
|
|
10224
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
10225
|
+
if (node.style.animationFillMode === "forwards") {
|
|
10226
|
+
node.style.animationFillMode = currentFillMode;
|
|
10227
|
+
}
|
|
10228
|
+
});
|
|
10229
|
+
}
|
|
10230
|
+
}
|
|
10231
|
+
};
|
|
10232
|
+
const handleAnimationStart = (event) => {
|
|
10233
|
+
if (event.target === node) {
|
|
10234
|
+
prevAnimationNameRef.current = getAnimationName2(stylesRef.current);
|
|
10235
|
+
}
|
|
10236
|
+
};
|
|
10237
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
10238
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
10239
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
10240
|
+
return () => {
|
|
10241
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
10242
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
10243
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
10244
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
10245
|
+
};
|
|
10246
|
+
} else {
|
|
10247
|
+
send("ANIMATION_END");
|
|
10248
|
+
}
|
|
10249
|
+
}, [node, send]);
|
|
10250
|
+
return {
|
|
10251
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
10252
|
+
ref: t.useCallback((node2) => {
|
|
10253
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
10254
|
+
setNode(node2);
|
|
10255
|
+
}, [])
|
|
10256
|
+
};
|
|
10257
|
+
}
|
|
10258
|
+
function getAnimationName2(styles) {
|
|
10259
|
+
return styles?.animationName || "none";
|
|
10260
|
+
}
|
|
10261
|
+
function getElementRef2(element) {
|
|
10262
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
10263
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10264
|
+
if (mayWarn) {
|
|
10265
|
+
return element.ref;
|
|
10266
|
+
}
|
|
10267
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
10268
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10269
|
+
if (mayWarn) {
|
|
10270
|
+
return element.props.ref;
|
|
10271
|
+
}
|
|
10272
|
+
return element.props.ref || element.ref;
|
|
10273
|
+
}
|
|
10274
|
+
function createContextScope2(scopeName, createContextScopeDeps = []) {
|
|
10275
|
+
let defaultContexts = [];
|
|
10276
|
+
function createContext32(rootComponentName, defaultContext) {
|
|
10277
|
+
const BaseContext = t.createContext(defaultContext);
|
|
10278
|
+
const index = defaultContexts.length;
|
|
10279
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
10280
|
+
const Provider3 = (props) => {
|
|
10281
|
+
const { scope, children, ...context } = props;
|
|
10282
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
10283
|
+
const value = t.useMemo(() => context, Object.values(context));
|
|
10284
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
10285
|
+
};
|
|
10286
|
+
Provider3.displayName = rootComponentName + "Provider";
|
|
10287
|
+
function useContext22(consumerName, scope) {
|
|
10288
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
10289
|
+
const context = t.useContext(Context);
|
|
10290
|
+
if (context)
|
|
10291
|
+
return context;
|
|
10292
|
+
if (defaultContext !== void 0)
|
|
10293
|
+
return defaultContext;
|
|
10294
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10295
|
+
}
|
|
10296
|
+
return [Provider3, useContext22];
|
|
10297
|
+
}
|
|
10298
|
+
const createScope = () => {
|
|
10299
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10300
|
+
return t.createContext(defaultContext);
|
|
10301
|
+
});
|
|
10302
|
+
return function useScope(scope) {
|
|
10303
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
10304
|
+
return t.useMemo(
|
|
10305
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10306
|
+
[scope, contexts]
|
|
10307
|
+
);
|
|
10308
|
+
};
|
|
10309
|
+
};
|
|
10310
|
+
createScope.scopeName = scopeName;
|
|
10311
|
+
return [createContext32, composeContextScopes2(createScope, ...createContextScopeDeps)];
|
|
10312
|
+
}
|
|
10313
|
+
function composeContextScopes2(...scopes) {
|
|
10314
|
+
const baseScope = scopes[0];
|
|
10315
|
+
if (scopes.length === 1)
|
|
10316
|
+
return baseScope;
|
|
10317
|
+
const createScope = () => {
|
|
10318
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
10319
|
+
useScope: createScope2(),
|
|
10320
|
+
scopeName: createScope2.scopeName
|
|
10321
|
+
}));
|
|
10322
|
+
return function useComposedScopes(overrideScopes) {
|
|
10323
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10324
|
+
const scopeProps = useScope(overrideScopes);
|
|
10325
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10326
|
+
return { ...nextScopes2, ...currentScope };
|
|
10327
|
+
}, {});
|
|
10328
|
+
return t.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10329
|
+
};
|
|
10330
|
+
};
|
|
10331
|
+
createScope.scopeName = baseScope.scopeName;
|
|
10332
|
+
return createScope;
|
|
10333
|
+
}
|
|
10072
10334
|
function useCallbackRef(callback) {
|
|
10073
10335
|
const callbackRef = t.useRef(callback);
|
|
10074
10336
|
t.useEffect(() => {
|
|
@@ -10086,14 +10348,24 @@ function useDirection(localDir) {
|
|
|
10086
10348
|
function clamp(value, [min2, max2]) {
|
|
10087
10349
|
return Math.min(max2, Math.max(min2, value));
|
|
10088
10350
|
}
|
|
10089
|
-
|
|
10351
|
+
|
|
10352
|
+
// ../../node_modules/@radix-ui/primitive/dist/index.mjs
|
|
10353
|
+
function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
10354
|
+
return function handleEvent(event) {
|
|
10355
|
+
originalEventHandler?.(event);
|
|
10356
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
10357
|
+
return ourEventHandler?.(event);
|
|
10358
|
+
}
|
|
10359
|
+
};
|
|
10360
|
+
}
|
|
10361
|
+
function useStateMachine3(initialState, machine) {
|
|
10090
10362
|
return t.useReducer((state, event) => {
|
|
10091
10363
|
const nextState = machine[state][event];
|
|
10092
10364
|
return nextState ?? state;
|
|
10093
10365
|
}, initialState);
|
|
10094
10366
|
}
|
|
10095
10367
|
var SCROLL_AREA_NAME = "ScrollArea";
|
|
10096
|
-
var [createScrollAreaContext, createScrollAreaScope] =
|
|
10368
|
+
var [createScrollAreaContext, createScrollAreaScope] = createContextScope2(SCROLL_AREA_NAME);
|
|
10097
10369
|
var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
|
|
10098
10370
|
var ScrollArea = t.forwardRef(
|
|
10099
10371
|
(props, forwardedRef) => {
|
|
@@ -10113,7 +10385,7 @@ var ScrollArea = t.forwardRef(
|
|
|
10113
10385
|
const [cornerHeight, setCornerHeight] = t.useState(0);
|
|
10114
10386
|
const [scrollbarXEnabled, setScrollbarXEnabled] = t.useState(false);
|
|
10115
10387
|
const [scrollbarYEnabled, setScrollbarYEnabled] = t.useState(false);
|
|
10116
|
-
const composedRefs =
|
|
10388
|
+
const composedRefs = useComposedRefs2(forwardedRef, (node) => setScrollArea(node));
|
|
10117
10389
|
const direction = useDirection(dir);
|
|
10118
10390
|
return /* @__PURE__ */ jsx(
|
|
10119
10391
|
ScrollAreaProvider,
|
|
@@ -10138,7 +10410,7 @@ var ScrollArea = t.forwardRef(
|
|
|
10138
10410
|
onCornerWidthChange: setCornerWidth,
|
|
10139
10411
|
onCornerHeightChange: setCornerHeight,
|
|
10140
10412
|
children: /* @__PURE__ */ jsx(
|
|
10141
|
-
|
|
10413
|
+
Primitive2.div,
|
|
10142
10414
|
{
|
|
10143
10415
|
dir: direction,
|
|
10144
10416
|
...scrollAreaProps,
|
|
@@ -10163,7 +10435,7 @@ var ScrollAreaViewport = t.forwardRef(
|
|
|
10163
10435
|
const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
|
|
10164
10436
|
const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
|
|
10165
10437
|
const ref = t.useRef(null);
|
|
10166
|
-
const composedRefs =
|
|
10438
|
+
const composedRefs = useComposedRefs2(forwardedRef, ref, context.onViewportChange);
|
|
10167
10439
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10168
10440
|
/* @__PURE__ */ jsx(
|
|
10169
10441
|
"style",
|
|
@@ -10175,7 +10447,7 @@ var ScrollAreaViewport = t.forwardRef(
|
|
|
10175
10447
|
}
|
|
10176
10448
|
),
|
|
10177
10449
|
/* @__PURE__ */ jsx(
|
|
10178
|
-
|
|
10450
|
+
Primitive2.div,
|
|
10179
10451
|
{
|
|
10180
10452
|
"data-radix-scroll-area-viewport": "",
|
|
10181
10453
|
...viewportProps,
|
|
@@ -10244,7 +10516,7 @@ var ScrollAreaScrollbarHover = t.forwardRef((props, forwardedRef) => {
|
|
|
10244
10516
|
};
|
|
10245
10517
|
}
|
|
10246
10518
|
}, [context.scrollArea, context.scrollHideDelay]);
|
|
10247
|
-
return /* @__PURE__ */ jsx(
|
|
10519
|
+
return /* @__PURE__ */ jsx(Presence2, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
|
|
10248
10520
|
ScrollAreaScrollbarAuto,
|
|
10249
10521
|
{
|
|
10250
10522
|
"data-state": visible ? "visible" : "hidden",
|
|
@@ -10258,7 +10530,7 @@ var ScrollAreaScrollbarScroll = t.forwardRef((props, forwardedRef) => {
|
|
|
10258
10530
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
10259
10531
|
const isHorizontal = props.orientation === "horizontal";
|
|
10260
10532
|
const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
|
|
10261
|
-
const [state, send] =
|
|
10533
|
+
const [state, send] = useStateMachine3("hidden", {
|
|
10262
10534
|
hidden: {
|
|
10263
10535
|
SCROLL: "scrolling"
|
|
10264
10536
|
},
|
|
@@ -10300,14 +10572,14 @@ var ScrollAreaScrollbarScroll = t.forwardRef((props, forwardedRef) => {
|
|
|
10300
10572
|
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
10301
10573
|
}
|
|
10302
10574
|
}, [context.viewport, isHorizontal, send, debounceScrollEnd]);
|
|
10303
|
-
return /* @__PURE__ */ jsx(
|
|
10575
|
+
return /* @__PURE__ */ jsx(Presence2, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsx(
|
|
10304
10576
|
ScrollAreaScrollbarVisible,
|
|
10305
10577
|
{
|
|
10306
10578
|
"data-state": state === "hidden" ? "hidden" : "visible",
|
|
10307
10579
|
...scrollbarProps,
|
|
10308
10580
|
ref: forwardedRef,
|
|
10309
|
-
onPointerEnter:
|
|
10310
|
-
onPointerLeave:
|
|
10581
|
+
onPointerEnter: composeEventHandlers2(props.onPointerEnter, () => send("POINTER_ENTER")),
|
|
10582
|
+
onPointerLeave: composeEventHandlers2(props.onPointerLeave, () => send("POINTER_LEAVE"))
|
|
10311
10583
|
}
|
|
10312
10584
|
) });
|
|
10313
10585
|
});
|
|
@@ -10325,7 +10597,7 @@ var ScrollAreaScrollbarAuto = t.forwardRef((props, forwardedRef) => {
|
|
|
10325
10597
|
}, 10);
|
|
10326
10598
|
useResizeObserver(context.viewport, handleResize);
|
|
10327
10599
|
useResizeObserver(context.content, handleResize);
|
|
10328
|
-
return /* @__PURE__ */ jsx(
|
|
10600
|
+
return /* @__PURE__ */ jsx(Presence2, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
|
|
10329
10601
|
ScrollAreaScrollbarVisible,
|
|
10330
10602
|
{
|
|
10331
10603
|
"data-state": visible ? "visible" : "hidden",
|
|
@@ -10413,7 +10685,7 @@ var ScrollAreaScrollbarX = t.forwardRef((props, forwardedRef) => {
|
|
|
10413
10685
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
10414
10686
|
const [computedStyle, setComputedStyle] = t.useState();
|
|
10415
10687
|
const ref = t.useRef(null);
|
|
10416
|
-
const
|
|
10688
|
+
const composeRefs3 = useComposedRefs2(forwardedRef, ref, context.onScrollbarXChange);
|
|
10417
10689
|
t.useEffect(() => {
|
|
10418
10690
|
if (ref.current)
|
|
10419
10691
|
setComputedStyle(getComputedStyle(ref.current));
|
|
@@ -10423,7 +10695,7 @@ var ScrollAreaScrollbarX = t.forwardRef((props, forwardedRef) => {
|
|
|
10423
10695
|
{
|
|
10424
10696
|
"data-orientation": "horizontal",
|
|
10425
10697
|
...scrollbarProps,
|
|
10426
|
-
ref:
|
|
10698
|
+
ref: composeRefs3,
|
|
10427
10699
|
sizes,
|
|
10428
10700
|
style: {
|
|
10429
10701
|
bottom: 0,
|
|
@@ -10464,7 +10736,7 @@ var ScrollAreaScrollbarY = t.forwardRef((props, forwardedRef) => {
|
|
|
10464
10736
|
const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
10465
10737
|
const [computedStyle, setComputedStyle] = t.useState();
|
|
10466
10738
|
const ref = t.useRef(null);
|
|
10467
|
-
const
|
|
10739
|
+
const composeRefs3 = useComposedRefs2(forwardedRef, ref, context.onScrollbarYChange);
|
|
10468
10740
|
t.useEffect(() => {
|
|
10469
10741
|
if (ref.current)
|
|
10470
10742
|
setComputedStyle(getComputedStyle(ref.current));
|
|
@@ -10474,7 +10746,7 @@ var ScrollAreaScrollbarY = t.forwardRef((props, forwardedRef) => {
|
|
|
10474
10746
|
{
|
|
10475
10747
|
"data-orientation": "vertical",
|
|
10476
10748
|
...scrollbarProps,
|
|
10477
|
-
ref:
|
|
10749
|
+
ref: composeRefs3,
|
|
10478
10750
|
sizes,
|
|
10479
10751
|
style: {
|
|
10480
10752
|
top: 0,
|
|
@@ -10528,7 +10800,7 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
|
|
|
10528
10800
|
} = props;
|
|
10529
10801
|
const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
|
|
10530
10802
|
const [scrollbar, setScrollbar] = t.useState(null);
|
|
10531
|
-
const
|
|
10803
|
+
const composeRefs3 = useComposedRefs2(forwardedRef, (node) => setScrollbar(node));
|
|
10532
10804
|
const rectRef = t.useRef(null);
|
|
10533
10805
|
const prevWebkitUserSelectRef = t.useRef("");
|
|
10534
10806
|
const viewport = context.viewport;
|
|
@@ -10567,12 +10839,12 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
|
|
|
10567
10839
|
onThumbPositionChange: handleThumbPositionChange,
|
|
10568
10840
|
onThumbPointerDown: useCallbackRef(onThumbPointerDown),
|
|
10569
10841
|
children: /* @__PURE__ */ jsx(
|
|
10570
|
-
|
|
10842
|
+
Primitive2.div,
|
|
10571
10843
|
{
|
|
10572
10844
|
...scrollbarProps,
|
|
10573
|
-
ref:
|
|
10845
|
+
ref: composeRefs3,
|
|
10574
10846
|
style: { position: "absolute", ...scrollbarProps.style },
|
|
10575
|
-
onPointerDown:
|
|
10847
|
+
onPointerDown: composeEventHandlers2(props.onPointerDown, (event) => {
|
|
10576
10848
|
const mainPointer = 0;
|
|
10577
10849
|
if (event.button === mainPointer) {
|
|
10578
10850
|
const element = event.target;
|
|
@@ -10585,8 +10857,8 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
|
|
|
10585
10857
|
handleDragScroll(event);
|
|
10586
10858
|
}
|
|
10587
10859
|
}),
|
|
10588
|
-
onPointerMove:
|
|
10589
|
-
onPointerUp:
|
|
10860
|
+
onPointerMove: composeEventHandlers2(props.onPointerMove, handleDragScroll),
|
|
10861
|
+
onPointerUp: composeEventHandlers2(props.onPointerUp, (event) => {
|
|
10590
10862
|
const element = event.target;
|
|
10591
10863
|
if (element.hasPointerCapture(event.pointerId)) {
|
|
10592
10864
|
element.releasePointerCapture(event.pointerId);
|
|
@@ -10606,7 +10878,7 @@ var ScrollAreaThumb = t.forwardRef(
|
|
|
10606
10878
|
(props, forwardedRef) => {
|
|
10607
10879
|
const { forceMount, ...thumbProps } = props;
|
|
10608
10880
|
const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
|
|
10609
|
-
return /* @__PURE__ */ jsx(
|
|
10881
|
+
return /* @__PURE__ */ jsx(Presence2, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
|
|
10610
10882
|
}
|
|
10611
10883
|
);
|
|
10612
10884
|
var ScrollAreaThumbImpl = t.forwardRef(
|
|
@@ -10615,7 +10887,7 @@ var ScrollAreaThumbImpl = t.forwardRef(
|
|
|
10615
10887
|
const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
|
|
10616
10888
|
const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
|
|
10617
10889
|
const { onThumbPositionChange } = scrollbarContext;
|
|
10618
|
-
const composedRef =
|
|
10890
|
+
const composedRef = useComposedRefs2(
|
|
10619
10891
|
forwardedRef,
|
|
10620
10892
|
(node) => scrollbarContext.onThumbChange(node)
|
|
10621
10893
|
);
|
|
@@ -10643,7 +10915,7 @@ var ScrollAreaThumbImpl = t.forwardRef(
|
|
|
10643
10915
|
}
|
|
10644
10916
|
}, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
|
|
10645
10917
|
return /* @__PURE__ */ jsx(
|
|
10646
|
-
|
|
10918
|
+
Primitive2.div,
|
|
10647
10919
|
{
|
|
10648
10920
|
"data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
|
|
10649
10921
|
...thumbProps,
|
|
@@ -10653,14 +10925,14 @@ var ScrollAreaThumbImpl = t.forwardRef(
|
|
|
10653
10925
|
height: "var(--radix-scroll-area-thumb-height)",
|
|
10654
10926
|
...style
|
|
10655
10927
|
},
|
|
10656
|
-
onPointerDownCapture:
|
|
10928
|
+
onPointerDownCapture: composeEventHandlers2(props.onPointerDownCapture, (event) => {
|
|
10657
10929
|
const thumb = event.target;
|
|
10658
10930
|
const thumbRect = thumb.getBoundingClientRect();
|
|
10659
10931
|
const x = event.clientX - thumbRect.left;
|
|
10660
10932
|
const y = event.clientY - thumbRect.top;
|
|
10661
10933
|
scrollbarContext.onThumbPointerDown({ x, y });
|
|
10662
10934
|
}),
|
|
10663
|
-
onPointerUp:
|
|
10935
|
+
onPointerUp: composeEventHandlers2(props.onPointerUp, scrollbarContext.onThumbPointerUp)
|
|
10664
10936
|
}
|
|
10665
10937
|
);
|
|
10666
10938
|
}
|
|
@@ -10693,7 +10965,7 @@ var ScrollAreaCornerImpl = t.forwardRef((props, forwardedRef) => {
|
|
|
10693
10965
|
setWidth(width2);
|
|
10694
10966
|
});
|
|
10695
10967
|
return hasSize ? /* @__PURE__ */ jsx(
|
|
10696
|
-
|
|
10968
|
+
Primitive2.div,
|
|
10697
10969
|
{
|
|
10698
10970
|
...cornerProps,
|
|
10699
10971
|
ref: forwardedRef,
|
|
@@ -10782,7 +11054,7 @@ function useDebounceCallback(callback, delay) {
|
|
|
10782
11054
|
}
|
|
10783
11055
|
function useResizeObserver(element, onResize) {
|
|
10784
11056
|
const handleResize = useCallbackRef(onResize);
|
|
10785
|
-
|
|
11057
|
+
useLayoutEffect22(() => {
|
|
10786
11058
|
let rAF = 0;
|
|
10787
11059
|
if (element) {
|
|
10788
11060
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -10950,17 +11222,81 @@ var Separator3 = t.forwardRef(
|
|
|
10950
11222
|
)
|
|
10951
11223
|
);
|
|
10952
11224
|
Separator3.displayName = SeparatorPrimitive.Root.displayName;
|
|
11225
|
+
var useInsertionEffect2 = t[" useInsertionEffect ".trim().toString()] || useLayoutEffect22;
|
|
11226
|
+
function useControllableState2({
|
|
11227
|
+
prop,
|
|
11228
|
+
defaultProp,
|
|
11229
|
+
onChange = () => {
|
|
11230
|
+
},
|
|
11231
|
+
caller
|
|
11232
|
+
}) {
|
|
11233
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState2({
|
|
11234
|
+
defaultProp,
|
|
11235
|
+
onChange
|
|
11236
|
+
});
|
|
11237
|
+
const isControlled = prop !== void 0;
|
|
11238
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
11239
|
+
{
|
|
11240
|
+
const isControlledRef = t.useRef(prop !== void 0);
|
|
11241
|
+
t.useEffect(() => {
|
|
11242
|
+
const wasControlled = isControlledRef.current;
|
|
11243
|
+
if (wasControlled !== isControlled) {
|
|
11244
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
11245
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
11246
|
+
console.warn(
|
|
11247
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
11248
|
+
);
|
|
11249
|
+
}
|
|
11250
|
+
isControlledRef.current = isControlled;
|
|
11251
|
+
}, [isControlled, caller]);
|
|
11252
|
+
}
|
|
11253
|
+
const setValue = t.useCallback(
|
|
11254
|
+
(nextValue) => {
|
|
11255
|
+
if (isControlled) {
|
|
11256
|
+
const value2 = isFunction3(nextValue) ? nextValue(prop) : nextValue;
|
|
11257
|
+
if (value2 !== prop) {
|
|
11258
|
+
onChangeRef.current?.(value2);
|
|
11259
|
+
}
|
|
11260
|
+
} else {
|
|
11261
|
+
setUncontrolledProp(nextValue);
|
|
11262
|
+
}
|
|
11263
|
+
},
|
|
11264
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
11265
|
+
);
|
|
11266
|
+
return [value, setValue];
|
|
11267
|
+
}
|
|
11268
|
+
function useUncontrolledState2({
|
|
11269
|
+
defaultProp,
|
|
11270
|
+
onChange
|
|
11271
|
+
}) {
|
|
11272
|
+
const [value, setValue] = t.useState(defaultProp);
|
|
11273
|
+
const prevValueRef = t.useRef(value);
|
|
11274
|
+
const onChangeRef = t.useRef(onChange);
|
|
11275
|
+
useInsertionEffect2(() => {
|
|
11276
|
+
onChangeRef.current = onChange;
|
|
11277
|
+
}, [onChange]);
|
|
11278
|
+
t.useEffect(() => {
|
|
11279
|
+
if (prevValueRef.current !== value) {
|
|
11280
|
+
onChangeRef.current?.(value);
|
|
11281
|
+
prevValueRef.current = value;
|
|
11282
|
+
}
|
|
11283
|
+
}, [value, prevValueRef]);
|
|
11284
|
+
return [value, setValue, onChangeRef];
|
|
11285
|
+
}
|
|
11286
|
+
function isFunction3(value) {
|
|
11287
|
+
return typeof value === "function";
|
|
11288
|
+
}
|
|
10953
11289
|
var NAME = "Toggle";
|
|
10954
11290
|
var Toggle = t.forwardRef((props, forwardedRef) => {
|
|
10955
11291
|
const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
|
|
10956
|
-
const [pressed, setPressed] =
|
|
11292
|
+
const [pressed, setPressed] = useControllableState2({
|
|
10957
11293
|
prop: pressedProp,
|
|
10958
11294
|
onChange: onPressedChange,
|
|
10959
11295
|
defaultProp: defaultPressed ?? false,
|
|
10960
11296
|
caller: NAME
|
|
10961
11297
|
});
|
|
10962
11298
|
return /* @__PURE__ */ jsx(
|
|
10963
|
-
|
|
11299
|
+
Primitive2.button,
|
|
10964
11300
|
{
|
|
10965
11301
|
type: "button",
|
|
10966
11302
|
"aria-pressed": pressed,
|
|
@@ -10968,7 +11304,7 @@ var Toggle = t.forwardRef((props, forwardedRef) => {
|
|
|
10968
11304
|
"data-disabled": props.disabled ? "" : void 0,
|
|
10969
11305
|
...buttonProps,
|
|
10970
11306
|
ref: forwardedRef,
|
|
10971
|
-
onClick:
|
|
11307
|
+
onClick: composeEventHandlers2(props.onClick, () => {
|
|
10972
11308
|
if (!props.disabled) {
|
|
10973
11309
|
setPressed(!pressed);
|
|
10974
11310
|
}
|
|
@@ -11654,7 +11990,7 @@ var SimpleEditor = t__default.forwardRef(
|
|
|
11654
11990
|
);
|
|
11655
11991
|
SimpleEditor.displayName = "SimpleEditor";
|
|
11656
11992
|
var CharacterCount = ({ content }) => {
|
|
11657
|
-
const [
|
|
11993
|
+
const [count4, setCount] = useState(0);
|
|
11658
11994
|
useEffect(() => {
|
|
11659
11995
|
const getPlainText = (html) => {
|
|
11660
11996
|
const div = document.createElement("div");
|
|
@@ -11664,7 +12000,7 @@ var CharacterCount = ({ content }) => {
|
|
|
11664
12000
|
setCount(getPlainText(content).length);
|
|
11665
12001
|
}, [content]);
|
|
11666
12002
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11667
|
-
|
|
12003
|
+
count4,
|
|
11668
12004
|
" characters"
|
|
11669
12005
|
] });
|
|
11670
12006
|
};
|