react-better-html 1.1.76 → 1.1.78
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 +584 -240
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +565 -221
- 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");
|
|
@@ -4880,7 +4962,7 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
4880
4962
|
Div_default.row,
|
|
4881
4963
|
{
|
|
4882
4964
|
position: "absolute",
|
|
4883
|
-
top: 46 / 2 + (label ? 16 + theme2.styles.gap
|
|
4965
|
+
top: 46 / 2 + (label ? 16 + theme2.styles.gap : 0),
|
|
4884
4966
|
right: theme2.styles.space + 1,
|
|
4885
4967
|
alignItems: "center",
|
|
4886
4968
|
gap: theme2.styles.gap,
|
|
@@ -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: 46px;
|
|
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,26 +5350,32 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5079
5350
|
},
|
|
5080
5351
|
[onChange, onChangeValue, withDebounce]
|
|
5081
5352
|
);
|
|
5082
|
-
(0,
|
|
5353
|
+
const leftIconZIndex = (0, import_react18.useMemo)(
|
|
5354
|
+
() => ["react-better-html-dropdown-open-late", "react-better-html-inputField-dateTime-opened-late"].some(
|
|
5355
|
+
(classNameItem) => props.className?.includes(classNameItem)
|
|
5356
|
+
) ? 1002 : 1,
|
|
5357
|
+
[props.className]
|
|
5358
|
+
);
|
|
5359
|
+
(0, import_react18.useEffect)(() => {
|
|
5083
5360
|
if (!withDebounce) return;
|
|
5084
5361
|
onChangeValue?.(debouncedValue);
|
|
5085
5362
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
5086
|
-
return /* @__PURE__ */ (0,
|
|
5087
|
-
label && /* @__PURE__ */ (0,
|
|
5088
|
-
/* @__PURE__ */ (0,
|
|
5089
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
5363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, ref: holderRef, children: [
|
|
5364
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
5366
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5090
5367
|
Icon_default,
|
|
5091
5368
|
{
|
|
5092
5369
|
name: leftIcon,
|
|
5093
5370
|
position: "absolute",
|
|
5094
|
-
top: 46 / 2,
|
|
5371
|
+
top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
|
|
5095
5372
|
left: theme2.styles.space + 1,
|
|
5096
5373
|
transform: "translateY(-50%)",
|
|
5097
5374
|
pointerEvents: "none",
|
|
5098
|
-
zIndex:
|
|
5375
|
+
zIndex: leftIconZIndex
|
|
5099
5376
|
}
|
|
5100
5377
|
),
|
|
5101
|
-
/* @__PURE__ */ (0,
|
|
5378
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5102
5379
|
InputElement,
|
|
5103
5380
|
{
|
|
5104
5381
|
theme: theme2,
|
|
@@ -5114,7 +5391,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5114
5391
|
ref
|
|
5115
5392
|
}
|
|
5116
5393
|
),
|
|
5117
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0,
|
|
5394
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5118
5395
|
Button_default.icon,
|
|
5119
5396
|
{
|
|
5120
5397
|
icon: rightIcon,
|
|
@@ -5124,7 +5401,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5124
5401
|
transform: "translateY(-50%)",
|
|
5125
5402
|
onClick: onClickRightIcon
|
|
5126
5403
|
}
|
|
5127
|
-
) : /* @__PURE__ */ (0,
|
|
5404
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5128
5405
|
Icon_default,
|
|
5129
5406
|
{
|
|
5130
5407
|
name: rightIcon,
|
|
@@ -5137,7 +5414,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5137
5414
|
) : void 0,
|
|
5138
5415
|
insideInputFieldComponent
|
|
5139
5416
|
] }),
|
|
5140
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
5417
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5141
5418
|
Text_default,
|
|
5142
5419
|
{
|
|
5143
5420
|
as: "span",
|
|
@@ -5149,7 +5426,7 @@ var InputFieldComponent = (0, import_react17.forwardRef)(function InputField({
|
|
|
5149
5426
|
)
|
|
5150
5427
|
] });
|
|
5151
5428
|
});
|
|
5152
|
-
InputFieldComponent.multiline = (0,
|
|
5429
|
+
InputFieldComponent.multiline = (0, import_react18.forwardRef)(function Multiline({
|
|
5153
5430
|
label,
|
|
5154
5431
|
placeholder,
|
|
5155
5432
|
errorText,
|
|
@@ -5167,17 +5444,17 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5167
5444
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5168
5445
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5169
5446
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5170
|
-
const onChangeElement = (0,
|
|
5447
|
+
const onChangeElement = (0, import_react18.useCallback)(
|
|
5171
5448
|
(event) => {
|
|
5172
5449
|
onChange?.(event);
|
|
5173
5450
|
onChangeValue?.(event.target.value);
|
|
5174
5451
|
},
|
|
5175
5452
|
[onChange, onChangeValue]
|
|
5176
5453
|
);
|
|
5177
|
-
return /* @__PURE__ */ (0,
|
|
5178
|
-
label && /* @__PURE__ */ (0,
|
|
5179
|
-
/* @__PURE__ */ (0,
|
|
5180
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
5454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { gap: theme2.styles.gap, children: [
|
|
5455
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, required, isError: !!errorText }),
|
|
5456
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
5457
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5181
5458
|
Icon_default,
|
|
5182
5459
|
{
|
|
5183
5460
|
name: leftIcon,
|
|
@@ -5188,7 +5465,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5188
5465
|
pointerEvents: "none"
|
|
5189
5466
|
}
|
|
5190
5467
|
),
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5468
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5192
5469
|
TextareaElement,
|
|
5193
5470
|
{
|
|
5194
5471
|
theme: theme2,
|
|
@@ -5204,7 +5481,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5204
5481
|
ref
|
|
5205
5482
|
}
|
|
5206
5483
|
),
|
|
5207
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0,
|
|
5484
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5208
5485
|
Button_default.icon,
|
|
5209
5486
|
{
|
|
5210
5487
|
icon: rightIcon,
|
|
@@ -5214,7 +5491,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5214
5491
|
transform: "translateY(-50%)",
|
|
5215
5492
|
onClick: onClickRightIcon
|
|
5216
5493
|
}
|
|
5217
|
-
) : /* @__PURE__ */ (0,
|
|
5494
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5218
5495
|
Icon_default,
|
|
5219
5496
|
{
|
|
5220
5497
|
name: rightIcon,
|
|
@@ -5226,7 +5503,7 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5226
5503
|
}
|
|
5227
5504
|
) : void 0
|
|
5228
5505
|
] }),
|
|
5229
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
5506
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5230
5507
|
Text_default,
|
|
5231
5508
|
{
|
|
5232
5509
|
as: "span",
|
|
@@ -5239,8 +5516,8 @@ InputFieldComponent.multiline = (0, import_react17.forwardRef)(function Multilin
|
|
|
5239
5516
|
)
|
|
5240
5517
|
] });
|
|
5241
5518
|
});
|
|
5242
|
-
InputFieldComponent.email = (0,
|
|
5243
|
-
return /* @__PURE__ */ (0,
|
|
5519
|
+
InputFieldComponent.email = (0, import_react18.forwardRef)(function Email({ ...props }, ref) {
|
|
5520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5244
5521
|
InputFieldComponent,
|
|
5245
5522
|
{
|
|
5246
5523
|
type: "email",
|
|
@@ -5253,9 +5530,9 @@ InputFieldComponent.email = (0, import_react17.forwardRef)(function Email({ ...p
|
|
|
5253
5530
|
}
|
|
5254
5531
|
);
|
|
5255
5532
|
});
|
|
5256
|
-
InputFieldComponent.password = (0,
|
|
5533
|
+
InputFieldComponent.password = (0, import_react18.forwardRef)(function Password({ ...props }, ref) {
|
|
5257
5534
|
const [isPassword, setIsPassword] = useBooleanState(true);
|
|
5258
|
-
return /* @__PURE__ */ (0,
|
|
5535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5259
5536
|
InputFieldComponent,
|
|
5260
5537
|
{
|
|
5261
5538
|
type: isPassword ? "password" : "text",
|
|
@@ -5270,21 +5547,21 @@ InputFieldComponent.password = (0, import_react17.forwardRef)(function Password(
|
|
|
5270
5547
|
}
|
|
5271
5548
|
);
|
|
5272
5549
|
});
|
|
5273
|
-
InputFieldComponent.search = (0,
|
|
5274
|
-
return /* @__PURE__ */ (0,
|
|
5550
|
+
InputFieldComponent.search = (0, import_react18.forwardRef)(function Search({ ...props }, ref) {
|
|
5551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(InputFieldComponent, { leftIcon: "magnifyingGlass", placeholder: "Search...", ref, ...props });
|
|
5275
5552
|
});
|
|
5276
|
-
InputFieldComponent.phoneNumber = (0,
|
|
5553
|
+
InputFieldComponent.phoneNumber = (0, import_react18.forwardRef)(function PhoneNumber({ label, value, onChangeValue, labelColor, ...props }, ref) {
|
|
5277
5554
|
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,
|
|
5555
|
+
const [dropdownValue, setDropdownValue] = (0, import_react18.useState)();
|
|
5556
|
+
const [inputFieldValue, setInputFieldValue] = (0, import_react18.useState)(value?.toString() ?? "");
|
|
5557
|
+
const renderOption = (0, import_react18.useCallback)(
|
|
5558
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5560
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { children: option.label })
|
|
5284
5561
|
] }),
|
|
5285
5562
|
[]
|
|
5286
5563
|
);
|
|
5287
|
-
const onChangeValueElement = (0,
|
|
5564
|
+
const onChangeValueElement = (0, import_react18.useCallback)(
|
|
5288
5565
|
(value2) => {
|
|
5289
5566
|
const readyValue = value2.replace(/\D/g, "");
|
|
5290
5567
|
setInputFieldValue(readyValue);
|
|
@@ -5292,7 +5569,7 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5292
5569
|
},
|
|
5293
5570
|
[onChangeValue, dropdownValue]
|
|
5294
5571
|
);
|
|
5295
|
-
const options = (0,
|
|
5572
|
+
const options = (0, import_react18.useMemo)(
|
|
5296
5573
|
() => countries.map((country) => ({
|
|
5297
5574
|
value: country.phoneNumberExtension,
|
|
5298
5575
|
label: `+${country.phoneNumberExtension}`,
|
|
@@ -5300,13 +5577,13 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5300
5577
|
})),
|
|
5301
5578
|
[]
|
|
5302
5579
|
);
|
|
5303
|
-
const defaultValue = (0,
|
|
5580
|
+
const defaultValue = (0, import_react18.useMemo)(() => {
|
|
5304
5581
|
const thisTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
5305
5582
|
const initialDefaultValue = options.find((option) => option.data?.timeZone === thisTimeZone)?.value ?? "";
|
|
5306
5583
|
setDropdownValue(initialDefaultValue);
|
|
5307
5584
|
return initialDefaultValue;
|
|
5308
5585
|
}, [options]);
|
|
5309
|
-
(0,
|
|
5586
|
+
(0, import_react18.useEffect)(() => {
|
|
5310
5587
|
if (value === void 0 || value === null) return;
|
|
5311
5588
|
const newValue = value.toString();
|
|
5312
5589
|
const country = countries.find(
|
|
@@ -5322,10 +5599,10 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5322
5599
|
setDropdownValue(country.phoneNumberExtension);
|
|
5323
5600
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
5324
5601
|
}, [value]);
|
|
5325
|
-
return /* @__PURE__ */ (0,
|
|
5326
|
-
label && /* @__PURE__ */ (0,
|
|
5327
|
-
/* @__PURE__ */ (0,
|
|
5328
|
-
/* @__PURE__ */ (0,
|
|
5602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, children: [
|
|
5603
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required: props.required, isError: !!props.errorText }),
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { children: [
|
|
5605
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5329
5606
|
Dropdown_default,
|
|
5330
5607
|
{
|
|
5331
5608
|
options,
|
|
@@ -5341,7 +5618,7 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5341
5618
|
withoutClearButton: true
|
|
5342
5619
|
}
|
|
5343
5620
|
),
|
|
5344
|
-
/* @__PURE__ */ (0,
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5345
5622
|
InputFieldComponent,
|
|
5346
5623
|
{
|
|
5347
5624
|
placeholder: label ?? "Phone number",
|
|
@@ -5355,31 +5632,38 @@ InputFieldComponent.phoneNumber = (0, import_react17.forwardRef)(function PhoneN
|
|
|
5355
5632
|
] })
|
|
5356
5633
|
] });
|
|
5357
5634
|
});
|
|
5358
|
-
InputFieldComponent.date = (0,
|
|
5635
|
+
InputFieldComponent.date = (0, import_react18.forwardRef)(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
5359
5636
|
const theme2 = useTheme();
|
|
5360
|
-
const holderRef = (0,
|
|
5361
|
-
const
|
|
5362
|
-
|
|
5637
|
+
const holderRef = (0, import_react18.useRef)(null);
|
|
5638
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5639
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5640
|
+
const onChange = (0, import_react18.useCallback)(
|
|
5641
|
+
(date) => {
|
|
5642
|
+
inputFieldProps.onChangeValue?.(date ?? "");
|
|
5643
|
+
setInternalValue(date ?? "");
|
|
5644
|
+
},
|
|
5645
|
+
[inputFieldProps.onChangeValue]
|
|
5646
|
+
);
|
|
5647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5363
5648
|
InputFieldComponent,
|
|
5364
5649
|
{
|
|
5365
5650
|
type: "date",
|
|
5366
|
-
insideInputFieldComponent: /* @__PURE__ */ (0,
|
|
5651
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5367
5652
|
Div_default,
|
|
5368
5653
|
{
|
|
5369
5654
|
position: "absolute",
|
|
5370
5655
|
top: "100%",
|
|
5371
5656
|
left: 0,
|
|
5372
|
-
width: "
|
|
5373
|
-
maxHeight: 300,
|
|
5657
|
+
width: "fit-content",
|
|
5374
5658
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5375
5659
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
5376
5660
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5377
5661
|
boxShadow: "0px 10px 20px #00000020",
|
|
5378
|
-
|
|
5662
|
+
userSelect: "none",
|
|
5379
5663
|
...insideInputFieldComponentProps,
|
|
5380
|
-
children:
|
|
5664
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange })
|
|
5381
5665
|
}
|
|
5382
|
-
),
|
|
5666
|
+
) : void 0,
|
|
5383
5667
|
holderRef,
|
|
5384
5668
|
ref,
|
|
5385
5669
|
...props,
|
|
@@ -5387,31 +5671,152 @@ InputFieldComponent.date = (0, import_react17.forwardRef)(function Date({ classN
|
|
|
5387
5671
|
}
|
|
5388
5672
|
);
|
|
5389
5673
|
});
|
|
5390
|
-
InputFieldComponent.dateTime = (0,
|
|
5674
|
+
InputFieldComponent.dateTime = (0, import_react18.forwardRef)(function DateTime({ minDate, maxDate, ...props }, ref) {
|
|
5391
5675
|
const theme2 = useTheme();
|
|
5392
|
-
const holderRef = (0,
|
|
5393
|
-
const
|
|
5394
|
-
|
|
5676
|
+
const holderRef = (0, import_react18.useRef)(null);
|
|
5677
|
+
const selectedHourRef = (0, import_react18.useRef)(null);
|
|
5678
|
+
const selectedMinuteRef = (0, import_react18.useRef)(null);
|
|
5679
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5680
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5681
|
+
const onChange = (0, import_react18.useCallback)(
|
|
5682
|
+
(date) => {
|
|
5683
|
+
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? "00:00"}` : "";
|
|
5684
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5685
|
+
setInternalValue(newValue);
|
|
5686
|
+
},
|
|
5687
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5688
|
+
);
|
|
5689
|
+
const onClickHour = (0, import_react18.useCallback)(
|
|
5690
|
+
(hour) => {
|
|
5691
|
+
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5692
|
+
const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
5693
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
5694
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5695
|
+
setInternalValue(newValue);
|
|
5696
|
+
},
|
|
5697
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5698
|
+
);
|
|
5699
|
+
const onClickMinute = (0, import_react18.useCallback)(
|
|
5700
|
+
(minute) => {
|
|
5701
|
+
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5702
|
+
const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
5703
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
5704
|
+
console.log(newValue);
|
|
5705
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5706
|
+
setInternalValue(newValue);
|
|
5707
|
+
},
|
|
5708
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5709
|
+
);
|
|
5710
|
+
(0, import_react18.useEffect)(() => {
|
|
5711
|
+
if (isOpen && selectedHourRef.current)
|
|
5712
|
+
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5713
|
+
if (isOpen && selectedMinuteRef.current)
|
|
5714
|
+
selectedMinuteRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5715
|
+
}, [isOpen]);
|
|
5716
|
+
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
5717
|
+
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
5718
|
+
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
5719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5395
5720
|
InputFieldComponent,
|
|
5396
5721
|
{
|
|
5397
5722
|
type: "datetime-local",
|
|
5398
|
-
insideInputFieldComponent: /* @__PURE__ */ (0,
|
|
5723
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5399
5724
|
Div_default,
|
|
5400
5725
|
{
|
|
5401
5726
|
position: "absolute",
|
|
5402
5727
|
top: "100%",
|
|
5403
5728
|
left: 0,
|
|
5404
|
-
width: "
|
|
5405
|
-
maxHeight: 300,
|
|
5729
|
+
width: "fit-content",
|
|
5406
5730
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5407
5731
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
5408
5732
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5409
5733
|
boxShadow: "0px 10px 20px #00000020",
|
|
5410
|
-
|
|
5734
|
+
overflow: "hidden",
|
|
5735
|
+
userSelect: "none",
|
|
5411
5736
|
...insideInputFieldComponentProps,
|
|
5412
|
-
children:
|
|
5737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { gap: theme2.styles.space, children: [
|
|
5738
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5740
|
+
Div_default.row,
|
|
5741
|
+
{
|
|
5742
|
+
height: 276,
|
|
5743
|
+
gap: theme2.styles.gap / 2,
|
|
5744
|
+
paddingTop: topSpacing,
|
|
5745
|
+
paddingBottom: theme2.styles.space / 2,
|
|
5746
|
+
paddingRight: theme2.styles.space / 2,
|
|
5747
|
+
children: [
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { height: "100%", children: [
|
|
5749
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5751
|
+
Div_default,
|
|
5752
|
+
{
|
|
5753
|
+
className: "react-better-html-no-scrollbar",
|
|
5754
|
+
width: buttonWidth,
|
|
5755
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5756
|
+
overflowY: "auto",
|
|
5757
|
+
children: hours.map((hour) => {
|
|
5758
|
+
const isSelected = hour.toString() === valueHour;
|
|
5759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5760
|
+
Div_default.row,
|
|
5761
|
+
{
|
|
5762
|
+
alignItems: "center",
|
|
5763
|
+
justifyContent: "center",
|
|
5764
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5765
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5766
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5767
|
+
filterHover: "brightness(0.9)",
|
|
5768
|
+
cursor: "pointer",
|
|
5769
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5770
|
+
value: hour,
|
|
5771
|
+
onClickWithValue: onClickHour,
|
|
5772
|
+
ref: isSelected ? selectedHourRef : void 0,
|
|
5773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5774
|
+
},
|
|
5775
|
+
hour
|
|
5776
|
+
);
|
|
5777
|
+
})
|
|
5778
|
+
}
|
|
5779
|
+
)
|
|
5780
|
+
] }),
|
|
5781
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { height: "100%", children: [
|
|
5782
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
5783
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5784
|
+
Div_default,
|
|
5785
|
+
{
|
|
5786
|
+
className: "react-better-html-no-scrollbar",
|
|
5787
|
+
width: buttonWidth,
|
|
5788
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5789
|
+
overflowY: "auto",
|
|
5790
|
+
children: minutes.map((minute) => {
|
|
5791
|
+
const isSelected = minute.toString() === valueMinute;
|
|
5792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5793
|
+
Div_default.row,
|
|
5794
|
+
{
|
|
5795
|
+
alignItems: "center",
|
|
5796
|
+
justifyContent: "center",
|
|
5797
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5798
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5799
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5800
|
+
filterHover: "brightness(0.9)",
|
|
5801
|
+
cursor: "pointer",
|
|
5802
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5803
|
+
value: minute,
|
|
5804
|
+
onClickWithValue: onClickMinute,
|
|
5805
|
+
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5807
|
+
},
|
|
5808
|
+
minute
|
|
5809
|
+
);
|
|
5810
|
+
})
|
|
5811
|
+
}
|
|
5812
|
+
)
|
|
5813
|
+
] })
|
|
5814
|
+
]
|
|
5815
|
+
}
|
|
5816
|
+
)
|
|
5817
|
+
] })
|
|
5413
5818
|
}
|
|
5414
|
-
),
|
|
5819
|
+
) : void 0,
|
|
5415
5820
|
holderRef,
|
|
5416
5821
|
ref,
|
|
5417
5822
|
...props,
|
|
@@ -5419,13 +5824,14 @@ InputFieldComponent.dateTime = (0, import_react17.forwardRef)(function DateTime(
|
|
|
5419
5824
|
}
|
|
5420
5825
|
);
|
|
5421
5826
|
});
|
|
5422
|
-
InputFieldComponent.time = (0,
|
|
5827
|
+
InputFieldComponent.time = (0, import_react18.forwardRef)(function Time({ ...props }, ref) {
|
|
5423
5828
|
const theme2 = useTheme();
|
|
5424
|
-
const holderRef = (0,
|
|
5425
|
-
const selectedHourRef = (0,
|
|
5426
|
-
const selectedMinuteRef = (0,
|
|
5427
|
-
const
|
|
5428
|
-
const
|
|
5829
|
+
const holderRef = (0, import_react18.useRef)(null);
|
|
5830
|
+
const selectedHourRef = (0, import_react18.useRef)(null);
|
|
5831
|
+
const selectedMinuteRef = (0, import_react18.useRef)(null);
|
|
5832
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5833
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5834
|
+
const onClickHour = (0, import_react18.useCallback)(
|
|
5429
5835
|
(hour) => {
|
|
5430
5836
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5431
5837
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -5433,7 +5839,7 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5433
5839
|
},
|
|
5434
5840
|
[internalValue, inputFieldProps.onChangeValue]
|
|
5435
5841
|
);
|
|
5436
|
-
const onClickMinute = (0,
|
|
5842
|
+
const onClickMinute = (0, import_react18.useCallback)(
|
|
5437
5843
|
(minute) => {
|
|
5438
5844
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5439
5845
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -5441,7 +5847,7 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5441
5847
|
},
|
|
5442
5848
|
[internalValue, inputFieldProps.onChangeValue]
|
|
5443
5849
|
);
|
|
5444
|
-
(0,
|
|
5850
|
+
(0, import_react18.useEffect)(() => {
|
|
5445
5851
|
if (isOpen && selectedHourRef.current)
|
|
5446
5852
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5447
5853
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -5449,12 +5855,11 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5449
5855
|
}, [isOpen]);
|
|
5450
5856
|
const valueHour = parseInt(internalValue?.toString().split(":")?.[0]).toString();
|
|
5451
5857
|
const valueMinute = parseInt(internalValue?.toString().split(":")?.[1]).toString();
|
|
5452
|
-
|
|
5453
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5454
5859
|
InputFieldComponent,
|
|
5455
5860
|
{
|
|
5456
5861
|
type: "time",
|
|
5457
|
-
insideInputFieldComponent: /* @__PURE__ */ (0,
|
|
5862
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5458
5863
|
Div_default,
|
|
5459
5864
|
{
|
|
5460
5865
|
position: "absolute",
|
|
@@ -5467,11 +5872,12 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5467
5872
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5468
5873
|
boxShadow: "0px 10px 20px #00000020",
|
|
5469
5874
|
overflowY: "auto",
|
|
5875
|
+
userSelect: "none",
|
|
5470
5876
|
...insideInputFieldComponentProps,
|
|
5471
|
-
children: /* @__PURE__ */ (0,
|
|
5472
|
-
/* @__PURE__ */ (0,
|
|
5877
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { height: "100%", children: [
|
|
5878
|
+
/* @__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
5879
|
const isSelected = hour.toString() === valueHour;
|
|
5474
|
-
return /* @__PURE__ */ (0,
|
|
5880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5475
5881
|
Div_default.row,
|
|
5476
5882
|
{
|
|
5477
5883
|
alignItems: "center",
|
|
@@ -5484,14 +5890,14 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5484
5890
|
value: hour,
|
|
5485
5891
|
onClickWithValue: onClickHour,
|
|
5486
5892
|
ref: isSelected ? selectedHourRef : void 0,
|
|
5487
|
-
children: /* @__PURE__ */ (0,
|
|
5893
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5488
5894
|
},
|
|
5489
5895
|
hour
|
|
5490
5896
|
);
|
|
5491
5897
|
}) }),
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5898
|
+
/* @__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
5899
|
const isSelected = minute.toString() === valueMinute;
|
|
5494
|
-
return /* @__PURE__ */ (0,
|
|
5900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5495
5901
|
Div_default.row,
|
|
5496
5902
|
{
|
|
5497
5903
|
alignItems: "center",
|
|
@@ -5504,14 +5910,14 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5504
5910
|
value: minute,
|
|
5505
5911
|
onClickWithValue: onClickMinute,
|
|
5506
5912
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5507
|
-
children: /* @__PURE__ */ (0,
|
|
5913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5508
5914
|
},
|
|
5509
5915
|
minute
|
|
5510
5916
|
);
|
|
5511
5917
|
}) })
|
|
5512
5918
|
] })
|
|
5513
5919
|
}
|
|
5514
|
-
),
|
|
5920
|
+
) : void 0,
|
|
5515
5921
|
holderRef,
|
|
5516
5922
|
ref,
|
|
5517
5923
|
...props,
|
|
@@ -5520,7 +5926,7 @@ InputFieldComponent.time = (0, import_react17.forwardRef)(function Time({ ...pro
|
|
|
5520
5926
|
}
|
|
5521
5927
|
);
|
|
5522
5928
|
});
|
|
5523
|
-
var InputField2 = (0,
|
|
5929
|
+
var InputField2 = (0, import_react18.memo)(InputFieldComponent);
|
|
5524
5930
|
InputField2.multiline = InputFieldComponent.multiline;
|
|
5525
5931
|
InputField2.email = InputFieldComponent.email;
|
|
5526
5932
|
InputField2.password = InputFieldComponent.password;
|
|
@@ -5532,9 +5938,9 @@ InputField2.time = InputFieldComponent.time;
|
|
|
5532
5938
|
var InputField_default = InputField2;
|
|
5533
5939
|
|
|
5534
5940
|
// src/components/ToggleInput.tsx
|
|
5535
|
-
var
|
|
5941
|
+
var import_react19 = require("react");
|
|
5536
5942
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
5537
|
-
var
|
|
5943
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5538
5944
|
var componentSize = 26;
|
|
5539
5945
|
var switchComponentBallGap = 3;
|
|
5540
5946
|
var switchComponentMouseDownDifference = 4;
|
|
@@ -5625,7 +6031,7 @@ var SwitchElement = import_styled_components10.default.div.withConfig({
|
|
|
5625
6031
|
${(props) => props.hoverStyle}
|
|
5626
6032
|
}
|
|
5627
6033
|
`;
|
|
5628
|
-
var ToggleInputComponent = (0,
|
|
6034
|
+
var ToggleInputComponent = (0, import_react19.forwardRef)(function ToggleInput({
|
|
5629
6035
|
label,
|
|
5630
6036
|
labelColor,
|
|
5631
6037
|
text,
|
|
@@ -5644,8 +6050,8 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5644
6050
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5645
6051
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5646
6052
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5647
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
5648
|
-
const onChangeElement = (0,
|
|
6053
|
+
const [internalChecked, setInternalChecked] = (0, import_react19.useState)(false);
|
|
6054
|
+
const onChangeElement = (0, import_react19.useCallback)(
|
|
5649
6055
|
(event) => {
|
|
5650
6056
|
const newIsChecked = event.target.checked;
|
|
5651
6057
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
@@ -5654,16 +6060,16 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5654
6060
|
[onChange, controlledChecked, value]
|
|
5655
6061
|
);
|
|
5656
6062
|
const checked = controlledChecked ?? internalChecked;
|
|
5657
|
-
const onClickText = (0,
|
|
6063
|
+
const onClickText = (0, import_react19.useCallback)(() => {
|
|
5658
6064
|
const newIsChecked = !checked;
|
|
5659
6065
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
5660
6066
|
onChange?.(newIsChecked, value);
|
|
5661
6067
|
}, [checked, controlledChecked, onChange, value]);
|
|
5662
|
-
return /* @__PURE__ */ (0,
|
|
5663
|
-
label && /* @__PURE__ */ (0,
|
|
5664
|
-
/* @__PURE__ */ (0,
|
|
5665
|
-
/* @__PURE__ */ (0,
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
6068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6069
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
6070
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6071
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5667
6073
|
InputElement2,
|
|
5668
6074
|
{
|
|
5669
6075
|
theme: theme2,
|
|
@@ -5676,7 +6082,7 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5676
6082
|
...restProps
|
|
5677
6083
|
}
|
|
5678
6084
|
),
|
|
5679
|
-
props.type === "checkbox" ? /* @__PURE__ */ (0,
|
|
6085
|
+
props.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5680
6086
|
Icon_default,
|
|
5681
6087
|
{
|
|
5682
6088
|
name: "check",
|
|
@@ -5690,7 +6096,7 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5690
6096
|
pointerEvents: "none",
|
|
5691
6097
|
transition: theme2.styles.transition
|
|
5692
6098
|
}
|
|
5693
|
-
) : props.type === "radio" ? /* @__PURE__ */ (0,
|
|
6099
|
+
) : props.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5694
6100
|
Div_default,
|
|
5695
6101
|
{
|
|
5696
6102
|
position: "absolute",
|
|
@@ -5706,15 +6112,15 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5706
6112
|
}
|
|
5707
6113
|
) : void 0
|
|
5708
6114
|
] }),
|
|
5709
|
-
text && /* @__PURE__ */ (0,
|
|
6115
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5710
6116
|
text,
|
|
5711
|
-
required && !label && /* @__PURE__ */ (0,
|
|
6117
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5712
6118
|
" ",
|
|
5713
6119
|
"*"
|
|
5714
6120
|
] })
|
|
5715
6121
|
] })
|
|
5716
6122
|
] }),
|
|
5717
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
6123
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5718
6124
|
Text_default,
|
|
5719
6125
|
{
|
|
5720
6126
|
as: "span",
|
|
@@ -5727,13 +6133,13 @@ var ToggleInputComponent = (0, import_react18.forwardRef)(function ToggleInput({
|
|
|
5727
6133
|
] });
|
|
5728
6134
|
});
|
|
5729
6135
|
var ToggleInput_default = {
|
|
5730
|
-
checkbox: (0,
|
|
5731
|
-
return /* @__PURE__ */ (0,
|
|
6136
|
+
checkbox: (0, import_react19.forwardRef)(function Checkbox(props, ref) {
|
|
6137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5732
6138
|
}),
|
|
5733
|
-
radiobutton: (0,
|
|
5734
|
-
return /* @__PURE__ */ (0,
|
|
6139
|
+
radiobutton: (0, import_react19.forwardRef)(function RadioButton(props, ref) {
|
|
6140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5735
6141
|
}),
|
|
5736
|
-
switch: (0,
|
|
6142
|
+
switch: (0, import_react19.forwardRef)(function Switch({
|
|
5737
6143
|
label,
|
|
5738
6144
|
labelColor,
|
|
5739
6145
|
errorText,
|
|
@@ -5754,15 +6160,15 @@ var ToggleInput_default = {
|
|
|
5754
6160
|
const [internalChecked, setInternalChecked] = useBooleanState();
|
|
5755
6161
|
const [isMouseDown, setIsMouseDown] = useBooleanState();
|
|
5756
6162
|
const checked = controlledChecked ?? internalChecked;
|
|
5757
|
-
const onClickElement = (0,
|
|
6163
|
+
const onClickElement = (0, import_react19.useCallback)(() => {
|
|
5758
6164
|
if (disabled) return;
|
|
5759
6165
|
const newIsChecked = !checked;
|
|
5760
6166
|
if (controlledChecked === void 0) setInternalChecked.setState(newIsChecked);
|
|
5761
6167
|
onChange?.(newIsChecked, value);
|
|
5762
6168
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5763
|
-
return /* @__PURE__ */ (0,
|
|
5764
|
-
label && /* @__PURE__ */ (0,
|
|
5765
|
-
/* @__PURE__ */ (0,
|
|
6169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6170
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5766
6172
|
Div_default.row,
|
|
5767
6173
|
{
|
|
5768
6174
|
alignItems: "center",
|
|
@@ -5773,7 +6179,7 @@ var ToggleInput_default = {
|
|
|
5773
6179
|
onTouchStart: setIsMouseDown.setTrue,
|
|
5774
6180
|
onTouchEnd: setIsMouseDown.setFalse,
|
|
5775
6181
|
onTouchCancel: setIsMouseDown.setFalse,
|
|
5776
|
-
children: /* @__PURE__ */ (0,
|
|
6182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5777
6183
|
SwitchElement,
|
|
5778
6184
|
{
|
|
5779
6185
|
theme: theme2,
|
|
@@ -5789,7 +6195,7 @@ var ToggleInput_default = {
|
|
|
5789
6195
|
)
|
|
5790
6196
|
}
|
|
5791
6197
|
),
|
|
5792
|
-
(errorText || infoText) && /* @__PURE__ */ (0,
|
|
6198
|
+
(errorText || infoText) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5793
6199
|
Text_default,
|
|
5794
6200
|
{
|
|
5795
6201
|
as: "span",
|
|
@@ -5804,8 +6210,8 @@ var ToggleInput_default = {
|
|
|
5804
6210
|
};
|
|
5805
6211
|
|
|
5806
6212
|
// src/components/Form.tsx
|
|
5807
|
-
var
|
|
5808
|
-
var
|
|
6213
|
+
var import_react20 = require("react");
|
|
6214
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5809
6215
|
function Form({
|
|
5810
6216
|
form,
|
|
5811
6217
|
submitButtonText,
|
|
@@ -5822,7 +6228,7 @@ function Form({
|
|
|
5822
6228
|
...props
|
|
5823
6229
|
}) {
|
|
5824
6230
|
const theme2 = useTheme();
|
|
5825
|
-
const submitButtonIsDisabledInternal = (0,
|
|
6231
|
+
const submitButtonIsDisabledInternal = (0, import_react20.useMemo)(() => {
|
|
5826
6232
|
if (!form || !form.requiredFields) return false;
|
|
5827
6233
|
return Object.entries(form.values).some(
|
|
5828
6234
|
([key, value]) => form.requiredFields?.includes(key) && (value === void 0 || value === null || value?.toString().trim() === "")
|
|
@@ -5830,9 +6236,9 @@ function Form({
|
|
|
5830
6236
|
}, [form]);
|
|
5831
6237
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
5832
6238
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
5833
|
-
return /* @__PURE__ */ (0,
|
|
5834
|
-
gap !== void 0 ? /* @__PURE__ */ (0,
|
|
5835
|
-
submitButtonText && /* @__PURE__ */ (0,
|
|
6239
|
+
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: [
|
|
6240
|
+
gap !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default.column, { gap, children }) : children,
|
|
6241
|
+
submitButtonText && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5836
6242
|
Div_default.row,
|
|
5837
6243
|
{
|
|
5838
6244
|
alignItems: "center",
|
|
@@ -5840,8 +6246,8 @@ function Form({
|
|
|
5840
6246
|
gap: theme2.styles.gap,
|
|
5841
6247
|
marginTop: theme2.styles.space,
|
|
5842
6248
|
children: [
|
|
5843
|
-
onClickCancel && /* @__PURE__ */ (0,
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
6249
|
+
onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.secondary, { text: "Cancel", onClick: onClickCancel }),
|
|
6250
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5845
6251
|
SubmitButtonTag,
|
|
5846
6252
|
{
|
|
5847
6253
|
text: submitButtonText,
|
|
@@ -5857,22 +6263,22 @@ function Form({
|
|
|
5857
6263
|
)
|
|
5858
6264
|
] }) });
|
|
5859
6265
|
}
|
|
5860
|
-
var Form_default = (0,
|
|
6266
|
+
var Form_default = (0, import_react20.memo)(Form);
|
|
5861
6267
|
|
|
5862
6268
|
// src/components/FormRow.tsx
|
|
5863
|
-
var
|
|
5864
|
-
var
|
|
5865
|
-
var FormRowComponent = (0,
|
|
6269
|
+
var import_react21 = require("react");
|
|
6270
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6271
|
+
var FormRowComponent = (0, import_react21.forwardRef)(function FormRow({ oneItemOnly, noBreakingPoint, gap, children, ...props }, ref) {
|
|
5866
6272
|
const theme2 = useTheme();
|
|
5867
6273
|
const mediaQuery = useMediaQuery();
|
|
5868
6274
|
const breakingPoint = !noBreakingPoint ? mediaQuery.size900 : false;
|
|
5869
6275
|
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
5870
|
-
return /* @__PURE__ */ (0,
|
|
6276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
5871
6277
|
children,
|
|
5872
|
-
oneItemOnly && /* @__PURE__ */ (0,
|
|
6278
|
+
oneItemOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Div_default, { width: "100%" })
|
|
5873
6279
|
] });
|
|
5874
6280
|
});
|
|
5875
|
-
FormRowComponent.withTitle = (0,
|
|
6281
|
+
FormRowComponent.withTitle = (0, import_react21.forwardRef)(function WithTitle({
|
|
5876
6282
|
icon,
|
|
5877
6283
|
title,
|
|
5878
6284
|
description,
|
|
@@ -5886,15 +6292,15 @@ FormRowComponent.withTitle = (0, import_react20.forwardRef)(function WithTitle({
|
|
|
5886
6292
|
}, ref) {
|
|
5887
6293
|
const theme2 = useTheme();
|
|
5888
6294
|
const mediaQuery = useMediaQuery();
|
|
5889
|
-
return /* @__PURE__ */ (0,
|
|
5890
|
-
/* @__PURE__ */ (0,
|
|
5891
|
-
icon && /* @__PURE__ */ (0,
|
|
5892
|
-
/* @__PURE__ */ (0,
|
|
5893
|
-
/* @__PURE__ */ (0,
|
|
5894
|
-
description && /* @__PURE__ */ (0,
|
|
6295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(FormRowComponent, { ...props, ref, children: [
|
|
6296
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: theme2.styles.space, children: [
|
|
6297
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon_default, { name: icon }),
|
|
6298
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { as: "h3", children: title }),
|
|
6300
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
5895
6301
|
] })
|
|
5896
6302
|
] }),
|
|
5897
|
-
/* @__PURE__ */ (0,
|
|
6303
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5898
6304
|
Div_default.row,
|
|
5899
6305
|
{
|
|
5900
6306
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
@@ -5902,22 +6308,22 @@ FormRowComponent.withTitle = (0, import_react20.forwardRef)(function WithTitle({
|
|
|
5902
6308
|
gap: theme2.styles.gap,
|
|
5903
6309
|
children: [
|
|
5904
6310
|
children,
|
|
5905
|
-
withActions && /* @__PURE__ */ (0,
|
|
5906
|
-
onClickReset && /* @__PURE__ */ (0,
|
|
5907
|
-
/* @__PURE__ */ (0,
|
|
6311
|
+
withActions && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6312
|
+
onClickReset && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
6313
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
5908
6314
|
] })
|
|
5909
6315
|
]
|
|
5910
6316
|
}
|
|
5911
6317
|
)
|
|
5912
6318
|
] });
|
|
5913
6319
|
});
|
|
5914
|
-
var FormRow2 = (0,
|
|
6320
|
+
var FormRow2 = (0, import_react21.memo)(FormRowComponent);
|
|
5915
6321
|
FormRow2.withTitle = FormRowComponent.withTitle;
|
|
5916
6322
|
var FormRow_default = FormRow2;
|
|
5917
6323
|
|
|
5918
6324
|
// src/components/ColorThemeSwitch.tsx
|
|
5919
|
-
var
|
|
5920
|
-
var
|
|
6325
|
+
var import_react22 = require("react");
|
|
6326
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
5921
6327
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
5922
6328
|
withMoon,
|
|
5923
6329
|
className,
|
|
@@ -5928,7 +6334,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5928
6334
|
darkMode: localStorage.getItem("theme") === "dark"
|
|
5929
6335
|
}
|
|
5930
6336
|
});
|
|
5931
|
-
(0,
|
|
6337
|
+
(0, import_react22.useEffect)(() => {
|
|
5932
6338
|
const timeout = setTimeout(() => {
|
|
5933
6339
|
window.document.body.parentElement?.setAttribute("data-theme", form.values.darkMode ? "dark" : "light");
|
|
5934
6340
|
localStorage.setItem("theme", form.values.darkMode ? "dark" : "light");
|
|
@@ -5937,7 +6343,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5937
6343
|
clearTimeout(timeout);
|
|
5938
6344
|
};
|
|
5939
6345
|
}, [form.values.darkMode]);
|
|
5940
|
-
(0,
|
|
6346
|
+
(0, import_react22.useEffect)(() => {
|
|
5941
6347
|
const html = document.querySelector("html");
|
|
5942
6348
|
if (!html) return;
|
|
5943
6349
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -5954,7 +6360,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5954
6360
|
observer.disconnect();
|
|
5955
6361
|
};
|
|
5956
6362
|
}, []);
|
|
5957
|
-
return /* @__PURE__ */ (0,
|
|
6363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
5958
6364
|
ToggleInput_default.switch,
|
|
5959
6365
|
{
|
|
5960
6366
|
className: `react-better-html-color-theme-switch ${withMoon ? ` react-better-html-color-theme-switch-with-moon` : ""}${className ? ` ${className}` : ""}`,
|
|
@@ -5965,20 +6371,20 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5965
6371
|
};
|
|
5966
6372
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
5967
6373
|
const theme2 = useTheme();
|
|
5968
|
-
return /* @__PURE__ */ (0,
|
|
5969
|
-
/* @__PURE__ */ (0,
|
|
5970
|
-
/* @__PURE__ */ (0,
|
|
5971
|
-
/* @__PURE__ */ (0,
|
|
6374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
6375
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text_default, { children: "Light" }),
|
|
6376
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ColorThemeSwitchComponent, { withMoon, className }),
|
|
6377
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text_default, { children: "Dark" })
|
|
5972
6378
|
] });
|
|
5973
6379
|
};
|
|
5974
|
-
var ColorThemeSwitch2 = (0,
|
|
6380
|
+
var ColorThemeSwitch2 = (0, import_react22.memo)(ColorThemeSwitchComponent);
|
|
5975
6381
|
ColorThemeSwitch2.withText = ColorThemeSwitchComponent.withText;
|
|
5976
6382
|
var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
5977
6383
|
|
|
5978
6384
|
// src/components/Table.tsx
|
|
5979
|
-
var
|
|
6385
|
+
var import_react23 = require("react");
|
|
5980
6386
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
5981
|
-
var
|
|
6387
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5982
6388
|
var defaultImageWidth = 120;
|
|
5983
6389
|
var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
5984
6390
|
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
|
|
@@ -6043,7 +6449,7 @@ var TdStyledComponent = import_styled_components11.default.td.withConfig({
|
|
|
6043
6449
|
})`
|
|
6044
6450
|
${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
|
|
6045
6451
|
`;
|
|
6046
|
-
var TableComponent = (0,
|
|
6452
|
+
var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
6047
6453
|
columns,
|
|
6048
6454
|
data,
|
|
6049
6455
|
isStriped,
|
|
@@ -6056,8 +6462,8 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6056
6462
|
}, ref) {
|
|
6057
6463
|
const { colorTheme } = useBetterHtmlContext();
|
|
6058
6464
|
const theme2 = useTheme();
|
|
6059
|
-
const [checkedItems, setCheckedItems] = (0,
|
|
6060
|
-
const renderCellContent = (0,
|
|
6465
|
+
const [checkedItems, setCheckedItems] = (0, import_react23.useState)([]);
|
|
6466
|
+
const renderCellContent = (0, import_react23.useCallback)(
|
|
6061
6467
|
(column, item, index) => {
|
|
6062
6468
|
switch (column.type) {
|
|
6063
6469
|
case "text": {
|
|
@@ -6065,17 +6471,17 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6065
6471
|
return column.format ? column.format(item, index) : String(value ?? "");
|
|
6066
6472
|
}
|
|
6067
6473
|
case "element": {
|
|
6068
|
-
return column.render?.(item, index) ?? /* @__PURE__ */ (0,
|
|
6474
|
+
return column.render?.(item, index) ?? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
|
|
6069
6475
|
}
|
|
6070
6476
|
case "image": {
|
|
6071
6477
|
const { type, keyName, ...props2 } = column;
|
|
6072
6478
|
const src = keyName ? item[keyName] : void 0;
|
|
6073
|
-
return /* @__PURE__ */ (0,
|
|
6479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, { src, width: defaultImageWidth, borderRadius: theme2.styles.borderRadius / 2, ...props2 });
|
|
6074
6480
|
}
|
|
6075
6481
|
case "checkbox": {
|
|
6076
6482
|
const { type, onChange, ...props2 } = column;
|
|
6077
6483
|
const checkedValue = checkedItems[index];
|
|
6078
|
-
return /* @__PURE__ */ (0,
|
|
6484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6079
6485
|
ToggleInput_default.checkbox,
|
|
6080
6486
|
{
|
|
6081
6487
|
checked: checkedValue,
|
|
@@ -6090,29 +6496,29 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6090
6496
|
);
|
|
6091
6497
|
}
|
|
6092
6498
|
default: {
|
|
6093
|
-
return /* @__PURE__ */ (0,
|
|
6499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
|
|
6094
6500
|
}
|
|
6095
6501
|
}
|
|
6096
6502
|
},
|
|
6097
6503
|
[theme2, checkedItems]
|
|
6098
6504
|
);
|
|
6099
|
-
const onClickRowElement = (0,
|
|
6505
|
+
const onClickRowElement = (0, import_react23.useCallback)(
|
|
6100
6506
|
(item, index) => {
|
|
6101
6507
|
onClickRow?.(item, index);
|
|
6102
6508
|
},
|
|
6103
6509
|
[onClickRow]
|
|
6104
6510
|
);
|
|
6105
|
-
const onClickAllCheckboxesElement = (0,
|
|
6511
|
+
const onClickAllCheckboxesElement = (0, import_react23.useCallback)(
|
|
6106
6512
|
(checked) => {
|
|
6107
6513
|
onClickAllCheckboxes?.(checked);
|
|
6108
6514
|
setCheckedItems(data.map(() => checked));
|
|
6109
6515
|
},
|
|
6110
6516
|
[onClickAllCheckboxes, data]
|
|
6111
6517
|
);
|
|
6112
|
-
const everythingIsChecked = (0,
|
|
6518
|
+
const everythingIsChecked = (0, import_react23.useMemo)(() => {
|
|
6113
6519
|
return checkedItems.every((checked) => checked) && checkedItems.length === data.length;
|
|
6114
6520
|
}, [data, checkedItems]);
|
|
6115
|
-
return /* @__PURE__ */ (0,
|
|
6521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6116
6522
|
Div_default,
|
|
6117
6523
|
{
|
|
6118
6524
|
border: `1px solid ${theme2.colors.border}`,
|
|
@@ -6120,7 +6526,7 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6120
6526
|
overflow: "auto",
|
|
6121
6527
|
...props,
|
|
6122
6528
|
ref,
|
|
6123
|
-
children: /* @__PURE__ */ (0,
|
|
6529
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
6124
6530
|
TableStyledComponent,
|
|
6125
6531
|
{
|
|
6126
6532
|
isStriped,
|
|
@@ -6129,14 +6535,14 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6129
6535
|
colorTheme,
|
|
6130
6536
|
theme: theme2,
|
|
6131
6537
|
children: [
|
|
6132
|
-
/* @__PURE__ */ (0,
|
|
6538
|
+
/* @__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
6539
|
ThStyledComponent,
|
|
6134
6540
|
{
|
|
6135
6541
|
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
6136
6542
|
minWidth: column.minWidth,
|
|
6137
6543
|
maxWidth: column.maxWidth,
|
|
6138
6544
|
textAlign: column.align,
|
|
6139
|
-
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0,
|
|
6545
|
+
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6140
6546
|
ToggleInput_default.checkbox,
|
|
6141
6547
|
{
|
|
6142
6548
|
checked: everythingIsChecked,
|
|
@@ -6146,86 +6552,24 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6146
6552
|
},
|
|
6147
6553
|
column.type + column.label + index
|
|
6148
6554
|
)) }) }),
|
|
6149
|
-
/* @__PURE__ */ (0,
|
|
6555
|
+
/* @__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
6556
|
"tr",
|
|
6151
6557
|
{
|
|
6152
6558
|
className: onClickRow ? "isClickable" : void 0,
|
|
6153
6559
|
onClick: () => onClickRowElement(item, rowIndex),
|
|
6154
|
-
children: columns.map((column, colIndex) => /* @__PURE__ */ (0,
|
|
6560
|
+
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
6561
|
},
|
|
6156
6562
|
JSON.stringify(item) + rowIndex
|
|
6157
|
-
)) : /* @__PURE__ */ (0,
|
|
6563
|
+
)) : /* @__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
6564
|
]
|
|
6159
6565
|
}
|
|
6160
6566
|
)
|
|
6161
6567
|
}
|
|
6162
6568
|
);
|
|
6163
6569
|
});
|
|
6164
|
-
var Table2 = (0,
|
|
6570
|
+
var Table2 = (0, import_react23.memo)(TableComponent);
|
|
6165
6571
|
var Table_default = Table2;
|
|
6166
6572
|
|
|
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
6573
|
// src/utils/variableFunctions.ts
|
|
6230
6574
|
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
6231
6575
|
if (value === void 0) {
|