@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,274 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
|
|
4
|
+
import Button from '../Button/Button'
|
|
5
|
+
import Select from '../Select/Select'
|
|
6
|
+
import ChevronLeft from '../../icons/ChevronLeft'
|
|
7
|
+
import ChevronRight from '../../icons/ChevronRight'
|
|
8
|
+
|
|
9
|
+
import './Table.css'
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'UI/Table',
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {},
|
|
15
|
+
} satisfies Meta<HTMLTableElement>
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => (
|
|
23
|
+
<table className="memori--table memori--table--compact">
|
|
24
|
+
<thead>
|
|
25
|
+
<tr>
|
|
26
|
+
<th>Header 1</th>
|
|
27
|
+
<th>Header 2</th>
|
|
28
|
+
<th>Header 3</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>Cell 1</td>
|
|
34
|
+
<td>Cell 2</td>
|
|
35
|
+
<td>Cell 3</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td>Cell 4</td>
|
|
39
|
+
<td>Cell 5</td>
|
|
40
|
+
<td>Cell 6</td>
|
|
41
|
+
</tr>
|
|
42
|
+
</tbody>
|
|
43
|
+
</table>
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const Compact: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<table className="memori--table memori--table--compact">
|
|
50
|
+
<thead>
|
|
51
|
+
<tr>
|
|
52
|
+
<th>Header 1</th>
|
|
53
|
+
<th>Header 2</th>
|
|
54
|
+
<th>Header 3</th>
|
|
55
|
+
</tr>
|
|
56
|
+
</thead>
|
|
57
|
+
<tbody>
|
|
58
|
+
<tr>
|
|
59
|
+
<td>Cell 1</td>
|
|
60
|
+
<td>Cell 2</td>
|
|
61
|
+
<td>Cell 3</td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
64
|
+
<td>Cell 4</td>
|
|
65
|
+
<td>Cell 5</td>
|
|
66
|
+
<td>Cell 6</td>
|
|
67
|
+
</tr>
|
|
68
|
+
</tbody>
|
|
69
|
+
</table>
|
|
70
|
+
),
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const Responsive: Story = {
|
|
74
|
+
render: () => (
|
|
75
|
+
<div className="memori--responsive-table-wrapper">
|
|
76
|
+
<table className="memori--table memori--table--compact">
|
|
77
|
+
<thead>
|
|
78
|
+
<tr>
|
|
79
|
+
<th>Header 1</th>
|
|
80
|
+
<th>Header 2</th>
|
|
81
|
+
<th>Header 3</th>
|
|
82
|
+
</tr>
|
|
83
|
+
</thead>
|
|
84
|
+
<tbody>
|
|
85
|
+
<tr>
|
|
86
|
+
<td>Cell 1</td>
|
|
87
|
+
<td>Cell 2</td>
|
|
88
|
+
<td>Cell 3</td>
|
|
89
|
+
</tr>
|
|
90
|
+
<tr>
|
|
91
|
+
<td>Cell 4</td>
|
|
92
|
+
<td>Cell 5</td>
|
|
93
|
+
<td>Cell 6</td>
|
|
94
|
+
</tr>
|
|
95
|
+
</tbody>
|
|
96
|
+
</table>
|
|
97
|
+
</div>
|
|
98
|
+
),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const WithFooter: Story = {
|
|
102
|
+
render: () => (
|
|
103
|
+
<table className="memori--table memori--table--compact">
|
|
104
|
+
<thead>
|
|
105
|
+
<tr>
|
|
106
|
+
<th>Header 1</th>
|
|
107
|
+
<th>Header 2</th>
|
|
108
|
+
<th>Header 3</th>
|
|
109
|
+
</tr>
|
|
110
|
+
</thead>
|
|
111
|
+
<tbody>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>Cell 1</td>
|
|
114
|
+
<td>Cell 2</td>
|
|
115
|
+
<td>Cell 3</td>
|
|
116
|
+
</tr>
|
|
117
|
+
<tr>
|
|
118
|
+
<td>Cell 4</td>
|
|
119
|
+
<td>Cell 5</td>
|
|
120
|
+
<td>Cell 6</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
<tfoot>
|
|
124
|
+
<tr>
|
|
125
|
+
<td>Footer 1</td>
|
|
126
|
+
<td>Footer 2</td>
|
|
127
|
+
<td>Footer 3</td>
|
|
128
|
+
</tr>
|
|
129
|
+
</tfoot>
|
|
130
|
+
</table>
|
|
131
|
+
),
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const WithColumnsAlignment: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<table className="memori--table memori--table--compact">
|
|
137
|
+
<thead>
|
|
138
|
+
<tr>
|
|
139
|
+
<th>Column aligned left by default</th>
|
|
140
|
+
<th className="memori--table--column-centered">
|
|
141
|
+
Column aligned center
|
|
142
|
+
</th>
|
|
143
|
+
<th className="memori--table--column-right">Column aligned right</th>
|
|
144
|
+
</tr>
|
|
145
|
+
</thead>
|
|
146
|
+
<tbody>
|
|
147
|
+
<tr>
|
|
148
|
+
<td>Cell 1</td>
|
|
149
|
+
<td>Cell 2</td>
|
|
150
|
+
<td>Cell 3</td>
|
|
151
|
+
</tr>
|
|
152
|
+
<tr>
|
|
153
|
+
<td>Cell 4</td>
|
|
154
|
+
<td>Cell 5</td>
|
|
155
|
+
<td>Cell 6</td>
|
|
156
|
+
</tr>
|
|
157
|
+
</tbody>
|
|
158
|
+
</table>
|
|
159
|
+
),
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const WithDateColumn: Story = {
|
|
163
|
+
render: () => (
|
|
164
|
+
<table className="memori--table memori--table--compact">
|
|
165
|
+
<thead>
|
|
166
|
+
<tr>
|
|
167
|
+
<th>Header 1</th>
|
|
168
|
+
<th>Header 2</th>
|
|
169
|
+
<th>Header 3</th>
|
|
170
|
+
</tr>
|
|
171
|
+
</thead>
|
|
172
|
+
<tbody>
|
|
173
|
+
<tr>
|
|
174
|
+
<td>Cell 1</td>
|
|
175
|
+
<td>Cell 2</td>
|
|
176
|
+
<td>Cell 3</td>
|
|
177
|
+
</tr>
|
|
178
|
+
<tr>
|
|
179
|
+
<td className="memori--table--date">2025-01-01</td>
|
|
180
|
+
<td className="memori--table--date">2025-01-02</td>
|
|
181
|
+
<td className="memori--table--date">2025-01-03</td>
|
|
182
|
+
</tr>
|
|
183
|
+
</tbody>
|
|
184
|
+
</table>
|
|
185
|
+
),
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export const WithColumnHiddenOnMobile: Story = {
|
|
189
|
+
render: () => (
|
|
190
|
+
<div className="memori--responsive-table-wrapper">
|
|
191
|
+
<table className="memori--table memori--table--compact">
|
|
192
|
+
<thead>
|
|
193
|
+
<tr>
|
|
194
|
+
<th>Header 1</th>
|
|
195
|
+
<th className="mobile-hidden">Header 2</th>
|
|
196
|
+
<th>Header 3</th>
|
|
197
|
+
</tr>
|
|
198
|
+
</thead>
|
|
199
|
+
<tbody>
|
|
200
|
+
<tr>
|
|
201
|
+
<td>Cell 1</td>
|
|
202
|
+
<td className="mobile-hidden">Cell 2</td>
|
|
203
|
+
<td>Cell 3</td>
|
|
204
|
+
</tr>
|
|
205
|
+
<tr>
|
|
206
|
+
<td>Cell 4</td>
|
|
207
|
+
<td className="mobile-hidden">Cell 5</td>
|
|
208
|
+
<td>Cell 6</td>
|
|
209
|
+
</tr>
|
|
210
|
+
</tbody>
|
|
211
|
+
</table>
|
|
212
|
+
</div>
|
|
213
|
+
),
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export const WithPagination: Story = {
|
|
217
|
+
render: () => (
|
|
218
|
+
<div>
|
|
219
|
+
<nav className="memori--table--pagination">
|
|
220
|
+
<div className="memori--table--pagination--pages">
|
|
221
|
+
<Button
|
|
222
|
+
shape="circle"
|
|
223
|
+
disabled
|
|
224
|
+
padded={false}
|
|
225
|
+
title="Previous page"
|
|
226
|
+
icon={<ChevronLeft />}
|
|
227
|
+
/>
|
|
228
|
+
<div className="memori--table--pagination--pages">1/6</div>
|
|
229
|
+
<Button
|
|
230
|
+
shape="circle"
|
|
231
|
+
padded={false}
|
|
232
|
+
title="Next page"
|
|
233
|
+
icon={<ChevronRight />}
|
|
234
|
+
/>
|
|
235
|
+
</div>
|
|
236
|
+
<Select
|
|
237
|
+
options={[
|
|
238
|
+
{ label: `25 / page`, value: 25 },
|
|
239
|
+
{ label: `50 / page`, value: 50 },
|
|
240
|
+
{ label: `100 / page`, value: 100 },
|
|
241
|
+
]}
|
|
242
|
+
value={25}
|
|
243
|
+
displayValue={`25 / page`}
|
|
244
|
+
onChange={value => {
|
|
245
|
+
console.log(value)
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
</nav>
|
|
249
|
+
<div className="memori--responsive-table-wrapper">
|
|
250
|
+
<table className="memori--table memori--table--compact">
|
|
251
|
+
<thead>
|
|
252
|
+
<tr>
|
|
253
|
+
<th>Header 1</th>
|
|
254
|
+
<th>Header 2</th>
|
|
255
|
+
<th>Header 3</th>
|
|
256
|
+
</tr>
|
|
257
|
+
</thead>
|
|
258
|
+
<tbody>
|
|
259
|
+
<tr>
|
|
260
|
+
<td>Cell 1</td>
|
|
261
|
+
<td>Cell 2</td>
|
|
262
|
+
<td>Cell 3</td>
|
|
263
|
+
</tr>
|
|
264
|
+
<tr>
|
|
265
|
+
<td>Cell 4</td>
|
|
266
|
+
<td>Cell 5</td>
|
|
267
|
+
<td>Cell 6</td>
|
|
268
|
+
</tr>
|
|
269
|
+
</tbody>
|
|
270
|
+
</table>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
),
|
|
274
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
.memori-tooltip {
|
|
2
|
+
position: relative;
|
|
3
|
+
z-index: 1000;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.memori-tooltip--content {
|
|
8
|
+
position: absolute;
|
|
9
|
+
z-index: 1000;
|
|
10
|
+
top: 50%;
|
|
11
|
+
left: 100%;
|
|
12
|
+
display: none;
|
|
13
|
+
width: auto;
|
|
14
|
+
min-width: 200px;
|
|
15
|
+
padding: 10px;
|
|
16
|
+
border-radius: 10px;
|
|
17
|
+
margin-left: 15px;
|
|
18
|
+
background: rgb(0 0 0 / 80%);
|
|
19
|
+
color: #fff;
|
|
20
|
+
font-size: 0.85em;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
text-align: center;
|
|
23
|
+
transform: none;
|
|
24
|
+
transition: 0.3s 0.1s all ease;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.memori-tooltip.memori-tooltip--align-left .memori-tooltip--content,
|
|
28
|
+
.memori-tooltip.memori-tooltip--align-topLeft .memori-tooltip--content {
|
|
29
|
+
right: 100%;
|
|
30
|
+
left: initial;
|
|
31
|
+
margin: initial;
|
|
32
|
+
margin-right: 15px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.memori-tooltip .memori-tooltip--content::before {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 50%;
|
|
38
|
+
left: -15px;
|
|
39
|
+
display: none;
|
|
40
|
+
border: 10px solid rgb(0 0 0 / 80%);
|
|
41
|
+
border-color: transparent rgb(0 0 0 / 80%) transparent transparent;
|
|
42
|
+
margin-left: -5px;
|
|
43
|
+
content: '';
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transform: translateY(-50%);
|
|
46
|
+
transition: 0.3s;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.memori-tooltip.memori-tooltip--align-left .memori-tooltip--content::before {
|
|
50
|
+
right: -15px;
|
|
51
|
+
left: auto;
|
|
52
|
+
border-color: transparent transparent transparent rgb(0 0 0 / 80%);
|
|
53
|
+
margin-right: -5px;
|
|
54
|
+
margin-left: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.memori-tooltip.memori-tooltip--align-topRight .memori-tooltip--content::before {
|
|
58
|
+
top: 100%;
|
|
59
|
+
right: auto;
|
|
60
|
+
left: 10px;
|
|
61
|
+
border-color: rgb(0 0 0 / 80%) transparent transparent;
|
|
62
|
+
margin-top: 10px;
|
|
63
|
+
margin-left: 5px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.memori-tooltip.memori-tooltip--align-topLeft .memori-tooltip--content::before {
|
|
67
|
+
top: 100%;
|
|
68
|
+
right: 10px;
|
|
69
|
+
left: auto;
|
|
70
|
+
border-color: rgb(0 0 0 / 80%) transparent transparent;
|
|
71
|
+
margin-top: 10px;
|
|
72
|
+
margin-left: 5px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.memori-tooltip.memori-tooltip--align-bottomLeft .memori-tooltip--content,
|
|
76
|
+
.memori-tooltip.memori-tooltip--align-bottomRight .memori-tooltip--content {
|
|
77
|
+
top: 100%;
|
|
78
|
+
right: initial;
|
|
79
|
+
left: 50%;
|
|
80
|
+
margin: initial;
|
|
81
|
+
margin-top: 15px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.memori-tooltip.memori-tooltip--align-bottomLeft .memori-tooltip--content::before {
|
|
85
|
+
z-index: 1001;
|
|
86
|
+
top: -15px;
|
|
87
|
+
bottom: initial;
|
|
88
|
+
left: 66%;
|
|
89
|
+
border-color: transparent transparent rgb(0 0 0 / 80%);
|
|
90
|
+
margin-top: 0;
|
|
91
|
+
margin-bottom: initial;
|
|
92
|
+
margin-left: 5px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.memori-tooltip.memori-tooltip--align-bottomRight .memori-tooltip--content::before {
|
|
96
|
+
z-index: 1001;
|
|
97
|
+
top: -15px;
|
|
98
|
+
right: 10px;
|
|
99
|
+
bottom: initial;
|
|
100
|
+
left: auto;
|
|
101
|
+
border-color: transparent transparent rgb(0 0 0 / 80%);
|
|
102
|
+
margin-top: -5px;
|
|
103
|
+
margin-right: 5px;
|
|
104
|
+
margin-bottom: initial;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content,
|
|
108
|
+
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content::before {
|
|
109
|
+
display: block;
|
|
110
|
+
opacity: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content,
|
|
114
|
+
.memori-tooltip:not(.memori-tooltip--disabled, .memori-tooltip--visible):hover .memori-tooltip--content {
|
|
115
|
+
transform: translateY(-50%);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.memori-tooltip:not(.memori-tooltip--visible, .memori-tooltip--disabled):hover .memori-tooltip--content,
|
|
119
|
+
.memori-tooltip:not(.memori-tooltip--visible, .memori-tooltip--disabled):hover .memori-tooltip--content::before {
|
|
120
|
+
display: block;
|
|
121
|
+
opacity: 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.memori-tooltip.memori-tooltip--align-topRight:not(.memori-tooltip--disabled).memori-tooltip--visible
|
|
125
|
+
.memori-tooltip--content,
|
|
126
|
+
.memori-tooltip.memori-tooltip--align-topRight:not(.memori-tooltip--disabled, .memori-tooltip--visible):hover
|
|
127
|
+
.memori-tooltip--content {
|
|
128
|
+
transform: translateY(-150%) translateX(-33%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.memori-tooltip.memori-tooltip--align-topLeft:not(.memori-tooltip--disabled).memori-tooltip--visible
|
|
132
|
+
.memori-tooltip--content,
|
|
133
|
+
.memori-tooltip.memori-tooltip--align-topLeft:not(.memori-tooltip--disabled, .memori-tooltip--visible):hover
|
|
134
|
+
.memori-tooltip--content {
|
|
135
|
+
transform: translateY(-150%) translateX(33%);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content a,
|
|
139
|
+
.memori-tooltip:not(.memori-tooltip--disabled, .memori-tooltip--visible):hover .memori-tooltip--content a {
|
|
140
|
+
color: #fff;
|
|
141
|
+
text-decoration: underline;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.memori-tooltip.memori-tooltip--disabled {
|
|
145
|
+
cursor: not-allowed;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.memori-tooltip.memori-tooltip--align-bottomLeft:not(.memori-tooltip--disabled).memori-tooltip--visible
|
|
149
|
+
.memori-tooltip--content,
|
|
150
|
+
.memori-tooltip.memori-tooltip--align-bottomLeft:not(.memori-tooltip--disabled, .memori-tooltip--visible):hover
|
|
151
|
+
.memori-tooltip--content {
|
|
152
|
+
transform: translateX(-73%);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.memori-tooltip.memori-tooltip--align-bottomRight:not(.memori-tooltip--disabled).memori-tooltip--visible
|
|
156
|
+
.memori-tooltip--content,
|
|
157
|
+
.memori-tooltip.memori-tooltip--align-bottomRight:not(.memori-tooltip--disabled, .memori-tooltip--visible):hover
|
|
158
|
+
.memori-tooltip--content {
|
|
159
|
+
transform: translateX(33%);
|
|
160
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import Tooltip from './Tooltip'
|
|
4
|
+
import './Tooltip.css'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'UI/Tooltip',
|
|
8
|
+
component: Tooltip,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
disabled: {
|
|
12
|
+
control: {
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
parameters: {
|
|
18
|
+
controls: { expanded: true },
|
|
19
|
+
},
|
|
20
|
+
render: args => (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
display: 'flex',
|
|
24
|
+
justifyContent: 'flex-start',
|
|
25
|
+
paddingTop: '10rem',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<Tooltip {...args} />
|
|
29
|
+
</div>
|
|
30
|
+
),
|
|
31
|
+
} satisfies Meta<typeof Tooltip>
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof meta>
|
|
36
|
+
|
|
37
|
+
export const Default: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
content: 'Here is some tooltip content',
|
|
40
|
+
children: <span>Hover me</span>,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const WithJSXContent: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
content: (
|
|
47
|
+
<p>
|
|
48
|
+
Here we have some JSX, useful for{' '}
|
|
49
|
+
<a
|
|
50
|
+
href="https://memori.ai"
|
|
51
|
+
rel="noopener noreferrer"
|
|
52
|
+
target="_blank"
|
|
53
|
+
>
|
|
54
|
+
links
|
|
55
|
+
</a>
|
|
56
|
+
, for example.
|
|
57
|
+
</p>
|
|
58
|
+
),
|
|
59
|
+
children: <span>Hover me</span>,
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Disabled: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
content: 'Here is some tooltip content but I am disabled',
|
|
66
|
+
children: <span>Hover me</span>,
|
|
67
|
+
disabled: true,
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const VisibleControlled: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
content:
|
|
74
|
+
'Here is some tooltip content displayed by default as I am controlled',
|
|
75
|
+
children: <span>Hover me</span>,
|
|
76
|
+
visible: true,
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const AlignLeft: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
content: 'Here is some tooltip content',
|
|
83
|
+
children: <span>Hover me</span>,
|
|
84
|
+
align: 'left',
|
|
85
|
+
visible: true,
|
|
86
|
+
},
|
|
87
|
+
render: args => (
|
|
88
|
+
<div
|
|
89
|
+
style={{
|
|
90
|
+
display: 'flex',
|
|
91
|
+
justifyContent: 'flex-end',
|
|
92
|
+
paddingTop: '10rem',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
<Tooltip {...args} />
|
|
96
|
+
</div>
|
|
97
|
+
),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const AlignRight: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
content: 'Here is some tooltip content',
|
|
103
|
+
children: <span>Hover me</span>,
|
|
104
|
+
align: 'right',
|
|
105
|
+
visible: true,
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const AlignTopLeft: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
content: 'Here is some tooltip content',
|
|
112
|
+
children: <span>Hover me</span>,
|
|
113
|
+
align: 'topLeft',
|
|
114
|
+
visible: true,
|
|
115
|
+
},
|
|
116
|
+
render: args => (
|
|
117
|
+
<div
|
|
118
|
+
style={{
|
|
119
|
+
display: 'flex',
|
|
120
|
+
justifyContent: 'flex-end',
|
|
121
|
+
paddingTop: '10rem',
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<Tooltip {...args} />
|
|
125
|
+
</div>
|
|
126
|
+
),
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const AlignTopRight: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
content: 'Here is some tooltip content',
|
|
132
|
+
children: <span>Hover me</span>,
|
|
133
|
+
align: 'topRight',
|
|
134
|
+
visible: true,
|
|
135
|
+
},
|
|
136
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { it, expect } from 'vitest'
|
|
3
|
+
import { render } from '@testing-library/react'
|
|
4
|
+
import Tooltip from './Tooltip'
|
|
5
|
+
|
|
6
|
+
it('renders Tooltip unchanged', () => {
|
|
7
|
+
const { container } = render(
|
|
8
|
+
<Tooltip content="Here is some tooltip content">Hover me</Tooltip>,
|
|
9
|
+
)
|
|
10
|
+
expect(container).toMatchSnapshot()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('renders Tooltip with jsx content unchanged', () => {
|
|
14
|
+
const { container } = render(
|
|
15
|
+
<Tooltip
|
|
16
|
+
content={
|
|
17
|
+
<p>
|
|
18
|
+
Here we have some JSX, useful for
|
|
19
|
+
<a
|
|
20
|
+
href="https://memori.ai"
|
|
21
|
+
rel="noopener noreferrer"
|
|
22
|
+
target="_blank"
|
|
23
|
+
>
|
|
24
|
+
links
|
|
25
|
+
</a>
|
|
26
|
+
, for example.
|
|
27
|
+
</p>
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
Hover me
|
|
31
|
+
</Tooltip>,
|
|
32
|
+
)
|
|
33
|
+
expect(container).toMatchSnapshot()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('renders Tooltip disabled unchanged', () => {
|
|
37
|
+
const { container } = render(
|
|
38
|
+
<Tooltip
|
|
39
|
+
content="Here is some tooltip content but I am disabled"
|
|
40
|
+
disabled
|
|
41
|
+
>
|
|
42
|
+
Hover me
|
|
43
|
+
</Tooltip>,
|
|
44
|
+
)
|
|
45
|
+
expect(container).toMatchSnapshot()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('renders Tooltip visible unchanged', () => {
|
|
49
|
+
const { container } = render(
|
|
50
|
+
<Tooltip
|
|
51
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
52
|
+
visible
|
|
53
|
+
>
|
|
54
|
+
Hover me
|
|
55
|
+
</Tooltip>,
|
|
56
|
+
)
|
|
57
|
+
expect(container).toMatchSnapshot()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('renders Tooltip aligned left unchanged', () => {
|
|
61
|
+
const { container } = render(
|
|
62
|
+
<Tooltip
|
|
63
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
64
|
+
visible
|
|
65
|
+
align="left"
|
|
66
|
+
>
|
|
67
|
+
Hover me
|
|
68
|
+
</Tooltip>,
|
|
69
|
+
)
|
|
70
|
+
expect(container).toMatchSnapshot()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('renders Tooltip aligned top left unchanged', () => {
|
|
74
|
+
const { container } = render(
|
|
75
|
+
<Tooltip
|
|
76
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
77
|
+
visible
|
|
78
|
+
align="topLeft"
|
|
79
|
+
>
|
|
80
|
+
Hover me
|
|
81
|
+
</Tooltip>,
|
|
82
|
+
)
|
|
83
|
+
expect(container).toMatchSnapshot()
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('renders Tooltip aligned right unchanged', () => {
|
|
87
|
+
const { container } = render(
|
|
88
|
+
<Tooltip
|
|
89
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
90
|
+
visible
|
|
91
|
+
align="right"
|
|
92
|
+
>
|
|
93
|
+
Hover me
|
|
94
|
+
</Tooltip>,
|
|
95
|
+
)
|
|
96
|
+
expect(container).toMatchSnapshot()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('renders Tooltip aligned top right unchanged', () => {
|
|
100
|
+
const { container } = render(
|
|
101
|
+
<Tooltip
|
|
102
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
103
|
+
visible
|
|
104
|
+
align="topRight"
|
|
105
|
+
>
|
|
106
|
+
Hover me
|
|
107
|
+
</Tooltip>,
|
|
108
|
+
)
|
|
109
|
+
expect(container).toMatchSnapshot()
|
|
110
|
+
})
|