@shohojdhara/atomix 0.2.1 → 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/README.md +1 -28
- package/dist/atomix.css +1500 -241
- package/dist/atomix.min.css +6 -6
- package/dist/index.d.ts +1052 -194
- package/dist/index.esm.js +12201 -6066
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5481 -2827
- 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 +1500 -301
- package/dist/themes/boomdevs.min.css +60 -8
- package/dist/themes/esrar.css +1500 -241
- package/dist/themes/esrar.min.css +6 -6
- package/dist/themes/mashroom.css +1496 -237
- package/dist/themes/mashroom.min.css +8 -8
- package/dist/themes/shaj-default.css +1451 -192
- 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/Footer/Footer.stories.tsx +388 -0
- package/src/components/Footer/Footer.tsx +197 -0
- package/src/components/Footer/FooterLink.tsx +72 -0
- package/src/components/Footer/FooterSection.tsx +87 -0
- package/src/components/Footer/FooterSocialLink.tsx +117 -0
- package/src/components/Footer/README.md +261 -0
- package/src/components/Footer/index.ts +13 -0
- 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/SectionIntro/SectionIntro.tsx +9 -11
- package/src/components/Slider/Slider.stories.tsx +634 -50
- package/src/components/Slider/Slider.tsx +5 -3
- 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 +14 -0
- package/src/layouts/Grid/Grid.stories.tsx +226 -159
- 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/useFooter.ts +85 -0
- package/src/lib/composables/useGlassContainer.ts +168 -0
- package/src/lib/composables/useSlider.ts +191 -4
- package/src/lib/constants/components.ts +173 -0
- package/src/lib/types/components.ts +622 -0
- package/src/lib/utils/displacement-generator.ts +86 -0
- package/src/styles/01-settings/_index.scss +1 -0
- package/src/styles/01-settings/_settings.accordion.scss +20 -19
- package/src/styles/01-settings/_settings.animations.scss +5 -5
- package/src/styles/01-settings/_settings.avatar-group.scss +1 -1
- package/src/styles/01-settings/_settings.avatar.scss +17 -18
- package/src/styles/01-settings/_settings.background.scss +10 -0
- package/src/styles/01-settings/_settings.badge.scss +1 -1
- package/src/styles/01-settings/_settings.breadcrumb.scss +8 -2
- package/src/styles/01-settings/_settings.callout.scss +7 -7
- package/src/styles/01-settings/_settings.card.scss +2 -2
- package/src/styles/01-settings/_settings.chart.scss +7 -7
- package/src/styles/01-settings/_settings.checkbox-group.scss +5 -2
- package/src/styles/01-settings/_settings.checkbox.scss +10 -4
- package/src/styles/01-settings/_settings.countdown.scss +6 -4
- package/src/styles/01-settings/_settings.dropdown.scss +9 -7
- package/src/styles/01-settings/_settings.edge-panel.scss +3 -2
- package/src/styles/01-settings/_settings.footer.scss +125 -0
- package/src/styles/01-settings/_settings.form-group.scss +3 -1
- package/src/styles/01-settings/_settings.form.scss +4 -2
- package/src/styles/01-settings/_settings.hero.scss +9 -7
- package/src/styles/01-settings/_settings.input.scss +9 -7
- package/src/styles/01-settings/_settings.list-group.scss +4 -2
- package/src/styles/01-settings/_settings.list.scss +4 -2
- package/src/styles/01-settings/_settings.menu.scss +10 -8
- package/src/styles/01-settings/_settings.messages.scss +19 -17
- package/src/styles/01-settings/_settings.modal.scss +6 -4
- package/src/styles/01-settings/_settings.nav.scss +6 -4
- package/src/styles/01-settings/_settings.navbar.scss +8 -5
- package/src/styles/01-settings/_settings.pagination.scss +5 -3
- package/src/styles/01-settings/_settings.popover.scss +6 -4
- package/src/styles/01-settings/_settings.rating.scss +5 -3
- package/src/styles/01-settings/_settings.river.scss +8 -6
- package/src/styles/01-settings/_settings.sectionintro.scss +8 -6
- package/src/styles/01-settings/_settings.select.scss +7 -5
- package/src/styles/01-settings/_settings.side-menu.scss +15 -13
- package/src/styles/01-settings/_settings.spacing.scss +4 -0
- package/src/styles/01-settings/_settings.steps.scss +7 -5
- package/src/styles/01-settings/_settings.tabs.scss +7 -5
- package/src/styles/01-settings/_settings.testimonials.scss +6 -4
- package/src/styles/01-settings/_settings.toggle.scss +3 -1
- package/src/styles/01-settings/_settings.tooltip.scss +5 -3
- package/src/styles/01-settings/_settings.upload.scss +22 -20
- package/src/styles/02-tools/_tools.animations.scss +19 -0
- package/src/styles/02-tools/_tools.background.scss +87 -0
- package/src/styles/02-tools/_tools.glass.scss +1 -0
- package/src/styles/02-tools/_tools.rem.scss +18 -5
- package/src/styles/02-tools/_tools.utility-api.scss +32 -26
- package/src/styles/03-generic/_generic.root.scss +15 -2
- package/src/styles/04-elements/_elements.body.scss +6 -0
- package/src/styles/06-components/_components.accordion.scss +24 -4
- package/src/styles/06-components/_components.atomix-glass.scss +0 -0
- package/src/styles/06-components/_components.avatar-group.scss +2 -1
- package/src/styles/06-components/_components.avatar.scss +2 -1
- package/src/styles/06-components/_components.badge.scss +36 -1
- package/src/styles/06-components/_components.breadcrumb.scss +2 -1
- package/src/styles/06-components/_components.button.scss +14 -3
- package/src/styles/06-components/_components.callout.scss +44 -4
- package/src/styles/06-components/_components.card.scss +21 -2
- package/src/styles/06-components/_components.chart.scss +3 -2
- package/src/styles/06-components/_components.checkbox.scss +2 -1
- package/src/styles/06-components/_components.color-mode-toggle.scss +3 -2
- package/src/styles/06-components/_components.countdown.scss +2 -1
- package/src/styles/06-components/_components.data-table.scss +7 -6
- package/src/styles/06-components/_components.datepicker.scss +20 -1
- package/src/styles/06-components/_components.dropdown.scss +11 -4
- package/src/styles/06-components/_components.edge-panel.scss +4 -3
- package/src/styles/06-components/_components.footer.scss +825 -0
- package/src/styles/06-components/_components.form-group.scss +1 -0
- package/src/styles/06-components/_components.hero.scss +4 -4
- package/src/styles/06-components/_components.image-gallery.scss +1 -0
- package/src/styles/06-components/_components.input.scss +33 -2
- package/src/styles/06-components/_components.list-group.scss +3 -2
- package/src/styles/06-components/_components.list.scss +2 -1
- package/src/styles/06-components/_components.menu.scss +5 -4
- package/src/styles/06-components/_components.messages.scss +8 -7
- package/src/styles/06-components/_components.modal.scss +3 -2
- package/src/styles/06-components/_components.nav.scss +6 -5
- package/src/styles/06-components/_components.navbar.scss +4 -3
- package/src/styles/06-components/_components.pagination.scss +2 -1
- package/src/styles/06-components/_components.photoviewer.scss +4 -3
- package/src/styles/06-components/_components.popover.scss +3 -2
- package/src/styles/06-components/_components.product-review.scss +3 -2
- package/src/styles/06-components/_components.progress.scss +3 -2
- package/src/styles/06-components/_components.river.scss +3 -2
- package/src/styles/06-components/_components.sectionintro.scss +2 -1
- package/src/styles/06-components/_components.select.scss +5 -4
- package/src/styles/06-components/_components.side-menu.scss +8 -7
- package/src/styles/06-components/_components.skeleton.scss +3 -2
- package/src/styles/06-components/_components.slider.scss +7 -6
- package/src/styles/06-components/_components.spinner.scss +1 -0
- package/src/styles/06-components/_components.steps.scss +3 -2
- package/src/styles/06-components/_components.tabs.scss +4 -3
- package/src/styles/06-components/_components.testimonials.scss +2 -1
- package/src/styles/06-components/_components.todo.scss +3 -2
- package/src/styles/06-components/_components.toggle.scss +5 -4
- package/src/styles/06-components/_components.tooltip.scss +3 -2
- package/src/styles/06-components/_components.upload.scss +4 -3
- package/src/styles/06-components/_components.video-player.scss +50 -27
- package/src/styles/06-components/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +48 -0
- package/dist/themes/yabai.css +0 -13711
- package/dist/themes/yabai.min.css +0 -189
|
@@ -52,6 +52,10 @@ const meta = {
|
|
|
52
52
|
control: 'boolean',
|
|
53
53
|
description: 'Whether the button should have a fully rounded (pill) shape',
|
|
54
54
|
},
|
|
55
|
+
glass: {
|
|
56
|
+
control: { type: 'boolean' },
|
|
57
|
+
description: 'Apply glass morphism effect to the button',
|
|
58
|
+
},
|
|
55
59
|
},
|
|
56
60
|
} satisfies Meta<typeof Button>;
|
|
57
61
|
|
|
@@ -310,3 +314,344 @@ export const RoundedVariants: Story = {
|
|
|
310
314
|
</div>
|
|
311
315
|
),
|
|
312
316
|
};
|
|
317
|
+
|
|
318
|
+
// Glass Effect Buttons
|
|
319
|
+
export const GlassEffect: Story = {
|
|
320
|
+
args: {
|
|
321
|
+
label: 'Glass Button',
|
|
322
|
+
variant: 'primary',
|
|
323
|
+
glass: true,
|
|
324
|
+
},
|
|
325
|
+
decorators: [
|
|
326
|
+
Story => (
|
|
327
|
+
<div
|
|
328
|
+
style={{
|
|
329
|
+
background: 'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
|
|
330
|
+
backgroundSize: 'cover',
|
|
331
|
+
backgroundPosition: 'center',
|
|
332
|
+
padding: '10rem 25rem',
|
|
333
|
+
borderRadius: '12px',
|
|
334
|
+
}}
|
|
335
|
+
>
|
|
336
|
+
<Story />
|
|
337
|
+
</div>
|
|
338
|
+
),
|
|
339
|
+
],
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export const GlassEffectCustomized: Story = {
|
|
343
|
+
args: {
|
|
344
|
+
label: 'Customized Glass',
|
|
345
|
+
variant: 'secondary',
|
|
346
|
+
glass: {
|
|
347
|
+
displacementScale: 60,
|
|
348
|
+
blurAmount: 2,
|
|
349
|
+
saturation: 180,
|
|
350
|
+
aberrationIntensity: 2,
|
|
351
|
+
cornerRadius: 12,
|
|
352
|
+
overLight: false,
|
|
353
|
+
mode: 'polar' as const,
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
decorators: [
|
|
357
|
+
Story => (
|
|
358
|
+
<div
|
|
359
|
+
style={{
|
|
360
|
+
background:
|
|
361
|
+
'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
|
|
362
|
+
backgroundSize: 'cover',
|
|
363
|
+
backgroundPosition: 'center',
|
|
364
|
+
padding: '25rem',
|
|
365
|
+
borderRadius: '12px',
|
|
366
|
+
}}
|
|
367
|
+
>
|
|
368
|
+
<Story />
|
|
369
|
+
</div>
|
|
370
|
+
),
|
|
371
|
+
],
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export const GlassVariants: Story = {
|
|
375
|
+
args: {
|
|
376
|
+
label: 'Glass Button',
|
|
377
|
+
variant: 'primary',
|
|
378
|
+
glass: true,
|
|
379
|
+
},
|
|
380
|
+
render: () => (
|
|
381
|
+
<div
|
|
382
|
+
style={{
|
|
383
|
+
background:
|
|
384
|
+
'url(https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg)',
|
|
385
|
+
backgroundSize: 'cover',
|
|
386
|
+
backgroundPosition: 'center',
|
|
387
|
+
padding: '25rem',
|
|
388
|
+
borderRadius: '12px',
|
|
389
|
+
}}
|
|
390
|
+
>
|
|
391
|
+
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
392
|
+
<Button label="Primary" variant="primary" glass />
|
|
393
|
+
<Button label="Secondary" variant="secondary" glass />
|
|
394
|
+
<Button label="Success" variant="success" glass />
|
|
395
|
+
<Button label="Info" variant="info" glass />
|
|
396
|
+
<Button label="Warning" variant="warning" glass />
|
|
397
|
+
<Button label="Error" variant="error" glass />
|
|
398
|
+
<Button label="Light" variant="light" glass />
|
|
399
|
+
<Button label="Dark" variant="dark" glass />
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
),
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const GlassOutlineVariants: Story = {
|
|
406
|
+
args: {
|
|
407
|
+
label: 'Glass Button',
|
|
408
|
+
variant: 'outline-primary',
|
|
409
|
+
glass: true,
|
|
410
|
+
},
|
|
411
|
+
render: () => (
|
|
412
|
+
<div
|
|
413
|
+
style={{
|
|
414
|
+
background:
|
|
415
|
+
'url(https://cdn.pixabay.com/photo/2018/08/15/13/10/new-year-background-3608029_1280.jpg)',
|
|
416
|
+
backgroundSize: 'cover',
|
|
417
|
+
backgroundPosition: 'center',
|
|
418
|
+
padding: '20rem 10rem',
|
|
419
|
+
borderRadius: '12px',
|
|
420
|
+
}}
|
|
421
|
+
>
|
|
422
|
+
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
423
|
+
<Button label="Outline Primary" variant="outline-primary" glass />
|
|
424
|
+
<Button label="Outline Secondary" variant="outline-secondary" glass />
|
|
425
|
+
<Button label="Outline Success" variant="outline-success" glass />
|
|
426
|
+
<Button label="Outline Info" variant="outline-info" glass />
|
|
427
|
+
<Button label="Outline Warning" variant="outline-warning" glass />
|
|
428
|
+
<Button label="Outline Error" variant="outline-error" glass />
|
|
429
|
+
<Button label="Outline Light" variant="outline-light" glass />
|
|
430
|
+
<Button label="Outline Dark" variant="outline-dark" glass />
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
),
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
export const GlassSizes: Story = {
|
|
437
|
+
args: {
|
|
438
|
+
label: 'Glass Button',
|
|
439
|
+
variant: 'primary',
|
|
440
|
+
glass: true,
|
|
441
|
+
},
|
|
442
|
+
render: () => (
|
|
443
|
+
<div
|
|
444
|
+
style={{
|
|
445
|
+
background:
|
|
446
|
+
'url(https://cdn.pixabay.com/photo/2020/12/15/01/43/street-5832394_1280.jpg)',
|
|
447
|
+
backgroundSize: 'cover',
|
|
448
|
+
backgroundPosition: 'center',
|
|
449
|
+
padding: '10rem 20rem',
|
|
450
|
+
borderRadius: '12px',
|
|
451
|
+
}}
|
|
452
|
+
>
|
|
453
|
+
<div className="u-d-flex u-align-items-center u-gap-2">
|
|
454
|
+
<Button label="Small Glass" variant="primary" size="sm" glass={{cornerRadius: 8}} />
|
|
455
|
+
<Button label="Medium Glass" variant="primary" size="md" glass />
|
|
456
|
+
<Button label="Large Glass" variant="primary" size="lg" glass />
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
),
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export const GlassWithIcons: Story = {
|
|
463
|
+
args: {
|
|
464
|
+
label: 'Glass Button',
|
|
465
|
+
variant: 'primary',
|
|
466
|
+
glass: true,
|
|
467
|
+
icon: <Icon />,
|
|
468
|
+
},
|
|
469
|
+
render: () => (
|
|
470
|
+
<div
|
|
471
|
+
style={{
|
|
472
|
+
background:
|
|
473
|
+
'url(https://cdn.pixabay.com/photo/2020/12/15/01/43/street-5832394_1280.jpg)',
|
|
474
|
+
backgroundSize: 'cover',
|
|
475
|
+
backgroundPosition: 'center',
|
|
476
|
+
padding: '25rem',
|
|
477
|
+
borderRadius: '12px',
|
|
478
|
+
}}
|
|
479
|
+
>
|
|
480
|
+
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
481
|
+
<Button label="With Icon" variant="primary" icon={<Icon />} glass={{cornerRadius: 12}} />
|
|
482
|
+
<Button label="Icon Only" variant="error" icon={<Icon />} iconOnly glass={{cornerRadius: 12}} />
|
|
483
|
+
<Button label="Rounded Glass" variant="success" icon={<Icon />} rounded glass={{cornerRadius: 24}} />
|
|
484
|
+
<Button label="Rounded Icon" variant="info" icon={<Icon />} iconOnly rounded glass={{cornerRadius: 50}} />
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
),
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export const GlassRounded: Story = {
|
|
491
|
+
args: {
|
|
492
|
+
label: 'Rounded Glass',
|
|
493
|
+
variant: 'primary',
|
|
494
|
+
glass: {
|
|
495
|
+
cornerRadius: 22,
|
|
496
|
+
},
|
|
497
|
+
rounded: true,
|
|
498
|
+
},
|
|
499
|
+
decorators: [
|
|
500
|
+
Story => (
|
|
501
|
+
<div
|
|
502
|
+
style={{
|
|
503
|
+
background:
|
|
504
|
+
'url(https://cdn.pixabay.com/photo/2020/12/15/01/43/street-5832394_1280.jpg)',
|
|
505
|
+
backgroundSize: 'cover',
|
|
506
|
+
backgroundPosition: 'center',
|
|
507
|
+
padding: '25rem',
|
|
508
|
+
borderRadius: '12px',
|
|
509
|
+
}}
|
|
510
|
+
>
|
|
511
|
+
<Story />
|
|
512
|
+
</div>
|
|
513
|
+
),
|
|
514
|
+
],
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
// Comprehensive Glass Showcase
|
|
518
|
+
export const GlassShowcase: Story = {
|
|
519
|
+
args: {
|
|
520
|
+
label: 'Glass Button',
|
|
521
|
+
variant: 'primary',
|
|
522
|
+
glass: true,
|
|
523
|
+
},
|
|
524
|
+
render: () => (
|
|
525
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}>
|
|
526
|
+
{/* Primary Glass Variants */}
|
|
527
|
+
<div
|
|
528
|
+
style={{
|
|
529
|
+
background:
|
|
530
|
+
'url(https://cdn.pixabay.com/photo/2021/11/13/08/50/athens-6790780_1280.jpg)',
|
|
531
|
+
backgroundSize: 'cover',
|
|
532
|
+
backgroundPosition: 'center',
|
|
533
|
+
padding: '2rem',
|
|
534
|
+
borderRadius: '12px',
|
|
535
|
+
}}
|
|
536
|
+
>
|
|
537
|
+
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
538
|
+
Primary Glass Variants
|
|
539
|
+
</h3>
|
|
540
|
+
<div className="u-d-flex u-flex-wrap u-gap-2 u-align-items-center">
|
|
541
|
+
<Button label="Small Glass" variant="primary" size="sm" glass={{cornerRadius: 8}} />
|
|
542
|
+
<Button label="Medium Glass" variant="primary" size="md" glass />
|
|
543
|
+
<Button label="Large Glass" variant="primary" size="lg" glass />
|
|
544
|
+
<Button label="With Icon" variant="primary" icon={<Icon />} glass />
|
|
545
|
+
<Button label="Icon Only" variant="primary" icon={<Icon />} iconOnly glass />
|
|
546
|
+
<Button label="Rounded" variant="primary" rounded glass={{cornerRadius: 24}} />
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
|
|
550
|
+
{/* Outline Glass Variants */}
|
|
551
|
+
<div
|
|
552
|
+
style={{
|
|
553
|
+
background:
|
|
554
|
+
'url(https://cdn.pixabay.com/photo/2025/09/18/23/32/pattern-9842070_1280.png)',
|
|
555
|
+
backgroundSize: 'cover',
|
|
556
|
+
backgroundPosition: 'center',
|
|
557
|
+
padding: '2rem',
|
|
558
|
+
borderRadius: '12px',
|
|
559
|
+
}}
|
|
560
|
+
>
|
|
561
|
+
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
562
|
+
Outline Glass Variants
|
|
563
|
+
</h3>
|
|
564
|
+
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
565
|
+
<Button label="Outline Primary" variant="outline-primary" glass />
|
|
566
|
+
<Button label="Outline Success" variant="outline-success" glass />
|
|
567
|
+
<Button label="Outline Warning" variant="outline-warning" glass />
|
|
568
|
+
<Button label="Outline Error" variant="outline-error" glass />
|
|
569
|
+
</div>
|
|
570
|
+
</div>
|
|
571
|
+
|
|
572
|
+
{/* Custom Glass Configuration */}
|
|
573
|
+
<div
|
|
574
|
+
style={{
|
|
575
|
+
background:
|
|
576
|
+
'url(https://cdn.pixabay.com/photo/2019/09/29/17/21/greece-4513857_1280.jpg)',
|
|
577
|
+
backgroundSize: 'cover',
|
|
578
|
+
backgroundPosition: 'center',
|
|
579
|
+
padding: '2rem',
|
|
580
|
+
borderRadius: '12px',
|
|
581
|
+
}}
|
|
582
|
+
>
|
|
583
|
+
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
584
|
+
Custom Glass Effects
|
|
585
|
+
</h3>
|
|
586
|
+
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
587
|
+
<Button
|
|
588
|
+
label="Polar Mode"
|
|
589
|
+
variant="secondary"
|
|
590
|
+
glass={{
|
|
591
|
+
displacementScale: 60,
|
|
592
|
+
blurAmount: 2,
|
|
593
|
+
saturation: 180,
|
|
594
|
+
aberrationIntensity: 2,
|
|
595
|
+
cornerRadius: 12,
|
|
596
|
+
mode: 'polar' as const,
|
|
597
|
+
}}
|
|
598
|
+
/>
|
|
599
|
+
<Button
|
|
600
|
+
label="Prominent Mode"
|
|
601
|
+
variant="info"
|
|
602
|
+
glass={{
|
|
603
|
+
displacementScale: 80,
|
|
604
|
+
blurAmount: 1,
|
|
605
|
+
saturation: 200,
|
|
606
|
+
aberrationIntensity: 3,
|
|
607
|
+
cornerRadius: 12,
|
|
608
|
+
mode: 'prominent' as const,
|
|
609
|
+
}}
|
|
610
|
+
/>
|
|
611
|
+
<Button
|
|
612
|
+
label="Shader Mode"
|
|
613
|
+
variant="success"
|
|
614
|
+
glass={{
|
|
615
|
+
displacementScale: 50,
|
|
616
|
+
blurAmount: 0,
|
|
617
|
+
saturation: 140,
|
|
618
|
+
aberrationIntensity: 1,
|
|
619
|
+
cornerRadius: 12,
|
|
620
|
+
mode: 'shader' as const,
|
|
621
|
+
}}
|
|
622
|
+
/>
|
|
623
|
+
</div>
|
|
624
|
+
</div>
|
|
625
|
+
|
|
626
|
+
{/* Light Background */}
|
|
627
|
+
<div
|
|
628
|
+
style={{
|
|
629
|
+
background:
|
|
630
|
+
'url(https://cdn.pixabay.com/photo/2019/09/29/17/21/greece-4513852_1280.jpg)',
|
|
631
|
+
backgroundSize: 'cover',
|
|
632
|
+
backgroundPosition: 'center',
|
|
633
|
+
padding: '2rem',
|
|
634
|
+
borderRadius: '12px',
|
|
635
|
+
}}
|
|
636
|
+
>
|
|
637
|
+
<h3 style={{ color: '#333', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
638
|
+
Light Background
|
|
639
|
+
</h3>
|
|
640
|
+
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
641
|
+
<Button label="Light Variant" variant="light" glass />
|
|
642
|
+
<Button label="Outline Light" variant="outline-light" glass />
|
|
643
|
+
<Button label="Dark on Light" variant="dark" glass />
|
|
644
|
+
<Button
|
|
645
|
+
label="Over Light"
|
|
646
|
+
variant="primary"
|
|
647
|
+
glass={{
|
|
648
|
+
overLight: true,
|
|
649
|
+
displacementScale: 45,
|
|
650
|
+
saturation: 120,
|
|
651
|
+
}}
|
|
652
|
+
/>
|
|
653
|
+
</div>
|
|
654
|
+
</div>
|
|
655
|
+
</div>
|
|
656
|
+
),
|
|
657
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ElementType, forwardRef } from 'react';
|
|
2
2
|
import { useButton } from '../../lib/composables/useButton';
|
|
3
3
|
import { ButtonProps } from '../../lib/types/components';
|
|
4
|
+
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
4
5
|
|
|
5
6
|
export type ButtonAsProp = {
|
|
6
7
|
as?: ElementType;
|
|
@@ -23,6 +24,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps & ButtonAsProp>(
|
|
|
23
24
|
rounded = false,
|
|
24
25
|
className = '',
|
|
25
26
|
as: Component = 'button',
|
|
27
|
+
glass,
|
|
26
28
|
...props
|
|
27
29
|
},
|
|
28
30
|
ref
|
|
@@ -32,6 +34,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps & ButtonAsProp>(
|
|
|
32
34
|
size,
|
|
33
35
|
disabled,
|
|
34
36
|
rounded,
|
|
37
|
+
glass,
|
|
35
38
|
});
|
|
36
39
|
|
|
37
40
|
const buttonClass = generateButtonClass({
|
|
@@ -40,9 +43,13 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps & ButtonAsProp>(
|
|
|
40
43
|
disabled,
|
|
41
44
|
rounded,
|
|
42
45
|
iconOnly,
|
|
46
|
+
glass,
|
|
43
47
|
className,
|
|
44
48
|
});
|
|
45
49
|
|
|
50
|
+
// Custom styles for glass effect
|
|
51
|
+
const glassStyles = glass ? {} : {};
|
|
52
|
+
|
|
46
53
|
// Handle the case when the button is rendered as a link or another component
|
|
47
54
|
const buttonProps = {
|
|
48
55
|
ref,
|
|
@@ -50,15 +57,40 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps & ButtonAsProp>(
|
|
|
50
57
|
onClick: handleClick(onClick),
|
|
51
58
|
disabled,
|
|
52
59
|
'aria-disabled': disabled,
|
|
60
|
+
style: glass ? glassStyles : undefined,
|
|
53
61
|
...props,
|
|
54
62
|
};
|
|
55
63
|
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
const buttonContent = (
|
|
65
|
+
<>
|
|
58
66
|
{icon && <span className="c-btn__icon">{icon}</span>}
|
|
59
67
|
{!iconOnly && <span className="c-btn__label">{label || children}</span>}
|
|
60
|
-
|
|
68
|
+
</>
|
|
61
69
|
);
|
|
70
|
+
|
|
71
|
+
if (glass) {
|
|
72
|
+
// Default glass settings for buttons
|
|
73
|
+
const defaultGlassProps = {
|
|
74
|
+
displacementScale: 80,
|
|
75
|
+
blurAmount: 1,
|
|
76
|
+
saturation: 200,
|
|
77
|
+
aberrationIntensity: 1,
|
|
78
|
+
cornerRadius: 12,
|
|
79
|
+
mode: 'shader' as const,
|
|
80
|
+
mouseContainer: ref,
|
|
81
|
+
onclick: ()=>{}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<AtomixGlass {...glassProps}>
|
|
88
|
+
<Component {...buttonProps}>{buttonContent}</Component>
|
|
89
|
+
</AtomixGlass>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return <Component {...buttonProps}>{buttonContent}</Component>;
|
|
62
94
|
}
|
|
63
95
|
);
|
|
64
96
|
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Button Component
|
|
2
|
+
|
|
3
|
+
A versatile button component that supports various styles, sizes, states, and a modern glass morphism effect.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Multiple variants (primary, secondary, success, info, warning, error, light, dark)
|
|
8
|
+
- Outline variants for all theme colors
|
|
9
|
+
- Three sizes (small, medium, large)
|
|
10
|
+
- Icon support with icon-only mode
|
|
11
|
+
- Rounded (pill) shape option
|
|
12
|
+
- Glass morphism effect
|
|
13
|
+
- Disabled state support
|
|
14
|
+
- Customizable as different HTML elements
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { Button } from '@shohojdhara/atomix';
|
|
20
|
+
|
|
21
|
+
// Basic button
|
|
22
|
+
<Button label="Click me" variant="primary" />
|
|
23
|
+
|
|
24
|
+
// Button with icon
|
|
25
|
+
<Button label="Save" variant="success" icon={<SaveIcon />} />
|
|
26
|
+
|
|
27
|
+
// Icon-only button
|
|
28
|
+
<Button label="Delete" variant="error" icon={<TrashIcon />} iconOnly />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Glass Morphism Effect
|
|
32
|
+
|
|
33
|
+
The Button component supports glass morphism effects through the `glass` prop, which creates a modern, translucent appearance perfect for overlaying on backgrounds.
|
|
34
|
+
|
|
35
|
+
### Basic Glass Effect
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
const GlassExample = () => (
|
|
39
|
+
<div style={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', padding: '2rem' }}>
|
|
40
|
+
<Button
|
|
41
|
+
label="Glass Button"
|
|
42
|
+
variant="primary"
|
|
43
|
+
glass={true}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Custom Glass Configuration
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
const CustomGlassExample = () => (
|
|
53
|
+
<div style={{ background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)', padding: '2rem' }}>
|
|
54
|
+
<Button
|
|
55
|
+
label="Customized Glass"
|
|
56
|
+
variant="secondary"
|
|
57
|
+
glass={{
|
|
58
|
+
displacementScale: 60,
|
|
59
|
+
blurAmount: 2,
|
|
60
|
+
saturation: 180,
|
|
61
|
+
aberrationIntensity: 2,
|
|
62
|
+
cornerRadius: 16,
|
|
63
|
+
overLight: false,
|
|
64
|
+
mode: 'polar'
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Glass with Different Variants
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
const GlassVariantsExample = () => (
|
|
75
|
+
<div style={{ background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)', padding: '2rem' }}>
|
|
76
|
+
<Button label="Primary Glass" variant="primary" glass />
|
|
77
|
+
<Button label="Outline Glass" variant="outline-primary" glass />
|
|
78
|
+
<Button label="Glass with Icon" variant="success" icon={<Icon />} glass />
|
|
79
|
+
<Button label="Rounded Glass" variant="info" rounded glass />
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Props
|
|
85
|
+
|
|
86
|
+
| Prop | Type | Default | Description |
|
|
87
|
+
|------|------|---------|-------------|
|
|
88
|
+
| `label` | `string` | - | Button text content |
|
|
89
|
+
| `children` | `ReactNode` | - | Alternative to label for complex content |
|
|
90
|
+
| `variant` | `Variant` | `'primary'` | Button visual style |
|
|
91
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
92
|
+
| `disabled` | `boolean` | `false` | Whether button is disabled |
|
|
93
|
+
| `icon` | `ReactNode` | - | Icon element to display |
|
|
94
|
+
| `iconOnly` | `boolean` | `false` | Show only icon, hide label |
|
|
95
|
+
| `rounded` | `boolean` | `false` | Make button fully rounded (pill shape) |
|
|
96
|
+
| `onClick` | `() => void` | - | Click event handler |
|
|
97
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
98
|
+
| `as` | `ElementType` | `'button'` | HTML element or component to render as |
|
|
99
|
+
| `glass` | `boolean \| AtomixGlassProps` | `false` | Glass morphism effect |
|
|
100
|
+
|
|
101
|
+
### Glass Props
|
|
102
|
+
|
|
103
|
+
When `glass` is an object, it accepts the same props as the `AtomixGlass` component:
|
|
104
|
+
|
|
105
|
+
| Prop | Type | Default | Description |
|
|
106
|
+
|------|------|---------|-------------|
|
|
107
|
+
| `displacementScale` | `number` | `40` | Displacement scale for the glass effect |
|
|
108
|
+
| `blurAmount` | `number` | `0` | Blur amount for the backdrop |
|
|
109
|
+
| `saturation` | `number` | `160` | Saturation percentage for the backdrop |
|
|
110
|
+
| `aberrationIntensity` | `number` | `1` | Chromatic aberration intensity |
|
|
111
|
+
| `cornerRadius` | `number` | `8` | Corner radius in pixels |
|
|
112
|
+
| `overLight` | `boolean` | `false` | Whether the glass is over a light background |
|
|
113
|
+
| `mode` | `'standard' \| 'polar' \| 'prominent' \| 'shader'` | `'standard'` | Glass effect mode |
|
|
114
|
+
|
|
115
|
+
## Variants
|
|
116
|
+
|
|
117
|
+
### Standard Variants
|
|
118
|
+
- `primary` - Main call-to-action buttons
|
|
119
|
+
- `secondary` - Secondary actions
|
|
120
|
+
- `success` - Positive actions (save, confirm)
|
|
121
|
+
- `info` - Informational actions
|
|
122
|
+
- `warning` - Caution actions
|
|
123
|
+
- `error` - Destructive actions (delete, cancel)
|
|
124
|
+
- `light` - Light theme variant
|
|
125
|
+
- `dark` - Dark theme variant
|
|
126
|
+
|
|
127
|
+
### Outline Variants
|
|
128
|
+
- `outline-primary`
|
|
129
|
+
- `outline-secondary`
|
|
130
|
+
- `outline-success`
|
|
131
|
+
- `outline-info`
|
|
132
|
+
- `outline-warning`
|
|
133
|
+
- `outline-error`
|
|
134
|
+
- `outline-light`
|
|
135
|
+
- `outline-dark`
|
|
136
|
+
|
|
137
|
+
### Special Variants
|
|
138
|
+
- `link` - Styled as an underlined link
|
|
139
|
+
|
|
140
|
+
## Sizes
|
|
141
|
+
|
|
142
|
+
- `sm` - Small button (compact spacing)
|
|
143
|
+
- `md` - Medium button (default size)
|
|
144
|
+
- `lg` - Large button (generous spacing)
|
|
145
|
+
|
|
146
|
+
## Advanced Usage
|
|
147
|
+
|
|
148
|
+
### As Different Elements
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
// Render as link
|
|
152
|
+
<Button
|
|
153
|
+
as="a"
|
|
154
|
+
href="/dashboard"
|
|
155
|
+
label="Go to Dashboard"
|
|
156
|
+
variant="primary"
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
// Render as custom component (e.g., React Router Link)
|
|
160
|
+
<Button
|
|
161
|
+
as={Link}
|
|
162
|
+
to="/profile"
|
|
163
|
+
label="View Profile"
|
|
164
|
+
variant="secondary"
|
|
165
|
+
/>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Complex Content
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
<Button variant="primary" glass>
|
|
172
|
+
<span>Custom Content</span>
|
|
173
|
+
<BadgeIcon />
|
|
174
|
+
</Button>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Best Practices
|
|
178
|
+
|
|
179
|
+
### Glass Effect Usage
|
|
180
|
+
1. **Use with backgrounds**: Glass effect works best when placed over background images or colorful backgrounds
|
|
181
|
+
2. **Consider contrast**: Ensure text remains readable over the background
|
|
182
|
+
3. **Performance**: Use glass effect sparingly on pages with many interactive elements
|
|
183
|
+
4. **Accessibility**: Test with screen readers and keyboard navigation
|
|
184
|
+
|
|
185
|
+
### General Usage
|
|
186
|
+
1. Use `primary` variant for main actions
|
|
187
|
+
2. Use `outline` variants when you need a subtler appearance
|
|
188
|
+
3. Consider using `iconOnly` buttons for repetitive actions in toolbars
|
|
189
|
+
4. Use `rounded` variant for modern, friendly interfaces
|
|
190
|
+
5. Always provide meaningful `label` text for accessibility, even with `iconOnly` buttons
|
|
191
|
+
|
|
192
|
+
## Accessibility
|
|
193
|
+
|
|
194
|
+
- Buttons include proper ARIA attributes
|
|
195
|
+
- Disabled state is communicated to screen readers
|
|
196
|
+
- Icon-only buttons should have descriptive labels
|
|
197
|
+
- Keyboard navigation is fully supported
|
|
198
|
+
- Glass effects don't interfere with accessibility features
|
|
199
|
+
|
|
200
|
+
## Styling
|
|
201
|
+
|
|
202
|
+
The Button component uses CSS custom properties for theming:
|
|
203
|
+
|
|
204
|
+
```css
|
|
205
|
+
.c-btn {
|
|
206
|
+
--atomix-btn-padding-x: /* horizontal padding */
|
|
207
|
+
--atomix-btn-padding-y: /* vertical padding */
|
|
208
|
+
--atomix-btn-font-size: /* font size */
|
|
209
|
+
--atomix-btn-color: /* text color */
|
|
210
|
+
--atomix-btn-bg: /* background color */
|
|
211
|
+
--atomix-btn-border-color: /* border color */
|
|
212
|
+
--atomix-btn-border-radius: /* corner radius */
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Glass buttons automatically adjust these properties for optimal appearance with the glass effect.
|