@shohojdhara/atomix 0.2.4 → 0.2.5
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 +19 -0
- package/dist/atomix.css +1266 -1412
- package/dist/atomix.min.css +3 -3
- package/dist/index.d.ts +1232 -876
- package/dist/index.esm.js +16212 -26364
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15652 -22298
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/themes/applemix.css +15008 -0
- package/dist/themes/applemix.min.css +72 -0
- package/dist/themes/boomdevs.css +1266 -1413
- package/dist/themes/boomdevs.min.css +3 -3
- package/dist/themes/esrar.css +1267 -1413
- package/dist/themes/esrar.min.css +3 -3
- package/dist/themes/flashtrade.css +15159 -0
- package/dist/themes/flashtrade.min.css +86 -0
- package/dist/themes/mashroom.css +1264 -1410
- package/dist/themes/mashroom.min.css +5 -5
- package/dist/themes/shaj-default.css +1266 -1412
- package/dist/themes/shaj-default.min.css +3 -3
- package/package.json +6 -17
- package/src/components/Accordion/Accordion.stories.tsx +4 -26
- package/src/components/Accordion/Accordion.tsx +21 -12
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +106 -72
- package/src/components/AtomixGlass/AtomixGlass.tsx +487 -1215
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +400 -0
- package/src/components/AtomixGlass/GlassFilter.tsx +156 -0
- package/src/components/AtomixGlass/README.md +124 -2
- package/src/components/AtomixGlass/atomixGLass.old.tsx +1266 -0
- package/src/components/AtomixGlass/glass-utils.ts +263 -0
- package/src/components/AtomixGlass/shader-utils.ts +404 -236
- package/src/components/AtomixGlass/{AtomixGlass.stories.tsx → stories/AtomixGlass.stories.tsx} +55 -35
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +57 -89
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +149 -149
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +95 -32
- package/src/components/AtomixGlass/stories/ShaderVariants.stories.tsx +0 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +9 -18
- package/src/components/AtomixGlass/utils.ts +3 -3
- package/src/components/Avatar/Avatar.tsx +3 -0
- package/src/components/Avatar/AvatarGroup.tsx +2 -1
- package/src/components/Badge/Badge.stories.tsx +74 -54
- package/src/components/Badge/Badge.tsx +8 -12
- package/src/components/Breadcrumb/Breadcrumb.tsx +23 -4
- package/src/components/Button/Button.tsx +3 -5
- package/src/components/Callout/Callout.stories.tsx +86 -35
- package/src/components/Callout/Callout.tsx +4 -0
- package/src/components/Card/Card.stories.tsx +89 -85
- package/src/components/Card/Card.tsx +15 -4
- package/src/components/Card/ElevationCard.tsx +2 -0
- package/src/components/Chart/AnimatedChart.tsx +179 -156
- package/src/components/Chart/AreaChart.tsx +123 -12
- package/src/components/Chart/BarChart.tsx +91 -100
- package/src/components/Chart/BaseChart.tsx +80 -0
- package/src/components/Chart/BubbleChart.tsx +114 -290
- package/src/components/Chart/CandlestickChart.tsx +282 -622
- package/src/components/Chart/Chart.stories.tsx +576 -179
- package/src/components/Chart/Chart.tsx +374 -75
- package/src/components/Chart/ChartRenderer.tsx +371 -220
- package/src/components/Chart/ChartToolbar.tsx +372 -61
- package/src/components/Chart/ChartTooltip.tsx +33 -18
- package/src/components/Chart/DonutChart.tsx +172 -254
- package/src/components/Chart/FunnelChart.tsx +169 -240
- package/src/components/Chart/GaugeChart.tsx +224 -392
- package/src/components/Chart/HeatmapChart.tsx +302 -440
- package/src/components/Chart/LineChart.tsx +148 -103
- package/src/components/Chart/MultiAxisChart.tsx +267 -395
- package/src/components/Chart/PieChart.tsx +114 -64
- package/src/components/Chart/RadarChart.tsx +202 -218
- package/src/components/Chart/ScatterChart.tsx +111 -97
- package/src/components/Chart/TreemapChart.tsx +147 -222
- package/src/components/Chart/WaterfallChart.tsx +253 -291
- package/src/components/Chart/index.ts +11 -9
- package/src/components/Chart/types.ts +85 -9
- package/src/components/Chart/utils.ts +66 -0
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +6 -3
- package/src/components/Countdown/Countdown.tsx +4 -0
- package/src/components/DataTable/DataTable.tsx +2 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -11
- package/src/components/DatePicker/DatePicker.tsx +3 -9
- package/src/components/DatePicker/types.ts +5 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +32 -25
- package/src/components/Dropdown/Dropdown.tsx +26 -28
- package/src/components/EdgePanel/EdgePanel.stories.tsx +13 -15
- package/src/components/EdgePanel/EdgePanel.tsx +20 -5
- package/src/components/Footer/Footer.stories.tsx +187 -60
- package/src/components/Footer/Footer.test.tsx +134 -0
- package/src/components/Footer/Footer.tsx +133 -34
- package/src/components/Footer/FooterLink.tsx +1 -1
- package/src/components/Footer/FooterSection.tsx +53 -36
- package/src/components/Footer/FooterSocialLink.tsx +32 -29
- package/src/components/Footer/README.md +82 -3
- package/src/components/Footer/index.ts +1 -1
- package/src/components/Form/Checkbox.stories.tsx +13 -5
- package/src/components/Form/Checkbox.tsx +3 -6
- package/src/components/Form/Form.stories.tsx +10 -3
- package/src/components/Form/Form.tsx +2 -0
- package/src/components/Form/FormGroup.tsx +2 -1
- package/src/components/Form/Input.stories.tsx +12 -11
- package/src/components/Form/Input.tsx +97 -95
- package/src/components/Form/Radio.stories.tsx +22 -7
- package/src/components/Form/Radio.tsx +3 -6
- package/src/components/Form/Select.stories.tsx +21 -6
- package/src/components/Form/Select.tsx +3 -5
- package/src/components/Form/Textarea.stories.tsx +13 -11
- package/src/components/Form/Textarea.tsx +88 -86
- package/src/components/Hero/Hero.stories.tsx +2 -3
- package/src/components/Hero/Hero.tsx +5 -6
- package/src/components/Icon/Icon.tsx +12 -1
- package/src/components/List/List.tsx +2 -1
- package/src/components/List/ListGroup.tsx +2 -1
- package/src/components/Messages/Messages.tsx +3 -2
- package/src/components/Modal/Modal.stories.tsx +48 -34
- package/src/components/Modal/Modal.tsx +19 -23
- package/src/components/Navigation/Menu/MegaMenu.tsx +2 -2
- package/src/components/Navigation/Menu/Menu.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +6 -1
- package/src/components/Navigation/Nav/NavDropdown.tsx +10 -1
- package/src/components/Navigation/Navbar/Navbar.tsx +4 -1
- package/src/components/Navigation/SideMenu/SideMenu.tsx +3 -2
- package/src/components/Pagination/Pagination.stories.tsx +13 -6
- package/src/components/Pagination/Pagination.tsx +7 -6
- package/src/components/PhotoViewer/PhotoViewer.tsx +2 -1
- package/src/components/Popover/Popover.stories.tsx +32 -24
- package/src/components/Popover/Popover.tsx +4 -1
- package/src/components/ProductReview/ProductReview.tsx +8 -2
- package/src/components/Progress/Progress.tsx +2 -1
- package/src/components/Rating/Rating.stories.tsx +11 -6
- package/src/components/Rating/Rating.tsx +3 -5
- package/src/components/River/River.tsx +5 -5
- package/src/components/SectionIntro/SectionIntro.tsx +8 -2
- package/src/components/Slider/Slider.stories.tsx +4 -4
- package/src/components/Slider/Slider.tsx +4 -3
- package/src/components/Spinner/Spinner.tsx +2 -1
- package/src/components/Steps/Steps.stories.tsx +5 -4
- package/src/components/Steps/Steps.tsx +8 -5
- package/src/components/Tab/Tab.stories.tsx +4 -3
- package/src/components/Tab/Tab.tsx +8 -6
- package/src/components/Testimonial/Testimonial.tsx +8 -2
- package/src/components/Todo/Todo.tsx +2 -1
- package/src/components/Toggle/Toggle.stories.tsx +5 -4
- package/src/components/Toggle/Toggle.tsx +8 -5
- package/src/components/Tooltip/Tooltip.stories.tsx +40 -30
- package/src/components/Tooltip/Tooltip.tsx +9 -2
- package/src/components/Upload/Upload.stories.tsx +252 -0
- package/src/components/Upload/Upload.tsx +92 -53
- package/src/components/VideoPlayer/VideoPlayer.tsx +3 -1
- package/src/components/index.ts +0 -4
- package/src/layouts/Grid/Grid.stories.tsx +10 -23
- package/src/layouts/Grid/Grid.tsx +20 -1
- package/src/layouts/Grid/GridCol.tsx +76 -48
- package/src/lib/composables/useAtomixGlass.ts +861 -44
- package/src/lib/composables/useBarChart.ts +13 -6
- package/src/lib/composables/useChart.ts +17 -13
- package/src/lib/composables/useChartExport.ts +19 -78
- package/src/lib/composables/useChartToolbar.ts +0 -1
- package/src/lib/composables/useEdgePanel.ts +111 -103
- package/src/lib/composables/useFooter.ts +3 -3
- package/src/lib/composables/useGlassContainer.ts +16 -7
- package/src/lib/composables/useLineChart.ts +8 -1
- package/src/lib/composables/useRiver.ts +5 -0
- package/src/lib/composables/useSlider.ts +62 -24
- package/src/lib/composables/useVideoPlayer.ts +60 -63
- package/src/lib/constants/components.ts +146 -32
- package/src/lib/types/components.ts +258 -10
- package/src/lib/utils/displacement-generator.ts +55 -49
- package/src/lib/utils/icons.ts +1 -1
- package/src/lib/utils/index.ts +16 -10
- package/src/styles/01-settings/_settings.accordion.scss +19 -19
- package/src/styles/01-settings/_settings.animations.scss +5 -5
- package/src/styles/01-settings/_settings.avatar-group.scss +1 -1
- package/src/styles/01-settings/_settings.avatar.scss +17 -17
- package/src/styles/01-settings/_settings.background.scss +1 -4
- package/src/styles/01-settings/_settings.badge.scss +1 -1
- package/src/styles/01-settings/_settings.breadcrumb.scss +1 -1
- package/src/styles/01-settings/_settings.card.scss +1 -1
- package/src/styles/01-settings/_settings.chart.scss +65 -2
- package/src/styles/01-settings/_settings.dropdown.scss +1 -1
- package/src/styles/01-settings/_settings.footer.scss +35 -42
- package/src/styles/01-settings/_settings.input.scss +1 -1
- package/src/styles/01-settings/_settings.list.scss +1 -1
- package/src/styles/01-settings/_settings.rating.scss +1 -1
- package/src/styles/01-settings/_settings.tabs.scss +1 -1
- package/src/styles/01-settings/_settings.upload.scss +6 -5
- package/src/styles/02-tools/_tools.animations.scss +4 -5
- package/src/styles/02-tools/_tools.background.scss +1 -13
- package/src/styles/02-tools/_tools.glass.scss +0 -1
- package/src/styles/02-tools/_tools.utility-api.scss +42 -34
- package/src/styles/03-generic/_generic.root.scss +1 -4
- package/src/styles/04-elements/_elements.body.scss +0 -1
- package/src/styles/06-components/_components.atomix-glass.scss +216 -39
- package/src/styles/06-components/_components.badge.scss +6 -8
- package/src/styles/06-components/_components.button.scss +8 -3
- package/src/styles/06-components/_components.card.scss +2 -14
- package/src/styles/06-components/_components.chart.scss +969 -1449
- package/src/styles/06-components/_components.dropdown.scss +19 -7
- package/src/styles/06-components/_components.edge-panel.scss +4 -2
- package/src/styles/06-components/_components.footer.scss +166 -85
- package/src/styles/06-components/_components.input.scss +8 -9
- package/src/styles/06-components/_components.list.scss +1 -0
- package/src/styles/06-components/_components.modal.scss +5 -3
- package/src/styles/06-components/_components.skeleton.scss +8 -6
- package/src/styles/06-components/_components.upload.scss +219 -4
- package/src/styles/06-components/old.chart.styles.scss +1 -30
- package/src/styles/99-utilities/_utilities.opacity.scss +1 -1
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/components/Chart/AdvancedChart.tsx +0 -624
- package/src/components/Chart/LineChartNew.tsx +0 -167
- package/src/components/Chart/RealTimeChart.tsx +0 -436
- package/src/components/DatePicker/DatePicker copy.tsx +0 -551
|
@@ -58,7 +58,7 @@ export const Glass = {
|
|
|
58
58
|
disabled: false,
|
|
59
59
|
glass: true,
|
|
60
60
|
},
|
|
61
|
-
render: (args) => (
|
|
61
|
+
render: (args: any) => (
|
|
62
62
|
<div
|
|
63
63
|
style={{
|
|
64
64
|
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
@@ -81,10 +81,11 @@ export const GlassOn = {
|
|
|
81
81
|
disabled: false,
|
|
82
82
|
glass: true,
|
|
83
83
|
},
|
|
84
|
-
render: (args) => (
|
|
84
|
+
render: (args: any) => (
|
|
85
85
|
<div
|
|
86
86
|
style={{
|
|
87
|
-
background:
|
|
87
|
+
background:
|
|
88
|
+
'url(https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80)',
|
|
88
89
|
backgroundSize: 'cover',
|
|
89
90
|
backgroundPosition: 'center',
|
|
90
91
|
padding: '3rem',
|
|
@@ -112,7 +113,7 @@ export const GlassCustom = {
|
|
|
112
113
|
cornerRadius: 12,
|
|
113
114
|
},
|
|
114
115
|
},
|
|
115
|
-
render: (args) => (
|
|
116
|
+
render: (args: any) => (
|
|
116
117
|
<div
|
|
117
118
|
style={{
|
|
118
119
|
background: 'linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57)',
|
|
@@ -29,6 +29,11 @@ export interface ToggleProps {
|
|
|
29
29
|
*/
|
|
30
30
|
className?: string;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Inline style for the component
|
|
34
|
+
*/
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
|
|
32
37
|
/**
|
|
33
38
|
* Glass morphism effect for the toggle
|
|
34
39
|
* Can be a boolean to enable with default settings, or an object with AtomixGlassProps to customize the effect
|
|
@@ -45,6 +50,7 @@ export const Toggle: React.FC<ToggleProps> = ({
|
|
|
45
50
|
onToggleOff,
|
|
46
51
|
disabled = false,
|
|
47
52
|
className = '',
|
|
53
|
+
style,
|
|
48
54
|
glass,
|
|
49
55
|
}) => {
|
|
50
56
|
const [isOn, setIsOn] = useState(initialOn);
|
|
@@ -76,6 +82,7 @@ export const Toggle: React.FC<ToggleProps> = ({
|
|
|
76
82
|
const toggleContent = (
|
|
77
83
|
<div
|
|
78
84
|
className={`c-toggle ${isOn ? TOGGLE.CLASSES.IS_ON : ''} ${disabled ? 'is-disabled' : ''} ${className}`}
|
|
85
|
+
style={style}
|
|
79
86
|
onClick={handleClick}
|
|
80
87
|
onKeyDown={handleKeyDown}
|
|
81
88
|
role="switch"
|
|
@@ -100,11 +107,7 @@ export const Toggle: React.FC<ToggleProps> = ({
|
|
|
100
107
|
|
|
101
108
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
102
109
|
|
|
103
|
-
return
|
|
104
|
-
<AtomixGlass {...glassProps}>
|
|
105
|
-
{toggleContent}
|
|
106
|
-
</AtomixGlass>
|
|
107
|
-
);
|
|
110
|
+
return <AtomixGlass {...glassProps}>{toggleContent}</AtomixGlass>;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
return toggleContent;
|
|
@@ -129,12 +129,14 @@ GlassTooltip.args = {
|
|
|
129
129
|
glass: true,
|
|
130
130
|
};
|
|
131
131
|
GlassTooltip.decorators = [
|
|
132
|
-
|
|
133
|
-
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
Story => (
|
|
133
|
+
<div
|
|
134
|
+
style={{
|
|
135
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
136
|
+
minHeight: '100vh',
|
|
137
|
+
padding: '2rem',
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
138
140
|
<Story />
|
|
139
141
|
</div>
|
|
140
142
|
),
|
|
@@ -158,12 +160,14 @@ GlassTooltipCustom.args = {
|
|
|
158
160
|
},
|
|
159
161
|
};
|
|
160
162
|
GlassTooltipCustom.decorators = [
|
|
161
|
-
|
|
162
|
-
<div
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
Story => (
|
|
164
|
+
<div
|
|
165
|
+
style={{
|
|
166
|
+
background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
|
|
167
|
+
minHeight: '100vh',
|
|
168
|
+
padding: '2rem',
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
167
171
|
<Story />
|
|
168
172
|
</div>
|
|
169
173
|
),
|
|
@@ -180,12 +184,14 @@ GlassTooltipClick.args = {
|
|
|
180
184
|
glass: true,
|
|
181
185
|
};
|
|
182
186
|
GlassTooltipClick.decorators = [
|
|
183
|
-
|
|
184
|
-
<div
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
Story => (
|
|
188
|
+
<div
|
|
189
|
+
style={{
|
|
190
|
+
background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
|
191
|
+
minHeight: '100vh',
|
|
192
|
+
padding: '2rem',
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
189
195
|
<Story />
|
|
190
196
|
</div>
|
|
191
197
|
),
|
|
@@ -202,12 +208,14 @@ GlassTooltipPositions.args = {
|
|
|
202
208
|
glass: true,
|
|
203
209
|
};
|
|
204
210
|
GlassTooltipPositions.decorators = [
|
|
205
|
-
|
|
206
|
-
<div
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
+
Story => (
|
|
212
|
+
<div
|
|
213
|
+
style={{
|
|
214
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
215
|
+
minHeight: '100vh',
|
|
216
|
+
padding: '2rem',
|
|
217
|
+
}}
|
|
218
|
+
>
|
|
211
219
|
<Story />
|
|
212
220
|
</div>
|
|
213
221
|
),
|
|
@@ -234,12 +242,14 @@ GlassTooltipRich.args = {
|
|
|
234
242
|
glass: true,
|
|
235
243
|
};
|
|
236
244
|
GlassTooltipRich.decorators = [
|
|
237
|
-
|
|
238
|
-
<div
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
245
|
+
Story => (
|
|
246
|
+
<div
|
|
247
|
+
style={{
|
|
248
|
+
background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
|
|
249
|
+
minHeight: '100vh',
|
|
250
|
+
padding: '2rem',
|
|
251
|
+
}}
|
|
252
|
+
>
|
|
243
253
|
<Story />
|
|
244
254
|
</div>
|
|
245
255
|
),
|
|
@@ -37,6 +37,11 @@ export interface TooltipProps {
|
|
|
37
37
|
*/
|
|
38
38
|
className?: string;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Inline style for the component
|
|
42
|
+
*/
|
|
43
|
+
style?: React.CSSProperties;
|
|
44
|
+
|
|
40
45
|
/**
|
|
41
46
|
* Delay before showing the tooltip (in milliseconds)
|
|
42
47
|
*/
|
|
@@ -60,6 +65,7 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
60
65
|
position = TOOLTIP.DEFAULTS.POSITION,
|
|
61
66
|
trigger = TOOLTIP.DEFAULTS.TRIGGER,
|
|
62
67
|
className = '',
|
|
68
|
+
style,
|
|
63
69
|
delay = TOOLTIP.DEFAULTS.DELAY,
|
|
64
70
|
offset = TOOLTIP.DEFAULTS.OFFSET,
|
|
65
71
|
glass,
|
|
@@ -129,7 +135,7 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
return (
|
|
132
|
-
<div className="u-position-relative u-d-inline-block">
|
|
138
|
+
<div className="u-position-relative u-d-inline-block" style={style}>
|
|
133
139
|
<div
|
|
134
140
|
className={`${TOOLTIP.SELECTORS.TRIGGER.substring(1)}${className ? ` ${className}` : ''}`}
|
|
135
141
|
{...triggerProps}
|
|
@@ -154,7 +160,8 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
154
160
|
mode: 'shader' as const,
|
|
155
161
|
};
|
|
156
162
|
|
|
157
|
-
const glassProps =
|
|
163
|
+
const glassProps =
|
|
164
|
+
glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
158
165
|
|
|
159
166
|
return (
|
|
160
167
|
<AtomixGlass {...glassProps}>
|
|
@@ -5,26 +5,55 @@ import { Upload } from './Upload';
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Components/Upload',
|
|
7
7
|
component: Upload,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'A modern file upload component with drag & drop functionality, progress tracking, and multiple size variants.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
8
16
|
argTypes: {
|
|
17
|
+
size: {
|
|
18
|
+
control: { type: 'select' },
|
|
19
|
+
options: ['sm', 'md', 'lg'],
|
|
20
|
+
defaultValue: 'md',
|
|
21
|
+
description: 'Size variant of the upload component',
|
|
22
|
+
},
|
|
9
23
|
disabled: {
|
|
10
24
|
control: { type: 'boolean' },
|
|
11
25
|
defaultValue: false,
|
|
26
|
+
description: 'Whether the upload component is disabled',
|
|
12
27
|
},
|
|
13
28
|
maxSizeInMB: {
|
|
14
29
|
control: { type: 'number' },
|
|
15
30
|
defaultValue: 5,
|
|
31
|
+
description: 'Maximum file size in MB',
|
|
16
32
|
},
|
|
17
33
|
multiple: {
|
|
18
34
|
control: { type: 'boolean' },
|
|
19
35
|
defaultValue: false,
|
|
36
|
+
description: 'Whether multiple files can be selected',
|
|
20
37
|
},
|
|
21
38
|
title: {
|
|
22
39
|
control: { type: 'text' },
|
|
23
40
|
defaultValue: 'Drag and Drop files here',
|
|
41
|
+
description: 'Text for the drag and drop section',
|
|
42
|
+
},
|
|
43
|
+
supportedFilesText: {
|
|
44
|
+
control: { type: 'text' },
|
|
45
|
+
defaultValue: 'Files supported: PDF, XSLS, JPEG, PNG, Scanner',
|
|
46
|
+
description: 'Text describing supported file types',
|
|
24
47
|
},
|
|
25
48
|
buttonText: {
|
|
26
49
|
control: { type: 'text' },
|
|
27
50
|
defaultValue: 'Choose File',
|
|
51
|
+
description: 'Text for the upload button',
|
|
52
|
+
},
|
|
53
|
+
helperText: {
|
|
54
|
+
control: { type: 'text' },
|
|
55
|
+
defaultValue: 'Maximum size: 5MB',
|
|
56
|
+
description: 'Helper text displayed below the button',
|
|
28
57
|
},
|
|
29
58
|
},
|
|
30
59
|
} as Meta<typeof Upload>;
|
|
@@ -38,11 +67,72 @@ const Template: StoryFn<typeof Upload> = args => (
|
|
|
38
67
|
// Default upload component
|
|
39
68
|
export const Default = Template.bind({});
|
|
40
69
|
Default.args = {
|
|
70
|
+
size: 'md',
|
|
41
71
|
title: 'Drag and Drop files here',
|
|
42
72
|
supportedFilesText: 'Files supported: PDF, XSLS, JPEG, PNG, Scanner',
|
|
43
73
|
buttonText: 'Choose File',
|
|
44
74
|
helperText: 'Maximum size: 5MB',
|
|
45
75
|
};
|
|
76
|
+
Default.parameters = {
|
|
77
|
+
docs: {
|
|
78
|
+
description: {
|
|
79
|
+
story: 'The default upload component with medium size and standard styling.',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Size Variants
|
|
85
|
+
export const SizeVariants: StoryFn<typeof Upload> = () => (
|
|
86
|
+
<div style={{ padding: '30px' }}>
|
|
87
|
+
<div style={{ marginBottom: '40px' }}>
|
|
88
|
+
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>Small Size</h3>
|
|
89
|
+
<div style={{ maxWidth: '400px' }}>
|
|
90
|
+
<Upload
|
|
91
|
+
size="sm"
|
|
92
|
+
title="Small Upload Area"
|
|
93
|
+
supportedFilesText="PDF, JPEG, PNG"
|
|
94
|
+
buttonText="Choose File"
|
|
95
|
+
helperText="Max: 2MB"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div style={{ marginBottom: '40px' }}>
|
|
101
|
+
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>
|
|
102
|
+
Medium Size (Default)
|
|
103
|
+
</h3>
|
|
104
|
+
<div style={{ maxWidth: '500px' }}>
|
|
105
|
+
<Upload
|
|
106
|
+
size="md"
|
|
107
|
+
title="Drag and Drop files here"
|
|
108
|
+
supportedFilesText="Files supported: PDF, XSLS, JPEG, PNG, Scanner"
|
|
109
|
+
buttonText="Choose File"
|
|
110
|
+
helperText="Maximum size: 5MB"
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div>
|
|
116
|
+
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>Large Size</h3>
|
|
117
|
+
<div style={{ maxWidth: '700px' }}>
|
|
118
|
+
<Upload
|
|
119
|
+
size="lg"
|
|
120
|
+
title="Drop your files here for upload"
|
|
121
|
+
supportedFilesText="Supported formats: PDF, Excel, Word, Images, and more"
|
|
122
|
+
buttonText="Browse Files"
|
|
123
|
+
helperText="Maximum file size: 10MB per file"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
SizeVariants.parameters = {
|
|
130
|
+
docs: {
|
|
131
|
+
description: {
|
|
132
|
+
story: 'Upload component in different sizes: small (sm), medium (md), and large (lg).',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
46
136
|
|
|
47
137
|
// Disabled state
|
|
48
138
|
export const Disabled = Template.bind({});
|
|
@@ -50,6 +140,13 @@ Disabled.args = {
|
|
|
50
140
|
...Default.args,
|
|
51
141
|
disabled: true,
|
|
52
142
|
};
|
|
143
|
+
Disabled.parameters = {
|
|
144
|
+
docs: {
|
|
145
|
+
description: {
|
|
146
|
+
story: 'Upload component in disabled state with reduced opacity and no interactions.',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
53
150
|
|
|
54
151
|
// Manual state controls
|
|
55
152
|
const WithStateControls: React.FC = () => {
|
|
@@ -203,12 +300,29 @@ const WithStateControls: React.FC = () => {
|
|
|
203
300
|
};
|
|
204
301
|
|
|
205
302
|
export const WithControls: StoryFn<typeof Upload> = () => <WithStateControls />;
|
|
303
|
+
WithControls.parameters = {
|
|
304
|
+
docs: {
|
|
305
|
+
description: {
|
|
306
|
+
story:
|
|
307
|
+
'Interactive example showing different upload states: default, uploading with progress, success, and error states.',
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
};
|
|
206
311
|
|
|
207
312
|
// Custom Icon
|
|
208
313
|
export const CustomIcon = Template.bind({});
|
|
209
314
|
CustomIcon.args = {
|
|
210
315
|
...Default.args,
|
|
211
316
|
icon: <i className="icon-lux-upload-cloud"></i>,
|
|
317
|
+
title: 'Upload your documents',
|
|
318
|
+
supportedFilesText: 'Drag files here or click to browse',
|
|
319
|
+
};
|
|
320
|
+
CustomIcon.parameters = {
|
|
321
|
+
docs: {
|
|
322
|
+
description: {
|
|
323
|
+
story: 'Upload component with a custom icon and personalized text content.',
|
|
324
|
+
},
|
|
325
|
+
},
|
|
212
326
|
};
|
|
213
327
|
|
|
214
328
|
// Multiple file upload
|
|
@@ -217,4 +331,142 @@ MultipleFiles.args = {
|
|
|
217
331
|
...Default.args,
|
|
218
332
|
multiple: true,
|
|
219
333
|
buttonText: 'Choose Files',
|
|
334
|
+
title: 'Upload multiple files',
|
|
335
|
+
supportedFilesText: 'Select multiple files at once',
|
|
336
|
+
helperText: 'Maximum size: 5MB per file',
|
|
337
|
+
};
|
|
338
|
+
MultipleFiles.parameters = {
|
|
339
|
+
docs: {
|
|
340
|
+
description: {
|
|
341
|
+
story: 'Upload component configured to accept multiple files at once.',
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// Drag and Drop Demo
|
|
347
|
+
export const DragDropDemo: StoryFn<typeof Upload> = () => {
|
|
348
|
+
const [dragState, setDragState] = useState<'idle' | 'dragging'>('idle');
|
|
349
|
+
const [uploadedFiles, setUploadedFiles] = useState<string[]>([]);
|
|
350
|
+
|
|
351
|
+
const handleFileSelect = (files: File[]) => {
|
|
352
|
+
const fileNames = files.map(file => file.name);
|
|
353
|
+
setUploadedFiles(prev => [...prev, ...fileNames]);
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
return (
|
|
357
|
+
<div style={{ padding: '30px' }}>
|
|
358
|
+
<div style={{ marginBottom: '20px' }}>
|
|
359
|
+
<h3 style={{ fontSize: '18px', fontWeight: '600', marginBottom: '10px' }}>
|
|
360
|
+
Interactive Drag & Drop Demo
|
|
361
|
+
</h3>
|
|
362
|
+
<p style={{ color: '#666', fontSize: '14px', marginBottom: '20px' }}>
|
|
363
|
+
Try dragging files over the upload area to see the hover effects, or click to select
|
|
364
|
+
files.
|
|
365
|
+
</p>
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
<div style={{ maxWidth: '600px', marginBottom: '20px' }}>
|
|
369
|
+
<Upload
|
|
370
|
+
title="Drag files here to see the magic ✨"
|
|
371
|
+
supportedFilesText="PDF, Images, Documents - All welcome!"
|
|
372
|
+
buttonText="Or click to browse"
|
|
373
|
+
helperText="Watch the upload area respond to your interactions"
|
|
374
|
+
onFileSelect={handleFileSelect}
|
|
375
|
+
multiple={true}
|
|
376
|
+
/>
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
{uploadedFiles.length > 0 && (
|
|
380
|
+
<div
|
|
381
|
+
style={{
|
|
382
|
+
padding: '16px',
|
|
383
|
+
backgroundColor: '#f8f9fa',
|
|
384
|
+
borderRadius: '8px',
|
|
385
|
+
border: '1px solid #e9ecef',
|
|
386
|
+
}}
|
|
387
|
+
>
|
|
388
|
+
<h4
|
|
389
|
+
style={{ fontSize: '14px', fontWeight: '600', marginBottom: '8px', color: '#495057' }}
|
|
390
|
+
>
|
|
391
|
+
Selected Files:
|
|
392
|
+
</h4>
|
|
393
|
+
<ul style={{ margin: 0, paddingLeft: '20px' }}>
|
|
394
|
+
{uploadedFiles.map((fileName, index) => (
|
|
395
|
+
<li key={index} style={{ fontSize: '14px', color: '#6c757d', marginBottom: '4px' }}>
|
|
396
|
+
{fileName}
|
|
397
|
+
</li>
|
|
398
|
+
))}
|
|
399
|
+
</ul>
|
|
400
|
+
<button
|
|
401
|
+
onClick={() => setUploadedFiles([])}
|
|
402
|
+
style={{
|
|
403
|
+
marginTop: '12px',
|
|
404
|
+
padding: '6px 12px',
|
|
405
|
+
fontSize: '12px',
|
|
406
|
+
backgroundColor: '#6c757d',
|
|
407
|
+
color: 'white',
|
|
408
|
+
border: 'none',
|
|
409
|
+
borderRadius: '4px',
|
|
410
|
+
cursor: 'pointer',
|
|
411
|
+
}}
|
|
412
|
+
>
|
|
413
|
+
Clear List
|
|
414
|
+
</button>
|
|
415
|
+
</div>
|
|
416
|
+
)}
|
|
417
|
+
</div>
|
|
418
|
+
);
|
|
419
|
+
};
|
|
420
|
+
DragDropDemo.parameters = {
|
|
421
|
+
docs: {
|
|
422
|
+
description: {
|
|
423
|
+
story:
|
|
424
|
+
'Interactive demonstration of drag & drop functionality with visual feedback and file tracking.',
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
// Different File Types
|
|
430
|
+
export const FileTypeRestrictions: StoryFn<typeof Upload> = () => (
|
|
431
|
+
<div style={{ padding: '30px' }}>
|
|
432
|
+
<div style={{ marginBottom: '40px' }}>
|
|
433
|
+
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>Images Only</h3>
|
|
434
|
+
<div style={{ maxWidth: '500px' }}>
|
|
435
|
+
<Upload
|
|
436
|
+
title="Upload Images"
|
|
437
|
+
supportedFilesText="JPEG, PNG, GIF, WebP"
|
|
438
|
+
buttonText="Choose Images"
|
|
439
|
+
helperText="Maximum size: 10MB"
|
|
440
|
+
acceptedFileTypes={['image/jpeg', 'image/png', 'image/gif', 'image/webp']}
|
|
441
|
+
multiple={true}
|
|
442
|
+
/>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
<div style={{ marginBottom: '40px' }}>
|
|
447
|
+
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>Documents Only</h3>
|
|
448
|
+
<div style={{ maxWidth: '500px' }}>
|
|
449
|
+
<Upload
|
|
450
|
+
title="Upload Documents"
|
|
451
|
+
supportedFilesText="PDF, Word, Excel, PowerPoint"
|
|
452
|
+
buttonText="Choose Documents"
|
|
453
|
+
helperText="Maximum size: 25MB"
|
|
454
|
+
acceptedFileTypes={[
|
|
455
|
+
'application/pdf',
|
|
456
|
+
'application/msword',
|
|
457
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
458
|
+
'application/vnd.ms-excel',
|
|
459
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
460
|
+
]}
|
|
461
|
+
/>
|
|
462
|
+
</div>
|
|
463
|
+
</div>
|
|
464
|
+
</div>
|
|
465
|
+
);
|
|
466
|
+
FileTypeRestrictions.parameters = {
|
|
467
|
+
docs: {
|
|
468
|
+
description: {
|
|
469
|
+
story: 'Upload components configured for specific file types with appropriate messaging.',
|
|
470
|
+
},
|
|
471
|
+
},
|
|
220
472
|
};
|