@asantemedia-org/edwardsvacuum-design-system 1.6.35 → 1.6.37
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/index.esm.js +47 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +79 -58
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
|
|
2
2
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import {
|
|
3
|
+
import { faChevronRight, faArrowRight } from '@fortawesome/pro-solid-svg-icons';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
5
5
|
|
|
6
6
|
/******************************************************************************
|
|
@@ -239,6 +239,25 @@ function requireClassnames() {
|
|
|
239
239
|
var classnamesExports = requireClassnames();
|
|
240
240
|
var classnames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
241
241
|
|
|
242
|
+
// Simple chevron SVG to avoid FontAwesome dependency issues
|
|
243
|
+
var ChevronIcon = function (_a) {
|
|
244
|
+
var isOpen = _a.isOpen;
|
|
245
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
246
|
+
width: "12",
|
|
247
|
+
height: "12",
|
|
248
|
+
viewBox: "0 0 12 12",
|
|
249
|
+
fill: "none",
|
|
250
|
+
style: {
|
|
251
|
+
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
252
|
+
transition: 'transform 0.2s ease'
|
|
253
|
+
}
|
|
254
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
255
|
+
d: "M2 4L6 8L10 4",
|
|
256
|
+
stroke: "#C4262E",
|
|
257
|
+
strokeWidth: "2",
|
|
258
|
+
strokeLinecap: "round"
|
|
259
|
+
}));
|
|
260
|
+
};
|
|
242
261
|
var AccordionSection = function (_a) {
|
|
243
262
|
var title = _a.title,
|
|
244
263
|
children = _a.children,
|
|
@@ -254,27 +273,32 @@ var AccordionSection = function (_a) {
|
|
|
254
273
|
var _f = useState(defaultOpen),
|
|
255
274
|
hasBeenOpened = _f[0],
|
|
256
275
|
setHasBeenOpened = _f[1];
|
|
257
|
-
// Prevent rapid clicks
|
|
276
|
+
// Prevent rapid clicks
|
|
258
277
|
var isToggling = useRef(false);
|
|
259
|
-
var toggleAccordion = useCallback(function () {
|
|
278
|
+
var toggleAccordion = useCallback(function (e) {
|
|
279
|
+
// Stop event propagation to prevent AEM handlers
|
|
280
|
+
e.stopPropagation();
|
|
281
|
+
e.preventDefault();
|
|
260
282
|
// Prevent multiple rapid toggles
|
|
261
283
|
if (isToggling.current) return;
|
|
262
284
|
isToggling.current = true;
|
|
263
|
-
|
|
264
|
-
|
|
285
|
+
// Use requestAnimationFrame to defer state update
|
|
286
|
+
requestAnimationFrame(function () {
|
|
287
|
+
setIsOpen(function (prev) {
|
|
288
|
+
return !prev;
|
|
289
|
+
});
|
|
290
|
+
if (!hasBeenOpened) {
|
|
291
|
+
setHasBeenOpened(true);
|
|
292
|
+
}
|
|
293
|
+
// Reset toggle lock
|
|
294
|
+
setTimeout(function () {
|
|
295
|
+
isToggling.current = false;
|
|
296
|
+
}, 300);
|
|
265
297
|
});
|
|
266
|
-
if (!hasBeenOpened) {
|
|
267
|
-
setHasBeenOpened(true);
|
|
268
|
-
}
|
|
269
|
-
// Reset toggle lock after animation
|
|
270
|
-
setTimeout(function () {
|
|
271
|
-
isToggling.current = false;
|
|
272
|
-
}, 350);
|
|
273
298
|
}, [hasBeenOpened]);
|
|
274
299
|
var handleKeyDown = useCallback(function (e) {
|
|
275
300
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
276
|
-
e
|
|
277
|
-
toggleAccordion();
|
|
301
|
+
toggleAccordion(e);
|
|
278
302
|
}
|
|
279
303
|
}, [toggleAccordion]);
|
|
280
304
|
// Only render children if not lazy loading, or if accordion has been opened
|
|
@@ -291,12 +315,16 @@ var AccordionSection = function (_a) {
|
|
|
291
315
|
}, /*#__PURE__*/React.createElement("span", {
|
|
292
316
|
className: "accordion-section__title"
|
|
293
317
|
}, title), /*#__PURE__*/React.createElement("span", {
|
|
294
|
-
className: "accordion-section__icon
|
|
295
|
-
}, /*#__PURE__*/React.createElement(
|
|
296
|
-
|
|
297
|
-
color: "#C4262EFF"
|
|
318
|
+
className: "accordion-section__icon"
|
|
319
|
+
}, /*#__PURE__*/React.createElement(ChevronIcon, {
|
|
320
|
+
isOpen: isOpen
|
|
298
321
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
299
|
-
className: "accordion-section__content
|
|
322
|
+
className: "accordion-section__content",
|
|
323
|
+
style: {
|
|
324
|
+
display: isOpen ? 'block' : 'none',
|
|
325
|
+
maxHeight: isOpen ? 'none' : '0',
|
|
326
|
+
overflow: isOpen ? 'visible' : 'hidden'
|
|
327
|
+
}
|
|
300
328
|
}, shouldRenderChildren ? children : null));
|
|
301
329
|
};
|
|
302
330
|
|