@shohojdhara/atomix 0.4.0 → 0.4.2
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/dist/atomix.css +0 -14
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +12 -19
- package/dist/charts.js +555 -359
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +98 -28
- package/dist/core.js +1082 -733
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +26 -21
- package/dist/forms.js +937 -350
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +14 -21
- package/dist/heavy.js +409 -256
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +518 -284
- package/dist/index.esm.js +1993 -1237
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1994 -1237
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
- package/scripts/atomix-cli.js +43 -1
- package/scripts/cli/__tests__/utils.test.js +6 -2
- package/scripts/cli/migration-tools.js +2 -2
- package/scripts/cli/theme-bridge.js +7 -9
- package/scripts/cli/utils.js +2 -1
- package/src/components/Accordion/Accordion.stories.tsx +40 -0
- package/src/components/Accordion/Accordion.tsx +174 -56
- package/src/components/Accordion/AccordionCompound.test.tsx +70 -0
- package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
- package/src/components/AtomixGlass/README.md +5 -5
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +185 -65
- package/src/components/Breadcrumb/BreadcrumbCompound.test.tsx +84 -0
- package/src/components/Breadcrumb/index.ts +2 -2
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/README.md +2 -2
- package/src/components/Callout/Callout.stories.tsx +166 -1011
- package/src/components/Callout/Callout.test.tsx +3 -3
- package/src/components/Callout/Callout.tsx +196 -84
- package/src/components/Callout/CalloutCompound.test.tsx +72 -0
- package/src/components/Callout/README.md +2 -2
- package/src/components/Chart/Chart.stories.tsx +1 -1
- package/src/components/Chart/Chart.tsx +5 -5
- package/src/components/Chart/TreemapChart.tsx +37 -29
- package/src/components/DatePicker/readme.md +3 -3
- package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +133 -20
- package/src/components/Dropdown/DropdownCompound.test.tsx +64 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
- package/src/components/EdgePanel/EdgePanel.tsx +164 -112
- package/src/components/EdgePanel/EdgePanelCompound.test.tsx +53 -0
- package/src/components/Form/Checkbox.stories.tsx +1 -1
- package/src/components/Form/Checkbox.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +1 -1
- package/src/components/Form/Input.tsx +1 -1
- package/src/components/Form/Radio.stories.tsx +1 -1
- package/src/components/Form/Radio.tsx +1 -1
- package/src/components/Form/Select.stories.tsx +24 -1
- package/src/components/Form/Select.test.tsx +99 -0
- package/src/components/Form/Select.tsx +145 -94
- package/src/components/Form/SelectOption.tsx +88 -0
- package/src/components/Form/Textarea.stories.tsx +1 -1
- package/src/components/Form/Textarea.tsx +1 -1
- package/src/components/Hero/Hero.stories.tsx +39 -2
- package/src/components/Hero/Hero.test.tsx +142 -0
- package/src/components/Hero/Hero.tsx +143 -4
- package/src/components/List/List.test.tsx +62 -0
- package/src/components/List/List.tsx +16 -5
- package/src/components/List/ListItem.tsx +20 -0
- package/src/components/Messages/Messages.stories.tsx +1 -1
- package/src/components/Messages/Messages.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +66 -2
- package/src/components/Modal/Modal.tsx +115 -35
- package/src/components/Modal/ModalCompound.test.tsx +94 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +1 -1
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
- package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/Rating/Rating.stories.tsx +1 -1
- package/src/components/Rating/Rating.test.tsx +73 -0
- package/src/components/Rating/Rating.tsx +25 -37
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.tsx +125 -22
- package/src/components/Steps/StepsCompound.test.tsx +81 -0
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +198 -45
- package/src/components/Tabs/TabsCompound.test.tsx +64 -0
- package/src/components/Todo/Todo.tsx +0 -1
- package/src/components/Toggle/Toggle.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
- package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
- package/src/lib/composables/__tests__/useChart.test.ts +50 -0
- package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
- package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
- package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
- package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
- package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
- package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
- package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
- package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
- package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
- package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
- package/src/lib/composables/glass-styles.ts +302 -0
- package/src/lib/composables/index.ts +0 -8
- package/src/lib/composables/useAtomixGlass.ts +331 -537
- package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
- package/src/lib/composables/useBarChart.ts +1 -1
- package/src/lib/composables/useBreadcrumb.ts +6 -6
- package/src/lib/composables/useChart.ts +104 -21
- package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
- package/src/lib/composables/useSlider.ts +66 -34
- package/src/lib/theme/devtools/CLI.ts +2 -10
- package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
- package/src/lib/types/components.ts +21 -23
- package/src/lib/utils/__tests__/componentUtils.test.ts +57 -2
- package/src/lib/utils/__tests__/dom.test.ts +100 -0
- package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
- package/src/lib/utils/__tests__/themeNaming.test.ts +117 -0
- package/src/lib/utils/themeNaming.ts +1 -1
- package/src/styles/06-components/_components.accordion.scss +0 -2
- package/src/styles/06-components/_components.chart.scss +0 -1
- package/src/styles/06-components/_components.dropdown.scss +0 -1
- package/src/styles/06-components/_components.edge-panel.scss +0 -2
- package/src/styles/06-components/_components.photoviewer.scss +0 -1
- package/src/styles/06-components/_components.river.scss +0 -1
- package/src/styles/06-components/_components.slider.scss +0 -3
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
|
@@ -1,1124 +1,279 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { Button } from '../Button/Button';
|
|
4
3
|
import { Callout } from './Callout';
|
|
5
|
-
import {
|
|
4
|
+
import { Icon } from '../Icon/Icon';
|
|
6
5
|
|
|
7
6
|
const meta = {
|
|
8
7
|
title: 'Components/Callout',
|
|
9
8
|
component: Callout,
|
|
10
9
|
parameters: {
|
|
11
|
-
layout: '
|
|
10
|
+
layout: 'centered',
|
|
12
11
|
docs: {
|
|
13
12
|
description: {
|
|
14
|
-
component:
|
|
15
|
-
|
|
13
|
+
component: `
|
|
14
|
+
# Callout
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
The Callout component is used to display important messages, alerts, or notifications to the user. It can be used for success, warning, error, or informational messages.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Multiple variants (primary, secondary, success, error, warning, info, light, dark)
|
|
23
|
+
- Compact mode
|
|
24
|
+
- Toast mode
|
|
25
|
+
- Glass morphism support
|
|
26
|
+
- Custom icons
|
|
27
|
+
- Action buttons
|
|
28
|
+
- Compound Component Pattern (new)
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Basic Usage
|
|
33
|
+
|
|
34
|
+
\`\`\`tsx
|
|
35
|
+
<Callout title="Callout Title">
|
|
36
|
+
This is the content of the callout.
|
|
37
|
+
</Callout>
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
### Compound Component Usage
|
|
41
|
+
|
|
42
|
+
\`\`\`tsx
|
|
43
|
+
<Callout>
|
|
44
|
+
<Callout.Content>
|
|
45
|
+
<Callout.Icon>
|
|
46
|
+
<Icon name="Info" />
|
|
47
|
+
</Callout.Icon>
|
|
48
|
+
<Callout.Message>
|
|
49
|
+
<Callout.Title>Custom Layout</Callout.Title>
|
|
50
|
+
<Callout.Text>
|
|
51
|
+
This callout uses the compound component pattern for full control over layout.
|
|
52
|
+
</Callout.Text>
|
|
53
|
+
</Callout.Message>
|
|
54
|
+
</Callout.Content>
|
|
55
|
+
<Callout.Actions>
|
|
56
|
+
<button>Action</button>
|
|
57
|
+
</Callout.Actions>
|
|
58
|
+
</Callout>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
## Props
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Default | Description |
|
|
64
|
+
| ---- | ---- | ------- | ----------- |
|
|
65
|
+
| variant | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'warning' \| 'info' \| 'light' \| 'dark' | 'primary' | The visual style of the callout |
|
|
66
|
+
| title | ReactNode | - | The title of the callout |
|
|
67
|
+
| children | ReactNode | - | The content of the callout |
|
|
68
|
+
| icon | ReactNode | - | Custom icon to display |
|
|
69
|
+
| onClose | () => void | - | Callback function when the close button is clicked |
|
|
70
|
+
| actions | ReactNode | - | Action buttons to display |
|
|
71
|
+
| compact | boolean | false | Whether to use compact styling |
|
|
72
|
+
| isToast | boolean | false | Whether to style as a toast notification |
|
|
73
|
+
| glass | boolean \| object | false | Whether to apply glass morphism effect |
|
|
74
|
+
| className | string | - | Additional CSS class names |
|
|
75
|
+
| style | CSSProperties | - | Inline styles |
|
|
76
|
+
`,
|
|
16
77
|
},
|
|
17
78
|
},
|
|
18
79
|
},
|
|
19
80
|
tags: ['autodocs'],
|
|
20
81
|
argTypes: {
|
|
21
82
|
variant: {
|
|
22
|
-
control: 'select',
|
|
23
|
-
options:
|
|
24
|
-
|
|
83
|
+
control: { type: 'select' },
|
|
84
|
+
options: [
|
|
85
|
+
'primary',
|
|
86
|
+
'secondary',
|
|
87
|
+
'success',
|
|
88
|
+
'error',
|
|
89
|
+
'warning',
|
|
90
|
+
'info',
|
|
91
|
+
'light',
|
|
92
|
+
'dark',
|
|
93
|
+
],
|
|
94
|
+
description: 'The visual style of the callout',
|
|
25
95
|
table: {
|
|
26
96
|
defaultValue: { summary: 'primary' },
|
|
27
|
-
type: { summary: 'string' },
|
|
28
97
|
},
|
|
29
98
|
},
|
|
30
99
|
title: {
|
|
31
100
|
control: 'text',
|
|
32
101
|
description: 'The title of the callout',
|
|
33
|
-
table: {
|
|
34
|
-
type: { summary: 'ReactNode' },
|
|
35
|
-
},
|
|
36
102
|
},
|
|
37
103
|
children: {
|
|
38
104
|
control: 'text',
|
|
39
105
|
description: 'The content of the callout',
|
|
40
|
-
table: {
|
|
41
|
-
type: { summary: 'ReactNode' },
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
icon: {
|
|
45
|
-
control: 'boolean',
|
|
46
|
-
description: 'Optional icon to display in the callout',
|
|
47
|
-
table: {
|
|
48
|
-
type: { summary: 'ReactNode' },
|
|
49
|
-
},
|
|
50
106
|
},
|
|
51
107
|
compact: {
|
|
52
108
|
control: 'boolean',
|
|
53
|
-
description: '
|
|
109
|
+
description: 'Whether to use compact styling',
|
|
54
110
|
table: {
|
|
55
|
-
defaultValue: { summary: false },
|
|
56
|
-
type: { summary: 'boolean' },
|
|
111
|
+
defaultValue: { summary: 'false' },
|
|
57
112
|
},
|
|
58
113
|
},
|
|
59
114
|
isToast: {
|
|
60
115
|
control: 'boolean',
|
|
61
|
-
description: '
|
|
116
|
+
description: 'Whether to style as a toast notification',
|
|
62
117
|
table: {
|
|
63
|
-
defaultValue: { summary: false },
|
|
64
|
-
type: { summary: 'boolean' },
|
|
118
|
+
defaultValue: { summary: 'false' },
|
|
65
119
|
},
|
|
66
120
|
},
|
|
67
121
|
glass: {
|
|
68
122
|
control: 'boolean',
|
|
69
|
-
description: '
|
|
70
|
-
table: {
|
|
71
|
-
defaultValue: { summary: false },
|
|
72
|
-
type: { summary: 'AtomixGlassProps | boolean' },
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
actions: {
|
|
76
|
-
control: false,
|
|
77
|
-
description: 'Optional action buttons to display in the callout',
|
|
78
|
-
table: {
|
|
79
|
-
type: { summary: 'ReactNode' },
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
className: {
|
|
83
|
-
control: 'text',
|
|
84
|
-
description: 'Additional CSS class names',
|
|
123
|
+
description: 'Whether to apply glass morphism effect',
|
|
85
124
|
table: {
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
onClose: {
|
|
90
|
-
action: 'closed',
|
|
91
|
-
description: 'Callback when callout is dismissed',
|
|
92
|
-
table: {
|
|
93
|
-
type: { summary: '() => void' },
|
|
125
|
+
defaultValue: { summary: 'false' },
|
|
94
126
|
},
|
|
95
127
|
},
|
|
128
|
+
onClose: { action: 'closed' },
|
|
96
129
|
},
|
|
97
130
|
} satisfies Meta<typeof Callout>;
|
|
98
131
|
|
|
99
132
|
export default meta;
|
|
100
133
|
type Story = StoryObj<typeof meta>;
|
|
101
134
|
|
|
102
|
-
|
|
103
|
-
const InfoIcon = () => (
|
|
104
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
105
|
-
<path
|
|
106
|
-
d="M12 16V12M12 8H12.01M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
|
|
107
|
-
stroke="currentColor"
|
|
108
|
-
strokeWidth="2"
|
|
109
|
-
strokeLinecap="round"
|
|
110
|
-
strokeLinejoin="round"
|
|
111
|
-
/>
|
|
112
|
-
</svg>
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
const SuccessIcon = () => (
|
|
116
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
117
|
-
<path
|
|
118
|
-
d="M9 12L11 14L15 10M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"
|
|
119
|
-
stroke="currentColor"
|
|
120
|
-
strokeWidth="2"
|
|
121
|
-
strokeLinecap="round"
|
|
122
|
-
strokeLinejoin="round"
|
|
123
|
-
/>
|
|
124
|
-
</svg>
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
const WarningIcon = () => (
|
|
128
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
|
-
<path
|
|
130
|
-
d="M12 9V13M12 17H12.01M3.98069 8.00001C3.32275 9.15122 3 10.5502 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C10.5502 3 9.15122 3.32275 8.00001 3.98069"
|
|
131
|
-
stroke="currentColor"
|
|
132
|
-
strokeWidth="2"
|
|
133
|
-
strokeLinecap="round"
|
|
134
|
-
strokeLinejoin="round"
|
|
135
|
-
/>
|
|
136
|
-
</svg>
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
const ErrorIcon = () => (
|
|
140
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
141
|
-
<path
|
|
142
|
-
d="M12 9V13M12 17H12.01M11.2926 3.05737C11.5093 3.01652 11.7321 3 11.9565 3C16.3908 3 20 6.60914 20 11.0435C20 11.2679 19.9835 11.4907 19.9426 11.7074C19.4862 15.0952 16.5609 17.7241 13 17.9711C12.6712 17.9903 12.3375 18 12 18C7.58172 18 4 14.4183 4 10C4 6.43913 6.62884 3.51375 10.0166 3.05736C10.2333 3.01652 10.4561 3 10.6805 3C10.9049 3 11.1277 3.01652 11.3444 3.05736L11.2926 3.05737Z"
|
|
143
|
-
stroke="currentColor"
|
|
144
|
-
strokeWidth="2"
|
|
145
|
-
strokeLinecap="round"
|
|
146
|
-
strokeLinejoin="round"
|
|
147
|
-
/>
|
|
148
|
-
</svg>
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
// Basic variants
|
|
152
|
-
export const Default: Story = {
|
|
135
|
+
export const Primary: Story = {
|
|
153
136
|
args: {
|
|
154
|
-
title: '
|
|
155
|
-
children: 'This is a
|
|
137
|
+
title: 'Primary Callout',
|
|
138
|
+
children: 'This is a primary callout message.',
|
|
156
139
|
variant: 'primary',
|
|
157
|
-
icon: <InfoIcon />,
|
|
158
|
-
},
|
|
159
|
-
parameters: {
|
|
160
|
-
docs: {
|
|
161
|
-
description: {
|
|
162
|
-
story: 'The default callout with a title, content, and an icon.',
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
140
|
},
|
|
166
141
|
};
|
|
167
142
|
|
|
168
143
|
export const Success: Story = {
|
|
169
144
|
args: {
|
|
170
|
-
title: 'Success',
|
|
171
|
-
children: '
|
|
145
|
+
title: 'Success Message',
|
|
146
|
+
children: 'Operation completed successfully.',
|
|
172
147
|
variant: 'success',
|
|
173
|
-
icon: <
|
|
174
|
-
},
|
|
175
|
-
parameters: {
|
|
176
|
-
docs: {
|
|
177
|
-
description: {
|
|
178
|
-
story: 'Use success callouts to confirm that an action was completed successfully.',
|
|
179
|
-
},
|
|
180
|
-
},
|
|
148
|
+
icon: <Icon name="CheckCircle" size="md" />,
|
|
181
149
|
},
|
|
182
150
|
};
|
|
183
151
|
|
|
184
152
|
export const Warning: Story = {
|
|
185
153
|
args: {
|
|
186
154
|
title: 'Warning',
|
|
187
|
-
children: 'Please
|
|
155
|
+
children: 'Please be careful with this action.',
|
|
188
156
|
variant: 'warning',
|
|
189
|
-
icon: <
|
|
190
|
-
},
|
|
191
|
-
parameters: {
|
|
192
|
-
docs: {
|
|
193
|
-
description: {
|
|
194
|
-
story:
|
|
195
|
-
'Warning callouts alert users to potential issues or important information they should be aware of.',
|
|
196
|
-
},
|
|
197
|
-
},
|
|
157
|
+
icon: <Icon name="Warning" size="md" />,
|
|
198
158
|
},
|
|
199
159
|
};
|
|
200
160
|
|
|
201
161
|
export const Error: Story = {
|
|
202
162
|
args: {
|
|
203
|
-
title: 'Error',
|
|
204
|
-
children: '
|
|
163
|
+
title: 'Error Occurred',
|
|
164
|
+
children: 'An error occurred while processing your request.',
|
|
205
165
|
variant: 'error',
|
|
206
|
-
icon: <
|
|
207
|
-
},
|
|
208
|
-
parameters: {
|
|
209
|
-
docs: {
|
|
210
|
-
description: {
|
|
211
|
-
story: 'Error callouts indicate that something went wrong and requires attention.',
|
|
212
|
-
},
|
|
213
|
-
},
|
|
166
|
+
icon: <Icon name="WarningCircle" size="md" />,
|
|
214
167
|
},
|
|
215
168
|
};
|
|
216
169
|
|
|
217
|
-
|
|
218
|
-
export const WithActions: Story = {
|
|
170
|
+
export const Info: Story = {
|
|
219
171
|
args: {
|
|
220
|
-
title: '
|
|
221
|
-
children: '
|
|
172
|
+
title: 'Information',
|
|
173
|
+
children: 'Here is some useful information.',
|
|
222
174
|
variant: 'info',
|
|
223
|
-
icon: <
|
|
224
|
-
actions: (
|
|
225
|
-
<>
|
|
226
|
-
<Button label="Update Now" variant="primary" size="sm" />
|
|
227
|
-
<Button label="Later" variant="outline-primary" size="sm" />
|
|
228
|
-
</>
|
|
229
|
-
),
|
|
230
|
-
},
|
|
231
|
-
parameters: {
|
|
232
|
-
docs: {
|
|
233
|
-
description: {
|
|
234
|
-
story:
|
|
235
|
-
'Callouts can include action buttons to allow users to respond directly to the message.',
|
|
236
|
-
},
|
|
237
|
-
},
|
|
175
|
+
icon: <Icon name="Info" size="md" />,
|
|
238
176
|
},
|
|
239
177
|
};
|
|
240
178
|
|
|
241
|
-
export const
|
|
179
|
+
export const WithActions: Story = {
|
|
242
180
|
args: {
|
|
243
|
-
title: '
|
|
244
|
-
children: 'This
|
|
181
|
+
title: 'Callout with Actions',
|
|
182
|
+
children: 'This callout includes action buttons.',
|
|
245
183
|
variant: 'primary',
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
story:
|
|
253
|
-
'Dismissible callouts include a close button that allows users to remove the callout from view.',
|
|
254
|
-
},
|
|
255
|
-
},
|
|
184
|
+
actions: (
|
|
185
|
+
<>
|
|
186
|
+
<button className="c-btn c-btn--sm c-btn--outline-light u-mr-2">Cancel</button>
|
|
187
|
+
<button className="c-btn c-btn--sm c-btn--light">Confirm</button>
|
|
188
|
+
</>
|
|
189
|
+
),
|
|
256
190
|
},
|
|
257
191
|
};
|
|
258
192
|
|
|
259
193
|
export const Compact: Story = {
|
|
260
194
|
args: {
|
|
261
|
-
title: '
|
|
262
|
-
|
|
263
|
-
icon: <InfoIcon />,
|
|
195
|
+
title: 'Compact Callout',
|
|
196
|
+
children: 'This is a compact callout.',
|
|
264
197
|
compact: true,
|
|
265
|
-
|
|
266
|
-
parameters: {
|
|
267
|
-
docs: {
|
|
268
|
-
description: {
|
|
269
|
-
story:
|
|
270
|
-
'Compact callouts are more space-efficient and display the title and icon in a single line.',
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
export const Toast: Story = {
|
|
277
|
-
args: {
|
|
278
|
-
title: 'Toast Notification',
|
|
279
|
-
children: 'This callout is styled as a toast notification.',
|
|
280
|
-
variant: 'success',
|
|
281
|
-
icon: <SuccessIcon />,
|
|
282
|
-
isToast: true,
|
|
283
|
-
onClose: () => console.log('Toast closed'),
|
|
284
|
-
},
|
|
285
|
-
parameters: {
|
|
286
|
-
docs: {
|
|
287
|
-
description: {
|
|
288
|
-
story:
|
|
289
|
-
'Toast notifications are temporary messages that appear and disappear automatically.',
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
// Theme variants
|
|
296
|
-
export const Dark: Story = {
|
|
297
|
-
args: {
|
|
298
|
-
title: 'Dark Mode',
|
|
299
|
-
children: 'This is a dark variant of the callout component.',
|
|
300
|
-
variant: 'dark',
|
|
301
|
-
icon: <InfoIcon />,
|
|
302
|
-
},
|
|
303
|
-
parameters: {
|
|
304
|
-
docs: {
|
|
305
|
-
description: {
|
|
306
|
-
story:
|
|
307
|
-
'Dark callouts are useful for dark-themed interfaces or for creating visual contrast.',
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
export const Light: Story = {
|
|
314
|
-
args: {
|
|
315
|
-
title: 'Light Mode',
|
|
316
|
-
children: 'This is a light variant of the callout component.',
|
|
317
|
-
variant: 'light',
|
|
318
|
-
icon: <InfoIcon />,
|
|
319
|
-
},
|
|
320
|
-
parameters: {
|
|
321
|
-
docs: {
|
|
322
|
-
description: {
|
|
323
|
-
story:
|
|
324
|
-
'Light callouts are useful for light-themed interfaces or for creating visual contrast.',
|
|
325
|
-
},
|
|
326
|
-
},
|
|
198
|
+
variant: 'info',
|
|
327
199
|
},
|
|
328
200
|
};
|
|
329
201
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
'dark',
|
|
342
|
-
];
|
|
343
|
-
|
|
344
|
-
const getIcon = (variant: string) => {
|
|
345
|
-
switch (variant) {
|
|
346
|
-
case 'success':
|
|
347
|
-
return <SuccessIcon />;
|
|
348
|
-
case 'warning':
|
|
349
|
-
return <WarningIcon />;
|
|
350
|
-
case 'error':
|
|
351
|
-
return <ErrorIcon />;
|
|
352
|
-
default:
|
|
353
|
-
return <InfoIcon />;
|
|
354
|
-
}
|
|
355
|
-
};
|
|
202
|
+
export const Dismissible: Story = {
|
|
203
|
+
render: args => {
|
|
204
|
+
const [visible, setVisible] = useState(true);
|
|
205
|
+
|
|
206
|
+
if (!visible) {
|
|
207
|
+
return (
|
|
208
|
+
<button className="c-btn c-btn--primary" onClick={() => setVisible(true)}>
|
|
209
|
+
Show Callout
|
|
210
|
+
</button>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
356
213
|
|
|
357
214
|
return (
|
|
358
|
-
<
|
|
359
|
-
{
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
title={`${variant.charAt(0).toUpperCase() + variant.slice(1)} Variant`}
|
|
363
|
-
variant={variant as any}
|
|
364
|
-
icon={getIcon(variant)}
|
|
365
|
-
>
|
|
366
|
-
This is an example of the {variant} callout variant.
|
|
367
|
-
</Callout>
|
|
368
|
-
))}
|
|
369
|
-
</div>
|
|
215
|
+
<Callout
|
|
216
|
+
{...args}
|
|
217
|
+
onClose={() => setVisible(false)}
|
|
218
|
+
/>
|
|
370
219
|
);
|
|
371
220
|
},
|
|
372
|
-
parameters: {
|
|
373
|
-
docs: {
|
|
374
|
-
description: {
|
|
375
|
-
story: 'Overview of all available callout color variants.',
|
|
376
|
-
},
|
|
377
|
-
},
|
|
378
|
-
},
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
// Glass morphism variants
|
|
382
|
-
export const Glass: Story = {
|
|
383
|
-
args: {
|
|
384
|
-
title: 'Glass Morphism',
|
|
385
|
-
children: 'This callout uses glass morphism effect for a modern, translucent appearance.',
|
|
386
|
-
variant: 'primary',
|
|
387
|
-
icon: <InfoIcon />,
|
|
388
|
-
glass: true,
|
|
389
|
-
},
|
|
390
|
-
parameters: {
|
|
391
|
-
docs: {
|
|
392
|
-
description: {
|
|
393
|
-
story:
|
|
394
|
-
'Glass morphism callouts provide a modern, translucent appearance with backdrop blur effects.',
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
},
|
|
398
|
-
decorators: [
|
|
399
|
-
Story => (
|
|
400
|
-
<div
|
|
401
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
402
|
-
style={{
|
|
403
|
-
backgroundImage:
|
|
404
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
405
|
-
}}
|
|
406
|
-
>
|
|
407
|
-
<Story />
|
|
408
|
-
</div>
|
|
409
|
-
),
|
|
410
|
-
],
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
export const GlassSuccess: Story = {
|
|
414
221
|
args: {
|
|
415
|
-
title: '
|
|
416
|
-
children: '
|
|
222
|
+
title: 'Dismissible Callout',
|
|
223
|
+
children: 'Click the X icon to dismiss this callout.',
|
|
417
224
|
variant: 'success',
|
|
418
|
-
icon: <SuccessIcon />,
|
|
419
|
-
glass: true,
|
|
420
225
|
},
|
|
421
|
-
parameters: {
|
|
422
|
-
docs: {
|
|
423
|
-
description: {
|
|
424
|
-
story: 'Success callouts with glass morphism effect for enhanced visual appeal.',
|
|
425
|
-
},
|
|
426
|
-
},
|
|
427
|
-
},
|
|
428
|
-
decorators: [
|
|
429
|
-
Story => (
|
|
430
|
-
<div
|
|
431
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
432
|
-
style={{
|
|
433
|
-
backgroundImage:
|
|
434
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
435
|
-
}}
|
|
436
|
-
>
|
|
437
|
-
<Story />
|
|
438
|
-
</div>
|
|
439
|
-
),
|
|
440
|
-
],
|
|
441
226
|
};
|
|
442
227
|
|
|
443
|
-
export const
|
|
228
|
+
export const CompoundUsage: Story = {
|
|
229
|
+
render: args => (
|
|
230
|
+
<Callout {...args}>
|
|
231
|
+
<Callout.Content>
|
|
232
|
+
<Callout.Icon>
|
|
233
|
+
<Icon name="Star" size="md" />
|
|
234
|
+
</Callout.Icon>
|
|
235
|
+
<Callout.Message>
|
|
236
|
+
<Callout.Title>Custom Layout</Callout.Title>
|
|
237
|
+
<Callout.Text>
|
|
238
|
+
This callout uses the compound component pattern (Callout.Content, Callout.Icon, Callout.Message, etc.) for full control.
|
|
239
|
+
</Callout.Text>
|
|
240
|
+
</Callout.Message>
|
|
241
|
+
</Callout.Content>
|
|
242
|
+
<Callout.Actions>
|
|
243
|
+
<button className="c-btn c-btn--sm c-btn--outline-primary">Custom Action</button>
|
|
244
|
+
</Callout.Actions>
|
|
245
|
+
<Callout.CloseButton onClick={() => alert('Closed!')} />
|
|
246
|
+
</Callout>
|
|
247
|
+
),
|
|
444
248
|
args: {
|
|
445
|
-
|
|
446
|
-
children: 'Please review your information before proceeding. Glass effect adds elegance.',
|
|
447
|
-
variant: 'warning',
|
|
448
|
-
icon: <WarningIcon />,
|
|
449
|
-
glass: true,
|
|
249
|
+
variant: 'secondary',
|
|
450
250
|
},
|
|
451
251
|
parameters: {
|
|
452
252
|
docs: {
|
|
453
253
|
description: {
|
|
454
|
-
story:
|
|
455
|
-
'Warning callouts with glass effect maintain urgency while adding visual sophistication.',
|
|
254
|
+
story: 'Demonstrates the Compound Component usage pattern.',
|
|
456
255
|
},
|
|
457
256
|
},
|
|
458
257
|
},
|
|
459
|
-
decorators: [
|
|
460
|
-
Story => (
|
|
461
|
-
<div
|
|
462
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
463
|
-
style={{
|
|
464
|
-
backgroundImage:
|
|
465
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
466
|
-
}}
|
|
467
|
-
>
|
|
468
|
-
<Story />
|
|
469
|
-
</div>
|
|
470
|
-
),
|
|
471
|
-
],
|
|
472
258
|
};
|
|
473
259
|
|
|
474
|
-
export const
|
|
260
|
+
export const GlassEffect: Story = {
|
|
475
261
|
args: {
|
|
476
|
-
title: '
|
|
477
|
-
children: '
|
|
478
|
-
variant: 'error',
|
|
479
|
-
icon: <ErrorIcon />,
|
|
262
|
+
title: 'Glass Callout',
|
|
263
|
+
children: 'This callout has a glass morphism effect.',
|
|
480
264
|
glass: true,
|
|
481
|
-
},
|
|
482
|
-
parameters: {
|
|
483
|
-
docs: {
|
|
484
|
-
description: {
|
|
485
|
-
story:
|
|
486
|
-
'Error callouts with glass morphism provide a softer, more approachable error presentation.',
|
|
487
|
-
},
|
|
488
|
-
},
|
|
489
|
-
},
|
|
490
|
-
decorators: [
|
|
491
|
-
Story => (
|
|
492
|
-
<div
|
|
493
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
494
|
-
style={{
|
|
495
|
-
backgroundImage:
|
|
496
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
497
|
-
}}
|
|
498
|
-
>
|
|
499
|
-
<Story />
|
|
500
|
-
</div>
|
|
501
|
-
),
|
|
502
|
-
],
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
export const GlassDark: Story = {
|
|
506
|
-
args: {
|
|
507
|
-
title: 'Dark Glass Mode',
|
|
508
|
-
children: 'This dark variant with glass effect creates stunning visual depth.',
|
|
509
|
-
variant: 'dark',
|
|
510
|
-
icon: <InfoIcon />,
|
|
511
|
-
glass: true,
|
|
512
|
-
},
|
|
513
|
-
parameters: {
|
|
514
|
-
docs: {
|
|
515
|
-
description: {
|
|
516
|
-
story: 'Dark callouts with glass effect create dramatic visual depth and contrast.',
|
|
517
|
-
},
|
|
518
|
-
},
|
|
519
|
-
},
|
|
520
|
-
decorators: [
|
|
521
|
-
Story => (
|
|
522
|
-
<div
|
|
523
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
524
|
-
style={{
|
|
525
|
-
backgroundImage:
|
|
526
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
527
|
-
}}
|
|
528
|
-
>
|
|
529
|
-
<Story />
|
|
530
|
-
</div>
|
|
531
|
-
),
|
|
532
|
-
],
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
export const GlassWithActions: Story = {
|
|
536
|
-
args: {
|
|
537
|
-
title: 'Glass Update Available',
|
|
538
|
-
children: 'A new version is available. The glass effect enhances the modern feel.',
|
|
539
|
-
variant: 'info',
|
|
540
|
-
icon: <InfoIcon />,
|
|
541
|
-
glass: true,
|
|
542
|
-
actions: (
|
|
543
|
-
<>
|
|
544
|
-
<Button label="Update Now" variant="primary" size="sm" />
|
|
545
|
-
<Button label="Later" variant="outline-primary" size="sm" />
|
|
546
|
-
</>
|
|
547
|
-
),
|
|
548
|
-
},
|
|
549
|
-
parameters: {
|
|
550
|
-
docs: {
|
|
551
|
-
description: {
|
|
552
|
-
story:
|
|
553
|
-
'Glass callouts with action buttons maintain full functionality while adding visual appeal.',
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
},
|
|
557
|
-
decorators: [
|
|
558
|
-
Story => (
|
|
559
|
-
<div
|
|
560
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
561
|
-
style={{
|
|
562
|
-
backgroundImage:
|
|
563
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
564
|
-
}}
|
|
565
|
-
>
|
|
566
|
-
<Story />
|
|
567
|
-
</div>
|
|
568
|
-
),
|
|
569
|
-
],
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
export const GlassDismissible: Story = {
|
|
573
|
-
args: {
|
|
574
|
-
title: 'Glass Notification',
|
|
575
|
-
children:
|
|
576
|
-
'This dismissible glass callout can be closed while maintaining its elegant appearance.',
|
|
577
265
|
variant: 'primary',
|
|
578
|
-
icon: <InfoIcon />,
|
|
579
|
-
glass: true,
|
|
580
|
-
onClose: () => console.log('Glass callout closed'),
|
|
581
266
|
},
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
<div
|
|
593
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
594
|
-
style={{
|
|
595
|
-
backgroundImage:
|
|
596
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
597
|
-
}}
|
|
598
|
-
>
|
|
599
|
-
<Story />
|
|
600
|
-
</div>
|
|
601
|
-
),
|
|
602
|
-
],
|
|
603
|
-
};
|
|
604
|
-
|
|
605
|
-
export const GlassToast: Story = {
|
|
606
|
-
args: {
|
|
607
|
-
title: 'Glass Toast Notification',
|
|
608
|
-
children:
|
|
609
|
-
'This glass toast notification combines the elegance of glass morphism with toast functionality.',
|
|
610
|
-
variant: 'success',
|
|
611
|
-
icon: <SuccessIcon />,
|
|
612
|
-
isToast: true,
|
|
613
|
-
glass: true,
|
|
614
|
-
onClose: () => console.log('Glass toast closed'),
|
|
615
|
-
},
|
|
616
|
-
parameters: {
|
|
617
|
-
docs: {
|
|
618
|
-
description: {
|
|
619
|
-
story:
|
|
620
|
-
'Glass toast notifications provide an elegant, floating appearance with enhanced visual depth.',
|
|
621
|
-
},
|
|
622
|
-
},
|
|
623
|
-
},
|
|
624
|
-
decorators: [
|
|
625
|
-
Story => (
|
|
626
|
-
<div
|
|
627
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
628
|
-
style={{
|
|
629
|
-
backgroundImage:
|
|
630
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
631
|
-
}}
|
|
632
|
-
>
|
|
633
|
-
<Story />
|
|
634
|
-
</div>
|
|
635
|
-
),
|
|
636
|
-
],
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
export const GlassOneLine: Story = {
|
|
640
|
-
args: {
|
|
641
|
-
title: 'Glass one-line notification',
|
|
642
|
-
variant: 'info',
|
|
643
|
-
icon: <InfoIcon />,
|
|
644
|
-
compact: true,
|
|
645
|
-
glass: true,
|
|
646
|
-
},
|
|
647
|
-
parameters: {
|
|
648
|
-
docs: {
|
|
649
|
-
description: {
|
|
650
|
-
story: 'Compact one-line glass callouts maintain elegance in minimal space.',
|
|
651
|
-
},
|
|
652
|
-
},
|
|
653
|
-
},
|
|
654
|
-
decorators: [
|
|
655
|
-
Story => (
|
|
656
|
-
<div
|
|
657
|
-
className="u-bg-cover u-bg-center u-p-16"
|
|
658
|
-
style={{
|
|
659
|
-
backgroundImage:
|
|
660
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80',
|
|
661
|
-
}}
|
|
662
|
-
>
|
|
663
|
-
<Story />
|
|
664
|
-
</div>
|
|
665
|
-
),
|
|
666
|
-
],
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
// Interactive examples
|
|
670
|
-
const ToastDemoTemplate = () => {
|
|
671
|
-
const [toasts, setToasts] = useState<{ id: string; variant: string }[]>([]);
|
|
672
|
-
|
|
673
|
-
const addToast = (variant: string) => {
|
|
674
|
-
const id = Math.random().toString(36).substring(2, 9);
|
|
675
|
-
setToasts([...toasts, { id, variant }]);
|
|
676
|
-
|
|
677
|
-
// Auto-remove after 5 seconds
|
|
678
|
-
setTimeout(() => {
|
|
679
|
-
setToasts(current => current.filter(toast => toast.id !== id));
|
|
680
|
-
}, 5000);
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
const removeToast = (id: string) => {
|
|
684
|
-
setToasts(current => current.filter(toast => toast.id !== id));
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
const getIcon = (variant: string) => {
|
|
688
|
-
switch (variant) {
|
|
689
|
-
case 'success':
|
|
690
|
-
return <SuccessIcon />;
|
|
691
|
-
case 'warning':
|
|
692
|
-
return <WarningIcon />;
|
|
693
|
-
case 'error':
|
|
694
|
-
return <ErrorIcon />;
|
|
695
|
-
default:
|
|
696
|
-
return <InfoIcon />;
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
const getTitle = (variant: string) => {
|
|
701
|
-
switch (variant) {
|
|
702
|
-
case 'success':
|
|
703
|
-
return 'Success';
|
|
704
|
-
case 'warning':
|
|
705
|
-
return 'Warning';
|
|
706
|
-
case 'error':
|
|
707
|
-
return 'Error';
|
|
708
|
-
default:
|
|
709
|
-
return 'Information';
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
const getMessage = (variant: string) => {
|
|
714
|
-
switch (variant) {
|
|
715
|
-
case 'success':
|
|
716
|
-
return 'Operation completed successfully!';
|
|
717
|
-
case 'warning':
|
|
718
|
-
return 'Please review before continuing.';
|
|
719
|
-
case 'error':
|
|
720
|
-
return 'An error occurred. Please try again.';
|
|
721
|
-
default:
|
|
722
|
-
return 'This is an informational message.';
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
return (
|
|
727
|
-
<div className="u-relative u-min-h-90vh u-p-8 u-bg-gradient-to-br u-from-red-500/[0.15] u-via-orange-500/[0.15] u-to-blue-500/[0.15] u-overflow-hidden">
|
|
728
|
-
{/* Additional background layer for depth */}
|
|
729
|
-
<div
|
|
730
|
-
className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-20"
|
|
731
|
-
style={{
|
|
732
|
-
backgroundImage:
|
|
733
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
734
|
-
}}
|
|
735
|
-
/>
|
|
736
|
-
|
|
737
|
-
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-4">
|
|
738
|
-
<div className="u-flex u-gap-2 u-flex-wrap">
|
|
739
|
-
<Button
|
|
740
|
-
label="Add Info Toast"
|
|
741
|
-
variant="primary"
|
|
742
|
-
size="sm"
|
|
743
|
-
onClick={() => addToast('info')}
|
|
744
|
-
/>
|
|
745
|
-
<Button
|
|
746
|
-
label="Add Success Toast"
|
|
747
|
-
variant="success"
|
|
748
|
-
size="sm"
|
|
749
|
-
onClick={() => addToast('success')}
|
|
750
|
-
/>
|
|
751
|
-
<Button
|
|
752
|
-
label="Add Warning Toast"
|
|
753
|
-
variant="warning"
|
|
754
|
-
size="sm"
|
|
755
|
-
onClick={() => addToast('warning')}
|
|
756
|
-
/>
|
|
757
|
-
<Button
|
|
758
|
-
label="Add Error Toast"
|
|
759
|
-
variant="error"
|
|
760
|
-
size="sm"
|
|
761
|
-
onClick={() => addToast('error')}
|
|
762
|
-
/>
|
|
763
|
-
</div>
|
|
764
|
-
|
|
765
|
-
<div className="u-relative u-h-96 u-border-2 u-border-white/[0.2] u-rounded-xl u-p-5 u-overflow-hidden u-bg-gradient-to-tr u-from-red-500/[0.1] u-via-yellow-500/[0.1] u-to-blue-500/[0.1] u-backdrop-blur-sm">
|
|
766
|
-
<div className="u-absolute u-top-5 u-right-5 u-flex u-flex-col u-gap-3 u-max-w-xs">
|
|
767
|
-
{toasts.map(toast => (
|
|
768
|
-
<Callout
|
|
769
|
-
key={toast.id}
|
|
770
|
-
title={getTitle(toast.variant)}
|
|
771
|
-
variant={toast.variant as any}
|
|
772
|
-
icon={getIcon(toast.variant)}
|
|
773
|
-
isToast={true}
|
|
774
|
-
onClose={() => removeToast(toast.id)}
|
|
775
|
-
>
|
|
776
|
-
{getMessage(toast.variant)}
|
|
777
|
-
</Callout>
|
|
778
|
-
))}
|
|
779
|
-
</div>
|
|
780
|
-
{toasts.length === 0 && (
|
|
781
|
-
<div className="u-flex u-h-full u-items-center u-justify-center u-text-white u-text-center u-leading-tight u-font-medium">
|
|
782
|
-
<div>
|
|
783
|
-
<div className="u-mb-2">
|
|
784
|
-
🎨 Click a button above to show toast notifications here 🎨
|
|
785
|
-
</div>
|
|
786
|
-
<small className="u-opacity-80">
|
|
787
|
-
Beautiful colorful backgrounds enhance the visual experience
|
|
788
|
-
</small>
|
|
789
|
-
</div>
|
|
790
|
-
</div>
|
|
791
|
-
)}
|
|
792
|
-
</div>
|
|
793
|
-
</div>
|
|
267
|
+
render: args => (
|
|
268
|
+
<div
|
|
269
|
+
style={{
|
|
270
|
+
padding: '2rem',
|
|
271
|
+
backgroundImage: 'url(https://images.unsplash.com/photo-1557683316-973673baf926?w=800)',
|
|
272
|
+
backgroundSize: 'cover',
|
|
273
|
+
borderRadius: '8px',
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<Callout {...args} />
|
|
794
277
|
</div>
|
|
795
|
-
)
|
|
796
|
-
};
|
|
797
|
-
|
|
798
|
-
export const ToastDemo: Story = {
|
|
799
|
-
render: () => <ToastDemoTemplate />,
|
|
800
|
-
parameters: {
|
|
801
|
-
docs: {
|
|
802
|
-
description: {
|
|
803
|
-
story:
|
|
804
|
-
'Interactive demo showing how toast notifications can be triggered and displayed in different variants.',
|
|
805
|
-
},
|
|
806
|
-
},
|
|
807
|
-
},
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
const AutoDismissTemplate = () => {
|
|
811
|
-
const [visible, setVisible] = useState(true);
|
|
812
|
-
const [countdown, setCountdown] = useState(5);
|
|
813
|
-
|
|
814
|
-
useEffect(() => {
|
|
815
|
-
if (!visible) return;
|
|
816
|
-
|
|
817
|
-
const timer = setInterval(() => {
|
|
818
|
-
setCountdown(prev => {
|
|
819
|
-
if (prev <= 1) {
|
|
820
|
-
clearInterval(timer);
|
|
821
|
-
setVisible(false);
|
|
822
|
-
return 0;
|
|
823
|
-
}
|
|
824
|
-
return prev - 1;
|
|
825
|
-
});
|
|
826
|
-
}, 1000);
|
|
827
|
-
|
|
828
|
-
return () => clearInterval(timer);
|
|
829
|
-
}, [visible]);
|
|
830
|
-
|
|
831
|
-
const resetCallout = () => {
|
|
832
|
-
setVisible(true);
|
|
833
|
-
setCountdown(5);
|
|
834
|
-
};
|
|
835
|
-
|
|
836
|
-
return (
|
|
837
|
-
<div className="u-relative u-min-h-90 u-p-16 u-bg-gradient-to-br u-from-red-500/[0.2] u-via-orange-500/[0.2] u-to-blue-500/[0.2]">
|
|
838
|
-
{/* Additional background layer for depth */}
|
|
839
|
-
<div
|
|
840
|
-
className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-30"
|
|
841
|
-
style={{
|
|
842
|
-
backgroundImage:
|
|
843
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
844
|
-
}}
|
|
845
|
-
/>
|
|
846
|
-
|
|
847
|
-
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-4">
|
|
848
|
-
{visible ? (
|
|
849
|
-
<Callout
|
|
850
|
-
title={`Auto-dismissing in ${countdown} seconds`}
|
|
851
|
-
variant="warning"
|
|
852
|
-
icon={<WarningIcon />}
|
|
853
|
-
glass
|
|
854
|
-
onClose={() => setVisible(false)}
|
|
855
|
-
>
|
|
856
|
-
This callout will automatically dismiss after the countdown. You can also dismiss it
|
|
857
|
-
manually. The glass effect looks beautiful against this colorful background!
|
|
858
|
-
</Callout>
|
|
859
|
-
) : (
|
|
860
|
-
<Button label="Show Auto-dismiss Callout" variant="primary" onClick={resetCallout} />
|
|
861
|
-
)}
|
|
862
|
-
</div>
|
|
863
|
-
</div>
|
|
864
|
-
);
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
export const AutoDismiss: Story = {
|
|
868
|
-
render: () => <AutoDismissTemplate />,
|
|
869
|
-
parameters: {
|
|
870
|
-
docs: {
|
|
871
|
-
description: {
|
|
872
|
-
story: 'Example of a callout that automatically dismisses after a countdown.',
|
|
873
|
-
},
|
|
874
|
-
},
|
|
875
|
-
},
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
const CalloutWithCustomContentTemplate = () => (
|
|
879
|
-
<Callout title="Custom Content Example" variant="primary" icon={<InfoIcon />}>
|
|
880
|
-
<div className="u-flex u-flex-col u-gap-3">
|
|
881
|
-
<p>Callouts can contain rich content including:</p>
|
|
882
|
-
<ul className="u-m-0 u-pl-5">
|
|
883
|
-
<li>Lists of items</li>
|
|
884
|
-
<li>Formatted text</li>
|
|
885
|
-
<li>Custom components</li>
|
|
886
|
-
</ul>
|
|
887
|
-
<div className="u-bg-black/[0.05] u-p-2 u-rounded u-text-sm">
|
|
888
|
-
<code>This is a code example</code>
|
|
889
|
-
</div>
|
|
890
|
-
</div>
|
|
891
|
-
</Callout>
|
|
892
|
-
);
|
|
893
|
-
|
|
894
|
-
export const CustomContent: Story = {
|
|
895
|
-
render: () => <CalloutWithCustomContentTemplate />,
|
|
896
|
-
parameters: {
|
|
897
|
-
docs: {
|
|
898
|
-
description: {
|
|
899
|
-
story: 'Callouts can contain rich, custom content beyond simple text.',
|
|
900
|
-
},
|
|
901
|
-
},
|
|
902
|
-
},
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
const GlassVariantsTemplate = () => {
|
|
906
|
-
const variants = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'light', 'dark'];
|
|
907
|
-
|
|
908
|
-
const getIcon = (variant: string) => {
|
|
909
|
-
switch (variant) {
|
|
910
|
-
case 'success':
|
|
911
|
-
return <SuccessIcon />;
|
|
912
|
-
case 'warning':
|
|
913
|
-
return <WarningIcon />;
|
|
914
|
-
case 'error':
|
|
915
|
-
return <ErrorIcon />;
|
|
916
|
-
default:
|
|
917
|
-
return <InfoIcon />;
|
|
918
|
-
}
|
|
919
|
-
};
|
|
920
|
-
|
|
921
|
-
const backgrounds = [
|
|
922
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80', // Mountain landscape
|
|
923
|
-
'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80', // Forest
|
|
924
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80', // Ocean
|
|
925
|
-
'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80', // Sunset
|
|
926
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80', // City lights
|
|
927
|
-
'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80', // Desert
|
|
928
|
-
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80', // Aurora
|
|
929
|
-
'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80', // Space
|
|
930
|
-
];
|
|
931
|
-
|
|
932
|
-
return (
|
|
933
|
-
<div className="u-relative u-min-h-screen u-p-16 u-bg-gradient-to-br u-from-red-500/[0.1] u-via-orange-500/[0.1] u-to-blue-500/[0.1]">
|
|
934
|
-
{/* Multiple background layers for depth */}
|
|
935
|
-
<div
|
|
936
|
-
className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-30"
|
|
937
|
-
style={{
|
|
938
|
-
backgroundImage:
|
|
939
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
940
|
-
}}
|
|
941
|
-
/>
|
|
942
|
-
<div
|
|
943
|
-
className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-20"
|
|
944
|
-
style={{
|
|
945
|
-
backgroundImage:
|
|
946
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
947
|
-
}}
|
|
948
|
-
/>
|
|
949
|
-
|
|
950
|
-
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-8">
|
|
951
|
-
{variants.map((variant, index) => (
|
|
952
|
-
<div
|
|
953
|
-
key={variant}
|
|
954
|
-
className="u-bg-cover u-bg-center u-p-8 u-rounded-xl u-relative u-overflow-hidden"
|
|
955
|
-
style={{ backgroundImage: `url("${backgrounds[index % backgrounds.length]}")` }}
|
|
956
|
-
>
|
|
957
|
-
<div className="u-absolute u-inset-0 u-bg-black/[0.1] u-z-n1" />
|
|
958
|
-
<Callout
|
|
959
|
-
title={`${variant.charAt(0).toUpperCase() + variant.slice(1)} Glass Variant`}
|
|
960
|
-
variant={variant as any}
|
|
961
|
-
icon={getIcon(variant)}
|
|
962
|
-
glass
|
|
963
|
-
>
|
|
964
|
-
This is an example of the {variant} callout variant with glass morphism effect against
|
|
965
|
-
a beautiful {index % 2 === 0 ? 'mountain' : 'forest'} background.
|
|
966
|
-
</Callout>
|
|
967
|
-
</div>
|
|
968
|
-
))}
|
|
969
|
-
</div>
|
|
970
|
-
</div>
|
|
971
|
-
);
|
|
972
|
-
};
|
|
973
|
-
|
|
974
|
-
export const AllGlassVariants: Story = {
|
|
975
|
-
render: () => <GlassVariantsTemplate />,
|
|
976
|
-
parameters: {
|
|
977
|
-
docs: {
|
|
978
|
-
description: {
|
|
979
|
-
story: 'Overview of all available callout variants with glass morphism effect.',
|
|
980
|
-
},
|
|
981
|
-
},
|
|
982
|
-
},
|
|
983
|
-
};
|
|
984
|
-
|
|
985
|
-
const GlassToastDemoTemplate = () => {
|
|
986
|
-
const [toasts, setToasts] = useState<{ id: string; variant: string }[]>([]);
|
|
987
|
-
|
|
988
|
-
const addToast = (variant: string) => {
|
|
989
|
-
const id = Math.random().toString(36).substring(2, 9);
|
|
990
|
-
setToasts([...toasts, { id, variant }]);
|
|
991
|
-
|
|
992
|
-
// Auto-remove after 5 seconds
|
|
993
|
-
setTimeout(() => {
|
|
994
|
-
setToasts(current => current.filter(toast => toast.id !== id));
|
|
995
|
-
}, 5000);
|
|
996
|
-
};
|
|
997
|
-
|
|
998
|
-
const removeToast = (id: string) => {
|
|
999
|
-
setToasts(current => current.filter(toast => toast.id !== id));
|
|
1000
|
-
};
|
|
1001
|
-
|
|
1002
|
-
const getIcon = (variant: string) => {
|
|
1003
|
-
switch (variant) {
|
|
1004
|
-
case 'success':
|
|
1005
|
-
return <SuccessIcon />;
|
|
1006
|
-
case 'warning':
|
|
1007
|
-
return <WarningIcon />;
|
|
1008
|
-
case 'error':
|
|
1009
|
-
return <ErrorIcon />;
|
|
1010
|
-
default:
|
|
1011
|
-
return <InfoIcon />;
|
|
1012
|
-
}
|
|
1013
|
-
};
|
|
1014
|
-
|
|
1015
|
-
const getTitle = (variant: string) => {
|
|
1016
|
-
switch (variant) {
|
|
1017
|
-
case 'success':
|
|
1018
|
-
return 'Glass Success';
|
|
1019
|
-
case 'warning':
|
|
1020
|
-
return 'Glass Warning';
|
|
1021
|
-
case 'error':
|
|
1022
|
-
return 'Glass Error';
|
|
1023
|
-
default:
|
|
1024
|
-
return 'Glass Info';
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
|
|
1028
|
-
const getMessage = (variant: string) => {
|
|
1029
|
-
switch (variant) {
|
|
1030
|
-
case 'success':
|
|
1031
|
-
return 'Glass operation completed successfully!';
|
|
1032
|
-
case 'warning':
|
|
1033
|
-
return 'Glass warning: Please review before continuing.';
|
|
1034
|
-
case 'error':
|
|
1035
|
-
return 'Glass error occurred. Please try again.';
|
|
1036
|
-
default:
|
|
1037
|
-
return 'This is a glass informational message.';
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
|
|
1041
|
-
return (
|
|
1042
|
-
<div className="u-relative u-min-h-screen u-p-8 u-bg-gradient-to-br u-from-red-500/[0.2] u-via-orange-500/[0.2] u-to-blue-500/[0.2]">
|
|
1043
|
-
{/* Additional background layers for depth */}
|
|
1044
|
-
<div
|
|
1045
|
-
className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-30"
|
|
1046
|
-
style={{
|
|
1047
|
-
backgroundImage:
|
|
1048
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
1049
|
-
}}
|
|
1050
|
-
/>
|
|
1051
|
-
|
|
1052
|
-
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-4">
|
|
1053
|
-
<div className="u-flex u-gap-2 u-flex-wrap">
|
|
1054
|
-
<Button
|
|
1055
|
-
label="Add Glass Info Toast"
|
|
1056
|
-
variant="primary"
|
|
1057
|
-
size="sm"
|
|
1058
|
-
onClick={() => addToast('info')}
|
|
1059
|
-
/>
|
|
1060
|
-
<Button
|
|
1061
|
-
label="Add Glass Success Toast"
|
|
1062
|
-
variant="success"
|
|
1063
|
-
size="sm"
|
|
1064
|
-
onClick={() => addToast('success')}
|
|
1065
|
-
/>
|
|
1066
|
-
<Button
|
|
1067
|
-
label="Add Glass Warning Toast"
|
|
1068
|
-
variant="warning"
|
|
1069
|
-
size="sm"
|
|
1070
|
-
onClick={() => addToast('warning')}
|
|
1071
|
-
/>
|
|
1072
|
-
<Button
|
|
1073
|
-
label="Add Glass Error Toast"
|
|
1074
|
-
variant="error"
|
|
1075
|
-
size="sm"
|
|
1076
|
-
onClick={() => addToast('error')}
|
|
1077
|
-
/>
|
|
1078
|
-
</div>
|
|
1079
|
-
|
|
1080
|
-
<div className="u-relative u-h-96 u-border-2 u-border-white/[0.2] u-rounded-xl u-p-5 u-overflow-hidden u-bg-gradient-to-tr u-from-red-500/[0.1] u-via-yellow-500/[0.1] u-to-blue-500/[0.1] u-backdrop-blur-sm">
|
|
1081
|
-
<div className="u-absolute u-top-5 u-right-5 u-flex u-flex-col u-gap-3 u-max-w-xs">
|
|
1082
|
-
{toasts.map(toast => (
|
|
1083
|
-
<Callout
|
|
1084
|
-
key={toast.id}
|
|
1085
|
-
title={getTitle(toast.variant)}
|
|
1086
|
-
variant={toast.variant as any}
|
|
1087
|
-
icon={getIcon(toast.variant)}
|
|
1088
|
-
isToast={true}
|
|
1089
|
-
glass
|
|
1090
|
-
onClose={() => removeToast(toast.id)}
|
|
1091
|
-
>
|
|
1092
|
-
{getMessage(toast.variant)}
|
|
1093
|
-
</Callout>
|
|
1094
|
-
))}
|
|
1095
|
-
</div>
|
|
1096
|
-
{toasts.length === 0 && (
|
|
1097
|
-
<div className="u-flex u-h-full u-items-center u-justify-center u-text-white u-text-center u-leading-tight u-font-medium">
|
|
1098
|
-
<div>
|
|
1099
|
-
<div className="u-mb-2">
|
|
1100
|
-
✨ Click a button above to show glass toast notifications here ✨
|
|
1101
|
-
</div>
|
|
1102
|
-
<small className="u-opacity-80">
|
|
1103
|
-
Beautiful colorful backgrounds help visualize the glass morphism effect
|
|
1104
|
-
</small>
|
|
1105
|
-
</div>
|
|
1106
|
-
</div>
|
|
1107
|
-
)}
|
|
1108
|
-
</div>
|
|
1109
|
-
</div>
|
|
1110
|
-
</div>
|
|
1111
|
-
);
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1114
|
-
export const GlassToastDemo: Story = {
|
|
1115
|
-
render: () => <GlassToastDemoTemplate />,
|
|
1116
|
-
parameters: {
|
|
1117
|
-
docs: {
|
|
1118
|
-
description: {
|
|
1119
|
-
story:
|
|
1120
|
-
'Interactive demo showing glass toast notifications with enhanced visual appeal against a gradient background.',
|
|
1121
|
-
},
|
|
1122
|
-
},
|
|
1123
|
-
},
|
|
278
|
+
),
|
|
1124
279
|
};
|