react-asc 25.3.0 → 25.3.1
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/index.es.js +26 -10
- package/index.js +26 -10
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -269,7 +269,7 @@ function useMobileDetect() {
|
|
|
269
269
|
useEffect(() => {
|
|
270
270
|
windowSize && checkIsMobile(windowSize.height, windowSize.width);
|
|
271
271
|
}, [windowSize]);
|
|
272
|
-
return { isMobile };
|
|
272
|
+
return { isMobile: isMobile };
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
const useOnDestroy = (callBack) => {
|
|
@@ -1117,11 +1117,11 @@ const FormInput = (props) => {
|
|
|
1117
1117
|
};
|
|
1118
1118
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1119
1119
|
const handleOnInput = (value, type, name) => {
|
|
1120
|
-
onInput && onInput({ value, type, name });
|
|
1120
|
+
onInput && onInput({ value: value, type: type, name: name });
|
|
1121
1121
|
};
|
|
1122
1122
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1123
1123
|
const handleOnChange = (value, type, name) => {
|
|
1124
|
-
onChange && onChange({ value, type, name });
|
|
1124
|
+
onChange && onChange({ value: value, type: type, name: name });
|
|
1125
1125
|
};
|
|
1126
1126
|
return (React.createElement(React.Fragment, null,
|
|
1127
1127
|
(type === 'text' ||
|
|
@@ -1547,10 +1547,11 @@ styleInject(css_248z$x);
|
|
|
1547
1547
|
|
|
1548
1548
|
const MenuBody = (props) => {
|
|
1549
1549
|
const { parentRef, children, className, shadow = true, menuPosition = 'left', onClickBackdrop } = props;
|
|
1550
|
+
const [popperInstance, setPopperInstance] = useState();
|
|
1550
1551
|
const menuBodyRef = useRef(null);
|
|
1551
1552
|
useEffect(() => {
|
|
1552
1553
|
if (menuBodyRef && parentRef.current && menuBodyRef.current) {
|
|
1553
|
-
createPopper(parentRef.current, menuBodyRef.current, {
|
|
1554
|
+
const popperInstance = createPopper(parentRef.current, menuBodyRef.current, {
|
|
1554
1555
|
placement: `${menuPosition}-start`,
|
|
1555
1556
|
modifiers: [
|
|
1556
1557
|
{
|
|
@@ -1570,6 +1571,10 @@ const MenuBody = (props) => {
|
|
|
1570
1571
|
},
|
|
1571
1572
|
]
|
|
1572
1573
|
});
|
|
1574
|
+
setPopperInstance(popperInstance);
|
|
1575
|
+
}
|
|
1576
|
+
else {
|
|
1577
|
+
popperInstance?.destroy();
|
|
1573
1578
|
}
|
|
1574
1579
|
}, [menuBodyRef]);
|
|
1575
1580
|
const getCssClasses = () => {
|
|
@@ -1582,6 +1587,9 @@ const MenuBody = (props) => {
|
|
|
1582
1587
|
const handleClickBackdrop = () => {
|
|
1583
1588
|
onClickBackdrop && onClickBackdrop();
|
|
1584
1589
|
};
|
|
1590
|
+
useOnDestroy(() => {
|
|
1591
|
+
popperInstance?.destroy();
|
|
1592
|
+
});
|
|
1585
1593
|
return (React.createElement(Portal, { className: 'menu-root' },
|
|
1586
1594
|
React.createElement("div", { ref: menuBodyRef, className: getCssClasses() },
|
|
1587
1595
|
React.createElement(List, null, children)),
|
|
@@ -2020,6 +2028,7 @@ styleInject(css_248z$l);
|
|
|
2020
2028
|
|
|
2021
2029
|
const Tooltip = (props) => {
|
|
2022
2030
|
const { children, text, placement = 'bottom', isOpen = false, isShowClose = false, delay = 0 } = props;
|
|
2031
|
+
const [popperInstance, setPopperInstance] = useState();
|
|
2023
2032
|
const [debounce, setDebounce] = useState(delay);
|
|
2024
2033
|
const [open, setOpen] = useState(isOpen);
|
|
2025
2034
|
const [show, setShow] = useState(isOpen);
|
|
@@ -2038,7 +2047,7 @@ const Tooltip = (props) => {
|
|
|
2038
2047
|
}, [delay]);
|
|
2039
2048
|
useEffect(() => {
|
|
2040
2049
|
if (open === true && refChild && refChild.current && refTooltip && refTooltip.current) {
|
|
2041
|
-
createPopper(refChild.current, refTooltip.current, {
|
|
2050
|
+
const popperInstance = createPopper(refChild.current, refTooltip.current, {
|
|
2042
2051
|
placement: placement,
|
|
2043
2052
|
modifiers: [
|
|
2044
2053
|
{
|
|
@@ -2047,6 +2056,10 @@ const Tooltip = (props) => {
|
|
|
2047
2056
|
},
|
|
2048
2057
|
]
|
|
2049
2058
|
});
|
|
2059
|
+
setPopperInstance(popperInstance);
|
|
2060
|
+
}
|
|
2061
|
+
else {
|
|
2062
|
+
popperInstance?.destroy();
|
|
2050
2063
|
}
|
|
2051
2064
|
}, [open]);
|
|
2052
2065
|
const handleMouseOver = () => {
|
|
@@ -2064,6 +2077,9 @@ const Tooltip = (props) => {
|
|
|
2064
2077
|
const handleClickClose = () => {
|
|
2065
2078
|
setShow(false);
|
|
2066
2079
|
};
|
|
2080
|
+
useOnDestroy(() => {
|
|
2081
|
+
popperInstance?.destroy();
|
|
2082
|
+
});
|
|
2067
2083
|
return (React.createElement(React.Fragment, null,
|
|
2068
2084
|
React.createElement("div", { ref: refChild, className: styles$l.tooltipContainer, onMouseOver: handleMouseOver, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur }, children),
|
|
2069
2085
|
open && text &&
|
|
@@ -2520,7 +2536,7 @@ const Step = (props) => {
|
|
|
2520
2536
|
const [hoverRef, isHovered] = useHover();
|
|
2521
2537
|
const handleClick = (event) => {
|
|
2522
2538
|
if (!isDisabled) {
|
|
2523
|
-
onClick && onClick({ event, value });
|
|
2539
|
+
onClick && onClick({ event: event, value: value });
|
|
2524
2540
|
}
|
|
2525
2541
|
};
|
|
2526
2542
|
const getCssClasses = () => {
|
|
@@ -2697,9 +2713,9 @@ const Tabs = (props) => {
|
|
|
2697
2713
|
const [selectedValue, setSelectedValue] = useState('');
|
|
2698
2714
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
2699
2715
|
const tabContext = ({
|
|
2700
|
-
selectedValue,
|
|
2701
|
-
setSelectedValue,
|
|
2702
|
-
fixed
|
|
2716
|
+
selectedValue: selectedValue,
|
|
2717
|
+
setSelectedValue: setSelectedValue,
|
|
2718
|
+
fixed: fixed
|
|
2703
2719
|
});
|
|
2704
2720
|
const prevSelectedValueRef = useRef();
|
|
2705
2721
|
useEffect(() => {
|
|
@@ -2746,7 +2762,7 @@ const Tab = (props) => {
|
|
|
2746
2762
|
return cssClasses.filter(css => css).join(' ');
|
|
2747
2763
|
};
|
|
2748
2764
|
const handleClick = (event) => {
|
|
2749
|
-
onClick && onClick({ event, value });
|
|
2765
|
+
onClick && onClick({ event: event, value: value });
|
|
2750
2766
|
setSelectedValue && setSelectedValue(value);
|
|
2751
2767
|
};
|
|
2752
2768
|
return (React.createElement(Button, { className: getCssClasses(), onClick: handleClick, isActive: selectedValue === value, disabled: disabled }, label));
|
package/index.js
CHANGED
|
@@ -278,7 +278,7 @@ function useMobileDetect() {
|
|
|
278
278
|
React.useEffect(() => {
|
|
279
279
|
windowSize && checkIsMobile(windowSize.height, windowSize.width);
|
|
280
280
|
}, [windowSize]);
|
|
281
|
-
return { isMobile };
|
|
281
|
+
return { isMobile: isMobile };
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
const useOnDestroy = (callBack) => {
|
|
@@ -1126,11 +1126,11 @@ const FormInput = (props) => {
|
|
|
1126
1126
|
};
|
|
1127
1127
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1128
1128
|
const handleOnInput = (value, type, name) => {
|
|
1129
|
-
onInput && onInput({ value, type, name });
|
|
1129
|
+
onInput && onInput({ value: value, type: type, name: name });
|
|
1130
1130
|
};
|
|
1131
1131
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1132
1132
|
const handleOnChange = (value, type, name) => {
|
|
1133
|
-
onChange && onChange({ value, type, name });
|
|
1133
|
+
onChange && onChange({ value: value, type: type, name: name });
|
|
1134
1134
|
};
|
|
1135
1135
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1136
1136
|
(type === 'text' ||
|
|
@@ -1556,10 +1556,11 @@ styleInject(css_248z$x);
|
|
|
1556
1556
|
|
|
1557
1557
|
const MenuBody = (props) => {
|
|
1558
1558
|
const { parentRef, children, className, shadow = true, menuPosition = 'left', onClickBackdrop } = props;
|
|
1559
|
+
const [popperInstance, setPopperInstance] = React.useState();
|
|
1559
1560
|
const menuBodyRef = React.useRef(null);
|
|
1560
1561
|
React.useEffect(() => {
|
|
1561
1562
|
if (menuBodyRef && parentRef.current && menuBodyRef.current) {
|
|
1562
|
-
core.createPopper(parentRef.current, menuBodyRef.current, {
|
|
1563
|
+
const popperInstance = core.createPopper(parentRef.current, menuBodyRef.current, {
|
|
1563
1564
|
placement: `${menuPosition}-start`,
|
|
1564
1565
|
modifiers: [
|
|
1565
1566
|
{
|
|
@@ -1579,6 +1580,10 @@ const MenuBody = (props) => {
|
|
|
1579
1580
|
},
|
|
1580
1581
|
]
|
|
1581
1582
|
});
|
|
1583
|
+
setPopperInstance(popperInstance);
|
|
1584
|
+
}
|
|
1585
|
+
else {
|
|
1586
|
+
popperInstance?.destroy();
|
|
1582
1587
|
}
|
|
1583
1588
|
}, [menuBodyRef]);
|
|
1584
1589
|
const getCssClasses = () => {
|
|
@@ -1591,6 +1596,9 @@ const MenuBody = (props) => {
|
|
|
1591
1596
|
const handleClickBackdrop = () => {
|
|
1592
1597
|
onClickBackdrop && onClickBackdrop();
|
|
1593
1598
|
};
|
|
1599
|
+
useOnDestroy(() => {
|
|
1600
|
+
popperInstance?.destroy();
|
|
1601
|
+
});
|
|
1594
1602
|
return (React__default["default"].createElement(Portal, { className: 'menu-root' },
|
|
1595
1603
|
React__default["default"].createElement("div", { ref: menuBodyRef, className: getCssClasses() },
|
|
1596
1604
|
React__default["default"].createElement(List, null, children)),
|
|
@@ -2029,6 +2037,7 @@ styleInject(css_248z$l);
|
|
|
2029
2037
|
|
|
2030
2038
|
const Tooltip = (props) => {
|
|
2031
2039
|
const { children, text, placement = 'bottom', isOpen = false, isShowClose = false, delay = 0 } = props;
|
|
2040
|
+
const [popperInstance, setPopperInstance] = React.useState();
|
|
2032
2041
|
const [debounce, setDebounce] = React.useState(delay);
|
|
2033
2042
|
const [open, setOpen] = React.useState(isOpen);
|
|
2034
2043
|
const [show, setShow] = React.useState(isOpen);
|
|
@@ -2047,7 +2056,7 @@ const Tooltip = (props) => {
|
|
|
2047
2056
|
}, [delay]);
|
|
2048
2057
|
React.useEffect(() => {
|
|
2049
2058
|
if (open === true && refChild && refChild.current && refTooltip && refTooltip.current) {
|
|
2050
|
-
core.createPopper(refChild.current, refTooltip.current, {
|
|
2059
|
+
const popperInstance = core.createPopper(refChild.current, refTooltip.current, {
|
|
2051
2060
|
placement: placement,
|
|
2052
2061
|
modifiers: [
|
|
2053
2062
|
{
|
|
@@ -2056,6 +2065,10 @@ const Tooltip = (props) => {
|
|
|
2056
2065
|
},
|
|
2057
2066
|
]
|
|
2058
2067
|
});
|
|
2068
|
+
setPopperInstance(popperInstance);
|
|
2069
|
+
}
|
|
2070
|
+
else {
|
|
2071
|
+
popperInstance?.destroy();
|
|
2059
2072
|
}
|
|
2060
2073
|
}, [open]);
|
|
2061
2074
|
const handleMouseOver = () => {
|
|
@@ -2073,6 +2086,9 @@ const Tooltip = (props) => {
|
|
|
2073
2086
|
const handleClickClose = () => {
|
|
2074
2087
|
setShow(false);
|
|
2075
2088
|
};
|
|
2089
|
+
useOnDestroy(() => {
|
|
2090
|
+
popperInstance?.destroy();
|
|
2091
|
+
});
|
|
2076
2092
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2077
2093
|
React__default["default"].createElement("div", { ref: refChild, className: styles$l.tooltipContainer, onMouseOver: handleMouseOver, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur }, children),
|
|
2078
2094
|
open && text &&
|
|
@@ -2529,7 +2545,7 @@ const Step = (props) => {
|
|
|
2529
2545
|
const [hoverRef, isHovered] = useHover();
|
|
2530
2546
|
const handleClick = (event) => {
|
|
2531
2547
|
if (!isDisabled) {
|
|
2532
|
-
onClick && onClick({ event, value });
|
|
2548
|
+
onClick && onClick({ event: event, value: value });
|
|
2533
2549
|
}
|
|
2534
2550
|
};
|
|
2535
2551
|
const getCssClasses = () => {
|
|
@@ -2706,9 +2722,9 @@ const Tabs = (props) => {
|
|
|
2706
2722
|
const [selectedValue, setSelectedValue] = React.useState('');
|
|
2707
2723
|
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
2708
2724
|
const tabContext = ({
|
|
2709
|
-
selectedValue,
|
|
2710
|
-
setSelectedValue,
|
|
2711
|
-
fixed
|
|
2725
|
+
selectedValue: selectedValue,
|
|
2726
|
+
setSelectedValue: setSelectedValue,
|
|
2727
|
+
fixed: fixed
|
|
2712
2728
|
});
|
|
2713
2729
|
const prevSelectedValueRef = React.useRef();
|
|
2714
2730
|
React.useEffect(() => {
|
|
@@ -2755,7 +2771,7 @@ const Tab = (props) => {
|
|
|
2755
2771
|
return cssClasses.filter(css => css).join(' ');
|
|
2756
2772
|
};
|
|
2757
2773
|
const handleClick = (event) => {
|
|
2758
|
-
onClick && onClick({ event, value });
|
|
2774
|
+
onClick && onClick({ event: event, value: value });
|
|
2759
2775
|
setSelectedValue && setSelectedValue(value);
|
|
2760
2776
|
};
|
|
2761
2777
|
return (React__default["default"].createElement(Button, { className: getCssClasses(), onClick: handleClick, isActive: selectedValue === value, disabled: disabled }, label));
|