addon-ui 0.3.0

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.
Files changed (129) hide show
  1. package/README.md +1197 -0
  2. package/package.json +113 -0
  3. package/src/components/Avatar/Avatar.tsx +56 -0
  4. package/src/components/Avatar/avatar.module.scss +78 -0
  5. package/src/components/Avatar/index.ts +2 -0
  6. package/src/components/Avatar/types.ts +11 -0
  7. package/src/components/BaseButton/BaseButton.tsx +36 -0
  8. package/src/components/BaseButton/base-button.module.scss +24 -0
  9. package/src/components/BaseButton/index.ts +1 -0
  10. package/src/components/Button/Button.tsx +51 -0
  11. package/src/components/Button/button.module.scss +140 -0
  12. package/src/components/Button/index.ts +2 -0
  13. package/src/components/Button/types.ts +24 -0
  14. package/src/components/Checkbox/Checkbox.tsx +58 -0
  15. package/src/components/Checkbox/checkbox.module.scss +82 -0
  16. package/src/components/Checkbox/index.ts +2 -0
  17. package/src/components/Checkbox/types.ts +15 -0
  18. package/src/components/Dialog/Dialog.tsx +126 -0
  19. package/src/components/Dialog/dialog.module.scss +55 -0
  20. package/src/components/Dialog/index.ts +1 -0
  21. package/src/components/Drawer/Drawer.tsx +53 -0
  22. package/src/components/Drawer/drawer.module.scss +170 -0
  23. package/src/components/Drawer/index.ts +2 -0
  24. package/src/components/Drawer/types.ts +6 -0
  25. package/src/components/Footer/Footer.tsx +59 -0
  26. package/src/components/Footer/footer.module.scss +45 -0
  27. package/src/components/Footer/index.ts +1 -0
  28. package/src/components/Header/Header.tsx +74 -0
  29. package/src/components/Header/header.module.scss +56 -0
  30. package/src/components/Header/index.ts +1 -0
  31. package/src/components/Highlight/Highlight.tsx +36 -0
  32. package/src/components/Highlight/highlight.module.scss +48 -0
  33. package/src/components/Highlight/index.ts +2 -0
  34. package/src/components/Highlight/types.ts +5 -0
  35. package/src/components/Icon/Icon.tsx +46 -0
  36. package/src/components/Icon/icon.module.scss +17 -0
  37. package/src/components/Icon/index.ts +1 -0
  38. package/src/components/IconButton/IconButton.tsx +50 -0
  39. package/src/components/IconButton/icon-button.module.scss +86 -0
  40. package/src/components/IconButton/index.ts +2 -0
  41. package/src/components/IconButton/types.ts +17 -0
  42. package/src/components/Layout/Provider.tsx +60 -0
  43. package/src/components/Layout/context.ts +24 -0
  44. package/src/components/Layout/index.ts +2 -0
  45. package/src/components/Layout/layout.module.scss +17 -0
  46. package/src/components/List/List.tsx +24 -0
  47. package/src/components/List/index.ts +1 -0
  48. package/src/components/List/list.module.scss +8 -0
  49. package/src/components/ListItem/ListItem.tsx +75 -0
  50. package/src/components/ListItem/index.ts +1 -0
  51. package/src/components/ListItem/list-item.module.scss +37 -0
  52. package/src/components/Modal/Modal.tsx +90 -0
  53. package/src/components/Modal/index.ts +2 -0
  54. package/src/components/Modal/modal.module.scss +97 -0
  55. package/src/components/Modal/types.ts +6 -0
  56. package/src/components/Odometer/Odometer.tsx +45 -0
  57. package/src/components/Odometer/hooks/useOdometer.tsx +24 -0
  58. package/src/components/Odometer/index.ts +2 -0
  59. package/src/components/Odometer/odometer.module.scss +81 -0
  60. package/src/components/Odometer/odometr.d.ts +9 -0
  61. package/src/components/ScrollArea/ScrollArea.tsx +75 -0
  62. package/src/components/ScrollArea/index.ts +1 -0
  63. package/src/components/ScrollArea/scroll-area.module.scss +58 -0
  64. package/src/components/SvgSprite/SvgSprite.tsx +21 -0
  65. package/src/components/SvgSprite/index.ts +1 -0
  66. package/src/components/Switch/Switch.tsx +24 -0
  67. package/src/components/Switch/index.ts +1 -0
  68. package/src/components/Switch/switch.module.scss +65 -0
  69. package/src/components/Tag/Tag.tsx +50 -0
  70. package/src/components/Tag/index.ts +2 -0
  71. package/src/components/Tag/tag.module.scss +118 -0
  72. package/src/components/Tag/types.ts +23 -0
  73. package/src/components/TextArea/TextArea.tsx +126 -0
  74. package/src/components/TextArea/index.ts +2 -0
  75. package/src/components/TextArea/text-area.module.scss +88 -0
  76. package/src/components/TextArea/types.ts +18 -0
  77. package/src/components/TextField/TextField.tsx +139 -0
  78. package/src/components/TextField/index.ts +2 -0
  79. package/src/components/TextField/text-field.module.scss +129 -0
  80. package/src/components/TextField/types.ts +24 -0
  81. package/src/components/Toast/Toast.tsx +124 -0
  82. package/src/components/Toast/index.ts +2 -0
  83. package/src/components/Toast/toast.module.scss +267 -0
  84. package/src/components/Toast/types.ts +20 -0
  85. package/src/components/Tooltip/Tooltip.tsx +82 -0
  86. package/src/components/Tooltip/index.ts +1 -0
  87. package/src/components/Tooltip/tooltip.module.scss +123 -0
  88. package/src/components/View/View.tsx +68 -0
  89. package/src/components/View/index.ts +1 -0
  90. package/src/components/View/view.module.scss +38 -0
  91. package/src/components/ViewDrawer/ViewDrawer.tsx +24 -0
  92. package/src/components/ViewDrawer/index.ts +1 -0
  93. package/src/components/ViewModal/ViewModal.tsx +24 -0
  94. package/src/components/ViewModal/index.ts +1 -0
  95. package/src/components/index.ts +27 -0
  96. package/src/components/types.ts +65 -0
  97. package/src/config/default.ts +3 -0
  98. package/src/config/index.ts +8 -0
  99. package/src/declaration.d.ts +8 -0
  100. package/src/index.ts +3 -0
  101. package/src/plugin/builder/ConfigBuilder.ts +32 -0
  102. package/src/plugin/builder/StyleBuilder.ts +35 -0
  103. package/src/plugin/builder/virtual.config.ts +5 -0
  104. package/src/plugin/finder/ConfigFinder.ts +26 -0
  105. package/src/plugin/finder/Finder.ts +76 -0
  106. package/src/plugin/finder/StyleFinder.ts +23 -0
  107. package/src/plugin/index.ts +73 -0
  108. package/src/plugin/types.ts +8 -0
  109. package/src/providers/extra/ExtraProvider.tsx +13 -0
  110. package/src/providers/extra/context.ts +14 -0
  111. package/src/providers/extra/index.ts +2 -0
  112. package/src/providers/icons/IconsProvider.tsx +35 -0
  113. package/src/providers/icons/context.ts +20 -0
  114. package/src/providers/icons/index.ts +2 -0
  115. package/src/providers/index.ts +4 -0
  116. package/src/providers/theme/ThemeProvider.tsx +60 -0
  117. package/src/providers/theme/ThemeStorage.tsx +36 -0
  118. package/src/providers/theme/context.ts +30 -0
  119. package/src/providers/theme/index.ts +3 -0
  120. package/src/providers/ui/UIProvider.tsx +41 -0
  121. package/src/providers/ui/index.ts +1 -0
  122. package/src/providers/ui/styles/default.scss +95 -0
  123. package/src/providers/ui/styles/reset.scss +127 -0
  124. package/src/styles/mixins.scss +23 -0
  125. package/src/types/config.ts +15 -0
  126. package/src/types/theme.ts +11 -0
  127. package/src/utils/index.ts +2 -0
  128. package/src/utils/react.ts +21 -0
  129. package/src/utils/utils.ts +12 -0
