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.
- package/README.md +1197 -0
- package/package.json +113 -0
- package/src/components/Avatar/Avatar.tsx +56 -0
- package/src/components/Avatar/avatar.module.scss +78 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Avatar/types.ts +11 -0
- package/src/components/BaseButton/BaseButton.tsx +36 -0
- package/src/components/BaseButton/base-button.module.scss +24 -0
- package/src/components/BaseButton/index.ts +1 -0
- package/src/components/Button/Button.tsx +51 -0
- package/src/components/Button/button.module.scss +140 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Button/types.ts +24 -0
- package/src/components/Checkbox/Checkbox.tsx +58 -0
- package/src/components/Checkbox/checkbox.module.scss +82 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Checkbox/types.ts +15 -0
- package/src/components/Dialog/Dialog.tsx +126 -0
- package/src/components/Dialog/dialog.module.scss +55 -0
- package/src/components/Dialog/index.ts +1 -0
- package/src/components/Drawer/Drawer.tsx +53 -0
- package/src/components/Drawer/drawer.module.scss +170 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Drawer/types.ts +6 -0
- package/src/components/Footer/Footer.tsx +59 -0
- package/src/components/Footer/footer.module.scss +45 -0
- package/src/components/Footer/index.ts +1 -0
- package/src/components/Header/Header.tsx +74 -0
- package/src/components/Header/header.module.scss +56 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Highlight/Highlight.tsx +36 -0
- package/src/components/Highlight/highlight.module.scss +48 -0
- package/src/components/Highlight/index.ts +2 -0
- package/src/components/Highlight/types.ts +5 -0
- package/src/components/Icon/Icon.tsx +46 -0
- package/src/components/Icon/icon.module.scss +17 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +50 -0
- package/src/components/IconButton/icon-button.module.scss +86 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/IconButton/types.ts +17 -0
- package/src/components/Layout/Provider.tsx +60 -0
- package/src/components/Layout/context.ts +24 -0
- package/src/components/Layout/index.ts +2 -0
- package/src/components/Layout/layout.module.scss +17 -0
- package/src/components/List/List.tsx +24 -0
- package/src/components/List/index.ts +1 -0
- package/src/components/List/list.module.scss +8 -0
- package/src/components/ListItem/ListItem.tsx +75 -0
- package/src/components/ListItem/index.ts +1 -0
- package/src/components/ListItem/list-item.module.scss +37 -0
- package/src/components/Modal/Modal.tsx +90 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Modal/modal.module.scss +97 -0
- package/src/components/Modal/types.ts +6 -0
- package/src/components/Odometer/Odometer.tsx +45 -0
- package/src/components/Odometer/hooks/useOdometer.tsx +24 -0
- package/src/components/Odometer/index.ts +2 -0
- package/src/components/Odometer/odometer.module.scss +81 -0
- package/src/components/Odometer/odometr.d.ts +9 -0
- package/src/components/ScrollArea/ScrollArea.tsx +75 -0
- package/src/components/ScrollArea/index.ts +1 -0
- package/src/components/ScrollArea/scroll-area.module.scss +58 -0
- package/src/components/SvgSprite/SvgSprite.tsx +21 -0
- package/src/components/SvgSprite/index.ts +1 -0
- package/src/components/Switch/Switch.tsx +24 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/switch.module.scss +65 -0
- package/src/components/Tag/Tag.tsx +50 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/Tag/tag.module.scss +118 -0
- package/src/components/Tag/types.ts +23 -0
- package/src/components/TextArea/TextArea.tsx +126 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextArea/text-area.module.scss +88 -0
- package/src/components/TextArea/types.ts +18 -0
- package/src/components/TextField/TextField.tsx +139 -0
- package/src/components/TextField/index.ts +2 -0
- package/src/components/TextField/text-field.module.scss +129 -0
- package/src/components/TextField/types.ts +24 -0
- package/src/components/Toast/Toast.tsx +124 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Toast/toast.module.scss +267 -0
- package/src/components/Toast/types.ts +20 -0
- package/src/components/Tooltip/Tooltip.tsx +82 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/tooltip.module.scss +123 -0
- package/src/components/View/View.tsx +68 -0
- package/src/components/View/index.ts +1 -0
- package/src/components/View/view.module.scss +38 -0
- package/src/components/ViewDrawer/ViewDrawer.tsx +24 -0
- package/src/components/ViewDrawer/index.ts +1 -0
- package/src/components/ViewModal/ViewModal.tsx +24 -0
- package/src/components/ViewModal/index.ts +1 -0
- package/src/components/index.ts +27 -0
- package/src/components/types.ts +65 -0
- package/src/config/default.ts +3 -0
- package/src/config/index.ts +8 -0
- package/src/declaration.d.ts +8 -0
- package/src/index.ts +3 -0
- package/src/plugin/builder/ConfigBuilder.ts +32 -0
- package/src/plugin/builder/StyleBuilder.ts +35 -0
- package/src/plugin/builder/virtual.config.ts +5 -0
- package/src/plugin/finder/ConfigFinder.ts +26 -0
- package/src/plugin/finder/Finder.ts +76 -0
- package/src/plugin/finder/StyleFinder.ts +23 -0
- package/src/plugin/index.ts +73 -0
- package/src/plugin/types.ts +8 -0
- package/src/providers/extra/ExtraProvider.tsx +13 -0
- package/src/providers/extra/context.ts +14 -0
- package/src/providers/extra/index.ts +2 -0
- package/src/providers/icons/IconsProvider.tsx +35 -0
- package/src/providers/icons/context.ts +20 -0
- package/src/providers/icons/index.ts +2 -0
- package/src/providers/index.ts +4 -0
- package/src/providers/theme/ThemeProvider.tsx +60 -0
- package/src/providers/theme/ThemeStorage.tsx +36 -0
- package/src/providers/theme/context.ts +30 -0
- package/src/providers/theme/index.ts +3 -0
- package/src/providers/ui/UIProvider.tsx +41 -0
- package/src/providers/ui/index.ts +1 -0
- package/src/providers/ui/styles/default.scss +95 -0
- package/src/providers/ui/styles/reset.scss +127 -0
- package/src/styles/mixins.scss +23 -0
- package/src/types/config.ts +15 -0
- package/src/types/theme.ts +11 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/react.ts +21 -0
- package/src/utils/utils.ts +12 -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,20 @@
|
|
|
1
|
+
export enum ToastSide {
|
|
2
|
+
TopCenter = "top-center",
|
|
3
|
+
TopLeft = "top-left",
|
|
4
|
+
TopRight = "top-right",
|
|
5
|
+
BottomRight = "bottom-right",
|
|
6
|
+
BottomLeft = "bottom-left",
|
|
7
|
+
BottomCenter = "bottom-center",
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum ToastRadius {
|
|
11
|
+
None = "none",
|
|
12
|
+
Small = "small",
|
|
13
|
+
Medium = "medium",
|
|
14
|
+
Large = "large",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum ToastColor {
|
|
18
|
+
Error = "error",
|
|
19
|
+
Success = "success",
|
|
20
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, {memo, ReactNode, forwardRef, ForwardRefRenderFunction} 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: ForwardRefRenderFunction<HTMLDivElement, TooltipProps> = (props, ref) => {
|
|
28
|
+
const {
|
|
29
|
+
open,
|
|
30
|
+
defaultOpen,
|
|
31
|
+
disableHoverableContent,
|
|
32
|
+
delayDuration,
|
|
33
|
+
onOpenChange,
|
|
34
|
+
|
|
35
|
+
arrowWidth,
|
|
36
|
+
arrowHeight,
|
|
37
|
+
collisionPadding = 8,
|
|
38
|
+
matchTriggerWidth,
|
|
39
|
+
content,
|
|
40
|
+
arrowClassName,
|
|
41
|
+
contentClassName,
|
|
42
|
+
children,
|
|
43
|
+
...other
|
|
44
|
+
} = {...useComponentProps("tooltip"), ...props};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Provider>
|
|
48
|
+
<Root
|
|
49
|
+
open={open}
|
|
50
|
+
defaultOpen={defaultOpen}
|
|
51
|
+
disableHoverableContent={disableHoverableContent}
|
|
52
|
+
onOpenChange={onOpenChange}
|
|
53
|
+
delayDuration={delayDuration}
|
|
54
|
+
>
|
|
55
|
+
<Trigger asChild>{children}</Trigger>
|
|
56
|
+
<Portal>
|
|
57
|
+
<Content
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={classnames(
|
|
60
|
+
styles["tooltip-content"],
|
|
61
|
+
{
|
|
62
|
+
[styles["tooltip-content--trigger-width"]]: matchTriggerWidth,
|
|
63
|
+
},
|
|
64
|
+
contentClassName
|
|
65
|
+
)}
|
|
66
|
+
collisionPadding={collisionPadding}
|
|
67
|
+
{...other}
|
|
68
|
+
>
|
|
69
|
+
{content}
|
|
70
|
+
<Arrow
|
|
71
|
+
width={arrowWidth}
|
|
72
|
+
height={arrowHeight}
|
|
73
|
+
className={classnames(styles["tooltip-arrow"], arrowClassName)}
|
|
74
|
+
/>
|
|
75
|
+
</Content>
|
|
76
|
+
</Portal>
|
|
77
|
+
</Root>
|
|
78
|
+
</Provider>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default memo(forwardRef(Tooltip));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as Tooltip, type TooltipProps} from "./Tooltip";
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
line-height: var(--tooltip-line-height, var(--line-height, 1rem));
|
|
10
|
+
color: var(--tooltip-color, var(--text-secondary-color));
|
|
11
|
+
background-color: var(--tooltip-bg-color, var(--bg-secondary-color));
|
|
12
|
+
border-radius: var(--tooltip-border-radius, 5px);
|
|
13
|
+
border-width: var(--tooltip-border-width, 1px);
|
|
14
|
+
border-color: var(--tooltip-border-color, var(--tooltip-bg-color, var(--bg-secondary-color)));
|
|
15
|
+
border-style: solid;
|
|
16
|
+
padding: var(--tooltip-padding, 7px 10px);
|
|
17
|
+
max-width: var(--tooltip-max-width, 300px);
|
|
18
|
+
word-wrap: break-word;
|
|
19
|
+
user-select: none;
|
|
20
|
+
animation-duration: var(--transition-speed-md);
|
|
21
|
+
will-change: transform, opacity;
|
|
22
|
+
box-shadow: var(--tooltip-box-shadow-offset, 0 0 5px 0) var(--tooltip-box-shadow-color, rgba(210, 208, 208, 0.47));
|
|
23
|
+
|
|
24
|
+
&--trigger-width {
|
|
25
|
+
width: var(--radix-tooltip-trigger-width);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&[data-state="delayed-open"][data-side="top"] {
|
|
29
|
+
animation-name: slideDownAndFade;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&[data-state="delayed-open"][data-side="right"] {
|
|
33
|
+
animation-name: slideLeftAndFade;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&[data-state="delayed-open"][data-side="bottom"] {
|
|
37
|
+
animation-name: slideUpAndFade;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[data-state="delayed-open"][data-side="left"] {
|
|
41
|
+
animation-name: slideRightAndFade;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:before {
|
|
45
|
+
content: "";
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 100000;
|
|
49
|
+
inset: 0;
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: 100%;
|
|
52
|
+
border: calc(var(--tooltip-border-width, 1px) + 2px) solid var(--tooltip-bg-color, var(--bg-secondary-color));
|
|
53
|
+
border-radius: calc(var(--tooltip-border-radius, 5px) - var(--tooltip-border-width, 1px));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
& > span {
|
|
57
|
+
&:before {
|
|
58
|
+
content: "";
|
|
59
|
+
position: absolute;
|
|
60
|
+
border-radius: 100%;
|
|
61
|
+
width: 1px;
|
|
62
|
+
height: 1px;
|
|
63
|
+
top: 50%;
|
|
64
|
+
left: 50%;
|
|
65
|
+
transform: translate(-50%, -50%);
|
|
66
|
+
box-shadow: var(--tooltip-arrow-box-shadow-offset, 0 1px 4px 2px)
|
|
67
|
+
var(--tooltip-box-shadow-color, rgba(210, 208, 208, 0.47));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&-arrow {
|
|
73
|
+
position: relative;
|
|
74
|
+
fill: var(--tooltip-bg-color, var(--bg-secondary-color));
|
|
75
|
+
stroke: var(--tooltip-border-color, var(--tooltip-bg-color, var(--bg-secondary-color)));
|
|
76
|
+
stroke-width: var(--tooltip-border-width, 1px);
|
|
77
|
+
margin-top: calc(var(--tooltip-border-width, 1px) * -1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@keyframes slideUpAndFade {
|
|
82
|
+
from {
|
|
83
|
+
opacity: 0;
|
|
84
|
+
transform: translateY(var(--tooltip-slide-distance, 2px));
|
|
85
|
+
}
|
|
86
|
+
to {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
transform: translateY(0);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@keyframes slideRightAndFade {
|
|
93
|
+
from {
|
|
94
|
+
opacity: 0;
|
|
95
|
+
transform: translateX(calc(0px - var(--tooltip-slide-distance, 2px)));
|
|
96
|
+
}
|
|
97
|
+
to {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
transform: translateX(0);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes slideDownAndFade {
|
|
104
|
+
from {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
transform: translateY(calc(0px - var(--tooltip-slide-distance, 2px)));
|
|
107
|
+
}
|
|
108
|
+
to {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
transform: translateY(0);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@keyframes slideLeftAndFade {
|
|
115
|
+
from {
|
|
116
|
+
opacity: 0;
|
|
117
|
+
transform: translateX(var(--tooltip-slide-distance, 2px));
|
|
118
|
+
}
|
|
119
|
+
to {
|
|
120
|
+
opacity: 1;
|
|
121
|
+
transform: translateX(0);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -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 @@
|
|
|
1
|
+
export {default as View, viewPropsKeys, 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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, {FC, memo} from "react";
|
|
2
|
+
|
|
3
|
+
import {splitProps} from "../../utils";
|
|
4
|
+
import {useComponentProps} from "../../providers";
|
|
5
|
+
|
|
6
|
+
import {Drawer, DrawerProps, drawerPropsKeys} from "../Drawer";
|
|
7
|
+
import {View, ViewProps, viewPropsKeys} from "../View";
|
|
8
|
+
|
|
9
|
+
export type ViewDrawerProps = Omit<DrawerProps, "title"> & ViewProps;
|
|
10
|
+
|
|
11
|
+
const ViewDrawer: FC<ViewDrawerProps> = props => {
|
|
12
|
+
const mergedProps = {...useComponentProps("viewDrawer"), ...props};
|
|
13
|
+
|
|
14
|
+
const drawerProps = splitProps<DrawerProps>(mergedProps, drawerPropsKeys);
|
|
15
|
+
const viewProps = splitProps<ViewProps>(mergedProps, viewPropsKeys);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Drawer {...drawerProps}>
|
|
19
|
+
<View {...viewProps} />
|
|
20
|
+
</Drawer>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default memo(ViewDrawer);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as ViewDrawer, type ViewDrawerProps} from "./ViewDrawer";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, {FC, memo} from "react";
|
|
2
|
+
|
|
3
|
+
import {splitProps} from "../../utils";
|
|
4
|
+
import {useComponentProps} from "../../providers";
|
|
5
|
+
|
|
6
|
+
import {Modal, ModalProps, modalPropsKeys} from "../Modal";
|
|
7
|
+
import {View, ViewProps, viewPropsKeys} from "../View";
|
|
8
|
+
|
|
9
|
+
export type ViewModalProps = Omit<ModalProps, "title"> & ViewProps;
|
|
10
|
+
|
|
11
|
+
const ViewModal: FC<ViewModalProps> = props => {
|
|
12
|
+
const mergedProps = {...useComponentProps("viewModal"), ...props};
|
|
13
|
+
|
|
14
|
+
const modalProps = splitProps<ModalProps>(mergedProps, modalPropsKeys);
|
|
15
|
+
const viewProps = splitProps<ViewProps>(mergedProps, viewPropsKeys);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Modal {...modalProps}>
|
|
19
|
+
<View {...viewProps} />
|
|
20
|
+
</Modal>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default memo(ViewModal);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as ViewModal, type ViewModalProps} from "./ViewModal";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from "./Avatar";
|
|
2
|
+
export * from "./BaseButton";
|
|
3
|
+
export * from "./Button";
|
|
4
|
+
export * from "./Checkbox";
|
|
5
|
+
export * from "./Dialog";
|
|
6
|
+
export * from "./Drawer";
|
|
7
|
+
export * from "./Footer";
|
|
8
|
+
export * from "./Header";
|
|
9
|
+
export * from "./Highlight";
|
|
10
|
+
export * from "./Icon";
|
|
11
|
+
export * from "./IconButton";
|
|
12
|
+
export * from "./Layout";
|
|
13
|
+
export * from "./List";
|
|
14
|
+
export * from "./ListItem";
|
|
15
|
+
export * from "./Modal";
|
|
16
|
+
export * from "./Odometer";
|
|
17
|
+
export * from "./ScrollArea";
|
|
18
|
+
export * from "./SvgSprite";
|
|
19
|
+
export * from "./Switch";
|
|
20
|
+
export * from "./Tag";
|
|
21
|
+
export * from "./TextArea";
|
|
22
|
+
export * from "./TextField";
|
|
23
|
+
export * from "./Toast";
|
|
24
|
+
export * from "./Tooltip";
|
|
25
|
+
export * from "./View";
|
|
26
|
+
export * from "./ViewDrawer";
|
|
27
|
+
export * from "./ViewModal";
|