react-better-html 1.1.158 → 1.1.160
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 +35 -12
- package/dist/index.d.ts +35 -12
- package/dist/index.js +208 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ 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" | "
|
|
6
|
+
type PluginName = "alerts" | "react-router-dom" | "localStorage";
|
|
7
7
|
type BetterHtmlPluginConstructor<T extends object = object> = (config?: T) => BetterHtmlPlugin<T>;
|
|
8
8
|
type BetterHtmlPlugin<T = object> = {
|
|
9
9
|
name: PluginName;
|
|
@@ -257,8 +257,9 @@ type VerticalDividerProps = DividerProps & {
|
|
|
257
257
|
};
|
|
258
258
|
type HorizontalDividerProps = DividerProps & {
|
|
259
259
|
text?: string;
|
|
260
|
+
textFontSize?: React.CSSProperties["fontSize"];
|
|
260
261
|
/** @default textSecondary */
|
|
261
|
-
textColor?:
|
|
262
|
+
textColor?: React.CSSProperties["color"];
|
|
262
263
|
};
|
|
263
264
|
type DividerComponentType = {
|
|
264
265
|
vertical: (props: ComponentPropWithRef<HTMLDivElement, VerticalDividerProps>) => React.ReactElement;
|
|
@@ -326,13 +327,9 @@ type PageHolderComponentType = {
|
|
|
326
327
|
center: (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps & {
|
|
327
328
|
pageBackgroundColor?: string;
|
|
328
329
|
contentMaxWidth?: React.CSSProperties["maxWidth"];
|
|
329
|
-
|
|
330
|
-
sideImageName?: AssetName | AnyOtherString;
|
|
330
|
+
sideComponent?: React.ReactNode;
|
|
331
331
|
/** @default "right" */
|
|
332
|
-
|
|
333
|
-
/** @default "center" */
|
|
334
|
-
sideImageAlignment?: "left" | "center" | "right";
|
|
335
|
-
sideImageFooter?: React.ReactNode;
|
|
332
|
+
sideComponentPosition?: "left" | "right";
|
|
336
333
|
}>) => React.ReactElement;
|
|
337
334
|
};
|
|
338
335
|
declare const PageHolderComponent: PageHolderComponentType;
|
|
@@ -405,7 +402,10 @@ type InputFieldComponentType = {
|
|
|
405
402
|
(props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
|
|
406
403
|
multiline: (props: ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>) => React.ReactElement;
|
|
407
404
|
email: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
408
|
-
password: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>
|
|
405
|
+
password: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "autoComplete"> & {
|
|
406
|
+
/** @default "current-password" */
|
|
407
|
+
autoComplete?: React.ComponentProps<"input">["autoComplete"];
|
|
408
|
+
}>) => React.ReactElement;
|
|
409
409
|
search: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
410
410
|
phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type" | "prefix">>) => React.ReactElement;
|
|
411
411
|
date: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
|
|
@@ -981,12 +981,17 @@ declare const colorThemeControls: {
|
|
|
981
981
|
toggleTheme: (theme?: ColorTheme) => void;
|
|
982
982
|
};
|
|
983
983
|
|
|
984
|
+
declare function generateLocalStorage<LocalStorage extends object>(): {
|
|
985
|
+
setItem: <StorageName extends keyof LocalStorage>(name: StorageName, value: LocalStorage[StorageName]) => void;
|
|
986
|
+
getItem: <StorageName extends keyof LocalStorage>(name: StorageName) => LocalStorage[StorageName] | undefined;
|
|
987
|
+
removeItem: (name: keyof LocalStorage) => void;
|
|
988
|
+
removeAllItems: () => void;
|
|
989
|
+
};
|
|
990
|
+
|
|
984
991
|
declare const countries: Country[];
|
|
985
992
|
|
|
986
993
|
declare const isMobileDevice: boolean;
|
|
987
994
|
|
|
988
|
-
declare const reactRouterDomPlugin: BetterHtmlPluginConstructor;
|
|
989
|
-
|
|
990
995
|
type AlertsPluginOptions = {
|
|
991
996
|
/** @default "bottom" */
|
|
992
997
|
position?: "top" | "bottom";
|
|
@@ -1004,4 +1009,22 @@ type AlertsPluginOptions = {
|
|
|
1004
1009
|
declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
|
|
1005
1010
|
declare const alertsPlugin: BetterHtmlPluginConstructor<AlertsPluginOptions>;
|
|
1006
1011
|
|
|
1007
|
-
|
|
1012
|
+
type ReactRouterDomPluginOptions = {};
|
|
1013
|
+
declare const defaultReactRouterDomPluginOptions: Required<ReactRouterDomPluginOptions>;
|
|
1014
|
+
declare const reactRouterDomPlugin: BetterHtmlPluginConstructor<ReactRouterDomPluginOptions>;
|
|
1015
|
+
|
|
1016
|
+
type LocalStoragePluginOptions = {
|
|
1017
|
+
encryption?: {
|
|
1018
|
+
/** @default false */
|
|
1019
|
+
enabled?: false;
|
|
1020
|
+
} | {
|
|
1021
|
+
/** @default false */
|
|
1022
|
+
enabled?: true;
|
|
1023
|
+
secretKey: string;
|
|
1024
|
+
iv: string;
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
|
|
1028
|
+
declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
|
|
1029
|
+
|
|
1030
|
+
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, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, 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, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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" | "
|
|
6
|
+
type PluginName = "alerts" | "react-router-dom" | "localStorage";
|
|
7
7
|
type BetterHtmlPluginConstructor<T extends object = object> = (config?: T) => BetterHtmlPlugin<T>;
|
|
8
8
|
type BetterHtmlPlugin<T = object> = {
|
|
9
9
|
name: PluginName;
|
|
@@ -257,8 +257,9 @@ type VerticalDividerProps = DividerProps & {
|
|
|
257
257
|
};
|
|
258
258
|
type HorizontalDividerProps = DividerProps & {
|
|
259
259
|
text?: string;
|
|
260
|
+
textFontSize?: React.CSSProperties["fontSize"];
|
|
260
261
|
/** @default textSecondary */
|
|
261
|
-
textColor?:
|
|
262
|
+
textColor?: React.CSSProperties["color"];
|
|
262
263
|
};
|
|
263
264
|
type DividerComponentType = {
|
|
264
265
|
vertical: (props: ComponentPropWithRef<HTMLDivElement, VerticalDividerProps>) => React.ReactElement;
|
|
@@ -326,13 +327,9 @@ type PageHolderComponentType = {
|
|
|
326
327
|
center: (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps & {
|
|
327
328
|
pageBackgroundColor?: string;
|
|
328
329
|
contentMaxWidth?: React.CSSProperties["maxWidth"];
|
|
329
|
-
|
|
330
|
-
sideImageName?: AssetName | AnyOtherString;
|
|
330
|
+
sideComponent?: React.ReactNode;
|
|
331
331
|
/** @default "right" */
|
|
332
|
-
|
|
333
|
-
/** @default "center" */
|
|
334
|
-
sideImageAlignment?: "left" | "center" | "right";
|
|
335
|
-
sideImageFooter?: React.ReactNode;
|
|
332
|
+
sideComponentPosition?: "left" | "right";
|
|
336
333
|
}>) => React.ReactElement;
|
|
337
334
|
};
|
|
338
335
|
declare const PageHolderComponent: PageHolderComponentType;
|
|
@@ -405,7 +402,10 @@ type InputFieldComponentType = {
|
|
|
405
402
|
(props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>): React.ReactElement;
|
|
406
403
|
multiline: (props: ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>) => React.ReactElement;
|
|
407
404
|
email: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
408
|
-
password: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>
|
|
405
|
+
password: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "autoComplete"> & {
|
|
406
|
+
/** @default "current-password" */
|
|
407
|
+
autoComplete?: React.ComponentProps<"input">["autoComplete"];
|
|
408
|
+
}>) => React.ReactElement;
|
|
409
409
|
search: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
410
410
|
phoneNumber: (props: ComponentPropWithRef<HTMLInputElement, OmitProps<InputFieldProps, "type" | "prefix">>) => React.ReactElement;
|
|
411
411
|
date: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps & {
|
|
@@ -981,12 +981,17 @@ declare const colorThemeControls: {
|
|
|
981
981
|
toggleTheme: (theme?: ColorTheme) => void;
|
|
982
982
|
};
|
|
983
983
|
|
|
984
|
+
declare function generateLocalStorage<LocalStorage extends object>(): {
|
|
985
|
+
setItem: <StorageName extends keyof LocalStorage>(name: StorageName, value: LocalStorage[StorageName]) => void;
|
|
986
|
+
getItem: <StorageName extends keyof LocalStorage>(name: StorageName) => LocalStorage[StorageName] | undefined;
|
|
987
|
+
removeItem: (name: keyof LocalStorage) => void;
|
|
988
|
+
removeAllItems: () => void;
|
|
989
|
+
};
|
|
990
|
+
|
|
984
991
|
declare const countries: Country[];
|
|
985
992
|
|
|
986
993
|
declare const isMobileDevice: boolean;
|
|
987
994
|
|
|
988
|
-
declare const reactRouterDomPlugin: BetterHtmlPluginConstructor;
|
|
989
|
-
|
|
990
995
|
type AlertsPluginOptions = {
|
|
991
996
|
/** @default "bottom" */
|
|
992
997
|
position?: "top" | "bottom";
|
|
@@ -1004,4 +1009,22 @@ type AlertsPluginOptions = {
|
|
|
1004
1009
|
declare const defaultAlertsPluginOptions: Required<AlertsPluginOptions>;
|
|
1005
1010
|
declare const alertsPlugin: BetterHtmlPluginConstructor<AlertsPluginOptions>;
|
|
1006
1011
|
|
|
1007
|
-
|
|
1012
|
+
type ReactRouterDomPluginOptions = {};
|
|
1013
|
+
declare const defaultReactRouterDomPluginOptions: Required<ReactRouterDomPluginOptions>;
|
|
1014
|
+
declare const reactRouterDomPlugin: BetterHtmlPluginConstructor<ReactRouterDomPluginOptions>;
|
|
1015
|
+
|
|
1016
|
+
type LocalStoragePluginOptions = {
|
|
1017
|
+
encryption?: {
|
|
1018
|
+
/** @default false */
|
|
1019
|
+
enabled?: false;
|
|
1020
|
+
} | {
|
|
1021
|
+
/** @default false */
|
|
1022
|
+
enabled?: true;
|
|
1023
|
+
secretKey: string;
|
|
1024
|
+
iv: string;
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
|
|
1028
|
+
declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
|
|
1029
|
+
|
|
1030
|
+
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, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, 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, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
package/dist/index.js
CHANGED
|
@@ -59,17 +59,21 @@ __export(index_exports, {
|
|
|
59
59
|
countries: () => countries,
|
|
60
60
|
darkenColor: () => darkenColor,
|
|
61
61
|
defaultAlertsPluginOptions: () => defaultAlertsPluginOptions,
|
|
62
|
+
defaultLocalStoragePluginOptions: () => defaultLocalStoragePluginOptions,
|
|
63
|
+
defaultReactRouterDomPluginOptions: () => defaultReactRouterDomPluginOptions,
|
|
62
64
|
desaturateColor: () => desaturateColor,
|
|
63
65
|
eventPreventDefault: () => eventPreventDefault,
|
|
64
66
|
eventPreventStop: () => eventPreventStop,
|
|
65
67
|
eventStopPropagation: () => eventStopPropagation,
|
|
66
68
|
formatPhoneNumber: () => formatPhoneNumber,
|
|
69
|
+
generateLocalStorage: () => generateLocalStorage,
|
|
67
70
|
generateRandomString: () => generateRandomString,
|
|
68
71
|
getBrowser: () => getBrowser,
|
|
69
72
|
getFormErrorObject: () => getFormErrorObject,
|
|
70
73
|
isMobileDevice: () => isMobileDevice,
|
|
71
74
|
lightenColor: () => lightenColor,
|
|
72
75
|
loaderControls: () => loaderControls,
|
|
76
|
+
localStoragePlugin: () => localStoragePlugin,
|
|
73
77
|
reactRouterDomPlugin: () => reactRouterDomPlugin,
|
|
74
78
|
saturateColor: () => saturateColor,
|
|
75
79
|
useAlertControls: () => useAlertControls,
|
|
@@ -1615,19 +1619,6 @@ var import_react8 = require("react");
|
|
|
1615
1619
|
var import_react7 = require("react");
|
|
1616
1620
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
1617
1621
|
|
|
1618
|
-
// src/plugins/react-router-dom.ts
|
|
1619
|
-
var import_react_router_dom = require("react-router-dom");
|
|
1620
|
-
var reactRouterDomPlugin = () => ({
|
|
1621
|
-
name: "react-router-dom",
|
|
1622
|
-
components: {
|
|
1623
|
-
Link: import_react_router_dom.Link,
|
|
1624
|
-
NavLink: import_react_router_dom.NavLink
|
|
1625
|
-
},
|
|
1626
|
-
initialize: () => {
|
|
1627
|
-
console.log("react-router-dom plugin initialized");
|
|
1628
|
-
}
|
|
1629
|
-
});
|
|
1630
|
-
|
|
1631
1622
|
// src/plugins/alerts.ts
|
|
1632
1623
|
var defaultAlertsPluginOptions = {
|
|
1633
1624
|
position: "bottom",
|
|
@@ -1648,6 +1639,39 @@ var alertsPlugin = (options) => ({
|
|
|
1648
1639
|
})
|
|
1649
1640
|
});
|
|
1650
1641
|
|
|
1642
|
+
// src/plugins/reactRouterDom.ts
|
|
1643
|
+
var import_react_router_dom = require("react-router-dom");
|
|
1644
|
+
var defaultReactRouterDomPluginOptions = {};
|
|
1645
|
+
var reactRouterDomPlugin = (options) => ({
|
|
1646
|
+
name: "react-router-dom",
|
|
1647
|
+
components: {
|
|
1648
|
+
Link: import_react_router_dom.Link,
|
|
1649
|
+
NavLink: import_react_router_dom.NavLink
|
|
1650
|
+
},
|
|
1651
|
+
initialize: () => {
|
|
1652
|
+
console.log("react-router-dom plugin initialized");
|
|
1653
|
+
},
|
|
1654
|
+
getConfig: () => ({
|
|
1655
|
+
...defaultReactRouterDomPluginOptions,
|
|
1656
|
+
...options
|
|
1657
|
+
})
|
|
1658
|
+
});
|
|
1659
|
+
|
|
1660
|
+
// src/plugins/localStorage.ts
|
|
1661
|
+
var defaultLocalStoragePluginOptions = {
|
|
1662
|
+
encryption: {}
|
|
1663
|
+
};
|
|
1664
|
+
var localStoragePlugin = (options) => ({
|
|
1665
|
+
name: "localStorage",
|
|
1666
|
+
initialize: () => {
|
|
1667
|
+
console.log("localStorage plugin initialized");
|
|
1668
|
+
},
|
|
1669
|
+
getConfig: () => ({
|
|
1670
|
+
...defaultLocalStoragePluginOptions,
|
|
1671
|
+
...options
|
|
1672
|
+
})
|
|
1673
|
+
});
|
|
1674
|
+
|
|
1651
1675
|
// src/components/Icon.tsx
|
|
1652
1676
|
var import_react = require("react");
|
|
1653
1677
|
var import_styled_components = __toESM(require("styled-components"));
|
|
@@ -3321,11 +3345,11 @@ var Divider_default = {
|
|
|
3321
3345
|
})
|
|
3322
3346
|
),
|
|
3323
3347
|
horizontal: (0, import_react12.memo)(
|
|
3324
|
-
(0, import_react12.forwardRef)(function Divider2({ width = 1, backgroundColor, text, textColor, ...props }, ref) {
|
|
3348
|
+
(0, import_react12.forwardRef)(function Divider2({ width = 1, backgroundColor, text, textFontSize, textColor, ...props }, ref) {
|
|
3325
3349
|
const theme2 = useTheme();
|
|
3326
3350
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
|
|
3327
3351
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
|
|
3328
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { color: textColor ?? theme2.colors.textSecondary, children: text }),
|
|
3352
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { fontSize: textFontSize, color: textColor ?? theme2.colors.textSecondary, children: text }),
|
|
3329
3353
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
|
|
3330
3354
|
] });
|
|
3331
3355
|
})
|
|
@@ -3636,11 +3660,8 @@ var PageHolderComponent = (0, import_react14.forwardRef)(function PageHolder({ n
|
|
|
3636
3660
|
PageHolderComponent.center = (0, import_react14.forwardRef)(function Center({
|
|
3637
3661
|
pageBackgroundColor,
|
|
3638
3662
|
contentMaxWidth,
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
sideImagePosition = "right",
|
|
3642
|
-
sideImageAlignment = "center",
|
|
3643
|
-
sideImageFooter,
|
|
3663
|
+
sideComponent,
|
|
3664
|
+
sideComponentPosition = "right",
|
|
3644
3665
|
noMaxContentWidth,
|
|
3645
3666
|
children,
|
|
3646
3667
|
...props
|
|
@@ -3649,7 +3670,7 @@ PageHolderComponent.center = (0, import_react14.forwardRef)(function Center({
|
|
|
3649
3670
|
const mediaQuery = useMediaQuery();
|
|
3650
3671
|
const { app } = useBetterHtmlContextInternal();
|
|
3651
3672
|
const breakingPoint = mediaQuery.size1000;
|
|
3652
|
-
const
|
|
3673
|
+
const withSideComponent = sideComponent && !breakingPoint;
|
|
3653
3674
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3654
3675
|
Div_default.row,
|
|
3655
3676
|
{
|
|
@@ -3659,8 +3680,8 @@ PageHolderComponent.center = (0, import_react14.forwardRef)(function Center({
|
|
|
3659
3680
|
justifyContent: "center",
|
|
3660
3681
|
backgroundColor: pageBackgroundColor,
|
|
3661
3682
|
children: [
|
|
3662
|
-
|
|
3663
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default.column, { width: `${
|
|
3683
|
+
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default, { width: "50%" }),
|
|
3684
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default.column, { width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3664
3685
|
Div_default.box,
|
|
3665
3686
|
{
|
|
3666
3687
|
width: `calc(100% - ${theme2.styles.space}px * 2)`,
|
|
@@ -3672,32 +3693,17 @@ PageHolderComponent.center = (0, import_react14.forwardRef)(function Center({
|
|
|
3672
3693
|
children
|
|
3673
3694
|
}
|
|
3674
3695
|
) }),
|
|
3675
|
-
|
|
3676
|
-
|
|
3696
|
+
sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default, { width: "50%" }),
|
|
3697
|
+
withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3677
3698
|
Div_default,
|
|
3678
3699
|
{
|
|
3679
3700
|
position: "fixed",
|
|
3680
3701
|
width: "50%",
|
|
3681
3702
|
height: "100svh",
|
|
3682
3703
|
top: 0,
|
|
3683
|
-
left:
|
|
3684
|
-
right:
|
|
3685
|
-
children:
|
|
3686
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3687
|
-
Div_default.row,
|
|
3688
|
-
{
|
|
3689
|
-
position: "absolute",
|
|
3690
|
-
width: "100%",
|
|
3691
|
-
height: "100%",
|
|
3692
|
-
top: 0,
|
|
3693
|
-
left: 0,
|
|
3694
|
-
justifyContent: sideImageAlignment === "left" ? "flex-start" : sideImageAlignment === "right" ? "flex-end" : "center",
|
|
3695
|
-
overflow: "hidden",
|
|
3696
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Image_default, { name: sideImageName, height: "100%", src: sideImageSrc })
|
|
3697
|
-
}
|
|
3698
|
-
),
|
|
3699
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default, { position: "absolute", width: "100%", bottom: theme2.styles.space, children: sideImageFooter })
|
|
3700
|
-
]
|
|
3704
|
+
left: sideComponentPosition === "left" ? 0 : "auto",
|
|
3705
|
+
right: sideComponentPosition === "right" ? 0 : "auto",
|
|
3706
|
+
children: sideComponent
|
|
3701
3707
|
}
|
|
3702
3708
|
)
|
|
3703
3709
|
]
|
|
@@ -5428,6 +5434,62 @@ var countries = [
|
|
|
5428
5434
|
}
|
|
5429
5435
|
];
|
|
5430
5436
|
|
|
5437
|
+
// src/utils/functions.ts
|
|
5438
|
+
var import_crypto_js = __toESM(require("crypto-js"));
|
|
5439
|
+
|
|
5440
|
+
// src/utils/variableFunctions.ts
|
|
5441
|
+
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
5442
|
+
if (value === void 0) {
|
|
5443
|
+
throw new Error(
|
|
5444
|
+
`\`${functionsName}()\` must be used within a \`<BetterHtmlProvider>\`. Make sure to add one at the root of your component tree.`
|
|
5445
|
+
);
|
|
5446
|
+
}
|
|
5447
|
+
return value !== void 0;
|
|
5448
|
+
};
|
|
5449
|
+
var loaderControls = {
|
|
5450
|
+
startLoading: (loaderName) => {
|
|
5451
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.startLoading")) return;
|
|
5452
|
+
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
5453
|
+
...oldValue,
|
|
5454
|
+
[loaderName.toString()]: true
|
|
5455
|
+
}));
|
|
5456
|
+
},
|
|
5457
|
+
stopLoading: (loaderName) => {
|
|
5458
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.stopLoading")) return;
|
|
5459
|
+
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
5460
|
+
...oldValue,
|
|
5461
|
+
[loaderName.toString()]: false
|
|
5462
|
+
}));
|
|
5463
|
+
}
|
|
5464
|
+
};
|
|
5465
|
+
var alertControls = {
|
|
5466
|
+
createAlert: (alert) => {
|
|
5467
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "alertControls.createAlert"))
|
|
5468
|
+
return void 0;
|
|
5469
|
+
const readyAlert = {
|
|
5470
|
+
id: crypto.randomUUID(),
|
|
5471
|
+
...alert
|
|
5472
|
+
};
|
|
5473
|
+
externalBetterHtmlContextValue.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
5474
|
+
return readyAlert;
|
|
5475
|
+
},
|
|
5476
|
+
removeAlert: (alertId) => {
|
|
5477
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "alertControls.removeAlert")) return;
|
|
5478
|
+
externalBetterHtmlContextValue.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
5479
|
+
}
|
|
5480
|
+
};
|
|
5481
|
+
var colorThemeControls = {
|
|
5482
|
+
toggleTheme: (theme2) => {
|
|
5483
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "colorThemeControls.toggleTheme")) return;
|
|
5484
|
+
const currentColorTheme = externalBetterHtmlContextValue.colorTheme;
|
|
5485
|
+
const newColorTheme = theme2 ?? (currentColorTheme === "dark" ? "light" : "dark");
|
|
5486
|
+
setTimeout(() => {
|
|
5487
|
+
window.document.body.parentElement?.setAttribute("data-theme", newColorTheme);
|
|
5488
|
+
localStorage.setItem("theme", newColorTheme);
|
|
5489
|
+
}, 0.01 * 1e3);
|
|
5490
|
+
}
|
|
5491
|
+
};
|
|
5492
|
+
|
|
5431
5493
|
// src/utils/functions.ts
|
|
5432
5494
|
var generateRandomString = (stringLength, options) => {
|
|
5433
5495
|
const capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
@@ -5499,6 +5561,40 @@ var eventPreventStop = (event) => {
|
|
|
5499
5561
|
event.preventDefault();
|
|
5500
5562
|
event.stopPropagation();
|
|
5501
5563
|
};
|
|
5564
|
+
var encryptString = (text) => {
|
|
5565
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "encryptString")) return void 0;
|
|
5566
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find((plugin) => plugin.name === "localStorage");
|
|
5567
|
+
if (!localStoragePlugin2) {
|
|
5568
|
+
throw new Error(
|
|
5569
|
+
"`encryptString` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
5570
|
+
);
|
|
5571
|
+
}
|
|
5572
|
+
const pluginConfig = localStoragePlugin2.getConfig?.() ?? {};
|
|
5573
|
+
if (!pluginConfig?.encryption?.enabled) return text;
|
|
5574
|
+
const encrypted = import_crypto_js.default.AES.encrypt(text, import_crypto_js.default.enc.Hex.parse(pluginConfig.encryption.secretKey), {
|
|
5575
|
+
iv: import_crypto_js.default.enc.Hex.parse(pluginConfig.encryption.iv),
|
|
5576
|
+
mode: import_crypto_js.default.mode.CBC,
|
|
5577
|
+
padding: import_crypto_js.default.pad.Pkcs7
|
|
5578
|
+
}).toString();
|
|
5579
|
+
return encrypted;
|
|
5580
|
+
};
|
|
5581
|
+
var decryptString = (text) => {
|
|
5582
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "decryptString")) return void 0;
|
|
5583
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find((plugin) => plugin.name === "localStorage");
|
|
5584
|
+
if (!localStoragePlugin2) {
|
|
5585
|
+
throw new Error(
|
|
5586
|
+
"`decryptString` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
5587
|
+
);
|
|
5588
|
+
}
|
|
5589
|
+
const pluginConfig = localStoragePlugin2.getConfig?.() ?? {};
|
|
5590
|
+
if (!pluginConfig?.encryption?.enabled) return text;
|
|
5591
|
+
const decrypted = import_crypto_js.default.AES.decrypt(text, import_crypto_js.default.enc.Hex.parse(pluginConfig.encryption.secretKey), {
|
|
5592
|
+
iv: import_crypto_js.default.enc.Hex.parse(pluginConfig.encryption.iv),
|
|
5593
|
+
mode: import_crypto_js.default.mode.CBC,
|
|
5594
|
+
padding: import_crypto_js.default.pad.Pkcs7
|
|
5595
|
+
});
|
|
5596
|
+
return decrypted.toString(import_crypto_js.default.enc.Utf8);
|
|
5597
|
+
};
|
|
5502
5598
|
|
|
5503
5599
|
// src/components/Label.tsx
|
|
5504
5600
|
var import_react17 = require("react");
|
|
@@ -7463,61 +7559,6 @@ var FormRow_default = FormRow2;
|
|
|
7463
7559
|
|
|
7464
7560
|
// src/components/ColorThemeSwitch.tsx
|
|
7465
7561
|
var import_react24 = require("react");
|
|
7466
|
-
|
|
7467
|
-
// src/utils/variableFunctions.ts
|
|
7468
|
-
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
7469
|
-
if (value === void 0) {
|
|
7470
|
-
throw new Error(
|
|
7471
|
-
`\`${functionsName}()\` must be used within a \`<BetterHtmlProvider>\`. Make sure to add one at the root of your component tree.`
|
|
7472
|
-
);
|
|
7473
|
-
}
|
|
7474
|
-
return value !== void 0;
|
|
7475
|
-
};
|
|
7476
|
-
var loaderControls = {
|
|
7477
|
-
startLoading: (loaderName) => {
|
|
7478
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.startLoading")) return;
|
|
7479
|
-
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
7480
|
-
...oldValue,
|
|
7481
|
-
[loaderName.toString()]: true
|
|
7482
|
-
}));
|
|
7483
|
-
},
|
|
7484
|
-
stopLoading: (loaderName) => {
|
|
7485
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.stopLoading")) return;
|
|
7486
|
-
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
7487
|
-
...oldValue,
|
|
7488
|
-
[loaderName.toString()]: false
|
|
7489
|
-
}));
|
|
7490
|
-
}
|
|
7491
|
-
};
|
|
7492
|
-
var alertControls = {
|
|
7493
|
-
createAlert: (alert) => {
|
|
7494
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "alertControls.createAlert"))
|
|
7495
|
-
return void 0;
|
|
7496
|
-
const readyAlert = {
|
|
7497
|
-
id: crypto.randomUUID(),
|
|
7498
|
-
...alert
|
|
7499
|
-
};
|
|
7500
|
-
externalBetterHtmlContextValue.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
7501
|
-
return readyAlert;
|
|
7502
|
-
},
|
|
7503
|
-
removeAlert: (alertId) => {
|
|
7504
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "alertControls.removeAlert")) return;
|
|
7505
|
-
externalBetterHtmlContextValue.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
7506
|
-
}
|
|
7507
|
-
};
|
|
7508
|
-
var colorThemeControls = {
|
|
7509
|
-
toggleTheme: (theme2) => {
|
|
7510
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "colorThemeControls.toggleTheme")) return;
|
|
7511
|
-
const currentColorTheme = externalBetterHtmlContextValue.colorTheme;
|
|
7512
|
-
const newColorTheme = theme2 ?? (currentColorTheme === "dark" ? "light" : "dark");
|
|
7513
|
-
setTimeout(() => {
|
|
7514
|
-
window.document.body.parentElement?.setAttribute("data-theme", newColorTheme);
|
|
7515
|
-
localStorage.setItem("theme", newColorTheme);
|
|
7516
|
-
}, 0.01 * 1e3);
|
|
7517
|
-
}
|
|
7518
|
-
};
|
|
7519
|
-
|
|
7520
|
-
// src/components/ColorThemeSwitch.tsx
|
|
7521
7562
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7522
7563
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
7523
7564
|
withMoon,
|
|
@@ -9121,6 +9162,71 @@ FoldableComponent.box = (0, import_react28.forwardRef)(function Box3({ ...props
|
|
|
9121
9162
|
var Foldable2 = (0, import_react28.memo)(FoldableComponent);
|
|
9122
9163
|
Foldable2.box = FoldableComponent.box;
|
|
9123
9164
|
var Foldable_default = Foldable2;
|
|
9165
|
+
|
|
9166
|
+
// src/utils/localStorage.ts
|
|
9167
|
+
function generateLocalStorage() {
|
|
9168
|
+
return {
|
|
9169
|
+
setItem: (name, value) => {
|
|
9170
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage"))
|
|
9171
|
+
return void 0;
|
|
9172
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
9173
|
+
(plugin) => plugin.name === "localStorage"
|
|
9174
|
+
);
|
|
9175
|
+
if (!localStoragePlugin2) {
|
|
9176
|
+
throw new Error(
|
|
9177
|
+
"`generateLocalStorage` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
9178
|
+
);
|
|
9179
|
+
}
|
|
9180
|
+
const pluginConfig = localStoragePlugin2.getConfig?.() ?? {};
|
|
9181
|
+
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
9182
|
+
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
9183
|
+
const readyValue = encryptionEnabled ? encryptString(JSON.stringify(value)) : JSON.stringify(value);
|
|
9184
|
+
if (value) localStorage.setItem(readyName.toString(), readyValue);
|
|
9185
|
+
else localStorage.removeItem(readyName.toString());
|
|
9186
|
+
},
|
|
9187
|
+
getItem: (name) => {
|
|
9188
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage"))
|
|
9189
|
+
return void 0;
|
|
9190
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
9191
|
+
(plugin) => plugin.name === "localStorage"
|
|
9192
|
+
);
|
|
9193
|
+
if (!localStoragePlugin2) {
|
|
9194
|
+
throw new Error(
|
|
9195
|
+
"`generateLocalStorage` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
9196
|
+
);
|
|
9197
|
+
}
|
|
9198
|
+
const pluginConfig = localStoragePlugin2.getConfig?.() ?? {};
|
|
9199
|
+
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
9200
|
+
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
9201
|
+
const item = localStorage.getItem(readyName.toString());
|
|
9202
|
+
if (item === null) return void 0;
|
|
9203
|
+
try {
|
|
9204
|
+
return encryptionEnabled ? JSON.parse(decryptString(item)) : JSON.parse(item);
|
|
9205
|
+
} catch (error) {
|
|
9206
|
+
return void 0;
|
|
9207
|
+
}
|
|
9208
|
+
},
|
|
9209
|
+
removeItem: (name) => {
|
|
9210
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage"))
|
|
9211
|
+
return void 0;
|
|
9212
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
9213
|
+
(plugin) => plugin.name === "localStorage"
|
|
9214
|
+
);
|
|
9215
|
+
if (!localStoragePlugin2) {
|
|
9216
|
+
throw new Error(
|
|
9217
|
+
"`generateLocalStorage` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
9218
|
+
);
|
|
9219
|
+
}
|
|
9220
|
+
const pluginConfig = localStoragePlugin2.getConfig?.() ?? {};
|
|
9221
|
+
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
9222
|
+
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
9223
|
+
localStorage.removeItem(readyName.toString());
|
|
9224
|
+
},
|
|
9225
|
+
removeAllItems: () => {
|
|
9226
|
+
localStorage.clear();
|
|
9227
|
+
}
|
|
9228
|
+
};
|
|
9229
|
+
}
|
|
9124
9230
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9125
9231
|
0 && (module.exports = {
|
|
9126
9232
|
BetterHtmlProvider,
|
|
@@ -9152,17 +9258,21 @@ var Foldable_default = Foldable2;
|
|
|
9152
9258
|
countries,
|
|
9153
9259
|
darkenColor,
|
|
9154
9260
|
defaultAlertsPluginOptions,
|
|
9261
|
+
defaultLocalStoragePluginOptions,
|
|
9262
|
+
defaultReactRouterDomPluginOptions,
|
|
9155
9263
|
desaturateColor,
|
|
9156
9264
|
eventPreventDefault,
|
|
9157
9265
|
eventPreventStop,
|
|
9158
9266
|
eventStopPropagation,
|
|
9159
9267
|
formatPhoneNumber,
|
|
9268
|
+
generateLocalStorage,
|
|
9160
9269
|
generateRandomString,
|
|
9161
9270
|
getBrowser,
|
|
9162
9271
|
getFormErrorObject,
|
|
9163
9272
|
isMobileDevice,
|
|
9164
9273
|
lightenColor,
|
|
9165
9274
|
loaderControls,
|
|
9275
|
+
localStoragePlugin,
|
|
9166
9276
|
reactRouterDomPlugin,
|
|
9167
9277
|
saturateColor,
|
|
9168
9278
|
useAlertControls,
|