adnbn-ui 0.0.1 → 0.0.2

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 (145) 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/eslint.config.js +39 -0
  9. package/package.json +77 -2
  10. package/src/components/Avatar/Avatar.stories.tsx +118 -0
  11. package/src/components/Avatar/Avatar.tsx +65 -0
  12. package/src/components/Avatar/avatar.module.scss +77 -0
  13. package/src/components/Avatar/index.ts +2 -0
  14. package/src/components/BaseButton/BaseButton.tsx +36 -0
  15. package/src/components/BaseButton/base-button.module.scss +24 -0
  16. package/src/components/BaseButton/index.ts +2 -0
  17. package/src/components/Button/Button.stories.tsx +148 -0
  18. package/src/components/Button/Button.tsx +73 -0
  19. package/src/components/Button/button.module.scss +140 -0
  20. package/src/components/Button/index.ts +2 -0
  21. package/src/components/Checkbox/Checkbox.stories.tsx +180 -0
  22. package/src/components/Checkbox/Checkbox.tsx +71 -0
  23. package/src/components/Checkbox/checkbox.module.scss +82 -0
  24. package/src/components/Checkbox/index.ts +2 -0
  25. package/src/components/Dialog/Dialog.tsx +125 -0
  26. package/src/components/Dialog/dialog.module.scss +55 -0
  27. package/src/components/Dialog/index.ts +2 -0
  28. package/src/components/Drawer/Drawer.stories.tsx +89 -0
  29. package/src/components/Drawer/Drawer.tsx +57 -0
  30. package/src/components/Drawer/drawer.module.scss +170 -0
  31. package/src/components/Drawer/index.ts +2 -0
  32. package/src/components/Footer/Footer.stories.tsx +118 -0
  33. package/src/components/Footer/Footer.tsx +58 -0
  34. package/src/components/Footer/footer.module.scss +44 -0
  35. package/src/components/Footer/index.ts +2 -0
  36. package/src/components/Header/Header.stories.tsx +49 -0
  37. package/src/components/Header/Header.tsx +73 -0
  38. package/src/components/Header/header.module.scss +56 -0
  39. package/src/components/Header/index.ts +2 -0
  40. package/src/components/Highlight/Highlight.stories.tsx +83 -0
  41. package/src/components/Highlight/Highlight.tsx +40 -0
  42. package/src/components/Highlight/highlight.module.scss +47 -0
  43. package/src/components/Highlight/index.ts +2 -0
  44. package/src/components/Icon/Icon.tsx +46 -0
  45. package/src/components/Icon/icon.module.scss +17 -0
  46. package/src/components/Icon/index.ts +2 -0
  47. package/src/components/IconButton/IconButton.stories.tsx +179 -0
  48. package/src/components/IconButton/IconButton.tsx +65 -0
  49. package/src/components/IconButton/icon-button.module.scss +86 -0
  50. package/src/components/IconButton/index.ts +2 -0
  51. package/src/components/Layout/Layout.stories.tsx +88 -0
  52. package/src/components/Layout/Provider.tsx +47 -0
  53. package/src/components/Layout/context.ts +24 -0
  54. package/src/components/Layout/index.ts +2 -0
  55. package/src/components/Layout/layout.module.scss +17 -0
  56. package/src/components/List/List.stories.tsx +81 -0
  57. package/src/components/List/List.tsx +24 -0
  58. package/src/components/List/index.ts +2 -0
  59. package/src/components/List/list.module.scss +8 -0
  60. package/src/components/ListItem/ListItem.tsx +75 -0
  61. package/src/components/ListItem/index.ts +2 -0
  62. package/src/components/ListItem/list-item.module.scss +36 -0
  63. package/src/components/Modal/Modal.stories.tsx +95 -0
  64. package/src/components/Modal/Modal.tsx +94 -0
  65. package/src/components/Modal/index.ts +2 -0
  66. package/src/components/Modal/modal.module.scss +97 -0
  67. package/src/components/Odometer/Odometer.stories.tsx +66 -0
  68. package/src/components/Odometer/Odometer.tsx +45 -0
  69. package/src/components/Odometer/hooks/useOdometer.tsx +24 -0
  70. package/src/components/Odometer/index.ts +3 -0
  71. package/src/components/Odometer/odometer.module.scss +81 -0
  72. package/src/components/Odometer/odometr.d.ts +9 -0
  73. package/src/components/ScrollArea/ScrollArea.stories.tsx +58 -0
  74. package/src/components/ScrollArea/ScrollArea.tsx +63 -0
  75. package/src/components/ScrollArea/index.ts +2 -0
  76. package/src/components/ScrollArea/scroll-area.module.scss +54 -0
  77. package/src/components/SvgSprite/SvgSprite.tsx +21 -0
  78. package/src/components/SvgSprite/index.ts +2 -0
  79. package/src/components/Switch/Switch.stories.tsx +25 -0
  80. package/src/components/Switch/Switch.tsx +23 -0
  81. package/src/components/Switch/index.ts +2 -0
  82. package/src/components/Switch/switch.module.scss +65 -0
  83. package/src/components/Tag/Tag.stories.tsx +157 -0
  84. package/src/components/Tag/Tag.tsx +71 -0
  85. package/src/components/Tag/index.ts +2 -0
  86. package/src/components/Tag/tag.module.scss +118 -0
  87. package/src/components/TextArea/TextArea.stories.tsx +145 -0
  88. package/src/components/TextArea/TextArea.tsx +143 -0
  89. package/src/components/TextArea/index.ts +2 -0
  90. package/src/components/TextArea/text-area.module.scss +88 -0
  91. package/src/components/TextField/TextField.stories.tsx +177 -0
  92. package/src/components/TextField/TextField.tsx +162 -0
  93. package/src/components/TextField/index.ts +2 -0
  94. package/src/components/TextField/text-field.module.scss +129 -0
  95. package/src/components/Toast/Toast.stories.tsx +209 -0
  96. package/src/components/Toast/Toast.tsx +142 -0
  97. package/src/components/Toast/index.ts +2 -0
  98. package/src/components/Toast/toast.module.scss +267 -0
  99. package/src/components/Tooltip/Tooltip.stories.tsx +80 -0
  100. package/src/components/Tooltip/Tooltip.tsx +79 -0
  101. package/src/components/Tooltip/index.ts +2 -0
  102. package/src/components/Tooltip/tooltip.module.scss +93 -0
  103. package/src/components/View/View.stories.tsx +47 -0
  104. package/src/components/View/View.tsx +68 -0
  105. package/src/components/View/index.ts +2 -0
  106. package/src/components/View/view.module.scss +38 -0
  107. package/src/components/ViewDrawer/ViewDrawer.stories.tsx +75 -0
  108. package/src/components/ViewDrawer/ViewDrawer.tsx +24 -0
  109. package/src/components/ViewDrawer/index.ts +2 -0
  110. package/src/components/ViewModal/ViewModal.stories.tsx +68 -0
  111. package/src/components/ViewModal/ViewModal.tsx +24 -0
  112. package/src/components/ViewModal/index.ts +2 -0
  113. package/src/components/index.ts +29 -0
  114. package/src/components/types.ts +65 -0
  115. package/src/config/default.ts +3 -0
  116. package/src/config/index.ts +26 -0
  117. package/src/declaration.d.ts +8 -0
  118. package/src/index.ts +3 -0
  119. package/src/plugin/builder/ConfigBuilder.ts +32 -0
  120. package/src/plugin/builder/StyleBuilder.ts +34 -0
  121. package/src/plugin/builder/virtual.config.ts +7 -0
  122. package/src/plugin/finder/ConfigFinder.ts +26 -0
  123. package/src/plugin/finder/Finder.ts +76 -0
  124. package/src/plugin/finder/StyleFinder.ts +23 -0
  125. package/src/plugin/index.ts +70 -0
  126. package/src/plugin/types.ts +8 -0
  127. package/src/providers/UIProvider.tsx +26 -0
  128. package/src/providers/icons/IconsProvider.tsx +34 -0
  129. package/src/providers/icons/context.ts +22 -0
  130. package/src/providers/icons/index.ts +3 -0
  131. package/src/providers/index.ts +3 -0
  132. package/src/providers/theme/ThemeProvider.tsx +39 -0
  133. package/src/providers/theme/context.ts +30 -0
  134. package/src/providers/theme/index.ts +2 -0
  135. package/src/providers/theme/styles/default.scss +95 -0
  136. package/src/providers/theme/styles/reset.css +111 -0
  137. package/src/styles/mixins.scss +23 -0
  138. package/src/types/theme.ts +4 -0
  139. package/src/utils/index.ts +2 -0
  140. package/src/utils/react.ts +21 -0
  141. package/src/utils/utils.ts +12 -0
  142. package/tsconfig.json +18 -0
  143. package/vite.config.ts +11 -0
  144. package/vitest.workspace.ts +19 -0
  145. package/components/Button/index.ts +0 -0
