@elliemae/ds-accordion 2.2.0-alpha.4 → 3.0.0-next.2

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.
Files changed (57) hide show
  1. package/cjs/DSAccordion.js +29 -50
  2. package/cjs/DSAccordionCTX.js +14 -40
  3. package/cjs/DSAccordionDatatestid.js +10 -38
  4. package/cjs/DSAccordionTypes.js +2 -27
  5. package/cjs/config/useAccordion.js +36 -59
  6. package/cjs/config/useAccordionRefs.js +39 -46
  7. package/cjs/defaultProps.js +39 -49
  8. package/cjs/index.js +14 -37
  9. package/cjs/parts/accordionContent/AccordionContent.js +35 -44
  10. package/cjs/parts/accordionItem/DSAccordionItem.js +174 -147
  11. package/cjs/parts/accordionItem/styles.js +128 -142
  12. package/cjs/parts/accordionItem/useAccordionItem.js +39 -52
  13. package/cjs/parts/accordionItem/useIsShowingEllipsis.js +21 -42
  14. package/cjs/propTypes.js +22 -53
  15. package/esm/DSAccordion.js +16 -18
  16. package/esm/DSAccordionCTX.js +9 -10
  17. package/esm/DSAccordionDatatestid.js +6 -9
  18. package/esm/DSAccordionTypes.js +1 -2
  19. package/esm/config/useAccordion.js +27 -25
  20. package/esm/config/useAccordionRefs.js +31 -17
  21. package/esm/defaultProps.js +31 -21
  22. package/esm/index.js +2 -8
  23. package/esm/parts/accordionContent/AccordionContent.js +25 -14
  24. package/esm/parts/accordionItem/DSAccordionItem.js +147 -114
  25. package/esm/parts/accordionItem/styles.js +115 -116
  26. package/esm/parts/accordionItem/useAccordionItem.js +33 -21
  27. package/esm/parts/accordionItem/useIsShowingEllipsis.js +15 -11
  28. package/esm/propTypes.js +17 -24
  29. package/package.json +7 -7
  30. package/cjs/DSAccordion.js.map +0 -7
  31. package/cjs/DSAccordionCTX.js.map +0 -7
  32. package/cjs/DSAccordionDatatestid.js.map +0 -7
  33. package/cjs/DSAccordionTypes.js.map +0 -7
  34. package/cjs/config/useAccordion.js.map +0 -7
  35. package/cjs/config/useAccordionRefs.js.map +0 -7
  36. package/cjs/defaultProps.js.map +0 -7
  37. package/cjs/index.js.map +0 -7
  38. package/cjs/parts/accordionContent/AccordionContent.js.map +0 -7
  39. package/cjs/parts/accordionItem/DSAccordionItem.js.map +0 -7
  40. package/cjs/parts/accordionItem/styles.js.map +0 -7
  41. package/cjs/parts/accordionItem/useAccordionItem.js.map +0 -7
  42. package/cjs/parts/accordionItem/useIsShowingEllipsis.js.map +0 -7
  43. package/cjs/propTypes.js.map +0 -7
  44. package/esm/DSAccordion.js.map +0 -7
  45. package/esm/DSAccordionCTX.js.map +0 -7
  46. package/esm/DSAccordionDatatestid.js.map +0 -7
  47. package/esm/DSAccordionTypes.js.map +0 -7
  48. package/esm/config/useAccordion.js.map +0 -7
  49. package/esm/config/useAccordionRefs.js.map +0 -7
  50. package/esm/defaultProps.js.map +0 -7
  51. package/esm/index.js.map +0 -7
  52. package/esm/parts/accordionContent/AccordionContent.js.map +0 -7
  53. package/esm/parts/accordionItem/DSAccordionItem.js.map +0 -7
  54. package/esm/parts/accordionItem/styles.js.map +0 -7
  55. package/esm/parts/accordionItem/useAccordionItem.js.map +0 -7
  56. package/esm/parts/accordionItem/useIsShowingEllipsis.js.map +0 -7
  57. package/esm/propTypes.js.map +0 -7
