adnbn-ui 0.0.2 → 0.1.1

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 (35) hide show
  1. package/README.md +1057 -0
  2. package/package.json +19 -3
  3. package/.prettierignore +0 -3
  4. package/.prettierrc +0 -28
  5. package/.storybook/main.ts +0 -22
  6. package/.storybook/preview.tsx +0 -100
  7. package/.storybook/styles/custom.scss +0 -59
  8. package/.storybook/styles/preview.css +0 -58
  9. package/.storybook/vitest.setup.ts +0 -9
  10. package/eslint.config.js +0 -39
  11. package/src/components/Avatar/Avatar.stories.tsx +0 -118
  12. package/src/components/Button/Button.stories.tsx +0 -148
  13. package/src/components/Checkbox/Checkbox.stories.tsx +0 -180
  14. package/src/components/Drawer/Drawer.stories.tsx +0 -89
  15. package/src/components/Footer/Footer.stories.tsx +0 -118
  16. package/src/components/Header/Header.stories.tsx +0 -49
  17. package/src/components/Highlight/Highlight.stories.tsx +0 -83
  18. package/src/components/IconButton/IconButton.stories.tsx +0 -179
  19. package/src/components/Layout/Layout.stories.tsx +0 -88
  20. package/src/components/List/List.stories.tsx +0 -81
  21. package/src/components/Modal/Modal.stories.tsx +0 -95
  22. package/src/components/Odometer/Odometer.stories.tsx +0 -66
  23. package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -58
  24. package/src/components/Switch/Switch.stories.tsx +0 -25
  25. package/src/components/Tag/Tag.stories.tsx +0 -157
  26. package/src/components/TextArea/TextArea.stories.tsx +0 -145
  27. package/src/components/TextField/TextField.stories.tsx +0 -177
  28. package/src/components/Toast/Toast.stories.tsx +0 -209
  29. package/src/components/Tooltip/Tooltip.stories.tsx +0 -80
  30. package/src/components/View/View.stories.tsx +0 -47
  31. package/src/components/ViewDrawer/ViewDrawer.stories.tsx +0 -75
  32. package/src/components/ViewModal/ViewModal.stories.tsx +0 -68
  33. package/tsconfig.json +0 -18
  34. package/vite.config.ts +0 -11
  35. package/vitest.workspace.ts +0 -19
