react-better-html 1.1.207 → 1.1.209
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 +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1825,7 +1825,18 @@ Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, bac
|
|
|
1825
1825
|
...props,
|
|
1826
1826
|
children: /* @__PURE__ */ jsx4(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
1827
1827
|
}
|
|
1828
|
-
) : /* @__PURE__ */ jsx4(
|
|
1828
|
+
) : /* @__PURE__ */ jsx4(
|
|
1829
|
+
Image,
|
|
1830
|
+
{
|
|
1831
|
+
width: size,
|
|
1832
|
+
height: size,
|
|
1833
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
1834
|
+
borderRadius: 999,
|
|
1835
|
+
objectFit: "cover",
|
|
1836
|
+
ref,
|
|
1837
|
+
...props
|
|
1838
|
+
}
|
|
1839
|
+
);
|
|
1829
1840
|
});
|
|
1830
1841
|
var MemoizedImage = memo4(Image);
|
|
1831
1842
|
MemoizedImage.profileImage = Image.profileImage;
|
|
@@ -3816,7 +3827,7 @@ PageHolder2.center = PageHolderComponent.center;
|
|
|
3816
3827
|
var PageHolder_default = PageHolder2;
|
|
3817
3828
|
|
|
3818
3829
|
// src/components/Chip.tsx
|
|
3819
|
-
import { forwardRef as forwardRef9, memo as memo14 } from "react";
|
|
3830
|
+
import { forwardRef as forwardRef9, memo as memo14, useCallback as useCallback7 } from "react";
|
|
3820
3831
|
|
|
3821
3832
|
// src/utils/colorManipulation.ts
|
|
3822
3833
|
var rgbToHsl = (r, g, b) => {
|
|
@@ -3938,8 +3949,25 @@ var desaturateColor = (hexColor, amount) => {
|
|
|
3938
3949
|
|
|
3939
3950
|
// src/components/Chip.tsx
|
|
3940
3951
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3941
|
-
var ChipComponent = forwardRef9(function Chip({
|
|
3952
|
+
var ChipComponent = forwardRef9(function Chip({
|
|
3953
|
+
text,
|
|
3954
|
+
color,
|
|
3955
|
+
backgroundColor,
|
|
3956
|
+
borderRadius,
|
|
3957
|
+
isCircle,
|
|
3958
|
+
value,
|
|
3959
|
+
onClick,
|
|
3960
|
+
onClickWithValue,
|
|
3961
|
+
...props
|
|
3962
|
+
}, ref) {
|
|
3942
3963
|
const theme2 = useTheme();
|
|
3964
|
+
const onClickElement = useCallback7(
|
|
3965
|
+
(event) => {
|
|
3966
|
+
onClick?.(event);
|
|
3967
|
+
onClickWithValue?.(value);
|
|
3968
|
+
},
|
|
3969
|
+
[onClick, onClickWithValue, value]
|
|
3970
|
+
);
|
|
3943
3971
|
return /* @__PURE__ */ jsx14(
|
|
3944
3972
|
Div_default,
|
|
3945
3973
|
{
|
|
@@ -3948,6 +3976,7 @@ var ChipComponent = forwardRef9(function Chip({ text, color, backgroundColor, bo
|
|
|
3948
3976
|
borderRadius: isCircle ? 999 : borderRadius ?? theme2.styles.borderRadius / 1.3,
|
|
3949
3977
|
paddingBlock: theme2.styles.gap / 2,
|
|
3950
3978
|
paddingInline: theme2.styles.space / 1.5,
|
|
3979
|
+
onClick: onClickElement,
|
|
3951
3980
|
...props,
|
|
3952
3981
|
ref,
|
|
3953
3982
|
children: /* @__PURE__ */ jsx14(Text_default, { color: color ?? theme2.colors.textPrimary, children: text })
|
|
@@ -3974,7 +4003,7 @@ Chip2.colored = ChipComponent.colored;
|
|
|
3974
4003
|
var Chip_default = Chip2;
|
|
3975
4004
|
|
|
3976
4005
|
// src/components/InputField.tsx
|
|
3977
|
-
import { forwardRef as forwardRef11, memo as memo18, useCallback as
|
|
4006
|
+
import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback10, useState as useState7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef5, useId as useId2 } from "react";
|
|
3978
4007
|
import styled10 from "styled-components";
|
|
3979
4008
|
|
|
3980
4009
|
// src/constants/countries.ts
|
|
@@ -5691,7 +5720,7 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
5691
5720
|
var Label_default = memo15(Label);
|
|
5692
5721
|
|
|
5693
5722
|
// src/components/Dropdown.tsx
|
|
5694
|
-
import { forwardRef as forwardRef10, Fragment as Fragment3, memo as memo16, useCallback as
|
|
5723
|
+
import { forwardRef as forwardRef10, Fragment as Fragment3, memo as memo16, useCallback as useCallback8, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef4, useState as useState5 } from "react";
|
|
5695
5724
|
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5696
5725
|
var DropdownComponent = forwardRef10(function Dropdown({
|
|
5697
5726
|
label,
|
|
@@ -5744,7 +5773,7 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
5744
5773
|
(option) => option.label.toLowerCase().includes(query) || option.searchValues?.some((value2) => value2.toLowerCase().includes(query))
|
|
5745
5774
|
);
|
|
5746
5775
|
}, [options, searchQuery]);
|
|
5747
|
-
const onKeyDownInputField =
|
|
5776
|
+
const onKeyDownInputField = useCallback8(
|
|
5748
5777
|
(event) => {
|
|
5749
5778
|
if (event.key === "Enter" || !withSearch && event.key === " ") {
|
|
5750
5779
|
event.preventDefault();
|
|
@@ -5797,7 +5826,7 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
5797
5826
|
withMultiselect
|
|
5798
5827
|
]
|
|
5799
5828
|
);
|
|
5800
|
-
const onClickOption =
|
|
5829
|
+
const onClickOption = useCallback8(
|
|
5801
5830
|
(option) => {
|
|
5802
5831
|
if (!option.disabled) {
|
|
5803
5832
|
const clickedValue = option.value;
|
|
@@ -5812,7 +5841,7 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
5812
5841
|
},
|
|
5813
5842
|
[onChange, internalValue, controlledValue, withMultiselect]
|
|
5814
5843
|
);
|
|
5815
|
-
const onClickClearButton =
|
|
5844
|
+
const onClickClearButton = useCallback8(
|
|
5816
5845
|
(event) => {
|
|
5817
5846
|
event.stopPropagation();
|
|
5818
5847
|
setInternalValue(void 0);
|
|
@@ -5824,7 +5853,7 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
5824
5853
|
},
|
|
5825
5854
|
[onChange]
|
|
5826
5855
|
);
|
|
5827
|
-
const onChangeValue =
|
|
5856
|
+
const onChangeValue = useCallback8(
|
|
5828
5857
|
(newValue) => {
|
|
5829
5858
|
setSearchQuery(newValue);
|
|
5830
5859
|
if (withDebounce) setDebouncedSearchQuery(newValue);
|
|
@@ -6044,7 +6073,7 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
6044
6073
|
});
|
|
6045
6074
|
DropdownComponent.countries = forwardRef10(function Countries({ ...props }, ref) {
|
|
6046
6075
|
const theme2 = useTheme();
|
|
6047
|
-
const renderOption =
|
|
6076
|
+
const renderOption = useCallback8(
|
|
6048
6077
|
(option, index, isSelected) => /* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6049
6078
|
/* @__PURE__ */ jsx15(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
6050
6079
|
/* @__PURE__ */ jsx15(Text_default, { children: option.label })
|
|
@@ -6079,7 +6108,7 @@ Dropdown2.countries = DropdownComponent.countries;
|
|
|
6079
6108
|
var Dropdown_default = Dropdown2;
|
|
6080
6109
|
|
|
6081
6110
|
// src/components/Calendar.tsx
|
|
6082
|
-
import { useCallback as
|
|
6111
|
+
import { useCallback as useCallback9, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as useEffect7, useId } from "react";
|
|
6083
6112
|
import styled9 from "styled-components";
|
|
6084
6113
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6085
6114
|
var getMonthName = (month, short = false) => {
|
|
@@ -6137,19 +6166,19 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
6137
6166
|
const [currentMonth, setCurrentMonth] = useState6(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
6138
6167
|
const [currentYear, setCurrentYear] = useState6(currentDate?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear());
|
|
6139
6168
|
const daysInMonth = useMemo5(() => new Date(currentYear, currentMonth + 1, 0).getDate(), [currentMonth, currentYear]);
|
|
6140
|
-
const onClickPreviousMonthButton =
|
|
6169
|
+
const onClickPreviousMonthButton = useCallback9(() => {
|
|
6141
6170
|
const newMonth = currentMonth === 0 ? 11 : currentMonth - 1;
|
|
6142
6171
|
const newYear = currentMonth === 0 ? currentYear - 1 : currentYear;
|
|
6143
6172
|
setCurrentMonth(newMonth);
|
|
6144
6173
|
setCurrentYear(newYear);
|
|
6145
6174
|
}, [currentMonth, currentYear]);
|
|
6146
|
-
const onClickNextMonthButton =
|
|
6175
|
+
const onClickNextMonthButton = useCallback9(() => {
|
|
6147
6176
|
const newMonth = currentMonth === 11 ? 0 : currentMonth + 1;
|
|
6148
6177
|
const newYear = currentMonth === 11 ? currentYear + 1 : currentYear;
|
|
6149
6178
|
setCurrentMonth(newMonth);
|
|
6150
6179
|
setCurrentYear(newYear);
|
|
6151
6180
|
}, [currentMonth, currentYear]);
|
|
6152
|
-
const onClickDay =
|
|
6181
|
+
const onClickDay = useCallback9(
|
|
6153
6182
|
(day) => {
|
|
6154
6183
|
if (!day) return;
|
|
6155
6184
|
const newDate = new Date(currentYear, currentMonth, day);
|
|
@@ -6160,18 +6189,18 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
6160
6189
|
},
|
|
6161
6190
|
[currentMonth, currentYear, onChange]
|
|
6162
6191
|
);
|
|
6163
|
-
const onClickClear =
|
|
6192
|
+
const onClickClear = useCallback9(() => {
|
|
6164
6193
|
setCurrentDate(void 0);
|
|
6165
6194
|
onChange?.(void 0);
|
|
6166
6195
|
}, []);
|
|
6167
|
-
const onClickToday =
|
|
6196
|
+
const onClickToday = useCallback9(() => {
|
|
6168
6197
|
const today = /* @__PURE__ */ new Date();
|
|
6169
6198
|
setCurrentDate(today);
|
|
6170
6199
|
onChange?.(
|
|
6171
6200
|
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
|
|
6172
6201
|
);
|
|
6173
6202
|
}, [onChange]);
|
|
6174
|
-
const onChangeYearSelect =
|
|
6203
|
+
const onChangeYearSelect = useCallback9((event) => {
|
|
6175
6204
|
setCurrentYear(parseInt(event.target.value));
|
|
6176
6205
|
}, []);
|
|
6177
6206
|
const firstDayOfMonth = useMemo5(() => {
|
|
@@ -6498,7 +6527,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
6498
6527
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
6499
6528
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
6500
6529
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
6501
|
-
const onChangeElement =
|
|
6530
|
+
const onChangeElement = useCallback10(
|
|
6502
6531
|
(event) => {
|
|
6503
6532
|
const newValue = event.target.value;
|
|
6504
6533
|
if (withDebounce) {
|
|
@@ -6644,7 +6673,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
6644
6673
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
6645
6674
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
6646
6675
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
6647
|
-
const onChangeElement =
|
|
6676
|
+
const onChangeElement = useCallback10(
|
|
6648
6677
|
(event) => {
|
|
6649
6678
|
onChange?.(event);
|
|
6650
6679
|
onChangeValue?.(event.target.value);
|
|
@@ -6752,28 +6781,28 @@ InputFieldComponent.password = forwardRef11(function Password({ ...props }, ref)
|
|
|
6752
6781
|
InputFieldComponent.search = forwardRef11(function Search({ value, onChangeValue, onFocus, onBlur, ...props }, ref) {
|
|
6753
6782
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
6754
6783
|
const [inputFieldFocused, setInputFieldFocused] = useBooleanState();
|
|
6755
|
-
const onChangeValueElement =
|
|
6784
|
+
const onChangeValueElement = useCallback10(
|
|
6756
6785
|
(value2) => {
|
|
6757
6786
|
setInputFieldValue(value2);
|
|
6758
6787
|
onChangeValue?.(value2);
|
|
6759
6788
|
},
|
|
6760
6789
|
[onChangeValue]
|
|
6761
6790
|
);
|
|
6762
|
-
const onFocusElement =
|
|
6791
|
+
const onFocusElement = useCallback10(
|
|
6763
6792
|
(event) => {
|
|
6764
6793
|
setInputFieldFocused.setTrue();
|
|
6765
6794
|
onFocus?.(event);
|
|
6766
6795
|
},
|
|
6767
6796
|
[onFocus]
|
|
6768
6797
|
);
|
|
6769
|
-
const onBlurElement =
|
|
6798
|
+
const onBlurElement = useCallback10(
|
|
6770
6799
|
(event) => {
|
|
6771
6800
|
setTimeout(() => setInputFieldFocused.setFalse(), 0.1 * 1e3);
|
|
6772
6801
|
onBlur?.(event);
|
|
6773
6802
|
},
|
|
6774
6803
|
[onBlur]
|
|
6775
6804
|
);
|
|
6776
|
-
const onClickRightIcon =
|
|
6805
|
+
const onClickRightIcon = useCallback10(() => {
|
|
6777
6806
|
onChangeValueElement("");
|
|
6778
6807
|
}, [onChangeValueElement]);
|
|
6779
6808
|
return /* @__PURE__ */ jsx17(
|
|
@@ -6797,21 +6826,21 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
6797
6826
|
const internalId = useId2();
|
|
6798
6827
|
const [dropdownValue, setDropdownValue] = useState7();
|
|
6799
6828
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
6800
|
-
const renderOption =
|
|
6829
|
+
const renderOption = useCallback10(
|
|
6801
6830
|
(option, index, isSelected) => /* @__PURE__ */ jsxs13(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6802
6831
|
/* @__PURE__ */ jsx17(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
6803
6832
|
/* @__PURE__ */ jsx17(Text_default, { children: option.label })
|
|
6804
6833
|
] }),
|
|
6805
6834
|
[]
|
|
6806
6835
|
);
|
|
6807
|
-
const onChangeDropdown =
|
|
6836
|
+
const onChangeDropdown = useCallback10(
|
|
6808
6837
|
(value2) => {
|
|
6809
6838
|
setDropdownValue(value2);
|
|
6810
6839
|
onChangeValue?.(value2 ? `+${value2}${inputFieldValue}` : inputFieldValue);
|
|
6811
6840
|
},
|
|
6812
6841
|
[onChangeValue, inputFieldValue]
|
|
6813
6842
|
);
|
|
6814
|
-
const onChangeValueElement =
|
|
6843
|
+
const onChangeValueElement = useCallback10(
|
|
6815
6844
|
(value2) => {
|
|
6816
6845
|
const readyValue = value2.replace(/\D/g, "");
|
|
6817
6846
|
setInputFieldValue(readyValue);
|
|
@@ -6900,7 +6929,7 @@ InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...pr
|
|
|
6900
6929
|
const holderRef = useRef5(null);
|
|
6901
6930
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
6902
6931
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
6903
|
-
const onChange =
|
|
6932
|
+
const onChange = useCallback10(
|
|
6904
6933
|
(date) => {
|
|
6905
6934
|
inputFieldProps.onChangeValue?.(date ?? "");
|
|
6906
6935
|
setInternalValue(date ?? "");
|
|
@@ -6941,7 +6970,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
6941
6970
|
const selectedMinuteRef = useRef5(null);
|
|
6942
6971
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
6943
6972
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
6944
|
-
const onChange =
|
|
6973
|
+
const onChange = useCallback10(
|
|
6945
6974
|
(date) => {
|
|
6946
6975
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
6947
6976
|
inputFieldProps.onChangeValue?.(newValue);
|
|
@@ -6949,7 +6978,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
6949
6978
|
},
|
|
6950
6979
|
[internalValue, defaultTimeAfterDatePick, inputFieldProps.onChangeValue]
|
|
6951
6980
|
);
|
|
6952
|
-
const onClickHour =
|
|
6981
|
+
const onClickHour = useCallback10(
|
|
6953
6982
|
(hour) => {
|
|
6954
6983
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
6955
6984
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
@@ -6959,7 +6988,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
6959
6988
|
},
|
|
6960
6989
|
[defaultDateAfterTimePick, internalValue, inputFieldProps.onChangeValue]
|
|
6961
6990
|
);
|
|
6962
|
-
const onClickMinute =
|
|
6991
|
+
const onClickMinute = useCallback10(
|
|
6963
6992
|
(minute) => {
|
|
6964
6993
|
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
6965
6994
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
@@ -7095,7 +7124,7 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
7095
7124
|
const selectedMinuteRef = useRef5(null);
|
|
7096
7125
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
7097
7126
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
7098
|
-
const onClickHour =
|
|
7127
|
+
const onClickHour = useCallback10(
|
|
7099
7128
|
(hour) => {
|
|
7100
7129
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
7101
7130
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -7103,7 +7132,7 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
7103
7132
|
},
|
|
7104
7133
|
[internalValue, inputFieldProps.onChangeValue]
|
|
7105
7134
|
);
|
|
7106
|
-
const onClickMinute =
|
|
7135
|
+
const onClickMinute = useCallback10(
|
|
7107
7136
|
(minute) => {
|
|
7108
7137
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
7109
7138
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -7212,7 +7241,7 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
7212
7241
|
});
|
|
7213
7242
|
InputFieldComponent.color = forwardRef11(function Color2({ value, onChangeValue, ...props }, ref) {
|
|
7214
7243
|
const [inputFieldValue, setInputFieldValue] = useState7(value ?? "#000000");
|
|
7215
|
-
const onChangeValueElement =
|
|
7244
|
+
const onChangeValueElement = useCallback10(
|
|
7216
7245
|
(value2) => {
|
|
7217
7246
|
setInputFieldValue(value2);
|
|
7218
7247
|
onChangeValue?.(value2);
|
|
@@ -7261,7 +7290,7 @@ InputField2.color = InputFieldComponent.color;
|
|
|
7261
7290
|
var InputField_default = InputField2;
|
|
7262
7291
|
|
|
7263
7292
|
// src/components/ToggleInput.tsx
|
|
7264
|
-
import { forwardRef as forwardRef12, useCallback as
|
|
7293
|
+
import { forwardRef as forwardRef12, useCallback as useCallback11, useId as useId3, useState as useState8 } from "react";
|
|
7265
7294
|
import styled11 from "styled-components";
|
|
7266
7295
|
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7267
7296
|
var componentSize = 26;
|
|
@@ -7379,7 +7408,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
7379
7408
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
7380
7409
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
7381
7410
|
const [internalChecked, setInternalChecked] = useState8(false);
|
|
7382
|
-
const onChangeElement =
|
|
7411
|
+
const onChangeElement = useCallback11(
|
|
7383
7412
|
(event) => {
|
|
7384
7413
|
const newIsChecked = event.target.checked;
|
|
7385
7414
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
@@ -7388,7 +7417,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
7388
7417
|
[onChange, controlledChecked, value]
|
|
7389
7418
|
);
|
|
7390
7419
|
const checked = controlledChecked ?? internalChecked;
|
|
7391
|
-
const onClickText =
|
|
7420
|
+
const onClickText = useCallback11(() => {
|
|
7392
7421
|
const newIsChecked = !checked;
|
|
7393
7422
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
7394
7423
|
onChange?.(newIsChecked, value);
|
|
@@ -7498,7 +7527,7 @@ var ToggleInput_default = {
|
|
|
7498
7527
|
const [internalChecked, setInternalChecked] = useBooleanState();
|
|
7499
7528
|
const [isMouseDown, setIsMouseDown] = useBooleanState();
|
|
7500
7529
|
const checked = controlledChecked ?? internalChecked;
|
|
7501
|
-
const onClickElement =
|
|
7530
|
+
const onClickElement = useCallback11(() => {
|
|
7502
7531
|
if (disabled) return;
|
|
7503
7532
|
const newIsChecked = !checked;
|
|
7504
7533
|
if (controlledChecked === void 0) setInternalChecked.setState(newIsChecked);
|
|
@@ -7775,7 +7804,7 @@ var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
|
7775
7804
|
import {
|
|
7776
7805
|
forwardRef as forwardRef15,
|
|
7777
7806
|
memo as memo23,
|
|
7778
|
-
useCallback as
|
|
7807
|
+
useCallback as useCallback13,
|
|
7779
7808
|
useMemo as useMemo9,
|
|
7780
7809
|
useState as useState10,
|
|
7781
7810
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -7786,7 +7815,7 @@ import {
|
|
|
7786
7815
|
import styled12, { css as css2 } from "styled-components";
|
|
7787
7816
|
|
|
7788
7817
|
// src/components/Pagination.tsx
|
|
7789
|
-
import { memo as memo22, useCallback as
|
|
7818
|
+
import { memo as memo22, useCallback as useCallback12, useEffect as useEffect10, useMemo as useMemo8, useState as useState9 } from "react";
|
|
7790
7819
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7791
7820
|
var PaginationComponent = function Pagination({
|
|
7792
7821
|
currentPage = 1,
|
|
@@ -7802,12 +7831,12 @@ var PaginationComponent = function Pagination({
|
|
|
7802
7831
|
const mediaQuery = useMediaQuery();
|
|
7803
7832
|
const [currentPageInternal, setCurrentPage] = useState9(currentPage);
|
|
7804
7833
|
const pageCountInternal = pageCount ?? (itemsPerPage !== void 0 ? Math.ceil(itemsLength / itemsPerPage) : 1);
|
|
7805
|
-
const onClickPreviousPageElement =
|
|
7834
|
+
const onClickPreviousPageElement = useCallback12(() => {
|
|
7806
7835
|
const newPage = currentPageInternal <= 1 ? 1 : currentPageInternal - 1;
|
|
7807
7836
|
setCurrentPage(newPage);
|
|
7808
7837
|
onClickPreviousPage?.(newPage);
|
|
7809
7838
|
}, [currentPageInternal, onClickPreviousPage]);
|
|
7810
|
-
const onClickNextPageElement =
|
|
7839
|
+
const onClickNextPageElement = useCallback12(() => {
|
|
7811
7840
|
const newPage = currentPageInternal >= pageCountInternal ? pageCountInternal : currentPageInternal + 1;
|
|
7812
7841
|
setCurrentPage(newPage);
|
|
7813
7842
|
onClickNextPage?.(newPage);
|
|
@@ -8118,7 +8147,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8118
8147
|
}
|
|
8119
8148
|
});
|
|
8120
8149
|
const expandColumn = useMemo9(() => readyColumns.find((column) => column.type === "expand"), [readyColumns]);
|
|
8121
|
-
const renderCellContent =
|
|
8150
|
+
const renderCellContent = useCallback13(
|
|
8122
8151
|
(column, item, itemIndex) => {
|
|
8123
8152
|
switch (column.type) {
|
|
8124
8153
|
case "text": {
|
|
@@ -8173,7 +8202,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8173
8202
|
},
|
|
8174
8203
|
[theme2, checkedItems, expandedRows]
|
|
8175
8204
|
);
|
|
8176
|
-
const onClickRowElement =
|
|
8205
|
+
const onClickRowElement = useCallback13(
|
|
8177
8206
|
(item, index) => {
|
|
8178
8207
|
if (expandColumn) {
|
|
8179
8208
|
setExpandedRows((oldValue) => {
|
|
@@ -8190,14 +8219,14 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8190
8219
|
},
|
|
8191
8220
|
[onClickRow, expandColumn]
|
|
8192
8221
|
);
|
|
8193
|
-
const onClickAllCheckboxesElement =
|
|
8222
|
+
const onClickAllCheckboxesElement = useCallback13(
|
|
8194
8223
|
(checked) => {
|
|
8195
8224
|
onClickAllCheckboxes?.(checked);
|
|
8196
8225
|
setCheckedItems(data.map(() => checked));
|
|
8197
8226
|
},
|
|
8198
8227
|
[onClickAllCheckboxes, data]
|
|
8199
8228
|
);
|
|
8200
|
-
const onClickFilterButton =
|
|
8229
|
+
const onClickFilterButton = useCallback13(
|
|
8201
8230
|
(columnIndex) => {
|
|
8202
8231
|
const thisFilterData = filterData[columnIndex];
|
|
8203
8232
|
if (thisFilterData?.type === "number" || thisFilterData?.type === "date" || thisFilterData?.type === "date-time") {
|
|
@@ -8213,12 +8242,12 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8213
8242
|
},
|
|
8214
8243
|
[filterData]
|
|
8215
8244
|
);
|
|
8216
|
-
const onCloseFilterModal =
|
|
8245
|
+
const onCloseFilterModal = useCallback13(() => {
|
|
8217
8246
|
setTimeout(() => setOpenedFilterColumnIndex(void 0), 0.2 * 1e3);
|
|
8218
8247
|
setFilterListSelectedItems(void 0);
|
|
8219
8248
|
filterForm.reset();
|
|
8220
8249
|
}, []);
|
|
8221
|
-
const onClickCancelFormFilter =
|
|
8250
|
+
const onClickCancelFormFilter = useCallback13(() => {
|
|
8222
8251
|
if (openedFilterColumnIndex === void 0) return;
|
|
8223
8252
|
setFilterData(
|
|
8224
8253
|
(oldValue) => Object.entries({
|
|
@@ -8231,7 +8260,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8231
8260
|
);
|
|
8232
8261
|
filterModalRef.current?.close();
|
|
8233
8262
|
}, [openedFilterColumnIndex]);
|
|
8234
|
-
const onClickFilterListItem =
|
|
8263
|
+
const onClickFilterListItem = useCallback13(
|
|
8235
8264
|
(value) => setFilterListSelectedItems((oldValue) => {
|
|
8236
8265
|
if (!oldValue) return [value];
|
|
8237
8266
|
if (oldValue.includes(value)) return oldValue.filter((item) => item !== value);
|
|
@@ -8239,7 +8268,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8239
8268
|
}),
|
|
8240
8269
|
[]
|
|
8241
8270
|
);
|
|
8242
|
-
const onClickFilterPreset =
|
|
8271
|
+
const onClickFilterPreset = useCallback13(
|
|
8243
8272
|
(preset) => {
|
|
8244
8273
|
const getValueForDate = (date) => {
|
|
8245
8274
|
if (openedFilterColumn?.filter === "date") return date.toISOString().split("T")[0];
|
|
@@ -8324,7 +8353,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8324
8353
|
},
|
|
8325
8354
|
[openedFilterColumn]
|
|
8326
8355
|
);
|
|
8327
|
-
const renderExpandedRow =
|
|
8356
|
+
const renderExpandedRow = useCallback13(
|
|
8328
8357
|
(...props2) => {
|
|
8329
8358
|
const expandColumn2 = readyColumns.find((column) => column.type === "expand");
|
|
8330
8359
|
if (!expandColumn2) return;
|
|
@@ -8400,11 +8429,11 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8400
8429
|
}, []);
|
|
8401
8430
|
}, [data, openedFilterColumn, filterForm.values.search]);
|
|
8402
8431
|
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
|
|
8403
|
-
const onClickSelectAllFilterListItems =
|
|
8432
|
+
const onClickSelectAllFilterListItems = useCallback13(
|
|
8404
8433
|
() => setFilterListSelectedItems(possibleFilterListValues.map((item) => item.value)),
|
|
8405
8434
|
[possibleFilterListValues]
|
|
8406
8435
|
);
|
|
8407
|
-
const onClickDeselectAllFilterListItems =
|
|
8436
|
+
const onClickDeselectAllFilterListItems = useCallback13(() => setFilterListSelectedItems([]), []);
|
|
8408
8437
|
useEffect11(() => {
|
|
8409
8438
|
onChangePage?.(currentPage);
|
|
8410
8439
|
}, [onChangePage, currentPage]);
|
|
@@ -8691,7 +8720,7 @@ var Table2 = memo23(TableComponent);
|
|
|
8691
8720
|
var Table_default = Table2;
|
|
8692
8721
|
|
|
8693
8722
|
// src/components/Tooltip.tsx
|
|
8694
|
-
import { memo as memo24, useCallback as
|
|
8723
|
+
import { memo as memo24, useCallback as useCallback14, useRef as useRef7, useState as useState11, useEffect as useEffect12, forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3, useMemo as useMemo10 } from "react";
|
|
8695
8724
|
import styled13, { css as css3 } from "styled-components";
|
|
8696
8725
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
8697
8726
|
var tooltipContainerStyle = (props) => ({
|
|
@@ -8858,7 +8887,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
8858
8887
|
const gap = theme2.styles.gap / 2;
|
|
8859
8888
|
const outsideScreenGap = theme2.styles.gap / 2;
|
|
8860
8889
|
const totalGap = arrowSize + gap;
|
|
8861
|
-
const openTooltip =
|
|
8890
|
+
const openTooltip = useCallback14(() => {
|
|
8862
8891
|
if (disabled) return;
|
|
8863
8892
|
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
8864
8893
|
setIsOpen(true);
|
|
@@ -8883,18 +8912,18 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
8883
8912
|
}, 1);
|
|
8884
8913
|
onOpen?.();
|
|
8885
8914
|
}, [disabled, onOpen, outsideScreenGap, totalGap]);
|
|
8886
|
-
const closeTooltip =
|
|
8915
|
+
const closeTooltip = useCallback14(() => {
|
|
8887
8916
|
setIsOpen(false);
|
|
8888
8917
|
closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
|
|
8889
8918
|
onClose?.();
|
|
8890
8919
|
}, [onClose]);
|
|
8891
|
-
const onMouseEnter =
|
|
8920
|
+
const onMouseEnter = useCallback14(() => {
|
|
8892
8921
|
if (trigger === "hover") openTooltip();
|
|
8893
8922
|
}, [trigger, openTooltip]);
|
|
8894
|
-
const onMouseLeave =
|
|
8923
|
+
const onMouseLeave = useCallback14(() => {
|
|
8895
8924
|
if (trigger === "hover") closeTooltip();
|
|
8896
8925
|
}, [trigger, closeTooltip]);
|
|
8897
|
-
const onClickHolder =
|
|
8926
|
+
const onClickHolder = useCallback14(
|
|
8898
8927
|
(event) => {
|
|
8899
8928
|
if (trigger === "click") {
|
|
8900
8929
|
if (!isOpen) openTooltip();
|
|
@@ -8903,7 +8932,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
8903
8932
|
},
|
|
8904
8933
|
[trigger, openTooltip, isOpen, closeTooltip]
|
|
8905
8934
|
);
|
|
8906
|
-
const onClickOutside =
|
|
8935
|
+
const onClickOutside = useCallback14(
|
|
8907
8936
|
(event) => {
|
|
8908
8937
|
if (!isOpen) return;
|
|
8909
8938
|
if (trigger !== "click") return;
|
|
@@ -9084,7 +9113,7 @@ Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
|
|
|
9084
9113
|
var Tooltip_default = Tooltip2;
|
|
9085
9114
|
|
|
9086
9115
|
// src/components/Tabs.tsx
|
|
9087
|
-
import { forwardRef as forwardRef17, memo as memo25, useCallback as
|
|
9116
|
+
import { forwardRef as forwardRef17, memo as memo25, useCallback as useCallback15, useEffect as useEffect13, useImperativeHandle as useImperativeHandle4, useMemo as useMemo11, useRef as useRef8, useState as useState12 } from "react";
|
|
9088
9117
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
9089
9118
|
var tabBottomLineWidth = 2;
|
|
9090
9119
|
var tabDotSize = 6;
|
|
@@ -9107,7 +9136,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
9107
9136
|
});
|
|
9108
9137
|
const [rerenderState, setRerenderState] = useState12(0);
|
|
9109
9138
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
9110
|
-
const onClickTab =
|
|
9139
|
+
const onClickTab = useCallback15(
|
|
9111
9140
|
(tab) => {
|
|
9112
9141
|
setSelectedTab(tab);
|
|
9113
9142
|
onChange?.(tab);
|
|
@@ -9275,7 +9304,7 @@ Tabs2.content = TabsComponent.content;
|
|
|
9275
9304
|
var Tabs_default = Tabs2;
|
|
9276
9305
|
|
|
9277
9306
|
// src/components/Foldable.tsx
|
|
9278
|
-
import { forwardRef as forwardRef18, memo as memo26, useCallback as
|
|
9307
|
+
import { forwardRef as forwardRef18, memo as memo26, useCallback as useCallback16, useEffect as useEffect14, useImperativeHandle as useImperativeHandle5, useRef as useRef9, useState as useState13 } from "react";
|
|
9279
9308
|
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
9280
9309
|
var animationDurationClose = 0.15;
|
|
9281
9310
|
var animationDurationOpen = animationDurationClose * 2;
|
|
@@ -9303,15 +9332,15 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
9303
9332
|
const [internalIsOpen, setInternalIsOpen] = useBooleanState(defaultOpen);
|
|
9304
9333
|
const [bodyVirtualHeight, setBodyVirtualHeight] = useState13();
|
|
9305
9334
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
9306
|
-
const open =
|
|
9335
|
+
const open = useCallback16(() => {
|
|
9307
9336
|
if (controlledIsOpen === void 0) setInternalIsOpen.setTrue();
|
|
9308
9337
|
onOpenChange?.(true);
|
|
9309
9338
|
}, [controlledIsOpen, onOpenChange]);
|
|
9310
|
-
const close =
|
|
9339
|
+
const close = useCallback16(() => {
|
|
9311
9340
|
if (controlledIsOpen === void 0) setInternalIsOpen.setFalse();
|
|
9312
9341
|
onOpenChange?.(false);
|
|
9313
9342
|
}, [controlledIsOpen, onOpenChange]);
|
|
9314
|
-
const toggleOpen =
|
|
9343
|
+
const toggleOpen = useCallback16(() => {
|
|
9315
9344
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
9316
9345
|
onOpenChange?.(!isOpen);
|
|
9317
9346
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
@@ -9430,7 +9459,7 @@ Foldable2.box = FoldableComponent.box;
|
|
|
9430
9459
|
var Foldable_default = Foldable2;
|
|
9431
9460
|
|
|
9432
9461
|
// src/components/SideMenu.tsx
|
|
9433
|
-
import { createContext as createContext2, memo as memo27, useCallback as
|
|
9462
|
+
import { createContext as createContext2, memo as memo27, useCallback as useCallback17, useContext as useContext2, useEffect as useEffect15, useMemo as useMemo12, useState as useState14 } from "react";
|
|
9434
9463
|
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
9435
9464
|
var sideMenuContext = createContext2(void 0);
|
|
9436
9465
|
var SideMenuContextProvider = sideMenuContext.Provider;
|
|
@@ -9456,7 +9485,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
9456
9485
|
const { activeItem, setActiveItem } = useSideMenuContext();
|
|
9457
9486
|
const [isOpened, setIsOpened] = useBooleanState();
|
|
9458
9487
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
9459
|
-
const onClickElement =
|
|
9488
|
+
const onClickElement = useCallback17(() => {
|
|
9460
9489
|
if (item.disabled) return;
|
|
9461
9490
|
if (!item.children) setActiveItem((oldValue) => oldValue?.href === item.href ? oldValue : void 0);
|
|
9462
9491
|
if (item.children) {
|
|
@@ -9642,7 +9671,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
9642
9671
|
const mediaQuery = useMediaQuery();
|
|
9643
9672
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed, sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
9644
9673
|
const [activeItem, setActiveItem] = useState14();
|
|
9645
|
-
const onClickXButton =
|
|
9674
|
+
const onClickXButton = useCallback17(() => {
|
|
9646
9675
|
setSideMenuIsOpenMobile.setFalse();
|
|
9647
9676
|
}, []);
|
|
9648
9677
|
const readyItems = useMemo12(() => items.filter((item) => !item.hidden), [items]);
|