react-better-html 1.1.279 → 1.1.280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +38 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "react-better-core";
|
|
27
27
|
|
|
28
28
|
// src/components/BetterHtmlProvider.tsx
|
|
29
|
-
import { createContext, memo as memo12, useCallback as
|
|
29
|
+
import { createContext, memo as memo12, useCallback as useCallback7, useContext, useEffect as useEffect6, useMemo as useMemo3, useState as useState4 } from "react";
|
|
30
30
|
import {
|
|
31
31
|
useBooleanState as useBooleanState3,
|
|
32
32
|
colorThemeControls,
|
|
@@ -129,7 +129,7 @@ import { memo as memo11 } from "react";
|
|
|
129
129
|
import { useTheme as useTheme12 } from "react-better-core";
|
|
130
130
|
|
|
131
131
|
// src/components/Div.tsx
|
|
132
|
-
import { forwardRef as forwardRef6, memo as memo6, useCallback as
|
|
132
|
+
import { forwardRef as forwardRef6, memo as memo6, useCallback as useCallback3 } from "react";
|
|
133
133
|
import { useTheme as useTheme7 } from "react-better-core";
|
|
134
134
|
import styled4 from "styled-components";
|
|
135
135
|
|
|
@@ -1303,7 +1303,7 @@ import { forwardRef as forwardRef2, memo as memo2 } from "react";
|
|
|
1303
1303
|
import { useTheme as useTheme3 } from "react-better-core";
|
|
1304
1304
|
|
|
1305
1305
|
// src/components/Text.tsx
|
|
1306
|
-
import { forwardRef, memo } from "react";
|
|
1306
|
+
import { forwardRef, memo, useCallback as useCallback2 } from "react";
|
|
1307
1307
|
import { useTheme as useTheme2 } from "react-better-core";
|
|
1308
1308
|
import styled, { css } from "styled-components";
|
|
1309
1309
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1320,17 +1320,30 @@ var TextStyledComponent = styled.p.withConfig({
|
|
|
1320
1320
|
${(props) => props.hoverStyle}
|
|
1321
1321
|
}
|
|
1322
1322
|
`;
|
|
1323
|
-
var TextComponent = forwardRef(function Text({ as: asValue, htmlContentTranslate, children, ...props }, ref) {
|
|
1323
|
+
var TextComponent = forwardRef(function Text({ as: asValue, isTabAccessed, htmlContentTranslate, onKeyDown, children, ...props }, ref) {
|
|
1324
1324
|
const theme2 = useTheme2();
|
|
1325
1325
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1326
1326
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1327
1327
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1328
|
+
const onKeyDownElement = useCallback2(
|
|
1329
|
+
(event) => {
|
|
1330
|
+
onKeyDown?.(event);
|
|
1331
|
+
if (!isTabAccessed) return;
|
|
1332
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1333
|
+
event.preventDefault();
|
|
1334
|
+
event.currentTarget.click();
|
|
1335
|
+
}
|
|
1336
|
+
},
|
|
1337
|
+
[onKeyDown, isTabAccessed]
|
|
1338
|
+
);
|
|
1328
1339
|
return /* @__PURE__ */ jsx(
|
|
1329
1340
|
TextStyledComponent,
|
|
1330
1341
|
{
|
|
1331
1342
|
as: asValue,
|
|
1343
|
+
tabIndex: isTabAccessed && !isMobileDevice ? 0 : void 0,
|
|
1332
1344
|
theme: theme2,
|
|
1333
1345
|
translate: htmlContentTranslate,
|
|
1346
|
+
onKeyDown: onKeyDownElement,
|
|
1334
1347
|
style,
|
|
1335
1348
|
hoverStyle,
|
|
1336
1349
|
isP: asValue === "p",
|
|
@@ -1707,14 +1720,14 @@ var DivComponent = forwardRef6(function Div({
|
|
|
1707
1720
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1708
1721
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1709
1722
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1710
|
-
const onClickElement =
|
|
1723
|
+
const onClickElement = useCallback3(
|
|
1711
1724
|
(event) => {
|
|
1712
1725
|
onClick?.(event);
|
|
1713
1726
|
onClickWithValue?.(value);
|
|
1714
1727
|
},
|
|
1715
1728
|
[onClick, onClickWithValue, value]
|
|
1716
1729
|
);
|
|
1717
|
-
const onKeyDownElement =
|
|
1730
|
+
const onKeyDownElement = useCallback3(
|
|
1718
1731
|
(event) => {
|
|
1719
1732
|
onKeyDown?.(event);
|
|
1720
1733
|
if (!isTabAccessed) return;
|
|
@@ -1859,7 +1872,7 @@ Div2.box = DivComponent.box;
|
|
|
1859
1872
|
var Div_default = Div2;
|
|
1860
1873
|
|
|
1861
1874
|
// src/components/alerts/Alert.tsx
|
|
1862
|
-
import { memo as memo10, useCallback as
|
|
1875
|
+
import { memo as memo10, useCallback as useCallback6, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
1863
1876
|
import { useTheme as useTheme11 } from "react-better-core";
|
|
1864
1877
|
import styled8 from "styled-components";
|
|
1865
1878
|
|
|
@@ -1920,7 +1933,7 @@ var localStoragePlugin = (options) => ({
|
|
|
1920
1933
|
});
|
|
1921
1934
|
|
|
1922
1935
|
// src/components/Button.tsx
|
|
1923
|
-
import { memo as memo8, useCallback as
|
|
1936
|
+
import { memo as memo8, useCallback as useCallback4 } from "react";
|
|
1924
1937
|
import {
|
|
1925
1938
|
useBetterCoreContext as useBetterCoreContext3,
|
|
1926
1939
|
useLoader,
|
|
@@ -2160,7 +2173,7 @@ var ButtonComponent = function Button({
|
|
|
2160
2173
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
2161
2174
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
2162
2175
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
2163
|
-
const onClickElement =
|
|
2176
|
+
const onClickElement = useCallback4(
|
|
2164
2177
|
(event) => {
|
|
2165
2178
|
onClick?.(event);
|
|
2166
2179
|
onClickWithValue?.(value);
|
|
@@ -2332,7 +2345,7 @@ ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...button
|
|
|
2332
2345
|
betterHtmlContextInternal.components.button?.style?.upload,
|
|
2333
2346
|
buttonProps
|
|
2334
2347
|
);
|
|
2335
|
-
const onClickElement =
|
|
2348
|
+
const onClickElement = useCallback4(() => {
|
|
2336
2349
|
const input = document.createElement("input");
|
|
2337
2350
|
input.setAttribute("type", "file");
|
|
2338
2351
|
if (accept) input.setAttribute("accept", accept);
|
|
@@ -2361,7 +2374,7 @@ Button2.upload = ButtonComponent.upload;
|
|
|
2361
2374
|
var Button_default = Button2;
|
|
2362
2375
|
|
|
2363
2376
|
// src/components/Modal.tsx
|
|
2364
|
-
import { memo as memo9, useCallback as
|
|
2377
|
+
import { memo as memo9, useCallback as useCallback5, forwardRef as forwardRef7, useImperativeHandle, useRef as useRef2, useEffect as useEffect4 } from "react";
|
|
2365
2378
|
import { createPortal } from "react-dom";
|
|
2366
2379
|
import {
|
|
2367
2380
|
useBetterCoreContext as useBetterCoreContext4,
|
|
@@ -2444,7 +2457,7 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
2444
2457
|
onCloseRef.current = onClose;
|
|
2445
2458
|
const [isOpened, setIsOpened] = useBooleanState2(false);
|
|
2446
2459
|
const [isOpenedLate, setIsOpenedLate] = useBooleanState2(false);
|
|
2447
|
-
const onClickOpen =
|
|
2460
|
+
const onClickOpen = useCallback5(() => {
|
|
2448
2461
|
dialogRef.current?.showModal();
|
|
2449
2462
|
setIsOpened.setTrue();
|
|
2450
2463
|
setIsOpenedLate.setTrue();
|
|
@@ -2458,7 +2471,7 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
2458
2471
|
}
|
|
2459
2472
|
onOpenRef.current?.();
|
|
2460
2473
|
}, [urlQuery, name]);
|
|
2461
|
-
const onClickClose =
|
|
2474
|
+
const onClickClose = useCallback5(
|
|
2462
2475
|
(event) => {
|
|
2463
2476
|
event?.stopPropagation();
|
|
2464
2477
|
setIsOpened.setFalse();
|
|
@@ -2471,7 +2484,7 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
2471
2484
|
},
|
|
2472
2485
|
[urlQuery, name]
|
|
2473
2486
|
);
|
|
2474
|
-
const onKeyDown =
|
|
2487
|
+
const onKeyDown = useCallback5(
|
|
2475
2488
|
(event) => {
|
|
2476
2489
|
if (event.key === "Escape") {
|
|
2477
2490
|
if (!withoutCloseButton) return;
|
|
@@ -2630,11 +2643,11 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
2630
2643
|
ModalComponent.confirmation = forwardRef7(function Confirmation({ message, continueButtonText = "Continue", continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
2631
2644
|
const theme2 = useTheme10();
|
|
2632
2645
|
const modalRef = useRef2(null);
|
|
2633
|
-
const onCancelElement =
|
|
2646
|
+
const onCancelElement = useCallback5(() => {
|
|
2634
2647
|
onCancel?.();
|
|
2635
2648
|
modalRef.current?.close();
|
|
2636
2649
|
}, [onCancel]);
|
|
2637
|
-
const onContinueElement =
|
|
2650
|
+
const onContinueElement = useCallback5(() => {
|
|
2638
2651
|
onContinue?.();
|
|
2639
2652
|
modalRef.current?.close();
|
|
2640
2653
|
}, [onContinue]);
|
|
@@ -2667,11 +2680,11 @@ ModalComponent.destructive = forwardRef7(function Destructive2({
|
|
|
2667
2680
|
}, ref) {
|
|
2668
2681
|
const theme2 = useTheme10();
|
|
2669
2682
|
const modalRef = useRef2(null);
|
|
2670
|
-
const onCancelElement =
|
|
2683
|
+
const onCancelElement = useCallback5(() => {
|
|
2671
2684
|
onCancel?.();
|
|
2672
2685
|
modalRef.current?.close();
|
|
2673
2686
|
}, [onCancel]);
|
|
2674
|
-
const onDeleteElement =
|
|
2687
|
+
const onDeleteElement = useCallback5(() => {
|
|
2675
2688
|
onDelete?.();
|
|
2676
2689
|
modalRef.current?.close();
|
|
2677
2690
|
}, [onDelete]);
|
|
@@ -2837,7 +2850,7 @@ function Alert2({ alert }) {
|
|
|
2837
2850
|
const [isPaused, setIsPaused] = useState3(false);
|
|
2838
2851
|
const [progress, setProgress] = useState3(100);
|
|
2839
2852
|
const [isRemoved, setIsRemoved] = useState3(false);
|
|
2840
|
-
const startProgressTimer =
|
|
2853
|
+
const startProgressTimer = useCallback6(() => {
|
|
2841
2854
|
if (intervalRef.current) {
|
|
2842
2855
|
clearInterval(intervalRef.current);
|
|
2843
2856
|
}
|
|
@@ -2864,7 +2877,7 @@ function Alert2({ alert }) {
|
|
|
2864
2877
|
}
|
|
2865
2878
|
}, updateInterval);
|
|
2866
2879
|
}, [alert, progress, defaultAlertDisplay]);
|
|
2867
|
-
const onClickCloseAlert =
|
|
2880
|
+
const onClickCloseAlert = useCallback6(() => {
|
|
2868
2881
|
setIsRemoved(true);
|
|
2869
2882
|
setTimeout(
|
|
2870
2883
|
() => {
|
|
@@ -2877,7 +2890,7 @@ function Alert2({ alert }) {
|
|
|
2877
2890
|
0.2 * 1e3 - 10
|
|
2878
2891
|
);
|
|
2879
2892
|
}, [alert]);
|
|
2880
|
-
const onMouseEnter =
|
|
2893
|
+
const onMouseEnter = useCallback6(() => {
|
|
2881
2894
|
setIsPaused(true);
|
|
2882
2895
|
if (intervalRef.current) {
|
|
2883
2896
|
clearInterval(intervalRef.current);
|
|
@@ -2885,11 +2898,11 @@ function Alert2({ alert }) {
|
|
|
2885
2898
|
}
|
|
2886
2899
|
remainingTimeRef.current = defaultAlertDurationNumber * (progress / 100);
|
|
2887
2900
|
}, [defaultAlertDurationNumber, progress]);
|
|
2888
|
-
const onMouseLeave =
|
|
2901
|
+
const onMouseLeave = useCallback6(() => {
|
|
2889
2902
|
setIsPaused(false);
|
|
2890
2903
|
startProgressTimer();
|
|
2891
2904
|
}, [startProgressTimer]);
|
|
2892
|
-
const onClickAlertModalDone =
|
|
2905
|
+
const onClickAlertModalDone = useCallback6(() => {
|
|
2893
2906
|
setIsRemoved(true);
|
|
2894
2907
|
modalRef.current?.close();
|
|
2895
2908
|
setTimeout(
|
|
@@ -3125,7 +3138,7 @@ var useAlertControls = () => {
|
|
|
3125
3138
|
throw new Error(
|
|
3126
3139
|
"`useAlertControls()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
3127
3140
|
);
|
|
3128
|
-
const createAlert =
|
|
3141
|
+
const createAlert = useCallback7((alert) => {
|
|
3129
3142
|
const readyAlert = {
|
|
3130
3143
|
id: crypto.randomUUID(),
|
|
3131
3144
|
...alert
|
|
@@ -3133,7 +3146,7 @@ var useAlertControls = () => {
|
|
|
3133
3146
|
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
3134
3147
|
return readyAlert;
|
|
3135
3148
|
}, []);
|
|
3136
|
-
const removeAlert =
|
|
3149
|
+
const removeAlert = useCallback7((alertId) => {
|
|
3137
3150
|
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
3138
3151
|
}, []);
|
|
3139
3152
|
return {
|
|
@@ -3603,25 +3616,30 @@ PageHolder2.center = PageHolderComponent.center;
|
|
|
3603
3616
|
var PageHolder_default = PageHolder2;
|
|
3604
3617
|
|
|
3605
3618
|
// src/components/Chip.tsx
|
|
3606
|
-
import { forwardRef as forwardRef9, memo as memo14, useCallback as
|
|
3619
|
+
import { forwardRef as forwardRef9, memo as memo14, useCallback as useCallback8 } from "react";
|
|
3607
3620
|
import { darkenColor, lightenColor, useBetterCoreContext as useBetterCoreContext6, useTheme as useTheme15 } from "react-better-core";
|
|
3608
3621
|
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3609
3622
|
var borderRadiusOffset = 1.3;
|
|
3610
|
-
var ChipComponent = forwardRef9(function Chip({
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
+
var ChipComponent = forwardRef9(function Chip({ fromSubcomponent, ...chipProps }, ref) {
|
|
3624
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3625
|
+
const {
|
|
3626
|
+
text,
|
|
3627
|
+
beforeText,
|
|
3628
|
+
afterText,
|
|
3629
|
+
color,
|
|
3630
|
+
backgroundColor,
|
|
3631
|
+
borderRadius,
|
|
3632
|
+
isCircle,
|
|
3633
|
+
value,
|
|
3634
|
+
onClick,
|
|
3635
|
+
onClickWithValue,
|
|
3636
|
+
...props
|
|
3637
|
+
} = useComponentsPropsMerger(
|
|
3638
|
+
!fromSubcomponent ? betterHtmlContextInternal.components.chip?.style?.default : {},
|
|
3639
|
+
chipProps
|
|
3640
|
+
);
|
|
3623
3641
|
const theme2 = useTheme15();
|
|
3624
|
-
const onClickElement =
|
|
3642
|
+
const onClickElement = useCallback8(
|
|
3625
3643
|
(event) => {
|
|
3626
3644
|
onClick?.(event);
|
|
3627
3645
|
onClickWithValue?.(value);
|
|
@@ -3649,7 +3667,12 @@ var ChipComponent = forwardRef9(function Chip({
|
|
|
3649
3667
|
}
|
|
3650
3668
|
);
|
|
3651
3669
|
});
|
|
3652
|
-
ChipComponent.colored = forwardRef9(function Colored({ color, withWhiteBackground, ...
|
|
3670
|
+
ChipComponent.colored = forwardRef9(function Colored({ color, withWhiteBackground, ...chipProps }, ref) {
|
|
3671
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3672
|
+
const { ...props } = useComponentsPropsMerger(
|
|
3673
|
+
betterHtmlContextInternal.components.chip?.style?.colored,
|
|
3674
|
+
chipProps
|
|
3675
|
+
);
|
|
3653
3676
|
const theme2 = useTheme15();
|
|
3654
3677
|
const { colorTheme } = useBetterCoreContext6();
|
|
3655
3678
|
const readyColor = color ?? theme2.colors.textSecondary;
|
|
@@ -3678,7 +3701,7 @@ Chip2.colored = ChipComponent.colored;
|
|
|
3678
3701
|
var Chip_default = Chip2;
|
|
3679
3702
|
|
|
3680
3703
|
// src/components/InputField.tsx
|
|
3681
|
-
import { forwardRef as forwardRef11, memo as memo18, useCallback as
|
|
3704
|
+
import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback11, useState as useState7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef5, useId as useId2 } from "react";
|
|
3682
3705
|
import {
|
|
3683
3706
|
darkenColor as darkenColor2,
|
|
3684
3707
|
lightenColor as lightenColor2,
|
|
@@ -3745,7 +3768,7 @@ function Label(labelProps) {
|
|
|
3745
3768
|
var Label_default = memo15(Label);
|
|
3746
3769
|
|
|
3747
3770
|
// src/components/Dropdown.tsx
|
|
3748
|
-
import { forwardRef as forwardRef10, Fragment as Fragment5, memo as memo16, useCallback as
|
|
3771
|
+
import { forwardRef as forwardRef10, Fragment as Fragment5, memo as memo16, useCallback as useCallback9, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef4, useState as useState5 } from "react";
|
|
3749
3772
|
import {
|
|
3750
3773
|
getPluralWord,
|
|
3751
3774
|
useBooleanState as useBooleanState4,
|
|
@@ -3818,7 +3841,7 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
3818
3841
|
(option) => option.label.toLowerCase().includes(query) || option.searchValues?.some((value2) => value2.toLowerCase().includes(query))
|
|
3819
3842
|
);
|
|
3820
3843
|
}, [options, searchQuery]);
|
|
3821
|
-
const onKeyDownInputField =
|
|
3844
|
+
const onKeyDownInputField = useCallback9(
|
|
3822
3845
|
(event) => {
|
|
3823
3846
|
if (event.key === "Enter" || !withSearch && event.key === " ") {
|
|
3824
3847
|
event.preventDefault();
|
|
@@ -3874,7 +3897,7 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
3874
3897
|
withMultiselect
|
|
3875
3898
|
]
|
|
3876
3899
|
);
|
|
3877
|
-
const onClickOption =
|
|
3900
|
+
const onClickOption = useCallback9(
|
|
3878
3901
|
(option) => {
|
|
3879
3902
|
if (!option.disabled) {
|
|
3880
3903
|
const clickedValue = option.value;
|
|
@@ -3891,7 +3914,7 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
3891
3914
|
},
|
|
3892
3915
|
[onChange, internalValue, controlledValue, withMultiselect]
|
|
3893
3916
|
);
|
|
3894
|
-
const onClickClearButton =
|
|
3917
|
+
const onClickClearButton = useCallback9(
|
|
3895
3918
|
(event) => {
|
|
3896
3919
|
event.stopPropagation();
|
|
3897
3920
|
setInternalValue(void 0);
|
|
@@ -3903,7 +3926,7 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
3903
3926
|
},
|
|
3904
3927
|
[onChange]
|
|
3905
3928
|
);
|
|
3906
|
-
const onChangeValue =
|
|
3929
|
+
const onChangeValue = useCallback9(
|
|
3907
3930
|
(newValue) => {
|
|
3908
3931
|
setSearchQuery(newValue);
|
|
3909
3932
|
setIsOpen.setTrue();
|
|
@@ -4161,7 +4184,7 @@ DropdownComponent.countries = forwardRef10(function Countries(dropdownProps, ref
|
|
|
4161
4184
|
dropdownProps
|
|
4162
4185
|
);
|
|
4163
4186
|
const theme2 = useTheme17();
|
|
4164
|
-
const renderOption =
|
|
4187
|
+
const renderOption = useCallback9(
|
|
4165
4188
|
(option, index, isSelected) => /* @__PURE__ */ jsxs12(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
4166
4189
|
/* @__PURE__ */ jsx16(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4167
4190
|
/* @__PURE__ */ jsx16(Text_default, { children: option.label })
|
|
@@ -4198,14 +4221,14 @@ DropdownComponent.language = forwardRef10(function Countries2({ isSmall, ...drop
|
|
|
4198
4221
|
dropdownProps
|
|
4199
4222
|
);
|
|
4200
4223
|
const theme2 = useTheme17();
|
|
4201
|
-
const renderOption =
|
|
4224
|
+
const renderOption = useCallback9(
|
|
4202
4225
|
(option, index, isSelected) => /* @__PURE__ */ jsxs12(Div_default.row, { alignItems: "center", justifyContent: isSmall ? "center" : void 0, gap: theme2.styles.gap, children: [
|
|
4203
4226
|
/* @__PURE__ */ jsx16(Image_default, { src: `https://flagcdn.com/w80/${option.data?.flagCode.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4204
4227
|
!isSmall && /* @__PURE__ */ jsx16(Text_default, { children: option.label })
|
|
4205
4228
|
] }),
|
|
4206
4229
|
[isSmall]
|
|
4207
4230
|
);
|
|
4208
|
-
const onChange =
|
|
4231
|
+
const onChange = useCallback9((value) => {
|
|
4209
4232
|
betterHtmlContextInternal.setLanguage(value);
|
|
4210
4233
|
localStorage.setItem("language", value);
|
|
4211
4234
|
}, []);
|
|
@@ -4244,7 +4267,7 @@ Dropdown2.language = DropdownComponent.language;
|
|
|
4244
4267
|
var Dropdown_default = Dropdown2;
|
|
4245
4268
|
|
|
4246
4269
|
// src/components/Calendar.tsx
|
|
4247
|
-
import { useCallback as
|
|
4270
|
+
import { useCallback as useCallback10, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as useEffect8, useId } from "react";
|
|
4248
4271
|
import { useTheme as useTheme18 } from "react-better-core";
|
|
4249
4272
|
import styled9 from "styled-components";
|
|
4250
4273
|
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
@@ -4303,19 +4326,19 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4303
4326
|
const [currentMonth, setCurrentMonth] = useState6(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
4304
4327
|
const [currentYear, setCurrentYear] = useState6(currentDate?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear());
|
|
4305
4328
|
const daysInMonth = useMemo5(() => new Date(currentYear, currentMonth + 1, 0).getDate(), [currentMonth, currentYear]);
|
|
4306
|
-
const onClickPreviousMonthButton =
|
|
4329
|
+
const onClickPreviousMonthButton = useCallback10(() => {
|
|
4307
4330
|
const newMonth = currentMonth === 0 ? 11 : currentMonth - 1;
|
|
4308
4331
|
const newYear = currentMonth === 0 ? currentYear - 1 : currentYear;
|
|
4309
4332
|
setCurrentMonth(newMonth);
|
|
4310
4333
|
setCurrentYear(newYear);
|
|
4311
4334
|
}, [currentMonth, currentYear]);
|
|
4312
|
-
const onClickNextMonthButton =
|
|
4335
|
+
const onClickNextMonthButton = useCallback10(() => {
|
|
4313
4336
|
const newMonth = currentMonth === 11 ? 0 : currentMonth + 1;
|
|
4314
4337
|
const newYear = currentMonth === 11 ? currentYear + 1 : currentYear;
|
|
4315
4338
|
setCurrentMonth(newMonth);
|
|
4316
4339
|
setCurrentYear(newYear);
|
|
4317
4340
|
}, [currentMonth, currentYear]);
|
|
4318
|
-
const onClickDay =
|
|
4341
|
+
const onClickDay = useCallback10(
|
|
4319
4342
|
(day) => {
|
|
4320
4343
|
if (!day) return;
|
|
4321
4344
|
const newDate = new Date(currentYear, currentMonth, day);
|
|
@@ -4326,18 +4349,18 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
4326
4349
|
},
|
|
4327
4350
|
[currentMonth, currentYear, onChange]
|
|
4328
4351
|
);
|
|
4329
|
-
const onClickClear =
|
|
4352
|
+
const onClickClear = useCallback10(() => {
|
|
4330
4353
|
setCurrentDate(void 0);
|
|
4331
4354
|
onChange?.(void 0);
|
|
4332
4355
|
}, []);
|
|
4333
|
-
const onClickToday =
|
|
4356
|
+
const onClickToday = useCallback10(() => {
|
|
4334
4357
|
const today = /* @__PURE__ */ new Date();
|
|
4335
4358
|
setCurrentDate(today);
|
|
4336
4359
|
onChange?.(
|
|
4337
4360
|
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
|
|
4338
4361
|
);
|
|
4339
4362
|
}, [onChange]);
|
|
4340
|
-
const onChangeYearSelect =
|
|
4363
|
+
const onChangeYearSelect = useCallback10((event) => {
|
|
4341
4364
|
setCurrentYear(parseInt(event.target.value));
|
|
4342
4365
|
}, []);
|
|
4343
4366
|
const firstDayOfMonth = useMemo5(() => {
|
|
@@ -4694,7 +4717,7 @@ var InputFieldComponent = forwardRef11(function InputField(inputFieldProps, ref)
|
|
|
4694
4717
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
4695
4718
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
4696
4719
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
4697
|
-
const onChangeElement =
|
|
4720
|
+
const onChangeElement = useCallback11(
|
|
4698
4721
|
(event) => {
|
|
4699
4722
|
const newValue = event.target.value;
|
|
4700
4723
|
if (withDebounce) {
|
|
@@ -4867,7 +4890,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline(inputFieldProps,
|
|
|
4867
4890
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
4868
4891
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
4869
4892
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
4870
|
-
const onChangeElement =
|
|
4893
|
+
const onChangeElement = useCallback11(
|
|
4871
4894
|
(event) => {
|
|
4872
4895
|
onChange?.(event);
|
|
4873
4896
|
onChangeValue?.(event.target.value);
|
|
@@ -5006,28 +5029,28 @@ InputFieldComponent.search = forwardRef11(function Search(inputFieldProps, ref)
|
|
|
5006
5029
|
);
|
|
5007
5030
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
5008
5031
|
const [inputFieldFocused, setInputFieldFocused] = useBooleanState5();
|
|
5009
|
-
const onChangeValueElement =
|
|
5032
|
+
const onChangeValueElement = useCallback11(
|
|
5010
5033
|
(value2) => {
|
|
5011
5034
|
setInputFieldValue(value2);
|
|
5012
5035
|
onChangeValue?.(value2);
|
|
5013
5036
|
},
|
|
5014
5037
|
[onChangeValue]
|
|
5015
5038
|
);
|
|
5016
|
-
const onFocusElement =
|
|
5039
|
+
const onFocusElement = useCallback11(
|
|
5017
5040
|
(event) => {
|
|
5018
5041
|
setInputFieldFocused.setTrue();
|
|
5019
5042
|
onFocus?.(event);
|
|
5020
5043
|
},
|
|
5021
5044
|
[onFocus]
|
|
5022
5045
|
);
|
|
5023
|
-
const onBlurElement =
|
|
5046
|
+
const onBlurElement = useCallback11(
|
|
5024
5047
|
(event) => {
|
|
5025
5048
|
setTimeout(() => setInputFieldFocused.setFalse(), 0.1 * 1e3);
|
|
5026
5049
|
onBlur?.(event);
|
|
5027
5050
|
},
|
|
5028
5051
|
[onBlur]
|
|
5029
5052
|
);
|
|
5030
|
-
const onClickRightIcon =
|
|
5053
|
+
const onClickRightIcon = useCallback11(() => {
|
|
5031
5054
|
onChangeValueElement("");
|
|
5032
5055
|
}, [onChangeValueElement]);
|
|
5033
5056
|
return /* @__PURE__ */ jsx18(
|
|
@@ -5064,21 +5087,21 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber(inputFieldPr
|
|
|
5064
5087
|
const internalId = useId2();
|
|
5065
5088
|
const [dropdownValue, setDropdownValue] = useState7();
|
|
5066
5089
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
5067
|
-
const renderOption =
|
|
5090
|
+
const renderOption = useCallback11(
|
|
5068
5091
|
(option, index, isSelected) => /* @__PURE__ */ jsxs14(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5069
5092
|
/* @__PURE__ */ jsx18(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5070
5093
|
/* @__PURE__ */ jsx18(Text_default, { children: option.label })
|
|
5071
5094
|
] }),
|
|
5072
5095
|
[]
|
|
5073
5096
|
);
|
|
5074
|
-
const onChangeDropdown =
|
|
5097
|
+
const onChangeDropdown = useCallback11(
|
|
5075
5098
|
(value2) => {
|
|
5076
5099
|
setDropdownValue(value2);
|
|
5077
5100
|
onChangeValue?.(value2 ? `+${value2}${inputFieldValue}` : inputFieldValue);
|
|
5078
5101
|
},
|
|
5079
5102
|
[onChangeValue, inputFieldValue]
|
|
5080
5103
|
);
|
|
5081
|
-
const onChangeValueElement =
|
|
5104
|
+
const onChangeValueElement = useCallback11(
|
|
5082
5105
|
(value2) => {
|
|
5083
5106
|
const readyValue = value2.replace(/\D/g, "");
|
|
5084
5107
|
setInputFieldValue(readyValue);
|
|
@@ -5185,7 +5208,7 @@ InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, dropd
|
|
|
5185
5208
|
insideInputFieldComponentProps,
|
|
5186
5209
|
isFocused
|
|
5187
5210
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5188
|
-
const onChange =
|
|
5211
|
+
const onChange = useCallback11(
|
|
5189
5212
|
(date) => {
|
|
5190
5213
|
restInputFieldProps.onChangeValue?.(date ?? "");
|
|
5191
5214
|
setInternalValue(date ?? "");
|
|
@@ -5272,7 +5295,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
5272
5295
|
() => minutesToRender?.filter((hour) => hour >= 0 && hour <= 59) ?? minutes,
|
|
5273
5296
|
[minutesToRender]
|
|
5274
5297
|
);
|
|
5275
|
-
const onChange =
|
|
5298
|
+
const onChange = useCallback11(
|
|
5276
5299
|
(date) => {
|
|
5277
5300
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
5278
5301
|
restInputFieldProps.onChangeValue?.(newValue);
|
|
@@ -5280,7 +5303,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
5280
5303
|
},
|
|
5281
5304
|
[internalValue, defaultTimeAfterDatePick, restInputFieldProps.onChangeValue]
|
|
5282
5305
|
);
|
|
5283
|
-
const onBlur =
|
|
5306
|
+
const onBlur = useCallback11(
|
|
5284
5307
|
(event) => {
|
|
5285
5308
|
if (hoursToRender || minutesToRender) {
|
|
5286
5309
|
const value = event.target.value;
|
|
@@ -5306,7 +5329,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
5306
5329
|
restInputFieldProps.onBlur
|
|
5307
5330
|
]
|
|
5308
5331
|
);
|
|
5309
|
-
const onClickHour =
|
|
5332
|
+
const onClickHour = useCallback11(
|
|
5310
5333
|
(hour) => {
|
|
5311
5334
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5312
5335
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
@@ -5316,7 +5339,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
5316
5339
|
},
|
|
5317
5340
|
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
5318
5341
|
);
|
|
5319
|
-
const onClickMinute =
|
|
5342
|
+
const onClickMinute = useCallback11(
|
|
5320
5343
|
(minute) => {
|
|
5321
5344
|
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5322
5345
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
@@ -5494,7 +5517,7 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5494
5517
|
() => minutesToRender?.filter((hour) => hour >= 0 && hour <= 59) ?? minutes,
|
|
5495
5518
|
[minutesToRender]
|
|
5496
5519
|
);
|
|
5497
|
-
const onBlur =
|
|
5520
|
+
const onBlur = useCallback11(
|
|
5498
5521
|
(event) => {
|
|
5499
5522
|
if (!!minHours || !!maxHours || !!minMinutes || !!maxMinutes || hoursToRender || minutesToRender) {
|
|
5500
5523
|
const value = event.target.value;
|
|
@@ -5522,7 +5545,7 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5522
5545
|
restInputFieldProps.onBlur
|
|
5523
5546
|
]
|
|
5524
5547
|
);
|
|
5525
|
-
const onClickHour =
|
|
5548
|
+
const onClickHour = useCallback11(
|
|
5526
5549
|
(hour) => {
|
|
5527
5550
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5528
5551
|
restInputFieldProps.onChangeValue?.(value);
|
|
@@ -5530,7 +5553,7 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5530
5553
|
},
|
|
5531
5554
|
[internalValue, restInputFieldProps.onChangeValue]
|
|
5532
5555
|
);
|
|
5533
|
-
const onClickMinute =
|
|
5556
|
+
const onClickMinute = useCallback11(
|
|
5534
5557
|
(minute) => {
|
|
5535
5558
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5536
5559
|
restInputFieldProps.onChangeValue?.(value);
|
|
@@ -5667,7 +5690,7 @@ InputFieldComponent.color = forwardRef11(function Color4({ ...inputFieldProps },
|
|
|
5667
5690
|
inputFieldProps
|
|
5668
5691
|
);
|
|
5669
5692
|
const [inputFieldValue, setInputFieldValue] = useState7(value ?? "#000000");
|
|
5670
|
-
const onChangeValueElement =
|
|
5693
|
+
const onChangeValueElement = useCallback11(
|
|
5671
5694
|
(value2) => {
|
|
5672
5695
|
setInputFieldValue(value2);
|
|
5673
5696
|
onChangeValue?.(value2);
|
|
@@ -5718,7 +5741,7 @@ InputField2.color = InputFieldComponent.color;
|
|
|
5718
5741
|
var InputField_default = InputField2;
|
|
5719
5742
|
|
|
5720
5743
|
// src/components/ToggleInput.tsx
|
|
5721
|
-
import { forwardRef as forwardRef12, useCallback as
|
|
5744
|
+
import { forwardRef as forwardRef12, useCallback as useCallback12, useId as useId3, useState as useState8 } from "react";
|
|
5722
5745
|
import { useBetterCoreContext as useBetterCoreContext8, useBooleanState as useBooleanState6, useTheme as useTheme20 } from "react-better-core";
|
|
5723
5746
|
import styled11, { css as css4 } from "styled-components";
|
|
5724
5747
|
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
@@ -5850,7 +5873,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5850
5873
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
5851
5874
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
5852
5875
|
const [internalChecked, setInternalChecked] = useState8(false);
|
|
5853
|
-
const onChangeElement =
|
|
5876
|
+
const onChangeElement = useCallback12(
|
|
5854
5877
|
(event) => {
|
|
5855
5878
|
const newIsChecked = event.target.checked;
|
|
5856
5879
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
@@ -5859,7 +5882,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5859
5882
|
[onChange, controlledChecked, value]
|
|
5860
5883
|
);
|
|
5861
5884
|
const checked = controlledChecked ?? internalChecked;
|
|
5862
|
-
const onClickText =
|
|
5885
|
+
const onClickText = useCallback12(() => {
|
|
5863
5886
|
const newIsChecked = !checked;
|
|
5864
5887
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
5865
5888
|
onChange?.(newIsChecked, value);
|
|
@@ -6016,7 +6039,7 @@ var ToggleInput_default = {
|
|
|
6016
6039
|
const [internalChecked, setInternalChecked] = useBooleanState6();
|
|
6017
6040
|
const [isMouseDown, setIsMouseDown] = useBooleanState6();
|
|
6018
6041
|
const checked = controlledChecked ?? internalChecked;
|
|
6019
|
-
const onClickElement =
|
|
6042
|
+
const onClickElement = useCallback12(() => {
|
|
6020
6043
|
if (disabled) return;
|
|
6021
6044
|
const newIsChecked = !checked;
|
|
6022
6045
|
if (controlledChecked === void 0) setInternalChecked.setState(newIsChecked);
|
|
@@ -6258,7 +6281,7 @@ FormRow2.withTitle = FormRowComponent.withTitle;
|
|
|
6258
6281
|
var FormRow_default = FormRow2;
|
|
6259
6282
|
|
|
6260
6283
|
// src/components/ColorThemeSwitch.tsx
|
|
6261
|
-
import { memo as memo21, useCallback as
|
|
6284
|
+
import { memo as memo21, useCallback as useCallback13, useEffect as useEffect10, useState as useState9 } from "react";
|
|
6262
6285
|
import { useTheme as useTheme23 } from "react-better-core";
|
|
6263
6286
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6264
6287
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
@@ -6267,7 +6290,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
6267
6290
|
...props
|
|
6268
6291
|
}) {
|
|
6269
6292
|
const [value, setValue] = useState9(localStorage.getItem("theme") === "dark");
|
|
6270
|
-
const onChangeSwitch =
|
|
6293
|
+
const onChangeSwitch = useCallback13((checked) => {
|
|
6271
6294
|
setValue(checked);
|
|
6272
6295
|
document.querySelector("html")?.setAttribute("data-theme", checked ? "dark" : "light");
|
|
6273
6296
|
}, []);
|
|
@@ -6315,7 +6338,7 @@ var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
|
6315
6338
|
import {
|
|
6316
6339
|
forwardRef as forwardRef15,
|
|
6317
6340
|
memo as memo23,
|
|
6318
|
-
useCallback as
|
|
6341
|
+
useCallback as useCallback15,
|
|
6319
6342
|
useMemo as useMemo9,
|
|
6320
6343
|
useState as useState11,
|
|
6321
6344
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -6327,7 +6350,7 @@ import { darkenColor as darkenColor3, useBetterCoreContext as useBetterCoreConte
|
|
|
6327
6350
|
import styled12, { css as css5 } from "styled-components";
|
|
6328
6351
|
|
|
6329
6352
|
// src/components/Pagination.tsx
|
|
6330
|
-
import { memo as memo22, useCallback as
|
|
6353
|
+
import { memo as memo22, useCallback as useCallback14, useEffect as useEffect11, useMemo as useMemo8, useState as useState10 } from "react";
|
|
6331
6354
|
import { useTheme as useTheme24 } from "react-better-core";
|
|
6332
6355
|
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6333
6356
|
var PaginationComponent = function Pagination({
|
|
@@ -6344,12 +6367,12 @@ var PaginationComponent = function Pagination({
|
|
|
6344
6367
|
const mediaQuery = useMediaQuery();
|
|
6345
6368
|
const [currentPageInternal, setCurrentPage] = useState10(currentPage);
|
|
6346
6369
|
const pageCountInternal = pageCount ?? (itemsPerPage !== void 0 ? Math.ceil(itemsLength / itemsPerPage) : 1);
|
|
6347
|
-
const onClickPreviousPageElement =
|
|
6370
|
+
const onClickPreviousPageElement = useCallback14(() => {
|
|
6348
6371
|
const newPage = currentPageInternal <= 1 ? 1 : currentPageInternal - 1;
|
|
6349
6372
|
setCurrentPage(newPage);
|
|
6350
6373
|
onClickPreviousPage?.(newPage);
|
|
6351
6374
|
}, [currentPageInternal, onClickPreviousPage]);
|
|
6352
|
-
const onClickNextPageElement =
|
|
6375
|
+
const onClickNextPageElement = useCallback14(() => {
|
|
6353
6376
|
const newPage = currentPageInternal >= pageCountInternal ? pageCountInternal : currentPageInternal + 1;
|
|
6354
6377
|
setCurrentPage(newPage);
|
|
6355
6378
|
onClickNextPage?.(newPage);
|
|
@@ -6662,7 +6685,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6662
6685
|
}
|
|
6663
6686
|
});
|
|
6664
6687
|
const expandColumn = useMemo9(() => readyColumns.find((column) => column.type === "expand"), [readyColumns]);
|
|
6665
|
-
const renderCellContent =
|
|
6688
|
+
const renderCellContent = useCallback15(
|
|
6666
6689
|
(column, item, itemIndex) => {
|
|
6667
6690
|
switch (column.type) {
|
|
6668
6691
|
case "text": {
|
|
@@ -6717,7 +6740,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6717
6740
|
},
|
|
6718
6741
|
[theme2, checkedItems, expandedRows]
|
|
6719
6742
|
);
|
|
6720
|
-
const onClickRowElement =
|
|
6743
|
+
const onClickRowElement = useCallback15(
|
|
6721
6744
|
(item, index) => {
|
|
6722
6745
|
if (expandColumn) {
|
|
6723
6746
|
setExpandedRows((oldValue) => {
|
|
@@ -6734,14 +6757,14 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6734
6757
|
},
|
|
6735
6758
|
[onClickRow, expandColumn]
|
|
6736
6759
|
);
|
|
6737
|
-
const onClickAllCheckboxesElement =
|
|
6760
|
+
const onClickAllCheckboxesElement = useCallback15(
|
|
6738
6761
|
(checked) => {
|
|
6739
6762
|
onClickAllCheckboxes?.(checked);
|
|
6740
6763
|
setCheckedItems(data.map(() => checked));
|
|
6741
6764
|
},
|
|
6742
6765
|
[onClickAllCheckboxes, data]
|
|
6743
6766
|
);
|
|
6744
|
-
const onClickFilterButton =
|
|
6767
|
+
const onClickFilterButton = useCallback15(
|
|
6745
6768
|
(columnIndex) => {
|
|
6746
6769
|
const thisFilterData = filterData[columnIndex];
|
|
6747
6770
|
if (thisFilterData?.type === "number" || thisFilterData?.type === "date" || thisFilterData?.type === "date-time") {
|
|
@@ -6757,12 +6780,12 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6757
6780
|
},
|
|
6758
6781
|
[filterData]
|
|
6759
6782
|
);
|
|
6760
|
-
const onCloseFilterModal =
|
|
6783
|
+
const onCloseFilterModal = useCallback15(() => {
|
|
6761
6784
|
setTimeout(() => setOpenedFilterColumnIndex(void 0), 0.2 * 1e3);
|
|
6762
6785
|
setFilterListSelectedItems(void 0);
|
|
6763
6786
|
filterForm.reset();
|
|
6764
6787
|
}, []);
|
|
6765
|
-
const onClickCancelFormFilter =
|
|
6788
|
+
const onClickCancelFormFilter = useCallback15(() => {
|
|
6766
6789
|
if (openedFilterColumnIndex === void 0) return;
|
|
6767
6790
|
setFilterData(
|
|
6768
6791
|
(oldValue) => Object.entries({
|
|
@@ -6775,7 +6798,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6775
6798
|
);
|
|
6776
6799
|
filterModalRef.current?.close();
|
|
6777
6800
|
}, [openedFilterColumnIndex]);
|
|
6778
|
-
const onClickFilterListItem =
|
|
6801
|
+
const onClickFilterListItem = useCallback15(
|
|
6779
6802
|
(value) => setFilterListSelectedItems((oldValue) => {
|
|
6780
6803
|
if (!oldValue) return [value];
|
|
6781
6804
|
if (oldValue.includes(value)) return oldValue.filter((item) => item !== value);
|
|
@@ -6783,7 +6806,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6783
6806
|
}),
|
|
6784
6807
|
[]
|
|
6785
6808
|
);
|
|
6786
|
-
const onClickFilterPreset =
|
|
6809
|
+
const onClickFilterPreset = useCallback15(
|
|
6787
6810
|
(preset) => {
|
|
6788
6811
|
const getValueForDate = (date) => {
|
|
6789
6812
|
if (openedFilterColumn?.filter === "date") return date.toISOString().split("T")[0];
|
|
@@ -6868,7 +6891,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6868
6891
|
},
|
|
6869
6892
|
[openedFilterColumn]
|
|
6870
6893
|
);
|
|
6871
|
-
const renderExpandedRow =
|
|
6894
|
+
const renderExpandedRow = useCallback15(
|
|
6872
6895
|
(...props2) => {
|
|
6873
6896
|
const expandColumn2 = readyColumns.find((column) => column.type === "expand");
|
|
6874
6897
|
if (!expandColumn2) return;
|
|
@@ -6929,11 +6952,11 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6929
6952
|
);
|
|
6930
6953
|
}, [data, openedFilterColumn, filterForm.values.search]);
|
|
6931
6954
|
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
|
|
6932
|
-
const onClickSelectAllFilterListItems =
|
|
6955
|
+
const onClickSelectAllFilterListItems = useCallback15(
|
|
6933
6956
|
() => setFilterListSelectedItems(possibleFilterListValues.map((item) => item.value)),
|
|
6934
6957
|
[possibleFilterListValues]
|
|
6935
6958
|
);
|
|
6936
|
-
const onClickDeselectAllFilterListItems =
|
|
6959
|
+
const onClickDeselectAllFilterListItems = useCallback15(() => setFilterListSelectedItems([]), []);
|
|
6937
6960
|
useEffect12(() => {
|
|
6938
6961
|
onChangePage?.(currentPage);
|
|
6939
6962
|
}, [onChangePage, currentPage]);
|
|
@@ -7219,7 +7242,7 @@ var Table2 = memo23(TableComponent);
|
|
|
7219
7242
|
var Table_default = Table2;
|
|
7220
7243
|
|
|
7221
7244
|
// src/components/Tooltip.tsx
|
|
7222
|
-
import { memo as memo24, useCallback as
|
|
7245
|
+
import { memo as memo24, useCallback as useCallback16, useRef as useRef7, useState as useState12, useEffect as useEffect13, forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3, useMemo as useMemo10 } from "react";
|
|
7223
7246
|
import { useTheme as useTheme26 } from "react-better-core";
|
|
7224
7247
|
import styled13, { css as css6 } from "styled-components";
|
|
7225
7248
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -7389,7 +7412,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
7389
7412
|
const gap = theme2.styles.gap / 2;
|
|
7390
7413
|
const outsideScreenGap = theme2.styles.gap / 2;
|
|
7391
7414
|
const totalGap = arrowSize + gap;
|
|
7392
|
-
const openTooltip =
|
|
7415
|
+
const openTooltip = useCallback16(() => {
|
|
7393
7416
|
if (disabled) return;
|
|
7394
7417
|
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
7395
7418
|
setIsOpen(true);
|
|
@@ -7414,18 +7437,18 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
7414
7437
|
}, 1);
|
|
7415
7438
|
onOpen?.();
|
|
7416
7439
|
}, [disabled, onOpen, outsideScreenGap, totalGap]);
|
|
7417
|
-
const closeTooltip =
|
|
7440
|
+
const closeTooltip = useCallback16(() => {
|
|
7418
7441
|
setIsOpen(false);
|
|
7419
7442
|
closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
|
|
7420
7443
|
onClose?.();
|
|
7421
7444
|
}, [onClose]);
|
|
7422
|
-
const onMouseEnter =
|
|
7445
|
+
const onMouseEnter = useCallback16(() => {
|
|
7423
7446
|
if (trigger === "hover") openTooltip();
|
|
7424
7447
|
}, [trigger, openTooltip]);
|
|
7425
|
-
const onMouseLeave =
|
|
7448
|
+
const onMouseLeave = useCallback16(() => {
|
|
7426
7449
|
if (trigger === "hover") closeTooltip();
|
|
7427
7450
|
}, [trigger, closeTooltip]);
|
|
7428
|
-
const onClickHolder =
|
|
7451
|
+
const onClickHolder = useCallback16(
|
|
7429
7452
|
(event) => {
|
|
7430
7453
|
if (trigger === "click") {
|
|
7431
7454
|
if (!isOpen) openTooltip();
|
|
@@ -7434,7 +7457,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
7434
7457
|
},
|
|
7435
7458
|
[trigger, openTooltip, isOpen, closeTooltip]
|
|
7436
7459
|
);
|
|
7437
|
-
const onClickOutside =
|
|
7460
|
+
const onClickOutside = useCallback16(
|
|
7438
7461
|
(event) => {
|
|
7439
7462
|
if (!isOpen) return;
|
|
7440
7463
|
if (trigger !== "click") return;
|
|
@@ -7619,7 +7642,7 @@ Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
|
|
|
7619
7642
|
var Tooltip_default = Tooltip2;
|
|
7620
7643
|
|
|
7621
7644
|
// src/components/Tabs.tsx
|
|
7622
|
-
import { forwardRef as forwardRef17, memo as memo25, useCallback as
|
|
7645
|
+
import { forwardRef as forwardRef17, memo as memo25, useCallback as useCallback17, useEffect as useEffect14, useImperativeHandle as useImperativeHandle4, useMemo as useMemo11, useRef as useRef8, useState as useState13 } from "react";
|
|
7623
7646
|
import { useTheme as useTheme27 } from "react-better-core";
|
|
7624
7647
|
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7625
7648
|
var tabBottomLineWidth = 2;
|
|
@@ -7657,7 +7680,7 @@ var TabsComponent = forwardRef17(function Tabs({
|
|
|
7657
7680
|
return selectedTabId2.id;
|
|
7658
7681
|
});
|
|
7659
7682
|
const [rerenderState, setRerenderState] = useState13(0);
|
|
7660
|
-
const onClickTab =
|
|
7683
|
+
const onClickTab = useCallback17(
|
|
7661
7684
|
(tabId) => {
|
|
7662
7685
|
setSelectedTabId(tabId);
|
|
7663
7686
|
onChange?.(tabId);
|
|
@@ -7847,7 +7870,7 @@ Tabs2.content = TabsComponent.content;
|
|
|
7847
7870
|
var Tabs_default = Tabs2;
|
|
7848
7871
|
|
|
7849
7872
|
// src/components/Foldable.tsx
|
|
7850
|
-
import { forwardRef as forwardRef18, memo as memo26, useCallback as
|
|
7873
|
+
import { forwardRef as forwardRef18, memo as memo26, useCallback as useCallback18, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef9, useState as useState14 } from "react";
|
|
7851
7874
|
import { useBooleanState as useBooleanState7, useTheme as useTheme28 } from "react-better-core";
|
|
7852
7875
|
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7853
7876
|
var animationDurationClose = 0.15;
|
|
@@ -7887,15 +7910,15 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
7887
7910
|
const [internalIsOpen, setInternalIsOpen] = useBooleanState7(defaultOpen);
|
|
7888
7911
|
const [bodyVirtualHeight, setBodyVirtualHeight] = useState14();
|
|
7889
7912
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
7890
|
-
const open =
|
|
7913
|
+
const open = useCallback18(() => {
|
|
7891
7914
|
if (controlledIsOpen === void 0) setInternalIsOpen.setTrue();
|
|
7892
7915
|
onOpenChange?.(true);
|
|
7893
7916
|
}, [controlledIsOpen, onOpenChange]);
|
|
7894
|
-
const close =
|
|
7917
|
+
const close = useCallback18(() => {
|
|
7895
7918
|
if (controlledIsOpen === void 0) setInternalIsOpen.setFalse();
|
|
7896
7919
|
onOpenChange?.(false);
|
|
7897
7920
|
}, [controlledIsOpen, onOpenChange]);
|
|
7898
|
-
const toggleOpen =
|
|
7921
|
+
const toggleOpen = useCallback18(() => {
|
|
7899
7922
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
7900
7923
|
onOpenChange?.(!isOpen);
|
|
7901
7924
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
@@ -8008,7 +8031,7 @@ Foldable2.box = FoldableComponent.box;
|
|
|
8008
8031
|
var Foldable_default = Foldable2;
|
|
8009
8032
|
|
|
8010
8033
|
// src/components/SideMenu.tsx
|
|
8011
|
-
import { createContext as createContext2, memo as memo27, useCallback as
|
|
8034
|
+
import { createContext as createContext2, memo as memo27, useCallback as useCallback19, useContext as useContext2, useEffect as useEffect16, useMemo as useMemo12, useState as useState15 } from "react";
|
|
8012
8035
|
import {
|
|
8013
8036
|
calculateColorContrast,
|
|
8014
8037
|
lightenColor as lightenColor3,
|
|
@@ -8042,7 +8065,7 @@ var MenuItemTypeItem = memo27(function MenuItemTypeItem2({
|
|
|
8042
8065
|
const { activeItem, setActiveItem } = useSideMenuContext();
|
|
8043
8066
|
const [isOpened, setIsOpened] = useBooleanState8();
|
|
8044
8067
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
8045
|
-
const onClickElement =
|
|
8068
|
+
const onClickElement = useCallback19(() => {
|
|
8046
8069
|
if (item.disabled) return;
|
|
8047
8070
|
if (!item.children) setActiveItem((oldValue) => oldValue?.href === item.href ? oldValue : void 0);
|
|
8048
8071
|
if (item.children) {
|
|
@@ -8306,7 +8329,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8306
8329
|
const [activeItem, setActiveItem] = useState15();
|
|
8307
8330
|
const [itemsState, setItemsState] = useState15(items);
|
|
8308
8331
|
const [bottomItemsState, setBottomItemsState] = useState15(bottomItems);
|
|
8309
|
-
const onClickXButton =
|
|
8332
|
+
const onClickXButton = useCallback19(() => {
|
|
8310
8333
|
setSideMenuIsOpenMobile.setFalse();
|
|
8311
8334
|
}, []);
|
|
8312
8335
|
const readyItems = useMemo12(() => items.filter((item) => !item.hidden), [items]);
|
|
@@ -8577,7 +8600,7 @@ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onCl
|
|
|
8577
8600
|
const theme2 = useTheme29();
|
|
8578
8601
|
const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
8579
8602
|
const [isHovered, setIsHovered] = useBooleanState8();
|
|
8580
|
-
const onClickElement =
|
|
8603
|
+
const onClickElement = useCallback19(() => {
|
|
8581
8604
|
setSideMenuIsOpenMobile.toggle();
|
|
8582
8605
|
onClick?.(!sideMenuIsOpenMobile);
|
|
8583
8606
|
}, [onClick, sideMenuIsOpenMobile]);
|