@@ -1,88 +0,0 @@
1
- import {useState} from "react";
2
- import {Meta} from "@storybook/react";
3
-
4
- import {hideInTable} from "../../utils";
5
-
6
- import {Header, Footer, Button, ScrollArea, IconButton, IconButtonVariant, IconButtonSize} from "../index";
7
-
8
- import {LayoutProvider, useLayout} from "./index";
9
-
10
- const meta: Meta<typeof LayoutProvider> = {
11
- title: "Components/Layout",
12
- component: LayoutProvider,
13
- tags: ["autodocs"],
14
- argTypes: {
15
- children: hideInTable,
16
- },
17
- };
18
-
19
- export default meta;
20
-
21
- export const Layout = () => {
22
- return (
23
- <LayoutProvider>
24
- <App />
25
- </LayoutProvider>
26
- );
27
- };
28
-
29
- const App = () => {
30
- const [arr, setArr] = useState(Array.from(Array(5)));
31
- const {expand, collapse} = useLayout();
32
-
33
- return (
34
- <div
35
- style={{
36
- background: "var(--bg-secondary-color)",
37
- flex: 1,
38
- display: "flex",
39
- flexDirection: "column",
40
- borderRadius: "10px",
41
- overflow: "hidden",
42
- }}
43
- >
44
- <Header title={"Layout"} />
45
- <div style={{display: "flex", justifyContent: "space-evenly", alignItems: "center", padding: "5px 10px"}}>
46
- <IconButton
47
- size={IconButtonSize.Medium}
48
- variant={IconButtonVariant.Contained}
49
- onClick={() => setArr([...arr, "item"])}
50
- >
51
-
52
- </IconButton>
53
- <Button onClick={() => expand()}>Expand</Button>
54
- <Button onClick={() => collapse()}>Collapse</Button>
55
-
56
- <IconButton
57
- size={IconButtonSize.Medium}
58
- variant={IconButtonVariant.Contained}
59
- onClick={() => setArr(arr.slice(0, -1))}
60
- >
61
-
62
- </IconButton>
63
- </div>
64
- <div style={{display: "flex", justifyContent: "space-evenly", padding: "5px 10px"}}>
65
- <Button onClick={() => expand({height: 700})}>700px height</Button>
66
- <Button onClick={() => expand({height: 700, width: 500})}>700x500px</Button>
67
- <Button onClick={() => expand({width: 500})}>500px width</Button>
68
- </div>
69
- <ScrollArea
70
- xOffset={10}
71
- type="always"
72
- style={{flex: 1, display: "flex", flexDirection: "column", overflow: "hidden"}}
73
- >
74
- <div style={{flex: 1}}>
75
- {arr.map((_, index) => (
76
- <div
77
- key={index}
78
- style={{padding: "10px 20px", textAlign: "center", color: "var(--text-secondary-color)"}}
79
- >
80
- Item {++index}
81
- </div>
82
- ))}
83
- </div>
84
- </ScrollArea>
85
- <Footer left="❤️" right="⭐" shadow style={{paddingTop: "10px"}} />
86
- </div>
87
- );
88
- };
@@ -1,81 +0,0 @@
1
- import {Meta, StoryObj} from "@storybook/react";
2
-
3
- import {hideInTable} from "../../utils";
4
-
5
- import {ListItem, Button, ButtonSize, ButtonVariant, Avatar, AvatarSize} from "../index";
6
-
7
- import ListComponent from "./List";
8
-
9
- const mockListItems = [
10
- {
11
- id: 1,
12
- avatar: "https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80",
13
- name: "John Doe",
14
- role: "React Developer",
15
- action: "Add",
16
- },
17
- {
18
- id: 2,
19
- avatar: "https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80",
20
- name: "Emily Smith",
21
- role: "UI/UX Designer",
22
- action: "Invite",
23
- },
24
- {
25
- id: 3,
26
- avatar: "https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80",
27
- name: "Michael Johnson",
28
- role: "Project Manager",
29
- action: "Add",
30
- },
31
- {
32
- id: 4,
33
- avatar: "https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80",
34
- name: "Sarah Brown",
35
- role: "QA Engineer",
36
- action: "Invite",
37
- },
38
- {
39
- id: 5,
40
- avatar: "https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80",
41
- name: "David Wilson",
42
- role: "DevOps Engineer",
43
- action: "Invite",
44
- },
45
- ];
46
-
47
- const meta: Meta<typeof ListComponent> = {
48
- title: "Components/List",
49
- component: ListComponent,
50
- tags: ["autodocs"],
51
- argTypes: {
52
- children: hideInTable,
53
- className: hideInTable,
54
- style: hideInTable,
55
- },
56
- };
57
-
58
- export default meta;
59
-
60
- type Story = StoryObj<typeof ListComponent>;
61
-
62
- export const List: Story = {
63
- args: {
64
- children: mockListItems.map(({id, avatar, name, role, action}) => (
65
- <ListItem
66
- key={id}
67
- left={<Avatar src={avatar} size={AvatarSize.Small} />}
68
- primary={<span style={{fontWeight: 500}}>{name}</span>}
69
- secondary={<span style={{fontSize: "14px"}}>{role}</span>}
70
- right={
71
- <Button variant={ButtonVariant.Contained} size={ButtonSize.Small}>
72
- {action}
73
- </Button>
74
- }
75
- />
76
- )),
77
- style: {
78
- minWidth: "300px",
79
- },
80
- },
81
- };
@@ -1,95 +0,0 @@
1
- import {useState} from "react";
2
- import {Meta} from "@storybook/react";
3
-
4
- import {capitalizeFirstLetter, hideInTable} from "../../utils";
5
-
6
- import {Button, Header} from "../index";
7
-
8
- import ModalComponent, {ModalProps, ModalRadius} from "./Modal";
9
-
10
- const radius: (ModalRadius | "default")[] = [
11
- ModalRadius.None,
12
- ModalRadius.Small,
13
- "default",
14
- ModalRadius.Medium,
15
- ModalRadius.Large,
16
- ];
17
-
18
- const meta: Meta<typeof ModalComponent> = {
19
- title: "Components/Modal",
20
- component: ModalComponent,
21
- tags: ["autodocs"],
22
- argTypes: {
23
- radius: {
24
- options: radius,
25
- control: {type: "select"},
26
- },
27
- modal: {
28
- description:
29
- "The modality of the dialog. When set to true, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.",
30
- control: {type: "boolean"},
31
- type: "boolean",
32
- },
33
- closeButton: {
34
- options: [true, false, {children: "❌"}],
35
- control: {type: "select"},
36
- },
37
- speed: {
38
- type: "number",
39
- },
40
- onClose: hideInTable,
41
- children: hideInTable,
42
- className: hideInTable,
43
- description: hideInTable,
44
- overlayClassName: hideInTable,
45
- childrenClassName: hideInTable,
46
- },
47
- };
48
-
49
- export default meta;
50
-
51
- export const Modal = (props: ModalProps & {label?: string}) => {
52
- const [open, setOpen] = useState(false);
53
- const {label = "Open Modal", ...other} = props;
54
- return (
55
- <div>
56
- <Button onClick={() => setOpen(true)}>{label}</Button>
57
- <ModalComponent open={open} onOpenChange={setOpen} {...other}>
58
- <div
59
- style={{
60
- display: "flex",
61
- alignItems: "center",
62
- justifyContent: "center",
63
- height: "100%",
64
- gap: "30px",
65
- }}
66
- >
67
- <Header
68
- title="Volume Up Plus"
69
- subtitle="Adjust the current tab's volume with the slider. Switch to any audio tab in one click."
70
- before="❤️"
71
- />
72
- <Button style={{margin: "50px auto", maxWidth: "max-content"}} onClick={() => setOpen(false)}>
73
- Close Modal
74
- </Button>
75
- </div>
76
- </ModalComponent>
77
- </div>
78
- );
79
- };
80
-
81
- export const Radius = () => {
82
- return (
83
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(5, auto)"}}>
84
- {radius.map(radius => (
85
- <div key={radius} className="item-card">
86
- <Modal
87
- radius={radius !== "default" ? radius : undefined}
88
- fullscreen={false}
89
- label={`${capitalizeFirstLetter(radius)} radius`}
90
- />
91
- </div>
92
- ))}
93
- </div>
94
- );
95
- };
@@ -1,66 +0,0 @@
1
- import {useEffect, useState} from "react";
2
- import {Meta, StoryObj} from "@storybook/react";
3
-
4
- import {hideInTable} from "../../utils";
5
-
6
- import OdometerComponent from "./Odometer";
7
-
8
- const meta: Meta<typeof OdometerComponent> = {
9
- title: "Components/Odometer",
10
- component: OdometerComponent,
11
- tags: ["autodocs"],
12
- argTypes: {
13
- value: {
14
- description: "The number to display on the odometer.",
15
- control: {type: "number"},
16
- },
17
- format: {
18
- description: "Formatting string for odometer value.",
19
- control: {type: "text"},
20
- },
21
- duration: {
22
- description: "Animation duration in milliseconds.",
23
- control: {type: "number"},
24
- },
25
- auto: hideInTable,
26
- className: hideInTable,
27
- },
28
- };
29
-
30
- export default meta;
31
-
32
- export const Odometer: StoryObj<typeof OdometerComponent> = {
33
- args: {
34
- value: 1234,
35
- duration: 500,
36
- format: "d",
37
- },
38
- };
39
-
40
- export const OdometerCount = () => {
41
- const [value, setValue] = useState(100);
42
-
43
- useEffect(() => {
44
- const interval = setInterval(() => {
45
- setValue(prev => ++prev);
46
- }, 1000);
47
-
48
- return () => clearInterval(interval);
49
- }, []);
50
-
51
- return <OdometerComponent value={value} />;
52
- };
53
-
54
- export const OdometerRandom = () => {
55
- const [value, setValue] = useState(100);
56
-
57
- useEffect(() => {
58
- const interval = setInterval(() => {
59
- setValue(prev => prev + Math.floor(Math.random() * 10) + 1);
60
- }, 3000);
61
-
62
- return () => clearInterval(interval);
63
- }, []);
64
-
65
- return <OdometerComponent value={value} duration={1000} />;
66
- };
@@ -1,58 +0,0 @@
1
- import {Meta, StoryObj} from "@storybook/react";
2
-
3
- import {hideInTable} from "../../utils";
4
-
5
- import ScrollAreaComponent from "./ScrollArea";
6
-
7
- const meta: Meta<typeof ScrollAreaComponent> = {
8
- title: "Components/ScrollArea",
9
- component: ScrollAreaComponent,
10
- tags: ["autodocs"],
11
- argTypes: {
12
- type: {
13
- description:
14
- "Describes the nature of scrollbar visibility, similar to how the scrollbar preferences in MacOS control visibility of native scrollbars.",
15
- options: ["auto", "always", "scroll", "hover"],
16
- control: {type: "select"},
17
- },
18
- scrollHideDelay: {
19
- description:
20
- 'If type is set to either "scroll" or "hover", this prop determines the length of time, in milliseconds, before the scrollbars are hidden after the user stops interacting with scrollbars.',
21
- },
22
- dir: {
23
- description:
24
- "The reading direction of the scroll area. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.",
25
- options: ["ltr", "rtl"],
26
- control: {type: "select"},
27
- },
28
-
29
- style: hideInTable,
30
- className: hideInTable,
31
- thumbClassName: hideInTable,
32
- cornerClassName: hideInTable,
33
- viewportClassName: hideInTable,
34
- scrollbarClassName: hideInTable,
35
- },
36
- };
37
-
38
- export default meta;
39
-
40
- export const ScrollArea: StoryObj<typeof ScrollAreaComponent> = {
41
- args: {
42
- type: "hover",
43
- dir: "ltr",
44
- xOffset: 3,
45
- yOffset: 3,
46
- scrollHideDelay: 600,
47
- style: {
48
- padding: "10px",
49
- width: "300px",
50
- height: "150px",
51
- borderRadius: "10px",
52
- color: "var(--text-secondary-color)",
53
- background: "var(--bg-secondary-color)",
54
- },
55
- children:
56
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula, justo at congue malesuada, arcu elit malesuada eros, ut tempor justo libero a est. Donec sit amet tortor nec justo auctor sagittis. Suspendisse potenti. Fusce gravida, libero vel auctor pretium, odio risus vehicula nunc, et ultricies nunc arcu a neque. Aliquam erat volutpat. Morbi vulputate erat nec lectus vestibulum, at ullamcorper risus aliquet",
57
- },
58
- };
@@ -1,25 +0,0 @@
1
- import {Meta, StoryObj} from "@storybook/react";
2
-
3
- import {hideInTable} from "../../utils";
4
-
5
- import SwitchComponent from "./Switch";
6
-
7
- const meta: Meta<typeof SwitchComponent> = {
8
- title: "Components/Switch",
9
- component: SwitchComponent,
10
- tags: ["autodocs"],
11
- argTypes: {
12
- children: hideInTable,
13
- className: hideInTable,
14
- thumbClassName: hideInTable,
15
- },
16
- };
17
-
18
- export default meta;
19
-
20
- export const Switch: StoryObj<typeof SwitchComponent> = {
21
- args: {
22
- checked: true,
23
- disabled: false,
24
- },
25
- };
@@ -1,157 +0,0 @@
1
- import {Meta, StoryObj} from "@storybook/react";
2
-
3
- import {capitalizeFirstLetter} from "../../utils";
4
-
5
- import TagComponent, {TagColor, TagRadius, TagSize, TagVariant} from "./Tag";
6
-
7
- const variants: TagVariant[] = [TagVariant.Contained, TagVariant.Outlined, TagVariant.Soft];
8
- const colors: (TagColor | "default")[] = ["default", TagColor.Primary, TagColor.Secondary, TagColor.Accent];
9
- const sizes: (TagSize | "default")[] = [TagSize.Small, "default", TagSize.Medium, TagSize.Large];
10
- const radius: (TagRadius | "default")[] = [TagRadius.Small, TagRadius.Medium, TagRadius.Large, "default"];
11
-
12
- const meta: Meta<typeof TagComponent> = {
13
- title: "Components/Tag",
14
- component: TagComponent,
15
- tags: ["autodocs"],
16
- argTypes: {
17
- variant: {
18
- options: variants,
19
- control: {type: "select"},
20
- },
21
- color: {
22
- options: colors,
23
- control: {type: "select"},
24
- },
25
- size: {
26
- options: sizes,
27
- control: {type: "select"},
28
- },
29
- radius: {
30
- options: radius,
31
- control: {type: "select"},
32
- },
33
- },
34
- };
35
-
36
- export default meta;
37
-
38
- export const Tag: StoryObj<typeof TagComponent> = {
39
- args: {
40
- children: "Test",
41
- variant: TagVariant.Contained,
42
- color: TagColor.Primary,
43
- clickable: false,
44
- },
45
- };
46
-
47
- export const Variant = () => {
48
- return (
49
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(3, auto)"}}>
50
- {variants.map(variant => (
51
- <div key={variant} className="item-card">
52
- <TagComponent variant={variant} color={TagColor.Primary}>
53
- {capitalizeFirstLetter(variant)}
54
- </TagComponent>
55
- </div>
56
- ))}
57
- </div>
58
- );
59
- };
60
-
61
- export const VariantDisabled = () => {
62
- return (
63
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(3, auto)"}}>
64
- {variants.map(variant => (
65
- <div key={variant} className="item-card">
66
- <TagComponent variant={variant} color={TagColor.Primary}>
67
- {capitalizeFirstLetter(variant)}
68
- </TagComponent>
69
- </div>
70
- ))}
71
- </div>
72
- );
73
- };
74
-
75
- export const Size = () => {
76
- return (
77
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
78
- {sizes.map(size => (
79
- <div key={size} className="item-card">
80
- <TagComponent size={size !== "default" ? size : undefined} color={TagColor.Primary}>
81
- {capitalizeFirstLetter(size)}
82
- </TagComponent>
83
- </div>
84
- ))}
85
- </div>
86
- );
87
- };
88
-
89
- export const Radius = () => {
90
- return (
91
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
92
- {radius.map(radius => (
93
- <div key={radius} className="item-card">
94
- <TagComponent radius={radius !== "default" ? radius : undefined} color={TagColor.Primary}>
95
- {capitalizeFirstLetter(radius)}
96
- </TagComponent>
97
- </div>
98
- ))}
99
- </div>
100
- );
101
- };
102
-
103
- export const VariantColor = () => {
104
- return (
105
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
106
- {variants.map(variant =>
107
- colors.map(color => (
108
- <div key={`${variant}-${color}`}>
109
- <TagComponent variant={variant} color={color !== "default" ? color : undefined}>
110
- {capitalizeFirstLetter(color)}
111
- </TagComponent>
112
- </div>
113
- ))
114
- )}
115
- </div>
116
- );
117
- };
118
-
119
- export const VariantSize = () => {
120
- return (
121
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
122
- {variants.map(variant =>
123
- sizes.map(size => (
124
- <div key={`${variant}-${size}`}>
125
- <TagComponent
126
- variant={variant}
127
- size={size !== "default" ? size : undefined}
128
- color={TagColor.Primary}
129
- >
130
- {capitalizeFirstLetter(size)}
131
- </TagComponent>
132
- </div>
133
- ))
134
- )}
135
- </div>
136
- );
137
- };
138
-
139
- export const VariantRadius = () => {
140
- return (
141
- <div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
142
- {variants.map(variant =>
143
- radius.map(radius => (
144
- <div key={`${variant}-${radius}`}>
145
- <TagComponent
146
- variant={variant}
147
- radius={radius !== "default" ? radius : undefined}
148
- color={TagColor.Primary}
149
- >
150
- {capitalizeFirstLetter(radius)}
151
- </TagComponent>
152
- </div>
153
- ))
154
- )}
155
- </div>
156
- );
157
- };