react-better-html 1.1.244 → 1.1.245

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.mjs CHANGED
@@ -1308,6 +1308,8 @@ import { jsx } from "react/jsx-runtime";
1308
1308
  var TextStyledComponent = styled.p.withConfig({
1309
1309
  shouldForwardProp: (prop) => !["style", "hoverStyle"].includes(prop)
1310
1310
  })`
1311
+ font-size: ${(props) => props.theme.styles.fontSize}px;
1312
+
1311
1313
  ${(props) => props.style}
1312
1314
 
1313
1315
  &:hover {
@@ -1315,6 +1317,7 @@ var TextStyledComponent = styled.p.withConfig({
1315
1317
  }
1316
1318
  `;
1317
1319
  var TextComponent = forwardRef(function Text({ htmlContentTranslate, children, ...props }, ref) {
1320
+ const theme2 = useTheme2();
1318
1321
  const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
1319
1322
  const dataProps = useComponentPropsWithPrefix(restProps, "data");
1320
1323
  const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
@@ -1322,6 +1325,7 @@ var TextComponent = forwardRef(function Text({ htmlContentTranslate, children, .
1322
1325
  TextStyledComponent,
1323
1326
  {
1324
1327
  as: props.as,
1328
+ theme: theme2,
1325
1329
  translate: htmlContentTranslate,
1326
1330
  style,
1327
1331
  hoverStyle,
@@ -1429,7 +1433,12 @@ var ImageElement = styled2.img.withConfig({
1429
1433
  ${(props) => props.hoverStyle}
1430
1434
  }
1431
1435
  `;
1432
- var Image = forwardRef3(function Image2({ name, src, ...props }, ref) {
1436
+ var Image = forwardRef3(function Image2(ImageProps3, ref) {
1437
+ const betterHtmlContextInternal = useBetterHtmlContextInternal();
1438
+ const { name, src, ...props } = useComponentsPropsMerger(
1439
+ betterHtmlContextInternal.components.image?.style?.default,
1440
+ ImageProps3
1441
+ );
1433
1442
  const { assets: assets2 } = useBetterCoreContext();
1434
1443
  const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
1435
1444
  const dataProps = useComponentPropsWithPrefix(restProps, "data");
@@ -1454,7 +1463,9 @@ var Image = forwardRef3(function Image2({ name, src, ...props }, ref) {
1454
1463
  }
1455
1464
  );
1456
1465
  });
1457
- Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, letterColor, backgroundColor, ...props }, ref) {
1466
+ Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, letterColor, backgroundColor, ...ImageProps3 }, ref) {
1467
+ const betterHtmlContextInternal = useBetterHtmlContextInternal();
1468
+ const props = useComponentsPropsMerger(betterHtmlContextInternal.components.image?.style?.default, ImageProps3);
1458
1469
  const theme2 = useTheme4();
1459
1470
  return letters ? /* @__PURE__ */ jsx3(
1460
1471
  Div_default.row,
@@ -2045,8 +2056,8 @@ var ButtonElement = styled6.button.withConfig({
2045
2056
  width: fit-content;
2046
2057
  min-width: max-content;
2047
2058
  font-family: ${(props) => props.theme.styles.fontFamily};
2048
- font-size: 16px;
2049
- line-height: 20px;
2059
+ font-size: ${(props) => props.theme.styles.fontSize}px;
2060
+ line-height: ${(props) => props.theme.styles.fontSize + 4}px;
2050
2061
  text-decoration: none;
2051
2062
  color: ${(props) => props.theme.colors.base};
2052
2063
  background-color: ${(props) => props.theme.colors.primary};
@@ -2137,7 +2148,7 @@ var ButtonComponent = function Button(buttonProps) {
2137
2148
  const iconComponent = icon ? /* @__PURE__ */ jsx8(
2138
2149
  Div_default.row,
2139
2150
  {
2140
- height: iconSize ?? parseInt(style.fontSize?.toString() ?? "16"),
2151
+ height: iconSize ?? parseInt(style.fontSize?.toString() ?? theme2.styles.fontSize.toString()),
2141
2152
  alignItems: "center",
2142
2153
  justifyContent: "center",
2143
2154
  children: /* @__PURE__ */ jsx8(
@@ -2145,7 +2156,7 @@ var ButtonComponent = function Button(buttonProps) {
2145
2156
  {
2146
2157
  name: icon,
2147
2158
  color: iconColor ?? props.color ?? theme2.colors.base,
2148
- size: iconSize ?? parseInt(style.fontSize?.toString() ?? "16")
2159
+ size: iconSize ?? parseInt(style.fontSize?.toString() ?? theme2.styles.fontSize.toString())
2149
2160
  }
2150
2161
  )
2151
2162
  }
@@ -2155,7 +2166,7 @@ var ButtonComponent = function Button(buttonProps) {
2155
2166
  {
2156
2167
  name: image,
2157
2168
  color: iconColor ?? props.color ?? theme2.colors.base,
2158
- width: imageWidth ?? parseInt(style.fontSize?.toString() ?? "16"),
2169
+ width: imageWidth ?? parseInt(style.fontSize?.toString() ?? theme2.styles.fontSize.toString()),
2159
2170
  height: imageHeight
2160
2171
  }
2161
2172
  ) : void 0;
@@ -2944,7 +2955,7 @@ function Alert2({ alert }) {
2944
2955
  ),
2945
2956
  /* @__PURE__ */ jsxs7(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
2946
2957
  /* @__PURE__ */ jsx10(Text_default, { fontSize: 18, fontWeight: 700, children: alertTitle }),
2947
- alert.message && /* @__PURE__ */ jsx10(Text_default, { color: theme2.colors.textSecondary, children: alert.message })
2958
+ alert.message && /* @__PURE__ */ jsx10(Text_default, { fontSize: theme2.styles.fontSize, color: theme2.colors.textSecondary, children: alert.message })
2948
2959
  ] }),
2949
2960
  pluginConfig.withCloseButton && /* @__PURE__ */ jsx10(Button_default.icon, { icon: "XMark", alignSelf: "flex-start", onClick: onClickCloseAlert })
2950
2961
  ] }),
@@ -4261,8 +4272,8 @@ var InputElement = styled10.input.withConfig({
4261
4272
  position: relative;
4262
4273
  width: 100%;
4263
4274
  font-family: ${(props) => props.theme.styles.fontFamily};
4264
- font-size: 16px;
4265
- line-height: 20px;
4275
+ font-size: ${(props) => props.theme.styles.fontSize}px;
4276
+ line-height: ${(props) => props.theme.styles.fontSize + 4}px;
4266
4277
  color: ${(props) => props.theme.colors.textPrimary};
4267
4278
  background: ${(props) => props.theme.colors.backgroundContent};
4268
4279
  border: ${(props) => props.theme.styles.borderWidth}px solid ${(props) => props.theme.colors.border};
@@ -4388,8 +4399,8 @@ var TextareaElement = styled10.textarea.withConfig({
4388
4399
  min-height: 3lh;
4389
4400
  max-height: 8lh;
4390
4401
  font-family: ${(props) => props.theme.styles.fontFamily};
4391
- font-size: 16px;
4392
- line-height: 20px;
4402
+ font-size: ${(props) => props.theme.styles.fontSize}px;
4403
+ line-height: ${(props) => props.theme.styles.fontSize + 4}px;
4393
4404
  color: ${(props) => props.theme.colors.textPrimary};
4394
4405
  background: ${(props) => props.theme.colors.backgroundContent};
4395
4406
  border: ${(props) => props.theme.styles.borderWidth}px solid ${(props) => props.theme.colors.border};
@@ -5657,7 +5668,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
5657
5668
  onClick: onClickText,
5658
5669
  children: [
5659
5670
  text,
5660
- required && !label && /* @__PURE__ */ jsxs15(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
5671
+ required && !label && /* @__PURE__ */ jsxs15(Text_default, { as: "span", fontSize: theme2.styles.fontSize, color: theme2.colors.error, children: [
5661
5672
  " ",
5662
5673
  "*"
5663
5674
  ] })
@@ -5665,7 +5676,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
5665
5676
  }
5666
5677
  ) : textAdvanced ? /* @__PURE__ */ jsxs15(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
5667
5678
  textAdvanced,
5668
- required && !label && /* @__PURE__ */ jsxs15(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
5679
+ required && !label && /* @__PURE__ */ jsxs15(Text_default, { as: "span", fontSize: theme2.styles.fontSize, color: theme2.colors.error, marginLeft: 4, children: [
5669
5680
  " ",
5670
5681
  "*"
5671
5682
  ] })
@@ -5926,12 +5937,12 @@ FormRowComponent.withTitle = forwardRef14(function WithTitle({
5926
5937
  /* @__PURE__ */ jsxs17(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
5927
5938
  /* @__PURE__ */ jsxs17(Text_default, { as: titleAs, fontSize: titleFontSize, children: [
5928
5939
  title,
5929
- required && /* @__PURE__ */ jsxs17(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
5940
+ required && /* @__PURE__ */ jsxs17(Text_default, { as: "span", fontSize: theme2.styles.fontSize, color: theme2.colors.error, children: [
5930
5941
  " ",
5931
5942
  "*"
5932
5943
  ] })
5933
5944
  ] }),
5934
- description && /* @__PURE__ */ jsx20(Text_default, { fontSize: descriptionFontSize, color: theme2.colors.textSecondary, children: description })
5945
+ description && /* @__PURE__ */ jsx20(Text_default, { fontSize: descriptionFontSize ?? theme2.styles.fontSize, color: theme2.colors.textSecondary, children: description })
5935
5946
  ] }),
5936
5947
  isLoading && /* @__PURE__ */ jsx20(Div_default, { width: 26 - titleGap })
5937
5948
  ] }),
@@ -8150,10 +8161,14 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
8150
8161
  }
8151
8162
  );
8152
8163
  };
8153
- SideMenuComponent.burgerButton = function BurgerButton() {
8164
+ SideMenuComponent.burgerButton = function BurgerButton({ position = "left", onClick }) {
8154
8165
  const theme2 = useTheme29();
8155
8166
  const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
8156
8167
  const [isHovered, setIsHovered] = useBooleanState8();
8168
+ const onClickElement = useCallback18(() => {
8169
+ setSideMenuIsOpenMobile.toggle();
8170
+ onClick?.(!sideMenuIsOpenMobile);
8171
+ }, [onClick, sideMenuIsOpenMobile]);
8157
8172
  const width = 2;
8158
8173
  return /* @__PURE__ */ jsxs24(
8159
8174
  Div_default,
@@ -8165,7 +8180,7 @@ SideMenuComponent.burgerButton = function BurgerButton() {
8165
8180
  onMouseOver: setIsHovered.setTrue,
8166
8181
  onMouseLeave: setIsHovered.setFalse,
8167
8182
  onMouseOut: setIsHovered.setFalse,
8168
- onClick: setSideMenuIsOpenMobile.toggle,
8183
+ onClick: onClickElement,
8169
8184
  children: [
8170
8185
  /* @__PURE__ */ jsx27(
8171
8186
  Div_default,
@@ -8174,10 +8189,11 @@ SideMenuComponent.burgerButton = function BurgerButton() {
8174
8189
  width: isHovered || sideMenuIsOpenMobile ? "100%" : "50%",
8175
8190
  height: width,
8176
8191
  top: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
8177
- left: 0,
8192
+ left: position === "left" ? 0 : position === "center" ? sideMenuIsOpenMobile ? 0 : "50%" : "auto",
8193
+ right: position === "right" ? 0 : void 0,
8178
8194
  backgroundColor: theme2.colors.border,
8179
8195
  borderRadius: 999,
8180
- transform: sideMenuIsOpenMobile ? "rotate(45deg)" : void 0,
8196
+ transform: sideMenuIsOpenMobile ? "rotate(45deg)" : position === "center" ? "translateX(-50%)" : void 0,
8181
8197
  transition: theme2.styles.transition
8182
8198
  }
8183
8199
  ),
@@ -8188,10 +8204,11 @@ SideMenuComponent.burgerButton = function BurgerButton() {
8188
8204
  width: isHovered ? "100%" : "100%",
8189
8205
  height: width,
8190
8206
  top: "50%",
8191
- left: 0,
8207
+ left: position === "left" ? 0 : position === "center" ? "50%" : "auto",
8208
+ right: position === "right" ? 0 : void 0,
8192
8209
  backgroundColor: theme2.colors.border,
8193
8210
  borderRadius: 999,
8194
- transform: "translateY(-50%)",
8211
+ transform: `translateY(-50%)${position === "center" ? " translateX(-50%)" : ""}`,
8195
8212
  opacity: sideMenuIsOpenMobile ? 0 : void 0,
8196
8213
  transition: theme2.styles.transition
8197
8214
  }
@@ -8203,10 +8220,11 @@ SideMenuComponent.burgerButton = function BurgerButton() {
8203
8220
  width: isHovered || sideMenuIsOpenMobile ? "100%" : "75%",
8204
8221
  height: width,
8205
8222
  bottom: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
8206
- left: 0,
8223
+ left: position === "left" ? 0 : position === "center" ? sideMenuIsOpenMobile ? 0 : "50%" : "auto",
8224
+ right: position === "right" ? 0 : void 0,
8207
8225
  backgroundColor: theme2.colors.border,
8208
8226
  borderRadius: 999,
8209
- transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : void 0,
8227
+ transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : position === "center" ? "translateX(-50%)" : void 0,
8210
8228
  transition: theme2.styles.transition
8211
8229
  }
8212
8230
  )