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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useLoader as useLoader2,
|
|
5
5
|
useLoaderControls,
|
|
6
6
|
countries as countries3,
|
|
7
|
-
lightenColor as
|
|
7
|
+
lightenColor as lightenColor5,
|
|
8
8
|
darkenColor as darkenColor4,
|
|
9
9
|
saturateColor,
|
|
10
10
|
desaturateColor,
|
|
@@ -1485,6 +1485,7 @@ Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, let
|
|
|
1485
1485
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
1486
1486
|
const props = useComponentsPropsMerger(betterHtmlContextInternal.components.image?.style?.default, ImageProps3);
|
|
1487
1487
|
const theme2 = useTheme4();
|
|
1488
|
+
const lettersSplit = letters?.split(" ") ?? [];
|
|
1488
1489
|
return letters ? /* @__PURE__ */ jsx3(
|
|
1489
1490
|
Div_default.row,
|
|
1490
1491
|
{
|
|
@@ -1498,7 +1499,7 @@ Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, let
|
|
|
1498
1499
|
...props,
|
|
1499
1500
|
width: size,
|
|
1500
1501
|
height: size,
|
|
1501
|
-
children: /* @__PURE__ */ jsx3(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: letterColor ?? theme2.colors.textPrimary, children: letters.toUpperCase().slice(0, 2) })
|
|
1502
|
+
children: /* @__PURE__ */ jsx3(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) })
|
|
1502
1503
|
}
|
|
1503
1504
|
) : /* @__PURE__ */ jsx3(
|
|
1504
1505
|
Image,
|
|
@@ -1939,6 +1940,7 @@ var localStoragePlugin = (options) => ({
|
|
|
1939
1940
|
// src/components/Button.tsx
|
|
1940
1941
|
import { memo as memo8, useCallback as useCallback4 } from "react";
|
|
1941
1942
|
import {
|
|
1943
|
+
lightenColor,
|
|
1942
1944
|
useBetterCoreContext as useBetterCoreContext3,
|
|
1943
1945
|
useLoader,
|
|
1944
1946
|
useTheme as useTheme9
|
|
@@ -2010,7 +2012,11 @@ var filterHover = () => {
|
|
|
2010
2012
|
z05: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.2)" : "brightness(0.95)",
|
|
2011
2013
|
z1: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.3)" : "brightness(0.9)",
|
|
2012
2014
|
z2: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.6)" : "brightness(0.8)",
|
|
2013
|
-
z3: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.9)" : "brightness(0.7)"
|
|
2015
|
+
z3: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(1.9)" : "brightness(0.7)",
|
|
2016
|
+
b05: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.8)" : "brightness(1.05)",
|
|
2017
|
+
b1: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.7)" : "brightness(1.1)",
|
|
2018
|
+
b2: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.4)" : "brightness(1.2)",
|
|
2019
|
+
b3: externalBetterCoreContextValue.colorTheme === "dark" ? "brightness(0.1)" : "brightness(1.3)"
|
|
2014
2020
|
};
|
|
2015
2021
|
};
|
|
2016
2022
|
|
|
@@ -2314,6 +2320,29 @@ ButtonComponent.destructive = function Destructive(buttonProps) {
|
|
|
2314
2320
|
}
|
|
2315
2321
|
);
|
|
2316
2322
|
};
|
|
2323
|
+
ButtonComponent.text = function Text3(buttonProps) {
|
|
2324
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2325
|
+
const { color, ...props } = useComponentsPropsMerger(
|
|
2326
|
+
betterHtmlContextInternal.components.button?.style?.text,
|
|
2327
|
+
buttonProps
|
|
2328
|
+
);
|
|
2329
|
+
const theme2 = useTheme9();
|
|
2330
|
+
const readyColor = color ?? theme2.colors.textPrimary;
|
|
2331
|
+
return /* @__PURE__ */ jsx8(
|
|
2332
|
+
ButtonComponent,
|
|
2333
|
+
{
|
|
2334
|
+
color: readyColor,
|
|
2335
|
+
colorHover: lightenColor(readyColor, 0.3),
|
|
2336
|
+
backgroundColor: "transparent",
|
|
2337
|
+
backgroundColorHover: "transparent",
|
|
2338
|
+
borderRadius: 0,
|
|
2339
|
+
loaderSize: 12,
|
|
2340
|
+
isSmall: true,
|
|
2341
|
+
...fromSubcomponentProps,
|
|
2342
|
+
...props
|
|
2343
|
+
}
|
|
2344
|
+
);
|
|
2345
|
+
};
|
|
2317
2346
|
ButtonComponent.icon = function Icon3({ size = 16, buttonSize, backgroundButtonColor, ...buttonProps }) {
|
|
2318
2347
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2319
2348
|
const { ...props } = useComponentsPropsMerger(
|
|
@@ -2373,6 +2402,7 @@ ButtonComponent.upload = function Upload({ accept, multiple, onUpload, ...button
|
|
|
2373
2402
|
var Button2 = memo8(ButtonComponent);
|
|
2374
2403
|
Button2.secondary = ButtonComponent.secondary;
|
|
2375
2404
|
Button2.destructive = ButtonComponent.destructive;
|
|
2405
|
+
Button2.text = ButtonComponent.text;
|
|
2376
2406
|
Button2.icon = ButtonComponent.icon;
|
|
2377
2407
|
Button2.upload = ButtonComponent.upload;
|
|
2378
2408
|
var Button_default = Button2;
|
|
@@ -3627,7 +3657,7 @@ var PageHolder_default = PageHolder2;
|
|
|
3627
3657
|
|
|
3628
3658
|
// src/components/Chip.tsx
|
|
3629
3659
|
import { forwardRef as forwardRef9, memo as memo14, useCallback as useCallback8 } from "react";
|
|
3630
|
-
import { darkenColor, lightenColor, useBetterCoreContext as useBetterCoreContext6, useTheme as useTheme15 } from "react-better-core";
|
|
3660
|
+
import { darkenColor, lightenColor as lightenColor2, useBetterCoreContext as useBetterCoreContext6, useTheme as useTheme15 } from "react-better-core";
|
|
3631
3661
|
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3632
3662
|
var borderRadiusOffset = 1.3;
|
|
3633
3663
|
var ChipComponent = forwardRef9(function Chip({ fromSubcomponent, ...chipProps }, ref) {
|
|
@@ -3689,7 +3719,7 @@ ChipComponent.colored = forwardRef9(function Colored({ color, withWhiteBackgroun
|
|
|
3689
3719
|
const chip = /* @__PURE__ */ jsx15(
|
|
3690
3720
|
ChipComponent,
|
|
3691
3721
|
{
|
|
3692
|
-
color: colorTheme === "light" ? darkenColor(readyColor, 0.7) :
|
|
3722
|
+
color: colorTheme === "light" ? darkenColor(readyColor, 0.7) : lightenColor2(readyColor, 0.7),
|
|
3693
3723
|
backgroundColor: readyColor + "40",
|
|
3694
3724
|
border: `${theme2.styles.borderWidth}px solid ${readyColor}`,
|
|
3695
3725
|
ref,
|
|
@@ -3714,7 +3744,7 @@ var Chip_default = Chip2;
|
|
|
3714
3744
|
import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback11, useState as useState7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef5, useId as useId2 } from "react";
|
|
3715
3745
|
import {
|
|
3716
3746
|
darkenColor as darkenColor2,
|
|
3717
|
-
lightenColor as
|
|
3747
|
+
lightenColor as lightenColor3,
|
|
3718
3748
|
useBooleanState as useBooleanState5,
|
|
3719
3749
|
useDebounceState as useDebounceState2,
|
|
3720
3750
|
countries as countries2,
|
|
@@ -3800,6 +3830,7 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
3800
3830
|
labelGap,
|
|
3801
3831
|
errorText,
|
|
3802
3832
|
infoText,
|
|
3833
|
+
infoTextColor,
|
|
3803
3834
|
required,
|
|
3804
3835
|
name,
|
|
3805
3836
|
disabled,
|
|
@@ -4046,6 +4077,7 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
4046
4077
|
labelGap,
|
|
4047
4078
|
errorText,
|
|
4048
4079
|
infoText,
|
|
4080
|
+
infoTextColor,
|
|
4049
4081
|
required: withMultiselect ? (Array.isArray(value) ? value.length > 0 : value !== void 0) ? false : required : required,
|
|
4050
4082
|
textAlign,
|
|
4051
4083
|
name,
|
|
@@ -4698,6 +4730,7 @@ var InputFieldComponent = forwardRef11(function InputField(inputFieldProps, ref)
|
|
|
4698
4730
|
labelGap,
|
|
4699
4731
|
errorText,
|
|
4700
4732
|
infoText,
|
|
4733
|
+
infoTextColor,
|
|
4701
4734
|
leftIcon,
|
|
4702
4735
|
rightIcon,
|
|
4703
4736
|
prefix,
|
|
@@ -4774,7 +4807,7 @@ var InputFieldComponent = forwardRef11(function InputField(inputFieldProps, ref)
|
|
|
4774
4807
|
justifyContent: "center",
|
|
4775
4808
|
border: `${theme2.styles.borderWidth}px solid ${theme2.colors.border}`,
|
|
4776
4809
|
borderRight: "none",
|
|
4777
|
-
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(theme2.colors.backgroundContent, 0.03) :
|
|
4810
|
+
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(theme2.colors.backgroundContent, 0.03) : lightenColor3(theme2.colors.backgroundContent, 0.1)),
|
|
4778
4811
|
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
4779
4812
|
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4780
4813
|
paddingInline: theme2.styles.space,
|
|
@@ -4849,7 +4882,7 @@ var InputFieldComponent = forwardRef11(function InputField(inputFieldProps, ref)
|
|
|
4849
4882
|
justifyContent: "center",
|
|
4850
4883
|
border: `${theme2.styles.borderWidth}px solid ${theme2.colors.border}`,
|
|
4851
4884
|
borderLeft: "none",
|
|
4852
|
-
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(theme2.colors.backgroundContent, 0.03) :
|
|
4885
|
+
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(theme2.colors.backgroundContent, 0.03) : lightenColor3(theme2.colors.backgroundContent, 0.1)),
|
|
4853
4886
|
borderTopRightRadius: theme2.styles.borderRadius,
|
|
4854
4887
|
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4855
4888
|
paddingInline: theme2.styles.space,
|
|
@@ -4863,7 +4896,7 @@ var InputFieldComponent = forwardRef11(function InputField(inputFieldProps, ref)
|
|
|
4863
4896
|
as: "span",
|
|
4864
4897
|
display: "block",
|
|
4865
4898
|
fontSize: 14,
|
|
4866
|
-
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4899
|
+
color: errorText ? theme2.colors.error : infoTextColor ?? labelColor ?? theme2.colors.textSecondary,
|
|
4867
4900
|
children: errorText || infoText
|
|
4868
4901
|
}
|
|
4869
4902
|
)
|
|
@@ -5867,6 +5900,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5867
5900
|
textAdvanced,
|
|
5868
5901
|
errorText,
|
|
5869
5902
|
infoText,
|
|
5903
|
+
infoTextColor,
|
|
5870
5904
|
size = componentSize,
|
|
5871
5905
|
value,
|
|
5872
5906
|
onChange,
|
|
@@ -5996,7 +6030,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5996
6030
|
as: "span",
|
|
5997
6031
|
display: "block",
|
|
5998
6032
|
fontSize: 14,
|
|
5999
|
-
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
6033
|
+
color: errorText ? theme2.colors.error : infoTextColor ?? labelColor ?? theme2.colors.textSecondary,
|
|
6000
6034
|
children: errorText || infoText
|
|
6001
6035
|
}
|
|
6002
6036
|
)
|
|
@@ -6123,30 +6157,32 @@ var ToggleInput_default = {
|
|
|
6123
6157
|
import { Children, forwardRef as forwardRef13, Fragment as Fragment7, memo as memo19, useMemo as useMemo7 } from "react";
|
|
6124
6158
|
import { useTheme as useTheme21 } from "react-better-core";
|
|
6125
6159
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6126
|
-
var FormComponent = forwardRef13(function Form({
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6160
|
+
var FormComponent = forwardRef13(function Form(formProps, ref) {
|
|
6161
|
+
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
6162
|
+
const {
|
|
6163
|
+
form,
|
|
6164
|
+
name,
|
|
6165
|
+
submitButtonText,
|
|
6166
|
+
submitButtonLoaderName,
|
|
6167
|
+
submitButtonIsLoading,
|
|
6168
|
+
submitButtonId,
|
|
6169
|
+
submitButtonIsDisabled,
|
|
6170
|
+
cancelButtonText,
|
|
6171
|
+
cancelButtonLoaderName,
|
|
6172
|
+
cancelButtonIsLoading,
|
|
6173
|
+
cancelButtonId,
|
|
6174
|
+
cancelButtonIsDisabled,
|
|
6175
|
+
actionButtonsLocation = "right",
|
|
6176
|
+
gap,
|
|
6177
|
+
isDestructive,
|
|
6178
|
+
withDividers,
|
|
6179
|
+
renderActionButtons,
|
|
6180
|
+
onClickCancel,
|
|
6181
|
+
onSubmit,
|
|
6182
|
+
id,
|
|
6183
|
+
children,
|
|
6184
|
+
...props
|
|
6185
|
+
} = useComponentsPropsMerger(betterHtmlContextInternal.components.form?.style?.default, formProps);
|
|
6150
6186
|
const theme2 = useTheme21();
|
|
6151
6187
|
const submitButtonIsDisabledInternal = useMemo7(() => {
|
|
6152
6188
|
if (!form || !form.requiredFields) return false;
|
|
@@ -6156,6 +6192,17 @@ var FormComponent = forwardRef13(function Form({
|
|
|
6156
6192
|
}, [form]);
|
|
6157
6193
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
6158
6194
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
6195
|
+
const cancelButton = /* @__PURE__ */ jsx20(
|
|
6196
|
+
Button_default.secondary,
|
|
6197
|
+
{
|
|
6198
|
+
text: cancelButtonText ?? "Cancel",
|
|
6199
|
+
isLoading: cancelButtonIsLoading,
|
|
6200
|
+
loaderName: cancelButtonLoaderName,
|
|
6201
|
+
disabled: cancelButtonIsDisabled,
|
|
6202
|
+
id: cancelButtonId,
|
|
6203
|
+
onClick: onClickCancel
|
|
6204
|
+
}
|
|
6205
|
+
);
|
|
6159
6206
|
return /* @__PURE__ */ jsx20(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ jsxs16("form", { name, onSubmit: onSubmit ?? form?.onSubmit, id, ref, children: [
|
|
6160
6207
|
gap !== void 0 || withDividers ? /* @__PURE__ */ jsx20(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? Children.toArray(children).map((child, index) => /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
6161
6208
|
child,
|
|
@@ -6174,18 +6221,8 @@ var FormComponent = forwardRef13(function Form({
|
|
|
6174
6221
|
gap: theme2.styles.gap,
|
|
6175
6222
|
marginTop: theme2.styles.space,
|
|
6176
6223
|
children: [
|
|
6177
|
-
renderActionButtons,
|
|
6178
|
-
|
|
6179
|
-
Button_default.secondary,
|
|
6180
|
-
{
|
|
6181
|
-
text: cancelButtonText ?? "Cancel",
|
|
6182
|
-
isLoading: cancelButtonIsLoading,
|
|
6183
|
-
loaderName: cancelButtonLoaderName,
|
|
6184
|
-
disabled: cancelButtonIsDisabled,
|
|
6185
|
-
id: cancelButtonId,
|
|
6186
|
-
onClick: onClickCancel
|
|
6187
|
-
}
|
|
6188
|
-
),
|
|
6224
|
+
actionButtonsLocation === "right" && renderActionButtons,
|
|
6225
|
+
actionButtonsLocation === "right" && onClickCancel ? cancelButton : void 0,
|
|
6189
6226
|
/* @__PURE__ */ jsx20(
|
|
6190
6227
|
SubmitButtonTag,
|
|
6191
6228
|
{
|
|
@@ -6196,7 +6233,9 @@ var FormComponent = forwardRef13(function Form({
|
|
|
6196
6233
|
id: submitButtonId,
|
|
6197
6234
|
isSubmit: true
|
|
6198
6235
|
}
|
|
6199
|
-
)
|
|
6236
|
+
),
|
|
6237
|
+
actionButtonsLocation === "left" && onClickCancel ? cancelButton : void 0,
|
|
6238
|
+
actionButtonsLocation === "left" && renderActionButtons
|
|
6200
6239
|
]
|
|
6201
6240
|
}
|
|
6202
6241
|
)
|
|
@@ -8046,7 +8085,7 @@ var Foldable_default = Foldable2;
|
|
|
8046
8085
|
import { createContext as createContext2, memo as memo27, useCallback as useCallback19, useContext as useContext2, useEffect as useEffect16, useMemo as useMemo12, useState as useState15 } from "react";
|
|
8047
8086
|
import {
|
|
8048
8087
|
calculateColorContrast,
|
|
8049
|
-
lightenColor as
|
|
8088
|
+
lightenColor as lightenColor4,
|
|
8050
8089
|
useBetterCoreContext as useBetterCoreContext10,
|
|
8051
8090
|
useBooleanState as useBooleanState8,
|
|
8052
8091
|
useTheme as useTheme29
|
|
@@ -8121,7 +8160,7 @@ var MenuItemTypeItem = memo27(function MenuItemTypeItem2({
|
|
|
8121
8160
|
alignItems: "center",
|
|
8122
8161
|
gap: iconGap,
|
|
8123
8162
|
whiteSpace: "nowrap",
|
|
8124
|
-
backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ?
|
|
8163
|
+
backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ? lightenColor4(theme2.colors.primary, 0.7) : lightenColor4(theme2.colors.primary, 0.85)) : readyBackgroundColor,
|
|
8125
8164
|
backgroundColorHover: isActive && activeItemColor ? void 0 : hoverItemColor,
|
|
8126
8165
|
borderRadius: theme2.styles.borderRadius,
|
|
8127
8166
|
paddingBlock,
|
|
@@ -8737,7 +8776,7 @@ export {
|
|
|
8737
8776
|
getPluralWord2 as getPluralWord,
|
|
8738
8777
|
isApiError,
|
|
8739
8778
|
isMobileDevice,
|
|
8740
|
-
|
|
8779
|
+
lightenColor5 as lightenColor,
|
|
8741
8780
|
loaderControls,
|
|
8742
8781
|
localStoragePlugin,
|
|
8743
8782
|
log,
|