@shohojdhara/atomix 0.3.15 → 0.4.0
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/build-tools/index.d.ts +31 -30
- package/build-tools/package.json +4 -21
- package/dist/atomix.css +20924 -2611
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +76 -2
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/index.d.ts +31 -30
- package/dist/build-tools/package.json +4 -21
- package/dist/charts.js.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +144 -18
- package/dist/index.esm.js +110 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +110 -55
- 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.js.map +1 -1
- package/dist/theme.d.ts +9 -9
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +32 -23
- package/src/components/Accordion/Accordion.test.tsx +70 -50
- package/src/components/Accordion/Accordion.tsx +99 -94
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
- package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/glass-utils.ts +4 -3
- package/src/components/AtomixGlass/shader-utils.ts +128 -52
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -62
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +20 -9
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +14 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +9 -8
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
- package/src/components/Button/Button.stories.tsx +13 -22
- package/src/components/Button/Button.test.tsx +97 -81
- package/src/components/Button/Button.tsx +46 -14
- package/src/components/Button/ButtonGroup.stories.tsx +37 -32
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +109 -16
- package/src/components/Card/Card.stories.tsx +67 -36
- package/src/components/Card/Card.tsx +30 -14
- package/src/components/Chart/AreaChart.tsx +1 -1
- package/src/components/Chart/CandlestickChart.tsx +23 -16
- package/src/components/Chart/Chart.stories.tsx +4 -9
- package/src/components/Chart/Chart.tsx +40 -44
- package/src/components/Chart/ChartRenderer.tsx +39 -12
- package/src/components/Chart/ChartToolbar.tsx +21 -5
- package/src/components/Chart/DonutChart.tsx +1 -1
- package/src/components/Chart/FunnelChart.tsx +4 -1
- package/src/components/Chart/GaugeChart.tsx +3 -1
- package/src/components/Chart/HeatmapChart.tsx +50 -37
- package/src/components/Chart/LineChart.tsx +3 -2
- package/src/components/Chart/MultiAxisChart.tsx +24 -16
- package/src/components/Chart/RadarChart.tsx +19 -17
- package/src/components/Chart/ScatterChart.tsx +29 -21
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +6 -2
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +7 -7
- package/src/components/DataTable/DataTable.stories.tsx +43 -38
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +32 -47
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +2 -5
- package/src/components/Dropdown/Dropdown.tsx +313 -299
- package/src/components/EdgePanel/EdgePanel.stories.tsx +6 -19
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Footer/Footer.stories.tsx +21 -16
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.test.tsx +49 -49
- package/src/components/Form/Checkbox.tsx +108 -100
- package/src/components/Form/Form.stories.tsx +2 -10
- package/src/components/Form/Input.stories.tsx +22 -39
- package/src/components/Form/Input.test.tsx +38 -44
- package/src/components/Form/Radio.stories.tsx +6 -12
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.tsx +184 -182
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +56 -23
- package/src/components/Hero/Hero.tsx +201 -55
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.tsx +19 -23
- package/src/components/Modal/Modal.stories.tsx +2 -1
- package/src/components/Modal/Modal.tsx +130 -127
- package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
- package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
- package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
- package/src/components/Pagination/Pagination.stories.tsx +7 -4
- package/src/components/Pagination/Pagination.tsx +199 -202
- package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
- package/src/components/Popover/Popover.stories.tsx +99 -192
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +35 -44
- package/src/components/River/River.stories.tsx +2 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +71 -71
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +3 -1
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +8 -6
- package/src/components/Tabs/Tabs.stories.tsx +12 -9
- package/src/components/Tabs/Tabs.tsx +74 -72
- package/src/components/Toggle/Toggle.stories.tsx +27 -13
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +24 -20
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +129 -127
- package/src/components/Upload/Upload.tsx +287 -283
- package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
- package/src/components/index.ts +13 -2
- package/src/layouts/Grid/Grid.stories.tsx +9 -3
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
- package/src/lib/__tests__/theme-tools.test.ts +32 -6
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +106 -49
- package/src/lib/composables/useChartExport.ts +1 -1
- package/src/lib/composables/useDataTable.ts +29 -17
- package/src/lib/composables/useHero.ts +58 -14
- package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
- package/src/lib/composables/useInput.ts +10 -8
- package/src/lib/composables/useSideMenu.ts +6 -5
- package/src/lib/composables/useTooltip.ts +1 -2
- package/src/lib/composables/useVideoPlayer.ts +44 -35
- package/src/lib/config/index.ts +154 -154
- package/src/lib/constants/cssVariables.ts +29 -29
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
- package/src/lib/hooks/index.ts +1 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -17
- package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
- package/src/lib/patterns/__tests__/slots.test.ts +1 -1
- package/src/lib/patterns/index.ts +1 -1
- package/src/lib/patterns/slots.tsx +8 -13
- package/src/lib/storybook/InteractiveDemo.tsx +13 -18
- package/src/lib/storybook/PreviewContainer.tsx +1 -1
- package/src/lib/storybook/VariantsGrid.tsx +3 -7
- package/src/lib/storybook/index.ts +1 -1
- package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
- package/src/lib/theme/adapters/index.ts +3 -9
- package/src/lib/theme/adapters/themeAdapter.ts +41 -26
- package/src/lib/theme/config/index.ts +1 -1
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +10 -5
- package/src/lib/theme/constants/constants.ts +2 -2
- package/src/lib/theme/constants/index.ts +1 -2
- package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
- package/src/lib/theme/core/composeTheme.ts +32 -26
- package/src/lib/theme/core/createTheme.ts +1 -1
- package/src/lib/theme/core/createThemeObject.ts +308 -301
- package/src/lib/theme/core/index.ts +3 -3
- package/src/lib/theme/devtools/CLI.ts +106 -104
- package/src/lib/theme/devtools/Comparator.tsx +50 -32
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
- package/src/lib/theme/devtools/Inspector.tsx +75 -60
- package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
- package/src/lib/theme/devtools/Preview.tsx +150 -106
- package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
- package/src/lib/theme/devtools/index.ts +3 -9
- package/src/lib/theme/devtools/useHistory.ts +23 -21
- package/src/lib/theme/errors/errors.ts +12 -11
- package/src/lib/theme/errors/index.ts +2 -7
- package/src/lib/theme/generators/generateCSS.ts +9 -13
- package/src/lib/theme/generators/generateCSSNested.ts +1 -6
- package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
- package/src/lib/theme/generators/index.ts +1 -4
- package/src/lib/theme/i18n/index.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +13 -13
- package/src/lib/theme/index.ts +7 -16
- package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
- package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
- package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
- package/src/lib/theme/runtime/index.ts +2 -5
- package/src/lib/theme/runtime/useTheme.ts +18 -18
- package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
- package/src/lib/theme/test/testTheme.ts +15 -16
- package/src/lib/theme/tokens/index.ts +2 -7
- package/src/lib/theme/tokens/tokens.ts +25 -24
- package/src/lib/theme/types.ts +428 -411
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
- package/src/lib/theme/utils/componentTheming.ts +18 -18
- package/src/lib/theme/utils/domUtils.ts +277 -289
- package/src/lib/theme/utils/index.ts +1 -2
- package/src/lib/theme/utils/injectCSS.ts +10 -14
- package/src/lib/theme/utils/naming.ts +20 -16
- package/src/lib/theme/utils/themeHelpers.ts +10 -12
- package/src/lib/theme/utils/themeUtils.ts +85 -86
- package/src/lib/theme/utils/themeValidation.ts +82 -33
- package/src/lib/theme-tools.ts +8 -6
- package/src/lib/types/components.ts +172 -71
- package/src/lib/types/partProps.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +1 -1
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +3 -1
- package/src/lib/utils/dataTableExport.ts +1 -5
- package/src/lib/utils/fontPreloader.ts +10 -19
- package/src/lib/utils/icons.ts +4 -1
- package/src/lib/utils/index.ts +2 -6
- package/src/lib/utils/memoryMonitor.ts +10 -8
- package/src/lib/utils/themeNaming.ts +2 -2
- package/src/styles/01-settings/_index.scss +0 -1
- package/src/styles/01-settings/_settings.colors.scss +8 -8
- package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/01-settings/_settings.spacing.scss +3 -4
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/01-settings/_settings.typography.scss +1 -1
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +30 -18
- package/src/styles/03-generic/_generic.root.scss +4 -3
- package/src/styles/06-components/_components.atomix-glass.scss +13 -9
- package/src/styles/06-components/_components.button.scss +16 -4
- package/src/styles/06-components/_components.callout.scss +27 -21
- package/src/styles/06-components/_components.card.scss +5 -14
- package/src/styles/06-components/_components.chart.scss +22 -19
- package/src/styles/06-components/_components.checkbox.scss +3 -1
- package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
- package/src/styles/06-components/_components.edge-panel.scss +9 -2
- package/src/styles/06-components/_components.footer.scss +1 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -5
- package/src/styles/06-components/_components.toggle.scss +18 -0
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/06-components/old.chart.styles.scss +0 -2
- package/src/styles/99-utilities/_utilities.border.scss +69 -27
- package/src/styles/99-utilities/_utilities.display.scss +1 -1
- package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
- package/src/styles/99-utilities/_utilities.position.scss +16 -9
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
- package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
- package/src/styles/99-utilities/_utilities.text-gradient.scss +30 -30
- package/src/styles/99-utilities/_utilities.text.scss +67 -46
|
@@ -24,241 +24,238 @@ interface PaginationNavButtonProps {
|
|
|
24
24
|
/**
|
|
25
25
|
* PaginationNavButton component for rendering first, previous, next, and last buttons
|
|
26
26
|
*/
|
|
27
|
-
export const PaginationNavButton: React.FC<PaginationNavButtonProps> = memo(
|
|
28
|
-
type,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
iconName,
|
|
33
|
-
}) => (
|
|
34
|
-
<li
|
|
35
|
-
className={`c-pagination__item c-pagination__item--${type} ${disabled ? 'is-disabled' : ''}`}
|
|
36
|
-
aria-disabled={disabled}
|
|
37
|
-
>
|
|
38
|
-
<button
|
|
39
|
-
type="button"
|
|
40
|
-
className="c-pagination__link"
|
|
41
|
-
onClick={onClick}
|
|
42
|
-
disabled={disabled}
|
|
43
|
-
aria-label={label}
|
|
27
|
+
export const PaginationNavButton: React.FC<PaginationNavButtonProps> = memo(
|
|
28
|
+
({ type, onClick, disabled, label, iconName }) => (
|
|
29
|
+
<li
|
|
30
|
+
className={`c-pagination__item c-pagination__item--${type} ${disabled ? 'is-disabled' : ''}`}
|
|
31
|
+
aria-disabled={disabled}
|
|
44
32
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
<button
|
|
34
|
+
type="button"
|
|
35
|
+
className="c-pagination__link"
|
|
36
|
+
onClick={onClick}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
aria-label={label}
|
|
39
|
+
>
|
|
40
|
+
<Icon name={iconName} size="sm" aria-hidden="true" />
|
|
41
|
+
</button>
|
|
42
|
+
</li>
|
|
43
|
+
)
|
|
44
|
+
);
|
|
49
45
|
|
|
50
46
|
/**
|
|
51
47
|
* Pagination component
|
|
52
48
|
*/
|
|
53
|
-
export const Pagination: React.FC<PaginationProps> = memo(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
siblingCount = PAGINATION_DEFAULTS.siblingCount,
|
|
58
|
-
showFirstLastButtons = PAGINATION_DEFAULTS.showFirstLastButtons,
|
|
59
|
-
showPrevNextButtons = PAGINATION_DEFAULTS.showPrevNextButtons,
|
|
60
|
-
showSearch = false,
|
|
61
|
-
searchPlaceholder = 'Go to page',
|
|
62
|
-
size = PAGINATION_DEFAULTS.size,
|
|
63
|
-
className = '',
|
|
64
|
-
style,
|
|
65
|
-
'aria-label': ariaLabel = 'Pagination',
|
|
66
|
-
glass,
|
|
67
|
-
}) => {
|
|
68
|
-
const { paginationRange, goToPage, nextPage, prevPage, firstPage, lastPage } = usePagination({
|
|
69
|
-
currentPage,
|
|
70
|
-
totalPages,
|
|
71
|
-
siblingCount,
|
|
49
|
+
export const Pagination: React.FC<PaginationProps> = memo(
|
|
50
|
+
({
|
|
51
|
+
currentPage = PAGINATION_DEFAULTS.currentPage,
|
|
52
|
+
totalPages = PAGINATION_DEFAULTS.totalPages,
|
|
72
53
|
onPageChange,
|
|
73
|
-
|
|
54
|
+
siblingCount = PAGINATION_DEFAULTS.siblingCount,
|
|
55
|
+
showFirstLastButtons = PAGINATION_DEFAULTS.showFirstLastButtons,
|
|
56
|
+
showPrevNextButtons = PAGINATION_DEFAULTS.showPrevNextButtons,
|
|
57
|
+
showSearch = false,
|
|
58
|
+
searchPlaceholder = 'Go to page',
|
|
59
|
+
size = PAGINATION_DEFAULTS.size,
|
|
60
|
+
className = '',
|
|
61
|
+
style,
|
|
62
|
+
'aria-label': ariaLabel = 'Pagination',
|
|
63
|
+
glass,
|
|
64
|
+
}) => {
|
|
65
|
+
const { paginationRange, goToPage, nextPage, prevPage, firstPage, lastPage } = usePagination({
|
|
66
|
+
currentPage,
|
|
67
|
+
totalPages,
|
|
68
|
+
siblingCount,
|
|
69
|
+
onPageChange,
|
|
70
|
+
});
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const [searchValue, setSearchValue] = useState<string>('');
|
|
73
|
+
const [searchError, setSearchError] = useState<string>('');
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
// Don't render pagination with a single page or no pages
|
|
76
|
+
if (currentPage === 0 || paginationRange.length < 2) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const handleSearchSubmit = (e: FormEvent<HTMLFormElement>) => {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
setSearchError('');
|
|
86
83
|
|
|
87
|
-
|
|
84
|
+
const pageNumber = parseInt(searchValue, 10);
|
|
88
85
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
if (isNaN(pageNumber)) {
|
|
87
|
+
setSearchError('Please enter a valid page number');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
93
90
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
if (pageNumber < 1 || pageNumber > totalPages) {
|
|
92
|
+
setSearchError(`Page must be between 1 and ${totalPages}`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
if (pageNumber === currentPage) {
|
|
97
|
+
setSearchError('You are already on this page');
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
goToPage(pageNumber);
|
|
102
|
+
setSearchValue('');
|
|
103
|
+
};
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
106
|
+
const value = e.target.value;
|
|
107
|
+
// Only allow numbers
|
|
108
|
+
if (value === '' || /^\d+$/.test(value)) {
|
|
109
|
+
setSearchValue(value);
|
|
110
|
+
setSearchError('');
|
|
111
|
+
}
|
|
112
|
+
};
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
const paginationContent = (
|
|
115
|
+
<nav
|
|
116
|
+
className={`c-pagination c-pagination--${size} ${className}`}
|
|
117
|
+
style={style}
|
|
118
|
+
aria-label={ariaLabel}
|
|
119
|
+
>
|
|
120
|
+
<ul className="c-pagination__items">
|
|
121
|
+
{showFirstLastButtons && (
|
|
122
|
+
<PaginationNavButton
|
|
123
|
+
type="first"
|
|
124
|
+
onClick={firstPage}
|
|
125
|
+
disabled={currentPage === 1}
|
|
126
|
+
label="Go to first page"
|
|
127
|
+
iconName="SkipBack"
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
133
130
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
{showPrevNextButtons && (
|
|
132
|
+
<PaginationNavButton
|
|
133
|
+
type="prev"
|
|
134
|
+
onClick={prevPage}
|
|
135
|
+
disabled={currentPage === 1}
|
|
136
|
+
label="Go to previous page"
|
|
137
|
+
iconName="CaretLeft"
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
|
|
141
|
+
{paginationRange.map((pageNumber, index) => {
|
|
142
|
+
if (pageNumber === DOTS) {
|
|
143
|
+
return (
|
|
144
|
+
<li
|
|
145
|
+
key={`dots-${index}`}
|
|
146
|
+
className="c-pagination__item c-pagination__item--dots"
|
|
147
|
+
aria-hidden="true"
|
|
148
|
+
>
|
|
149
|
+
…
|
|
150
|
+
</li>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const isActive = pageNumber === currentPage;
|
|
143
155
|
|
|
144
|
-
{paginationRange.map((pageNumber, index) => {
|
|
145
|
-
if (pageNumber === DOTS) {
|
|
146
156
|
return (
|
|
147
157
|
<li
|
|
148
|
-
key={
|
|
149
|
-
className=
|
|
150
|
-
aria-
|
|
158
|
+
key={pageNumber}
|
|
159
|
+
className={`c-pagination__item ${isActive ? 'is-active' : ''}`}
|
|
160
|
+
aria-current={isActive ? 'page' : undefined}
|
|
151
161
|
>
|
|
152
|
-
|
|
162
|
+
<button
|
|
163
|
+
type="button"
|
|
164
|
+
className="c-pagination__link"
|
|
165
|
+
onClick={() => goToPage(pageNumber as number)}
|
|
166
|
+
aria-label={`Page ${pageNumber}`}
|
|
167
|
+
aria-current={isActive ? 'page' : undefined}
|
|
168
|
+
>
|
|
169
|
+
{pageNumber}
|
|
170
|
+
</button>
|
|
153
171
|
</li>
|
|
154
172
|
);
|
|
155
|
-
}
|
|
173
|
+
})}
|
|
156
174
|
|
|
157
|
-
|
|
175
|
+
{showPrevNextButtons && (
|
|
176
|
+
<PaginationNavButton
|
|
177
|
+
type="next"
|
|
178
|
+
onClick={nextPage}
|
|
179
|
+
disabled={currentPage === totalPages}
|
|
180
|
+
label="Go to next page"
|
|
181
|
+
iconName="CaretRight"
|
|
182
|
+
/>
|
|
183
|
+
)}
|
|
158
184
|
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
185
|
+
{showFirstLastButtons && (
|
|
186
|
+
<PaginationNavButton
|
|
187
|
+
type="last"
|
|
188
|
+
onClick={lastPage}
|
|
189
|
+
disabled={currentPage === totalPages}
|
|
190
|
+
label="Go to last page"
|
|
191
|
+
iconName="SkipForward"
|
|
192
|
+
/>
|
|
193
|
+
)}
|
|
194
|
+
</ul>
|
|
195
|
+
|
|
196
|
+
{showSearch && (
|
|
197
|
+
<form
|
|
198
|
+
className="c-pagination__search"
|
|
199
|
+
onSubmit={handleSearchSubmit}
|
|
200
|
+
aria-label="Jump to page"
|
|
201
|
+
>
|
|
202
|
+
<div className="c-pagination__search-wrapper">
|
|
203
|
+
<label
|
|
204
|
+
htmlFor={`pagination-search-${currentPage}`}
|
|
205
|
+
className="c-pagination__search-label"
|
|
171
206
|
>
|
|
172
|
-
|
|
207
|
+
<span className="c-pagination__search-label-text">Go to page:</span>
|
|
208
|
+
<input
|
|
209
|
+
id={`pagination-search-${currentPage}`}
|
|
210
|
+
type="text"
|
|
211
|
+
inputMode="numeric"
|
|
212
|
+
pattern="[0-9]*"
|
|
213
|
+
className={`c-pagination__search-input ${searchError ? 'is-error' : ''}`}
|
|
214
|
+
placeholder={searchPlaceholder}
|
|
215
|
+
value={searchValue}
|
|
216
|
+
onChange={handleSearchChange}
|
|
217
|
+
aria-label="Page number"
|
|
218
|
+
aria-invalid={searchError ? 'true' : 'false'}
|
|
219
|
+
aria-describedby={searchError ? `pagination-error-${currentPage}` : undefined}
|
|
220
|
+
/>
|
|
221
|
+
</label>
|
|
222
|
+
<button type="submit" className="c-pagination__search-button" aria-label="Go to page">
|
|
223
|
+
<Icon name="ArrowRight" size="sm" aria-hidden="true" />
|
|
173
224
|
</button>
|
|
174
|
-
</
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
/>
|
|
186
|
-
)}
|
|
187
|
-
|
|
188
|
-
{showFirstLastButtons && (
|
|
189
|
-
<PaginationNavButton
|
|
190
|
-
type="last"
|
|
191
|
-
onClick={lastPage}
|
|
192
|
-
disabled={currentPage === totalPages}
|
|
193
|
-
label="Go to last page"
|
|
194
|
-
iconName="SkipForward"
|
|
195
|
-
/>
|
|
225
|
+
</div>
|
|
226
|
+
{searchError && (
|
|
227
|
+
<div
|
|
228
|
+
id={`pagination-error-${currentPage}`}
|
|
229
|
+
className="c-pagination__search-error"
|
|
230
|
+
role="alert"
|
|
231
|
+
>
|
|
232
|
+
{searchError}
|
|
233
|
+
</div>
|
|
234
|
+
)}
|
|
235
|
+
</form>
|
|
196
236
|
)}
|
|
197
|
-
</
|
|
237
|
+
</nav>
|
|
238
|
+
);
|
|
198
239
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
id={`pagination-search-${currentPage}`}
|
|
210
|
-
type="text"
|
|
211
|
-
inputMode="numeric"
|
|
212
|
-
pattern="[0-9]*"
|
|
213
|
-
className={`c-pagination__search-input ${searchError ? 'is-error' : ''}`}
|
|
214
|
-
placeholder={searchPlaceholder}
|
|
215
|
-
value={searchValue}
|
|
216
|
-
onChange={handleSearchChange}
|
|
217
|
-
aria-label="Page number"
|
|
218
|
-
aria-invalid={searchError ? 'true' : 'false'}
|
|
219
|
-
aria-describedby={searchError ? `pagination-error-${currentPage}` : undefined}
|
|
220
|
-
/>
|
|
221
|
-
</label>
|
|
222
|
-
<button
|
|
223
|
-
type="submit"
|
|
224
|
-
className="c-pagination__search-button"
|
|
225
|
-
aria-label="Go to page"
|
|
226
|
-
>
|
|
227
|
-
<Icon name="ArrowRight" size="sm" aria-hidden="true" />
|
|
228
|
-
</button>
|
|
229
|
-
</div>
|
|
230
|
-
{searchError && (
|
|
231
|
-
<div
|
|
232
|
-
id={`pagination-error-${currentPage}`}
|
|
233
|
-
className="c-pagination__search-error"
|
|
234
|
-
role="alert"
|
|
235
|
-
>
|
|
236
|
-
{searchError}
|
|
237
|
-
</div>
|
|
238
|
-
)}
|
|
239
|
-
</form>
|
|
240
|
-
)}
|
|
241
|
-
</nav>
|
|
242
|
-
);
|
|
240
|
+
if (glass) {
|
|
241
|
+
// Default glass settings for pagination
|
|
242
|
+
const defaultGlassProps = {
|
|
243
|
+
displacementScale: 60,
|
|
244
|
+
blurAmount: 1,
|
|
245
|
+
saturation: 160,
|
|
246
|
+
aberrationIntensity: 0.5,
|
|
247
|
+
cornerRadius: 8,
|
|
248
|
+
mode: 'shader' as const,
|
|
249
|
+
};
|
|
243
250
|
|
|
244
|
-
|
|
245
|
-
// Default glass settings for pagination
|
|
246
|
-
const defaultGlassProps = {
|
|
247
|
-
displacementScale: 60,
|
|
248
|
-
blurAmount: 1,
|
|
249
|
-
saturation: 160,
|
|
250
|
-
aberrationIntensity: 0.5,
|
|
251
|
-
cornerRadius: 8,
|
|
252
|
-
mode: 'shader' as const,
|
|
253
|
-
};
|
|
251
|
+
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
254
252
|
|
|
255
|
-
|
|
253
|
+
return <AtomixGlass {...glassProps}>{paginationContent}</AtomixGlass>;
|
|
254
|
+
}
|
|
256
255
|
|
|
257
|
-
return
|
|
256
|
+
return paginationContent;
|
|
258
257
|
}
|
|
259
|
-
|
|
260
|
-
return paginationContent;
|
|
261
|
-
});
|
|
258
|
+
);
|
|
262
259
|
|
|
263
260
|
export type { PaginationProps };
|
|
264
261
|
|
|
@@ -111,7 +111,10 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
|
|
|
111
111
|
|
|
112
112
|
const link = document.createElement('a');
|
|
113
113
|
link.href = currentImage.src;
|
|
114
|
-
const sanitizedTitle = (currentImage.title || `image-${currentIndex + 1}`).replace(
|
|
114
|
+
const sanitizedTitle = (currentImage.title || `image-${currentIndex + 1}`).replace(
|
|
115
|
+
/[^a-zA-Z0-9.-]/g,
|
|
116
|
+
'_'
|
|
117
|
+
);
|
|
115
118
|
link.download = sanitizedTitle;
|
|
116
119
|
document.body.appendChild(link);
|
|
117
120
|
link.click();
|