@@ -0,0 +1,267 @@
1
+ @use "../../styles/mixins" as dir;
2
+
3
+ $root: toast;
4
+
5
+ .#{$root} {
6
+ box-sizing: border-box;
7
+ position: relative;
8
+ display: grid;
9
+ align-items: center;
10
+ grid-template-areas: "title action" "description action";
11
+ grid-template-columns: auto max-content;
12
+ column-gap: var(--toast-gap, 15px);
13
+ background-color: var(--toast-bg-color, var(--bg-secondary-color));
14
+ border-radius: var(--toast-border-radius, 10px);
15
+ padding: var(--toast-padding, var(--side-padding-xs));
16
+
17
+ &[data-state="open"] {
18
+ &.#{$root}--top-left,
19
+ &.#{$root}--bottom-left {
20
+ animation: slideInLeft var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
21
+ }
22
+
23
+ &.#{$root}--top-right,
24
+ &.#{$root}--bottom-right {
25
+ animation: slideInRight var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
26
+ }
27
+
28
+ &.#{$root}--top-center {
29
+ animation: slideInTop var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
30
+ }
31
+
32
+ &.#{$root}--bottom-center {
33
+ animation: slideInBottom var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
34
+ }
35
+ }
36
+
37
+ &[data-state="closed"] {
38
+ animation: hide var(--toast-transition-speed, var(--transition-speed-md)) ease-in;
39
+ }
40
+
41
+ &[data-swipe="move"] {
42
+ transform: translateX(var(--radix-toast-swipe-move-x)) translateY(var(--radix-toast-swipe-move-y));
43
+ }
44
+
45
+ &[data-swipe="cancel"] {
46
+ transform: translateX(0) translateY(0);
47
+ transition: transform var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
48
+ }
49
+
50
+ &[data-swipe="end"] {
51
+ &.#{$root}--top-left,
52
+ &.#{$root}--bottom-left {
53
+ animation: swipeOutLeft var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
54
+ }
55
+ &.#{$root}--top-right,
56
+ &.#{$root}--bottom-right {
57
+ animation: swipeOutRight var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
58
+ }
59
+
60
+ &.#{$root}--top-center {
61
+ animation: swipeOutTop var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
62
+ }
63
+ &.#{$root}--bottom-center {
64
+ animation: swipeOutBottom var(--toast-transition-speed, var(--transition-speed-md)) ease-out;
65
+ }
66
+ }
67
+
68
+ &--none-radius {
69
+ border-radius: 0;
70
+ }
71
+ &--small-radius {
72
+ border-radius: var(--toast-border-radius, 6px);
73
+ }
74
+ &--medium-radius {
75
+ border-radius: var(--toast-border-radius, 15px);
76
+ }
77
+ &--large-radius {
78
+ border-radius: var(--toast-border-radius, 20px);
79
+ }
80
+
81
+ &--error-color {
82
+ background-color: var(--toast-error-bg-color, var(--error-color));
83
+ }
84
+
85
+ &--success-color {
86
+ background-color: var(--toast-success-bg-color, var(--success-color));
87
+ }
88
+
89
+ &__title,
90
+ &__description {
91
+ .#{$root}--error-color & {
92
+ color: var(--toast-error-text-color, white);
93
+ }
94
+ .#{$root}--success-color & {
95
+ color: var(--toast-success-text-color, white);
96
+ }
97
+ }
98
+
99
+ &__title {
100
+ grid-area: title;
101
+ margin-bottom: 5px;
102
+ font-weight: 500;
103
+ color: var(--text-primary-color);
104
+ font-size: 15px;
105
+ }
106
+
107
+ &__description {
108
+ grid-area: description;
109
+ margin: 0;
110
+ color: var(--text-secondary-color);
111
+ font-size: 13px;
112
+ line-height: 1.3;
113
+ }
114
+
115
+ &__action {
116
+ grid-area: action;
117
+ }
118
+
119
+ &__close {
120
+ position: absolute !important;
121
+ top: var(--toast-close-offset, 5px);
122
+
123
+ @include dir.ltr {
124
+ right: var(--toast-close-offset, 5px);
125
+ }
126
+
127
+ @include dir.rtl {
128
+ left: var(--toast-close-offset, 5px);
129
+ }
130
+ }
131
+
132
+ &__viewport {
133
+ box-sizing: border-box;
134
+ position: fixed;
135
+ display: flex;
136
+ flex-direction: column;
137
+ gap: var(--toast-viewport-gap, 10px);
138
+ width: var(--toast-width, 300px);
139
+ padding: var(--toast-viewport-padding, var(--side-padding-xs));
140
+ max-width: 100vw;
141
+ margin: 0;
142
+ list-style: none;
143
+ z-index: 999999;
144
+ outline: none;
145
+
146
+ &:has(.#{$root}--full-width) {
147
+ width: 100%;
148
+ }
149
+
150
+ &:has(.#{$root}--sticky) {
151
+ padding: 0;
152
+ }
153
+
154
+ &:has(.#{$root}--top-center) {
155
+ top: 0;
156
+ left: 50%;
157
+ transform: translateX(-50%);
158
+ }
159
+
160
+ &:has(.#{$root}--top-left) {
161
+ top: 0;
162
+ left: 0;
163
+ }
164
+
165
+ &:has(.#{$root}--top-right) {
166
+ top: 0;
167
+ right: 0;
168
+ }
169
+
170
+ &:has(.#{$root}--bottom-right) {
171
+ bottom: 0;
172
+ right: 0;
173
+ }
174
+
175
+ &:has(.#{$root}--bottom-left) {
176
+ bottom: 0;
177
+ left: 0;
178
+ }
179
+
180
+ &:has(.#{$root}--bottom-center) {
181
+ bottom: 0;
182
+ left: 50%;
183
+ transform: translateX(-50%);
184
+ }
185
+ }
186
+ }
187
+
188
+ @keyframes hide {
189
+ from {
190
+ opacity: 1;
191
+ }
192
+ to {
193
+ opacity: 0;
194
+ }
195
+ }
196
+
197
+ @keyframes slideInRight {
198
+ from {
199
+ transform: translateX(100%);
200
+ }
201
+ to {
202
+ transform: translateX(0);
203
+ }
204
+ }
205
+
206
+ @keyframes slideInLeft {
207
+ from {
208
+ transform: translateX(-100%);
209
+ }
210
+ to {
211
+ transform: translateX(0);
212
+ }
213
+ }
214
+
215
+ @keyframes slideInTop {
216
+ from {
217
+ transform: translateY(-100%);
218
+ }
219
+ to {
220
+ transform: translateX(0);
221
+ }
222
+ }
223
+
224
+ @keyframes slideInBottom {
225
+ from {
226
+ transform: translateY(100%);
227
+ }
228
+ to {
229
+ transform: translateX(0);
230
+ }
231
+ }
232
+
233
+ @keyframes swipeOutRight {
234
+ from {
235
+ transform: translateX(var(--radix-toast-swipe-end-x));
236
+ }
237
+ to {
238
+ transform: translateX(100%);
239
+ }
240
+ }
241
+
242
+ @keyframes swipeOutLeft {
243
+ from {
244
+ transform: translateX(var(--radix-toast-swipe-end-x));
245
+ }
246
+ to {
247
+ transform: translateX(-100%);
248
+ }
249
+ }
250
+
251
+ @keyframes swipeOutTop {
252
+ from {
253
+ transform: translateY(var(--radix-toast-swipe-end-y));
254
+ }
255
+ to {
256
+ transform: translateY(-100%);
257
+ }
258
+ }
259
+
260
+ @keyframes swipeOutBottom {
261
+ from {
262
+ transform: translateY(var(--radix-toast-swipe-end-y));
263
+ }
264
+ to {
265
+ transform: translateY(100%);
266
+ }
267
+ }
@@ -0,0 +1,80 @@
1
+ import {Meta, StoryObj} from "@storybook/react";
2
+
3
+ import {hideInTable} from "../../utils";
4
+
5
+ import {Button} from "../index";
6
+
7
+ import TooltipComponent from "./Tooltip";
8
+
9
+ const meta: Meta<typeof TooltipComponent> = {
10
+ title: "Components/Tooltip",
11
+ component: TooltipComponent,
12
+ tags: ["autodocs"],
13
+ argTypes: {
14
+ open: {
15
+ options: [true, false, undefined],
16
+ control: "select",
17
+ type: "boolean",
18
+ description: "The controlled open state of the tooltip. Must be used in conjunction with onOpenChange.",
19
+ },
20
+ side: {
21
+ options: ["top", "right", "bottom", "left"],
22
+ control: "select",
23
+ description:
24
+ "The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.",
25
+ },
26
+ align: {
27
+ options: ["start", "center", "end"],
28
+ control: "select",
29
+ description: "The preferred alignment against the trigger. May change when collisions occur.",
30
+ },
31
+ delayDuration: {
32
+ description:
33
+ "Override the duration given to the `Provider` to customise the open delay for a specific tooltip.",
34
+ },
35
+ arrowWidth: {
36
+ description: "The width of the arrow in pixels.",
37
+ },
38
+ arrowHeight: {
39
+ description: "The height of the arrow in pixels.",
40
+ },
41
+ arrowPadding: {
42
+ description:
43
+ "The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners.",
44
+ },
45
+ alignOffset: {
46
+ description: 'An offset in pixels from the "start" or "end" alignment options.',
47
+ },
48
+ avoidCollisions: {
49
+ description:
50
+ "When true, overrides the side and align preferences to prevent collisions with boundary edges.",
51
+ },
52
+ matchTriggerWidth: {
53
+ description: "Whether to set the content width equal to the trigger width",
54
+ },
55
+
56
+ arrowClassName: hideInTable,
57
+ contentClassName: hideInTable,
58
+ children: hideInTable,
59
+ },
60
+ };
61
+
62
+ export default meta;
63
+
64
+ export const Tooltip: StoryObj<typeof TooltipComponent> = {
65
+ args: {
66
+ content: "Tooltip content",
67
+ open: undefined,
68
+ align: "center",
69
+ alignOffset: 0,
70
+ side: "top",
71
+ sideOffset: 0,
72
+ arrowHeight: 5,
73
+ arrowWidth: 10,
74
+ arrowPadding: 0,
75
+ delayDuration: 700,
76
+ matchTriggerWidth: false,
77
+ avoidCollisions: true,
78
+ children: <Button style={{marginTop: "40px"}}>Button</Button>,
79
+ },
80
+ };
@@ -0,0 +1,79 @@
1
+ import React, {FC, memo, ReactNode} from "react";
2
+ import classnames from "classnames";
3
+ import {
4
+ Arrow,
5
+ Content,
6
+ Portal,
7
+ Provider,
8
+ Root,
9
+ TooltipContentProps,
10
+ TooltipProps as TooltipRootProps,
11
+ Trigger,
12
+ } from "@radix-ui/react-tooltip";
13
+
14
+ import {useComponentProps} from "../../providers";
15
+
16
+ import styles from "./tooltip.module.scss";
17
+
18
+ export interface TooltipProps extends TooltipRootProps, Omit<TooltipContentProps, "content"> {
19
+ content: ReactNode;
20
+ arrowWidth?: number;
21
+ arrowHeight?: number;
22
+ matchTriggerWidth?: boolean;
23
+ arrowClassName?: string;
24
+ contentClassName?: string;
25
+ }
26
+
27
+ const Tooltip: FC<TooltipProps> = props => {
28
+ const {
29
+ open,
30
+ defaultOpen,
31
+ disableHoverableContent,
32
+ delayDuration,
33
+ onOpenChange,
34
+
35
+ arrowWidth,
36
+ arrowHeight,
37
+ matchTriggerWidth,
38
+ content,
39
+ arrowClassName,
40
+ contentClassName,
41
+ children,
42
+ ...other
43
+ } = {...useComponentProps("tooltip"), ...props};
44
+
45
+ return (
46
+ <Provider>
47
+ <Root
48
+ open={open}
49
+ defaultOpen={defaultOpen}
50
+ disableHoverableContent={disableHoverableContent}
51
+ onOpenChange={onOpenChange}
52
+ delayDuration={delayDuration}
53
+ >
54
+ <Trigger asChild>{children}</Trigger>
55
+ <Portal>
56
+ <Content
57
+ className={classnames(
58
+ styles["tooltip-content"],
59
+ {
60
+ [styles["tooltip-content--trigger-width"]]: matchTriggerWidth,
61
+ },
62
+ contentClassName
63
+ )}
64
+ {...other}
65
+ >
66
+ {content}
67
+ <Arrow
68
+ width={arrowWidth}
69
+ height={arrowHeight}
70
+ className={classnames(styles["tooltip-arrow"], arrowClassName)}
71
+ />
72
+ </Content>
73
+ </Portal>
74
+ </Root>
75
+ </Provider>
76
+ );
77
+ };
78
+
79
+ export default memo(Tooltip);
@@ -0,0 +1,2 @@
1
+ export {default as Tooltip} from "./Tooltip";
2
+ export type {TooltipProps} from "./Tooltip";
@@ -0,0 +1,93 @@
1
+ $root: tooltip;
2
+
3
+ .#{$root} {
4
+ &-content {
5
+ box-sizing: border-box;
6
+ font-family: var(--tooltip-font-family, var(--font-family)), sans-serif;
7
+ font-weight: var(--tooltip-font-weight, 500);
8
+ font-size: var(--tooltip-font-size, var(--font-size, 14px));
9
+ color: var(--tooltip-color, var(--text-secondary-color));
10
+ background-color: var(--tooltip-bg-color, var(--bg-secondary-color));
11
+ border-radius: var(--tooltip-border-radius, 5px);
12
+ border-width: var(--tooltip-border-width, 1px);
13
+ border-color: var(--tooltip-border-color, var(--tooltip-bg-color, var(--bg-secondary-color)));
14
+ border-style: solid;
15
+ padding: var(--tooltip-padding, 7px 10px);
16
+ max-width: var(--tooltip-max-width, 300px);
17
+ word-wrap: break-word;
18
+ user-select: none;
19
+ animation-duration: var(--transition-speed-md);
20
+ will-change: transform, opacity;
21
+ box-shadow:
22
+ rgba(0, 6, 13, 0.35) 0 10px 38px -10px,
23
+ rgba(0, 6, 13, 0.2) 0px 10px 20px -15px;
24
+
25
+ &--trigger-width {
26
+ width: var(--radix-tooltip-trigger-width);
27
+ }
28
+
29
+ &[data-state="delayed-open"][data-side="top"] {
30
+ animation-name: slideDownAndFade;
31
+ }
32
+
33
+ &[data-state="delayed-open"][data-side="right"] {
34
+ animation-name: slideLeftAndFade;
35
+ }
36
+
37
+ &[data-state="delayed-open"][data-side="bottom"] {
38
+ animation-name: slideUpAndFade;
39
+ }
40
+
41
+ &[data-state="delayed-open"][data-side="left"] {
42
+ animation-name: slideRightAndFade;
43
+ }
44
+ }
45
+
46
+ &-arrow {
47
+ fill: var(--tooltip-bg-color, var(--bg-secondary-color));
48
+ }
49
+ }
50
+
51
+ @keyframes slideUpAndFade {
52
+ from {
53
+ opacity: 0;
54
+ transform: translateY(var(--tooltip-slide-distance, 2px));
55
+ }
56
+ to {
57
+ opacity: 1;
58
+ transform: translateY(0);
59
+ }
60
+ }
61
+
62
+ @keyframes slideRightAndFade {
63
+ from {
64
+ opacity: 0;
65
+ transform: translateX(calc(0px - var(--tooltip-slide-distance, 2px)));
66
+ }
67
+ to {
68
+ opacity: 1;
69
+ transform: translateX(0);
70
+ }
71
+ }
72
+
73
+ @keyframes slideDownAndFade {
74
+ from {
75
+ opacity: 0;
76
+ transform: translateY(calc(0px - var(--tooltip-slide-distance, 2px)));
77
+ }
78
+ to {
79
+ opacity: 1;
80
+ transform: translateY(0);
81
+ }
82
+ }
83
+
84
+ @keyframes slideLeftAndFade {
85
+ from {
86
+ opacity: 0;
87
+ transform: translateX(var(--tooltip-slide-distance, 2px));
88
+ }
89
+ to {
90
+ opacity: 1;
91
+ transform: translateX(0);
92
+ }
93
+ }
@@ -0,0 +1,47 @@
1
+ import {Meta, StoryObj} from "@storybook/react";
2
+
3
+ import {hideInTable} from "../../utils";
4
+
5
+ import ViewComponent from "./View";
6
+
7
+ const meta: Meta<typeof ViewComponent> = {
8
+ title: "Components/View",
9
+ component: ViewComponent,
10
+ tags: ["autodocs"],
11
+ argTypes: {
12
+ before: hideInTable,
13
+ after: hideInTable,
14
+ className: hideInTable,
15
+ wrapClassName: hideInTable,
16
+ titleClassName: hideInTable,
17
+ bodyClassName: hideInTable,
18
+ headerClassName: hideInTable,
19
+ beforeClassName: hideInTable,
20
+ afterClassName: hideInTable,
21
+ subtitleClassName: hideInTable,
22
+ childrenClassName: hideInTable,
23
+ },
24
+ decorators: [
25
+ Story => (
26
+ <div
27
+ style={{background: "var(--bg-secondary-color", width: "380px", height: "400px", borderRadius: "10px"}}
28
+ >
29
+ <Story />
30
+ </div>
31
+ ),
32
+ ],
33
+ };
34
+
35
+ export default meta;
36
+
37
+ export const View: StoryObj<typeof ViewComponent> = {
38
+ args: {
39
+ title: "Volume Up Plus",
40
+ subtitle: "Adjust the current tab's volume with the slider. Switch to any audio tab in one click.",
41
+ before: "❤️",
42
+ alignCenter: true,
43
+ center: true,
44
+ showSeparate: true,
45
+ children: "children",
46
+ },
47
+ };
@@ -0,0 +1,68 @@
1
+ import React, {FC, memo} from "react";
2
+ import classnames from "classnames";
3
+
4
+ import {useComponentProps} from "../../providers";
5
+ import {Header, HeaderProps} from "../Header";
6
+
7
+ import styles from "./view.module.scss";
8
+
9
+ export interface ViewProps extends HeaderProps {
10
+ center?: boolean;
11
+ showSeparate?: boolean;
12
+ bodyClassName?: string;
13
+ headerClassName?: string;
14
+ }
15
+
16
+ export const viewPropsKeys = new Set<keyof ViewProps>([
17
+ // View keys
18
+ "center",
19
+ "showSeparate",
20
+ "bodyClassName",
21
+ "headerClassName",
22
+ "children",
23
+
24
+ // Header keys
25
+ "title",
26
+ "before",
27
+ "after",
28
+ "subtitle",
29
+ "wrapClassName",
30
+ "titleClassName",
31
+ "beforeClassName",
32
+ "afterClassName",
33
+ "subtitleClassName",
34
+ "alignCenter",
35
+ ]);
36
+
37
+ const View: FC<ViewProps> = props => {
38
+ const {center, showSeparate, className, bodyClassName, headerClassName, children, ...other} = {
39
+ ...useComponentProps("view"),
40
+ ...props,
41
+ };
42
+
43
+ return (
44
+ <div
45
+ className={classnames(
46
+ styles["view"],
47
+ {
48
+ [styles["view--center"]]: center,
49
+ },
50
+ className
51
+ )}
52
+ >
53
+ <Header
54
+ className={classnames(
55
+ styles["view-header"],
56
+ {
57
+ [styles[`view-header--separate`]]: showSeparate,
58
+ },
59
+ headerClassName
60
+ )}
61
+ {...other}
62
+ />
63
+ <div className={classnames(styles["view-body"], bodyClassName)}>{children}</div>
64
+ </div>
65
+ );
66
+ };
67
+
68
+ export default memo(View);
@@ -0,0 +1,2 @@
1
+ export {default as View, viewPropsKeys} from "./View";
2
+ export type {ViewProps} from "./View";
@@ -0,0 +1,38 @@
1
+ $root: view;
2
+
3
+ .#{$root} {
4
+ display: flex;
5
+ flex-direction: column;
6
+ box-sizing: border-box;
7
+ width: 100%;
8
+ height: 100%;
9
+
10
+ &-header {
11
+ padding-bottom: var(--view-header-padding-bottom, var(--header-padding, var(--side-padding-sm)));
12
+ justify-content: flex-end;
13
+
14
+ &__title {
15
+ color: var(--view-header-title-color, var(--text-primary-color));
16
+ font-family: var(--view-header-title-font-family, var(--font-family)), sans-serif;
17
+ }
18
+
19
+ &--separate {
20
+ border-bottom: var(--view-header-separate-width, 1px) solid
21
+ var(--view-header-separate-color, var(--separator-color));
22
+ justify-content: space-between;
23
+ will-change: border;
24
+ transition: border-bottom-color var(--transition-speed-sm);
25
+ }
26
+ }
27
+
28
+ &-body {
29
+ flex-grow: 1;
30
+ display: flex;
31
+ flex-direction: column;
32
+
33
+ .#{$root}--center & {
34
+ align-items: center;
35
+ justify-content: center;
36
+ }
37
+ }
38
+ }