@memori.ai/ui 1.0.0-alpha
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 +105 -0
- package/dist/components/Alert/Alert.d.ts +18 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +27 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/ButtonBase/ButtonBase.d.ts +28 -0
- package/dist/components/ButtonBase/index.d.ts +3 -0
- package/dist/components/Card/Card.d.ts +13 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +12 -0
- package/dist/components/ConfirmDialog/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.d.ts +32 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Dropdown/Dropdown.d.ts +11 -0
- package/dist/components/Dropdown/index.d.ts +2 -0
- package/dist/components/Expandable/Expandable.d.ts +15 -0
- package/dist/components/Expandable/helpers.d.ts +3 -0
- package/dist/components/Expandable/index.d.ts +2 -0
- package/dist/components/InputBase/InputBase.d.ts +49 -0
- package/dist/components/InputBase/index.d.ts +3 -0
- package/dist/components/Modal/Modal.d.ts +16 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +16 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Slider/Slider.d.ts +12 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Spin/Spin.d.ts +9 -0
- package/dist/components/Spin/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +11 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/i18n/I18nWrapper.d.ts +6 -0
- package/dist/icons/AI.d.ts +5 -0
- package/dist/icons/Alert.d.ts +5 -0
- package/dist/icons/ArrowUp.d.ts +5 -0
- package/dist/icons/Bug.d.ts +5 -0
- package/dist/icons/Chat.d.ts +5 -0
- package/dist/icons/ChevronDown.d.ts +5 -0
- package/dist/icons/ChevronLeft.d.ts +5 -0
- package/dist/icons/ChevronRight.d.ts +5 -0
- package/dist/icons/ChevronUp.d.ts +5 -0
- package/dist/icons/Clear.d.ts +5 -0
- package/dist/icons/Close.d.ts +6 -0
- package/dist/icons/Code.d.ts +5 -0
- package/dist/icons/Copy.d.ts +5 -0
- package/dist/icons/DeepThought.d.ts +5 -0
- package/dist/icons/Delete.d.ts +5 -0
- package/dist/icons/Document.d.ts +5 -0
- package/dist/icons/Download.d.ts +5 -0
- package/dist/icons/Edit.d.ts +5 -0
- package/dist/icons/Expand.d.ts +5 -0
- package/dist/icons/Eye.d.ts +5 -0
- package/dist/icons/EyeInvisible.d.ts +5 -0
- package/dist/icons/Facebook.d.ts +5 -0
- package/dist/icons/Feedback.d.ts +5 -0
- package/dist/icons/File.d.ts +5 -0
- package/dist/icons/FileExcel.d.ts +5 -0
- package/dist/icons/FilePdf.d.ts +5 -0
- package/dist/icons/FileWord.d.ts +5 -0
- package/dist/icons/Fullscreen.d.ts +5 -0
- package/dist/icons/FullscreenExit.d.ts +5 -0
- package/dist/icons/Group.d.ts +5 -0
- package/dist/icons/History.d.ts +6 -0
- package/dist/icons/Image.d.ts +4 -0
- package/dist/icons/Info.d.ts +5 -0
- package/dist/icons/Link.d.ts +5 -0
- package/dist/icons/Linkedin.d.ts +5 -0
- package/dist/icons/Loading.d.ts +6 -0
- package/dist/icons/Logout.d.ts +5 -0
- package/dist/icons/Mail.d.ts +5 -0
- package/dist/icons/MapMarker.d.ts +5 -0
- package/dist/icons/MenuHorizontal.d.ts +6 -0
- package/dist/icons/MenuVertical.d.ts +6 -0
- package/dist/icons/Message.d.ts +5 -0
- package/dist/icons/Microphone.d.ts +5 -0
- package/dist/icons/Minus.d.ts +5 -0
- package/dist/icons/MinusCircle.d.ts +5 -0
- package/dist/icons/PaperClip.d.ts +5 -0
- package/dist/icons/Picture.d.ts +5 -0
- package/dist/icons/Plus.d.ts +5 -0
- package/dist/icons/Preview.d.ts +4 -0
- package/dist/icons/Print.d.ts +6 -0
- package/dist/icons/QuestionHelp.d.ts +5 -0
- package/dist/icons/Refresh.d.ts +5 -0
- package/dist/icons/SelectIcon.d.ts +5 -0
- package/dist/icons/Send.d.ts +5 -0
- package/dist/icons/Setting.d.ts +5 -0
- package/dist/icons/Share.d.ts +5 -0
- package/dist/icons/Sound.d.ts +5 -0
- package/dist/icons/SoundDeactivated.d.ts +5 -0
- package/dist/icons/Telegram.d.ts +5 -0
- package/dist/icons/ThumbDown.d.ts +5 -0
- package/dist/icons/ThumbUp.d.ts +5 -0
- package/dist/icons/Translation.d.ts +5 -0
- package/dist/icons/Twitter.d.ts +5 -0
- package/dist/icons/Upload.d.ts +4 -0
- package/dist/icons/User.d.ts +5 -0
- package/dist/icons/Warning.d.ts +5 -0
- package/dist/icons/WhatsApp.d.ts +5 -0
- package/dist/index.d.ts +13 -0
- package/dist/memori-ai-ui.css +2 -0
- package/dist/memori-ai-ui.es.js +6400 -0
- package/dist/memori-ai-ui.umd.js +23 -0
- package/package.json +97 -0
- package/src/components/Alert/Alert.css +95 -0
- package/src/components/Alert/Alert.stories.tsx +156 -0
- package/src/components/Alert/Alert.test.tsx +122 -0
- package/src/components/Alert/Alert.tsx +124 -0
- package/src/components/Alert/__snapshots__/Alert.test.tsx.snap +67 -0
- package/src/components/Alert/index.tsx +2 -0
- package/src/components/Button/Button.css +173 -0
- package/src/components/Button/Button.stories.tsx +173 -0
- package/src/components/Button/Button.test.tsx +80 -0
- package/src/components/Button/Button.tsx +104 -0
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +204 -0
- package/src/components/Button/index.tsx +2 -0
- package/src/components/ButtonBase/ButtonBase.stories.tsx +194 -0
- package/src/components/ButtonBase/ButtonBase.tsx +84 -0
- package/src/components/ButtonBase/index.tsx +3 -0
- package/src/components/ButtonBase/styles.module.css +135 -0
- package/src/components/Card/Card.css +67 -0
- package/src/components/Card/Card.stories.tsx +104 -0
- package/src/components/Card/Card.test.tsx +67 -0
- package/src/components/Card/Card.tsx +58 -0
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +321 -0
- package/src/components/Card/index.tsx +2 -0
- package/src/components/Checkbox/Checkbox.css +114 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +77 -0
- package/src/components/Checkbox/Checkbox.test.tsx +50 -0
- package/src/components/Checkbox/Checkbox.tsx +61 -0
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +131 -0
- package/src/components/Checkbox/index.tsx +2 -0
- package/src/components/ConfirmDialog/ConfirmDialog.css +44 -0
- package/src/components/ConfirmDialog/ConfirmDialog.stories.tsx +235 -0
- package/src/components/ConfirmDialog/ConfirmDialog.test.tsx +129 -0
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +73 -0
- package/src/components/ConfirmDialog/__snapshots__/ConfirmDialog.test.tsx.snap +11 -0
- package/src/components/ConfirmDialog/index.tsx +2 -0
- package/src/components/Details/Details.css +66 -0
- package/src/components/Details/Details.stories.tsx +67 -0
- package/src/components/Drawer/Drawer.css +210 -0
- package/src/components/Drawer/Drawer.stories.tsx +275 -0
- package/src/components/Drawer/Drawer.test.tsx +158 -0
- package/src/components/Drawer/Drawer.tsx +242 -0
- package/src/components/Drawer/__snapshots__/Drawer.test.tsx.snap +21 -0
- package/src/components/Drawer/index.tsx +2 -0
- package/src/components/Dropdown/Dropdown.css +177 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +73 -0
- package/src/components/Dropdown/Dropdown.test.tsx +88 -0
- package/src/components/Dropdown/Dropdown.tsx +88 -0
- package/src/components/Dropdown/__snapshots__/Dropdown.test.tsx.snap +141 -0
- package/src/components/Dropdown/index.tsx +2 -0
- package/src/components/Expandable/Expandable.css +15 -0
- package/src/components/Expandable/Expandable.stories.tsx +196 -0
- package/src/components/Expandable/Expandable.test.tsx +143 -0
- package/src/components/Expandable/Expandable.tsx +122 -0
- package/src/components/Expandable/__snapshots__/Expandable.test.tsx.snap +199 -0
- package/src/components/Expandable/helpers.ts +16 -0
- package/src/components/Expandable/index.tsx +2 -0
- package/src/components/InputBase/InputBase.stories.tsx +237 -0
- package/src/components/InputBase/InputBase.tsx +105 -0
- package/src/components/InputBase/index.tsx +3 -0
- package/src/components/InputBase/styles.module.css +96 -0
- package/src/components/Modal/Modal.css +95 -0
- package/src/components/Modal/Modal.stories.tsx +184 -0
- package/src/components/Modal/Modal.test.tsx +129 -0
- package/src/components/Modal/Modal.tsx +124 -0
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +17 -0
- package/src/components/Modal/index.tsx +2 -0
- package/src/components/Select/Select.css +134 -0
- package/src/components/Select/Select.stories.tsx +85 -0
- package/src/components/Select/Select.test.tsx +85 -0
- package/src/components/Select/Select.tsx +84 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +261 -0
- package/src/components/Select/index.tsx +2 -0
- package/src/components/Slider/Slider.css +194 -0
- package/src/components/Slider/Slider.stories.tsx +85 -0
- package/src/components/Slider/Slider.test.tsx +55 -0
- package/src/components/Slider/Slider.tsx +157 -0
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +419 -0
- package/src/components/Slider/index.tsx +2 -0
- package/src/components/Spin/Spin.css +31 -0
- package/src/components/Spin/Spin.stories.tsx +65 -0
- package/src/components/Spin/Spin.test.tsx +47 -0
- package/src/components/Spin/Spin.tsx +34 -0
- package/src/components/Spin/__snapshots__/Spin.test.tsx.snap +193 -0
- package/src/components/Spin/index.tsx +2 -0
- package/src/components/Table/Table.css +130 -0
- package/src/components/Table/Table.stories.tsx +274 -0
- package/src/components/Tooltip/Tooltip.css +160 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +136 -0
- package/src/components/Tooltip/Tooltip.test.tsx +110 -0
- package/src/components/Tooltip/Tooltip.tsx +46 -0
- package/src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap +163 -0
- package/src/components/Tooltip/index.tsx +2 -0
- package/src/components/definitions.stories.tsx +150 -0
- package/src/i18n/I18nWrapper.tsx +13 -0
- package/src/i18n/i18n.ts +34 -0
- package/src/icons/AI.tsx +38 -0
- package/src/icons/Alert.tsx +31 -0
- package/src/icons/ArrowUp.tsx +28 -0
- package/src/icons/Bug.tsx +81 -0
- package/src/icons/Chat.tsx +30 -0
- package/src/icons/ChevronDown.tsx +26 -0
- package/src/icons/ChevronLeft.tsx +28 -0
- package/src/icons/ChevronRight.tsx +28 -0
- package/src/icons/ChevronUp.tsx +24 -0
- package/src/icons/Clear.tsx +23 -0
- package/src/icons/Close.tsx +30 -0
- package/src/icons/Code.tsx +30 -0
- package/src/icons/Copy.tsx +30 -0
- package/src/icons/DeepThought.tsx +38 -0
- package/src/icons/Delete.tsx +23 -0
- package/src/icons/Document.tsx +52 -0
- package/src/icons/Download.tsx +23 -0
- package/src/icons/Edit.tsx +17 -0
- package/src/icons/Expand.tsx +23 -0
- package/src/icons/Eye.tsx +17 -0
- package/src/icons/EyeInvisible.tsx +24 -0
- package/src/icons/Facebook.tsx +23 -0
- package/src/icons/Feedback.tsx +27 -0
- package/src/icons/File.tsx +17 -0
- package/src/icons/FileExcel.tsx +23 -0
- package/src/icons/FilePdf.tsx +23 -0
- package/src/icons/FileWord.tsx +23 -0
- package/src/icons/Fullscreen.tsx +23 -0
- package/src/icons/FullscreenExit.tsx +23 -0
- package/src/icons/Group.tsx +30 -0
- package/src/icons/History.tsx +33 -0
- package/src/icons/Image.tsx +37 -0
- package/src/icons/Info.tsx +37 -0
- package/src/icons/Link.tsx +17 -0
- package/src/icons/Linkedin.tsx +23 -0
- package/src/icons/Loading.tsx +28 -0
- package/src/icons/Logout.tsx +33 -0
- package/src/icons/Mail.tsx +17 -0
- package/src/icons/MapMarker.tsx +26 -0
- package/src/icons/MenuHorizontal.tsx +29 -0
- package/src/icons/MenuVertical.tsx +29 -0
- package/src/icons/Message.tsx +23 -0
- package/src/icons/Microphone.tsx +23 -0
- package/src/icons/Minus.tsx +23 -0
- package/src/icons/MinusCircle.tsx +24 -0
- package/src/icons/PaperClip.tsx +23 -0
- package/src/icons/Picture.tsx +23 -0
- package/src/icons/Plus.tsx +18 -0
- package/src/icons/Preview.tsx +31 -0
- package/src/icons/Print.tsx +37 -0
- package/src/icons/QuestionHelp.tsx +34 -0
- package/src/icons/Refresh.tsx +30 -0
- package/src/icons/SelectIcon.tsx +28 -0
- package/src/icons/Send.tsx +17 -0
- package/src/icons/Setting.tsx +23 -0
- package/src/icons/Share.tsx +23 -0
- package/src/icons/Sound.tsx +23 -0
- package/src/icons/SoundDeactivated.tsx +27 -0
- package/src/icons/Telegram.tsx +26 -0
- package/src/icons/ThumbDown.tsx +29 -0
- package/src/icons/ThumbUp.tsx +29 -0
- package/src/icons/Translation.tsx +24 -0
- package/src/icons/Twitter.tsx +23 -0
- package/src/icons/Upload.tsx +34 -0
- package/src/icons/User.tsx +17 -0
- package/src/icons/Warning.tsx +27 -0
- package/src/icons/WhatsApp.tsx +24 -0
- package/src/icons/icons.stories.css +5 -0
- package/src/icons/icons.stories.tsx +110 -0
- package/src/icons/loading.css +14 -0
- package/src/index.ts +15 -0
- package/src/styles/utils.css +17 -0
- package/src/styles.css +4 -0
- package/src/theme/variables.css +110 -0
- package/src/vite-env.d.ts +6 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
|
|
4
|
+
import './Details.css'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'UI/Details',
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {},
|
|
10
|
+
} satisfies Meta<HTMLDetailsElement>
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof meta>
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<details className="memori--details">
|
|
19
|
+
<summary>Details</summary>
|
|
20
|
+
<p>Details content</p>
|
|
21
|
+
</details>
|
|
22
|
+
),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Open: Story = {
|
|
26
|
+
render: () => (
|
|
27
|
+
<details
|
|
28
|
+
className="memori--details"
|
|
29
|
+
open
|
|
30
|
+
>
|
|
31
|
+
<summary>Details</summary>
|
|
32
|
+
<p>Details content</p>
|
|
33
|
+
</details>
|
|
34
|
+
),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const WithChildren: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<details className="memori--details">
|
|
40
|
+
<summary>Details</summary>
|
|
41
|
+
<p>Details content 1</p>
|
|
42
|
+
<p>Details content 2</p>
|
|
43
|
+
</details>
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const WithComplexHTMLContent: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<details className="memori--details">
|
|
50
|
+
<summary>Details</summary>
|
|
51
|
+
<p>Details content</p>
|
|
52
|
+
<ul>
|
|
53
|
+
<li>Item 1</li>
|
|
54
|
+
<li>Item 2</li>
|
|
55
|
+
<li>Item 3</li>
|
|
56
|
+
</ul>
|
|
57
|
+
<p>Details content</p>
|
|
58
|
+
<figure>
|
|
59
|
+
<img
|
|
60
|
+
src="https://www.aisuru.com/images/aisuru/og-image.png"
|
|
61
|
+
alt="Placeholder"
|
|
62
|
+
/>
|
|
63
|
+
<figcaption>Placeholder image</figcaption>
|
|
64
|
+
</figure>
|
|
65
|
+
</details>
|
|
66
|
+
),
|
|
67
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
.memori-drawer {
|
|
2
|
+
position: relative;
|
|
3
|
+
z-index: 1001;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.memori-drawer--backdrop {
|
|
7
|
+
position: fixed;
|
|
8
|
+
z-index: 1000;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
background-color: rgb(0 0 0 / 30%);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.memori-drawer--container {
|
|
17
|
+
position: fixed;
|
|
18
|
+
z-index: 1001;
|
|
19
|
+
inset: 0;
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.memori-drawer--container-scrollable {
|
|
24
|
+
display: flex;
|
|
25
|
+
min-height: 100%;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.memori-drawer--panel {
|
|
31
|
+
position: relative;
|
|
32
|
+
display: flex;
|
|
33
|
+
width: var(--memori-drawer--width, 100%);
|
|
34
|
+
max-width: 80vw;
|
|
35
|
+
height: 100%;
|
|
36
|
+
min-height: 100vh;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
padding: 1rem 1.5rem 1.5rem;
|
|
40
|
+
margin-right: 0;
|
|
41
|
+
margin-left: auto;
|
|
42
|
+
background-color: #fff;
|
|
43
|
+
font-family: var(--memori-font-family);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@media (width >= 768px) {
|
|
47
|
+
.memori-drawer--panel {
|
|
48
|
+
width: var(--memori-drawer--width-md, 80%);
|
|
49
|
+
max-width: none;
|
|
50
|
+
padding-top: 1.5rem;
|
|
51
|
+
padding-right: 2rem;
|
|
52
|
+
padding-left: 2rem;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (width >= 1024px) {
|
|
57
|
+
.memori-drawer--panel {
|
|
58
|
+
width: var(--memori-drawer--width-lg, 60%);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.memori-drawer--panel.memori-drawer--with-footer {
|
|
63
|
+
padding-bottom: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.memori-drawer--panel .memori-spin {
|
|
67
|
+
display: flex;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
flex: 1;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
overflow-y: auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.memori-drawer--panel > .memori-spin {
|
|
76
|
+
margin-top: -1.75rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.memori-drawer--panel p {
|
|
80
|
+
margin: 0 0 1em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
h2.memori-drawer--title {
|
|
84
|
+
margin: 0 0 1rem;
|
|
85
|
+
font-size: 1.5rem;
|
|
86
|
+
font-weight: 700;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.memori-drawer--panel-left {
|
|
90
|
+
margin-right: auto;
|
|
91
|
+
margin-left: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.memori-drawer--close {
|
|
95
|
+
position: sticky;
|
|
96
|
+
z-index: 70;
|
|
97
|
+
top: 0;
|
|
98
|
+
left: 0;
|
|
99
|
+
padding: 0.5rem;
|
|
100
|
+
margin-top: -1.5rem;
|
|
101
|
+
margin-left: -5.5rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (width <= 767px) {
|
|
105
|
+
.memori-drawer--close {
|
|
106
|
+
left: 0.5rem;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.memori-drawer--close button {
|
|
111
|
+
border-color: #fff;
|
|
112
|
+
color: #fff;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (width <= 767px) {
|
|
116
|
+
.memori-drawer--close button {
|
|
117
|
+
color: #000;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.memori-drawer--panel-left .memori-drawer--close {
|
|
122
|
+
right: -3.5rem;
|
|
123
|
+
left: auto;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (width <= 767px) {
|
|
127
|
+
.memori-drawer--panel-left .memori-drawer--close {
|
|
128
|
+
right: 0.5rem;
|
|
129
|
+
left: auto;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.memori-drawer--footer {
|
|
134
|
+
position: sticky;
|
|
135
|
+
bottom: 0;
|
|
136
|
+
left: 0;
|
|
137
|
+
display: flex;
|
|
138
|
+
width: 100%;
|
|
139
|
+
justify-content: flex-end;
|
|
140
|
+
padding-top: 1rem;
|
|
141
|
+
padding-bottom: 1rem;
|
|
142
|
+
border-top: 1px solid rgb(0 0 0 / 25%);
|
|
143
|
+
margin-top: auto;
|
|
144
|
+
background-color: #fff;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.memori-drawer--footer-left-action {
|
|
148
|
+
margin-right: auto;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.memori-drawer--footer-actions {
|
|
152
|
+
display: flex;
|
|
153
|
+
gap: 0.5rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.memori-drawer--footer button + button {
|
|
157
|
+
margin-left: 0.5em;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.memori-drawer--content {
|
|
161
|
+
flex: 1;
|
|
162
|
+
padding-top: 12px;
|
|
163
|
+
overflow-y: auto;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.memori-drawer--content--scrollable {
|
|
167
|
+
flex: 1;
|
|
168
|
+
overflow-y: auto;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Transition classes */
|
|
172
|
+
.ease-out {
|
|
173
|
+
transition-timing-function: ease-out;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ease-in {
|
|
177
|
+
transition-timing-function: ease-in;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.duration-300 {
|
|
181
|
+
transition-duration: 300ms;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.duration-200 {
|
|
185
|
+
transition-duration: 200ms;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.duration-400 {
|
|
189
|
+
transition-duration: 400ms;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.duration-500 {
|
|
193
|
+
transition-duration: 500ms;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.opacity-0 {
|
|
197
|
+
opacity: 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.opacity-100 {
|
|
201
|
+
opacity: 1;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.max-w-0 {
|
|
205
|
+
max-width: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.max-w-80 {
|
|
209
|
+
max-width: 80%;
|
|
210
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import Drawer, { type Props } from './Drawer'
|
|
4
|
+
import Button from '../Button/Button'
|
|
5
|
+
|
|
6
|
+
import I18nWrapper from '../../i18n/I18nWrapper'
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'UI/Drawer',
|
|
10
|
+
component: Drawer,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
title: {
|
|
14
|
+
control: {
|
|
15
|
+
type: 'text',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
control: {
|
|
20
|
+
type: 'text',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
loading: {
|
|
24
|
+
control: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
open: {
|
|
29
|
+
control: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
className: {
|
|
34
|
+
control: {
|
|
35
|
+
type: 'text',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
placement: {
|
|
39
|
+
control: {
|
|
40
|
+
type: 'select',
|
|
41
|
+
options: ['left', 'right'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
width: {
|
|
45
|
+
control: {
|
|
46
|
+
type: 'text',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
animated: {
|
|
50
|
+
control: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
closable: {
|
|
55
|
+
control: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
parameters: {
|
|
61
|
+
controls: { expanded: true },
|
|
62
|
+
},
|
|
63
|
+
render: (args: Props) => {
|
|
64
|
+
const [isOpen, setIsOpen] = React.useState(!!args.open || false)
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<I18nWrapper>
|
|
68
|
+
<Button onClick={() => setIsOpen(true)}>Open Drawer</Button>
|
|
69
|
+
<Drawer
|
|
70
|
+
{...args}
|
|
71
|
+
open={isOpen}
|
|
72
|
+
onClose={() => setIsOpen(false)}
|
|
73
|
+
>
|
|
74
|
+
{content}
|
|
75
|
+
</Drawer>
|
|
76
|
+
</I18nWrapper>
|
|
77
|
+
)
|
|
78
|
+
},
|
|
79
|
+
} satisfies Meta<typeof Drawer>
|
|
80
|
+
|
|
81
|
+
export default meta
|
|
82
|
+
type Story = StoryObj<typeof meta>
|
|
83
|
+
|
|
84
|
+
const content = (
|
|
85
|
+
<>
|
|
86
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
87
|
+
<h3>Suspendisse a sodales nulla, sed semper nisi.</h3>
|
|
88
|
+
<p>Proin tincidunt enim in felis aliquet, a ultricies purus bibendum.</p>
|
|
89
|
+
<ul>
|
|
90
|
+
<li>Quisque in ultrices lectus.</li>
|
|
91
|
+
<li>Quisque in ultrices lectus.</li>
|
|
92
|
+
<li>Quisque in ultrices lectus.</li>
|
|
93
|
+
</ul>
|
|
94
|
+
<p>Nulla at urna diam.</p>
|
|
95
|
+
<h3>Suspendisse a sodales nulla, sed semper nisi.</h3>
|
|
96
|
+
<p>Proin tincidunt enim in felis aliquet, a ultricies purus bibendum.</p>
|
|
97
|
+
</>
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
// Create a proper footer object for the Drawer component
|
|
101
|
+
const simpleFooterObject = {
|
|
102
|
+
onSubmit: () => console.log('Submit clicked'),
|
|
103
|
+
loading: false,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Basic examples
|
|
107
|
+
export const Default: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
open: false,
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const Open: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
open: true,
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const Loading: Story = {
|
|
120
|
+
args: {
|
|
121
|
+
open: true,
|
|
122
|
+
title: 'Drawer Title',
|
|
123
|
+
description: 'Drawer Description',
|
|
124
|
+
loading: true,
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const WithSimpleFooter: Story = {
|
|
129
|
+
args: {
|
|
130
|
+
open: true,
|
|
131
|
+
title: 'Drawer Title',
|
|
132
|
+
description: 'Drawer Description',
|
|
133
|
+
footer: {
|
|
134
|
+
onSubmit: () => console.log('Submit'),
|
|
135
|
+
loading: false,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const PlacementLeft: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
open: true,
|
|
143
|
+
placement: 'left',
|
|
144
|
+
title: 'Left Drawer',
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const CustomWidth: Story = {
|
|
149
|
+
args: {
|
|
150
|
+
open: true,
|
|
151
|
+
title: 'Custom Width Drawer',
|
|
152
|
+
width: '50%',
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const NonAnimated: Story = {
|
|
157
|
+
args: {
|
|
158
|
+
open: true,
|
|
159
|
+
title: 'Non-Animated Drawer',
|
|
160
|
+
animated: false,
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export const NonClosable: Story = {
|
|
165
|
+
args: {
|
|
166
|
+
open: true,
|
|
167
|
+
title: 'Non-Closable Drawer',
|
|
168
|
+
closable: false,
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const WithDataDetection: Story = {
|
|
173
|
+
args: {
|
|
174
|
+
open: true,
|
|
175
|
+
title: 'Data Change Detection',
|
|
176
|
+
description: 'This drawer demonstrates the data change detection feature',
|
|
177
|
+
},
|
|
178
|
+
render: (args: Props) => {
|
|
179
|
+
const [isOpen, setIsOpen] = React.useState(!!args.open || false)
|
|
180
|
+
// Use static data for the story - don't try to update it which might cause issues
|
|
181
|
+
const staticData = { id: 1, name: 'John Doe' }
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<I18nWrapper>
|
|
185
|
+
<Button onClick={() => setIsOpen(true)}>Open Data Drawer</Button>
|
|
186
|
+
<Drawer
|
|
187
|
+
{...args}
|
|
188
|
+
open={isOpen}
|
|
189
|
+
data={staticData}
|
|
190
|
+
onClose={() => setIsOpen(false)}
|
|
191
|
+
>
|
|
192
|
+
<p>This drawer has data associated with it.</p>
|
|
193
|
+
<p>
|
|
194
|
+
When you close it, the component will check for unsaved changes.
|
|
195
|
+
</p>
|
|
196
|
+
<p>(For this demo, no actual changes are tracked)</p>
|
|
197
|
+
</Drawer>
|
|
198
|
+
</I18nWrapper>
|
|
199
|
+
)
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Improved ConfirmationDialog template with better state management
|
|
204
|
+
export const WithConfirmationDialog: Story = {
|
|
205
|
+
args: {
|
|
206
|
+
open: true,
|
|
207
|
+
title: 'Unsaved Changes Demo',
|
|
208
|
+
description:
|
|
209
|
+
'This drawer shows the confirmation dialog when closing with unsaved changes',
|
|
210
|
+
},
|
|
211
|
+
render: (args: Props) => {
|
|
212
|
+
const [isOpen, setIsOpen] = useState<boolean>(!!args.open || true)
|
|
213
|
+
const [data, setData] = useState({ id: 1, name: 'John Doe' })
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<I18nWrapper>
|
|
217
|
+
<Button onClick={() => setIsOpen(true)}>
|
|
218
|
+
Open Confirmation Dialog
|
|
219
|
+
</Button>
|
|
220
|
+
<Drawer
|
|
221
|
+
{...args}
|
|
222
|
+
open={isOpen}
|
|
223
|
+
onClose={() => setIsOpen(false)}
|
|
224
|
+
data={data}
|
|
225
|
+
title="Confirmation Example"
|
|
226
|
+
confirmDialogTitle="Confirmation Example"
|
|
227
|
+
confirmDialogMessage="Are you sure you want to close this drawer?"
|
|
228
|
+
footer={{
|
|
229
|
+
onSubmit: () => {
|
|
230
|
+
console.log('Submitted with data:', data)
|
|
231
|
+
setIsOpen(false)
|
|
232
|
+
},
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
<h3>Sample Form Content</h3>
|
|
236
|
+
<p>Current data: {JSON.stringify(data)}</p>
|
|
237
|
+
<Button onClick={() => setData({ id: 1, name: 'Jane Smith' })}>
|
|
238
|
+
Modify Data
|
|
239
|
+
</Button>
|
|
240
|
+
</Drawer>
|
|
241
|
+
</I18nWrapper>
|
|
242
|
+
)
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Fixed Template with lots of content and proper footer
|
|
247
|
+
export const WithLongContent: Story = {
|
|
248
|
+
args: {
|
|
249
|
+
open: true,
|
|
250
|
+
title: 'Long Content Drawer',
|
|
251
|
+
description: 'This drawer has a lot of content',
|
|
252
|
+
footer: simpleFooterObject, // Use the properly structured footer object
|
|
253
|
+
},
|
|
254
|
+
render: (args: Props) => {
|
|
255
|
+
const [isOpen, setIsOpen] = React.useState(!!args.open || false)
|
|
256
|
+
|
|
257
|
+
return (
|
|
258
|
+
<I18nWrapper>
|
|
259
|
+
<Button onClick={() => setIsOpen(true)}>
|
|
260
|
+
Open Long Content Drawer
|
|
261
|
+
</Button>
|
|
262
|
+
<Drawer
|
|
263
|
+
{...args}
|
|
264
|
+
open={isOpen}
|
|
265
|
+
onClose={() => setIsOpen(false)}
|
|
266
|
+
>
|
|
267
|
+
{content}
|
|
268
|
+
{content}
|
|
269
|
+
{content}
|
|
270
|
+
{content}
|
|
271
|
+
</Drawer>
|
|
272
|
+
</I18nWrapper>
|
|
273
|
+
)
|
|
274
|
+
},
|
|
275
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { expect, it, vi } from 'vitest'
|
|
3
|
+
import { render } from '@testing-library/react'
|
|
4
|
+
import Drawer from './Drawer'
|
|
5
|
+
import Button from '../Button/Button'
|
|
6
|
+
|
|
7
|
+
const content = (
|
|
8
|
+
<>
|
|
9
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
10
|
+
<h3>Suspendisse a sodales nulla, sed semper nisi.</h3>
|
|
11
|
+
<p>Proin tincidunt enim in felis aliquet, a ultricies purus bibendum.</p>
|
|
12
|
+
<ul>
|
|
13
|
+
<li>Quisque in ultrices lectus.</li>
|
|
14
|
+
<li>Quisque in ultrices lectus.</li>
|
|
15
|
+
<li>Quisque in ultrices lectus.</li>
|
|
16
|
+
</ul>
|
|
17
|
+
<p>Nulla at urna diam.</p>
|
|
18
|
+
</>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
it('renders Drawer unchanged', () => {
|
|
22
|
+
const { container } = render(
|
|
23
|
+
<Drawer
|
|
24
|
+
open={false}
|
|
25
|
+
onClose={vi.fn()}
|
|
26
|
+
>
|
|
27
|
+
{content}
|
|
28
|
+
</Drawer>,
|
|
29
|
+
)
|
|
30
|
+
expect(container).toMatchSnapshot()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('renders Drawer open unchanged', () => {
|
|
34
|
+
const { container } = render(
|
|
35
|
+
<Drawer
|
|
36
|
+
open={true}
|
|
37
|
+
onClose={vi.fn()}
|
|
38
|
+
>
|
|
39
|
+
{content}
|
|
40
|
+
</Drawer>,
|
|
41
|
+
)
|
|
42
|
+
expect(container).toMatchSnapshot()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('renders Drawer with title unchanged', () => {
|
|
46
|
+
const { container } = render(
|
|
47
|
+
<Drawer
|
|
48
|
+
open={true}
|
|
49
|
+
onClose={vi.fn()}
|
|
50
|
+
title="Lorem ipsum"
|
|
51
|
+
>
|
|
52
|
+
{content}
|
|
53
|
+
</Drawer>,
|
|
54
|
+
)
|
|
55
|
+
expect(container).toMatchSnapshot()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('renders Drawer with description unchanged', () => {
|
|
59
|
+
const { container } = render(
|
|
60
|
+
<Drawer
|
|
61
|
+
open={true}
|
|
62
|
+
onClose={vi.fn()}
|
|
63
|
+
description="Lorem ipsum dolor sit amet"
|
|
64
|
+
>
|
|
65
|
+
{content}
|
|
66
|
+
</Drawer>,
|
|
67
|
+
)
|
|
68
|
+
expect(container).toMatchSnapshot()
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('renders Drawer loading unchanged', () => {
|
|
72
|
+
const { container } = render(
|
|
73
|
+
<Drawer
|
|
74
|
+
open={true}
|
|
75
|
+
onClose={vi.fn()}
|
|
76
|
+
loading
|
|
77
|
+
>
|
|
78
|
+
{content}
|
|
79
|
+
</Drawer>,
|
|
80
|
+
)
|
|
81
|
+
expect(container).toMatchSnapshot()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('renders Drawer with footer unchanged', () => {
|
|
85
|
+
const { container } = render(
|
|
86
|
+
<Drawer
|
|
87
|
+
open={true}
|
|
88
|
+
onClose={vi.fn()}
|
|
89
|
+
footer={{
|
|
90
|
+
leftAction: <Button>Cancel</Button>,
|
|
91
|
+
onSubmit: vi.fn(),
|
|
92
|
+
loading: false,
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{content}
|
|
96
|
+
</Drawer>,
|
|
97
|
+
)
|
|
98
|
+
expect(container).toMatchSnapshot()
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('renders Drawer non closable unchanged', () => {
|
|
102
|
+
const { container } = render(
|
|
103
|
+
<Drawer
|
|
104
|
+
open={true}
|
|
105
|
+
onClose={vi.fn()}
|
|
106
|
+
closable={false}
|
|
107
|
+
>
|
|
108
|
+
{content}
|
|
109
|
+
</Drawer>,
|
|
110
|
+
)
|
|
111
|
+
expect(container).toMatchSnapshot()
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('renders Drawer side left unchanged', () => {
|
|
115
|
+
const { container } = render(
|
|
116
|
+
<Drawer
|
|
117
|
+
open={true}
|
|
118
|
+
onClose={vi.fn()}
|
|
119
|
+
placement="left"
|
|
120
|
+
>
|
|
121
|
+
{content}
|
|
122
|
+
</Drawer>,
|
|
123
|
+
)
|
|
124
|
+
expect(container).toMatchSnapshot()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('renders Drawer with custom widths unchanged', () => {
|
|
128
|
+
const { container } = render(
|
|
129
|
+
<Drawer
|
|
130
|
+
open={true}
|
|
131
|
+
onClose={vi.fn()}
|
|
132
|
+
width="100%"
|
|
133
|
+
widthMd="90%"
|
|
134
|
+
widthLg="80%"
|
|
135
|
+
>
|
|
136
|
+
{content}
|
|
137
|
+
</Drawer>,
|
|
138
|
+
)
|
|
139
|
+
expect(container).toMatchSnapshot()
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
it('renders Drawer with footer unchanged', () => {
|
|
143
|
+
const { container } = render(
|
|
144
|
+
<Drawer
|
|
145
|
+
open={true}
|
|
146
|
+
onClose={vi.fn()}
|
|
147
|
+
footer={{
|
|
148
|
+
leftActionClassName: 'custom-left-action-class',
|
|
149
|
+
leftAction: <Button>Cancel</Button>,
|
|
150
|
+
onSubmit: vi.fn(),
|
|
151
|
+
loading: false,
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
{content}
|
|
155
|
+
</Drawer>,
|
|
156
|
+
)
|
|
157
|
+
expect(container).toMatchSnapshot()
|
|
158
|
+
})
|