@shohojdhara/atomix 0.3.14 → 0.3.15
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/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- 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 +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { fn } from '@storybook/test';
|
|
3
4
|
import { Toggle } from './Toggle';
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -9,8 +10,61 @@ const meta = {
|
|
|
9
10
|
layout: 'centered',
|
|
10
11
|
docs: {
|
|
11
12
|
description: {
|
|
12
|
-
component:
|
|
13
|
-
|
|
13
|
+
component: `
|
|
14
|
+
# Toggle
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
Toggle provides an on/off switch control for binary choices. It offers a more visually distinct alternative to checkboxes for settings, preferences, or feature toggles. Toggles support disabled states and can include glass morphism effects.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- On/off state control
|
|
23
|
+
- Uncontrolled and controlled usage
|
|
24
|
+
- Disabled state
|
|
25
|
+
- Glass morphism effect
|
|
26
|
+
- Accessible design
|
|
27
|
+
- Responsive behavior
|
|
28
|
+
|
|
29
|
+
## Accessibility
|
|
30
|
+
|
|
31
|
+
- Keyboard support: Toggle with Space or Enter key
|
|
32
|
+
- Screen reader: State changes announced appropriately
|
|
33
|
+
- ARIA support: Proper roles and properties for toggle components
|
|
34
|
+
- Focus management: Visible focus indicators maintained
|
|
35
|
+
|
|
36
|
+
## Usage Examples
|
|
37
|
+
|
|
38
|
+
### Basic Usage
|
|
39
|
+
|
|
40
|
+
\`\`\`tsx
|
|
41
|
+
<Toggle
|
|
42
|
+
defaultChecked={false}
|
|
43
|
+
onChange={(checked) => console.log(checked)}
|
|
44
|
+
/>
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
### Controlled Usage
|
|
48
|
+
|
|
49
|
+
\`\`\`tsx
|
|
50
|
+
<Toggle
|
|
51
|
+
checked={isEnabled}
|
|
52
|
+
onChange={setEnabled}
|
|
53
|
+
/>
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
## API Reference
|
|
57
|
+
|
|
58
|
+
### Props
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Default | Description |
|
|
61
|
+
| ---- | ---- | ------- | ----------- |
|
|
62
|
+
| defaultChecked | boolean | false | Whether the toggle is initially on (uncontrolled) |
|
|
63
|
+
| checked | boolean | - | Whether the toggle is on (controlled) |
|
|
64
|
+
| onChange | (checked: boolean) => void | - | Callback when the toggle state changes |
|
|
65
|
+
| disabled | boolean | false | Whether the toggle is disabled |
|
|
66
|
+
| glass | boolean | false | Enable glass morphism effect |
|
|
67
|
+
`,
|
|
14
68
|
},
|
|
15
69
|
},
|
|
16
70
|
},
|
|
@@ -19,11 +73,18 @@ const meta = {
|
|
|
19
73
|
defaultChecked: {
|
|
20
74
|
control: { type: 'boolean' },
|
|
21
75
|
description: 'Whether the toggle is initially on (uncontrolled)',
|
|
22
|
-
|
|
76
|
+
table: {
|
|
77
|
+
type: { summary: 'boolean' },
|
|
78
|
+
defaultValue: { summary: false },
|
|
79
|
+
},
|
|
23
80
|
},
|
|
24
81
|
checked: {
|
|
25
82
|
control: { type: 'boolean' },
|
|
26
83
|
description: 'Whether the toggle is on (controlled)',
|
|
84
|
+
table: {
|
|
85
|
+
type: { summary: 'boolean' },
|
|
86
|
+
defaultValue: { summary: '-' },
|
|
87
|
+
},
|
|
27
88
|
},
|
|
28
89
|
onChange: {
|
|
29
90
|
action: 'changed',
|
|
@@ -32,11 +93,18 @@ const meta = {
|
|
|
32
93
|
disabled: {
|
|
33
94
|
control: { type: 'boolean' },
|
|
34
95
|
description: 'Whether the toggle is disabled',
|
|
35
|
-
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'boolean' },
|
|
98
|
+
defaultValue: { summary: false },
|
|
99
|
+
},
|
|
36
100
|
},
|
|
37
101
|
glass: {
|
|
38
102
|
control: 'boolean',
|
|
39
103
|
description: 'Enable glass morphism effect',
|
|
104
|
+
table: {
|
|
105
|
+
type: { summary: 'boolean' },
|
|
106
|
+
defaultValue: { summary: false },
|
|
107
|
+
},
|
|
40
108
|
},
|
|
41
109
|
},
|
|
42
110
|
} satisfies Meta<typeof Toggle>;
|
|
@@ -44,7 +112,7 @@ const meta = {
|
|
|
44
112
|
export default meta;
|
|
45
113
|
type Story = StoryObj<typeof meta>;
|
|
46
114
|
|
|
47
|
-
export const
|
|
115
|
+
export const BasicUsage: Story = {
|
|
48
116
|
render: args => (
|
|
49
117
|
<div style={{ display: 'flex', justifyContent: 'center', padding: '30px' }}>
|
|
50
118
|
<Toggle {...args} />
|
|
@@ -54,11 +122,15 @@ export const Default: Story = {
|
|
|
54
122
|
defaultChecked: false,
|
|
55
123
|
disabled: false,
|
|
56
124
|
},
|
|
125
|
+
parameters: {
|
|
126
|
+
docs: {
|
|
127
|
+
description: {
|
|
128
|
+
story: 'Basic toggle with default settings.',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
57
132
|
};
|
|
58
133
|
|
|
59
|
-
/**
|
|
60
|
-
* Controlled Toggle using checked and onChange.
|
|
61
|
-
*/
|
|
62
134
|
export const Controlled: Story = {
|
|
63
135
|
render: () => {
|
|
64
136
|
const [isChecked, setIsChecked] = React.useState(false);
|
|
@@ -69,6 +141,13 @@ export const Controlled: Story = {
|
|
|
69
141
|
</div>
|
|
70
142
|
);
|
|
71
143
|
},
|
|
144
|
+
parameters: {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story: 'Controlled toggle using checked and onChange.',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
72
151
|
};
|
|
73
152
|
|
|
74
153
|
export const InitiallyOn: Story = {
|
|
@@ -81,53 +160,61 @@ export const InitiallyOn: Story = {
|
|
|
81
160
|
defaultChecked: true,
|
|
82
161
|
disabled: false,
|
|
83
162
|
},
|
|
163
|
+
parameters: {
|
|
164
|
+
docs: {
|
|
165
|
+
description: {
|
|
166
|
+
story: 'Toggle that starts in the "on" position.',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
84
170
|
};
|
|
85
171
|
|
|
86
|
-
export const
|
|
87
|
-
render:
|
|
88
|
-
<div style={{ display: 'flex',
|
|
89
|
-
<
|
|
172
|
+
export const DisabledStates: Story = {
|
|
173
|
+
render: () => (
|
|
174
|
+
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '2rem', padding: '30px' }}>
|
|
175
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
|
|
176
|
+
<Toggle disabled={true} checked={false} />
|
|
177
|
+
<span>Disabled Off</span>
|
|
178
|
+
</div>
|
|
179
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
|
|
180
|
+
<Toggle disabled={true} checked={true} />
|
|
181
|
+
<span>Disabled On</span>
|
|
182
|
+
</div>
|
|
90
183
|
</div>
|
|
91
184
|
),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
185
|
+
parameters: {
|
|
186
|
+
docs: {
|
|
187
|
+
description: {
|
|
188
|
+
story: 'Toggle in both disabled states (off and on).',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
95
191
|
},
|
|
96
192
|
};
|
|
97
193
|
|
|
98
|
-
export const
|
|
194
|
+
export const WithGlassEffect: Story = {
|
|
99
195
|
render: args => (
|
|
100
|
-
<div style={{
|
|
196
|
+
<div style={{
|
|
197
|
+
display: 'flex',
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
padding: '30px',
|
|
200
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
201
|
+
minHeight: '200px'
|
|
202
|
+
}}>
|
|
101
203
|
<Toggle {...args} />
|
|
102
204
|
</div>
|
|
103
205
|
),
|
|
104
|
-
args: {
|
|
105
|
-
defaultChecked: true,
|
|
106
|
-
disabled: true,
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const Glass: Story = {
|
|
111
206
|
args: {
|
|
112
207
|
defaultChecked: false,
|
|
113
208
|
disabled: false,
|
|
114
209
|
glass: true,
|
|
115
210
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
display: 'flex',
|
|
124
|
-
alignItems: 'center',
|
|
125
|
-
justifyContent: 'center',
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
<Toggle {...args} />
|
|
129
|
-
</div>
|
|
130
|
-
),
|
|
211
|
+
parameters: {
|
|
212
|
+
docs: {
|
|
213
|
+
description: {
|
|
214
|
+
story: 'Toggle with glass morphism effect applied.',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
131
218
|
};
|
|
132
219
|
|
|
133
220
|
export const GlassOn: Story = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { fn } from '@storybook/test';
|
|
3
4
|
import type { AtomixGlassProps } from '../../lib/types/components';
|
|
4
5
|
import { Tooltip } from './Tooltip';
|
|
5
6
|
|
|
@@ -13,8 +14,69 @@ const meta = {
|
|
|
13
14
|
layout: 'fullscreen',
|
|
14
15
|
docs: {
|
|
15
16
|
description: {
|
|
16
|
-
component:
|
|
17
|
-
|
|
17
|
+
component: `
|
|
18
|
+
# Tooltip
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
Tooltip displays contextual information when users hover over or click on an element. It supports multiple positions, triggers, and can include rich content. Tooltips are useful for providing additional context without cluttering the interface.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- Multiple position options (top, bottom, left, right with corners)
|
|
27
|
+
- Hover and click triggers
|
|
28
|
+
- Configurable delays and offsets
|
|
29
|
+
- Glass morphism effect
|
|
30
|
+
- Rich content support
|
|
31
|
+
- Accessible design
|
|
32
|
+
- Responsive behavior
|
|
33
|
+
|
|
34
|
+
## Accessibility
|
|
35
|
+
|
|
36
|
+
- Screen reader: Tooltip content announced appropriately
|
|
37
|
+
- ARIA support: Proper roles and properties for tooltip components
|
|
38
|
+
- Keyboard support: Accessible via keyboard navigation
|
|
39
|
+
- Focus management: Maintains focus on trigger element
|
|
40
|
+
|
|
41
|
+
## Usage Examples
|
|
42
|
+
|
|
43
|
+
### Basic Usage
|
|
44
|
+
|
|
45
|
+
\`\`\`tsx
|
|
46
|
+
<Tooltip
|
|
47
|
+
content="Tooltip text"
|
|
48
|
+
position="top"
|
|
49
|
+
>
|
|
50
|
+
<button>Hover me</button>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
### With Glass Effect
|
|
55
|
+
|
|
56
|
+
\`\`\`tsx
|
|
57
|
+
<Tooltip
|
|
58
|
+
content="Tooltip text"
|
|
59
|
+
position="top"
|
|
60
|
+
glass={true}
|
|
61
|
+
>
|
|
62
|
+
<button>Hover me</button>
|
|
63
|
+
</Tooltip>
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
|
|
68
|
+
### Props
|
|
69
|
+
|
|
70
|
+
| Prop | Type | Default | Description |
|
|
71
|
+
| ---- | ---- | ------- | ----------- |
|
|
72
|
+
| position | Position | 'top' | Position of the tooltip relative to the trigger |
|
|
73
|
+
| trigger | 'hover' \\| 'click' | 'hover' | How the tooltip is triggered |
|
|
74
|
+
| delay | number | 200 | Delay in milliseconds before showing tooltip |
|
|
75
|
+
| offset | number | 10 | Offset distance from the trigger element |
|
|
76
|
+
| glass | boolean \\| GlassProps | false | Enable glass morphism effect |
|
|
77
|
+
| content | ReactNode | - | Content to display in the tooltip |
|
|
78
|
+
| children | ReactNode | - | Trigger element for the tooltip |
|
|
79
|
+
`,
|
|
18
80
|
},
|
|
19
81
|
},
|
|
20
82
|
},
|
|
@@ -32,24 +94,52 @@ const meta = {
|
|
|
32
94
|
'bottom-left',
|
|
33
95
|
'bottom-right',
|
|
34
96
|
],
|
|
35
|
-
|
|
97
|
+
description: 'Position of the tooltip relative to the trigger',
|
|
98
|
+
table: {
|
|
99
|
+
type: { summary: 'Position' },
|
|
100
|
+
defaultValue: { summary: 'top' },
|
|
101
|
+
},
|
|
36
102
|
},
|
|
37
103
|
trigger: {
|
|
38
104
|
control: { type: 'select' },
|
|
39
105
|
options: ['hover', 'click'],
|
|
40
|
-
|
|
106
|
+
description: 'How the tooltip is triggered',
|
|
107
|
+
table: {
|
|
108
|
+
type: { summary: '"hover" | "click"' },
|
|
109
|
+
defaultValue: { summary: 'hover' },
|
|
110
|
+
},
|
|
41
111
|
},
|
|
42
112
|
delay: {
|
|
43
113
|
control: { type: 'number' },
|
|
44
|
-
|
|
114
|
+
description: 'Delay in milliseconds before showing tooltip',
|
|
115
|
+
table: {
|
|
116
|
+
type: { summary: 'number' },
|
|
117
|
+
defaultValue: { summary: 200 },
|
|
118
|
+
},
|
|
45
119
|
},
|
|
46
120
|
offset: {
|
|
47
121
|
control: { type: 'number' },
|
|
48
|
-
|
|
122
|
+
description: 'Offset distance from the trigger element',
|
|
123
|
+
table: {
|
|
124
|
+
type: { summary: 'number' },
|
|
125
|
+
defaultValue: { summary: 10 },
|
|
126
|
+
},
|
|
49
127
|
},
|
|
50
128
|
glass: {
|
|
51
129
|
control: { type: 'boolean' },
|
|
52
130
|
description: 'Enable glass morphism effect',
|
|
131
|
+
table: {
|
|
132
|
+
type: { summary: 'boolean | GlassProps' },
|
|
133
|
+
defaultValue: { summary: false },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
content: {
|
|
137
|
+
control: 'object',
|
|
138
|
+
description: 'Content to display in the tooltip',
|
|
139
|
+
table: {
|
|
140
|
+
type: { summary: 'ReactNode' },
|
|
141
|
+
defaultValue: { summary: '-' },
|
|
142
|
+
},
|
|
53
143
|
},
|
|
54
144
|
},
|
|
55
145
|
} satisfies Meta<typeof Tooltip>;
|
|
@@ -57,8 +147,7 @@ const meta = {
|
|
|
57
147
|
export default meta;
|
|
58
148
|
type Story = StoryObj<typeof meta>;
|
|
59
149
|
|
|
60
|
-
|
|
61
|
-
export const Default: Story = {
|
|
150
|
+
export const BasicUsage: Story = {
|
|
62
151
|
render: args => (
|
|
63
152
|
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
64
153
|
<Tooltip {...args}>
|
|
@@ -71,6 +160,13 @@ export const Default: Story = {
|
|
|
71
160
|
position: 'top',
|
|
72
161
|
trigger: 'hover',
|
|
73
162
|
} as any,
|
|
163
|
+
parameters: {
|
|
164
|
+
docs: {
|
|
165
|
+
description: {
|
|
166
|
+
story: 'Default tooltip with top position and hover trigger.',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
74
170
|
};
|
|
75
171
|
|
|
76
172
|
export const ClickTrigger: Story = {
|
|
@@ -86,117 +182,111 @@ export const ClickTrigger: Story = {
|
|
|
86
182
|
position: 'top',
|
|
87
183
|
trigger: 'click',
|
|
88
184
|
} as any,
|
|
185
|
+
parameters: {
|
|
186
|
+
docs: {
|
|
187
|
+
description: {
|
|
188
|
+
story: 'Tooltip with click trigger instead of hover.',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
89
192
|
};
|
|
90
193
|
|
|
91
|
-
export const
|
|
92
|
-
render:
|
|
93
|
-
<div style={{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
150
|
-
<Tooltip {...args}>
|
|
151
|
-
<button className="c-btn c-btn--primary">Hover me (500ms delay)</button>
|
|
152
|
-
</Tooltip>
|
|
194
|
+
export const AllPositions: Story = {
|
|
195
|
+
render: () => (
|
|
196
|
+
<div style={{
|
|
197
|
+
display: 'grid',
|
|
198
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
199
|
+
gap: '20px',
|
|
200
|
+
padding: '50px',
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
justifyItems: 'center',
|
|
203
|
+
height: '500px'
|
|
204
|
+
}}>
|
|
205
|
+
<div>
|
|
206
|
+
<Tooltip content="Top Left Tooltip">
|
|
207
|
+
<button className="c-btn c-btn--primary">Top Left</button>
|
|
208
|
+
</Tooltip>
|
|
209
|
+
</div>
|
|
210
|
+
<div>
|
|
211
|
+
<Tooltip content="Top Tooltip" position="top">
|
|
212
|
+
<button className="c-btn c-btn--primary">Top</button>
|
|
213
|
+
</Tooltip>
|
|
214
|
+
</div>
|
|
215
|
+
<div>
|
|
216
|
+
<Tooltip content="Top Right Tooltip" position="top-right">
|
|
217
|
+
<button className="c-btn c-btn--primary">Top Right</button>
|
|
218
|
+
</Tooltip>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div>
|
|
222
|
+
<Tooltip content="Left Tooltip" position="left">
|
|
223
|
+
<button className="c-btn c-btn--primary">Left</button>
|
|
224
|
+
</Tooltip>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<div style={{ textAlign: 'center' }}>
|
|
228
|
+
<p>All tooltip positions</p>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div>
|
|
232
|
+
<Tooltip content="Right Tooltip" position="right">
|
|
233
|
+
<button className="c-btn c-btn--primary">Right</button>
|
|
234
|
+
</Tooltip>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<div>
|
|
238
|
+
<Tooltip content="Bottom Left Tooltip" position="bottom-left">
|
|
239
|
+
<button className="c-btn c-btn--primary">Bottom Left</button>
|
|
240
|
+
</Tooltip>
|
|
241
|
+
</div>
|
|
242
|
+
<div>
|
|
243
|
+
<Tooltip content="Bottom Tooltip" position="bottom">
|
|
244
|
+
<button className="c-btn c-btn--primary">Bottom</button>
|
|
245
|
+
</Tooltip>
|
|
246
|
+
</div>
|
|
247
|
+
<div>
|
|
248
|
+
<Tooltip content="Bottom Right Tooltip" position="bottom-right">
|
|
249
|
+
<button className="c-btn c-btn--primary">Bottom Right</button>
|
|
250
|
+
</Tooltip>
|
|
251
|
+
</div>
|
|
153
252
|
</div>
|
|
154
253
|
),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
254
|
+
parameters: {
|
|
255
|
+
docs: {
|
|
256
|
+
description: {
|
|
257
|
+
story: 'All available tooltip positions demonstrated.',
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
160
261
|
};
|
|
161
262
|
|
|
162
|
-
export const
|
|
263
|
+
export const WithGlassEffect: Story = {
|
|
163
264
|
render: args => (
|
|
164
|
-
<div style={{
|
|
265
|
+
<div style={{
|
|
266
|
+
display: 'flex',
|
|
267
|
+
justifyContent: 'center',
|
|
268
|
+
padding: '100px',
|
|
269
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
270
|
+
minHeight: '300px'
|
|
271
|
+
}}>
|
|
165
272
|
<Tooltip {...args}>
|
|
166
273
|
<button className="c-btn c-btn--primary">Hover me</button>
|
|
167
274
|
</Tooltip>
|
|
168
275
|
</div>
|
|
169
276
|
),
|
|
170
277
|
args: {
|
|
171
|
-
content: <p className="u-mb-0">
|
|
278
|
+
content: <p className="u-mb-0">Tooltip with glass effect applied</p>,
|
|
172
279
|
position: 'top',
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export const RichContent: Story = {
|
|
178
|
-
render: args => (
|
|
179
|
-
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
180
|
-
<Tooltip {...args}>
|
|
181
|
-
<button className="c-btn c-btn--primary">Click for rich content</button>
|
|
182
|
-
</Tooltip>
|
|
183
|
-
</div>
|
|
184
|
-
),
|
|
185
|
-
args: {
|
|
186
|
-
content: (
|
|
187
|
-
<div>
|
|
188
|
-
<h4 style={{ marginTop: 0, marginBottom: '8px' }}>Rich Tooltip Content</h4>
|
|
189
|
-
<ul style={{ margin: 0, paddingLeft: '16px' }}>
|
|
190
|
-
<li>Supports HTML content</li>
|
|
191
|
-
<li>Can include multiple elements</li>
|
|
192
|
-
<li>Helpful for complex information</li>
|
|
193
|
-
</ul>
|
|
194
|
-
</div>
|
|
195
|
-
),
|
|
196
|
-
position: 'bottom',
|
|
197
|
-
trigger: 'click',
|
|
198
|
-
offset: 15,
|
|
280
|
+
trigger: 'hover',
|
|
281
|
+
glass: true,
|
|
199
282
|
} as any,
|
|
283
|
+
parameters: {
|
|
284
|
+
docs: {
|
|
285
|
+
description: {
|
|
286
|
+
story: 'Tooltip with glass morphism effect applied.',
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
200
290
|
};
|
|
201
291
|
|
|
202
292
|
/**
|