@shohojdhara/atomix 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -0
- package/dist/atomix.css +101 -88
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +5 -15258
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +17 -19
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +41 -11
- package/dist/core.js +55 -41
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +28 -11
- package/dist/forms.js +25 -24
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +32 -25
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +122 -46
- package/dist/index.esm.js +865 -200
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +870 -204
- 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 +27 -2
- package/dist/theme.js +721 -108
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/scripts/atomix-cli.js +610 -1111
- package/scripts/cli/component-generator.js +610 -0
- package/scripts/cli/documentation-sync.js +542 -0
- package/scripts/cli/interactive-init.js +84 -288
- package/scripts/cli/mappings.js +211 -0
- package/scripts/cli/migration-tools.js +95 -288
- package/scripts/cli/template-manager.js +107 -0
- package/scripts/cli/templates/README.md +123 -0
- package/scripts/cli/templates/composable-templates.js +149 -0
- package/scripts/cli/templates/config-templates.js +126 -0
- package/scripts/cli/templates/index.js +95 -0
- package/scripts/cli/templates/project-templates.js +214 -0
- package/scripts/cli/templates/react-templates.js +261 -0
- package/scripts/cli/templates/scss-templates.js +156 -0
- package/scripts/cli/templates/storybook-templates.js +236 -0
- package/scripts/cli/templates/testing-templates.js +45 -0
- package/scripts/cli/templates/token-templates.js +447 -0
- package/scripts/cli/templates/types-templates.js +133 -0
- package/scripts/cli/templates-original-backup.js +1655 -0
- package/scripts/cli/templates.js +35 -0
- package/scripts/cli/templates_backup.js +684 -0
- package/scripts/cli/theme-bridge.js +20 -14
- package/scripts/cli/token-manager.js +150 -77
- package/scripts/cli/utils.js +37 -25
- package/src/components/Accordion/Accordion.stories.tsx +5 -5
- package/src/components/Accordion/Accordion.test.tsx +57 -0
- package/src/components/Accordion/Accordion.tsx +4 -0
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +41 -44
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +37 -37
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -51
- package/src/components/Avatar/Avatar.stories.tsx +26 -26
- package/src/components/Badge/Badge.stories.tsx +31 -31
- package/src/components/Badge/Badge.test.tsx +51 -0
- package/src/components/Badge/Badge.tsx +20 -1
- package/src/components/Block/Block.stories.tsx +5 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +2 -2
- package/src/components/Button/Button.stories.tsx +13 -13
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Button/ButtonGroup.stories.tsx +2 -2
- package/src/components/Button/README.md +5 -0
- package/src/components/Callout/Callout.stories.tsx +11 -11
- package/src/components/Callout/Callout.test.tsx +10 -10
- package/src/components/Callout/Callout.tsx +7 -7
- package/src/components/Callout/README.md +9 -8
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Chart/Chart.stories.tsx +6 -6
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +1 -1
- package/src/components/DataTable/DataTable.tsx +14 -12
- package/src/components/DatePicker/DatePicker.stories.tsx +6 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +4 -4
- package/src/components/Form/Checkbox.stories.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +4 -2
- package/src/components/Form/Form.stories.tsx +3 -3
- package/src/components/Form/FormGroup.stories.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +28 -16
- package/src/components/Form/Input.test.tsx +59 -0
- package/src/components/Form/Input.tsx +97 -95
- package/src/components/Form/Radio.stories.tsx +94 -94
- package/src/components/Form/Radio.tsx +2 -2
- package/src/components/Form/Select.stories.tsx +4 -4
- package/src/components/Form/Select.tsx +2 -2
- package/src/components/Form/Textarea.stories.tsx +22 -7
- package/src/components/Form/Textarea.test.tsx +45 -0
- package/src/components/Form/Textarea.tsx +88 -86
- package/src/components/List/List.stories.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +4 -4
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +5 -5
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/README.md +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +5 -2
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -10
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/ProductReview/ProductReview.tsx +1 -1
- package/src/components/Progress/Progress.tsx +46 -46
- package/src/components/Rating/Rating.stories.tsx +4 -4
- package/src/components/Rating/Rating.tsx +8 -8
- package/src/components/Slider/Slider.stories.tsx +63 -63
- package/src/components/Spinner/Spinner.stories.tsx +2 -2
- package/src/components/Spinner/Spinner.test.tsx +35 -0
- package/src/components/Spinner/Spinner.tsx +9 -2
- package/src/components/Testimonial/Testimonial.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.stories.tsx +32 -9
- package/src/components/Toggle/Toggle.test.tsx +91 -0
- package/src/components/Toggle/Toggle.tsx +44 -27
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/layouts/Grid/Grid.stories.tsx +49 -49
- package/src/layouts/MasonryGrid/MasonryGrid.stories.tsx +2 -2
- package/src/lib/composables/useAccordion.ts +12 -3
- package/src/lib/composables/useBreadcrumb.ts +2 -2
- package/src/lib/composables/useCallout.ts +7 -7
- package/src/lib/composables/useNavbar.ts +1 -1
- package/src/lib/constants/components.ts +1 -1
- package/src/lib/storybook/InteractiveDemo.tsx +113 -0
- package/src/lib/storybook/PreviewContainer.tsx +36 -0
- package/src/lib/storybook/VariantsGrid.tsx +21 -0
- package/src/lib/storybook/index.ts +3 -0
- package/src/lib/theme/core/createThemeObject.ts +9 -5
- package/src/lib/theme/devtools/CLI.ts +155 -0
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +213 -0
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +566 -0
- package/src/lib/theme/devtools/LiveEditor.tsx +2 -1
- package/src/lib/theme/devtools/index.ts +3 -0
- package/src/lib/theme/errors/errors.ts +8 -0
- package/src/lib/theme/runtime/ThemeProvider.tsx +117 -57
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +305 -0
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +588 -0
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +264 -0
- package/src/lib/theme/utils/index.ts +1 -0
- package/src/lib/theme/utils/themeValidation.ts +501 -0
- package/src/lib/theme-tools.ts +32 -3
- package/src/lib/types/components.ts +81 -26
- package/src/lib/utils/themeNaming.ts +1 -1
- package/src/styles/06-components/_components.atomix-glass.scss +14 -15
- package/src/styles/06-components/_components.callout.scss +29 -33
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/99-utilities/_utilities.display.scss +14 -3
- package/src/styles/99-utilities/_utilities.flex.scss +10 -10
- package/src/styles/99-utilities/_utilities.text.scss +28 -8
- package/scripts/cli/__tests__/cli-commands.test.js +0 -204
- package/scripts/cli/__tests__/utils.test.js +0 -201
- package/scripts/cli/__tests__/vitest.config.js +0 -26
|
@@ -48,15 +48,15 @@ const meta = {
|
|
|
48
48
|
type: { summary: 'ReactNode' },
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
|
-
|
|
51
|
+
compact: {
|
|
52
52
|
control: 'boolean',
|
|
53
|
-
description: 'Display the callout in
|
|
53
|
+
description: 'Display the callout in compact mode',
|
|
54
54
|
table: {
|
|
55
55
|
defaultValue: { summary: 'false' },
|
|
56
56
|
type: { summary: 'boolean' },
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
|
-
|
|
59
|
+
isToast: {
|
|
60
60
|
control: 'boolean',
|
|
61
61
|
description: 'Display the callout as a toast notification',
|
|
62
62
|
table: {
|
|
@@ -250,18 +250,18 @@ export const Dismissible: Story = {
|
|
|
250
250
|
},
|
|
251
251
|
};
|
|
252
252
|
|
|
253
|
-
export const
|
|
253
|
+
export const Compact: Story = {
|
|
254
254
|
args: {
|
|
255
255
|
title: 'Quick notification',
|
|
256
256
|
variant: 'info',
|
|
257
257
|
icon: <InfoIcon />,
|
|
258
|
-
|
|
258
|
+
compact: true,
|
|
259
259
|
},
|
|
260
260
|
parameters: {
|
|
261
261
|
docs: {
|
|
262
262
|
description: {
|
|
263
263
|
story:
|
|
264
|
-
'
|
|
264
|
+
'Compact callouts are more space-efficient and display the title and icon in a single line.',
|
|
265
265
|
},
|
|
266
266
|
},
|
|
267
267
|
},
|
|
@@ -273,7 +273,7 @@ export const Toast: Story = {
|
|
|
273
273
|
children: 'This callout is styled as a toast notification.',
|
|
274
274
|
variant: 'success',
|
|
275
275
|
icon: <SuccessIcon />,
|
|
276
|
-
|
|
276
|
+
isToast: true,
|
|
277
277
|
onClose: () => console.log('Toast closed'),
|
|
278
278
|
},
|
|
279
279
|
parameters: {
|
|
@@ -487,7 +487,7 @@ const ToastDemoTemplate = () => {
|
|
|
487
487
|
title={getTitle(toast.variant)}
|
|
488
488
|
variant={toast.variant as any}
|
|
489
489
|
icon={getIcon(toast.variant)}
|
|
490
|
-
|
|
490
|
+
isToast={true}
|
|
491
491
|
onClose={() => removeToast(toast.id)}
|
|
492
492
|
>
|
|
493
493
|
{getMessage(toast.variant)}
|
|
@@ -958,7 +958,7 @@ export const GlassToast: Story = {
|
|
|
958
958
|
'This glass toast notification combines the elegance of glass morphism with toast functionality.',
|
|
959
959
|
variant: 'success',
|
|
960
960
|
icon: <SuccessIcon />,
|
|
961
|
-
|
|
961
|
+
isToast: true,
|
|
962
962
|
glass: true,
|
|
963
963
|
onClose: () => console.log('Glass toast closed'),
|
|
964
964
|
},
|
|
@@ -993,7 +993,7 @@ export const GlassOneLine: Story = {
|
|
|
993
993
|
title: 'Glass one-line notification',
|
|
994
994
|
variant: 'info',
|
|
995
995
|
icon: <InfoIcon />,
|
|
996
|
-
|
|
996
|
+
compact: true,
|
|
997
997
|
glass: true,
|
|
998
998
|
},
|
|
999
999
|
parameters: {
|
|
@@ -1325,7 +1325,7 @@ const GlassToastDemoTemplate = () => {
|
|
|
1325
1325
|
title={getTitle(toast.variant)}
|
|
1326
1326
|
variant={toast.variant as any}
|
|
1327
1327
|
icon={getIcon(toast.variant)}
|
|
1328
|
-
|
|
1328
|
+
isToast={true}
|
|
1329
1329
|
glass
|
|
1330
1330
|
onClose={() => removeToast(toast.id)}
|
|
1331
1331
|
>
|
|
@@ -46,19 +46,19 @@ describe('Callout Component', () => {
|
|
|
46
46
|
expect(container.firstChild).toHaveClass('c-callout--success');
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
it('applies
|
|
49
|
+
it('applies compact class when enabled', () => {
|
|
50
50
|
const { container } = render(
|
|
51
|
-
<Callout title="Test" variant="primary"
|
|
51
|
+
<Callout title="Test" variant="primary" compact>
|
|
52
52
|
Content
|
|
53
53
|
</Callout>
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
expect(container.firstChild).toHaveClass('c-callout--
|
|
56
|
+
expect(container.firstChild).toHaveClass('c-callout--compact');
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('applies toast class when enabled', () => {
|
|
60
60
|
const { container } = render(
|
|
61
|
-
<Callout title="Test" variant="primary"
|
|
61
|
+
<Callout title="Test" variant="primary" isToast>
|
|
62
62
|
Content
|
|
63
63
|
</Callout>
|
|
64
64
|
);
|
|
@@ -198,8 +198,8 @@ describe('Callout Component', () => {
|
|
|
198
198
|
glass={true}
|
|
199
199
|
onClose={handleClose}
|
|
200
200
|
actions={actions}
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
compact
|
|
202
|
+
isToast
|
|
203
203
|
>
|
|
204
204
|
Glass content
|
|
205
205
|
</Callout>
|
|
@@ -222,7 +222,7 @@ describe('Callout Component', () => {
|
|
|
222
222
|
expect(outerCallout).toHaveClass(
|
|
223
223
|
'c-callout',
|
|
224
224
|
'c-callout--success',
|
|
225
|
-
'c-callout--
|
|
225
|
+
'c-callout--compact',
|
|
226
226
|
'c-callout--toast',
|
|
227
227
|
'c-callout--glass'
|
|
228
228
|
);
|
|
@@ -270,7 +270,7 @@ describe('Callout Component', () => {
|
|
|
270
270
|
|
|
271
271
|
it('applies alert role and assertive live region for toast alerts', () => {
|
|
272
272
|
render(
|
|
273
|
-
<Callout title="Toast Error" variant="error"
|
|
273
|
+
<Callout title="Toast Error" variant="error" isToast>
|
|
274
274
|
Toast error message
|
|
275
275
|
</Callout>
|
|
276
276
|
);
|
|
@@ -281,7 +281,7 @@ describe('Callout Component', () => {
|
|
|
281
281
|
|
|
282
282
|
it('applies polite live region for toast notifications', () => {
|
|
283
283
|
render(
|
|
284
|
-
<Callout title="Toast Info" variant="info"
|
|
284
|
+
<Callout title="Toast Info" variant="info" isToast>
|
|
285
285
|
Toast info message
|
|
286
286
|
</Callout>
|
|
287
287
|
);
|
|
@@ -292,7 +292,7 @@ describe('Callout Component', () => {
|
|
|
292
292
|
|
|
293
293
|
it('maintains accessibility with glass effect', () => {
|
|
294
294
|
render(
|
|
295
|
-
<Callout title="Glass Error" variant="error" glass={true}
|
|
295
|
+
<Callout title="Glass Error" variant="error" glass={true} isToast>
|
|
296
296
|
Glass error message
|
|
297
297
|
</Callout>
|
|
298
298
|
);
|
|
@@ -14,8 +14,8 @@ export const Callout: React.FC<CalloutProps> = ({
|
|
|
14
14
|
variant = 'primary',
|
|
15
15
|
onClose,
|
|
16
16
|
actions,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
compact = false,
|
|
18
|
+
isToast = false,
|
|
19
19
|
glass,
|
|
20
20
|
className,
|
|
21
21
|
style,
|
|
@@ -23,8 +23,8 @@ export const Callout: React.FC<CalloutProps> = ({
|
|
|
23
23
|
}) => {
|
|
24
24
|
const { generateCalloutClass, handleClose } = useCallout({
|
|
25
25
|
variant,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
compact,
|
|
27
|
+
isToast,
|
|
28
28
|
glass,
|
|
29
29
|
className,
|
|
30
30
|
style,
|
|
@@ -37,7 +37,7 @@ export const Callout: React.FC<CalloutProps> = ({
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
// For toast notifications or alerts, use appropriate role and live region
|
|
40
|
-
if (
|
|
40
|
+
if (isToast) {
|
|
41
41
|
baseAttributes.role = 'alert';
|
|
42
42
|
baseAttributes['aria-live'] = 'polite';
|
|
43
43
|
} else if (['warning', 'error'].includes(variant)) {
|
|
@@ -83,7 +83,7 @@ export const Callout: React.FC<CalloutProps> = ({
|
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
85
|
<div
|
|
86
|
-
className={generateCalloutClass({ variant,
|
|
86
|
+
className={generateCalloutClass({ variant, compact, isToast, glass, className })}
|
|
87
87
|
{...getAriaAttributes()}
|
|
88
88
|
{...props}
|
|
89
89
|
style={style}
|
|
@@ -102,7 +102,7 @@ export const Callout: React.FC<CalloutProps> = ({
|
|
|
102
102
|
|
|
103
103
|
return (
|
|
104
104
|
<div
|
|
105
|
-
className={generateCalloutClass({ variant,
|
|
105
|
+
className={generateCalloutClass({ variant, compact, isToast, glass, className })}
|
|
106
106
|
{...getAriaAttributes()}
|
|
107
107
|
{...props}
|
|
108
108
|
style={style}
|
|
@@ -46,8 +46,8 @@ import { Callout } from '@atomix/react';
|
|
|
46
46
|
| `variant` | `ThemeColor` | `'primary'` | Color variant |
|
|
47
47
|
| `onClose` | `() => void` | - | Close handler function |
|
|
48
48
|
| `actions` | `ReactNode` | - | Optional action buttons |
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
49
|
+
| `compact` | `boolean` | `false` | Display in compact mode |
|
|
50
|
+
| `isToast` | `boolean` | `false` | Display as toast notification |
|
|
51
51
|
| `glass` | `AtomixGlassProps \| boolean` | `false` | Glass morphism effect |
|
|
52
52
|
| `className` | `string` | - | Additional CSS classes |
|
|
53
53
|
|
|
@@ -121,14 +121,14 @@ When `glass={true}`, these default settings are used:
|
|
|
121
121
|
|
|
122
122
|
## Layout Options
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### Compact Mode
|
|
125
125
|
|
|
126
126
|
```tsx
|
|
127
127
|
<Callout
|
|
128
128
|
title="Quick notification"
|
|
129
129
|
variant="info"
|
|
130
130
|
icon={<InfoIcon />}
|
|
131
|
-
|
|
131
|
+
compact={true}
|
|
132
132
|
/>
|
|
133
133
|
```
|
|
134
134
|
|
|
@@ -139,7 +139,7 @@ When `glass={true}`, these default settings are used:
|
|
|
139
139
|
title="Toast Message"
|
|
140
140
|
variant="success"
|
|
141
141
|
icon={<SuccessIcon />}
|
|
142
|
-
|
|
142
|
+
isToast={true}
|
|
143
143
|
onClose={() => handleClose()}
|
|
144
144
|
>
|
|
145
145
|
This appears as a toast notification
|
|
@@ -222,7 +222,7 @@ function ToastManager() {
|
|
|
222
222
|
key={toast.id}
|
|
223
223
|
title={toast.variant}
|
|
224
224
|
variant={toast.variant}
|
|
225
|
-
|
|
225
|
+
isToast={true}
|
|
226
226
|
glass={true}
|
|
227
227
|
onClose={() => removeToast(toast.id)}
|
|
228
228
|
>
|
|
@@ -368,7 +368,7 @@ function NotificationSystem() {
|
|
|
368
368
|
variant="error"
|
|
369
369
|
title="Error"
|
|
370
370
|
icon={<X />}
|
|
371
|
-
|
|
371
|
+
isToast={true}
|
|
372
372
|
glass={true}
|
|
373
373
|
onClose={() => handleErrorClose()}
|
|
374
374
|
>
|
|
@@ -384,7 +384,8 @@ function NotificationSystem() {
|
|
|
384
384
|
### From v1.x to v2.x
|
|
385
385
|
|
|
386
386
|
- Glass prop added as optional feature
|
|
387
|
-
-
|
|
387
|
+
- **Prop Rename**: `oneLine` is now `compact`
|
|
388
|
+
- **Prop Rename**: `toast` is now `isToast`
|
|
388
389
|
- Enhanced accessibility attributes
|
|
389
390
|
- Improved TypeScript definitions
|
|
390
391
|
|
|
@@ -303,10 +303,10 @@ export const ChartGallery: Story = {
|
|
|
303
303
|
|
|
304
304
|
// Custom toolbar with chart controls
|
|
305
305
|
const customToolbar = (
|
|
306
|
-
<div className="u-
|
|
307
|
-
<div className="u-border-start u-ps-2 u-
|
|
306
|
+
<div className="u-flex u-gap-2 u-items-center u-flex-wrap u-mb-5">
|
|
307
|
+
<div className="u-border-start u-ps-2 u-flex u-gap-2 u-items-center">
|
|
308
308
|
{/* Data Points Control */}
|
|
309
|
-
<div className="u-
|
|
309
|
+
<div className="u-flex u-items-center u-gap-1">
|
|
310
310
|
<Icon name="Database" size="sm" />
|
|
311
311
|
<input
|
|
312
312
|
type="range"
|
|
@@ -515,14 +515,14 @@ export const ChartGallery: Story = {
|
|
|
515
515
|
return (
|
|
516
516
|
<Container className="u-py-6">
|
|
517
517
|
<Card className="u-mb-6 u-p-6 u-text-center">
|
|
518
|
-
<h1 className="u-mb-3 u-
|
|
518
|
+
<h1 className="u-mb-3 u-flex u-items-center u-justify-center u-gap-2">
|
|
519
519
|
<Icon name="ChartBar" size="lg" />
|
|
520
520
|
Atomix Chart Gallery
|
|
521
521
|
</h1>
|
|
522
522
|
<p className="u-mb-4 u-text-muted">
|
|
523
523
|
Explore 20+ modern chart types with integrated toolbar controls
|
|
524
524
|
</p>
|
|
525
|
-
<div className="u-
|
|
525
|
+
<div className="u-flex u-gap-2 u-justify-center u-flex-wrap">
|
|
526
526
|
<Badge label="20+ Types" variant="primary" />
|
|
527
527
|
<Badge label="Real-time" variant="success" />
|
|
528
528
|
<Badge label="Interactive" variant="info" />
|
|
@@ -542,7 +542,7 @@ export const ChartGallery: Story = {
|
|
|
542
542
|
onClick={() => setSelectedType(key)}
|
|
543
543
|
active={selectedType === key}
|
|
544
544
|
>
|
|
545
|
-
<div className="u-
|
|
545
|
+
<div className="u-flex u-items-center u-gap-2">
|
|
546
546
|
<Icon name={icon as any} size="sm" />
|
|
547
547
|
<div>
|
|
548
548
|
<div>{label}</div>
|
|
@@ -353,7 +353,7 @@ const Chart = memo(
|
|
|
353
353
|
>
|
|
354
354
|
{(title || subtitle || showToolbar) && (
|
|
355
355
|
<div
|
|
356
|
-
className={`${CHART.HEADER_CLASS} u-
|
|
356
|
+
className={`${CHART.HEADER_CLASS} u-flex u-justify-between u-items-start u-gap-4`}
|
|
357
357
|
>
|
|
358
358
|
<div className={`${CHART.HEADER_CONTENT_CLASS} u-flex-1`}>
|
|
359
359
|
{title && <h3 className={`${CHART.TITLE_CLASS} u-mb-1`}>{title}</h3>}
|
|
@@ -127,7 +127,7 @@ export const WithoutStorage: Story = {
|
|
|
127
127
|
export const InHeader: Story = {
|
|
128
128
|
render: () => (
|
|
129
129
|
<div
|
|
130
|
-
className="u-p-5 u-shadow u-
|
|
130
|
+
className="u-p-5 u-shadow u-flex u-justify-between u-items-center"
|
|
131
131
|
style={{ width: '400px', borderRadius: '8px' }}
|
|
132
132
|
>
|
|
133
133
|
<span style={{ fontWeight: 600 }}>Toggle Theme</span>
|
|
@@ -137,26 +137,26 @@ export const DataTable: React.FC<DataTableProps> = memo(({
|
|
|
137
137
|
e.preventDefault();
|
|
138
138
|
e.stopPropagation();
|
|
139
139
|
setResizingColumn(columnKey);
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
const startX = e.clientX;
|
|
142
142
|
const startWidth = columnWidths[columnKey] || 100;
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
const handleMouseMove = (moveEvent: MouseEvent) => {
|
|
145
145
|
const diff = moveEvent.clientX - startX;
|
|
146
146
|
const newWidth = Math.max(50, startWidth + diff); // Minimum width of 50px
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
setColumnWidths(prev => ({
|
|
149
149
|
...prev,
|
|
150
150
|
[columnKey]: newWidth,
|
|
151
151
|
}));
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
const handleMouseUp = () => {
|
|
155
155
|
setResizingColumn(null);
|
|
156
156
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
157
157
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
158
158
|
};
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
document.addEventListener('mousemove', handleMouseMove);
|
|
161
161
|
document.addEventListener('mouseup', handleMouseUp);
|
|
162
162
|
}, [columnWidths]);
|
|
@@ -178,8 +178,10 @@ export const DataTable: React.FC<DataTableProps> = memo(({
|
|
|
178
178
|
if (dragStartIndex !== null && dragStartIndex !== dropIndex && onColumnReorder) {
|
|
179
179
|
const newOrder = [...visibleColumns.map(col => col.key)];
|
|
180
180
|
const [removed] = newOrder.splice(dragStartIndex, 1);
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
if (removed) {
|
|
182
|
+
newOrder.splice(dropIndex, 0, removed);
|
|
183
|
+
onColumnReorder(newOrder);
|
|
184
|
+
}
|
|
183
185
|
}
|
|
184
186
|
setDragStartIndex(null);
|
|
185
187
|
setDragOverIndex(null);
|
|
@@ -246,7 +248,7 @@ export const DataTable: React.FC<DataTableProps> = memo(({
|
|
|
246
248
|
{visibleColumns.map((column, index) => {
|
|
247
249
|
const isDragging = dragStartIndex === index;
|
|
248
250
|
const isDragOver = dragOverIndex === index;
|
|
249
|
-
|
|
251
|
+
|
|
250
252
|
return (
|
|
251
253
|
<th
|
|
252
254
|
key={`header-${column.key}`}
|
|
@@ -363,8 +365,8 @@ export const DataTable: React.FC<DataTableProps> = memo(({
|
|
|
363
365
|
{selectionMode === 'multiple' ? (
|
|
364
366
|
<Checkbox
|
|
365
367
|
checked={isSelected}
|
|
366
|
-
onChange={(e) => handleRowSelect(rowId, e.target.checked)}
|
|
367
|
-
onClick={(e) => e.stopPropagation()}
|
|
368
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleRowSelect(rowId, e.target.checked)}
|
|
369
|
+
onClick={(e: React.MouseEvent<HTMLInputElement>) => e.stopPropagation()}
|
|
368
370
|
aria-label={`Select row ${rowIndex + 1}`}
|
|
369
371
|
/>
|
|
370
372
|
) : (
|
|
@@ -411,7 +413,7 @@ export const DataTable: React.FC<DataTableProps> = memo(({
|
|
|
411
413
|
showFirstLastButtons={true}
|
|
412
414
|
showPrevNextButtons={true}
|
|
413
415
|
size="sm"
|
|
414
|
-
|
|
416
|
+
aria-label="Data table pagination"
|
|
415
417
|
className="c-data-table__pagination"
|
|
416
418
|
/>
|
|
417
419
|
</div>
|
|
@@ -466,7 +468,7 @@ export const DataTable: React.FC<DataTableProps> = memo(({
|
|
|
466
468
|
<Checkbox
|
|
467
469
|
checked={columnVisibility[column.key] !== false}
|
|
468
470
|
onChange={() => handleColumnVisibilityToggle(column.key)}
|
|
469
|
-
onClick={(e) => e.stopPropagation()}
|
|
471
|
+
onClick={(e: React.MouseEvent<HTMLInputElement>) => e.stopPropagation()}
|
|
470
472
|
/>
|
|
471
473
|
<span style={{ marginLeft: '0.5rem' }}>{column.title}</span>
|
|
472
474
|
</label>
|
|
@@ -135,7 +135,7 @@ export const DateRangeSelection: Story = {
|
|
|
135
135
|
return (
|
|
136
136
|
<div
|
|
137
137
|
style={{ width: '300px' }}
|
|
138
|
-
className="u-
|
|
138
|
+
className="u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center"
|
|
139
139
|
>
|
|
140
140
|
<DatePicker
|
|
141
141
|
{...args}
|
|
@@ -875,9 +875,9 @@ export const DateRangeWithLimits: Story = {
|
|
|
875
875
|
return (
|
|
876
876
|
<div
|
|
877
877
|
style={{ width: '400px' }}
|
|
878
|
-
className="u-
|
|
878
|
+
className="u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center"
|
|
879
879
|
>
|
|
880
|
-
<p className="u-text-info u-px-2 u-py-4 u-bg-info-subtle u-
|
|
880
|
+
<p className="u-text-info u-px-2 u-py-4 u-bg-info-subtle u-text-xs u-text-center">
|
|
881
881
|
Select a date range between {minDate.toLocaleDateString()} and{' '}
|
|
882
882
|
{maxDate.toLocaleDateString()}
|
|
883
883
|
</p>
|
|
@@ -913,7 +913,7 @@ export const InlineRangeSelection: Story = {
|
|
|
913
913
|
return (
|
|
914
914
|
<div
|
|
915
915
|
style={{ width: '300px' }}
|
|
916
|
-
className="u-
|
|
916
|
+
className="u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center"
|
|
917
917
|
>
|
|
918
918
|
<DatePicker
|
|
919
919
|
{...args}
|
|
@@ -950,7 +950,7 @@ export const Sizes: Story = {
|
|
|
950
950
|
return (
|
|
951
951
|
<div
|
|
952
952
|
style={{ width: '300px' }}
|
|
953
|
-
className={'u-
|
|
953
|
+
className={'u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center'}
|
|
954
954
|
>
|
|
955
955
|
<DatePicker {...args} size="sm" placeholder="Small (sm)" value={date} onChange={setDate} />
|
|
956
956
|
<DatePicker {...args} size="md" placeholder="Medium (md)" value={date} onChange={setDate} />
|
|
@@ -1003,7 +1003,7 @@ export const DifferentFormats: Story = {
|
|
|
1003
1003
|
const [date3, setDate3] = useState<Date | null>(initialDate);
|
|
1004
1004
|
|
|
1005
1005
|
return (
|
|
1006
|
-
<div className="u-w-75 u-mx-auto u-mt-20 u-
|
|
1006
|
+
<div className="u-w-75 u-mx-auto u-mt-20 u-flex u-gap-3">
|
|
1007
1007
|
<DatePicker
|
|
1008
1008
|
{...args}
|
|
1009
1009
|
format="MM/dd/yyyy"
|
|
@@ -250,7 +250,7 @@ export const AllPlacements: Story = {
|
|
|
250
250
|
return (
|
|
251
251
|
<div className="u-p-5" style={{ height: '650px' }}>
|
|
252
252
|
<div
|
|
253
|
-
className="u-
|
|
253
|
+
className="u-grid"
|
|
254
254
|
style={{
|
|
255
255
|
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
256
256
|
gridTemplateRows: 'repeat(2, 1fr)',
|
|
@@ -261,7 +261,7 @@ export const AllPlacements: Story = {
|
|
|
261
261
|
{placements.map(placement => (
|
|
262
262
|
<div
|
|
263
263
|
key={placement.value}
|
|
264
|
-
className="u-
|
|
264
|
+
className="u-flex u-items-center u-justify-center"
|
|
265
265
|
>
|
|
266
266
|
<Dropdown
|
|
267
267
|
trigger="click"
|
|
@@ -316,7 +316,7 @@ export const AllVariants: Story = {
|
|
|
316
316
|
|
|
317
317
|
return (
|
|
318
318
|
<div className="u-p-4" style={{ minHeight: '300px' }}>
|
|
319
|
-
<div className="u-
|
|
319
|
+
<div className="u-flex u-flex-wrap u-gap-3">
|
|
320
320
|
{[
|
|
321
321
|
'primary',
|
|
322
322
|
'secondary',
|
|
@@ -462,7 +462,7 @@ export const GlassAllVariants: Story = {
|
|
|
462
462
|
padding: '2rem',
|
|
463
463
|
}}
|
|
464
464
|
>
|
|
465
|
-
<div className="u-
|
|
465
|
+
<div className="u-flex u-flex-wrap u-gap-3">
|
|
466
466
|
{[
|
|
467
467
|
'primary',
|
|
468
468
|
'secondary',
|
|
@@ -67,7 +67,7 @@ export const Checked: Story = {
|
|
|
67
67
|
// Checkbox states
|
|
68
68
|
export const States: Story = {
|
|
69
69
|
render: (args: any) => (
|
|
70
|
-
<div className="u-
|
|
70
|
+
<div className="u-flex u-flex-column u-gap-3">
|
|
71
71
|
<Checkbox label="Default checkbox" />
|
|
72
72
|
<Checkbox label="Checked checkbox" checked />
|
|
73
73
|
<Checkbox label="Disabled checkbox" disabled />
|
|
@@ -82,7 +82,7 @@ export const States: Story = {
|
|
|
82
82
|
// Without label
|
|
83
83
|
export const WithoutLabel: Story = {
|
|
84
84
|
args: {
|
|
85
|
-
|
|
85
|
+
'aria-label': 'Checkbox without visible label',
|
|
86
86
|
},
|
|
87
87
|
};
|
|
88
88
|
|
|
@@ -177,7 +177,7 @@ export const GlassStates: Story = {
|
|
|
177
177
|
>
|
|
178
178
|
Glass Checkbox States
|
|
179
179
|
</h3>
|
|
180
|
-
<div className="u-
|
|
180
|
+
<div className="u-flex u-flex-column u-gap-3">
|
|
181
181
|
<Checkbox label="Glass Checkbox" glass />
|
|
182
182
|
<Checkbox label="Glass Checked" checked glass />
|
|
183
183
|
<Checkbox label="Glass Disabled" disabled glass />
|
|
@@ -20,8 +20,9 @@ export const Checkbox: React.FC<CheckboxProps> = memo(({
|
|
|
20
20
|
invalid = false,
|
|
21
21
|
valid = false,
|
|
22
22
|
indeterminate = false,
|
|
23
|
-
ariaLabel,
|
|
24
|
-
ariaDescribedBy,
|
|
23
|
+
'aria-label': ariaLabel,
|
|
24
|
+
'aria-describedby': ariaDescribedBy,
|
|
25
|
+
onClick,
|
|
25
26
|
glass,
|
|
26
27
|
}) => {
|
|
27
28
|
const { generateCheckboxClass, checkboxRef } = useCheckbox({
|
|
@@ -47,6 +48,7 @@ export const Checkbox: React.FC<CheckboxProps> = memo(({
|
|
|
47
48
|
className="c-checkbox__input"
|
|
48
49
|
checked={checked}
|
|
49
50
|
onChange={onChange}
|
|
51
|
+
onClick={onClick}
|
|
50
52
|
disabled={disabled}
|
|
51
53
|
required={required}
|
|
52
54
|
id={id}
|
|
@@ -127,14 +127,14 @@ export const CompleteForm: Story = {
|
|
|
127
127
|
</FormGroup>
|
|
128
128
|
|
|
129
129
|
<FormGroup label="Preferred contact method">
|
|
130
|
-
<div className="u-
|
|
130
|
+
<div className="u-flex u-flex-column u-gap-2">
|
|
131
131
|
<Radio id="contact-email" name="contactMethod" value="email" label="Email" checked />
|
|
132
132
|
<Radio id="contact-phone" name="contactMethod" value="phone" label="Phone" />
|
|
133
133
|
<Radio id="contact-mail" name="contactMethod" value="mail" label="Mail" />
|
|
134
134
|
</div>
|
|
135
135
|
</FormGroup>
|
|
136
136
|
|
|
137
|
-
<div className="u-
|
|
137
|
+
<div className="u-flex u-gap-3 u-mt-4">
|
|
138
138
|
<button type="submit" className="c-btn c-btn--primary">
|
|
139
139
|
Register
|
|
140
140
|
</button>
|
|
@@ -306,7 +306,7 @@ export const Interactive: Story = {
|
|
|
306
306
|
/>
|
|
307
307
|
</FormGroup>
|
|
308
308
|
|
|
309
|
-
<div className="u-
|
|
309
|
+
<div className="u-flex u-gap-3 u-mt-4">
|
|
310
310
|
<button type="submit" className="c-btn c-btn--primary">
|
|
311
311
|
Submit
|
|
312
312
|
</button>
|
|
@@ -88,7 +88,7 @@ export const ValidationStates: Story = {
|
|
|
88
88
|
required: true,
|
|
89
89
|
},
|
|
90
90
|
render: args => (
|
|
91
|
-
<div className="u-
|
|
91
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
92
92
|
<FormGroup label="Username" htmlFor="username" helperText="Username is available" valid>
|
|
93
93
|
<Input id="username" value="johndoe" valid />
|
|
94
94
|
</FormGroup>
|