qstd 0.2.7 → 0.2.8
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/CHANGELOG.md +15 -1
- package/dist/client/index.cjs +11 -11
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +11 -11
- package/dist/{log-DPBPow2d.d.cts → log-TRYALTmf.d.cts} +5 -5
- package/dist/{log-DPBPow2d.d.ts → log-TRYALTmf.d.ts} +5 -5
- package/dist/preset/index.cjs +7 -5
- package/dist/preset/index.js +7 -5
- package/dist/react/index.cjs +163 -159
- package/dist/react/index.css +5 -8
- package/dist/react/index.d.cts +17 -12
- package/dist/react/index.d.ts +17 -12
- package/dist/react/index.js +159 -155
- package/dist/server/index.cjs +11 -11
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +11 -11
- package/package.json +9 -6
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as React12 from 'react';
|
|
3
|
+
import React12__default, { forwardRef, useMemo, createElement } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { motion, MotionConfig, LayoutGroup, AnimatePresence, useDragControls, useMotionValue } from 'framer-motion';
|
|
6
6
|
import { useFloating, offset, flip, shift, hide, autoUpdate, FloatingPortal, arrow, useHover, safePolygon, useFocus, useDismiss, useRole, useInteractions } from '@floating-ui/react';
|
|
@@ -8,11 +8,11 @@ import { BeatLoader } from 'react-spinners';
|
|
|
8
8
|
import { Oval, ThreeDots, TailSpin, RotatingLines } from 'react-loader-spinner';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { nanoid } from 'nanoid';
|
|
11
|
+
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
11
12
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
12
13
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
13
14
|
import { far } from '@fortawesome/free-regular-svg-icons';
|
|
14
15
|
import { fab } from '@fortawesome/free-brands-svg-icons';
|
|
15
|
-
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
16
16
|
import { useImmer } from 'use-immer';
|
|
17
17
|
|
|
18
18
|
// src/react/index.ts
|
|
@@ -607,14 +607,14 @@ function Menu(props) {
|
|
|
607
607
|
trigger,
|
|
608
608
|
...rest
|
|
609
609
|
} = props;
|
|
610
|
-
const hoverTimeoutRef =
|
|
611
|
-
const [isOpen, setOpen] =
|
|
610
|
+
const hoverTimeoutRef = React12__default.useRef(null);
|
|
611
|
+
const [isOpen, setOpen] = React12__default.useState(isOpenControlled ?? false);
|
|
612
612
|
const onOpenChange = (open) => {
|
|
613
613
|
const newOpenState = typeof open === "function" ? open(isOpen) : open;
|
|
614
614
|
props.onOpenOrClose?.(newOpenState);
|
|
615
615
|
setOpen(newOpenState);
|
|
616
616
|
};
|
|
617
|
-
|
|
617
|
+
React12__default.useEffect(() => {
|
|
618
618
|
if (typeof isOpenControlled !== "boolean") return;
|
|
619
619
|
setOpen(isOpenControlled);
|
|
620
620
|
}, [isOpenControlled]);
|
|
@@ -630,7 +630,10 @@ function Menu(props) {
|
|
|
630
630
|
open: isOpen,
|
|
631
631
|
onOpenChange,
|
|
632
632
|
middleware: [
|
|
633
|
-
offset({
|
|
633
|
+
offset({
|
|
634
|
+
...props.offset?.x !== void 0 && { crossAxis: props.offset.x },
|
|
635
|
+
...props.offset?.y !== void 0 && { mainAxis: props.offset.y }
|
|
636
|
+
}),
|
|
634
637
|
flip({ fallbackPlacements: ["top-end"] }),
|
|
635
638
|
shift({ padding: 5 }),
|
|
636
639
|
hide({ strategy: "referenceHidden" })
|
|
@@ -686,11 +689,11 @@ function Menu(props) {
|
|
|
686
689
|
},
|
|
687
690
|
isOpen
|
|
688
691
|
);
|
|
689
|
-
|
|
692
|
+
React12__default.useEffect(() => {
|
|
690
693
|
if (!hideData?.referenceHidden) return;
|
|
691
694
|
closeMenuImmediate();
|
|
692
695
|
}, [hideData, closeMenuImmediate]);
|
|
693
|
-
|
|
696
|
+
React12__default.useEffect(() => {
|
|
694
697
|
return () => {
|
|
695
698
|
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
696
699
|
};
|
|
@@ -716,10 +719,10 @@ function Menu(props) {
|
|
|
716
719
|
onMouseLeave: handleMenuMouseLeave
|
|
717
720
|
} : {};
|
|
718
721
|
const transformOrigin = floatingContext.placement.startsWith("top") ? "bottom left" : "top left";
|
|
719
|
-
const childArray =
|
|
722
|
+
const childArray = React12__default.Children.toArray(children);
|
|
720
723
|
let customContainerEl = null;
|
|
721
724
|
for (const c of childArray) {
|
|
722
|
-
if (
|
|
725
|
+
if (React12__default.isValidElement(c)) {
|
|
723
726
|
const anyType = c.type;
|
|
724
727
|
if (c.props?.["data-menu-container"] || anyType?.isBlockMenuContainer) {
|
|
725
728
|
customContainerEl = c;
|
|
@@ -748,7 +751,7 @@ function Menu(props) {
|
|
|
748
751
|
...restStyle || {}
|
|
749
752
|
};
|
|
750
753
|
const mergedClassName = [defaultsClassName, childProps.className].filter(Boolean).join(" ");
|
|
751
|
-
const contentNode =
|
|
754
|
+
const contentNode = React12__default.cloneElement(
|
|
752
755
|
customContainerEl,
|
|
753
756
|
{
|
|
754
757
|
// Defaults are now in mergedClassName via css()
|
|
@@ -834,7 +837,7 @@ function Menu(props) {
|
|
|
834
837
|
);
|
|
835
838
|
}
|
|
836
839
|
function useOutsideClick(ref, handler, enabled = true) {
|
|
837
|
-
|
|
840
|
+
React12__default.useEffect(() => {
|
|
838
841
|
if (!enabled) return;
|
|
839
842
|
const listener = (event) => {
|
|
840
843
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
@@ -941,9 +944,9 @@ var prepareFiles = async (acceptedFiles) => {
|
|
|
941
944
|
);
|
|
942
945
|
};
|
|
943
946
|
var findChildrenByDisplayName = (children, displayName2) => {
|
|
944
|
-
return
|
|
947
|
+
return React12__default.Children.toArray(children).find(
|
|
945
948
|
(child) => {
|
|
946
|
-
if (
|
|
949
|
+
if (React12__default.isValidElement(child)) {
|
|
947
950
|
const childType = child.type;
|
|
948
951
|
return childType.displayName === displayName2;
|
|
949
952
|
} else {
|
|
@@ -1076,7 +1079,7 @@ function getIcon(position, Icon2, props) {
|
|
|
1076
1079
|
const Cmp = loadingIconsMap[chosen];
|
|
1077
1080
|
const sizePx = typeof loadingIconSize === "number" ? `${loadingIconSize}px` : "12px";
|
|
1078
1081
|
return Cmp({ width: sizePx, height: sizePx });
|
|
1079
|
-
} else if (
|
|
1082
|
+
} else if (React12__default.isValidElement(chosen)) {
|
|
1080
1083
|
return chosen;
|
|
1081
1084
|
} else if (typeof chosen === "function") {
|
|
1082
1085
|
return chosen();
|
|
@@ -1172,9 +1175,9 @@ var TrackNameKey = "Track";
|
|
|
1172
1175
|
var ThumbNameKey = "Thumb";
|
|
1173
1176
|
var Button = motionTags.button;
|
|
1174
1177
|
var Base = motionTags.div;
|
|
1175
|
-
var SwitchContext =
|
|
1178
|
+
var SwitchContext = React12__default.createContext(null);
|
|
1176
1179
|
var useSwitchContext = () => {
|
|
1177
|
-
const context2 =
|
|
1180
|
+
const context2 = React12__default.useContext(SwitchContext);
|
|
1178
1181
|
if (!context2) {
|
|
1179
1182
|
throw new Error("Switch compound components must be used within Switch");
|
|
1180
1183
|
}
|
|
@@ -1190,16 +1193,16 @@ function Switch(props) {
|
|
|
1190
1193
|
_motion,
|
|
1191
1194
|
...rest
|
|
1192
1195
|
} = props;
|
|
1193
|
-
const [x, setX] =
|
|
1194
|
-
const [pressed, setPressed] =
|
|
1195
|
-
const [growThumb, setGrowThumb] =
|
|
1196
|
+
const [x, setX] = React12__default.useState(0);
|
|
1197
|
+
const [pressed, setPressed] = React12__default.useState(false);
|
|
1198
|
+
const [growThumb, setGrowThumb] = React12__default.useState(false);
|
|
1196
1199
|
const borderWidth = 4;
|
|
1197
1200
|
const trackWidth = thumbSize * 1.5;
|
|
1198
1201
|
const borderRadius = thumbSize * 2.5;
|
|
1199
1202
|
const xWhileOn = thumbSize;
|
|
1200
1203
|
const checkedPosition = xWhileOn * 0.5;
|
|
1201
1204
|
const stopwatch = useStopwatch();
|
|
1202
|
-
|
|
1205
|
+
React12__default.useEffect(() => {
|
|
1203
1206
|
if (pressed && !disabled) {
|
|
1204
1207
|
stopwatch.start();
|
|
1205
1208
|
} else {
|
|
@@ -1207,12 +1210,12 @@ function Switch(props) {
|
|
|
1207
1210
|
stopwatch.clear();
|
|
1208
1211
|
}
|
|
1209
1212
|
}, [pressed, disabled]);
|
|
1210
|
-
|
|
1213
|
+
React12__default.useEffect(() => {
|
|
1211
1214
|
if (stopwatch.time > 200) {
|
|
1212
1215
|
setGrowThumb(true);
|
|
1213
1216
|
}
|
|
1214
1217
|
}, [stopwatch.time]);
|
|
1215
|
-
|
|
1218
|
+
React12__default.useEffect(() => {
|
|
1216
1219
|
setX(checked ? checkedPosition : 0);
|
|
1217
1220
|
}, [checked, checkedPosition]);
|
|
1218
1221
|
const toggle = () => {
|
|
@@ -1277,10 +1280,10 @@ function Switch(props) {
|
|
|
1277
1280
|
children,
|
|
1278
1281
|
ThumbNameKey
|
|
1279
1282
|
);
|
|
1280
|
-
const trackElement = track ?
|
|
1283
|
+
const trackElement = track ? React12__default.cloneElement(track, {
|
|
1281
1284
|
_motion,
|
|
1282
|
-
children: thumb ?
|
|
1283
|
-
}) : /* @__PURE__ */ jsx(Track, { _motion, children: thumb ?
|
|
1285
|
+
children: thumb ? React12__default.cloneElement(thumb, { _motion }) : /* @__PURE__ */ jsx(Thumb, { _motion })
|
|
1286
|
+
}) : /* @__PURE__ */ jsx(Track, { _motion, children: thumb ? React12__default.cloneElement(thumb, { _motion }) : /* @__PURE__ */ jsx(Thumb, { _motion }) });
|
|
1284
1287
|
return /* @__PURE__ */ jsx(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsx(
|
|
1285
1288
|
Button,
|
|
1286
1289
|
{
|
|
@@ -1405,10 +1408,10 @@ function Thumb(props) {
|
|
|
1405
1408
|
Track.displayName = TrackNameKey;
|
|
1406
1409
|
Thumb.displayName = ThumbNameKey;
|
|
1407
1410
|
function useStopwatch(props = {}) {
|
|
1408
|
-
const [active, setActive] =
|
|
1409
|
-
const [time, setTime] =
|
|
1411
|
+
const [active, setActive] = React12__default.useState(false);
|
|
1412
|
+
const [time, setTime] = React12__default.useState(0);
|
|
1410
1413
|
const timeInterval = props?.interval ?? 10;
|
|
1411
|
-
|
|
1414
|
+
React12__default.useEffect(() => {
|
|
1412
1415
|
let interval = null;
|
|
1413
1416
|
if (active) {
|
|
1414
1417
|
interval = setInterval(() => {
|
|
@@ -1428,7 +1431,7 @@ function useStopwatch(props = {}) {
|
|
|
1428
1431
|
return { time, start, stop, clear };
|
|
1429
1432
|
}
|
|
1430
1433
|
var switch_default = Switch;
|
|
1431
|
-
var RadioContext =
|
|
1434
|
+
var RadioContext = React12__default.createContext(null);
|
|
1432
1435
|
var Base2 = base;
|
|
1433
1436
|
var MotionDiv2 = motionTags.div;
|
|
1434
1437
|
function Radio(props) {
|
|
@@ -1443,14 +1446,14 @@ function Radio(props) {
|
|
|
1443
1446
|
onKeyDown: onKeyDownProp,
|
|
1444
1447
|
...rest
|
|
1445
1448
|
} = props;
|
|
1446
|
-
const groupId =
|
|
1449
|
+
const groupId = React12__default.useId();
|
|
1447
1450
|
const isControlled = controlledValue !== void 0;
|
|
1448
|
-
const [uncontrolled, setUncontrolled] =
|
|
1451
|
+
const [uncontrolled, setUncontrolled] = React12__default.useState(
|
|
1449
1452
|
defaultValue
|
|
1450
1453
|
);
|
|
1451
1454
|
const selectedValue = isControlled ? controlledValue : uncontrolled;
|
|
1452
|
-
const itemsRef =
|
|
1453
|
-
const [activeId, setActiveId] =
|
|
1455
|
+
const itemsRef = React12__default.useRef([]);
|
|
1456
|
+
const [activeId, setActiveId] = React12__default.useState("");
|
|
1454
1457
|
const setSelectedValue = (val) => {
|
|
1455
1458
|
if (!isControlled) setUncontrolled(val);
|
|
1456
1459
|
onChange?.(val);
|
|
@@ -1503,7 +1506,7 @@ function Radio(props) {
|
|
|
1503
1506
|
setActiveId(found.id);
|
|
1504
1507
|
}
|
|
1505
1508
|
};
|
|
1506
|
-
|
|
1509
|
+
React12__default.useEffect(() => {
|
|
1507
1510
|
if (!selectedValue) return;
|
|
1508
1511
|
const selected = itemsRef.current.find((x) => x.value === selectedValue);
|
|
1509
1512
|
if (selected && !selected.disabled) setActiveId(selected.id);
|
|
@@ -1544,7 +1547,7 @@ function Radio(props) {
|
|
|
1544
1547
|
},
|
|
1545
1548
|
children: [
|
|
1546
1549
|
(options ?? []).map(
|
|
1547
|
-
(opt) => renderOption ? /* @__PURE__ */ jsx(
|
|
1550
|
+
(opt) => renderOption ? /* @__PURE__ */ jsx(React12__default.Fragment, { children: renderOption(opt) }, opt.value) : /* @__PURE__ */ jsx(
|
|
1548
1551
|
Item,
|
|
1549
1552
|
{
|
|
1550
1553
|
value: opt.value,
|
|
@@ -1574,7 +1577,7 @@ function Item(props) {
|
|
|
1574
1577
|
onBlur: onBlurProp,
|
|
1575
1578
|
...rest
|
|
1576
1579
|
} = props;
|
|
1577
|
-
const ctx =
|
|
1580
|
+
const ctx = React12__default.useContext(RadioContext);
|
|
1578
1581
|
if (!ctx) {
|
|
1579
1582
|
return /* @__PURE__ */ jsxs(Base2, { flex: true, alignI: true, cursor: "pointer", ...rest, children: [
|
|
1580
1583
|
/* @__PURE__ */ jsx(Base2, { "data-radio-circle": true, w: 24, h: 24, br: 9999, mr: 8 }),
|
|
@@ -1593,22 +1596,22 @@ function Item(props) {
|
|
|
1593
1596
|
} = ctx;
|
|
1594
1597
|
const disabled = !!(groupDisabled || itemDisabled);
|
|
1595
1598
|
const id = `radio-item-${groupId}-${value}`;
|
|
1596
|
-
const ref =
|
|
1597
|
-
|
|
1599
|
+
const ref = React12__default.useRef(null);
|
|
1600
|
+
React12__default.useEffect(() => {
|
|
1598
1601
|
registerItem({ id, value, disabled, ref });
|
|
1599
1602
|
return () => unregisterItem(id);
|
|
1600
1603
|
}, [id, value, disabled]);
|
|
1601
1604
|
const isSelected = selectedValue === value;
|
|
1602
1605
|
const isActive = isActiveId(id);
|
|
1603
|
-
const [isFocused, setIsFocused] =
|
|
1606
|
+
const [isFocused, setIsFocused] = React12__default.useState(false);
|
|
1604
1607
|
const shouldUseGrid = gridProp || !!colsProp;
|
|
1605
1608
|
const renderLabel = () => {
|
|
1606
|
-
const onlyChild =
|
|
1609
|
+
const onlyChild = React12__default.Children.count(children) === 1 ? React12__default.Children.toArray(children)[0] : null;
|
|
1607
1610
|
if (typeof onlyChild === "string") {
|
|
1608
1611
|
return /* @__PURE__ */ jsx(Base2, { "data-radio-label": true, children: onlyChild });
|
|
1609
1612
|
}
|
|
1610
|
-
if (
|
|
1611
|
-
return
|
|
1613
|
+
if (React12__default.isValidElement(onlyChild)) {
|
|
1614
|
+
return React12__default.cloneElement(
|
|
1612
1615
|
onlyChild,
|
|
1613
1616
|
{
|
|
1614
1617
|
...onlyChild.props || {},
|
|
@@ -1728,7 +1731,7 @@ function Item(props) {
|
|
|
1728
1731
|
var LabelNameKey = "Label";
|
|
1729
1732
|
var Base3 = base;
|
|
1730
1733
|
var isBrowser = typeof window !== "undefined";
|
|
1731
|
-
var useIsomorphicLayoutEffect = isBrowser ?
|
|
1734
|
+
var useIsomorphicLayoutEffect = isBrowser ? React12__default.useLayoutEffect : React12__default.useEffect;
|
|
1732
1735
|
function pick(props, obj) {
|
|
1733
1736
|
return props.reduce(
|
|
1734
1737
|
(acc, prop) => {
|
|
@@ -1860,16 +1863,16 @@ function Textarea(props) {
|
|
|
1860
1863
|
...rest
|
|
1861
1864
|
} = props;
|
|
1862
1865
|
const isControlled = rest.value !== void 0;
|
|
1863
|
-
const libRef =
|
|
1866
|
+
const libRef = React12__default.useRef(null);
|
|
1864
1867
|
const ref = assignRefs(libRef, userRef);
|
|
1865
|
-
const heightRef =
|
|
1866
|
-
const [_value, _setValue] =
|
|
1868
|
+
const heightRef = React12__default.useRef(0);
|
|
1869
|
+
const [_value, _setValue] = React12__default.useState("");
|
|
1867
1870
|
const value = props.value ?? _value;
|
|
1868
1871
|
const label = findChildrenByDisplayName(
|
|
1869
1872
|
children,
|
|
1870
1873
|
LabelNameKey
|
|
1871
1874
|
);
|
|
1872
|
-
const labelWithProps = label ?
|
|
1875
|
+
const labelWithProps = label ? React12__default.cloneElement(label, {
|
|
1873
1876
|
required: props.required,
|
|
1874
1877
|
value: props.value,
|
|
1875
1878
|
error
|
|
@@ -1900,20 +1903,20 @@ function Textarea(props) {
|
|
|
1900
1903
|
useIsomorphicLayoutEffect(() => {
|
|
1901
1904
|
resizeTextarea();
|
|
1902
1905
|
}, [rest.value, rest.placeholder, minRows, maxRows]);
|
|
1903
|
-
|
|
1906
|
+
React12__default.useEffect(() => {
|
|
1904
1907
|
if (!isBrowser) return;
|
|
1905
1908
|
const onResize = () => resizeTextarea();
|
|
1906
1909
|
window.addEventListener("resize", onResize);
|
|
1907
1910
|
return () => window.removeEventListener("resize", onResize);
|
|
1908
1911
|
}, [minRows, maxRows, rest.placeholder, rest.value]);
|
|
1909
|
-
|
|
1912
|
+
React12__default.useEffect(() => {
|
|
1910
1913
|
const fonts = isBrowser ? document.fonts : void 0;
|
|
1911
1914
|
if (!fonts || typeof fonts.addEventListener !== "function") return;
|
|
1912
1915
|
const onFontsLoaded = () => resizeTextarea();
|
|
1913
1916
|
fonts.addEventListener("loadingdone", onFontsLoaded);
|
|
1914
1917
|
return () => fonts.removeEventListener("loadingdone", onFontsLoaded);
|
|
1915
1918
|
}, [minRows, maxRows, rest.placeholder, rest.value]);
|
|
1916
|
-
|
|
1919
|
+
React12__default.useEffect(() => {
|
|
1917
1920
|
const node = libRef.current;
|
|
1918
1921
|
const form = node?.form;
|
|
1919
1922
|
if (!node || !form || isControlled) return;
|
|
@@ -1930,7 +1933,7 @@ function Textarea(props) {
|
|
|
1930
1933
|
return /* @__PURE__ */ jsxs(Base3, { grid: true, rows: "/ 4", children: [
|
|
1931
1934
|
/* @__PURE__ */ jsxs(Base3, { grid: true, relative: true, children: [
|
|
1932
1935
|
labelWithProps,
|
|
1933
|
-
/* @__PURE__ */ jsx(MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsx(
|
|
1936
|
+
/* @__PURE__ */ jsx(MotionConfig, { ..._motion && { transition: _motion }, children: /* @__PURE__ */ jsx(
|
|
1934
1937
|
Txtarea,
|
|
1935
1938
|
{
|
|
1936
1939
|
ref,
|
|
@@ -2065,13 +2068,13 @@ function Input(props) {
|
|
|
2065
2068
|
children,
|
|
2066
2069
|
RightSideNameKey
|
|
2067
2070
|
);
|
|
2068
|
-
const labelWithProps = label ?
|
|
2071
|
+
const labelWithProps = label ? React12__default.cloneElement(label, {
|
|
2069
2072
|
hasLeftIcon: !!leftIcon,
|
|
2070
2073
|
required: props.required,
|
|
2071
2074
|
value: props.value,
|
|
2072
2075
|
error
|
|
2073
2076
|
}) : null;
|
|
2074
|
-
const rightSideWithProps = rightSide ?
|
|
2077
|
+
const rightSideWithProps = rightSide ? React12__default.cloneElement(rightSide, {
|
|
2075
2078
|
onChange: props.onChange,
|
|
2076
2079
|
value: props.value
|
|
2077
2080
|
}) : null;
|
|
@@ -2196,27 +2199,27 @@ function Label2(props) {
|
|
|
2196
2199
|
Label2.displayName = LabelNameKey2;
|
|
2197
2200
|
function useResizeObserver(opts = {}) {
|
|
2198
2201
|
const onResize = opts.onResize;
|
|
2199
|
-
const onResizeRef =
|
|
2202
|
+
const onResizeRef = React12__default.useRef(void 0);
|
|
2200
2203
|
onResizeRef.current = onResize;
|
|
2201
2204
|
const round = opts.round || Math.round;
|
|
2202
|
-
const resizeObserverRef =
|
|
2203
|
-
const [size, setSize] =
|
|
2205
|
+
const resizeObserverRef = React12__default.useRef(null);
|
|
2206
|
+
const [size, setSize] = React12__default.useState({
|
|
2204
2207
|
width: void 0,
|
|
2205
2208
|
height: void 0
|
|
2206
2209
|
});
|
|
2207
|
-
const didUnmount =
|
|
2208
|
-
|
|
2210
|
+
const didUnmount = React12__default.useRef(false);
|
|
2211
|
+
React12__default.useEffect(() => {
|
|
2209
2212
|
didUnmount.current = false;
|
|
2210
2213
|
return () => {
|
|
2211
2214
|
didUnmount.current = true;
|
|
2212
2215
|
};
|
|
2213
2216
|
}, []);
|
|
2214
|
-
const previous =
|
|
2217
|
+
const previous = React12__default.useRef({
|
|
2215
2218
|
width: void 0,
|
|
2216
2219
|
height: void 0
|
|
2217
2220
|
});
|
|
2218
2221
|
const refCallback = useResolvedElement(
|
|
2219
|
-
|
|
2222
|
+
React12__default.useCallback(
|
|
2220
2223
|
(element) => {
|
|
2221
2224
|
if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) {
|
|
2222
2225
|
resizeObserverRef.current = {
|
|
@@ -2255,7 +2258,7 @@ function useResizeObserver(opts = {}) {
|
|
|
2255
2258
|
),
|
|
2256
2259
|
opts.ref
|
|
2257
2260
|
);
|
|
2258
|
-
return
|
|
2261
|
+
return React12__default.useMemo(
|
|
2259
2262
|
() => ({
|
|
2260
2263
|
ref: refCallback,
|
|
2261
2264
|
width: size.width,
|
|
@@ -2267,14 +2270,14 @@ function useResizeObserver(opts = {}) {
|
|
|
2267
2270
|
);
|
|
2268
2271
|
}
|
|
2269
2272
|
function useResolvedElement(subscriber, refOrElement) {
|
|
2270
|
-
const lastReportRef =
|
|
2271
|
-
const refOrElementRef =
|
|
2273
|
+
const lastReportRef = React12__default.useRef(null);
|
|
2274
|
+
const refOrElementRef = React12__default.useRef(null);
|
|
2272
2275
|
refOrElementRef.current = refOrElement;
|
|
2273
|
-
const cbElementRef =
|
|
2274
|
-
|
|
2276
|
+
const cbElementRef = React12__default.useRef(null);
|
|
2277
|
+
React12__default.useEffect(() => {
|
|
2275
2278
|
evaluateSubscription();
|
|
2276
2279
|
});
|
|
2277
|
-
const evaluateSubscription =
|
|
2280
|
+
const evaluateSubscription = React12__default.useCallback(() => {
|
|
2278
2281
|
const cbElement = cbElementRef.current;
|
|
2279
2282
|
const refOrElement2 = refOrElementRef.current;
|
|
2280
2283
|
const element = cbElement ? cbElement : refOrElement2 ? refOrElement2 instanceof Element ? refOrElement2 : refOrElement2.current : null;
|
|
@@ -2292,7 +2295,7 @@ function useResolvedElement(subscriber, refOrElement) {
|
|
|
2292
2295
|
cleanup: element ? subscriber(element) : void 0
|
|
2293
2296
|
};
|
|
2294
2297
|
}, [subscriber]);
|
|
2295
|
-
|
|
2298
|
+
React12__default.useEffect(() => {
|
|
2296
2299
|
return () => {
|
|
2297
2300
|
if (lastReportRef.current && lastReportRef.current.cleanup) {
|
|
2298
2301
|
lastReportRef.current.cleanup();
|
|
@@ -2300,7 +2303,7 @@ function useResolvedElement(subscriber, refOrElement) {
|
|
|
2300
2303
|
}
|
|
2301
2304
|
};
|
|
2302
2305
|
}, []);
|
|
2303
|
-
return
|
|
2306
|
+
return React12__default.useCallback(
|
|
2304
2307
|
(element) => {
|
|
2305
2308
|
cbElementRef.current = element;
|
|
2306
2309
|
evaluateSubscription();
|
|
@@ -2326,7 +2329,7 @@ var use_resize_observer_default = useResizeObserver;
|
|
|
2326
2329
|
var MotionDiv3 = motionTags.div;
|
|
2327
2330
|
var MotionBtn = motionTags.button;
|
|
2328
2331
|
var displayName = "AccordionItem";
|
|
2329
|
-
var AccordionContext =
|
|
2332
|
+
var AccordionContext = React12__default.createContext({});
|
|
2330
2333
|
function AccordionProvider(props) {
|
|
2331
2334
|
const [state, setState] = useImmer({
|
|
2332
2335
|
allowMultiple: false,
|
|
@@ -2336,7 +2339,7 @@ function AccordionProvider(props) {
|
|
|
2336
2339
|
return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: { setState, state }, children: props.children });
|
|
2337
2340
|
}
|
|
2338
2341
|
function useAccordion() {
|
|
2339
|
-
const context2 =
|
|
2342
|
+
const context2 = React12__default.useContext(AccordionContext);
|
|
2340
2343
|
if (context2 === void 0) {
|
|
2341
2344
|
throw new Error("useAccordion must be used within a AccordionProvider");
|
|
2342
2345
|
}
|
|
@@ -2345,22 +2348,22 @@ function useAccordion() {
|
|
|
2345
2348
|
function AccordionComponent(props) {
|
|
2346
2349
|
const accordion = useAccordion();
|
|
2347
2350
|
const accordionState = accordion.state;
|
|
2348
|
-
|
|
2351
|
+
React12__default.useEffect(() => {
|
|
2349
2352
|
accordion.setState((draft) => {
|
|
2350
2353
|
draft.allowMultiple = !!props.allowMultiple;
|
|
2351
2354
|
draft.allowToggle = !!props.allowToggle;
|
|
2352
2355
|
});
|
|
2353
2356
|
}, [props.allowMultiple, props.allowToggle]);
|
|
2354
|
-
|
|
2357
|
+
React12__default.Children.forEach(props.children, (x) => {
|
|
2355
2358
|
if (typeof x.type === "function" && "displayName" in x.type && x.type.displayName !== displayName) {
|
|
2356
2359
|
throw new Error("Accordion can only have AccordionItems as children");
|
|
2357
2360
|
}
|
|
2358
2361
|
});
|
|
2359
|
-
const children =
|
|
2360
|
-
if (!
|
|
2361
|
-
return
|
|
2362
|
+
const children = React12__default.Children.map(props.children, (child, i) => {
|
|
2363
|
+
if (!React12__default.isValidElement(child)) return child;
|
|
2364
|
+
return React12__default.cloneElement(child, { idx: i });
|
|
2362
2365
|
});
|
|
2363
|
-
|
|
2366
|
+
React12__default.useEffect(() => {
|
|
2364
2367
|
if (accordionState.open.length === children.length) return;
|
|
2365
2368
|
const defaultOpenIdx = props.defaultOpenIdx;
|
|
2366
2369
|
const items = new Array(children.length).fill(null).map((x, i) => {
|
|
@@ -2467,10 +2470,10 @@ var MotionDiv4 = motionTags.div;
|
|
|
2467
2470
|
var MotionBtn2 = motionTags.button;
|
|
2468
2471
|
var breakpoint = ["(min-width: 600px)"];
|
|
2469
2472
|
function DrawerComponent(props) {
|
|
2470
|
-
const ref =
|
|
2471
|
-
const dragHandleRef =
|
|
2473
|
+
const ref = React12__default.useRef(null);
|
|
2474
|
+
const dragHandleRef = React12__default.useRef(null);
|
|
2472
2475
|
const [isDesktop] = useMatchMedia(breakpoint);
|
|
2473
|
-
const closeFnRef =
|
|
2476
|
+
const closeFnRef = React12__default.useRef(null);
|
|
2474
2477
|
const dragControls = useDragControls();
|
|
2475
2478
|
const { open, setOpen } = useDrawer();
|
|
2476
2479
|
const { onClose, ...rest } = props;
|
|
@@ -2481,10 +2484,12 @@ function DrawerComponent(props) {
|
|
|
2481
2484
|
setOpen(true);
|
|
2482
2485
|
};
|
|
2483
2486
|
const closeDrawer = () => setOpen(false);
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2487
|
+
React12__default.useEffect(() => {
|
|
2488
|
+
closeFnRef.current = () => {
|
|
2489
|
+
closeDrawer();
|
|
2490
|
+
onClose?.();
|
|
2491
|
+
};
|
|
2492
|
+
});
|
|
2488
2493
|
const onDragStart = (e, info) => {
|
|
2489
2494
|
console.log({ e });
|
|
2490
2495
|
if (isDesktop) return;
|
|
@@ -2492,16 +2497,18 @@ function DrawerComponent(props) {
|
|
|
2492
2497
|
if (!noDragEl || !noDragEl.contains(e.target)) {
|
|
2493
2498
|
dragControls.start(e);
|
|
2494
2499
|
} else {
|
|
2495
|
-
dragControls.componentControls.forEach(
|
|
2496
|
-
entry
|
|
2497
|
-
|
|
2500
|
+
dragControls.componentControls.forEach(
|
|
2501
|
+
(entry) => {
|
|
2502
|
+
entry.stop(e, info);
|
|
2503
|
+
}
|
|
2504
|
+
);
|
|
2498
2505
|
}
|
|
2499
2506
|
};
|
|
2500
|
-
|
|
2507
|
+
React12__default.useEffect(() => {
|
|
2501
2508
|
if (props.open) openDrawer();
|
|
2502
|
-
else closeFnRef.current();
|
|
2509
|
+
else closeFnRef.current?.();
|
|
2503
2510
|
}, [props.open]);
|
|
2504
|
-
|
|
2511
|
+
React12__default.useEffect(() => {
|
|
2505
2512
|
const container = ref.current;
|
|
2506
2513
|
if (!open || !container) return;
|
|
2507
2514
|
container.setAttribute("tabindex", "0");
|
|
@@ -2512,7 +2519,7 @@ function DrawerComponent(props) {
|
|
|
2512
2519
|
const closeOnEsc = (e) => {
|
|
2513
2520
|
if (e.key !== "Escape" || props.closeOnEsc === false) return;
|
|
2514
2521
|
console.log("[close] esc key");
|
|
2515
|
-
closeFnRef.current();
|
|
2522
|
+
closeFnRef.current?.();
|
|
2516
2523
|
};
|
|
2517
2524
|
container.addEventListener("focusout", trapFocus);
|
|
2518
2525
|
container.addEventListener("keydown", closeOnEsc);
|
|
@@ -2522,12 +2529,12 @@ function DrawerComponent(props) {
|
|
|
2522
2529
|
container.removeEventListener("keydown", closeOnEsc);
|
|
2523
2530
|
document.body.style.overflow = "auto";
|
|
2524
2531
|
};
|
|
2525
|
-
}, [open]);
|
|
2526
|
-
|
|
2532
|
+
}, [open, props.closeOnEsc]);
|
|
2533
|
+
React12__default.useEffect(() => {
|
|
2527
2534
|
const unsubscribeY = y.on("change", (latestY) => {
|
|
2528
2535
|
if (latestY > 150) {
|
|
2529
2536
|
console.log("[close] latestY > 150");
|
|
2530
|
-
closeFnRef.current();
|
|
2537
|
+
closeFnRef.current?.();
|
|
2531
2538
|
}
|
|
2532
2539
|
});
|
|
2533
2540
|
return () => {
|
|
@@ -2538,7 +2545,7 @@ function DrawerComponent(props) {
|
|
|
2538
2545
|
const outsideClickClose = props.outsideClickClose ?? true;
|
|
2539
2546
|
if (!outsideClickClose) return;
|
|
2540
2547
|
console.log("[close] clicked backdrop");
|
|
2541
|
-
closeFnRef.current();
|
|
2548
|
+
closeFnRef.current?.();
|
|
2542
2549
|
};
|
|
2543
2550
|
return createPortal(
|
|
2544
2551
|
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: open && /* @__PURE__ */ jsx(
|
|
@@ -2606,9 +2613,7 @@ function DrawerComponent(props) {
|
|
|
2606
2613
|
drag: "y",
|
|
2607
2614
|
style: { y },
|
|
2608
2615
|
dragControls,
|
|
2609
|
-
|
|
2610
|
-
onPointerDown: (...args) => onDragStart(args[0], args[1]),
|
|
2611
|
-
// onPointerDown: (x, y) => onDragStart(x, y),
|
|
2616
|
+
onPointerDown: (e) => onDragStart(e),
|
|
2612
2617
|
// drag={hasBackdrop ? "y" : false}
|
|
2613
2618
|
dragElastic: 0,
|
|
2614
2619
|
// prevent drawer from being dragged higher than what its opened to
|
|
@@ -2664,19 +2669,19 @@ function DrawerComponent(props) {
|
|
|
2664
2669
|
document.getElementById("portal")
|
|
2665
2670
|
);
|
|
2666
2671
|
}
|
|
2667
|
-
var DrawerContext =
|
|
2672
|
+
var DrawerContext = React12__default.createContext({
|
|
2668
2673
|
open: false,
|
|
2669
|
-
setOpen: (
|
|
2674
|
+
setOpen: () => {
|
|
2670
2675
|
return;
|
|
2671
2676
|
}
|
|
2672
2677
|
});
|
|
2673
2678
|
function DrawerProvider(props) {
|
|
2674
|
-
const [open, setOpen] =
|
|
2679
|
+
const [open, setOpen] = React12__default.useState(false);
|
|
2675
2680
|
const value = { open, setOpen };
|
|
2676
2681
|
return /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: props.children });
|
|
2677
2682
|
}
|
|
2678
2683
|
function useDrawer() {
|
|
2679
|
-
const context2 =
|
|
2684
|
+
const context2 = React12__default.useContext(DrawerContext);
|
|
2680
2685
|
if (context2 === void 0) {
|
|
2681
2686
|
throw new Error("useDrawer must be used within a DrawerProvider");
|
|
2682
2687
|
}
|
|
@@ -2689,7 +2694,7 @@ function BtnGroup(props) {
|
|
|
2689
2694
|
const [isDesktop] = useMatchMedia(breakpoint);
|
|
2690
2695
|
const { children, ...rest } = props;
|
|
2691
2696
|
if (isDesktop) {
|
|
2692
|
-
return /* @__PURE__ */ jsx(MotionDiv4, { flex: true, alignI: true, gap: 4, ...rest, children:
|
|
2697
|
+
return /* @__PURE__ */ jsx(MotionDiv4, { flex: true, alignI: true, gap: 4, ...rest, children: React12__default.Children.toArray(children).toReversed() });
|
|
2693
2698
|
} else {
|
|
2694
2699
|
return /* @__PURE__ */ jsx(MotionDiv4, { grid: true, rowG: 14, ...props });
|
|
2695
2700
|
}
|
|
@@ -2738,7 +2743,7 @@ function CloseBtn(props) {
|
|
|
2738
2743
|
h: 16,
|
|
2739
2744
|
w: 16,
|
|
2740
2745
|
fontSize: 16,
|
|
2741
|
-
color:
|
|
2746
|
+
color: "currentColor"
|
|
2742
2747
|
}
|
|
2743
2748
|
)
|
|
2744
2749
|
}
|
|
@@ -2750,7 +2755,7 @@ function CloseBtn(props) {
|
|
|
2750
2755
|
}
|
|
2751
2756
|
}
|
|
2752
2757
|
function Backdrop(props) {
|
|
2753
|
-
const [allowOutsideClick, setAllowOutsideClick] =
|
|
2758
|
+
const [allowOutsideClick, setAllowOutsideClick] = React12__default.useState(true);
|
|
2754
2759
|
const [isDesktop] = useMatchMedia(breakpoint);
|
|
2755
2760
|
return /* @__PURE__ */ jsx(
|
|
2756
2761
|
MotionDiv4,
|
|
@@ -2773,7 +2778,7 @@ function Backdrop(props) {
|
|
|
2773
2778
|
left: 0,
|
|
2774
2779
|
height: "100%",
|
|
2775
2780
|
width: "100%",
|
|
2776
|
-
placeI:
|
|
2781
|
+
...isDesktop ? { placeI: true } : {},
|
|
2777
2782
|
onClick: () => allowOutsideClick ? props.onClick() : void 0,
|
|
2778
2783
|
children: props.children
|
|
2779
2784
|
}
|
|
@@ -2786,8 +2791,8 @@ function useMatchMedia(queries, defaultValues = []) {
|
|
|
2786
2791
|
const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
|
|
2787
2792
|
return matchedQueries;
|
|
2788
2793
|
};
|
|
2789
|
-
const [value, setValue] =
|
|
2790
|
-
|
|
2794
|
+
const [value, setValue] = React12__default.useState(getValue);
|
|
2795
|
+
React12__default.useLayoutEffect(() => {
|
|
2791
2796
|
const handler = () => setValue(getValue);
|
|
2792
2797
|
mediaQueryLists.forEach((mql) => mql.addListener(handler));
|
|
2793
2798
|
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
|
|
@@ -2800,9 +2805,9 @@ var TrackBgNameKey = "TrackBg";
|
|
|
2800
2805
|
var TrackFillNameKey = "TrackFill";
|
|
2801
2806
|
function Progress(props) {
|
|
2802
2807
|
const { children, steps, value, max: maxProp, ...rest } = props;
|
|
2803
|
-
const [progress, setProgress] =
|
|
2808
|
+
const [progress, setProgress] = React12__default.useState(0);
|
|
2804
2809
|
const max = maxProp ?? 100;
|
|
2805
|
-
|
|
2810
|
+
React12__default.useEffect(() => {
|
|
2806
2811
|
setProgress(Math.min((value ?? 0) / max, 1) * 100);
|
|
2807
2812
|
}, [value, max]);
|
|
2808
2813
|
const width = `${progress}%`;
|
|
@@ -2842,7 +2847,7 @@ function Progress(props) {
|
|
|
2842
2847
|
TrackFillNameKey
|
|
2843
2848
|
);
|
|
2844
2849
|
const barHeight = rest.h ?? 8;
|
|
2845
|
-
const bgEl = trackBgChild ?
|
|
2850
|
+
const bgEl = trackBgChild ? React12__default.cloneElement(trackBgChild, {
|
|
2846
2851
|
gridArea: "1 / 1",
|
|
2847
2852
|
h: barHeight,
|
|
2848
2853
|
w: trackBgChild.props.w ?? true
|
|
@@ -2857,7 +2862,7 @@ function Progress(props) {
|
|
|
2857
2862
|
bg: { base: "neutral.200", _dark: "neutral.700" }
|
|
2858
2863
|
}
|
|
2859
2864
|
);
|
|
2860
|
-
const fillEl = trackFillChild ?
|
|
2865
|
+
const fillEl = trackFillChild ? React12__default.cloneElement(trackFillChild, {
|
|
2861
2866
|
gridArea: "1 / 1",
|
|
2862
2867
|
h: barHeight,
|
|
2863
2868
|
roundedLeft: 9999,
|
|
@@ -2928,7 +2933,7 @@ function TrackFill(props) {
|
|
|
2928
2933
|
}
|
|
2929
2934
|
TrackFill.displayName = TrackFillNameKey;
|
|
2930
2935
|
var Base5 = base;
|
|
2931
|
-
var TooltipContainer =
|
|
2936
|
+
var TooltipContainer = React12__default.forwardRef(function TooltipContainer2(props, ref) {
|
|
2932
2937
|
const { children, className, style, ...rest } = props;
|
|
2933
2938
|
return /* @__PURE__ */ jsx(
|
|
2934
2939
|
Base5,
|
|
@@ -2955,9 +2960,9 @@ function Tooltip(props) {
|
|
|
2955
2960
|
delay = 80,
|
|
2956
2961
|
className
|
|
2957
2962
|
} = props;
|
|
2958
|
-
const referenceRef =
|
|
2959
|
-
const arrowRef =
|
|
2960
|
-
const [open, setOpen] =
|
|
2963
|
+
const referenceRef = React12__default.useRef(null);
|
|
2964
|
+
const arrowRef = React12__default.useRef(null);
|
|
2965
|
+
const [open, setOpen] = React12__default.useState(false);
|
|
2961
2966
|
const { x, y, refs, strategy, middlewareData, context: context2 } = useFloating({
|
|
2962
2967
|
open,
|
|
2963
2968
|
onOpenChange: setOpen,
|
|
@@ -2986,7 +2991,7 @@ function Tooltip(props) {
|
|
|
2986
2991
|
role
|
|
2987
2992
|
]);
|
|
2988
2993
|
const referenceProps = getReferenceProps({});
|
|
2989
|
-
|
|
2994
|
+
React12__default.useEffect(() => {
|
|
2990
2995
|
if (!follow || !referenceRef.current) return;
|
|
2991
2996
|
const el = referenceRef.current;
|
|
2992
2997
|
const onMove = (e) => {
|
|
@@ -3009,14 +3014,14 @@ function Tooltip(props) {
|
|
|
3009
3014
|
const arrowAnchorStyle = side.startsWith("top") ? { bottom: -anchorOffset } : side.startsWith("bottom") ? { top: -anchorOffset } : side.startsWith("left") ? { right: -anchorOffset } : { left: -anchorOffset };
|
|
3010
3015
|
const arrowStyle = side.startsWith("top") || side.startsWith("bottom") ? { left: arrowX || void 0, ...arrowAnchorStyle } : { top: arrowY || void 0, ...arrowAnchorStyle };
|
|
3011
3016
|
const transformOrigin = side.startsWith("top") ? "center bottom" : side.startsWith("bottom") ? "center top" : side.startsWith("left") ? "right center" : side.startsWith("right") ? "left center" : "center";
|
|
3012
|
-
const childrenArray =
|
|
3017
|
+
const childrenArray = React12__default.Children.toArray(children);
|
|
3013
3018
|
const hasMultipleChildren = childrenArray.length > 1;
|
|
3014
3019
|
let child;
|
|
3015
3020
|
if (hasMultipleChildren) {
|
|
3016
3021
|
child = /* @__PURE__ */ jsx("div", { style: { display: "inline-block" }, children });
|
|
3017
3022
|
} else {
|
|
3018
|
-
const only =
|
|
3019
|
-
const isDomElement =
|
|
3023
|
+
const only = React12__default.Children.only(children);
|
|
3024
|
+
const isDomElement = React12__default.isValidElement(only) && typeof only.type === "string";
|
|
3020
3025
|
child = isDomElement ? only : (
|
|
3021
3026
|
// Ensure the wrapper reliably captures mouseenter/pointerenter and can contain block elements
|
|
3022
3027
|
/* @__PURE__ */ jsx("div", { style: { display: "inline-block" }, children: only })
|
|
@@ -3034,7 +3039,7 @@ function Tooltip(props) {
|
|
|
3034
3039
|
originalRef.current = node;
|
|
3035
3040
|
};
|
|
3036
3041
|
const refAttrs = referenceProps;
|
|
3037
|
-
const cloned =
|
|
3042
|
+
const cloned = React12__default.cloneElement(
|
|
3038
3043
|
child,
|
|
3039
3044
|
{
|
|
3040
3045
|
...refAttrs,
|
|
@@ -3043,11 +3048,11 @@ function Tooltip(props) {
|
|
|
3043
3048
|
}
|
|
3044
3049
|
);
|
|
3045
3050
|
if (disabled) return /* @__PURE__ */ jsx(Fragment, { children: cloned });
|
|
3046
|
-
const [isMounted, setIsMounted] =
|
|
3047
|
-
const closeTimerRef =
|
|
3051
|
+
const [isMounted, setIsMounted] = React12__default.useState(false);
|
|
3052
|
+
const closeTimerRef = React12__default.useRef(
|
|
3048
3053
|
null
|
|
3049
3054
|
);
|
|
3050
|
-
|
|
3055
|
+
React12__default.useEffect(() => {
|
|
3051
3056
|
if (closeTimerRef.current) {
|
|
3052
3057
|
clearTimeout(closeTimerRef.current);
|
|
3053
3058
|
closeTimerRef.current = null;
|
|
@@ -3070,24 +3075,24 @@ function Tooltip(props) {
|
|
|
3070
3075
|
let arrowEl = null;
|
|
3071
3076
|
let floatingNode = null;
|
|
3072
3077
|
const findRoleTooltipElement = (node) => {
|
|
3073
|
-
if (!
|
|
3078
|
+
if (!React12__default.isValidElement(node)) return null;
|
|
3074
3079
|
const el = node;
|
|
3075
3080
|
if (el.props?.role === "tooltip") return el;
|
|
3076
3081
|
const kids = el.props?.children;
|
|
3077
3082
|
if (!kids) return null;
|
|
3078
|
-
const arr =
|
|
3083
|
+
const arr = React12__default.Children.toArray(kids);
|
|
3079
3084
|
for (const c of arr) {
|
|
3080
|
-
if (
|
|
3085
|
+
if (React12__default.isValidElement(c) && c.props?.role === "tooltip") {
|
|
3081
3086
|
return c;
|
|
3082
3087
|
}
|
|
3083
3088
|
}
|
|
3084
3089
|
return null;
|
|
3085
3090
|
};
|
|
3086
|
-
const isCustomTooltip =
|
|
3091
|
+
const isCustomTooltip = React12__default.isValidElement(content) && !!(content.type && content.type.isBlockTooltipContainer);
|
|
3087
3092
|
const customEl = isCustomTooltip ? content : findRoleTooltipElement(content);
|
|
3088
|
-
const containerRef =
|
|
3089
|
-
const [containerBg, setContainerBg] =
|
|
3090
|
-
|
|
3093
|
+
const containerRef = React12__default.useRef(null);
|
|
3094
|
+
const [containerBg, setContainerBg] = React12__default.useState();
|
|
3095
|
+
React12__default.useEffect(() => {
|
|
3091
3096
|
if (!(open || isMounted)) return;
|
|
3092
3097
|
const el = containerRef.current;
|
|
3093
3098
|
if (!el) return;
|
|
@@ -3195,7 +3200,7 @@ function Tooltip(props) {
|
|
|
3195
3200
|
else if (originalChildRef && typeof originalChildRef === "object")
|
|
3196
3201
|
originalChildRef.current = node;
|
|
3197
3202
|
};
|
|
3198
|
-
return
|
|
3203
|
+
return React12__default.cloneElement(
|
|
3199
3204
|
el,
|
|
3200
3205
|
{
|
|
3201
3206
|
// Spread childProps first
|
|
@@ -3292,12 +3297,12 @@ var Svg = motionTags.svg;
|
|
|
3292
3297
|
var CheckboxBtn = motionTags.button;
|
|
3293
3298
|
function Checkbox(props) {
|
|
3294
3299
|
const { children, onClick, ...rest } = props;
|
|
3295
|
-
const [checked, setChecked] =
|
|
3296
|
-
const [indeterminate, setIndeterminate] =
|
|
3297
|
-
|
|
3300
|
+
const [checked, setChecked] = React12__default.useState(false);
|
|
3301
|
+
const [indeterminate, setIndeterminate] = React12__default.useState(false);
|
|
3302
|
+
React12__default.useEffect(() => {
|
|
3298
3303
|
setChecked(!!rest.checked);
|
|
3299
3304
|
}, [rest.checked]);
|
|
3300
|
-
|
|
3305
|
+
React12__default.useEffect(() => {
|
|
3301
3306
|
setIndeterminate(!!rest.indeterminate);
|
|
3302
3307
|
}, [rest.indeterminate]);
|
|
3303
3308
|
const isIndeterminate = typeof rest.indeterminate === "boolean";
|
|
@@ -3389,7 +3394,7 @@ function Block(props) {
|
|
|
3389
3394
|
tooltip,
|
|
3390
3395
|
...rest
|
|
3391
3396
|
} = anyProps;
|
|
3392
|
-
const fileInputRef =
|
|
3397
|
+
const fileInputRef = React12.useRef(null);
|
|
3393
3398
|
const isLoading = anyProps.isLoading;
|
|
3394
3399
|
const multiple = anyProps.multiple;
|
|
3395
3400
|
const is = anyProps.is;
|
|
@@ -3426,7 +3431,7 @@ function Block(props) {
|
|
|
3426
3431
|
...anyProps
|
|
3427
3432
|
}
|
|
3428
3433
|
) : extract.filepickerAllowed ? /* @__PURE__ */ jsxs("div", { onClick: () => fileInputRef.current?.click(), children: [
|
|
3429
|
-
|
|
3434
|
+
React12.createElement(
|
|
3430
3435
|
Comp,
|
|
3431
3436
|
{
|
|
3432
3437
|
cursor: "pointer",
|
|
@@ -3456,7 +3461,7 @@ function Block(props) {
|
|
|
3456
3461
|
value: ""
|
|
3457
3462
|
}
|
|
3458
3463
|
)
|
|
3459
|
-
] }) :
|
|
3464
|
+
] }) : React12.createElement(
|
|
3460
3465
|
Comp,
|
|
3461
3466
|
{
|
|
3462
3467
|
...isLoading && { "data-loading": isLoading },
|
|
@@ -3564,16 +3569,16 @@ var saveStore = (store) => {
|
|
|
3564
3569
|
|
|
3565
3570
|
// src/react/use-theme/index.ts
|
|
3566
3571
|
function useTheme() {
|
|
3567
|
-
const [store, setStore] =
|
|
3568
|
-
const storeRef =
|
|
3569
|
-
const isInternalUpdateRef =
|
|
3570
|
-
|
|
3572
|
+
const [store, setStore] = React12__default.useState(getInitialStore);
|
|
3573
|
+
const storeRef = React12__default.useRef(store);
|
|
3574
|
+
const isInternalUpdateRef = React12__default.useRef(false);
|
|
3575
|
+
React12__default.useEffect(() => {
|
|
3571
3576
|
storeRef.current = store;
|
|
3572
3577
|
}, [store]);
|
|
3573
|
-
|
|
3578
|
+
React12__default.useEffect(() => {
|
|
3574
3579
|
document.documentElement.setAttribute("data-theme", store.value);
|
|
3575
3580
|
}, [store.value]);
|
|
3576
|
-
|
|
3581
|
+
React12__default.useEffect(() => {
|
|
3577
3582
|
const handleStorageChange = (e) => {
|
|
3578
3583
|
if (e.key === THEME_STORAGE_KEY || e.key === THEME_STORE_STORAGE_KEY) {
|
|
3579
3584
|
setStore(getInitialStore());
|
|
@@ -3603,7 +3608,6 @@ function useTheme() {
|
|
|
3603
3608
|
saveStore(newStore);
|
|
3604
3609
|
};
|
|
3605
3610
|
const toggle = (theme) => {
|
|
3606
|
-
console.log("toggle theme");
|
|
3607
3611
|
const newStore = {
|
|
3608
3612
|
value: theme ?? (storeRef.current.value === "light" ? "dark" : "light"),
|
|
3609
3613
|
isManual: true
|
|
@@ -3617,8 +3621,8 @@ function useTheme() {
|
|
|
3617
3621
|
|
|
3618
3622
|
// src/react/index.ts
|
|
3619
3623
|
function useDebounce(value, delay = 500) {
|
|
3620
|
-
const [debouncedValue, setDebouncedValue] =
|
|
3621
|
-
|
|
3624
|
+
const [debouncedValue, setDebouncedValue] = React12__default.useState(value);
|
|
3625
|
+
React12__default.useEffect(() => {
|
|
3622
3626
|
const handler = setTimeout(() => {
|
|
3623
3627
|
setDebouncedValue(value);
|
|
3624
3628
|
}, delay);
|
|
@@ -3629,10 +3633,10 @@ function useDebounce(value, delay = 500) {
|
|
|
3629
3633
|
return debouncedValue;
|
|
3630
3634
|
}
|
|
3631
3635
|
function useThrottle(value, interval = 500) {
|
|
3632
|
-
const [throttledValue, setThrottledValue] =
|
|
3633
|
-
const lastUpdate =
|
|
3634
|
-
const timeoutRef =
|
|
3635
|
-
|
|
3636
|
+
const [throttledValue, setThrottledValue] = React12__default.useState(value);
|
|
3637
|
+
const lastUpdate = React12__default.useRef(0);
|
|
3638
|
+
const timeoutRef = React12__default.useRef(null);
|
|
3639
|
+
React12__default.useEffect(() => {
|
|
3636
3640
|
const now = Date.now();
|
|
3637
3641
|
const timeSinceLastUpdate = now - lastUpdate.current;
|
|
3638
3642
|
if (timeSinceLastUpdate >= interval) {
|
|
@@ -3662,8 +3666,8 @@ function useMatchMedia2(queries, defaultValues = []) {
|
|
|
3662
3666
|
const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
|
|
3663
3667
|
return matchedQueries;
|
|
3664
3668
|
};
|
|
3665
|
-
const [value, setValue] =
|
|
3666
|
-
|
|
3669
|
+
const [value, setValue] = React12__default.useState(getValue);
|
|
3670
|
+
React12__default.useLayoutEffect(() => {
|
|
3667
3671
|
const handler = () => setValue(getValue);
|
|
3668
3672
|
mediaQueryLists.forEach((mql) => mql.addListener(handler));
|
|
3669
3673
|
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
|