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.cjs
CHANGED
|
@@ -3,7 +3,7 @@ require("./index.css");
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var React12 = require('react');
|
|
7
7
|
var reactDom = require('react-dom');
|
|
8
8
|
var framerMotion = require('framer-motion');
|
|
9
9
|
var react = require('@floating-ui/react');
|
|
@@ -11,11 +11,11 @@ var reactSpinners = require('react-spinners');
|
|
|
11
11
|
var reactLoaderSpinner = require('react-loader-spinner');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
13
|
var nanoid = require('nanoid');
|
|
14
|
+
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
14
15
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
15
16
|
var fontawesomeSvgCore = require('@fortawesome/fontawesome-svg-core');
|
|
16
17
|
var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
|
|
17
18
|
var freeBrandsSvgIcons = require('@fortawesome/free-brands-svg-icons');
|
|
18
|
-
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
19
19
|
var useImmer = require('use-immer');
|
|
20
20
|
|
|
21
21
|
function _interopNamespace(e) {
|
|
@@ -36,7 +36,7 @@ function _interopNamespace(e) {
|
|
|
36
36
|
return Object.freeze(n);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var React12__namespace = /*#__PURE__*/_interopNamespace(React12);
|
|
40
40
|
|
|
41
41
|
// src/react/index.ts
|
|
42
42
|
|
|
@@ -444,10 +444,10 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
|
444
444
|
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn);
|
|
445
445
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp);
|
|
446
446
|
const __base__ = Dynamic.__base__ || Dynamic;
|
|
447
|
-
const StyledComponent = /* @__PURE__ */
|
|
447
|
+
const StyledComponent = /* @__PURE__ */ React12.forwardRef(function StyledComponent2(props, ref) {
|
|
448
448
|
const { as: Element2 = __base__, unstyled, children, ...restProps } = props;
|
|
449
|
-
const combinedProps =
|
|
450
|
-
const [htmlProps2, forwardedProps, variantProps, styleProps, elementProps] =
|
|
449
|
+
const combinedProps = React12.useMemo(() => Object.assign({}, defaultProps, restProps), [restProps]);
|
|
450
|
+
const [htmlProps2, forwardedProps, variantProps, styleProps, elementProps] = React12.useMemo(() => {
|
|
451
451
|
return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty);
|
|
452
452
|
}, [combinedProps]);
|
|
453
453
|
function recipeClass() {
|
|
@@ -467,7 +467,7 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
|
467
467
|
}
|
|
468
468
|
return configOrCva.__recipe__ ? recipeClass() : cvaClass();
|
|
469
469
|
};
|
|
470
|
-
return
|
|
470
|
+
return React12.createElement(Element2, {
|
|
471
471
|
ref,
|
|
472
472
|
...forwardedProps,
|
|
473
473
|
...elementProps,
|
|
@@ -630,14 +630,14 @@ function Menu(props) {
|
|
|
630
630
|
trigger,
|
|
631
631
|
...rest
|
|
632
632
|
} = props;
|
|
633
|
-
const hoverTimeoutRef =
|
|
634
|
-
const [isOpen, setOpen] =
|
|
633
|
+
const hoverTimeoutRef = React12__namespace.default.useRef(null);
|
|
634
|
+
const [isOpen, setOpen] = React12__namespace.default.useState(isOpenControlled ?? false);
|
|
635
635
|
const onOpenChange = (open) => {
|
|
636
636
|
const newOpenState = typeof open === "function" ? open(isOpen) : open;
|
|
637
637
|
props.onOpenOrClose?.(newOpenState);
|
|
638
638
|
setOpen(newOpenState);
|
|
639
639
|
};
|
|
640
|
-
|
|
640
|
+
React12__namespace.default.useEffect(() => {
|
|
641
641
|
if (typeof isOpenControlled !== "boolean") return;
|
|
642
642
|
setOpen(isOpenControlled);
|
|
643
643
|
}, [isOpenControlled]);
|
|
@@ -653,7 +653,10 @@ function Menu(props) {
|
|
|
653
653
|
open: isOpen,
|
|
654
654
|
onOpenChange,
|
|
655
655
|
middleware: [
|
|
656
|
-
react.offset({
|
|
656
|
+
react.offset({
|
|
657
|
+
...props.offset?.x !== void 0 && { crossAxis: props.offset.x },
|
|
658
|
+
...props.offset?.y !== void 0 && { mainAxis: props.offset.y }
|
|
659
|
+
}),
|
|
657
660
|
react.flip({ fallbackPlacements: ["top-end"] }),
|
|
658
661
|
react.shift({ padding: 5 }),
|
|
659
662
|
react.hide({ strategy: "referenceHidden" })
|
|
@@ -709,11 +712,11 @@ function Menu(props) {
|
|
|
709
712
|
},
|
|
710
713
|
isOpen
|
|
711
714
|
);
|
|
712
|
-
|
|
715
|
+
React12__namespace.default.useEffect(() => {
|
|
713
716
|
if (!hideData?.referenceHidden) return;
|
|
714
717
|
closeMenuImmediate();
|
|
715
718
|
}, [hideData, closeMenuImmediate]);
|
|
716
|
-
|
|
719
|
+
React12__namespace.default.useEffect(() => {
|
|
717
720
|
return () => {
|
|
718
721
|
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
719
722
|
};
|
|
@@ -739,10 +742,10 @@ function Menu(props) {
|
|
|
739
742
|
onMouseLeave: handleMenuMouseLeave
|
|
740
743
|
} : {};
|
|
741
744
|
const transformOrigin = floatingContext.placement.startsWith("top") ? "bottom left" : "top left";
|
|
742
|
-
const childArray =
|
|
745
|
+
const childArray = React12__namespace.default.Children.toArray(children);
|
|
743
746
|
let customContainerEl = null;
|
|
744
747
|
for (const c of childArray) {
|
|
745
|
-
if (
|
|
748
|
+
if (React12__namespace.default.isValidElement(c)) {
|
|
746
749
|
const anyType = c.type;
|
|
747
750
|
if (c.props?.["data-menu-container"] || anyType?.isBlockMenuContainer) {
|
|
748
751
|
customContainerEl = c;
|
|
@@ -771,7 +774,7 @@ function Menu(props) {
|
|
|
771
774
|
...restStyle || {}
|
|
772
775
|
};
|
|
773
776
|
const mergedClassName = [defaultsClassName, childProps.className].filter(Boolean).join(" ");
|
|
774
|
-
const contentNode =
|
|
777
|
+
const contentNode = React12__namespace.default.cloneElement(
|
|
775
778
|
customContainerEl,
|
|
776
779
|
{
|
|
777
780
|
// Defaults are now in mergedClassName via css()
|
|
@@ -857,7 +860,7 @@ function Menu(props) {
|
|
|
857
860
|
);
|
|
858
861
|
}
|
|
859
862
|
function useOutsideClick(ref, handler, enabled = true) {
|
|
860
|
-
|
|
863
|
+
React12__namespace.default.useEffect(() => {
|
|
861
864
|
if (!enabled) return;
|
|
862
865
|
const listener = (event) => {
|
|
863
866
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
@@ -964,9 +967,9 @@ var prepareFiles = async (acceptedFiles) => {
|
|
|
964
967
|
);
|
|
965
968
|
};
|
|
966
969
|
var findChildrenByDisplayName = (children, displayName2) => {
|
|
967
|
-
return
|
|
970
|
+
return React12__namespace.default.Children.toArray(children).find(
|
|
968
971
|
(child) => {
|
|
969
|
-
if (
|
|
972
|
+
if (React12__namespace.default.isValidElement(child)) {
|
|
970
973
|
const childType = child.type;
|
|
971
974
|
return childType.displayName === displayName2;
|
|
972
975
|
} else {
|
|
@@ -1099,7 +1102,7 @@ function getIcon(position, Icon2, props) {
|
|
|
1099
1102
|
const Cmp = loadingIconsMap[chosen];
|
|
1100
1103
|
const sizePx = typeof loadingIconSize === "number" ? `${loadingIconSize}px` : "12px";
|
|
1101
1104
|
return Cmp({ width: sizePx, height: sizePx });
|
|
1102
|
-
} else if (
|
|
1105
|
+
} else if (React12__namespace.default.isValidElement(chosen)) {
|
|
1103
1106
|
return chosen;
|
|
1104
1107
|
} else if (typeof chosen === "function") {
|
|
1105
1108
|
return chosen();
|
|
@@ -1195,9 +1198,9 @@ var TrackNameKey = "Track";
|
|
|
1195
1198
|
var ThumbNameKey = "Thumb";
|
|
1196
1199
|
var Button = motionTags.button;
|
|
1197
1200
|
var Base = motionTags.div;
|
|
1198
|
-
var SwitchContext =
|
|
1201
|
+
var SwitchContext = React12__namespace.default.createContext(null);
|
|
1199
1202
|
var useSwitchContext = () => {
|
|
1200
|
-
const context2 =
|
|
1203
|
+
const context2 = React12__namespace.default.useContext(SwitchContext);
|
|
1201
1204
|
if (!context2) {
|
|
1202
1205
|
throw new Error("Switch compound components must be used within Switch");
|
|
1203
1206
|
}
|
|
@@ -1213,16 +1216,16 @@ function Switch(props) {
|
|
|
1213
1216
|
_motion,
|
|
1214
1217
|
...rest
|
|
1215
1218
|
} = props;
|
|
1216
|
-
const [x, setX] =
|
|
1217
|
-
const [pressed, setPressed] =
|
|
1218
|
-
const [growThumb, setGrowThumb] =
|
|
1219
|
+
const [x, setX] = React12__namespace.default.useState(0);
|
|
1220
|
+
const [pressed, setPressed] = React12__namespace.default.useState(false);
|
|
1221
|
+
const [growThumb, setGrowThumb] = React12__namespace.default.useState(false);
|
|
1219
1222
|
const borderWidth = 4;
|
|
1220
1223
|
const trackWidth = thumbSize * 1.5;
|
|
1221
1224
|
const borderRadius = thumbSize * 2.5;
|
|
1222
1225
|
const xWhileOn = thumbSize;
|
|
1223
1226
|
const checkedPosition = xWhileOn * 0.5;
|
|
1224
1227
|
const stopwatch = useStopwatch();
|
|
1225
|
-
|
|
1228
|
+
React12__namespace.default.useEffect(() => {
|
|
1226
1229
|
if (pressed && !disabled) {
|
|
1227
1230
|
stopwatch.start();
|
|
1228
1231
|
} else {
|
|
@@ -1230,12 +1233,12 @@ function Switch(props) {
|
|
|
1230
1233
|
stopwatch.clear();
|
|
1231
1234
|
}
|
|
1232
1235
|
}, [pressed, disabled]);
|
|
1233
|
-
|
|
1236
|
+
React12__namespace.default.useEffect(() => {
|
|
1234
1237
|
if (stopwatch.time > 200) {
|
|
1235
1238
|
setGrowThumb(true);
|
|
1236
1239
|
}
|
|
1237
1240
|
}, [stopwatch.time]);
|
|
1238
|
-
|
|
1241
|
+
React12__namespace.default.useEffect(() => {
|
|
1239
1242
|
setX(checked ? checkedPosition : 0);
|
|
1240
1243
|
}, [checked, checkedPosition]);
|
|
1241
1244
|
const toggle = () => {
|
|
@@ -1300,10 +1303,10 @@ function Switch(props) {
|
|
|
1300
1303
|
children,
|
|
1301
1304
|
ThumbNameKey
|
|
1302
1305
|
);
|
|
1303
|
-
const trackElement = track ?
|
|
1306
|
+
const trackElement = track ? React12__namespace.default.cloneElement(track, {
|
|
1304
1307
|
_motion,
|
|
1305
|
-
children: thumb ?
|
|
1306
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx(Track, { _motion, children: thumb ?
|
|
1308
|
+
children: thumb ? React12__namespace.default.cloneElement(thumb, { _motion }) : /* @__PURE__ */ jsxRuntime.jsx(Thumb, { _motion })
|
|
1309
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(Track, { _motion, children: thumb ? React12__namespace.default.cloneElement(thumb, { _motion }) : /* @__PURE__ */ jsxRuntime.jsx(Thumb, { _motion }) });
|
|
1307
1310
|
return /* @__PURE__ */ jsxRuntime.jsx(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1308
1311
|
Button,
|
|
1309
1312
|
{
|
|
@@ -1428,10 +1431,10 @@ function Thumb(props) {
|
|
|
1428
1431
|
Track.displayName = TrackNameKey;
|
|
1429
1432
|
Thumb.displayName = ThumbNameKey;
|
|
1430
1433
|
function useStopwatch(props = {}) {
|
|
1431
|
-
const [active, setActive] =
|
|
1432
|
-
const [time, setTime] =
|
|
1434
|
+
const [active, setActive] = React12__namespace.default.useState(false);
|
|
1435
|
+
const [time, setTime] = React12__namespace.default.useState(0);
|
|
1433
1436
|
const timeInterval = props?.interval ?? 10;
|
|
1434
|
-
|
|
1437
|
+
React12__namespace.default.useEffect(() => {
|
|
1435
1438
|
let interval = null;
|
|
1436
1439
|
if (active) {
|
|
1437
1440
|
interval = setInterval(() => {
|
|
@@ -1451,7 +1454,7 @@ function useStopwatch(props = {}) {
|
|
|
1451
1454
|
return { time, start, stop, clear };
|
|
1452
1455
|
}
|
|
1453
1456
|
var switch_default = Switch;
|
|
1454
|
-
var RadioContext =
|
|
1457
|
+
var RadioContext = React12__namespace.default.createContext(null);
|
|
1455
1458
|
var Base2 = base;
|
|
1456
1459
|
var MotionDiv2 = motionTags.div;
|
|
1457
1460
|
function Radio(props) {
|
|
@@ -1466,14 +1469,14 @@ function Radio(props) {
|
|
|
1466
1469
|
onKeyDown: onKeyDownProp,
|
|
1467
1470
|
...rest
|
|
1468
1471
|
} = props;
|
|
1469
|
-
const groupId =
|
|
1472
|
+
const groupId = React12__namespace.default.useId();
|
|
1470
1473
|
const isControlled = controlledValue !== void 0;
|
|
1471
|
-
const [uncontrolled, setUncontrolled] =
|
|
1474
|
+
const [uncontrolled, setUncontrolled] = React12__namespace.default.useState(
|
|
1472
1475
|
defaultValue
|
|
1473
1476
|
);
|
|
1474
1477
|
const selectedValue = isControlled ? controlledValue : uncontrolled;
|
|
1475
|
-
const itemsRef =
|
|
1476
|
-
const [activeId, setActiveId] =
|
|
1478
|
+
const itemsRef = React12__namespace.default.useRef([]);
|
|
1479
|
+
const [activeId, setActiveId] = React12__namespace.default.useState("");
|
|
1477
1480
|
const setSelectedValue = (val) => {
|
|
1478
1481
|
if (!isControlled) setUncontrolled(val);
|
|
1479
1482
|
onChange?.(val);
|
|
@@ -1526,7 +1529,7 @@ function Radio(props) {
|
|
|
1526
1529
|
setActiveId(found.id);
|
|
1527
1530
|
}
|
|
1528
1531
|
};
|
|
1529
|
-
|
|
1532
|
+
React12__namespace.default.useEffect(() => {
|
|
1530
1533
|
if (!selectedValue) return;
|
|
1531
1534
|
const selected = itemsRef.current.find((x) => x.value === selectedValue);
|
|
1532
1535
|
if (selected && !selected.disabled) setActiveId(selected.id);
|
|
@@ -1567,7 +1570,7 @@ function Radio(props) {
|
|
|
1567
1570
|
},
|
|
1568
1571
|
children: [
|
|
1569
1572
|
(options ?? []).map(
|
|
1570
|
-
(opt) => renderOption ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1573
|
+
(opt) => renderOption ? /* @__PURE__ */ jsxRuntime.jsx(React12__namespace.default.Fragment, { children: renderOption(opt) }, opt.value) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1571
1574
|
Item,
|
|
1572
1575
|
{
|
|
1573
1576
|
value: opt.value,
|
|
@@ -1597,7 +1600,7 @@ function Item(props) {
|
|
|
1597
1600
|
onBlur: onBlurProp,
|
|
1598
1601
|
...rest
|
|
1599
1602
|
} = props;
|
|
1600
|
-
const ctx =
|
|
1603
|
+
const ctx = React12__namespace.default.useContext(RadioContext);
|
|
1601
1604
|
if (!ctx) {
|
|
1602
1605
|
return /* @__PURE__ */ jsxRuntime.jsxs(Base2, { flex: true, alignI: true, cursor: "pointer", ...rest, children: [
|
|
1603
1606
|
/* @__PURE__ */ jsxRuntime.jsx(Base2, { "data-radio-circle": true, w: 24, h: 24, br: 9999, mr: 8 }),
|
|
@@ -1616,22 +1619,22 @@ function Item(props) {
|
|
|
1616
1619
|
} = ctx;
|
|
1617
1620
|
const disabled = !!(groupDisabled || itemDisabled);
|
|
1618
1621
|
const id = `radio-item-${groupId}-${value}`;
|
|
1619
|
-
const ref =
|
|
1620
|
-
|
|
1622
|
+
const ref = React12__namespace.default.useRef(null);
|
|
1623
|
+
React12__namespace.default.useEffect(() => {
|
|
1621
1624
|
registerItem({ id, value, disabled, ref });
|
|
1622
1625
|
return () => unregisterItem(id);
|
|
1623
1626
|
}, [id, value, disabled]);
|
|
1624
1627
|
const isSelected = selectedValue === value;
|
|
1625
1628
|
const isActive = isActiveId(id);
|
|
1626
|
-
const [isFocused, setIsFocused] =
|
|
1629
|
+
const [isFocused, setIsFocused] = React12__namespace.default.useState(false);
|
|
1627
1630
|
const shouldUseGrid = gridProp || !!colsProp;
|
|
1628
1631
|
const renderLabel = () => {
|
|
1629
|
-
const onlyChild =
|
|
1632
|
+
const onlyChild = React12__namespace.default.Children.count(children) === 1 ? React12__namespace.default.Children.toArray(children)[0] : null;
|
|
1630
1633
|
if (typeof onlyChild === "string") {
|
|
1631
1634
|
return /* @__PURE__ */ jsxRuntime.jsx(Base2, { "data-radio-label": true, children: onlyChild });
|
|
1632
1635
|
}
|
|
1633
|
-
if (
|
|
1634
|
-
return
|
|
1636
|
+
if (React12__namespace.default.isValidElement(onlyChild)) {
|
|
1637
|
+
return React12__namespace.default.cloneElement(
|
|
1635
1638
|
onlyChild,
|
|
1636
1639
|
{
|
|
1637
1640
|
...onlyChild.props || {},
|
|
@@ -1751,7 +1754,7 @@ function Item(props) {
|
|
|
1751
1754
|
var LabelNameKey = "Label";
|
|
1752
1755
|
var Base3 = base;
|
|
1753
1756
|
var isBrowser = typeof window !== "undefined";
|
|
1754
|
-
var useIsomorphicLayoutEffect = isBrowser ?
|
|
1757
|
+
var useIsomorphicLayoutEffect = isBrowser ? React12__namespace.default.useLayoutEffect : React12__namespace.default.useEffect;
|
|
1755
1758
|
function pick(props, obj) {
|
|
1756
1759
|
return props.reduce(
|
|
1757
1760
|
(acc, prop) => {
|
|
@@ -1883,16 +1886,16 @@ function Textarea(props) {
|
|
|
1883
1886
|
...rest
|
|
1884
1887
|
} = props;
|
|
1885
1888
|
const isControlled = rest.value !== void 0;
|
|
1886
|
-
const libRef =
|
|
1889
|
+
const libRef = React12__namespace.default.useRef(null);
|
|
1887
1890
|
const ref = assignRefs(libRef, userRef);
|
|
1888
|
-
const heightRef =
|
|
1889
|
-
const [_value, _setValue] =
|
|
1891
|
+
const heightRef = React12__namespace.default.useRef(0);
|
|
1892
|
+
const [_value, _setValue] = React12__namespace.default.useState("");
|
|
1890
1893
|
const value = props.value ?? _value;
|
|
1891
1894
|
const label = findChildrenByDisplayName(
|
|
1892
1895
|
children,
|
|
1893
1896
|
LabelNameKey
|
|
1894
1897
|
);
|
|
1895
|
-
const labelWithProps = label ?
|
|
1898
|
+
const labelWithProps = label ? React12__namespace.default.cloneElement(label, {
|
|
1896
1899
|
required: props.required,
|
|
1897
1900
|
value: props.value,
|
|
1898
1901
|
error
|
|
@@ -1923,20 +1926,20 @@ function Textarea(props) {
|
|
|
1923
1926
|
useIsomorphicLayoutEffect(() => {
|
|
1924
1927
|
resizeTextarea();
|
|
1925
1928
|
}, [rest.value, rest.placeholder, minRows, maxRows]);
|
|
1926
|
-
|
|
1929
|
+
React12__namespace.default.useEffect(() => {
|
|
1927
1930
|
if (!isBrowser) return;
|
|
1928
1931
|
const onResize = () => resizeTextarea();
|
|
1929
1932
|
window.addEventListener("resize", onResize);
|
|
1930
1933
|
return () => window.removeEventListener("resize", onResize);
|
|
1931
1934
|
}, [minRows, maxRows, rest.placeholder, rest.value]);
|
|
1932
|
-
|
|
1935
|
+
React12__namespace.default.useEffect(() => {
|
|
1933
1936
|
const fonts = isBrowser ? document.fonts : void 0;
|
|
1934
1937
|
if (!fonts || typeof fonts.addEventListener !== "function") return;
|
|
1935
1938
|
const onFontsLoaded = () => resizeTextarea();
|
|
1936
1939
|
fonts.addEventListener("loadingdone", onFontsLoaded);
|
|
1937
1940
|
return () => fonts.removeEventListener("loadingdone", onFontsLoaded);
|
|
1938
1941
|
}, [minRows, maxRows, rest.placeholder, rest.value]);
|
|
1939
|
-
|
|
1942
|
+
React12__namespace.default.useEffect(() => {
|
|
1940
1943
|
const node = libRef.current;
|
|
1941
1944
|
const form = node?.form;
|
|
1942
1945
|
if (!node || !form || isControlled) return;
|
|
@@ -1953,7 +1956,7 @@ function Textarea(props) {
|
|
|
1953
1956
|
return /* @__PURE__ */ jsxRuntime.jsxs(Base3, { grid: true, rows: "/ 4", children: [
|
|
1954
1957
|
/* @__PURE__ */ jsxRuntime.jsxs(Base3, { grid: true, relative: true, children: [
|
|
1955
1958
|
labelWithProps,
|
|
1956
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1959
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.MotionConfig, { ..._motion && { transition: _motion }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1957
1960
|
Txtarea,
|
|
1958
1961
|
{
|
|
1959
1962
|
ref,
|
|
@@ -2088,13 +2091,13 @@ function Input(props) {
|
|
|
2088
2091
|
children,
|
|
2089
2092
|
RightSideNameKey
|
|
2090
2093
|
);
|
|
2091
|
-
const labelWithProps = label ?
|
|
2094
|
+
const labelWithProps = label ? React12__namespace.default.cloneElement(label, {
|
|
2092
2095
|
hasLeftIcon: !!leftIcon,
|
|
2093
2096
|
required: props.required,
|
|
2094
2097
|
value: props.value,
|
|
2095
2098
|
error
|
|
2096
2099
|
}) : null;
|
|
2097
|
-
const rightSideWithProps = rightSide ?
|
|
2100
|
+
const rightSideWithProps = rightSide ? React12__namespace.default.cloneElement(rightSide, {
|
|
2098
2101
|
onChange: props.onChange,
|
|
2099
2102
|
value: props.value
|
|
2100
2103
|
}) : null;
|
|
@@ -2219,27 +2222,27 @@ function Label2(props) {
|
|
|
2219
2222
|
Label2.displayName = LabelNameKey2;
|
|
2220
2223
|
function useResizeObserver(opts = {}) {
|
|
2221
2224
|
const onResize = opts.onResize;
|
|
2222
|
-
const onResizeRef =
|
|
2225
|
+
const onResizeRef = React12__namespace.default.useRef(void 0);
|
|
2223
2226
|
onResizeRef.current = onResize;
|
|
2224
2227
|
const round = opts.round || Math.round;
|
|
2225
|
-
const resizeObserverRef =
|
|
2226
|
-
const [size, setSize] =
|
|
2228
|
+
const resizeObserverRef = React12__namespace.default.useRef(null);
|
|
2229
|
+
const [size, setSize] = React12__namespace.default.useState({
|
|
2227
2230
|
width: void 0,
|
|
2228
2231
|
height: void 0
|
|
2229
2232
|
});
|
|
2230
|
-
const didUnmount =
|
|
2231
|
-
|
|
2233
|
+
const didUnmount = React12__namespace.default.useRef(false);
|
|
2234
|
+
React12__namespace.default.useEffect(() => {
|
|
2232
2235
|
didUnmount.current = false;
|
|
2233
2236
|
return () => {
|
|
2234
2237
|
didUnmount.current = true;
|
|
2235
2238
|
};
|
|
2236
2239
|
}, []);
|
|
2237
|
-
const previous =
|
|
2240
|
+
const previous = React12__namespace.default.useRef({
|
|
2238
2241
|
width: void 0,
|
|
2239
2242
|
height: void 0
|
|
2240
2243
|
});
|
|
2241
2244
|
const refCallback = useResolvedElement(
|
|
2242
|
-
|
|
2245
|
+
React12__namespace.default.useCallback(
|
|
2243
2246
|
(element) => {
|
|
2244
2247
|
if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) {
|
|
2245
2248
|
resizeObserverRef.current = {
|
|
@@ -2278,7 +2281,7 @@ function useResizeObserver(opts = {}) {
|
|
|
2278
2281
|
),
|
|
2279
2282
|
opts.ref
|
|
2280
2283
|
);
|
|
2281
|
-
return
|
|
2284
|
+
return React12__namespace.default.useMemo(
|
|
2282
2285
|
() => ({
|
|
2283
2286
|
ref: refCallback,
|
|
2284
2287
|
width: size.width,
|
|
@@ -2290,14 +2293,14 @@ function useResizeObserver(opts = {}) {
|
|
|
2290
2293
|
);
|
|
2291
2294
|
}
|
|
2292
2295
|
function useResolvedElement(subscriber, refOrElement) {
|
|
2293
|
-
const lastReportRef =
|
|
2294
|
-
const refOrElementRef =
|
|
2296
|
+
const lastReportRef = React12__namespace.default.useRef(null);
|
|
2297
|
+
const refOrElementRef = React12__namespace.default.useRef(null);
|
|
2295
2298
|
refOrElementRef.current = refOrElement;
|
|
2296
|
-
const cbElementRef =
|
|
2297
|
-
|
|
2299
|
+
const cbElementRef = React12__namespace.default.useRef(null);
|
|
2300
|
+
React12__namespace.default.useEffect(() => {
|
|
2298
2301
|
evaluateSubscription();
|
|
2299
2302
|
});
|
|
2300
|
-
const evaluateSubscription =
|
|
2303
|
+
const evaluateSubscription = React12__namespace.default.useCallback(() => {
|
|
2301
2304
|
const cbElement = cbElementRef.current;
|
|
2302
2305
|
const refOrElement2 = refOrElementRef.current;
|
|
2303
2306
|
const element = cbElement ? cbElement : refOrElement2 ? refOrElement2 instanceof Element ? refOrElement2 : refOrElement2.current : null;
|
|
@@ -2315,7 +2318,7 @@ function useResolvedElement(subscriber, refOrElement) {
|
|
|
2315
2318
|
cleanup: element ? subscriber(element) : void 0
|
|
2316
2319
|
};
|
|
2317
2320
|
}, [subscriber]);
|
|
2318
|
-
|
|
2321
|
+
React12__namespace.default.useEffect(() => {
|
|
2319
2322
|
return () => {
|
|
2320
2323
|
if (lastReportRef.current && lastReportRef.current.cleanup) {
|
|
2321
2324
|
lastReportRef.current.cleanup();
|
|
@@ -2323,7 +2326,7 @@ function useResolvedElement(subscriber, refOrElement) {
|
|
|
2323
2326
|
}
|
|
2324
2327
|
};
|
|
2325
2328
|
}, []);
|
|
2326
|
-
return
|
|
2329
|
+
return React12__namespace.default.useCallback(
|
|
2327
2330
|
(element) => {
|
|
2328
2331
|
cbElementRef.current = element;
|
|
2329
2332
|
evaluateSubscription();
|
|
@@ -2349,7 +2352,7 @@ var use_resize_observer_default = useResizeObserver;
|
|
|
2349
2352
|
var MotionDiv3 = motionTags.div;
|
|
2350
2353
|
var MotionBtn = motionTags.button;
|
|
2351
2354
|
var displayName = "AccordionItem";
|
|
2352
|
-
var AccordionContext =
|
|
2355
|
+
var AccordionContext = React12__namespace.default.createContext({});
|
|
2353
2356
|
function AccordionProvider(props) {
|
|
2354
2357
|
const [state, setState] = useImmer.useImmer({
|
|
2355
2358
|
allowMultiple: false,
|
|
@@ -2359,7 +2362,7 @@ function AccordionProvider(props) {
|
|
|
2359
2362
|
return /* @__PURE__ */ jsxRuntime.jsx(AccordionContext.Provider, { value: { setState, state }, children: props.children });
|
|
2360
2363
|
}
|
|
2361
2364
|
function useAccordion() {
|
|
2362
|
-
const context2 =
|
|
2365
|
+
const context2 = React12__namespace.default.useContext(AccordionContext);
|
|
2363
2366
|
if (context2 === void 0) {
|
|
2364
2367
|
throw new Error("useAccordion must be used within a AccordionProvider");
|
|
2365
2368
|
}
|
|
@@ -2368,22 +2371,22 @@ function useAccordion() {
|
|
|
2368
2371
|
function AccordionComponent(props) {
|
|
2369
2372
|
const accordion = useAccordion();
|
|
2370
2373
|
const accordionState = accordion.state;
|
|
2371
|
-
|
|
2374
|
+
React12__namespace.default.useEffect(() => {
|
|
2372
2375
|
accordion.setState((draft) => {
|
|
2373
2376
|
draft.allowMultiple = !!props.allowMultiple;
|
|
2374
2377
|
draft.allowToggle = !!props.allowToggle;
|
|
2375
2378
|
});
|
|
2376
2379
|
}, [props.allowMultiple, props.allowToggle]);
|
|
2377
|
-
|
|
2380
|
+
React12__namespace.default.Children.forEach(props.children, (x) => {
|
|
2378
2381
|
if (typeof x.type === "function" && "displayName" in x.type && x.type.displayName !== displayName) {
|
|
2379
2382
|
throw new Error("Accordion can only have AccordionItems as children");
|
|
2380
2383
|
}
|
|
2381
2384
|
});
|
|
2382
|
-
const children =
|
|
2383
|
-
if (!
|
|
2384
|
-
return
|
|
2385
|
+
const children = React12__namespace.default.Children.map(props.children, (child, i) => {
|
|
2386
|
+
if (!React12__namespace.default.isValidElement(child)) return child;
|
|
2387
|
+
return React12__namespace.default.cloneElement(child, { idx: i });
|
|
2385
2388
|
});
|
|
2386
|
-
|
|
2389
|
+
React12__namespace.default.useEffect(() => {
|
|
2387
2390
|
if (accordionState.open.length === children.length) return;
|
|
2388
2391
|
const defaultOpenIdx = props.defaultOpenIdx;
|
|
2389
2392
|
const items = new Array(children.length).fill(null).map((x, i) => {
|
|
@@ -2490,10 +2493,10 @@ var MotionDiv4 = motionTags.div;
|
|
|
2490
2493
|
var MotionBtn2 = motionTags.button;
|
|
2491
2494
|
var breakpoint = ["(min-width: 600px)"];
|
|
2492
2495
|
function DrawerComponent(props) {
|
|
2493
|
-
const ref =
|
|
2494
|
-
const dragHandleRef =
|
|
2496
|
+
const ref = React12__namespace.default.useRef(null);
|
|
2497
|
+
const dragHandleRef = React12__namespace.default.useRef(null);
|
|
2495
2498
|
const [isDesktop] = useMatchMedia(breakpoint);
|
|
2496
|
-
const closeFnRef =
|
|
2499
|
+
const closeFnRef = React12__namespace.default.useRef(null);
|
|
2497
2500
|
const dragControls = framerMotion.useDragControls();
|
|
2498
2501
|
const { open, setOpen } = useDrawer();
|
|
2499
2502
|
const { onClose, ...rest } = props;
|
|
@@ -2504,10 +2507,12 @@ function DrawerComponent(props) {
|
|
|
2504
2507
|
setOpen(true);
|
|
2505
2508
|
};
|
|
2506
2509
|
const closeDrawer = () => setOpen(false);
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2510
|
+
React12__namespace.default.useEffect(() => {
|
|
2511
|
+
closeFnRef.current = () => {
|
|
2512
|
+
closeDrawer();
|
|
2513
|
+
onClose?.();
|
|
2514
|
+
};
|
|
2515
|
+
});
|
|
2511
2516
|
const onDragStart = (e, info) => {
|
|
2512
2517
|
console.log({ e });
|
|
2513
2518
|
if (isDesktop) return;
|
|
@@ -2515,16 +2520,18 @@ function DrawerComponent(props) {
|
|
|
2515
2520
|
if (!noDragEl || !noDragEl.contains(e.target)) {
|
|
2516
2521
|
dragControls.start(e);
|
|
2517
2522
|
} else {
|
|
2518
|
-
dragControls.componentControls.forEach(
|
|
2519
|
-
entry
|
|
2520
|
-
|
|
2523
|
+
dragControls.componentControls.forEach(
|
|
2524
|
+
(entry) => {
|
|
2525
|
+
entry.stop(e, info);
|
|
2526
|
+
}
|
|
2527
|
+
);
|
|
2521
2528
|
}
|
|
2522
2529
|
};
|
|
2523
|
-
|
|
2530
|
+
React12__namespace.default.useEffect(() => {
|
|
2524
2531
|
if (props.open) openDrawer();
|
|
2525
|
-
else closeFnRef.current();
|
|
2532
|
+
else closeFnRef.current?.();
|
|
2526
2533
|
}, [props.open]);
|
|
2527
|
-
|
|
2534
|
+
React12__namespace.default.useEffect(() => {
|
|
2528
2535
|
const container = ref.current;
|
|
2529
2536
|
if (!open || !container) return;
|
|
2530
2537
|
container.setAttribute("tabindex", "0");
|
|
@@ -2535,7 +2542,7 @@ function DrawerComponent(props) {
|
|
|
2535
2542
|
const closeOnEsc = (e) => {
|
|
2536
2543
|
if (e.key !== "Escape" || props.closeOnEsc === false) return;
|
|
2537
2544
|
console.log("[close] esc key");
|
|
2538
|
-
closeFnRef.current();
|
|
2545
|
+
closeFnRef.current?.();
|
|
2539
2546
|
};
|
|
2540
2547
|
container.addEventListener("focusout", trapFocus);
|
|
2541
2548
|
container.addEventListener("keydown", closeOnEsc);
|
|
@@ -2545,12 +2552,12 @@ function DrawerComponent(props) {
|
|
|
2545
2552
|
container.removeEventListener("keydown", closeOnEsc);
|
|
2546
2553
|
document.body.style.overflow = "auto";
|
|
2547
2554
|
};
|
|
2548
|
-
}, [open]);
|
|
2549
|
-
|
|
2555
|
+
}, [open, props.closeOnEsc]);
|
|
2556
|
+
React12__namespace.default.useEffect(() => {
|
|
2550
2557
|
const unsubscribeY = y.on("change", (latestY) => {
|
|
2551
2558
|
if (latestY > 150) {
|
|
2552
2559
|
console.log("[close] latestY > 150");
|
|
2553
|
-
closeFnRef.current();
|
|
2560
|
+
closeFnRef.current?.();
|
|
2554
2561
|
}
|
|
2555
2562
|
});
|
|
2556
2563
|
return () => {
|
|
@@ -2561,7 +2568,7 @@ function DrawerComponent(props) {
|
|
|
2561
2568
|
const outsideClickClose = props.outsideClickClose ?? true;
|
|
2562
2569
|
if (!outsideClickClose) return;
|
|
2563
2570
|
console.log("[close] clicked backdrop");
|
|
2564
|
-
closeFnRef.current();
|
|
2571
|
+
closeFnRef.current?.();
|
|
2565
2572
|
};
|
|
2566
2573
|
return reactDom.createPortal(
|
|
2567
2574
|
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, mode: "wait", children: open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2629,9 +2636,7 @@ function DrawerComponent(props) {
|
|
|
2629
2636
|
drag: "y",
|
|
2630
2637
|
style: { y },
|
|
2631
2638
|
dragControls,
|
|
2632
|
-
|
|
2633
|
-
onPointerDown: (...args) => onDragStart(args[0], args[1]),
|
|
2634
|
-
// onPointerDown: (x, y) => onDragStart(x, y),
|
|
2639
|
+
onPointerDown: (e) => onDragStart(e),
|
|
2635
2640
|
// drag={hasBackdrop ? "y" : false}
|
|
2636
2641
|
dragElastic: 0,
|
|
2637
2642
|
// prevent drawer from being dragged higher than what its opened to
|
|
@@ -2687,19 +2692,19 @@ function DrawerComponent(props) {
|
|
|
2687
2692
|
document.getElementById("portal")
|
|
2688
2693
|
);
|
|
2689
2694
|
}
|
|
2690
|
-
var DrawerContext =
|
|
2695
|
+
var DrawerContext = React12__namespace.default.createContext({
|
|
2691
2696
|
open: false,
|
|
2692
|
-
setOpen: (
|
|
2697
|
+
setOpen: () => {
|
|
2693
2698
|
return;
|
|
2694
2699
|
}
|
|
2695
2700
|
});
|
|
2696
2701
|
function DrawerProvider(props) {
|
|
2697
|
-
const [open, setOpen] =
|
|
2702
|
+
const [open, setOpen] = React12__namespace.default.useState(false);
|
|
2698
2703
|
const value = { open, setOpen };
|
|
2699
2704
|
return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value, children: props.children });
|
|
2700
2705
|
}
|
|
2701
2706
|
function useDrawer() {
|
|
2702
|
-
const context2 =
|
|
2707
|
+
const context2 = React12__namespace.default.useContext(DrawerContext);
|
|
2703
2708
|
if (context2 === void 0) {
|
|
2704
2709
|
throw new Error("useDrawer must be used within a DrawerProvider");
|
|
2705
2710
|
}
|
|
@@ -2712,7 +2717,7 @@ function BtnGroup(props) {
|
|
|
2712
2717
|
const [isDesktop] = useMatchMedia(breakpoint);
|
|
2713
2718
|
const { children, ...rest } = props;
|
|
2714
2719
|
if (isDesktop) {
|
|
2715
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MotionDiv4, { flex: true, alignI: true, gap: 4, ...rest, children:
|
|
2720
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MotionDiv4, { flex: true, alignI: true, gap: 4, ...rest, children: React12__namespace.default.Children.toArray(children).toReversed() });
|
|
2716
2721
|
} else {
|
|
2717
2722
|
return /* @__PURE__ */ jsxRuntime.jsx(MotionDiv4, { grid: true, rowG: 14, ...props });
|
|
2718
2723
|
}
|
|
@@ -2761,7 +2766,7 @@ function CloseBtn(props) {
|
|
|
2761
2766
|
h: 16,
|
|
2762
2767
|
w: 16,
|
|
2763
2768
|
fontSize: 16,
|
|
2764
|
-
color:
|
|
2769
|
+
color: "currentColor"
|
|
2765
2770
|
}
|
|
2766
2771
|
)
|
|
2767
2772
|
}
|
|
@@ -2773,7 +2778,7 @@ function CloseBtn(props) {
|
|
|
2773
2778
|
}
|
|
2774
2779
|
}
|
|
2775
2780
|
function Backdrop(props) {
|
|
2776
|
-
const [allowOutsideClick, setAllowOutsideClick] =
|
|
2781
|
+
const [allowOutsideClick, setAllowOutsideClick] = React12__namespace.default.useState(true);
|
|
2777
2782
|
const [isDesktop] = useMatchMedia(breakpoint);
|
|
2778
2783
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2779
2784
|
MotionDiv4,
|
|
@@ -2796,7 +2801,7 @@ function Backdrop(props) {
|
|
|
2796
2801
|
left: 0,
|
|
2797
2802
|
height: "100%",
|
|
2798
2803
|
width: "100%",
|
|
2799
|
-
placeI:
|
|
2804
|
+
...isDesktop ? { placeI: true } : {},
|
|
2800
2805
|
onClick: () => allowOutsideClick ? props.onClick() : void 0,
|
|
2801
2806
|
children: props.children
|
|
2802
2807
|
}
|
|
@@ -2809,8 +2814,8 @@ function useMatchMedia(queries, defaultValues = []) {
|
|
|
2809
2814
|
const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
|
|
2810
2815
|
return matchedQueries;
|
|
2811
2816
|
};
|
|
2812
|
-
const [value, setValue] =
|
|
2813
|
-
|
|
2817
|
+
const [value, setValue] = React12__namespace.default.useState(getValue);
|
|
2818
|
+
React12__namespace.default.useLayoutEffect(() => {
|
|
2814
2819
|
const handler = () => setValue(getValue);
|
|
2815
2820
|
mediaQueryLists.forEach((mql) => mql.addListener(handler));
|
|
2816
2821
|
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
|
|
@@ -2823,9 +2828,9 @@ var TrackBgNameKey = "TrackBg";
|
|
|
2823
2828
|
var TrackFillNameKey = "TrackFill";
|
|
2824
2829
|
function Progress(props) {
|
|
2825
2830
|
const { children, steps, value, max: maxProp, ...rest } = props;
|
|
2826
|
-
const [progress, setProgress] =
|
|
2831
|
+
const [progress, setProgress] = React12__namespace.default.useState(0);
|
|
2827
2832
|
const max = maxProp ?? 100;
|
|
2828
|
-
|
|
2833
|
+
React12__namespace.default.useEffect(() => {
|
|
2829
2834
|
setProgress(Math.min((value ?? 0) / max, 1) * 100);
|
|
2830
2835
|
}, [value, max]);
|
|
2831
2836
|
const width = `${progress}%`;
|
|
@@ -2865,7 +2870,7 @@ function Progress(props) {
|
|
|
2865
2870
|
TrackFillNameKey
|
|
2866
2871
|
);
|
|
2867
2872
|
const barHeight = rest.h ?? 8;
|
|
2868
|
-
const bgEl = trackBgChild ?
|
|
2873
|
+
const bgEl = trackBgChild ? React12__namespace.default.cloneElement(trackBgChild, {
|
|
2869
2874
|
gridArea: "1 / 1",
|
|
2870
2875
|
h: barHeight,
|
|
2871
2876
|
w: trackBgChild.props.w ?? true
|
|
@@ -2880,7 +2885,7 @@ function Progress(props) {
|
|
|
2880
2885
|
bg: { base: "neutral.200", _dark: "neutral.700" }
|
|
2881
2886
|
}
|
|
2882
2887
|
);
|
|
2883
|
-
const fillEl = trackFillChild ?
|
|
2888
|
+
const fillEl = trackFillChild ? React12__namespace.default.cloneElement(trackFillChild, {
|
|
2884
2889
|
gridArea: "1 / 1",
|
|
2885
2890
|
h: barHeight,
|
|
2886
2891
|
roundedLeft: 9999,
|
|
@@ -2951,7 +2956,7 @@ function TrackFill(props) {
|
|
|
2951
2956
|
}
|
|
2952
2957
|
TrackFill.displayName = TrackFillNameKey;
|
|
2953
2958
|
var Base5 = base;
|
|
2954
|
-
var TooltipContainer =
|
|
2959
|
+
var TooltipContainer = React12__namespace.default.forwardRef(function TooltipContainer2(props, ref) {
|
|
2955
2960
|
const { children, className, style, ...rest } = props;
|
|
2956
2961
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2957
2962
|
Base5,
|
|
@@ -2978,9 +2983,9 @@ function Tooltip(props) {
|
|
|
2978
2983
|
delay = 80,
|
|
2979
2984
|
className
|
|
2980
2985
|
} = props;
|
|
2981
|
-
const referenceRef =
|
|
2982
|
-
const arrowRef =
|
|
2983
|
-
const [open, setOpen] =
|
|
2986
|
+
const referenceRef = React12__namespace.default.useRef(null);
|
|
2987
|
+
const arrowRef = React12__namespace.default.useRef(null);
|
|
2988
|
+
const [open, setOpen] = React12__namespace.default.useState(false);
|
|
2984
2989
|
const { x, y, refs, strategy, middlewareData, context: context2 } = react.useFloating({
|
|
2985
2990
|
open,
|
|
2986
2991
|
onOpenChange: setOpen,
|
|
@@ -3009,7 +3014,7 @@ function Tooltip(props) {
|
|
|
3009
3014
|
role
|
|
3010
3015
|
]);
|
|
3011
3016
|
const referenceProps = getReferenceProps({});
|
|
3012
|
-
|
|
3017
|
+
React12__namespace.default.useEffect(() => {
|
|
3013
3018
|
if (!follow || !referenceRef.current) return;
|
|
3014
3019
|
const el = referenceRef.current;
|
|
3015
3020
|
const onMove = (e) => {
|
|
@@ -3032,14 +3037,14 @@ function Tooltip(props) {
|
|
|
3032
3037
|
const arrowAnchorStyle = side.startsWith("top") ? { bottom: -anchorOffset } : side.startsWith("bottom") ? { top: -anchorOffset } : side.startsWith("left") ? { right: -anchorOffset } : { left: -anchorOffset };
|
|
3033
3038
|
const arrowStyle = side.startsWith("top") || side.startsWith("bottom") ? { left: arrowX || void 0, ...arrowAnchorStyle } : { top: arrowY || void 0, ...arrowAnchorStyle };
|
|
3034
3039
|
const transformOrigin = side.startsWith("top") ? "center bottom" : side.startsWith("bottom") ? "center top" : side.startsWith("left") ? "right center" : side.startsWith("right") ? "left center" : "center";
|
|
3035
|
-
const childrenArray =
|
|
3040
|
+
const childrenArray = React12__namespace.default.Children.toArray(children);
|
|
3036
3041
|
const hasMultipleChildren = childrenArray.length > 1;
|
|
3037
3042
|
let child;
|
|
3038
3043
|
if (hasMultipleChildren) {
|
|
3039
3044
|
child = /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "inline-block" }, children });
|
|
3040
3045
|
} else {
|
|
3041
|
-
const only =
|
|
3042
|
-
const isDomElement =
|
|
3046
|
+
const only = React12__namespace.default.Children.only(children);
|
|
3047
|
+
const isDomElement = React12__namespace.default.isValidElement(only) && typeof only.type === "string";
|
|
3043
3048
|
child = isDomElement ? only : (
|
|
3044
3049
|
// Ensure the wrapper reliably captures mouseenter/pointerenter and can contain block elements
|
|
3045
3050
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "inline-block" }, children: only })
|
|
@@ -3057,7 +3062,7 @@ function Tooltip(props) {
|
|
|
3057
3062
|
originalRef.current = node;
|
|
3058
3063
|
};
|
|
3059
3064
|
const refAttrs = referenceProps;
|
|
3060
|
-
const cloned =
|
|
3065
|
+
const cloned = React12__namespace.default.cloneElement(
|
|
3061
3066
|
child,
|
|
3062
3067
|
{
|
|
3063
3068
|
...refAttrs,
|
|
@@ -3066,11 +3071,11 @@ function Tooltip(props) {
|
|
|
3066
3071
|
}
|
|
3067
3072
|
);
|
|
3068
3073
|
if (disabled) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: cloned });
|
|
3069
|
-
const [isMounted, setIsMounted] =
|
|
3070
|
-
const closeTimerRef =
|
|
3074
|
+
const [isMounted, setIsMounted] = React12__namespace.default.useState(false);
|
|
3075
|
+
const closeTimerRef = React12__namespace.default.useRef(
|
|
3071
3076
|
null
|
|
3072
3077
|
);
|
|
3073
|
-
|
|
3078
|
+
React12__namespace.default.useEffect(() => {
|
|
3074
3079
|
if (closeTimerRef.current) {
|
|
3075
3080
|
clearTimeout(closeTimerRef.current);
|
|
3076
3081
|
closeTimerRef.current = null;
|
|
@@ -3093,24 +3098,24 @@ function Tooltip(props) {
|
|
|
3093
3098
|
let arrowEl = null;
|
|
3094
3099
|
let floatingNode = null;
|
|
3095
3100
|
const findRoleTooltipElement = (node) => {
|
|
3096
|
-
if (!
|
|
3101
|
+
if (!React12__namespace.default.isValidElement(node)) return null;
|
|
3097
3102
|
const el = node;
|
|
3098
3103
|
if (el.props?.role === "tooltip") return el;
|
|
3099
3104
|
const kids = el.props?.children;
|
|
3100
3105
|
if (!kids) return null;
|
|
3101
|
-
const arr =
|
|
3106
|
+
const arr = React12__namespace.default.Children.toArray(kids);
|
|
3102
3107
|
for (const c of arr) {
|
|
3103
|
-
if (
|
|
3108
|
+
if (React12__namespace.default.isValidElement(c) && c.props?.role === "tooltip") {
|
|
3104
3109
|
return c;
|
|
3105
3110
|
}
|
|
3106
3111
|
}
|
|
3107
3112
|
return null;
|
|
3108
3113
|
};
|
|
3109
|
-
const isCustomTooltip =
|
|
3114
|
+
const isCustomTooltip = React12__namespace.default.isValidElement(content) && !!(content.type && content.type.isBlockTooltipContainer);
|
|
3110
3115
|
const customEl = isCustomTooltip ? content : findRoleTooltipElement(content);
|
|
3111
|
-
const containerRef =
|
|
3112
|
-
const [containerBg, setContainerBg] =
|
|
3113
|
-
|
|
3116
|
+
const containerRef = React12__namespace.default.useRef(null);
|
|
3117
|
+
const [containerBg, setContainerBg] = React12__namespace.default.useState();
|
|
3118
|
+
React12__namespace.default.useEffect(() => {
|
|
3114
3119
|
if (!(open || isMounted)) return;
|
|
3115
3120
|
const el = containerRef.current;
|
|
3116
3121
|
if (!el) return;
|
|
@@ -3218,7 +3223,7 @@ function Tooltip(props) {
|
|
|
3218
3223
|
else if (originalChildRef && typeof originalChildRef === "object")
|
|
3219
3224
|
originalChildRef.current = node;
|
|
3220
3225
|
};
|
|
3221
|
-
return
|
|
3226
|
+
return React12__namespace.default.cloneElement(
|
|
3222
3227
|
el,
|
|
3223
3228
|
{
|
|
3224
3229
|
// Spread childProps first
|
|
@@ -3315,12 +3320,12 @@ var Svg = motionTags.svg;
|
|
|
3315
3320
|
var CheckboxBtn = motionTags.button;
|
|
3316
3321
|
function Checkbox(props) {
|
|
3317
3322
|
const { children, onClick, ...rest } = props;
|
|
3318
|
-
const [checked, setChecked] =
|
|
3319
|
-
const [indeterminate, setIndeterminate] =
|
|
3320
|
-
|
|
3323
|
+
const [checked, setChecked] = React12__namespace.default.useState(false);
|
|
3324
|
+
const [indeterminate, setIndeterminate] = React12__namespace.default.useState(false);
|
|
3325
|
+
React12__namespace.default.useEffect(() => {
|
|
3321
3326
|
setChecked(!!rest.checked);
|
|
3322
3327
|
}, [rest.checked]);
|
|
3323
|
-
|
|
3328
|
+
React12__namespace.default.useEffect(() => {
|
|
3324
3329
|
setIndeterminate(!!rest.indeterminate);
|
|
3325
3330
|
}, [rest.indeterminate]);
|
|
3326
3331
|
const isIndeterminate = typeof rest.indeterminate === "boolean";
|
|
@@ -3412,7 +3417,7 @@ function Block(props) {
|
|
|
3412
3417
|
tooltip,
|
|
3413
3418
|
...rest
|
|
3414
3419
|
} = anyProps;
|
|
3415
|
-
const fileInputRef =
|
|
3420
|
+
const fileInputRef = React12__namespace.useRef(null);
|
|
3416
3421
|
const isLoading = anyProps.isLoading;
|
|
3417
3422
|
const multiple = anyProps.multiple;
|
|
3418
3423
|
const is = anyProps.is;
|
|
@@ -3449,7 +3454,7 @@ function Block(props) {
|
|
|
3449
3454
|
...anyProps
|
|
3450
3455
|
}
|
|
3451
3456
|
) : extract.filepickerAllowed ? /* @__PURE__ */ jsxRuntime.jsxs("div", { onClick: () => fileInputRef.current?.click(), children: [
|
|
3452
|
-
|
|
3457
|
+
React12__namespace.createElement(
|
|
3453
3458
|
Comp,
|
|
3454
3459
|
{
|
|
3455
3460
|
cursor: "pointer",
|
|
@@ -3479,7 +3484,7 @@ function Block(props) {
|
|
|
3479
3484
|
value: ""
|
|
3480
3485
|
}
|
|
3481
3486
|
)
|
|
3482
|
-
] }) :
|
|
3487
|
+
] }) : React12__namespace.createElement(
|
|
3483
3488
|
Comp,
|
|
3484
3489
|
{
|
|
3485
3490
|
...isLoading && { "data-loading": isLoading },
|
|
@@ -3587,16 +3592,16 @@ var saveStore = (store) => {
|
|
|
3587
3592
|
|
|
3588
3593
|
// src/react/use-theme/index.ts
|
|
3589
3594
|
function useTheme() {
|
|
3590
|
-
const [store, setStore] =
|
|
3591
|
-
const storeRef =
|
|
3592
|
-
const isInternalUpdateRef =
|
|
3593
|
-
|
|
3595
|
+
const [store, setStore] = React12__namespace.default.useState(getInitialStore);
|
|
3596
|
+
const storeRef = React12__namespace.default.useRef(store);
|
|
3597
|
+
const isInternalUpdateRef = React12__namespace.default.useRef(false);
|
|
3598
|
+
React12__namespace.default.useEffect(() => {
|
|
3594
3599
|
storeRef.current = store;
|
|
3595
3600
|
}, [store]);
|
|
3596
|
-
|
|
3601
|
+
React12__namespace.default.useEffect(() => {
|
|
3597
3602
|
document.documentElement.setAttribute("data-theme", store.value);
|
|
3598
3603
|
}, [store.value]);
|
|
3599
|
-
|
|
3604
|
+
React12__namespace.default.useEffect(() => {
|
|
3600
3605
|
const handleStorageChange = (e) => {
|
|
3601
3606
|
if (e.key === THEME_STORAGE_KEY || e.key === THEME_STORE_STORAGE_KEY) {
|
|
3602
3607
|
setStore(getInitialStore());
|
|
@@ -3626,7 +3631,6 @@ function useTheme() {
|
|
|
3626
3631
|
saveStore(newStore);
|
|
3627
3632
|
};
|
|
3628
3633
|
const toggle = (theme) => {
|
|
3629
|
-
console.log("toggle theme");
|
|
3630
3634
|
const newStore = {
|
|
3631
3635
|
value: theme ?? (storeRef.current.value === "light" ? "dark" : "light"),
|
|
3632
3636
|
isManual: true
|
|
@@ -3640,8 +3644,8 @@ function useTheme() {
|
|
|
3640
3644
|
|
|
3641
3645
|
// src/react/index.ts
|
|
3642
3646
|
function useDebounce(value, delay = 500) {
|
|
3643
|
-
const [debouncedValue, setDebouncedValue] =
|
|
3644
|
-
|
|
3647
|
+
const [debouncedValue, setDebouncedValue] = React12__namespace.default.useState(value);
|
|
3648
|
+
React12__namespace.default.useEffect(() => {
|
|
3645
3649
|
const handler = setTimeout(() => {
|
|
3646
3650
|
setDebouncedValue(value);
|
|
3647
3651
|
}, delay);
|
|
@@ -3652,10 +3656,10 @@ function useDebounce(value, delay = 500) {
|
|
|
3652
3656
|
return debouncedValue;
|
|
3653
3657
|
}
|
|
3654
3658
|
function useThrottle(value, interval = 500) {
|
|
3655
|
-
const [throttledValue, setThrottledValue] =
|
|
3656
|
-
const lastUpdate =
|
|
3657
|
-
const timeoutRef =
|
|
3658
|
-
|
|
3659
|
+
const [throttledValue, setThrottledValue] = React12__namespace.default.useState(value);
|
|
3660
|
+
const lastUpdate = React12__namespace.default.useRef(0);
|
|
3661
|
+
const timeoutRef = React12__namespace.default.useRef(null);
|
|
3662
|
+
React12__namespace.default.useEffect(() => {
|
|
3659
3663
|
const now = Date.now();
|
|
3660
3664
|
const timeSinceLastUpdate = now - lastUpdate.current;
|
|
3661
3665
|
if (timeSinceLastUpdate >= interval) {
|
|
@@ -3685,8 +3689,8 @@ function useMatchMedia2(queries, defaultValues = []) {
|
|
|
3685
3689
|
const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
|
|
3686
3690
|
return matchedQueries;
|
|
3687
3691
|
};
|
|
3688
|
-
const [value, setValue] =
|
|
3689
|
-
|
|
3692
|
+
const [value, setValue] = React12__namespace.default.useState(getValue);
|
|
3693
|
+
React12__namespace.default.useLayoutEffect(() => {
|
|
3690
3694
|
const handler = () => setValue(getValue);
|
|
3691
3695
|
mediaQueryLists.forEach((mql) => mql.addListener(handler));
|
|
3692
3696
|
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
|