react-better-html 1.1.287 → 1.1.289
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 +107 -99
- package/dist/index.d.ts +107 -99
- package/dist/index.js +79 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1558,6 +1558,7 @@ Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size
|
|
|
1558
1558
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
1559
1559
|
const props = useComponentsPropsMerger(betterHtmlContextInternal.components.image?.style?.default, ImageProps3);
|
|
1560
1560
|
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
1561
|
+
const lettersSplit = letters?.split(" ") ?? [];
|
|
1561
1562
|
return letters ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1562
1563
|
Div_default.row,
|
|
1563
1564
|
{
|
|
@@ -1571,7 +1572,7 @@ Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size
|
|
|
1571
1572
|
...props,
|
|
1572
1573
|
width: size,
|
|
1573
1574
|
height: size,
|
|
1574
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: letterColor ?? theme2.colors.textPrimary, children: letters.toUpperCase().slice(0, 2) })
|
|
1575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: letterColor ?? theme2.colors.textPrimary, children: lettersSplit.length > 1 ? lettersSplit[0][0] + (lettersSplit.at(-1)?.[0] ?? lettersSplit[0][1] ?? "") : letters.toUpperCase().slice(0, 2) })
|
|
1575
1576
|
}
|
|
1576
1577
|
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1577
1578
|
Image,
|
|
@@ -2079,7 +2080,11 @@ var filterHover = () => {
|
|
|
2079
2080
|
z05: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.2)" : "brightness(0.95)",
|
|
2080
2081
|
z1: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.3)" : "brightness(0.9)",
|
|
2081
2082
|
z2: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.6)" : "brightness(0.8)",
|
|
2082
|
-
z3: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.9)" : "brightness(0.7)"
|
|
2083
|
+
z3: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.9)" : "brightness(0.7)",
|
|
2084
|
+
b05: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.8)" : "brightness(1.05)",
|
|
2085
|
+
b1: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.7)" : "brightness(1.1)",
|
|
2086
|
+
b2: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.4)" : "brightness(1.2)",
|
|
2087
|
+
b3: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.1)" : "brightness(1.3)"
|
|
2083
2088
|
};
|
|
2084
2089
|
};
|
|
2085
2090
|
|
|
@@ -2383,6 +2388,29 @@ ButtonComponent.destructive = function Destructive(buttonProps) {
|
|
|
2383
2388
|
}
|
|
2384
2389
|
);
|
|
2385
2390
|
};
|
|
2391
|
+
ButtonComponent.text = function Text3(buttonProps) {
|
|
2392
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2393
|
+
const { color, ...props } = useComponentsPropsMerger(
|
|
2394
|
+
betterHtmlContextInternal.components.button?.style?.text,
|
|
2395
|
+
buttonProps
|
|
2396
|
+
);
|
|
2397
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2398
|
+
const readyColor = color ?? theme2.colors.textPrimary;
|
|
2399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2400
|
+
ButtonComponent,
|
|
2401
|
+
{
|
|
2402
|
+
color: readyColor,
|
|
2403
|
+
colorHover: (0, import_react_better_core9.lightenColor)(readyColor, 0.3),
|
|
2404
|
+
backgroundColor: "transparent",
|
|
2405
|
+
backgroundColorHover: "transparent",
|
|
2406
|
+
borderRadius: 0,
|
|
2407
|
+
loaderSize: 12,
|
|
2408
|
+
isSmall: true,
|
|
2409
|
+
...fromSubcomponentProps,
|
|
2410
|
+
...props
|
|
2411
|
+
}
|
|
2412
|
+
);
|
|
2413
|
+
};
|
|
2386
2414
|
ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...buttonProps }) {
|
|
2387
2415
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2388
2416
|
const { ...props } = useComponentsPropsMerger(
|
|
@@ -2442,6 +2470,7 @@ ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...button
|
|
|
2442
2470
|
var Button2 = (0, import_react10.memo)(ButtonComponent);
|
|
2443
2471
|
Button2.secondary = ButtonComponent.secondary;
|
|
2444
2472
|
Button2.destructive = ButtonComponent.destructive;
|
|
2473
|
+
Button2.text = ButtonComponent.text;
|
|
2445
2474
|
Button2.icon = ButtonComponent.icon;
|
|
2446
2475
|
Button2.upload = ButtonComponent.upload;
|
|
2447
2476
|
var Button_default = Button2;
|
|
@@ -3851,6 +3880,7 @@ var DropdownComponent = (0, import_react19.forwardRef)(function Dropdown(dropdow
|
|
|
3851
3880
|
labelGap,
|
|
3852
3881
|
errorText,
|
|
3853
3882
|
infoText,
|
|
3883
|
+
infoTextColor,
|
|
3854
3884
|
required,
|
|
3855
3885
|
name,
|
|
3856
3886
|
disabled,
|
|
@@ -4097,6 +4127,7 @@ var DropdownComponent = (0, import_react19.forwardRef)(function Dropdown(dropdow
|
|
|
4097
4127
|
labelGap,
|
|
4098
4128
|
errorText,
|
|
4099
4129
|
infoText,
|
|
4130
|
+
infoTextColor,
|
|
4100
4131
|
required: withMultiselect ? (Array.isArray(value) ? value.length > 0 : value !== void 0) ? false : required : required,
|
|
4101
4132
|
textAlign,
|
|
4102
4133
|
name,
|
|
@@ -4749,6 +4780,7 @@ var InputFieldComponent = (0, import_react22.forwardRef)(function InputField(inp
|
|
|
4749
4780
|
labelGap,
|
|
4750
4781
|
errorText,
|
|
4751
4782
|
infoText,
|
|
4783
|
+
infoTextColor,
|
|
4752
4784
|
leftIcon,
|
|
4753
4785
|
rightIcon,
|
|
4754
4786
|
prefix,
|
|
@@ -4914,7 +4946,7 @@ var InputFieldComponent = (0, import_react22.forwardRef)(function InputField(inp
|
|
|
4914
4946
|
as: "span",
|
|
4915
4947
|
display: "block",
|
|
4916
4948
|
fontSize: 14,
|
|
4917
|
-
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4949
|
+
color: errorText ? theme2.colors.error : infoTextColor ?? labelColor ?? theme2.colors.textSecondary,
|
|
4918
4950
|
children: errorText || infoText
|
|
4919
4951
|
}
|
|
4920
4952
|
)
|
|
@@ -5918,6 +5950,7 @@ var ToggleInputComponent = (0, import_react23.forwardRef)(function ToggleInput({
|
|
|
5918
5950
|
textAdvanced,
|
|
5919
5951
|
errorText,
|
|
5920
5952
|
infoText,
|
|
5953
|
+
infoTextColor,
|
|
5921
5954
|
size = componentSize,
|
|
5922
5955
|
value,
|
|
5923
5956
|
onChange,
|
|
@@ -6047,7 +6080,7 @@ var ToggleInputComponent = (0, import_react23.forwardRef)(function ToggleInput({
|
|
|
6047
6080
|
as: "span",
|
|
6048
6081
|
display: "block",
|
|
6049
6082
|
fontSize: 14,
|
|
6050
|
-
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
6083
|
+
color: errorText ? theme2.colors.error : infoTextColor ?? labelColor ?? theme2.colors.textSecondary,
|
|
6051
6084
|
children: errorText || infoText
|
|
6052
6085
|
}
|
|
6053
6086
|
)
|
|
@@ -6174,30 +6207,32 @@ var ToggleInput_default = {
|
|
|
6174
6207
|
var import_react24 = require("react");
|
|
6175
6208
|
var import_react_better_core21 = require("react-better-core");
|
|
6176
6209
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6177
|
-
var FormComponent = (0, import_react24.forwardRef)(function Form({
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6210
|
+
var FormComponent = (0, import_react24.forwardRef)(function Form(formProps, ref) {
|
|
6211
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
6212
|
+
const {
|
|
6213
|
+
form,
|
|
6214
|
+
name,
|
|
6215
|
+
submitButtonText,
|
|
6216
|
+
submitButtonLoaderName,
|
|
6217
|
+
submitButtonIsLoading,
|
|
6218
|
+
submitButtonId,
|
|
6219
|
+
submitButtonIsDisabled,
|
|
6220
|
+
cancelButtonText,
|
|
6221
|
+
cancelButtonLoaderName,
|
|
6222
|
+
cancelButtonIsLoading,
|
|
6223
|
+
cancelButtonId,
|
|
6224
|
+
cancelButtonIsDisabled,
|
|
6225
|
+
actionButtonsLocation = "right",
|
|
6226
|
+
gap,
|
|
6227
|
+
isDestructive,
|
|
6228
|
+
withDividers,
|
|
6229
|
+
renderActionButtons,
|
|
6230
|
+
onClickCancel,
|
|
6231
|
+
onSubmit,
|
|
6232
|
+
id,
|
|
6233
|
+
children,
|
|
6234
|
+
...props
|
|
6235
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.form?.style?.default, formProps);
|
|
6201
6236
|
const theme2 = (0, import_react_better_core21.useTheme)();
|
|
6202
6237
|
const submitButtonIsDisabledInternal = (0, import_react24.useMemo)(() => {
|
|
6203
6238
|
if (!form || !form.requiredFields) return false;
|
|
@@ -6207,6 +6242,17 @@ var FormComponent = (0, import_react24.forwardRef)(function Form({
|
|
|
6207
6242
|
}, [form]);
|
|
6208
6243
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
6209
6244
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
6245
|
+
const cancelButton = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6246
|
+
Button_default.secondary,
|
|
6247
|
+
{
|
|
6248
|
+
text: cancelButtonText ?? "Cancel",
|
|
6249
|
+
isLoading: cancelButtonIsLoading,
|
|
6250
|
+
loaderName: cancelButtonLoaderName,
|
|
6251
|
+
disabled: cancelButtonIsDisabled,
|
|
6252
|
+
id: cancelButtonId,
|
|
6253
|
+
onClick: onClickCancel
|
|
6254
|
+
}
|
|
6255
|
+
);
|
|
6210
6256
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { name, onSubmit: onSubmit ?? form?.onSubmit, id, ref, children: [
|
|
6211
6257
|
gap !== void 0 || withDividers ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? import_react24.Children.toArray(children).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react24.Fragment, { children: [
|
|
6212
6258
|
child,
|
|
@@ -6225,18 +6271,8 @@ var FormComponent = (0, import_react24.forwardRef)(function Form({
|
|
|
6225
6271
|
gap: theme2.styles.gap,
|
|
6226
6272
|
marginTop: theme2.styles.space,
|
|
6227
6273
|
children: [
|
|
6228
|
-
renderActionButtons,
|
|
6229
|
-
|
|
6230
|
-
Button_default.secondary,
|
|
6231
|
-
{
|
|
6232
|
-
text: cancelButtonText ?? "Cancel",
|
|
6233
|
-
isLoading: cancelButtonIsLoading,
|
|
6234
|
-
loaderName: cancelButtonLoaderName,
|
|
6235
|
-
disabled: cancelButtonIsDisabled,
|
|
6236
|
-
id: cancelButtonId,
|
|
6237
|
-
onClick: onClickCancel
|
|
6238
|
-
}
|
|
6239
|
-
),
|
|
6274
|
+
actionButtonsLocation === "right" && renderActionButtons,
|
|
6275
|
+
actionButtonsLocation === "right" && onClickCancel ? cancelButton : void 0,
|
|
6240
6276
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6241
6277
|
SubmitButtonTag,
|
|
6242
6278
|
{
|
|
@@ -6247,7 +6283,9 @@ var FormComponent = (0, import_react24.forwardRef)(function Form({
|
|
|
6247
6283
|
id: submitButtonId,
|
|
6248
6284
|
isSubmit: true
|
|
6249
6285
|
}
|
|
6250
|
-
)
|
|
6286
|
+
),
|
|
6287
|
+
actionButtonsLocation === "left" && onClickCancel ? cancelButton : void 0,
|
|
6288
|
+
actionButtonsLocation === "left" && renderActionButtons
|
|
6251
6289
|
]
|
|
6252
6290
|
}
|
|
6253
6291
|
)
|