@shohojdhara/atomix 0.3.4 → 0.3.6
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 +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +269 -189
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15179 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6477 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3373 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2466 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4566 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5171 -4792
- package/dist/index.esm.js +6098 -4563
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6291 -4747
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +2122 -0
- package/dist/theme.js +6084 -0
- package/dist/theme.js.map +1 -0
- package/package.json +59 -27
- package/scripts/atomix-cli.js +544 -16
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +1 -1
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -18
- package/src/components/Chart/AreaChart.tsx +5 -2
- package/src/components/Chart/BarChart.tsx +1 -1
- package/src/components/Chart/BubbleChart.tsx +6 -6
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +1 -2
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +19 -13
- package/src/components/Chart/ScatterChart.tsx +3 -4
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -2
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +10 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +88 -7
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +6 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useAtomixGlass.ts +2 -3
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +57 -14
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -15
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +254 -0
- package/src/lib/theme/config/loader.ts +37 -48
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +19 -6
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +155 -0
- package/src/lib/theme/core/createTheme.ts +94 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
- package/src/lib/theme/core/index.ts +5 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +489 -112
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +6 -3
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +4 -14
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +7 -7
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -95
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +4 -4
- package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
- package/src/lib/theme/runtime/index.ts +1 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
- package/src/lib/theme-tools.ts +8 -9
- package/src/lib/types/components.ts +93 -34
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/build-themes.js +0 -208
- package/scripts/sync-theme-config.js +0 -309
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -657
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -442
- package/src/styles/03-generic/_generated-root.css +0 -5
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -35
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
- /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import type { AtomixGlassProps } from '../../lib/types/components';
|
|
3
4
|
import { Tooltip } from './Tooltip';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
// Helper type for glass props in stories (without children requirement)
|
|
7
|
+
type GlassProps = boolean | Omit<AtomixGlassProps, 'children'>;
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
6
10
|
title: 'Components/Tooltip',
|
|
7
11
|
component: Tooltip,
|
|
8
12
|
parameters: {
|
|
9
13
|
layout: 'fullscreen',
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component:
|
|
17
|
+
'The Tooltip component displays contextual information when users hover over or click on an element. It supports multiple positions, triggers, and can include rich content. Tooltips are useful for providing additional context without cluttering the interface.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
10
20
|
},
|
|
21
|
+
tags: ['autodocs'],
|
|
11
22
|
argTypes: {
|
|
12
23
|
position: {
|
|
13
24
|
control: { type: 'select' },
|
|
@@ -41,253 +52,360 @@ export default {
|
|
|
41
52
|
description: 'Enable glass morphism effect',
|
|
42
53
|
},
|
|
43
54
|
},
|
|
44
|
-
}
|
|
55
|
+
} satisfies Meta<typeof Tooltip>;
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<Tooltip {...args}>
|
|
49
|
-
<button className="c-btn c-btn--primary">Hover me</button>
|
|
50
|
-
</Tooltip>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
57
|
+
export default meta;
|
|
58
|
+
type Story = StoryObj<typeof meta>;
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
Default
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
// Default Tooltip
|
|
61
|
+
export const Default: Story = {
|
|
62
|
+
render: args => (
|
|
63
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
64
|
+
<Tooltip {...args}>
|
|
65
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
66
|
+
</Tooltip>
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
args: {
|
|
70
|
+
content: <p className="u-mb-0">This is a tooltip on top</p>,
|
|
71
|
+
position: 'top',
|
|
72
|
+
trigger: 'hover',
|
|
73
|
+
} as any,
|
|
59
74
|
};
|
|
60
75
|
|
|
61
|
-
export const ClickTrigger =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
export const ClickTrigger: Story = {
|
|
77
|
+
render: args => (
|
|
78
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
79
|
+
<Tooltip {...args}>
|
|
80
|
+
<button className="c-btn c-btn--primary">Click me</button>
|
|
81
|
+
</Tooltip>
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
args: {
|
|
85
|
+
content: <p className="u-mb-0">Click anywhere to close this tooltip</p>,
|
|
86
|
+
position: 'top',
|
|
87
|
+
trigger: 'click',
|
|
88
|
+
} as any,
|
|
66
89
|
};
|
|
67
90
|
|
|
68
|
-
export const BottomPosition =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
91
|
+
export const BottomPosition: Story = {
|
|
92
|
+
render: args => (
|
|
93
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
94
|
+
<Tooltip {...args}>
|
|
95
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
</div>
|
|
98
|
+
),
|
|
99
|
+
args: {
|
|
100
|
+
content: <p className="u-mb-0">This tooltip appears below the trigger</p>,
|
|
101
|
+
position: 'bottom',
|
|
102
|
+
} as any,
|
|
72
103
|
};
|
|
73
104
|
|
|
74
|
-
export const LeftPosition =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
export const LeftPosition: Story = {
|
|
106
|
+
render: args => (
|
|
107
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
108
|
+
<Tooltip {...args}>
|
|
109
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
110
|
+
</Tooltip>
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
args: {
|
|
114
|
+
content: <p className="u-mb-0">This tooltip appears to the left</p>,
|
|
115
|
+
position: 'left',
|
|
116
|
+
} as any,
|
|
78
117
|
};
|
|
79
118
|
|
|
80
|
-
export const RightPosition =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
119
|
+
export const RightPosition: Story = {
|
|
120
|
+
render: args => (
|
|
121
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
122
|
+
<Tooltip {...args}>
|
|
123
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
124
|
+
</Tooltip>
|
|
125
|
+
</div>
|
|
126
|
+
),
|
|
127
|
+
args: {
|
|
128
|
+
content: <p className="u-mb-0">This tooltip appears to the right</p>,
|
|
129
|
+
position: 'right',
|
|
130
|
+
} as any,
|
|
84
131
|
};
|
|
85
132
|
|
|
86
|
-
export const WithIcon =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
133
|
+
export const WithIcon: Story = {
|
|
134
|
+
render: args => (
|
|
135
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
136
|
+
<Tooltip {...args}>
|
|
137
|
+
<i className="icon-lux-info" style={{ fontSize: '24px', cursor: 'pointer' }}></i>
|
|
138
|
+
</Tooltip>
|
|
139
|
+
</div>
|
|
140
|
+
),
|
|
141
|
+
args: {
|
|
142
|
+
content: <p className="u-mb-0">Tooltips work great with icons</p>,
|
|
143
|
+
position: 'top',
|
|
144
|
+
} as any,
|
|
91
145
|
};
|
|
92
146
|
|
|
93
|
-
export const CustomDelay =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
147
|
+
export const CustomDelay: Story = {
|
|
148
|
+
render: args => (
|
|
149
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
150
|
+
<Tooltip {...args}>
|
|
151
|
+
<button className="c-btn c-btn--primary">Hover me (500ms delay)</button>
|
|
152
|
+
</Tooltip>
|
|
153
|
+
</div>
|
|
154
|
+
),
|
|
155
|
+
args: {
|
|
156
|
+
content: <p className="u-mb-0">This tooltip has a longer delay</p>,
|
|
157
|
+
position: 'top',
|
|
158
|
+
delay: 500,
|
|
159
|
+
} as any,
|
|
98
160
|
};
|
|
99
161
|
|
|
100
|
-
export const CustomOffset =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
162
|
+
export const CustomOffset: Story = {
|
|
163
|
+
render: args => (
|
|
164
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
165
|
+
<Tooltip {...args}>
|
|
166
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
167
|
+
</Tooltip>
|
|
168
|
+
</div>
|
|
169
|
+
),
|
|
170
|
+
args: {
|
|
171
|
+
content: <p className="u-mb-0">This tooltip has a larger offset from the trigger</p>,
|
|
172
|
+
position: 'top',
|
|
173
|
+
offset: 20,
|
|
174
|
+
} as any,
|
|
105
175
|
};
|
|
106
176
|
|
|
107
|
-
export const RichContent =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<li>Supports HTML content</li>
|
|
114
|
-
<li>Can include multiple elements</li>
|
|
115
|
-
<li>Helpful for complex information</li>
|
|
116
|
-
</ul>
|
|
177
|
+
export const RichContent: Story = {
|
|
178
|
+
render: args => (
|
|
179
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
180
|
+
<Tooltip {...args}>
|
|
181
|
+
<button className="c-btn c-btn--primary">Click for rich content</button>
|
|
182
|
+
</Tooltip>
|
|
117
183
|
</div>
|
|
118
184
|
),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
185
|
+
args: {
|
|
186
|
+
content: (
|
|
187
|
+
<div>
|
|
188
|
+
<h4 style={{ marginTop: 0, marginBottom: '8px' }}>Rich Tooltip Content</h4>
|
|
189
|
+
<ul style={{ margin: 0, paddingLeft: '16px' }}>
|
|
190
|
+
<li>Supports HTML content</li>
|
|
191
|
+
<li>Can include multiple elements</li>
|
|
192
|
+
<li>Helpful for complex information</li>
|
|
193
|
+
</ul>
|
|
194
|
+
</div>
|
|
195
|
+
),
|
|
196
|
+
position: 'bottom',
|
|
197
|
+
trigger: 'click',
|
|
198
|
+
offset: 15,
|
|
199
|
+
} as any,
|
|
122
200
|
};
|
|
123
201
|
|
|
124
202
|
/**
|
|
125
203
|
* Glass morphism tooltip example.
|
|
126
204
|
*/
|
|
127
|
-
export const GlassTooltip =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
};
|
|
134
|
-
GlassTooltip.decorators = [
|
|
135
|
-
Story => (
|
|
136
|
-
<div
|
|
137
|
-
style={{
|
|
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,
|
|
145
|
-
}}
|
|
146
|
-
>
|
|
147
|
-
<Story />
|
|
205
|
+
export const GlassTooltip: Story = {
|
|
206
|
+
render: args => (
|
|
207
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
208
|
+
<Tooltip {...args}>
|
|
209
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
210
|
+
</Tooltip>
|
|
148
211
|
</div>
|
|
149
212
|
),
|
|
150
|
-
|
|
213
|
+
args: {
|
|
214
|
+
content: <p className="u-mb-0">This is a glass tooltip</p>,
|
|
215
|
+
position: 'top',
|
|
216
|
+
trigger: 'hover',
|
|
217
|
+
glass: true,
|
|
218
|
+
} as any,
|
|
219
|
+
decorators: [
|
|
220
|
+
Story => (
|
|
221
|
+
<div
|
|
222
|
+
style={{
|
|
223
|
+
backgroundImage:
|
|
224
|
+
'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)',
|
|
225
|
+
backgroundSize: 'cover',
|
|
226
|
+
backgroundPosition: 'center',
|
|
227
|
+
minHeight: '100dvh',
|
|
228
|
+
width: '100dvw',
|
|
229
|
+
margin: 0,
|
|
230
|
+
}}
|
|
231
|
+
>
|
|
232
|
+
<Story />
|
|
233
|
+
</div>
|
|
234
|
+
),
|
|
235
|
+
],
|
|
236
|
+
};
|
|
151
237
|
|
|
152
238
|
/**
|
|
153
239
|
* Glass tooltip with custom settings.
|
|
154
240
|
*/
|
|
155
|
-
export const GlassTooltipCustom =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
displacementScale: 60,
|
|
162
|
-
blurAmount: 2,
|
|
163
|
-
saturation: 200,
|
|
164
|
-
aberrationIntensity: 1,
|
|
165
|
-
cornerRadius: 12,
|
|
166
|
-
mode: 'polar',
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
GlassTooltipCustom.decorators = [
|
|
170
|
-
Story => (
|
|
171
|
-
<div
|
|
172
|
-
style={{
|
|
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',
|
|
182
|
-
}}
|
|
183
|
-
>
|
|
184
|
-
<Story />
|
|
241
|
+
export const GlassTooltipCustom: Story = {
|
|
242
|
+
render: args => (
|
|
243
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
244
|
+
<Tooltip {...args}>
|
|
245
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
246
|
+
</Tooltip>
|
|
185
247
|
</div>
|
|
186
248
|
),
|
|
187
|
-
|
|
249
|
+
args: {
|
|
250
|
+
content: <p className="u-mb-0">Custom glass tooltip with enhanced effects</p>,
|
|
251
|
+
position: 'top',
|
|
252
|
+
trigger: 'hover',
|
|
253
|
+
glass: {
|
|
254
|
+
displacementScale: 60,
|
|
255
|
+
blurAmount: 2,
|
|
256
|
+
saturation: 200,
|
|
257
|
+
aberrationIntensity: 1,
|
|
258
|
+
cornerRadius: 12,
|
|
259
|
+
mode: 'polar',
|
|
260
|
+
} as GlassProps,
|
|
261
|
+
} as any,
|
|
262
|
+
decorators: [
|
|
263
|
+
Story => (
|
|
264
|
+
<div
|
|
265
|
+
style={{
|
|
266
|
+
background:
|
|
267
|
+
'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)',
|
|
268
|
+
backgroundSize: 'cover',
|
|
269
|
+
backgroundPosition: 'center',
|
|
270
|
+
minHeight: '100dvh',
|
|
271
|
+
width: '100dvw',
|
|
272
|
+
display: 'flex',
|
|
273
|
+
alignItems: 'center',
|
|
274
|
+
justifyContent: 'center',
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
<Story />
|
|
278
|
+
</div>
|
|
279
|
+
),
|
|
280
|
+
],
|
|
281
|
+
};
|
|
188
282
|
|
|
189
283
|
/**
|
|
190
284
|
* Glass tooltip with click trigger.
|
|
191
285
|
*/
|
|
192
|
-
export const GlassTooltipClick =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
};
|
|
199
|
-
GlassTooltipClick.decorators = [
|
|
200
|
-
Story => (
|
|
201
|
-
<div
|
|
202
|
-
style={{
|
|
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,
|
|
210
|
-
padding: '2rem',
|
|
211
|
-
display: 'flex',
|
|
212
|
-
alignItems: 'center',
|
|
213
|
-
justifyContent: 'center',
|
|
214
|
-
}}
|
|
215
|
-
>
|
|
216
|
-
<Story />
|
|
286
|
+
export const GlassTooltipClick: Story = {
|
|
287
|
+
render: args => (
|
|
288
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
289
|
+
<Tooltip {...args}>
|
|
290
|
+
<button className="c-btn c-btn--primary">Click me</button>
|
|
291
|
+
</Tooltip>
|
|
217
292
|
</div>
|
|
218
293
|
),
|
|
219
|
-
|
|
294
|
+
args: {
|
|
295
|
+
content: <p className="u-mb-0">Click to show glass tooltip</p>,
|
|
296
|
+
position: 'top',
|
|
297
|
+
trigger: 'click',
|
|
298
|
+
glass: true,
|
|
299
|
+
} as any,
|
|
300
|
+
decorators: [
|
|
301
|
+
Story => (
|
|
302
|
+
<div
|
|
303
|
+
style={{
|
|
304
|
+
background:
|
|
305
|
+
'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)',
|
|
306
|
+
backgroundSize: 'cover',
|
|
307
|
+
backgroundPosition: 'center',
|
|
308
|
+
minHeight: '100dvh',
|
|
309
|
+
width: '100dvw',
|
|
310
|
+
margin: 0,
|
|
311
|
+
padding: '2rem',
|
|
312
|
+
display: 'flex',
|
|
313
|
+
alignItems: 'center',
|
|
314
|
+
justifyContent: 'center',
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<Story />
|
|
318
|
+
</div>
|
|
319
|
+
),
|
|
320
|
+
],
|
|
321
|
+
};
|
|
220
322
|
|
|
221
323
|
/**
|
|
222
324
|
* Glass tooltip with different positions.
|
|
223
325
|
*/
|
|
224
|
-
export const GlassTooltipPositions =
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
};
|
|
231
|
-
GlassTooltipPositions.decorators = [
|
|
232
|
-
Story => (
|
|
233
|
-
<div
|
|
234
|
-
style={{
|
|
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,
|
|
242
|
-
padding: '2rem',
|
|
243
|
-
display: 'flex',
|
|
244
|
-
alignItems: 'center',
|
|
245
|
-
justifyContent: 'center',
|
|
246
|
-
}}
|
|
247
|
-
>
|
|
248
|
-
<Story />
|
|
326
|
+
export const GlassTooltipPositions: Story = {
|
|
327
|
+
render: args => (
|
|
328
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
329
|
+
<Tooltip {...args}>
|
|
330
|
+
<button className="c-btn c-btn--primary">Hover me</button>
|
|
331
|
+
</Tooltip>
|
|
249
332
|
</div>
|
|
250
333
|
),
|
|
251
|
-
|
|
334
|
+
args: {
|
|
335
|
+
content: <p className="u-mb-0">Glass tooltip in different positions</p>,
|
|
336
|
+
position: 'top',
|
|
337
|
+
trigger: 'hover',
|
|
338
|
+
glass: true,
|
|
339
|
+
} as any,
|
|
340
|
+
decorators: [
|
|
341
|
+
Story => (
|
|
342
|
+
<div
|
|
343
|
+
style={{
|
|
344
|
+
background:
|
|
345
|
+
'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)',
|
|
346
|
+
backgroundSize: 'cover',
|
|
347
|
+
backgroundPosition: 'center',
|
|
348
|
+
minHeight: '100dvh',
|
|
349
|
+
width: '100dvw',
|
|
350
|
+
margin: 0,
|
|
351
|
+
padding: '2rem',
|
|
352
|
+
display: 'flex',
|
|
353
|
+
alignItems: 'center',
|
|
354
|
+
justifyContent: 'center',
|
|
355
|
+
}}
|
|
356
|
+
>
|
|
357
|
+
<Story />
|
|
358
|
+
</div>
|
|
359
|
+
),
|
|
360
|
+
],
|
|
361
|
+
};
|
|
252
362
|
|
|
253
363
|
/**
|
|
254
364
|
* Glass tooltip with rich content.
|
|
255
365
|
*/
|
|
256
|
-
export const GlassTooltipRich =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<li>Beautiful glass effect</li>
|
|
263
|
-
<li>Supports rich content</li>
|
|
264
|
-
<li>Modern design</li>
|
|
265
|
-
</ul>
|
|
366
|
+
export const GlassTooltipRich: Story = {
|
|
367
|
+
render: args => (
|
|
368
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '100px' }}>
|
|
369
|
+
<Tooltip {...args}>
|
|
370
|
+
<button className="c-btn c-btn--primary">Click for rich content</button>
|
|
371
|
+
</Tooltip>
|
|
266
372
|
</div>
|
|
267
373
|
),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
374
|
+
args: {
|
|
375
|
+
content: (
|
|
376
|
+
<div>
|
|
377
|
+
<h4 style={{ marginTop: 0, marginBottom: '8px' }}>Glass Rich Tooltip</h4>
|
|
378
|
+
<ul style={{ margin: 0, paddingLeft: '16px' }}>
|
|
379
|
+
<li>Beautiful glass effect</li>
|
|
380
|
+
<li>Supports rich content</li>
|
|
381
|
+
<li>Modern design</li>
|
|
382
|
+
</ul>
|
|
383
|
+
</div>
|
|
384
|
+
),
|
|
385
|
+
position: 'bottom',
|
|
386
|
+
trigger: 'click',
|
|
387
|
+
offset: 15,
|
|
388
|
+
glass: true,
|
|
389
|
+
} as any,
|
|
390
|
+
decorators: [
|
|
391
|
+
Story => (
|
|
392
|
+
<div
|
|
393
|
+
style={{
|
|
394
|
+
background:
|
|
395
|
+
'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)',
|
|
396
|
+
backgroundSize: 'cover',
|
|
397
|
+
backgroundPosition: 'center',
|
|
398
|
+
minHeight: '100dvh',
|
|
399
|
+
width: '100dvw',
|
|
400
|
+
margin: 0,
|
|
401
|
+
padding: '2rem',
|
|
402
|
+
display: 'flex',
|
|
403
|
+
alignItems: 'center',
|
|
404
|
+
justifyContent: 'center',
|
|
405
|
+
}}
|
|
406
|
+
>
|
|
407
|
+
<Story />
|
|
408
|
+
</div>
|
|
409
|
+
),
|
|
410
|
+
],
|
|
272
411
|
};
|
|
273
|
-
GlassTooltipRich.decorators = [
|
|
274
|
-
Story => (
|
|
275
|
-
<div
|
|
276
|
-
style={{
|
|
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,
|
|
284
|
-
padding: '2rem',
|
|
285
|
-
display: 'flex',
|
|
286
|
-
alignItems: 'center',
|
|
287
|
-
justifyContent: 'center',
|
|
288
|
-
}}
|
|
289
|
-
>
|
|
290
|
-
<Story />
|
|
291
|
-
</div>
|
|
292
|
-
),
|
|
293
|
-
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode, memo } 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';
|
|
@@ -60,7 +60,7 @@ export interface TooltipProps {
|
|
|
60
60
|
glass?: AtomixGlassProps | boolean;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export const Tooltip: React.FC<TooltipProps> = ({
|
|
63
|
+
export const Tooltip: React.FC<TooltipProps> = memo(({
|
|
64
64
|
content,
|
|
65
65
|
children,
|
|
66
66
|
position = TOOLTIP.DEFAULTS.POSITION,
|
|
@@ -162,7 +162,7 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
162
162
|
)}
|
|
163
163
|
</div>
|
|
164
164
|
);
|
|
165
|
-
};
|
|
165
|
+
});
|
|
166
166
|
|
|
167
167
|
Tooltip.displayName = 'Tooltip';
|
|
168
168
|
|