@shohojdhara/atomix 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atomix.css +9 -10
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15108 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6482 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3357 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2450 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4550 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5161 -4990
- package/dist/index.esm.js +1457 -784
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1473 -790
- 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 +1992 -0
- package/dist/theme.js +5348 -0
- package/dist/theme.js.map +1 -0
- package/package.json +66 -20
- 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.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -17
- package/src/components/Chart/AreaChart.tsx +5 -1
- package/src/components/Chart/BarChart.tsx +1 -0
- package/src/components/Chart/BubbleChart.tsx +6 -5
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/FunnelChart.tsx +1 -1
- package/src/components/Chart/RadarChart.tsx +19 -12
- package/src/components/Chart/ScatterChart.tsx +3 -3
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Pagination/Pagination.tsx +6 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +5 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- 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/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +55 -13
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +10 -14
- 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/composeTheme.ts +1 -1
- package/src/lib/theme/core/ThemeEngine.ts +8 -0
- package/src/lib/theme/core/ThemeValidator.ts +5 -2
- package/src/lib/theme/devtools/Inspector.tsx +1 -1
- package/src/lib/theme/devtools/LiveEditor.tsx +11 -5
- package/src/lib/theme/generateCSSVariables.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +2 -1
- package/src/lib/theme/runtime/ThemeApplicator.ts +28 -11
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +3 -3
- package/src/lib/theme/runtime/ThemeManager.ts +4 -0
- package/src/lib/theme-tools.ts +1 -1
- package/src/lib/types/components.ts +183 -34
- package/src/lib/types/partProps.ts +0 -16
- 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.fonts.scss +2 -5
- package/src/styles/03-generic/_generated-root.css +22 -1
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/themes/themes.config.js +37 -4
- package/scripts/build-themes.js +0 -208
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
|
@@ -97,6 +97,7 @@ const RadarChart = memo(
|
|
|
97
97
|
const radius = Math.min(centerX, centerY) * 0.8;
|
|
98
98
|
|
|
99
99
|
const firstDataset = renderedDatasets[0];
|
|
100
|
+
if (!firstDataset) return null;
|
|
100
101
|
const dataPoints = firstDataset.data || [];
|
|
101
102
|
const angleStep = (2 * Math.PI) / dataPoints.length;
|
|
102
103
|
|
|
@@ -195,24 +196,28 @@ const RadarChart = memo(
|
|
|
195
196
|
points.push({ x, y, value, point: dataset.data[i] });
|
|
196
197
|
}
|
|
197
198
|
|
|
198
|
-
if (points.length === 0) return null;
|
|
199
|
+
if (points.length === 0 || !points[0]) return null;
|
|
199
200
|
|
|
200
201
|
// Generate path
|
|
201
202
|
let path = '';
|
|
202
203
|
if (smooth && points.length > 2) {
|
|
203
204
|
// For smooth curves, we would implement a more complex algorithm
|
|
204
205
|
// For now, we'll just connect the points with straight lines
|
|
205
|
-
path = `M ${points[0]
|
|
206
|
+
path = `M ${points[0]!.x},${points[0]!.y}`;
|
|
206
207
|
for (let i = 1; i < points.length; i++) {
|
|
207
|
-
|
|
208
|
+
if (points[i]) {
|
|
209
|
+
path += ` L ${points[i]!.x},${points[i]!.y}`;
|
|
210
|
+
}
|
|
208
211
|
}
|
|
209
|
-
path += ` L ${points[0]
|
|
212
|
+
path += ` L ${points[0]!.x},${points[0]!.y} Z`;
|
|
210
213
|
} else {
|
|
211
|
-
path = `M ${points[0]
|
|
214
|
+
path = `M ${points[0]!.x},${points[0]!.y}`;
|
|
212
215
|
for (let i = 1; i < points.length; i++) {
|
|
213
|
-
|
|
216
|
+
if (points[i]) {
|
|
217
|
+
path += ` L ${points[i]!.x},${points[i]!.y}`;
|
|
218
|
+
}
|
|
214
219
|
}
|
|
215
|
-
path += ` L ${points[0]
|
|
220
|
+
path += ` L ${points[0]!.x},${points[0]!.y} Z`;
|
|
216
221
|
}
|
|
217
222
|
|
|
218
223
|
return (
|
|
@@ -246,9 +251,11 @@ const RadarChart = memo(
|
|
|
246
251
|
r={isHovered ? pointRadius * 1.5 : pointRadius}
|
|
247
252
|
fill={color}
|
|
248
253
|
className={`c-chart__radar-point ${isHovered ? 'c-chart__radar-point--hovered' : ''}`}
|
|
249
|
-
onClick={() =>
|
|
250
|
-
|
|
251
|
-
|
|
254
|
+
onClick={() => {
|
|
255
|
+
if (point.point) {
|
|
256
|
+
handlers.onDataPointClick?.(point.point, datasetIndex, pointIndex);
|
|
257
|
+
}
|
|
258
|
+
}}
|
|
252
259
|
onMouseEnter={e => {
|
|
253
260
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
254
261
|
handlers.onPointHover(
|
|
@@ -276,10 +283,10 @@ const RadarChart = memo(
|
|
|
276
283
|
{dataPaths}
|
|
277
284
|
{axisLabels}
|
|
278
285
|
</g>
|
|
279
|
-
{showTooltips && hoveredPoint && (
|
|
286
|
+
{showTooltips && hoveredPoint && renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && (
|
|
280
287
|
<ChartTooltip
|
|
281
288
|
dataPoint={
|
|
282
|
-
renderedDatasets[hoveredPoint.datasetIndex]
|
|
289
|
+
renderedDatasets[hoveredPoint.datasetIndex]!.data![hoveredPoint.pointIndex]!
|
|
283
290
|
}
|
|
284
291
|
datasetLabel={renderedDatasets[hoveredPoint.datasetIndex]?.label}
|
|
285
292
|
datasetColor={
|
|
@@ -60,7 +60,7 @@ const ScatterChart = memo(
|
|
|
60
60
|
renderedDatasets.forEach((dataset: ChartDataset, datasetIndex: number) => {
|
|
61
61
|
const color = dataset.color || colors[datasetIndex % colors.length];
|
|
62
62
|
|
|
63
|
-
dataset.data?.forEach((point:
|
|
63
|
+
dataset.data?.forEach((point: any, pointIndex: number) => {
|
|
64
64
|
const x =
|
|
65
65
|
point.x !== undefined
|
|
66
66
|
? scales.padding.left + (point.x / 100) * scales.innerWidth
|
|
@@ -125,10 +125,10 @@ const ScatterChart = memo(
|
|
|
125
125
|
return (
|
|
126
126
|
<>
|
|
127
127
|
{points}
|
|
128
|
-
{showTooltips && hoveredPoint && (
|
|
128
|
+
{showTooltips && hoveredPoint && renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && (
|
|
129
129
|
<ChartTooltip
|
|
130
130
|
dataPoint={
|
|
131
|
-
renderedDatasets[hoveredPoint.datasetIndex]
|
|
131
|
+
renderedDatasets[hoveredPoint.datasetIndex]!.data![hoveredPoint.pointIndex]!
|
|
132
132
|
}
|
|
133
133
|
datasetLabel={renderedDatasets[hoveredPoint.datasetIndex]?.label}
|
|
134
134
|
datasetColor={
|
|
@@ -197,7 +197,7 @@ const TreemapChart = memo(
|
|
|
197
197
|
switch (scheme) {
|
|
198
198
|
case 'category':
|
|
199
199
|
return colors[index % colors.length];
|
|
200
|
-
case 'depth':
|
|
200
|
+
case 'depth': {
|
|
201
201
|
const depthColors = [
|
|
202
202
|
'var(--atomix-blue-9)',
|
|
203
203
|
'var(--atomix-blue-6)',
|
|
@@ -206,6 +206,7 @@ const TreemapChart = memo(
|
|
|
206
206
|
'var(--atomix-blue-2)',
|
|
207
207
|
];
|
|
208
208
|
return depthColors[Math.min(depth, depthColors.length - 1)];
|
|
209
|
+
}
|
|
209
210
|
case 'value':
|
|
210
211
|
if (data.length > 0) {
|
|
211
212
|
const maxValue = Math.max(...data.map(d => d.value));
|
|
@@ -289,9 +289,19 @@ export interface ChartProps extends BaseComponentProps {
|
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* Chart scales interface
|
|
292
|
-
* Imported from useChart for consistency
|
|
293
292
|
*/
|
|
294
|
-
export
|
|
293
|
+
export interface ChartScales {
|
|
294
|
+
xScale: (index: number, dataLength?: number) => number;
|
|
295
|
+
yScale: (value: number) => number;
|
|
296
|
+
minValue: number;
|
|
297
|
+
maxValue: number;
|
|
298
|
+
valueRange: number;
|
|
299
|
+
innerWidth: number;
|
|
300
|
+
innerHeight: number;
|
|
301
|
+
width: number;
|
|
302
|
+
height: number;
|
|
303
|
+
padding: { top: number; right: number; bottom: number; left: number };
|
|
304
|
+
}
|
|
295
305
|
|
|
296
306
|
/**
|
|
297
307
|
* Chart interaction state
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* @returns Color string
|
|
6
6
|
*/
|
|
7
7
|
export const getColorFromScheme = (colorScheme: string[], index: number): string => {
|
|
8
|
-
|
|
8
|
+
const color = colorScheme[index % colorScheme.length];
|
|
9
|
+
return color || colorScheme[0] || '#000000';
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -23,12 +24,12 @@ export const getColorFromValue = (
|
|
|
23
24
|
colorScheme: string[]
|
|
24
25
|
): string => {
|
|
25
26
|
if (minValue === maxValue) {
|
|
26
|
-
return colorScheme[0];
|
|
27
|
+
return colorScheme[0] || '#000000';
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const normalized = (value - minValue) / (maxValue - minValue);
|
|
30
31
|
const index = Math.floor(normalized * (colorScheme.length - 1));
|
|
31
|
-
return colorScheme[index];
|
|
32
|
+
return colorScheme[index] || colorScheme[0] || '#000000';
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
1
|
+
import React, { useRef, memo } from 'react';
|
|
2
2
|
import { DataTableProps } from '../../lib/types/components';
|
|
3
3
|
import { useDataTable } from '../../lib/composables/useDataTable';
|
|
4
4
|
import { DATA_TABLE_CLASSES } from '../../lib/constants/components';
|
|
@@ -19,7 +19,7 @@ import { Pagination } from '../Pagination/Pagination';
|
|
|
19
19
|
* />
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export const DataTable: React.FC<DataTableProps> = ({
|
|
22
|
+
export const DataTable: React.FC<DataTableProps> = memo(({
|
|
23
23
|
data,
|
|
24
24
|
columns,
|
|
25
25
|
className,
|
|
@@ -205,7 +205,7 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
205
205
|
{renderPagination()}
|
|
206
206
|
</div>
|
|
207
207
|
);
|
|
208
|
-
};
|
|
208
|
+
});
|
|
209
209
|
|
|
210
210
|
export type { DataTableProps };
|
|
211
211
|
|
|
@@ -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;
|
|
@@ -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.
|
|
@@ -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
|
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { RadioProps } from '../../lib/types/components';
|
|
3
3
|
import { useRadio } from '../../lib/composables/useRadio';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
@@ -6,7 +6,7 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
6
6
|
/**
|
|
7
7
|
* Radio - A component for radio button inputs
|
|
8
8
|
*/
|
|
9
|
-
export const Radio: React.FC<RadioProps> = ({
|
|
9
|
+
export const Radio: React.FC<RadioProps> = memo(({
|
|
10
10
|
label,
|
|
11
11
|
checked = false,
|
|
12
12
|
onChange,
|
|
@@ -77,7 +77,7 @@ export const Radio: React.FC<RadioProps> = ({
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return radioContent;
|
|
80
|
-
};
|
|
80
|
+
});
|
|
81
81
|
|
|
82
82
|
export type { RadioProps };
|
|
83
83
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState } from 'react';
|
|
1
|
+
import React, { useRef, useEffect, useState, memo } from 'react';
|
|
2
2
|
import { SelectProps } from '../../lib/types/components';
|
|
3
3
|
import { useSelect } from '../../lib/composables';
|
|
4
4
|
import { SELECT } from '../../lib/constants/components';
|
|
@@ -7,7 +7,7 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
7
7
|
/**
|
|
8
8
|
* Select - A component for dropdown selection
|
|
9
9
|
*/
|
|
10
|
-
export const Select: React.FC<SelectProps> = ({
|
|
10
|
+
export const Select: React.FC<SelectProps> = memo(({
|
|
11
11
|
options = [],
|
|
12
12
|
value,
|
|
13
13
|
onChange,
|
|
@@ -204,7 +204,7 @@ export const Select: React.FC<SelectProps> = ({
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
return selectContent;
|
|
207
|
-
};
|
|
207
|
+
});
|
|
208
208
|
|
|
209
209
|
export type { SelectProps };
|
|
210
210
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, memo } from 'react';
|
|
2
2
|
import { TextareaProps } from '../../lib/types/components';
|
|
3
3
|
import { useTextarea } from '../../lib/composables/useTextarea';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
@@ -6,7 +6,8 @@ import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
|
6
6
|
/**
|
|
7
7
|
* Textarea - A component for multiline text input
|
|
8
8
|
*/
|
|
9
|
-
export const Textarea =
|
|
9
|
+
export const Textarea = memo(
|
|
10
|
+
forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
10
11
|
(
|
|
11
12
|
{
|
|
12
13
|
value,
|
|
@@ -100,6 +101,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
100
101
|
|
|
101
102
|
return textareaElement;
|
|
102
103
|
}
|
|
104
|
+
)
|
|
103
105
|
);
|
|
104
106
|
|
|
105
107
|
Textarea.displayName = 'Textarea';
|
|
@@ -44,8 +44,8 @@ const ListItems = ({ variant }: { variant: string }) => (
|
|
|
44
44
|
</>
|
|
45
45
|
);
|
|
46
46
|
|
|
47
|
-
const createListSection = (title: string, variant: string) => (
|
|
48
|
-
<div style={sectionStyle}>
|
|
47
|
+
const createListSection = (title: string, variant: string, key?: string) => (
|
|
48
|
+
<div key={key} style={sectionStyle}>
|
|
49
49
|
<h3 style={titleStyle}>{title}</h3>
|
|
50
50
|
<List variant={variant as any}>
|
|
51
51
|
<ListItems variant={variant} />
|
|
@@ -67,7 +67,7 @@ export const VariantsShowcase: Story = {
|
|
|
67
67
|
<div className="u-d-flex u-flex-column u-gap-8">
|
|
68
68
|
{['Default', 'Dash', 'Number', 'Text'].map((title, index) => {
|
|
69
69
|
const variant = index === 0 ? 'default' : title.toLowerCase();
|
|
70
|
-
return createListSection(`${title} List`, variant);
|
|
70
|
+
return createListSection(`${title} List`, variant, variant);
|
|
71
71
|
})}
|
|
72
72
|
</div>
|
|
73
73
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { ListProps } from '../../lib/types/components';
|
|
3
3
|
import { LIST } from '../../lib/constants/components';
|
|
4
4
|
|
|
5
|
-
export const List: React.FC<ListProps> = ({
|
|
5
|
+
export const List: React.FC<ListProps> = memo(({
|
|
6
6
|
children,
|
|
7
7
|
variant = 'default',
|
|
8
8
|
className = '',
|
|
@@ -27,7 +27,7 @@ export const List: React.FC<ListProps> = ({
|
|
|
27
27
|
})}
|
|
28
28
|
</ListElement>
|
|
29
29
|
);
|
|
30
|
-
};
|
|
30
|
+
});
|
|
31
31
|
|
|
32
32
|
export type { ListProps };
|
|
33
33
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ListGroupProps } from '../../lib/types/components';
|
|
2
|
+
import { ListGroupProps as ListGroupPropsType } from '../../lib/types/components';
|
|
3
3
|
import { LIST_GROUP } from '../../lib/constants/components';
|
|
4
4
|
import { List } from './List';
|
|
5
5
|
|
|
6
|
+
export type ListGroupProps = ListGroupPropsType;
|
|
7
|
+
|
|
6
8
|
export const ListGroup: React.FC<ListGroupProps> = ({
|
|
7
9
|
children,
|
|
8
10
|
className = '',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState, useCallback, memo } from 'react';
|
|
2
2
|
import { ModalProps } from '../../lib/types/components';
|
|
3
3
|
import { MODAL } from '../../lib/constants/components';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
@@ -76,7 +76,7 @@ function useModal({
|
|
|
76
76
|
/**
|
|
77
77
|
* Modal component for displaying overlay content
|
|
78
78
|
*/
|
|
79
|
-
export const Modal: React.FC<ModalProps> = ({
|
|
79
|
+
export const Modal: React.FC<ModalProps> = memo(({
|
|
80
80
|
children,
|
|
81
81
|
isOpen = false,
|
|
82
82
|
onOpenChange,
|
|
@@ -213,7 +213,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
213
213
|
</div>
|
|
214
214
|
</div>
|
|
215
215
|
);
|
|
216
|
-
};
|
|
216
|
+
});
|
|
217
217
|
|
|
218
218
|
Modal.displayName = 'Modal';
|
|
219
219
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { Icon } from '../../Icon/Icon';
|
|
8
8
|
import { mapIconName } from './Menu'; // Import the mapping function
|
|
9
9
|
|
|
10
|
-
export const MegaMenu
|
|
10
|
+
export const MegaMenu = forwardRef<HTMLDivElement, MegaMenuProps>(
|
|
11
11
|
({ children, className = '', style, disabled = false }, ref) => {
|
|
12
12
|
return (
|
|
13
13
|
<div ref={ref} className={`c-menu c-menu--mega ${className}`} style={style}>
|
|
@@ -31,7 +31,9 @@ export const MegaMenu: React.FC<MegaMenuProps> = forwardRef<HTMLDivElement, Mega
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
MegaMenu.displayName = 'MegaMenu';
|
|
35
|
+
|
|
36
|
+
export const MegaMenuColumn = forwardRef<
|
|
35
37
|
HTMLDivElement,
|
|
36
38
|
MegaMenuColumnProps
|
|
37
39
|
>(({ title, icon, children, width = 'auto', className = '', disabled = false }, ref) => {
|
|
@@ -80,7 +82,9 @@ export const MegaMenuColumn: React.FC<MegaMenuColumnProps> = forwardRef<
|
|
|
80
82
|
);
|
|
81
83
|
});
|
|
82
84
|
|
|
83
|
-
|
|
85
|
+
MegaMenuColumn.displayName = 'MegaMenuColumn';
|
|
86
|
+
|
|
87
|
+
export const MegaMenuLink = forwardRef<
|
|
84
88
|
HTMLAnchorElement,
|
|
85
89
|
MegaMenuLinkProps
|
|
86
90
|
>(({ href, children, className = '', disabled = false, onClick }, ref) => {
|
|
@@ -107,3 +111,5 @@ export const MegaMenuLink: React.FC<MegaMenuLinkProps> = forwardRef<
|
|
|
107
111
|
</a>
|
|
108
112
|
);
|
|
109
113
|
});
|
|
114
|
+
|
|
115
|
+
MegaMenuLink.displayName = 'MegaMenuLink';
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef, ReactNode } from 'react';
|
|
|
2
2
|
import { MenuProps, MenuItemProps } from '../../../lib/types/components';
|
|
3
3
|
import { Icon } from '../../Icon/Icon';
|
|
4
4
|
|
|
5
|
-
export const Menu
|
|
5
|
+
export const Menu = forwardRef<HTMLDivElement, MenuProps>(
|
|
6
6
|
({ children, className = '', style, disabled = false }, ref) => {
|
|
7
7
|
return (
|
|
8
8
|
<div ref={ref} className={`c-menu ${className}`} style={style}>
|
|
@@ -24,6 +24,8 @@ export const Menu: React.FC<MenuProps> = forwardRef<HTMLDivElement, MenuProps>(
|
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
+
Menu.displayName = 'Menu';
|
|
28
|
+
|
|
27
29
|
export type { MenuProps, MenuItemProps, MenuDividerProps };
|
|
28
30
|
|
|
29
31
|
export default Menu;
|
|
@@ -35,7 +37,7 @@ interface MenuDividerProps {
|
|
|
35
37
|
className?: string;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
export const MenuItem
|
|
40
|
+
export const MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(
|
|
39
41
|
(
|
|
40
42
|
{ children, href = '#', icon, active = false, disabled = false, onClick, className = '' },
|
|
41
43
|
ref
|
|
@@ -83,6 +85,8 @@ export const MenuItem: React.FC<MenuItemProps> = forwardRef<HTMLLIElement, MenuI
|
|
|
83
85
|
}
|
|
84
86
|
);
|
|
85
87
|
|
|
88
|
+
MenuItem.displayName = 'MenuItem';
|
|
89
|
+
|
|
86
90
|
// Map icon-lux names to Phosphor icon names
|
|
87
91
|
export const mapIconName = (luxIconName: string): any => {
|
|
88
92
|
const iconMap: Record<string, any> = {
|
|
@@ -104,8 +108,10 @@ export const mapIconName = (luxIconName: string): any => {
|
|
|
104
108
|
return iconMap[luxIconName] || 'Circle'; // Default to Circle if no mapping found
|
|
105
109
|
};
|
|
106
110
|
|
|
107
|
-
export const MenuDivider
|
|
111
|
+
export const MenuDivider = forwardRef<HTMLLIElement, MenuDividerProps>(
|
|
108
112
|
({ className = '' }, ref) => {
|
|
109
113
|
return <li ref={ref} className={`c-menu__divider ${className}`} role="separator"></li>;
|
|
110
114
|
}
|
|
111
115
|
);
|
|
116
|
+
|
|
117
|
+
MenuDivider.displayName = 'MenuDivider';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { PaginationProps } from '../../lib/types/components';
|
|
3
3
|
import { usePagination, DOTS } from '../../lib/composables/usePagination';
|
|
4
4
|
import { PAGINATION_DEFAULTS } from '../../lib/constants/components';
|
|
@@ -26,7 +26,7 @@ interface PaginationNavButtonProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* PaginationNavButton component for rendering first, previous, next, and last buttons
|
|
28
28
|
*/
|
|
29
|
-
export const PaginationNavButton: React.FC<PaginationNavButtonProps> = ({
|
|
29
|
+
export const PaginationNavButton: React.FC<PaginationNavButtonProps> = memo(({
|
|
30
30
|
type,
|
|
31
31
|
onClick,
|
|
32
32
|
disabled,
|
|
@@ -47,12 +47,12 @@ export const PaginationNavButton: React.FC<PaginationNavButtonProps> = ({
|
|
|
47
47
|
<Icon name={iconName} size="sm" aria-hidden="true" />
|
|
48
48
|
</button>
|
|
49
49
|
</li>
|
|
50
|
-
);
|
|
50
|
+
));
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Pagination component
|
|
54
54
|
*/
|
|
55
|
-
export const Pagination: React.FC<PaginationProps> = ({
|
|
55
|
+
export const Pagination: React.FC<PaginationProps> = memo(({
|
|
56
56
|
currentPage = PAGINATION_DEFAULTS.currentPage,
|
|
57
57
|
totalPages = PAGINATION_DEFAULTS.totalPages,
|
|
58
58
|
onPageChange,
|
|
@@ -178,10 +178,11 @@ export const Pagination: React.FC<PaginationProps> = ({
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
return paginationContent;
|
|
181
|
-
};
|
|
181
|
+
});
|
|
182
182
|
|
|
183
183
|
export type { PaginationProps };
|
|
184
184
|
|
|
185
185
|
Pagination.displayName = 'Pagination';
|
|
186
|
+
PaginationNavButton.displayName = 'PaginationNavButton';
|
|
186
187
|
|
|
187
188
|
export default Pagination;
|
|
@@ -5,7 +5,7 @@ import React, { useRef, useEffect, useState } from 'react';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface PhotoViewerImageProps {
|
|
7
7
|
/** Ref to the image element */
|
|
8
|
-
imageRef: React.RefObject<HTMLImageElement
|
|
8
|
+
imageRef: React.RefObject<HTMLImageElement>;
|
|
9
9
|
/** Ref to the container element */
|
|
10
10
|
containerRef?: React.RefObject<HTMLDivElement | null>;
|
|
11
11
|
/** Image source URL */
|
|
@@ -134,7 +134,7 @@ export const PhotoViewerImage: React.FC<PhotoViewerImageProps> = ({
|
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
136
|
<div
|
|
137
|
-
ref={effectiveContainerRef}
|
|
137
|
+
ref={effectiveContainerRef as React.LegacyRef<HTMLDivElement>}
|
|
138
138
|
className={`c-photo-viewer__image-container ${isTransitioning ? 'is-transitioning' : ''}`}
|
|
139
139
|
style={{
|
|
140
140
|
cursor: isDragging ? 'grabbing' : zoomLevel > 1 ? 'grab' : 'default',
|
|
@@ -117,10 +117,8 @@ export const Popover: React.FC<PopoverProps> = ({
|
|
|
117
117
|
/**
|
|
118
118
|
* PopoverTrigger component to wrap the element that triggers the popover
|
|
119
119
|
*/
|
|
120
|
-
export const PopoverTrigger
|
|
121
|
-
|
|
122
|
-
PopoverTriggerProps
|
|
123
|
-
>(({ children, trigger: triggerProp }, ref) => {
|
|
120
|
+
export const PopoverTrigger = forwardRef<HTMLElement, PopoverTriggerProps>(
|
|
121
|
+
({ children, trigger: triggerProp }, ref) => {
|
|
124
122
|
const { isOpen, setIsOpen, triggerRef, popoverId, triggerType } =
|
|
125
123
|
React.useContext(PopoverContext);
|
|
126
124
|
|
|
@@ -159,6 +157,8 @@ export const PopoverTrigger: React.FC<PopoverTriggerProps> = forwardRef<
|
|
|
159
157
|
return React.cloneElement(child, triggerProps);
|
|
160
158
|
});
|
|
161
159
|
|
|
160
|
+
PopoverTrigger.displayName = 'PopoverTrigger';
|
|
161
|
+
|
|
162
162
|
export type { PopoverProps, PopoverTriggerProps };
|
|
163
163
|
|
|
164
164
|
Popover.displayName = 'Popover';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, memo } from 'react';
|
|
2
2
|
import { ProgressProps } from '../../lib/types/components';
|
|
3
3
|
import { useProgress } from '../../lib/composables/useProgress';
|
|
4
4
|
import { PROGRESS } from '../../lib/constants/components';
|
|
5
5
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
6
6
|
|
|
7
|
-
export const Progress =
|
|
7
|
+
export const Progress = memo(
|
|
8
|
+
forwardRef<HTMLDivElement, ProgressProps>(
|
|
8
9
|
(
|
|
9
10
|
{
|
|
10
11
|
value,
|
|
@@ -54,8 +55,11 @@ export const Progress = forwardRef<HTMLDivElement, ProgressProps>(
|
|
|
54
55
|
|
|
55
56
|
return progressContent;
|
|
56
57
|
}
|
|
58
|
+
)
|
|
57
59
|
);
|
|
58
60
|
|
|
61
|
+
Progress.displayName = 'Progress';
|
|
62
|
+
|
|
59
63
|
export type { ProgressProps };
|
|
60
64
|
|
|
61
65
|
export default Progress;
|