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.mjs
CHANGED
|
@@ -861,6 +861,21 @@ function useComponentPropsWithPrefix(props, prefix) {
|
|
|
861
861
|
return returnValue;
|
|
862
862
|
}, [props, prefix]);
|
|
863
863
|
}
|
|
864
|
+
function useComponentsPropsMerger(...props) {
|
|
865
|
+
return useMemo(
|
|
866
|
+
() => props.filter((props2) => props2 !== void 0).reduce(
|
|
867
|
+
(previousValue, currentValue) => ({
|
|
868
|
+
...previousValue,
|
|
869
|
+
...Object.entries(currentValue).reduce((pv, [key, value]) => {
|
|
870
|
+
if (value !== void 0) pv[key] = value;
|
|
871
|
+
return pv;
|
|
872
|
+
}, {})
|
|
873
|
+
}),
|
|
874
|
+
{}
|
|
875
|
+
),
|
|
876
|
+
[props]
|
|
877
|
+
);
|
|
878
|
+
}
|
|
864
879
|
function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
865
880
|
const theme2 = useTheme();
|
|
866
881
|
const [isOpen, setIsOpen] = useBooleanState();
|
|
@@ -1334,7 +1349,14 @@ var Text_default = Text2;
|
|
|
1334
1349
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1335
1350
|
var Divider_default = {
|
|
1336
1351
|
vertical: memo2(
|
|
1337
|
-
forwardRef2(function Divider(
|
|
1352
|
+
forwardRef2(function Divider(dividerProps, ref) {
|
|
1353
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
1354
|
+
const {
|
|
1355
|
+
width = 1,
|
|
1356
|
+
backgroundColor,
|
|
1357
|
+
height,
|
|
1358
|
+
...props
|
|
1359
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.divider?.style?.vertical, dividerProps);
|
|
1338
1360
|
const theme2 = useTheme3();
|
|
1339
1361
|
return /* @__PURE__ */ jsx2(
|
|
1340
1362
|
Div_default,
|
|
@@ -1350,11 +1372,35 @@ var Divider_default = {
|
|
|
1350
1372
|
})
|
|
1351
1373
|
),
|
|
1352
1374
|
horizontal: memo2(
|
|
1353
|
-
forwardRef2(function Divider2(
|
|
1375
|
+
forwardRef2(function Divider2(dividerProps, ref) {
|
|
1376
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
1377
|
+
const {
|
|
1378
|
+
width = 1,
|
|
1379
|
+
backgroundColor,
|
|
1380
|
+
text,
|
|
1381
|
+
textFontFamily,
|
|
1382
|
+
textFontSize,
|
|
1383
|
+
textFontWeight,
|
|
1384
|
+
textTransform,
|
|
1385
|
+
textLetterSpacing,
|
|
1386
|
+
textColor,
|
|
1387
|
+
...props
|
|
1388
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.divider?.style?.horizontal, dividerProps);
|
|
1354
1389
|
const theme2 = useTheme3();
|
|
1355
1390
|
return /* @__PURE__ */ jsxs(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
|
|
1356
1391
|
/* @__PURE__ */ jsx2(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
|
|
1357
|
-
text && /* @__PURE__ */ jsx2(
|
|
1392
|
+
text && /* @__PURE__ */ jsx2(
|
|
1393
|
+
Text_default,
|
|
1394
|
+
{
|
|
1395
|
+
fontFamily: textFontFamily,
|
|
1396
|
+
fontSize: textFontSize,
|
|
1397
|
+
fontWeight: textFontWeight,
|
|
1398
|
+
textTransform,
|
|
1399
|
+
letterSpacing: textLetterSpacing,
|
|
1400
|
+
color: textColor ?? theme2.colors.textSecondary,
|
|
1401
|
+
children: text
|
|
1402
|
+
}
|
|
1403
|
+
),
|
|
1358
1404
|
/* @__PURE__ */ jsx2(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
|
|
1359
1405
|
] });
|
|
1360
1406
|
})
|
|
@@ -1970,39 +2016,40 @@ var ButtonElement = styled6.button.withConfig({
|
|
|
1970
2016
|
${(props) => props.hoverStyle}
|
|
1971
2017
|
}
|
|
1972
2018
|
`;
|
|
1973
|
-
var ButtonComponent = function Button({
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2019
|
+
var ButtonComponent = function Button(buttonProps) {
|
|
2020
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2021
|
+
const {
|
|
2022
|
+
href,
|
|
2023
|
+
text,
|
|
2024
|
+
value,
|
|
2025
|
+
download,
|
|
2026
|
+
target,
|
|
2027
|
+
icon,
|
|
2028
|
+
iconPosition = "left",
|
|
2029
|
+
iconColor,
|
|
2030
|
+
iconSize,
|
|
2031
|
+
image,
|
|
2032
|
+
imagePosition = "left",
|
|
2033
|
+
imageWidth,
|
|
2034
|
+
imageHeight,
|
|
2035
|
+
loaderName,
|
|
2036
|
+
loaderSize,
|
|
2037
|
+
isLoading,
|
|
2038
|
+
disabled,
|
|
2039
|
+
isSmall,
|
|
2040
|
+
isSubmit,
|
|
2041
|
+
onClick,
|
|
2042
|
+
onClickWithValue,
|
|
2043
|
+
...props
|
|
2044
|
+
} = useComponentsPropsMerger(
|
|
2045
|
+
betterHtmlContextInternal.components.button?.style?.default,
|
|
2046
|
+
buttonProps
|
|
2047
|
+
);
|
|
1997
2048
|
const theme2 = useTheme9();
|
|
1998
2049
|
const isLoadingHook = useLoader(loaderName);
|
|
1999
|
-
const { components } = useBetterHtmlContextInternal();
|
|
2000
2050
|
const { colorTheme } = useBetterCoreContext3();
|
|
2001
2051
|
const isLoadingElement = isLoading || isLoadingHook;
|
|
2002
|
-
const { style, hoverStyle, restProps } = useComponentPropsGrouper(
|
|
2003
|
-
...components.button?.style?.default,
|
|
2004
|
-
...props
|
|
2005
|
-
});
|
|
2052
|
+
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
2006
2053
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
2007
2054
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
2008
2055
|
const onClickElement = useCallback3(
|
|
@@ -2037,8 +2084,8 @@ var ButtonComponent = function Button({
|
|
|
2037
2084
|
height: imageHeight
|
|
2038
2085
|
}
|
|
2039
2086
|
) : void 0;
|
|
2040
|
-
const linkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
2041
|
-
const buttonComponentTag = components.button?.tagReplacement?.buttonComponent ?? "button";
|
|
2087
|
+
const linkComponentTag = betterHtmlContextInternal.components.button?.tagReplacement?.linkComponent ?? "a";
|
|
2088
|
+
const buttonComponentTag = betterHtmlContextInternal.components.button?.tagReplacement?.buttonComponent ?? "button";
|
|
2042
2089
|
return /* @__PURE__ */ jsxs5(
|
|
2043
2090
|
ButtonElement,
|
|
2044
2091
|
{
|
|
@@ -2106,41 +2153,44 @@ var ButtonComponent = function Button({
|
|
|
2106
2153
|
}
|
|
2107
2154
|
);
|
|
2108
2155
|
};
|
|
2109
|
-
ButtonComponent.secondary = function Secondary(
|
|
2156
|
+
ButtonComponent.secondary = function Secondary(buttonProps) {
|
|
2157
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2158
|
+
const { className, ...props } = useComponentsPropsMerger(
|
|
2159
|
+
betterHtmlContextInternal.components.button?.style?.secondary,
|
|
2160
|
+
buttonProps
|
|
2161
|
+
);
|
|
2110
2162
|
const theme2 = useTheme9();
|
|
2111
|
-
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2112
2163
|
return /* @__PURE__ */ jsx8(
|
|
2113
2164
|
ButtonComponent,
|
|
2114
2165
|
{
|
|
2115
|
-
...betterHtmlContext2.components.button?.style?.secondary,
|
|
2116
2166
|
className: `secondary${className ? ` ${className}` : ""}`,
|
|
2117
2167
|
color: theme2.colors.textPrimary,
|
|
2118
2168
|
...props
|
|
2119
2169
|
}
|
|
2120
2170
|
);
|
|
2121
2171
|
};
|
|
2122
|
-
ButtonComponent.destructive = function Destructive(
|
|
2123
|
-
const
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
{
|
|
2128
|
-
...betterHtmlContext2.components.button?.style?.destructive,
|
|
2129
|
-
backgroundColor: theme2.colors.error,
|
|
2130
|
-
color: theme2.colors.base,
|
|
2131
|
-
...props
|
|
2132
|
-
}
|
|
2172
|
+
ButtonComponent.destructive = function Destructive(buttonProps) {
|
|
2173
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2174
|
+
const props = useComponentsPropsMerger(
|
|
2175
|
+
betterHtmlContextInternal.components.button?.style?.destructive,
|
|
2176
|
+
buttonProps
|
|
2133
2177
|
);
|
|
2178
|
+
const theme2 = useTheme9();
|
|
2179
|
+
return /* @__PURE__ */ jsx8(ButtonComponent, { backgroundColor: theme2.colors.error, color: theme2.colors.base, ...props });
|
|
2134
2180
|
};
|
|
2135
|
-
ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...
|
|
2181
|
+
ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...buttonProps }) {
|
|
2182
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2183
|
+
const { ...props } = useComponentsPropsMerger(
|
|
2184
|
+
betterHtmlContextInternal.components.button?.style?.icon,
|
|
2185
|
+
buttonProps
|
|
2186
|
+
);
|
|
2136
2187
|
const theme2 = useTheme9();
|
|
2137
|
-
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2138
2188
|
const readyButtonSize = buttonSize ?? size + theme2.styles.space;
|
|
2139
2189
|
const backgroundButtonColorReady = backgroundButtonColor ?? theme2.colors.textPrimary;
|
|
2140
2190
|
return /* @__PURE__ */ jsx8(
|
|
2141
2191
|
ButtonComponent,
|
|
2142
2192
|
{
|
|
2143
|
-
...
|
|
2193
|
+
...betterHtmlContextInternal.components.button?.style?.icon,
|
|
2144
2194
|
width: readyButtonSize,
|
|
2145
2195
|
height: readyButtonSize,
|
|
2146
2196
|
color: theme2.colors.textPrimary,
|
|
@@ -2157,8 +2207,12 @@ ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonC
|
|
|
2157
2207
|
}
|
|
2158
2208
|
);
|
|
2159
2209
|
};
|
|
2160
|
-
ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...
|
|
2161
|
-
const
|
|
2210
|
+
ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...buttonProps }) {
|
|
2211
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2212
|
+
const { ...props } = useComponentsPropsMerger(
|
|
2213
|
+
betterHtmlContextInternal.components.button?.style?.upload,
|
|
2214
|
+
buttonProps
|
|
2215
|
+
);
|
|
2162
2216
|
const onClickElement = useCallback3(() => {
|
|
2163
2217
|
const input = document.createElement("input");
|
|
2164
2218
|
input.setAttribute("type", "file");
|
|
@@ -2172,7 +2226,7 @@ ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...props
|
|
|
2172
2226
|
return /* @__PURE__ */ jsx8(
|
|
2173
2227
|
ButtonComponent,
|
|
2174
2228
|
{
|
|
2175
|
-
...
|
|
2229
|
+
...betterHtmlContextInternal.components.button?.style?.upload,
|
|
2176
2230
|
text: "Upload",
|
|
2177
2231
|
icon: "uploadCloud",
|
|
2178
2232
|
onClick: onClickElement,
|
|
@@ -3318,7 +3372,7 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3318
3372
|
position: "relative",
|
|
3319
3373
|
width: "100%",
|
|
3320
3374
|
minHeight: "100svh",
|
|
3321
|
-
alignItems: "center",
|
|
3375
|
+
alignItems: height !== "100%" ? "center" : void 0,
|
|
3322
3376
|
justifyContent: "center",
|
|
3323
3377
|
backgroundColor: pageBackgroundColor,
|
|
3324
3378
|
backgroundImage: pageBackgroundImage,
|
|
@@ -3337,29 +3391,19 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3337
3391
|
}
|
|
3338
3392
|
),
|
|
3339
3393
|
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ jsx13(Div_default, { width: "50%" }),
|
|
3340
|
-
/* @__PURE__ */ jsx13(
|
|
3341
|
-
|
|
3394
|
+
/* @__PURE__ */ jsx13(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ jsx13(
|
|
3395
|
+
ContentTag,
|
|
3342
3396
|
{
|
|
3343
|
-
|
|
3344
|
-
|
|
3397
|
+
width: `calc(100% - ${((props.margin ?? props.marginInline) !== void 0 ? parseFloat((props.margin ?? props.marginInline)?.toString() ?? "") : theme2.styles.space) * 2}px)`,
|
|
3398
|
+
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3345
3399
|
height,
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3352
|
-
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3353
|
-
height,
|
|
3354
|
-
marginInline: theme2.styles.space,
|
|
3355
|
-
marginBlock: theme2.styles.space,
|
|
3356
|
-
...props,
|
|
3357
|
-
ref,
|
|
3358
|
-
children
|
|
3359
|
-
}
|
|
3360
|
-
)
|
|
3400
|
+
marginInline: theme2.styles.space,
|
|
3401
|
+
marginBlock: theme2.styles.space,
|
|
3402
|
+
...props,
|
|
3403
|
+
ref,
|
|
3404
|
+
children
|
|
3361
3405
|
}
|
|
3362
|
-
),
|
|
3406
|
+
) }),
|
|
3363
3407
|
sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ jsx13(Div_default, { width: "50%" }),
|
|
3364
3408
|
withSideComponent && /* @__PURE__ */ jsx13(
|
|
3365
3409
|
Div_default,
|
|
@@ -3473,7 +3517,9 @@ import styled10 from "styled-components";
|
|
|
3473
3517
|
import { memo as memo15 } from "react";
|
|
3474
3518
|
import { useTheme as useTheme16 } from "react-better-core";
|
|
3475
3519
|
import { jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3476
|
-
function Label(
|
|
3520
|
+
function Label(labelProps) {
|
|
3521
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3522
|
+
const { text, required, isError, fontFamily, letterSpacing, textTransform, color, htmlFor } = useComponentsPropsMerger(betterHtmlContextInternal.components.label?.style?.default, labelProps);
|
|
3477
3523
|
const theme2 = useTheme16();
|
|
3478
3524
|
return /* @__PURE__ */ jsxs11(
|
|
3479
3525
|
Text_default,
|
|
@@ -3481,8 +3527,11 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3481
3527
|
as: "label",
|
|
3482
3528
|
width: "fit-content",
|
|
3483
3529
|
height: 16,
|
|
3530
|
+
fontFamily,
|
|
3484
3531
|
fontSize: 14,
|
|
3485
3532
|
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
3533
|
+
letterSpacing,
|
|
3534
|
+
textTransform,
|
|
3486
3535
|
htmlFor,
|
|
3487
3536
|
"aria-required": required,
|
|
3488
3537
|
children: [
|
|
@@ -3508,35 +3557,43 @@ import {
|
|
|
3508
3557
|
} from "react-better-core";
|
|
3509
3558
|
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3510
3559
|
import { createElement as createElement2 } from "react";
|
|
3511
|
-
var DropdownComponent = forwardRef10(function Dropdown({
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3560
|
+
var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
3561
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3562
|
+
const {
|
|
3563
|
+
label,
|
|
3564
|
+
labelFontFamily,
|
|
3565
|
+
labelLetterSpacing,
|
|
3566
|
+
labelTextTransform,
|
|
3567
|
+
labelColor,
|
|
3568
|
+
errorText,
|
|
3569
|
+
infoText,
|
|
3570
|
+
required,
|
|
3571
|
+
name,
|
|
3572
|
+
disabled,
|
|
3573
|
+
options,
|
|
3574
|
+
value: controlledValue,
|
|
3575
|
+
defaultValue,
|
|
3576
|
+
placeholder,
|
|
3577
|
+
leftIcon,
|
|
3578
|
+
inputFieldClassName,
|
|
3579
|
+
withSearch,
|
|
3580
|
+
withDebounce,
|
|
3581
|
+
debounceDelay = 0.5,
|
|
3582
|
+
debounceIsLoading,
|
|
3583
|
+
debounceMinimumSymbolsRequired,
|
|
3584
|
+
withoutClearButton,
|
|
3585
|
+
withoutRenderingOptionsWhenClosed,
|
|
3586
|
+
onChange,
|
|
3587
|
+
onChangeSearch,
|
|
3588
|
+
renderOption,
|
|
3589
|
+
renderOptionDivider,
|
|
3590
|
+
withMultiselect,
|
|
3591
|
+
id,
|
|
3592
|
+
...props
|
|
3593
|
+
} = useComponentsPropsMerger(
|
|
3594
|
+
betterHtmlContextInternal.components.dropdown?.style?.default,
|
|
3595
|
+
dropdownProps
|
|
3596
|
+
);
|
|
3540
3597
|
const theme2 = useTheme17();
|
|
3541
3598
|
const inputFieldHolderRef = useRef4(null);
|
|
3542
3599
|
const buttonsRef = useRef4(null);
|
|
@@ -3746,6 +3803,9 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3746
3803
|
InputField_default,
|
|
3747
3804
|
{
|
|
3748
3805
|
label,
|
|
3806
|
+
labelFontFamily,
|
|
3807
|
+
labelLetterSpacing,
|
|
3808
|
+
labelTextTransform,
|
|
3749
3809
|
labelColor,
|
|
3750
3810
|
errorText,
|
|
3751
3811
|
infoText,
|
|
@@ -3889,7 +3949,12 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3889
3949
|
}
|
|
3890
3950
|
) });
|
|
3891
3951
|
});
|
|
3892
|
-
DropdownComponent.countries = forwardRef10(function Countries(
|
|
3952
|
+
DropdownComponent.countries = forwardRef10(function Countries(dropdownProps, ref) {
|
|
3953
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
3954
|
+
const props = useComponentsPropsMerger(
|
|
3955
|
+
betterHtmlContextInternal.components.dropdown?.style?.countries,
|
|
3956
|
+
dropdownProps
|
|
3957
|
+
);
|
|
3893
3958
|
const theme2 = useTheme17();
|
|
3894
3959
|
const renderOption = useCallback8(
|
|
3895
3960
|
(option, index, isSelected) => /* @__PURE__ */ jsxs12(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
@@ -4308,30 +4373,35 @@ var TextareaElement = styled10.textarea.withConfig({
|
|
|
4308
4373
|
`;
|
|
4309
4374
|
var hours = Array.from({ length: 24 }, (_, index) => index);
|
|
4310
4375
|
var minutes = Array.from({ length: 60 }, (_, index) => index);
|
|
4311
|
-
var InputFieldComponent = forwardRef11(function InputField({
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4376
|
+
var InputFieldComponent = forwardRef11(function InputField(inputFieldProps, ref) {
|
|
4377
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4378
|
+
const {
|
|
4379
|
+
label,
|
|
4380
|
+
labelFontFamily,
|
|
4381
|
+
labelLetterSpacing,
|
|
4382
|
+
labelTextTransform,
|
|
4383
|
+
labelColor,
|
|
4384
|
+
errorText,
|
|
4385
|
+
infoText,
|
|
4386
|
+
leftIcon,
|
|
4387
|
+
rightIcon,
|
|
4388
|
+
prefix,
|
|
4389
|
+
prefixBackgroundColor,
|
|
4390
|
+
suffix,
|
|
4391
|
+
suffixBackgroundColor,
|
|
4392
|
+
insideInputFieldBeforeComponent,
|
|
4393
|
+
insideInputFieldAfterComponent,
|
|
4394
|
+
withDebounce,
|
|
4395
|
+
debounceDelay = 0.5,
|
|
4396
|
+
onChange,
|
|
4397
|
+
onChangeValue,
|
|
4398
|
+
onClickRightIcon,
|
|
4399
|
+
holderRef,
|
|
4400
|
+
required,
|
|
4401
|
+
placeholder,
|
|
4402
|
+
id,
|
|
4403
|
+
...props
|
|
4404
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.inputField?.style?.default, inputFieldProps);
|
|
4335
4405
|
const theme2 = useTheme19();
|
|
4336
4406
|
const internalId = useId2();
|
|
4337
4407
|
const { colorTheme } = useBetterCoreContext7();
|
|
@@ -4367,7 +4437,19 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4367
4437
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4368
4438
|
const readyId = id ?? internalId;
|
|
4369
4439
|
return /* @__PURE__ */ jsxs14(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4370
|
-
label && /* @__PURE__ */ jsx17(
|
|
4440
|
+
label && /* @__PURE__ */ jsx17(
|
|
4441
|
+
Label_default,
|
|
4442
|
+
{
|
|
4443
|
+
text: label,
|
|
4444
|
+
fontFamily: labelFontFamily,
|
|
4445
|
+
letterSpacing: labelLetterSpacing,
|
|
4446
|
+
textTransform: labelTextTransform,
|
|
4447
|
+
color: labelColor,
|
|
4448
|
+
required,
|
|
4449
|
+
isError: !!errorText,
|
|
4450
|
+
htmlFor: readyId
|
|
4451
|
+
}
|
|
4452
|
+
),
|
|
4371
4453
|
/* @__PURE__ */ jsxs14(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4372
4454
|
prefix && /* @__PURE__ */ jsx17(
|
|
4373
4455
|
Div_default.row,
|
|
@@ -4469,20 +4551,29 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4469
4551
|
)
|
|
4470
4552
|
] });
|
|
4471
4553
|
});
|
|
4472
|
-
InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4554
|
+
InputFieldComponent.multiline = forwardRef11(function Multiline(inputFieldProps, ref) {
|
|
4555
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4556
|
+
const {
|
|
4557
|
+
label,
|
|
4558
|
+
labelFontFamily,
|
|
4559
|
+
labelLetterSpacing,
|
|
4560
|
+
labelTextTransform,
|
|
4561
|
+
labelColor,
|
|
4562
|
+
placeholder,
|
|
4563
|
+
errorText,
|
|
4564
|
+
infoText,
|
|
4565
|
+
leftIcon,
|
|
4566
|
+
rightIcon,
|
|
4567
|
+
onChange,
|
|
4568
|
+
onChangeValue,
|
|
4569
|
+
onClickRightIcon,
|
|
4570
|
+
required,
|
|
4571
|
+
id,
|
|
4572
|
+
...props
|
|
4573
|
+
} = useComponentsPropsMerger(
|
|
4574
|
+
betterHtmlContextInternal.components.inputField?.style?.multiline,
|
|
4575
|
+
inputFieldProps
|
|
4576
|
+
);
|
|
4486
4577
|
const theme2 = useTheme19();
|
|
4487
4578
|
const internalId = useId2();
|
|
4488
4579
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
@@ -4497,7 +4588,19 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4497
4588
|
);
|
|
4498
4589
|
const readyId = id ?? internalId;
|
|
4499
4590
|
return /* @__PURE__ */ jsxs14(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
4500
|
-
label && /* @__PURE__ */ jsx17(
|
|
4591
|
+
label && /* @__PURE__ */ jsx17(
|
|
4592
|
+
Label_default,
|
|
4593
|
+
{
|
|
4594
|
+
text: label,
|
|
4595
|
+
fontFamily: labelFontFamily,
|
|
4596
|
+
letterSpacing: labelLetterSpacing,
|
|
4597
|
+
textTransform: labelTextTransform,
|
|
4598
|
+
color: labelColor,
|
|
4599
|
+
required,
|
|
4600
|
+
isError: !!errorText,
|
|
4601
|
+
htmlFor: readyId
|
|
4602
|
+
}
|
|
4603
|
+
),
|
|
4501
4604
|
/* @__PURE__ */ jsxs14(Div_default, { position: "relative", width: "100%", children: [
|
|
4502
4605
|
leftIcon && /* @__PURE__ */ jsx17(
|
|
4503
4606
|
Icon_default,
|
|
@@ -4556,14 +4659,19 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4556
4659
|
as: "span",
|
|
4557
4660
|
display: "block",
|
|
4558
4661
|
marginTop: theme2.styles.gap / 2,
|
|
4559
|
-
color: errorText ? theme2.colors.error :
|
|
4662
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4560
4663
|
fontSize: 14,
|
|
4561
4664
|
children: errorText || infoText
|
|
4562
4665
|
}
|
|
4563
4666
|
)
|
|
4564
4667
|
] });
|
|
4565
4668
|
});
|
|
4566
|
-
InputFieldComponent.email = forwardRef11(function Email(
|
|
4669
|
+
InputFieldComponent.email = forwardRef11(function Email(inputFieldProps, ref) {
|
|
4670
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4671
|
+
const props = useComponentsPropsMerger(
|
|
4672
|
+
betterHtmlContextInternal.components.inputField?.style?.email,
|
|
4673
|
+
inputFieldProps
|
|
4674
|
+
);
|
|
4567
4675
|
return /* @__PURE__ */ jsx17(
|
|
4568
4676
|
InputFieldComponent,
|
|
4569
4677
|
{
|
|
@@ -4577,7 +4685,12 @@ InputFieldComponent.email = forwardRef11(function Email({ ...props }, ref) {
|
|
|
4577
4685
|
}
|
|
4578
4686
|
);
|
|
4579
4687
|
});
|
|
4580
|
-
InputFieldComponent.password = forwardRef11(function Password(
|
|
4688
|
+
InputFieldComponent.password = forwardRef11(function Password(inputFieldProps, ref) {
|
|
4689
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4690
|
+
const props = useComponentsPropsMerger(
|
|
4691
|
+
betterHtmlContextInternal.components.inputField?.style?.password,
|
|
4692
|
+
inputFieldProps
|
|
4693
|
+
);
|
|
4581
4694
|
const [isPassword, setIsPassword] = useBooleanState5(true);
|
|
4582
4695
|
return /* @__PURE__ */ jsx17(
|
|
4583
4696
|
InputFieldComponent,
|
|
@@ -4594,7 +4707,12 @@ InputFieldComponent.password = forwardRef11(function Password({ ...props }, ref)
|
|
|
4594
4707
|
}
|
|
4595
4708
|
);
|
|
4596
4709
|
});
|
|
4597
|
-
InputFieldComponent.search = forwardRef11(function Search(
|
|
4710
|
+
InputFieldComponent.search = forwardRef11(function Search(inputFieldProps, ref) {
|
|
4711
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4712
|
+
const { value, onChangeValue, onFocus, onBlur, ...props } = useComponentsPropsMerger(
|
|
4713
|
+
betterHtmlContextInternal.components.inputField?.style?.search,
|
|
4714
|
+
inputFieldProps
|
|
4715
|
+
);
|
|
4598
4716
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
4599
4717
|
const [inputFieldFocused, setInputFieldFocused] = useBooleanState5();
|
|
4600
4718
|
const onChangeValueElement = useCallback10(
|
|
@@ -4637,7 +4755,19 @@ InputFieldComponent.search = forwardRef11(function Search({ value, onChangeValue
|
|
|
4637
4755
|
}
|
|
4638
4756
|
);
|
|
4639
4757
|
});
|
|
4640
|
-
InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber(
|
|
4758
|
+
InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber(inputFieldProps, ref) {
|
|
4759
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4760
|
+
const {
|
|
4761
|
+
label,
|
|
4762
|
+
labelFontFamily,
|
|
4763
|
+
labelLetterSpacing,
|
|
4764
|
+
labelTextTransform,
|
|
4765
|
+
labelColor,
|
|
4766
|
+
value,
|
|
4767
|
+
onChangeValue,
|
|
4768
|
+
id,
|
|
4769
|
+
...props
|
|
4770
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.inputField?.style?.phoneNumber, inputFieldProps);
|
|
4641
4771
|
const theme2 = useTheme19();
|
|
4642
4772
|
const internalId = useId2();
|
|
4643
4773
|
const [dropdownValue, setDropdownValue] = useState7();
|
|
@@ -4695,12 +4825,16 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
4695
4825
|
setInputFieldValue(newValue.slice(country.phoneNumberExtension.length + 1));
|
|
4696
4826
|
}, [value]);
|
|
4697
4827
|
const readyId = id ?? internalId;
|
|
4828
|
+
const readyLabel = betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.label ?? label;
|
|
4698
4829
|
return /* @__PURE__ */ jsxs14(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
4699
|
-
|
|
4830
|
+
readyLabel && /* @__PURE__ */ jsx17(
|
|
4700
4831
|
Label_default,
|
|
4701
4832
|
{
|
|
4702
|
-
text:
|
|
4703
|
-
|
|
4833
|
+
text: readyLabel,
|
|
4834
|
+
fontFamily: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelFontFamily ?? labelFontFamily,
|
|
4835
|
+
letterSpacing: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelLetterSpacing ?? labelLetterSpacing,
|
|
4836
|
+
textTransform: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelTextTransform ?? labelTextTransform,
|
|
4837
|
+
color: betterHtmlContextInternal.components.inputField?.style?.phoneNumber?.labelColor ?? labelColor,
|
|
4704
4838
|
required: props.required,
|
|
4705
4839
|
isError: !!props.errorText,
|
|
4706
4840
|
htmlFor: readyId
|
|
@@ -4728,7 +4862,9 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
4728
4862
|
/* @__PURE__ */ jsx17(
|
|
4729
4863
|
InputFieldComponent,
|
|
4730
4864
|
{
|
|
4731
|
-
|
|
4865
|
+
...betterHtmlContextInternal.components.inputField?.style?.phoneNumber,
|
|
4866
|
+
label: void 0,
|
|
4867
|
+
placeholder: readyLabel ?? "Phone number",
|
|
4732
4868
|
className: "react-better-html-phone-number",
|
|
4733
4869
|
value: inputFieldValue,
|
|
4734
4870
|
onChangeValue: onChangeValueElement,
|
|
@@ -4740,21 +4876,32 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
4740
4876
|
] })
|
|
4741
4877
|
] });
|
|
4742
4878
|
});
|
|
4743
|
-
InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...
|
|
4879
|
+
InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...inputFieldProps }, ref) {
|
|
4880
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4881
|
+
const props = useComponentsPropsMerger(
|
|
4882
|
+
betterHtmlContextInternal.components.inputField?.style?.date,
|
|
4883
|
+
inputFieldProps
|
|
4884
|
+
);
|
|
4744
4885
|
const theme2 = useTheme19();
|
|
4745
4886
|
const holderRef = useRef5(null);
|
|
4746
4887
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4747
|
-
const {
|
|
4888
|
+
const {
|
|
4889
|
+
internalValue,
|
|
4890
|
+
setInternalValue,
|
|
4891
|
+
inputFieldProps: restInputFieldProps,
|
|
4892
|
+
insideInputFieldComponentProps
|
|
4893
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4748
4894
|
const onChange = useCallback10(
|
|
4749
4895
|
(date) => {
|
|
4750
|
-
|
|
4896
|
+
restInputFieldProps.onChangeValue?.(date ?? "");
|
|
4751
4897
|
setInternalValue(date ?? "");
|
|
4752
4898
|
},
|
|
4753
|
-
[
|
|
4899
|
+
[restInputFieldProps.onChangeValue]
|
|
4754
4900
|
);
|
|
4755
4901
|
return /* @__PURE__ */ jsx17(
|
|
4756
4902
|
InputFieldComponent,
|
|
4757
4903
|
{
|
|
4904
|
+
...betterHtmlContextInternal.components.inputField?.style?.date,
|
|
4758
4905
|
type: "date",
|
|
4759
4906
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ jsx17(
|
|
4760
4907
|
Div_default,
|
|
@@ -4775,7 +4922,7 @@ InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...pr
|
|
|
4775
4922
|
holderRef,
|
|
4776
4923
|
ref,
|
|
4777
4924
|
...props,
|
|
4778
|
-
...
|
|
4925
|
+
...restInputFieldProps
|
|
4779
4926
|
}
|
|
4780
4927
|
);
|
|
4781
4928
|
});
|
|
@@ -4786,14 +4933,25 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4786
4933
|
maxDate,
|
|
4787
4934
|
defaultDateAfterTimePick,
|
|
4788
4935
|
defaultTimeAfterDatePick = "00:00",
|
|
4789
|
-
...
|
|
4936
|
+
...inputFieldProps
|
|
4790
4937
|
}, ref) {
|
|
4938
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
4939
|
+
const props = useComponentsPropsMerger(
|
|
4940
|
+
betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
4941
|
+
inputFieldProps
|
|
4942
|
+
);
|
|
4791
4943
|
const theme2 = useTheme19();
|
|
4792
4944
|
const holderRef = useRef5(null);
|
|
4793
4945
|
const selectedHourRef = useRef5(null);
|
|
4794
4946
|
const selectedMinuteRef = useRef5(null);
|
|
4795
4947
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4796
|
-
const {
|
|
4948
|
+
const {
|
|
4949
|
+
internalValue,
|
|
4950
|
+
setInternalValue,
|
|
4951
|
+
inputFieldProps: restInputFieldProps,
|
|
4952
|
+
insideInputFieldComponentProps,
|
|
4953
|
+
isOpen
|
|
4954
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4797
4955
|
const readyHours = useMemo6(
|
|
4798
4956
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
4799
4957
|
[hoursToRender]
|
|
@@ -4805,10 +4963,10 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4805
4963
|
const onChange = useCallback10(
|
|
4806
4964
|
(date) => {
|
|
4807
4965
|
const newValue = date ? `${date}T${internalValue?.toString().split("T")[1] ?? defaultTimeAfterDatePick}` : "";
|
|
4808
|
-
|
|
4966
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4809
4967
|
setInternalValue(newValue);
|
|
4810
4968
|
},
|
|
4811
|
-
[internalValue, defaultTimeAfterDatePick,
|
|
4969
|
+
[internalValue, defaultTimeAfterDatePick, restInputFieldProps.onChangeValue]
|
|
4812
4970
|
);
|
|
4813
4971
|
const onBlur = useCallback10(
|
|
4814
4972
|
(event) => {
|
|
@@ -4821,9 +4979,9 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4821
4979
|
const newTime = `${readyHour.toString().padStart(2, "0")}:${readyMinute.toString().padStart(2, "0")}`;
|
|
4822
4980
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4823
4981
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4824
|
-
|
|
4982
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4825
4983
|
}
|
|
4826
|
-
|
|
4984
|
+
restInputFieldProps.onBlur?.(event);
|
|
4827
4985
|
},
|
|
4828
4986
|
[
|
|
4829
4987
|
defaultDateAfterTimePick,
|
|
@@ -4832,8 +4990,8 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4832
4990
|
minutesToRender,
|
|
4833
4991
|
readyHours,
|
|
4834
4992
|
readyMinutes,
|
|
4835
|
-
|
|
4836
|
-
|
|
4993
|
+
restInputFieldProps.onChangeValue,
|
|
4994
|
+
restInputFieldProps.onBlur
|
|
4837
4995
|
]
|
|
4838
4996
|
);
|
|
4839
4997
|
const onClickHour = useCallback10(
|
|
@@ -4841,20 +4999,20 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4841
4999
|
const newTime = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
4842
5000
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4843
5001
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4844
|
-
|
|
5002
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4845
5003
|
setInternalValue(newValue);
|
|
4846
5004
|
},
|
|
4847
|
-
[defaultDateAfterTimePick, internalValue,
|
|
5005
|
+
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
4848
5006
|
);
|
|
4849
5007
|
const onClickMinute = useCallback10(
|
|
4850
5008
|
(minute) => {
|
|
4851
5009
|
const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
4852
5010
|
const today = defaultDateAfterTimePick ?? `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
|
|
4853
5011
|
const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
|
|
4854
|
-
|
|
5012
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
4855
5013
|
setInternalValue(newValue);
|
|
4856
5014
|
},
|
|
4857
|
-
[defaultDateAfterTimePick, internalValue,
|
|
5015
|
+
[defaultDateAfterTimePick, internalValue, restInputFieldProps.onChangeValue]
|
|
4858
5016
|
);
|
|
4859
5017
|
useEffect9(() => {
|
|
4860
5018
|
if (isOpen && selectedHourRef.current)
|
|
@@ -4868,6 +5026,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4868
5026
|
return /* @__PURE__ */ jsx17(
|
|
4869
5027
|
InputFieldComponent,
|
|
4870
5028
|
{
|
|
5029
|
+
...betterHtmlContextInternal.components.inputField?.style?.dateTime,
|
|
4871
5030
|
type: "datetime-local",
|
|
4872
5031
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ jsx17(
|
|
4873
5032
|
Div_default,
|
|
@@ -4971,12 +5130,17 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({
|
|
|
4971
5130
|
holderRef,
|
|
4972
5131
|
ref,
|
|
4973
5132
|
...props,
|
|
4974
|
-
...
|
|
5133
|
+
...restInputFieldProps,
|
|
4975
5134
|
onBlur
|
|
4976
5135
|
}
|
|
4977
5136
|
);
|
|
4978
5137
|
});
|
|
4979
|
-
InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesToRender, minTime, maxTime, ...
|
|
5138
|
+
InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesToRender, minTime, maxTime, ...inputFieldProps }, ref) {
|
|
5139
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5140
|
+
const props = useComponentsPropsMerger(
|
|
5141
|
+
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5142
|
+
inputFieldProps
|
|
5143
|
+
);
|
|
4980
5144
|
const theme2 = useTheme19();
|
|
4981
5145
|
const holderRef = useRef5(null);
|
|
4982
5146
|
const selectedHourRef = useRef5(null);
|
|
@@ -4986,7 +5150,13 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
4986
5150
|
const minMinutes = minTime ? parseInt(minTime.split(":")[1]) : void 0;
|
|
4987
5151
|
const maxHours = maxTime ? parseInt(maxTime.split(":")[0]) : void 0;
|
|
4988
5152
|
const maxMinutes = maxTime ? parseInt(maxTime.split(":")[1]) : void 0;
|
|
4989
|
-
const {
|
|
5153
|
+
const {
|
|
5154
|
+
internalValue,
|
|
5155
|
+
setInternalValue,
|
|
5156
|
+
inputFieldProps: restInputFieldProps,
|
|
5157
|
+
insideInputFieldComponentProps,
|
|
5158
|
+
isOpen
|
|
5159
|
+
} = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
4990
5160
|
const readyHours = useMemo6(
|
|
4991
5161
|
() => hoursToRender?.filter((hour) => hour >= 0 && hour <= 23) ?? hours,
|
|
4992
5162
|
[hoursToRender]
|
|
@@ -5006,9 +5176,9 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5006
5176
|
const finalHour = minHours && readyHour < minHours ? minHours : maxHours && readyHour > maxHours ? maxHours : readyHour;
|
|
5007
5177
|
const finalMinute = !!minHours && !!minMinutes && finalHour === minHours && readyMinute < minMinutes ? minMinutes : !!maxHours && !!maxMinutes && finalHour === maxHours && readyMinute > maxMinutes ? maxMinutes : readyMinute;
|
|
5008
5178
|
const newValue = `${finalHour.toString().padStart(2, "0")}:${finalMinute.toString().padStart(2, "0")}`;
|
|
5009
|
-
|
|
5179
|
+
restInputFieldProps.onChangeValue?.(newValue);
|
|
5010
5180
|
}
|
|
5011
|
-
|
|
5181
|
+
restInputFieldProps.onBlur?.(event);
|
|
5012
5182
|
},
|
|
5013
5183
|
[
|
|
5014
5184
|
minHours,
|
|
@@ -5019,25 +5189,25 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5019
5189
|
minutesToRender,
|
|
5020
5190
|
readyHours,
|
|
5021
5191
|
readyMinutes,
|
|
5022
|
-
|
|
5023
|
-
|
|
5192
|
+
restInputFieldProps.onChangeValue,
|
|
5193
|
+
restInputFieldProps.onBlur
|
|
5024
5194
|
]
|
|
5025
5195
|
);
|
|
5026
5196
|
const onClickHour = useCallback10(
|
|
5027
5197
|
(hour) => {
|
|
5028
5198
|
const value = `${hour.toString().padStart(2, "0")}:${internalValue?.toString().split(":")[1] || "00"}`;
|
|
5029
|
-
|
|
5199
|
+
restInputFieldProps.onChangeValue?.(value);
|
|
5030
5200
|
setInternalValue(value);
|
|
5031
5201
|
},
|
|
5032
|
-
[internalValue,
|
|
5202
|
+
[internalValue, restInputFieldProps.onChangeValue]
|
|
5033
5203
|
);
|
|
5034
5204
|
const onClickMinute = useCallback10(
|
|
5035
5205
|
(minute) => {
|
|
5036
5206
|
const value = `${internalValue?.toString().split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
|
|
5037
|
-
|
|
5207
|
+
restInputFieldProps.onChangeValue?.(value);
|
|
5038
5208
|
setInternalValue(value);
|
|
5039
5209
|
},
|
|
5040
|
-
[internalValue,
|
|
5210
|
+
[internalValue, restInputFieldProps.onChangeValue]
|
|
5041
5211
|
);
|
|
5042
5212
|
useEffect9(() => {
|
|
5043
5213
|
if (isOpen && selectedHourRef.current)
|
|
@@ -5050,6 +5220,7 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5050
5220
|
return /* @__PURE__ */ jsx17(
|
|
5051
5221
|
InputFieldComponent,
|
|
5052
5222
|
{
|
|
5223
|
+
...betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5053
5224
|
type: "time",
|
|
5054
5225
|
insideInputFieldAfterComponent: !isMobileIOS ? /* @__PURE__ */ jsx17(
|
|
5055
5226
|
Div_default,
|
|
@@ -5138,13 +5309,18 @@ InputFieldComponent.time = forwardRef11(function Time({ hoursToRender, minutesTo
|
|
|
5138
5309
|
holderRef,
|
|
5139
5310
|
ref,
|
|
5140
5311
|
...props,
|
|
5141
|
-
...
|
|
5312
|
+
...restInputFieldProps,
|
|
5142
5313
|
minWidth: buttonWidth * 2 + 2,
|
|
5143
5314
|
onBlur
|
|
5144
5315
|
}
|
|
5145
5316
|
);
|
|
5146
5317
|
});
|
|
5147
|
-
InputFieldComponent.color = forwardRef11(function Color4(
|
|
5318
|
+
InputFieldComponent.color = forwardRef11(function Color4(inputFieldProps, ref) {
|
|
5319
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5320
|
+
const { value, onChangeValue, ...props } = useComponentsPropsMerger(
|
|
5321
|
+
betterHtmlContextInternal.components.inputField?.style?.time,
|
|
5322
|
+
inputFieldProps
|
|
5323
|
+
);
|
|
5148
5324
|
const [inputFieldValue, setInputFieldValue] = useState7(value ?? "#000000");
|
|
5149
5325
|
const onChangeValueElement = useCallback10(
|
|
5150
5326
|
(value2) => {
|
|
@@ -5160,6 +5336,7 @@ InputFieldComponent.color = forwardRef11(function Color4({ value, onChangeValue,
|
|
|
5160
5336
|
return /* @__PURE__ */ jsx17(
|
|
5161
5337
|
InputFieldComponent,
|
|
5162
5338
|
{
|
|
5339
|
+
...betterHtmlContextInternal.components.inputField?.style?.color,
|
|
5163
5340
|
type: "color",
|
|
5164
5341
|
insideInputFieldAfterComponent: /* @__PURE__ */ jsx17(
|
|
5165
5342
|
Div_default.row,
|
|
@@ -5294,8 +5471,14 @@ var SwitchElement = styled11.div.withConfig({
|
|
|
5294
5471
|
`;
|
|
5295
5472
|
var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
5296
5473
|
label,
|
|
5474
|
+
labelFontFamily,
|
|
5475
|
+
labelLetterSpacing,
|
|
5476
|
+
labelTextTransform,
|
|
5297
5477
|
labelColor,
|
|
5298
5478
|
text,
|
|
5479
|
+
textFontFamily,
|
|
5480
|
+
textLetterSpacing,
|
|
5481
|
+
textTextTransform,
|
|
5299
5482
|
textAdvanced,
|
|
5300
5483
|
errorText,
|
|
5301
5484
|
infoText,
|
|
@@ -5329,7 +5512,19 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5329
5512
|
}, [checked, controlledChecked, onChange, value]);
|
|
5330
5513
|
const readyId = id ?? internalId;
|
|
5331
5514
|
return /* @__PURE__ */ jsxs15(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5332
|
-
label && /* @__PURE__ */ jsx18(
|
|
5515
|
+
label && /* @__PURE__ */ jsx18(
|
|
5516
|
+
Label_default,
|
|
5517
|
+
{
|
|
5518
|
+
text: label,
|
|
5519
|
+
fontFamily: labelFontFamily,
|
|
5520
|
+
letterSpacing: labelLetterSpacing,
|
|
5521
|
+
textTransform: labelTextTransform,
|
|
5522
|
+
color: labelColor,
|
|
5523
|
+
required,
|
|
5524
|
+
isError: !!errorText,
|
|
5525
|
+
htmlFor: readyId
|
|
5526
|
+
}
|
|
5527
|
+
),
|
|
5333
5528
|
/* @__PURE__ */ jsxs15(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5334
5529
|
/* @__PURE__ */ jsxs15(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5335
5530
|
/* @__PURE__ */ jsx18(
|
|
@@ -5377,13 +5572,25 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5377
5572
|
}
|
|
5378
5573
|
) : void 0
|
|
5379
5574
|
] }),
|
|
5380
|
-
text ? /* @__PURE__ */ jsxs15(
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5575
|
+
text ? /* @__PURE__ */ jsxs15(
|
|
5576
|
+
Text_default,
|
|
5577
|
+
{
|
|
5578
|
+
fontFamily: textFontFamily,
|
|
5579
|
+
letterSpacing: textLetterSpacing,
|
|
5580
|
+
textTransform: textTextTransform,
|
|
5581
|
+
color,
|
|
5582
|
+
userSelect: "none",
|
|
5583
|
+
cursor: "pointer",
|
|
5584
|
+
onClick: onClickText,
|
|
5585
|
+
children: [
|
|
5586
|
+
text,
|
|
5587
|
+
required && !label && /* @__PURE__ */ jsxs15(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5588
|
+
" ",
|
|
5589
|
+
"*"
|
|
5590
|
+
] })
|
|
5591
|
+
]
|
|
5592
|
+
}
|
|
5593
|
+
) : textAdvanced ? /* @__PURE__ */ jsxs15(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5387
5594
|
textAdvanced,
|
|
5388
5595
|
required && !label && /* @__PURE__ */ jsxs15(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5389
5596
|
" ",
|
|
@@ -5404,25 +5611,43 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5404
5611
|
] });
|
|
5405
5612
|
});
|
|
5406
5613
|
var ToggleInput_default = {
|
|
5407
|
-
checkbox: forwardRef12(function Checkbox(
|
|
5614
|
+
checkbox: forwardRef12(function Checkbox(checkboxProps, ref) {
|
|
5615
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5616
|
+
const props = useComponentsPropsMerger(
|
|
5617
|
+
betterHtmlContextInternal.components.toggleInput?.style?.checkbox,
|
|
5618
|
+
checkboxProps
|
|
5619
|
+
);
|
|
5408
5620
|
return /* @__PURE__ */ jsx18(ToggleInputComponent, { type: "checkbox", ref, ...props });
|
|
5409
5621
|
}),
|
|
5410
|
-
radiobutton: forwardRef12(function RadioButton(
|
|
5622
|
+
radiobutton: forwardRef12(function RadioButton(radiobuttonProps, ref) {
|
|
5623
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5624
|
+
const props = useComponentsPropsMerger(
|
|
5625
|
+
betterHtmlContextInternal.components.toggleInput?.style?.radiobutton,
|
|
5626
|
+
radiobuttonProps
|
|
5627
|
+
);
|
|
5411
5628
|
return /* @__PURE__ */ jsx18(ToggleInputComponent, { type: "radio", ref, ...props });
|
|
5412
5629
|
}),
|
|
5413
|
-
switch: forwardRef12(function Switch({
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5630
|
+
switch: forwardRef12(function Switch(switchProps, ref) {
|
|
5631
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
5632
|
+
const {
|
|
5633
|
+
label,
|
|
5634
|
+
labelFontFamily,
|
|
5635
|
+
labelLetterSpacing,
|
|
5636
|
+
labelTextTransform,
|
|
5637
|
+
labelColor,
|
|
5638
|
+
errorText,
|
|
5639
|
+
infoText,
|
|
5640
|
+
disabled,
|
|
5641
|
+
value,
|
|
5642
|
+
onChange,
|
|
5643
|
+
checked: controlledChecked,
|
|
5644
|
+
required,
|
|
5645
|
+
id,
|
|
5646
|
+
...props
|
|
5647
|
+
} = useComponentsPropsMerger(
|
|
5648
|
+
betterHtmlContextInternal.components.toggleInput?.style?.switch,
|
|
5649
|
+
switchProps
|
|
5650
|
+
);
|
|
5426
5651
|
const theme2 = useTheme20();
|
|
5427
5652
|
const internalId = useId3();
|
|
5428
5653
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
@@ -5439,7 +5664,19 @@ var ToggleInput_default = {
|
|
|
5439
5664
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5440
5665
|
const readyId = id ?? internalId;
|
|
5441
5666
|
return /* @__PURE__ */ jsxs15(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5442
|
-
label && /* @__PURE__ */ jsx18(
|
|
5667
|
+
label && /* @__PURE__ */ jsx18(
|
|
5668
|
+
Label_default,
|
|
5669
|
+
{
|
|
5670
|
+
text: label,
|
|
5671
|
+
fontFamily: labelFontFamily,
|
|
5672
|
+
letterSpacing: labelLetterSpacing,
|
|
5673
|
+
textTransform: labelTextTransform,
|
|
5674
|
+
color: labelColor,
|
|
5675
|
+
required,
|
|
5676
|
+
isError: !!errorText,
|
|
5677
|
+
htmlFor: readyId
|
|
5678
|
+
}
|
|
5679
|
+
),
|
|
5443
5680
|
/* @__PURE__ */ jsx18(
|
|
5444
5681
|
Div_default.row,
|
|
5445
5682
|
{
|
|
@@ -7445,12 +7682,12 @@ var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
|
7445
7682
|
gap: iconGap,
|
|
7446
7683
|
whiteSpace: "nowrap",
|
|
7447
7684
|
backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ? lightenColor3(theme2.colors.primary, 0.7) : lightenColor3(theme2.colors.primary, 0.85)) : readyBackgroundColor,
|
|
7448
|
-
backgroundColorHover: hoverItemColor,
|
|
7685
|
+
backgroundColorHover: isActive && activeItemColor ? void 0 : hoverItemColor,
|
|
7449
7686
|
borderRadius: theme2.styles.borderRadius,
|
|
7450
7687
|
paddingBlock,
|
|
7451
7688
|
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7452
7689
|
paddingRight: theme2.styles.space,
|
|
7453
|
-
filterHover: !hoverItemColor ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
|
|
7690
|
+
filterHover: !hoverItemColor || isActive ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
|
|
7454
7691
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7455
7692
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7456
7693
|
opacity: item.disabled ? 0.6 : void 0,
|