react-better-html 1.1.155 → 1.1.157

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 CHANGED
@@ -523,6 +523,7 @@ declare function usePageScroll(): {
523
523
  scrollY: number;
524
524
  };
525
525
  declare function useMediaQuery(): {
526
+ screenWidth: number;
526
527
  size320: boolean;
527
528
  size400: boolean;
528
529
  size500: boolean;
@@ -584,6 +585,7 @@ type FormProps = {
584
585
  form?: OmitProps<ReturnType<typeof useForm>, "focusField">;
585
586
  submitButtonText?: string;
586
587
  submitButtonLoaderName?: LoaderName | AnyOtherString;
588
+ submitButtonIsLoading?: boolean;
587
589
  submitButtonId?: string;
588
590
  /** @default false */
589
591
  submitButtonIsDisabled?: boolean;
@@ -592,14 +594,12 @@ type FormProps = {
592
594
  actionButtonsLocation?: "left" | "center" | "right";
593
595
  gap?: React.CSSProperties["gap"];
594
596
  /** @default false */
595
- isSubmitting?: boolean;
596
- /** @default false */
597
597
  isDestructive?: boolean;
598
598
  /** @default false */
599
599
  withDividers?: boolean;
600
600
  renderActionButtons?: React.ReactNode;
601
601
  onClickCancel?: () => void;
602
- onSubmit?: (value: React.FormEvent<HTMLFormElement>) => void;
602
+ onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
603
603
  children?: React.ReactNode;
604
604
  } & ComponentMarginProps;
605
605
  type FormComponentType = {
@@ -960,6 +960,9 @@ declare const generateRandomString: (stringLength: number, options?: {
960
960
  declare const getBrowser: () => BrowserName | undefined;
961
961
  declare const formatPhoneNumber: (phoneNumber: string) => string;
962
962
  declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
963
+ declare const eventPreventDefault: (event: React.MouseEvent) => void;
964
+ declare const eventStopPropagation: (event: React.MouseEvent) => void;
965
+ declare const eventPreventStop: (event: React.MouseEvent) => void;
963
966
 
964
967
  declare const lightenColor: (hexColor: string, amount: number) => string;
965
968
  declare const darkenColor: (hexColor: string, amount: number) => string;
@@ -1001,4 +1004,4 @@ type AlertsPluginOptions = {
1001
1004
  declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
1002
1005
  declare const alertsPlugin: BetterHtmlPluginConstructor<AlertsPluginOptions>;
1003
1006
 
1004
- export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
1007
+ export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
package/dist/index.d.ts CHANGED
@@ -523,6 +523,7 @@ declare function usePageScroll(): {
523
523
  scrollY: number;
524
524
  };
525
525
  declare function useMediaQuery(): {
526
+ screenWidth: number;
526
527
  size320: boolean;
527
528
  size400: boolean;
528
529
  size500: boolean;
@@ -584,6 +585,7 @@ type FormProps = {
584
585
  form?: OmitProps<ReturnType<typeof useForm>, "focusField">;
585
586
  submitButtonText?: string;
586
587
  submitButtonLoaderName?: LoaderName | AnyOtherString;
588
+ submitButtonIsLoading?: boolean;
587
589
  submitButtonId?: string;
588
590
  /** @default false */
589
591
  submitButtonIsDisabled?: boolean;
@@ -592,14 +594,12 @@ type FormProps = {
592
594
  actionButtonsLocation?: "left" | "center" | "right";
593
595
  gap?: React.CSSProperties["gap"];
594
596
  /** @default false */
595
- isSubmitting?: boolean;
596
- /** @default false */
597
597
  isDestructive?: boolean;
598
598
  /** @default false */
599
599
  withDividers?: boolean;
600
600
  renderActionButtons?: React.ReactNode;
601
601
  onClickCancel?: () => void;
602
- onSubmit?: (value: React.FormEvent<HTMLFormElement>) => void;
602
+ onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
603
603
  children?: React.ReactNode;
604
604
  } & ComponentMarginProps;
605
605
  type FormComponentType = {
@@ -960,6 +960,9 @@ declare const generateRandomString: (stringLength: number, options?: {
960
960
  declare const getBrowser: () => BrowserName | undefined;
961
961
  declare const formatPhoneNumber: (phoneNumber: string) => string;
962
962
  declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
963
+ declare const eventPreventDefault: (event: React.MouseEvent) => void;
964
+ declare const eventStopPropagation: (event: React.MouseEvent) => void;
965
+ declare const eventPreventStop: (event: React.MouseEvent) => void;
963
966
 
964
967
  declare const lightenColor: (hexColor: string, amount: number) => string;
965
968
  declare const darkenColor: (hexColor: string, amount: number) => string;
@@ -1001,4 +1004,4 @@ type AlertsPluginOptions = {
1001
1004
  declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
1002
1005
  declare const alertsPlugin: BetterHtmlPluginConstructor<AlertsPluginOptions>;
1003
1006
 
1004
- export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
1007
+ export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
package/dist/index.js CHANGED
@@ -60,6 +60,9 @@ __export(index_exports, {
60
60
  darkenColor: () => darkenColor,
61
61
  defaultAlertsPluginOptions: () => defaultAlertsPluginOptions,
62
62
  desaturateColor: () => desaturateColor,
63
+ eventPreventDefault: () => eventPreventDefault,
64
+ eventPreventStop: () => eventPreventStop,
65
+ eventStopPropagation: () => eventStopPropagation,
63
66
  formatPhoneNumber: () => formatPhoneNumber,
64
67
  generateRandomString: () => generateRandomString,
65
68
  getBrowser: () => getBrowser,
@@ -1651,10 +1654,24 @@ var import_styled_components = __toESM(require("styled-components"));
1651
1654
  var import_jsx_runtime = require("react/jsx-runtime");
1652
1655
  var import_react2 = require("react");
1653
1656
  var IconElement = import_styled_components.default.svg.withConfig({
1654
- shouldForwardProp: (prop) => !["normalStyle", "hoverStyle"].includes(prop)
1657
+ shouldForwardProp: (prop) => !["theme", "normalStyle", "hoverStyle", "hoverColor"].includes(prop)
1655
1658
  })`
1656
1659
  ${(props) => props.normalStyle}
1657
1660
 
1661
+ path {
1662
+ ${(props) => props.hoverColor ? `transition: ${props.theme.styles.transition};` : ""}
1663
+ }
1664
+
1665
+ &:hover {
1666
+ path.react-better-html-icon-path-with-fill {
1667
+ fill: ${(props) => props.hoverColor};
1668
+ }
1669
+
1670
+ path.react-better-html-icon-path-with-stroke {
1671
+ stroke: ${(props) => props.hoverColor};
1672
+ }
1673
+ }
1674
+
1658
1675
  &:hover {
1659
1676
  ${(props) => props.hoverStyle}
1660
1677
  }
@@ -1667,6 +1684,7 @@ var Icon = (0, import_react.forwardRef)(function Icon2({ name, size = 16, ...pro
1667
1684
  const ariaProps = useComponentPropsWithPrefix(props, "aria");
1668
1685
  const restProps = useComponentPropsWithoutStyle(props);
1669
1686
  const svgColor = props.color ?? theme2.colors.textPrimary;
1687
+ const svgHoverColorColor = props.colorHover;
1670
1688
  (0, import_react.useEffect)(() => {
1671
1689
  if (!icons2[name.toString()])
1672
1690
  console.warn(
@@ -1681,6 +1699,8 @@ var Icon = (0, import_react.forwardRef)(function Icon2({ name, size = 16, ...pro
1681
1699
  viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
1682
1700
  fill: "none",
1683
1701
  xmlns: "http://www.w3.org/2000/svg",
1702
+ theme: theme2,
1703
+ hoverColor: svgHoverColorColor,
1684
1704
  ...styledComponentStyles,
1685
1705
  ...dataProps,
1686
1706
  ...ariaProps,
@@ -1690,6 +1710,7 @@ var Icon = (0, import_react.forwardRef)(function Icon2({ name, size = 16, ...pro
1690
1710
  "path",
1691
1711
  {
1692
1712
  ...path,
1713
+ className: path.type === "fill" ? "react-better-html-icon-path-with-fill" : "react-better-html-icon-path-with-stroke",
1693
1714
  fill: path.type === "fill" ? svgColor : void 0,
1694
1715
  stroke: path.type === "stroke" ? svgColor : void 0,
1695
1716
  key: path.d
@@ -2864,6 +2885,7 @@ function usePageScroll() {
2864
2885
  function useMediaQuery() {
2865
2886
  const { width } = usePageResize();
2866
2887
  return {
2888
+ screenWidth: width,
2867
2889
  size320: width <= 320,
2868
2890
  size400: width <= 400,
2869
2891
  size500: width <= 500,
@@ -3704,7 +3726,7 @@ var PageHeaderComponent = (0, import_react15.forwardRef)(function PageHeader({
3704
3726
  {
3705
3727
  alignItems: "center",
3706
3728
  gap: theme2.styles.space,
3707
- marginBottom: marginBottom || theme2.styles.space * 2,
3729
+ marginBottom: marginBottom ?? theme2.styles.space * 2,
3708
3730
  ref,
3709
3731
  children: [
3710
3732
  imageUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Image_default.profileImage, { src: imageUrl, size: imageSize ?? (mediaQuery.size600 ? 46 : 60) }),
@@ -5460,6 +5482,16 @@ var formatPhoneNumber = (phoneNumber) => {
5460
5482
  var getFormErrorObject = (formValues) => {
5461
5483
  return {};
5462
5484
  };
5485
+ var eventPreventDefault = (event) => {
5486
+ event.preventDefault();
5487
+ };
5488
+ var eventStopPropagation = (event) => {
5489
+ event.stopPropagation();
5490
+ };
5491
+ var eventPreventStop = (event) => {
5492
+ event.preventDefault();
5493
+ event.stopPropagation();
5494
+ };
5463
5495
 
5464
5496
  // src/components/Label.tsx
5465
5497
  var import_react17 = require("react");
@@ -7247,12 +7279,12 @@ var FormComponent = (0, import_react22.forwardRef)(function Form({
7247
7279
  form,
7248
7280
  submitButtonText,
7249
7281
  submitButtonLoaderName,
7282
+ submitButtonIsLoading,
7250
7283
  submitButtonId,
7251
7284
  submitButtonIsDisabled,
7252
7285
  cancelButtonText,
7253
7286
  actionButtonsLocation = "right",
7254
7287
  gap,
7255
- isSubmitting,
7256
7288
  isDestructive,
7257
7289
  withDividers,
7258
7290
  renderActionButtons,
@@ -7289,7 +7321,7 @@ var FormComponent = (0, import_react22.forwardRef)(function Form({
7289
7321
  SubmitButtonTag,
7290
7322
  {
7291
7323
  text: submitButtonText,
7292
- isLoading: isSubmitting || form?.isSubmitting,
7324
+ isLoading: submitButtonIsLoading || form?.isSubmitting,
7293
7325
  loaderName: submitButtonLoaderName,
7294
7326
  disabled: submitButtonIsDisabledFinal,
7295
7327
  id: submitButtonId,
@@ -9068,6 +9100,9 @@ var Foldable_default = Foldable2;
9068
9100
  darkenColor,
9069
9101
  defaultAlertsPluginOptions,
9070
9102
  desaturateColor,
9103
+ eventPreventDefault,
9104
+ eventPreventStop,
9105
+ eventStopPropagation,
9071
9106
  formatPhoneNumber,
9072
9107
  generateRandomString,
9073
9108
  getBrowser,