react-better-html 1.1.239 → 1.1.240
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 +441 -404
- package/dist/index.d.ts +441 -404
- package/dist/index.js +435 -188
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +435 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -932,6 +932,21 @@ function useComponentPropsWithPrefix(props, prefix) {
|
|
|
932
932
|
return returnValue;
|
|
933
933
|
}, [props, prefix]);
|
|
934
934
|
}
|
|
935
|
+
function useComponentsPropsMerger(...props) {
|
|
936
|
+
return (0, import_react.useMemo)(
|
|
937
|
+
() => props.filter((props2) => props2 !== void 0).reduce(
|
|
938
|
+
(previousValue, currentValue) => ({
|
|
939
|
+
...previousValue,
|
|
940
|
+
...Object.entries(currentValue).reduce((pv, [key, value]) => {
|
|
941
|
+
if (value !== void 0) pv[key] = value;
|
|
942
|
+
return pv;
|
|
943
|
+
}, {})
|
|
944
|
+
}),
|
|
945
|
+
{}
|
|
946
|
+
),
|
|
947
|
+
[props]
|
|
948
|
+
);
|
|
949
|
+
}
|
|
935
950
|
function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
936
951
|
const theme2 = (0, import_react_better_core.useTheme)();
|
|
937
952
|
const [isOpen, setIsOpen] = (0, import_react_better_core.useBooleanState)();
|
|
@@ -1405,7 +1420,14 @@ var Text_default = Text2;
|
|
|
1405
1420
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1406
1421
|
var Divider_default = {
|
|
1407
1422
|
vertical: (0, import_react3.memo)(
|
|
1408
|
-
(0, import_react3.forwardRef)(function Divider(
|
|
1423
|
+
(0, import_react3.forwardRef)(function Divider(dividerProps, ref) {
|
|
1424
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
1425
|
+
const {
|
|
1426
|
+
width = 1,
|
|
1427
|
+
backgroundColor,
|
|
1428
|
+
height,
|
|
1429
|
+
...props
|
|
1430
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.divider?.style?.vertical, dividerProps);
|
|
1409
1431
|
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
1410
1432
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1411
1433
|
Div_default,
|
|
@@ -1421,11 +1443,35 @@ var Divider_default = {
|
|
|
1421
1443
|
})
|
|
1422
1444
|
),
|
|
1423
1445
|
horizontal: (0, import_react3.memo)(
|
|
1424
|
-
(0, import_react3.forwardRef)(function Divider2(
|
|
1446
|
+
(0, import_react3.forwardRef)(function Divider2(dividerProps, ref) {
|
|
1447
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
1448
|
+
const {
|
|
1449
|
+
width = 1,
|
|
1450
|
+
backgroundColor,
|
|
1451
|
+
text,
|
|
1452
|
+
textFontFamily,
|
|
1453
|
+
textFontSize,
|
|
1454
|
+
textFontWeight,
|
|
1455
|
+
textTransform,
|
|
1456
|
+
textLetterSpacing,
|
|
1457
|
+
textColor,
|
|
1458
|
+
...props
|
|
1459
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.divider?.style?.horizontal, dividerProps);
|
|
1425
1460
|
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
1426
1461
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
|
|
1427
1462
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
|
|
1428
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1463
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1464
|
+
Text_default,
|
|
1465
|
+
{
|
|
1466
|
+
fontFamily: textFontFamily,
|
|
1467
|
+
fontSize: textFontSize,
|
|
1468
|
+
fontWeight: textFontWeight,
|
|
1469
|
+
textTransform,
|
|
1470
|
+
letterSpacing: textLetterSpacing,
|
|
1471
|
+
color: textColor ?? theme2.colors.textSecondary,
|
|
1472
|
+
children: text
|
|
1473
|
+
}
|
|
1474
|
+
),
|
|
1429
1475
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
|
|
1430
1476
|
] });
|
|
1431
1477
|
})
|
|
@@ -2037,39 +2083,40 @@ var ButtonElement = import_styled_components6.default.button.withConfig({
|
|
|
2037
2083
|
${(props) => props.hoverStyle}
|
|
2038
2084
|
}
|
|
2039
2085
|
`;
|
|
2040
|
-
var ButtonComponent = function Button({
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2086
|
+
var ButtonComponent = function Button(buttonProps) {
|
|
2087
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2088
|
+
const {
|
|
2089
|
+
href,
|
|
2090
|
+
text,
|
|
2091
|
+
value,
|
|
2092
|
+
download,
|
|
2093
|
+
target,
|
|
2094
|
+
icon,
|
|
2095
|
+
iconPosition = "left",
|
|
2096
|
+
iconColor,
|
|
2097
|
+
iconSize,
|
|
2098
|
+
image,
|
|
2099
|
+
imagePosition = "left",
|
|
2100
|
+
imageWidth,
|
|
2101
|
+
imageHeight,
|
|
2102
|
+
loaderName,
|
|
2103
|
+
loaderSize,
|
|
2104
|
+
isLoading,
|
|
2105
|
+
disabled,
|
|
2106
|
+
isSmall,
|
|
2107
|
+
isSubmit,
|
|
2108
|
+
onClick,
|
|
2109
|
+
onClickWithValue,
|
|
2110
|
+
...props
|
|
2111
|
+
} = useComponentsPropsMerger(
|
|
2112
|
+
betterHtmlContextInternal.components.button?.style?.default,
|
|
2113
|
+
buttonProps
|
|
2114
|
+
);
|
|
2064
2115
|
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2065
2116
|
const isLoadingHook = (0, import_react_better_core9.useLoader)(loaderName);
|
|
2066
|
-
const { components } = useBetterHtmlContextInternal();
|
|
2067
2117
|
const { colorTheme } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
2068
2118
|
const isLoadingElement = isLoading || isLoadingHook;
|
|
2069
|
-
const { style, hoverStyle, restProps } = useComponentPropsGrouper(
|
|
2070
|
-
...components.button?.style?.default,
|
|
2071
|
-
...props
|
|
2072
|
-
});
|
|
2119
|
+
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
2073
2120
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
2074
2121
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
2075
2122
|
const onClickElement = (0, import_react10.useCallback)(
|
|
@@ -2104,8 +2151,8 @@ var ButtonComponent = function Button({
|
|
|
2104
2151
|
height: imageHeight
|
|
2105
2152
|
}
|
|
2106
2153
|
) : void 0;
|
|
2107
|
-
const linkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
2108
|
-
const buttonComponentTag = components.button?.tagReplacement?.buttonComponent ?? "button";
|
|
2154
|
+
const linkComponentTag = betterHtmlContextInternal.components.button?.tagReplacement?.linkComponent ?? "a";
|
|
2155
|
+
const buttonComponentTag = betterHtmlContextInternal.components.button?.tagReplacement?.buttonComponent ?? "button";
|
|
2109
2156
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2110
2157
|
ButtonElement,
|
|
2111
2158
|
{
|
|
@@ -2173,41 +2220,44 @@ var ButtonComponent = function Button({
|
|
|
2173
2220
|
}
|
|
2174
2221
|
);
|
|
2175
2222
|
};
|
|
2176
|
-
ButtonComponent.secondary = function Secondary(
|
|
2223
|
+
ButtonComponent.secondary = function Secondary(buttonProps) {
|
|
2224
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2225
|
+
const { className, ...props } = useComponentsPropsMerger(
|
|
2226
|
+
betterHtmlContextInternal.components.button?.style?.secondary,
|
|
2227
|
+
buttonProps
|
|
2228
|
+
);
|
|
2177
2229
|
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2178
|
-
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2179
2230
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2180
2231
|
ButtonComponent,
|
|
2181
2232
|
{
|
|
2182
|
-
...betterHtmlContext2.components.button?.style?.secondary,
|
|
2183
2233
|
className: `secondary${className ? ` ${className}` : ""}`,
|
|
2184
2234
|
color: theme2.colors.textPrimary,
|
|
2185
2235
|
...props
|
|
2186
2236
|
}
|
|
2187
2237
|
);
|
|
2188
2238
|
};
|
|
2189
|
-
ButtonComponent.destructive = function Destructive(
|
|
2190
|
-
const
|
|
2191
|
-
const
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
{
|
|
2195
|
-
...betterHtmlContext2.components.button?.style?.destructive,
|
|
2196
|
-
backgroundColor: theme2.colors.error,
|
|
2197
|
-
color: theme2.colors.base,
|
|
2198
|
-
...props
|
|
2199
|
-
}
|
|
2239
|
+
ButtonComponent.destructive = function Destructive(buttonProps) {
|
|
2240
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2241
|
+
const props = useComponentsPropsMerger(
|
|
2242
|
+
betterHtmlContextInternal.components.button?.style?.destructive,
|
|
2243
|
+
buttonProps
|
|
2200
2244
|
);
|
|
2245
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ButtonComponent, { backgroundColor: theme2.colors.error, color: theme2.colors.base, ...props });
|
|
2201
2247
|
};
|
|
2202
|
-
ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...
|
|
2248
|
+
ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...buttonProps }) {
|
|
2249
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2250
|
+
const { ...props } = useComponentsPropsMerger(
|
|
2251
|
+
betterHtmlContextInternal.components.button?.style?.icon,
|
|
2252
|
+
buttonProps
|
|
2253
|
+
);
|
|
2203
2254
|
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2204
|
-
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2205
2255
|
const readyButtonSize = buttonSize ?? size + theme2.styles.space;
|
|
2206
2256
|
const backgroundButtonColorReady = backgroundButtonColor ?? theme2.colors.textPrimary;
|
|
2207
2257
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2208
2258
|
ButtonComponent,
|
|
2209
2259
|
{
|
|
2210
|
-
...
|
|
2260
|
+
...betterHtmlContextInternal.components.button?.style?.icon,
|
|
2211
2261
|
width: readyButtonSize,
|
|
2212
2262
|
height: readyButtonSize,
|
|
2213
2263
|
color: theme2.colors.textPrimary,
|
|
@@ -2224,8 +2274,12 @@ ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonC
|
|
|
2224
2274
|
}
|
|
2225
2275
|
);
|
|
2226
2276
|
};
|
|
2227
|
-
ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...
|
|
2228
|
-
const
|
|
2277
|
+
ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...buttonProps }) {
|
|
2278
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2279
|
+
const { ...props } = useComponentsPropsMerger(
|
|
2280
|
+
betterHtmlContextInternal.components.button?.style?.upload,
|
|
2281
|
+
buttonProps
|
|
2282
|
+
);
|
|
2229
2283
|
const onClickElement = (0, import_react10.useCallback)(() => {
|
|
2230
2284
|
const input = document.createElement("input");
|
|
2231
2285
|
input.setAttribute("type", "file");
|
|
@@ -2239,7 +2293,7 @@ ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...props
|
|
|
2239
2293
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2240
2294
|
ButtonComponent,
|
|
2241
2295
|
{
|
|
2242
|
-
...
|
|
2296
|
+
...betterHtmlContextInternal.components.button?.style?.upload,
|
|
2243
2297
|
text: "Upload",
|
|
2244
2298
|
icon: "uploadCloud",
|
|
2245
2299
|
onClick: onClickElement,
|
|
@@ -3518,7 +3572,9 @@ var import_styled_components11 = __toESM(require("styled-components"));
|
|
|
3518
3572
|
var import_react17 = require("react");
|
|
3519
3573
|
var import_react_better_core16 = require("react-better-core");
|
|
3520
3574
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3521
|
-
function Label(
|
|
3575
|
+
function Label(labelProps) {
|
|
3576
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3577
|
+
const { text, required, isError, fontFamily, letterSpacing, textTransform, color, htmlFor } = useComponentsPropsMerger(betterHtmlContextInternal.components.label?.style?.default, labelProps);
|
|
3522
3578
|
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
3523
3579
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3524
3580
|
Text_default,
|
|
@@ -3526,8 +3582,11 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3526
3582
|
as: "label",
|
|
3527
3583
|
width: "fit-content",
|
|
3528
3584
|
height: 16,
|
|
3585
|
+
fontFamily,
|
|
3529
3586
|
fontSize: 14,
|
|
3530
3587
|
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
3588
|
+
letterSpacing,
|
|
3589
|
+
textTransform,
|
|
3531
3590
|
htmlFor,
|
|
3532
3591
|
"aria-required": required,
|
|
3533
3592
|
children: [
|
|
@@ -3547,35 +3606,43 @@ var import_react18 = require("react");
|
|
|
3547
3606
|
var import_react_better_core17 = require("react-better-core");
|
|
3548
3607
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3549
3608
|
var import_react19 = require("react");
|
|
3550
|
-
var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3609
|
+
var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown(dropdownProps, ref) {
|
|
3610
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3611
|
+
const {
|
|
3612
|
+
label,
|
|
3613
|
+
labelFontFamily,
|
|
3614
|
+
labelLetterSpacing,
|
|
3615
|
+
labelTextTransform,
|
|
3616
|
+
labelColor,
|
|
3617
|
+
errorText,
|
|
3618
|
+
infoText,
|
|
3619
|
+
required,
|
|
3620
|
+
name,
|
|
3621
|
+
disabled,
|
|
3622
|
+
options,
|
|
3623
|
+
value: controlledValue,
|
|
3624
|
+
defaultValue,
|
|
3625
|
+
placeholder,
|
|
3626
|
+
leftIcon,
|
|
3627
|
+
inputFieldClassName,
|
|
3628
|
+
withSearch,
|
|
3629
|
+
withDebounce,
|
|
3630
|
+
debounceDelay = 0.5,
|
|
3631
|
+
debounceIsLoading,
|
|
3632
|
+
debounceMinimumSymbolsRequired,
|
|
3633
|
+
withoutClearButton,
|
|
3634
|
+
withoutRenderingOptionsWhenClosed,
|
|
3635
|
+
onChange,
|
|
3636
|
+
onChangeSearch,
|
|
3637
|
+
renderOption,
|
|
3638
|
+
renderOptionDivider,
|
|
3639
|
+
withMultiselect,
|
|
3640
|
+
id,
|
|
3641
|
+
...props
|
|
3642
|
+
} = useComponentsPropsMerger(
|
|
3643
|
+
betterHtmlContextInternal.components.dropdown?.style?.default,
|
|
3644
|
+
dropdownProps
|
|
3645
|
+
);
|
|
3579
3646
|
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3580
3647
|
const inputFieldHolderRef = (0, import_react18.useRef)(null);
|
|
3581
3648
|
const buttonsRef = (0, import_react18.useRef)(null);
|
|
@@ -3785,6 +3852,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3785
3852
|
InputField_default,
|
|
3786
3853
|
{
|
|
3787
3854
|
label,
|
|
3855
|
+
labelFontFamily,
|
|
3856
|
+
labelLetterSpacing,
|
|
3857
|
+
labelTextTransform,
|
|
3788
3858
|
labelColor,
|
|
3789
3859
|
errorText,
|
|
3790
3860
|
infoText,
|
|
@@ -3928,7 +3998,12 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3928
3998
|
}
|
|
3929
3999
|
) });
|
|
3930
4000
|
});
|
|
3931
|
-
DropdownComponent.countries = (0, import_react18.forwardRef)(function Countries(
|
|
4001
|
+
DropdownComponent.countries = (0, import_react18.forwardRef)(function Countries(dropdownProps, ref) {
|
|
4002
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4003
|
+
const props = useComponentsPropsMerger(
|
|
4004
|
+
betterHtmlContextInternal.components.dropdown?.style?.countries,
|
|
4005
|
+
dropdownProps
|
|
4006
|
+
);
|
|
3932
4007
|
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3933
4008
|
const renderOption = (0, import_react18.useCallback)(
|
|
3934
4009
|
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
@@ -4347,30 +4422,35 @@ var TextareaElement = import_styled_components11.default.textarea.withConfig({
|
|
|
4347
4422
|
`;
|
|
4348
4423
|
var hours = Array.from({ length: 24 }, (_, index) => index);
|
|
4349
4424
|
var minutes = Array.from({ length: 60 }, (_, index) => index);
|
|
4350
|
-
var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4425
|
+
var InputFieldComponent = (0, import_react21.forwardRef)(function InputField(inputFieldProps, ref) {
|
|
4426
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4427
|
+
const {
|
|
4428
|
+
label,
|
|
4429
|
+
labelFontFamily,
|
|
4430
|
+
labelLetterSpacing,
|
|
4431
|
+
labelTextTransform,
|
|
4432
|
+
labelColor,
|
|
4433
|
+
errorText,
|
|
4434
|
+
infoText,
|
|
4435
|
+
leftIcon,
|
|
4436
|
+
rightIcon,
|
|
4437
|
+
prefix,
|
|
4438
|
+
prefixBackgroundColor,
|
|
4439
|
+
suffix,
|
|
4440
|
+
suffixBackgroundColor,
|
|
4441
|
+
insideInputFieldBeforeComponent,
|
|
4442
|
+
insideInputFieldAfterComponent,
|
|
4443
|
+
withDebounce,
|
|
4444
|
+
debounceDelay = 0.5,
|
|
4445
|
+
onChange,
|
|
4446
|
+
onChangeValue,
|
|
4447
|
+
onClickRightIcon,
|
|
4448
|
+
holderRef,
|
|
4449
|
+
required,
|
|
4450
|
+
placeholder,
|
|
4451
|
+
id,
|
|
4452
|
+
...props
|
|
4453
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.inputField?.style?.default, inputFieldProps);
|
|
4374
4454
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4375
4455
|
const internalId = (0, import_react21.useId)();
|
|
4376
4456
|
const { colorTheme } = (0, import_react_better_core19.useBetterCoreContext)();
|
|
@@ -4406,7 +4486,19 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4406
4486
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4407
4487
|
const readyId = id ?? internalId;
|
|
4408
4488
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4409
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4489
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4490
|
+
Label_default,
|
|
4491
|
+
{
|
|
4492
|
+
text: label,
|
|
4493
|
+
fontFamily: labelFontFamily,
|
|
4494
|
+
letterSpacing: labelLetterSpacing,
|
|
4495
|
+
textTransform: labelTextTransform,
|
|
4496
|
+
color: labelColor,
|
|
4497
|
+
required,
|
|
4498
|
+
isError: !!errorText,
|
|
4499
|
+
htmlFor: readyId
|
|
4500
|
+
}
|
|
4501
|
+
),
|
|
4410
4502
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4411
4503
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4412
4504
|
Div_default.row,
|
|
@@ -4508,20 +4600,29 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4508
4600
|
)
|
|
4509
4601
|
] });
|
|
4510
4602
|
});
|
|
4511
|
-
InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multiline({
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4603
|
+
InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multiline(inputFieldProps, ref) {
|
|
4604
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4605
|
+
const {
|
|
4606
|
+
label,
|
|
4607
|
+
labelFontFamily,
|
|
4608
|
+
labelLetterSpacing,
|
|
4609
|
+
labelTextTransform,
|
|
4610
|
+
labelColor,
|
|
4611
|
+
placeholder,
|
|
4612
|
+
errorText,
|
|
4613
|
+
infoText,
|
|
4614
|
+
leftIcon,
|
|
4615
|
+
rightIcon,
|
|
4616
|
+
onChange,
|
|
4617
|
+
onChangeValue,
|
|
4618
|
+
onClickRightIcon,
|
|
4619
|
+
required,
|
|
4620
|
+
id,
|
|
4621
|
+
...props
|
|
4622
|
+
} = useComponentsPropsMerger(
|
|
4623
|
+
betterHtmlContextInternal.components.inputField?.style?.multiline,
|
|
4624
|
+
inputFieldProps
|
|
4625
|
+
);
|
|
4525
4626
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4526
4627
|
const internalId = (0, import_react21.useId)();
|
|
4527
4628
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
@@ -4536,7 +4637,19 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4536
4637
|
);
|
|
4537
4638
|
const readyId = id ?? internalId;
|
|
4538
4639
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
4539
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4640
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4641
|
+
Label_default,
|
|
4642
|
+
{
|
|
4643
|
+
text: label,
|
|
4644
|
+
fontFamily: labelFontFamily,
|
|
4645
|
+
letterSpacing: labelLetterSpacing,
|
|
4646
|
+
textTransform: labelTextTransform,
|
|
4647
|
+
color: labelColor,
|
|
4648
|
+
required,
|
|
4649
|
+
isError: !!errorText,
|
|
4650
|
+
htmlFor: readyId
|
|
4651
|
+
}
|
|
4652
|
+
),
|
|
4540
4653
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
4541
4654
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4542
4655
|
Icon_default,
|
|
@@ -4595,14 +4708,19 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4595
4708
|
as: "span",
|
|
4596
4709
|
display: "block",
|
|
4597
4710
|
marginTop: theme2.styles.gap / 2,
|
|
4598
|
-
color: errorText ? theme2.colors.error :
|
|
4711
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4599
4712
|
fontSize: 14,
|
|
4600
4713
|
children: errorText || infoText
|
|
4601
4714
|
}
|
|
4602
4715
|
)
|
|
4603
4716
|
] });
|
|
4604
4717
|
});
|
|
4605
|
-
InputFieldComponent.email = (0, import_react21.forwardRef)(function Email(
|
|
4718
|
+
InputFieldComponent.email = (0, import_react21.forwardRef)(function Email(inputFieldProps, ref) {
|
|
4719
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4720
|
+
const props = useComponentsPropsMerger(
|
|
4721
|
+
betterHtmlContextInternal.components.inputField?.style?.email,
|
|
4722
|
+
inputFieldProps
|
|
4723
|
+
);
|
|
4606
4724
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4607
4725
|
InputFieldComponent,
|
|
4608
4726
|
{
|
|
@@ -4616,7 +4734,12 @@ InputFieldComponent.email = (0, import_react21.forwardRef)(function Email({ ...p
|
|
|
4616
4734
|
}
|
|
4617
4735
|
);
|
|
4618
4736
|
});
|
|
4619
|
-
InputFieldComponent.password = (0, import_react21.forwardRef)(function Password(
|
|
4737
|
+
InputFieldComponent.password = (0, import_react21.forwardRef)(function Password(inputFieldProps, ref) {
|
|
4738
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4739
|
+
const props = useComponentsPropsMerger(
|
|
4740
|
+
betterHtmlContextInternal.components.inputField?.style?.password,
|
|
4741
|
+
inputFieldProps
|
|
4742
|
+
);
|
|
4620
4743
|
const [isPassword, setIsPassword] = (0, import_react_better_core19.useBooleanState)(true);
|
|
4621
4744
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4622
4745
|
InputFieldComponent,
|
|
@@ -4633,7 +4756,12 @@ InputFieldComponent.password = (0, import_react21.forwardRef)(function Password(
|
|
|
4633
4756
|
}
|
|
4634
4757
|
);
|
|
4635
4758
|
});
|
|
4636
|
-
InputFieldComponent.search = (0, import_react21.forwardRef)(function Search(
|
|
4759
|
+
InputFieldComponent.search = (0, import_react21.forwardRef)(function Search(inputFieldProps, ref) {
|
|
4760
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4761
|
+
const { value, onChangeValue, onFocus, onBlur, ...props } = useComponentsPropsMerger(
|
|
4762
|
+
betterHtmlContextInternal.components.inputField?.style?.search,
|
|
4763
|
+
inputFieldProps
|
|
4764
|
+
);
|
|
4637
4765
|
const [inputFieldValue, setInputFieldValue] = (0, import_react21.useState)(value?.toString() ?? "");
|
|
4638
4766
|
const [inputFieldFocused, setInputFieldFocused] = (0, import_react_better_core19.useBooleanState)();
|
|
4639
4767
|
const onChangeValueElement = (0, import_react21.useCallback)(
|
|
@@ -4676,7 +4804,19 @@ InputFieldComponent.search = (0, import_react21.forwardRef)(function Search({ va
|
|
|
4676
4804
|
}
|
|
4677
4805
|
);
|
|
4678
4806
|
});
|
|
4679
|
-
InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneNumber(
|
|
4807
|
+
InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneNumber(inputFieldProps, ref) {
|
|
4808
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4809
|
+
const {
|
|
4810
|
+
label,
|
|
4811
|
+
labelFontFamily,
|
|
4812
|
+
labelLetterSpacing,
|
|
4813
|
+
labelTextTransform,
|
|
4814
|
+
labelColor,
|
|
4815
|
+
value,
|
|
4816
|
+
onChangeValue,
|
|
4817
|
+
id,
|
|
4818
|
+
...props
|
|
4819
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.inputField?.style?.phoneNumber, inputFieldProps);
|
|
4680
4820
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4681
4821
|
const internalId = (0, import_react21.useId)();
|
|
4682
4822
|
const [dropdownValue, setDropdownValue] = (0, import_react21.useState)();
|
|
@@ -4734,12 +4874,16 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4734
4874
|
setInputFieldValue(newValue.slice(country.phoneNumberExtension.length + 1));
|
|
4735
4875
|
}, [value]);
|
|
4736
4876
|
const readyId = id ?? internalId;
|
|
4877
|
+
const readyLabel = betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.label ?? label;
|
|
4737
4878
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
4738
|
-
|
|
4879
|
+
readyLabel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4739
4880
|
Label_default,
|
|
4740
4881
|
{
|
|
4741
|
-
text:
|
|
4742
|
-
|
|
4882
|
+
text: readyLabel,
|
|
4883
|
+
fontFamily: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelFontFamily ?? labelFontFamily,
|
|
4884
|
+
letterSpacing: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelLetterSpacing ?? labelLetterSpacing,
|
|
4885
|
+
textTransform: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelTextTransform ?? labelTextTransform,
|
|
4886
|
+
color: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelColor ?? labelColor,
|
|
4743
4887
|
required: props.required,
|
|
4744
4888
|
isError: !!props.errorText,
|
|
4745
4889
|
htmlFor: readyId
|
|
@@ -4767,7 +4911,9 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4767
4911
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4768
4912
|
InputFieldComponent,
|
|
4769
4913
|
{
|
|
4770
|
-
|
|
4914
|
+
...betterHtmlContextInternal.components.inputField?.style?.phoneNumber,
|
|
4915
|
+
label: void 0,
|
|
4916
|
+
placeholder: readyLabel ?? "Phone number",
|
|
4771
4917
|
className: "react-better-html-phone-number",
|
|
4772
4918
|
value: inputFieldValue,
|
|
4773
4919
|
onChangeValue: onChangeValueElement,
|
|
@@ -4779,21 +4925,32 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4779
4925
|
] })
|
|
4780
4926
|
] });
|
|
4781
4927
|
});
|
|
4782
|
-
InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDate, maxDate, ...
|
|
4928
|
+
InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDate, maxDate, ...inputFieldProps }, ref) {
|
|
4929
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4930
|
+
const props = useComponentsPropsMerger(
|
|
4931
|
+
betterHtmlContextInternal.components.inputField?.style?.date,
|
|
4932
|
+
inputFieldProps
|
|
4933
|
+
);
|
|
4783
4934
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4784
4935
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4785
4936
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4786
|
-
const {
|
|
4937
|
+
const {
|
|
4938
|
+
internalValue,
|
|
4939
|
+
setInternalValue,
|
|
4940
|
+
inputFieldProps: restInputFieldProps,
|
|
4941
|
+
insideInputFieldComponentProps
|
|
4942
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4787
4943
|
const onChange = (0, import_react21.useCallback)(
|
|
4788
4944
|
(date) => {
|
|
4789
|
-
|
|
4945
|
+
restInputFieldProps.onChangeValue?.(date ?? "");
|
|
4790
4946
|
setInternalValue(date ?? "");
|
|
4791
4947
|
},
|
|
4792
|
-
[
|
|
4948
|
+
[restInputFieldProps.onChangeValue]
|
|
4793
4949
|
);
|
|
4794
4950
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4795
4951
|
InputFieldComponent,
|
|
4796
4952
|
{
|
|
4953
|
+
...betterHtmlContextInternal.components.inputField?.style?.date,
|
|
4797
4954
|
type: "date",
|
|
4798
4955
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4799
4956
|
Div_default,
|
|
@@ -4814,7 +4971,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4814
4971
|
holderRef,
|
|
4815
4972
|
ref,
|
|
4816
4973
|
...props,
|
|
4817
|
-
...
|
|
4974
|
+
...restInputFieldProps
|
|
4818
4975
|
}
|
|
4819
4976
|
);
|
|
4820
4977
|
});
|
|
@@ -4825,14 +4982,25 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4825
4982
|
maxDate,
|
|
4826
4983
|
defaultDateAfterTimePick,
|
|
4827
4984
|
defaultTimeAfterDatePick = "00:00",
|
|
4828
|
-
...
|
|
4985
|
+
...inputFieldProps
|
|
4829
4986
|
}, ref) {
|
|
4987
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4988
|
+
const props = useComponentsPropsMerger(
|
|
4989
|
+
betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
4990
|
+
inputFieldProps
|
|
4991
|
+
);
|
|
4830
4992
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4831
4993
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4832
4994
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4833
4995
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
4834
4996
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4835
|
-
const {
|
|
4997
|
+
const {
|
|
4998
|
+
internalValue,
|
|
4999
|
+
setInternalValue,
|
|
5000
|
+
inputFieldProps: restInputFieldProps,
|
|
5001
|
+
insideInputFieldComponentProps,
|
|
5002
|
+
isOpen
|
|
5003
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4836
5004
|
const readyHours = (0, import_react21.useMemo)(
|
|
4837
5005
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
4838
5006
|
[hoursToRender]
|
|
@@ -4844,10 +5012,10 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4844
5012
|
const onChange = (0, import_react21.useCallback)(
|
|
4845
5013
|
(date) => {
|
|
4846
5014
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
4847
|
-
|
|
5015
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4848
5016
|
setInternalValue(newValue);
|
|
4849
5017
|
},
|
|
4850
|
-
[internalValue, defaultTimeAfterDatePick,
|
|
5018
|
+
[internalValue, defaultTimeAfterDatePick, restInputFieldProps.onChangeValue]
|
|
4851
5019
|
);
|
|
4852
5020
|
const onBlur = (0, import_react21.useCallback)(
|
|
4853
5021
|
(event) => {
|
|
@@ -4860,9 +5028,9 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4860
5028
|
const newTime = `${readyHour.toString().padStart(2, "0")}:${readyMinute.toString().padStart(2, "0")}`;
|
|
4861
5029
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4862
5030
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4863
|
-
|
|
5031
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4864
5032
|
}
|
|
4865
|
-
|
|
5033
|
+
restInputFieldProps.onBlur?.(event);
|
|
4866
5034
|
},
|
|
4867
5035
|
[
|
|
4868
5036
|
defaultDateAfterTimePick,
|
|
@@ -4871,8 +5039,8 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4871
5039
|
minutesToRender,
|
|
4872
5040
|
readyHours,
|
|
4873
5041
|
readyMinutes,
|
|
4874
|
-
|
|
4875
|
-
|
|
5042
|
+
restInputFieldProps.onChangeValue,
|
|
5043
|
+
restInputFieldProps.onBlur
|
|
4876
5044
|
]
|
|
4877
5045
|
);
|
|
4878
5046
|
const onClickHour = (0, import_react21.useCallback)(
|
|
@@ -4880,20 +5048,20 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4880
5048
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
4881
5049
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4882
5050
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4883
|
-
|
|
5051
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4884
5052
|
setInternalValue(newValue);
|
|
4885
5053
|
},
|
|
4886
|
-
[defaultDateAfterTimePick, internalValue,
|
|
5054
|
+
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
4887
5055
|
);
|
|
4888
5056
|
const onClickMinute = (0, import_react21.useCallback)(
|
|
4889
5057
|
(minute) => {
|
|
4890
5058
|
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
4891
5059
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4892
5060
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4893
|
-
|
|
5061
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4894
5062
|
setInternalValue(newValue);
|
|
4895
5063
|
},
|
|
4896
|
-
[defaultDateAfterTimePick, internalValue,
|
|
5064
|
+
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
4897
5065
|
);
|
|
4898
5066
|
(0, import_react21.useEffect)(() => {
|
|
4899
5067
|
if (isOpen && selectedHourRef.current)
|
|
@@ -4907,6 +5075,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4907
5075
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4908
5076
|
InputFieldComponent,
|
|
4909
5077
|
{
|
|
5078
|
+
...betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
4910
5079
|
type: "datetime-local",
|
|
4911
5080
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4912
5081
|
Div_default,
|
|
@@ -5010,12 +5179,17 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5010
5179
|
holderRef,
|
|
5011
5180
|
ref,
|
|
5012
5181
|
...props,
|
|
5013
|
-
...
|
|
5182
|
+
...restInputFieldProps,
|
|
5014
5183
|
onBlur
|
|
5015
5184
|
}
|
|
5016
5185
|
);
|
|
5017
5186
|
});
|
|
5018
|
-
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursToRender, minutesToRender, minTime, maxTime, ...
|
|
5187
|
+
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursToRender, minutesToRender, minTime, maxTime, ...inputFieldProps }, ref) {
|
|
5188
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5189
|
+
const props = useComponentsPropsMerger(
|
|
5190
|
+
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5191
|
+
inputFieldProps
|
|
5192
|
+
);
|
|
5019
5193
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
5020
5194
|
const holderRef = (0, import_react21.useRef)(null);
|
|
5021
5195
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
@@ -5025,7 +5199,13 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5025
5199
|
const minMinutes = minTime ? parseInt(minTime.split(":")[1]) : void 0;
|
|
5026
5200
|
const maxHours = maxTime ? parseInt(maxTime.split(":")[0]) : void 0;
|
|
5027
5201
|
const maxMinutes = maxTime ? parseInt(maxTime.split(":")[1]) : void 0;
|
|
5028
|
-
const {
|
|
5202
|
+
const {
|
|
5203
|
+
internalValue,
|
|
5204
|
+
setInternalValue,
|
|
5205
|
+
inputFieldProps: restInputFieldProps,
|
|
5206
|
+
insideInputFieldComponentProps,
|
|
5207
|
+
isOpen
|
|
5208
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5029
5209
|
const readyHours = (0, import_react21.useMemo)(
|
|
5030
5210
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
5031
5211
|
[hoursToRender]
|
|
@@ -5045,9 +5225,9 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5045
5225
|
const finalHour = minHours && readyHour < minHours ? minHours : maxHours && readyHour > maxHours ? maxHours : readyHour;
|
|
5046
5226
|
const finalMinute = !!minHours && !!minMinutes && finalHour === minHours && readyMinute < minMinutes ? minMinutes : !!maxHours && !!maxMinutes && finalHour === maxHours && readyMinute > maxMinutes ? maxMinutes : readyMinute;
|
|
5047
5227
|
const newValue = `${finalHour.toString().padStart(2, "0")}:${finalMinute.toString().padStart(2, "0")}`;
|
|
5048
|
-
|
|
5228
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
5049
5229
|
}
|
|
5050
|
-
|
|
5230
|
+
restInputFieldProps.onBlur?.(event);
|
|
5051
5231
|
},
|
|
5052
5232
|
[
|
|
5053
5233
|
minHours,
|
|
@@ -5058,25 +5238,25 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5058
5238
|
minutesToRender,
|
|
5059
5239
|
readyHours,
|
|
5060
5240
|
readyMinutes,
|
|
5061
|
-
|
|
5062
|
-
|
|
5241
|
+
restInputFieldProps.onChangeValue,
|
|
5242
|
+
restInputFieldProps.onBlur
|
|
5063
5243
|
]
|
|
5064
5244
|
);
|
|
5065
5245
|
const onClickHour = (0, import_react21.useCallback)(
|
|
5066
5246
|
(hour) => {
|
|
5067
5247
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5068
|
-
|
|
5248
|
+
restInputFieldProps.onChangeValue?.(value);
|
|
5069
5249
|
setInternalValue(value);
|
|
5070
5250
|
},
|
|
5071
|
-
[internalValue,
|
|
5251
|
+
[internalValue, restInputFieldProps.onChangeValue]
|
|
5072
5252
|
);
|
|
5073
5253
|
const onClickMinute = (0, import_react21.useCallback)(
|
|
5074
5254
|
(minute) => {
|
|
5075
5255
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5076
|
-
|
|
5256
|
+
restInputFieldProps.onChangeValue?.(value);
|
|
5077
5257
|
setInternalValue(value);
|
|
5078
5258
|
},
|
|
5079
|
-
[internalValue,
|
|
5259
|
+
[internalValue, restInputFieldProps.onChangeValue]
|
|
5080
5260
|
);
|
|
5081
5261
|
(0, import_react21.useEffect)(() => {
|
|
5082
5262
|
if (isOpen && selectedHourRef.current)
|
|
@@ -5089,6 +5269,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5089
5269
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5090
5270
|
InputFieldComponent,
|
|
5091
5271
|
{
|
|
5272
|
+
...betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5092
5273
|
type: "time",
|
|
5093
5274
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5094
5275
|
Div_default,
|
|
@@ -5177,13 +5358,18 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5177
5358
|
holderRef,
|
|
5178
5359
|
ref,
|
|
5179
5360
|
...props,
|
|
5180
|
-
...
|
|
5361
|
+
...restInputFieldProps,
|
|
5181
5362
|
minWidth: buttonWidth * 2 + 2,
|
|
5182
5363
|
onBlur
|
|
5183
5364
|
}
|
|
5184
5365
|
);
|
|
5185
5366
|
});
|
|
5186
|
-
InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4(
|
|
5367
|
+
InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4(inputFieldProps, ref) {
|
|
5368
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5369
|
+
const { value, onChangeValue, ...props } = useComponentsPropsMerger(
|
|
5370
|
+
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5371
|
+
inputFieldProps
|
|
5372
|
+
);
|
|
5187
5373
|
const [inputFieldValue, setInputFieldValue] = (0, import_react21.useState)(value ?? "#000000");
|
|
5188
5374
|
const onChangeValueElement = (0, import_react21.useCallback)(
|
|
5189
5375
|
(value2) => {
|
|
@@ -5199,6 +5385,7 @@ InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4({ val
|
|
|
5199
5385
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5200
5386
|
InputFieldComponent,
|
|
5201
5387
|
{
|
|
5388
|
+
...betterHtmlContextInternal.components.inputField?.style?.color,
|
|
5202
5389
|
type: "color",
|
|
5203
5390
|
insideInputFieldAfterComponent: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5204
5391
|
Div_default.row,
|
|
@@ -5333,8 +5520,14 @@ var SwitchElement = import_styled_components12.default.div.withConfig({
|
|
|
5333
5520
|
`;
|
|
5334
5521
|
var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
5335
5522
|
label,
|
|
5523
|
+
labelFontFamily,
|
|
5524
|
+
labelLetterSpacing,
|
|
5525
|
+
labelTextTransform,
|
|
5336
5526
|
labelColor,
|
|
5337
5527
|
text,
|
|
5528
|
+
textFontFamily,
|
|
5529
|
+
textLetterSpacing,
|
|
5530
|
+
textTextTransform,
|
|
5338
5531
|
textAdvanced,
|
|
5339
5532
|
errorText,
|
|
5340
5533
|
infoText,
|
|
@@ -5368,7 +5561,19 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5368
5561
|
}, [checked, controlledChecked, onChange, value]);
|
|
5369
5562
|
const readyId = id ?? internalId;
|
|
5370
5563
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5371
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5564
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5565
|
+
Label_default,
|
|
5566
|
+
{
|
|
5567
|
+
text: label,
|
|
5568
|
+
fontFamily: labelFontFamily,
|
|
5569
|
+
letterSpacing: labelLetterSpacing,
|
|
5570
|
+
textTransform: labelTextTransform,
|
|
5571
|
+
color: labelColor,
|
|
5572
|
+
required,
|
|
5573
|
+
isError: !!errorText,
|
|
5574
|
+
htmlFor: readyId
|
|
5575
|
+
}
|
|
5576
|
+
),
|
|
5372
5577
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5373
5578
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5374
5579
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -5416,13 +5621,25 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5416
5621
|
}
|
|
5417
5622
|
) : void 0
|
|
5418
5623
|
] }),
|
|
5419
|
-
text ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5624
|
+
text ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5625
|
+
Text_default,
|
|
5626
|
+
{
|
|
5627
|
+
fontFamily: textFontFamily,
|
|
5628
|
+
letterSpacing: textLetterSpacing,
|
|
5629
|
+
textTransform: textTextTransform,
|
|
5630
|
+
color,
|
|
5631
|
+
userSelect: "none",
|
|
5632
|
+
cursor: "pointer",
|
|
5633
|
+
onClick: onClickText,
|
|
5634
|
+
children: [
|
|
5635
|
+
text,
|
|
5636
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5637
|
+
" ",
|
|
5638
|
+
"*"
|
|
5639
|
+
] })
|
|
5640
|
+
]
|
|
5641
|
+
}
|
|
5642
|
+
) : textAdvanced ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5426
5643
|
textAdvanced,
|
|
5427
5644
|
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5428
5645
|
" ",
|
|
@@ -5443,25 +5660,43 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5443
5660
|
] });
|
|
5444
5661
|
});
|
|
5445
5662
|
var ToggleInput_default = {
|
|
5446
|
-
checkbox: (0, import_react22.forwardRef)(function Checkbox(
|
|
5663
|
+
checkbox: (0, import_react22.forwardRef)(function Checkbox(checkboxProps, ref) {
|
|
5664
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5665
|
+
const props = useComponentsPropsMerger(
|
|
5666
|
+
betterHtmlContextInternal.components.toggleInput?.style?.checkbox,
|
|
5667
|
+
checkboxProps
|
|
5668
|
+
);
|
|
5447
5669
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5448
5670
|
}),
|
|
5449
|
-
radiobutton: (0, import_react22.forwardRef)(function RadioButton(
|
|
5671
|
+
radiobutton: (0, import_react22.forwardRef)(function RadioButton(radiobuttonProps, ref) {
|
|
5672
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5673
|
+
const props = useComponentsPropsMerger(
|
|
5674
|
+
betterHtmlContextInternal.components.toggleInput?.style?.radiobutton,
|
|
5675
|
+
radiobuttonProps
|
|
5676
|
+
);
|
|
5450
5677
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5451
5678
|
}),
|
|
5452
|
-
switch: (0, import_react22.forwardRef)(function Switch({
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5679
|
+
switch: (0, import_react22.forwardRef)(function Switch(switchProps, ref) {
|
|
5680
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5681
|
+
const {
|
|
5682
|
+
label,
|
|
5683
|
+
labelFontFamily,
|
|
5684
|
+
labelLetterSpacing,
|
|
5685
|
+
labelTextTransform,
|
|
5686
|
+
labelColor,
|
|
5687
|
+
errorText,
|
|
5688
|
+
infoText,
|
|
5689
|
+
disabled,
|
|
5690
|
+
value,
|
|
5691
|
+
onChange,
|
|
5692
|
+
checked: controlledChecked,
|
|
5693
|
+
required,
|
|
5694
|
+
id,
|
|
5695
|
+
...props
|
|
5696
|
+
} = useComponentsPropsMerger(
|
|
5697
|
+
betterHtmlContextInternal.components.toggleInput?.style?.switch,
|
|
5698
|
+
switchProps
|
|
5699
|
+
);
|
|
5465
5700
|
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5466
5701
|
const internalId = (0, import_react22.useId)();
|
|
5467
5702
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
@@ -5478,7 +5713,19 @@ var ToggleInput_default = {
|
|
|
5478
5713
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5479
5714
|
const readyId = id ?? internalId;
|
|
5480
5715
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5481
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5716
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5717
|
+
Label_default,
|
|
5718
|
+
{
|
|
5719
|
+
text: label,
|
|
5720
|
+
fontFamily: labelFontFamily,
|
|
5721
|
+
letterSpacing: labelLetterSpacing,
|
|
5722
|
+
textTransform: labelTextTransform,
|
|
5723
|
+
color: labelColor,
|
|
5724
|
+
required,
|
|
5725
|
+
isError: !!errorText,
|
|
5726
|
+
htmlFor: readyId
|
|
5727
|
+
}
|
|
5728
|
+
),
|
|
5482
5729
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5483
5730
|
Div_default.row,
|
|
5484
5731
|
{
|