@shohojdhara/atomix 0.3.2 → 0.3.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 +39 -20
- package/dist/atomix.css +83 -115
- package/dist/atomix.min.css +3 -3
- package/dist/index.d.ts +7049 -7284
- package/dist/index.esm.js +3529 -4674
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3208 -4315
- 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/applemix.css +16576 -0
- package/dist/themes/applemix.css.map +1 -0
- package/dist/themes/applemix.min.css +73 -0
- package/dist/themes/boomdevs.css +16007 -0
- package/dist/themes/boomdevs.css.map +1 -0
- package/dist/themes/boomdevs.min.css +406 -0
- package/dist/themes/esrar.css +18424 -0
- package/dist/themes/esrar.css.map +1 -0
- package/dist/themes/esrar.min.css +221 -0
- package/dist/themes/flashtrade.css +17596 -0
- package/dist/themes/flashtrade.css.map +1 -0
- package/dist/themes/flashtrade.min.css +196 -0
- package/dist/themes/mashroom.css +31082 -0
- package/dist/themes/mashroom.css.map +1 -0
- package/dist/themes/mashroom.min.css +450 -0
- package/dist/themes/shaj-default.css +17200 -0
- package/dist/themes/shaj-default.css.map +1 -0
- package/dist/themes/shaj-default.min.css +502 -0
- package/package.json +96 -17
- package/scripts/atomix-cli.js +1428 -0
- package/scripts/build-themes.js +208 -0
- package/scripts/cli/interactive-init.js +528 -0
- package/scripts/cli/migration-tools.js +603 -0
- package/scripts/cli/token-manager.js +519 -0
- package/scripts/sync-theme-config.js +309 -0
- package/src/components/List/ListGroup.tsx +1 -2
- package/src/components/Popover/Popover.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +49 -12
- package/src/components/Tooltip/Tooltip.tsx +32 -58
- package/src/lib/composables/useTooltip.ts +285 -0
- package/src/lib/constants/cssVariables.ts +390 -0
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +151 -0
- package/src/lib/hooks/index.ts +19 -0
- package/src/lib/hooks/useComponentCustomization.ts +175 -0
- package/src/lib/index.ts +13 -1
- package/src/lib/patterns/__tests__/slots.test.ts +108 -0
- package/src/lib/patterns/index.ts +35 -0
- package/src/lib/patterns/slots.tsx +421 -0
- package/src/lib/theme/__tests__/ThemeBuilder.test.ts +223 -0
- package/src/lib/theme/builders/ThemeBuilder.ts +372 -0
- package/src/lib/theme/createTheme.ts +2 -134
- package/src/lib/theme/cssVariableMapper.ts +261 -0
- package/src/lib/theme/index.ts +33 -250
- package/src/lib/theme/runtime/ThemeApplicator.ts +252 -0
- package/src/lib/theme/themeUtils.ts +27 -5
- package/src/lib/theme/types.ts +59 -0
- package/src/lib/theme-tools.ts +185 -0
- package/src/lib/types/components.ts +194 -0
- package/src/lib/types/partProps.ts +426 -0
- package/src/lib/utils/__tests__/componentUtils.test.ts +144 -0
- package/src/lib/utils/componentUtils.ts +163 -0
- package/src/lib/utils/index.ts +17 -57
- package/src/styles/01-settings/_settings.colors.scss +10 -10
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/06-components/_components.tooltip.scss +31 -81
- package/src/themes/README.md +443 -0
- package/src/themes/THEME_CHECKLIST.md +74 -0
- package/src/themes/applemix/01-settings/_index.scss +24 -0
- package/src/themes/applemix/01-settings/_settings.animations.scss +0 -0
- package/src/themes/applemix/01-settings/_settings.background.scss +6 -0
- package/src/themes/applemix/01-settings/_settings.colors.scss +75 -0
- package/src/themes/applemix/01-settings/_settings.config.scss +15 -0
- package/src/themes/applemix/01-settings/_settings.typography.scss +30 -0
- package/src/themes/applemix/02-tools/_index.scss +4 -0
- package/src/themes/applemix/03-generic/_index.scss +7 -0
- package/src/themes/applemix/04-elements/_index.scss +7 -0
- package/src/themes/applemix/05-objects/_index.scss +7 -0
- package/src/themes/applemix/06-components/_index.scss +15 -0
- package/src/themes/applemix/99-utilities/_index.scss +7 -0
- package/src/themes/applemix/README.md +378 -0
- package/src/themes/applemix/index.scss +33 -0
- package/src/themes/boomdevs/01-settings/_index.scss +38 -0
- package/src/themes/boomdevs/01-settings/_settings.accordion.scss +12 -0
- package/src/themes/boomdevs/01-settings/_settings.animations.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.avatar.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.badge.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.border-radius.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.border.scss +10 -0
- package/src/themes/boomdevs/01-settings/_settings.box-shadow.scss +14 -0
- package/src/themes/boomdevs/01-settings/_settings.breadcrumb.scss +13 -0
- package/src/themes/boomdevs/01-settings/_settings.breakpoints.scss +15 -0
- package/src/themes/boomdevs/01-settings/_settings.button.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.callout.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.card.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.checkbox.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.colors.scss +145 -0
- package/src/themes/boomdevs/01-settings/_settings.dropdown.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.grid.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.input.scss +14 -0
- package/src/themes/boomdevs/01-settings/_settings.link.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.list.scss +10 -0
- package/src/themes/boomdevs/01-settings/_settings.modal.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.navbar.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.pagination.scss +13 -0
- package/src/themes/boomdevs/01-settings/_settings.progress.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.rating.scss +10 -0
- package/src/themes/boomdevs/01-settings/_settings.spacing.scss +33 -0
- package/src/themes/boomdevs/01-settings/_settings.spinner.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.steps.scss +12 -0
- package/src/themes/boomdevs/01-settings/_settings.tabs.scss +12 -0
- package/src/themes/boomdevs/01-settings/_settings.todo.scss +15 -0
- package/src/themes/boomdevs/01-settings/_settings.toggle.scss +14 -0
- package/src/themes/boomdevs/01-settings/_settings.tooltip.scss +13 -0
- package/src/themes/boomdevs/01-settings/_settings.typography.scss +58 -0
- package/src/themes/boomdevs/01-settings/_settings.video-player.scss +12 -0
- package/src/themes/boomdevs/02-tools/_index.scss +7 -0
- package/src/themes/boomdevs/03-generic/_index.scss +7 -0
- package/src/themes/boomdevs/04-elements/_index.scss +7 -0
- package/src/themes/boomdevs/05-objects/_index.scss +7 -0
- package/src/themes/boomdevs/06-components/_components.button.scss +11 -0
- package/src/themes/boomdevs/06-components/_index.scss +11 -0
- package/src/themes/boomdevs/99-utilities/_index.scss +7 -0
- package/src/themes/boomdevs/index.scss +26 -0
- package/src/themes/esrar/01-settings/_index.scss +15 -0
- package/src/themes/esrar/01-settings/_settings.colors.scss +91 -0
- package/src/themes/esrar/02-tools/_index.scss +8 -0
- package/src/themes/esrar/02-tools/_tools.animations.scss +342 -0
- package/src/themes/esrar/06-components/_components.accordion.scss +49 -0
- package/src/themes/esrar/06-components/_components.avatar-group.scss +14 -0
- package/src/themes/esrar/06-components/_components.avatar.scss +61 -0
- package/src/themes/esrar/06-components/_components.badge.scss +117 -0
- package/src/themes/esrar/06-components/_components.breadcrumb.scss +65 -0
- package/src/themes/esrar/06-components/_components.btn-group.scss +19 -0
- package/src/themes/esrar/06-components/_components.button.scss +224 -0
- package/src/themes/esrar/06-components/_components.callout.scss +51 -0
- package/src/themes/esrar/06-components/_components.card.scss +134 -0
- package/src/themes/esrar/06-components/_components.chart.scss +24 -0
- package/src/themes/esrar/06-components/_components.checkbox-group.scss +26 -0
- package/src/themes/esrar/06-components/_components.checkbox.scss +71 -0
- package/src/themes/esrar/06-components/_components.color-mode-toggle.scss +29 -0
- package/src/themes/esrar/06-components/_components.countdown.scss +67 -0
- package/src/themes/esrar/06-components/_components.data-table.scss +22 -0
- package/src/themes/esrar/06-components/_components.datepicker.scss +20 -0
- package/src/themes/esrar/06-components/_components.dropdown.scss +272 -0
- package/src/themes/esrar/06-components/_components.edge-panel.scss +10 -0
- package/src/themes/esrar/06-components/_components.form-group.scss +15 -0
- package/src/themes/esrar/06-components/_components.form.scss +66 -0
- package/src/themes/esrar/06-components/_components.hero.scss +251 -0
- package/src/themes/esrar/06-components/_components.icon.scss +33 -0
- package/src/themes/esrar/06-components/_components.image-gallery.scss +29 -0
- package/src/themes/esrar/06-components/_components.input.scss +91 -0
- package/src/themes/esrar/06-components/_components.list-group.scss +26 -0
- package/src/themes/esrar/06-components/_components.modal.scss +148 -0
- package/src/themes/esrar/06-components/_components.notification.scss +80 -0
- package/src/themes/esrar/06-components/_components.pagination.scss +84 -0
- package/src/themes/esrar/06-components/_components.popover.scss +10 -0
- package/src/themes/esrar/06-components/_components.progress.scss +64 -0
- package/src/themes/esrar/06-components/_components.rating.scss +26 -0
- package/src/themes/esrar/06-components/_components.skeleton.scss +15 -0
- package/src/themes/esrar/06-components/_components.slider.scss +90 -0
- package/src/themes/esrar/06-components/_components.spinner.scss +71 -0
- package/src/themes/esrar/06-components/_components.steps.scss +76 -0
- package/src/themes/esrar/06-components/_components.tab.scss +58 -0
- package/src/themes/esrar/06-components/_components.tag.scss +21 -0
- package/src/themes/esrar/06-components/_components.timeline.scss +19 -0
- package/src/themes/esrar/06-components/_components.toast.scss +91 -0
- package/src/themes/esrar/06-components/_components.toggle.scss +74 -0
- package/src/themes/esrar/06-components/_components.tooltip.scss +45 -0
- package/src/themes/esrar/06-components/_components.upload.scss +102 -0
- package/src/themes/esrar/06-components/_index.scss +42 -0
- package/src/themes/esrar/index.scss +30 -0
- package/src/themes/flashtrade/01-settings/_index.scss +19 -0
- package/src/themes/flashtrade/01-settings/_settings.animations.scss +11 -0
- package/src/themes/flashtrade/01-settings/_settings.background.scss +9 -0
- package/src/themes/flashtrade/01-settings/_settings.colors.scss +79 -0
- package/src/themes/flashtrade/01-settings/_settings.config.scss +16 -0
- package/src/themes/flashtrade/01-settings/_settings.typography.scss +35 -0
- package/src/themes/flashtrade/02-tools/_index.scss +8 -0
- package/src/themes/flashtrade/03-generic/_index.scss +8 -0
- package/src/themes/flashtrade/04-elements/_index.scss +12 -0
- package/src/themes/flashtrade/05-objects/_index.scss +8 -0
- package/src/themes/flashtrade/06-components/_components.badge.scss +156 -0
- package/src/themes/flashtrade/06-components/_components.button.scss +135 -0
- package/src/themes/flashtrade/06-components/_components.card.scss +214 -0
- package/src/themes/flashtrade/06-components/_components.navbar.scss +227 -0
- package/src/themes/flashtrade/06-components/_index.scss +13 -0
- package/src/themes/flashtrade/99-utilities/_index.scss +9 -0
- package/src/themes/flashtrade/99-utilities/_utilities.trading.scss +187 -0
- package/src/themes/flashtrade/README.md +386 -0
- package/src/themes/flashtrade/demo.html +272 -0
- package/src/themes/flashtrade/index.scss +36 -0
- package/src/themes/mashroom/01-settings/_index.scss +69 -0
- package/src/themes/mashroom/01-settings/_settings.accordion.scss +32 -0
- package/src/themes/mashroom/01-settings/_settings.animations.scss +26 -0
- package/src/themes/mashroom/01-settings/_settings.avatar-group.scss +22 -0
- package/src/themes/mashroom/01-settings/_settings.avatar.scss +57 -0
- package/src/themes/mashroom/01-settings/_settings.badge.scss +19 -0
- package/src/themes/mashroom/01-settings/_settings.border-radius.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.border.scss +14 -0
- package/src/themes/mashroom/01-settings/_settings.box-shadow.scss +40 -0
- package/src/themes/mashroom/01-settings/_settings.breadcrumb.scss +0 -0
- package/src/themes/mashroom/01-settings/_settings.breakpoints.scss +17 -0
- package/src/themes/mashroom/01-settings/_settings.btn-group.scss +5 -0
- package/src/themes/mashroom/01-settings/_settings.button.scss +50 -0
- package/src/themes/mashroom/01-settings/_settings.callout.scss +81 -0
- package/src/themes/mashroom/01-settings/_settings.card.scss +52 -0
- package/src/themes/mashroom/01-settings/_settings.checkbox-group.scss +5 -0
- package/src/themes/mashroom/01-settings/_settings.checkbox.scss +23 -0
- package/src/themes/mashroom/01-settings/_settings.color-mode.scss +7 -0
- package/src/themes/mashroom/01-settings/_settings.colors.scss +180 -0
- package/src/themes/mashroom/01-settings/_settings.config.scss +4 -0
- package/src/themes/mashroom/01-settings/_settings.countdown.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.data-table.scss +56 -0
- package/src/themes/mashroom/01-settings/_settings.datepicker.scss +45 -0
- package/src/themes/mashroom/01-settings/_settings.design-tokens.scss +3 -0
- package/src/themes/mashroom/01-settings/_settings.dropdown.scss +45 -0
- package/src/themes/mashroom/01-settings/_settings.edge-panel.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.fonts.scss +8 -0
- package/src/themes/mashroom/01-settings/_settings.form-group.scss +14 -0
- package/src/themes/mashroom/01-settings/_settings.form.scss +6 -0
- package/src/themes/mashroom/01-settings/_settings.grid.scss +23 -0
- package/src/themes/mashroom/01-settings/_settings.hero.scss +41 -0
- package/src/themes/mashroom/01-settings/_settings.input.scss +51 -0
- package/src/themes/mashroom/01-settings/_settings.link.scss +13 -0
- package/src/themes/mashroom/01-settings/_settings.list-group.scss +16 -0
- package/src/themes/mashroom/01-settings/_settings.list.scss +13 -0
- package/src/themes/mashroom/01-settings/_settings.masonry-grid.scss +23 -0
- package/src/themes/mashroom/01-settings/_settings.menu.scss +50 -0
- package/src/themes/mashroom/01-settings/_settings.messages.scss +98 -0
- package/src/themes/mashroom/01-settings/_settings.modal.scss +41 -0
- package/src/themes/mashroom/01-settings/_settings.nav.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.navbar.scss +54 -0
- package/src/themes/mashroom/01-settings/_settings.pagination.scss +30 -0
- package/src/themes/mashroom/01-settings/_settings.photoviewer.scss +45 -0
- package/src/themes/mashroom/01-settings/_settings.popover.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.position.scss +9 -0
- package/src/themes/mashroom/01-settings/_settings.progress.scss +17 -0
- package/src/themes/mashroom/01-settings/_settings.rating.scss +11 -0
- package/src/themes/mashroom/01-settings/_settings.river.scss +50 -0
- package/src/themes/mashroom/01-settings/_settings.sectionintro.scss +31 -0
- package/src/themes/mashroom/01-settings/_settings.select.scss +47 -0
- package/src/themes/mashroom/01-settings/_settings.side-menu.scss +79 -0
- package/src/themes/mashroom/01-settings/_settings.skeleton.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.spacing.scss +66 -0
- package/src/themes/mashroom/01-settings/_settings.spinner.scss +34 -0
- package/src/themes/mashroom/01-settings/_settings.steps.scss +33 -0
- package/src/themes/mashroom/01-settings/_settings.tabs.scss +33 -0
- package/src/themes/mashroom/01-settings/_settings.testimonials.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.todo.scss +52 -0
- package/src/themes/mashroom/01-settings/_settings.toggle.scss +49 -0
- package/src/themes/mashroom/01-settings/_settings.tooltip.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.typography.scss +95 -0
- package/src/themes/mashroom/01-settings/_settings.upload.scss +96 -0
- package/src/themes/mashroom/01-settings/_settings.z-layers.scss +19 -0
- package/src/themes/mashroom/02-tools/_index.scss +8 -0
- package/src/themes/mashroom/02-tools/_tools.psychedelic-gradients.scss +78 -0
- package/src/themes/mashroom/02-tools/_tools.trippy-effects.scss +114 -0
- package/src/themes/mashroom/03-generic/_index.scss +6 -0
- package/src/themes/mashroom/04-elements/_index.scss +6 -0
- package/src/themes/mashroom/05-objects/_index.scss +6 -0
- package/src/themes/mashroom/06-components/_components.accordion.scss +187 -0
- package/src/themes/mashroom/06-components/_components.avatar-group.scss +276 -0
- package/src/themes/mashroom/06-components/_components.avatar.scss +114 -0
- package/src/themes/mashroom/06-components/_components.badge.scss +152 -0
- package/src/themes/mashroom/06-components/_components.breadcrumb.scss +162 -0
- package/src/themes/mashroom/06-components/_components.btn-group.scss +404 -0
- package/src/themes/mashroom/06-components/_components.button.scss +160 -0
- package/src/themes/mashroom/06-components/_components.callout.scss +140 -0
- package/src/themes/mashroom/06-components/_components.card.scss +225 -0
- package/src/themes/mashroom/06-components/_components.checkbox.scss +186 -0
- package/src/themes/mashroom/06-components/_components.color-mode-toggle.scss +308 -0
- package/src/themes/mashroom/06-components/_components.countdown.scss +402 -0
- package/src/themes/mashroom/06-components/_components.data-table.scss +354 -0
- package/src/themes/mashroom/06-components/_components.datepicker.scss +349 -0
- package/src/themes/mashroom/06-components/_components.dropdown.scss +334 -0
- package/src/themes/mashroom/06-components/_components.edge-panel.scss +413 -0
- package/src/themes/mashroom/06-components/_components.form-group.scss +433 -0
- package/src/themes/mashroom/06-components/_components.form.scss +358 -0
- package/src/themes/mashroom/06-components/_components.hero.scss +151 -0
- package/src/themes/mashroom/06-components/_components.input.scss +147 -0
- package/src/themes/mashroom/06-components/_components.list-group.scss +456 -0
- package/src/themes/mashroom/06-components/_components.list.scss +145 -0
- package/src/themes/mashroom/06-components/_components.menu.scss +497 -0
- package/src/themes/mashroom/06-components/_components.messages.scss +277 -0
- package/src/themes/mashroom/06-components/_components.modal.scss +264 -0
- package/src/themes/mashroom/06-components/_components.nav.scss +181 -0
- package/src/themes/mashroom/06-components/_components.navbar.scss +538 -0
- package/src/themes/mashroom/06-components/_components.pagination.scss +400 -0
- package/src/themes/mashroom/06-components/_components.photoviewer.scss +498 -0
- package/src/themes/mashroom/06-components/_components.popover.scss +383 -0
- package/src/themes/mashroom/06-components/_components.product-review.scss +408 -0
- package/src/themes/mashroom/06-components/_components.progress.scss +249 -0
- package/src/themes/mashroom/06-components/_components.rating.scss +300 -0
- package/src/themes/mashroom/06-components/_components.river.scss +570 -0
- package/src/themes/mashroom/06-components/_components.sectionintro.scss +546 -0
- package/src/themes/mashroom/06-components/_components.select.scss +455 -0
- package/src/themes/mashroom/06-components/_components.side-menu.scss +635 -0
- package/src/themes/mashroom/06-components/_components.skeleton.scss +447 -0
- package/src/themes/mashroom/06-components/_components.slider.scss +414 -0
- package/src/themes/mashroom/06-components/_components.spinner.scss +198 -0
- package/src/themes/mashroom/06-components/_components.steps.scss +350 -0
- package/src/themes/mashroom/06-components/_components.tabs.scss +269 -0
- package/src/themes/mashroom/06-components/_components.testimonials.scss +561 -0
- package/src/themes/mashroom/06-components/_components.toggle.scss +231 -0
- package/src/themes/mashroom/06-components/_components.tooltip.scss +167 -0
- package/src/themes/mashroom/06-components/_components.upload.scss +537 -0
- package/src/themes/mashroom/06-components/_components.video-player.scss +560 -0
- package/src/themes/mashroom/06-components/_index.scss +55 -0
- package/src/themes/mashroom/99-utilities/_index.scss +6 -0
- package/src/themes/mashroom/index.scss +26 -0
- package/src/themes/shaj-default/01-settings/_index.scss +69 -0
- package/src/themes/shaj-default/01-settings/_settings.accordion.scss +38 -0
- package/src/themes/shaj-default/01-settings/_settings.animations.scss +32 -0
- package/src/themes/shaj-default/01-settings/_settings.avatar-group.scss +28 -0
- package/src/themes/shaj-default/01-settings/_settings.avatar.scss +63 -0
- package/src/themes/shaj-default/01-settings/_settings.badge.scss +25 -0
- package/src/themes/shaj-default/01-settings/_settings.border-radius.scss +24 -0
- package/src/themes/shaj-default/01-settings/_settings.border.scss +20 -0
- package/src/themes/shaj-default/01-settings/_settings.box-shadow.scss +46 -0
- package/src/themes/shaj-default/01-settings/_settings.breadcrumb.scss +0 -0
- package/src/themes/shaj-default/01-settings/_settings.breakpoints.scss +23 -0
- package/src/themes/shaj-default/01-settings/_settings.btn-group.scss +11 -0
- package/src/themes/shaj-default/01-settings/_settings.button.scss +56 -0
- package/src/themes/shaj-default/01-settings/_settings.callout.scss +87 -0
- package/src/themes/shaj-default/01-settings/_settings.card.scss +52 -0
- package/src/themes/shaj-default/01-settings/_settings.checkbox-group.scss +11 -0
- package/src/themes/shaj-default/01-settings/_settings.checkbox.scss +29 -0
- package/src/themes/shaj-default/01-settings/_settings.color-mode.scss +13 -0
- package/src/themes/shaj-default/01-settings/_settings.colors.scss +91 -0
- package/src/themes/shaj-default/01-settings/_settings.config.scss +4 -0
- package/src/themes/shaj-default/01-settings/_settings.countdown.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.data-table.scss +62 -0
- package/src/themes/shaj-default/01-settings/_settings.datepicker.scss +51 -0
- package/src/themes/shaj-default/01-settings/_settings.design-tokens.scss +9 -0
- package/src/themes/shaj-default/01-settings/_settings.dropdown.scss +51 -0
- package/src/themes/shaj-default/01-settings/_settings.edge-panel.scss +30 -0
- package/src/themes/shaj-default/01-settings/_settings.fonts.scss +13 -0
- package/src/themes/shaj-default/01-settings/_settings.form-group.scss +20 -0
- package/src/themes/shaj-default/01-settings/_settings.form.scss +12 -0
- package/src/themes/shaj-default/01-settings/_settings.grid.scss +29 -0
- package/src/themes/shaj-default/01-settings/_settings.hero.scss +47 -0
- package/src/themes/shaj-default/01-settings/_settings.input.scss +57 -0
- package/src/themes/shaj-default/01-settings/_settings.link.scss +19 -0
- package/src/themes/shaj-default/01-settings/_settings.list-group.scss +22 -0
- package/src/themes/shaj-default/01-settings/_settings.list.scss +19 -0
- package/src/themes/shaj-default/01-settings/_settings.masonry-grid.scss +29 -0
- package/src/themes/shaj-default/01-settings/_settings.menu.scss +56 -0
- package/src/themes/shaj-default/01-settings/_settings.messages.scss +104 -0
- package/src/themes/shaj-default/01-settings/_settings.modal.scss +47 -0
- package/src/themes/shaj-default/01-settings/_settings.nav.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.navbar.scss +60 -0
- package/src/themes/shaj-default/01-settings/_settings.pagination.scss +36 -0
- package/src/themes/shaj-default/01-settings/_settings.photoviewer.scss +51 -0
- package/src/themes/shaj-default/01-settings/_settings.popover.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.position.scss +15 -0
- package/src/themes/shaj-default/01-settings/_settings.progress.scss +23 -0
- package/src/themes/shaj-default/01-settings/_settings.rating.scss +17 -0
- package/src/themes/shaj-default/01-settings/_settings.river.scss +56 -0
- package/src/themes/shaj-default/01-settings/_settings.sectionintro.scss +37 -0
- package/src/themes/shaj-default/01-settings/_settings.select.scss +53 -0
- package/src/themes/shaj-default/01-settings/_settings.side-menu.scss +85 -0
- package/src/themes/shaj-default/01-settings/_settings.skeleton.scss +30 -0
- package/src/themes/shaj-default/01-settings/_settings.spacing.scss +72 -0
- package/src/themes/shaj-default/01-settings/_settings.spinner.scss +24 -0
- package/src/themes/shaj-default/01-settings/_settings.steps.scss +39 -0
- package/src/themes/shaj-default/01-settings/_settings.tabs.scss +39 -0
- package/src/themes/shaj-default/01-settings/_settings.testimonials.scss +30 -0
- package/src/themes/shaj-default/01-settings/_settings.todo.scss +58 -0
- package/src/themes/shaj-default/01-settings/_settings.toggle.scss +55 -0
- package/src/themes/shaj-default/01-settings/_settings.tooltip.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.typography.scss +101 -0
- package/src/themes/shaj-default/01-settings/_settings.upload.scss +102 -0
- package/src/themes/shaj-default/01-settings/_settings.z-layers.scss +25 -0
- package/src/themes/shaj-default/02-tools/_index.scss +0 -0
- package/src/themes/shaj-default/03-generic/_generic.root.scss +0 -0
- package/src/themes/shaj-default/03-generic/_index.scss +2 -0
- package/src/themes/shaj-default/04-elements/_index.scss +0 -0
- package/src/themes/shaj-default/05-objects/_index.scss +0 -0
- package/src/themes/shaj-default/06-components/_components.button.scss +55 -0
- package/src/themes/shaj-default/06-components/_components.card.scss +57 -0
- package/src/themes/shaj-default/06-components/_components.input.scss +58 -0
- package/src/themes/shaj-default/06-components/_components.navbar.scss +99 -0
- package/src/themes/shaj-default/06-components/_components.tooltip.scss +0 -0
- package/src/themes/shaj-default/06-components/_index.scss +13 -0
- package/src/themes/shaj-default/99-utilities/_index.scss +0 -0
- package/src/themes/shaj-default/index.scss +25 -0
- package/src/themes/themes.config.js +219 -0
- package/theme.config.ts +360 -0
- package/src/lib/theme/studio/ThemeStudio.tsx +0 -312
- package/src/lib/theme/studio/index.ts +0 -8
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sync Theme Configuration
|
|
5
|
+
*
|
|
6
|
+
* This script generates src/themes/themes.config.js from theme.config.ts
|
|
7
|
+
* to maintain a single source of truth for theme configuration.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
11
|
+
import { join, dirname } from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
16
|
+
|
|
17
|
+
// File paths
|
|
18
|
+
const THEME_CONFIG_TS = join(__dirname, '../theme.config.ts');
|
|
19
|
+
const THEMES_CONFIG_JS = join(__dirname, '../src/themes/themes.config.js');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Parse theme.config.ts to extract configuration
|
|
23
|
+
* Note: This is a simplified parser that works with the current structure
|
|
24
|
+
*/
|
|
25
|
+
async function parseThemeConfigTS() {
|
|
26
|
+
try {
|
|
27
|
+
const content = await readFile(THEME_CONFIG_TS, 'utf8');
|
|
28
|
+
|
|
29
|
+
// Extract themes object
|
|
30
|
+
const themesMatch = content.match(/themes:\s*{([^}]+(?:{[^}]*}[^}]*)*[^}]+)}/s);
|
|
31
|
+
if (!themesMatch) {
|
|
32
|
+
throw new Error('Could not find themes configuration');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Extract individual theme configurations
|
|
36
|
+
const themes = {};
|
|
37
|
+
const themeRegex = /['"]([^'"]+)['"]\s*:\s*{([^}]+(?:{[^}]*}[^}]*)*[^}]+)}/gs;
|
|
38
|
+
let match;
|
|
39
|
+
|
|
40
|
+
while ((match = themeRegex.exec(themesMatch[1])) !== null) {
|
|
41
|
+
const [, themeName, themeConfig] = match;
|
|
42
|
+
|
|
43
|
+
// Parse theme properties
|
|
44
|
+
const theme = {
|
|
45
|
+
name: extractValue(themeConfig, 'name'),
|
|
46
|
+
description: extractValue(themeConfig, 'description'),
|
|
47
|
+
author: extractValue(themeConfig, 'author'),
|
|
48
|
+
version: extractValue(themeConfig, 'version'),
|
|
49
|
+
tags: extractArray(themeConfig, 'tags'),
|
|
50
|
+
supportsDarkMode: extractBoolean(themeConfig, 'supportsDarkMode'),
|
|
51
|
+
status: extractValue(themeConfig, 'status'),
|
|
52
|
+
color: extractValue(themeConfig, 'color'),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Parse features if present
|
|
56
|
+
const featuresMatch = themeConfig.match(/features:\s*\[([^\]]*)\]/s);
|
|
57
|
+
if (featuresMatch) {
|
|
58
|
+
theme.features = featuresMatch[1]
|
|
59
|
+
.split(',')
|
|
60
|
+
.map(f => f.trim().replace(/['"]/g, ''))
|
|
61
|
+
.filter(f => f.length > 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Parse a11y if present
|
|
65
|
+
const a11yMatch = themeConfig.match(/a11y:\s*{([^}]*)}/);
|
|
66
|
+
if (a11yMatch) {
|
|
67
|
+
theme.a11y = {
|
|
68
|
+
contrastTarget: extractNumber(a11yMatch[1], 'contrastTarget'),
|
|
69
|
+
modes: extractArray(a11yMatch[1], 'modes'),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
themes[themeName] = theme;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Extract build configuration
|
|
77
|
+
const buildMatch = content.match(/build:\s*(defaultBuildConfig|{[^}]+})/);
|
|
78
|
+
const build = buildMatch && buildMatch[1] === 'defaultBuildConfig'
|
|
79
|
+
? getDefaultBuildConfig()
|
|
80
|
+
: parseBuildConfig(buildMatch?.[1]);
|
|
81
|
+
|
|
82
|
+
// Extract runtime configuration
|
|
83
|
+
const runtimeMatch = content.match(/runtime:\s*(defaultRuntimeConfig|{[^}]+})/);
|
|
84
|
+
const runtime = runtimeMatch && runtimeMatch[1] === 'defaultRuntimeConfig'
|
|
85
|
+
? getDefaultRuntimeConfig()
|
|
86
|
+
: parseRuntimeConfig(runtimeMatch?.[1]);
|
|
87
|
+
|
|
88
|
+
// Extract integration configuration
|
|
89
|
+
const integrationMatch = content.match(/integration:\s*(defaultIntegrationConfig|{[^}]+})/);
|
|
90
|
+
const integration = integrationMatch && integrationMatch[1] === 'defaultIntegrationConfig'
|
|
91
|
+
? getDefaultIntegrationConfig()
|
|
92
|
+
: parseIntegrationConfig(integrationMatch?.[1]);
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
themes,
|
|
96
|
+
build,
|
|
97
|
+
runtime,
|
|
98
|
+
integration,
|
|
99
|
+
dependencies: {},
|
|
100
|
+
};
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('❌ Failed to parse theme.config.ts:', error.message);
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Helper function to extract string values
|
|
109
|
+
*/
|
|
110
|
+
function extractValue(text, key) {
|
|
111
|
+
const regex = new RegExp(`${key}:\\s*['"]([^'"]+)['"]`);
|
|
112
|
+
const match = text.match(regex);
|
|
113
|
+
return match ? match[1] : undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Helper function to extract number values
|
|
118
|
+
*/
|
|
119
|
+
function extractNumber(text, key) {
|
|
120
|
+
const regex = new RegExp(`${key}:\\s*(\\d+(?:\\.\\d+)?)`);
|
|
121
|
+
const match = text.match(regex);
|
|
122
|
+
return match ? parseFloat(match[1]) : undefined;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Helper function to extract boolean values
|
|
127
|
+
*/
|
|
128
|
+
function extractBoolean(text, key) {
|
|
129
|
+
const regex = new RegExp(`${key}:\\s*(true|false)`);
|
|
130
|
+
const match = text.match(regex);
|
|
131
|
+
return match ? match[1] === 'true' : undefined;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Helper function to extract array values
|
|
136
|
+
*/
|
|
137
|
+
function extractArray(text, key) {
|
|
138
|
+
const regex = new RegExp(`${key}:\\s*\\[([^\\]]*)\\]`);
|
|
139
|
+
const match = text.match(regex);
|
|
140
|
+
if (!match) return undefined;
|
|
141
|
+
|
|
142
|
+
return match[1]
|
|
143
|
+
.split(',')
|
|
144
|
+
.map(item => item.trim().replace(/['"]/g, ''))
|
|
145
|
+
.filter(item => item.length > 0);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Get default build configuration
|
|
150
|
+
*/
|
|
151
|
+
function getDefaultBuildConfig() {
|
|
152
|
+
return {
|
|
153
|
+
output: {
|
|
154
|
+
directory: 'themes',
|
|
155
|
+
formats: {
|
|
156
|
+
expanded: '.css',
|
|
157
|
+
compressed: '.min.css',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
sass: {
|
|
161
|
+
style: 'expanded',
|
|
162
|
+
sourceMap: true,
|
|
163
|
+
loadPaths: ['src'],
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get default runtime configuration
|
|
170
|
+
*/
|
|
171
|
+
function getDefaultRuntimeConfig() {
|
|
172
|
+
return {
|
|
173
|
+
basePath: '/themes',
|
|
174
|
+
cdnPath: null,
|
|
175
|
+
preload: ['shaj-default'],
|
|
176
|
+
lazy: true,
|
|
177
|
+
defaultTheme: 'shaj-default',
|
|
178
|
+
storageKey: 'atomix-theme',
|
|
179
|
+
useMinified: "process.env.NODE_ENV === 'production'",
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get default integration configuration
|
|
185
|
+
*/
|
|
186
|
+
function getDefaultIntegrationConfig() {
|
|
187
|
+
return {
|
|
188
|
+
cssVariables: {
|
|
189
|
+
colorMode: '--storybook-color-mode',
|
|
190
|
+
},
|
|
191
|
+
classNames: {
|
|
192
|
+
theme: 'data-theme',
|
|
193
|
+
colorMode: 'data-atomix-color-mode',
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Parse build configuration
|
|
200
|
+
*/
|
|
201
|
+
function parseBuildConfig(configText) {
|
|
202
|
+
if (!configText) return getDefaultBuildConfig();
|
|
203
|
+
// For now, return default config
|
|
204
|
+
// A more sophisticated parser would be needed for complex objects
|
|
205
|
+
return getDefaultBuildConfig();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Parse runtime configuration
|
|
210
|
+
*/
|
|
211
|
+
function parseRuntimeConfig(configText) {
|
|
212
|
+
if (!configText) return getDefaultRuntimeConfig();
|
|
213
|
+
// For now, return default config
|
|
214
|
+
// A more sophisticated parser would be needed for complex objects
|
|
215
|
+
return getDefaultRuntimeConfig();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Parse integration configuration
|
|
220
|
+
*/
|
|
221
|
+
function parseIntegrationConfig(configText) {
|
|
222
|
+
if (!configText) return getDefaultIntegrationConfig();
|
|
223
|
+
// For now, return default config
|
|
224
|
+
// A more sophisticated parser would be needed for complex objects
|
|
225
|
+
return getDefaultIntegrationConfig();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Generate themes.config.js content
|
|
230
|
+
*/
|
|
231
|
+
function generateThemesConfigJS(config) {
|
|
232
|
+
const { themes, build, runtime, integration, dependencies } = config;
|
|
233
|
+
|
|
234
|
+
// Convert themes to metadata format
|
|
235
|
+
const metadata = {};
|
|
236
|
+
for (const [key, theme] of Object.entries(themes)) {
|
|
237
|
+
metadata[key] = { ...theme };
|
|
238
|
+
// Remove undefined values
|
|
239
|
+
Object.keys(metadata[key]).forEach(k => {
|
|
240
|
+
if (metadata[key][k] === undefined) {
|
|
241
|
+
delete metadata[key][k];
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return `/**
|
|
247
|
+
* Theme Configuration
|
|
248
|
+
*
|
|
249
|
+
* This file is auto-generated from theme.config.ts
|
|
250
|
+
* DO NOT EDIT MANUALLY - Edit theme.config.ts instead
|
|
251
|
+
*
|
|
252
|
+
* Generated on: ${new Date().toISOString()}
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
export const themesConfig = {
|
|
256
|
+
// Theme metadata
|
|
257
|
+
metadata: ${JSON.stringify(metadata, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
258
|
+
|
|
259
|
+
// Build configuration
|
|
260
|
+
build: ${JSON.stringify(build, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
261
|
+
|
|
262
|
+
// Export configuration for package.json
|
|
263
|
+
exports: {
|
|
264
|
+
'./themes/*': './dist/themes/*.css',
|
|
265
|
+
'./themes/*.min': './dist/themes/*.min.css',
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
// Theme integration settings
|
|
269
|
+
integration: ${JSON.stringify(integration, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
270
|
+
|
|
271
|
+
// Runtime theme loading configuration
|
|
272
|
+
runtime: ${JSON.stringify(runtime, null, 4).replace(/"([^"]+)":/g, '$1:').replace(/"process\.env\.NODE_ENV === 'production'"/g, "process.env.NODE_ENV === 'production'")},
|
|
273
|
+
|
|
274
|
+
// Theme dependencies (if a theme requires another theme to be loaded)
|
|
275
|
+
dependencies: ${JSON.stringify(dependencies, null, 4).replace(/"([^"]+)":/g, '$1:')},
|
|
276
|
+
};`;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Main function
|
|
281
|
+
*/
|
|
282
|
+
async function main() {
|
|
283
|
+
console.log('🔄 Syncing theme configuration...\n');
|
|
284
|
+
|
|
285
|
+
try {
|
|
286
|
+
// Parse theme.config.ts
|
|
287
|
+
console.log('📖 Reading theme.config.ts...');
|
|
288
|
+
const config = await parseThemeConfigTS();
|
|
289
|
+
console.log(` ✅ Found ${Object.keys(config.themes).length} themes`);
|
|
290
|
+
|
|
291
|
+
// Generate themes.config.js
|
|
292
|
+
console.log('\n📝 Generating themes.config.js...');
|
|
293
|
+
const jsContent = generateThemesConfigJS(config);
|
|
294
|
+
|
|
295
|
+
// Write to file
|
|
296
|
+
await writeFile(THEMES_CONFIG_JS, jsContent, 'utf8');
|
|
297
|
+
console.log(' ✅ Written to src/themes/themes.config.js');
|
|
298
|
+
|
|
299
|
+
console.log('\n✨ Configuration sync complete!');
|
|
300
|
+
console.log(' themes.config.js has been updated from theme.config.ts');
|
|
301
|
+
|
|
302
|
+
} catch (error) {
|
|
303
|
+
console.error('\n💥 Sync failed:', error.message);
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Run the sync
|
|
309
|
+
main();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
2
|
import { ListGroupProps } from '../../lib/types/components';
|
|
4
3
|
import { LIST_GROUP } from '../../lib/constants/components';
|
|
5
4
|
import { List } from './List';
|
|
@@ -11,7 +10,7 @@ export const ListGroup: React.FC<ListGroupProps> = ({
|
|
|
11
10
|
variant = 'default',
|
|
12
11
|
}) => {
|
|
13
12
|
// Generate CSS classes
|
|
14
|
-
const listGroupClasses =
|
|
13
|
+
const listGroupClasses = [LIST_GROUP.BASE_CLASS, className].filter(Boolean).join(' ');
|
|
15
14
|
|
|
16
15
|
// Get valid List children
|
|
17
16
|
const validLists = React.Children.toArray(children).filter(
|
|
@@ -71,7 +71,7 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
71
71
|
{typeof document !== 'undefined' &&
|
|
72
72
|
createPortal(
|
|
73
73
|
<div
|
|
74
|
-
ref={popoverRef}
|
|
74
|
+
ref={popoverRef as React.RefObject<HTMLDivElement>}
|
|
75
75
|
className={`c-popover c-popover--${currentPosition} ${isOpen ? POPOVER.CLASSES.IS_OPEN : ''} ${glass ? 'c-popover--glass' : ''} ${className}`}
|
|
76
76
|
style={style}
|
|
77
77
|
id={popoverId}
|
|
@@ -106,7 +106,7 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
106
106
|
<div className="c-popover__content-inner">{content}</div>
|
|
107
107
|
</div>
|
|
108
108
|
)}
|
|
109
|
-
<div ref={arrowRef} className="c-popover__arrow"></div>
|
|
109
|
+
<div ref={arrowRef as React.RefObject<HTMLDivElement>} className="c-popover__arrow"></div>
|
|
110
110
|
</div>,
|
|
111
111
|
document.body
|
|
112
112
|
)}
|
|
@@ -5,6 +5,9 @@ import { Tooltip } from './Tooltip';
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Components/Tooltip',
|
|
7
7
|
component: Tooltip,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'fullscreen',
|
|
10
|
+
},
|
|
8
11
|
argTypes: {
|
|
9
12
|
position: {
|
|
10
13
|
control: { type: 'select' },
|
|
@@ -132,9 +135,13 @@ GlassTooltip.decorators = [
|
|
|
132
135
|
Story => (
|
|
133
136
|
<div
|
|
134
137
|
style={{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
backgroundImage:
|
|
139
|
+
'url(https://images.unsplash.com/photo-1764066183840-9afb28867988?q=80&w=3135&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
140
|
+
backgroundSize: 'cover',
|
|
141
|
+
backgroundPosition: 'center',
|
|
142
|
+
minHeight: '100dvh',
|
|
143
|
+
width: '100dvw',
|
|
144
|
+
margin: 0,
|
|
138
145
|
}}
|
|
139
146
|
>
|
|
140
147
|
<Story />
|
|
@@ -163,9 +170,15 @@ GlassTooltipCustom.decorators = [
|
|
|
163
170
|
Story => (
|
|
164
171
|
<div
|
|
165
172
|
style={{
|
|
166
|
-
background:
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
background:
|
|
174
|
+
'url(https://images.unsplash.com/photo-1758843412266-e8661a80ada2?q=80&w=2128&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
175
|
+
backgroundSize: 'cover',
|
|
176
|
+
backgroundPosition: 'center',
|
|
177
|
+
minHeight: '100dvh',
|
|
178
|
+
width: '100dvw',
|
|
179
|
+
display: 'flex',
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
justifyContent: 'center',
|
|
169
182
|
}}
|
|
170
183
|
>
|
|
171
184
|
<Story />
|
|
@@ -187,9 +200,17 @@ GlassTooltipClick.decorators = [
|
|
|
187
200
|
Story => (
|
|
188
201
|
<div
|
|
189
202
|
style={{
|
|
190
|
-
background:
|
|
191
|
-
|
|
203
|
+
background:
|
|
204
|
+
'url(https://images.unsplash.com/photo-1658937364065-60f3f6818724?q=80&w=2093&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
205
|
+
backgroundSize: 'cover',
|
|
206
|
+
backgroundPosition: 'center',
|
|
207
|
+
minHeight: '100dvh',
|
|
208
|
+
width: '100dvw',
|
|
209
|
+
margin: 0,
|
|
192
210
|
padding: '2rem',
|
|
211
|
+
display: 'flex',
|
|
212
|
+
alignItems: 'center',
|
|
213
|
+
justifyContent: 'center',
|
|
193
214
|
}}
|
|
194
215
|
>
|
|
195
216
|
<Story />
|
|
@@ -211,9 +232,17 @@ GlassTooltipPositions.decorators = [
|
|
|
211
232
|
Story => (
|
|
212
233
|
<div
|
|
213
234
|
style={{
|
|
214
|
-
background:
|
|
215
|
-
|
|
235
|
+
background:
|
|
236
|
+
'url(https://images.unsplash.com/photo-1657617053432-09e4adf998bb?q=80&w=2532&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
237
|
+
backgroundSize: 'cover',
|
|
238
|
+
backgroundPosition: 'center',
|
|
239
|
+
minHeight: '100dvh',
|
|
240
|
+
width: '100dvw',
|
|
241
|
+
margin: 0,
|
|
216
242
|
padding: '2rem',
|
|
243
|
+
display: 'flex',
|
|
244
|
+
alignItems: 'center',
|
|
245
|
+
justifyContent: 'center',
|
|
217
246
|
}}
|
|
218
247
|
>
|
|
219
248
|
<Story />
|
|
@@ -245,9 +274,17 @@ GlassTooltipRich.decorators = [
|
|
|
245
274
|
Story => (
|
|
246
275
|
<div
|
|
247
276
|
style={{
|
|
248
|
-
background:
|
|
249
|
-
|
|
277
|
+
background:
|
|
278
|
+
'url(https://images.unsplash.com/photo-1685334466570-6c6162e242b6?q=80&w=2534&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
279
|
+
backgroundSize: 'cover',
|
|
280
|
+
backgroundPosition: 'center',
|
|
281
|
+
minHeight: '100dvh',
|
|
282
|
+
width: '100dvw',
|
|
283
|
+
margin: 0,
|
|
250
284
|
padding: '2rem',
|
|
285
|
+
display: 'flex',
|
|
286
|
+
alignItems: 'center',
|
|
287
|
+
justifyContent: 'center',
|
|
251
288
|
}}
|
|
252
289
|
>
|
|
253
290
|
<Story />
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { ReactNode
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { TOOLTIP } from '../../lib/constants/components';
|
|
3
3
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
4
4
|
import { AtomixGlassProps } from '../../lib/types/components';
|
|
5
|
+
import { useTooltip, type TooltipPosition, type TooltipTrigger } from '../../lib/composables/useTooltip';
|
|
5
6
|
|
|
6
7
|
export interface TooltipProps {
|
|
7
8
|
/**
|
|
@@ -70,38 +71,22 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
70
71
|
offset = TOOLTIP.DEFAULTS.OFFSET,
|
|
71
72
|
glass,
|
|
72
73
|
}) => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const hideTooltip = () => {
|
|
92
|
-
if (timeoutRef.current) {
|
|
93
|
-
clearTimeout(timeoutRef.current);
|
|
94
|
-
}
|
|
95
|
-
setIsVisible(false);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const toggleTooltip = () => {
|
|
99
|
-
if (isVisible) {
|
|
100
|
-
hideTooltip();
|
|
101
|
-
} else {
|
|
102
|
-
showTooltip();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
74
|
+
const {
|
|
75
|
+
isVisible,
|
|
76
|
+
isPositioned,
|
|
77
|
+
tooltipId,
|
|
78
|
+
triggerRef,
|
|
79
|
+
tooltipRef,
|
|
80
|
+
tooltipStyle,
|
|
81
|
+
arrowStyle,
|
|
82
|
+
triggerProps,
|
|
83
|
+
wrapperProps,
|
|
84
|
+
} = useTooltip({
|
|
85
|
+
position: position as TooltipPosition,
|
|
86
|
+
trigger: trigger as TooltipTrigger,
|
|
87
|
+
offset,
|
|
88
|
+
delay,
|
|
89
|
+
});
|
|
105
90
|
|
|
106
91
|
const getTooltipPositionClasses = () => {
|
|
107
92
|
const positionMap: Record<string, string> = {
|
|
@@ -117,40 +102,23 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
117
102
|
return positionMap[position] || 'c-tooltip--top';
|
|
118
103
|
};
|
|
119
104
|
|
|
120
|
-
const wrapperProps: React.HTMLAttributes<HTMLDivElement> = {};
|
|
121
|
-
const triggerProps: React.HTMLAttributes<HTMLDivElement> = {
|
|
122
|
-
'aria-describedby': isVisible ? tooltipId : undefined,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
if (trigger === 'hover') {
|
|
126
|
-
wrapperProps.onMouseEnter = showTooltip;
|
|
127
|
-
wrapperProps.onMouseLeave = hideTooltip;
|
|
128
|
-
triggerProps.onFocus = showTooltip;
|
|
129
|
-
triggerProps.onBlur = hideTooltip;
|
|
130
|
-
} else if (trigger === 'click') {
|
|
131
|
-
triggerProps.onClick = toggleTooltip;
|
|
132
|
-
// For click trigger, we might want to handle keyboard activation too, but div isn't focusable by default.
|
|
133
|
-
// Ideally the child should be a button.
|
|
134
|
-
}
|
|
135
|
-
|
|
136
105
|
const renderContent = () => {
|
|
137
106
|
const contentElement = (
|
|
138
107
|
<div
|
|
139
|
-
className={`c-tooltip__content ${TOOLTIP.SELECTORS.CONTENT.substring(1)} ${isVisible && 'is-active'}`}
|
|
108
|
+
className={`c-tooltip__content ${TOOLTIP.SELECTORS.CONTENT.substring(1)} ${isVisible && isPositioned && 'is-active'}`}
|
|
140
109
|
>
|
|
141
|
-
<span
|
|
110
|
+
<span
|
|
111
|
+
className={TOOLTIP.SELECTORS.ARROW.substring(1)}
|
|
112
|
+
style={arrowStyle}
|
|
113
|
+
></span>
|
|
142
114
|
{content}
|
|
143
115
|
</div>
|
|
144
116
|
);
|
|
145
117
|
|
|
146
118
|
if (glass) {
|
|
147
119
|
const defaultGlassProps = {
|
|
148
|
-
displacementScale:
|
|
149
|
-
blurAmount:
|
|
150
|
-
saturation: 160,
|
|
151
|
-
aberrationIntensity: 0.3,
|
|
152
|
-
cornerRadius: 6,
|
|
153
|
-
mode: 'shader' as const,
|
|
120
|
+
displacementScale: 100,
|
|
121
|
+
blurAmount: 3,
|
|
154
122
|
};
|
|
155
123
|
|
|
156
124
|
const glassProps =
|
|
@@ -169,6 +137,7 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
169
137
|
{...wrapperProps}
|
|
170
138
|
>
|
|
171
139
|
<div
|
|
140
|
+
ref={triggerRef}
|
|
172
141
|
className={`${TOOLTIP.SELECTORS.TRIGGER.substring(1)}${className ? ` ${className}` : ''}`}
|
|
173
142
|
{...triggerProps}
|
|
174
143
|
>
|
|
@@ -176,12 +145,17 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
176
145
|
</div>
|
|
177
146
|
{isVisible && (
|
|
178
147
|
<div
|
|
148
|
+
ref={tooltipRef}
|
|
179
149
|
id={tooltipId}
|
|
180
150
|
role="tooltip"
|
|
181
151
|
className={`c-tooltip ${TOOLTIP.SELECTORS.TOOLTIP.substring(1)} ${getTooltipPositionClasses()} ${glass ? 'c-tooltip--glass' : ''}`}
|
|
182
152
|
data-tooltip-position={position}
|
|
183
153
|
data-tooltip-trigger={trigger}
|
|
184
|
-
style={{
|
|
154
|
+
style={{
|
|
155
|
+
...tooltipStyle,
|
|
156
|
+
// Position off-screen initially to prevent jump, then move to calculated position
|
|
157
|
+
...(isPositioned ? {} : { left: '-9999px', top: '-9999px' }),
|
|
158
|
+
}}
|
|
185
159
|
>
|
|
186
160
|
{renderContent()}
|
|
187
161
|
</div>
|