react-better-html 1.1.72 → 1.1.74
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 +686 -0
- package/dist/index.d.ts +686 -34
- package/dist/index.js +6302 -101
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6231 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/components/BetterHtmlProvider.d.ts +0 -29
- package/dist/components/BetterHtmlProvider.js +0 -161
- package/dist/components/Button.d.ts +0 -65
- package/dist/components/Button.js +0 -166
- package/dist/components/Chip.d.ts +0 -20
- package/dist/components/Chip.js +0 -20
- package/dist/components/ColorThemeSwitch.d.ts +0 -15
- package/dist/components/ColorThemeSwitch.js +0 -54
- package/dist/components/Div.d.ts +0 -30
- package/dist/components/Div.js +0 -60
- package/dist/components/Divider.d.ts +0 -21
- package/dist/components/Divider.js +0 -20
- package/dist/components/Dropdown.d.ts +0 -48
- package/dist/components/Dropdown.js +0 -160
- package/dist/components/ExampleComponent.d.ts +0 -5
- package/dist/components/ExampleComponent.js +0 -10
- package/dist/components/Form.d.ts +0 -25
- package/dist/components/Form.js +0 -27
- package/dist/components/FormRow.d.ts +0 -32
- package/dist/components/FormRow.js +0 -28
- package/dist/components/Icon.d.ts +0 -13
- package/dist/components/Icon.js +0 -36
- package/dist/components/Image.d.ts +0 -18
- package/dist/components/Image.js +0 -44
- package/dist/components/InputField.d.ts +0 -44
- package/dist/components/InputField.js +0 -270
- package/dist/components/Label.d.ts +0 -11
- package/dist/components/Label.js +0 -14
- package/dist/components/Loader.d.ts +0 -34
- package/dist/components/Loader.js +0 -43
- package/dist/components/Modal.d.ts +0 -46
- package/dist/components/Modal.js +0 -123
- package/dist/components/PageHeader.d.ts +0 -18
- package/dist/components/PageHeader.js +0 -19
- package/dist/components/PageHolder.d.ts +0 -8
- package/dist/components/PageHolder.js +0 -15
- package/dist/components/Table.d.ts +0 -45
- package/dist/components/Table.js +0 -159
- package/dist/components/Text.d.ts +0 -18
- package/dist/components/Text.js +0 -38
- package/dist/components/ToggleInput.d.ts +0 -20
- package/dist/components/ToggleInput.js +0 -161
- package/dist/constants/app.d.ts +0 -2
- package/dist/constants/app.js +0 -6
- package/dist/constants/assets.d.ts +0 -2
- package/dist/constants/assets.js +0 -6
- package/dist/constants/countries.d.ts +0 -2
- package/dist/constants/countries.js +0 -1482
- package/dist/constants/css.d.ts +0 -1
- package/dist/constants/css.js +0 -1291
- package/dist/constants/icons.d.ts +0 -2
- package/dist/constants/icons.js +0 -85
- package/dist/constants/theme.d.ts +0 -2
- package/dist/constants/theme.js +0 -50
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -4
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/index.js +0 -17
- package/dist/plugins/react-router-dom.d.ts +0 -2
- package/dist/plugins/react-router-dom.js +0 -14
- package/dist/types/app.d.ts +0 -15
- package/dist/types/app.js +0 -2
- package/dist/types/asset.d.ts +0 -4
- package/dist/types/asset.js +0 -2
- package/dist/types/components.d.ts +0 -13
- package/dist/types/components.js +0 -2
- package/dist/types/config.d.ts +0 -23
- package/dist/types/config.js +0 -2
- package/dist/types/countries.d.ts +0 -7
- package/dist/types/countries.js +0 -2
- package/dist/types/icon.d.ts +0 -11
- package/dist/types/icon.js +0 -2
- package/dist/types/loader.d.ts +0 -4
- package/dist/types/loader.js +0 -2
- package/dist/types/other.d.ts +0 -1
- package/dist/types/other.js +0 -2
- package/dist/types/plugin.d.ts +0 -7
- package/dist/types/plugin.js +0 -2
- package/dist/types/theme.d.ts +0 -19
- package/dist/types/theme.js +0 -2
- package/dist/utils/functions.d.ts +0 -16
- package/dist/utils/functions.js +0 -77
- package/dist/utils/hooks.d.ts +0 -86
- package/dist/utils/hooks.js +0 -450
- package/dist/utils/logger.d.ts +0 -41
- package/dist/utils/logger.js +0 -66
- package/dist/utils/variableFunctions.d.ts +0 -6
- package/dist/utils/variableFunctions.js +0 -28
- package/dist/utils/withPlugin.d.ts +0 -4
- package/dist/utils/withPlugin.js +0 -15
package/dist/constants/icons.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.icons = void 0;
|
|
4
|
-
exports.icons = {
|
|
5
|
-
XMark: {
|
|
6
|
-
width: 384,
|
|
7
|
-
height: 512,
|
|
8
|
-
paths: [
|
|
9
|
-
{
|
|
10
|
-
d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z",
|
|
11
|
-
type: "fill",
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
uploadCloud: {
|
|
16
|
-
width: 640,
|
|
17
|
-
height: 512,
|
|
18
|
-
paths: [
|
|
19
|
-
{
|
|
20
|
-
d: "M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128l-368 0zm79-217c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l39-39L296 392c0 13.3 10.7 24 24 24s24-10.7 24-24l0-134.1 39 39c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0l-80 80z",
|
|
21
|
-
type: "fill",
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
trash: {
|
|
26
|
-
width: 448,
|
|
27
|
-
height: 512,
|
|
28
|
-
paths: [
|
|
29
|
-
{
|
|
30
|
-
d: "M135.2 17.7C140.6 6.8 151.7 0 163.8 0L284.2 0c12.1 0 23.2 6.8 28.6 17.7L320 32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 7.2-14.3zM32 128l384 0 0 320c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-320zm96 64c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16z",
|
|
31
|
-
type: "fill",
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
chevronDown: {
|
|
36
|
-
width: 512,
|
|
37
|
-
height: 512,
|
|
38
|
-
paths: [
|
|
39
|
-
{
|
|
40
|
-
d: "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z",
|
|
41
|
-
type: "fill",
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
eye: {
|
|
46
|
-
width: 576,
|
|
47
|
-
height: 512,
|
|
48
|
-
paths: [
|
|
49
|
-
{
|
|
50
|
-
d: "M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z",
|
|
51
|
-
type: "fill",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
eyeDashed: {
|
|
56
|
-
width: 640,
|
|
57
|
-
height: 512,
|
|
58
|
-
paths: [
|
|
59
|
-
{
|
|
60
|
-
d: "M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5L373 389.9z",
|
|
61
|
-
type: "fill",
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
magnifyingGlass: {
|
|
66
|
-
width: 512,
|
|
67
|
-
height: 512,
|
|
68
|
-
paths: [
|
|
69
|
-
{
|
|
70
|
-
d: "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z",
|
|
71
|
-
type: "fill",
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
check: {
|
|
76
|
-
width: 448,
|
|
77
|
-
height: 512,
|
|
78
|
-
paths: [
|
|
79
|
-
{
|
|
80
|
-
d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z",
|
|
81
|
-
type: "fill",
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
};
|
package/dist/constants/theme.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.theme = void 0;
|
|
4
|
-
exports.theme = {
|
|
5
|
-
styles: {
|
|
6
|
-
space: 16,
|
|
7
|
-
gap: 8,
|
|
8
|
-
borderRadius: 10,
|
|
9
|
-
fontFamily: "Arial, sans-serif",
|
|
10
|
-
transition: "ease 0.2s",
|
|
11
|
-
},
|
|
12
|
-
colors: {
|
|
13
|
-
light: {
|
|
14
|
-
textPrimary: "#111111",
|
|
15
|
-
textSecondary: "#777777",
|
|
16
|
-
textLink: "#0894ff",
|
|
17
|
-
label: "#111111",
|
|
18
|
-
primary: "#6d466b",
|
|
19
|
-
secondary: "#412234",
|
|
20
|
-
accent: "#16d7ed",
|
|
21
|
-
success: "#28a745",
|
|
22
|
-
info: "#0fa0da",
|
|
23
|
-
warn: "#ffc107",
|
|
24
|
-
error: "#dc3545",
|
|
25
|
-
base: "#f8f8f8",
|
|
26
|
-
backgroundBase: "#f8f8f8",
|
|
27
|
-
backgroundSecondary: "#e8e8e8",
|
|
28
|
-
backgroundContent: "#ffffff",
|
|
29
|
-
border: "#ced4da",
|
|
30
|
-
},
|
|
31
|
-
dark: {
|
|
32
|
-
textPrimary: "#f8f8f8",
|
|
33
|
-
textSecondary: "#e8e8e8",
|
|
34
|
-
textLink: "#0894ff",
|
|
35
|
-
label: "#111111",
|
|
36
|
-
primary: "#9b6499",
|
|
37
|
-
secondary: "#6c466b",
|
|
38
|
-
accent: "#16d7ed",
|
|
39
|
-
success: "#28a745",
|
|
40
|
-
info: "#0fa0da",
|
|
41
|
-
warn: "#ffc107",
|
|
42
|
-
error: "#dc3545",
|
|
43
|
-
base: "#f8f8f8",
|
|
44
|
-
backgroundBase: "#111111",
|
|
45
|
-
backgroundSecondary: "#222222",
|
|
46
|
-
backgroundContent: "#333333",
|
|
47
|
-
border: "#777777",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
package/dist/constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isMobileDevice: boolean;
|
package/dist/constants.js
DELETED
package/dist/plugins/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./react-router-dom";
|
package/dist/plugins/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./react-router-dom"), exports);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reactRouterDomPlugin = void 0;
|
|
4
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
5
|
-
exports.reactRouterDomPlugin = {
|
|
6
|
-
name: "react-router-dom",
|
|
7
|
-
components: {
|
|
8
|
-
Link: react_router_dom_1.Link,
|
|
9
|
-
NavLink: react_router_dom_1.NavLink,
|
|
10
|
-
},
|
|
11
|
-
initialize: () => {
|
|
12
|
-
console.log("react-router-dom plugin initialized");
|
|
13
|
-
},
|
|
14
|
-
};
|
package/dist/types/app.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Removes the given props from type */
|
|
2
|
-
export type OmitProps<T, K extends keyof T> = Omit<T, K>;
|
|
3
|
-
/** Removes the given options from type */
|
|
4
|
-
export type ExcludeOptions<T, K extends T> = Exclude<T, K>;
|
|
5
|
-
/** Picks only the selected values */
|
|
6
|
-
export type PickValue<T, K extends T> = K;
|
|
7
|
-
/** Makes all object props optional (On the root) */
|
|
8
|
-
export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
9
|
-
/** Makes all object props optional (On the root and nested) */
|
|
10
|
-
export type DeepPartialRecord<T> = {
|
|
11
|
-
[K in keyof T]?: T[K] extends object ? DeepPartialRecord<T[K]> : T[K];
|
|
12
|
-
};
|
|
13
|
-
/** returns only the required props */
|
|
14
|
-
export type PickAllRequired<T, K extends keyof T> = Required<Pick<T, K>>;
|
|
15
|
-
export type AnyOtherString = Omit<string & {}, "">;
|
package/dist/types/app.js
DELETED
package/dist/types/asset.d.ts
DELETED
package/dist/types/asset.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BetterHtmlPlugin } from "./plugin";
|
|
2
|
-
export type ComponentStyle = React.CSSProperties;
|
|
3
|
-
export type ComponentHoverStyle = {
|
|
4
|
-
[CSSProperty in keyof ComponentStyle as `${CSSProperty & string}Hover`]: ComponentStyle[CSSProperty];
|
|
5
|
-
};
|
|
6
|
-
export type ComponentMarginProps = Pick<ComponentStyle, "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "marginBlock" | "marginInline">;
|
|
7
|
-
export type ComponentPaddingProps = Pick<ComponentStyle, "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingBlock" | "paddingInline">;
|
|
8
|
-
export type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
|
|
9
|
-
ref?: React.Ref<ComponentRef>;
|
|
10
|
-
};
|
|
11
|
-
export type ComponentPropWithPlugin<ComponentProps> = ComponentProps & {
|
|
12
|
-
plugin: BetterHtmlPlugin;
|
|
13
|
-
};
|
package/dist/types/components.js
DELETED
package/dist/types/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ColorTheme, ThemeConfig } from "./theme";
|
|
2
|
-
import { AssetsConfig } from "./asset";
|
|
3
|
-
import { IconsConfig } from "./icon";
|
|
4
|
-
import { LoaderConfig } from "./loader";
|
|
5
|
-
import { ComponentHoverStyle, ComponentStyle } from "./components";
|
|
6
|
-
export type AppConfig = {
|
|
7
|
-
contentMaxWidth: number;
|
|
8
|
-
};
|
|
9
|
-
type ComponentConfig<Subcomponents extends string> = {
|
|
10
|
-
[key in Subcomponents]?: ComponentStyle & ComponentHoverStyle;
|
|
11
|
-
};
|
|
12
|
-
export type BetterHtmlConfig = {
|
|
13
|
-
app: AppConfig;
|
|
14
|
-
theme: ThemeConfig;
|
|
15
|
-
colorTheme: ColorTheme;
|
|
16
|
-
icons: Partial<IconsConfig>;
|
|
17
|
-
assets: Partial<AssetsConfig>;
|
|
18
|
-
loaders: Partial<LoaderConfig>;
|
|
19
|
-
components: {
|
|
20
|
-
button?: ComponentConfig<"default" | "secondary" | "destructive" | "icon" | "upload">;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export {};
|
package/dist/types/config.js
DELETED
package/dist/types/countries.js
DELETED
package/dist/types/icon.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type IconName = "XMark" | "uploadCloud" | "trash" | "chevronDown" | "eye" | "eyeDashed" | "magnifyingGlass" | "check";
|
|
2
|
-
export type IconData = {
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
paths: (React.ComponentProps<"path"> & {
|
|
6
|
-
type: "fill" | "stroke";
|
|
7
|
-
})[];
|
|
8
|
-
};
|
|
9
|
-
export type IconsConfig = Record<IconName, IconData> & {
|
|
10
|
-
[key: string]: IconData;
|
|
11
|
-
};
|
package/dist/types/icon.js
DELETED
package/dist/types/loader.d.ts
DELETED
package/dist/types/loader.js
DELETED
package/dist/types/other.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type BrowserName = "firefox" | "chrome" | "safari" | "edge" | "opera";
|
package/dist/types/other.js
DELETED
package/dist/types/plugin.d.ts
DELETED
package/dist/types/plugin.js
DELETED
package/dist/types/theme.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type Color = `#${string}` | "transparent";
|
|
2
|
-
export type ColorName = "textPrimary" | "textSecondary" | "textLink" | "label" | "primary" | "secondary" | "accent" | "success" | "info" | "warn" | "error" | "base" | "backgroundBase" | "backgroundSecondary" | "backgroundContent" | "border";
|
|
3
|
-
export type ColorTheme = "light" | "dark";
|
|
4
|
-
export type Styles = {
|
|
5
|
-
space: number;
|
|
6
|
-
gap: number;
|
|
7
|
-
borderRadius: number;
|
|
8
|
-
fontFamily: string;
|
|
9
|
-
transition: string;
|
|
10
|
-
};
|
|
11
|
-
export type Colors = Record<ColorName, Color>;
|
|
12
|
-
export type Theme = {
|
|
13
|
-
styles: Styles;
|
|
14
|
-
colors: Colors;
|
|
15
|
-
};
|
|
16
|
-
export type ThemeConfig = {
|
|
17
|
-
styles: Styles;
|
|
18
|
-
colors: Record<ColorTheme, Colors>;
|
|
19
|
-
};
|
package/dist/types/theme.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PartialRecord } from "../types/app";
|
|
2
|
-
import { BrowserName } from "../types/other";
|
|
3
|
-
import { useForm } from "./hooks";
|
|
4
|
-
export declare const generateRandomString: (stringLength: number, options?: {
|
|
5
|
-
/** @default true */
|
|
6
|
-
includeCapitalLetters?: boolean;
|
|
7
|
-
/** @default true */
|
|
8
|
-
includeLowerLetters?: boolean;
|
|
9
|
-
/** @default true */
|
|
10
|
-
includeNumbers?: boolean;
|
|
11
|
-
/** @default 1 */
|
|
12
|
-
dashSections?: number;
|
|
13
|
-
}) => string;
|
|
14
|
-
export declare const getBrowser: () => BrowserName | undefined;
|
|
15
|
-
export declare const formatPhoneNumber: (phoneNumber: string) => string;
|
|
16
|
-
export declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
|
package/dist/utils/functions.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFormErrorObject = exports.formatPhoneNumber = exports.getBrowser = exports.generateRandomString = void 0;
|
|
4
|
-
const countries_1 = require("../constants/countries");
|
|
5
|
-
const generateRandomString = (stringLength, options) => {
|
|
6
|
-
const capitals = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
7
|
-
const lowers = "abcdefghijklmnopqrstuvwxyz";
|
|
8
|
-
const numbers = "0123456789";
|
|
9
|
-
const includes = [];
|
|
10
|
-
if (options?.includeCapitalLetters !== false)
|
|
11
|
-
includes.push(capitals);
|
|
12
|
-
if (options?.includeLowerLetters !== false)
|
|
13
|
-
includes.push(lowers);
|
|
14
|
-
if (options?.includeNumbers !== false)
|
|
15
|
-
includes.push(numbers);
|
|
16
|
-
const characters = includes.join("");
|
|
17
|
-
const dashSections = Math.max(1, options?.dashSections ?? 1);
|
|
18
|
-
const dashSectionLength = Math.floor(stringLength / dashSections);
|
|
19
|
-
if (stringLength < dashSections)
|
|
20
|
-
return "";
|
|
21
|
-
let result = "";
|
|
22
|
-
let currentSectionLength = 0;
|
|
23
|
-
while (result.length < stringLength) {
|
|
24
|
-
if (currentSectionLength >= dashSectionLength) {
|
|
25
|
-
result += "-";
|
|
26
|
-
currentSectionLength = 0;
|
|
27
|
-
}
|
|
28
|
-
if (result.length < stringLength) {
|
|
29
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
30
|
-
currentSectionLength += 1;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
exports.generateRandomString = generateRandomString;
|
|
36
|
-
const getBrowser = () => {
|
|
37
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
38
|
-
if (userAgent.includes("firefox"))
|
|
39
|
-
return "firefox";
|
|
40
|
-
if (userAgent.includes("chrome") && !userAgent.includes("edg"))
|
|
41
|
-
return "chrome";
|
|
42
|
-
if (userAgent.includes("safari") && !userAgent.includes("chrome"))
|
|
43
|
-
return "safari";
|
|
44
|
-
if (userAgent.includes("edg"))
|
|
45
|
-
return "edge";
|
|
46
|
-
if (userAgent.includes("opr") || userAgent.includes("opera"))
|
|
47
|
-
return "opera";
|
|
48
|
-
return;
|
|
49
|
-
};
|
|
50
|
-
exports.getBrowser = getBrowser;
|
|
51
|
-
const formatPhoneNumber = (phoneNumber) => {
|
|
52
|
-
const cleanPhoneNumber = phoneNumber.replace(/\D/g, "");
|
|
53
|
-
const country = countries_1.countries.find((country) => country.phoneNumberExtension === cleanPhoneNumber.slice(0, country.phoneNumberExtension.length));
|
|
54
|
-
if (!country)
|
|
55
|
-
return phoneNumber;
|
|
56
|
-
let phonNumberRest = cleanPhoneNumber.slice(country.phoneNumberExtension.length);
|
|
57
|
-
if (country.phoneNumberFormat) {
|
|
58
|
-
let formattedNumber = "";
|
|
59
|
-
let index = 0;
|
|
60
|
-
for (const char of country.phoneNumberFormat) {
|
|
61
|
-
if (char === "X" && index < phonNumberRest.length) {
|
|
62
|
-
formattedNumber += phonNumberRest[index];
|
|
63
|
-
index++;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
formattedNumber += char;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
phonNumberRest = formattedNumber.replace(/X/g, "").trim();
|
|
70
|
-
}
|
|
71
|
-
return `+${country.phoneNumberExtension} ${phonNumberRest}`;
|
|
72
|
-
};
|
|
73
|
-
exports.formatPhoneNumber = formatPhoneNumber;
|
|
74
|
-
const getFormErrorObject = (formValues) => {
|
|
75
|
-
return {};
|
|
76
|
-
};
|
|
77
|
-
exports.getFormErrorObject = getFormErrorObject;
|
package/dist/utils/hooks.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { ComponentHoverStyle, ComponentPropWithRef, ComponentStyle } from "../types/components";
|
|
2
|
-
import { Theme } from "../types/theme";
|
|
3
|
-
import { OmitProps, PartialRecord } from "../types/app";
|
|
4
|
-
import { InputFieldProps, TextareaFieldProps } from "../components/InputField";
|
|
5
|
-
import { DropdownProps } from "../components/Dropdown";
|
|
6
|
-
import { ToggleInputProps, ToggleInputRef } from "../components/ToggleInput";
|
|
7
|
-
export declare function useStyledComponentStyles(props: ComponentStyle & ComponentHoverStyle, theme?: Theme,
|
|
8
|
-
/** @default false */
|
|
9
|
-
excludeProps?: boolean): {
|
|
10
|
-
normalStyle: ComponentStyle;
|
|
11
|
-
hoverStyle: ComponentStyle;
|
|
12
|
-
};
|
|
13
|
-
export declare function useComponentPropsWithPrefix<Props extends Record<string, any>, Prefix extends string>(props: Props, prefix: Prefix): Record<`${Prefix}-${string}`, any>;
|
|
14
|
-
export declare function useComponentPropsWithExcludedStyle<Props extends Record<string, any>>(props: Props): Partial<Props>;
|
|
15
|
-
export declare function useComponentPropsWithoutStyle<Props extends Record<string, any>>(props: Props): Partial<Props>;
|
|
16
|
-
export declare function useComponentInputFieldDateProps(props: InputFieldProps, holderRef: React.RefObject<HTMLDivElement | null>): {
|
|
17
|
-
internalValue: string;
|
|
18
|
-
setInternalValue: React.Dispatch<React.SetStateAction<string>>;
|
|
19
|
-
inputFieldProps: InputFieldProps;
|
|
20
|
-
insideInputFieldComponentProps: InputFieldProps;
|
|
21
|
-
isOpen: boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare function usePageResize(): {
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
};
|
|
27
|
-
export declare function usePageScroll(): {
|
|
28
|
-
scrollX: number;
|
|
29
|
-
scrollY: number;
|
|
30
|
-
};
|
|
31
|
-
export declare function useMediaQuery(): {
|
|
32
|
-
size320: boolean;
|
|
33
|
-
size400: boolean;
|
|
34
|
-
size500: boolean;
|
|
35
|
-
size600: boolean;
|
|
36
|
-
size700: boolean;
|
|
37
|
-
size800: boolean;
|
|
38
|
-
size900: boolean;
|
|
39
|
-
size1000: boolean;
|
|
40
|
-
size1100: boolean;
|
|
41
|
-
size1200: boolean;
|
|
42
|
-
size1300: boolean;
|
|
43
|
-
size1400: boolean;
|
|
44
|
-
size1500: boolean;
|
|
45
|
-
size1600: boolean;
|
|
46
|
-
};
|
|
47
|
-
export declare function useBooleanState(initialValue?: boolean): [
|
|
48
|
-
state: boolean,
|
|
49
|
-
actions: {
|
|
50
|
-
setState: React.Dispatch<React.SetStateAction<boolean>>;
|
|
51
|
-
setTrue: () => void;
|
|
52
|
-
setFalse: () => void;
|
|
53
|
-
toggle: () => void;
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
export declare function useDebounceState<Value>(initialValue: Value, delay?: number): [value: Value, debouncedValue: Value, setValue: React.Dispatch<React.SetStateAction<Value>>, isLoading: boolean];
|
|
57
|
-
export declare function useForm<FormFields extends Record<string | number, string | number | boolean | undefined>>(options: {
|
|
58
|
-
defaultValues: FormFields;
|
|
59
|
-
requiredFields?: (keyof FormFields)[];
|
|
60
|
-
onSubmit?: (values: FormFields) => void | Promise<void>;
|
|
61
|
-
validate?: (values: FormFields) => PartialRecord<keyof FormFields, string>;
|
|
62
|
-
}): {
|
|
63
|
-
values: FormFields;
|
|
64
|
-
errors: Partial<Record<keyof FormFields, string>>;
|
|
65
|
-
isSubmitting: boolean;
|
|
66
|
-
setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
|
|
67
|
-
setFieldsValue: (values: Partial<FormFields>) => void;
|
|
68
|
-
getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<HTMLInputElement, InputFieldProps>;
|
|
69
|
-
getTextAreaProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<HTMLTextAreaElement, TextareaFieldProps>;
|
|
70
|
-
getDropdownFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => OmitProps<ComponentPropWithRef<HTMLDivElement, DropdownProps<FormFields[FieldName], unknown>>, "options">;
|
|
71
|
-
getCheckboxProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
|
|
72
|
-
getRadioButtonProps: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName]) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
|
|
73
|
-
getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<ToggleInputRef, ToggleInputProps<FormFields[FieldName]>>;
|
|
74
|
-
focusField: (field: keyof FormFields) => void;
|
|
75
|
-
onSubmit: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
|
|
76
|
-
reset: () => void;
|
|
77
|
-
requiredFields: (keyof FormFields)[] | undefined;
|
|
78
|
-
isDirty: boolean;
|
|
79
|
-
isValid: boolean;
|
|
80
|
-
canSubmit: boolean;
|
|
81
|
-
};
|
|
82
|
-
export declare function useUrlQuery(): {
|
|
83
|
-
setQuery: (query: Record<string, string | number>, keepHistory?: boolean) => void;
|
|
84
|
-
getQuery: (name: string) => string | null;
|
|
85
|
-
removeQuery: (name: string, keepHistory?: boolean) => void;
|
|
86
|
-
};
|