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.mjs
CHANGED
|
@@ -1396,6 +1396,26 @@ var icons = {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
]
|
|
1398
1398
|
},
|
|
1399
|
+
chevronLeft: {
|
|
1400
|
+
width: 320,
|
|
1401
|
+
height: 512,
|
|
1402
|
+
paths: [
|
|
1403
|
+
{
|
|
1404
|
+
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",
|
|
1405
|
+
type: "fill"
|
|
1406
|
+
}
|
|
1407
|
+
]
|
|
1408
|
+
},
|
|
1409
|
+
chevronRight: {
|
|
1410
|
+
width: 320,
|
|
1411
|
+
height: 512,
|
|
1412
|
+
paths: [
|
|
1413
|
+
{
|
|
1414
|
+
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",
|
|
1415
|
+
type: "fill"
|
|
1416
|
+
}
|
|
1417
|
+
]
|
|
1418
|
+
},
|
|
1399
1419
|
eye: {
|
|
1400
1420
|
width: 576,
|
|
1401
1421
|
height: 512,
|
|
@@ -1703,7 +1723,7 @@ function useComponentPropsWithoutStyle(props) {
|
|
|
1703
1723
|
[props]
|
|
1704
1724
|
);
|
|
1705
1725
|
}
|
|
1706
|
-
function useComponentInputFieldDateProps(props, holderRef) {
|
|
1726
|
+
function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
1707
1727
|
const theme2 = useTheme();
|
|
1708
1728
|
const [isOpen, setIsOpen] = useBooleanState();
|
|
1709
1729
|
const [isOpenLate, setIsOpenLate] = useBooleanState();
|
|
@@ -1712,7 +1732,7 @@ function useComponentInputFieldDateProps(props, holderRef) {
|
|
|
1712
1732
|
const inputFieldProps = useMemo2(
|
|
1713
1733
|
() => ({
|
|
1714
1734
|
value: internalValue,
|
|
1715
|
-
className: `${isOpen ? "react-better-html-inputField-dateTime-opened" : ""}${isOpenLate ? " react-better-html-inputField-dateTime-opened-late" : ""}${props.className ? ` ${props.className}` : ""}`,
|
|
1735
|
+
className: `${isOpen && !disabled ? "react-better-html-inputField-dateTime-opened" : ""}${isOpenLate && !disabled ? " react-better-html-inputField-dateTime-opened-late" : ""}${props.className ? ` ${props.className}` : ""}`,
|
|
1716
1736
|
onClick: (event) => {
|
|
1717
1737
|
if (props.disabled) return;
|
|
1718
1738
|
setIsOpen.setTrue();
|
|
@@ -1731,7 +1751,7 @@ function useComponentInputFieldDateProps(props, holderRef) {
|
|
|
1731
1751
|
props.onChangeValue?.(value);
|
|
1732
1752
|
}
|
|
1733
1753
|
}),
|
|
1734
|
-
[props, internalValue, isOpen, isOpenLate]
|
|
1754
|
+
[props, internalValue, isOpen, isOpenLate, disabled]
|
|
1735
1755
|
);
|
|
1736
1756
|
const insideInputFieldComponentProps = useMemo2(
|
|
1737
1757
|
() => ({
|
|
@@ -3059,7 +3079,7 @@ Chip2.circle = ChipComponent.circle;
|
|
|
3059
3079
|
var Chip_default = Chip2;
|
|
3060
3080
|
|
|
3061
3081
|
// src/components/InputField.tsx
|
|
3062
|
-
import { forwardRef as forwardRef8, memo as
|
|
3082
|
+
import { forwardRef as forwardRef8, memo as memo16, useCallback as useCallback9, useState as useState7, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef4 } from "react";
|
|
3063
3083
|
import styled8 from "styled-components";
|
|
3064
3084
|
|
|
3065
3085
|
// src/constants/countries.ts
|
|
@@ -4543,6 +4563,68 @@ var countries = [
|
|
|
4543
4563
|
}
|
|
4544
4564
|
];
|
|
4545
4565
|
|
|
4566
|
+
// src/utils/functions.ts
|
|
4567
|
+
var generateRandomString = (stringLength, options) => {
|
|
4568
|
+
const capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
4569
|
+
const lowers = "abcdefghijklmnopqrstuvwxyz";
|
|
4570
|
+
const numbers = "0123456789";
|
|
4571
|
+
const includes = [];
|
|
4572
|
+
if (options?.includeCapitalLetters !== false) includes.push(capitals);
|
|
4573
|
+
if (options?.includeLowerLetters !== false) includes.push(lowers);
|
|
4574
|
+
if (options?.includeNumbers !== false) includes.push(numbers);
|
|
4575
|
+
const characters = includes.join("");
|
|
4576
|
+
const dashSections = Math.max(1, options?.dashSections ?? 1);
|
|
4577
|
+
const dashSectionLength = Math.floor(stringLength / dashSections);
|
|
4578
|
+
if (stringLength < dashSections) return "";
|
|
4579
|
+
let result = "";
|
|
4580
|
+
let currentSectionLength = 0;
|
|
4581
|
+
while (result.length < stringLength) {
|
|
4582
|
+
if (currentSectionLength >= dashSectionLength) {
|
|
4583
|
+
result += "-";
|
|
4584
|
+
currentSectionLength = 0;
|
|
4585
|
+
}
|
|
4586
|
+
if (result.length < stringLength) {
|
|
4587
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
4588
|
+
currentSectionLength += 1;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
return result;
|
|
4592
|
+
};
|
|
4593
|
+
var getBrowser = () => {
|
|
4594
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
4595
|
+
if (userAgent.includes("firefox")) return "firefox";
|
|
4596
|
+
if (userAgent.includes("chrome") && !userAgent.includes("edg")) return "chrome";
|
|
4597
|
+
if (userAgent.includes("safari") && !userAgent.includes("chrome")) return "safari";
|
|
4598
|
+
if (userAgent.includes("edg")) return "edge";
|
|
4599
|
+
if (userAgent.includes("opr") || userAgent.includes("opera")) return "opera";
|
|
4600
|
+
return;
|
|
4601
|
+
};
|
|
4602
|
+
var formatPhoneNumber = (phoneNumber) => {
|
|
4603
|
+
const cleanPhoneNumber = phoneNumber.replace(/\D/g, "");
|
|
4604
|
+
const country = countries.find(
|
|
4605
|
+
(country2) => country2.phoneNumberExtension === cleanPhoneNumber.slice(0, country2.phoneNumberExtension.length)
|
|
4606
|
+
);
|
|
4607
|
+
if (!country) return phoneNumber;
|
|
4608
|
+
let phonNumberRest = cleanPhoneNumber.slice(country.phoneNumberExtension.length);
|
|
4609
|
+
if (country.phoneNumberFormat) {
|
|
4610
|
+
let formattedNumber = "";
|
|
4611
|
+
let index = 0;
|
|
4612
|
+
for (const char of country.phoneNumberFormat) {
|
|
4613
|
+
if (char === "X" && index < phonNumberRest.length) {
|
|
4614
|
+
formattedNumber += phonNumberRest[index];
|
|
4615
|
+
index++;
|
|
4616
|
+
} else {
|
|
4617
|
+
formattedNumber += char;
|
|
4618
|
+
}
|
|
4619
|
+
}
|
|
4620
|
+
phonNumberRest = formattedNumber.replace(/X/g, "").trim();
|
|
4621
|
+
}
|
|
4622
|
+
return `+${country.phoneNumberExtension} ${phonNumberRest}`;
|
|
4623
|
+
};
|
|
4624
|
+
var getFormErrorObject = (formValues) => {
|
|
4625
|
+
return {};
|
|
4626
|
+
};
|
|
4627
|
+
|
|
4546
4628
|
// src/components/Label.tsx
|
|
4547
4629
|
import { memo as memo13 } from "react";
|
|
4548
4630
|
import { jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -4807,7 +4889,7 @@ var DropdownComponent = forwardRef7(function Dropdown({
|
|
|
4807
4889
|
Div_default.row,
|
|
4808
4890
|
{
|
|
4809
4891
|
position: "absolute",
|
|
4810
|
-
top: 46 / 2 + (label ? 16 + theme2.styles.gap
|
|
4892
|
+
top: 46 / 2 + (label ? 16 + theme2.styles.gap : 0),
|
|
4811
4893
|
right: theme2.styles.space + 1,
|
|
4812
4894
|
alignItems: "center",
|
|
4813
4895
|
gap: theme2.styles.gap,
|
|
@@ -4850,8 +4932,188 @@ var DropdownComponent = forwardRef7(function Dropdown({
|
|
|
4850
4932
|
var Dropdown2 = memo14(DropdownComponent);
|
|
4851
4933
|
var Dropdown_default = Dropdown2;
|
|
4852
4934
|
|
|
4853
|
-
// src/components/
|
|
4935
|
+
// src/components/Calendar.tsx
|
|
4936
|
+
import { useCallback as useCallback8, useMemo as useMemo4, useState as useState6, memo as memo15, useEffect as useEffect6 } from "react";
|
|
4854
4937
|
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4938
|
+
var getMonthName = (month, short = false) => {
|
|
4939
|
+
return [
|
|
4940
|
+
short ? "Jan" : "January",
|
|
4941
|
+
short ? "Feb" : "February",
|
|
4942
|
+
short ? "Mar" : "March",
|
|
4943
|
+
short ? "Apr" : "April",
|
|
4944
|
+
short ? "May" : "May",
|
|
4945
|
+
short ? "Jun" : "June",
|
|
4946
|
+
short ? "Jul" : "July",
|
|
4947
|
+
short ? "Aug" : "August",
|
|
4948
|
+
short ? "Sep" : "September",
|
|
4949
|
+
short ? "Oct" : "October",
|
|
4950
|
+
short ? "Nov" : "November",
|
|
4951
|
+
short ? "Dec" : "December"
|
|
4952
|
+
][month];
|
|
4953
|
+
};
|
|
4954
|
+
var getWeekDayName = (day, short = false) => {
|
|
4955
|
+
return [
|
|
4956
|
+
short ? "Sun" : "Sunday",
|
|
4957
|
+
short ? "Mon" : "Monday",
|
|
4958
|
+
short ? "Tue" : "Tuesday",
|
|
4959
|
+
short ? "Wed" : "Wednesday",
|
|
4960
|
+
short ? "Thu" : "Thursday",
|
|
4961
|
+
short ? "Fri" : "Friday",
|
|
4962
|
+
short ? "Sat" : "Saturday"
|
|
4963
|
+
][day];
|
|
4964
|
+
};
|
|
4965
|
+
var weekDaysIndex = [1, 2, 3, 4, 5, 6, 0];
|
|
4966
|
+
function Calendar({ value, minDate, maxDate, onChange }) {
|
|
4967
|
+
const theme2 = useTheme();
|
|
4968
|
+
const [currentDate, setCurrentDate] = useState6(value ? new Date(value) : void 0);
|
|
4969
|
+
const [currentMonth, setCurrentMonth] = useState6(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
4970
|
+
const [currentYear, setCurrentYear] = useState6(currentDate?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear());
|
|
4971
|
+
const daysInMonth = useMemo4(() => new Date(currentYear, currentMonth + 1, 0).getDate(), [currentMonth, currentYear]);
|
|
4972
|
+
const onClickPreviousMonthButton = useCallback8(() => {
|
|
4973
|
+
const newMonth = currentMonth === 0 ? 11 : currentMonth - 1;
|
|
4974
|
+
const newYear = currentMonth === 0 ? currentYear - 1 : currentYear;
|
|
4975
|
+
setCurrentMonth(newMonth);
|
|
4976
|
+
setCurrentYear(newYear);
|
|
4977
|
+
}, [currentMonth, currentYear]);
|
|
4978
|
+
const onClickNextMonthButton = useCallback8(() => {
|
|
4979
|
+
const newMonth = currentMonth === 11 ? 0 : currentMonth + 1;
|
|
4980
|
+
const newYear = currentMonth === 11 ? currentYear + 1 : currentYear;
|
|
4981
|
+
setCurrentMonth(newMonth);
|
|
4982
|
+
setCurrentYear(newYear);
|
|
4983
|
+
}, [currentMonth, currentYear]);
|
|
4984
|
+
const onClickDay = useCallback8(
|
|
4985
|
+
(day) => {
|
|
4986
|
+
if (!day) return;
|
|
4987
|
+
const newDate = new Date(currentYear, currentMonth, day);
|
|
4988
|
+
setCurrentDate(newDate);
|
|
4989
|
+
onChange?.(
|
|
4990
|
+
`${newDate.getFullYear()}-${(newDate.getMonth() + 1).toString().padStart(2, "0")}-${newDate.getDate().toString().padStart(2, "0")}`
|
|
4991
|
+
);
|
|
4992
|
+
},
|
|
4993
|
+
[currentMonth, currentYear, onChange]
|
|
4994
|
+
);
|
|
4995
|
+
const onClickClear = useCallback8(() => {
|
|
4996
|
+
setCurrentDate(void 0);
|
|
4997
|
+
onChange?.(void 0);
|
|
4998
|
+
}, []);
|
|
4999
|
+
const onClickToday = useCallback8(() => {
|
|
5000
|
+
const today = /* @__PURE__ */ new Date();
|
|
5001
|
+
setCurrentDate(today);
|
|
5002
|
+
onChange?.(
|
|
5003
|
+
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`
|
|
5004
|
+
);
|
|
5005
|
+
}, [onChange]);
|
|
5006
|
+
const firstDayOfMonth = useMemo4(() => {
|
|
5007
|
+
const day = new Date(currentYear, currentMonth, 1).getDay();
|
|
5008
|
+
return day === 0 ? 6 : day - 1;
|
|
5009
|
+
}, [currentMonth, currentYear]);
|
|
5010
|
+
const days = useMemo4(() => {
|
|
5011
|
+
const result = [];
|
|
5012
|
+
for (let index = 0; index < firstDayOfMonth; index++) {
|
|
5013
|
+
result.push(void 0);
|
|
5014
|
+
}
|
|
5015
|
+
for (let index = 1; index <= daysInMonth; index++) {
|
|
5016
|
+
result.push(index);
|
|
5017
|
+
}
|
|
5018
|
+
return result;
|
|
5019
|
+
}, [daysInMonth, firstDayOfMonth]);
|
|
5020
|
+
useEffect6(() => {
|
|
5021
|
+
if (!value) return;
|
|
5022
|
+
const date = new Date(value);
|
|
5023
|
+
setCurrentDate(date);
|
|
5024
|
+
setCurrentMonth(date.getMonth());
|
|
5025
|
+
setCurrentYear(date.getFullYear());
|
|
5026
|
+
}, [value]);
|
|
5027
|
+
return /* @__PURE__ */ jsxs9(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
|
|
5028
|
+
/* @__PURE__ */ jsxs9(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
5029
|
+
/* @__PURE__ */ jsx14(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
5030
|
+
/* @__PURE__ */ jsxs9(Text_default, { fontWeight: 700, children: [
|
|
5031
|
+
getMonthName(currentMonth),
|
|
5032
|
+
" ",
|
|
5033
|
+
currentYear
|
|
5034
|
+
] }),
|
|
5035
|
+
/* @__PURE__ */ jsx14(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
5036
|
+
] }),
|
|
5037
|
+
/* @__PURE__ */ jsxs9(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
5038
|
+
weekDaysIndex.map((day) => /* @__PURE__ */ jsx14(Div_default.row, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", children: getWeekDayName(day, true) }) }, day)),
|
|
5039
|
+
days.map((day, index) => {
|
|
5040
|
+
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
5041
|
+
const isSelected = day !== void 0 && day === currentDate?.getDate() && currentMonth === currentDate.getMonth() && currentYear === currentDate.getFullYear();
|
|
5042
|
+
const isWeekend = thisDayDate.getDay() === 6 || thisDayDate.getDay() === 0;
|
|
5043
|
+
const isDisabled = minDate && thisDayDate.getTime() < minDate.getTime() || maxDate && thisDayDate.getTime() > maxDate.getTime();
|
|
5044
|
+
return /* @__PURE__ */ jsxs9(
|
|
5045
|
+
Div_default.row,
|
|
5046
|
+
{
|
|
5047
|
+
position: "relative",
|
|
5048
|
+
width: "100%",
|
|
5049
|
+
aspectRatio: "1",
|
|
5050
|
+
alignItems: "center",
|
|
5051
|
+
justifyContent: "center",
|
|
5052
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5053
|
+
filterHover: !isDisabled ? "brightness(0.9)" : void 0,
|
|
5054
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5055
|
+
padding: theme2.styles.space / 2,
|
|
5056
|
+
cursor: day ? !isDisabled ? "pointer" : "not-allowed" : void 0,
|
|
5057
|
+
value: day,
|
|
5058
|
+
onClickWithValue: !isDisabled ? onClickDay : void 0,
|
|
5059
|
+
children: [
|
|
5060
|
+
day && /* @__PURE__ */ jsx14(
|
|
5061
|
+
Text_default,
|
|
5062
|
+
{
|
|
5063
|
+
fontSize: 14,
|
|
5064
|
+
textAlign: "center",
|
|
5065
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : isWeekend ? theme2.colors.textSecondary : void 0,
|
|
5066
|
+
children: day
|
|
5067
|
+
}
|
|
5068
|
+
),
|
|
5069
|
+
isDisabled && /* @__PURE__ */ jsx14(
|
|
5070
|
+
Div_default,
|
|
5071
|
+
{
|
|
5072
|
+
position: "absolute",
|
|
5073
|
+
width: "60%",
|
|
5074
|
+
height: 1,
|
|
5075
|
+
top: "50%",
|
|
5076
|
+
left: "50%",
|
|
5077
|
+
backgroundColor: theme2.colors.textSecondary,
|
|
5078
|
+
borderRadius: 999,
|
|
5079
|
+
transform: "translate(-50%, -50%) rotate(45deg)"
|
|
5080
|
+
}
|
|
5081
|
+
)
|
|
5082
|
+
]
|
|
5083
|
+
},
|
|
5084
|
+
index
|
|
5085
|
+
);
|
|
5086
|
+
})
|
|
5087
|
+
] }),
|
|
5088
|
+
/* @__PURE__ */ jsxs9(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
5089
|
+
/* @__PURE__ */ jsx14(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickClear, children: /* @__PURE__ */ jsx14(
|
|
5090
|
+
Text_default,
|
|
5091
|
+
{
|
|
5092
|
+
fontSize: 14,
|
|
5093
|
+
textDecorationHover: "underline",
|
|
5094
|
+
color: theme2.colors.textSecondary,
|
|
5095
|
+
colorHover: theme2.colors.textPrimary,
|
|
5096
|
+
children: "Clear"
|
|
5097
|
+
}
|
|
5098
|
+
) }),
|
|
5099
|
+
/* @__PURE__ */ jsx14(Div_default, { isTabAccessed: true, cursor: "pointer", onClick: onClickToday, children: /* @__PURE__ */ jsx14(
|
|
5100
|
+
Text_default,
|
|
5101
|
+
{
|
|
5102
|
+
fontSize: 14,
|
|
5103
|
+
textDecorationHover: "underline",
|
|
5104
|
+
color: theme2.colors.textSecondary,
|
|
5105
|
+
colorHover: theme2.colors.textPrimary,
|
|
5106
|
+
children: "Today"
|
|
5107
|
+
}
|
|
5108
|
+
) })
|
|
5109
|
+
] })
|
|
5110
|
+
] });
|
|
5111
|
+
}
|
|
5112
|
+
var Calendar_default = memo15(Calendar);
|
|
5113
|
+
|
|
5114
|
+
// src/components/InputField.tsx
|
|
5115
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5116
|
+
var buttonWidth = 50;
|
|
4855
5117
|
var InputElement = styled8.input.withConfig({
|
|
4856
5118
|
shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
|
|
4857
5119
|
})`
|
|
@@ -4883,11 +5145,20 @@ var InputElement = styled8.input.withConfig({
|
|
|
4883
5145
|
cursor: not-allowed;
|
|
4884
5146
|
}
|
|
4885
5147
|
|
|
4886
|
-
&[type="date"]
|
|
4887
|
-
&[type="datetime-local"]
|
|
4888
|
-
&[type="time"]
|
|
4889
|
-
|
|
5148
|
+
&[type="date"],
|
|
5149
|
+
&[type="datetime-local"],
|
|
5150
|
+
&[type="time"] {
|
|
5151
|
+
// min-height: 46px;
|
|
4890
5152
|
-webkit-appearance: none;
|
|
5153
|
+
|
|
5154
|
+
&::-webkit-calendar-picker-indicator {
|
|
5155
|
+
display: none;
|
|
5156
|
+
-webkit-appearance: none;
|
|
5157
|
+
}
|
|
5158
|
+
|
|
5159
|
+
&::-webkit-date-and-time-value {
|
|
5160
|
+
text-align: left !important;
|
|
5161
|
+
}
|
|
4891
5162
|
}
|
|
4892
5163
|
|
|
4893
5164
|
&.react-better-html-phone-number-holder {
|
|
@@ -4993,7 +5264,7 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
4993
5264
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
4994
5265
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
4995
5266
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
4996
|
-
const onChangeElement =
|
|
5267
|
+
const onChangeElement = useCallback9(
|
|
4997
5268
|
(event) => {
|
|
4998
5269
|
const newValue = event.target.value;
|
|
4999
5270
|
if (withDebounce) {
|
|
@@ -5006,26 +5277,32 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
5006
5277
|
},
|
|
5007
5278
|
[onChange, onChangeValue, withDebounce]
|
|
5008
5279
|
);
|
|
5009
|
-
|
|
5280
|
+
const leftIconZIndex = useMemo5(
|
|
5281
|
+
() => ["react-better-html-dropdown-open-late", "react-better-html-inputField-dateTime-opened-late"].some(
|
|
5282
|
+
(classNameItem) => props.className?.includes(classNameItem)
|
|
5283
|
+
) ? 1002 : 1,
|
|
5284
|
+
[props.className]
|
|
5285
|
+
);
|
|
5286
|
+
useEffect7(() => {
|
|
5010
5287
|
if (!withDebounce) return;
|
|
5011
5288
|
onChangeValue?.(debouncedValue);
|
|
5012
5289
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
5013
|
-
return /* @__PURE__ */
|
|
5014
|
-
label && /* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
leftIcon && /* @__PURE__ */
|
|
5290
|
+
return /* @__PURE__ */ jsxs10(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, ref: holderRef, children: [
|
|
5291
|
+
label && /* @__PURE__ */ jsx15(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
5292
|
+
/* @__PURE__ */ jsxs10(Div_default, { position: "relative", width: "100%", children: [
|
|
5293
|
+
leftIcon && /* @__PURE__ */ jsx15(
|
|
5017
5294
|
Icon_default,
|
|
5018
5295
|
{
|
|
5019
5296
|
name: leftIcon,
|
|
5020
5297
|
position: "absolute",
|
|
5021
|
-
top: 46 / 2,
|
|
5298
|
+
top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
|
|
5022
5299
|
left: theme2.styles.space + 1,
|
|
5023
5300
|
transform: "translateY(-50%)",
|
|
5024
5301
|
pointerEvents: "none",
|
|
5025
|
-
zIndex:
|
|
5302
|
+
zIndex: leftIconZIndex
|
|
5026
5303
|
}
|
|
5027
5304
|
),
|
|
5028
|
-
/* @__PURE__ */
|
|
5305
|
+
/* @__PURE__ */ jsx15(
|
|
5029
5306
|
InputElement,
|
|
5030
5307
|
{
|
|
5031
5308
|
theme: theme2,
|
|
@@ -5041,7 +5318,7 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
5041
5318
|
ref
|
|
5042
5319
|
}
|
|
5043
5320
|
),
|
|
5044
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */
|
|
5321
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ jsx15(
|
|
5045
5322
|
Button_default.icon,
|
|
5046
5323
|
{
|
|
5047
5324
|
icon: rightIcon,
|
|
@@ -5051,7 +5328,7 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
5051
5328
|
transform: "translateY(-50%)",
|
|
5052
5329
|
onClick: onClickRightIcon
|
|
5053
5330
|
}
|
|
5054
|
-
) : /* @__PURE__ */
|
|
5331
|
+
) : /* @__PURE__ */ jsx15(
|
|
5055
5332
|
Icon_default,
|
|
5056
5333
|
{
|
|
5057
5334
|
name: rightIcon,
|
|
@@ -5064,7 +5341,7 @@ var InputFieldComponent = forwardRef8(function InputField({
|
|
|
5064
5341
|
) : void 0,
|
|
5065
5342
|
insideInputFieldComponent
|
|
5066
5343
|
] }),
|
|
5067
|
-
(errorText || infoText) && /* @__PURE__ */
|
|
5344
|
+
(errorText || infoText) && /* @__PURE__ */ jsx15(
|
|
5068
5345
|
Text_default,
|
|
5069
5346
|
{
|
|
5070
5347
|
as: "span",
|
|
@@ -5094,17 +5371,17 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5094
5371
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5095
5372
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5096
5373
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5097
|
-
const onChangeElement =
|
|
5374
|
+
const onChangeElement = useCallback9(
|
|
5098
5375
|
(event) => {
|
|
5099
5376
|
onChange?.(event);
|
|
5100
5377
|
onChangeValue?.(event.target.value);
|
|
5101
5378
|
},
|
|
5102
5379
|
[onChange, onChangeValue]
|
|
5103
5380
|
);
|
|
5104
|
-
return /* @__PURE__ */
|
|
5105
|
-
label && /* @__PURE__ */
|
|
5106
|
-
/* @__PURE__ */
|
|
5107
|
-
leftIcon && /* @__PURE__ */
|
|
5381
|
+
return /* @__PURE__ */ jsxs10(Div_default.column, { gap: theme2.styles.gap, children: [
|
|
5382
|
+
label && /* @__PURE__ */ jsx15(Label_default, { text: label, required, isError: !!errorText }),
|
|
5383
|
+
/* @__PURE__ */ jsxs10(Div_default, { position: "relative", width: "100%", children: [
|
|
5384
|
+
leftIcon && /* @__PURE__ */ jsx15(
|
|
5108
5385
|
Icon_default,
|
|
5109
5386
|
{
|
|
5110
5387
|
name: leftIcon,
|
|
@@ -5115,7 +5392,7 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5115
5392
|
pointerEvents: "none"
|
|
5116
5393
|
}
|
|
5117
5394
|
),
|
|
5118
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsx15(
|
|
5119
5396
|
TextareaElement,
|
|
5120
5397
|
{
|
|
5121
5398
|
theme: theme2,
|
|
@@ -5131,7 +5408,7 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5131
5408
|
ref
|
|
5132
5409
|
}
|
|
5133
5410
|
),
|
|
5134
|
-
rightIcon ? onClickRightIcon ? /* @__PURE__ */
|
|
5411
|
+
rightIcon ? onClickRightIcon ? /* @__PURE__ */ jsx15(
|
|
5135
5412
|
Button_default.icon,
|
|
5136
5413
|
{
|
|
5137
5414
|
icon: rightIcon,
|
|
@@ -5141,7 +5418,7 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5141
5418
|
transform: "translateY(-50%)",
|
|
5142
5419
|
onClick: onClickRightIcon
|
|
5143
5420
|
}
|
|
5144
|
-
) : /* @__PURE__ */
|
|
5421
|
+
) : /* @__PURE__ */ jsx15(
|
|
5145
5422
|
Icon_default,
|
|
5146
5423
|
{
|
|
5147
5424
|
name: rightIcon,
|
|
@@ -5153,7 +5430,7 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5153
5430
|
}
|
|
5154
5431
|
) : void 0
|
|
5155
5432
|
] }),
|
|
5156
|
-
(errorText || infoText) && /* @__PURE__ */
|
|
5433
|
+
(errorText || infoText) && /* @__PURE__ */ jsx15(
|
|
5157
5434
|
Text_default,
|
|
5158
5435
|
{
|
|
5159
5436
|
as: "span",
|
|
@@ -5167,7 +5444,7 @@ InputFieldComponent.multiline = forwardRef8(function Multiline({
|
|
|
5167
5444
|
] });
|
|
5168
5445
|
});
|
|
5169
5446
|
InputFieldComponent.email = forwardRef8(function Email({ ...props }, ref) {
|
|
5170
|
-
return /* @__PURE__ */
|
|
5447
|
+
return /* @__PURE__ */ jsx15(
|
|
5171
5448
|
InputFieldComponent,
|
|
5172
5449
|
{
|
|
5173
5450
|
type: "email",
|
|
@@ -5182,7 +5459,7 @@ InputFieldComponent.email = forwardRef8(function Email({ ...props }, ref) {
|
|
|
5182
5459
|
});
|
|
5183
5460
|
InputFieldComponent.password = forwardRef8(function Password({ ...props }, ref) {
|
|
5184
5461
|
const [isPassword, setIsPassword] = useBooleanState(true);
|
|
5185
|
-
return /* @__PURE__ */
|
|
5462
|
+
return /* @__PURE__ */ jsx15(
|
|
5186
5463
|
InputFieldComponent,
|
|
5187
5464
|
{
|
|
5188
5465
|
type: isPassword ? "password" : "text",
|
|
@@ -5198,20 +5475,20 @@ InputFieldComponent.password = forwardRef8(function Password({ ...props }, ref)
|
|
|
5198
5475
|
);
|
|
5199
5476
|
});
|
|
5200
5477
|
InputFieldComponent.search = forwardRef8(function Search({ ...props }, ref) {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5478
|
+
return /* @__PURE__ */ jsx15(InputFieldComponent, { leftIcon: "magnifyingGlass", placeholder: "Search...", ref, ...props });
|
|
5202
5479
|
});
|
|
5203
5480
|
InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, value, onChangeValue, labelColor, ...props }, ref) {
|
|
5204
5481
|
const theme2 = useTheme();
|
|
5205
|
-
const [dropdownValue, setDropdownValue] =
|
|
5206
|
-
const [inputFieldValue, setInputFieldValue] =
|
|
5207
|
-
const renderOption =
|
|
5208
|
-
(option, index, isSelected) => /* @__PURE__ */
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5482
|
+
const [dropdownValue, setDropdownValue] = useState7();
|
|
5483
|
+
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
5484
|
+
const renderOption = useCallback9(
|
|
5485
|
+
(option, index, isSelected) => /* @__PURE__ */ jsxs10(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5486
|
+
/* @__PURE__ */ jsx15(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5487
|
+
/* @__PURE__ */ jsx15(Text_default, { children: option.label })
|
|
5211
5488
|
] }),
|
|
5212
5489
|
[]
|
|
5213
5490
|
);
|
|
5214
|
-
const onChangeValueElement =
|
|
5491
|
+
const onChangeValueElement = useCallback9(
|
|
5215
5492
|
(value2) => {
|
|
5216
5493
|
const readyValue = value2.replace(/\D/g, "");
|
|
5217
5494
|
setInputFieldValue(readyValue);
|
|
@@ -5219,7 +5496,7 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5219
5496
|
},
|
|
5220
5497
|
[onChangeValue, dropdownValue]
|
|
5221
5498
|
);
|
|
5222
|
-
const options =
|
|
5499
|
+
const options = useMemo5(
|
|
5223
5500
|
() => countries.map((country) => ({
|
|
5224
5501
|
value: country.phoneNumberExtension,
|
|
5225
5502
|
label: `+${country.phoneNumberExtension}`,
|
|
@@ -5227,13 +5504,13 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5227
5504
|
})),
|
|
5228
5505
|
[]
|
|
5229
5506
|
);
|
|
5230
|
-
const defaultValue =
|
|
5507
|
+
const defaultValue = useMemo5(() => {
|
|
5231
5508
|
const thisTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
5232
5509
|
const initialDefaultValue = options.find((option) => option.data?.timeZone === thisTimeZone)?.value ?? "";
|
|
5233
5510
|
setDropdownValue(initialDefaultValue);
|
|
5234
5511
|
return initialDefaultValue;
|
|
5235
5512
|
}, [options]);
|
|
5236
|
-
|
|
5513
|
+
useEffect7(() => {
|
|
5237
5514
|
if (value === void 0 || value === null) return;
|
|
5238
5515
|
const newValue = value.toString();
|
|
5239
5516
|
const country = countries.find(
|
|
@@ -5249,10 +5526,10 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5249
5526
|
setDropdownValue(country.phoneNumberExtension);
|
|
5250
5527
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
5251
5528
|
}, [value]);
|
|
5252
|
-
return /* @__PURE__ */
|
|
5253
|
-
label && /* @__PURE__ */
|
|
5254
|
-
/* @__PURE__ */
|
|
5255
|
-
/* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ jsxs10(Div_default.column, { width: "100%", gap: theme2.styles.gap, children: [
|
|
5530
|
+
label && /* @__PURE__ */ jsx15(Label_default, { text: label, color: labelColor, required: props.required, isError: !!props.errorText }),
|
|
5531
|
+
/* @__PURE__ */ jsxs10(Div_default.row, { children: [
|
|
5532
|
+
/* @__PURE__ */ jsx15(
|
|
5256
5533
|
Dropdown_default,
|
|
5257
5534
|
{
|
|
5258
5535
|
options,
|
|
@@ -5268,7 +5545,7 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5268
5545
|
withoutClearButton: true
|
|
5269
5546
|
}
|
|
5270
5547
|
),
|
|
5271
|
-
/* @__PURE__ */
|
|
5548
|
+
/* @__PURE__ */ jsx15(
|
|
5272
5549
|
InputFieldComponent,
|
|
5273
5550
|
{
|
|
5274
5551
|
placeholder: label ?? "Phone number",
|
|
@@ -5282,31 +5559,38 @@ InputFieldComponent.phoneNumber = forwardRef8(function PhoneNumber({ label, valu
|
|
|
5282
5559
|
] })
|
|
5283
5560
|
] });
|
|
5284
5561
|
});
|
|
5285
|
-
InputFieldComponent.date = forwardRef8(function
|
|
5562
|
+
InputFieldComponent.date = forwardRef8(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
5286
5563
|
const theme2 = useTheme();
|
|
5287
5564
|
const holderRef = useRef4(null);
|
|
5288
|
-
const
|
|
5289
|
-
|
|
5565
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5566
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5567
|
+
const onChange = useCallback9(
|
|
5568
|
+
(date) => {
|
|
5569
|
+
inputFieldProps.onChangeValue?.(date ?? "");
|
|
5570
|
+
setInternalValue(date ?? "");
|
|
5571
|
+
},
|
|
5572
|
+
[inputFieldProps.onChangeValue]
|
|
5573
|
+
);
|
|
5574
|
+
return /* @__PURE__ */ jsx15(
|
|
5290
5575
|
InputFieldComponent,
|
|
5291
5576
|
{
|
|
5292
5577
|
type: "date",
|
|
5293
|
-
insideInputFieldComponent: /* @__PURE__ */
|
|
5578
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ jsx15(
|
|
5294
5579
|
Div_default,
|
|
5295
5580
|
{
|
|
5296
5581
|
position: "absolute",
|
|
5297
5582
|
top: "100%",
|
|
5298
5583
|
left: 0,
|
|
5299
|
-
width: "
|
|
5300
|
-
maxHeight: 300,
|
|
5584
|
+
width: "fit-content",
|
|
5301
5585
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5302
5586
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
5303
5587
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5304
5588
|
boxShadow: "0px 10px 20px #00000020",
|
|
5305
|
-
|
|
5589
|
+
userSelect: "none",
|
|
5306
5590
|
...insideInputFieldComponentProps,
|
|
5307
|
-
children:
|
|
5591
|
+
children: /* @__PURE__ */ jsx15(Calendar_default, { value: internalValue, minDate, maxDate, onChange })
|
|
5308
5592
|
}
|
|
5309
|
-
),
|
|
5593
|
+
) : void 0,
|
|
5310
5594
|
holderRef,
|
|
5311
5595
|
ref,
|
|
5312
5596
|
...props,
|
|
@@ -5314,31 +5598,152 @@ InputFieldComponent.date = forwardRef8(function Date({ className, onFocus, onBlu
|
|
|
5314
5598
|
}
|
|
5315
5599
|
);
|
|
5316
5600
|
});
|
|
5317
|
-
InputFieldComponent.dateTime = forwardRef8(function DateTime({
|
|
5601
|
+
InputFieldComponent.dateTime = forwardRef8(function DateTime({ minDate, maxDate, ...props }, ref) {
|
|
5318
5602
|
const theme2 = useTheme();
|
|
5319
5603
|
const holderRef = useRef4(null);
|
|
5320
|
-
const
|
|
5321
|
-
|
|
5604
|
+
const selectedHourRef = useRef4(null);
|
|
5605
|
+
const selectedMinuteRef = useRef4(null);
|
|
5606
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5607
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5608
|
+
const onChange = useCallback9(
|
|
5609
|
+
(date) => {
|
|
5610
|
+
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? "00:00"}` : "";
|
|
5611
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5612
|
+
setInternalValue(newValue);
|
|
5613
|
+
},
|
|
5614
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5615
|
+
);
|
|
5616
|
+
const onClickHour = useCallback9(
|
|
5617
|
+
(hour) => {
|
|
5618
|
+
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5619
|
+
const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
5620
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
5621
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5622
|
+
setInternalValue(newValue);
|
|
5623
|
+
},
|
|
5624
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5625
|
+
);
|
|
5626
|
+
const onClickMinute = useCallback9(
|
|
5627
|
+
(minute) => {
|
|
5628
|
+
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5629
|
+
const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
5630
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
5631
|
+
console.log(newValue);
|
|
5632
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5633
|
+
setInternalValue(newValue);
|
|
5634
|
+
},
|
|
5635
|
+
[internalValue, inputFieldProps.onChangeValue]
|
|
5636
|
+
);
|
|
5637
|
+
useEffect7(() => {
|
|
5638
|
+
if (isOpen && selectedHourRef.current)
|
|
5639
|
+
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5640
|
+
if (isOpen && selectedMinuteRef.current)
|
|
5641
|
+
selectedMinuteRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5642
|
+
}, [isOpen]);
|
|
5643
|
+
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
5644
|
+
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
5645
|
+
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
5646
|
+
return /* @__PURE__ */ jsx15(
|
|
5322
5647
|
InputFieldComponent,
|
|
5323
5648
|
{
|
|
5324
5649
|
type: "datetime-local",
|
|
5325
|
-
insideInputFieldComponent: /* @__PURE__ */
|
|
5650
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ jsx15(
|
|
5326
5651
|
Div_default,
|
|
5327
5652
|
{
|
|
5328
5653
|
position: "absolute",
|
|
5329
5654
|
top: "100%",
|
|
5330
5655
|
left: 0,
|
|
5331
|
-
width: "
|
|
5332
|
-
maxHeight: 300,
|
|
5656
|
+
width: "fit-content",
|
|
5333
5657
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5334
5658
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
5335
5659
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5336
5660
|
boxShadow: "0px 10px 20px #00000020",
|
|
5337
|
-
|
|
5661
|
+
overflow: "hidden",
|
|
5662
|
+
userSelect: "none",
|
|
5338
5663
|
...insideInputFieldComponentProps,
|
|
5339
|
-
children:
|
|
5664
|
+
children: /* @__PURE__ */ jsxs10(Div_default.row, { gap: theme2.styles.space, children: [
|
|
5665
|
+
/* @__PURE__ */ jsx15(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
5666
|
+
/* @__PURE__ */ jsxs10(
|
|
5667
|
+
Div_default.row,
|
|
5668
|
+
{
|
|
5669
|
+
height: 276,
|
|
5670
|
+
gap: theme2.styles.gap / 2,
|
|
5671
|
+
paddingTop: topSpacing,
|
|
5672
|
+
paddingBottom: theme2.styles.space / 2,
|
|
5673
|
+
paddingRight: theme2.styles.space / 2,
|
|
5674
|
+
children: [
|
|
5675
|
+
/* @__PURE__ */ jsxs10(Div_default, { height: "100%", children: [
|
|
5676
|
+
/* @__PURE__ */ jsx15(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
5677
|
+
/* @__PURE__ */ jsx15(
|
|
5678
|
+
Div_default,
|
|
5679
|
+
{
|
|
5680
|
+
className: "react-better-html-no-scrollbar",
|
|
5681
|
+
width: buttonWidth,
|
|
5682
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5683
|
+
overflowY: "auto",
|
|
5684
|
+
children: hours.map((hour) => {
|
|
5685
|
+
const isSelected = hour.toString() === valueHour;
|
|
5686
|
+
return /* @__PURE__ */ jsx15(
|
|
5687
|
+
Div_default.row,
|
|
5688
|
+
{
|
|
5689
|
+
alignItems: "center",
|
|
5690
|
+
justifyContent: "center",
|
|
5691
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5692
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5693
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5694
|
+
filterHover: "brightness(0.9)",
|
|
5695
|
+
cursor: "pointer",
|
|
5696
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5697
|
+
value: hour,
|
|
5698
|
+
onClickWithValue: onClickHour,
|
|
5699
|
+
ref: isSelected ? selectedHourRef : void 0,
|
|
5700
|
+
children: /* @__PURE__ */ jsx15(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5701
|
+
},
|
|
5702
|
+
hour
|
|
5703
|
+
);
|
|
5704
|
+
})
|
|
5705
|
+
}
|
|
5706
|
+
)
|
|
5707
|
+
] }),
|
|
5708
|
+
/* @__PURE__ */ jsxs10(Div_default, { height: "100%", children: [
|
|
5709
|
+
/* @__PURE__ */ jsx15(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
5710
|
+
/* @__PURE__ */ jsx15(
|
|
5711
|
+
Div_default,
|
|
5712
|
+
{
|
|
5713
|
+
className: "react-better-html-no-scrollbar",
|
|
5714
|
+
width: buttonWidth,
|
|
5715
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5716
|
+
overflowY: "auto",
|
|
5717
|
+
children: minutes.map((minute) => {
|
|
5718
|
+
const isSelected = minute.toString() === valueMinute;
|
|
5719
|
+
return /* @__PURE__ */ jsx15(
|
|
5720
|
+
Div_default.row,
|
|
5721
|
+
{
|
|
5722
|
+
alignItems: "center",
|
|
5723
|
+
justifyContent: "center",
|
|
5724
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5725
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5726
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5727
|
+
filterHover: "brightness(0.9)",
|
|
5728
|
+
cursor: "pointer",
|
|
5729
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5730
|
+
value: minute,
|
|
5731
|
+
onClickWithValue: onClickMinute,
|
|
5732
|
+
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5733
|
+
children: /* @__PURE__ */ jsx15(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5734
|
+
},
|
|
5735
|
+
minute
|
|
5736
|
+
);
|
|
5737
|
+
})
|
|
5738
|
+
}
|
|
5739
|
+
)
|
|
5740
|
+
] })
|
|
5741
|
+
]
|
|
5742
|
+
}
|
|
5743
|
+
)
|
|
5744
|
+
] })
|
|
5340
5745
|
}
|
|
5341
|
-
),
|
|
5746
|
+
) : void 0,
|
|
5342
5747
|
holderRef,
|
|
5343
5748
|
ref,
|
|
5344
5749
|
...props,
|
|
@@ -5351,8 +5756,9 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5351
5756
|
const holderRef = useRef4(null);
|
|
5352
5757
|
const selectedHourRef = useRef4(null);
|
|
5353
5758
|
const selectedMinuteRef = useRef4(null);
|
|
5354
|
-
const
|
|
5355
|
-
const
|
|
5759
|
+
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5760
|
+
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5761
|
+
const onClickHour = useCallback9(
|
|
5356
5762
|
(hour) => {
|
|
5357
5763
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5358
5764
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -5360,7 +5766,7 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5360
5766
|
},
|
|
5361
5767
|
[internalValue, inputFieldProps.onChangeValue]
|
|
5362
5768
|
);
|
|
5363
|
-
const onClickMinute =
|
|
5769
|
+
const onClickMinute = useCallback9(
|
|
5364
5770
|
(minute) => {
|
|
5365
5771
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5366
5772
|
inputFieldProps.onChangeValue?.(value);
|
|
@@ -5368,7 +5774,7 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5368
5774
|
},
|
|
5369
5775
|
[internalValue, inputFieldProps.onChangeValue]
|
|
5370
5776
|
);
|
|
5371
|
-
|
|
5777
|
+
useEffect7(() => {
|
|
5372
5778
|
if (isOpen && selectedHourRef.current)
|
|
5373
5779
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
5374
5780
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -5376,12 +5782,11 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5376
5782
|
}, [isOpen]);
|
|
5377
5783
|
const valueHour = parseInt(internalValue?.toString().split(":")?.[0]).toString();
|
|
5378
5784
|
const valueMinute = parseInt(internalValue?.toString().split(":")?.[1]).toString();
|
|
5379
|
-
|
|
5380
|
-
return /* @__PURE__ */ jsx14(
|
|
5785
|
+
return /* @__PURE__ */ jsx15(
|
|
5381
5786
|
InputFieldComponent,
|
|
5382
5787
|
{
|
|
5383
5788
|
type: "time",
|
|
5384
|
-
insideInputFieldComponent: /* @__PURE__ */
|
|
5789
|
+
insideInputFieldComponent: !isMobileIOS ? /* @__PURE__ */ jsx15(
|
|
5385
5790
|
Div_default,
|
|
5386
5791
|
{
|
|
5387
5792
|
position: "absolute",
|
|
@@ -5394,11 +5799,12 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5394
5799
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
5395
5800
|
boxShadow: "0px 10px 20px #00000020",
|
|
5396
5801
|
overflowY: "auto",
|
|
5802
|
+
userSelect: "none",
|
|
5397
5803
|
...insideInputFieldComponentProps,
|
|
5398
|
-
children: /* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5804
|
+
children: /* @__PURE__ */ jsxs10(Div_default.row, { height: "100%", children: [
|
|
5805
|
+
/* @__PURE__ */ jsx15(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: hours.map((hour) => {
|
|
5400
5806
|
const isSelected = hour.toString() === valueHour;
|
|
5401
|
-
return /* @__PURE__ */
|
|
5807
|
+
return /* @__PURE__ */ jsx15(
|
|
5402
5808
|
Div_default.row,
|
|
5403
5809
|
{
|
|
5404
5810
|
alignItems: "center",
|
|
@@ -5411,14 +5817,14 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5411
5817
|
value: hour,
|
|
5412
5818
|
onClickWithValue: onClickHour,
|
|
5413
5819
|
ref: isSelected ? selectedHourRef : void 0,
|
|
5414
|
-
children: /* @__PURE__ */
|
|
5820
|
+
children: /* @__PURE__ */ jsx15(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5415
5821
|
},
|
|
5416
5822
|
hour
|
|
5417
5823
|
);
|
|
5418
5824
|
}) }),
|
|
5419
|
-
/* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx15(Div_default, { className: "react-better-html-no-scrollbar", width: buttonWidth, height: "100%", overflowY: "auto", children: minutes.map((minute) => {
|
|
5420
5826
|
const isSelected = minute.toString() === valueMinute;
|
|
5421
|
-
return /* @__PURE__ */
|
|
5827
|
+
return /* @__PURE__ */ jsx15(
|
|
5422
5828
|
Div_default.row,
|
|
5423
5829
|
{
|
|
5424
5830
|
alignItems: "center",
|
|
@@ -5431,14 +5837,14 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5431
5837
|
value: minute,
|
|
5432
5838
|
onClickWithValue: onClickMinute,
|
|
5433
5839
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5434
|
-
children: /* @__PURE__ */
|
|
5840
|
+
children: /* @__PURE__ */ jsx15(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5435
5841
|
},
|
|
5436
5842
|
minute
|
|
5437
5843
|
);
|
|
5438
5844
|
}) })
|
|
5439
5845
|
] })
|
|
5440
5846
|
}
|
|
5441
|
-
),
|
|
5847
|
+
) : void 0,
|
|
5442
5848
|
holderRef,
|
|
5443
5849
|
ref,
|
|
5444
5850
|
...props,
|
|
@@ -5447,7 +5853,7 @@ InputFieldComponent.time = forwardRef8(function Time({ ...props }, ref) {
|
|
|
5447
5853
|
}
|
|
5448
5854
|
);
|
|
5449
5855
|
});
|
|
5450
|
-
var InputField2 =
|
|
5856
|
+
var InputField2 = memo16(InputFieldComponent);
|
|
5451
5857
|
InputField2.multiline = InputFieldComponent.multiline;
|
|
5452
5858
|
InputField2.email = InputFieldComponent.email;
|
|
5453
5859
|
InputField2.password = InputFieldComponent.password;
|
|
@@ -5459,9 +5865,9 @@ InputField2.time = InputFieldComponent.time;
|
|
|
5459
5865
|
var InputField_default = InputField2;
|
|
5460
5866
|
|
|
5461
5867
|
// src/components/ToggleInput.tsx
|
|
5462
|
-
import { forwardRef as forwardRef9, useCallback as
|
|
5868
|
+
import { forwardRef as forwardRef9, useCallback as useCallback10, useState as useState8 } from "react";
|
|
5463
5869
|
import styled9 from "styled-components";
|
|
5464
|
-
import { jsx as
|
|
5870
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5465
5871
|
var componentSize = 26;
|
|
5466
5872
|
var switchComponentBallGap = 3;
|
|
5467
5873
|
var switchComponentMouseDownDifference = 4;
|
|
@@ -5571,8 +5977,8 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
5571
5977
|
const dataProps = useComponentPropsWithPrefix(props, "data");
|
|
5572
5978
|
const ariaProps = useComponentPropsWithPrefix(props, "aria");
|
|
5573
5979
|
const restProps = useComponentPropsWithoutStyle(props);
|
|
5574
|
-
const [internalChecked, setInternalChecked] =
|
|
5575
|
-
const onChangeElement =
|
|
5980
|
+
const [internalChecked, setInternalChecked] = useState8(false);
|
|
5981
|
+
const onChangeElement = useCallback10(
|
|
5576
5982
|
(event) => {
|
|
5577
5983
|
const newIsChecked = event.target.checked;
|
|
5578
5984
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
@@ -5581,16 +5987,16 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
5581
5987
|
[onChange, controlledChecked, value]
|
|
5582
5988
|
);
|
|
5583
5989
|
const checked = controlledChecked ?? internalChecked;
|
|
5584
|
-
const onClickText =
|
|
5990
|
+
const onClickText = useCallback10(() => {
|
|
5585
5991
|
const newIsChecked = !checked;
|
|
5586
5992
|
if (controlledChecked === void 0) setInternalChecked(newIsChecked);
|
|
5587
5993
|
onChange?.(newIsChecked, value);
|
|
5588
5994
|
}, [checked, controlledChecked, onChange, value]);
|
|
5589
|
-
return /* @__PURE__ */
|
|
5590
|
-
label && /* @__PURE__ */
|
|
5591
|
-
/* @__PURE__ */
|
|
5592
|
-
/* @__PURE__ */
|
|
5593
|
-
/* @__PURE__ */
|
|
5995
|
+
return /* @__PURE__ */ jsxs11(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
5996
|
+
label && /* @__PURE__ */ jsx16(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
5997
|
+
/* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5998
|
+
/* @__PURE__ */ jsxs11(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5999
|
+
/* @__PURE__ */ jsx16(
|
|
5594
6000
|
InputElement2,
|
|
5595
6001
|
{
|
|
5596
6002
|
theme: theme2,
|
|
@@ -5603,7 +6009,7 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
5603
6009
|
...restProps
|
|
5604
6010
|
}
|
|
5605
6011
|
),
|
|
5606
|
-
props.type === "checkbox" ? /* @__PURE__ */
|
|
6012
|
+
props.type === "checkbox" ? /* @__PURE__ */ jsx16(
|
|
5607
6013
|
Icon_default,
|
|
5608
6014
|
{
|
|
5609
6015
|
name: "check",
|
|
@@ -5617,7 +6023,7 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
5617
6023
|
pointerEvents: "none",
|
|
5618
6024
|
transition: theme2.styles.transition
|
|
5619
6025
|
}
|
|
5620
|
-
) : props.type === "radio" ? /* @__PURE__ */
|
|
6026
|
+
) : props.type === "radio" ? /* @__PURE__ */ jsx16(
|
|
5621
6027
|
Div_default,
|
|
5622
6028
|
{
|
|
5623
6029
|
position: "absolute",
|
|
@@ -5633,15 +6039,15 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
5633
6039
|
}
|
|
5634
6040
|
) : void 0
|
|
5635
6041
|
] }),
|
|
5636
|
-
text && /* @__PURE__ */
|
|
6042
|
+
text && /* @__PURE__ */ jsxs11(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5637
6043
|
text,
|
|
5638
|
-
required && !label && /* @__PURE__ */
|
|
6044
|
+
required && !label && /* @__PURE__ */ jsxs11(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5639
6045
|
" ",
|
|
5640
6046
|
"*"
|
|
5641
6047
|
] })
|
|
5642
6048
|
] })
|
|
5643
6049
|
] }),
|
|
5644
|
-
(errorText || infoText) && /* @__PURE__ */
|
|
6050
|
+
(errorText || infoText) && /* @__PURE__ */ jsx16(
|
|
5645
6051
|
Text_default,
|
|
5646
6052
|
{
|
|
5647
6053
|
as: "span",
|
|
@@ -5655,10 +6061,10 @@ var ToggleInputComponent = forwardRef9(function ToggleInput({
|
|
|
5655
6061
|
});
|
|
5656
6062
|
var ToggleInput_default = {
|
|
5657
6063
|
checkbox: forwardRef9(function Checkbox(props, ref) {
|
|
5658
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ jsx16(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5659
6065
|
}),
|
|
5660
6066
|
radiobutton: forwardRef9(function RadioButton(props, ref) {
|
|
5661
|
-
return /* @__PURE__ */
|
|
6067
|
+
return /* @__PURE__ */ jsx16(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5662
6068
|
}),
|
|
5663
6069
|
switch: forwardRef9(function Switch({
|
|
5664
6070
|
label,
|
|
@@ -5681,15 +6087,15 @@ var ToggleInput_default = {
|
|
|
5681
6087
|
const [internalChecked, setInternalChecked] = useBooleanState();
|
|
5682
6088
|
const [isMouseDown, setIsMouseDown] = useBooleanState();
|
|
5683
6089
|
const checked = controlledChecked ?? internalChecked;
|
|
5684
|
-
const onClickElement =
|
|
6090
|
+
const onClickElement = useCallback10(() => {
|
|
5685
6091
|
if (disabled) return;
|
|
5686
6092
|
const newIsChecked = !checked;
|
|
5687
6093
|
if (controlledChecked === void 0) setInternalChecked.setState(newIsChecked);
|
|
5688
6094
|
onChange?.(newIsChecked, value);
|
|
5689
6095
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5690
|
-
return /* @__PURE__ */
|
|
5691
|
-
label && /* @__PURE__ */
|
|
5692
|
-
/* @__PURE__ */
|
|
6096
|
+
return /* @__PURE__ */ jsxs11(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
6097
|
+
label && /* @__PURE__ */ jsx16(Label_default, { text: label, color: labelColor, required, isError: !!errorText }),
|
|
6098
|
+
/* @__PURE__ */ jsx16(
|
|
5693
6099
|
Div_default.row,
|
|
5694
6100
|
{
|
|
5695
6101
|
alignItems: "center",
|
|
@@ -5700,7 +6106,7 @@ var ToggleInput_default = {
|
|
|
5700
6106
|
onTouchStart: setIsMouseDown.setTrue,
|
|
5701
6107
|
onTouchEnd: setIsMouseDown.setFalse,
|
|
5702
6108
|
onTouchCancel: setIsMouseDown.setFalse,
|
|
5703
|
-
children: /* @__PURE__ */
|
|
6109
|
+
children: /* @__PURE__ */ jsx16(
|
|
5704
6110
|
SwitchElement,
|
|
5705
6111
|
{
|
|
5706
6112
|
theme: theme2,
|
|
@@ -5716,7 +6122,7 @@ var ToggleInput_default = {
|
|
|
5716
6122
|
)
|
|
5717
6123
|
}
|
|
5718
6124
|
),
|
|
5719
|
-
(errorText || infoText) && /* @__PURE__ */
|
|
6125
|
+
(errorText || infoText) && /* @__PURE__ */ jsx16(
|
|
5720
6126
|
Text_default,
|
|
5721
6127
|
{
|
|
5722
6128
|
as: "span",
|
|
@@ -5731,8 +6137,8 @@ var ToggleInput_default = {
|
|
|
5731
6137
|
};
|
|
5732
6138
|
|
|
5733
6139
|
// src/components/Form.tsx
|
|
5734
|
-
import { memo as
|
|
5735
|
-
import { jsx as
|
|
6140
|
+
import { memo as memo17, useMemo as useMemo6 } from "react";
|
|
6141
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5736
6142
|
function Form({
|
|
5737
6143
|
form,
|
|
5738
6144
|
submitButtonText,
|
|
@@ -5749,7 +6155,7 @@ function Form({
|
|
|
5749
6155
|
...props
|
|
5750
6156
|
}) {
|
|
5751
6157
|
const theme2 = useTheme();
|
|
5752
|
-
const submitButtonIsDisabledInternal =
|
|
6158
|
+
const submitButtonIsDisabledInternal = useMemo6(() => {
|
|
5753
6159
|
if (!form || !form.requiredFields) return false;
|
|
5754
6160
|
return Object.entries(form.values).some(
|
|
5755
6161
|
([key, value]) => form.requiredFields?.includes(key) && (value === void 0 || value === null || value?.toString().trim() === "")
|
|
@@ -5757,9 +6163,9 @@ function Form({
|
|
|
5757
6163
|
}, [form]);
|
|
5758
6164
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
5759
6165
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
5760
|
-
return /* @__PURE__ */
|
|
5761
|
-
gap !== void 0 ? /* @__PURE__ */
|
|
5762
|
-
submitButtonText && /* @__PURE__ */
|
|
6166
|
+
return /* @__PURE__ */ jsx17(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ jsxs12("form", { onSubmit: onSubmit ?? form?.onSubmit, children: [
|
|
6167
|
+
gap !== void 0 ? /* @__PURE__ */ jsx17(Div_default.column, { gap, children }) : children,
|
|
6168
|
+
submitButtonText && /* @__PURE__ */ jsxs12(
|
|
5763
6169
|
Div_default.row,
|
|
5764
6170
|
{
|
|
5765
6171
|
alignItems: "center",
|
|
@@ -5767,8 +6173,8 @@ function Form({
|
|
|
5767
6173
|
gap: theme2.styles.gap,
|
|
5768
6174
|
marginTop: theme2.styles.space,
|
|
5769
6175
|
children: [
|
|
5770
|
-
onClickCancel && /* @__PURE__ */
|
|
5771
|
-
/* @__PURE__ */
|
|
6176
|
+
onClickCancel && /* @__PURE__ */ jsx17(Button_default.secondary, { text: "Cancel", onClick: onClickCancel }),
|
|
6177
|
+
/* @__PURE__ */ jsx17(
|
|
5772
6178
|
SubmitButtonTag,
|
|
5773
6179
|
{
|
|
5774
6180
|
text: submitButtonText,
|
|
@@ -5784,19 +6190,19 @@ function Form({
|
|
|
5784
6190
|
)
|
|
5785
6191
|
] }) });
|
|
5786
6192
|
}
|
|
5787
|
-
var Form_default =
|
|
6193
|
+
var Form_default = memo17(Form);
|
|
5788
6194
|
|
|
5789
6195
|
// src/components/FormRow.tsx
|
|
5790
|
-
import { forwardRef as forwardRef10, memo as
|
|
5791
|
-
import { jsx as
|
|
6196
|
+
import { forwardRef as forwardRef10, memo as memo18 } from "react";
|
|
6197
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5792
6198
|
var FormRowComponent = forwardRef10(function FormRow({ oneItemOnly, noBreakingPoint, gap, children, ...props }, ref) {
|
|
5793
6199
|
const theme2 = useTheme();
|
|
5794
6200
|
const mediaQuery = useMediaQuery();
|
|
5795
6201
|
const breakingPoint = !noBreakingPoint ? mediaQuery.size900 : false;
|
|
5796
6202
|
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
5797
|
-
return /* @__PURE__ */
|
|
6203
|
+
return /* @__PURE__ */ jsxs13(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
5798
6204
|
children,
|
|
5799
|
-
oneItemOnly && /* @__PURE__ */
|
|
6205
|
+
oneItemOnly && /* @__PURE__ */ jsx18(Div_default, { width: "100%" })
|
|
5800
6206
|
] });
|
|
5801
6207
|
});
|
|
5802
6208
|
FormRowComponent.withTitle = forwardRef10(function WithTitle({
|
|
@@ -5813,15 +6219,15 @@ FormRowComponent.withTitle = forwardRef10(function WithTitle({
|
|
|
5813
6219
|
}, ref) {
|
|
5814
6220
|
const theme2 = useTheme();
|
|
5815
6221
|
const mediaQuery = useMediaQuery();
|
|
5816
|
-
return /* @__PURE__ */
|
|
5817
|
-
/* @__PURE__ */
|
|
5818
|
-
icon && /* @__PURE__ */
|
|
5819
|
-
/* @__PURE__ */
|
|
5820
|
-
/* @__PURE__ */
|
|
5821
|
-
description && /* @__PURE__ */
|
|
6222
|
+
return /* @__PURE__ */ jsxs13(FormRowComponent, { ...props, ref, children: [
|
|
6223
|
+
/* @__PURE__ */ jsxs13(Div_default.row, { width: "100%", alignItems: "center", gap: theme2.styles.space, children: [
|
|
6224
|
+
icon && /* @__PURE__ */ jsx18(Icon_default, { name: icon }),
|
|
6225
|
+
/* @__PURE__ */ jsxs13(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6226
|
+
/* @__PURE__ */ jsx18(Text_default, { as: "h3", children: title }),
|
|
6227
|
+
description && /* @__PURE__ */ jsx18(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
5822
6228
|
] })
|
|
5823
6229
|
] }),
|
|
5824
|
-
/* @__PURE__ */
|
|
6230
|
+
/* @__PURE__ */ jsxs13(
|
|
5825
6231
|
Div_default.row,
|
|
5826
6232
|
{
|
|
5827
6233
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
@@ -5829,22 +6235,22 @@ FormRowComponent.withTitle = forwardRef10(function WithTitle({
|
|
|
5829
6235
|
gap: theme2.styles.gap,
|
|
5830
6236
|
children: [
|
|
5831
6237
|
children,
|
|
5832
|
-
withActions && /* @__PURE__ */
|
|
5833
|
-
onClickReset && /* @__PURE__ */
|
|
5834
|
-
/* @__PURE__ */
|
|
6238
|
+
withActions && /* @__PURE__ */ jsxs13(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6239
|
+
onClickReset && /* @__PURE__ */ jsx18(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
6240
|
+
/* @__PURE__ */ jsx18(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
5835
6241
|
] })
|
|
5836
6242
|
]
|
|
5837
6243
|
}
|
|
5838
6244
|
)
|
|
5839
6245
|
] });
|
|
5840
6246
|
});
|
|
5841
|
-
var FormRow2 =
|
|
6247
|
+
var FormRow2 = memo18(FormRowComponent);
|
|
5842
6248
|
FormRow2.withTitle = FormRowComponent.withTitle;
|
|
5843
6249
|
var FormRow_default = FormRow2;
|
|
5844
6250
|
|
|
5845
6251
|
// src/components/ColorThemeSwitch.tsx
|
|
5846
|
-
import { memo as
|
|
5847
|
-
import { jsx as
|
|
6252
|
+
import { memo as memo19, useEffect as useEffect8 } from "react";
|
|
6253
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5848
6254
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
5849
6255
|
withMoon,
|
|
5850
6256
|
className,
|
|
@@ -5855,7 +6261,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5855
6261
|
darkMode: localStorage.getItem("theme") === "dark"
|
|
5856
6262
|
}
|
|
5857
6263
|
});
|
|
5858
|
-
|
|
6264
|
+
useEffect8(() => {
|
|
5859
6265
|
const timeout = setTimeout(() => {
|
|
5860
6266
|
window.document.body.parentElement?.setAttribute("data-theme", form.values.darkMode ? "dark" : "light");
|
|
5861
6267
|
localStorage.setItem("theme", form.values.darkMode ? "dark" : "light");
|
|
@@ -5864,7 +6270,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5864
6270
|
clearTimeout(timeout);
|
|
5865
6271
|
};
|
|
5866
6272
|
}, [form.values.darkMode]);
|
|
5867
|
-
|
|
6273
|
+
useEffect8(() => {
|
|
5868
6274
|
const html = document.querySelector("html");
|
|
5869
6275
|
if (!html) return;
|
|
5870
6276
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -5881,7 +6287,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5881
6287
|
observer.disconnect();
|
|
5882
6288
|
};
|
|
5883
6289
|
}, []);
|
|
5884
|
-
return /* @__PURE__ */
|
|
6290
|
+
return /* @__PURE__ */ jsx19(
|
|
5885
6291
|
ToggleInput_default.switch,
|
|
5886
6292
|
{
|
|
5887
6293
|
className: `react-better-html-color-theme-switch ${withMoon ? ` react-better-html-color-theme-switch-with-moon` : ""}${className ? ` ${className}` : ""}`,
|
|
@@ -5892,20 +6298,20 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5892
6298
|
};
|
|
5893
6299
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
5894
6300
|
const theme2 = useTheme();
|
|
5895
|
-
return /* @__PURE__ */
|
|
5896
|
-
/* @__PURE__ */
|
|
5897
|
-
/* @__PURE__ */
|
|
5898
|
-
/* @__PURE__ */
|
|
6301
|
+
return /* @__PURE__ */ jsxs14(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
6302
|
+
/* @__PURE__ */ jsx19(Text_default, { children: "Light" }),
|
|
6303
|
+
/* @__PURE__ */ jsx19(ColorThemeSwitchComponent, { withMoon, className }),
|
|
6304
|
+
/* @__PURE__ */ jsx19(Text_default, { children: "Dark" })
|
|
5899
6305
|
] });
|
|
5900
6306
|
};
|
|
5901
|
-
var ColorThemeSwitch2 =
|
|
6307
|
+
var ColorThemeSwitch2 = memo19(ColorThemeSwitchComponent);
|
|
5902
6308
|
ColorThemeSwitch2.withText = ColorThemeSwitchComponent.withText;
|
|
5903
6309
|
var ColorThemeSwitch_default = ColorThemeSwitch2;
|
|
5904
6310
|
|
|
5905
6311
|
// src/components/Table.tsx
|
|
5906
|
-
import { forwardRef as forwardRef11, memo as
|
|
6312
|
+
import { forwardRef as forwardRef11, memo as memo20, useCallback as useCallback11, useMemo as useMemo7, useState as useState9 } from "react";
|
|
5907
6313
|
import styled10, { css as css2 } from "styled-components";
|
|
5908
|
-
import { Fragment as Fragment3, jsx as
|
|
6314
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5909
6315
|
var defaultImageWidth = 120;
|
|
5910
6316
|
var TableStyledComponent = styled10.table.withConfig({
|
|
5911
6317
|
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
|
|
@@ -5983,8 +6389,8 @@ var TableComponent = forwardRef11(function Table({
|
|
|
5983
6389
|
}, ref) {
|
|
5984
6390
|
const { colorTheme } = useBetterHtmlContext();
|
|
5985
6391
|
const theme2 = useTheme();
|
|
5986
|
-
const [checkedItems, setCheckedItems] =
|
|
5987
|
-
const renderCellContent =
|
|
6392
|
+
const [checkedItems, setCheckedItems] = useState9([]);
|
|
6393
|
+
const renderCellContent = useCallback11(
|
|
5988
6394
|
(column, item, index) => {
|
|
5989
6395
|
switch (column.type) {
|
|
5990
6396
|
case "text": {
|
|
@@ -5992,17 +6398,17 @@ var TableComponent = forwardRef11(function Table({
|
|
|
5992
6398
|
return column.format ? column.format(item, index) : String(value ?? "");
|
|
5993
6399
|
}
|
|
5994
6400
|
case "element": {
|
|
5995
|
-
return column.render?.(item, index) ?? /* @__PURE__ */
|
|
6401
|
+
return column.render?.(item, index) ?? /* @__PURE__ */ jsx20(Fragment3, {});
|
|
5996
6402
|
}
|
|
5997
6403
|
case "image": {
|
|
5998
6404
|
const { type, keyName, ...props2 } = column;
|
|
5999
6405
|
const src = keyName ? item[keyName] : void 0;
|
|
6000
|
-
return /* @__PURE__ */
|
|
6406
|
+
return /* @__PURE__ */ jsx20(Image_default, { src, width: defaultImageWidth, borderRadius: theme2.styles.borderRadius / 2, ...props2 });
|
|
6001
6407
|
}
|
|
6002
6408
|
case "checkbox": {
|
|
6003
6409
|
const { type, onChange, ...props2 } = column;
|
|
6004
6410
|
const checkedValue = checkedItems[index];
|
|
6005
|
-
return /* @__PURE__ */
|
|
6411
|
+
return /* @__PURE__ */ jsx20(
|
|
6006
6412
|
ToggleInput_default.checkbox,
|
|
6007
6413
|
{
|
|
6008
6414
|
checked: checkedValue,
|
|
@@ -6017,29 +6423,29 @@ var TableComponent = forwardRef11(function Table({
|
|
|
6017
6423
|
);
|
|
6018
6424
|
}
|
|
6019
6425
|
default: {
|
|
6020
|
-
return /* @__PURE__ */
|
|
6426
|
+
return /* @__PURE__ */ jsx20(Fragment3, {});
|
|
6021
6427
|
}
|
|
6022
6428
|
}
|
|
6023
6429
|
},
|
|
6024
6430
|
[theme2, checkedItems]
|
|
6025
6431
|
);
|
|
6026
|
-
const onClickRowElement =
|
|
6432
|
+
const onClickRowElement = useCallback11(
|
|
6027
6433
|
(item, index) => {
|
|
6028
6434
|
onClickRow?.(item, index);
|
|
6029
6435
|
},
|
|
6030
6436
|
[onClickRow]
|
|
6031
6437
|
);
|
|
6032
|
-
const onClickAllCheckboxesElement =
|
|
6438
|
+
const onClickAllCheckboxesElement = useCallback11(
|
|
6033
6439
|
(checked) => {
|
|
6034
6440
|
onClickAllCheckboxes?.(checked);
|
|
6035
6441
|
setCheckedItems(data.map(() => checked));
|
|
6036
6442
|
},
|
|
6037
6443
|
[onClickAllCheckboxes, data]
|
|
6038
6444
|
);
|
|
6039
|
-
const everythingIsChecked =
|
|
6445
|
+
const everythingIsChecked = useMemo7(() => {
|
|
6040
6446
|
return checkedItems.every((checked) => checked) && checkedItems.length === data.length;
|
|
6041
6447
|
}, [data, checkedItems]);
|
|
6042
|
-
return /* @__PURE__ */
|
|
6448
|
+
return /* @__PURE__ */ jsx20(
|
|
6043
6449
|
Div_default,
|
|
6044
6450
|
{
|
|
6045
6451
|
border: `1px solid ${theme2.colors.border}`,
|
|
@@ -6047,7 +6453,7 @@ var TableComponent = forwardRef11(function Table({
|
|
|
6047
6453
|
overflow: "auto",
|
|
6048
6454
|
...props,
|
|
6049
6455
|
ref,
|
|
6050
|
-
children: /* @__PURE__ */
|
|
6456
|
+
children: /* @__PURE__ */ jsxs15(
|
|
6051
6457
|
TableStyledComponent,
|
|
6052
6458
|
{
|
|
6053
6459
|
isStriped,
|
|
@@ -6056,14 +6462,14 @@ var TableComponent = forwardRef11(function Table({
|
|
|
6056
6462
|
colorTheme,
|
|
6057
6463
|
theme: theme2,
|
|
6058
6464
|
children: [
|
|
6059
|
-
/* @__PURE__ */
|
|
6465
|
+
/* @__PURE__ */ jsx20("thead", { children: /* @__PURE__ */ jsx20("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ jsx20(
|
|
6060
6466
|
ThStyledComponent,
|
|
6061
6467
|
{
|
|
6062
6468
|
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
6063
6469
|
minWidth: column.minWidth,
|
|
6064
6470
|
maxWidth: column.maxWidth,
|
|
6065
6471
|
textAlign: column.align,
|
|
6066
|
-
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */
|
|
6472
|
+
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ jsx20(
|
|
6067
6473
|
ToggleInput_default.checkbox,
|
|
6068
6474
|
{
|
|
6069
6475
|
checked: everythingIsChecked,
|
|
@@ -6073,86 +6479,24 @@ var TableComponent = forwardRef11(function Table({
|
|
|
6073
6479
|
},
|
|
6074
6480
|
column.type + column.label + index
|
|
6075
6481
|
)) }) }),
|
|
6076
|
-
/* @__PURE__ */
|
|
6482
|
+
/* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ jsx20(
|
|
6077
6483
|
"tr",
|
|
6078
6484
|
{
|
|
6079
6485
|
className: onClickRow ? "isClickable" : void 0,
|
|
6080
6486
|
onClick: () => onClickRowElement(item, rowIndex),
|
|
6081
|
-
children: columns.map((column, colIndex) => /* @__PURE__ */
|
|
6487
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
|
|
6082
6488
|
},
|
|
6083
6489
|
JSON.stringify(item) + rowIndex
|
|
6084
|
-
)) : /* @__PURE__ */
|
|
6490
|
+
)) : /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) })
|
|
6085
6491
|
]
|
|
6086
6492
|
}
|
|
6087
6493
|
)
|
|
6088
6494
|
}
|
|
6089
6495
|
);
|
|
6090
6496
|
});
|
|
6091
|
-
var Table2 =
|
|
6497
|
+
var Table2 = memo20(TableComponent);
|
|
6092
6498
|
var Table_default = Table2;
|
|
6093
6499
|
|
|
6094
|
-
// src/utils/functions.ts
|
|
6095
|
-
var generateRandomString = (stringLength, options) => {
|
|
6096
|
-
const capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
6097
|
-
const lowers = "abcdefghijklmnopqrstuvwxyz";
|
|
6098
|
-
const numbers = "0123456789";
|
|
6099
|
-
const includes = [];
|
|
6100
|
-
if (options?.includeCapitalLetters !== false) includes.push(capitals);
|
|
6101
|
-
if (options?.includeLowerLetters !== false) includes.push(lowers);
|
|
6102
|
-
if (options?.includeNumbers !== false) includes.push(numbers);
|
|
6103
|
-
const characters = includes.join("");
|
|
6104
|
-
const dashSections = Math.max(1, options?.dashSections ?? 1);
|
|
6105
|
-
const dashSectionLength = Math.floor(stringLength / dashSections);
|
|
6106
|
-
if (stringLength < dashSections) return "";
|
|
6107
|
-
let result = "";
|
|
6108
|
-
let currentSectionLength = 0;
|
|
6109
|
-
while (result.length < stringLength) {
|
|
6110
|
-
if (currentSectionLength >= dashSectionLength) {
|
|
6111
|
-
result += "-";
|
|
6112
|
-
currentSectionLength = 0;
|
|
6113
|
-
}
|
|
6114
|
-
if (result.length < stringLength) {
|
|
6115
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
6116
|
-
currentSectionLength += 1;
|
|
6117
|
-
}
|
|
6118
|
-
}
|
|
6119
|
-
return result;
|
|
6120
|
-
};
|
|
6121
|
-
var getBrowser = () => {
|
|
6122
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
6123
|
-
if (userAgent.includes("firefox")) return "firefox";
|
|
6124
|
-
if (userAgent.includes("chrome") && !userAgent.includes("edg")) return "chrome";
|
|
6125
|
-
if (userAgent.includes("safari") && !userAgent.includes("chrome")) return "safari";
|
|
6126
|
-
if (userAgent.includes("edg")) return "edge";
|
|
6127
|
-
if (userAgent.includes("opr") || userAgent.includes("opera")) return "opera";
|
|
6128
|
-
return;
|
|
6129
|
-
};
|
|
6130
|
-
var formatPhoneNumber = (phoneNumber) => {
|
|
6131
|
-
const cleanPhoneNumber = phoneNumber.replace(/\D/g, "");
|
|
6132
|
-
const country = countries.find(
|
|
6133
|
-
(country2) => country2.phoneNumberExtension === cleanPhoneNumber.slice(0, country2.phoneNumberExtension.length)
|
|
6134
|
-
);
|
|
6135
|
-
if (!country) return phoneNumber;
|
|
6136
|
-
let phonNumberRest = cleanPhoneNumber.slice(country.phoneNumberExtension.length);
|
|
6137
|
-
if (country.phoneNumberFormat) {
|
|
6138
|
-
let formattedNumber = "";
|
|
6139
|
-
let index = 0;
|
|
6140
|
-
for (const char of country.phoneNumberFormat) {
|
|
6141
|
-
if (char === "X" && index < phonNumberRest.length) {
|
|
6142
|
-
formattedNumber += phonNumberRest[index];
|
|
6143
|
-
index++;
|
|
6144
|
-
} else {
|
|
6145
|
-
formattedNumber += char;
|
|
6146
|
-
}
|
|
6147
|
-
}
|
|
6148
|
-
phonNumberRest = formattedNumber.replace(/X/g, "").trim();
|
|
6149
|
-
}
|
|
6150
|
-
return `+${country.phoneNumberExtension} ${phonNumberRest}`;
|
|
6151
|
-
};
|
|
6152
|
-
var getFormErrorObject = (formValues) => {
|
|
6153
|
-
return {};
|
|
6154
|
-
};
|
|
6155
|
-
|
|
6156
6500
|
// src/utils/variableFunctions.ts
|
|
6157
6501
|
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
6158
6502
|
if (value === void 0) {
|