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.
- package/.prettierignore +3 -0
- package/.prettierrc +28 -0
- package/.storybook/main.ts +22 -0
- package/.storybook/preview.tsx +100 -0
- package/.storybook/styles/custom.scss +59 -0
- package/.storybook/styles/preview.css +58 -0
- package/.storybook/vitest.setup.ts +9 -0
- package/README.md +1057 -0
- package/eslint.config.js +39 -0
- package/package.json +95 -4
- package/src/components/Avatar/Avatar.stories.tsx +118 -0
- package/src/components/Avatar/Avatar.tsx +65 -0
- package/src/components/Avatar/avatar.module.scss +77 -0
- package/src/components/Avatar/index.ts +2 -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 +2 -0
- package/src/components/Button/Button.stories.tsx +148 -0
- package/src/components/Button/Button.tsx +73 -0
- package/src/components/Button/button.module.scss +140 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +180 -0
- package/src/components/Checkbox/Checkbox.tsx +71 -0
- package/src/components/Checkbox/checkbox.module.scss +82 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Dialog/Dialog.tsx +125 -0
- package/src/components/Dialog/dialog.module.scss +55 -0
- package/src/components/Dialog/index.ts +2 -0
- package/src/components/Drawer/Drawer.stories.tsx +89 -0
- package/src/components/Drawer/Drawer.tsx +57 -0
- package/src/components/Drawer/drawer.module.scss +170 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Footer/Footer.stories.tsx +118 -0
- package/src/components/Footer/Footer.tsx +58 -0
- package/src/components/Footer/footer.module.scss +44 -0
- package/src/components/Footer/index.ts +2 -0
- package/src/components/Header/Header.stories.tsx +49 -0
- package/src/components/Header/Header.tsx +73 -0
- package/src/components/Header/header.module.scss +56 -0
- package/src/components/Header/index.ts +2 -0
- package/src/components/Highlight/Highlight.stories.tsx +83 -0
- package/src/components/Highlight/Highlight.tsx +40 -0
- package/src/components/Highlight/highlight.module.scss +47 -0
- package/src/components/Highlight/index.ts +2 -0
- package/src/components/Icon/Icon.tsx +46 -0
- package/src/components/Icon/icon.module.scss +17 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/IconButton/IconButton.stories.tsx +179 -0
- package/src/components/IconButton/IconButton.tsx +65 -0
- package/src/components/IconButton/icon-button.module.scss +86 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/Layout/Layout.stories.tsx +88 -0
- package/src/components/Layout/Provider.tsx +47 -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.stories.tsx +81 -0
- package/src/components/List/List.tsx +24 -0
- package/src/components/List/index.ts +2 -0
- package/src/components/List/list.module.scss +8 -0
- package/src/components/ListItem/ListItem.tsx +75 -0
- package/src/components/ListItem/index.ts +2 -0
- package/src/components/ListItem/list-item.module.scss +36 -0
- package/src/components/Modal/Modal.stories.tsx +95 -0
- package/src/components/Modal/Modal.tsx +94 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Modal/modal.module.scss +97 -0
- package/src/components/Odometer/Odometer.stories.tsx +66 -0
- package/src/components/Odometer/Odometer.tsx +45 -0
- package/src/components/Odometer/hooks/useOdometer.tsx +24 -0
- package/src/components/Odometer/index.ts +3 -0
- package/src/components/Odometer/odometer.module.scss +81 -0
- package/src/components/Odometer/odometr.d.ts +9 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +58 -0
- package/src/components/ScrollArea/ScrollArea.tsx +63 -0
- package/src/components/ScrollArea/index.ts +2 -0
- package/src/components/ScrollArea/scroll-area.module.scss +54 -0
- package/src/components/SvgSprite/SvgSprite.tsx +21 -0
- package/src/components/SvgSprite/index.ts +2 -0
- package/src/components/Switch/Switch.stories.tsx +25 -0
- package/src/components/Switch/Switch.tsx +23 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Switch/switch.module.scss +65 -0
- package/src/components/Tag/Tag.stories.tsx +157 -0
- package/src/components/Tag/Tag.tsx +71 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/Tag/tag.module.scss +118 -0
- package/src/components/TextArea/TextArea.stories.tsx +145 -0
- package/src/components/TextArea/TextArea.tsx +143 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextArea/text-area.module.scss +88 -0
- package/src/components/TextField/TextField.stories.tsx +177 -0
- package/src/components/TextField/TextField.tsx +162 -0
- package/src/components/TextField/index.ts +2 -0
- package/src/components/TextField/text-field.module.scss +129 -0
- package/src/components/Toast/Toast.stories.tsx +209 -0
- package/src/components/Toast/Toast.tsx +142 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Toast/toast.module.scss +267 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +80 -0
- package/src/components/Tooltip/Tooltip.tsx +79 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Tooltip/tooltip.module.scss +93 -0
- package/src/components/View/View.stories.tsx +47 -0
- package/src/components/View/View.tsx +68 -0
- package/src/components/View/index.ts +2 -0
- package/src/components/View/view.module.scss +38 -0
- package/src/components/ViewDrawer/ViewDrawer.stories.tsx +75 -0
- package/src/components/ViewDrawer/ViewDrawer.tsx +24 -0
- package/src/components/ViewDrawer/index.ts +2 -0
- package/src/components/ViewModal/ViewModal.stories.tsx +68 -0
- package/src/components/ViewModal/ViewModal.tsx +24 -0
- package/src/components/ViewModal/index.ts +2 -0
- package/src/components/index.ts +29 -0
- package/src/components/types.ts +65 -0
- package/src/config/default.ts +3 -0
- package/src/config/index.ts +26 -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 +34 -0
- package/src/plugin/builder/virtual.config.ts +7 -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 +70 -0
- package/src/plugin/types.ts +8 -0
- package/src/providers/UIProvider.tsx +26 -0
- package/src/providers/icons/IconsProvider.tsx +34 -0
- package/src/providers/icons/context.ts +22 -0
- package/src/providers/icons/index.ts +3 -0
- package/src/providers/index.ts +3 -0
- package/src/providers/theme/ThemeProvider.tsx +39 -0
- package/src/providers/theme/context.ts +30 -0
- package/src/providers/theme/index.ts +2 -0
- package/src/providers/theme/styles/default.scss +95 -0
- package/src/providers/theme/styles/reset.css +111 -0
- package/src/styles/mixins.scss +23 -0
- package/src/types/theme.ts +4 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/react.ts +21 -0
- package/src/utils/utils.ts +12 -0
- package/tsconfig.json +18 -0
- package/vite.config.ts +11 -0
- package/vitest.workspace.ts +19 -0
- package/components/Button/index.ts +0 -0
@@ -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,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,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,75 @@
|
|
1
|
+
import {useState} from "react";
|
2
|
+
import {Meta} from "@storybook/react";
|
3
|
+
|
4
|
+
import {hideInTable} from "../../utils";
|
5
|
+
|
6
|
+
import {Button, DrawerSide} from "../index";
|
7
|
+
|
8
|
+
import ViewDrawerComponent, {ViewDrawerProps} from "./ViewDrawer";
|
9
|
+
|
10
|
+
const sides: DrawerSide[] = [DrawerSide.Left, DrawerSide.Top, DrawerSide.Bottom, DrawerSide.Right];
|
11
|
+
|
12
|
+
const meta: Meta<typeof ViewDrawerComponent> = {
|
13
|
+
title: "Components/ViewDrawer",
|
14
|
+
component: ViewDrawerComponent,
|
15
|
+
tags: ["autodocs"],
|
16
|
+
argTypes: {
|
17
|
+
side: {
|
18
|
+
options: sides,
|
19
|
+
control: {type: "select"},
|
20
|
+
},
|
21
|
+
title: {
|
22
|
+
type: "string",
|
23
|
+
},
|
24
|
+
subtitle: {
|
25
|
+
type: "string",
|
26
|
+
},
|
27
|
+
after: {
|
28
|
+
type: "string",
|
29
|
+
},
|
30
|
+
before: {
|
31
|
+
type: "string",
|
32
|
+
},
|
33
|
+
fullscreen: {
|
34
|
+
type: "boolean",
|
35
|
+
},
|
36
|
+
speed: {
|
37
|
+
type: "number",
|
38
|
+
},
|
39
|
+
children: hideInTable,
|
40
|
+
className: hideInTable,
|
41
|
+
wrapClassName: hideInTable,
|
42
|
+
titleClassName: hideInTable,
|
43
|
+
bodyClassName: hideInTable,
|
44
|
+
headerClassName: hideInTable,
|
45
|
+
beforeClassName: hideInTable,
|
46
|
+
afterClassName: hideInTable,
|
47
|
+
subtitleClassName: hideInTable,
|
48
|
+
childrenClassName: hideInTable,
|
49
|
+
},
|
50
|
+
};
|
51
|
+
|
52
|
+
export default meta;
|
53
|
+
|
54
|
+
export const ViewDrawer = (props: ViewDrawerProps) => {
|
55
|
+
const [open, setOpen] = useState(false);
|
56
|
+
return (
|
57
|
+
<div>
|
58
|
+
<Button onClick={() => setOpen(true)}>Open</Button>
|
59
|
+
<ViewDrawerComponent
|
60
|
+
open={open}
|
61
|
+
onOpenChange={setOpen}
|
62
|
+
title="Volume Up Plus"
|
63
|
+
side={DrawerSide.Right}
|
64
|
+
fullscreen={false}
|
65
|
+
subtitle="Adjust the current tab's volume with the slider. Switch to any audio tab in one click."
|
66
|
+
after="❤️"
|
67
|
+
{...props}
|
68
|
+
>
|
69
|
+
<Button style={{margin: "50px auto", maxWidth: "max-content"}} onClick={() => setOpen(false)}>
|
70
|
+
Close ViewDrawer
|
71
|
+
</Button>
|
72
|
+
</ViewDrawerComponent>
|
73
|
+
</div>
|
74
|
+
);
|
75
|
+
};
|
@@ -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,68 @@
|
|
1
|
+
import {useState} from "react";
|
2
|
+
import {Meta} from "@storybook/react";
|
3
|
+
|
4
|
+
import {hideInTable} from "../../utils";
|
5
|
+
|
6
|
+
import {Button} from "../index";
|
7
|
+
|
8
|
+
import ViewModalComponent, {ViewModalProps} from "./ViewModal";
|
9
|
+
|
10
|
+
const meta: Meta<typeof ViewModalComponent> = {
|
11
|
+
title: "Components/ViewModal",
|
12
|
+
component: ViewModalComponent,
|
13
|
+
tags: ["autodocs"],
|
14
|
+
argTypes: {
|
15
|
+
title: {
|
16
|
+
type: "string",
|
17
|
+
},
|
18
|
+
subtitle: {
|
19
|
+
type: "string",
|
20
|
+
},
|
21
|
+
after: {
|
22
|
+
type: "string",
|
23
|
+
},
|
24
|
+
before: {
|
25
|
+
type: "string",
|
26
|
+
},
|
27
|
+
fullscreen: {
|
28
|
+
type: "boolean",
|
29
|
+
},
|
30
|
+
speed: {
|
31
|
+
type: "number",
|
32
|
+
},
|
33
|
+
children: hideInTable,
|
34
|
+
className: hideInTable,
|
35
|
+
wrapClassName: hideInTable,
|
36
|
+
titleClassName: hideInTable,
|
37
|
+
bodyClassName: hideInTable,
|
38
|
+
headerClassName: hideInTable,
|
39
|
+
beforeClassName: hideInTable,
|
40
|
+
afterClassName: hideInTable,
|
41
|
+
subtitleClassName: hideInTable,
|
42
|
+
childrenClassName: hideInTable,
|
43
|
+
},
|
44
|
+
};
|
45
|
+
|
46
|
+
export default meta;
|
47
|
+
|
48
|
+
export const ViewModal = (props: ViewModalProps) => {
|
49
|
+
const [open, setOpen] = useState(false);
|
50
|
+
return (
|
51
|
+
<div>
|
52
|
+
<Button onClick={() => setOpen(true)}>Open</Button>
|
53
|
+
<ViewModalComponent
|
54
|
+
open={open}
|
55
|
+
onOpenChange={setOpen}
|
56
|
+
title="Volume Up Plus"
|
57
|
+
fullscreen={false}
|
58
|
+
subtitle="Adjust the current tab's volume with the slider. Switch to any audio tab in one click."
|
59
|
+
after="❤️"
|
60
|
+
{...props}
|
61
|
+
>
|
62
|
+
<Button style={{margin: "50px auto", maxWidth: "max-content"}} onClick={() => setOpen(false)}>
|
63
|
+
Close ViewModal
|
64
|
+
</Button>
|
65
|
+
</ViewModalComponent>
|
66
|
+
</div>
|
67
|
+
);
|
68
|
+
};
|
@@ -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,29 @@
|
|
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";
|
28
|
+
|
29
|
+
export type {ComponentsProps} from "./types";
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import type {
|
2
|
+
AvatarProps,
|
3
|
+
ButtonProps,
|
4
|
+
CheckboxProps,
|
5
|
+
DialogProps,
|
6
|
+
DrawerProps,
|
7
|
+
FooterProps,
|
8
|
+
HeaderProps,
|
9
|
+
HighlightProps,
|
10
|
+
IconProps,
|
11
|
+
IconButtonProps,
|
12
|
+
ListProps,
|
13
|
+
ListItemProps,
|
14
|
+
ModalProps,
|
15
|
+
OdometerProps,
|
16
|
+
ScrollAreaProps,
|
17
|
+
SwitchProps,
|
18
|
+
TagProps,
|
19
|
+
TextAreaProps,
|
20
|
+
TextFieldProps,
|
21
|
+
ToastProps,
|
22
|
+
TooltipProps,
|
23
|
+
ViewProps,
|
24
|
+
ViewDrawerProps,
|
25
|
+
ViewModalProps,
|
26
|
+
} from "../components";
|
27
|
+
|
28
|
+
export interface ComponentsProps {
|
29
|
+
avatar?: Pick<AvatarProps, "size" | "radius" | "cursorPointer" | "delayMs">;
|
30
|
+
button?: Pick<ButtonProps, "variant" | "color" | "size" | "radius">;
|
31
|
+
checkbox?: Pick<CheckboxProps, "variant" | "size" | "radius" | "checkedIcon" | "indeterminateIcon">;
|
32
|
+
dialog?: DialogProps;
|
33
|
+
drawer?: DrawerProps;
|
34
|
+
footer?: FooterProps;
|
35
|
+
header?: Pick<HeaderProps, "alignCenter" | "before" | "after">;
|
36
|
+
highlight?: HighlightProps;
|
37
|
+
icon?: Omit<IconProps, "name">;
|
38
|
+
iconButton?: Pick<IconButtonProps, "variant" | "size" | "radius">;
|
39
|
+
list?: ListProps;
|
40
|
+
listItem?: ListItemProps;
|
41
|
+
modal?: ModalProps;
|
42
|
+
odometer?: Pick<OdometerProps, "auto" | "format" | "duration">;
|
43
|
+
scrollArea?: ScrollAreaProps;
|
44
|
+
switch?: SwitchProps;
|
45
|
+
tag?: Pick<TagProps, "variant" | "size" | "color" | "radius" | "clickable">;
|
46
|
+
textArea?: TextAreaProps;
|
47
|
+
textField?: TextFieldProps;
|
48
|
+
toast?: Pick<
|
49
|
+
ToastProps,
|
50
|
+
| "side"
|
51
|
+
| "duration"
|
52
|
+
| "swipeDirection"
|
53
|
+
| "swipeThreshold"
|
54
|
+
| "closeProps"
|
55
|
+
| "closeIcon"
|
56
|
+
| "fullWidth"
|
57
|
+
| "sticky"
|
58
|
+
| "radius"
|
59
|
+
| "color"
|
60
|
+
>;
|
61
|
+
tooltip?: Pick<TooltipProps, "side" | "align" | "delayDuration" | "arrowHeight" | "arrowWidth">;
|
62
|
+
view?: ViewProps;
|
63
|
+
viewDrawer?: ViewDrawerProps;
|
64
|
+
viewModal?: ViewModalProps;
|
65
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import type {ComponentsProps} from "../components";
|
2
|
+
import type {Icons} from "../providers";
|
3
|
+
|
4
|
+
export {AvatarSize, AvatarRadius} from "../components/Avatar";
|
5
|
+
export {ButtonColor, ButtonSize, ButtonRadius, ButtonVariant} from "../components/Button";
|
6
|
+
export {CheckboxVariant, CheckboxRadius, CheckboxSize} from "../components/Checkbox";
|
7
|
+
export {DrawerSide} from "../components/Drawer";
|
8
|
+
export {HighlightColor} from "../components/Highlight";
|
9
|
+
export {IconButtonSize, IconButtonVariant, IconButtonRadius} from "../components/IconButton";
|
10
|
+
export {ModalRadius} from "../components/Modal";
|
11
|
+
export {TagVariant, TagColor, TagRadius, TagSize} from "../components/Tag";
|
12
|
+
export {TextAreaSize, TextAreaVariant} from "../components/TextArea";
|
13
|
+
export {TextFieldAccent, TextFieldSize, TextFieldVariant} from "../components/TextField";
|
14
|
+
export {ToastColor, ToastRadius, ToastSide} from "../components/Toast";
|
15
|
+
|
16
|
+
export type {ComponentsProps} from "../components";
|
17
|
+
|
18
|
+
export interface Config {
|
19
|
+
props: ComponentsProps;
|
20
|
+
icons: Icons;
|
21
|
+
}
|
22
|
+
|
23
|
+
export const defineConfig = (config: Partial<Config>): Config => {
|
24
|
+
const {props = {}, icons = {}} = config;
|
25
|
+
return {props, icons};
|
26
|
+
};
|
package/src/index.ts
ADDED