@shohojdhara/atomix 0.2.2 → 0.2.3
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/dist/atomix.css +292 -529
- package/dist/atomix.min.css +5 -5
- package/dist/index.d.ts +623 -121
- package/dist/index.esm.js +11475 -6047
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4698 -2755
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/themes/boomdevs.css +291 -528
- package/dist/themes/boomdevs.min.css +6 -6
- package/dist/themes/esrar.css +292 -529
- package/dist/themes/esrar.min.css +6 -6
- package/dist/themes/mashroom.css +286 -526
- package/dist/themes/mashroom.min.css +6 -6
- package/dist/themes/shaj-default.css +286 -526
- package/dist/themes/shaj-default.min.css +6 -6
- package/package.json +66 -15
- package/src/components/Accordion/Accordion.stories.tsx +137 -0
- package/src/components/Accordion/Accordion.tsx +33 -3
- package/src/components/AtomixGlass/AtomixGlass.stories.tsx +3011 -0
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +199 -0
- package/src/components/AtomixGlass/AtomixGlass.tsx +1281 -0
- package/src/components/AtomixGlass/AtomixGlassComprehensivePreview.stories.tsx +1369 -0
- package/src/components/AtomixGlass/README.md +134 -0
- package/src/components/AtomixGlass/index.ts +10 -0
- package/src/components/AtomixGlass/shader-utils.ts +140 -0
- package/src/components/AtomixGlass/utils.ts +8 -0
- package/src/components/Badge/Badge.stories.tsx +169 -0
- package/src/components/Badge/Badge.tsx +27 -2
- package/src/components/Button/Button.stories.tsx +345 -0
- package/src/components/Button/Button.tsx +35 -3
- package/src/components/Button/README.md +216 -0
- package/src/components/Callout/Callout.stories.tsx +813 -78
- package/src/components/Callout/Callout.test.tsx +368 -0
- package/src/components/Callout/Callout.tsx +26 -7
- package/src/components/Callout/README.md +409 -0
- package/src/components/Card/Card.stories.tsx +140 -0
- package/src/components/Card/Card.tsx +19 -3
- package/src/components/DatePicker/DatePicker copy.tsx +551 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +188 -0
- package/src/components/DatePicker/DatePicker.tsx +379 -332
- package/src/components/DatePicker/readme.md +110 -1
- package/src/components/DatePicker/types.ts +8 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +145 -0
- package/src/components/Dropdown/Dropdown.tsx +34 -5
- package/src/components/Form/Checkbox.stories.tsx +101 -0
- package/src/components/Form/Checkbox.tsx +26 -2
- package/src/components/Form/Input.stories.tsx +124 -0
- package/src/components/Form/Input.tsx +36 -7
- package/src/components/Form/Radio.stories.tsx +139 -0
- package/src/components/Form/Radio.tsx +26 -2
- package/src/components/Form/Select.stories.tsx +110 -0
- package/src/components/Form/Select.tsx +26 -2
- package/src/components/Form/Textarea.stories.tsx +104 -0
- package/src/components/Form/Textarea.tsx +36 -7
- package/src/components/Hero/Hero.stories.tsx +54 -1
- package/src/components/Hero/Hero.tsx +70 -11
- package/src/components/Modal/Modal.stories.tsx +235 -0
- package/src/components/Modal/Modal.tsx +64 -35
- package/src/components/Pagination/Pagination.stories.tsx +101 -0
- package/src/components/Pagination/Pagination.tsx +25 -1
- package/src/components/Popover/Popover.stories.tsx +94 -0
- package/src/components/Popover/Popover.tsx +30 -4
- package/src/components/Rating/Rating.stories.tsx +112 -0
- package/src/components/Rating/Rating.tsx +25 -1
- package/src/components/Steps/Steps.stories.tsx +119 -0
- package/src/components/Steps/Steps.tsx +32 -1
- package/src/components/Tab/Tab.stories.tsx +88 -0
- package/src/components/Tab/Tab.tsx +32 -1
- package/src/components/Toggle/Toggle.stories.tsx +92 -0
- package/src/components/Toggle/Toggle.tsx +32 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +131 -0
- package/src/components/Tooltip/Tooltip.tsx +43 -7
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +1002 -196
- package/src/components/VideoPlayer/VideoPlayer.tsx +161 -4
- package/src/components/index.ts +1 -0
- package/src/lib/composables/index.ts +4 -0
- package/src/lib/composables/useAtomixGlass.ts +71 -0
- package/src/lib/composables/useButton.ts +3 -1
- package/src/lib/composables/useCallout.ts +4 -1
- package/src/lib/composables/useGlassContainer.ts +168 -0
- package/src/lib/constants/components.ts +88 -0
- package/src/lib/types/components.ts +352 -0
- package/src/lib/utils/displacement-generator.ts +86 -0
- package/src/styles/01-settings/_settings.background.scss +8 -7
- package/src/styles/01-settings/_settings.callout.scss +7 -7
- package/src/styles/02-tools/_tools.animations.scss +19 -0
- package/src/styles/02-tools/_tools.background.scss +19 -17
- package/src/styles/02-tools/_tools.glass.scss +1 -0
- package/src/styles/03-generic/_generic.root.scss +3 -2
- package/src/styles/04-elements/_elements.body.scss +0 -18
- package/src/styles/06-components/_components.accordion.scss +16 -0
- package/src/styles/06-components/_components.atomix-glass.scss +0 -0
- package/src/styles/06-components/_components.badge.scss +34 -0
- package/src/styles/06-components/_components.button.scss +10 -0
- package/src/styles/06-components/_components.callout.scss +41 -2
- package/src/styles/06-components/_components.card.scss +17 -0
- package/src/styles/06-components/_components.chart.scss +1 -1
- package/src/styles/06-components/_components.datepicker.scss +18 -0
- package/src/styles/06-components/_components.dropdown.scss +7 -1
- package/src/styles/06-components/_components.hero.scss +1 -2
- package/src/styles/06-components/_components.input.scss +31 -1
- package/src/styles/06-components/_components.video-player.scss +48 -26
- package/src/styles/06-components/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +48 -0
- package/dist/themes/yabai.css +0 -15207
- package/dist/themes/yabai.min.css +0 -189
|
@@ -84,6 +84,7 @@ const RangeExample = () => {
|
|
|
84
84
|
| `placement` | `string` | `'bottom-start'` | Placement of the dropdown calendar |
|
|
85
85
|
| `inputClassName` | `string` | - | Additional class for the input |
|
|
86
86
|
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the input field |
|
|
87
|
+
| `glass` | `boolean \| AtomixGlassProps` | `false` | Applies glass morphism effect to calendar dropdown |
|
|
87
88
|
|
|
88
89
|
## Ref API
|
|
89
90
|
|
|
@@ -103,4 +104,112 @@ datePickerRef.current.clear();
|
|
|
103
104
|
|
|
104
105
|
// Focus the input
|
|
105
106
|
datePickerRef.current.focus();
|
|
106
|
-
```
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Glass Morphism Effect
|
|
110
|
+
|
|
111
|
+
The DatePicker component supports glass morphism effects through the `glass` prop, which can be applied to the calendar dropdown for a modern, translucent appearance.
|
|
112
|
+
|
|
113
|
+
### Basic Glass Effect
|
|
114
|
+
|
|
115
|
+
```jsx
|
|
116
|
+
import React, { useState } from 'react';
|
|
117
|
+
import DatePicker from '../components/DatePicker';
|
|
118
|
+
|
|
119
|
+
const GlassExample = () => {
|
|
120
|
+
const [selectedDate, setSelectedDate] = useState(null);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div style={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', padding: '2rem' }}>
|
|
124
|
+
<DatePicker
|
|
125
|
+
value={selectedDate}
|
|
126
|
+
onChange={setSelectedDate}
|
|
127
|
+
placeholder="Select a date..."
|
|
128
|
+
glass={true}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Custom Glass Configuration
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
import React, { useState } from 'react';
|
|
139
|
+
import DatePicker from '../components/DatePicker';
|
|
140
|
+
|
|
141
|
+
const CustomGlassExample = () => {
|
|
142
|
+
const [selectedDate, setSelectedDate] = useState(null);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div style={{ background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)', padding: '2rem' }}>
|
|
146
|
+
<DatePicker
|
|
147
|
+
value={selectedDate}
|
|
148
|
+
onChange={setSelectedDate}
|
|
149
|
+
placeholder="Select a date..."
|
|
150
|
+
glass={{
|
|
151
|
+
displacementScale: 60,
|
|
152
|
+
blurAmount: 0,
|
|
153
|
+
saturation: 180,
|
|
154
|
+
aberrationIntensity: 2,
|
|
155
|
+
cornerRadius: 16,
|
|
156
|
+
overLight: false,
|
|
157
|
+
mode: 'polar',
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Glass with Date Range Selection
|
|
166
|
+
|
|
167
|
+
```jsx
|
|
168
|
+
import React, { useState } from 'react';
|
|
169
|
+
import DatePicker from '../components/DatePicker';
|
|
170
|
+
|
|
171
|
+
const GlassRangeExample = () => {
|
|
172
|
+
const [dateRange, setDateRange] = useState({ startDate: null, endDate: null });
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div style={{ background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)', padding: '2rem' }}>
|
|
176
|
+
<DatePicker
|
|
177
|
+
selectionMode="range"
|
|
178
|
+
startDate={dateRange.startDate}
|
|
179
|
+
endDate={dateRange.endDate}
|
|
180
|
+
onRangeChange={setDateRange}
|
|
181
|
+
placeholder="Select date range..."
|
|
182
|
+
glass={{
|
|
183
|
+
displacementScale: 45,
|
|
184
|
+
blurAmount: 0,
|
|
185
|
+
saturation: 160,
|
|
186
|
+
aberrationIntensity: 1.5,
|
|
187
|
+
cornerRadius: 14,
|
|
188
|
+
mode: 'prominent',
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Glass Props
|
|
197
|
+
|
|
198
|
+
When `glass` is an object, it accepts the same props as the `AtomixGlass` component:
|
|
199
|
+
|
|
200
|
+
| Prop | Type | Default | Description |
|
|
201
|
+
|------|------|---------|-------------|
|
|
202
|
+
| `displacementScale` | `number` | `40` | Displacement scale for the glass effect |
|
|
203
|
+
| `blurAmount` | `number` | `0` | Blur amount for the backdrop |
|
|
204
|
+
| `saturation` | `number` | `160` | Saturation percentage for the backdrop |
|
|
205
|
+
| `aberrationIntensity` | `number` | `1.5` | Chromatic aberration intensity |
|
|
206
|
+
| `cornerRadius` | `number` | `12` | Corner radius in pixels |
|
|
207
|
+
| `overLight` | `boolean` | `false` | Whether the glass is over a light background |
|
|
208
|
+
| `mode` | `'standard' \| 'polar' \| 'prominent' \| 'shader'` | `'standard'` | Glass effect mode |
|
|
209
|
+
|
|
210
|
+
### Best Practices for Glass DatePicker
|
|
211
|
+
|
|
212
|
+
- Use glass effects with colorful or gradient backgrounds for best visual impact
|
|
213
|
+
- Consider the `overLight` prop when using light backgrounds
|
|
214
|
+
- The `polar` and `prominent` modes work well for date pickers with larger calendar dropdowns
|
|
215
|
+
- Ensure sufficient contrast between the glass effect and background for accessibility
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AtomixGlassProps } from '../../lib/types/components';
|
|
2
3
|
|
|
3
4
|
export type DatePickerViewMode = 'days' | 'months' | 'years';
|
|
4
5
|
|
|
@@ -142,6 +143,13 @@ export interface DatePickerProps {
|
|
|
142
143
|
* @default "md"
|
|
143
144
|
*/
|
|
144
145
|
size?: DatePickerSize;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Applies a glass morphism effect to the calendar dropdown.
|
|
149
|
+
* Can be a boolean to enable with default settings, or an object with AtomixGlassProps to customize the effect.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
glass?: boolean | AtomixGlassProps;
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
export interface DatePickerRef {
|
|
@@ -67,6 +67,10 @@ const meta: Meta<typeof Dropdown> = {
|
|
|
67
67
|
control: 'boolean',
|
|
68
68
|
description: 'Whether to close the dropdown when pressing the Escape key',
|
|
69
69
|
},
|
|
70
|
+
glass: {
|
|
71
|
+
control: 'boolean',
|
|
72
|
+
description: 'Enable glass morphism effect',
|
|
73
|
+
},
|
|
70
74
|
},
|
|
71
75
|
};
|
|
72
76
|
|
|
@@ -356,3 +360,144 @@ export const AllVariants: Story = {
|
|
|
356
360
|
);
|
|
357
361
|
},
|
|
358
362
|
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Glass morphism dropdown example.
|
|
366
|
+
*/
|
|
367
|
+
export const GlassDropdown: Story = {
|
|
368
|
+
args: {
|
|
369
|
+
...Default.args,
|
|
370
|
+
glass: true,
|
|
371
|
+
},
|
|
372
|
+
render: args => <InteractiveDropdown {...args} />,
|
|
373
|
+
decorators: [
|
|
374
|
+
(Story) => (
|
|
375
|
+
<div style={{
|
|
376
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
377
|
+
minHeight: '100vh',
|
|
378
|
+
padding: '2rem'
|
|
379
|
+
}}>
|
|
380
|
+
<Story />
|
|
381
|
+
</div>
|
|
382
|
+
),
|
|
383
|
+
],
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Glass dropdown with custom settings.
|
|
388
|
+
*/
|
|
389
|
+
export const GlassDropdownCustom: Story = {
|
|
390
|
+
args: {
|
|
391
|
+
...Default.args,
|
|
392
|
+
glass: {
|
|
393
|
+
displacementScale: 80,
|
|
394
|
+
blurAmount: 2,
|
|
395
|
+
saturation: 200,
|
|
396
|
+
aberrationIntensity: 1,
|
|
397
|
+
cornerRadius: 16,
|
|
398
|
+
mode: 'polar',
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
render: args => <InteractiveDropdown {...args} />,
|
|
402
|
+
decorators: [
|
|
403
|
+
(Story) => (
|
|
404
|
+
<div style={{
|
|
405
|
+
background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
|
|
406
|
+
minHeight: '100vh',
|
|
407
|
+
padding: '2rem'
|
|
408
|
+
}}>
|
|
409
|
+
<Story />
|
|
410
|
+
</div>
|
|
411
|
+
),
|
|
412
|
+
],
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Glass dropdown with icons.
|
|
417
|
+
*/
|
|
418
|
+
export const GlassDropdownWithIcons: Story = {
|
|
419
|
+
args: {
|
|
420
|
+
...WithIcons.args,
|
|
421
|
+
glass: true,
|
|
422
|
+
},
|
|
423
|
+
render: args => <InteractiveDropdown {...args} />,
|
|
424
|
+
decorators: [
|
|
425
|
+
(Story) => (
|
|
426
|
+
<div style={{
|
|
427
|
+
background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
|
428
|
+
minHeight: '100vh',
|
|
429
|
+
padding: '2rem'
|
|
430
|
+
}}>
|
|
431
|
+
<Story />
|
|
432
|
+
</div>
|
|
433
|
+
),
|
|
434
|
+
],
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Glass dropdown with all variants.
|
|
439
|
+
*/
|
|
440
|
+
export const GlassAllVariants: Story = {
|
|
441
|
+
parameters: {
|
|
442
|
+
docs: {
|
|
443
|
+
description: {
|
|
444
|
+
story:
|
|
445
|
+
'Glass morphism effect applied to dropdowns with all color variants.',
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
render: () => {
|
|
450
|
+
const [openDropdown, setOpenDropdown] = useState<string | null>(null);
|
|
451
|
+
|
|
452
|
+
const handleOpenChange = (variant: string, isOpen: boolean) => {
|
|
453
|
+
if (isOpen) {
|
|
454
|
+
setOpenDropdown(variant);
|
|
455
|
+
} else if (openDropdown === variant) {
|
|
456
|
+
setOpenDropdown(null);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
return (
|
|
461
|
+
<div style={{
|
|
462
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
463
|
+
minHeight: '100vh',
|
|
464
|
+
padding: '2rem'
|
|
465
|
+
}}>
|
|
466
|
+
<div className="u-d-flex u-flex-wrap u-gap-3">
|
|
467
|
+
{[
|
|
468
|
+
'primary',
|
|
469
|
+
'secondary',
|
|
470
|
+
'tertiary',
|
|
471
|
+
'success',
|
|
472
|
+
'info',
|
|
473
|
+
'warning',
|
|
474
|
+
'error',
|
|
475
|
+
'light',
|
|
476
|
+
'dark',
|
|
477
|
+
].map(color => (
|
|
478
|
+
<Dropdown
|
|
479
|
+
key={color}
|
|
480
|
+
variant={color as ThemeColor}
|
|
481
|
+
trigger="click"
|
|
482
|
+
isOpen={openDropdown === color}
|
|
483
|
+
onOpenChange={isOpen => handleOpenChange(color, isOpen)}
|
|
484
|
+
glass={true}
|
|
485
|
+
children={
|
|
486
|
+
<button className={`c-btn c-btn--${color}`}>
|
|
487
|
+
{color} <Icon name="CaretDown" className="c-dropdown__toggle-icon" size="sm" />
|
|
488
|
+
</button>
|
|
489
|
+
}
|
|
490
|
+
menu={
|
|
491
|
+
<>
|
|
492
|
+
<DropdownItem>Menu item 1</DropdownItem>
|
|
493
|
+
<DropdownItem>Menu item 2</DropdownItem>
|
|
494
|
+
<DropdownItem>Menu item 3</DropdownItem>
|
|
495
|
+
</>
|
|
496
|
+
}
|
|
497
|
+
/>
|
|
498
|
+
))}
|
|
499
|
+
</div>
|
|
500
|
+
</div>
|
|
501
|
+
);
|
|
502
|
+
},
|
|
503
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState, useCallback, createContext, useContext, useEffect } from 'react';
|
|
2
2
|
import { DROPDOWN } from '../../lib/constants/components';
|
|
3
|
+
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
3
4
|
import type {
|
|
4
5
|
DropdownProps,
|
|
5
6
|
DropdownItemProps,
|
|
@@ -138,6 +139,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
138
139
|
minWidth = DROPDOWN.DEFAULTS.MIN_WIDTH,
|
|
139
140
|
variant,
|
|
140
141
|
className = '',
|
|
142
|
+
glass,
|
|
141
143
|
...props
|
|
142
144
|
}) => {
|
|
143
145
|
// Set up controlled vs uncontrolled state
|
|
@@ -294,6 +296,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
294
296
|
trigger === 'click' ? 'c-dropdown--onclick' : '',
|
|
295
297
|
variant ? `c-dropdown--${variant}` : '',
|
|
296
298
|
isOpen ? 'is-open' : '',
|
|
299
|
+
glass ? 'c-dropdown--glass' : '',
|
|
297
300
|
className,
|
|
298
301
|
]
|
|
299
302
|
.filter(Boolean)
|
|
@@ -306,6 +309,14 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
306
309
|
menuStyleProps.minWidth = typeof minWidth === 'number' ? `${minWidth}px` : minWidth;
|
|
307
310
|
}
|
|
308
311
|
|
|
312
|
+
const menuContent = (
|
|
313
|
+
<div className="c-dropdown__menu-inner" style={menuStyleProps}>
|
|
314
|
+
<DropdownContext.Provider value={{ isOpen, close, id: dropdownId, trigger }}>
|
|
315
|
+
<ul className={`c-dropdown__menu ${glass ? 'c-dropdown__menu--glass' : ''}`}>{menu}</ul>
|
|
316
|
+
</DropdownContext.Provider>
|
|
317
|
+
</div>
|
|
318
|
+
);
|
|
319
|
+
|
|
309
320
|
return (
|
|
310
321
|
<div
|
|
311
322
|
ref={dropdownRef}
|
|
@@ -335,11 +346,29 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
335
346
|
aria-hidden={!isOpen}
|
|
336
347
|
onKeyDown={handleKeyDown}
|
|
337
348
|
>
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
349
|
+
{glass ? (
|
|
350
|
+
// Default glass settings for dropdowns
|
|
351
|
+
(() => {
|
|
352
|
+
const defaultGlassProps = {
|
|
353
|
+
displacementScale: 60,
|
|
354
|
+
blurAmount: 1,
|
|
355
|
+
saturation: 160,
|
|
356
|
+
aberrationIntensity: 0.5,
|
|
357
|
+
cornerRadius: 12,
|
|
358
|
+
mode: 'shader' as const,
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
362
|
+
|
|
363
|
+
return (
|
|
364
|
+
<AtomixGlass {...glassProps} style={{position: 'absolute', width: '100%', height: '100%'}}>
|
|
365
|
+
{menuContent}
|
|
366
|
+
</AtomixGlass>
|
|
367
|
+
);
|
|
368
|
+
})()
|
|
369
|
+
) : (
|
|
370
|
+
menuContent
|
|
371
|
+
)}
|
|
343
372
|
</div>
|
|
344
373
|
</div>
|
|
345
374
|
);
|
|
@@ -32,6 +32,10 @@ const meta = {
|
|
|
32
32
|
control: 'boolean',
|
|
33
33
|
description: 'Whether the checkbox is in indeterminate state',
|
|
34
34
|
},
|
|
35
|
+
glass: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Enable glass morphism effect',
|
|
38
|
+
},
|
|
35
39
|
},
|
|
36
40
|
} satisfies Meta<typeof Checkbox>;
|
|
37
41
|
|
|
@@ -74,3 +78,100 @@ export const WithoutLabel: Story = {
|
|
|
74
78
|
ariaLabel: 'Checkbox without visible label',
|
|
75
79
|
},
|
|
76
80
|
};
|
|
81
|
+
|
|
82
|
+
// Glass variant
|
|
83
|
+
export const Glass: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
label: 'Glass Checkbox',
|
|
86
|
+
glass: true,
|
|
87
|
+
},
|
|
88
|
+
render: (args) => (
|
|
89
|
+
<div
|
|
90
|
+
style={{
|
|
91
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
92
|
+
padding: '2rem',
|
|
93
|
+
borderRadius: '12px',
|
|
94
|
+
minHeight: '200px',
|
|
95
|
+
display: 'flex',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<Checkbox {...args} />
|
|
101
|
+
</div>
|
|
102
|
+
),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Glass with custom settings
|
|
106
|
+
export const GlassCustom: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
label: 'Custom Glass Checkbox',
|
|
109
|
+
glass: {
|
|
110
|
+
displacementScale: 80,
|
|
111
|
+
blurAmount: 2,
|
|
112
|
+
saturation: 200,
|
|
113
|
+
aberrationIntensity: 0.8,
|
|
114
|
+
cornerRadius: 12,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
render: (args) => (
|
|
118
|
+
<div
|
|
119
|
+
style={{
|
|
120
|
+
background: 'url(https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80)',
|
|
121
|
+
backgroundSize: 'cover',
|
|
122
|
+
backgroundPosition: 'center',
|
|
123
|
+
padding: '2rem',
|
|
124
|
+
borderRadius: '12px',
|
|
125
|
+
minHeight: '200px',
|
|
126
|
+
display: 'flex',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
justifyContent: 'center',
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Checkbox {...args} />
|
|
132
|
+
</div>
|
|
133
|
+
),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Glass states
|
|
137
|
+
export const GlassStates: Story = {
|
|
138
|
+
render: () => (
|
|
139
|
+
<div
|
|
140
|
+
style={{
|
|
141
|
+
background: 'linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57)',
|
|
142
|
+
backgroundSize: '400% 400%',
|
|
143
|
+
animation: 'gradient 15s ease infinite',
|
|
144
|
+
padding: '2rem',
|
|
145
|
+
borderRadius: '12px',
|
|
146
|
+
minHeight: '400px',
|
|
147
|
+
display: 'flex',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<style>
|
|
153
|
+
{`
|
|
154
|
+
@keyframes gradient {
|
|
155
|
+
0% { background-position: 0% 50%; }
|
|
156
|
+
50% { background-position: 100% 50%; }
|
|
157
|
+
100% { background-position: 0% 50%; }
|
|
158
|
+
}
|
|
159
|
+
`}
|
|
160
|
+
</style>
|
|
161
|
+
<div>
|
|
162
|
+
<h3 style={{ color: 'white', marginBottom: '2rem', textAlign: 'center', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
|
|
163
|
+
Glass Checkbox States
|
|
164
|
+
</h3>
|
|
165
|
+
<div className="u-d-flex u-flex-column u-gap-3">
|
|
166
|
+
<Checkbox label="Glass Checkbox" glass />
|
|
167
|
+
<Checkbox label="Glass Checked" checked glass />
|
|
168
|
+
<Checkbox label="Glass Disabled" disabled glass />
|
|
169
|
+
<Checkbox label="Glass Disabled and Checked" disabled checked glass />
|
|
170
|
+
<Checkbox label="Glass Valid" valid checked glass />
|
|
171
|
+
<Checkbox label="Glass Invalid" invalid glass />
|
|
172
|
+
<Checkbox label="Glass Indeterminate" indeterminate glass />
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
),
|
|
177
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CheckboxProps } from '../../lib/types/components';
|
|
3
3
|
import { useCheckbox } from '../../lib/composables/useCheckbox';
|
|
4
|
+
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Checkbox - A component for checkbox inputs
|
|
@@ -20,6 +21,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
20
21
|
indeterminate = false,
|
|
21
22
|
ariaLabel,
|
|
22
23
|
ariaDescribedBy,
|
|
24
|
+
glass,
|
|
23
25
|
}) => {
|
|
24
26
|
const { generateCheckboxClass, checkboxRef } = useCheckbox({
|
|
25
27
|
indeterminate,
|
|
@@ -29,14 +31,14 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
const checkboxClass = generateCheckboxClass({
|
|
32
|
-
className,
|
|
34
|
+
className: `${className} ${glass ? 'c-checkbox--glass' : ''}`.trim(),
|
|
33
35
|
disabled,
|
|
34
36
|
invalid,
|
|
35
37
|
valid,
|
|
36
38
|
indeterminate,
|
|
37
39
|
});
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
const checkboxContent = (
|
|
40
42
|
<div className={checkboxClass}>
|
|
41
43
|
<input
|
|
42
44
|
ref={checkboxRef}
|
|
@@ -60,6 +62,28 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
60
62
|
)}
|
|
61
63
|
</div>
|
|
62
64
|
);
|
|
65
|
+
|
|
66
|
+
if (glass) {
|
|
67
|
+
// Default glass settings for checkboxes
|
|
68
|
+
const defaultGlassProps = {
|
|
69
|
+
displacementScale: 40,
|
|
70
|
+
blurAmount: 1,
|
|
71
|
+
saturation: 160,
|
|
72
|
+
aberrationIntensity: 0.3,
|
|
73
|
+
cornerRadius: 6,
|
|
74
|
+
mode: 'shader' as const,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<AtomixGlass {...glassProps}>
|
|
81
|
+
{checkboxContent}
|
|
82
|
+
</AtomixGlass>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return checkboxContent;
|
|
63
87
|
};
|
|
64
88
|
|
|
65
89
|
export type { CheckboxProps };
|
|
@@ -39,6 +39,10 @@ const meta = {
|
|
|
39
39
|
control: 'text',
|
|
40
40
|
description: 'Placeholder text',
|
|
41
41
|
},
|
|
42
|
+
glass: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
description: 'Enable glass morphism effect',
|
|
45
|
+
},
|
|
42
46
|
},
|
|
43
47
|
} satisfies Meta<typeof Input>;
|
|
44
48
|
|
|
@@ -104,3 +108,123 @@ export const States: Story = {
|
|
|
104
108
|
</div>
|
|
105
109
|
),
|
|
106
110
|
};
|
|
111
|
+
|
|
112
|
+
// Glass Effect
|
|
113
|
+
export const Glass: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
placeholder: 'Glass Input',
|
|
116
|
+
glass: true,
|
|
117
|
+
},
|
|
118
|
+
render: (args) => (
|
|
119
|
+
<div
|
|
120
|
+
style={{
|
|
121
|
+
background: 'url(https://cdn.pixabay.com/photo/2021/11/13/08/50/athens-6790780_1280.jpg)',
|
|
122
|
+
padding: '2rem',
|
|
123
|
+
borderRadius: '12px',
|
|
124
|
+
backgroundSize: 'cover',
|
|
125
|
+
backgroundPosition: 'center',
|
|
126
|
+
minHeight: '200px',
|
|
127
|
+
display: 'flex',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
justifyContent: 'center',
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
<Input {...args} />
|
|
133
|
+
</div>
|
|
134
|
+
),
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Glass Variants
|
|
138
|
+
export const GlassVariants: Story = {
|
|
139
|
+
render: () => (
|
|
140
|
+
<div
|
|
141
|
+
style={{
|
|
142
|
+
background: 'url(https://cdn.pixabay.com/photo/2021/11/13/08/50/athens-6790780_1280.jpg)',
|
|
143
|
+
padding: '2rem',
|
|
144
|
+
borderRadius: '12px',
|
|
145
|
+
backgroundSize: 'cover',
|
|
146
|
+
backgroundPosition: 'center',
|
|
147
|
+
minHeight: '200px',
|
|
148
|
+
display: 'flex',
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
justifyContent: 'center',
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
154
|
+
Glass Input Variants
|
|
155
|
+
</h3>
|
|
156
|
+
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
157
|
+
<Input placeholder="Small Glass" size="sm" glass />
|
|
158
|
+
<Input placeholder="Medium Glass" size="md" glass />
|
|
159
|
+
<Input placeholder="Large Glass" size="lg" glass />
|
|
160
|
+
<Input placeholder="Primary Glass" variant="primary" glass />
|
|
161
|
+
<Input placeholder="Success Glass" variant="success" glass />
|
|
162
|
+
<Input placeholder="Custom Glass" glass={{
|
|
163
|
+
displacementScale: 80,
|
|
164
|
+
blurAmount: 2,
|
|
165
|
+
saturation: 200,
|
|
166
|
+
aberrationIntensity: 2,
|
|
167
|
+
cornerRadius: 12,
|
|
168
|
+
}} />
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
),
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Glass Showcase
|
|
175
|
+
export const GlassShowcase: Story = {
|
|
176
|
+
render: () => (
|
|
177
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}>
|
|
178
|
+
{/* Basic Glass */}
|
|
179
|
+
<div
|
|
180
|
+
style={{
|
|
181
|
+
background: 'url(https://cdn.pixabay.com/photo/2021/11/13/08/50/athens-6790780_1280.jpg)',
|
|
182
|
+
backgroundSize: 'cover',
|
|
183
|
+
backgroundPosition: 'center',
|
|
184
|
+
padding: '2rem',
|
|
185
|
+
borderRadius: '12px',
|
|
186
|
+
backgroundSize: 'cover',
|
|
187
|
+
backgroundPosition: 'center',
|
|
188
|
+
minHeight: '200px',
|
|
189
|
+
display: 'flex',
|
|
190
|
+
alignItems: 'center',
|
|
191
|
+
justifyContent: 'center',
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
195
|
+
Glass Input on Background
|
|
196
|
+
</h3>
|
|
197
|
+
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
198
|
+
<Input placeholder="Enter your name" glass />
|
|
199
|
+
<Input type="email" placeholder="Enter your email" glass />
|
|
200
|
+
<Input type="password" placeholder="Enter password" glass />
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
{/* Different Glass Modes */}
|
|
205
|
+
<div
|
|
206
|
+
style={{
|
|
207
|
+
background: 'url(https://cdn.pixabay.com/photo/2021/11/13/08/50/athens-6790780_1280.jpg)',
|
|
208
|
+
padding: '2rem',
|
|
209
|
+
borderRadius: '12px',
|
|
210
|
+
backgroundSize: 'cover',
|
|
211
|
+
backgroundPosition: 'center',
|
|
212
|
+
minHeight: '200px',
|
|
213
|
+
display: 'flex',
|
|
214
|
+
alignItems: 'center',
|
|
215
|
+
justifyContent: 'center',
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
219
|
+
Glass Modes
|
|
220
|
+
</h3>
|
|
221
|
+
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
222
|
+
<Input placeholder="Standard Mode" glass={{ mode: 'standard' }} />
|
|
223
|
+
<Input placeholder="Polar Mode" glass={{ mode: 'polar' }} />
|
|
224
|
+
<Input placeholder="Prominent Mode" glass={{ mode: 'prominent' }} />
|
|
225
|
+
<Input placeholder="Shader Mode" glass={{ mode: 'shader' }} />
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
),
|
|
230
|
+
};
|