react-better-html 1.1.253 → 1.1.255
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +229 -175
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +229 -175
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1021,7 +1021,8 @@ function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
|
1021
1021
|
setInternalValue,
|
|
1022
1022
|
inputFieldProps,
|
|
1023
1023
|
insideInputFieldComponentProps,
|
|
1024
|
-
isOpen
|
|
1024
|
+
isOpen,
|
|
1025
|
+
isFocused
|
|
1025
1026
|
};
|
|
1026
1027
|
}
|
|
1027
1028
|
function usePageResize() {
|
|
@@ -5042,7 +5043,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
5042
5043
|
] })
|
|
5043
5044
|
] });
|
|
5044
5045
|
});
|
|
5045
|
-
InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDate, maxDate, ...inputFieldProps }, ref) {
|
|
5046
|
+
InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDate, maxDate, dropdownPosition = "left", ...inputFieldProps }, ref) {
|
|
5046
5047
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5047
5048
|
const props = useComponentsPropsMerger(
|
|
5048
5049
|
betterHtmlContextInternal.components.inputField?.style?.date,
|
|
@@ -5055,7 +5056,8 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5055
5056
|
internalValue,
|
|
5056
5057
|
setInternalValue,
|
|
5057
5058
|
inputFieldProps: restInputFieldProps,
|
|
5058
|
-
insideInputFieldComponentProps
|
|
5059
|
+
insideInputFieldComponentProps,
|
|
5060
|
+
isFocused
|
|
5059
5061
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5060
5062
|
const onChange = (0, import_react21.useCallback)(
|
|
5061
5063
|
(date) => {
|
|
@@ -5069,12 +5071,13 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5069
5071
|
{
|
|
5070
5072
|
...betterHtmlContextInternal.components.inputField?.style?.date,
|
|
5071
5073
|
type: "date",
|
|
5072
|
-
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.
|
|
5074
|
+
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5073
5075
|
Div_default,
|
|
5074
5076
|
{
|
|
5075
5077
|
position: "absolute",
|
|
5076
5078
|
top: "100%",
|
|
5077
|
-
left: 0,
|
|
5079
|
+
left: dropdownPosition === "left" ? 0 : void 0,
|
|
5080
|
+
right: dropdownPosition === "right" ? 0 : void 0,
|
|
5078
5081
|
width: "fit-content",
|
|
5079
5082
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5080
5083
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
@@ -5082,7 +5085,22 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
5082
5085
|
boxShadow: "0px 10px 20px #00000020",
|
|
5083
5086
|
userSelect: "none",
|
|
5084
5087
|
...insideInputFieldComponentProps,
|
|
5085
|
-
children:
|
|
5088
|
+
children: [
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5090
|
+
Div_default,
|
|
5091
|
+
{
|
|
5092
|
+
position: "absolute",
|
|
5093
|
+
top: 0,
|
|
5094
|
+
left: -theme2.styles.borderWidth,
|
|
5095
|
+
width: `calc(100% + ${theme2.styles.borderWidth * 2}px)`,
|
|
5096
|
+
height: theme2.styles.borderWidth,
|
|
5097
|
+
backgroundColor: isFocused ? theme2.colors.primary : theme2.colors.border,
|
|
5098
|
+
transform: `translateY(-${theme2.styles.borderWidth}px)`,
|
|
5099
|
+
transition: theme2.styles.transition
|
|
5100
|
+
}
|
|
5101
|
+
),
|
|
5102
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange })
|
|
5103
|
+
]
|
|
5086
5104
|
}
|
|
5087
5105
|
) : void 0,
|
|
5088
5106
|
holderRef,
|
|
@@ -5099,6 +5117,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5099
5117
|
maxDate,
|
|
5100
5118
|
defaultDateAfterTimePick,
|
|
5101
5119
|
defaultTimeAfterDatePick = "00:00",
|
|
5120
|
+
dropdownPosition = "left",
|
|
5102
5121
|
...inputFieldProps
|
|
5103
5122
|
}, ref) {
|
|
5104
5123
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
@@ -5116,7 +5135,8 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5116
5135
|
setInternalValue,
|
|
5117
5136
|
inputFieldProps: restInputFieldProps,
|
|
5118
5137
|
insideInputFieldComponentProps,
|
|
5119
|
-
isOpen
|
|
5138
|
+
isOpen,
|
|
5139
|
+
isFocused
|
|
5120
5140
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5121
5141
|
const readyHours = (0, import_react21.useMemo)(
|
|
5122
5142
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
@@ -5194,12 +5214,13 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5194
5214
|
{
|
|
5195
5215
|
...betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
5196
5216
|
type: "datetime-local",
|
|
5197
|
-
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.
|
|
5217
|
+
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5198
5218
|
Div_default,
|
|
5199
5219
|
{
|
|
5200
5220
|
position: "absolute",
|
|
5201
5221
|
top: "100%",
|
|
5202
|
-
left: 0,
|
|
5222
|
+
left: dropdownPosition === "left" ? 0 : void 0,
|
|
5223
|
+
right: dropdownPosition === "right" ? 0 : void 0,
|
|
5203
5224
|
width: "fit-content",
|
|
5204
5225
|
backgroundColor: theme2.colors.backgroundContent,
|
|
5205
5226
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
@@ -5208,89 +5229,104 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5208
5229
|
overflow: "hidden",
|
|
5209
5230
|
userSelect: "none",
|
|
5210
5231
|
...insideInputFieldComponentProps,
|
|
5211
|
-
children:
|
|
5212
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5213
|
-
|
|
5214
|
-
Div_default.row,
|
|
5232
|
+
children: [
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5234
|
+
Div_default,
|
|
5215
5235
|
{
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5225
|
-
Div_default,
|
|
5226
|
-
{
|
|
5227
|
-
className: "react-better-html-no-scrollbar",
|
|
5228
|
-
width: buttonWidth,
|
|
5229
|
-
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5230
|
-
overflowY: "auto",
|
|
5231
|
-
tabIndex: -1,
|
|
5232
|
-
children: readyHours.map((hour) => {
|
|
5233
|
-
const isSelected = hour.toString() === valueHour;
|
|
5234
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5235
|
-
Div_default.row,
|
|
5236
|
-
{
|
|
5237
|
-
alignItems: "center",
|
|
5238
|
-
justifyContent: "center",
|
|
5239
|
-
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5240
|
-
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5241
|
-
borderRadius: theme2.styles.borderRadius / 2,
|
|
5242
|
-
filterHover: "brightness(0.9)",
|
|
5243
|
-
cursor: "pointer",
|
|
5244
|
-
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5245
|
-
value: hour,
|
|
5246
|
-
onClickWithValue: onClickHour,
|
|
5247
|
-
ref: isSelected ? selectedHourRef : void 0,
|
|
5248
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5249
|
-
},
|
|
5250
|
-
hour
|
|
5251
|
-
);
|
|
5252
|
-
})
|
|
5253
|
-
}
|
|
5254
|
-
)
|
|
5255
|
-
] }),
|
|
5256
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { height: "100%", children: [
|
|
5257
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
5258
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5259
|
-
Div_default,
|
|
5260
|
-
{
|
|
5261
|
-
className: "react-better-html-no-scrollbar",
|
|
5262
|
-
width: buttonWidth,
|
|
5263
|
-
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5264
|
-
overflowY: "auto",
|
|
5265
|
-
tabIndex: -1,
|
|
5266
|
-
children: readyMinutes.map((minute) => {
|
|
5267
|
-
const isSelected = minute.toString() === valueMinute;
|
|
5268
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5269
|
-
Div_default.row,
|
|
5270
|
-
{
|
|
5271
|
-
alignItems: "center",
|
|
5272
|
-
justifyContent: "center",
|
|
5273
|
-
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5274
|
-
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5275
|
-
borderRadius: theme2.styles.borderRadius / 2,
|
|
5276
|
-
filterHover: "brightness(0.9)",
|
|
5277
|
-
cursor: "pointer",
|
|
5278
|
-
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5279
|
-
value: minute,
|
|
5280
|
-
onClickWithValue: onClickMinute,
|
|
5281
|
-
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5282
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5283
|
-
},
|
|
5284
|
-
minute
|
|
5285
|
-
);
|
|
5286
|
-
})
|
|
5287
|
-
}
|
|
5288
|
-
)
|
|
5289
|
-
] })
|
|
5290
|
-
]
|
|
5236
|
+
position: "absolute",
|
|
5237
|
+
top: 0,
|
|
5238
|
+
left: -theme2.styles.borderWidth,
|
|
5239
|
+
width: `calc(100% + ${theme2.styles.borderWidth * 2}px)`,
|
|
5240
|
+
height: theme2.styles.borderWidth,
|
|
5241
|
+
backgroundColor: isFocused ? theme2.colors.primary : theme2.colors.border,
|
|
5242
|
+
transform: `translateY(-${theme2.styles.borderWidth}px)`,
|
|
5243
|
+
transition: theme2.styles.transition
|
|
5291
5244
|
}
|
|
5292
|
-
)
|
|
5293
|
-
|
|
5245
|
+
),
|
|
5246
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { gap: theme2.styles.space, children: [
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
5248
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5249
|
+
Div_default.row,
|
|
5250
|
+
{
|
|
5251
|
+
height: 276,
|
|
5252
|
+
gap: theme2.styles.gap / 2,
|
|
5253
|
+
paddingTop: topSpacing,
|
|
5254
|
+
paddingBottom: theme2.styles.space / 2,
|
|
5255
|
+
paddingRight: theme2.styles.space / 2,
|
|
5256
|
+
children: [
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { height: "100%", children: [
|
|
5258
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
5259
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5260
|
+
Div_default,
|
|
5261
|
+
{
|
|
5262
|
+
className: "react-better-html-no-scrollbar",
|
|
5263
|
+
width: buttonWidth,
|
|
5264
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5265
|
+
overflowY: "auto",
|
|
5266
|
+
tabIndex: -1,
|
|
5267
|
+
children: readyHours.map((hour) => {
|
|
5268
|
+
const isSelected = hour.toString() === valueHour;
|
|
5269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5270
|
+
Div_default.row,
|
|
5271
|
+
{
|
|
5272
|
+
alignItems: "center",
|
|
5273
|
+
justifyContent: "center",
|
|
5274
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5275
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5276
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5277
|
+
filterHover: "brightness(0.9)",
|
|
5278
|
+
cursor: "pointer",
|
|
5279
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5280
|
+
value: hour,
|
|
5281
|
+
onClickWithValue: onClickHour,
|
|
5282
|
+
ref: isSelected ? selectedHourRef : void 0,
|
|
5283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5284
|
+
},
|
|
5285
|
+
hour
|
|
5286
|
+
);
|
|
5287
|
+
})
|
|
5288
|
+
}
|
|
5289
|
+
)
|
|
5290
|
+
] }),
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { height: "100%", children: [
|
|
5292
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5294
|
+
Div_default,
|
|
5295
|
+
{
|
|
5296
|
+
className: "react-better-html-no-scrollbar",
|
|
5297
|
+
width: buttonWidth,
|
|
5298
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
5299
|
+
overflowY: "auto",
|
|
5300
|
+
tabIndex: -1,
|
|
5301
|
+
children: readyMinutes.map((minute) => {
|
|
5302
|
+
const isSelected = minute.toString() === valueMinute;
|
|
5303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5304
|
+
Div_default.row,
|
|
5305
|
+
{
|
|
5306
|
+
alignItems: "center",
|
|
5307
|
+
justifyContent: "center",
|
|
5308
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5309
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5310
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
5311
|
+
filterHover: "brightness(0.9)",
|
|
5312
|
+
cursor: "pointer",
|
|
5313
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5314
|
+
value: minute,
|
|
5315
|
+
onClickWithValue: onClickMinute,
|
|
5316
|
+
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5317
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5318
|
+
},
|
|
5319
|
+
minute
|
|
5320
|
+
);
|
|
5321
|
+
})
|
|
5322
|
+
}
|
|
5323
|
+
)
|
|
5324
|
+
] })
|
|
5325
|
+
]
|
|
5326
|
+
}
|
|
5327
|
+
)
|
|
5328
|
+
] })
|
|
5329
|
+
]
|
|
5294
5330
|
}
|
|
5295
5331
|
) : void 0,
|
|
5296
5332
|
holderRef,
|
|
@@ -5301,7 +5337,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5301
5337
|
}
|
|
5302
5338
|
);
|
|
5303
5339
|
});
|
|
5304
|
-
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursToRender, minutesToRender, minTime, maxTime, ...inputFieldProps }, ref) {
|
|
5340
|
+
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursToRender, minutesToRender, minTime, maxTime, dropdownPosition = "left", ...inputFieldProps }, ref) {
|
|
5305
5341
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5306
5342
|
const props = useComponentsPropsMerger(
|
|
5307
5343
|
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
@@ -5321,7 +5357,8 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5321
5357
|
setInternalValue,
|
|
5322
5358
|
inputFieldProps: restInputFieldProps,
|
|
5323
5359
|
insideInputFieldComponentProps,
|
|
5324
|
-
isOpen
|
|
5360
|
+
isOpen,
|
|
5361
|
+
isFocused
|
|
5325
5362
|
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5326
5363
|
const readyHours = (0, import_react21.useMemo)(
|
|
5327
5364
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
@@ -5388,12 +5425,13 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5388
5425
|
{
|
|
5389
5426
|
...betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5390
5427
|
type: "time",
|
|
5391
|
-
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.
|
|
5428
|
+
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5392
5429
|
Div_default,
|
|
5393
5430
|
{
|
|
5394
5431
|
position: "absolute",
|
|
5395
5432
|
top: "100%",
|
|
5396
|
-
left: 0,
|
|
5433
|
+
left: dropdownPosition === "left" ? 0 : void 0,
|
|
5434
|
+
right: dropdownPosition === "right" ? 0 : void 0,
|
|
5397
5435
|
width: buttonWidth * 2 + 2,
|
|
5398
5436
|
height: 300,
|
|
5399
5437
|
backgroundColor: theme2.colors.backgroundContent,
|
|
@@ -5403,73 +5441,88 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5403
5441
|
overflowY: "auto",
|
|
5404
5442
|
userSelect: "none",
|
|
5405
5443
|
...insideInputFieldComponentProps,
|
|
5406
|
-
children:
|
|
5444
|
+
children: [
|
|
5407
5445
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5408
5446
|
Div_default,
|
|
5409
5447
|
{
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5419
|
-
Div_default.row,
|
|
5420
|
-
{
|
|
5421
|
-
alignItems: "center",
|
|
5422
|
-
justifyContent: "center",
|
|
5423
|
-
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5424
|
-
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5425
|
-
filterHover: "brightness(0.9)",
|
|
5426
|
-
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
5427
|
-
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5428
|
-
opacity: isDisabled ? 0.6 : void 0,
|
|
5429
|
-
value: hour,
|
|
5430
|
-
onClickWithValue: !isDisabled ? onClickHour : void 0,
|
|
5431
|
-
ref: isSelected ? selectedHourRef : void 0,
|
|
5432
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5433
|
-
},
|
|
5434
|
-
hour
|
|
5435
|
-
);
|
|
5436
|
-
})
|
|
5448
|
+
position: "absolute",
|
|
5449
|
+
top: 0,
|
|
5450
|
+
left: -theme2.styles.borderWidth,
|
|
5451
|
+
width: `calc(100% + ${theme2.styles.borderWidth * 2}px)`,
|
|
5452
|
+
height: theme2.styles.borderWidth,
|
|
5453
|
+
backgroundColor: isFocused ? theme2.colors.primary : theme2.colors.border,
|
|
5454
|
+
transform: `translateY(-${theme2.styles.borderWidth}px)`,
|
|
5455
|
+
transition: theme2.styles.transition
|
|
5437
5456
|
}
|
|
5438
5457
|
),
|
|
5439
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5458
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { height: "100%", children: [
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5460
|
+
Div_default,
|
|
5461
|
+
{
|
|
5462
|
+
className: "react-better-html-no-scrollbar",
|
|
5463
|
+
width: buttonWidth,
|
|
5464
|
+
height: "100%",
|
|
5465
|
+
overflowY: "auto",
|
|
5466
|
+
tabIndex: -1,
|
|
5467
|
+
children: readyHours.map((hour) => {
|
|
5468
|
+
const isSelected = hour.toString() === valueHour;
|
|
5469
|
+
const isDisabled = minHours && hour < minHours || maxHours && hour > maxHours;
|
|
5470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5471
|
+
Div_default.row,
|
|
5472
|
+
{
|
|
5473
|
+
alignItems: "center",
|
|
5474
|
+
justifyContent: "center",
|
|
5475
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5476
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5477
|
+
filterHover: "brightness(0.9)",
|
|
5478
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
5479
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5480
|
+
opacity: isDisabled ? 0.6 : void 0,
|
|
5481
|
+
value: hour,
|
|
5482
|
+
onClickWithValue: !isDisabled ? onClickHour : void 0,
|
|
5483
|
+
ref: isSelected ? selectedHourRef : void 0,
|
|
5484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: hour.toString().padStart(2, "0") })
|
|
5485
|
+
},
|
|
5486
|
+
hour
|
|
5487
|
+
);
|
|
5488
|
+
})
|
|
5489
|
+
}
|
|
5490
|
+
),
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5492
|
+
Div_default,
|
|
5493
|
+
{
|
|
5494
|
+
className: "react-better-html-no-scrollbar",
|
|
5495
|
+
width: buttonWidth,
|
|
5496
|
+
height: "100%",
|
|
5497
|
+
overflowY: "auto",
|
|
5498
|
+
tabIndex: -1,
|
|
5499
|
+
children: readyMinutes.map((minute) => {
|
|
5500
|
+
const isSelected = minute.toString() === valueMinute;
|
|
5501
|
+
const currentHour = parseInt(valueHour);
|
|
5502
|
+
const isDisabled = minHours !== void 0 && minMinutes !== void 0 && currentHour === minHours && minute < minMinutes || maxHours !== void 0 && maxMinutes !== void 0 && currentHour === maxHours && minute > maxMinutes;
|
|
5503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5504
|
+
Div_default.row,
|
|
5505
|
+
{
|
|
5506
|
+
alignItems: "center",
|
|
5507
|
+
justifyContent: "center",
|
|
5508
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5509
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
5510
|
+
filterHover: "brightness(0.9)",
|
|
5511
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
5512
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
5513
|
+
opacity: isDisabled ? 0.6 : void 0,
|
|
5514
|
+
value: minute,
|
|
5515
|
+
onClickWithValue: !isDisabled ? onClickMinute : void 0,
|
|
5516
|
+
ref: isSelected ? selectedMinuteRef : void 0,
|
|
5517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { textAlign: "center", children: minute.toString().padStart(2, "0") })
|
|
5518
|
+
},
|
|
5519
|
+
minute
|
|
5520
|
+
);
|
|
5521
|
+
})
|
|
5522
|
+
}
|
|
5523
|
+
)
|
|
5524
|
+
] })
|
|
5525
|
+
]
|
|
5473
5526
|
}
|
|
5474
5527
|
) : void 0,
|
|
5475
5528
|
holderRef,
|
|
@@ -5481,7 +5534,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5481
5534
|
}
|
|
5482
5535
|
);
|
|
5483
5536
|
});
|
|
5484
|
-
InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4(inputFieldProps, ref) {
|
|
5537
|
+
InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4({ ...inputFieldProps }, ref) {
|
|
5485
5538
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5486
5539
|
const { value, onChangeValue, ...props } = useComponentsPropsMerger(
|
|
5487
5540
|
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
@@ -7444,11 +7497,12 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7444
7497
|
const firstRenderPassedRef = (0, import_react29.useRef)(false);
|
|
7445
7498
|
const tabsRef = (0, import_react29.useRef)({});
|
|
7446
7499
|
const [selectedTab, setSelectedTab] = (0, import_react29.useState)(() => {
|
|
7447
|
-
const selectedTabId = tabs[0]
|
|
7500
|
+
const selectedTabId = tabs[0];
|
|
7448
7501
|
if (urlQuery) {
|
|
7449
7502
|
const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
|
|
7450
7503
|
if (!tabQueryValue) return selectedTabId;
|
|
7451
|
-
|
|
7504
|
+
const queryTab = tabs.find((tab) => tab.id === tabQueryValue);
|
|
7505
|
+
if (queryTab) return queryTab;
|
|
7452
7506
|
}
|
|
7453
7507
|
return selectedTabId;
|
|
7454
7508
|
});
|
|
@@ -7456,7 +7510,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7456
7510
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
7457
7511
|
const onClickTab = (0, import_react29.useCallback)(
|
|
7458
7512
|
(tab) => {
|
|
7459
|
-
setSelectedTab(tab
|
|
7513
|
+
setSelectedTab(tab);
|
|
7460
7514
|
onChange?.(tab);
|
|
7461
7515
|
if (urlQuery) {
|
|
7462
7516
|
urlQuery.setQuery({
|
|
@@ -7467,11 +7521,11 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7467
7521
|
[onChange, name, urlQuery]
|
|
7468
7522
|
);
|
|
7469
7523
|
const width = (0, import_react29.useMemo)(
|
|
7470
|
-
() => tabsRef.current[selectedTab]?.getBoundingClientRect().width ?? 0,
|
|
7524
|
+
() => tabsRef.current[selectedTab.id]?.getBoundingClientRect().width ?? 0,
|
|
7471
7525
|
[rerenderState, selectedTab]
|
|
7472
7526
|
);
|
|
7473
7527
|
const leftSpacing = (0, import_react29.useMemo)(() => {
|
|
7474
|
-
const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTab);
|
|
7528
|
+
const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTab.id);
|
|
7475
7529
|
let spacing = 0;
|
|
7476
7530
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
7477
7531
|
if (index < selectedTabIndex) spacing += (tab?.getBoundingClientRect().width ?? 0) + tabsGap;
|
|
@@ -7494,7 +7548,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7494
7548
|
return oldValue.map(
|
|
7495
7549
|
(item) => item.name === (name ?? defaultTabName) ? {
|
|
7496
7550
|
...item,
|
|
7497
|
-
selectedTab
|
|
7551
|
+
selectedTab: selectedTab.id
|
|
7498
7552
|
} : item
|
|
7499
7553
|
);
|
|
7500
7554
|
} else {
|
|
@@ -7502,14 +7556,14 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7502
7556
|
...oldValue,
|
|
7503
7557
|
{
|
|
7504
7558
|
name: name ?? defaultTabName,
|
|
7505
|
-
selectedTab
|
|
7559
|
+
selectedTab: selectedTab.id
|
|
7506
7560
|
}
|
|
7507
7561
|
];
|
|
7508
7562
|
}
|
|
7509
7563
|
});
|
|
7510
7564
|
}, [selectedTab, name]);
|
|
7511
7565
|
(0, import_react29.useEffect)(() => {
|
|
7512
|
-
tabsRef.current[selectedTab]?.scrollIntoView({
|
|
7566
|
+
tabsRef.current[selectedTab.id]?.scrollIntoView({
|
|
7513
7567
|
behavior: firstRenderPassedRef.current ? "smooth" : void 0,
|
|
7514
7568
|
block: "nearest"
|
|
7515
7569
|
});
|
|
@@ -7521,16 +7575,19 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7521
7575
|
);
|
|
7522
7576
|
};
|
|
7523
7577
|
}, []);
|
|
7578
|
+
(0, import_react29.useEffect)(() => {
|
|
7579
|
+
onChange?.(selectedTab);
|
|
7580
|
+
}, []);
|
|
7524
7581
|
(0, import_react29.useImperativeHandle)(ref, () => {
|
|
7525
7582
|
return {
|
|
7526
|
-
selectedTab,
|
|
7583
|
+
selectedTab: selectedTab.id,
|
|
7527
7584
|
selectTab: onClickTab
|
|
7528
7585
|
};
|
|
7529
7586
|
}, [selectedTab, onClickTab]);
|
|
7530
7587
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
7531
7588
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
7532
7589
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7533
|
-
const selected = tab.id === selectedTab;
|
|
7590
|
+
const selected = tab.id === selectedTab.id;
|
|
7534
7591
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7535
7592
|
Div_default,
|
|
7536
7593
|
{
|
|
@@ -7790,18 +7847,11 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
7790
7847
|
backgroundColor,
|
|
7791
7848
|
activeItemColor,
|
|
7792
7849
|
hoverItemColor,
|
|
7850
|
+
location,
|
|
7793
7851
|
onClick
|
|
7794
7852
|
}) {
|
|
7795
|
-
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
7796
|
-
if (!reactRouterDomPlugin2) {
|
|
7797
|
-
throw new Error(
|
|
7798
|
-
"`SideMenu` component requires the `react-router-dom` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
7799
|
-
);
|
|
7800
|
-
}
|
|
7801
|
-
const reactRouterDomPluginConfig = reactRouterDomPlugin2.getConfig();
|
|
7802
7853
|
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7803
7854
|
const mediaQuery = useMediaQuery();
|
|
7804
|
-
const location = reactRouterDomPluginConfig.useLocation();
|
|
7805
7855
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
7806
7856
|
const { colorTheme } = (0, import_react_better_core29.useBetterCoreContext)();
|
|
7807
7857
|
const { activeItem, setActiveItem } = useSideMenuContext();
|
|
@@ -7953,6 +8003,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
7953
8003
|
{
|
|
7954
8004
|
item: child,
|
|
7955
8005
|
backgroundColor: readyBackgroundColor,
|
|
8006
|
+
location,
|
|
7956
8007
|
onClick
|
|
7957
8008
|
},
|
|
7958
8009
|
child.text
|
|
@@ -8003,6 +8054,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
8003
8054
|
var SideMenuComponent = function SideMenu({
|
|
8004
8055
|
items,
|
|
8005
8056
|
bottomItems,
|
|
8057
|
+
location,
|
|
8006
8058
|
topSpace = 0,
|
|
8007
8059
|
logoAssetName,
|
|
8008
8060
|
logoUrl,
|
|
@@ -8064,6 +8116,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8064
8116
|
backgroundColor: readyBackgroundColor,
|
|
8065
8117
|
activeItemColor,
|
|
8066
8118
|
hoverItemColor,
|
|
8119
|
+
location,
|
|
8067
8120
|
onClick: onClickXButton
|
|
8068
8121
|
},
|
|
8069
8122
|
item.text
|
|
@@ -8086,6 +8139,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
8086
8139
|
backgroundColor: readyBackgroundColor,
|
|
8087
8140
|
activeItemColor,
|
|
8088
8141
|
hoverItemColor,
|
|
8142
|
+
location,
|
|
8089
8143
|
onClick: onClickXButton
|
|
8090
8144
|
},
|
|
8091
8145
|
item.text
|