@@ -1,31 +1,35 @@
1
- import * as React from "react";
2
- import { useMemo, useState, useCallback } from "react";
3
- import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
4
- import { useAccordionRefs } from "./useAccordionRefs";
5
- import { defaultProps } from "../defaultProps";
6
- const useAccordion = (props) => {
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import 'core-js/modules/esnext.async-iterator.some.js';
3
+ import 'core-js/modules/esnext.iterator.constructor.js';
4
+ import 'core-js/modules/esnext.iterator.some.js';
5
+ import 'core-js/modules/esnext.async-iterator.filter.js';
6
+ import 'core-js/modules/esnext.iterator.filter.js';
7
+ import { useState, useMemo, useCallback } from 'react';
8
+ import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
9
+ import { useAccordionRefs } from './useAccordionRefs.js';
10
+ import { defaultProps } from '../defaultProps.js';
11
+
12
+ const useAccordion = props => {
7
13
  const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);
8
- const { activeValue, allowMultipleOpen, onChange } = propsWithDefaults;
9
- const { focusableChildrenReferences, allChildrenReferences } = useAccordionRefs(propsWithDefaults);
14
+ const {
15
+ activeValue,
16
+ allowMultipleOpen,
17
+ onChange
18
+ } = propsWithDefaults;
19
+ const {
20
+ focusableChildrenReferences,
21
+ allChildrenReferences
22
+ } = useAccordionRefs(propsWithDefaults);
10
23
  const [internalActiveValue, setInternalActiveValue] = useState(activeValue);
11
24
  const actualActiveValue = useMemo(() => {
12
- if (activeValue === void 0)
13
- return internalActiveValue;
25
+ if (activeValue === undefined) return internalActiveValue;
14
26
  return activeValue;
15
27
  }, [activeValue, internalActiveValue]);
16
28
  const setActiveValues = useCallback((value, e) => {
17
29
  let newState;
18
- if (allowMultipleOpen && (actualActiveValue === void 0 || actualActiveValue === null))
19
- newState = [value];
20
- else if (allowMultipleOpen && Array.isArray(actualActiveValue))
21
- if (!actualActiveValue.some((currentValues) => currentValues === value))
22
- newState = [...actualActiveValue, value];
23
- else
24
- newState = actualActiveValue.filter((currentValues) => currentValues !== value);
25
- else if (actualActiveValue === value)
26
- newState = null;
27
- else
28
- newState = value;
30
+ if (allowMultipleOpen && (actualActiveValue === undefined || actualActiveValue === null)) newState = [value];else if (allowMultipleOpen && Array.isArray(actualActiveValue)) {
31
+ if (!actualActiveValue.some(currentValues => currentValues === value)) newState = [...actualActiveValue, value];else newState = actualActiveValue.filter(currentValues => currentValues !== value);
32
+ } else if (actualActiveValue === value) newState = null;else newState = value;
29
33
  setInternalActiveValue(newState);
30
34
  return onChange(newState, e);
31
35
  }, [actualActiveValue, allowMultipleOpen, onChange]);
@@ -38,7 +42,5 @@ const useAccordion = (props) => {
38
42
  }), [actualActiveValue, allChildrenReferences, focusableChildrenReferences, propsWithDefaults, setActiveValues]);
39
43
  return ctx;
40
44
  };
