@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,37 +1,46 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import DatePicker from './DatePicker';
|
|
4
4
|
import { DateRange } from './types';
|
|
5
5
|
import { formatDateRange } from './utils';
|
|
6
|
+
import { SIZES } from '../../lib/constants/components';
|
|
6
7
|
|
|
7
|
-
const meta
|
|
8
|
+
const meta = {
|
|
8
9
|
title: 'Components/DatePicker',
|
|
9
10
|
component: DatePicker,
|
|
10
11
|
parameters: {
|
|
11
12
|
layout: 'padded',
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
'The DatePicker component provides a user-friendly interface for selecting dates or date ranges. It supports single date selection, date range selection, custom date formatting, and various display options. DatePickers are essential for forms requiring date input and provide calendar-based selection with keyboard navigation.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
12
19
|
},
|
|
20
|
+
tags: ['autodocs'],
|
|
13
21
|
argTypes: {
|
|
14
|
-
value: { control: 'date' },
|
|
15
|
-
startDate: { control: 'date' },
|
|
16
|
-
endDate: { control: 'date' },
|
|
22
|
+
value: { control: 'date', description: 'Selected date value' },
|
|
23
|
+
startDate: { control: 'date', description: 'Start date for range selection' },
|
|
24
|
+
endDate: { control: 'date', description: 'End date for range selection' },
|
|
17
25
|
selectionMode: {
|
|
18
26
|
control: { type: 'radio' },
|
|
19
27
|
options: ['single', 'range'],
|
|
20
28
|
description: 'Selection mode - single date or date range',
|
|
21
29
|
},
|
|
22
|
-
minDate: { control: 'date' },
|
|
23
|
-
maxDate: { control: 'date' },
|
|
24
|
-
format: { control: 'text' },
|
|
25
|
-
placeholder: { control: 'text' },
|
|
26
|
-
disabled: { control: 'boolean' },
|
|
27
|
-
readOnly: { control: 'boolean' },
|
|
28
|
-
clearable: { control: 'boolean' },
|
|
29
|
-
showTodayButton: { control: 'boolean' },
|
|
30
|
-
showWeekNumbers: { control: 'boolean' },
|
|
31
|
-
inline: { control: 'boolean' },
|
|
30
|
+
minDate: { control: 'date', description: 'Minimum selectable date' },
|
|
31
|
+
maxDate: { control: 'date', description: 'Maximum selectable date' },
|
|
32
|
+
format: { control: 'text', description: 'Date format string' },
|
|
33
|
+
placeholder: { control: 'text', description: 'Placeholder text' },
|
|
34
|
+
disabled: { control: 'boolean', description: 'Whether the date picker is disabled' },
|
|
35
|
+
readOnly: { control: 'boolean', description: 'Whether the date picker is read-only' },
|
|
36
|
+
clearable: { control: 'boolean', description: 'Whether the date can be cleared' },
|
|
37
|
+
showTodayButton: { control: 'boolean', description: 'Whether to show a "Today" button' },
|
|
38
|
+
showWeekNumbers: { control: 'boolean', description: 'Whether to show week numbers' },
|
|
39
|
+
inline: { control: 'boolean', description: 'Whether to display inline (always visible)' },
|
|
32
40
|
size: {
|
|
33
41
|
control: { type: 'select' },
|
|
34
|
-
options:
|
|
42
|
+
options: SIZES,
|
|
43
|
+
description: 'Size of the date picker',
|
|
35
44
|
},
|
|
36
45
|
placement: {
|
|
37
46
|
control: { type: 'select' },
|
|
@@ -51,11 +60,10 @@ const meta: Meta<typeof DatePicker> = {
|
|
|
51
60
|
description: 'Apply glass morphism effect to the calendar dropdown',
|
|
52
61
|
},
|
|
53
62
|
},
|
|
54
|
-
}
|
|
63
|
+
} satisfies Meta<typeof DatePicker>;
|
|
55
64
|
|
|
56
65
|
export default meta;
|
|
57
|
-
|
|
58
|
-
type Story = StoryObj<typeof DatePicker>;
|
|
66
|
+
type Story = StoryObj<typeof meta>;
|
|
59
67
|
|
|
60
68
|
export const Default: Story = {
|
|
61
69
|
args: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { ThemeColor } from '../../lib/types/components';
|
|
4
4
|
import { Icon } from '../Icon';
|
|
5
5
|
import { Dropdown, DropdownDivider, DropdownHeader, DropdownItem } from './index';
|
|
6
|
+
import { THEME_COLORS } from '../../lib/constants/components';
|
|
6
7
|
|
|
7
|
-
const meta
|
|
8
|
+
const meta = {
|
|
8
9
|
title: 'Components/Dropdown',
|
|
9
10
|
component: Dropdown,
|
|
10
11
|
parameters: {
|
|
@@ -12,13 +13,14 @@ const meta: Meta<typeof Dropdown> = {
|
|
|
12
13
|
docs: {
|
|
13
14
|
description: {
|
|
14
15
|
component:
|
|
15
|
-
'Dropdown component
|
|
16
|
+
'The Dropdown component provides a toggleable menu that appears relative to a trigger element. It supports multiple placement options, click or hover triggers, and can include dividers, headers, and icons. Dropdowns are ideal for navigation menus, action menus, or any context where options need to be revealed on demand.',
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
},
|
|
20
|
+
tags: ['autodocs'],
|
|
19
21
|
argTypes: {
|
|
20
22
|
placement: {
|
|
21
|
-
control: 'select',
|
|
23
|
+
control: { type: 'select' },
|
|
22
24
|
options: [
|
|
23
25
|
'bottom-start',
|
|
24
26
|
'bottom-end',
|
|
@@ -32,23 +34,13 @@ const meta: Meta<typeof Dropdown> = {
|
|
|
32
34
|
description: 'The placement of the dropdown menu relative to the trigger element',
|
|
33
35
|
},
|
|
34
36
|
trigger: {
|
|
35
|
-
control: 'radio',
|
|
37
|
+
control: { type: 'radio' },
|
|
36
38
|
options: ['click', 'hover'],
|
|
37
39
|
description: 'How the dropdown is triggered - by click or hover',
|
|
38
40
|
},
|
|
39
41
|
variant: {
|
|
40
|
-
control: 'select',
|
|
41
|
-
options:
|
|
42
|
-
'primary',
|
|
43
|
-
'secondary',
|
|
44
|
-
'tertiary',
|
|
45
|
-
'success',
|
|
46
|
-
'info',
|
|
47
|
-
'warning',
|
|
48
|
-
'error',
|
|
49
|
-
'light',
|
|
50
|
-
'dark',
|
|
51
|
-
],
|
|
42
|
+
control: { type: 'select' },
|
|
43
|
+
options: THEME_COLORS,
|
|
52
44
|
description: 'The color variant of the dropdown',
|
|
53
45
|
},
|
|
54
46
|
minWidth: {
|
|
@@ -72,10 +64,10 @@ const meta: Meta<typeof Dropdown> = {
|
|
|
72
64
|
description: 'Enable glass morphism effect',
|
|
73
65
|
},
|
|
74
66
|
},
|
|
75
|
-
}
|
|
67
|
+
} satisfies Meta<typeof Dropdown>;
|
|
76
68
|
|
|
77
69
|
export default meta;
|
|
78
|
-
type Story = StoryObj<typeof
|
|
70
|
+
type Story = StoryObj<typeof meta>;
|
|
79
71
|
|
|
80
72
|
/**
|
|
81
73
|
* Interactive dropdown component that can be used in Storybook
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useState, useCallback, createContext, useContext, useEffect } from 'react';
|
|
1
|
+
import React, { useRef, useState, useCallback, createContext, useContext, useEffect, memo } from 'react';
|
|
2
2
|
import { DROPDOWN } from '../../lib/constants/components';
|
|
3
3
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
4
4
|
import type {
|
|
@@ -27,7 +27,7 @@ const DropdownContext = createContext<DropdownContextType>({
|
|
|
27
27
|
/**
|
|
28
28
|
* DropdownItem component for menu items
|
|
29
29
|
*/
|
|
30
|
-
export const DropdownItem: React.FC<DropdownItemProps> = ({
|
|
30
|
+
export const DropdownItem: React.FC<DropdownItemProps> = memo(({
|
|
31
31
|
children,
|
|
32
32
|
href,
|
|
33
33
|
active = false,
|
|
@@ -111,26 +111,26 @@ export const DropdownItem: React.FC<DropdownItemProps> = ({
|
|
|
111
111
|
</button>
|
|
112
112
|
</li>
|
|
113
113
|
);
|
|
114
|
-
};
|
|
114
|
+
});
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* DropdownDivider component for separating groups of items
|
|
118
118
|
*/
|
|
119
|
-
export const DropdownDivider: React.FC<DropdownDividerProps> = ({ className = '' }) => {
|
|
119
|
+
export const DropdownDivider: React.FC<DropdownDividerProps> = memo(({ className = '' }) => {
|
|
120
120
|
return <li className={`c-dropdown__divider ${className}`} role="separator" />;
|
|
121
|
-
};
|
|
121
|
+
});
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* DropdownHeader component for section headers
|
|
125
125
|
*/
|
|
126
|
-
export const DropdownHeader: React.FC<DropdownHeaderProps> = ({ children, className = '' }) => {
|
|
126
|
+
export const DropdownHeader: React.FC<DropdownHeaderProps> = memo(({ children, className = '' }) => {
|
|
127
127
|
return <li className={`c-dropdown__header ${className}`}>{children}</li>;
|
|
128
|
-
};
|
|
128
|
+
});
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Dropdown component for creating dropdown menus
|
|
132
132
|
*/
|
|
133
|
-
export const Dropdown: React.FC<DropdownProps> = ({
|
|
133
|
+
export const Dropdown: React.FC<DropdownProps> = memo(({
|
|
134
134
|
children,
|
|
135
135
|
menu,
|
|
136
136
|
placement = 'bottom-start',
|
|
@@ -370,10 +370,13 @@ export const Dropdown: React.FC<DropdownProps> = ({
|
|
|
370
370
|
</div>
|
|
371
371
|
</div>
|
|
372
372
|
);
|
|
373
|
-
};
|
|
373
|
+
});
|
|
374
374
|
|
|
375
375
|
export type { DropdownProps, DropdownItemProps, DropdownDividerProps, DropdownHeaderProps };
|
|
376
376
|
|
|
377
377
|
Dropdown.displayName = 'Dropdown';
|
|
378
|
+
DropdownItem.displayName = 'DropdownItem';
|
|
379
|
+
DropdownDivider.displayName = 'DropdownDivider';
|
|
380
|
+
DropdownHeader.displayName = 'DropdownHeader';
|
|
378
381
|
|
|
379
382
|
export default Dropdown;
|
|
@@ -3,8 +3,9 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
3
3
|
import { Footer } from './Footer';
|
|
4
4
|
import { FooterSection } from './FooterSection';
|
|
5
5
|
import { FooterLink } from './FooterLink';
|
|
6
|
+
import { THEME_COLORS, SIZES } from '../../lib/constants/components';
|
|
6
7
|
|
|
7
|
-
const meta
|
|
8
|
+
const meta = {
|
|
8
9
|
title: 'Components/Footer',
|
|
9
10
|
component: Footer,
|
|
10
11
|
parameters: {
|
|
@@ -12,10 +13,11 @@ const meta: Meta<typeof Footer> = {
|
|
|
12
13
|
docs: {
|
|
13
14
|
description: {
|
|
14
15
|
component:
|
|
15
|
-
'
|
|
16
|
+
'The Footer component provides a comprehensive footer section for websites with multiple layout variants, sections, links, and optional features like newsletter signup and back-to-top buttons. Footers support various color variants, sizes, and can be sticky. Essential for site navigation, branding, and additional information display.',
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
},
|
|
20
|
+
tags: ['autodocs'],
|
|
19
21
|
argTypes: {
|
|
20
22
|
layout: {
|
|
21
23
|
control: 'select',
|
|
@@ -24,12 +26,12 @@ const meta: Meta<typeof Footer> = {
|
|
|
24
26
|
},
|
|
25
27
|
variant: {
|
|
26
28
|
control: 'select',
|
|
27
|
-
options:
|
|
29
|
+
options: THEME_COLORS,
|
|
28
30
|
description: 'Color variant',
|
|
29
31
|
},
|
|
30
32
|
size: {
|
|
31
33
|
control: 'select',
|
|
32
|
-
options:
|
|
34
|
+
options: SIZES,
|
|
33
35
|
description: 'Size variant',
|
|
34
36
|
},
|
|
35
37
|
showNewsletter: {
|
|
@@ -49,10 +51,10 @@ const meta: Meta<typeof Footer> = {
|
|
|
49
51
|
description: 'Whether footer should be sticky',
|
|
50
52
|
},
|
|
51
53
|
},
|
|
52
|
-
}
|
|
54
|
+
} satisfies Meta<typeof Footer>;
|
|
53
55
|
|
|
54
56
|
export default meta;
|
|
55
|
-
type Story = StoryObj<typeof
|
|
57
|
+
type Story = StoryObj<typeof meta>;
|
|
56
58
|
|
|
57
59
|
// Sample social links
|
|
58
60
|
const sampleSocialLinks = [
|
|
@@ -49,8 +49,15 @@ export const FooterLink = forwardRef<HTMLAnchorElement, FooterLinkProps>(
|
|
|
49
49
|
|
|
50
50
|
if (LinkComponent) {
|
|
51
51
|
const Component = LinkComponent as React.ComponentType<any>;
|
|
52
|
+
// Only pass href if the link is not disabled and href exists
|
|
53
|
+
const componentProps = {
|
|
54
|
+
ref,
|
|
55
|
+
...(href && !disabled ? { to: href } : {}),
|
|
56
|
+
...linkProps,
|
|
57
|
+
};
|
|
58
|
+
|
|
52
59
|
return (
|
|
53
|
-
<Component
|
|
60
|
+
<Component {...componentProps}>
|
|
54
61
|
{icon && <span className="c-footer__link-icon">{icon}</span>}
|
|
55
62
|
<span className="c-footer__link-text">{children}</span>
|
|
56
63
|
{external && <span className="c-footer__link-external">↗</span>}
|
|
@@ -70,4 +77,4 @@ export const FooterLink = forwardRef<HTMLAnchorElement, FooterLinkProps>(
|
|
|
70
77
|
|
|
71
78
|
FooterLink.displayName = 'FooterLink';
|
|
72
79
|
|
|
73
|
-
export default FooterLink;
|
|
80
|
+
export default FooterLink;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import { FooterSectionProps } from '
|
|
3
|
-
import { GridCol } from '
|
|
4
|
-
import { useFooter } from '
|
|
2
|
+
import { FooterSectionProps } from '../../lib/types/components';
|
|
3
|
+
import { GridCol } from '../../layouts';
|
|
4
|
+
import { useFooter } from '../../lib/composables/useFooter';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* FooterSection component provides a section within the footer for organizing links and content.
|
|
@@ -6,7 +6,14 @@ const meta = {
|
|
|
6
6
|
component: Checkbox,
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'The Checkbox component allows users to select one or more options from a set. It supports checked, unchecked, and indeterminate states, and can be used in forms or as standalone controls. Checkboxes provide clear visual feedback and support keyboard navigation.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
9
15
|
},
|
|
16
|
+
tags: ['autodocs'],
|
|
10
17
|
argTypes: {
|
|
11
18
|
label: {
|
|
12
19
|
control: 'text',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { CheckboxProps } from '../../lib/types/components';
|
|
3
3
|
import { useCheckbox } from '../../lib/composables/useCheckbox';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
@@ -6,7 +6,7 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
6
6
|
/**
|
|
7
7
|
* Checkbox - A component for checkbox inputs
|
|
8
8
|
*/
|
|
9
|
-
export const Checkbox: React.FC<CheckboxProps> = ({
|
|
9
|
+
export const Checkbox: React.FC<CheckboxProps> = memo(({
|
|
10
10
|
label,
|
|
11
11
|
checked = false,
|
|
12
12
|
onChange,
|
|
@@ -81,7 +81,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return checkboxContent;
|
|
84
|
-
};
|
|
84
|
+
});
|
|
85
85
|
|
|
86
86
|
export type { CheckboxProps };
|
|
87
87
|
|
|
@@ -18,7 +18,14 @@ const meta = {
|
|
|
18
18
|
component: Form,
|
|
19
19
|
parameters: {
|
|
20
20
|
layout: 'centered',
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component:
|
|
24
|
+
'The Form component provides a semantic HTML form wrapper with enhanced functionality. It supports form validation, submission handling, and can be disabled as a whole. Forms work seamlessly with FormGroup and all form input components to create complete, accessible form experiences.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
21
27
|
},
|
|
28
|
+
tags: ['autodocs'],
|
|
22
29
|
argTypes: {
|
|
23
30
|
disabled: {
|
|
24
31
|
control: 'boolean',
|
|
@@ -5,13 +5,21 @@ import { Input } from './Input';
|
|
|
5
5
|
import { Radio } from './Radio';
|
|
6
6
|
import { Select } from './Select';
|
|
7
7
|
import { Textarea } from './Textarea';
|
|
8
|
+
import { SIZES } from '../../lib/constants/components';
|
|
8
9
|
|
|
9
10
|
const meta = {
|
|
10
11
|
title: 'Components/Form/FormGroup',
|
|
11
12
|
component: FormGroup,
|
|
12
13
|
parameters: {
|
|
13
14
|
layout: 'centered',
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component:
|
|
18
|
+
'The FormGroup component provides a structured wrapper for form fields, including labels, inputs, helper text, and error messages. It ensures proper accessibility, consistent spacing, and validation state display. FormGroups are essential for creating well-organized and accessible forms.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
14
21
|
},
|
|
22
|
+
tags: ['autodocs'],
|
|
15
23
|
argTypes: {
|
|
16
24
|
label: {
|
|
17
25
|
control: 'text',
|
|
@@ -39,7 +47,7 @@ const meta = {
|
|
|
39
47
|
},
|
|
40
48
|
size: {
|
|
41
49
|
control: { type: 'select' },
|
|
42
|
-
options:
|
|
50
|
+
options: SIZES,
|
|
43
51
|
description: 'Size variant',
|
|
44
52
|
},
|
|
45
53
|
},
|
|
@@ -2,28 +2,39 @@ import React from 'react';
|
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { Input } from './Input';
|
|
4
4
|
import { MagnifyingGlass, Envelope, Lock, User, Phone, Calendar } from '@phosphor-icons/react';
|
|
5
|
+
import { SIZES, THEME_COLORS } from '../../lib/constants/components';
|
|
5
6
|
|
|
6
7
|
const meta = {
|
|
7
8
|
title: 'Components/Form/Input',
|
|
8
9
|
component: Input,
|
|
9
10
|
parameters: {
|
|
10
11
|
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
'The Input component provides a text input field for user data entry. It supports various input types, sizes, validation states, and can include icons and clear buttons. Inputs are essential form elements for collecting user information and can be customized to match your design system.',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
11
18
|
},
|
|
19
|
+
tags: ['autodocs'],
|
|
12
20
|
argTypes: {
|
|
13
21
|
type: {
|
|
14
22
|
control: { type: 'select' },
|
|
15
23
|
options: ['text', 'email', 'password', 'number', 'search', 'tel', 'url'],
|
|
16
24
|
description: 'Input type',
|
|
25
|
+
defaultValue: 'text',
|
|
17
26
|
},
|
|
18
27
|
size: {
|
|
19
28
|
control: { type: 'select' },
|
|
20
|
-
options:
|
|
29
|
+
options: SIZES,
|
|
21
30
|
description: 'Size of the input',
|
|
31
|
+
defaultValue: 'md',
|
|
22
32
|
},
|
|
23
33
|
variant: {
|
|
24
34
|
control: { type: 'select' },
|
|
25
|
-
options:
|
|
35
|
+
options: THEME_COLORS,
|
|
26
36
|
description: 'Color variant of the input',
|
|
37
|
+
defaultValue: 'secondary',
|
|
27
38
|
},
|
|
28
39
|
disabled: {
|
|
29
40
|
control: 'boolean',
|
|
@@ -67,7 +78,9 @@ const meta = {
|
|
|
67
78
|
export default meta;
|
|
68
79
|
type Story = StoryObj<typeof meta>;
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Basic text input with placeholder.
|
|
83
|
+
*/
|
|
71
84
|
export const Basic: Story = {
|
|
72
85
|
args: {
|
|
73
86
|
placeholder: 'Enter text here',
|
|
@@ -75,7 +88,9 @@ export const Basic: Story = {
|
|
|
75
88
|
},
|
|
76
89
|
};
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Showcase of all input sizes (small, medium, large).
|
|
93
|
+
*/
|
|
79
94
|
export const Sizes: Story = {
|
|
80
95
|
render: () => (
|
|
81
96
|
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
@@ -86,7 +101,9 @@ export const Sizes: Story = {
|
|
|
86
101
|
),
|
|
87
102
|
};
|
|
88
103
|
|
|
89
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Showcase of different input types (text, email, password, number, search, tel, url).
|
|
106
|
+
*/
|
|
90
107
|
export const Types: Story = {
|
|
91
108
|
render: () => (
|
|
92
109
|
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
@@ -101,7 +118,9 @@ export const Types: Story = {
|
|
|
101
118
|
),
|
|
102
119
|
};
|
|
103
120
|
|
|
104
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Showcase of input color variants (primary, success, error, warning, info).
|
|
123
|
+
*/
|
|
105
124
|
export const Variants: Story = {
|
|
106
125
|
render: () => (
|
|
107
126
|
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
@@ -114,7 +133,9 @@ export const Variants: Story = {
|
|
|
114
133
|
),
|
|
115
134
|
};
|
|
116
135
|
|
|
117
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Showcase of input states (default, disabled, valid, invalid).
|
|
138
|
+
*/
|
|
118
139
|
export const States: Story = {
|
|
119
140
|
render: () => (
|
|
120
141
|
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
@@ -126,7 +147,9 @@ export const States: Story = {
|
|
|
126
147
|
),
|
|
127
148
|
};
|
|
128
149
|
|
|
129
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Input with prefix and suffix icons for enhanced UX.
|
|
152
|
+
*/
|
|
130
153
|
export const WithIcons: Story = {
|
|
131
154
|
render: () => (
|
|
132
155
|
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '300px' }}>
|
|
@@ -153,7 +176,9 @@ export const WithIcons: Story = {
|
|
|
153
176
|
),
|
|
154
177
|
};
|
|
155
178
|
|
|
156
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Input with clear button that appears when there's a value.
|
|
181
|
+
*/
|
|
157
182
|
export const Clearable: Story = {
|
|
158
183
|
render: () => {
|
|
159
184
|
const [value, setValue] = React.useState('');
|
|
@@ -177,7 +202,9 @@ export const Clearable: Story = {
|
|
|
177
202
|
},
|
|
178
203
|
};
|
|
179
204
|
|
|
180
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Input with character counter showing remaining characters.
|
|
207
|
+
*/
|
|
181
208
|
export const WithCounter: Story = {
|
|
182
209
|
render: () => {
|
|
183
210
|
const [value, setValue] = React.useState('');
|
|
@@ -202,7 +229,9 @@ export const WithCounter: Story = {
|
|
|
202
229
|
},
|
|
203
230
|
};
|
|
204
231
|
|
|
205
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Password input with visibility toggle button.
|
|
234
|
+
*/
|
|
206
235
|
export const PasswordToggle: Story = {
|
|
207
236
|
render: () => {
|
|
208
237
|
const [password, setPassword] = React.useState('');
|
|
@@ -228,7 +257,9 @@ export const PasswordToggle: Story = {
|
|
|
228
257
|
},
|
|
229
258
|
};
|
|
230
259
|
|
|
231
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Input with error messages and helper text for validation feedback.
|
|
262
|
+
*/
|
|
232
263
|
export const WithMessages: Story = {
|
|
233
264
|
render: () => {
|
|
234
265
|
const [email, setEmail] = React.useState('');
|
|
@@ -263,7 +294,9 @@ export const WithMessages: Story = {
|
|
|
263
294
|
},
|
|
264
295
|
};
|
|
265
296
|
|
|
266
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Full-width input that takes the full width of its container.
|
|
299
|
+
*/
|
|
267
300
|
export const FullWidth: Story = {
|
|
268
301
|
render: () => (
|
|
269
302
|
<div className="u-d-flex u-flex-column u-gap-3" style={{ width: '100%', maxWidth: '500px' }}>
|
|
@@ -277,8 +310,17 @@ export const FullWidth: Story = {
|
|
|
277
310
|
),
|
|
278
311
|
};
|
|
279
312
|
|
|
280
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Comprehensive example showcasing multiple input features together.
|
|
315
|
+
*/
|
|
281
316
|
export const Comprehensive: Story = {
|
|
317
|
+
parameters: {
|
|
318
|
+
docs: {
|
|
319
|
+
description: {
|
|
320
|
+
story: 'A comprehensive example demonstrating multiple input features including icons, clearable functionality, password toggle, character counter, and helper text in a form-like layout.',
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
282
324
|
render: () => {
|
|
283
325
|
const [search, setSearch] = React.useState('');
|
|
284
326
|
const [password, setPassword] = React.useState('');
|
|
@@ -335,7 +377,9 @@ export const Comprehensive: Story = {
|
|
|
335
377
|
},
|
|
336
378
|
};
|
|
337
379
|
|
|
338
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Input with glass morphism effect enabled.
|
|
382
|
+
*/
|
|
339
383
|
export const Glass: Story = {
|
|
340
384
|
args: {
|
|
341
385
|
placeholder: 'Glass Input',
|
|
@@ -400,8 +444,17 @@ export const GlassVariants: Story = {
|
|
|
400
444
|
),
|
|
401
445
|
};
|
|
402
446
|
|
|
403
|
-
|
|
447
|
+
/**
|
|
448
|
+
* Comprehensive showcase of glass morphism effects on inputs.
|
|
449
|
+
*/
|
|
404
450
|
export const GlassShowcase: Story = {
|
|
451
|
+
parameters: {
|
|
452
|
+
docs: {
|
|
453
|
+
description: {
|
|
454
|
+
story: 'Demonstrates glass morphism effects on inputs with different modes and configurations, showing how inputs look over colorful backgrounds.',
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
},
|
|
405
458
|
render: () => (
|
|
406
459
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}>
|
|
407
460
|
{/* Basic Glass */}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, memo } from 'react';
|
|
2
2
|
import { InputProps } from '../../lib/types/components';
|
|
3
3
|
import { useInput } from '../../lib/composables/useInput';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
@@ -6,7 +6,8 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
6
6
|
/**
|
|
7
7
|
* Input - A component for text input fields
|
|
8
8
|
*/
|
|
9
|
-
export const Input =
|
|
9
|
+
export const Input = memo(
|
|
10
|
+
forwardRef<HTMLInputElement, InputProps>(
|
|
10
11
|
(
|
|
11
12
|
{
|
|
12
13
|
type = 'text',
|
|
@@ -109,6 +110,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
109
110
|
|
|
110
111
|
return inputElement;
|
|
111
112
|
}
|
|
113
|
+
)
|
|
112
114
|
);
|
|
113
115
|
|
|
114
116
|
Input.displayName = 'Input';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
import { Radio } from './Radio';
|
|
3
4
|
|
|
@@ -6,7 +7,14 @@ const meta = {
|
|
|
6
7
|
component: Radio,
|
|
7
8
|
parameters: {
|
|
8
9
|
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'The Radio component allows users to select a single option from a group of mutually exclusive options. Radio buttons are typically used in groups where only one selection is allowed. They provide clear visual feedback and support keyboard navigation.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
9
16
|
},
|
|
17
|
+
tags: ['autodocs'],
|
|
10
18
|
argTypes: {
|
|
11
19
|
label: {
|
|
12
20
|
control: 'text',
|
|
@@ -134,7 +142,7 @@ export const GlassCustom: Story = {
|
|
|
134
142
|
saturation: 200,
|
|
135
143
|
aberrationIntensity: 0.8,
|
|
136
144
|
cornerRadius: 12,
|
|
137
|
-
},
|
|
145
|
+
} as any,
|
|
138
146
|
},
|
|
139
147
|
render: (args: any) => (
|
|
140
148
|
<div
|