react-better-html 1.1.125 → 1.1.127

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
@@ -3,11 +3,13 @@ import * as react from 'react';
3
3
  import { ComponentType, ComponentProps, ReactNode } from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
 
6
- type PluginName = "react-router-dom";
7
- type BetterHtmlPlugin = {
6
+ type PluginName = "react-router-dom" | "alerts";
7
+ type BetterHtmlPluginConstructor<T extends object = object> = (config?: T) => BetterHtmlPlugin<T>;
8
+ type BetterHtmlPlugin<T = object> = {
8
9
  name: PluginName;
9
10
  components?: Record<string, ComponentType<any>>;
10
11
  initialize?: () => void;
12
+ getConfig?: () => T;
11
13
  };
12
14
 
13
15
  type ComponentStyle = React.CSSProperties;
@@ -134,7 +136,7 @@ declare const Loader: typeof LoaderComponent & {
134
136
  text: typeof LoaderComponent.text;
135
137
  };
136
138
 
137
- type IconName = "XMark" | "uploadCloud" | "trash" | "chevronDown" | "chevronLeft" | "chevronRight" | "doubleChevronLeft" | "doubleChevronRight" | "eye" | "eyeDashed" | "magnifyingGlass" | "check" | "filter";
139
+ type IconName = "XMark" | "uploadCloud" | "trash" | "chevronDown" | "chevronLeft" | "chevronRight" | "doubleChevronLeft" | "doubleChevronRight" | "eye" | "eyeDashed" | "magnifyingGlass" | "check" | "infoI" | "warningTriangle" | "filter";
138
140
  type IconData = {
139
141
  width: number;
140
142
  height: number;
@@ -879,6 +881,17 @@ type BetterHtmlConfig = {
879
881
  };
880
882
  };
881
883
 
884
+ type AlertType = "info" | "success" | "warning" | "error";
885
+ type AlertDuration = number | "auto";
886
+ type Alert = {
887
+ id: string;
888
+ type: AlertType;
889
+ title?: string;
890
+ message?: string;
891
+ duration?: AlertDuration;
892
+ onClose?: (alert: Alert) => void;
893
+ };
894
+
882
895
  declare const useBetterHtmlContext: () => BetterHtmlConfig;
883
896
  declare const useTheme: () => {
884
897
  colors: Colors;
@@ -889,6 +902,10 @@ declare const useLoaderControls: () => {
889
902
  startLoading: (loaderName: LoaderName | AnyOtherString) => void;
890
903
  stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
891
904
  };
905
+ declare const useAlertControls: () => {
906
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
907
+ removeAlert: (alertId: string) => void;
908
+ };
892
909
  type BetterHtmlProviderValue = DeepPartialRecord<BetterHtmlConfig>;
893
910
  type BetterHtmlProviderProps = {
894
911
  value?: BetterHtmlProviderValue;
@@ -896,7 +913,7 @@ type BetterHtmlProviderProps = {
896
913
  children?: React.ReactNode;
897
914
  };
898
915
  declare function BetterHtmlProvider({ value, plugins: pluginsToUse, children }: BetterHtmlProviderProps): react_jsx_runtime.JSX.Element;
899
- declare const _default: react.MemoExoticComponent<typeof BetterHtmlProvider>;
916
+ declare const _default: typeof BetterHtmlProvider;
900
917
 
901
918
  type BrowserName = "firefox" | "chrome" | "safari" | "edge" | "opera";
902
919
 
@@ -923,6 +940,10 @@ declare const loaderControls: {
923
940
  startLoading: (loaderName: LoaderName | AnyOtherString) => void;
924
941
  stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
925
942
  };
943
+ declare const alertControls: {
944
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
945
+ removeAlert: (alertId: string) => void;
946
+ };
926
947
  declare const colorThemeControls: {
927
948
  toggleTheme: (theme?: ColorTheme) => void;
928
949
  };
@@ -931,6 +952,23 @@ declare const countries: Country[];
931
952
 
932
953
  declare const isMobileDevice: boolean;
933
954
 
934
- declare const reactRouterDomPlugin: BetterHtmlPlugin;
955
+ declare const reactRouterDomPlugin: BetterHtmlPluginConstructor;
956
+
957
+ type AlertsPluginOptions = {
958
+ /** @default "bottom" */
959
+ position?: "top" | "bottom";
960
+ /** @default "right" */
961
+ align?: "left" | "center" | "right";
962
+ /** @default "auto" */
963
+ defaultDuration?: AlertDuration;
964
+ /** @default 460 */
965
+ maxWidth?: number;
966
+ /** @default true */
967
+ withLoaderBar?: boolean;
968
+ /** @default true */
969
+ withCloseButton?: boolean;
970
+ };
971
+ declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
972
+ declare const alertsPlugin: BetterHtmlPluginConstructor<AlertsPluginOptions>;
935
973
 
936
- export { 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 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, colorThemeControls, countries, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
974
+ 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 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 };
package/dist/index.d.ts CHANGED
@@ -3,11 +3,13 @@ import * as react from 'react';
3
3
  import { ComponentType, ComponentProps, ReactNode } from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
 
6
- type PluginName = "react-router-dom";
7
- type BetterHtmlPlugin = {
6
+ type PluginName = "react-router-dom" | "alerts";
7
+ type BetterHtmlPluginConstructor<T extends object = object> = (config?: T) => BetterHtmlPlugin<T>;
8
+ type BetterHtmlPlugin<T = object> = {
8
9
  name: PluginName;
9
10
  components?: Record<string, ComponentType<any>>;
10
11
  initialize?: () => void;
12
+ getConfig?: () => T;
11
13
  };
12
14
 
13
15
  type ComponentStyle = React.CSSProperties;
@@ -134,7 +136,7 @@ declare const Loader: typeof LoaderComponent & {
134
136
  text: typeof LoaderComponent.text;
135
137
  };
136
138
 
137
- type IconName = "XMark" | "uploadCloud" | "trash" | "chevronDown" | "chevronLeft" | "chevronRight" | "doubleChevronLeft" | "doubleChevronRight" | "eye" | "eyeDashed" | "magnifyingGlass" | "check" | "filter";
139
+ type IconName = "XMark" | "uploadCloud" | "trash" | "chevronDown" | "chevronLeft" | "chevronRight" | "doubleChevronLeft" | "doubleChevronRight" | "eye" | "eyeDashed" | "magnifyingGlass" | "check" | "infoI" | "warningTriangle" | "filter";
138
140
  type IconData = {
139
141
  width: number;
140
142
  height: number;
@@ -879,6 +881,17 @@ type BetterHtmlConfig = {
879
881
  };
880
882
  };
881
883
 
884
+ type AlertType = "info" | "success" | "warning" | "error";
885
+ type AlertDuration = number | "auto";
886
+ type Alert = {
887
+ id: string;
888
+ type: AlertType;
889
+ title?: string;
890
+ message?: string;
891
+ duration?: AlertDuration;
892
+ onClose?: (alert: Alert) => void;
893
+ };
894
+
882
895
  declare const useBetterHtmlContext: () => BetterHtmlConfig;
883
896
  declare const useTheme: () => {
884
897
  colors: Colors;
@@ -889,6 +902,10 @@ declare const useLoaderControls: () => {
889
902
  startLoading: (loaderName: LoaderName | AnyOtherString) => void;
890
903
  stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
891
904
  };
905
+ declare const useAlertControls: () => {
906
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
907
+ removeAlert: (alertId: string) => void;
908
+ };
892
909
  type BetterHtmlProviderValue = DeepPartialRecord<BetterHtmlConfig>;
893
910
  type BetterHtmlProviderProps = {
894
911
  value?: BetterHtmlProviderValue;
@@ -896,7 +913,7 @@ type BetterHtmlProviderProps = {
896
913
  children?: React.ReactNode;
897
914
  };
898
915
  declare function BetterHtmlProvider({ value, plugins: pluginsToUse, children }: BetterHtmlProviderProps): react_jsx_runtime.JSX.Element;
899
- declare const _default: react.MemoExoticComponent<typeof BetterHtmlProvider>;
916
+ declare const _default: typeof BetterHtmlProvider;
900
917
 
901
918
  type BrowserName = "firefox" | "chrome" | "safari" | "edge" | "opera";
902
919
 
@@ -923,6 +940,10 @@ declare const loaderControls: {
923
940
  startLoading: (loaderName: LoaderName | AnyOtherString) => void;
924
941
  stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
925
942
  };
943
+ declare const alertControls: {
944
+ createAlert: (alert: OmitProps<Alert, "id">) => Alert;
945
+ removeAlert: (alertId: string) => void;
946
+ };
926
947
  declare const colorThemeControls: {
927
948
  toggleTheme: (theme?: ColorTheme) => void;
928
949
  };
@@ -931,6 +952,23 @@ declare const countries: Country[];
931
952
 
932
953
  declare const isMobileDevice: boolean;
933
954
 
934
- declare const reactRouterDomPlugin: BetterHtmlPlugin;
955
+ declare const reactRouterDomPlugin: BetterHtmlPluginConstructor;
956
+
957
+ type AlertsPluginOptions = {
958
+ /** @default "bottom" */
959
+ position?: "top" | "bottom";
960
+ /** @default "right" */
961
+ align?: "left" | "center" | "right";
962
+ /** @default "auto" */
963
+ defaultDuration?: AlertDuration;
964
+ /** @default 460 */
965
+ maxWidth?: number;
966
+ /** @default true */
967
+ withLoaderBar?: boolean;
968
+ /** @default true */
969
+ withCloseButton?: boolean;
970
+ };
971
+ declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
972
+ declare const alertsPlugin: BetterHtmlPluginConstructor<AlertsPluginOptions>;
935
973
 
936
- export { 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 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, colorThemeControls, countries, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
974
+ 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 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 };