@shohojdhara/atomix 0.3.15 → 0.4.0
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/build-tools/index.d.ts +31 -30
- package/build-tools/package.json +4 -21
- package/dist/atomix.css +20924 -2611
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +76 -2
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/index.d.ts +31 -30
- package/dist/build-tools/package.json +4 -21
- package/dist/charts.js.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +144 -18
- package/dist/index.esm.js +110 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +110 -55
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/theme.d.ts +9 -9
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +32 -23
- package/src/components/Accordion/Accordion.test.tsx +70 -50
- package/src/components/Accordion/Accordion.tsx +99 -94
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
- package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/glass-utils.ts +4 -3
- package/src/components/AtomixGlass/shader-utils.ts +128 -52
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -62
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +20 -9
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +14 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +9 -8
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
- package/src/components/Button/Button.stories.tsx +13 -22
- package/src/components/Button/Button.test.tsx +97 -81
- package/src/components/Button/Button.tsx +46 -14
- package/src/components/Button/ButtonGroup.stories.tsx +37 -32
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +109 -16
- package/src/components/Card/Card.stories.tsx +67 -36
- package/src/components/Card/Card.tsx +30 -14
- package/src/components/Chart/AreaChart.tsx +1 -1
- package/src/components/Chart/CandlestickChart.tsx +23 -16
- package/src/components/Chart/Chart.stories.tsx +4 -9
- package/src/components/Chart/Chart.tsx +40 -44
- package/src/components/Chart/ChartRenderer.tsx +39 -12
- package/src/components/Chart/ChartToolbar.tsx +21 -5
- package/src/components/Chart/DonutChart.tsx +1 -1
- package/src/components/Chart/FunnelChart.tsx +4 -1
- package/src/components/Chart/GaugeChart.tsx +3 -1
- package/src/components/Chart/HeatmapChart.tsx +50 -37
- package/src/components/Chart/LineChart.tsx +3 -2
- package/src/components/Chart/MultiAxisChart.tsx +24 -16
- package/src/components/Chart/RadarChart.tsx +19 -17
- package/src/components/Chart/ScatterChart.tsx +29 -21
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +6 -2
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +7 -7
- package/src/components/DataTable/DataTable.stories.tsx +43 -38
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +32 -47
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +2 -5
- package/src/components/Dropdown/Dropdown.tsx +313 -299
- package/src/components/EdgePanel/EdgePanel.stories.tsx +6 -19
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Footer/Footer.stories.tsx +21 -16
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.test.tsx +49 -49
- package/src/components/Form/Checkbox.tsx +108 -100
- package/src/components/Form/Form.stories.tsx +2 -10
- package/src/components/Form/Input.stories.tsx +22 -39
- package/src/components/Form/Input.test.tsx +38 -44
- package/src/components/Form/Radio.stories.tsx +6 -12
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.tsx +184 -182
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +56 -23
- package/src/components/Hero/Hero.tsx +201 -55
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.tsx +19 -23
- package/src/components/Modal/Modal.stories.tsx +2 -1
- package/src/components/Modal/Modal.tsx +130 -127
- package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
- package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
- package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
- package/src/components/Pagination/Pagination.stories.tsx +7 -4
- package/src/components/Pagination/Pagination.tsx +199 -202
- package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
- package/src/components/Popover/Popover.stories.tsx +99 -192
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +35 -44
- package/src/components/River/River.stories.tsx +2 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +71 -71
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +3 -1
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +8 -6
- package/src/components/Tabs/Tabs.stories.tsx +12 -9
- package/src/components/Tabs/Tabs.tsx +74 -72
- package/src/components/Toggle/Toggle.stories.tsx +27 -13
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +24 -20
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +129 -127
- package/src/components/Upload/Upload.tsx +287 -283
- package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
- package/src/components/index.ts +13 -2
- package/src/layouts/Grid/Grid.stories.tsx +9 -3
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
- package/src/lib/__tests__/theme-tools.test.ts +32 -6
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +106 -49
- package/src/lib/composables/useChartExport.ts +1 -1
- package/src/lib/composables/useDataTable.ts +29 -17
- package/src/lib/composables/useHero.ts +58 -14
- package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
- package/src/lib/composables/useInput.ts +10 -8
- package/src/lib/composables/useSideMenu.ts +6 -5
- package/src/lib/composables/useTooltip.ts +1 -2
- package/src/lib/composables/useVideoPlayer.ts +44 -35
- package/src/lib/config/index.ts +154 -154
- package/src/lib/constants/cssVariables.ts +29 -29
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
- package/src/lib/hooks/index.ts +1 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -17
- package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
- package/src/lib/patterns/__tests__/slots.test.ts +1 -1
- package/src/lib/patterns/index.ts +1 -1
- package/src/lib/patterns/slots.tsx +8 -13
- package/src/lib/storybook/InteractiveDemo.tsx +13 -18
- package/src/lib/storybook/PreviewContainer.tsx +1 -1
- package/src/lib/storybook/VariantsGrid.tsx +3 -7
- package/src/lib/storybook/index.ts +1 -1
- package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
- package/src/lib/theme/adapters/index.ts +3 -9
- package/src/lib/theme/adapters/themeAdapter.ts +41 -26
- package/src/lib/theme/config/index.ts +1 -1
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +10 -5
- package/src/lib/theme/constants/constants.ts +2 -2
- package/src/lib/theme/constants/index.ts +1 -2
- package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
- package/src/lib/theme/core/composeTheme.ts +32 -26
- package/src/lib/theme/core/createTheme.ts +1 -1
- package/src/lib/theme/core/createThemeObject.ts +308 -301
- package/src/lib/theme/core/index.ts +3 -3
- package/src/lib/theme/devtools/CLI.ts +106 -104
- package/src/lib/theme/devtools/Comparator.tsx +50 -32
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
- package/src/lib/theme/devtools/Inspector.tsx +75 -60
- package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
- package/src/lib/theme/devtools/Preview.tsx +150 -106
- package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
- package/src/lib/theme/devtools/index.ts +3 -9
- package/src/lib/theme/devtools/useHistory.ts +23 -21
- package/src/lib/theme/errors/errors.ts +12 -11
- package/src/lib/theme/errors/index.ts +2 -7
- package/src/lib/theme/generators/generateCSS.ts +9 -13
- package/src/lib/theme/generators/generateCSSNested.ts +1 -6
- package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
- package/src/lib/theme/generators/index.ts +1 -4
- package/src/lib/theme/i18n/index.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +13 -13
- package/src/lib/theme/index.ts +7 -16
- package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
- package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
- package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
- package/src/lib/theme/runtime/index.ts +2 -5
- package/src/lib/theme/runtime/useTheme.ts +18 -18
- package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
- package/src/lib/theme/test/testTheme.ts +15 -16
- package/src/lib/theme/tokens/index.ts +2 -7
- package/src/lib/theme/tokens/tokens.ts +25 -24
- package/src/lib/theme/types.ts +428 -411
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
- package/src/lib/theme/utils/componentTheming.ts +18 -18
- package/src/lib/theme/utils/domUtils.ts +277 -289
- package/src/lib/theme/utils/index.ts +1 -2
- package/src/lib/theme/utils/injectCSS.ts +10 -14
- package/src/lib/theme/utils/naming.ts +20 -16
- package/src/lib/theme/utils/themeHelpers.ts +10 -12
- package/src/lib/theme/utils/themeUtils.ts +85 -86
- package/src/lib/theme/utils/themeValidation.ts +82 -33
- package/src/lib/theme-tools.ts +8 -6
- package/src/lib/types/components.ts +172 -71
- package/src/lib/types/partProps.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +1 -1
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +3 -1
- package/src/lib/utils/dataTableExport.ts +1 -5
- package/src/lib/utils/fontPreloader.ts +10 -19
- package/src/lib/utils/icons.ts +4 -1
- package/src/lib/utils/index.ts +2 -6
- package/src/lib/utils/memoryMonitor.ts +10 -8
- package/src/lib/utils/themeNaming.ts +2 -2
- package/src/styles/01-settings/_index.scss +0 -1
- package/src/styles/01-settings/_settings.colors.scss +8 -8
- package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/01-settings/_settings.spacing.scss +3 -4
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/01-settings/_settings.typography.scss +1 -1
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +30 -18
- package/src/styles/03-generic/_generic.root.scss +4 -3
- package/src/styles/06-components/_components.atomix-glass.scss +13 -9
- package/src/styles/06-components/_components.button.scss +16 -4
- package/src/styles/06-components/_components.callout.scss +27 -21
- package/src/styles/06-components/_components.card.scss +5 -14
- package/src/styles/06-components/_components.chart.scss +22 -19
- package/src/styles/06-components/_components.checkbox.scss +3 -1
- package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
- package/src/styles/06-components/_components.edge-panel.scss +9 -2
- package/src/styles/06-components/_components.footer.scss +1 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -5
- package/src/styles/06-components/_components.toggle.scss +18 -0
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/06-components/old.chart.styles.scss +0 -2
- package/src/styles/99-utilities/_utilities.border.scss +69 -27
- package/src/styles/99-utilities/_utilities.display.scss +1 -1
- package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
- package/src/styles/99-utilities/_utilities.position.scss +16 -9
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
- package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
- package/src/styles/99-utilities/_utilities.text-gradient.scss +30 -30
- package/src/styles/99-utilities/_utilities.text.scss +67 -46
|
@@ -5,7 +5,7 @@ import { Popover, PopoverTrigger } from './Popover';
|
|
|
5
5
|
import { Toggle } from '../Toggle/Toggle';
|
|
6
6
|
import { Button } from '../Button/Button';
|
|
7
7
|
|
|
8
|
-
const meta = {
|
|
8
|
+
const meta: Meta<typeof Popover> = {
|
|
9
9
|
title: 'Components/Popover',
|
|
10
10
|
component: Popover,
|
|
11
11
|
parameters: {
|
|
@@ -113,7 +113,7 @@ Popover displays floating content relative to a trigger element. It provides a f
|
|
|
113
113
|
description: 'Delay in milliseconds before showing the popover',
|
|
114
114
|
table: {
|
|
115
115
|
type: { summary: 'number' },
|
|
116
|
-
defaultValue: { summary: 0 },
|
|
116
|
+
defaultValue: { summary: '0' },
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
119
|
offset: {
|
|
@@ -121,7 +121,7 @@ Popover displays floating content relative to a trigger element. It provides a f
|
|
|
121
121
|
description: 'Offset distance from the trigger element',
|
|
122
122
|
table: {
|
|
123
123
|
type: { summary: 'number' },
|
|
124
|
-
defaultValue: { summary: 12 },
|
|
124
|
+
defaultValue: { summary: '12' },
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
127
|
defaultOpen: {
|
|
@@ -129,7 +129,7 @@ Popover displays floating content relative to a trigger element. It provides a f
|
|
|
129
129
|
description: 'Whether the popover is initially open',
|
|
130
130
|
table: {
|
|
131
131
|
type: { summary: 'boolean' },
|
|
132
|
-
defaultValue: { summary: false },
|
|
132
|
+
defaultValue: { summary: 'false' },
|
|
133
133
|
},
|
|
134
134
|
},
|
|
135
135
|
closeOnClickOutside: {
|
|
@@ -137,7 +137,7 @@ Popover displays floating content relative to a trigger element. It provides a f
|
|
|
137
137
|
description: 'Whether to close the popover when clicking outside',
|
|
138
138
|
table: {
|
|
139
139
|
type: { summary: 'boolean' },
|
|
140
|
-
defaultValue: { summary: true },
|
|
140
|
+
defaultValue: { summary: 'true' },
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
closeOnEscape: {
|
|
@@ -145,7 +145,7 @@ Popover displays floating content relative to a trigger element. It provides a f
|
|
|
145
145
|
description: 'Whether to close the popover when pressing Escape key',
|
|
146
146
|
table: {
|
|
147
147
|
type: { summary: 'boolean' },
|
|
148
|
-
defaultValue: { summary: true },
|
|
148
|
+
defaultValue: { summary: 'true' },
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
className: {
|
|
@@ -161,11 +161,11 @@ Popover displays floating content relative to a trigger element. It provides a f
|
|
|
161
161
|
description: 'Enable glass morphism effect',
|
|
162
162
|
table: {
|
|
163
163
|
type: { summary: 'boolean' },
|
|
164
|
-
defaultValue: { summary: false },
|
|
164
|
+
defaultValue: { summary: 'false' },
|
|
165
165
|
},
|
|
166
166
|
},
|
|
167
167
|
},
|
|
168
|
-
}
|
|
168
|
+
};
|
|
169
169
|
|
|
170
170
|
export default meta;
|
|
171
171
|
type Story = StoryObj<typeof meta>;
|
|
@@ -213,18 +213,17 @@ const InteractivePopover = (args: React.ComponentProps<typeof Popover>) => {
|
|
|
213
213
|
|
|
214
214
|
return (
|
|
215
215
|
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
216
|
-
<Popover {...args}>
|
|
216
|
+
<Popover {...args} content={content}>
|
|
217
217
|
<PopoverTrigger>
|
|
218
218
|
<Button variant="primary">Open Popover</Button>
|
|
219
219
|
</PopoverTrigger>
|
|
220
|
-
{content}
|
|
221
220
|
</Popover>
|
|
222
221
|
</div>
|
|
223
222
|
);
|
|
224
223
|
};
|
|
225
224
|
|
|
226
225
|
export const BasicUsage: Story = {
|
|
227
|
-
render:
|
|
226
|
+
render: args => <InteractivePopover {...args} content={undefined} />,
|
|
228
227
|
args: {
|
|
229
228
|
position: 'top',
|
|
230
229
|
trigger: 'click',
|
|
@@ -243,88 +242,41 @@ export const BasicUsage: Story = {
|
|
|
243
242
|
export const AllPositions: Story = {
|
|
244
243
|
render: () => {
|
|
245
244
|
const content = <div style={{ padding: '20px' }}>Popover Content</div>;
|
|
246
|
-
|
|
245
|
+
|
|
247
246
|
return (
|
|
248
|
-
<div
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
</
|
|
280
|
-
</
|
|
281
|
-
|
|
282
|
-
<div>
|
|
283
|
-
<Popover position="left">
|
|
284
|
-
<PopoverTrigger>
|
|
285
|
-
<Button variant="primary">Left</Button>
|
|
286
|
-
</PopoverTrigger>
|
|
287
|
-
{content}
|
|
288
|
-
</Popover>
|
|
289
|
-
</div>
|
|
290
|
-
|
|
291
|
-
<div style={{ textAlign: 'center' }}>
|
|
292
|
-
<p>All popover positions</p>
|
|
293
|
-
</div>
|
|
294
|
-
|
|
295
|
-
<div>
|
|
296
|
-
<Popover position="right">
|
|
297
|
-
<PopoverTrigger>
|
|
298
|
-
<Button variant="primary">Right</Button>
|
|
299
|
-
</PopoverTrigger>
|
|
300
|
-
{content}
|
|
301
|
-
</Popover>
|
|
302
|
-
</div>
|
|
303
|
-
|
|
304
|
-
<div>
|
|
305
|
-
<Popover position="bottom-start">
|
|
306
|
-
<PopoverTrigger>
|
|
307
|
-
<Button variant="primary">Bottom Start</Button>
|
|
308
|
-
</PopoverTrigger>
|
|
309
|
-
{content}
|
|
310
|
-
</Popover>
|
|
311
|
-
</div>
|
|
312
|
-
<div>
|
|
313
|
-
<Popover position="bottom">
|
|
314
|
-
<PopoverTrigger>
|
|
315
|
-
<Button variant="primary">Bottom</Button>
|
|
316
|
-
</PopoverTrigger>
|
|
317
|
-
{content}
|
|
318
|
-
</Popover>
|
|
319
|
-
</div>
|
|
320
|
-
<div>
|
|
321
|
-
<Popover position="bottom-end">
|
|
322
|
-
<PopoverTrigger>
|
|
323
|
-
<Button variant="primary">Bottom End</Button>
|
|
324
|
-
</PopoverTrigger>
|
|
325
|
-
{content}
|
|
326
|
-
</Popover>
|
|
327
|
-
</div>
|
|
247
|
+
<div
|
|
248
|
+
style={{
|
|
249
|
+
display: 'flex',
|
|
250
|
+
justifyContent: 'center',
|
|
251
|
+
gap: '20px',
|
|
252
|
+
padding: '50px',
|
|
253
|
+
alignItems: 'center',
|
|
254
|
+
height: '300px',
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
<Popover position="left" content={content}>
|
|
258
|
+
<PopoverTrigger>
|
|
259
|
+
<Button variant="primary">Left</Button>
|
|
260
|
+
</PopoverTrigger>
|
|
261
|
+
</Popover>
|
|
262
|
+
|
|
263
|
+
<Popover position="top" content={content}>
|
|
264
|
+
<PopoverTrigger>
|
|
265
|
+
<Button variant="primary">Top</Button>
|
|
266
|
+
</PopoverTrigger>
|
|
267
|
+
</Popover>
|
|
268
|
+
|
|
269
|
+
<Popover position="bottom" content={content}>
|
|
270
|
+
<PopoverTrigger>
|
|
271
|
+
<Button variant="primary">Bottom</Button>
|
|
272
|
+
</PopoverTrigger>
|
|
273
|
+
</Popover>
|
|
274
|
+
|
|
275
|
+
<Popover position="right" content={content}>
|
|
276
|
+
<PopoverTrigger>
|
|
277
|
+
<Button variant="primary">Right</Button>
|
|
278
|
+
</PopoverTrigger>
|
|
279
|
+
</Popover>
|
|
328
280
|
</div>
|
|
329
281
|
);
|
|
330
282
|
},
|
|
@@ -338,19 +290,23 @@ export const AllPositions: Story = {
|
|
|
338
290
|
};
|
|
339
291
|
|
|
340
292
|
export const WithGlassEffect: Story = {
|
|
341
|
-
render:
|
|
342
|
-
<div
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
293
|
+
render: args => (
|
|
294
|
+
<div
|
|
295
|
+
style={{
|
|
296
|
+
display: 'flex',
|
|
297
|
+
justifyContent: 'center',
|
|
298
|
+
padding: '100px',
|
|
299
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
300
|
+
minHeight: '300px',
|
|
301
|
+
}}
|
|
302
|
+
>
|
|
303
|
+
<Popover
|
|
304
|
+
{...args}
|
|
305
|
+
content={<div style={{ padding: '20px' }}>Glass Effect Popover Content</div>}
|
|
306
|
+
>
|
|
350
307
|
<PopoverTrigger>
|
|
351
308
|
<Button variant="primary">Open Glass Popover</Button>
|
|
352
309
|
</PopoverTrigger>
|
|
353
|
-
<div style={{ padding: '20px' }}>Glass Effect Popover Content</div>
|
|
354
310
|
</Popover>
|
|
355
311
|
</div>
|
|
356
312
|
),
|
|
@@ -374,7 +330,7 @@ export const WithGlassEffect: Story = {
|
|
|
374
330
|
* Glass morphism popover example.
|
|
375
331
|
*/
|
|
376
332
|
export const GlassPopover: Story = {
|
|
377
|
-
render: args => <InteractivePopover {...args} />,
|
|
333
|
+
render: args => <InteractivePopover {...args} content={undefined} />,
|
|
378
334
|
args: {
|
|
379
335
|
position: 'top',
|
|
380
336
|
trigger: 'click',
|
|
@@ -404,7 +360,7 @@ export const GlassPopover: Story = {
|
|
|
404
360
|
* Glass popover with custom settings.
|
|
405
361
|
*/
|
|
406
362
|
export const GlassPopoverCustom: Story = {
|
|
407
|
-
render:
|
|
363
|
+
render: args => {
|
|
408
364
|
const selectOptions = [
|
|
409
365
|
{ value: '1', label: 'Option 1' },
|
|
410
366
|
{ value: '2', label: 'Option 2' },
|
|
@@ -446,11 +402,10 @@ export const GlassPopoverCustom: Story = {
|
|
|
446
402
|
|
|
447
403
|
return (
|
|
448
404
|
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
449
|
-
<Popover {...args}>
|
|
405
|
+
<Popover {...args} content={content}>
|
|
450
406
|
<PopoverTrigger>
|
|
451
407
|
<Button variant="primary">Open Popover</Button>
|
|
452
408
|
</PopoverTrigger>
|
|
453
|
-
{content}
|
|
454
409
|
</Popover>
|
|
455
410
|
</div>
|
|
456
411
|
);
|
|
@@ -491,7 +446,7 @@ export const GlassPopoverCustom: Story = {
|
|
|
491
446
|
* Glass popover with hover trigger.
|
|
492
447
|
*/
|
|
493
448
|
export const GlassPopoverHover: Story = {
|
|
494
|
-
render:
|
|
449
|
+
render: args => {
|
|
495
450
|
const selectOptions = [
|
|
496
451
|
{ value: '1', label: 'Option 1' },
|
|
497
452
|
{ value: '2', label: 'Option 2' },
|
|
@@ -533,11 +488,10 @@ export const GlassPopoverHover: Story = {
|
|
|
533
488
|
|
|
534
489
|
return (
|
|
535
490
|
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
536
|
-
<Popover {...args}>
|
|
491
|
+
<Popover {...args} content={content}>
|
|
537
492
|
<PopoverTrigger>
|
|
538
493
|
<Button variant="primary">Open Popover</Button>
|
|
539
494
|
</PopoverTrigger>
|
|
540
|
-
{content}
|
|
541
495
|
</Popover>
|
|
542
496
|
</div>
|
|
543
497
|
);
|
|
@@ -571,91 +525,44 @@ export const GlassPopoverHover: Story = {
|
|
|
571
525
|
* Glass popover with different positions.
|
|
572
526
|
*/
|
|
573
527
|
export const GlassPopoverPositions: Story = {
|
|
574
|
-
render:
|
|
528
|
+
render: args => {
|
|
575
529
|
const content = <div style={{ padding: '20px' }}>Popover Content</div>;
|
|
576
|
-
|
|
530
|
+
|
|
577
531
|
return (
|
|
578
|
-
<div
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
</
|
|
611
|
-
</
|
|
612
|
-
|
|
613
|
-
<div>
|
|
614
|
-
<Popover {...args} position="left">
|
|
615
|
-
<PopoverTrigger>
|
|
616
|
-
<Button variant="primary">Left</Button>
|
|
617
|
-
</PopoverTrigger>
|
|
618
|
-
{content}
|
|
619
|
-
</Popover>
|
|
620
|
-
</div>
|
|
621
|
-
|
|
622
|
-
<div style={{ textAlign: 'center' }}>
|
|
623
|
-
<p>All popover positions</p>
|
|
624
|
-
</div>
|
|
625
|
-
|
|
626
|
-
<div>
|
|
627
|
-
<Popover {...args} position="right">
|
|
628
|
-
<PopoverTrigger>
|
|
629
|
-
<Button variant="primary">Right</Button>
|
|
630
|
-
</PopoverTrigger>
|
|
631
|
-
{content}
|
|
632
|
-
</Popover>
|
|
633
|
-
</div>
|
|
634
|
-
|
|
635
|
-
<div>
|
|
636
|
-
<Popover {...args} position="bottom-start">
|
|
637
|
-
<PopoverTrigger>
|
|
638
|
-
<Button variant="primary">Bottom Start</Button>
|
|
639
|
-
</PopoverTrigger>
|
|
640
|
-
{content}
|
|
641
|
-
</Popover>
|
|
642
|
-
</div>
|
|
643
|
-
<div>
|
|
644
|
-
<Popover {...args} position="bottom">
|
|
645
|
-
<PopoverTrigger>
|
|
646
|
-
<Button variant="primary">Bottom</Button>
|
|
647
|
-
</PopoverTrigger>
|
|
648
|
-
{content}
|
|
649
|
-
</Popover>
|
|
650
|
-
</div>
|
|
651
|
-
<div>
|
|
652
|
-
<Popover {...args} position="bottom-end">
|
|
653
|
-
<PopoverTrigger>
|
|
654
|
-
<Button variant="primary">Bottom End</Button>
|
|
655
|
-
</PopoverTrigger>
|
|
656
|
-
{content}
|
|
657
|
-
</Popover>
|
|
658
|
-
</div>
|
|
532
|
+
<div
|
|
533
|
+
style={{
|
|
534
|
+
display: 'flex',
|
|
535
|
+
justifyContent: 'center',
|
|
536
|
+
gap: '20px',
|
|
537
|
+
padding: '50px',
|
|
538
|
+
alignItems: 'center',
|
|
539
|
+
height: '300px',
|
|
540
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
541
|
+
}}
|
|
542
|
+
>
|
|
543
|
+
<Popover {...args} position="left" content={content}>
|
|
544
|
+
<PopoverTrigger>
|
|
545
|
+
<Button variant="primary">Left</Button>
|
|
546
|
+
</PopoverTrigger>
|
|
547
|
+
</Popover>
|
|
548
|
+
|
|
549
|
+
<Popover {...args} position="top" content={content}>
|
|
550
|
+
<PopoverTrigger>
|
|
551
|
+
<Button variant="primary">Top</Button>
|
|
552
|
+
</PopoverTrigger>
|
|
553
|
+
</Popover>
|
|
554
|
+
|
|
555
|
+
<Popover {...args} position="bottom" content={content}>
|
|
556
|
+
<PopoverTrigger>
|
|
557
|
+
<Button variant="primary">Bottom</Button>
|
|
558
|
+
</PopoverTrigger>
|
|
559
|
+
</Popover>
|
|
560
|
+
|
|
561
|
+
<Popover {...args} position="right" content={content}>
|
|
562
|
+
<PopoverTrigger>
|
|
563
|
+
<Button variant="primary">Right</Button>
|
|
564
|
+
</PopoverTrigger>
|
|
565
|
+
</Popover>
|
|
659
566
|
</div>
|
|
660
567
|
);
|
|
661
568
|
},
|
|
@@ -106,7 +106,10 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
106
106
|
<div className="c-popover__content-inner">{content}</div>
|
|
107
107
|
</div>
|
|
108
108
|
)}
|
|
109
|
-
<div
|
|
109
|
+
<div
|
|
110
|
+
ref={arrowRef as React.RefObject<HTMLDivElement>}
|
|
111
|
+
className="c-popover__arrow"
|
|
112
|
+
></div>
|
|
110
113
|
</div>,
|
|
111
114
|
document.body
|
|
112
115
|
)}
|
|
@@ -119,43 +122,44 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
119
122
|
*/
|
|
120
123
|
export const PopoverTrigger = forwardRef<HTMLElement, PopoverTriggerProps>(
|
|
121
124
|
({ children, trigger: triggerProp }, ref) => {
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
125
|
+
const { isOpen, setIsOpen, triggerRef, popoverId, triggerType } =
|
|
126
|
+
React.useContext(PopoverContext);
|
|
127
|
+
|
|
128
|
+
// Determine which trigger type to use - prop from PopoverTrigger or from context
|
|
129
|
+
const effectiveTrigger = triggerProp || triggerType;
|
|
130
|
+
|
|
131
|
+
// Handle trigger events
|
|
132
|
+
const handleClick = () => {
|
|
133
|
+
setIsOpen(!isOpen);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const handleMouseEnter = () => {
|
|
137
|
+
setIsOpen(true);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const handleMouseLeave = () => {
|
|
141
|
+
setIsOpen(false);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Clone the children element with additional props
|
|
145
|
+
const child = React.Children.only(children) as React.ReactElement;
|
|
146
|
+
|
|
147
|
+
const triggerProps: any = {
|
|
148
|
+
ref: ref || triggerRef,
|
|
149
|
+
'aria-describedby': popoverId,
|
|
150
|
+
'aria-expanded': isOpen,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (effectiveTrigger === 'click') {
|
|
154
|
+
triggerProps.onClick = handleClick;
|
|
155
|
+
} else if (effectiveTrigger === 'hover') {
|
|
156
|
+
triggerProps.onMouseEnter = handleMouseEnter;
|
|
157
|
+
triggerProps.onMouseLeave = handleMouseLeave;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return React.cloneElement(child, triggerProps);
|
|
155
161
|
}
|
|
156
|
-
|
|
157
|
-
return React.cloneElement(child, triggerProps);
|
|
158
|
-
});
|
|
162
|
+
);
|
|
159
163
|
|
|
160
164
|
PopoverTrigger.displayName = 'PopoverTrigger';
|
|
161
165
|
|
|
@@ -4,7 +4,7 @@ import { fn } from '@storybook/test';
|
|
|
4
4
|
import { Progress } from './Progress';
|
|
5
5
|
import { THEME_COLORS, SIZES } from '../../lib/constants/components';
|
|
6
6
|
|
|
7
|
-
const meta = {
|
|
7
|
+
const meta: Meta<typeof Progress> = {
|
|
8
8
|
title: 'Components/Progress',
|
|
9
9
|
component: Progress,
|
|
10
10
|
parameters: {
|
|
@@ -83,7 +83,7 @@ Progress displays the completion status of a task or process. It provides visual
|
|
|
83
83
|
description: 'The progress value as a percentage (0-100)',
|
|
84
84
|
table: {
|
|
85
85
|
type: { summary: 'number' },
|
|
86
|
-
defaultValue: { summary: 0 },
|
|
86
|
+
defaultValue: { summary: '0' },
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
89
|
variant: {
|
|
@@ -104,40 +104,8 @@ Progress displays the completion status of a task or process. It provides visual
|
|
|
104
104
|
defaultValue: { summary: 'md' },
|
|
105
105
|
},
|
|
106
106
|
},
|
|
107
|
-
animated: {
|
|
108
|
-
control: 'boolean',
|
|
109
|
-
description: 'Whether to animate the progress bar',
|
|
110
|
-
table: {
|
|
111
|
-
type: { summary: 'boolean' },
|
|
112
|
-
defaultValue: { summary: false },
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
striped: {
|
|
116
|
-
control: 'boolean',
|
|
117
|
-
description: 'Whether to apply striped styling',
|
|
118
|
-
table: {
|
|
119
|
-
type: { summary: 'boolean' },
|
|
120
|
-
defaultValue: { summary: false },
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
label: {
|
|
124
|
-
control: 'text',
|
|
125
|
-
description: 'Optional label to display with the progress',
|
|
126
|
-
table: {
|
|
127
|
-
type: { summary: 'string' },
|
|
128
|
-
defaultValue: { summary: '-' },
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
max: {
|
|
132
|
-
control: 'number',
|
|
133
|
-
description: 'The maximum value for the progress bar',
|
|
134
|
-
table: {
|
|
135
|
-
type: { summary: 'number' },
|
|
136
|
-
defaultValue: { summary: 100 },
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
107
|
},
|
|
140
|
-
}
|
|
108
|
+
};
|
|
141
109
|
|
|
142
110
|
export default meta;
|
|
143
111
|
type Story = StoryObj<typeof meta>;
|
|
@@ -158,13 +126,24 @@ export const BasicUsage: Story = {
|
|
|
158
126
|
};
|
|
159
127
|
|
|
160
128
|
export const AllVariants: Story = {
|
|
129
|
+
args: { value: 0 },
|
|
161
130
|
render: () => (
|
|
162
131
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem', width: '100%' }}>
|
|
163
|
-
<div
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<div
|
|
167
|
-
|
|
132
|
+
<div>
|
|
133
|
+
<strong>Primary:</strong> <Progress value={75} variant="primary" />
|
|
134
|
+
</div>
|
|
135
|
+
<div>
|
|
136
|
+
<strong>Secondary:</strong> <Progress value={60} variant="secondary" />
|
|
137
|
+
</div>
|
|
138
|
+
<div>
|
|
139
|
+
<strong>Success:</strong> <Progress value={100} variant="success" />
|
|
140
|
+
</div>
|
|
141
|
+
<div>
|
|
142
|
+
<strong>Warning:</strong> <Progress value={45} variant="warning" />
|
|
143
|
+
</div>
|
|
144
|
+
<div>
|
|
145
|
+
<strong>Error:</strong> <Progress value={30} variant="error" />
|
|
146
|
+
</div>
|
|
168
147
|
</div>
|
|
169
148
|
),
|
|
170
149
|
parameters: {
|
|
@@ -177,11 +156,18 @@ export const AllVariants: Story = {
|
|
|
177
156
|
};
|
|
178
157
|
|
|
179
158
|
export const AllSizes: Story = {
|
|
159
|
+
args: { value: 0 },
|
|
180
160
|
render: () => (
|
|
181
161
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem', width: '100%' }}>
|
|
182
|
-
<div
|
|
183
|
-
|
|
184
|
-
|
|
162
|
+
<div>
|
|
163
|
+
<strong>Small:</strong> <Progress value={60} size="sm" />
|
|
164
|
+
</div>
|
|
165
|
+
<div>
|
|
166
|
+
<strong>Medium:</strong> <Progress value={70} size="md" />
|
|
167
|
+
</div>
|
|
168
|
+
<div>
|
|
169
|
+
<strong>Large:</strong> <Progress value={80} size="lg" />
|
|
170
|
+
</div>
|
|
185
171
|
</div>
|
|
186
172
|
),
|
|
187
173
|
parameters: {
|
|
@@ -198,8 +184,13 @@ export const WithLabel: Story = {
|
|
|
198
184
|
value: 75,
|
|
199
185
|
variant: 'primary',
|
|
200
186
|
size: 'md',
|
|
201
|
-
label: 'Processing files: 75%',
|
|
202
187
|
},
|
|
188
|
+
render: args => (
|
|
189
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
|
190
|
+
<label>Processing files: 75%</label>
|
|
191
|
+
<Progress {...args} />
|
|
192
|
+
</div>
|
|
193
|
+
),
|
|
203
194
|
parameters: {
|
|
204
195
|
docs: {
|
|
205
196
|
description: {
|
|
@@ -172,7 +172,8 @@ export const ContentColumns: Story = {
|
|
|
172
172
|
<div>
|
|
173
173
|
<p className="c-river__text">
|
|
174
174
|
Use content columns to create custom layouts with different types of content. This
|
|
175
|
-
approach gives you more control over the structure and presentation of your
|
|
175
|
+
approach gives you more control over the structure and presentation of your
|
|
176
|
+
information.
|
|
176
177
|
</p>
|
|
177
178
|
<p className="c-river__text">
|
|
178
179
|
Perfect for featuring important statistics, quotes, or highlighting key information
|