@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
|
@@ -72,6 +72,10 @@ const meta = {
|
|
|
72
72
|
control: 'boolean',
|
|
73
73
|
description: 'Input takes full width',
|
|
74
74
|
},
|
|
75
|
+
defaultValue: {
|
|
76
|
+
control: 'text',
|
|
77
|
+
description: 'Initial value for uncontrolled input',
|
|
78
|
+
},
|
|
75
79
|
},
|
|
76
80
|
} satisfies Meta<typeof Input>;
|
|
77
81
|
|
|
@@ -88,12 +92,22 @@ export const Basic: Story = {
|
|
|
88
92
|
},
|
|
89
93
|
};
|
|
90
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Input using defaultValue for uncontrolled component pattern.
|
|
97
|
+
*/
|
|
98
|
+
export const Uncontrolled: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
defaultValue: 'Initial value',
|
|
101
|
+
placeholder: 'Type something...',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
91
105
|
/**
|
|
92
106
|
* Showcase of all input sizes (small, medium, large).
|
|
93
107
|
*/
|
|
94
108
|
export const Sizes: Story = {
|
|
95
109
|
render: () => (
|
|
96
|
-
<div className="u-
|
|
110
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
97
111
|
<Input size="sm" placeholder="Small input" />
|
|
98
112
|
<Input size="md" placeholder="Medium input (default)" />
|
|
99
113
|
<Input size="lg" placeholder="Large input" />
|
|
@@ -106,7 +120,7 @@ export const Sizes: Story = {
|
|
|
106
120
|
*/
|
|
107
121
|
export const Types: Story = {
|
|
108
122
|
render: () => (
|
|
109
|
-
<div className="u-
|
|
123
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
110
124
|
<Input type="text" placeholder="Text input" />
|
|
111
125
|
<Input type="email" placeholder="Email input" />
|
|
112
126
|
<Input type="password" placeholder="Password input" />
|
|
@@ -123,7 +137,7 @@ export const Types: Story = {
|
|
|
123
137
|
*/
|
|
124
138
|
export const Variants: Story = {
|
|
125
139
|
render: () => (
|
|
126
|
-
<div className="u-
|
|
140
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
127
141
|
<Input variant="primary" placeholder="Primary input" />
|
|
128
142
|
<Input variant="success" placeholder="Success input" />
|
|
129
143
|
<Input variant="error" placeholder="Error input" />
|
|
@@ -138,7 +152,7 @@ export const Variants: Story = {
|
|
|
138
152
|
*/
|
|
139
153
|
export const States: Story = {
|
|
140
154
|
render: () => (
|
|
141
|
-
<div className="u-
|
|
155
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
142
156
|
<Input placeholder="Default input" />
|
|
143
157
|
<Input placeholder="Disabled input" disabled />
|
|
144
158
|
<Input placeholder="Valid input" valid />
|
|
@@ -152,7 +166,7 @@ export const States: Story = {
|
|
|
152
166
|
*/
|
|
153
167
|
export const WithIcons: Story = {
|
|
154
168
|
render: () => (
|
|
155
|
-
<div className="u-
|
|
169
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
156
170
|
<Input
|
|
157
171
|
placeholder="Search..."
|
|
158
172
|
prefixIcon={<MagnifyingGlass size={18} />}
|
|
@@ -183,7 +197,7 @@ export const Clearable: Story = {
|
|
|
183
197
|
render: () => {
|
|
184
198
|
const [value, setValue] = React.useState('');
|
|
185
199
|
return (
|
|
186
|
-
<div className="u-
|
|
200
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
187
201
|
<Input
|
|
188
202
|
placeholder="Type to see clear button"
|
|
189
203
|
value={value}
|
|
@@ -209,7 +223,7 @@ export const WithCounter: Story = {
|
|
|
209
223
|
render: () => {
|
|
210
224
|
const [value, setValue] = React.useState('');
|
|
211
225
|
return (
|
|
212
|
-
<div className="u-
|
|
226
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
213
227
|
<Input
|
|
214
228
|
placeholder="Type here (max 50 characters)"
|
|
215
229
|
value={value}
|
|
@@ -236,7 +250,7 @@ export const PasswordToggle: Story = {
|
|
|
236
250
|
render: () => {
|
|
237
251
|
const [password, setPassword] = React.useState('');
|
|
238
252
|
return (
|
|
239
|
-
<div className="u-
|
|
253
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
240
254
|
<Input
|
|
241
255
|
type="password"
|
|
242
256
|
placeholder="Enter password"
|
|
@@ -268,7 +282,7 @@ export const WithMessages: Story = {
|
|
|
268
282
|
const isInvalidEmail = email.length > 0 && !isValidEmail;
|
|
269
283
|
|
|
270
284
|
return (
|
|
271
|
-
<div className="u-
|
|
285
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
272
286
|
<Input
|
|
273
287
|
type="email"
|
|
274
288
|
placeholder="Email address"
|
|
@@ -299,7 +313,7 @@ export const WithMessages: Story = {
|
|
|
299
313
|
*/
|
|
300
314
|
export const FullWidth: Story = {
|
|
301
315
|
render: () => (
|
|
302
|
-
<div className="u-
|
|
316
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '100%', maxWidth: '500px' }}>
|
|
303
317
|
<Input placeholder="Full width input" fullWidth />
|
|
304
318
|
<Input
|
|
305
319
|
placeholder="Full width with icon"
|
|
@@ -327,7 +341,7 @@ export const Comprehensive: Story = {
|
|
|
327
341
|
const [bio, setBio] = React.useState('');
|
|
328
342
|
|
|
329
343
|
return (
|
|
330
|
-
<div className="u-
|
|
344
|
+
<div className="u-flex u-flex-column u-gap-4" style={{ width: '400px' }}>
|
|
331
345
|
<div>
|
|
332
346
|
<label style={{ display: 'block', marginBottom: '0.5rem', color: 'white' }}>
|
|
333
347
|
Search
|
|
@@ -423,7 +437,7 @@ export const GlassVariants: Story = {
|
|
|
423
437
|
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
424
438
|
Glass Input Variants
|
|
425
439
|
</h3>
|
|
426
|
-
<div className="u-
|
|
440
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
427
441
|
<Input placeholder="Small Glass" size="sm" glass />
|
|
428
442
|
<Input placeholder="Medium Glass" size="md" glass />
|
|
429
443
|
<Input placeholder="Large Glass" size="lg" glass />
|
|
@@ -465,8 +479,6 @@ export const GlassShowcase: Story = {
|
|
|
465
479
|
backgroundPosition: 'center',
|
|
466
480
|
padding: '2rem',
|
|
467
481
|
borderRadius: '12px',
|
|
468
|
-
backgroundSize: 'cover',
|
|
469
|
-
backgroundPosition: 'center',
|
|
470
482
|
minHeight: '200px',
|
|
471
483
|
display: 'flex',
|
|
472
484
|
alignItems: 'center',
|
|
@@ -476,7 +488,7 @@ export const GlassShowcase: Story = {
|
|
|
476
488
|
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
477
489
|
Glass Input on Background
|
|
478
490
|
</h3>
|
|
479
|
-
<div className="u-
|
|
491
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
480
492
|
<Input placeholder="Enter your name" glass />
|
|
481
493
|
<Input type="email" placeholder="Enter your email" glass />
|
|
482
494
|
<Input type="password" placeholder="Enter password" glass />
|
|
@@ -498,7 +510,7 @@ export const GlassShowcase: Story = {
|
|
|
498
510
|
}}
|
|
499
511
|
>
|
|
500
512
|
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>Glass Modes</h3>
|
|
501
|
-
<div className="u-
|
|
513
|
+
<div className="u-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
502
514
|
<Input placeholder="Standard Mode" glass={{ mode: 'standard' }} />
|
|
503
515
|
<Input placeholder="Polar Mode" glass={{ mode: 'polar' }} />
|
|
504
516
|
<Input placeholder="Prominent Mode" glass={{ mode: 'prominent' }} />
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
+
import { Input } from './Input';
|
|
4
|
+
|
|
5
|
+
// Mock AtomixGlass component
|
|
6
|
+
vi.mock('../AtomixGlass/AtomixGlass', () => ({
|
|
7
|
+
AtomixGlass: ({ children, ...props }: any) => (
|
|
8
|
+
<div data-testid="atomix-glass" data-glass-props={JSON.stringify(props)}>
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
11
|
+
),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
describe('Input Component', () => {
|
|
15
|
+
it('renders correctly', () => {
|
|
16
|
+
render(<Input placeholder="Test Input" />);
|
|
17
|
+
expect(screen.getByPlaceholderText('Test Input')).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('handles controlled value', () => {
|
|
21
|
+
render(<Input value="Controlled Value" onChange={() => { }} />);
|
|
22
|
+
const input = screen.getByDisplayValue('Controlled Value');
|
|
23
|
+
expect(input).toBeInTheDocument();
|
|
24
|
+
expect(input).toHaveValue('Controlled Value');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('handles uncontrolled defaultValue', () => {
|
|
28
|
+
render(<Input defaultValue="Default Value" />);
|
|
29
|
+
const input = screen.getByDisplayValue('Default Value');
|
|
30
|
+
expect(input).toBeInTheDocument();
|
|
31
|
+
expect(input).toHaveValue('Default Value');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('calls onChange when typing', () => {
|
|
35
|
+
const handleChange = vi.fn();
|
|
36
|
+
render(<Input onChange={handleChange} />);
|
|
37
|
+
const input = screen.getByRole('textbox');
|
|
38
|
+
fireEvent.change(input, { target: { value: 'New Value' } });
|
|
39
|
+
expect(handleChange).toHaveBeenCalledTimes(1);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('applies accessibility attributes', () => {
|
|
43
|
+
render(
|
|
44
|
+
<Input
|
|
45
|
+
aria-label="Accessible Label"
|
|
46
|
+
aria-describedby="description-id"
|
|
47
|
+
invalid
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
const input = screen.getByLabelText('Accessible Label');
|
|
51
|
+
expect(input).toHaveAttribute('aria-describedby', 'description-id');
|
|
52
|
+
expect(input).toHaveAttribute('aria-invalid', 'true');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('renders as glass when enabled', () => {
|
|
56
|
+
render(<Input glass placeholder="Glass Input" />);
|
|
57
|
+
expect(screen.getByTestId('atomix-glass')).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -8,108 +8,110 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
8
8
|
*/
|
|
9
9
|
export const Input = memo(
|
|
10
10
|
forwardRef<HTMLInputElement, InputProps>(
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
11
|
+
(
|
|
12
|
+
{
|
|
13
|
+
type = 'text',
|
|
14
|
+
value,
|
|
15
|
+
defaultValue,
|
|
16
|
+
onChange,
|
|
17
|
+
onBlur,
|
|
18
|
+
onFocus,
|
|
19
|
+
placeholder,
|
|
20
|
+
className = '',
|
|
21
|
+
style,
|
|
22
|
+
disabled = false,
|
|
23
|
+
required = false,
|
|
24
|
+
readOnly = false,
|
|
25
|
+
id,
|
|
26
|
+
name,
|
|
27
|
+
autoComplete,
|
|
28
|
+
autoFocus = false,
|
|
29
|
+
size = 'md',
|
|
30
|
+
variant,
|
|
31
|
+
invalid = false,
|
|
32
|
+
valid = false,
|
|
33
|
+
maxLength,
|
|
34
|
+
minLength,
|
|
35
|
+
pattern,
|
|
36
|
+
min,
|
|
37
|
+
max,
|
|
38
|
+
step,
|
|
39
|
+
'aria-label': ariaLabel,
|
|
40
|
+
'aria-describedby': ariaDescribedBy,
|
|
41
|
+
glass,
|
|
42
|
+
},
|
|
43
|
+
ref
|
|
44
|
+
) => {
|
|
45
|
+
const { generateInputClass } = useInput({
|
|
46
|
+
size,
|
|
47
|
+
variant,
|
|
48
|
+
disabled,
|
|
49
|
+
invalid,
|
|
50
|
+
valid,
|
|
51
|
+
});
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
const inputClass = generateInputClass({
|
|
54
|
+
className: `${className} ${glass ? 'c-input--glass' : ''}`.trim(),
|
|
55
|
+
size,
|
|
56
|
+
variant,
|
|
57
|
+
disabled,
|
|
58
|
+
invalid,
|
|
59
|
+
valid,
|
|
60
|
+
type,
|
|
61
|
+
});
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
// Custom styles for glass effect
|
|
64
|
+
const glassStyles = glass ? {} : {};
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
66
|
+
const inputElement = (
|
|
67
|
+
<input
|
|
68
|
+
ref={ref}
|
|
69
|
+
type={type}
|
|
70
|
+
className={inputClass}
|
|
71
|
+
value={value}
|
|
72
|
+
defaultValue={defaultValue}
|
|
73
|
+
onChange={onChange}
|
|
74
|
+
onBlur={onBlur}
|
|
75
|
+
onFocus={onFocus}
|
|
76
|
+
placeholder={placeholder}
|
|
77
|
+
disabled={disabled}
|
|
78
|
+
required={required}
|
|
79
|
+
readOnly={readOnly}
|
|
80
|
+
id={id}
|
|
81
|
+
name={name}
|
|
82
|
+
autoComplete={autoComplete}
|
|
83
|
+
autoFocus={autoFocus}
|
|
84
|
+
maxLength={maxLength}
|
|
85
|
+
minLength={minLength}
|
|
86
|
+
pattern={pattern}
|
|
87
|
+
min={min}
|
|
88
|
+
max={max}
|
|
89
|
+
step={step}
|
|
90
|
+
aria-label={ariaLabel}
|
|
91
|
+
aria-describedby={ariaDescribedBy}
|
|
92
|
+
aria-invalid={invalid}
|
|
93
|
+
style={glass ? { ...glassStyles, ...style } : style}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
94
96
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
if (glass) {
|
|
98
|
+
// Default glass settings for inputs
|
|
99
|
+
const defaultGlassProps = {
|
|
100
|
+
displacementScale: 60,
|
|
101
|
+
blurAmount: 1,
|
|
102
|
+
saturation: 180,
|
|
103
|
+
aberrationIntensity: 0.2,
|
|
104
|
+
cornerRadius: 12,
|
|
105
|
+
mode: 'shader' as const,
|
|
106
|
+
};
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
return <AtomixGlass {...glassProps}>{inputElement}</AtomixGlass>;
|
|
111
|
+
}
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
return inputElement;
|
|
114
|
+
}
|
|
113
115
|
)
|
|
114
116
|
);
|
|
115
117
|
|