react-better-html 1.1.76 → 1.1.77
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 +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +575 -237
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +556 -218
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1469,6 +1469,26 @@ var icons = {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
]
|
|
1471
1471
|
},
|
|
1472
|
+
chevronLeft: {
|
|
1473
|
+
width: 320,
|
|
1474
|
+
height: 512,
|
|
1475
|
+
paths: [
|
|
1476
|
+
{
|
|
1477
|
+
d: "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z",
|
|
1478
|
+
type: "fill"
|
|
1479
|
+
}
|
|
1480
|
+
]
|
|
1481
|
+
},
|
|
1482
|
+
chevronRight: {
|
|
1483
|
+
width: 320,
|
|
1484
|
+
height: 512,
|
|
1485
|
+
paths: [
|
|
1486
|
+
{
|
|
1487
|
+
d: "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z",
|
|
1488
|
+
type: "fill"
|
|
1489
|
+
}
|
|
1490
|
+
]
|
|
1491
|
+
},
|
|
1472
1492
|
eye: {
|
|
1473
1493
|
width: 576,
|
|
1474
1494
|
height: 512,
|
|
@@ -1776,7 +1796,7 @@ function useComponentPropsWithoutStyle(props) {
|
|
|
1776
1796
|
[props]
|
|
1777
1797
|
);
|
|
1778
1798
|
}
|
|
1779
|
-
function useComponentInputFieldDateProps(props, holderRef) {
|
|
1799
|
+
function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
1780
1800
|
const theme2 = useTheme();
|
|
1781
1801
|
const [isOpen, setIsOpen] = useBooleanState();
|
|
1782
1802
|
const [isOpenLate, setIsOpenLate] = useBooleanState();
|
|
@@ -1785,7 +1805,7 @@ function useComponentInputFieldDateProps(props, holderRef) {
|
|
|
1785
1805
|
const inputFieldProps = (0, import_react2.useMemo)(
|
|
1786
1806
|
() => ({
|
|
1787
1807
|
value: internalValue,
|
|
1788
|
-
className: `${isOpen ? "react-better-html-inputField-dateTime-opened" : ""}${isOpenLate ? " react-better-html-inputField-dateTime-opened-late" : ""}${props.className ? ` ${props.className}` : ""}`,
|
|
1808
|
+
className: `${isOpen && !disabled ? "react-better-html-inputField-dateTime-opened" : ""}${isOpenLate && !disabled ? " react-better-html-inputField-dateTime-opened-late" : ""}${props.className ? ` ${props.className}` : ""}`,
|
|
1789
1809
|
onClick: (event) => {
|
|
1790
1810
|
if (props.disabled) return;
|
|
1791
1811
|
setIsOpen.setTrue();
|
|
@@ -1804,7 +1824,7 @@ function useComponentInputFieldDateProps(props, holderRef) {
|
|
|
1804
1824
|
props.onChangeValue?.(value);
|
|
1805
1825
|
}
|
|
1806
1826
|
}),
|
|
1807
|
-
[props, internalValue, isOpen, isOpenLate]
|
|
1827
|
+
[props, internalValue, isOpen, isOpenLate, disabled]
|
|
1808
1828
|
);
|
|
1809
1829
|
const insideInputFieldComponentProps = (0, import_react2.useMemo)(
|
|
1810
1830
|
() => ({
|
|
@@ -3132,7 +3152,7 @@ Chip2.circle = ChipComponent.circle;
|
|
|
3132
3152
|
var Chip_default = Chip2;
|
|
3133
3153
|
|
|
3134
3154
|
// src/components/InputField.tsx
|
|
3135
|
-
var
|
|
3155
|
+
var import_react18 = require("react");
|
|
3136
3156
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
3137
3157
|
|
|
3138
3158
|
// src/constants/countries.ts
|
|
@@ -4616,6 +4636,68 @@ var countries = [
|
|
|
4616
4636
|
}
|
|
4617
4637
|
];
|
|
4618
4638
|
|
|
4639
|
+
// src/utils/functions.ts
|
|
4640
|
+
var generateRandomString = (stringLength, options) => {
|
|
4641
|
+
const capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
4642
|
+
const lowers = "abcdefghijklmnopqrstuvwxyz";
|
|
4643
|
+
const numbers = "0123456789";
|
|
4644
|
+
const includes = [];
|
|
4645
|
+
if (options?.includeCapitalLetters !== false) includes.push(capitals);
|
|
4646
|
+
if (options?.includeLowerLetters !== false) includes.push(lowers);
|
|
4647
|
+
if (options?.includeNumbers !== false) includes.push(numbers);
|
|
4648
|
+
const characters = includes.join("");
|
|
4649
|
+
const dashSections = Math.max(1, options?.dashSections ?? 1);
|
|
4650
|
+
const dashSectionLength = Math.floor(stringLength / dashSections);
|
|
4651
|
+
if (stringLength < dashSections) return "";
|
|
4652
|
+
let result = "";
|
|
4653
|
+
let currentSectionLength = 0;
|
|
4654
|
+
while (result.length < stringLength) {
|
|
4655
|
+
if (currentSectionLength >= dashSectionLength) {
|
|
4656
|
+
result += "-";
|
|
4657
|
+
currentSectionLength = 0;
|
|
4658
|
+
}
|
|
4659
|
+
if (result.length < stringLength) {
|
|
4660
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
4661
|
+
currentSectionLength += 1;
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
return result;
|
|
4665
|
+
};
|
|
4666
|
+
var getBrowser = () => {
|
|
4667
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
4668
|
+
if (userAgent.includes("firefox")) return "firefox";
|
|
4669
|
+
if (userAgent.includes("chrome") && !userAgent.includes("edg")) return "chrome";
|
|
4670
|
+
if (userAgent.includes("safari") && !userAgent.includes("chrome")) return "safari";
|
|
4671
|
+
if (userAgent.includes("edg")) return "edge";
|
|
4672
|
+
if (userAgent.includes("opr") || userAgent.includes("opera")) return "opera";
|
|
4673
|
+
return;
|
|
4674
|
+
};
|
|
4675
|
+
var formatPhoneNumber = (phoneNumber) => {
|
|
4676
|
+
const cleanPhoneNumber = phoneNumber.replace(/\D/g, "");
|
|
4677
|
+
const country = countries.find(
|
|
4678
|
+
(country2) => country2.phoneNumberExtension === cleanPhoneNumber.slice(0, country2.phoneNumberExtension.length)
|
|
4679
|
+
);
|
|
4680
|
+
if (!country) return phoneNumber;
|
|
4681
|
+
let phonNumberRest = cleanPhoneNumber.slice(country.phoneNumberExtension.length);
|
|
4682
|
+
if (country.phoneNumberFormat) {
|
|
4683
|
+
let formattedNumber = "";
|
|
4684
|
+
let index = 0;
|
|
4685
|
+
for (const char of country.phoneNumberFormat) {
|
|
4686
|
+
if (char === "X" && index < phonNumberRest.length) {
|
|
4687
|
+
formattedNumber += phonNumberRest[index];
|
|
4688
|
+
index++;
|
|
4689
|
+
} else {
|
|
4690
|
+
formattedNumber += char;
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
phonNumberRest = formattedNumber.replace(/X/g, "").trim();
|
|
4694
|
+
}
|
|
4695
|
+
return `+${country.phoneNumberExtension} ${phonNumberRest}`;
|
|
4696
|
+
};
|
|
4697
|
+
var getFormErrorObject = (formValues) => {
|
|
4698
|
+
return {};
|
|
4699
|
+
};
|
|
4700
|
+
|
|
4619
4701
|
// src/components/Label.tsx
|
|
4620
4702
|
var import_react15 = require("react");
|
|
4621
4703
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
@@ -4923,8 +5005,188 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4923
5005
|
var Dropdown2 = (0, import_react16.memo)(DropdownComponent);
|
|
4924
5006
|
var Dropdown_default = Dropdown2;
|
|
4925
5007
|
|
|
4926
|
-
// src/components/
|
|
5008
|
+
// src/components/Calendar.tsx
|
|
5009
|
+
var import_react17 = require("react");
|
|
4927
5010
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5011
|
+
var getMonthName = (month, short = false) => {
|
|
5012
|
+
return [
|
|
5013
|
+
short ? "Jan" : "January",
|
|
5014
|
+
short ? "Feb" : "February",
|
|
5015
|
+
short ? "Mar" : "March",
|
|
5016
|
+
short ? "Apr" : "April",
|
|
5017
|
+
short ? "May" : "May",
|
|
5018
|
+
short ? "Jun" : "June",
|
|
5019
|
+
short ? "Jul" : "July",
|
|
5020
|
+
short ? "Aug" : "August",
|
|
5021
|
+
short ? "Sep" : "September",
|
|
5022
|
+
short ? "Oct" : "October",
|
|
5023
|
+
short ? "Nov" : "November",
|
|
5024
|
+
short ? "Dec" : "December"
|
|
5025
|
+
][month];
|
|
5026
|
+
};
|
|
5027
|
+
var getWeekDayName = (day, short = false) => {
|
|
5028
|
+
return [
|
|
5029
|
+
short ? "Sun" : "Sunday",
|
|
5030
|
+
short ? "Mon" : "Monday",
|
|
5031
|
+
short ? "Tue" : "Tuesday",
|
|
5032
|
+
short ? "Wed" : "Wednesday",
|
|
5033
|
+
short ? "Thu" : "Thursday",
|
|
5034
|
+
short ? "Fri" : "Friday",
|
|
5035
|
+
short ? "Sat" : "Saturday"
|
|
5036
|
+
][day];
|
|
5037
|
+
};
|
|
5038
|
+
var weekDaysIndex = [1, 2, 3, 4, 5, 6, 0];
|
|
5039
|
+
function Calendar({ value, minDate, maxDate, onChange }) {
|
|
5040
|
+
const theme2 = useTheme();
|
|
5041
|
+
const [currentDate, setCurrentDate] = (0, import_react17.useState)(value ? new Date(value) : void 0);
|
|
5042
|
+
const [currentMonth, setCurrentMonth] = (0, import_react17.useState)(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
5043
|
+
const [currentYear, setCurrentYear] = (0, import_react17.useState)(currentDate?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear());
|
|
5044
|
+
const daysInMonth = (0, import_react17.useMemo)(() => new Date(currentYear, currentMonth + 1, 0).getDate(), [currentMonth, currentYear]);
|
|
5045
|
+
const onClickPreviousMonthButton = (0, import_react17.useCallback)(() => {
|
|
5046
|
+
const newMonth = currentMonth === 0 ? 11 : currentMonth - 1;
|
|
5047
|
+
const newYear = currentMonth === 0 ? currentYear - 1 : currentYear;
|
|
5048
|
+
setCurrentMonth(newMonth);
|
|
5049
|
+
setCurrentYear(newYear);
|
|
5050
|
+
}, [currentMonth, currentYear]);
|
|
5051
|
+
const onClickNextMonthButton = (0, import_react17.useCallback)(() => {
|
|
5052
|
+
const newMonth = currentMonth === 11 ? 0 : currentMonth + 1;
|
|
5053
|
+
const newYear = currentMonth === 11 ? currentYear + 1 : currentYear;
|
|
5054
|
+
setCurrentMonth(newMonth);
|
|
5055
|
+
setCurrentYear(newYear);
|
|
5056
|
+
}, [currentMonth, currentYear]);
|
|
5057
|
+
const onClickDay = (0, import_react17.useCallback)(
|
|
5058
|
+
(day) => {
|
|
5059
|
+
if (!day) return;
|
|
5060
|
+
const newDate = new Date(currentYear, currentMonth, day);
|
|
5061
|
+
setCurrentDate(newDate);
|
|
5062
|
+
onChange?.(
|
|
5063
|
+
`${newDate.getFullYear()}-${(newDate.getMonth() + 1).toString().padStart(2, "0")}-${newDate.getDate().toString().padStart(2, "0")}`
|
|
5064
|
+
);
|
|
5065
|
+
},
|
|
5066
|
+
[currentMonth, currentYear, onChange]
|
|
5067
|
+
);
|
|
5068
|
+
const onClickClear = (0, import_react17.useCallback)(() => {
|
|
5069
|
+
setCurrentDate(void 0);
|
|
5070
|
+
onChange?.(void 0);
|
|
5071
|
+
}, []);
|
|
5072
|
+
const onClickToday = (0, import_react17.useCallback)(() => {
|
|
5073
|
+
const today = /* @__PURE__ */ new Date();
|
|
5074
|
+
setCurrentDate(today);
|
|
5075
|
+
onChange?.(
|
|
5076
|
+
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
|
|
5077
|
+
);
|
|
5078
|
+
}, [onChange]);
|
|
5079
|
+
const firstDayOfMonth = (0, import_react17.useMemo)(() => {
|
|
5080
|
+
const day = new Date(currentYear, currentMonth, 1).getDay();
|
|
5081
|
+
return day === 0 ? 6 : day - 1;
|
|
5082
|
+
}, [currentMonth, currentYear]);
|
|
5083
|
+
const days = (0, import_react17.useMemo)(() => {
|
|
5084
|
+
const result = [];
|
|
5085
|
+
for (let index = 0; index < firstDayOfMonth; index++) {
|
|
5086
|
+
result.push(void 0);
|
|
5087
|
+
}
|
|
5088
|
+
for (let index = 1; index <= daysInMonth; index++) {
|
|
5089
|
+
result.push(index);
|
|
5090
|
+
}
|
|
5091
|
+
return result;
|
|
5092
|
+
}, [daysInMonth, firstDayOfMonth]);
|
|
5093
|
+
(0, import_react17.useEffect)(() => {
|
|
5094
|
+
if (!value) return;
|
|
5095
|
+
const date = new Date(value);
|
|
5096
|
+
setCurrentDate(date);
|
|
5097
|
+
setCurrentMonth(date.getMonth());
|
|
5098
|
+
setCurrentYear(date.getFullYear());
|
|
5099
|
+
}, [value]);
|
|
5100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
5102
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
5103
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { fontWeight: 700, children: [
|
|
5104
|
+
getMonthName(currentMonth),
|
|
5105
|
+
" ",
|
|
5106
|
+
currentYear
|
|
5107
|
+
] }),
|
|
5108
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
5109
|
+
] }),
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
5111
|
+
weekDaysIndex.map((day) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Div_default.row, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", children: getWeekDayName(day, true) }) }, day)),
|
|
5112
|
+
days.map((day, index) => {
|
|
5113
|
+
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
5114
|
+
const isSelected = day !== void 0 && day === currentDate?.getDate() && currentMonth === currentDate.getMonth() && currentYear === currentDate.getFullYear();
|
|
5115
|
+
const isWeekend = thisDayDate.getDay() === 6 || thisDayDate.getDay() === 0;
|
|
5116
|
+
const isDisabled = minDate && thisDayDate.getTime() < minDate.getTime() || maxDate && thisDayDate.getTime() > maxDate.getTime();
|
|
5117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5118
|
+
Div_default.row,
|
|
5119
|
+
{
|
|
5120
|
+
position: "relative",
|
|
5121
|
+
width: "100%",
|
|
5122
|
+
aspectRatio: "1",
|
|
5123
|
+
alignItems: "center",
|
|
5124
|
+
justifyContent: "center",
|
|
5125
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5126
|
+
filterHover: !isDisabled ? "brightness(0.9)" : void 0,
|
|
5127
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5128
|
+
padding: theme2.styles.space / 2,
|
|
5129
|
+
cursor: day ? !isDisabled ? "pointer" : "not-allowed" : void 0,
|
|
5130
|
+
value: day,
|
|
5131
|
+
onClickWithValue: !isDisabled ? onClickDay : void 0,
|
|
5132
|
+
children: [
|
|
5133
|
+
day && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5134
|
+
Text_default,
|
|
5135
|
+
{
|
|
5136
|
+
fontSize: 14,
|
|
5137
|
+
textAlign: "center",
|
|
5138
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : isWeekend ? theme2.colors.textSecondary : void 0,
|
|
5139
|
+
children: day
|
|
5140
|
+
}
|
|
5141
|
+
),
|
|
5142
|
+
isDisabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5143
|
+
Div_default,
|
|
5144
|
+
{
|
|
5145
|
+
position: "absolute",
|
|
5146
|
+
width: "60%",
|
|
5147
|
+
height: 1,
|
|
5148
|
+
top: "50%",
|
|
5149
|
+
left: "50%",
|
|
5150
|
+
backgroundColor: theme2.colors.textSecondary,
|
|
5151
|
+
borderRadius: 999,
|
|
5152
|
+
transform: "translate(-50%, -50%) rotate(45deg)"
|
|
5153
|
+
}
|
|
5154
|
+
)
|
|
5155
|
+
]
|
|
5156
|
+
},
|
|
5157
|
+
index
|
|
5158
|
+
);
|
|
5159
|
+
})
|
|
5160
|
+
] }),
|
|
5161
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickClear, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5163
|
+
Text_default,
|
|
5164
|
+
{
|
|
5165
|
+
fontSize: 14,
|
|
5166
|
+
textDecorationHover: "underline",
|
|
5167
|
+
color: theme2.colors.textSecondary,
|
|
5168
|
+
colorHover: theme2.colors.textPrimary,
|
|
5169
|
+
children: "Clear"
|
|
5170
|
+
}
|
|
5171
|
+
) }),
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickToday, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5173
|
+
Text_default,
|
|
5174
|
+
{
|
|
5175
|
+
fontSize: 14,
|
|
5176
|
+
textDecorationHover: "underline",
|
|
5177
|
+
color: theme2.colors.textSecondary,
|
|
5178
|
+
colorHover: theme2.colors.textPrimary,
|
|
5179
|
+
children: "Today"
|
|
5180
|
+
}
|
|
5181
|
+
) })
|
|
5182
|
+
] })
|
|
5183
|
+
] });
|
|
5184
|
+
}
|
|
5185
|
+
var Calendar_default = (0, import_react17.memo)(Calendar);
|
|
5186
|
+
|
|
5187
|
+
// src/components/InputField.tsx
|
|
5188
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5189
|
+
var buttonWidth = 50;
|
|
4928
5190
|
var InputElement = import_styled_components9.default.input.withConfig({
|
|
4929
5191
|
shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
|
|
4930
5192
|
})`
|
|
@@ -4956,11 +5218,20 @@ var InputElement = import_styled_components9.default.input.withConfig({
|
|
|
4956
5218
|
cursor: not-allowed;
|
|
4957
5219
|
}
|
|
4958
5220
|
|
|
4959
|
-
&[type="date"]
|
|
4960
|
-
&[type="datetime-local"]
|
|
4961
|
-
&[type="time"]
|
|
4962
|
-
|
|
5221
|
+
&[type="date"],
|
|
5222
|
+
&[type="datetime-local"],
|
|
5223
|
+
&[type="time"] {
|
|
5224
|
+
min-height: 48px;
|
|
4963
5225
|
-webkit-appearance: none;
|
|
5226
|
+
|
|
5227
|
+
&::-webkit-calendar-picker-indicator {
|
|
5228
|
+
display: none;
|
|
5229
|
+
-webkit-appearance: none;
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
&::-webkit-date-and-time-value {
|
|
5233
|
+
text-align: left !important;
|
|
5234
|
+
}
|
|
4964
5235
|
}
|
|
4965
5236
|
|
|
4966
5237
|
&.react-better-html-phone-number-holder {
|
|
@@ -5038,7 +5309,7 @@ var TextareaElement = import_styled_components9.default.textarea.withConfig({
|
|
|
5038
5309
|
`;
|
|
5039
5310
|
var hours = Array.from({ length: 24 }, (_, index) => index);
|
|
5040
5311
|
var minutes = Array.from({ length: 60 }, (_, index) => index);
|
|
5041
|
-
var InputFieldComponent = (0,
|
|
5312
|
+
var InputFieldComponent = (0, import_react18.forwardRef)(function InputField({
|
|
5042
5313
|
label,
|
|
5043
5314
|
labelColor,
|
|
5044
5315
|
errorText,
|
|
@@ -5066,7 +5337,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5066
5337
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5067
5338
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5068
5339
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5069
|
-
const onChangeElement = (0,
|
|
5340
|
+
const onChangeElement = (0, import_react18.useCallback)(
|
|
5070
5341
|
(event) => {
|
|
5071
5342
|
const newValue = event.target.value;
|
|
5072
5343
|
if (withDebounce) {
|
|
@@ -5079,14 +5350,14 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5079
5350
|
},
|
|
5080
5351
|
[onChange, onChangeValue, withDebounce]
|
|
5081
5352
|
);
|
|
5082
|
-
(0,
|
|
5353
|
+
(0, import_react18.useEffect)(() => {
|
|
5083
5354
|
if (!withDebounce) return;
|
|
5084
5355
|
onChangeValue?.(debouncedValue);
|
|
5085
5356
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
5086
|
-
return /* @__PURE__ */ (0,
|
|
5087
|
-
label && /* @__PURE__ */ (0,
|
|
5088
|
-
/* @__PURE__ */ (0,
|
|
5089
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
5357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, ref: holderRef, children: [
|
|
5358
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
5360
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5090
5361
|
Icon_default,
|
|
5091
5362
|
{
|
|
5092
5363
|
name: leftIcon,
|
|
@@ -5098,7 +5369,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5098
5369
|
zIndex: props.className?.includes("react-better-html-dropdown-open-late") ? 1002 : 1
|
|
5099
5370
|
}
|
|
5100
5371
|
),
|
|
5101
|
-
/* @__PURE__ */ (0,
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5102
5373
|
InputElement,
|
|
5103
5374
|
{
|
|
5104
5375
|
theme: theme2,
|
|
@@ -5114,7 +5385,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5114
5385
|
ref
|
|
5115
5386
|
}
|
|
5116
5387
|
),
|
|
5117
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0,
|
|
5388
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5118
5389
|
Button_default.icon,
|
|
5119
5390
|
{
|
|
5120
5391
|
icon: rightIcon,
|
|
@@ -5124,7 +5395,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5124
5395
|
transform: "translateY(-50%)",
|
|
5125
5396
|
onClick: onClickRightIcon
|
|
5126
5397
|
}
|
|
5127
|
-
) : /* @__PURE__ */ (0,
|
|
5398
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5128
5399
|
Icon_default,
|
|
5129
5400
|
{
|
|
5130
5401
|
name: rightIcon,
|
|
@@ -5137,7 +5408,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5137
5408
|
) : void 0,
|
|
5138
5409
|
insideInputFieldComponent
|
|
5139
5410
|
] }),
|
|
5140
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
5411
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5141
5412
|
Text_default,
|
|
5142
5413
|
{
|
|
5143
5414
|
as: "span",
|
|
@@ -5149,7 +5420,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5149
5420
|
)
|
|
5150
5421
|
] });
|
|
5151
5422
|
});
|
|
5152
|
-
InputFieldComponent.multiline = (0,
|
|
5423
|
+
InputFieldComponent.multiline = (0, import_react18.forwardRef)(function Multiline({
|
|
5153
5424
|
label,
|
|
5154
5425
|
placeholder,
|
|
5155
5426
|
errorText,
|
|
@@ -5167,17 +5438,17 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5167
5438
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5168
5439
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5169
5440
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5170
|
-
const onChangeElement = (0,
|
|
5441
|
+
const onChangeElement = (0, import_react18.useCallback)(
|
|
5171
5442
|
(event) => {
|
|
5172
5443
|
onChange?.(event);
|
|
5173
5444
|
onChangeValue?.(event.target.value);
|
|
5174
5445
|
},
|
|
5175
5446
|
[onChange, onChangeValue]
|
|
5176
5447
|
);
|
|
5177
|
-
return /* @__PURE__ */ (0,
|
|
5178
|
-
label && /* @__PURE__ */ (0,
|
|
5179
|
-
/* @__PURE__ */ (0,
|
|
5180
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
5448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { gap: theme2.styles.gap, children: [
|
|
5449
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, required, isError: !!errorText }),
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
5451
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5181
5452
|
Icon_default,
|
|
5182
5453
|
{
|
|
5183
5454
|
name: leftIcon,
|
|
@@ -5188,7 +5459,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5188
5459
|
pointerEvents: "none"
|
|
5189
5460
|
}
|
|
5190
5461
|
),
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5462
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5192
5463
|
TextareaElement,
|
|
5193
5464
|
{
|
|
5194
5465
|
theme: theme2,
|
|
@@ -5204,7 +5475,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5204
5475
|
ref
|
|
5205
5476
|
}
|
|
5206
5477
|
),
|
|
5207
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0,
|
|
5478
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5208
5479
|
Button_default.icon,
|
|
5209
5480
|
{
|
|
5210
5481
|
icon: rightIcon,
|
|
@@ -5214,7 +5485,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5214
5485
|
transform: "translateY(-50%)",
|
|
5215
5486
|
onClick: onClickRightIcon
|
|
5216
5487
|
}
|
|
5217
|
-
) : /* @__PURE__ */ (0,
|
|
5488
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5218
5489
|
Icon_default,
|
|
5219
5490
|
{
|
|
5220
5491
|
name: rightIcon,
|
|
@@ -5226,7 +5497,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5226
5497
|
}
|
|
5227
5498
|
) : void 0
|
|
5228
5499
|
] }),
|
|
5229
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
5500
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5230
5501
|
Text_default,
|
|
5231
5502
|
{
|
|
5232
5503
|
as: "span",
|
|
@@ -5239,8 +5510,8 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5239
5510
|
)
|
|
5240
5511
|
] });
|
|
5241
5512
|
});
|
|
5242
|
-
InputFieldComponent.email = (0,
|
|
5243
|
-
return /* @__PURE__ */ (0,
|
|
5513
|
+
InputFieldComponent.email = (0, import_react18.forwardRef)(function Email({ ...props }, ref) {
|
|
5514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5244
5515
|
InputFieldComponent,
|
|
5245
5516
|
{
|
|
5246
5517
|
type: "email",
|
|
@@ -5253,9 +5524,9 @@ InputFieldComponent.email = (0, import_react17.forwardRef)(function Email({ ...p
|
|
|
5253
5524
|
}
|
|
5254
5525
|
);
|
|
5255
5526
|
});
|
|
5256
|
-
InputFieldComponent.password = (0,
|
|
5527
|
+
InputFieldComponent.password = (0, import_react18.forwardRef)(function Password({ ...props }, ref) {
|
|
5257
5528
|
const [isPassword, setIsPassword] = useBooleanState(true);
|
|
5258
|
-
return /* @__PURE__ */ (0,
|
|
5529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5259
5530
|
InputFieldComponent,
|
|
5260
5531
|
{
|
|
5261
5532
|
type: isPassword ? "password" : "text",
|
|
@@ -5270,21 +5541,21 @@ InputFieldComponent.password = (0, import_react17.forwardRef)(function Password(
|
|
|
5270
5541
|
}
|
|
5271
5542
|
);
|
|
5272
5543
|
});
|
|
5273
|
-
InputFieldComponent.search = (0,
|
|
5274
|
-
return /* @__PURE__ */ (0,
|
|
5544
|
+
InputFieldComponent.search = (0, import_react18.forwardRef)(function Search({ ...props }, ref) {
|
|
5545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(InputFieldComponent, { leftIcon: "magnifyingGlass", placeholder: "Search...", ref, ...props });
|
|
5275
5546
|
});
|
|
5276
|
-
InputFieldComponent.phoneNumber = (0,
|
|
5547
|
+
InputFieldComponent.phoneNumber = (0, import_react18.forwardRef)(function PhoneNumber({ label, value, onChangeValue, labelColor, ...props }, ref) {
|
|
5277
5548
|
const theme2 = useTheme();
|
|
5278
|
-
const [dropdownValue, setDropdownValue] = (0,
|
|
5279
|
-
const [inputFieldValue, setInputFieldValue] = (0,
|
|
5280
|
-
const renderOption = (0,
|
|
5281
|
-
(option, index, isSelected) => /* @__PURE__ */ (0,
|
|
5282
|
-
/* @__PURE__ */ (0,
|
|
5283
|
-
/* @__PURE__ */ (0,
|
|
5549
|
+
const [dropdownValue, setDropdownValue] = (0, import_react18.useState)();
|
|
5550
|
+
const [inputFieldValue, setInputFieldValue] = (0, import_react18.useState)(value?.toString() ?? "");
|
|
5551
|
+
const renderOption = (0, import_react18.useCallback)(
|
|
5552
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5553
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5554
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { children: option.label })
|
|
5284
5555
|
] }),
|
|
5285
5556
|
[]
|
|
5286
5557
|
);
|
|
5287
|
-
const onChangeValueElement = (0,
|
|
5558
|
+
const onChangeValueElement = (0, import_react18.useCallback)(
|
|
5288
5559
|
(value2) => {
|
|
5289
5560
|
const readyValue = value2.replace(/\D/g, "");
|
|
5290
5561
|
setInputFieldValue(readyValue);
|
|
@@ -5292,7 +5563,7 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5292
5563
|
},
|
|
5293
5564
|
[onChangeValue, dropdownValue]
|
|
5294
5565
|
);
|
|
5295
|
-
const options = (0,
|
|
5566
|
+
const options = (0, import_react18.useMemo)(
|
|
5296
5567
|
() => countries.map((country) => ({
|
|
5297
5568
|
value: country.phoneNumberExtension,
|
|
5298
5569
|
label: `+${country.phoneNumberExtension}`,
|
|
@@ -5300,13 +5571,13 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5300
5571
|
})),
|
|
5301
5572
|
[]
|
|
5302
5573
|
);
|
|
5303
|
-
const defaultValue = (0,
|
|
5574
|
+
const defaultValue = (0, import_react18.useMemo)(() => {
|
|
5304
5575
|
const thisTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
5305
5576
|
const initialDefaultValue = options.find((option) => option.data?.timeZone === thisTimeZone)?.value ?? "";
|
|
5306
5577
|
setDropdownValue(initialDefaultValue);
|
|
5307
5578
|
return initialDefaultValue;
|
|
5308
5579
|
}, [options]);
|
|
5309
|
-
(0,
|
|
5580
|
+
(0, import_react18.useEffect)(() => {
|
|
5310
5581
|
if (value === void 0 || value === null) return;
|
|
5311
5582
|
const newValue = value.toString();
|
|
5312
5583
|
const country = countries.find(
|
|
@@ -5322,10 +5593,10 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5322
5593
|
setDropdownValue(country.phoneNumberExtension);
|
|
5323
5594
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
5324
5595
|
}, [value]);
|
|
5325
|
-
return /* @__PURE__ */ (0,
|
|
5326
|
-
label && /* @__PURE__ */ (0,
|
|
5327
|
-
/* @__PURE__ */ (0,
|
|
5328
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, children: [
|
|
5597
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required: props.required, isError: !!props.errorText }),
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { children: [
|
|
5599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5329
5600
|
Dropdown_default,
|
|
5330
5601
|
{
|
|
5331
5602
|
options,
|
|
@@ -5341,7 +5612,7 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5341
5612
|
withoutClearButton: true
|
|
5342
5613
|
}
|
|
5343
5614
|
),
|
|
5344
|
-
/* @__PURE__ */ (0,
|
|
5615
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5345
5616
|
InputFieldComponent,
|
|
5346
5617
|
{
|
|
5347
5618
|
placeholder: label ?? "Phone number",
|
|
@@ -5355,31 +5626,38 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5355
5626
|
] })
|
|
5356
5627
|
] });
|
|
5357
5628
|
});
|
|
5358
|
-
InputFieldComponent.date = (0,
|
|
5629
|
+
InputFieldComponent.date = (0, import_react18.forwardRef)(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
5359
5630
|
const theme2 = useTheme();
|
|
5360
|
-
const holderRef = (0,
|
|
5361
|
-
const
|
|
5362
|
-
|
|
5631
|
+
const holderRef = (0, import_react18.useRef)(null);
|
|
5632
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5633
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5634
|
+
const onChange = (0, import_react18.useCallback)(
|
|
5635
|
+
(date) => {
|
|
5636
|
+
inputFieldProps.onChangeValue?.(date ?? "");
|
|
5637
|
+
setInternalValue(date ?? "");
|
|
5638
|
+
},
|
|
5639
|
+
[inputFieldProps.onChangeValue]
|
|
5640
|
+
);
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5363
5642
|
InputFieldComponent,
|
|
5364
5643
|
{
|
|
5365
5644
|
type: "date",
|
|
5366
|
-
insideInputFieldComponent: /* @__PURE__ */ (0,
|
|
5645
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5367
5646
|
Div_default,
|
|
5368
5647
|
{
|
|
5369
5648
|
position: "absolute",
|
|
5370
5649
|
top: "100%",
|
|
5371
5650
|
left: 0,
|
|
5372
|
-
width: "
|
|
5373
|
-
maxHeight: 300,
|
|
5651
|
+
width: "fit-content",
|
|
5374
5652
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5375
5653
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
5376
5654
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5377
5655
|
boxShadow: "0px 10px 20px #00000020",
|
|
5378
|
-
|
|
5656
|
+
userSelect: "none",
|
|
5379
5657
|
...insideInputFieldComponentProps,
|
|
5380
|
-
children:
|
|
5658
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange })
|
|
5381
5659
|
}
|
|
5382
|
-
),
|
|
5660
|
+
) : void 0,
|
|
5383
5661
|
holderRef,
|
|
5384
5662
|
ref,
|
|
5385
5663
|
...props,
|
|
@@ -5387,31 +5665,152 @@ InputFieldComponent.date = (0, import_react17.forwardRef)(function Date({ classN
|
|
|
5387
5665
|
}
|
|
5388
5666
|
);
|
|
5389
5667
|
});
|
|
5390
|
-
InputFieldComponent.dateTime = (0,
|
|
5668
|
+
InputFieldComponent.dateTime = (0, import_react18.forwardRef)(function DateTime({ minDate, maxDate, ...props }, ref) {
|
|
5391
5669
|
const theme2 = useTheme();
|
|
5392
|
-
const holderRef = (0,
|
|
5393
|
-
const
|
|
5394
|
-
|
|
5670
|
+
const holderRef = (0, import_react18.useRef)(null);
|
|
5671
|
+
const selectedHourRef = (0, import_react18.useRef)(null);
|
|
5672
|
+
const selectedMinuteRef = (0, import_react18.useRef)(null);
|
|
5673
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5674
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5675
|
+
const onChange = (0, import_react18.useCallback)(
|
|
5676
|
+
(date) => {
|
|
5677
|
+
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? "00:00"}` : "";
|
|
5678
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5679
|
+
setInternalValue(newValue);
|
|
5680
|
+
},
|
|
5681
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5682
|
+
);
|
|
5683
|
+
const onClickHour = (0, import_react18.useCallback)(
|
|
5684
|
+
(hour) => {
|
|
5685
|
+
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5686
|
+
const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
5687
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
5688
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5689
|
+
setInternalValue(newValue);
|
|
5690
|
+
},
|
|
5691
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5692
|
+
);
|
|
5693
|
+
const onClickMinute = (0, import_react18.useCallback)(
|
|
5694
|
+
(minute) => {
|
|
5695
|
+
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5696
|
+
const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
5697
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
5698
|
+
console.log(newValue);
|
|
5699
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5700
|
+
setInternalValue(newValue);
|
|
5701
|
+
},
|
|
5702
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5703
|
+
);
|
|
5704
|
+
(0, import_react18.useEffect)(() => {
|
|
5705
|
+
if (isOpen && selectedHourRef.current)
|
|
5706
|
+
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5707
|
+
if (isOpen && selectedMinuteRef.current)
|
|
5708
|
+
selectedMinuteRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5709
|
+
}, [isOpen]);
|
|
5710
|
+
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
5711
|
+
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
5712
|
+
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
5713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5395
5714
|
InputFieldComponent,
|
|
5396
5715
|
{
|
|
5397
5716
|
type: "datetime-local",
|
|
5398
|
-
insideInputFieldComponent: /* @__PURE__ */ (0,
|
|
5717
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5399
5718
|
Div_default,
|
|
5400
5719
|
{
|
|
5401
5720
|
position: "absolute",
|
|
5402
5721
|
top: "100%",
|
|
5403
5722
|
left: 0,
|
|
5404
|
-
width: "
|
|
5405
|
-
maxHeight: 300,
|
|
5723
|
+
width: "fit-content",
|
|
5406
5724
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5407
5725
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
5408
5726
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5409
5727
|
boxShadow: "0px 10px 20px #00000020",
|
|
5410
|
-
|
|
5728
|
+
overflow: "hidden",
|
|
5729
|
+
userSelect: "none",
|
|
5411
5730
|
...insideInputFieldComponentProps,
|
|
5412
|
-
children:
|
|
5731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { gap: theme2.styles.space, children: [
|
|
5732
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5734
|
+
Div_default.row,
|
|
5735
|
+
{
|
|
5736
|
+
height: 276,
|
|
5737
|
+
gap: theme2.styles.gap / 2,
|
|
5738
|
+
paddingTop: topSpacing,
|
|
5739
|
+
paddingBottom: theme2.styles.space / 2,
|
|
5740
|
+
paddingRight: theme2.styles.space / 2,
|
|
5741
|
+
children: [
|
|
5742
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { height: "100%", children: [
|
|
5743
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
5744
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5745
|
+
Div_default,
|
|
5746
|
+
{
|
|
5747
|
+
className: "react-better-html-no-scrollbar",
|
|
5748
|
+
width: buttonWidth,
|
|
5749
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5750
|
+
overflowY: "auto",
|
|
5751
|
+
children: hours.map((hour) => {
|
|
5752
|
+
const isSelected = hour.toString() === valueHour;
|
|
5753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5754
|
+
Div_default.row,
|
|
5755
|
+
{
|
|
5756
|
+
alignItems: "center",
|
|
5757
|
+
justifyContent: "center",
|
|
5758
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5759
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5760
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5761
|
+
filterHover: "brightness(0.9)",
|
|
5762
|
+
cursor: "pointer",
|
|
5763
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5764
|
+
value: hour,
|
|
5765
|
+
onClickWithValue: onClickHour,
|
|
5766
|
+
ref: isSelected ? selectedHourRef : void 0,
|
|
5767
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5768
|
+
},
|
|
5769
|
+
hour
|
|
5770
|
+
);
|
|
5771
|
+
})
|
|
5772
|
+
}
|
|
5773
|
+
)
|
|
5774
|
+
] }),
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { height: "100%", children: [
|
|
5776
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5778
|
+
Div_default,
|
|
5779
|
+
{
|
|
5780
|
+
className: "react-better-html-no-scrollbar",
|
|
5781
|
+
width: buttonWidth,
|
|
5782
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5783
|
+
overflowY: "auto",
|
|
5784
|
+
children: minutes.map((minute) => {
|
|
5785
|
+
const isSelected = minute.toString() === valueMinute;
|
|
5786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5787
|
+
Div_default.row,
|
|
5788
|
+
{
|
|
5789
|
+
alignItems: "center",
|
|
5790
|
+
justifyContent: "center",
|
|
5791
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5792
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5793
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5794
|
+
filterHover: "brightness(0.9)",
|
|
5795
|
+
cursor: "pointer",
|
|
5796
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5797
|
+
value: minute,
|
|
5798
|
+
onClickWithValue: onClickMinute,
|
|
5799
|
+
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5801
|
+
},
|
|
5802
|
+
minute
|
|
5803
|
+
);
|
|
5804
|
+
})
|
|
5805
|
+
}
|
|
5806
|
+
)
|
|
5807
|
+
] })
|
|
5808
|
+
]
|
|
5809
|
+
}
|
|
5810
|
+
)
|
|
5811
|
+
] })
|
|
5413
5812
|
}
|
|
5414
|
-
),
|
|
5813
|
+
) : void 0,
|
|
5415
5814
|
holderRef,
|
|
5416
5815
|
ref,
|
|
5417
5816
|
...props,
|
|
@@ -5419,13 +5818,14 @@ InputFieldComponent.dateTime = (0, import_react17.forwardRef)(function DateTime(
|
|
|
5419
5818
|
}
|
|
5420
5819
|
);
|
|
5421
5820
|
});
|
|
5422
|
-
InputFieldComponent.time = (0,
|
|
5821
|
+
InputFieldComponent.time = (0, import_react18.forwardRef)(function Time({ ...props }, ref) {
|
|
5423
5822
|
const theme2 = useTheme();
|
|
5424
|
-
const holderRef = (0,
|
|
5425
|
-
const selectedHourRef = (0,
|
|
5426
|
-
const selectedMinuteRef = (0,
|
|
5427
|
-
const
|
|
5428
|
-
const
|
|
5823
|
+
const holderRef = (0, import_react18.useRef)(null);
|
|
5824
|
+
const selectedHourRef = (0, import_react18.useRef)(null);
|
|
5825
|
+
const selectedMinuteRef = (0, import_react18.useRef)(null);
|
|
5826
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5827
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5828
|
+
const onClickHour = (0, import_react18.useCallback)(
|
|
5429
5829
|
(hour) => {
|
|
5430
5830
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5431
5831
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -5433,7 +5833,7 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5433
5833
|
},
|
|
5434
5834
|
[internalValue, inputFieldProps.onChangeValue]
|
|
5435
5835
|
);
|
|
5436
|
-
const onClickMinute = (0,
|
|
5836
|
+
const onClickMinute = (0, import_react18.useCallback)(
|
|
5437
5837
|
(minute) => {
|
|
5438
5838
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5439
5839
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -5441,7 +5841,7 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5441
5841
|
},
|
|
5442
5842
|
[internalValue, inputFieldProps.onChangeValue]
|
|
5443
5843
|
);
|
|
5444
|
-
(0,
|
|
5844
|
+
(0, import_react18.useEffect)(() => {
|
|
5445
5845
|
if (isOpen && selectedHourRef.current)
|
|
5446
5846
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5447
5847
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -5449,12 +5849,11 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5449
5849
|
}, [isOpen]);
|
|
5450
5850
|
const valueHour = parseInt(internalValue?.toString().split(":")?.[0]).toString();
|
|
5451
5851
|
const valueMinute = parseInt(internalValue?.toString().split(":")?.[1]).toString();
|
|
5452
|
-
|
|
5453
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5454
5853
|
InputFieldComponent,
|
|
5455
5854
|
{
|
|
5456
5855
|
type: "time",
|
|
5457
|
-
insideInputFieldComponent: /* @__PURE__ */ (0,
|
|
5856
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5458
5857
|
Div_default,
|
|
5459
5858
|
{
|
|
5460
5859
|
position: "absolute",
|
|
@@ -5467,11 +5866,12 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5467
5866
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5468
5867
|
boxShadow: "0px 10px 20px #00000020",
|
|
5469
5868
|
overflowY: "auto",
|
|
5869
|
+
userSelect: "none",
|
|
5470
5870
|
...insideInputFieldComponentProps,
|
|
5471
|
-
children: /* @__PURE__ */ (0,
|
|
5472
|
-
/* @__PURE__ */ (0,
|
|
5871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { height: "100%", children: [
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: hours.map((hour) => {
|
|
5473
5873
|
const isSelected = hour.toString() === valueHour;
|
|
5474
|
-
return /* @__PURE__ */ (0,
|
|
5874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5475
5875
|
Div_default.row,
|
|
5476
5876
|
{
|
|
5477
5877
|
alignItems: "center",
|
|
@@ -5484,14 +5884,14 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5484
5884
|
value: hour,
|
|
5485
5885
|
onClickWithValue: onClickHour,
|
|
5486
5886
|
ref: isSelected ? selectedHourRef : void 0,
|
|
5487
|
-
children: /* @__PURE__ */ (0,
|
|
5887
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5488
5888
|
},
|
|
5489
5889
|
hour
|
|
5490
5890
|
);
|
|
5491
5891
|
}) }),
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5892
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: minutes.map((minute) => {
|
|
5493
5893
|
const isSelected = minute.toString() === valueMinute;
|
|
5494
|
-
return /* @__PURE__ */ (0,
|
|
5894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5495
5895
|
Div_default.row,
|
|
5496
5896
|
{
|
|
5497
5897
|
alignItems: "center",
|
|
@@ -5504,14 +5904,14 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5504
5904
|
value: minute,
|
|
5505
5905
|
onClickWithValue: onClickMinute,
|
|
5506
5906
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5507
|
-
children: /* @__PURE__ */ (0,
|
|
5907
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5508
5908
|
},
|
|
5509
5909
|
minute
|
|
5510
5910
|
);
|
|
5511
5911
|
}) })
|
|
5512
5912
|
] })
|
|
5513
5913
|
}
|
|
5514
|
-
),
|
|
5914
|
+
) : void 0,
|
|
5515
5915
|
holderRef,
|
|
5516
5916
|
ref,
|
|
5517
5917
|
...props,
|
|
@@ -5520,7 +5920,7 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5520
5920
|
}
|
|
5521
5921
|
);
|
|
5522
5922
|
});
|
|
5523
|
-
var InputField2 = (0,
|
|
5923
|
+
var InputField2 = (0, import_react18.memo)(InputFieldComponent);
|
|
5524
5924
|
InputField2.multiline = InputFieldComponent.multiline;
|
|
5525
5925
|
InputField2.email = InputFieldComponent.email;
|
|
5526
5926
|
InputField2.password = InputFieldComponent.password;
|
|
@@ -5532,9 +5932,9 @@ InputField2.time = InputFieldComponent.time;
|
|
|
5532
5932
|
var InputField_default = InputField2;
|
|
5533
5933
|
|
|
5534
5934
|
// src/components/ToggleInput.tsx
|
|
5535
|
-
var
|
|
5935
|
+
var import_react19 = require("react");
|
|
5536
5936
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
5537
|
-
var
|
|
5937
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5538
5938
|
var componentSize = 26;
|
|
5539
5939
|
var switchComponentBallGap = 3;
|
|
5540
5940
|
var switchComponentMouseDownDifference = 4;
|
|
@@ -5625,7 +6025,7 @@ var SwitchElement = import_styled_components10.default.div.withConfig({
|
|
|
5625
6025
|
${(props) => props.hoverStyle}
|
|
5626
6026
|
}
|
|
5627
6027
|
`;
|
|
5628
|
-
var ToggleInputComponent = (0,
|
|
6028
|
+
var ToggleInputComponent = (0, import_react19.forwardRef)(function ToggleInput({
|
|
5629
6029
|
label,
|
|
5630
6030
|
labelColor,
|
|
5631
6031
|
text,
|
|
@@ -5644,8 +6044,8 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5644
6044
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5645
6045
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5646
6046
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5647
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
5648
|
-
const onChangeElement = (0,
|
|
6047
|
+
const [internalChecked, setInternalChecked] = (0, import_react19.useState)(false);
|
|
6048
|
+
const onChangeElement = (0, import_react19.useCallback)(
|
|
5649
6049
|
(event) => {
|
|
5650
6050
|
const newIsChecked = event.target.checked;
|
|
5651
6051
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
@@ -5654,16 +6054,16 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5654
6054
|
[onChange, controlledChecked, value]
|
|
5655
6055
|
);
|
|
5656
6056
|
const checked = controlledChecked ?? internalChecked;
|
|
5657
|
-
const onClickText = (0,
|
|
6057
|
+
const onClickText = (0, import_react19.useCallback)(() => {
|
|
5658
6058
|
const newIsChecked = !checked;
|
|
5659
6059
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
5660
6060
|
onChange?.(newIsChecked, value);
|
|
5661
6061
|
}, [checked, controlledChecked, onChange, value]);
|
|
5662
|
-
return /* @__PURE__ */ (0,
|
|
5663
|
-
label && /* @__PURE__ */ (0,
|
|
5664
|
-
/* @__PURE__ */ (0,
|
|
5665
|
-
/* @__PURE__ */ (0,
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
6062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6063
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6065
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5667
6067
|
InputElement2,
|
|
5668
6068
|
{
|
|
5669
6069
|
theme: theme2,
|
|
@@ -5676,7 +6076,7 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5676
6076
|
...restProps
|
|
5677
6077
|
}
|
|
5678
6078
|
),
|
|
5679
|
-
props.type === "checkbox" ? /* @__PURE__ */ (0,
|
|
6079
|
+
props.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5680
6080
|
Icon_default,
|
|
5681
6081
|
{
|
|
5682
6082
|
name: "check",
|
|
@@ -5690,7 +6090,7 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5690
6090
|
pointerEvents: "none",
|
|
5691
6091
|
transition: theme2.styles.transition
|
|
5692
6092
|
}
|
|
5693
|
-
) : props.type === "radio" ? /* @__PURE__ */ (0,
|
|
6093
|
+
) : props.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5694
6094
|
Div_default,
|
|
5695
6095
|
{
|
|
5696
6096
|
position: "absolute",
|
|
@@ -5706,15 +6106,15 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5706
6106
|
}
|
|
5707
6107
|
) : void 0
|
|
5708
6108
|
] }),
|
|
5709
|
-
text && /* @__PURE__ */ (0,
|
|
6109
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5710
6110
|
text,
|
|
5711
|
-
required && !label && /* @__PURE__ */ (0,
|
|
6111
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5712
6112
|
" ",
|
|
5713
6113
|
"*"
|
|
5714
6114
|
] })
|
|
5715
6115
|
] })
|
|
5716
6116
|
] }),
|
|
5717
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
6117
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5718
6118
|
Text_default,
|
|
5719
6119
|
{
|
|
5720
6120
|
as: "span",
|
|
@@ -5727,13 +6127,13 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5727
6127
|
] });
|
|
5728
6128
|
});
|
|
5729
6129
|
var ToggleInput_default = {
|
|
5730
|
-
checkbox: (0,
|
|
5731
|
-
return /* @__PURE__ */ (0,
|
|
6130
|
+
checkbox: (0, import_react19.forwardRef)(function Checkbox(props, ref) {
|
|
6131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5732
6132
|
}),
|
|
5733
|
-
radiobutton: (0,
|
|
5734
|
-
return /* @__PURE__ */ (0,
|
|
6133
|
+
radiobutton: (0, import_react19.forwardRef)(function RadioButton(props, ref) {
|
|
6134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5735
6135
|
}),
|
|
5736
|
-
switch: (0,
|
|
6136
|
+
switch: (0, import_react19.forwardRef)(function Switch({
|
|
5737
6137
|
label,
|
|
5738
6138
|
labelColor,
|
|
5739
6139
|
errorText,
|
|
@@ -5754,15 +6154,15 @@ var ToggleInput_default = {
|
|
|
5754
6154
|
const [internalChecked, setInternalChecked] = useBooleanState();
|
|
5755
6155
|
const [isMouseDown, setIsMouseDown] = useBooleanState();
|
|
5756
6156
|
const checked = controlledChecked ?? internalChecked;
|
|
5757
|
-
const onClickElement = (0,
|
|
6157
|
+
const onClickElement = (0, import_react19.useCallback)(() => {
|
|
5758
6158
|
if (disabled) return;
|
|
5759
6159
|
const newIsChecked = !checked;
|
|
5760
6160
|
if (controlledChecked === void 0) setInternalChecked.setState(newIsChecked);
|
|
5761
6161
|
onChange?.(newIsChecked, value);
|
|
5762
6162
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5763
|
-
return /* @__PURE__ */ (0,
|
|
5764
|
-
label && /* @__PURE__ */ (0,
|
|
5765
|
-
/* @__PURE__ */ (0,
|
|
6163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6164
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
6165
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5766
6166
|
Div_default.row,
|
|
5767
6167
|
{
|
|
5768
6168
|
alignItems: "center",
|
|
@@ -5773,7 +6173,7 @@ var ToggleInput_default = {
|
|
|
5773
6173
|
onTouchStart: setIsMouseDown.setTrue,
|
|
5774
6174
|
onTouchEnd: setIsMouseDown.setFalse,
|
|
5775
6175
|
onTouchCancel: setIsMouseDown.setFalse,
|
|
5776
|
-
children: /* @__PURE__ */ (0,
|
|
6176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5777
6177
|
SwitchElement,
|
|
5778
6178
|
{
|
|
5779
6179
|
theme: theme2,
|
|
@@ -5789,7 +6189,7 @@ var ToggleInput_default = {
|
|
|
5789
6189
|
)
|
|
5790
6190
|
}
|
|
5791
6191
|
),
|
|
5792
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
6192
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5793
6193
|
Text_default,
|
|
5794
6194
|
{
|
|
5795
6195
|
as: "span",
|
|
@@ -5804,8 +6204,8 @@ var ToggleInput_default = {
|
|
|
5804
6204
|
};
|
|
5805
6205
|
|
|
5806
6206
|
// src/components/Form.tsx
|
|
5807
|
-
var
|
|
5808
|
-
var
|
|
6207
|
+
var import_react20 = require("react");
|
|
6208
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5809
6209
|
function Form({
|
|
5810
6210
|
form,
|
|
5811
6211
|
submitButtonText,
|
|
@@ -5822,7 +6222,7 @@ function Form({
|
|
|
5822
6222
|
...props
|
|
5823
6223
|
}) {
|
|
5824
6224
|
const theme2 = useTheme();
|
|
5825
|
-
const submitButtonIsDisabledInternal = (0,
|
|
6225
|
+
const submitButtonIsDisabledInternal = (0, import_react20.useMemo)(() => {
|
|
5826
6226
|
if (!form || !form.requiredFields) return false;
|
|
5827
6227
|
return Object.entries(form.values).some(
|
|
5828
6228
|
([key, value]) => form.requiredFields?.includes(key) && (value === void 0 || value === null || value?.toString().trim() === "")
|
|
@@ -5830,9 +6230,9 @@ function Form({
|
|
|
5830
6230
|
}, [form]);
|
|
5831
6231
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
5832
6232
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
5833
|
-
return /* @__PURE__ */ (0,
|
|
5834
|
-
gap !== void 0 ? /* @__PURE__ */ (0,
|
|
5835
|
-
submitButtonText && /* @__PURE__ */ (0,
|
|
6233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: onSubmit ?? form?.onSubmit, children: [
|
|
6234
|
+
gap !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default.column, { gap, children }) : children,
|
|
6235
|
+
submitButtonText && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5836
6236
|
Div_default.row,
|
|
5837
6237
|
{
|
|
5838
6238
|
alignItems: "center",
|
|
@@ -5840,8 +6240,8 @@ function Form({
|
|
|
5840
6240
|
gap: theme2.styles.gap,
|
|
5841
6241
|
marginTop: theme2.styles.space,
|
|
5842
6242
|
children: [
|
|
5843
|
-
onClickCancel && /* @__PURE__ */ (0,
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
6243
|
+
onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.secondary, { text: "Cancel", onClick: onClickCancel }),
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5845
6245
|
SubmitButtonTag,
|
|
5846
6246
|
{
|
|
5847
6247
|
text: submitButtonText,
|
|
@@ -5857,22 +6257,22 @@ function Form({
|
|
|
5857
6257
|
)
|
|
5858
6258
|
] }) });
|
|
5859
6259
|
}
|
|
5860
|
-
var Form_default = (0,
|
|
6260
|
+
var Form_default = (0, import_react20.memo)(Form);
|
|
5861
6261
|
|
|
5862
6262
|
// src/components/FormRow.tsx
|
|
5863
|
-
var
|
|
5864
|
-
var
|
|
5865
|
-
var FormRowComponent = (0,
|
|
6263
|
+
var import_react21 = require("react");
|
|
6264
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6265
|
+
var FormRowComponent = (0, import_react21.forwardRef)(function FormRow({ oneItemOnly, noBreakingPoint, gap, children, ...props }, ref) {
|
|
5866
6266
|
const theme2 = useTheme();
|
|
5867
6267
|
const mediaQuery = useMediaQuery();
|
|
5868
6268
|
const breakingPoint = !noBreakingPoint ? mediaQuery.size900 : false;
|
|
5869
6269
|
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
5870
|
-
return /* @__PURE__ */ (0,
|
|
6270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
5871
6271
|
children,
|
|
5872
|
-
oneItemOnly && /* @__PURE__ */ (0,
|
|
6272
|
+
oneItemOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Div_default, { width: "100%" })
|
|
5873
6273
|
] });
|
|
5874
6274
|
});
|
|
5875
|
-
FormRowComponent.withTitle = (0,
|
|
6275
|
+
FormRowComponent.withTitle = (0, import_react21.forwardRef)(function WithTitle({
|
|
5876
6276
|
icon,
|
|
5877
6277
|
title,
|
|
5878
6278
|
description,
|
|
@@ -5886,15 +6286,15 @@ FormRowComponent.withTitle = (0, import_react20.forwardRef)(function WithTitle({
|
|
|
5886
6286
|
}, ref) {
|
|
5887
6287
|
const theme2 = useTheme();
|
|
5888
6288
|
const mediaQuery = useMediaQuery();
|
|
5889
|
-
return /* @__PURE__ */ (0,
|
|
5890
|
-
/* @__PURE__ */ (0,
|
|
5891
|
-
icon && /* @__PURE__ */ (0,
|
|
5892
|
-
/* @__PURE__ */ (0,
|
|
5893
|
-
/* @__PURE__ */ (0,
|
|
5894
|
-
description && /* @__PURE__ */ (0,
|
|
6289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(FormRowComponent, { ...props, ref, children: [
|
|
6290
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: theme2.styles.space, children: [
|
|
6291
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon_default, { name: icon }),
|
|
6292
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6293
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { as: "h3", children: title }),
|
|
6294
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
5895
6295
|
] })
|
|
5896
6296
|
] }),
|
|
5897
|
-
/* @__PURE__ */ (0,
|
|
6297
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5898
6298
|
Div_default.row,
|
|
5899
6299
|
{
|
|
5900
6300
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
@@ -5902,22 +6302,22 @@ FormRowComponent.withTitle = (0, import_react20.forwardRef)(function WithTitle({
|
|
|
5902
6302
|
gap: theme2.styles.gap,
|
|
5903
6303
|
children: [
|
|
5904
6304
|
children,
|
|
5905
|
-
withActions && /* @__PURE__ */ (0,
|
|
5906
|
-
onClickReset && /* @__PURE__ */ (0,
|
|
5907
|
-
/* @__PURE__ */ (0,
|
|
6305
|
+
withActions && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6306
|
+
onClickReset && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
6307
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
5908
6308
|
] })
|
|
5909
6309
|
]
|
|
5910
6310
|
}
|
|
5911
6311
|
)
|
|
5912
6312
|
] });
|
|
5913
6313
|
});
|
|
5914
|
-
var FormRow2 = (0,
|
|
6314
|
+
var FormRow2 = (0, import_react21.memo)(FormRowComponent);
|
|
5915
6315
|
FormRow2.withTitle = FormRowComponent.withTitle;
|
|
5916
6316
|
var FormRow_default = FormRow2;
|
|
5917
6317
|
|
|
5918
6318
|
// src/components/ColorThemeSwitch.tsx
|
|
5919
|
-
var
|
|
5920
|
-
var
|
|
6319
|
+
var import_react22 = require("react");
|
|
6320
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
5921
6321
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
5922
6322
|
withMoon,
|
|
5923
6323
|
className,
|
|
@@ -5928,7 +6328,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5928
6328
|
darkMode: localStorage.getItem("theme") === "dark"
|
|
5929
6329
|
}
|
|
5930
6330
|
});
|
|
5931
|
-
(0,
|
|
6331
|
+
(0, import_react22.useEffect)(() => {
|
|
5932
6332
|
const timeout = setTimeout(() => {
|
|
5933
6333
|
window.document.body.parentElement?.setAttribute("data-theme", form.values.darkMode ? "dark" : "light");
|
|
5934
6334
|
localStorage.setItem("theme", form.values.darkMode ? "dark" : "light");
|
|
@@ -5937,7 +6337,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5937
6337
|
clearTimeout(timeout);
|
|
5938
6338
|
};
|
|
5939
6339
|
}, [form.values.darkMode]);
|
|
5940
|
-
(0,
|
|
6340
|
+
(0, import_react22.useEffect)(() => {
|
|
5941
6341
|
const html = document.querySelector("html");
|
|
5942
6342
|
if (!html) return;
|
|
5943
6343
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -5954,7 +6354,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5954
6354
|
observer.disconnect();
|
|
5955
6355
|
};
|
|
5956
6356
|
}, []);
|
|
5957
|
-
return /* @__PURE__ */ (0,
|
|
6357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5958
6358
|
ToggleInput_default.switch,
|
|
5959
6359
|
{
|
|
5960
6360
|
className: `react-better-html-color-theme-switch ${withMoon ? ` react-better-html-color-theme-switch-with-moon` : ""}${className ? ` ${className}` : ""}`,
|
|
@@ -5965,20 +6365,20 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5965
6365
|
};
|
|
5966
6366
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
5967
6367
|
const theme2 = useTheme();
|
|
5968
|
-
return /* @__PURE__ */ (0,
|
|
5969
|
-
/* @__PURE__ */ (0,
|
|
5970
|
-
/* @__PURE__ */ (0,
|
|
5971
|
-
/* @__PURE__ */ (0,
|
|
6368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
6369
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text_default, { children: "Light" }),
|
|
6370
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ColorThemeSwitchComponent, { withMoon, className }),
|
|
6371
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text_default, { children: "Dark" })
|
|
5972
6372
|
] });
|
|
5973
6373
|
};
|
|
5974
|
-
var ColorThemeSwitch2 = (0,
|
|
6374
|
+
var ColorThemeSwitch2 = (0, import_react22.memo)(ColorThemeSwitchComponent);
|
|
5975
6375
|
ColorThemeSwitch2.withText = ColorThemeSwitchComponent.withText;
|
|
5976
6376
|
var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
5977
6377
|
|
|
5978
6378
|
// src/components/Table.tsx
|
|
5979
|
-
var
|
|
6379
|
+
var import_react23 = require("react");
|
|
5980
6380
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
5981
|
-
var
|
|
6381
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5982
6382
|
var defaultImageWidth = 120;
|
|
5983
6383
|
var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
5984
6384
|
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
|
|
@@ -6043,7 +6443,7 @@ var TdStyledComponent = import_styled_components11.default.td.withConfig({
|
|
|
6043
6443
|
})`
|
|
6044
6444
|
${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
|
|
6045
6445
|
`;
|
|
6046
|
-
var TableComponent = (0,
|
|
6446
|
+
var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
6047
6447
|
columns,
|
|
6048
6448
|
data,
|
|
6049
6449
|
isStriped,
|
|
@@ -6056,8 +6456,8 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6056
6456
|
}, ref) {
|
|
6057
6457
|
const { colorTheme } = useBetterHtmlContext();
|
|
6058
6458
|
const theme2 = useTheme();
|
|
6059
|
-
const [checkedItems, setCheckedItems] = (0,
|
|
6060
|
-
const renderCellContent = (0,
|
|
6459
|
+
const [checkedItems, setCheckedItems] = (0, import_react23.useState)([]);
|
|
6460
|
+
const renderCellContent = (0, import_react23.useCallback)(
|
|
6061
6461
|
(column, item, index) => {
|
|
6062
6462
|
switch (column.type) {
|
|
6063
6463
|
case "text": {
|
|
@@ -6065,17 +6465,17 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6065
6465
|
return column.format ? column.format(item, index) : String(value ?? "");
|
|
6066
6466
|
}
|
|
6067
6467
|
case "element": {
|
|
6068
|
-
return column.render?.(item, index) ?? /* @__PURE__ */ (0,
|
|
6468
|
+
return column.render?.(item, index) ?? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
|
|
6069
6469
|
}
|
|
6070
6470
|
case "image": {
|
|
6071
6471
|
const { type, keyName, ...props2 } = column;
|
|
6072
6472
|
const src = keyName ? item[keyName] : void 0;
|
|
6073
|
-
return /* @__PURE__ */ (0,
|
|
6473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, { src, width: defaultImageWidth, borderRadius: theme2.styles.borderRadius / 2, ...props2 });
|
|
6074
6474
|
}
|
|
6075
6475
|
case "checkbox": {
|
|
6076
6476
|
const { type, onChange, ...props2 } = column;
|
|
6077
6477
|
const checkedValue = checkedItems[index];
|
|
6078
|
-
return /* @__PURE__ */ (0,
|
|
6478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6079
6479
|
ToggleInput_default.checkbox,
|
|
6080
6480
|
{
|
|
6081
6481
|
checked: checkedValue,
|
|
@@ -6090,29 +6490,29 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6090
6490
|
);
|
|
6091
6491
|
}
|
|
6092
6492
|
default: {
|
|
6093
|
-
return /* @__PURE__ */ (0,
|
|
6493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
|
|
6094
6494
|
}
|
|
6095
6495
|
}
|
|
6096
6496
|
},
|
|
6097
6497
|
[theme2, checkedItems]
|
|
6098
6498
|
);
|
|
6099
|
-
const onClickRowElement = (0,
|
|
6499
|
+
const onClickRowElement = (0, import_react23.useCallback)(
|
|
6100
6500
|
(item, index) => {
|
|
6101
6501
|
onClickRow?.(item, index);
|
|
6102
6502
|
},
|
|
6103
6503
|
[onClickRow]
|
|
6104
6504
|
);
|
|
6105
|
-
const onClickAllCheckboxesElement = (0,
|
|
6505
|
+
const onClickAllCheckboxesElement = (0, import_react23.useCallback)(
|
|
6106
6506
|
(checked) => {
|
|
6107
6507
|
onClickAllCheckboxes?.(checked);
|
|
6108
6508
|
setCheckedItems(data.map(() => checked));
|
|
6109
6509
|
},
|
|
6110
6510
|
[onClickAllCheckboxes, data]
|
|
6111
6511
|
);
|
|
6112
|
-
const everythingIsChecked = (0,
|
|
6512
|
+
const everythingIsChecked = (0, import_react23.useMemo)(() => {
|
|
6113
6513
|
return checkedItems.every((checked) => checked) && checkedItems.length === data.length;
|
|
6114
6514
|
}, [data, checkedItems]);
|
|
6115
|
-
return /* @__PURE__ */ (0,
|
|
6515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6116
6516
|
Div_default,
|
|
6117
6517
|
{
|
|
6118
6518
|
border: `1px solid ${theme2.colors.border}`,
|
|
@@ -6120,7 +6520,7 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6120
6520
|
overflow: "auto",
|
|
6121
6521
|
...props,
|
|
6122
6522
|
ref,
|
|
6123
|
-
children: /* @__PURE__ */ (0,
|
|
6523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
6124
6524
|
TableStyledComponent,
|
|
6125
6525
|
{
|
|
6126
6526
|
isStriped,
|
|
@@ -6129,14 +6529,14 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6129
6529
|
colorTheme,
|
|
6130
6530
|
theme: theme2,
|
|
6131
6531
|
children: [
|
|
6132
|
-
/* @__PURE__ */ (0,
|
|
6532
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6133
6533
|
ThStyledComponent,
|
|
6134
6534
|
{
|
|
6135
6535
|
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
6136
6536
|
minWidth: column.minWidth,
|
|
6137
6537
|
maxWidth: column.maxWidth,
|
|
6138
6538
|
textAlign: column.align,
|
|
6139
|
-
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0,
|
|
6539
|
+
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6140
6540
|
ToggleInput_default.checkbox,
|
|
6141
6541
|
{
|
|
6142
6542
|
checked: everythingIsChecked,
|
|
@@ -6146,86 +6546,24 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6146
6546
|
},
|
|
6147
6547
|
column.type + column.label + index
|
|
6148
6548
|
)) }) }),
|
|
6149
|
-
/* @__PURE__ */ (0,
|
|
6549
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6150
6550
|
"tr",
|
|
6151
6551
|
{
|
|
6152
6552
|
className: onClickRow ? "isClickable" : void 0,
|
|
6153
6553
|
onClick: () => onClickRowElement(item, rowIndex),
|
|
6154
|
-
children: columns.map((column, colIndex) => /* @__PURE__ */ (0,
|
|
6554
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
|
|
6155
6555
|
},
|
|
6156
6556
|
JSON.stringify(item) + rowIndex
|
|
6157
|
-
)) : /* @__PURE__ */ (0,
|
|
6557
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) })
|
|
6158
6558
|
]
|
|
6159
6559
|
}
|
|
6160
6560
|
)
|
|
6161
6561
|
}
|
|
6162
6562
|
);
|
|
6163
6563
|
});
|
|
6164
|
-
var Table2 = (0,
|
|
6564
|
+
var Table2 = (0, import_react23.memo)(TableComponent);
|
|
6165
6565
|
var Table_default = Table2;
|
|
6166
6566
|
|
|
6167
|
-
// src/utils/functions.ts
|
|
6168
|
-
var generateRandomString = (stringLength, options) => {
|
|
6169
|
-
const capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
6170
|
-
const lowers = "abcdefghijklmnopqrstuvwxyz";
|
|
6171
|
-
const numbers = "0123456789";
|
|
6172
|
-
const includes = [];
|
|
6173
|
-
if (options?.includeCapitalLetters !== false) includes.push(capitals);
|
|
6174
|
-
if (options?.includeLowerLetters !== false) includes.push(lowers);
|
|
6175
|
-
if (options?.includeNumbers !== false) includes.push(numbers);
|
|
6176
|
-
const characters = includes.join("");
|
|
6177
|
-
const dashSections = Math.max(1, options?.dashSections ?? 1);
|
|
6178
|
-
const dashSectionLength = Math.floor(stringLength / dashSections);
|
|
6179
|
-
if (stringLength < dashSections) return "";
|
|
6180
|
-
let result = "";
|
|
6181
|
-
let currentSectionLength = 0;
|
|
6182
|
-
while (result.length < stringLength) {
|
|
6183
|
-
if (currentSectionLength >= dashSectionLength) {
|
|
6184
|
-
result += "-";
|
|
6185
|
-
currentSectionLength = 0;
|
|
6186
|
-
}
|
|
6187
|
-
if (result.length < stringLength) {
|
|
6188
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
6189
|
-
currentSectionLength += 1;
|
|
6190
|
-
}
|
|
6191
|
-
}
|
|
6192
|
-
return result;
|
|
6193
|
-
};
|
|
6194
|
-
var getBrowser = () => {
|
|
6195
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
6196
|
-
if (userAgent.includes("firefox")) return "firefox";
|
|
6197
|
-
if (userAgent.includes("chrome") && !userAgent.includes("edg")) return "chrome";
|
|
6198
|
-
if (userAgent.includes("safari") && !userAgent.includes("chrome")) return "safari";
|
|
6199
|
-
if (userAgent.includes("edg")) return "edge";
|
|
6200
|
-
if (userAgent.includes("opr") || userAgent.includes("opera")) return "opera";
|
|
6201
|
-
return;
|
|
6202
|
-
};
|
|
6203
|
-
var formatPhoneNumber = (phoneNumber) => {
|
|
6204
|
-
const cleanPhoneNumber = phoneNumber.replace(/\D/g, "");
|
|
6205
|
-
const country = countries.find(
|
|
6206
|
-
(country2) => country2.phoneNumberExtension === cleanPhoneNumber.slice(0, country2.phoneNumberExtension.length)
|
|
6207
|
-
);
|
|
6208
|
-
if (!country) return phoneNumber;
|
|
6209
|
-
let phonNumberRest = cleanPhoneNumber.slice(country.phoneNumberExtension.length);
|
|
6210
|
-
if (country.phoneNumberFormat) {
|
|
6211
|
-
let formattedNumber = "";
|
|
6212
|
-
let index = 0;
|
|
6213
|
-
for (const char of country.phoneNumberFormat) {
|
|
6214
|
-
if (char === "X" && index < phonNumberRest.length) {
|
|
6215
|
-
formattedNumber += phonNumberRest[index];
|
|
6216
|
-
index++;
|
|
6217
|
-
} else {
|
|
6218
|
-
formattedNumber += char;
|
|
6219
|
-
}
|
|
6220
|
-
}
|
|
6221
|
-
phonNumberRest = formattedNumber.replace(/X/g, "").trim();
|
|
6222
|
-
}
|
|
6223
|
-
return `+${country.phoneNumberExtension} ${phonNumberRest}`;
|
|
6224
|
-
};
|
|
6225
|
-
var getFormErrorObject = (formValues) => {
|
|
6226
|
-
return {};
|
|
6227
|
-
};
|
|
6228
|
-
|
|
6229
6567
|
// src/utils/variableFunctions.ts
|
|
6230
6568
|
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
6231
6569
|
if (value === void 0) {
|