react-better-html 1.1.290 → 1.1.292
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 +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +137 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +114 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
-
useTheme as
|
|
3
|
+
useTheme as useTheme31,
|
|
4
4
|
useLoader as useLoader2,
|
|
5
5
|
useLoaderControls,
|
|
6
6
|
countries as countries3,
|
|
@@ -3863,6 +3863,8 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
3863
3863
|
withMultiselect,
|
|
3864
3864
|
id,
|
|
3865
3865
|
textAlign,
|
|
3866
|
+
backgroundColor,
|
|
3867
|
+
borderRadius,
|
|
3866
3868
|
...props
|
|
3867
3869
|
} = useComponentsPropsMerger(
|
|
3868
3870
|
betterHtmlContextInternal.components.dropdown?.style?.default,
|
|
@@ -4088,6 +4090,8 @@ var DropdownComponent = forwardRef10(function Dropdown(dropdownProps, ref) {
|
|
|
4088
4090
|
infoTextColor,
|
|
4089
4091
|
required: withMultiselect ? (Array.isArray(value) ? value.length > 0 : value !== void 0) ? false : required : required,
|
|
4090
4092
|
textAlign,
|
|
4093
|
+
backgroundColor,
|
|
4094
|
+
borderRadius,
|
|
4091
4095
|
name,
|
|
4092
4096
|
disabled,
|
|
4093
4097
|
readOnly: !withSearch,
|
|
@@ -5800,13 +5804,24 @@ var componentSize = 26;
|
|
|
5800
5804
|
var switchComponentBallGap = 3;
|
|
5801
5805
|
var switchComponentMouseDownDifference = 4;
|
|
5802
5806
|
var InputElement2 = styled11.input.withConfig({
|
|
5803
|
-
shouldForwardProp: (prop) => ![
|
|
5807
|
+
shouldForwardProp: (prop) => ![
|
|
5808
|
+
"theme",
|
|
5809
|
+
"colorTheme",
|
|
5810
|
+
"style",
|
|
5811
|
+
"hoverStyle",
|
|
5812
|
+
"size",
|
|
5813
|
+
"withNoBorder",
|
|
5814
|
+
"inactiveColor",
|
|
5815
|
+
"activeColor",
|
|
5816
|
+
"inactiveBackgroundColor",
|
|
5817
|
+
"activeBackgroundColor"
|
|
5818
|
+
].includes(prop)
|
|
5804
5819
|
})`
|
|
5805
5820
|
position: relative;
|
|
5806
5821
|
appearance: none;
|
|
5807
5822
|
width: ${(props) => props.size ?? componentSize}px;
|
|
5808
5823
|
height: ${(props) => props.size ?? componentSize}px;
|
|
5809
|
-
background-color: ${(props) => props.theme.colors.backgroundContent};
|
|
5824
|
+
background-color: ${(props) => props.inactiveBackgroundColor ?? props.theme.colors.backgroundContent};
|
|
5810
5825
|
border: ${(props) => props.theme.styles.borderWidth}px solid ${(props) => props.theme.colors.border};
|
|
5811
5826
|
border-radius: ${(props) => props.theme.styles.borderRadius / 2}px;
|
|
5812
5827
|
cursor: pointer;
|
|
@@ -5818,8 +5833,8 @@ var InputElement2 = styled11.input.withConfig({
|
|
|
5818
5833
|
}
|
|
5819
5834
|
|
|
5820
5835
|
&:checked {
|
|
5821
|
-
background-color: ${(props) => props.theme.colors.primary};
|
|
5822
|
-
border-color: ${(props) => props.theme.colors.primary};
|
|
5836
|
+
background-color: ${(props) => props.activeBackgroundColor ?? props.theme.colors.primary};
|
|
5837
|
+
border-color: ${(props) => props.activeBackgroundColor ?? props.theme.colors.primary};
|
|
5823
5838
|
}
|
|
5824
5839
|
|
|
5825
5840
|
&:disabled {
|
|
@@ -5840,7 +5855,18 @@ var InputElement2 = styled11.input.withConfig({
|
|
|
5840
5855
|
}
|
|
5841
5856
|
`;
|
|
5842
5857
|
var SwitchElement = styled11.div.withConfig({
|
|
5843
|
-
shouldForwardProp: (prop) => ![
|
|
5858
|
+
shouldForwardProp: (prop) => ![
|
|
5859
|
+
"theme",
|
|
5860
|
+
"checked",
|
|
5861
|
+
"disabled",
|
|
5862
|
+
"isMouseDown",
|
|
5863
|
+
"style",
|
|
5864
|
+
"hoverStyle",
|
|
5865
|
+
"activeColor",
|
|
5866
|
+
"inactiveColor",
|
|
5867
|
+
"inactiveBackgroundColor",
|
|
5868
|
+
"activeBackgroundColor"
|
|
5869
|
+
].includes(prop)
|
|
5844
5870
|
})`
|
|
5845
5871
|
--width: ${(props) => componentSize * 2 - props.theme.styles.gap / 2}px;
|
|
5846
5872
|
--ball-size: ${componentSize - switchComponentBallGap * 2}px;
|
|
@@ -5848,7 +5874,7 @@ var SwitchElement = styled11.div.withConfig({
|
|
|
5848
5874
|
position: relative;
|
|
5849
5875
|
width: var(--width);
|
|
5850
5876
|
height: ${componentSize}px;
|
|
5851
|
-
background-color: ${(props) => props.checked ? props.theme.colors.primary : props.theme.colors.border};
|
|
5877
|
+
background-color: ${(props) => props.checked ? props.activeBackgroundColor ?? props.theme.colors.primary : props.inactiveBackgroundColor ?? props.theme.colors.border};
|
|
5852
5878
|
border-radius: 999px;
|
|
5853
5879
|
cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
|
|
5854
5880
|
opacity: ${(props) => props.disabled ? 0.5 : 1};
|
|
@@ -5859,7 +5885,7 @@ var SwitchElement = styled11.div.withConfig({
|
|
|
5859
5885
|
position: absolute;
|
|
5860
5886
|
width: ${(props) => componentSize - switchComponentBallGap * 2 + (props.isMouseDown ? switchComponentMouseDownDifference : 0)}px;
|
|
5861
5887
|
height: ${componentSize - switchComponentBallGap * 2}px;
|
|
5862
|
-
background-color: ${(props) => props.theme.colors.base};
|
|
5888
|
+
background-color: ${(props) => props.checked ? props.activeColor ?? props.theme.colors.base : props.inactiveColor ?? props.theme.colors.base};
|
|
5863
5889
|
border-radius: 999px;
|
|
5864
5890
|
top: ${switchComponentBallGap}px;
|
|
5865
5891
|
left: ${switchComponentBallGap}px;
|
|
@@ -5875,7 +5901,7 @@ var SwitchElement = styled11.div.withConfig({
|
|
|
5875
5901
|
position: absolute;
|
|
5876
5902
|
width: ${(props) => componentSize - switchComponentBallGap * 2 + (props.isMouseDown ? switchComponentMouseDownDifference : 0)}px;
|
|
5877
5903
|
height: ${componentSize - switchComponentBallGap * 2}px;
|
|
5878
|
-
background-color: ${(props) => props.checked ? props.theme.colors.primary : "transparent"};
|
|
5904
|
+
background-color: ${(props) => props.checked ? props.activeBackgroundColor ?? props.theme.colors.primary : "transparent"};
|
|
5879
5905
|
border-radius: 999px;
|
|
5880
5906
|
top: ${switchComponentBallGap}px;
|
|
5881
5907
|
left: ${switchComponentBallGap}px;
|
|
@@ -5909,6 +5935,10 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5909
5935
|
errorText,
|
|
5910
5936
|
infoText,
|
|
5911
5937
|
infoTextColor,
|
|
5938
|
+
inactiveColor,
|
|
5939
|
+
activeColor,
|
|
5940
|
+
inactiveBackgroundColor,
|
|
5941
|
+
activeBackgroundColor,
|
|
5912
5942
|
size = componentSize,
|
|
5913
5943
|
value,
|
|
5914
5944
|
onChange,
|
|
@@ -5964,6 +5994,10 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5964
5994
|
colorTheme,
|
|
5965
5995
|
size,
|
|
5966
5996
|
withNoBorder: theme2.styles.borderWidth === 0,
|
|
5997
|
+
inactiveColor,
|
|
5998
|
+
activeColor,
|
|
5999
|
+
inactiveBackgroundColor,
|
|
6000
|
+
activeBackgroundColor,
|
|
5967
6001
|
type: props.type ?? "checkbox",
|
|
5968
6002
|
checked,
|
|
5969
6003
|
onChange: onChangeElement,
|
|
@@ -5982,7 +6016,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5982
6016
|
position: "absolute",
|
|
5983
6017
|
top: "50%",
|
|
5984
6018
|
left: "50%",
|
|
5985
|
-
color: theme2.colors.base,
|
|
6019
|
+
color: activeColor ?? theme2.colors.base,
|
|
5986
6020
|
size: size / 1.8,
|
|
5987
6021
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5988
6022
|
opacity: checked ? 1 : 0,
|
|
@@ -5997,7 +6031,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5997
6031
|
height: size / 2,
|
|
5998
6032
|
top: "50%",
|
|
5999
6033
|
left: "50%",
|
|
6000
|
-
backgroundColor: theme2.colors.base,
|
|
6034
|
+
backgroundColor: activeColor ?? theme2.colors.base,
|
|
6001
6035
|
borderRadius: 999,
|
|
6002
6036
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
6003
6037
|
opacity: checked ? 1 : 0,
|
|
@@ -8733,11 +8767,79 @@ var SideMenu2 = memo27(SideMenuComponent);
|
|
|
8733
8767
|
SideMenu2.pageHolder = SideMenuComponent.pageHolder;
|
|
8734
8768
|
SideMenu2.burgerButton = SideMenuComponent.burgerButton;
|
|
8735
8769
|
var SideMenu_default = SideMenu2;
|
|
8770
|
+
|
|
8771
|
+
// src/components/DeveloperPage.tsx
|
|
8772
|
+
import { memo as memo28 } from "react";
|
|
8773
|
+
import { useBetterCoreContext as useBetterCoreContext11, useTheme as useTheme30 } from "react-better-core";
|
|
8774
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8775
|
+
function DeveloperPage({ iconSize = 24, assetSize = 120, sections }) {
|
|
8776
|
+
const theme2 = useTheme30();
|
|
8777
|
+
const { devMode, icons: icons2, assets: assets2 } = useBetterCoreContext11();
|
|
8778
|
+
const gridGap = theme2.styles.space;
|
|
8779
|
+
const iconNameFontSie = 12;
|
|
8780
|
+
return devMode ? /* @__PURE__ */ jsxs25(Div_default.column, { gap: theme2.styles.space, children: [
|
|
8781
|
+
/* @__PURE__ */ jsx29(Div_default.box, { title: "Icons", titleAs: "h2", description: "List of all icons in the config", children: /* @__PURE__ */ jsx29(Div_default.row, { alignItems: "center", justifyContent: "center", flexWrap: "wrap", gap: gridGap, children: Object.keys(icons2).map((icon) => /* @__PURE__ */ jsxs25(
|
|
8782
|
+
Div_default.row,
|
|
8783
|
+
{
|
|
8784
|
+
position: "relative",
|
|
8785
|
+
width: iconSize + gridGap * 2 + iconNameFontSie,
|
|
8786
|
+
height: iconSize + gridGap * 2 + iconNameFontSie,
|
|
8787
|
+
alignItems: "center",
|
|
8788
|
+
justifyContent: "center",
|
|
8789
|
+
children: [
|
|
8790
|
+
/* @__PURE__ */ jsx29(Icon_default, { name: icon, color: theme2.colors.primary, size: iconSize }),
|
|
8791
|
+
/* @__PURE__ */ jsx29(
|
|
8792
|
+
Text_default,
|
|
8793
|
+
{
|
|
8794
|
+
position: "absolute",
|
|
8795
|
+
width: "100%",
|
|
8796
|
+
top: `calc(100% - ${iconNameFontSie}px)`,
|
|
8797
|
+
fontSize: iconNameFontSie,
|
|
8798
|
+
textAlign: "center",
|
|
8799
|
+
wordBreak: "break-all",
|
|
8800
|
+
color: theme2.colors.textSecondary,
|
|
8801
|
+
children: icon
|
|
8802
|
+
}
|
|
8803
|
+
)
|
|
8804
|
+
]
|
|
8805
|
+
},
|
|
8806
|
+
icon
|
|
8807
|
+
)) }) }),
|
|
8808
|
+
/* @__PURE__ */ jsx29(Div_default.box, { title: "Assets", titleAs: "h2", description: "List of all assets in the config", children: /* @__PURE__ */ jsx29(Div_default.row, { alignItems: "center", justifyContent: "center", flexWrap: "wrap", gap: gridGap, children: Object.keys(assets2).map((asset) => /* @__PURE__ */ jsxs25(
|
|
8809
|
+
Div_default.column,
|
|
8810
|
+
{
|
|
8811
|
+
position: "relative",
|
|
8812
|
+
width: assetSize,
|
|
8813
|
+
alignItems: "center",
|
|
8814
|
+
justifyContent: "center",
|
|
8815
|
+
gap: theme2.styles.gap,
|
|
8816
|
+
children: [
|
|
8817
|
+
/* @__PURE__ */ jsx29(Image_default, { name: asset, width: "100%", height: assetSize, objectFit: "contain" }),
|
|
8818
|
+
/* @__PURE__ */ jsx29(
|
|
8819
|
+
Text_default,
|
|
8820
|
+
{
|
|
8821
|
+
width: "100%",
|
|
8822
|
+
fontSize: iconNameFontSie,
|
|
8823
|
+
textAlign: "center",
|
|
8824
|
+
wordBreak: "break-all",
|
|
8825
|
+
color: theme2.colors.textSecondary,
|
|
8826
|
+
children: asset
|
|
8827
|
+
}
|
|
8828
|
+
)
|
|
8829
|
+
]
|
|
8830
|
+
},
|
|
8831
|
+
asset
|
|
8832
|
+
)) }) }),
|
|
8833
|
+
sections?.map((section) => /* @__PURE__ */ jsx29(Div_default.box, { title: section.title, titleAs: "h2", description: section.description, children: section.children }, section.title))
|
|
8834
|
+
] }) : void 0;
|
|
8835
|
+
}
|
|
8836
|
+
var DeveloperPage_default = memo28(DeveloperPage);
|
|
8736
8837
|
export {
|
|
8737
8838
|
BetterHtmlProvider_default as BetterHtmlProvider,
|
|
8738
8839
|
Button_default as Button,
|
|
8739
8840
|
Chip_default as Chip,
|
|
8740
8841
|
ColorThemeSwitch_default as ColorThemeSwitch,
|
|
8842
|
+
DeveloperPage_default as DeveloperPage,
|
|
8741
8843
|
Div_default as Div,
|
|
8742
8844
|
Divider_default as Divider,
|
|
8743
8845
|
Dropdown_default as Dropdown,
|
|
@@ -8802,7 +8904,7 @@ export {
|
|
|
8802
8904
|
useMediaQuery,
|
|
8803
8905
|
usePageResize,
|
|
8804
8906
|
usePageScroll,
|
|
8805
|
-
|
|
8907
|
+
useTheme31 as useTheme,
|
|
8806
8908
|
useUrlQuery
|
|
8807
8909
|
};
|
|
8808
8910
|
//# sourceMappingURL=index.mjs.map
|