@@ -0,0 +1,95 @@
1
+ @use "../../../styles/mixins" as theme;
2
+
3
+ @include theme.light {
4
+ --min-height: 440px;
5
+ --max-height: 540px;
6
+
7
+ --min-width: 380px;
8
+ --max-width: var(--min-width);
9
+
10
+ --font-family: "Arial", sans-serif;
11
+ --font-size: 14px;
12
+ --font-weight: 400;
13
+ --letter-spacing: 0.2px;
14
+ --line-height: normal;
15
+
16
+ --border-radius: 20px;
17
+
18
+ --side-padding-xs: 15px;
19
+ --side-padding-sm: 20px;
20
+ --side-padding-md: 25px;
21
+ --side-padding-lg: 30px;
22
+
23
+ --transition-speed-xs: 100ms;
24
+ --transition-speed-sm: 200ms;
25
+ --transition-speed-md: 250ms;
26
+ --transition-speed-lg: 500ms;
27
+
28
+ /* Common colors */
29
+ --primary-color: #5959ff;
30
+ --secondary-color: #3ea2f3;
31
+ --accent-color: #1dce75;
32
+ --error-color: #e54d2e;
33
+ --success-color: #1fd8a4;
34
+
35
+ --border-color: #dbdbdb;
36
+
37
+ --bg-transparent: transparent;
38
+ --bg-default-color: #fff;
39
+ --bg-primary-color: #f5f6f7;
40
+ --bg-secondary-color: #e9ecef;
41
+
42
+ --text-default-color: #000;
43
+ --text-primary-color: #2e4453;
44
+ --text-secondary-color: #25282b;
45
+ --text-accent-color: var(--accent-color);
46
+ --text-disabled-color: #333337;
47
+
48
+ --separator-color: #ccc;
49
+
50
+ /* Components colors */
51
+ --avatar-fallback-bg-color: #edeef0;
52
+ --avatar-fallback-color: #2e2f3b;
53
+
54
+ --checkbox-bg-color: #ddd;
55
+
56
+ --icon-button-color: #59647c;
57
+ --icon-button-bg-color: #ddd;
58
+ --icon-button-border-color: #ededed;
59
+ --icon-button-color-hover: #404a61;
60
+ --icon-button-bg-color-hover: #ccc;
61
+
62
+ --scroll-area-thumb-bg-color: #d9d9d9;
63
+ }
64
+
65
+ @include theme.dark {
66
+ /* Common colors */
67
+ --border-color: #545863;
68
+
69
+ --bg-transparent: transparent;
70
+ --bg-default-color: #000;
71
+ --bg-primary-color: #2e2f3b;
72
+ --bg-secondary-color: #3f404b;
73
+
74
+ --text-default-color: #fff;
75
+ --text-primary-color: #ededed;
76
+ --text-secondary-color: #fbfbfb;
77
+ --text-accent-color: var(--accent-color);
78
+ --text-disabled-color: #90aab9;
79
+
80
+ --separator-color: #555;
81
+
82
+ /* Components colors */
83
+ --avatar-fallback-bg-color: #606060;
84
+ --avatar-fallback-color: #eeeeee;
85
+
86
+ --checkbox-bg-color: #777;
87
+
88
+ --icon-button-color: #838a99;
89
+ --icon-button-bg-color: #404a61;
90
+ --icon-button-border-color: #3f404b;
91
+ --icon-button-color-hover: #959ca9;
92
+ --icon-button-bg-color-hover: #444;
93
+
94
+ --scroll-area-thumb-bg-color: #5e6063;
95
+ }
@@ -0,0 +1,127 @@
1
+ a,
2
+ abbr,
3
+ acronym,
4
+ address,
5
+ applet,
6
+ article,
7
+ aside,
8
+ audio,
9
+ b,
10
+ big,
11
+ blockquote,
12
+ body,
13
+ canvas,
14
+ caption,
15
+ center,
16
+ cite,
17
+ code,
18
+ dd,
19
+ del,
20
+ details,
21
+ dfn,
22
+ div,
23
+ dl,
24
+ dt,
25
+ em,
26
+ embed,
27
+ fieldset,
28
+ figcaption,
29
+ figure,
30
+ footer,
31
+ form,
32
+ h1,
33
+ h2,
34
+ h3,
35
+ h4,
36
+ h5,
37
+ h6,
38
+ header,
39
+ hgroup,
40
+ html,
41
+ i,
42
+ iframe,
43
+ img,
44
+ ins,
45
+ kbd,
46
+ label,
47
+ legend,
48
+ li,
49
+ main,
50
+ mark,
51
+ menu,
52
+ nav,
53
+ object,
54
+ ol,
55
+ output,
56
+ p,
57
+ pre,
58
+ q,
59
+ ruby,
60
+ s,
61
+ samp,
62
+ section,
63
+ small,
64
+ span,
65
+ strike,
66
+ strong,
67
+ sub,
68
+ summary,
69
+ sup,
70
+ table,
71
+ tbody,
72
+ td,
73
+ tfoot,
74
+ th,
75
+ thead,
76
+ time,
77
+ tr,
78
+ tt,
79
+ u,
80
+ ul,
81
+ var,
82
+ video {
83
+ margin: 0;
84
+ padding: 0;
85
+ border: 0;
86
+ vertical-align: baseline;
87
+ outline: none !important;
88
+ box-sizing: border-box;
89
+ }
90
+
91
+ article,
92
+ aside,
93
+ details,
94
+ figcaption,
95
+ figure,
96
+ footer,
97
+ header,
98
+ hgroup,
99
+ main,
100
+ menu,
101
+ nav,
102
+ section {
103
+ display: block;
104
+ }
105
+
106
+ input:focus,
107
+ select:focus,
108
+ textarea:focus,
109
+ button:focus {
110
+ outline: none;
111
+ }
112
+
113
+ body {
114
+ background-color: var(--bg-primary-color);
115
+ color: var(--text-primary-color);
116
+ font-family: var(--font-family), "sans-serif";
117
+ font-size: var(--font-size);
118
+ font-weight: var(--font-weight);
119
+ line-height: var(--line-height);
120
+ letter-spacing: var(--letter-spacing);
121
+ -webkit-font-smoothing: antialiased;
122
+ -moz-osx-font-smoothing: grayscale;
123
+ will-change: background-color, color;
124
+ transition:
125
+ background-color var(--transition-speed-md),
126
+ color var(--transition-speed-md);
127
+ }
@@ -0,0 +1,23 @@
1
+ @mixin light {
2
+ :root {
3
+ @content;
4
+ }
5
+ }
6
+
7
+ @mixin dark {
8
+ html[theme="dark"] {
9
+ @content;
10
+ }
11
+ }
12
+
13
+ @mixin ltr {
14
+ html[dir="ltr"] & {
15
+ @content;
16
+ }
17
+ }
18
+
19
+ @mixin rtl {
20
+ html[dir="rtl"] & {
21
+ @content;
22
+ }
23
+ }
@@ -0,0 +1,15 @@
1
+ import {SvgSpriteProps} from "../components";
2
+ import {ComponentsProps} from "../components/types";
3
+
4
+ export type {ComponentsProps};
5
+
6
+ export type Icons = SvgSpriteProps["icons"];
7
+
8
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
9
+ export interface ExtraProps {}
10
+
11
+ export interface Config {
12
+ components: ComponentsProps;
13
+ extra: ExtraProps;
14
+ icons: Icons;
15
+ }
@@ -0,0 +1,11 @@
1
+ export enum Theme {
2
+ Light = "light",
3
+ Dark = "dark",
4
+ }
5
+
6
+ export interface ThemeStorageContract {
7
+ get: () => Promise<Theme | undefined>;
8
+ change: (theme: Theme) => Promise<void>;
9
+ toggle: () => Promise<void>;
10
+ watch: (callback: (theme: Theme) => void) => () => void;
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./utils";
2
+ export * from "./react";
@@ -0,0 +1,21 @@
1
+ import {cloneElement, createElement, isValidElement, JSX, ReactNode} from "react";
2
+ import classnames from "classnames";
3
+
4
+ export const cloneOrCreateElement = <T extends keyof JSX.IntrinsicElements>(
5
+ element: ReactNode,
6
+ props: JSX.IntrinsicElements[T] = {},
7
+ wrapperTag: T = "span" as T
8
+ ) => {
9
+ if (isValidElement<{className?: string}>(element)) {
10
+ return cloneElement(element, {
11
+ ...props,
12
+ className: classnames(element.props.className, props.className),
13
+ });
14
+ }
15
+
16
+ if (element) {
17
+ return createElement(wrapperTag, {...props}, element);
18
+ }
19
+
20
+ return null;
21
+ };
@@ -0,0 +1,12 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
+ export const hideInTable = {table: {disable: true}};
4
+
5
+ export const capitalizeFirstLetter = (text: string) => {
6
+ if (text.length < 2) return text;
7
+ return text[0].toUpperCase() + text.slice(1);
8
+ };
9
+
10
+ export const splitProps = <T extends object>(props: Record<string, any>, keys: Set<keyof T>) => {
11
+ return Object.fromEntries(Object.entries(props).filter(([key]) => keys.has(key as keyof T))) as T;
12
+ };