@shohojdhara/atomix 0.3.5 → 0.3.6
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 +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +260 -179
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +250 -179
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +61 -66
- package/dist/charts.js.map +1 -1
- package/dist/core.js +47 -31
- package/dist/core.js.map +1 -1
- package/dist/forms.js +47 -31
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +47 -31
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1841 -1633
- package/dist/index.esm.js +4975 -4113
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5151 -4290
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +1572 -1442
- package/dist/theme.js +4816 -4080
- package/dist/theme.js.map +1 -1
- package/package.json +6 -20
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Chart/AnimatedChart.tsx +0 -1
- package/src/components/Chart/AreaChart.tsx +0 -1
- package/src/components/Chart/BarChart.tsx +0 -1
- package/src/components/Chart/BubbleChart.tsx +0 -1
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +0 -1
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +0 -1
- package/src/components/Chart/ScatterChart.tsx +0 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +7 -0
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +83 -3
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +1 -0
- package/src/lib/composables/useAtomixGlass.ts +2 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +2 -1
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +254 -0
- package/src/lib/theme/config/loader.ts +37 -48
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +19 -6
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +155 -0
- package/src/lib/theme/core/createTheme.ts +94 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
- package/src/lib/theme/core/index.ts +5 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +52 -111
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +1 -1
- package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
- package/src/lib/theme/runtime/index.ts +1 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
- package/src/lib/theme-tools.ts +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/sync-theme-config.js +0 -309
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -665
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -446
- package/src/styles/03-generic/_generated-root.css +0 -26
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -68
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
- /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { fn } from '@storybook/test';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
3
|
import { Popover, PopoverTrigger } from './Popover';
|
|
5
4
|
import { Toggle } from '../Toggle/Toggle';
|
|
6
5
|
import { Button } from '../Button/Button';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
const meta = {
|
|
9
8
|
title: 'Components/Popover',
|
|
10
9
|
component: Popover,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
'The Popover component displays floating content relative to a trigger element. It provides a flexible way to show additional information, actions, or controls without navigating away from the current context. Popovers support multiple positions, click or hover triggers, and can include rich interactive content.',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
tags: ['autodocs'],
|
|
11
20
|
argTypes: {
|
|
12
21
|
position: {
|
|
13
22
|
control: { type: 'select' },
|
|
@@ -47,10 +56,13 @@ export default {
|
|
|
47
56
|
description: 'Enable glass morphism effect',
|
|
48
57
|
},
|
|
49
58
|
},
|
|
50
|
-
}
|
|
59
|
+
} satisfies Meta<typeof Popover>;
|
|
60
|
+
|
|
61
|
+
export default meta;
|
|
62
|
+
type Story = StoryObj<typeof meta>;
|
|
51
63
|
|
|
52
|
-
//
|
|
53
|
-
const
|
|
64
|
+
// Helper component for interactive stories
|
|
65
|
+
const InteractivePopover = (args: React.ComponentProps<typeof Popover>) => {
|
|
54
66
|
const selectOptions = [
|
|
55
67
|
{ value: '1', label: 'Option 1' },
|
|
56
68
|
{ value: '2', label: 'Option 2' },
|
|
@@ -103,143 +115,207 @@ const Template: StoryFn<typeof Popover> = args => {
|
|
|
103
115
|
);
|
|
104
116
|
};
|
|
105
117
|
|
|
106
|
-
export const Default =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
export const Default: Story = {
|
|
119
|
+
render: args => <InteractivePopover {...args} />,
|
|
120
|
+
args: {
|
|
121
|
+
position: 'top',
|
|
122
|
+
trigger: 'click',
|
|
123
|
+
offset: 12,
|
|
124
|
+
delay: 0,
|
|
125
|
+
defaultOpen: false,
|
|
126
|
+
closeOnClickOutside: true,
|
|
127
|
+
closeOnEscape: true,
|
|
128
|
+
} as any,
|
|
115
129
|
};
|
|
116
130
|
|
|
117
|
-
export const Hover =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
export const Hover: Story = {
|
|
132
|
+
render: args => <InteractivePopover {...args} />,
|
|
133
|
+
args: {
|
|
134
|
+
position: 'top',
|
|
135
|
+
trigger: 'hover',
|
|
136
|
+
offset: 12,
|
|
137
|
+
delay: 200,
|
|
138
|
+
defaultOpen: false,
|
|
139
|
+
closeOnClickOutside: true,
|
|
140
|
+
closeOnEscape: true,
|
|
141
|
+
} as any,
|
|
122
142
|
};
|
|
123
143
|
|
|
124
|
-
export const BottomPosition =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
export const BottomPosition: Story = {
|
|
145
|
+
render: args => <InteractivePopover {...args} />,
|
|
146
|
+
args: {
|
|
147
|
+
position: 'bottom',
|
|
148
|
+
trigger: 'click',
|
|
149
|
+
offset: 12,
|
|
150
|
+
delay: 0,
|
|
151
|
+
defaultOpen: false,
|
|
152
|
+
closeOnClickOutside: true,
|
|
153
|
+
closeOnEscape: true,
|
|
154
|
+
} as any,
|
|
128
155
|
};
|
|
129
156
|
|
|
130
|
-
export const LeftPosition =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
157
|
+
export const LeftPosition: Story = {
|
|
158
|
+
render: args => <InteractivePopover {...args} />,
|
|
159
|
+
args: {
|
|
160
|
+
position: 'left',
|
|
161
|
+
trigger: 'click',
|
|
162
|
+
offset: 12,
|
|
163
|
+
delay: 0,
|
|
164
|
+
defaultOpen: false,
|
|
165
|
+
closeOnClickOutside: true,
|
|
166
|
+
closeOnEscape: true,
|
|
167
|
+
} as any,
|
|
134
168
|
};
|
|
135
169
|
|
|
136
|
-
export const RightPosition =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
170
|
+
export const RightPosition: Story = {
|
|
171
|
+
render: args => <InteractivePopover {...args} />,
|
|
172
|
+
args: {
|
|
173
|
+
position: 'right',
|
|
174
|
+
trigger: 'click',
|
|
175
|
+
offset: 12,
|
|
176
|
+
delay: 0,
|
|
177
|
+
defaultOpen: false,
|
|
178
|
+
closeOnClickOutside: true,
|
|
179
|
+
closeOnEscape: true,
|
|
180
|
+
} as any,
|
|
140
181
|
};
|
|
141
182
|
|
|
142
|
-
export const AutoPosition =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
183
|
+
export const AutoPosition: Story = {
|
|
184
|
+
render: args => <InteractivePopover {...args} />,
|
|
185
|
+
args: {
|
|
186
|
+
position: 'auto',
|
|
187
|
+
trigger: 'click',
|
|
188
|
+
offset: 12,
|
|
189
|
+
delay: 0,
|
|
190
|
+
defaultOpen: true, // Open by default to showcase auto-positioning
|
|
191
|
+
closeOnClickOutside: true,
|
|
192
|
+
closeOnEscape: true,
|
|
193
|
+
} as any,
|
|
147
194
|
};
|
|
148
195
|
|
|
149
196
|
/**
|
|
150
197
|
* Glass morphism popover example.
|
|
151
198
|
*/
|
|
152
|
-
export const GlassPopover =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
199
|
+
export const GlassPopover: Story = {
|
|
200
|
+
render: args => <InteractivePopover {...args} />,
|
|
201
|
+
args: {
|
|
202
|
+
position: 'top',
|
|
203
|
+
trigger: 'click',
|
|
204
|
+
offset: 12,
|
|
205
|
+
delay: 0,
|
|
206
|
+
defaultOpen: false,
|
|
207
|
+
closeOnClickOutside: true,
|
|
208
|
+
closeOnEscape: true,
|
|
209
|
+
glass: true,
|
|
210
|
+
} as any,
|
|
211
|
+
decorators: [
|
|
212
|
+
Story => (
|
|
213
|
+
<div
|
|
214
|
+
style={{
|
|
215
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
216
|
+
minHeight: '100vh',
|
|
217
|
+
padding: '2rem',
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
<Story />
|
|
221
|
+
</div>
|
|
222
|
+
),
|
|
223
|
+
],
|
|
156
224
|
};
|
|
157
|
-
GlassPopover.decorators = [
|
|
158
|
-
Story => (
|
|
159
|
-
<div
|
|
160
|
-
style={{
|
|
161
|
-
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
162
|
-
minHeight: '100vh',
|
|
163
|
-
padding: '2rem',
|
|
164
|
-
}}
|
|
165
|
-
>
|
|
166
|
-
<Story />
|
|
167
|
-
</div>
|
|
168
|
-
),
|
|
169
|
-
];
|
|
170
225
|
|
|
171
226
|
/**
|
|
172
227
|
* Glass popover with custom settings.
|
|
173
228
|
*/
|
|
174
|
-
export const GlassPopoverCustom =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
229
|
+
export const GlassPopoverCustom: Story = {
|
|
230
|
+
render: args => <InteractivePopover {...args} />,
|
|
231
|
+
args: {
|
|
232
|
+
position: 'top',
|
|
233
|
+
trigger: 'click',
|
|
234
|
+
offset: 12,
|
|
235
|
+
delay: 0,
|
|
236
|
+
defaultOpen: false,
|
|
237
|
+
closeOnClickOutside: true,
|
|
238
|
+
closeOnEscape: true,
|
|
239
|
+
glass: {
|
|
240
|
+
displacementScale: 80,
|
|
241
|
+
blurAmount: 2,
|
|
242
|
+
saturation: 200,
|
|
243
|
+
aberrationIntensity: 1,
|
|
244
|
+
cornerRadius: 16,
|
|
245
|
+
mode: 'polar',
|
|
246
|
+
} as any,
|
|
247
|
+
} as any,
|
|
248
|
+
decorators: [
|
|
249
|
+
Story => (
|
|
250
|
+
<div
|
|
251
|
+
style={{
|
|
252
|
+
background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
|
|
253
|
+
minHeight: '100vh',
|
|
254
|
+
padding: '2rem',
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
<Story />
|
|
258
|
+
</div>
|
|
259
|
+
),
|
|
260
|
+
],
|
|
185
261
|
};
|
|
186
|
-
GlassPopoverCustom.decorators = [
|
|
187
|
-
Story => (
|
|
188
|
-
<div
|
|
189
|
-
style={{
|
|
190
|
-
background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
|
|
191
|
-
minHeight: '100vh',
|
|
192
|
-
padding: '2rem',
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
<Story />
|
|
196
|
-
</div>
|
|
197
|
-
),
|
|
198
|
-
];
|
|
199
262
|
|
|
200
263
|
/**
|
|
201
264
|
* Glass popover with hover trigger.
|
|
202
265
|
*/
|
|
203
|
-
export const GlassPopoverHover =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
266
|
+
export const GlassPopoverHover: Story = {
|
|
267
|
+
render: args => <InteractivePopover {...args} />,
|
|
268
|
+
args: {
|
|
269
|
+
position: 'top',
|
|
270
|
+
trigger: 'hover',
|
|
271
|
+
offset: 12,
|
|
272
|
+
delay: 200,
|
|
273
|
+
defaultOpen: false,
|
|
274
|
+
closeOnClickOutside: true,
|
|
275
|
+
closeOnEscape: true,
|
|
276
|
+
glass: true,
|
|
277
|
+
} as any,
|
|
278
|
+
decorators: [
|
|
279
|
+
Story => (
|
|
280
|
+
<div
|
|
281
|
+
style={{
|
|
282
|
+
background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
|
283
|
+
minHeight: '100vh',
|
|
284
|
+
padding: '2rem',
|
|
285
|
+
}}
|
|
286
|
+
>
|
|
287
|
+
<Story />
|
|
288
|
+
</div>
|
|
289
|
+
),
|
|
290
|
+
],
|
|
209
291
|
};
|
|
210
|
-
GlassPopoverHover.decorators = [
|
|
211
|
-
Story => (
|
|
212
|
-
<div
|
|
213
|
-
style={{
|
|
214
|
-
background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
|
215
|
-
minHeight: '100vh',
|
|
216
|
-
padding: '2rem',
|
|
217
|
-
}}
|
|
218
|
-
>
|
|
219
|
-
<Story />
|
|
220
|
-
</div>
|
|
221
|
-
),
|
|
222
|
-
];
|
|
223
292
|
|
|
224
293
|
/**
|
|
225
294
|
* Glass popover with different positions.
|
|
226
295
|
*/
|
|
227
|
-
export const GlassPopoverPositions =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
296
|
+
export const GlassPopoverPositions: Story = {
|
|
297
|
+
render: args => <InteractivePopover {...args} />,
|
|
298
|
+
args: {
|
|
299
|
+
position: 'top',
|
|
300
|
+
trigger: 'click',
|
|
301
|
+
offset: 12,
|
|
302
|
+
delay: 0,
|
|
303
|
+
defaultOpen: true,
|
|
304
|
+
closeOnClickOutside: true,
|
|
305
|
+
closeOnEscape: true,
|
|
306
|
+
glass: true,
|
|
307
|
+
} as any,
|
|
308
|
+
decorators: [
|
|
309
|
+
Story => (
|
|
310
|
+
<div
|
|
311
|
+
style={{
|
|
312
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
313
|
+
minHeight: '100vh',
|
|
314
|
+
padding: '2rem',
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<Story />
|
|
318
|
+
</div>
|
|
319
|
+
),
|
|
320
|
+
],
|
|
232
321
|
};
|
|
233
|
-
GlassPopoverPositions.decorators = [
|
|
234
|
-
Story => (
|
|
235
|
-
<div
|
|
236
|
-
style={{
|
|
237
|
-
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
238
|
-
minHeight: '100vh',
|
|
239
|
-
padding: '2rem',
|
|
240
|
-
}}
|
|
241
|
-
>
|
|
242
|
-
<Story />
|
|
243
|
-
</div>
|
|
244
|
-
),
|
|
245
|
-
];
|
|
@@ -1,88 +1,110 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { ProductReview } from './ProductReview';
|
|
4
|
+
import { THEME_COLORS } from '../../lib/constants/components';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const meta = {
|
|
7
7
|
title: 'Components/ProductReview',
|
|
8
8
|
component: ProductReview,
|
|
9
9
|
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
10
11
|
docs: {
|
|
11
12
|
description: {
|
|
12
|
-
component:
|
|
13
|
+
component:
|
|
14
|
+
'The ProductReview component provides a comprehensive form for collecting user ratings and feedback on products. It supports customizable rating scales, half-star ratings, product images, and detailed comment sections. Ideal for e-commerce sites, review platforms, or any application requiring product feedback collection.',
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
17
|
},
|
|
18
|
+
tags: ['autodocs'],
|
|
16
19
|
argTypes: {
|
|
17
|
-
productName: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
productName: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Name of the product being reviewed',
|
|
23
|
+
},
|
|
24
|
+
productImage: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'URL of the product image',
|
|
27
|
+
},
|
|
28
|
+
initialRating: {
|
|
29
|
+
control: { type: 'number', min: 0, max: 5, step: 0.5 },
|
|
30
|
+
description: 'Initial rating value',
|
|
31
|
+
},
|
|
32
|
+
maxRating: {
|
|
33
|
+
control: { type: 'number', min: 1, max: 10 },
|
|
34
|
+
description: 'Maximum rating value',
|
|
35
|
+
},
|
|
36
|
+
allowHalf: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Whether to allow half-star ratings',
|
|
39
|
+
},
|
|
22
40
|
ratingColor: {
|
|
23
41
|
control: {
|
|
24
42
|
type: 'select',
|
|
25
|
-
options:
|
|
43
|
+
options: THEME_COLORS,
|
|
26
44
|
},
|
|
45
|
+
description: 'Color variant for the rating stars',
|
|
27
46
|
},
|
|
28
47
|
},
|
|
29
|
-
}
|
|
48
|
+
} satisfies Meta<typeof ProductReview>;
|
|
30
49
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
50
|
+
export default meta;
|
|
51
|
+
type Story = StoryObj<typeof meta>;
|
|
34
52
|
|
|
35
|
-
export const Default =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
export const Default: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
productName: 'Wireless Headphones',
|
|
56
|
+
productImage: 'https://via.placeholder.com/100',
|
|
57
|
+
initialRating: 0,
|
|
58
|
+
maxRating: 5,
|
|
59
|
+
allowHalf: true,
|
|
60
|
+
ratingColor: 'warning',
|
|
61
|
+
onSubmit: (rating: number, comment: string) => {
|
|
62
|
+
console.log('Rating:', rating);
|
|
63
|
+
console.log('Comment:', comment);
|
|
64
|
+
},
|
|
46
65
|
},
|
|
47
66
|
};
|
|
48
67
|
|
|
49
|
-
export const WithInitialRating =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
68
|
+
export const WithInitialRating: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
productName: 'Smart Watch',
|
|
71
|
+
productImage: 'https://via.placeholder.com/100',
|
|
72
|
+
initialRating: 4,
|
|
73
|
+
maxRating: 5,
|
|
74
|
+
allowHalf: true,
|
|
75
|
+
ratingColor: 'warning',
|
|
76
|
+
onSubmit: (rating: number, comment: string) => {
|
|
77
|
+
console.log('Rating:', rating);
|
|
78
|
+
console.log('Comment:', comment);
|
|
79
|
+
},
|
|
60
80
|
},
|
|
61
81
|
};
|
|
62
82
|
|
|
63
|
-
export const WithoutImage =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
export const WithoutImage: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
productName: 'Bluetooth Speaker',
|
|
86
|
+
initialRating: 0,
|
|
87
|
+
maxRating: 5,
|
|
88
|
+
allowHalf: true,
|
|
89
|
+
ratingColor: 'warning',
|
|
90
|
+
onSubmit: (rating: number, comment: string) => {
|
|
91
|
+
console.log('Rating:', rating);
|
|
92
|
+
console.log('Comment:', comment);
|
|
93
|
+
},
|
|
73
94
|
},
|
|
74
95
|
};
|
|
75
96
|
|
|
76
|
-
export const CustomRatingScale =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
export const CustomRatingScale: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
productName: 'Gaming Laptop',
|
|
100
|
+
productImage: 'https://via.placeholder.com/100',
|
|
101
|
+
initialRating: 0,
|
|
102
|
+
maxRating: 10,
|
|
103
|
+
allowHalf: false,
|
|
104
|
+
ratingColor: 'primary',
|
|
105
|
+
onSubmit: (rating: number, comment: string) => {
|
|
106
|
+
console.log('Rating:', rating);
|
|
107
|
+
console.log('Comment:', comment);
|
|
108
|
+
},
|
|
87
109
|
},
|
|
88
110
|
};
|
|
@@ -1,75 +1,105 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Meta,
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { Progress } from './Progress';
|
|
4
|
-
import {
|
|
4
|
+
import { THEME_COLORS, SIZES } from '../../lib/constants/components';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const meta = {
|
|
7
7
|
title: 'Components/Progress',
|
|
8
8
|
component: Progress,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'The Progress component displays the completion status of a task or process. It provides visual feedback on progress through a horizontal bar that fills based on a percentage value. Progress bars support multiple variants, sizes, and can be used to show loading states, form completion, or any incremental process.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
decorators: [
|
|
20
|
+
Story => (
|
|
21
|
+
<div style={{ width: '50%' }}>
|
|
22
|
+
<Story />
|
|
23
|
+
</div>
|
|
24
|
+
),
|
|
25
|
+
],
|
|
9
26
|
argTypes: {
|
|
10
|
-
value: {
|
|
27
|
+
value: {
|
|
28
|
+
control: { type: 'range', min: 0, max: 100 },
|
|
29
|
+
description: 'The progress value as a percentage (0-100)',
|
|
30
|
+
defaultValue: 50,
|
|
31
|
+
},
|
|
11
32
|
variant: {
|
|
12
|
-
control: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
33
|
+
control: { type: 'select' },
|
|
34
|
+
options: THEME_COLORS,
|
|
35
|
+
description: 'The color variant of the progress bar',
|
|
36
|
+
defaultValue: 'primary',
|
|
16
37
|
},
|
|
17
38
|
size: {
|
|
18
|
-
control: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
control: { type: 'select' },
|
|
40
|
+
options: SIZES,
|
|
41
|
+
description: 'The size of the progress bar',
|
|
42
|
+
defaultValue: 'md',
|
|
22
43
|
},
|
|
23
44
|
},
|
|
24
|
-
}
|
|
45
|
+
} satisfies Meta<typeof Progress>;
|
|
25
46
|
|
|
26
|
-
|
|
47
|
+
export default meta;
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
27
49
|
|
|
28
|
-
|
|
29
|
-
Default
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
// Default Progress
|
|
51
|
+
export const Default: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
value: 50,
|
|
54
|
+
variant: 'primary',
|
|
55
|
+
size: 'md',
|
|
56
|
+
},
|
|
33
57
|
};
|
|
34
58
|
|
|
35
|
-
export const Secondary =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
59
|
+
export const Secondary: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
value: 75,
|
|
62
|
+
variant: 'secondary',
|
|
63
|
+
size: 'md',
|
|
64
|
+
},
|
|
40
65
|
};
|
|
41
66
|
|
|
42
|
-
export const Success =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
export const Success: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
value: 100,
|
|
70
|
+
variant: 'success',
|
|
71
|
+
size: 'md',
|
|
72
|
+
},
|
|
47
73
|
};
|
|
48
74
|
|
|
49
|
-
export const Warning =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
export const Warning: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
value: 25,
|
|
78
|
+
variant: 'warning',
|
|
79
|
+
size: 'md',
|
|
80
|
+
},
|
|
54
81
|
};
|
|
55
82
|
|
|
56
|
-
export const Error =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
83
|
+
export const Error: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
value: 10,
|
|
86
|
+
variant: 'error',
|
|
87
|
+
size: 'md',
|
|
88
|
+
},
|
|
61
89
|
};
|
|
62
90
|
|
|
63
|
-
export const Small =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
export const Small: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
value: 60,
|
|
94
|
+
variant: 'primary',
|
|
95
|
+
size: 'sm',
|
|
96
|
+
},
|
|
68
97
|
};
|
|
69
98
|
|
|
70
|
-
export const Large =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
export const Large: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
value: 80,
|
|
102
|
+
variant: 'primary',
|
|
103
|
+
size: 'lg',
|
|
104
|
+
},
|
|
75
105
|
};
|