@appdirect/design-system 0.0.9 → 0.0.11
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 +2 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
- package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
- package/dist/contracts/PageContentHeader.json +10 -5
- package/dist/contracts/index.json +1 -1
- package/dist/index.ts +3 -4
- package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
- package/dist/stories/Buttons/Button.stories.tsx +145 -0
- package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
- package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
- package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
- package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
- package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
- package/dist/stories/Combobox/Select.stories.tsx +311 -0
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
- package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
- package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
- package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
- package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
- package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
- package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
- package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
- package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
- package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
- package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
- package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
- package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
- package/dist/stories/DataDisplay/List.stories.tsx +376 -0
- package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
- package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
- package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
- package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
- package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
- package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
- package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
- package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
- package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
- package/dist/stories/Inputs/Radio.stories.tsx +437 -0
- package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
- package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
- package/dist/stories/Inputs/Slider.stories.tsx +22 -0
- package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
- package/dist/stories/Inputs/Switch.stories.tsx +361 -0
- package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
- package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
- package/dist/stories/Misc/Divider.stories.tsx +581 -0
- package/dist/stories/Misc/Paper.stories.tsx +557 -0
- package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
- package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
- package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
- package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
- package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
- package/dist/stories/Overlays/Menu.stories.tsx +941 -0
- package/dist/stories/Overlays/Modal.stories.tsx +249 -0
- package/dist/stories/Overlays/Popover.stories.tsx +780 -0
- package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
- package/dist/stories/Typography/Code.stories.tsx +368 -0
- package/dist/stories/Typography/Kbd.stories.tsx +514 -0
- package/dist/stories/Typography/Text.stories.tsx +117 -0
- package/dist/stories/Typography/Title.stories.tsx +112 -0
- package/dist/stories/index.json +1435 -0
- package/package.json +5 -3
- package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Inline, Stack, Modal, ConfirmationModal, Title, Text, TextInput, TextArea, Switch, Button } from '@appdirect/design-system';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Modal> = {
|
|
6
|
+
title: 'Design System/Overlays/Modal',
|
|
7
|
+
component: Modal,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'Modal component for displaying overlay content with a Mantine-aligned shell API and composed children.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs', 'code-connected'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
21
|
+
description: 'Modal size',
|
|
22
|
+
},
|
|
23
|
+
title: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Modal title',
|
|
26
|
+
},
|
|
27
|
+
padding: {
|
|
28
|
+
control: 'select',
|
|
29
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
30
|
+
description: 'Modal content padding',
|
|
31
|
+
},
|
|
32
|
+
withCloseButton: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: 'Whether to show close button in the header',
|
|
35
|
+
},
|
|
36
|
+
closeOnClickOutside: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Whether modal can be closed by clicking overlay',
|
|
39
|
+
},
|
|
40
|
+
closeOnEscape: {
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
description: 'Whether modal can be closed by pressing Escape',
|
|
43
|
+
},
|
|
44
|
+
centered: {
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
description: 'Whether to center the modal vertically',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
type Story = StoryObj<typeof meta>;
|
|
53
|
+
|
|
54
|
+
export const Default: Story = {
|
|
55
|
+
render: () => {
|
|
56
|
+
const [opened, setOpened] = useState(false);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<Button onClick={() => setOpened(true)}>Open Modal</Button>
|
|
61
|
+
|
|
62
|
+
<Modal opened={opened} onClose={() => setOpened(false)} title="Default Modal">
|
|
63
|
+
<Text>This is a basic modal with default settings.</Text>
|
|
64
|
+
</Modal>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Sizes: Story = {
|
|
71
|
+
render: () => {
|
|
72
|
+
const [openedSize, setOpenedSize] = useState<string | null>(null);
|
|
73
|
+
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<Inline gap="sm">
|
|
78
|
+
{sizes.map((size) => (
|
|
79
|
+
<Button key={size} variant="outline" onClick={() => setOpenedSize(size)}>
|
|
80
|
+
{size.toUpperCase()}
|
|
81
|
+
</Button>
|
|
82
|
+
))}
|
|
83
|
+
</Inline>
|
|
84
|
+
|
|
85
|
+
{sizes.map((size) => (
|
|
86
|
+
<Modal
|
|
87
|
+
key={size}
|
|
88
|
+
opened={openedSize === size}
|
|
89
|
+
onClose={() => setOpenedSize(null)}
|
|
90
|
+
title={`${size.toUpperCase()} Modal`}
|
|
91
|
+
size={size}
|
|
92
|
+
>
|
|
93
|
+
<Text>This is a {size} sized modal. The content area adjusts to the modal size.</Text>
|
|
94
|
+
</Modal>
|
|
95
|
+
))}
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const ComposedConfirmation: Story = {
|
|
102
|
+
render: () => {
|
|
103
|
+
const [opened, setOpened] = useState(false);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<>
|
|
107
|
+
<Button onClick={() => setOpened(true)}>Open Confirmation Modal</Button>
|
|
108
|
+
|
|
109
|
+
<Modal opened={opened} onClose={() => setOpened(false)} title="Delete Item" size="sm">
|
|
110
|
+
<Stack gap="md">
|
|
111
|
+
<Text>This action cannot be undone. Are you sure you want to delete this item?</Text>
|
|
112
|
+
<Inline justify="flex-end" gap="sm">
|
|
113
|
+
<Button variant="outline" onClick={() => setOpened(false)}>
|
|
114
|
+
Cancel
|
|
115
|
+
</Button>
|
|
116
|
+
<Button variant="danger" onClick={() => setOpened(false)}>
|
|
117
|
+
Delete
|
|
118
|
+
</Button>
|
|
119
|
+
</Inline>
|
|
120
|
+
</Stack>
|
|
121
|
+
</Modal>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const FormModal: Story = {
|
|
128
|
+
render: () => {
|
|
129
|
+
const [opened, setOpened] = useState(false);
|
|
130
|
+
const [formData, setFormData] = useState({
|
|
131
|
+
name: '',
|
|
132
|
+
description: '',
|
|
133
|
+
active: false,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<>
|
|
138
|
+
<Button onClick={() => setOpened(true)}>Open Form Modal</Button>
|
|
139
|
+
|
|
140
|
+
<Modal opened={opened} onClose={() => setOpened(false)} title="Create New Item" size="md">
|
|
141
|
+
<Stack gap="md">
|
|
142
|
+
<TextInput
|
|
143
|
+
label="Name"
|
|
144
|
+
placeholder="Enter item name..."
|
|
145
|
+
value={formData.name}
|
|
146
|
+
onChange={(event) => setFormData((prev) => ({ ...prev, name: event.target.value }))}
|
|
147
|
+
required
|
|
148
|
+
/>
|
|
149
|
+
<TextArea
|
|
150
|
+
label="Description"
|
|
151
|
+
placeholder="Enter description..."
|
|
152
|
+
value={formData.description}
|
|
153
|
+
onChange={(event) =>
|
|
154
|
+
setFormData((prev) => ({ ...prev, description: event.target.value }))
|
|
155
|
+
}
|
|
156
|
+
rows={3}
|
|
157
|
+
/>
|
|
158
|
+
<Switch
|
|
159
|
+
label="Active"
|
|
160
|
+
checked={formData.active}
|
|
161
|
+
onChange={(event) =>
|
|
162
|
+
setFormData((prev) => ({ ...prev, active: event.target.checked }))
|
|
163
|
+
}
|
|
164
|
+
/>
|
|
165
|
+
<Inline justify="space-between" gap="sm">
|
|
166
|
+
<Button variant="default" onClick={() => setFormData({ name: '', description: '', active: false })}>
|
|
167
|
+
Reset Form
|
|
168
|
+
</Button>
|
|
169
|
+
<Inline justify="flex-end" gap="sm">
|
|
170
|
+
<Button variant="outline" onClick={() => setOpened(false)}>
|
|
171
|
+
Cancel
|
|
172
|
+
</Button>
|
|
173
|
+
<Button variant="primary" disabled={!formData.name.trim()} onClick={() => setOpened(false)}>
|
|
174
|
+
Create Item
|
|
175
|
+
</Button>
|
|
176
|
+
</Inline>
|
|
177
|
+
</Inline>
|
|
178
|
+
</Stack>
|
|
179
|
+
</Modal>
|
|
180
|
+
</>
|
|
181
|
+
);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const ConfirmationHelper: Story = {
|
|
186
|
+
render: () => {
|
|
187
|
+
const [confirmOpened, setConfirmOpened] = useState(false);
|
|
188
|
+
const [deleteOpened, setDeleteOpened] = useState(false);
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<>
|
|
192
|
+
<Inline gap="sm">
|
|
193
|
+
<Button variant="outline" onClick={() => setConfirmOpened(true)}>
|
|
194
|
+
Basic Confirmation
|
|
195
|
+
</Button>
|
|
196
|
+
<Button variant="outline" onClick={() => setDeleteOpened(true)}>
|
|
197
|
+
Delete Confirmation
|
|
198
|
+
</Button>
|
|
199
|
+
</Inline>
|
|
200
|
+
|
|
201
|
+
<ConfirmationModal
|
|
202
|
+
opened={confirmOpened}
|
|
203
|
+
onClose={() => setConfirmOpened(false)}
|
|
204
|
+
title="Confirm Action"
|
|
205
|
+
onConfirm={() => setConfirmOpened(false)}
|
|
206
|
+
onCancel={() => setConfirmOpened(false)}
|
|
207
|
+
>
|
|
208
|
+
<Text>Are you sure you want to perform this action?</Text>
|
|
209
|
+
</ConfirmationModal>
|
|
210
|
+
|
|
211
|
+
<ConfirmationModal
|
|
212
|
+
opened={deleteOpened}
|
|
213
|
+
onClose={() => setDeleteOpened(false)}
|
|
214
|
+
title="Delete Item"
|
|
215
|
+
confirmLabel="Delete"
|
|
216
|
+
confirmVariant="danger"
|
|
217
|
+
onConfirm={() => setDeleteOpened(false)}
|
|
218
|
+
onCancel={() => setDeleteOpened(false)}
|
|
219
|
+
>
|
|
220
|
+
<Text>This action cannot be undone. Are you sure you want to delete this item?</Text>
|
|
221
|
+
</ConfirmationModal>
|
|
222
|
+
</>
|
|
223
|
+
);
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const Interactive: Story = {
|
|
228
|
+
args: {
|
|
229
|
+
title: 'Interactive Modal',
|
|
230
|
+
size: 'md',
|
|
231
|
+
withCloseButton: true,
|
|
232
|
+
closeOnClickOutside: true,
|
|
233
|
+
closeOnEscape: true,
|
|
234
|
+
centered: true,
|
|
235
|
+
padding: 'md',
|
|
236
|
+
children: 'Use the controls below to interact with the Modal and see different combinations.',
|
|
237
|
+
},
|
|
238
|
+
render: (args) => {
|
|
239
|
+
const [opened, setOpened] = useState(false);
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<>
|
|
243
|
+
<Button onClick={() => setOpened(true)}>Open Interactive Modal</Button>
|
|
244
|
+
|
|
245
|
+
<Modal {...args} opened={opened} onClose={() => setOpened(false)} />
|
|
246
|
+
</>
|
|
247
|
+
);
|
|
248
|
+
},
|
|
249
|
+
};
|