adnbn-ui 0.0.1 → 0.1.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 (146) hide show
  1. package/.prettierignore +3 -0
  2. package/.prettierrc +28 -0
  3. package/.storybook/main.ts +22 -0
  4. package/.storybook/preview.tsx +100 -0
  5. package/.storybook/styles/custom.scss +59 -0
  6. package/.storybook/styles/preview.css +58 -0
  7. package/.storybook/vitest.setup.ts +9 -0
  8. package/README.md +1057 -0
  9. package/eslint.config.js +39 -0
  10. package/package.json +95 -4
  11. package/src/components/Avatar/Avatar.stories.tsx +118 -0
  12. package/src/components/Avatar/Avatar.tsx +65 -0
  13. package/src/components/Avatar/avatar.module.scss +77 -0
  14. package/src/components/Avatar/index.ts +2 -0
  15. package/src/components/BaseButton/BaseButton.tsx +36 -0
  16. package/src/components/BaseButton/base-button.module.scss +24 -0
  17. package/src/components/BaseButton/index.ts +2 -0
  18. package/src/components/Button/Button.stories.tsx +148 -0
  19. package/src/components/Button/Button.tsx +73 -0
  20. package/src/components/Button/button.module.scss +140 -0
  21. package/src/components/Button/index.ts +2 -0
  22. package/src/components/Checkbox/Checkbox.stories.tsx +180 -0
  23. package/src/components/Checkbox/Checkbox.tsx +71 -0
  24. package/src/components/Checkbox/checkbox.module.scss +82 -0
  25. package/src/components/Checkbox/index.ts +2 -0
  26. package/src/components/Dialog/Dialog.tsx +125 -0
  27. package/src/components/Dialog/dialog.module.scss +55 -0
  28. package/src/components/Dialog/index.ts +2 -0
  29. package/src/components/Drawer/Drawer.stories.tsx +89 -0
  30. package/src/components/Drawer/Drawer.tsx +57 -0
  31. package/src/components/Drawer/drawer.module.scss +170 -0
  32. package/src/components/Drawer/index.ts +2 -0
  33. package/src/components/Footer/Footer.stories.tsx +118 -0
  34. package/src/components/Footer/Footer.tsx +58 -0
  35. package/src/components/Footer/footer.module.scss +44 -0
  36. package/src/components/Footer/index.ts +2 -0
  37. package/src/components/Header/Header.stories.tsx +49 -0
  38. package/src/components/Header/Header.tsx +73 -0
  39. package/src/components/Header/header.module.scss +56 -0
  40. package/src/components/Header/index.ts +2 -0
  41. package/src/components/Highlight/Highlight.stories.tsx +83 -0
  42. package/src/components/Highlight/Highlight.tsx +40 -0
  43. package/src/components/Highlight/highlight.module.scss +47 -0
  44. package/src/components/Highlight/index.ts +2 -0
  45. package/src/components/Icon/Icon.tsx +46 -0
  46. package/src/components/Icon/icon.module.scss +17 -0
  47. package/src/components/Icon/index.ts +2 -0
  48. package/src/components/IconButton/IconButton.stories.tsx +179 -0
  49. package/src/components/IconButton/IconButton.tsx +65 -0
  50. package/src/components/IconButton/icon-button.module.scss +86 -0
  51. package/src/components/IconButton/index.ts +2 -0
  52. package/src/components/Layout/Layout.stories.tsx +88 -0
  53. package/src/components/Layout/Provider.tsx +47 -0
  54. package/src/components/Layout/context.ts +24 -0
  55. package/src/components/Layout/index.ts +2 -0
  56. package/src/components/Layout/layout.module.scss +17 -0
  57. package/src/components/List/List.stories.tsx +81 -0
  58. package/src/components/List/List.tsx +24 -0
  59. package/src/components/List/index.ts +2 -0
  60. package/src/components/List/list.module.scss +8 -0
  61. package/src/components/ListItem/ListItem.tsx +75 -0
  62. package/src/components/ListItem/index.ts +2 -0
  63. package/src/components/ListItem/list-item.module.scss +36 -0
  64. package/src/components/Modal/Modal.stories.tsx +95 -0
  65. package/src/components/Modal/Modal.tsx +94 -0
  66. package/src/components/Modal/index.ts +2 -0
  67. package/src/components/Modal/modal.module.scss +97 -0
  68. package/src/components/Odometer/Odometer.stories.tsx +66 -0
  69. package/src/components/Odometer/Odometer.tsx +45 -0
  70. package/src/components/Odometer/hooks/useOdometer.tsx +24 -0
  71. package/src/components/Odometer/index.ts +3 -0
  72. package/src/components/Odometer/odometer.module.scss +81 -0
  73. package/src/components/Odometer/odometr.d.ts +9 -0
  74. package/src/components/ScrollArea/ScrollArea.stories.tsx +58 -0
  75. package/src/components/ScrollArea/ScrollArea.tsx +63 -0
  76. package/src/components/ScrollArea/index.ts +2 -0
  77. package/src/components/ScrollArea/scroll-area.module.scss +54 -0
  78. package/src/components/SvgSprite/SvgSprite.tsx +21 -0
  79. package/src/components/SvgSprite/index.ts +2 -0
  80. package/src/components/Switch/Switch.stories.tsx +25 -0
  81. package/src/components/Switch/Switch.tsx +23 -0
  82. package/src/components/Switch/index.ts +2 -0
  83. package/src/components/Switch/switch.module.scss +65 -0
  84. package/src/components/Tag/Tag.stories.tsx +157 -0
  85. package/src/components/Tag/Tag.tsx +71 -0
  86. package/src/components/Tag/index.ts +2 -0
  87. package/src/components/Tag/tag.module.scss +118 -0
  88. package/src/components/TextArea/TextArea.stories.tsx +145 -0
  89. package/src/components/TextArea/TextArea.tsx +143 -0
  90. package/src/components/TextArea/index.ts +2 -0
  91. package/src/components/TextArea/text-area.module.scss +88 -0
  92. package/src/components/TextField/TextField.stories.tsx +177 -0
  93. package/src/components/TextField/TextField.tsx +162 -0
  94. package/src/components/TextField/index.ts +2 -0
  95. package/src/components/TextField/text-field.module.scss +129 -0
  96. package/src/components/Toast/Toast.stories.tsx +209 -0
  97. package/src/components/Toast/Toast.tsx +142 -0
  98. package/src/components/Toast/index.ts +2 -0
  99. package/src/components/Toast/toast.module.scss +267 -0
  100. package/src/components/Tooltip/Tooltip.stories.tsx +80 -0
  101. package/src/components/Tooltip/Tooltip.tsx +79 -0
  102. package/src/components/Tooltip/index.ts +2 -0
  103. package/src/components/Tooltip/tooltip.module.scss +93 -0
  104. package/src/components/View/View.stories.tsx +47 -0
  105. package/src/components/View/View.tsx +68 -0
  106. package/src/components/View/index.ts +2 -0
  107. package/src/components/View/view.module.scss +38 -0
  108. package/src/components/ViewDrawer/ViewDrawer.stories.tsx +75 -0
  109. package/src/components/ViewDrawer/ViewDrawer.tsx +24 -0
  110. package/src/components/ViewDrawer/index.ts +2 -0
  111. package/src/components/ViewModal/ViewModal.stories.tsx +68 -0
  112. package/src/components/ViewModal/ViewModal.tsx +24 -0
  113. package/src/components/ViewModal/index.ts +2 -0
  114. package/src/components/index.ts +29 -0
  115. package/src/components/types.ts +65 -0
  116. package/src/config/default.ts +3 -0
  117. package/src/config/index.ts +26 -0
  118. package/src/declaration.d.ts +8 -0
  119. package/src/index.ts +3 -0
  120. package/src/plugin/builder/ConfigBuilder.ts +32 -0
  121. package/src/plugin/builder/StyleBuilder.ts +34 -0
  122. package/src/plugin/builder/virtual.config.ts +7 -0
  123. package/src/plugin/finder/ConfigFinder.ts +26 -0
  124. package/src/plugin/finder/Finder.ts +76 -0
  125. package/src/plugin/finder/StyleFinder.ts +23 -0
  126. package/src/plugin/index.ts +70 -0
  127. package/src/plugin/types.ts +8 -0
  128. package/src/providers/UIProvider.tsx +26 -0
  129. package/src/providers/icons/IconsProvider.tsx +34 -0
  130. package/src/providers/icons/context.ts +22 -0
  131. package/src/providers/icons/index.ts +3 -0
  132. package/src/providers/index.ts +3 -0
  133. package/src/providers/theme/ThemeProvider.tsx +39 -0
  134. package/src/providers/theme/context.ts +30 -0
  135. package/src/providers/theme/index.ts +2 -0
  136. package/src/providers/theme/styles/default.scss +95 -0
  137. package/src/providers/theme/styles/reset.css +111 -0
  138. package/src/styles/mixins.scss +23 -0
  139. package/src/types/theme.ts +4 -0
  140. package/src/utils/index.ts +2 -0
  141. package/src/utils/react.ts +21 -0
  142. package/src/utils/utils.ts +12 -0
  143. package/tsconfig.json +18 -0
  144. package/vite.config.ts +11 -0
  145. package/vitest.workspace.ts +19 -0
  146. package/components/Button/index.ts +0 -0
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ dist/
3
+ build/
package/.prettierrc ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": false,
5
+ "printWidth": 120,
6
+ "tabWidth": 4,
7
+ "useTabs": false,
8
+ "bracketSpacing": false,
9
+ "arrowParens": "avoid",
10
+ "endOfLine": "lf",
11
+ "overrides": [
12
+ {
13
+ "files": "*.json",
14
+ "options": {
15
+ "tabWidth": 2,
16
+ "bracketSpacing": true,
17
+ "bracketSameLine": false,
18
+ "printWidth": 40
19
+ }
20
+ },
21
+ {
22
+ "files": "*.scss",
23
+ "options": {
24
+ "tabWidth": 2
25
+ }
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,22 @@
1
+ import path from "path";
2
+ import {mergeConfig} from "vite";
3
+ import type {StorybookConfig} from "@storybook/react-vite";
4
+
5
+ const config: StorybookConfig = {
6
+ stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
7
+ addons: ["@storybook/addon-essentials"],
8
+ framework: {
9
+ name: "@storybook/react-vite",
10
+ options: {},
11
+ },
12
+ viteFinal: config => {
13
+ return mergeConfig(config, {
14
+ resolve: {
15
+ alias: {
16
+ "adnbn-ui-config": path.resolve("src", "config", "default.ts"),
17
+ },
18
+ },
19
+ });
20
+ },
21
+ };
22
+ export default config;
@@ -0,0 +1,100 @@
1
+ import React, {useEffect} from "react";
2
+ import type {Preview, StoryContext, StoryFn} from "@storybook/react";
3
+ import {ThemeProvider} from "../src/providers";
4
+ import "./styles/preview.css";
5
+
6
+ const ThemeDecorator = (Story: StoryFn, context: StoryContext) => {
7
+ const dir = context.globals.dir || "ltr";
8
+ const theme = context.globals.theme || "light";
9
+ const cssVariables = context.globals.cssVariables || "default";
10
+
11
+ useEffect(() => {
12
+ document.documentElement.setAttribute("dir", dir);
13
+ return () => {
14
+ document.documentElement.removeAttribute("dir");
15
+ };
16
+ }, [dir]);
17
+
18
+ useEffect(() => {
19
+ document.documentElement.setAttribute("theme", theme);
20
+ return () => {
21
+ document.documentElement.removeAttribute("theme");
22
+ };
23
+ }, [theme]);
24
+
25
+ useEffect(() => {
26
+ if (cssVariables === "default") return;
27
+
28
+ const linkElement = document.createElement("link");
29
+ linkElement.rel = "stylesheet";
30
+ linkElement.href = "../.storybook/styles/custom.scss";
31
+ document.head.appendChild(linkElement);
32
+
33
+ return () => {
34
+ document.head.removeChild(linkElement);
35
+ };
36
+ }, [cssVariables]);
37
+
38
+ return (
39
+ <ThemeProvider>
40
+ <div className="story-wrapper">{Story(context.args, context)}</div>
41
+ </ThemeProvider>
42
+ );
43
+ };
44
+
45
+ const globalTypes = {
46
+ dir: {
47
+ name: "Direction",
48
+ description: "Choose direction",
49
+ defaultValue: "ltr",
50
+ toolbar: {
51
+ icon: "transfer",
52
+ items: [
53
+ {value: "ltr", title: "Left to right"},
54
+ {value: "rtl", title: "Right to left"},
55
+ ],
56
+ showName: true,
57
+ },
58
+ },
59
+ theme: {
60
+ name: "Theme",
61
+ description: "Global theme for components",
62
+ defaultValue: "light",
63
+ toolbar: {
64
+ icon: "star",
65
+ items: [
66
+ {value: "light", title: "Light theme"},
67
+ {value: "dark", title: "Dark theme"},
68
+ ],
69
+ showName: true,
70
+ },
71
+ },
72
+ cssVariables: {
73
+ name: "CSS Variables",
74
+ description: "Choose CSS variables set",
75
+ defaultValue: "default",
76
+ toolbar: {
77
+ icon: "paintbrush",
78
+ items: [
79
+ {value: "default", title: "Default Variables"},
80
+ {value: "custom", title: "Custom Variables"},
81
+ ],
82
+ showName: true,
83
+ },
84
+ },
85
+ };
86
+
87
+ const preview: Preview = {
88
+ parameters: {
89
+ controls: {
90
+ matchers: {
91
+ color: /(background|color)$/i,
92
+ date: /Date$/i,
93
+ },
94
+ },
95
+ },
96
+ decorators: [ThemeDecorator],
97
+ globalTypes,
98
+ };
99
+
100
+ export default preview;
@@ -0,0 +1,59 @@
1
+ @use "../../src/styles/mixins" as theme;
2
+
3
+ @include theme.light {
4
+ --button-height-sm: 20px;
5
+ --button-height: 25px;
6
+ --button-height-md: 30px;
7
+ --button-height-lg: 40px;
8
+
9
+ --switch-border-radius: 5px;
10
+ --switch-width: 40px;
11
+ --switch-height: 20px;
12
+ --switch-thumb-width: 20px;
13
+ --switch-thumb-height: 16px;
14
+
15
+ --tooltip-border-radius: 10px;
16
+ --tooltip-padding: 5px 10px;
17
+
18
+ --toast-viewport-padding: 5px;
19
+
20
+ /* Common colors */
21
+ --primary-color: #29a383;
22
+ --secondary-color: #20573e;
23
+ --accent-color: #f76b15;
24
+
25
+ --bg-primary-color: #f5f6f7;
26
+
27
+ --text-primary-color: #111111;
28
+
29
+ /* Components colors */
30
+ --avatar-fallback-bg-color: #ffe7b3;
31
+ --avatar-fallback-color: #2e2f3b;
32
+
33
+ --icon-button-color: #004074;
34
+ --icon-button-bg-color: #70b8ff;
35
+ --icon-button-border-color: #c2e6ff;
36
+ --icon-button-color-hover: #104d87;
37
+ --icon-button-bg-color-hover: #70b8ff;
38
+
39
+ --tooltip-bg-color: #a39073;
40
+ }
41
+
42
+ @include theme.dark {
43
+ /* Common colors */
44
+ --bg-primary-color: #191919;
45
+
46
+ --text-primary-color: #b4b4b4;
47
+
48
+ /* Components colors */
49
+ --avatar-fallback-bg-color: #3f2700;
50
+ --avatar-fallback-color: #f5f6f7;
51
+
52
+ --icon-button-color: #0bd8b6;
53
+ --icon-button-bg-color: #023b37;
54
+ --icon-button-border-color: #084843;
55
+ --icon-button-color-hover: #adf0dd;
56
+ --icon-button-bg-color-hover: #0b3b2c;
57
+
58
+ --tooltip-bg-color: #d4b3a5;
59
+ }
@@ -0,0 +1,58 @@
1
+ body {
2
+ height: 100%;
3
+ width: 100%;
4
+ padding: 0 !important;
5
+ }
6
+
7
+ body.sb-main-padded {
8
+ height: 100vh;
9
+ }
10
+
11
+ .docs-story > div {
12
+ padding: 0;
13
+ overflow: hidden;
14
+ }
15
+
16
+ .docs-story .innerZoomElementWrapper > div {
17
+ width: 100%;
18
+ border: none !important;
19
+ }
20
+
21
+ #storybook-root {
22
+ height: 100%;
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+ }
27
+
28
+ /*Custom classes*/
29
+ .story-wrapper {
30
+ font-family: "Arial", sans-serif;
31
+ box-sizing: border-box;
32
+ width: 100%;
33
+ height: 100%;
34
+ padding: 50px 30px;
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ background: var(--bg-primary-color);
39
+ }
40
+
41
+ .grid-wrapper {
42
+ display: grid;
43
+ gap: 25px;
44
+ justify-content: center;
45
+ align-items: center;
46
+ }
47
+
48
+ .item-card {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 15px;
52
+ justify-content: center;
53
+ align-items: center;
54
+ }
55
+
56
+ .item-card__title {
57
+ color: var(--text-primary-color);
58
+ }
@@ -0,0 +1,9 @@
1
+ import {beforeAll} from "vitest";
2
+ import {setProjectAnnotations} from "@storybook/react";
3
+ import * as projectAnnotations from "./preview";
4
+
5
+ // This is an important step to apply the right configuration when testing your stories.
6
+ // More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7
+ const project = setProjectAnnotations([projectAnnotations]);
8
+
9
+ beforeAll(project.beforeAll);