@asantemedia-org/leybold-design-system 1.0.3 → 1.0.4
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 +29 -1
- package/dist/index.js +26 -34
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -58,6 +58,34 @@ npm run build
|
|
|
58
58
|
npm run build:npm
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### Publishing to npm
|
|
62
|
+
|
|
63
|
+
Publishing requires an npm access token with publish permissions for the `@asantemedia-org` organization.
|
|
64
|
+
|
|
65
|
+
#### Setup Access Token
|
|
66
|
+
|
|
67
|
+
1. Generate an access token at [npmjs.com](https://www.npmjs.com) → Access Tokens
|
|
68
|
+
2. Configure the token:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm config set //registry.npmjs.org/:_authToken YOUR_ACCESS_TOKEN
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Publish
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run build:npm
|
|
78
|
+
npm run publish:npm
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or to bump version and publish in one step:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm run build:npm
|
|
85
|
+
npm version patch # or minor/major
|
|
86
|
+
npm publish --access public
|
|
87
|
+
```
|
|
88
|
+
|
|
61
89
|
### Project Structure
|
|
62
90
|
|
|
63
91
|
```
|
|
@@ -127,9 +155,9 @@ The design system follows the Atomic Design methodology:
|
|
|
127
155
|
6. **Templates** - Complete page layouts
|
|
128
156
|
|
|
129
157
|
Each component should include:
|
|
158
|
+
|
|
130
159
|
- Component implementation
|
|
131
160
|
- Storybook stories with different variants
|
|
132
161
|
- Documentation
|
|
133
162
|
- TypeScript types
|
|
134
163
|
- SCSS modules for styling
|
|
135
|
-
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var edwardsvacuumDesignSystem = require('@asantemedia-org/edwardsvacuum-design-system');
|
|
1
|
+
import React, { useMemo, useState, useCallback, useRef, useEffect } from 'react';
|
|
2
|
+
import { ProductDetailsCard, AlgoliaDynamicSearchRaw, QrForm } from '@asantemedia-org/edwardsvacuum-design-system';
|
|
5
3
|
|
|
6
4
|
function _extends() {
|
|
7
5
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -277,7 +275,7 @@ const Pagination = ({
|
|
|
277
275
|
className,
|
|
278
276
|
ariaLabel = "Pagination"
|
|
279
277
|
}) => {
|
|
280
|
-
const pageNumbers =
|
|
278
|
+
const pageNumbers = useMemo(() => generatePageNumbers(currentPage, totalPages, maxVisiblePages), [currentPage, totalPages, maxVisiblePages]);
|
|
281
279
|
const handlePageChange = page => {
|
|
282
280
|
if (page >= 1 && page <= totalPages && page !== currentPage) {
|
|
283
281
|
onPageChange(page);
|
|
@@ -349,15 +347,15 @@ const Image = ({
|
|
|
349
347
|
srcSet,
|
|
350
348
|
sizes
|
|
351
349
|
}) => {
|
|
352
|
-
const [isLoading, setIsLoading] =
|
|
353
|
-
const [hasError, setHasError] =
|
|
354
|
-
const [currentSrc, setCurrentSrc] =
|
|
355
|
-
const handleLoad =
|
|
350
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
351
|
+
const [hasError, setHasError] = useState(false);
|
|
352
|
+
const [currentSrc, setCurrentSrc] = useState(src);
|
|
353
|
+
const handleLoad = useCallback(() => {
|
|
356
354
|
setIsLoading(false);
|
|
357
355
|
setHasError(false);
|
|
358
356
|
onLoad?.();
|
|
359
357
|
}, [onLoad]);
|
|
360
|
-
const handleError =
|
|
358
|
+
const handleError = useCallback(() => {
|
|
361
359
|
setIsLoading(false);
|
|
362
360
|
setHasError(true);
|
|
363
361
|
|
|
@@ -536,7 +534,7 @@ const ProductCardDetails = ({
|
|
|
536
534
|
};
|
|
537
535
|
return /*#__PURE__*/React.createElement("div", {
|
|
538
536
|
className: styles$b.productDetails
|
|
539
|
-
}, /*#__PURE__*/React.createElement(
|
|
537
|
+
}, /*#__PURE__*/React.createElement(ProductDetailsCard, {
|
|
540
538
|
className: `${className}`,
|
|
541
539
|
title: title,
|
|
542
540
|
imageUrl: imageUrl,
|
|
@@ -615,7 +613,7 @@ const AlgoliaDynamicSearchLeybold = props => {
|
|
|
615
613
|
ProductCard: ProductCardAdapter,
|
|
616
614
|
ProductDetailsCard: ProductCardDetailsAdapter
|
|
617
615
|
};
|
|
618
|
-
return /*#__PURE__*/React.createElement(
|
|
616
|
+
return /*#__PURE__*/React.createElement(AlgoliaDynamicSearchRaw, _extends({}, props, {
|
|
619
617
|
innerComponents: innerComponents
|
|
620
618
|
}));
|
|
621
619
|
};
|
|
@@ -666,7 +664,7 @@ const QrFormButtonAdapter = ({
|
|
|
666
664
|
const QrFormLeybold = props => {
|
|
667
665
|
return /*#__PURE__*/React.createElement("div", {
|
|
668
666
|
className: "qr-journey-form-wrapper"
|
|
669
|
-
}, /*#__PURE__*/React.createElement(
|
|
667
|
+
}, /*#__PURE__*/React.createElement(QrForm, _extends({}, props, {
|
|
670
668
|
ButtonComponent: QrFormButtonAdapter
|
|
671
669
|
})));
|
|
672
670
|
};
|
|
@@ -712,9 +710,9 @@ const SearchModal = ({
|
|
|
712
710
|
children,
|
|
713
711
|
className = ''
|
|
714
712
|
}) => {
|
|
715
|
-
const modalRef =
|
|
716
|
-
const previouslyFocusedElement =
|
|
717
|
-
|
|
713
|
+
const modalRef = useRef(null);
|
|
714
|
+
const previouslyFocusedElement = useRef(null);
|
|
715
|
+
useEffect(() => {
|
|
718
716
|
if (isOpen) {
|
|
719
717
|
// Store the previously focused element
|
|
720
718
|
previouslyFocusedElement.current = document.activeElement;
|
|
@@ -739,7 +737,7 @@ const SearchModal = ({
|
|
|
739
737
|
document.body.style.overflow = '';
|
|
740
738
|
};
|
|
741
739
|
}, [isOpen]);
|
|
742
|
-
|
|
740
|
+
useEffect(() => {
|
|
743
741
|
const handleEscape = event => {
|
|
744
742
|
if (event.key === 'Escape' && isOpen) {
|
|
745
743
|
onClose();
|
|
@@ -750,7 +748,7 @@ const SearchModal = ({
|
|
|
750
748
|
}, [isOpen, onClose]);
|
|
751
749
|
|
|
752
750
|
// Focus trap implementation
|
|
753
|
-
|
|
751
|
+
useEffect(() => {
|
|
754
752
|
if (!isOpen || !modalRef.current) return;
|
|
755
753
|
const modal = modalRef.current;
|
|
756
754
|
const focusableElements = modal.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
@@ -1167,10 +1165,10 @@ const FilterAccordion = ({
|
|
|
1167
1165
|
onValueToggle,
|
|
1168
1166
|
className
|
|
1169
1167
|
}) => {
|
|
1170
|
-
const [searchQuery, setSearchQuery] =
|
|
1168
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
1171
1169
|
|
|
1172
1170
|
// Filter facet values based on search query
|
|
1173
|
-
const filteredValues =
|
|
1171
|
+
const filteredValues = useMemo(() => {
|
|
1174
1172
|
if (!searchQuery.trim()) {
|
|
1175
1173
|
return facet.values;
|
|
1176
1174
|
}
|
|
@@ -1293,7 +1291,7 @@ const AppliedFilters = ({
|
|
|
1293
1291
|
className
|
|
1294
1292
|
}) => {
|
|
1295
1293
|
// Extract all refined (selected) filters
|
|
1296
|
-
const appliedFilters =
|
|
1294
|
+
const appliedFilters = useMemo(() => {
|
|
1297
1295
|
const filters = [];
|
|
1298
1296
|
facets.forEach(facet => {
|
|
1299
1297
|
facet.values.forEach(value => {
|
|
@@ -1358,7 +1356,7 @@ const FiltersPanel = ({
|
|
|
1358
1356
|
className
|
|
1359
1357
|
}) => {
|
|
1360
1358
|
// Track which accordions are expanded
|
|
1361
|
-
const [expandedAccordions, setExpandedAccordions] =
|
|
1359
|
+
const [expandedAccordions, setExpandedAccordions] = useState(() => {
|
|
1362
1360
|
// Initialize with default expanded facets
|
|
1363
1361
|
const expanded = new Set();
|
|
1364
1362
|
facets.forEach(facet => {
|
|
@@ -1368,7 +1366,7 @@ const FiltersPanel = ({
|
|
|
1368
1366
|
});
|
|
1369
1367
|
return expanded;
|
|
1370
1368
|
});
|
|
1371
|
-
const handleAccordionToggle =
|
|
1369
|
+
const handleAccordionToggle = useCallback(facetId => {
|
|
1372
1370
|
setExpandedAccordions(prev => {
|
|
1373
1371
|
const next = new Set(prev);
|
|
1374
1372
|
if (next.has(facetId)) {
|
|
@@ -1379,13 +1377,13 @@ const FiltersPanel = ({
|
|
|
1379
1377
|
return next;
|
|
1380
1378
|
});
|
|
1381
1379
|
}, []);
|
|
1382
|
-
const handleValueToggle =
|
|
1380
|
+
const handleValueToggle = useCallback((attribute, value) => {
|
|
1383
1381
|
onFacetToggle(attribute, value);
|
|
1384
1382
|
}, [onFacetToggle]);
|
|
1385
|
-
const handleRemoveFilter =
|
|
1383
|
+
const handleRemoveFilter = useCallback((attribute, value) => {
|
|
1386
1384
|
onFacetToggle(attribute, value);
|
|
1387
1385
|
}, [onFacetToggle]);
|
|
1388
|
-
const handleClearAll =
|
|
1386
|
+
const handleClearAll = useCallback(() => {
|
|
1389
1387
|
// Remove all refined facets
|
|
1390
1388
|
facets.forEach(facet => {
|
|
1391
1389
|
facet.values.forEach(value => {
|
|
@@ -1773,14 +1771,8 @@ const SearchTriggerButton = ({
|
|
|
1773
1771
|
}, label));
|
|
1774
1772
|
};
|
|
1775
1773
|
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
exports.AppliedFilters = AppliedFilters;
|
|
1779
|
-
exports.Button = Button;
|
|
1780
|
-
exports.ContentCardHorizontal = ContentCardHorizontal;
|
|
1781
|
-
exports.FederatedInstantResultsLayout = FederatedInstantResultsLayout;
|
|
1782
|
-
exports.FederatedResultsView = FederatedResultsView;
|
|
1783
|
-
exports.FederatedSearchExperience = FederatedSearchExperience;
|
|
1774
|
+
export { AlgoliaDynamicSearchLeybold, AppliedFilterTag, AppliedFilters, Button, ContentCardHorizontal, FederatedInstantResultsLayout, FederatedResultsView, FederatedSearchExperience, FilterAccordion, FilterItem, FilterSearch, FiltersPanel, ModalCloseButton, Pagination, PaginationButton, PaginationEllipsis, PaginationItem, ProductCardHorizontal, QrFormLeybold, ResultsColumn, ResultsCount, ResultsList, SearchBar, SearchIcon, SearchInput, SearchModal, SearchSubmitButton, SearchTriggerButton, SeeAllLinkButton };
|
|
1775
|
+
ence = FederatedSearchExperience;
|
|
1784
1776
|
exports.FilterAccordion = FilterAccordion;
|
|
1785
1777
|
exports.FilterItem = FilterItem;
|
|
1786
1778
|
exports.FilterSearch = FilterSearch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asantemedia-org/leybold-design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Design system for Leybold",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -96,7 +96,8 @@
|
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"react": ">=18.2.0",
|
|
99
|
-
"react-dom": ">=18.2.0"
|
|
99
|
+
"react-dom": ">=18.2.0",
|
|
100
|
+
"@asantemedia-org/edwardsvacuum-design-system": ">=1.6.52"
|
|
100
101
|
},
|
|
101
102
|
"publishConfig": {
|
|
102
103
|
"access": "public"
|