@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
|
@@ -8,99 +8,101 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
8
8
|
*/
|
|
9
9
|
export const Textarea = memo(
|
|
10
10
|
forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
11
|
+
(
|
|
12
|
+
{
|
|
13
|
+
value,
|
|
14
|
+
defaultValue,
|
|
15
|
+
onChange,
|
|
16
|
+
onBlur,
|
|
17
|
+
onFocus,
|
|
18
|
+
placeholder,
|
|
19
|
+
className = '',
|
|
20
|
+
style,
|
|
21
|
+
disabled = false,
|
|
22
|
+
required = false,
|
|
23
|
+
readOnly = false,
|
|
24
|
+
id,
|
|
25
|
+
name,
|
|
26
|
+
rows = 4,
|
|
27
|
+
cols,
|
|
28
|
+
maxLength,
|
|
29
|
+
minLength,
|
|
30
|
+
size = 'md',
|
|
31
|
+
variant,
|
|
32
|
+
invalid = false,
|
|
33
|
+
valid = false,
|
|
34
|
+
autoFocus = false,
|
|
35
|
+
'aria-label': ariaLabel,
|
|
36
|
+
'aria-describedby': ariaDescribedBy,
|
|
37
|
+
glass,
|
|
38
|
+
},
|
|
39
|
+
ref
|
|
40
|
+
) => {
|
|
41
|
+
const { generateTextareaClass } = useTextarea({
|
|
42
|
+
size,
|
|
43
|
+
variant,
|
|
44
|
+
disabled,
|
|
45
|
+
invalid,
|
|
46
|
+
valid,
|
|
47
|
+
});
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
const textareaClass = generateTextareaClass({
|
|
50
|
+
className: `${className} ${glass ? 'c-input--glass' : ''}`.trim(),
|
|
51
|
+
size,
|
|
52
|
+
variant,
|
|
53
|
+
disabled,
|
|
54
|
+
invalid,
|
|
55
|
+
valid,
|
|
56
|
+
});
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
// Custom styles for glass effect
|
|
59
|
+
const glassStyles = glass ? {} : {};
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
61
|
+
const textareaElement = (
|
|
62
|
+
<textarea
|
|
63
|
+
ref={ref}
|
|
64
|
+
className={textareaClass}
|
|
65
|
+
value={value}
|
|
66
|
+
defaultValue={defaultValue}
|
|
67
|
+
onChange={onChange}
|
|
68
|
+
onBlur={onBlur}
|
|
69
|
+
onFocus={onFocus}
|
|
70
|
+
placeholder={placeholder}
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
required={required}
|
|
73
|
+
readOnly={readOnly}
|
|
74
|
+
id={id}
|
|
75
|
+
name={name}
|
|
76
|
+
rows={rows}
|
|
77
|
+
cols={cols}
|
|
78
|
+
maxLength={maxLength}
|
|
79
|
+
minLength={minLength}
|
|
80
|
+
autoFocus={autoFocus}
|
|
81
|
+
aria-label={ariaLabel}
|
|
82
|
+
aria-describedby={ariaDescribedBy}
|
|
83
|
+
aria-invalid={invalid}
|
|
84
|
+
style={glass ? { ...glassStyles, ...style } : style}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
if (glass) {
|
|
89
|
+
// Default glass settings for textareas
|
|
90
|
+
const defaultGlassProps = {
|
|
91
|
+
displacementScale: 60,
|
|
92
|
+
blurAmount: 1,
|
|
93
|
+
saturation: 180,
|
|
94
|
+
aberrationIntensity: 1,
|
|
95
|
+
cornerRadius: 8,
|
|
96
|
+
mode: 'shader' as const,
|
|
97
|
+
};
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
return <AtomixGlass {...glassProps}>{textareaElement}</AtomixGlass>;
|
|
102
|
+
}
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
return textareaElement;
|
|
105
|
+
}
|
|
104
106
|
)
|
|
105
107
|
);
|
|
106
108
|
|
|
@@ -71,7 +71,7 @@ export const Basic: Story = {
|
|
|
71
71
|
export const VariantsShowcase: Story = {
|
|
72
72
|
render: () => {
|
|
73
73
|
return (
|
|
74
|
-
<div className="u-
|
|
74
|
+
<div className="u-flex u-flex-column u-gap-8">
|
|
75
75
|
{['Default', 'Dash', 'Number', 'Text'].map((title, index) => {
|
|
76
76
|
const variant = index === 0 ? 'default' : title.toLowerCase();
|
|
77
77
|
return createListSection(`${title} List`, variant, variant);
|
|
@@ -91,7 +91,7 @@ export const ListGroupShowcase: Story = {
|
|
|
91
91
|
];
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
|
-
<div className="u-
|
|
94
|
+
<div className="u-flex u-flex-column u-gap-8">
|
|
95
95
|
<div>
|
|
96
96
|
<h3 style={titleStyle}>Mixed Variants ListGroup</h3>
|
|
97
97
|
<ListGroup>
|
|
@@ -213,8 +213,8 @@ export const Sizes: Story = {
|
|
|
213
213
|
const [isOpen, setIsOpen] = useState(false);
|
|
214
214
|
|
|
215
215
|
return (
|
|
216
|
-
<div className="u-
|
|
217
|
-
<div className="u-
|
|
216
|
+
<div className="u-flex u-flex-column u-gap-4">
|
|
217
|
+
<div className="u-flex u-gap-4">
|
|
218
218
|
<div
|
|
219
219
|
className={`c-btn ${size === 'sm' ? 'c-btn--primary' : 'c-btn--secondary'}`}
|
|
220
220
|
onClick={() => {
|
|
@@ -440,8 +440,8 @@ export const GlassModalSizes: Story = {
|
|
|
440
440
|
const [isOpen, setIsOpen] = useState(false);
|
|
441
441
|
|
|
442
442
|
return (
|
|
443
|
-
<div className="u-
|
|
444
|
-
<div className="u-
|
|
443
|
+
<div className="u-flex u-flex-column u-gap-4">
|
|
444
|
+
<div className="u-flex u-gap-4">
|
|
445
445
|
<div
|
|
446
446
|
className={`c-btn ${size === 'sm' ? 'c-btn--primary' : 'c-btn--secondary'}`}
|
|
447
447
|
onClick={() => {
|
|
@@ -209,7 +209,7 @@ export const FixedBottom: Story = {
|
|
|
209
209
|
// Navbar with different variants
|
|
210
210
|
export const Variants: Story = {
|
|
211
211
|
render: () => (
|
|
212
|
-
<div className="u-
|
|
212
|
+
<div className="u-flex u-flex-column u-gap-3">
|
|
213
213
|
<Navbar brand={<LogoBrand />} variant="primary">
|
|
214
214
|
<Nav alignment="end">
|
|
215
215
|
<NavItem>Link 1</NavItem>
|
|
@@ -293,7 +293,7 @@ export const Variants: Story = {
|
|
|
293
293
|
// Navbar with different nav alignments
|
|
294
294
|
export const NavAlignments: Story = {
|
|
295
295
|
render: () => (
|
|
296
|
-
<div className="u-
|
|
296
|
+
<div className="u-flex u-flex-column u-gap-3">
|
|
297
297
|
<Navbar brand={<LogoBrand />}>
|
|
298
298
|
<Nav alignment="start">
|
|
299
299
|
<NavItem>Link 1</NavItem>
|
|
@@ -386,8 +386,8 @@ export const WithSearchField: Story = {
|
|
|
386
386
|
<NavItem>Link 2</NavItem>
|
|
387
387
|
<NavItem>Link 3</NavItem>
|
|
388
388
|
</Nav>
|
|
389
|
-
<div className="u-ms-auto u-
|
|
390
|
-
<div className="c-search-form u-
|
|
389
|
+
<div className="u-ms-auto u-flex u-items-center">
|
|
390
|
+
<div className="c-search-form u-flex u-gap-2">
|
|
391
391
|
<input type="text" className="c-input c-input--sm" placeholder="Search..." />
|
|
392
392
|
<button className="c-btn c-btn--primary c-btn--sm">
|
|
393
393
|
<Icon name="MagnifyingGlass" size="sm" />
|
|
@@ -528,7 +528,7 @@ export const ResponsiveNavbar: Story = {
|
|
|
528
528
|
// Mega Menu vs Dropdown Comparison
|
|
529
529
|
export const MegaMenuVsDropdown: Story = {
|
|
530
530
|
render: () => (
|
|
531
|
-
<div className="u-
|
|
531
|
+
<div className="u-flex u-flex-column u-gap-3">
|
|
532
532
|
<div>
|
|
533
533
|
<h4 className="u-mb-3">Regular Dropdown</h4>
|
|
534
534
|
<Navbar brand={<LogoBrand />}>
|
|
@@ -223,7 +223,7 @@ document.querySelector('.c-navbar').addEventListener('navbar:collapsed', (event)
|
|
|
223
223
|
| `backdrop` | `boolean` | `false` | Show backdrop on mobile |
|
|
224
224
|
| `closeOnOutsideClick` | `boolean` | `true` | Close on outside click |
|
|
225
225
|
| `closeOnEscape` | `boolean` | `true` | Close on escape key |
|
|
226
|
-
| `
|
|
226
|
+
| `aria-label` | `string` | `'Main navigation'` | Accessible label |
|
|
227
227
|
| `className` | `string` | - | Additional CSS classes |
|
|
228
228
|
| `disabled` | `boolean` | `false` | Disable the navbar |
|
|
229
229
|
|
|
@@ -58,7 +58,7 @@ const meta = {
|
|
|
58
58
|
description: 'Size variant for pagination',
|
|
59
59
|
defaultValue: 'md',
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
'aria-label': {
|
|
62
62
|
control: 'text',
|
|
63
63
|
description: 'Accessible label for the navigation element',
|
|
64
64
|
},
|
|
@@ -71,6 +71,9 @@ const meta = {
|
|
|
71
71
|
description: 'Enable glass morphism effect',
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
+
args: {
|
|
75
|
+
onPageChange: () => { },
|
|
76
|
+
},
|
|
74
77
|
} satisfies Meta<typeof Pagination>;
|
|
75
78
|
|
|
76
79
|
export default meta;
|
|
@@ -97,7 +100,7 @@ export const Default: Story = {
|
|
|
97
100
|
showFirstLastButtons: true,
|
|
98
101
|
showPrevNextButtons: true,
|
|
99
102
|
size: 'md',
|
|
100
|
-
|
|
103
|
+
'aria-label': 'Pagination',
|
|
101
104
|
},
|
|
102
105
|
parameters: {
|
|
103
106
|
docs: {
|
|
@@ -62,7 +62,7 @@ export const Pagination: React.FC<PaginationProps> = memo(({
|
|
|
62
62
|
size = PAGINATION_DEFAULTS.size,
|
|
63
63
|
className = '',
|
|
64
64
|
style,
|
|
65
|
-
ariaLabel = 'Pagination',
|
|
65
|
+
'aria-label': ariaLabel = 'Pagination',
|
|
66
66
|
glass,
|
|
67
67
|
}) => {
|
|
68
68
|
const { paginationRange, goToPage, nextPage, prevPage, firstPage, lastPage } = usePagination({
|
|
@@ -110,7 +110,7 @@ const PhotoViewerDemo: React.FC<{ images: ImageType[]; startIndex?: number }> =
|
|
|
110
110
|
<p className="u-mb-4 u-text-secondary">
|
|
111
111
|
Click on any image to open the PhotoViewer with full functionality.
|
|
112
112
|
</p>
|
|
113
|
-
<div className="u-
|
|
113
|
+
<div className="u-flex u-gap-4 u-mb-4">
|
|
114
114
|
<Badge variant="primary" label="Zoom & Pan" />
|
|
115
115
|
<Badge variant="secondary" label="Keyboard Navigation" />
|
|
116
116
|
<Badge variant="success" label="Touch Gestures" />
|
|
@@ -119,7 +119,7 @@ const PhotoViewerDemo: React.FC<{ images: ImageType[]; startIndex?: number }> =
|
|
|
119
119
|
</div>
|
|
120
120
|
|
|
121
121
|
<div
|
|
122
|
-
className="u-
|
|
122
|
+
className="u-grid"
|
|
123
123
|
style={{ gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem' }}
|
|
124
124
|
>
|
|
125
125
|
{images.map((image, index) => (
|
|
@@ -132,8 +132,8 @@ const PhotoViewerDemo: React.FC<{ images: ImageType[]; startIndex?: number }> =
|
|
|
132
132
|
onClick={() => openViewer(index)}
|
|
133
133
|
/>
|
|
134
134
|
<div className="u-position-absolute u-bottom-0 u-start-0 u-end-0 u-bg-dark u-bg-opacity-75 u-p-3">
|
|
135
|
-
<h4 className="u-text-white u-
|
|
136
|
-
<p className="u-text-white u-
|
|
135
|
+
<h4 className="u-text-white u-text-sm u-font-medium u-mb-1">{image.title}</h4>
|
|
136
|
+
<p className="u-text-white u-text-xs u-opacity-75 u-mb-0">{image.author}</p>
|
|
137
137
|
</div>
|
|
138
138
|
</div>
|
|
139
139
|
))}
|
|
@@ -249,7 +249,7 @@ export const ThumbnailPositions: Story = {
|
|
|
249
249
|
Choose a thumbnail position and click "Open Viewer" to see the layout.
|
|
250
250
|
</p>
|
|
251
251
|
|
|
252
|
-
<div className="u-
|
|
252
|
+
<div className="u-flex u-gap-3 u-mb-4">
|
|
253
253
|
{(['bottom', 'top', 'left', 'right', 'none'] as const).map(pos => (
|
|
254
254
|
<Button
|
|
255
255
|
key={pos}
|
|
@@ -306,8 +306,8 @@ export const FeatureControls: Story = {
|
|
|
306
306
|
Toggle features on/off to see how they affect the PhotoViewer behavior.
|
|
307
307
|
</p>
|
|
308
308
|
|
|
309
|
-
<div className="u-
|
|
310
|
-
<label className="u-
|
|
309
|
+
<div className="u-flex u-gap-4 u-mb-4">
|
|
310
|
+
<label className="u-flex u-items-center u-gap-2">
|
|
311
311
|
<input
|
|
312
312
|
type="checkbox"
|
|
313
313
|
checked={features.keyboard}
|
|
@@ -315,7 +315,7 @@ export const FeatureControls: Story = {
|
|
|
315
315
|
/>
|
|
316
316
|
<span>Keyboard Navigation</span>
|
|
317
317
|
</label>
|
|
318
|
-
<label className="u-
|
|
318
|
+
<label className="u-flex u-items-center u-gap-2">
|
|
319
319
|
<input
|
|
320
320
|
type="checkbox"
|
|
321
321
|
checked={features.gestures}
|
|
@@ -323,7 +323,7 @@ export const FeatureControls: Story = {
|
|
|
323
323
|
/>
|
|
324
324
|
<span>Touch Gestures</span>
|
|
325
325
|
</label>
|
|
326
|
-
<label className="u-
|
|
326
|
+
<label className="u-flex u-items-center u-gap-2">
|
|
327
327
|
<input
|
|
328
328
|
type="checkbox"
|
|
329
329
|
checked={features.fullscreen}
|
|
@@ -386,7 +386,7 @@ export const MobileOptimized: Story = {
|
|
|
386
386
|
<li>Responsive controls and thumbnails</li>
|
|
387
387
|
<li>Full-screen info panel on mobile</li>
|
|
388
388
|
</ul>
|
|
389
|
-
<p className="u-text-tertiary u-
|
|
389
|
+
<p className="u-text-tertiary u-text-sm">
|
|
390
390
|
Try this on a mobile device or use browser dev tools to simulate mobile viewport.
|
|
391
391
|
</p>
|
|
392
392
|
</div>
|
|
@@ -83,7 +83,7 @@ const InteractivePopover = (args: React.ComponentProps<typeof Popover>) => {
|
|
|
83
83
|
|
|
84
84
|
const content = (
|
|
85
85
|
<>
|
|
86
|
-
<div className="u-
|
|
86
|
+
<div className="u-flex u-items-center u-gap-7">
|
|
87
87
|
<span className="u-text-nowrap">Sort by</span>
|
|
88
88
|
<div className="c-select">
|
|
89
89
|
<select value={selectedOption} onChange={handleSelectChange}>
|
|
@@ -135,7 +135,7 @@ export const ProductReview: React.FC<ProductReviewProps> = ({
|
|
|
135
135
|
allowHalf={allowHalf}
|
|
136
136
|
maxValue={maxRating}
|
|
137
137
|
size="lg"
|
|
138
|
-
|
|
138
|
+
variant={ratingColor}
|
|
139
139
|
/>
|
|
140
140
|
<span className="c-rating__value">
|
|
141
141
|
{rating > 0 ? rating.toFixed(1) : 'Select a rating'}
|
|
@@ -6,55 +6,55 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
6
6
|
|
|
7
7
|
export const Progress = memo(
|
|
8
8
|
forwardRef<HTMLDivElement, ProgressProps>(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
value,
|
|
12
|
+
variant = 'primary',
|
|
13
|
+
size = 'md',
|
|
14
|
+
className = '',
|
|
15
|
+
style,
|
|
16
|
+
disabled = false,
|
|
17
|
+
'aria-label': ariaLabel = PROGRESS.DEFAULTS.ARIA_LABEL,
|
|
18
|
+
glass,
|
|
19
|
+
},
|
|
20
|
+
ref
|
|
21
|
+
) => {
|
|
22
|
+
const { progressValue, progressStyle, progressClasses } = useProgress({
|
|
23
|
+
value,
|
|
24
|
+
variant,
|
|
25
|
+
size,
|
|
26
|
+
className,
|
|
27
|
+
});
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
const progressContent = (
|
|
30
|
+
<div
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={progressClasses + (glass ? ' c-progress--glass' : '')}
|
|
33
|
+
style={{ ...progressStyle, ...style }}
|
|
34
|
+
role="progressbar"
|
|
35
|
+
aria-valuemin={0}
|
|
36
|
+
aria-valuemax={100}
|
|
37
|
+
aria-valuenow={progressValue}
|
|
38
|
+
aria-label={ariaLabel}
|
|
39
|
+
aria-disabled={disabled}
|
|
40
|
+
>
|
|
41
|
+
<div className={PROGRESS.CLASSES.BAR}></div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
if (glass) {
|
|
46
|
+
const defaultGlassProps = {
|
|
47
|
+
displacementScale: 30,
|
|
48
|
+
blurAmount: 0.5,
|
|
49
|
+
cornerRadius: 8,
|
|
50
|
+
mode: 'shader' as const,
|
|
51
|
+
};
|
|
52
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
53
|
+
return <AtomixGlass {...glassProps}>{progressContent}</AtomixGlass>;
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
return progressContent;
|
|
57
|
+
}
|
|
58
58
|
)
|
|
59
59
|
);
|
|
60
60
|
|
|
@@ -38,7 +38,7 @@ const meta = {
|
|
|
38
38
|
options: SIZES,
|
|
39
39
|
description: 'The size of the rating stars',
|
|
40
40
|
},
|
|
41
|
-
|
|
41
|
+
variant: {
|
|
42
42
|
control: { type: 'select' },
|
|
43
43
|
options: THEME_COLORS,
|
|
44
44
|
description: 'The color variant of the rating',
|
|
@@ -104,14 +104,14 @@ export const Large: Story = {
|
|
|
104
104
|
},
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
export const
|
|
107
|
+
export const CustomVariant: Story = {
|
|
108
108
|
args: {
|
|
109
109
|
value: 4,
|
|
110
110
|
maxValue: 5,
|
|
111
111
|
allowHalf: false,
|
|
112
112
|
readOnly: true,
|
|
113
113
|
size: 'md',
|
|
114
|
-
|
|
114
|
+
variant: 'warning',
|
|
115
115
|
},
|
|
116
116
|
};
|
|
117
117
|
|
|
@@ -206,7 +206,7 @@ export const GlassCustom: Story = {
|
|
|
206
206
|
allowHalf: true,
|
|
207
207
|
readOnly: true,
|
|
208
208
|
size: 'lg',
|
|
209
|
-
|
|
209
|
+
variant: 'warning',
|
|
210
210
|
glass: {
|
|
211
211
|
displacementScale: 80,
|
|
212
212
|
blurAmount: 2,
|
|
@@ -13,8 +13,8 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
13
13
|
* <Rating value={3} onChange={handleRatingChange} />
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* // Read-only with custom
|
|
17
|
-
* <Rating value={4.5} readOnly
|
|
16
|
+
* // Read-only with custom variant
|
|
17
|
+
* <Rating value={4.5} readOnly variant="warning" />
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* // With half-star support
|
|
@@ -29,7 +29,7 @@ export const Rating = forwardRef<HTMLDivElement, RatingProps>(
|
|
|
29
29
|
allowHalf = false,
|
|
30
30
|
readOnly = false,
|
|
31
31
|
size = 'md',
|
|
32
|
-
|
|
32
|
+
variant,
|
|
33
33
|
onChange,
|
|
34
34
|
className = '',
|
|
35
35
|
style,
|
|
@@ -142,7 +142,7 @@ export const Rating = forwardRef<HTMLDivElement, RatingProps>(
|
|
|
142
142
|
allowHalf,
|
|
143
143
|
readOnly,
|
|
144
144
|
size,
|
|
145
|
-
|
|
145
|
+
variant,
|
|
146
146
|
onChange,
|
|
147
147
|
]);
|
|
148
148
|
|
|
@@ -156,16 +156,16 @@ export const Rating = forwardRef<HTMLDivElement, RatingProps>(
|
|
|
156
156
|
allowHalf,
|
|
157
157
|
readOnly,
|
|
158
158
|
size,
|
|
159
|
-
|
|
159
|
+
variant,
|
|
160
160
|
});
|
|
161
|
-
}, [useVanillaJS, valueProp, defaultValue, maxValue, allowHalf, readOnly, size,
|
|
161
|
+
}, [useVanillaJS, valueProp, defaultValue, maxValue, allowHalf, readOnly, size, variant]);
|
|
162
162
|
|
|
163
163
|
// Determine CSS classes
|
|
164
164
|
const ratingClasses = [
|
|
165
165
|
'c-rating',
|
|
166
166
|
size === 'sm' ? RATING.CLASSES.SMALL : '',
|
|
167
167
|
size === 'lg' ? RATING.CLASSES.LARGE : '',
|
|
168
|
-
|
|
168
|
+
variant ? `c-rating--${variant}` : '',
|
|
169
169
|
className,
|
|
170
170
|
]
|
|
171
171
|
.filter(Boolean)
|
|
@@ -201,7 +201,7 @@ export const Rating = forwardRef<HTMLDivElement, RatingProps>(
|
|
|
201
201
|
'c-rating__star',
|
|
202
202
|
isFullStar ? RATING.CLASSES.FULL : '',
|
|
203
203
|
isHalfStar ? RATING.CLASSES.HALF : '',
|
|
204
|
-
|
|
204
|
+
variant ? `c-rating__star--${variant}` : '',
|
|
205
205
|
focusedIndex === i ? 'c-rating__star--focused' : '',
|
|
206
206
|
]
|
|
207
207
|
.filter(Boolean)
|