41
- export {
42
- useAccordion
43
- };
44
- //# sourceMappingURL=useAccordion.js.map
45
+
46
+ export { useAccordion };
@@ -1,18 +1,32 @@
1
- import * as React from "react";
2
- import React2, { useMemo } from "react";
3
- const useAccordionRefs = ({ children }) => useMemo(() => {
4
- const focusableChildrenReferences = [];
5
- const allChildrenReferences = {};
6
- React2.Children.map(children, (child, index) => {
7
- const { value, disabled } = child.props;
8
- const currentRef = React2.createRef();
9
- allChildrenReferences[index] = currentRef;
10
- if (!disabled)
11
- focusableChildrenReferences.push({ index, value, ref: currentRef });
12
- });
13
- return { focusableChildrenReferences, allChildrenReferences };
14
- }, [children]);
15
- export {
16
- useAccordionRefs
1
+ import 'core-js/modules/esnext.async-iterator.map.js';
2
+ import 'core-js/modules/esnext.iterator.map.js';
3
+ import React, { useMemo } from 'react';
4
+
5
+ const useAccordionRefs = _ref => {
6
+ let {
7
+ children
8
+ } = _ref;
9
+ return useMemo(() => {
10
+ const focusableChildrenReferences = [];
11
+ const allChildrenReferences = {};
12
+ React.Children.map(children, (child, index) => {
13
+ const {
14
+ value,
15
+ disabled
16
+ } = child.props;
17
+ const currentRef = /*#__PURE__*/React.createRef();
18
+ allChildrenReferences[index] = currentRef;
19
+ if (!disabled) focusableChildrenReferences.push({
20
+ index,
21
+ value,
22
+ ref: currentRef
23
+ });
24
+ });
25
+ return {
26
+ focusableChildrenReferences,
27
+ allChildrenReferences
28
+ };
29
+ }, [children]);
17
30
  };
18
- //# sourceMappingURL=useAccordionRefs.js.map
31
+
32
+ export { useAccordionRefs };
@@ -1,18 +1,31 @@
1
- import * as React from "react";
2
- import React2, { memo } from "react";
3
- import { ArrowheadRight, ArrowheadDown, ChevronRight, ChevronDown } from "@elliemae/ds-icons";
4
- const DefaultIconClosed = memo(({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ React2.createElement(ChevronRight, {
5
- width: "20px"
6
- }) : /* @__PURE__ */ React2.createElement(ArrowheadRight, {
7
- width: "20px"
8
- }));
9
- const DefaultIconOpen = memo(({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ React2.createElement(ChevronDown, {
10
- width: "20px"
11
- }) : /* @__PURE__ */ React2.createElement(ArrowheadDown, {
12
- width: "20px"
13
- }));
14
- const noop = () => {
15
- };
1
+ import _jsx2 from '@babel/runtime/helpers/esm/jsx';
2
+ import { memo } from 'react';
3
+ import { ChevronRight, ArrowheadRight, ChevronDown, ArrowheadDown } from '@elliemae/ds-icons';
4
+
5
+ var _ChevronRight, _ArrowheadRight, _ChevronDown, _ArrowheadDown;
6
+ const DefaultIconClosed = /*#__PURE__*/memo(_ref => {
7
+ let {
8
+ isDSMobile = false
9
+ } = _ref;
10
+ return isDSMobile ? _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx2(ChevronRight, {
11
+ width: "20px"
12
+ })) : _ArrowheadRight || (_ArrowheadRight = /*#__PURE__*/_jsx2(ArrowheadRight, {
13
+ width: "20px"
14
+ }));
15
+ });
16
+ const DefaultIconOpen = /*#__PURE__*/memo(_ref2 => {
17
+ let {
18
+ isDSMobile = false
19
+ } = _ref2;
20
+ return isDSMobile ? _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx2(ChevronDown, {
21
+ width: "20px"
22
+ })) : _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx2(ArrowheadDown, {
23
+ width: "20px"
24
+ }));
25
+ }); // eslint-disable-next-line @typescript-eslint/no-empty-function
26
+
27
+ const noop = () => {};
28
+
16
29
  const defaultProps = {
17
30
  containerProps: {},
18
31
  allowMultipleOpen: false,
@@ -24,12 +37,9 @@ const defaultProps = {
24
37
  const accordionItemDefaultProps = {
25
38
  iconClosed: DefaultIconClosed,
26
39
  iconOpened: DefaultIconOpen,
27
- title: "",
40
+ title: '',
28
41
  customActions: [],
29
42
  disabled: false
30
43
  };
31
- export {
32
- accordionItemDefaultProps,
33
- defaultProps
34
- };
35
- //# sourceMappingURL=defaultProps.js.map
44
+
45
+ export { accordionItemDefaultProps, defaultProps };
package/esm/index.js CHANGED
@@ -1,8 +1,2 @@
1
- import * as React from "react";
2
- export * from "./DSAccordion";
3
- export * from "./parts/accordionItem/DSAccordionItem";
4
- import { default as default2 } from "./DSAccordion";
5
- export {
6
- default2 as default
7
- };
8
- //# sourceMappingURL=index.js.map
1
+ export { DSAccordion, DSAccordionWithSchema, DSAccordion as default } from './DSAccordion.js';
2
+ export { DSAccordionItem, DSAccordionItemWithSchema } from './parts/accordionItem/DSAccordionItem.js';
@@ -1,21 +1,32 @@
1
- import * as React from "react";
2
- import React2, { useContext } from "react";
3
- import { DSAccordionContext } from "../../DSAccordionCTX";
4
- import { DSAccordionDataTestid } from "../../DSAccordionDatatestid";
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
3
+ import 'core-js/modules/esnext.iterator.constructor.js';
4
+ import 'core-js/modules/esnext.iterator.for-each.js';
5
+ import 'core-js/modules/esnext.async-iterator.filter.js';
6
+ import 'core-js/modules/esnext.iterator.filter.js';
7
+ import React, { useContext } from 'react';
8
+ import { DSAccordionContext } from '../../DSAccordionCTX.js';
9
+ import { DSAccordionDataTestid } from '../../DSAccordionDatatestid.js';
10
+ import { jsx } from 'react/jsx-runtime';
11
+
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
15
  const AccordionContent = () => {
6
16
  const {
7
- props: { containerProps, children }
17
+ props: {
18
+ containerProps,
19
+ children
20
+ }
8
21
  } = useContext(DSAccordionContext);
9
22
  const childrenWithIndex = [];
10
- React2.Children.forEach(children, (child, index) => childrenWithIndex.push(React2.cloneElement(child, {
23
+ React.Children.forEach(children, (child, index) => childrenWithIndex.push( /*#__PURE__*/React.cloneElement(child, {
11
24
  dsIndex: index
12
25
  })));
13
- return /* @__PURE__ */ React2.createElement("div", {
14
- ...containerProps,
15
- "data-testid": DSAccordionDataTestid.GROUP
16
- }, childrenWithIndex);
26
+ return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
27
+ "data-testid": DSAccordionDataTestid.GROUP,
28
+ children: childrenWithIndex
29
+ }));
17
30
  };
18
- export {
19
- AccordionContent
20
- };
21
- //# sourceMappingURL=AccordionContent.js.map
31
+
32
+ export { AccordionContent };
@@ -1,27 +1,35 @@
1
- import * as React from "react";
2
- import React2, { useState, useContext, useCallback, useMemo } from "react";
3
- import { describe } from "react-desc";
4
- import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
5
- import { DSButton, BUTTON_TYPE } from "@elliemae/ds-button";
6
- import { DSPopperJS } from "@elliemae/ds-popperjs";
7
- import { accordionItemDefaultProps } from "../../defaultProps";
8
- import {
9
- StyledItemAddon,
10
- StyledItemContainer,
11
- StyledItemContent,
12
- StyledItemCustomActions,
13
- StyledItemHeader,
14
- StyledItemHeaderContainer,
15
- StyledItemTitles,
16
- StyledPrimaryTitle,
17
- StyledSecondaryTitle
18
- } from "./styles";
19
- import { accordionItemPropTypes } from "../../propTypes";
20
- import { useAccordionItem } from "./useAccordionItem";
21
- import { DSAccordionContext } from "../../DSAccordionCTX";
22
- import { DSAccordionDataTestid } from "../../DSAccordionDatatestid";
23
- import { useIsShowingEllipsis } from "./useIsShowingEllipsis";
24
- const DSAccordionItem = (props) => {
1
+ import _jsx2 from '@babel/runtime/helpers/esm/jsx';
2
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
+ import 'core-js/modules/web.dom-collections.iterator.js';
5
+ import 'core-js/modules/esnext.async-iterator.map.js';
6
+ import 'core-js/modules/esnext.iterator.map.js';
7
+ import 'core-js/modules/esnext.async-iterator.filter.js';
8
+ import 'core-js/modules/esnext.iterator.constructor.js';
9
+ import 'core-js/modules/esnext.iterator.filter.js';
10
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
11
+ import 'core-js/modules/esnext.iterator.for-each.js';
12
+ import { useContext, useCallback, useState, useMemo } from 'react';
13
+ import { describe } from 'react-desc';
14
+ import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
15
+ import DSButton, { BUTTON_TYPE } from '@elliemae/ds-button';
16
+ import { DSPopperJS } from '@elliemae/ds-popperjs';
17
+ import { accordionItemDefaultProps } from '../../defaultProps.js';
18
+ import { StyledItemCustomActions, StyledPrimaryTitle, StyledSecondaryTitle, StyledItemContainer, StyledItemHeaderContainer, StyledItemHeader, StyledItemAddon, StyledItemTitles, StyledItemContent } from './styles.js';
19
+ import { accordionItemPropTypes } from '../../propTypes.js';
20
+ import { useAccordionItem } from './useAccordionItem.js';
21
+ import { DSAccordionContext } from '../../DSAccordionCTX.js';
22
+ import { DSAccordionDataTestid } from '../../DSAccordionDatatestid.js';
23
+ import { useIsShowingEllipsis } from './useIsShowingEllipsis.js';
24
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
25
+
26
+ const _excluded = ["onClick", "id"];
27
+
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
+
30
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
+
32
+ const DSAccordionItem = props => {
25
33
  const propsWithDefaults = useMemoMergePropsWithDefault(props, accordionItemDefaultProps);
26
34
  const {
27
35
  children,
@@ -35,126 +43,151 @@ const DSAccordionItem = (props) => {
35
43
  dsIndex,
36
44
  renderCustomActions
37
45
  } = propsWithDefaults;
38
- const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled });
46
+ const {
47
+ handleOnClick,
48
+ handleOnKeyDown,
49
+ selected
50
+ } = useAccordionItem({
51
+ value,
52
+ disabled
53
+ });
39
54
  const {
40
55
  allChildrenReferences,
41
56
  actualActiveValue,
42
- props: { isDSMobile }
57
+ props: {
58
+ isDSMobile
59
+ }
43
60
  } = useContext(DSAccordionContext);
44
- const onKeyDownWithIndex = useCallback((e) => {
61
+ const onKeyDownWithIndex = useCallback(e => {
45
62
  handleOnKeyDown(e, dsIndex);
46
63
  }, [dsIndex, handleOnKeyDown]);
47
64
  const [showPopover, setShowPopover] = useState(false);
48
65
  const [referenceElement, setReferenceElement] = useState();
49
66
  const CustomActionsContent = useMemo(() => {
50
- if (!isDSMobile && customActions?.length > 0)
51
- return /* @__PURE__ */ React2.createElement(StyledItemCustomActions, null, customActions?.map(({ onClick, id, ...rest }) => /* @__PURE__ */ React2.createElement(DSButton, {
52
- key: id,
53
- onClick: (e) => {
67
+ if (!isDSMobile && (customActions === null || customActions === void 0 ? void 0 : customActions.length) > 0) return /*#__PURE__*/_jsx2(StyledItemCustomActions, {}, void 0, customActions === null || customActions === void 0 ? void 0 : customActions.map(_ref => {
68
+ let {
69
+ onClick,
70
+ id
71
+ } = _ref,
72
+ rest = _objectWithoutProperties(_ref, _excluded);
73
+
74
+ return /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({
75
+ onClick: e => {
54
76
  e.stopPropagation();
55
- if (onClick)
56
- onClick(e);
57
- },
58
- ...rest,
77
+ if (onClick) onClick(e);
78
+ }
79
+ }, rest), {}, {
59
80
  buttonType: BUTTON_TYPE.SECONDARY
60
- })));
61
- if (!isDSMobile && renderCustomActions)
62
- return /* @__PURE__ */ React2.createElement(StyledItemCustomActions, null, renderCustomActions({ allRefs: allChildrenReferences, actualActiveValue }));
81
+ }), id);
82
+ }));
83
+ if (!isDSMobile && renderCustomActions) return /*#__PURE__*/_jsx2(StyledItemCustomActions, {}, void 0, renderCustomActions({
84
+ allRefs: allChildrenReferences,
85
+ actualActiveValue
86
+ }));
63
87
  return null;
64
88
  }, [actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);
65
- const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();
66
- const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();
89
+ const {
90
+ isShowingEllipsis: isPrimaryShowingEllipsis,
91
+ setElement: setPrimaryElement
92
+ } = useIsShowingEllipsis();
93
+ const {
94
+ isShowingEllipsis: isSecondaryShowingEllipsis,
95
+ setElement: setSecondaryElement
96
+ } = useIsShowingEllipsis();
67
97
  const handleOnFocus = useCallback(() => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis), [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis]);
68
98
  const handleOnBlur = useCallback(() => setShowPopover(false), []);
69
99
  const Titles = useMemo(() => {
70
- if (isPrimaryShowingEllipsis || isSecondaryShowingEllipsis)
71
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledPrimaryTitle, {
100
+ if (isPrimaryShowingEllipsis || isSecondaryShowingEllipsis) return /*#__PURE__*/jsxs(Fragment, {
101
+ children: [/*#__PURE__*/jsx(StyledPrimaryTitle, {
72
102
  ref: setPrimaryElement,
73
- id: `accordion_${title}id`,
74
- disabled,
75
- isDSMobile
76
- }, title), !isDSMobile && secondaryTitle && /* @__PURE__ */ React2.createElement(StyledSecondaryTitle, {
103
+ id: "accordion_".concat(title, "id"),
104
+ disabled: disabled,
105
+ isDSMobile: isDSMobile,
106
+ children: title
107
+ }), !isDSMobile && secondaryTitle && /*#__PURE__*/jsx(StyledSecondaryTitle, {
77
108
  ref: setSecondaryElement,
78
- disabled
79
- }, secondaryTitle), /* @__PURE__ */ React2.createElement(DSPopperJS, {
80
- referenceElement,
81
- showPopover
82
- }, /* @__PURE__ */ React2.createElement("div", {
83
- style: { maxWidth: 260, padding: 8, background: "white", display: "grid", gap: 8 }
84
- }, /* @__PURE__ */ React2.createElement("p", {
85
- style: { margin: 0 }
86
- }, title), /* @__PURE__ */ React2.createElement("p", {
87
- style: { margin: 0 }
88
- }, " ", secondaryTitle))));
89
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledPrimaryTitle, {
90
- ref: setPrimaryElement,
91
- id: `accordion_${title}id`,
92
- disabled,
93
- isDSMobile
94
- }, title), !isDSMobile && secondaryTitle && /* @__PURE__ */ React2.createElement(StyledSecondaryTitle, {
95
- ref: setSecondaryElement,
96
- disabled
97
- }, secondaryTitle));
98
- }, [
99
- disabled,
100
- isDSMobile,
101
- isPrimaryShowingEllipsis,
102
- isSecondaryShowingEllipsis,
103
- referenceElement,
104
- secondaryTitle,
105
- setPrimaryElement,
106
- setSecondaryElement,
107
- showPopover,
108
- title
109
- ]);
110
- return /* @__PURE__ */ React2.createElement(StyledItemContainer, {
109
+ disabled: disabled,
110
+ children: secondaryTitle
111
+ }), /*#__PURE__*/_jsx2(DSPopperJS, {
112
+ referenceElement: referenceElement,
113
+ showPopover: showPopover
114
+ }, void 0, /*#__PURE__*/_jsx2("div", {
115
+ style: {
116
+ maxWidth: 260,
117
+ padding: 8,
118
+ background: 'white',
119
+ display: 'grid',
120
+ gap: 8
121
+ }
122
+ }, void 0, /*#__PURE__*/_jsx2("p", {
123
+ style: {
124
+ margin: 0
125
+ }
126
+ }, void 0, title), /*#__PURE__*/_jsx2("p", {
127
+ style: {
128
+ margin: 0
129
+ }
130
+ }, void 0, " ", secondaryTitle)))]
131
+ });
132
+ return /*#__PURE__*/jsxs(Fragment, {
133
+ children: [/*#__PURE__*/jsx(StyledPrimaryTitle, {
134
+ ref: setPrimaryElement,
135
+ id: "accordion_".concat(title, "id"),
136
+ disabled: disabled,
137
+ isDSMobile: isDSMobile,
138
+ children: title
139
+ }), !isDSMobile && secondaryTitle && /*#__PURE__*/jsx(StyledSecondaryTitle, {
140
+ ref: setSecondaryElement,
141
+ disabled: disabled,
142
+ children: secondaryTitle
143
+ })]
144
+ });
145
+ }, [disabled, isDSMobile, isPrimaryShowingEllipsis, isSecondaryShowingEllipsis, referenceElement, secondaryTitle, setPrimaryElement, setSecondaryElement, showPopover, title]);
146
+ return /*#__PURE__*/_jsx2(StyledItemContainer, {
111
147
  "data-testid": DSAccordionDataTestid.ITEM.CONTAINER
112
- }, /* @__PURE__ */ React2.createElement(StyledItemHeaderContainer, {
113
- disabled
114
- }, /* @__PURE__ */ React2.createElement(StyledItemHeader, {
115
- withCustomActions: (customActions?.length > 0 || renderCustomActions !== void 0) && !isDSMobile,
148
+ }, void 0, /*#__PURE__*/_jsx2(StyledItemHeaderContainer, {
149
+ disabled: disabled
150
+ }, void 0, /*#__PURE__*/jsxs(StyledItemHeader, {
151
+ withCustomActions: ((customActions === null || customActions === void 0 ? void 0 : customActions.length) > 0 || renderCustomActions !== undefined) && !isDSMobile,
116
152
  withSecondaryTitle: secondaryTitle,
117
153
  onClick: handleOnClick,
118
- tabIndex: !disabled ? 0 : void 0,
119
- disabled,
154
+ tabIndex: !disabled ? 0 : undefined,
155
+ disabled: disabled,
120
156
  "data-disabled": disabled,
121
157
  ref: allChildrenReferences[dsIndex],
122
158
  onKeyDown: onKeyDownWithIndex,
123
- isDSMobile,
159
+ isDSMobile: isDSMobile,
124
160
  "data-testid": DSAccordionDataTestid.ITEM.HEADER,
125
- id: `ds-accordion-header-${value}`,
161
+ id: "ds-accordion-header-".concat(value),
126
162
  "aria-expanded": selected,
127
163
  "aria-disabled": disabled,
128
- "aria-controls": `ds-accordion-content-${value}`,
164
+ "aria-controls": "ds-accordion-content-".concat(value),
129
165
  onFocus: handleOnFocus,
130
- onBlur: handleOnBlur
131
- }, /* @__PURE__ */ React2.createElement(StyledItemAddon, {
132
- disabled,
133
- isDSMobile
134
- }, selected ? /* @__PURE__ */ React2.createElement(IconOpened, {
135
- isDSMobile
136
- }) : /* @__PURE__ */ React2.createElement(IconClosed, {
137
- isDSMobile
138
- })), /* @__PURE__ */ React2.createElement(StyledItemTitles, {
139
- onMouseEnter: handleOnFocus,
140
- onMouseLeave: handleOnBlur,
141
- isDSMobile,
142
- ref: setReferenceElement
143
- }, Titles)), CustomActionsContent), selected && /* @__PURE__ */ React2.createElement(StyledItemContent, {
166
+ onBlur: handleOnBlur,
167
+ children: [/*#__PURE__*/_jsx2(StyledItemAddon, {
168
+ disabled: disabled,
169
+ isDSMobile: isDSMobile
170
+ }, void 0, selected ? /*#__PURE__*/_jsx2(IconOpened, {
171
+ isDSMobile: isDSMobile
172
+ }) : /*#__PURE__*/_jsx2(IconClosed, {
173
+ isDSMobile: isDSMobile
174
+ })), /*#__PURE__*/jsx(StyledItemTitles, {
175
+ onMouseEnter: handleOnFocus,
176
+ onMouseLeave: handleOnBlur,
177
+ isDSMobile: isDSMobile,
178
+ ref: setReferenceElement,
179
+ children: Titles
180
+ })]
181
+ }), CustomActionsContent), selected && /*#__PURE__*/_jsx2(StyledItemContent, {
144
182
  "data-testid": DSAccordionDataTestid.ITEM.CONTENT,
145
- "aria-labelledby": `ds-accordion-header-${value}`,
183
+ "aria-labelledby": "ds-accordion-header-".concat(value),
146
184
  role: "region",
147
- isDSMobile,
148
- id: `ds-accordion-content-${value}`
149
- }, children));
185
+ isDSMobile: isDSMobile,
186
+ id: "ds-accordion-content-".concat(value)
187
+ }, void 0, children));
150
188
  };
151
- DSAccordionItem.propTypes = accordionItemPropTypes;
189
+
152
190
  const DSAccordionItemWithSchema = describe(DSAccordionItem);
153
191
  DSAccordionItemWithSchema.propTypes = accordionItemPropTypes;
154
- var DSAccordionItem_default = DSAccordionItem;
155
- export {
156
- DSAccordionItem,
157
- DSAccordionItemWithSchema,
158
- DSAccordionItem_default as default
159
- };
160
- //# sourceMappingURL=DSAccordionItem.js.map
192
+
193
+ export { DSAccordionItem, DSAccordionItemWithSchema, DSAccordionItem as default };