@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
package/README.md
CHANGED
|
@@ -11,3 +11,5 @@ import '@appdirect/ad-design-tokens/css/foundations.css';
|
|
|
11
11
|
import '@appdirect/ad-design-tokens/css/mantine.css';
|
|
12
12
|
import { Button, TextInput, Stack } from '@appdirect/design-system';
|
|
13
13
|
```
|
|
14
|
+
|
|
15
|
+
The Storybook stories ship as reference patterns in `dist/stories/`, with design-system imports pointing at `@appdirect/design-system`. `@appdirect/design-system/stories` is an index of every story file: title, component, description, story names, and the components it imports. Stories are not compiled or exported as code. The build fails when a story imports a Mantine component the design system has not adopted.
|
|
@@ -13,15 +13,15 @@ import { ThemeIcon } from '../../DataDisplay/ThemeIcon';
|
|
|
13
13
|
import { Text } from '../../Typography/Text';
|
|
14
14
|
import { Title } from '../../Typography/Title';
|
|
15
15
|
import { Card } from '../../DataDisplay/Card';
|
|
16
|
+
import { Alert } from '../../DataDisplay/Alert';
|
|
16
17
|
import { useDisclosure } from '@mantine/hooks';
|
|
17
18
|
import { RiEditLine, RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react';
|
|
18
19
|
import { KeyInsight, KeyInsightProps } from '../KeyInsight';
|
|
19
20
|
import { NameValue, NameValuePair } from '../NameValue';
|
|
20
|
-
import { DescriptionBlock } from './DescriptionBlock';
|
|
21
21
|
|
|
22
22
|
// ========================== TYPES ==========================
|
|
23
23
|
|
|
24
|
-
export type ContentSection = 'insights' | 'description' | '
|
|
24
|
+
export type ContentSection = 'insights' | 'description' | 'nameValuePairs' | 'drawer';
|
|
25
25
|
|
|
26
26
|
export interface PageContentHeaderProps {
|
|
27
27
|
// ==================== HEADER SECTION ====================
|
|
@@ -51,10 +51,16 @@ export interface PageContentHeaderProps {
|
|
|
51
51
|
variant?: 'primary' | 'secondary' | 'default' | 'disabled' | 'link' | 'secret' | 'outline' | 'danger';
|
|
52
52
|
}>;
|
|
53
53
|
|
|
54
|
+
// ==================== PANEL NOTIFICATION ====================
|
|
55
|
+
/** Whether to show a panel notification banner below the header */
|
|
56
|
+
panelNotification?: boolean;
|
|
57
|
+
/** Content for the panel notification (ignored when panelNotification is false) */
|
|
58
|
+
panelNotificationMessage?: React.ReactNode;
|
|
59
|
+
|
|
54
60
|
// ==================== CONTENT SECTIONS (MUTUALLY EXCLUSIVE) ====================
|
|
55
|
-
/** Which content section to display. Content sections bleed to edges like Card.Section */
|
|
56
|
-
contentSection
|
|
57
|
-
|
|
61
|
+
/** Which content section to display, if any. Content sections bleed to edges like Card.Section */
|
|
62
|
+
contentSection?: ContentSection;
|
|
63
|
+
|
|
58
64
|
// Key Insights Section
|
|
59
65
|
/** Array of key insights to display */
|
|
60
66
|
insights?: Omit<KeyInsightProps, 'showBorder'>[];
|
|
@@ -66,15 +72,7 @@ export interface PageContentHeaderProps {
|
|
|
66
72
|
description?: string;
|
|
67
73
|
/** Whether description supports markdown/links */
|
|
68
74
|
allowLinks?: boolean;
|
|
69
|
-
|
|
70
|
-
// DescriptionBlock Section
|
|
71
|
-
/** Title for the description block */
|
|
72
|
-
descriptionBlockTitle?: string;
|
|
73
|
-
/** Description text for the description block */
|
|
74
|
-
descriptionBlockText?: string;
|
|
75
|
-
/** Whether description block supports HTML/links */
|
|
76
|
-
descriptionBlockAllowHtml?: boolean;
|
|
77
|
-
|
|
75
|
+
|
|
78
76
|
// Name Value Pairs Section
|
|
79
77
|
/** Array of name-value pairs */
|
|
80
78
|
nameValuePairs?: NameValuePair[];
|
|
@@ -123,16 +121,17 @@ export function PageContentHeader({
|
|
|
123
121
|
|
|
124
122
|
// Action props
|
|
125
123
|
actions = [],
|
|
126
|
-
|
|
124
|
+
|
|
125
|
+
// Panel notification props
|
|
126
|
+
panelNotification = false,
|
|
127
|
+
panelNotificationMessage,
|
|
128
|
+
|
|
127
129
|
// Content props
|
|
128
130
|
contentSection,
|
|
129
131
|
insights = [],
|
|
130
132
|
descriptionTitle,
|
|
131
133
|
description,
|
|
132
134
|
allowLinks = false,
|
|
133
|
-
descriptionBlockTitle,
|
|
134
|
-
descriptionBlockText,
|
|
135
|
-
descriptionBlockAllowHtml,
|
|
136
135
|
nameValuePairs = [],
|
|
137
136
|
nameValueColumns = 2,
|
|
138
137
|
drawerContent,
|
|
@@ -272,19 +271,6 @@ export function PageContentHeader({
|
|
|
272
271
|
);
|
|
273
272
|
};
|
|
274
273
|
|
|
275
|
-
const renderDescriptionBlock = () => {
|
|
276
|
-
if (!descriptionBlockText) return null;
|
|
277
|
-
|
|
278
|
-
// DescriptionBlock bleeds to edges - no padding wrapper
|
|
279
|
-
return (
|
|
280
|
-
<DescriptionBlock
|
|
281
|
-
title={descriptionBlockTitle}
|
|
282
|
-
description={descriptionBlockText}
|
|
283
|
-
allowHtml={descriptionBlockAllowHtml}
|
|
284
|
-
/>
|
|
285
|
-
);
|
|
286
|
-
};
|
|
287
|
-
|
|
288
274
|
const renderNameValuePairs = () => (
|
|
289
275
|
<Box p={spacing}>
|
|
290
276
|
<NameValue
|
|
@@ -342,8 +328,6 @@ export function PageContentHeader({
|
|
|
342
328
|
return renderKeyInsights();
|
|
343
329
|
case 'description':
|
|
344
330
|
return renderDescription();
|
|
345
|
-
case 'descriptionBlock':
|
|
346
|
-
return renderDescriptionBlock();
|
|
347
331
|
case 'nameValuePairs':
|
|
348
332
|
return renderNameValuePairs();
|
|
349
333
|
case 'drawer':
|
|
@@ -370,8 +354,14 @@ export function PageContentHeader({
|
|
|
370
354
|
{renderActions()}
|
|
371
355
|
</Box>
|
|
372
356
|
)}
|
|
357
|
+
{/* Panel notification */}
|
|
358
|
+
{panelNotification && (
|
|
359
|
+
<Alert color="info">
|
|
360
|
+
{panelNotificationMessage}
|
|
361
|
+
</Alert>
|
|
362
|
+
)}
|
|
373
363
|
</Stack>
|
|
374
|
-
|
|
364
|
+
|
|
375
365
|
{/* Content Section - uses Card.Section to bleed to edges */}
|
|
376
366
|
{contentSection_ && (
|
|
377
367
|
<Card.Section withBorder mt="md">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "../../contracts/ds-component-contract.v1.json",
|
|
3
3
|
"id": "PageContentHeader",
|
|
4
4
|
"kind": "complex",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"purpose": "Required page header for prototype pages. AppDirect composition; Mantine has no page-content-header.",
|
|
7
7
|
"importFrom": [
|
|
8
8
|
"@appdirect/design-system"
|
|
@@ -52,17 +52,23 @@
|
|
|
52
52
|
},
|
|
53
53
|
"notes": "Actions use DS Button variants, not a Mantine variant map."
|
|
54
54
|
},
|
|
55
|
+
"panelNotification": {
|
|
56
|
+
"type": "boolean"
|
|
57
|
+
},
|
|
58
|
+
"panelNotificationMessage": {
|
|
59
|
+
"type": "ReactNode",
|
|
60
|
+
"notes": "Ignored when panelNotification is false. Orthogonal to contentSection - can be shown alongside any section, or none."
|
|
61
|
+
},
|
|
55
62
|
"contentSection": {
|
|
56
63
|
"enum": [
|
|
57
64
|
"insights",
|
|
58
65
|
"description",
|
|
59
|
-
"descriptionBlock",
|
|
60
66
|
"nameValuePairs",
|
|
61
67
|
"drawer"
|
|
62
68
|
],
|
|
63
|
-
"required":
|
|
69
|
+
"required": false,
|
|
64
70
|
"exclusive": true,
|
|
65
|
-
"notes": "Mutually exclusive content slots. Do not pass more than one section's data as if they compose."
|
|
71
|
+
"notes": "Mutually exclusive content slots. Do not pass more than one section's data as if they compose. Omit entirely for a header-only layout (Figma's 'default' variant)."
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
},
|
|
@@ -81,7 +87,6 @@
|
|
|
81
87
|
"ThemeIcon",
|
|
82
88
|
"KeyInsight",
|
|
83
89
|
"NameValue",
|
|
84
|
-
"DescriptionBlock",
|
|
85
90
|
"Inline",
|
|
86
91
|
"Stack"
|
|
87
92
|
],
|
package/dist/index.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { AppShellLayout, HeaderBar, SidebarNav, SidebarNavLink, SingleColumnLayo
|
|
|
28
28
|
import { KeyInsight } from './ComplexComponents/KeyInsight';
|
|
29
29
|
import { NameValue, NameValueItem } from './ComplexComponents/NameValue';
|
|
30
30
|
import { CopyButton } from './ComplexComponents/Utilities';
|
|
31
|
-
import { PageContentHeader
|
|
31
|
+
import { PageContentHeader } from './ComplexComponents/PageContentHeader';
|
|
32
32
|
import { DataTable } from './ComplexComponents/DataTable';
|
|
33
33
|
import { DashboardWidget } from './ComplexComponents/DashboardWidget';
|
|
34
34
|
import { Placeholder } from './ComplexComponents/Placeholder';
|
|
@@ -93,8 +93,8 @@ export { NameValue, NameValueItem } from './ComplexComponents/NameValue';
|
|
|
93
93
|
export type { NameValueProps, NameValuePair, NameValueItemProps } from './ComplexComponents/NameValue';
|
|
94
94
|
export { CopyButton } from './ComplexComponents/Utilities';
|
|
95
95
|
export type { CopyButtonProps } from './ComplexComponents/Utilities';
|
|
96
|
-
export { PageContentHeader
|
|
97
|
-
export type { PageContentHeaderProps, ContentSection
|
|
96
|
+
export { PageContentHeader } from './ComplexComponents/PageContentHeader';
|
|
97
|
+
export type { PageContentHeaderProps, ContentSection } from './ComplexComponents/PageContentHeader';
|
|
98
98
|
export { DataTable } from './ComplexComponents/DataTable';
|
|
99
99
|
export type { DataTableProps, DataTableColumn, PageInfo } from './ComplexComponents/DataTable';
|
|
100
100
|
export { DashboardWidget } from './ComplexComponents/DashboardWidget';
|
|
@@ -208,7 +208,6 @@ export const ComplexComponents = {
|
|
|
208
208
|
NameValueItem,
|
|
209
209
|
CopyButton,
|
|
210
210
|
PageContentHeader,
|
|
211
|
-
DescriptionBlock,
|
|
212
211
|
DataTable,
|
|
213
212
|
DashboardWidget,
|
|
214
213
|
Placeholder,
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { ActionIcon } from '@appdirect/design-system';
|
|
3
|
+
import { RiAddLine, RiEditLine, RiDeleteBinLine, RiEyeLine, RiDownloadLine, RiSettingsLine, RiMore2Fill } from '@remixicon/react';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ActionIcon> = {
|
|
6
|
+
title: 'Design System/Buttons/ActionIcon',
|
|
7
|
+
component: ActionIcon,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'ActionIcon component for icon-based actions with consistent sizing and subtle styling.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs', 'code-connected'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
variant: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['default', 'outline', 'link'],
|
|
21
|
+
description: 'Visual style variant',
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
26
|
+
description: 'Size of the action button',
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Disabled state',
|
|
31
|
+
},
|
|
32
|
+
children: {
|
|
33
|
+
control: false,
|
|
34
|
+
description: 'Icon content (React element)',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
|
|
42
|
+
export const Default: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
children: <RiEditLine size={16} />,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Variants: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
51
|
+
<div style={{ textAlign: 'center' }}>
|
|
52
|
+
<ActionIcon variant="default"><RiEditLine size={16} /></ActionIcon>
|
|
53
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Default</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div style={{ textAlign: 'center' }}>
|
|
56
|
+
<ActionIcon variant="outline"><RiEditLine size={16} /></ActionIcon>
|
|
57
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Outline</div>
|
|
58
|
+
</div>
|
|
59
|
+
<div style={{ textAlign: 'center' }}>
|
|
60
|
+
<ActionIcon variant="link"><RiEditLine size={16} /></ActionIcon>
|
|
61
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Link</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Sizes: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
70
|
+
<div style={{ textAlign: 'center' }}>
|
|
71
|
+
<ActionIcon size="xs"><RiEditLine size={12} /></ActionIcon>
|
|
72
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>xs</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div style={{ textAlign: 'center' }}>
|
|
75
|
+
<ActionIcon size="sm"><RiEditLine size={14} /></ActionIcon>
|
|
76
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>sm</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div style={{ textAlign: 'center' }}>
|
|
79
|
+
<ActionIcon size="md"><RiEditLine size={16} /></ActionIcon>
|
|
80
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>md</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div style={{ textAlign: 'center' }}>
|
|
83
|
+
<ActionIcon size="lg"><RiEditLine size={18} /></ActionIcon>
|
|
84
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>lg</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div style={{ textAlign: 'center' }}>
|
|
87
|
+
<ActionIcon size="xl"><RiEditLine size={20} /></ActionIcon>
|
|
88
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>xl</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const CommonActions: Story = {
|
|
95
|
+
render: () => (
|
|
96
|
+
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
|
|
97
|
+
<ActionIcon><RiAddLine size={16} /></ActionIcon>
|
|
98
|
+
<ActionIcon><RiEditLine size={16} /></ActionIcon>
|
|
99
|
+
<ActionIcon><RiDeleteBinLine size={16} /></ActionIcon>
|
|
100
|
+
<ActionIcon><RiEyeLine size={16} /></ActionIcon>
|
|
101
|
+
<ActionIcon><RiDownloadLine size={16} /></ActionIcon>
|
|
102
|
+
<ActionIcon><RiSettingsLine size={16} /></ActionIcon>
|
|
103
|
+
</div>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const States: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
110
|
+
<div style={{ textAlign: 'center' }}>
|
|
111
|
+
<ActionIcon><RiEditLine size={16} /></ActionIcon>
|
|
112
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Normal</div>
|
|
113
|
+
</div>
|
|
114
|
+
<div style={{ textAlign: 'center' }}>
|
|
115
|
+
<ActionIcon disabled><RiEditLine size={16} /></ActionIcon>
|
|
116
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Disabled</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const CustomStyling: Story = {
|
|
123
|
+
render: () => (
|
|
124
|
+
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
125
|
+
<div style={{ textAlign: 'center' }}>
|
|
126
|
+
<ActionIcon>
|
|
127
|
+
<RiAddLine size={16} style={{ color: 'var(--mantine-color-blue-6)' }} />
|
|
128
|
+
</ActionIcon>
|
|
129
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Blue Theme</div>
|
|
130
|
+
</div>
|
|
131
|
+
<div style={{ textAlign: 'center' }}>
|
|
132
|
+
<ActionIcon>
|
|
133
|
+
<RiDeleteBinLine size={16} style={{ color: 'var(--mantine-color-red-6)' }} />
|
|
134
|
+
</ActionIcon>
|
|
135
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Red Theme</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div style={{ textAlign: 'center' }}>
|
|
138
|
+
<ActionIcon size="xl" style={{ width: 48, height: 48 }}>
|
|
139
|
+
<RiMore2Fill size={24} />
|
|
140
|
+
</ActionIcon>
|
|
141
|
+
<div style={{ fontSize: '12px', marginTop: '4px' }}>Custom Size</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const Interactive: Story = {
|
|
148
|
+
args: {
|
|
149
|
+
children: <RiEditLine size={16} />,
|
|
150
|
+
size: 'md',
|
|
151
|
+
},
|
|
152
|
+
parameters: {
|
|
153
|
+
docs: {
|
|
154
|
+
description: {
|
|
155
|
+
story: 'Use the controls below to interact with the ActionIcon and see different combinations.',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Button, Inline } from '@appdirect/design-system';
|
|
3
|
+
import { Stack } from '@mantine/core';
|
|
4
|
+
import { RiAddLine, RiDownloadLine, RiDeleteBinLine, RiEyeLine } from '@remixicon/react';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Button> = {
|
|
7
|
+
title: 'Design System/Buttons/Button',
|
|
8
|
+
component: Button,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'Enhanced Button component with design system variants, t-shirt sizing, and consistent styling.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
tags: ['autodocs', 'code-connected'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
variant: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['primary', 'secondary', 'default', 'disabled', 'link', 'secret', 'outline', 'danger'],
|
|
22
|
+
description: 'Button style variant',
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
27
|
+
description: 'Button size',
|
|
28
|
+
},
|
|
29
|
+
color: {
|
|
30
|
+
control: 'select',
|
|
31
|
+
options: ['primary', 'secondary', 'success', 'warning', 'danger'],
|
|
32
|
+
description: 'Button color theme',
|
|
33
|
+
},
|
|
34
|
+
children: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Button content',
|
|
37
|
+
},
|
|
38
|
+
loading: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Loading state with spinner',
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
description: 'Disabled state',
|
|
45
|
+
},
|
|
46
|
+
fullWidth: {
|
|
47
|
+
control: 'boolean',
|
|
48
|
+
description: 'Full width button',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
export const Default: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
children: 'Button',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Variants: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<Stack gap="md">
|
|
65
|
+
<Button variant="primary">Primary</Button>
|
|
66
|
+
<Button variant="secondary">Secondary</Button>
|
|
67
|
+
<Button variant="default">Default</Button>
|
|
68
|
+
<Button variant="outline">Outline</Button>
|
|
69
|
+
<Button variant="danger">Danger</Button>
|
|
70
|
+
<Button variant="link">Link</Button>
|
|
71
|
+
<Button variant="secret">Secret</Button>
|
|
72
|
+
<Button variant="disabled">Disabled</Button>
|
|
73
|
+
</Stack>
|
|
74
|
+
),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const Sizes: Story = {
|
|
78
|
+
render: () => (
|
|
79
|
+
<Stack gap="md">
|
|
80
|
+
<Button size="xs">Extra Small</Button>
|
|
81
|
+
<Button size="sm">Small</Button>
|
|
82
|
+
<Button size="md">Medium</Button>
|
|
83
|
+
<Button size="lg">Large</Button>
|
|
84
|
+
<Button size="xl">Extra Large</Button>
|
|
85
|
+
</Stack>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const WithIcons: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<Stack gap="md">
|
|
92
|
+
<Button leftSection={<RiAddLine size={16} />}>Add Item</Button>
|
|
93
|
+
<Button rightSection={<RiDownloadLine size={16} />}>Download</Button>
|
|
94
|
+
<Button variant="danger" leftSection={<RiDeleteBinLine size={16} />}>Delete</Button>
|
|
95
|
+
<Button variant="outline" leftSection={<RiEyeLine size={16} />} rightSection={<RiDownloadLine size={16} />}>
|
|
96
|
+
View & Download
|
|
97
|
+
</Button>
|
|
98
|
+
</Stack>
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const States: Story = {
|
|
103
|
+
render: () => (
|
|
104
|
+
<Stack gap="md">
|
|
105
|
+
<Button>Normal</Button>
|
|
106
|
+
<Button loading>Loading</Button>
|
|
107
|
+
<Button disabled>Disabled</Button>
|
|
108
|
+
<Button variant="primary" loading>
|
|
109
|
+
Processing
|
|
110
|
+
</Button>
|
|
111
|
+
</Stack>
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const FullWidth: Story = {
|
|
116
|
+
render: () => (
|
|
117
|
+
<Stack gap="md" w="600px">
|
|
118
|
+
<Button fullWidth variant="secondary">
|
|
119
|
+
Full Width Button
|
|
120
|
+
</Button>
|
|
121
|
+
</Stack>
|
|
122
|
+
),
|
|
123
|
+
parameters: {
|
|
124
|
+
docs: {
|
|
125
|
+
description: {
|
|
126
|
+
story: 'Button can take the full width of its container.',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const Interactive: Story = {
|
|
133
|
+
args: {
|
|
134
|
+
children: 'Click me',
|
|
135
|
+
variant: 'primary',
|
|
136
|
+
size: 'md',
|
|
137
|
+
},
|
|
138
|
+
parameters: {
|
|
139
|
+
docs: {
|
|
140
|
+
description: {
|
|
141
|
+
story: 'Use the controls below to interact with the button and see different combinations.',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack } from '@mantine/core';
|
|
3
|
+
import { Inline, CloseButton, Title, Text, Alert, Paper } from '@appdirect/design-system';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof CloseButton> = {
|
|
6
|
+
title: 'Design System/Buttons/CloseButton',
|
|
7
|
+
component: CloseButton,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'CloseButton component for dismissing modals, alerts, and other UI elements with consistent sizing.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs', 'code-connected'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
21
|
+
description: 'Size of the close button',
|
|
22
|
+
},
|
|
23
|
+
color: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['black', 'blue'],
|
|
26
|
+
description: 'Color variant of the close button',
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Disabled state',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {
|
|
39
|
+
args: {},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Sizes: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<Inline gap="sm" align="center">
|
|
45
|
+
<CloseButton size="xs" />
|
|
46
|
+
<CloseButton size="sm" />
|
|
47
|
+
<CloseButton size="md" />
|
|
48
|
+
<CloseButton size="lg" />
|
|
49
|
+
<CloseButton size="xl" />
|
|
50
|
+
</Inline>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Colors: Story = {
|
|
55
|
+
render: () => (
|
|
56
|
+
<Inline gap="md" align="center">
|
|
57
|
+
<CloseButton color="black" />
|
|
58
|
+
<CloseButton color="blue" />
|
|
59
|
+
</Inline>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const States: Story = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<Inline gap="md" align="center">
|
|
66
|
+
<Paper variant="border" style={{ textAlign: 'center' }}>
|
|
67
|
+
<CloseButton />
|
|
68
|
+
<Text size="xs" mt={4}>Normal</Text>
|
|
69
|
+
</Paper>
|
|
70
|
+
<Paper variant="border" style={{ textAlign: 'center' }}>
|
|
71
|
+
<CloseButton disabled />
|
|
72
|
+
<Text size="xs" mt={4}>Disabled</Text>
|
|
73
|
+
</Paper>
|
|
74
|
+
</Inline>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const UsageExamples: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<Stack gap="md">
|
|
81
|
+
{/* Modal Header Example */}
|
|
82
|
+
<Paper variant="border-shadow">
|
|
83
|
+
<Inline justify="space-between" align="center">
|
|
84
|
+
<Title order={4}>Slat title</Title>
|
|
85
|
+
<CloseButton size="md" />
|
|
86
|
+
</Inline>
|
|
87
|
+
</Paper>
|
|
88
|
+
|
|
89
|
+
{/* Alert Example */}
|
|
90
|
+
<Alert
|
|
91
|
+
type="info"
|
|
92
|
+
title="Info"
|
|
93
|
+
withCloseButton
|
|
94
|
+
onClose={() => {}}
|
|
95
|
+
>
|
|
96
|
+
This is an informational alert message.
|
|
97
|
+
</Alert>
|
|
98
|
+
</Stack>
|
|
99
|
+
),
|
|
100
|
+
parameters: {
|
|
101
|
+
docs: {
|
|
102
|
+
description: {
|
|
103
|
+
story: 'Common usage patterns for CloseButton in different UI contexts.',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const Interactive: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
size: 'md',
|
|
112
|
+
color: 'black',
|
|
113
|
+
},
|
|
114
|
+
parameters: {
|
|
115
|
+
docs: {
|
|
116
|
+
description: {
|
|
117
|
+
story: 'Use the controls below to interact with the CloseButton and see different combinations.',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|