react-better-html 1.1.228 → 1.1.230
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 +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +143 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -139,6 +139,7 @@ type InputFieldProps = {
|
|
|
139
139
|
holderRef?: React.ForwardedRef<HTMLDivElement>;
|
|
140
140
|
} & OmitProps<React.ComponentProps<"input">, "style" | "ref" | "prefix"> & ComponentStyle & ComponentHoverStyle;
|
|
141
141
|
type TextareaFieldProps = OmitProps<InputFieldProps, "type"> & OmitProps<React.ComponentProps<"textarea">, "style" | "ref">;
|
|
142
|
+
type InputFieldDateTimeExcludeProps = Pick<InputFieldProps, "min" | "max" | "minLength" | "maxLength">;
|
|
142
143
|
type InputFieldComponentType = {
|
|
143
144
|
(props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
|
|
144
145
|
multiline: (props: ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>) => React.ReactElement;
|
|
@@ -153,7 +154,9 @@ type InputFieldComponentType = {
|
|
|
153
154
|
minDate?: Date;
|
|
154
155
|
maxDate?: Date;
|
|
155
156
|
}>) => React.ReactElement;
|
|
156
|
-
dateTime: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
|
|
157
|
+
dateTime: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, keyof InputFieldDateTimeExcludeProps> & {
|
|
158
|
+
hoursToRender?: number[];
|
|
159
|
+
minutesToRender?: number[];
|
|
157
160
|
minDate?: Date;
|
|
158
161
|
maxDate?: Date;
|
|
159
162
|
/** @default today */
|
|
@@ -161,7 +164,14 @@ type InputFieldComponentType = {
|
|
|
161
164
|
/** @default "00:00" */
|
|
162
165
|
defaultTimeAfterDatePick?: `${number}:${number}`;
|
|
163
166
|
}>) => React.ReactElement;
|
|
164
|
-
time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps
|
|
167
|
+
time: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, keyof InputFieldDateTimeExcludeProps>> & {
|
|
168
|
+
hoursToRender?: number[];
|
|
169
|
+
minutesToRender?: number[];
|
|
170
|
+
/** @default 00:00 */
|
|
171
|
+
minTime?: string;
|
|
172
|
+
/** @default 23:59 */
|
|
173
|
+
maxTime?: string;
|
|
174
|
+
}) => React.ReactElement;
|
|
165
175
|
color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
166
176
|
};
|
|
167
177
|
declare const InputFieldComponent: InputFieldComponentType;
|
|
@@ -411,6 +421,7 @@ type ImageComponent = {
|
|
|
411
421
|
/** @default 40 */
|
|
412
422
|
size?: number;
|
|
413
423
|
letters?: string;
|
|
424
|
+
letterColor?: string;
|
|
414
425
|
backgroundColor?: string;
|
|
415
426
|
}>) => React.ReactElement;
|
|
416
427
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ type InputFieldProps = {
|
|
|
139
139
|
holderRef?: React.ForwardedRef<HTMLDivElement>;
|
|
140
140
|
} & OmitProps<React.ComponentProps<"input">, "style" | "ref" | "prefix"> & ComponentStyle & ComponentHoverStyle;
|
|
141
141
|
type TextareaFieldProps = OmitProps<InputFieldProps, "type"> & OmitProps<React.ComponentProps<"textarea">, "style" | "ref">;
|
|
142
|
+
type InputFieldDateTimeExcludeProps = Pick<InputFieldProps, "min" | "max" | "minLength" | "maxLength">;
|
|
142
143
|
type InputFieldComponentType = {
|
|
143
144
|
(props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
|
|
144
145
|
multiline: (props: ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>) => React.ReactElement;
|
|
@@ -153,7 +154,9 @@ type InputFieldComponentType = {
|
|
|
153
154
|
minDate?: Date;
|
|
154
155
|
maxDate?: Date;
|
|
155
156
|
}>) => React.ReactElement;
|
|
156
|
-
dateTime: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
|
|
157
|
+
dateTime: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, keyof InputFieldDateTimeExcludeProps> & {
|
|
158
|
+
hoursToRender?: number[];
|
|
159
|
+
minutesToRender?: number[];
|
|
157
160
|
minDate?: Date;
|
|
158
161
|
maxDate?: Date;
|
|
159
162
|
/** @default today */
|
|
@@ -161,7 +164,14 @@ type InputFieldComponentType = {
|
|
|
161
164
|
/** @default "00:00" */
|
|
162
165
|
defaultTimeAfterDatePick?: `${number}:${number}`;
|
|
163
166
|
}>) => React.ReactElement;
|
|
164
|
-
time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps
|
|
167
|
+
time: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, keyof InputFieldDateTimeExcludeProps>> & {
|
|
168
|
+
hoursToRender?: number[];
|
|
169
|
+
minutesToRender?: number[];
|
|
170
|
+
/** @default 00:00 */
|
|
171
|
+
minTime?: string;
|
|
172
|
+
/** @default 23:59 */
|
|
173
|
+
maxTime?: string;
|
|
174
|
+
}) => React.ReactElement;
|
|
165
175
|
color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
166
176
|
};
|
|
167
177
|
declare const InputFieldComponent: InputFieldComponentType;
|
|
@@ -411,6 +421,7 @@ type ImageComponent = {
|
|
|
411
421
|
/** @default 40 */
|
|
412
422
|
size?: number;
|
|
413
423
|
letters?: string;
|
|
424
|
+
letterColor?: string;
|
|
414
425
|
backgroundColor?: string;
|
|
415
426
|
}>) => React.ReactElement;
|
|
416
427
|
};
|
package/dist/index.js
CHANGED
|
@@ -1474,7 +1474,7 @@ var Image = (0, import_react4.forwardRef)(function Image2({ name, src, ...props
|
|
|
1474
1474
|
}
|
|
1475
1475
|
);
|
|
1476
1476
|
});
|
|
1477
|
-
Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size = 40, letters, backgroundColor, ...props }, ref) {
|
|
1477
|
+
Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size = 40, letters, letterColor, backgroundColor, ...props }, ref) {
|
|
1478
1478
|
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
1479
1479
|
return letters ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1480
1480
|
Div_default.row,
|
|
@@ -1488,7 +1488,7 @@ Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size
|
|
|
1488
1488
|
...props,
|
|
1489
1489
|
width: size,
|
|
1490
1490
|
height: size,
|
|
1491
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
1491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: letterColor ?? theme2.colors.textPrimary, children: letters.toUpperCase().slice(0, 2) })
|
|
1492
1492
|
}
|
|
1493
1493
|
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1494
1494
|
Image,
|
|
@@ -2728,25 +2728,31 @@ function Alert2({ alert }) {
|
|
|
2728
2728
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
2729
2729
|
if (defaultAlertDisplay === "prominent") return;
|
|
2730
2730
|
setIsRemoved(true);
|
|
2731
|
-
setTimeout(
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2731
|
+
setTimeout(
|
|
2732
|
+
() => {
|
|
2733
|
+
alertControls2.removeAlert(alert.id);
|
|
2734
|
+
if (!calledOnCloseRef.current) {
|
|
2735
|
+
alert.onClose?.(alert);
|
|
2736
|
+
calledOnCloseRef.current = true;
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
0.2 * 1e3 - 10
|
|
2740
|
+
);
|
|
2738
2741
|
}
|
|
2739
2742
|
}, updateInterval);
|
|
2740
2743
|
}, [alert, progress, defaultAlertDisplay]);
|
|
2741
2744
|
const onClickCloseAlert = (0, import_react12.useCallback)(() => {
|
|
2742
2745
|
setIsRemoved(true);
|
|
2743
|
-
setTimeout(
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2746
|
+
setTimeout(
|
|
2747
|
+
() => {
|
|
2748
|
+
alertControls2.removeAlert(alert.id);
|
|
2749
|
+
if (!calledOnCloseRef.current) {
|
|
2750
|
+
alert.onClose?.(alert);
|
|
2751
|
+
calledOnCloseRef.current = true;
|
|
2752
|
+
}
|
|
2753
|
+
},
|
|
2754
|
+
0.2 * 1e3 - 10
|
|
2755
|
+
);
|
|
2750
2756
|
}, [alert]);
|
|
2751
2757
|
const onMouseEnter = (0, import_react12.useCallback)(() => {
|
|
2752
2758
|
setIsPaused(true);
|
|
@@ -2763,13 +2769,16 @@ function Alert2({ alert }) {
|
|
|
2763
2769
|
const onClickAlertModalDone = (0, import_react12.useCallback)(() => {
|
|
2764
2770
|
setIsRemoved(true);
|
|
2765
2771
|
modalRef.current?.close();
|
|
2766
|
-
setTimeout(
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2772
|
+
setTimeout(
|
|
2773
|
+
() => {
|
|
2774
|
+
alertControls2.removeAlert(alert.id);
|
|
2775
|
+
if (!calledOnCloseRef.current) {
|
|
2776
|
+
alert.onClose?.(alert);
|
|
2777
|
+
calledOnCloseRef.current = true;
|
|
2778
|
+
}
|
|
2779
|
+
},
|
|
2780
|
+
0.2 * 1e3 - 10
|
|
2781
|
+
);
|
|
2773
2782
|
}, [alert]);
|
|
2774
2783
|
const alertData = (0, import_react12.useMemo)(
|
|
2775
2784
|
() => ({
|
|
@@ -2863,7 +2872,7 @@ function Alert2({ alert }) {
|
|
|
2863
2872
|
),
|
|
2864
2873
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2865
2874
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { fontSize: 18, fontWeight: 700, children: alertTitle }),
|
|
2866
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { color: theme2.colors.textSecondary, children: alert.message })
|
|
2875
|
+
alert.message && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { color: theme2.colors.textSecondary, children: alert.message })
|
|
2867
2876
|
] }),
|
|
2868
2877
|
pluginConfig.withCloseButton && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button_default.icon, { icon: "XMark", alignSelf: "flex-start", onClick: onClickCloseAlert })
|
|
2869
2878
|
] }),
|
|
@@ -3242,6 +3251,18 @@ var decryptString = (text) => {
|
|
|
3242
3251
|
});
|
|
3243
3252
|
return decrypted.toString(import_crypto_js.default.enc.Utf8);
|
|
3244
3253
|
};
|
|
3254
|
+
function findClosestNumber(numbers, target) {
|
|
3255
|
+
let closest = numbers[0];
|
|
3256
|
+
let minDistance = Math.abs(target - numbers[0]);
|
|
3257
|
+
for (let index = 1; index < numbers.length; index++) {
|
|
3258
|
+
const distance = Math.abs(target - numbers[index]);
|
|
3259
|
+
if (distance < minDistance || distance === minDistance && numbers[index] < closest) {
|
|
3260
|
+
closest = numbers[index];
|
|
3261
|
+
minDistance = distance;
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
return closest;
|
|
3265
|
+
}
|
|
3245
3266
|
|
|
3246
3267
|
// src/utils/localStorage.ts
|
|
3247
3268
|
function generateLocalStorage() {
|
|
@@ -4789,13 +4810,29 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4789
4810
|
}
|
|
4790
4811
|
);
|
|
4791
4812
|
});
|
|
4792
|
-
InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime({
|
|
4813
|
+
InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime({
|
|
4814
|
+
hoursToRender,
|
|
4815
|
+
minutesToRender,
|
|
4816
|
+
minDate,
|
|
4817
|
+
maxDate,
|
|
4818
|
+
defaultDateAfterTimePick,
|
|
4819
|
+
defaultTimeAfterDatePick = "00:00",
|
|
4820
|
+
...props
|
|
4821
|
+
}, ref) {
|
|
4793
4822
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4794
4823
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4795
4824
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4796
4825
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
4797
4826
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4798
4827
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4828
|
+
const readyHours = (0, import_react21.useMemo)(
|
|
4829
|
+
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
4830
|
+
[hoursToRender]
|
|
4831
|
+
);
|
|
4832
|
+
const readyMinutes = (0, import_react21.useMemo)(
|
|
4833
|
+
() => minutesToRender?.filter((hour) => hour >= 0 && hour <= 59) ?? minutes,
|
|
4834
|
+
[minutesToRender]
|
|
4835
|
+
);
|
|
4799
4836
|
const onChange = (0, import_react21.useCallback)(
|
|
4800
4837
|
(date) => {
|
|
4801
4838
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
@@ -4804,6 +4841,32 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4804
4841
|
},
|
|
4805
4842
|
[internalValue, defaultTimeAfterDatePick, inputFieldProps.onChangeValue]
|
|
4806
4843
|
);
|
|
4844
|
+
const onBlur = (0, import_react21.useCallback)(
|
|
4845
|
+
(event) => {
|
|
4846
|
+
if (hoursToRender || minutesToRender) {
|
|
4847
|
+
const value = event.target.value;
|
|
4848
|
+
const hours2 = parseInt(value.split(":")[0] || "0");
|
|
4849
|
+
const minutes2 = parseInt(value.split(":")[1] || "0");
|
|
4850
|
+
const readyHour = readyHours.includes(hours2) ? hours2 : findClosestNumber(readyHours, hours2);
|
|
4851
|
+
const readyMinute = readyMinutes.includes(minutes2) ? minutes2 : findClosestNumber(readyMinutes, minutes2);
|
|
4852
|
+
const newTime = `${readyHour.toString().padStart(2, "0")}:${readyMinute.toString().padStart(2, "0")}`;
|
|
4853
|
+
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4854
|
+
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4855
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
4856
|
+
}
|
|
4857
|
+
inputFieldProps.onBlur?.(event);
|
|
4858
|
+
},
|
|
4859
|
+
[
|
|
4860
|
+
defaultDateAfterTimePick,
|
|
4861
|
+
internalValue,
|
|
4862
|
+
hoursToRender,
|
|
4863
|
+
minutesToRender,
|
|
4864
|
+
readyHours,
|
|
4865
|
+
readyMinutes,
|
|
4866
|
+
inputFieldProps.onChangeValue,
|
|
4867
|
+
inputFieldProps.onBlur
|
|
4868
|
+
]
|
|
4869
|
+
);
|
|
4807
4870
|
const onClickHour = (0, import_react21.useCallback)(
|
|
4808
4871
|
(hour) => {
|
|
4809
4872
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
@@ -4872,7 +4935,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4872
4935
|
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4873
4936
|
overflowY: "auto",
|
|
4874
4937
|
tabIndex: -1,
|
|
4875
|
-
children:
|
|
4938
|
+
children: readyHours.map((hour) => {
|
|
4876
4939
|
const isSelected = hour.toString() === valueHour;
|
|
4877
4940
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4878
4941
|
Div_default.row,
|
|
@@ -4906,7 +4969,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4906
4969
|
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4907
4970
|
overflowY: "auto",
|
|
4908
4971
|
tabIndex: -1,
|
|
4909
|
-
children:
|
|
4972
|
+
children: readyMinutes.map((minute) => {
|
|
4910
4973
|
const isSelected = minute.toString() === valueMinute;
|
|
4911
4974
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4912
4975
|
Div_default.row,
|
|
@@ -4939,17 +5002,56 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4939
5002
|
holderRef,
|
|
4940
5003
|
ref,
|
|
4941
5004
|
...props,
|
|
4942
|
-
...inputFieldProps
|
|
5005
|
+
...inputFieldProps,
|
|
5006
|
+
onBlur
|
|
4943
5007
|
}
|
|
4944
5008
|
);
|
|
4945
5009
|
});
|
|
4946
|
-
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...props }, ref) {
|
|
5010
|
+
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursToRender, minutesToRender, minTime, maxTime, ...props }, ref) {
|
|
4947
5011
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4948
5012
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4949
5013
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4950
5014
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
4951
5015
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
5016
|
+
const minHours = minTime ? parseInt(minTime.split(":")[0]) : void 0;
|
|
5017
|
+
const minMinutes = minTime ? parseInt(minTime.split(":")[1]) : void 0;
|
|
5018
|
+
const maxHours = maxTime ? parseInt(maxTime.split(":")[0]) : void 0;
|
|
5019
|
+
const maxMinutes = maxTime ? parseInt(maxTime.split(":")[1]) : void 0;
|
|
4952
5020
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps, isOpen } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5021
|
+
const readyHours = (0, import_react21.useMemo)(
|
|
5022
|
+
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
5023
|
+
[hoursToRender]
|
|
5024
|
+
);
|
|
5025
|
+
const readyMinutes = (0, import_react21.useMemo)(
|
|
5026
|
+
() => minutesToRender?.filter((hour) => hour >= 0 && hour <= 59) ?? minutes,
|
|
5027
|
+
[minutesToRender]
|
|
5028
|
+
);
|
|
5029
|
+
const onBlur = (0, import_react21.useCallback)(
|
|
5030
|
+
(event) => {
|
|
5031
|
+
if (!!minHours || !!maxHours || !!minMinutes || !!maxMinutes || hoursToRender || minutesToRender) {
|
|
5032
|
+
const value = event.target.value;
|
|
5033
|
+
const hours2 = parseInt(value.split(":")[0] || "0");
|
|
5034
|
+
const minutes2 = parseInt(value.split(":")[1] || "0");
|
|
5035
|
+
const readyHour = readyHours.includes(hours2) ? hours2 : findClosestNumber(readyHours, hours2);
|
|
5036
|
+
const readyMinute = readyMinutes.includes(minutes2) ? minutes2 : findClosestNumber(readyMinutes, minutes2);
|
|
5037
|
+
const newValue = `${(minHours && readyHour < minHours ? minHours : maxHours && readyHour > maxHours ? maxHours : readyHour).toString().padStart(2, "0")}:${(minMinutes && readyMinute < minMinutes ? minMinutes : maxHours && readyMinute > maxHours ? maxHours : readyMinute).toString().padStart(2, "0")}`;
|
|
5038
|
+
inputFieldProps.onChangeValue?.(newValue);
|
|
5039
|
+
}
|
|
5040
|
+
inputFieldProps.onBlur?.(event);
|
|
5041
|
+
},
|
|
5042
|
+
[
|
|
5043
|
+
minHours,
|
|
5044
|
+
maxHours,
|
|
5045
|
+
minMinutes,
|
|
5046
|
+
maxMinutes,
|
|
5047
|
+
hoursToRender,
|
|
5048
|
+
minutesToRender,
|
|
5049
|
+
readyHours,
|
|
5050
|
+
readyMinutes,
|
|
5051
|
+
inputFieldProps.onChangeValue,
|
|
5052
|
+
inputFieldProps.onBlur
|
|
5053
|
+
]
|
|
5054
|
+
);
|
|
4953
5055
|
const onClickHour = (0, import_react21.useCallback)(
|
|
4954
5056
|
(hour) => {
|
|
4955
5057
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
@@ -5002,8 +5104,9 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
5002
5104
|
height: "100%",
|
|
5003
5105
|
overflowY: "auto",
|
|
5004
5106
|
tabIndex: -1,
|
|
5005
|
-
children:
|
|
5107
|
+
children: readyHours.map((hour) => {
|
|
5006
5108
|
const isSelected = hour.toString() === valueHour;
|
|
5109
|
+
const isDisabled = minHours && hour < minHours || maxHours && hour > maxHours;
|
|
5007
5110
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5008
5111
|
Div_default.row,
|
|
5009
5112
|
{
|
|
@@ -5012,10 +5115,11 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
5012
5115
|
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5013
5116
|
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5014
5117
|
filterHover: "brightness(0.9)",
|
|
5015
|
-
cursor: "pointer",
|
|
5118
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
5016
5119
|
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5120
|
+
opacity: isDisabled ? 0.6 : void 0,
|
|
5017
5121
|
value: hour,
|
|
5018
|
-
onClickWithValue: onClickHour,
|
|
5122
|
+
onClickWithValue: !isDisabled ? onClickHour : void 0,
|
|
5019
5123
|
ref: isSelected ? selectedHourRef : void 0,
|
|
5020
5124
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5021
5125
|
},
|
|
@@ -5032,8 +5136,9 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
5032
5136
|
height: "100%",
|
|
5033
5137
|
overflowY: "auto",
|
|
5034
5138
|
tabIndex: -1,
|
|
5035
|
-
children:
|
|
5139
|
+
children: readyMinutes.map((minute) => {
|
|
5036
5140
|
const isSelected = minute.toString() === valueMinute;
|
|
5141
|
+
const isDisabled = minMinutes && minute < minMinutes || maxMinutes && minute > maxMinutes;
|
|
5037
5142
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5038
5143
|
Div_default.row,
|
|
5039
5144
|
{
|
|
@@ -5042,10 +5147,11 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
5042
5147
|
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5043
5148
|
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5044
5149
|
filterHover: "brightness(0.9)",
|
|
5045
|
-
cursor: "pointer",
|
|
5150
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
5046
5151
|
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5152
|
+
opacity: isDisabled ? 0.6 : void 0,
|
|
5047
5153
|
value: minute,
|
|
5048
|
-
onClickWithValue: onClickMinute,
|
|
5154
|
+
onClickWithValue: !isDisabled ? onClickMinute : void 0,
|
|
5049
5155
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5050
5156
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5051
5157
|
},
|
|
@@ -5061,7 +5167,8 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
5061
5167
|
ref,
|
|
5062
5168
|
...props,
|
|
5063
5169
|
...inputFieldProps,
|
|
5064
|
-
minWidth: buttonWidth * 2 + 2
|
|
5170
|
+
minWidth: buttonWidth * 2 + 2,
|
|
5171
|
+
onBlur
|
|
5065
5172
|
}
|
|
5066
5173
|
);
|
|
5067
5174
|
});
|