react-better-html 1.1.238 → 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 +448 -211
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +448 -211
- 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,
|
|
@@ -3381,7 +3435,7 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3381
3435
|
position: "relative",
|
|
3382
3436
|
width: "100%",
|
|
3383
3437
|
minHeight: "100svh",
|
|
3384
|
-
alignItems: "center",
|
|
3438
|
+
alignItems: height !== "100%" ? "center" : void 0,
|
|
3385
3439
|
justifyContent: "center",
|
|
3386
3440
|
backgroundColor: pageBackgroundColor,
|
|
3387
3441
|
backgroundImage: pageBackgroundImage,
|
|
@@ -3400,29 +3454,19 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3400
3454
|
}
|
|
3401
3455
|
),
|
|
3402
3456
|
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default, { width: "50%" }),
|
|
3403
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3404
|
-
|
|
3457
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3458
|
+
ContentTag,
|
|
3405
3459
|
{
|
|
3406
|
-
|
|
3407
|
-
|
|
3460
|
+
width: `calc(100% - ${((props.margin ?? props.marginInline) !== void 0 ? parseFloat((props.margin ?? props.marginInline)?.toString() ?? "") : theme2.styles.space) * 2}px)`,
|
|
3461
|
+
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3408
3462
|
height,
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3415
|
-
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3416
|
-
height,
|
|
3417
|
-
marginInline: theme2.styles.space,
|
|
3418
|
-
marginBlock: theme2.styles.space,
|
|
3419
|
-
...props,
|
|
3420
|
-
ref,
|
|
3421
|
-
children
|
|
3422
|
-
}
|
|
3423
|
-
)
|
|
3463
|
+
marginInline: theme2.styles.space,
|
|
3464
|
+
marginBlock: theme2.styles.space,
|
|
3465
|
+
...props,
|
|
3466
|
+
ref,
|
|
3467
|
+
children
|
|
3424
3468
|
}
|
|
3425
|
-
),
|
|
3469
|
+
) }),
|
|
3426
3470
|
sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default, { width: "50%" }),
|
|
3427
3471
|
withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3428
3472
|
Div_default,
|
|
@@ -3528,7 +3572,9 @@ var import_styled_components11 = __toESM(require("styled-components"));
|
|
|
3528
3572
|
var import_react17 = require("react");
|
|
3529
3573
|
var import_react_better_core16 = require("react-better-core");
|
|
3530
3574
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3531
|
-
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);
|
|
3532
3578
|
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
3533
3579
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3534
3580
|
Text_default,
|
|
@@ -3536,8 +3582,11 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3536
3582
|
as: "label",
|
|
3537
3583
|
width: "fit-content",
|
|
3538
3584
|
height: 16,
|
|
3585
|
+
fontFamily,
|
|
3539
3586
|
fontSize: 14,
|
|
3540
3587
|
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
3588
|
+
letterSpacing,
|
|
3589
|
+
textTransform,
|
|
3541
3590
|
htmlFor,
|
|
3542
3591
|
"aria-required": required,
|
|
3543
3592
|
children: [
|
|
@@ -3557,35 +3606,43 @@ var import_react18 = require("react");
|
|
|
3557
3606
|
var import_react_better_core17 = require("react-better-core");
|
|
3558
3607
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3559
3608
|
var import_react19 = require("react");
|
|
3560
|
-
var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
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
|
+
);
|
|
3589
3646
|
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3590
3647
|
const inputFieldHolderRef = (0, import_react18.useRef)(null);
|
|
3591
3648
|
const buttonsRef = (0, import_react18.useRef)(null);
|
|
@@ -3795,6 +3852,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3795
3852
|
InputField_default,
|
|
3796
3853
|
{
|
|
3797
3854
|
label,
|
|
3855
|
+
labelFontFamily,
|
|
3856
|
+
labelLetterSpacing,
|
|
3857
|
+
labelTextTransform,
|
|
3798
3858
|
labelColor,
|
|
3799
3859
|
errorText,
|
|
3800
3860
|
infoText,
|
|
@@ -3938,7 +3998,12 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3938
3998
|
}
|
|
3939
3999
|
) });
|
|
3940
4000
|
});
|
|
3941
|
-
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
|
+
);
|
|
3942
4007
|
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3943
4008
|
const renderOption = (0, import_react18.useCallback)(
|
|
3944
4009
|
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
@@ -4357,30 +4422,35 @@ var TextareaElement = import_styled_components11.default.textarea.withConfig({
|
|
|
4357
4422
|
`;
|
|
4358
4423
|
var hours = Array.from({ length: 24 }, (_, index) => index);
|
|
4359
4424
|
var minutes = Array.from({ length: 60 }, (_, index) => index);
|
|
4360
|
-
var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
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);
|
|
4384
4454
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4385
4455
|
const internalId = (0, import_react21.useId)();
|
|
4386
4456
|
const { colorTheme } = (0, import_react_better_core19.useBetterCoreContext)();
|
|
@@ -4416,7 +4486,19 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4416
4486
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4417
4487
|
const readyId = id ?? internalId;
|
|
4418
4488
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4419
|
-
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
|
+
),
|
|
4420
4502
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4421
4503
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4422
4504
|
Div_default.row,
|
|
@@ -4518,20 +4600,29 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4518
4600
|
)
|
|
4519
4601
|
] });
|
|
4520
4602
|
});
|
|
4521
|
-
InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multiline({
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
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
|
+
);
|
|
4535
4626
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4536
4627
|
const internalId = (0, import_react21.useId)();
|
|
4537
4628
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
@@ -4546,7 +4637,19 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4546
4637
|
);
|
|
4547
4638
|
const readyId = id ?? internalId;
|
|
4548
4639
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
4549
|
-
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
|
+
),
|
|
4550
4653
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
4551
4654
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4552
4655
|
Icon_default,
|
|
@@ -4605,14 +4708,19 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4605
4708
|
as: "span",
|
|
4606
4709
|
display: "block",
|
|
4607
4710
|
marginTop: theme2.styles.gap / 2,
|
|
4608
|
-
color: errorText ? theme2.colors.error :
|
|
4711
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4609
4712
|
fontSize: 14,
|
|
4610
4713
|
children: errorText || infoText
|
|
4611
4714
|
}
|
|
4612
4715
|
)
|
|
4613
4716
|
] });
|
|
4614
4717
|
});
|
|
4615
|
-
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
|
+
);
|
|
4616
4724
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4617
4725
|
InputFieldComponent,
|
|
4618
4726
|
{
|
|
@@ -4626,7 +4734,12 @@ InputFieldComponent.email = (0, import_react21.forwardRef)(function Email({ ...p
|
|
|
4626
4734
|
}
|
|
4627
4735
|
);
|
|
4628
4736
|
});
|
|
4629
|
-
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
|
+
);
|
|
4630
4743
|
const [isPassword, setIsPassword] = (0, import_react_better_core19.useBooleanState)(true);
|
|
4631
4744
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4632
4745
|
InputFieldComponent,
|
|
@@ -4643,7 +4756,12 @@ InputFieldComponent.password = (0, import_react21.forwardRef)(function Password(
|
|
|
4643
4756
|
}
|
|
4644
4757
|
);
|
|
4645
4758
|
});
|
|
4646
|
-
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
|
+
);
|
|
4647
4765
|
const [inputFieldValue, setInputFieldValue] = (0, import_react21.useState)(value?.toString() ?? "");
|
|
4648
4766
|
const [inputFieldFocused, setInputFieldFocused] = (0, import_react_better_core19.useBooleanState)();
|
|
4649
4767
|
const onChangeValueElement = (0, import_react21.useCallback)(
|
|
@@ -4686,7 +4804,19 @@ InputFieldComponent.search = (0, import_react21.forwardRef)(function Search({ va
|
|
|
4686
4804
|
}
|
|
4687
4805
|
);
|
|
4688
4806
|
});
|
|
4689
|
-
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);
|
|
4690
4820
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4691
4821
|
const internalId = (0, import_react21.useId)();
|
|
4692
4822
|
const [dropdownValue, setDropdownValue] = (0, import_react21.useState)();
|
|
@@ -4744,12 +4874,16 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4744
4874
|
setInputFieldValue(newValue.slice(country.phoneNumberExtension.length + 1));
|
|
4745
4875
|
}, [value]);
|
|
4746
4876
|
const readyId = id ?? internalId;
|
|
4877
|
+
const readyLabel = betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.label ?? label;
|
|
4747
4878
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
4748
|
-
|
|
4879
|
+
readyLabel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4749
4880
|
Label_default,
|
|
4750
4881
|
{
|
|
4751
|
-
text:
|
|
4752
|
-
|
|
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,
|
|
4753
4887
|
required: props.required,
|
|
4754
4888
|
isError: !!props.errorText,
|
|
4755
4889
|
htmlFor: readyId
|
|
@@ -4777,7 +4911,9 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4777
4911
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4778
4912
|
InputFieldComponent,
|
|
4779
4913
|
{
|
|
4780
|
-
|
|
4914
|
+
...betterHtmlContextInternal.components.inputField?.style?.phoneNumber,
|
|
4915
|
+
label: void 0,
|
|
4916
|
+
placeholder: readyLabel ?? "Phone number",
|
|
4781
4917
|
className: "react-better-html-phone-number",
|
|
4782
4918
|
value: inputFieldValue,
|
|
4783
4919
|
onChangeValue: onChangeValueElement,
|
|
@@ -4789,21 +4925,32 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4789
4925
|
] })
|
|
4790
4926
|
] });
|
|
4791
4927
|
});
|
|
4792
|
-
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
|
+
);
|
|
4793
4934
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4794
4935
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4795
4936
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4796
|
-
const {
|
|
4937
|
+
const {
|
|
4938
|
+
internalValue,
|
|
4939
|
+
setInternalValue,
|
|
4940
|
+
inputFieldProps: restInputFieldProps,
|
|
4941
|
+
insideInputFieldComponentProps
|
|
4942
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4797
4943
|
const onChange = (0, import_react21.useCallback)(
|
|
4798
4944
|
(date) => {
|
|
4799
|
-
|
|
4945
|
+
restInputFieldProps.onChangeValue?.(date ?? "");
|
|
4800
4946
|
setInternalValue(date ?? "");
|
|
4801
4947
|
},
|
|
4802
|
-
[
|
|
4948
|
+
[restInputFieldProps.onChangeValue]
|
|
4803
4949
|
);
|
|
4804
4950
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4805
4951
|
InputFieldComponent,
|
|
4806
4952
|
{
|
|
4953
|
+
...betterHtmlContextInternal.components.inputField?.style?.date,
|
|
4807
4954
|
type: "date",
|
|
4808
4955
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4809
4956
|
Div_default,
|
|
@@ -4824,7 +4971,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4824
4971
|
holderRef,
|
|
4825
4972
|
ref,
|
|
4826
4973
|
...props,
|
|
4827
|
-
...
|
|
4974
|
+
...restInputFieldProps
|
|
4828
4975
|
}
|
|
4829
4976
|
);
|
|
4830
4977
|
});
|
|
@@ -4835,14 +4982,25 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4835
4982
|
maxDate,
|
|
4836
4983
|
defaultDateAfterTimePick,
|
|
4837
4984
|
defaultTimeAfterDatePick = "00:00",
|
|
4838
|
-
...
|
|
4985
|
+
...inputFieldProps
|
|
4839
4986
|
}, ref) {
|
|
4987
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4988
|
+
const props = useComponentsPropsMerger(
|
|
4989
|
+
betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
4990
|
+
inputFieldProps
|
|
4991
|
+
);
|
|
4840
4992
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4841
4993
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4842
4994
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4843
4995
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
4844
4996
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4845
|
-
const {
|
|
4997
|
+
const {
|
|
4998
|
+
internalValue,
|
|
4999
|
+
setInternalValue,
|
|
5000
|
+
inputFieldProps: restInputFieldProps,
|
|
5001
|
+
insideInputFieldComponentProps,
|
|
5002
|
+
isOpen
|
|
5003
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4846
5004
|
const readyHours = (0, import_react21.useMemo)(
|
|
4847
5005
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
4848
5006
|
[hoursToRender]
|
|
@@ -4854,10 +5012,10 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4854
5012
|
const onChange = (0, import_react21.useCallback)(
|
|
4855
5013
|
(date) => {
|
|
4856
5014
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
4857
|
-
|
|
5015
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4858
5016
|
setInternalValue(newValue);
|
|
4859
5017
|
},
|
|
4860
|
-
[internalValue, defaultTimeAfterDatePick,
|
|
5018
|
+
[internalValue, defaultTimeAfterDatePick, restInputFieldProps.onChangeValue]
|
|
4861
5019
|
);
|
|
4862
5020
|
const onBlur = (0, import_react21.useCallback)(
|
|
4863
5021
|
(event) => {
|
|
@@ -4870,9 +5028,9 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4870
5028
|
const newTime = `${readyHour.toString().padStart(2, "0")}:${readyMinute.toString().padStart(2, "0")}`;
|
|
4871
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")}`;
|
|
4872
5030
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4873
|
-
|
|
5031
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4874
5032
|
}
|
|
4875
|
-
|
|
5033
|
+
restInputFieldProps.onBlur?.(event);
|
|
4876
5034
|
},
|
|
4877
5035
|
[
|
|
4878
5036
|
defaultDateAfterTimePick,
|
|
@@ -4881,8 +5039,8 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4881
5039
|
minutesToRender,
|
|
4882
5040
|
readyHours,
|
|
4883
5041
|
readyMinutes,
|
|
4884
|
-
|
|
4885
|
-
|
|
5042
|
+
restInputFieldProps.onChangeValue,
|
|
5043
|
+
restInputFieldProps.onBlur
|
|
4886
5044
|
]
|
|
4887
5045
|
);
|
|
4888
5046
|
const onClickHour = (0, import_react21.useCallback)(
|
|
@@ -4890,20 +5048,20 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4890
5048
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
4891
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")}`;
|
|
4892
5050
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4893
|
-
|
|
5051
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4894
5052
|
setInternalValue(newValue);
|
|
4895
5053
|
},
|
|
4896
|
-
[defaultDateAfterTimePick, internalValue,
|
|
5054
|
+
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
4897
5055
|
);
|
|
4898
5056
|
const onClickMinute = (0, import_react21.useCallback)(
|
|
4899
5057
|
(minute) => {
|
|
4900
5058
|
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
4901
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")}`;
|
|
4902
5060
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4903
|
-
|
|
5061
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4904
5062
|
setInternalValue(newValue);
|
|
4905
5063
|
},
|
|
4906
|
-
[defaultDateAfterTimePick, internalValue,
|
|
5064
|
+
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
4907
5065
|
);
|
|
4908
5066
|
(0, import_react21.useEffect)(() => {
|
|
4909
5067
|
if (isOpen && selectedHourRef.current)
|
|
@@ -4917,6 +5075,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4917
5075
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4918
5076
|
InputFieldComponent,
|
|
4919
5077
|
{
|
|
5078
|
+
...betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
4920
5079
|
type: "datetime-local",
|
|
4921
5080
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4922
5081
|
Div_default,
|
|
@@ -5020,12 +5179,17 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
5020
5179
|
holderRef,
|
|
5021
5180
|
ref,
|
|
5022
5181
|
...props,
|
|
5023
|
-
...
|
|
5182
|
+
...restInputFieldProps,
|
|
5024
5183
|
onBlur
|
|
5025
5184
|
}
|
|
5026
5185
|
);
|
|
5027
5186
|
});
|
|
5028
|
-
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
|
+
);
|
|
5029
5193
|
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
5030
5194
|
const holderRef = (0, import_react21.useRef)(null);
|
|
5031
5195
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
@@ -5035,7 +5199,13 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5035
5199
|
const minMinutes = minTime ? parseInt(minTime.split(":")[1]) : void 0;
|
|
5036
5200
|
const maxHours = maxTime ? parseInt(maxTime.split(":")[0]) : void 0;
|
|
5037
5201
|
const maxMinutes = maxTime ? parseInt(maxTime.split(":")[1]) : void 0;
|
|
5038
|
-
const {
|
|
5202
|
+
const {
|
|
5203
|
+
internalValue,
|
|
5204
|
+
setInternalValue,
|
|
5205
|
+
inputFieldProps: restInputFieldProps,
|
|
5206
|
+
insideInputFieldComponentProps,
|
|
5207
|
+
isOpen
|
|
5208
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
5039
5209
|
const readyHours = (0, import_react21.useMemo)(
|
|
5040
5210
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
5041
5211
|
[hoursToRender]
|
|
@@ -5055,9 +5225,9 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5055
5225
|
const finalHour = minHours && readyHour < minHours ? minHours : maxHours && readyHour > maxHours ? maxHours : readyHour;
|
|
5056
5226
|
const finalMinute = !!minHours && !!minMinutes && finalHour === minHours && readyMinute < minMinutes ? minMinutes : !!maxHours && !!maxMinutes && finalHour === maxHours && readyMinute > maxMinutes ? maxMinutes : readyMinute;
|
|
5057
5227
|
const newValue = `${finalHour.toString().padStart(2, "0")}:${finalMinute.toString().padStart(2, "0")}`;
|
|
5058
|
-
|
|
5228
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
5059
5229
|
}
|
|
5060
|
-
|
|
5230
|
+
restInputFieldProps.onBlur?.(event);
|
|
5061
5231
|
},
|
|
5062
5232
|
[
|
|
5063
5233
|
minHours,
|
|
@@ -5068,25 +5238,25 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5068
5238
|
minutesToRender,
|
|
5069
5239
|
readyHours,
|
|
5070
5240
|
readyMinutes,
|
|
5071
|
-
|
|
5072
|
-
|
|
5241
|
+
restInputFieldProps.onChangeValue,
|
|
5242
|
+
restInputFieldProps.onBlur
|
|
5073
5243
|
]
|
|
5074
5244
|
);
|
|
5075
5245
|
const onClickHour = (0, import_react21.useCallback)(
|
|
5076
5246
|
(hour) => {
|
|
5077
5247
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5078
|
-
|
|
5248
|
+
restInputFieldProps.onChangeValue?.(value);
|
|
5079
5249
|
setInternalValue(value);
|
|
5080
5250
|
},
|
|
5081
|
-
[internalValue,
|
|
5251
|
+
[internalValue, restInputFieldProps.onChangeValue]
|
|
5082
5252
|
);
|
|
5083
5253
|
const onClickMinute = (0, import_react21.useCallback)(
|
|
5084
5254
|
(minute) => {
|
|
5085
5255
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5086
|
-
|
|
5256
|
+
restInputFieldProps.onChangeValue?.(value);
|
|
5087
5257
|
setInternalValue(value);
|
|
5088
5258
|
},
|
|
5089
|
-
[internalValue,
|
|
5259
|
+
[internalValue, restInputFieldProps.onChangeValue]
|
|
5090
5260
|
);
|
|
5091
5261
|
(0, import_react21.useEffect)(() => {
|
|
5092
5262
|
if (isOpen && selectedHourRef.current)
|
|
@@ -5099,6 +5269,7 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5099
5269
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5100
5270
|
InputFieldComponent,
|
|
5101
5271
|
{
|
|
5272
|
+
...betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5102
5273
|
type: "time",
|
|
5103
5274
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5104
5275
|
Div_default,
|
|
@@ -5187,13 +5358,18 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ hoursT
|
|
|
5187
5358
|
holderRef,
|
|
5188
5359
|
ref,
|
|
5189
5360
|
...props,
|
|
5190
|
-
...
|
|
5361
|
+
...restInputFieldProps,
|
|
5191
5362
|
minWidth: buttonWidth * 2 + 2,
|
|
5192
5363
|
onBlur
|
|
5193
5364
|
}
|
|
5194
5365
|
);
|
|
5195
5366
|
});
|
|
5196
|
-
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
|
+
);
|
|
5197
5373
|
const [inputFieldValue, setInputFieldValue] = (0, import_react21.useState)(value ?? "#000000");
|
|
5198
5374
|
const onChangeValueElement = (0, import_react21.useCallback)(
|
|
5199
5375
|
(value2) => {
|
|
@@ -5209,6 +5385,7 @@ InputFieldComponent.color = (0, import_react21.forwardRef)(function Color4({ val
|
|
|
5209
5385
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5210
5386
|
InputFieldComponent,
|
|
5211
5387
|
{
|
|
5388
|
+
...betterHtmlContextInternal.components.inputField?.style?.color,
|
|
5212
5389
|
type: "color",
|
|
5213
5390
|
insideInputFieldAfterComponent: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5214
5391
|
Div_default.row,
|
|
@@ -5343,8 +5520,14 @@ var SwitchElement = import_styled_components12.default.div.withConfig({
|
|
|
5343
5520
|
`;
|
|
5344
5521
|
var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
5345
5522
|
label,
|
|
5523
|
+
labelFontFamily,
|
|
5524
|
+
labelLetterSpacing,
|
|
5525
|
+
labelTextTransform,
|
|
5346
5526
|
labelColor,
|
|
5347
5527
|
text,
|
|
5528
|
+
textFontFamily,
|
|
5529
|
+
textLetterSpacing,
|
|
5530
|
+
textTextTransform,
|
|
5348
5531
|
textAdvanced,
|
|
5349
5532
|
errorText,
|
|
5350
5533
|
infoText,
|
|
@@ -5378,7 +5561,19 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5378
5561
|
}, [checked, controlledChecked, onChange, value]);
|
|
5379
5562
|
const readyId = id ?? internalId;
|
|
5380
5563
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5381
|
-
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
|
+
),
|
|
5382
5577
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5383
5578
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5384
5579
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -5426,13 +5621,25 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5426
5621
|
}
|
|
5427
5622
|
) : void 0
|
|
5428
5623
|
] }),
|
|
5429
|
-
text ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
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: [
|
|
5436
5643
|
textAdvanced,
|
|
5437
5644
|
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5438
5645
|
" ",
|
|
@@ -5453,25 +5660,43 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5453
5660
|
] });
|
|
5454
5661
|
});
|
|
5455
5662
|
var ToggleInput_default = {
|
|
5456
|
-
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
|
+
);
|
|
5457
5669
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5458
5670
|
}),
|
|
5459
|
-
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
|
+
);
|
|
5460
5677
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5461
5678
|
}),
|
|
5462
|
-
switch: (0, import_react22.forwardRef)(function Switch({
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
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
|
+
);
|
|
5475
5700
|
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5476
5701
|
const internalId = (0, import_react22.useId)();
|
|
5477
5702
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
@@ -5488,7 +5713,19 @@ var ToggleInput_default = {
|
|
|
5488
5713
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5489
5714
|
const readyId = id ?? internalId;
|
|
5490
5715
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5491
|
-
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
|
+
),
|
|
5492
5729
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5493
5730
|
Div_default.row,
|
|
5494
5731
|
{
|
|
@@ -7478,12 +7715,12 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
7478
7715
|
gap: iconGap,
|
|
7479
7716
|
whiteSpace: "nowrap",
|
|
7480
7717
|
backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ? (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.7) : (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.85)) : readyBackgroundColor,
|
|
7481
|
-
backgroundColorHover: hoverItemColor,
|
|
7718
|
+
backgroundColorHover: isActive && activeItemColor ? void 0 : hoverItemColor,
|
|
7482
7719
|
borderRadius: theme2.styles.borderRadius,
|
|
7483
7720
|
paddingBlock,
|
|
7484
7721
|
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7485
7722
|
paddingRight: theme2.styles.space,
|
|
7486
|
-
filterHover: !hoverItemColor ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
|
|
7723
|
+
filterHover: !hoverItemColor || isActive ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
|
|
7487
7724
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7488
7725
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7489
7726
|
opacity: item.disabled ? 0.6 : void 0,
|