@elliemae/ds-accordion 2.2.0-alpha.2 → 2.2.0-beta.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.
Files changed (61) 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 +144 -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 +131 -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/types/DSAccordion.d.ts +1 -1
  31. package/types/DSAccordionTypes.d.ts +3 -0
  32. package/types/parts/accordionItem/DSAccordionItem.d.ts +1 -1
  33. package/types/parts/accordionItem/styles.d.ts +2 -2
  34. package/cjs/DSAccordion.js.map +0 -7
  35. package/cjs/DSAccordionCTX.js.map +0 -7
  36. package/cjs/DSAccordionDatatestid.js.map +0 -7
  37. package/cjs/DSAccordionTypes.js.map +0 -7
  38. package/cjs/config/useAccordion.js.map +0 -7
  39. package/cjs/config/useAccordionRefs.js.map +0 -7
  40. package/cjs/defaultProps.js.map +0 -7
  41. package/cjs/index.js.map +0 -7
  42. package/cjs/parts/accordionContent/AccordionContent.js.map +0 -7
  43. package/cjs/parts/accordionItem/DSAccordionItem.js.map +0 -7
  44. package/cjs/parts/accordionItem/styles.js.map +0 -7
  45. package/cjs/parts/accordionItem/useAccordionItem.js.map +0 -7
  46. package/cjs/parts/accordionItem/useIsShowingEllipsis.js.map +0 -7
  47. package/cjs/propTypes.js.map +0 -7
  48. package/esm/DSAccordion.js.map +0 -7
  49. package/esm/DSAccordionCTX.js.map +0 -7
  50. package/esm/DSAccordionDatatestid.js.map +0 -7
  51. package/esm/DSAccordionTypes.js.map +0 -7
  52. package/esm/config/useAccordion.js.map +0 -7
  53. package/esm/config/useAccordionRefs.js.map +0 -7
  54. package/esm/defaultProps.js.map +0 -7
  55. package/esm/index.js.map +0 -7
  56. package/esm/parts/accordionContent/AccordionContent.js.map +0 -7
  57. package/esm/parts/accordionItem/DSAccordionItem.js.map +0 -7
  58. package/esm/parts/accordionItem/styles.js.map +0 -7
  59. package/esm/parts/accordionItem/useAccordionItem.js.map +0 -7
  60. package/esm/parts/accordionItem/useIsShowingEllipsis.js.map +0 -7
  61. package/esm/propTypes.js.map +0 -7
@@ -1,118 +1,133 @@
1
- import * as React from "react";
2
- import styled from "styled-components";
3
- const StyledItemContainer = styled.div`
4
- display: grid;
5
- grid-template-rows: auto auto;
6
- border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[200]};
7
- align-items: center;
8
- `;
9
- const StyledItemHeader = styled.button`
10
- display: grid;
11
- height: ${({ withSecondaryTitle }) => withSecondaryTitle ? "48px" : "32px"};
12
- grid-template-columns: ${({ withCustomActions, isDSMobile }) => withCustomActions ? "32px auto" : `${isDSMobile ? `auto 32px` : `32px auto`}`};
13
- width: 100%;
14
- align-items: center;
15
- border: none;
16
- outline: none;
17
- background: none;
1
+ import styled from 'styled-components';
18
2
 
19
- &:hover {
20
- cursor: ${({ disabled }) => disabled ? "not-allowed" : "pointer"};
21
- }
3
+ const StyledItemContainer = /*#__PURE__*/styled.div.withConfig({
4
+ componentId: "sc-fnpjby-0"
5
+ })(["display:grid;grid-template-rows:auto auto;border-bottom:1px solid ", ";align-items:center;"], _ref => {
6
+ let {
7
+ theme
8
+ } = _ref;
9
+ return theme.colors.neutral[200];
10
+ });
11
+ const StyledItemHeader = /*#__PURE__*/styled.button.withConfig({
12
+ componentId: "sc-fnpjby-1"
13
+ })(["display:flex;height:", ";width:100%;align-items:center;border:none;outline:none;background:none;&:hover{cursor:", ";}padding:", ";", " &:focus{&:after{position:absolute;content:'';left:0;top:0;width:100%;height:100%;border-radius:2px;border:2px solid ", ";pointer-events:none;}}"], _ref2 => {
14
+ let {
15
+ theme,
16
+ withSecondaryTitle
17
+ } = _ref2;
18
+ return withSecondaryTitle ? theme.space.m : theme.space.s;
19
+ }, _ref3 => {
20
+ let {
21
+ disabled
22
+ } = _ref3;
23
+ return disabled ? 'not-allowed' : 'pointer';
24
+ }, _ref4 => {
25
+ let {
26
+ isDSMobile
27
+ } = _ref4;
28
+ return isDSMobile ? "0 16px" : "0";
29
+ }, _ref5 => {
30
+ let {
31
+ isDSMobile
32
+ } = _ref5;
33
+ return isDSMobile ? "flex-direction: row-reverse;" : "";
34
+ }, _ref6 => {
35
+ let {
36
+ theme
37
+ } = _ref6;
38
+ return theme.colors.brand[700];
39
+ });
40
+ const StyledItemContent = /*#__PURE__*/styled.div.withConfig({
41
+ componentId: "sc-fnpjby-2"
42
+ })(["margin:", ";grid-column:1/2;"], _ref7 => {
43
+ let {
44
+ isDSMobile
45
+ } = _ref7;
46
+ return isDSMobile ? "16px 16px 24px 16px" : "16px 16px 16px 32px";
47
+ });
48
+ const StyledItemAddon = /*#__PURE__*/styled.div.withConfig({
49
+ componentId: "sc-fnpjby-3"
50
+ })(["", " height:100%;width:", ";display:grid;place-items:center;& .em-ds-icon svg{fill:", ";}"], _ref8 => {
51
+ let {
52
+ theme,
53
+ isDSMobile
54
+ } = _ref8;
55
+ return !isDSMobile ? "padding: 0 ".concat(theme.space.xxs, ";") : "";
56
+ }, _ref9 => {
57
+ let {
58
+ theme
59
+ } = _ref9;
60
+ return theme.space.s;
61
+ }, _ref10 => {
62
+ let {
63
+ disabled,
64
+ theme
65
+ } = _ref10;
66
+ return disabled ? theme.colors.neutral[200] : theme.colors.brand[800];
67
+ });
68
+ const StyledItemTitles = /*#__PURE__*/styled.div.withConfig({
69
+ componentId: "sc-fnpjby-4"
70
+ })(["display:grid;grid-template-columns:100%;width:100%;align-content:center;"]);
71
+ const StyledPrimaryTitle = /*#__PURE__*/styled.div.withConfig({
72
+ componentId: "sc-fnpjby-5"
73
+ })(["margin:0;font-size:16px;color:", ";font-weight:", ";text-overflow:ellipsis;overflow:hidden;height:", ";width:100%;text-align:left;display:block;white-space:nowrap;"], _ref11 => {
74
+ let {
75
+ disabled,
76
+ theme
77
+ } = _ref11;
78
+ return disabled ? theme.colors.neutral[200] : theme.colors.neutral[700];
79
+ }, _ref12 => {
80
+ let {
81
+ theme,
82
+ isDSMobile
83
+ } = _ref12;
84
+ return isDSMobile ? theme.fontWeights.regular : theme.fontWeights.regular;
85
+ }, _ref13 => {
86
+ let {
87
+ theme
88
+ } = _ref13;
89
+ return theme.space.xs;
90
+ });
91
+ const StyledSecondaryTitle = /*#__PURE__*/styled.span.withConfig({
92
+ componentId: "sc-fnpjby-6"
93
+ })(["margin:0;font-size:", ";text-align:left;color:", ";text-overflow:ellipsis;overflow:hidden;height:", ";width:100%;text-align:left;display:block;white-space:nowrap;"], _ref14 => {
94
+ let {
95
+ theme
96
+ } = _ref14;
97
+ return theme.fontSizes.label[200];
98
+ }, _ref15 => {
99
+ let {
100
+ disabled,
101
+ theme
102
+ } = _ref15;
103
+ return disabled ? theme.colors.neutral[200] : theme.colors.neutral[500];
104
+ }, _ref16 => {
105
+ let {
106
+ theme
107
+ } = _ref16;
108
+ return theme.space.xs;
109
+ });
110
+ const StyledItemCustomActions = /*#__PURE__*/styled.div.withConfig({
111
+ componentId: "sc-fnpjby-7"
112
+ })(["display:grid;grid-auto-flow:column;grid-gap:", ";margin:0 ", ";justify-content:flex-end;"], _ref17 => {
113
+ let {
114
+ theme
115
+ } = _ref17;
116
+ return theme.space.xxs;
117
+ }, _ref18 => {
118
+ let {
119
+ theme
120
+ } = _ref18;
121
+ return theme.space.xs;
122
+ });
123
+ const StyledItemHeaderContainer = /*#__PURE__*/styled.div.withConfig({
124
+ componentId: "sc-fnpjby-8"
125
+ })(["display:grid;grid-template-columns:auto max-content;place-items:center;position:relative;&:hover{", "}"], _ref19 => {
126
+ let {
127
+ disabled,
128
+ theme
129
+ } = _ref19;
130
+ return !disabled ? "background: ".concat(theme.colors.brand[200], ";") : "";
131
+ });
22
132
 
23
- padding: ${({ isDSMobile }) => isDSMobile ? `0 16px` : `0`};
24
-
25
- ${({ isDSMobile }) => isDSMobile ? `grid-template-areas: 'title addon';` : ``}
26
-
27
- &:focus {
28
- &:after {
29
- position: absolute;
30
- content: '';
31
- left: 0;
32
- top: 0;
33
- width: 100%;
34
- height: 100%;
35
- border-radius: 2px;
36
- border: 2px solid ${({ theme }) => theme.colors.brand[700]};
37
- pointer-events: none;
38
- }
39
- }
40
- `;
41
- const StyledItemContent = styled.div`
42
- margin: ${({ isDSMobile }) => isDSMobile ? `16px 16px 24px 16px` : `16px 16px 16px 32px`};
43
- grid-column: 1/2;
44
- `;
45
- const StyledItemAddon = styled.div`
46
- ${({ isDSMobile }) => !isDSMobile ? ` padding: 0 8px;
47
-
48
- ` : `
49
- grid-area: addon;
50
- `}
51
- height: 100%;
52
- display: grid;
53
- place-items: center;
54
-
55
- & .em-ds-icon svg {
56
- fill: ${({ disabled, theme }) => disabled ? theme.colors.neutral[200] : theme.colors.brand[800]};
57
- }
58
- `;
59
- const StyledItemTitles = styled.div`
60
- display: grid;
61
- grid-template-columns: 100%;
62
- align-content: center;
63
- ${({ isDSMobile }) => isDSMobile ? `grid-area: title;` : ``}
64
- `;
65
- const StyledPrimaryTitle = styled.div`
66
- margin: 0;
67
- font-size: 16px;
68
- color: ${({ disabled, theme }) => disabled ? theme.colors.neutral[200] : theme.colors.neutral[700]};
69
- font-weight: ${({ theme, isDSMobile }) => isDSMobile ? theme.fontWeights.regular : theme.fontWeights.regular};
70
- text-overflow: ellipsis;
71
- overflow: hidden;
72
- height: 16px;
73
- width: 100%;
74
- text-align: left;
75
- display: block;
76
- white-space: nowrap;
77
- `;
78
- const StyledSecondaryTitle = styled.span`
79
- margin: 0;
80
- font-size: ${({ theme }) => theme.fontSizes.label[200]};
81
- text-align: left;
82
- color: ${({ disabled, theme }) => disabled ? theme.colors.neutral[200] : theme.colors.neutral[500]};
83
- text-overflow: ellipsis;
84
- overflow: hidden;
85
- height: 16px;
86
- width: 100%;
87
- text-align: left;
88
- display: block;
89
- white-space: nowrap;
90
- `;
91
- const StyledItemCustomActions = styled.div`
92
- display: grid;
93
- grid-auto-flow: column;
94
- grid-gap: 8px;
95
- margin: 0 16px;
96
- justify-content: flex-end;
97
- `;
98
- const StyledItemHeaderContainer = styled.div`
99
- display: grid;
100
- grid-template-columns: auto max-content;
101
- place-items: center;
102
- position: relative;
103
- &:hover {
104
- ${({ disabled, theme }) => !disabled ? `background: ${theme.colors.brand[200]}` : ``};
105
- }
106
- `;
107
- export {
108
- StyledItemAddon,
109
- StyledItemContainer,
110
- StyledItemContent,
111
- StyledItemCustomActions,
112
- StyledItemHeader,
113
- StyledItemHeaderContainer,
114
- StyledItemTitles,
115
- StyledPrimaryTitle,
116
- StyledSecondaryTitle
117
- };
118
- //# sourceMappingURL=styles.js.map
133
+ export { StyledItemAddon, StyledItemContainer, StyledItemContent, StyledItemCustomActions, StyledItemHeader, StyledItemHeaderContainer, StyledItemTitles, StyledPrimaryTitle, StyledSecondaryTitle };
@@ -1,28 +1,42 @@
1
- import * as React from "react";
2
- import { useCallback, useContext, useMemo } from "react";
3
- import { DSAccordionContext } from "../../DSAccordionCTX";
4
- const useAccordionItem = ({ value, disabled }) => {
5
- const { actualActiveValue, setActiveValues, focusableChildrenReferences } = useContext(DSAccordionContext);
1
+ import 'core-js/modules/esnext.async-iterator.some.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.some.js';
4
+ import { useContext, useMemo, useCallback } from 'react';
5
+ import { DSAccordionContext } from '../../DSAccordionCTX.js';
6
+
7
+ const useAccordionItem = _ref => {
8
+ let {
9
+ value,
10
+ disabled
11
+ } = _ref;
12
+ const {
13
+ actualActiveValue,
14
+ setActiveValues,
15
+ focusableChildrenReferences
16
+ } = useContext(DSAccordionContext);
6
17
  const selected = useMemo(() => {
7
18
  if (Array.isArray(actualActiveValue)) {
8
- return actualActiveValue.some((currentValue) => currentValue === value);
19
+ return actualActiveValue.some(currentValue => currentValue === value);
9
20
  }
21
+
10
22
  return value === actualActiveValue;
11
23
  }, [actualActiveValue, value]);
12
- const handleOnClick = useCallback((e) => {
13
- if (!disabled)
14
- setActiveValues(value, e);
24
+ const handleOnClick = useCallback(e => {
25
+ if (!disabled) setActiveValues(value, e);
15
26
  }, [disabled, setActiveValues, value]);
16
27
  const handleOnKeyDown = useCallback((e, _dsIndex) => {
17
- if (!disabled && e.key === "ArrowDown") {
18
- const currentIndex = focusableChildrenReferences.findIndex((item) => item.index === _dsIndex);
19
- if (focusableChildrenReferences[currentIndex + 1]?.ref?.current)
20
- focusableChildrenReferences[currentIndex + 1]?.ref?.current?.focus();
28
+ if (!disabled && e.key === 'ArrowDown') {
29
+ var _focusableChildrenRef, _focusableChildrenRef2, _focusableChildrenRef3, _focusableChildrenRef4, _focusableChildrenRef5;
30
+
31
+ const currentIndex = focusableChildrenReferences.findIndex(item => item.index === _dsIndex);
32
+ if ((_focusableChildrenRef = focusableChildrenReferences[currentIndex + 1]) !== null && _focusableChildrenRef !== void 0 && (_focusableChildrenRef2 = _focusableChildrenRef.ref) !== null && _focusableChildrenRef2 !== void 0 && _focusableChildrenRef2.current) (_focusableChildrenRef3 = focusableChildrenReferences[currentIndex + 1]) === null || _focusableChildrenRef3 === void 0 ? void 0 : (_focusableChildrenRef4 = _focusableChildrenRef3.ref) === null || _focusableChildrenRef4 === void 0 ? void 0 : (_focusableChildrenRef5 = _focusableChildrenRef4.current) === null || _focusableChildrenRef5 === void 0 ? void 0 : _focusableChildrenRef5.focus();
21
33
  }
22
- if (!disabled && e.key === "ArrowUp") {
23
- const currentIndex = focusableChildrenReferences.findIndex((item) => item.index === _dsIndex);
24
- if (focusableChildrenReferences[currentIndex - 1]?.ref?.current)
25
- focusableChildrenReferences[currentIndex - 1]?.ref?.current?.focus();
34
+
35
+ if (!disabled && e.key === 'ArrowUp') {
36
+ var _focusableChildrenRef6, _focusableChildrenRef7, _focusableChildrenRef8, _focusableChildrenRef9, _focusableChildrenRef10;
37
+
38
+ const currentIndex = focusableChildrenReferences.findIndex(item => item.index === _dsIndex);
39
+ if ((_focusableChildrenRef6 = focusableChildrenReferences[currentIndex - 1]) !== null && _focusableChildrenRef6 !== void 0 && (_focusableChildrenRef7 = _focusableChildrenRef6.ref) !== null && _focusableChildrenRef7 !== void 0 && _focusableChildrenRef7.current) (_focusableChildrenRef8 = focusableChildrenReferences[currentIndex - 1]) === null || _focusableChildrenRef8 === void 0 ? void 0 : (_focusableChildrenRef9 = _focusableChildrenRef8.ref) === null || _focusableChildrenRef9 === void 0 ? void 0 : (_focusableChildrenRef10 = _focusableChildrenRef9.current) === null || _focusableChildrenRef10 === void 0 ? void 0 : _focusableChildrenRef10.focus();
26
40
  }
27
41
  }, [disabled, focusableChildrenReferences]);
28
42
  return {
@@ -31,7 +45,5 @@ const useAccordionItem = ({ value, disabled }) => {
31
45
  selected
32
46
  };
33
47
  };
34
- export {
35
- useAccordionItem
36
- };
37
- //# sourceMappingURL=useAccordionItem.js.map
48
+
49
+ export { useAccordionItem };
@@ -1,29 +1,33 @@
1
- import * as React from "react";
2
- import { useEffect, useState, useMemo } from "react";
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import { useState, useMemo, useEffect } from 'react';
3
+
3
4
  const useIsShowingEllipsis = () => {
4
5
  const [element, setElement] = useState();
5
- const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);
6
- const resizeObserver = useMemo(() => new ResizeObserver((entries) => {
6
+ const [isShowingEllipsis, setIsShowingEllipsis] = useState(false); // const isShowingEllipsis = element?.scrollWidth > primaryTitleWrapperEl?.clientWidth;
7
+
8
+ const resizeObserver = useMemo(() => new ResizeObserver(entries => {
7
9
  if (entries.length) {
8
10
  const [textWrapperEntry] = entries;
9
11
  const el = textWrapperEntry.target;
10
- setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);
12
+ setIsShowingEllipsis((el === null || el === void 0 ? void 0 : el.scrollWidth) > (el === null || el === void 0 ? void 0 : el.clientWidth));
11
13
  }
12
14
  }), []);
13
15
  useEffect(() => {
14
16
  if (element) {
15
- setIsShowingEllipsis(element?.scrollWidth > element?.clientWidth);
17
+ setIsShowingEllipsis((element === null || element === void 0 ? void 0 : element.scrollWidth) > (element === null || element === void 0 ? void 0 : element.clientWidth));
16
18
  resizeObserver.observe(element);
17
19
  }
20
+
18
21
  return () => {
19
22
  if (element) {
20
23
  resizeObserver.unobserve(element);
21
24
  }
22
25
  };
23
26
  }, [resizeObserver, element]);
24
- return { setElement, isShowingEllipsis };
27
+ return {
28
+ setElement,
29
+ isShowingEllipsis
30
+ };
25
31
  };
26
- export {
27
- useIsShowingEllipsis
28
- };
29
- //# sourceMappingURL=useIsShowingEllipsis.js.map
32
+
33
+ export { useIsShowingEllipsis };
package/esm/propTypes.js CHANGED
@@ -1,28 +1,21 @@
1
- import * as React from "react";
2
- import { PropTypes } from "react-desc";
1
+ import { PropTypes } from 'react-desc';
2
+
3
3
  const accordionItemPropTypes = {
4
- children: PropTypes.node.description("Dimsum AccordionItem content.").isRequired,
5
- title: PropTypes.string.description("Set a primary title."),
6
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Dimsum AccordionItem value, this value should be unique.").isRequired,
7
- iconClosed: PropTypes.node.description("Custom Dimsum Icon when it is closed."),
8
- iconOpened: PropTypes.node.description("Custom Dimsum Icon when it is open."),
9
- secondaryTitle: PropTypes.string.description("Set a secondary title"),
10
- customActions: PropTypes.arrayOf(PropTypes.object).description("Set Dimsum AccordionItem custom actions."),
11
- renderCustomActions: PropTypes.func.description("This property will render any JSX in the custom actions area. You can access to all references and active values within the props.")
4
+ children: PropTypes.node.description('Dimsum AccordionItem content.').isRequired,
5
+ title: PropTypes.string.description('Set a primary title.'),
6
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Dimsum AccordionItem value, this value should be unique.').isRequired,
7
+ iconClosed: PropTypes.node.description('Custom Dimsum Icon when it is closed.'),
8
+ iconOpened: PropTypes.node.description('Custom Dimsum Icon when it is open.'),
9
+ secondaryTitle: PropTypes.string.description('Set a secondary title'),
10
+ customActions: PropTypes.arrayOf(PropTypes.object).description('Set Dimsum AccordionItem custom actions.'),
11
+ renderCustomActions: PropTypes.func.description('This property will render any JSX in the custom actions area. You can access to all references and active values within the props.')
12
12
  };
13
13
  const accordionPropTypes = {
14
- containerProps: PropTypes.object.description("Adds props to the container."),
15
- activeValue: PropTypes.oneOfType([
16
- PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
17
- PropTypes.string,
18
- PropTypes.number
19
- ]).description("Selected active value. This property makes the component a controlled one."),
20
- children: PropTypes.node.description("Dimsum AccordionItems to show."),
21
- allowMultipleOpen: PropTypes.bool.description("Allows multiple Dimsum AccordionItems to be open at the same time."),
22
- onChange: PropTypes.func.description("Callback function once the Dimsum Accordion changes.")
14
+ containerProps: PropTypes.object.description('Adds props to the container.'),
15
+ activeValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.string, PropTypes.number]).description('Selected active value. This property makes the component a controlled one.'),
16
+ children: PropTypes.node.description('Dimsum AccordionItems to show.'),
17
+ allowMultipleOpen: PropTypes.bool.description('Allows multiple Dimsum AccordionItems to be open at the same time.'),
18
+ onChange: PropTypes.func.description('Callback function once the Dimsum Accordion changes.')
23
19
  };
24
- export {
25
- accordionItemPropTypes,
26
- accordionPropTypes
27
- };
28
- //# sourceMappingURL=propTypes.js.map
20
+
21
+ export { accordionItemPropTypes, accordionPropTypes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-accordion",
3
- "version": "2.2.0-alpha.2",
3
+ "version": "2.2.0-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Accordion",
6
6
  "module": "./esm/index.js",
@@ -84,12 +84,12 @@
84
84
  "build": "node ../../scripts/build/build.js"
85
85
  },
86
86
  "dependencies": {
87
- "@elliemae/ds-button": "2.2.0-alpha.2",
88
- "@elliemae/ds-classnames": "2.2.0-alpha.2",
89
- "@elliemae/ds-icons": "2.2.0-alpha.2",
90
- "@elliemae/ds-shared": "2.2.0-alpha.2",
91
- "@elliemae/ds-system": "2.2.0-alpha.2",
92
- "@elliemae/ds-truncated-tooltip-text": "2.2.0-alpha.2",
87
+ "@elliemae/ds-button": "2.2.0-beta.0",
88
+ "@elliemae/ds-classnames": "2.2.0-beta.0",
89
+ "@elliemae/ds-icons": "2.2.0-beta.0",
90
+ "@elliemae/ds-shared": "2.2.0-beta.0",
91
+ "@elliemae/ds-system": "2.2.0-beta.0",
92
+ "@elliemae/ds-truncated-tooltip-text": "2.2.0-beta.0",
93
93
  "react-desc": "^4.1.3"
94
94
  },
95
95
  "devDependencies": {
@@ -37,7 +37,7 @@ declare const DSAccordion: {
37
37
  };
38
38
  };
39
39
  declare const DSAccordionWithSchema: {
40
- (props?: DSAccordionPropsT | undefined): JSX.Element;
40
+ (props?: unknown): JSX.Element;
41
41
  propTypes: unknown;
42
42
  toTypescript: () => import("react-desc").TypescriptSchema;
43
43
  };
@@ -132,3 +132,6 @@ export interface StyledItemAddonPropsT {
132
132
  disabled: boolean;
133
133
  isDSMobile: boolean;
134
134
  }
135
+ export interface StyledItemHeaderContainerPropsT {
136
+ disabled: boolean;
137
+ }
@@ -45,7 +45,7 @@ declare const DSAccordionItem: {
45
45
  };
46
46
  };
47
47
  declare const DSAccordionItemWithSchema: {
48
- (props?: DSAccordionItemPropsT | undefined): JSX.Element;
48
+ (props?: unknown): JSX.Element;
49
49
  propTypes: unknown;
50
50
  toTypescript: () => import("react-desc").TypescriptSchema;
51
51
  };
@@ -1,4 +1,4 @@
1
- import type { StyledItemAddonPropsT, StyledItemHeaderPropsT, StyledItemTitlesPropsT, StyledPrimaryTitlePropsT, StyledSecondaryTitlePropsT, StyledItemContentPropsT } from '../../DSAccordionTypes';
1
+ import type { StyledItemAddonPropsT, StyledItemHeaderPropsT, StyledItemTitlesPropsT, StyledPrimaryTitlePropsT, StyledSecondaryTitlePropsT, StyledItemContentPropsT, StyledItemHeaderContainerPropsT } from '../../DSAccordionTypes';
2
2
  export declare const StyledItemContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
3
  export declare const StyledItemHeader: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, StyledItemHeaderPropsT, never>;
4
4
  export declare const StyledItemContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemContentPropsT, never>;
@@ -7,4 +7,4 @@ export declare const StyledItemTitles: import("styled-components").StyledCompone
7
7
  export declare const StyledPrimaryTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledPrimaryTitlePropsT, never>;
8
8
  export declare const StyledSecondaryTitle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, StyledSecondaryTitlePropsT, never>;
9
9
  export declare const StyledItemCustomActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
- export declare const StyledItemHeaderContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
+ export declare const StyledItemHeaderContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemHeaderContainerPropsT, never>;
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/DSAccordion.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { describe } from 'react-desc';\nimport { AccordionContent } from './parts/accordionContent/AccordionContent';\nimport { useAccordion } from './config/useAccordion';\nimport { DSAccordionContext } from './DSAccordionCTX';\nimport { accordionPropTypes } from './propTypes';\nimport type { DSAccordionPropsT } from './DSAccordionTypes';\n\nconst DSAccordion = (props: DSAccordionPropsT): JSX.Element => {\n const ctx = useAccordion(props);\n\n return (\n <DSAccordionContext.Provider value={ctx}>\n <AccordionContent />\n </DSAccordionContext.Provider>\n );\n};\n\nDSAccordion.propTypes = accordionPropTypes;\nconst DSAccordionWithSchema = describe(DSAccordion);\nDSAccordionWithSchema.propTypes = accordionPropTypes;\n\nexport { DSAccordion, DSAccordionWithSchema };\n\nexport default DSAccordion;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAyB;AACzB,8BAAiC;AACjC,0BAA6B;AAC7B,4BAAmC;AACnC,uBAAmC;AAGnC,MAAM,cAAc,CAAC,UAA0C;AAC7D,QAAM,MAAM,sCAAa;AAEzB,SACE,mDAAC,yCAAmB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAClC,mDAAC,0CAAD;AAAA;AAKN,YAAY,YAAY;AACxB,MAAM,wBAAwB,gCAAS;AACvC,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/DSAccordionCTX.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { createContext } from 'react';\nimport { defaultProps } from './defaultProps';\nimport type { DSAccordionContextT } from './DSAccordionTypes';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nconst defaultContext = {\n props: defaultProps,\n actualActiveValue: [],\n setActiveValues: noop,\n focusableChildrenReferences: [],\n allChildrenReferences: {},\n};\n\nexport const DSAccordionContext = createContext<DSAccordionContextT>(defaultContext);\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAC9B,0BAA6B;AAI7B,MAAM,OAAO,MAAY;AAAA;AAEzB,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,6BAA6B;AAAA,EAC7B,uBAAuB;AAAA;AAGlB,MAAM,qBAAqB,gCAAmC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/DSAccordionDatatestid.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export const DSAccordionDataTestid = {\n ITEM: {\n CONTENT: 'ds-accordion_item-content',\n HEADER: 'ds-accordion_item-header',\n CONTAINER: 'ds-accordion_item',\n },\n GROUP: 'ds-accordion_group',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,wBAAwB;AAAA,EACnC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,WAAW;AAAA;AAAA,EAEb,OAAO;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/DSAccordionTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\n\n/* ****************************************** Misc Types ********************************************** */\n\nexport type InternalActiveValueT = (string | number)[] | string | number | null | undefined;\n\nexport interface DefaultIconPropsT {\n isDSMobile: boolean;\n}\n\nexport interface CustomActionsT {\n onClick: (e: React.MouseEvent) => void;\n id: string;\n}\n\nexport interface FocusableChildrenReferences {\n index: number;\n value: string | number;\n ref: React.MutableRefObject<HTMLButtonElement | null>;\n}\n\nexport interface AllChildrenReferences {\n [index: string]: React.MutableRefObject<HTMLButtonElement | null>;\n}\n\n/* ****************************************** Component Types ********************************************** */\n\nexport interface DSAccordionPropsT {\n containerProps?: Record<string, unknown>;\n activeValue?: (string | number)[] | string | number | null;\n children?: React.ReactElement<DSAccordionItemPropsT>[];\n allowMultipleOpen?: boolean;\n contentExpandable?: boolean;\n onChange?: (value: (string | number)[] | string | number | null, e: React.MouseEvent | React.KeyboardEvent) => void;\n disabled?: boolean;\n isDSMobile?: boolean;\n}\n\nexport interface DSAccordionDefaultPropsT {\n containerProps: Record<string, unknown>;\n allowMultipleOpen: boolean;\n contentExpandable: boolean;\n onChange: (value: (string | number)[] | string | number | null, e: React.MouseEvent | React.KeyboardEvent) => void;\n children: React.ReactElement<DSAccordionItemPropsT>[];\n isDSMobile: boolean;\n}\n\nexport interface DSAccordionPropsWithDefaultsT {\n containerProps: Record<string, unknown>;\n activeValue?: (string | number)[] | string | number | null;\n children: React.ReactElement<DSAccordionItemPropsT>[];\n allowMultipleOpen: boolean;\n contentExpandable: boolean;\n onChange: (value: (string | number)[] | string | number | null, e: React.MouseEvent | React.KeyboardEvent) => void;\n isDSMobile: boolean;\n}\n\nexport interface DSAccordionItemPropsT {\n title?: string;\n value: string | number;\n iconClosed?: React.FunctionComponent<DefaultIconPropsT>;\n iconOpened?: React.FunctionComponent<DefaultIconPropsT>;\n children?: React.ReactNode;\n secondaryTitle?: string;\n customActions?: CustomActionsT[];\n disabled?: boolean;\n dsIndex: number;\n renderCustomActions?: (props: {\n allRefs: AllChildrenReferences;\n actualActiveValue: InternalActiveValueT;\n }) => JSX.Element;\n}\n\nexport interface DSAccordionItemDefaultPropsT {\n iconClosed: React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>>;\n iconOpened: React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>>;\n title: string;\n customActions: CustomActionsT[];\n disabled: boolean;\n}\n\nexport interface DSAccordionItemPropsWithDefaultsT {\n title: string;\n value: string | number;\n iconClosed:\n | React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>>\n | React.FunctionComponent<DefaultIconPropsT>;\n iconOpened:\n | React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>>\n | React.FunctionComponent<DefaultIconPropsT>;\n children?: React.ReactNode;\n secondaryTitle?: string;\n customActions: CustomActionsT[];\n disabled: boolean;\n dsIndex: number;\n renderCustomActions?: (props: {\n allRefs: AllChildrenReferences;\n actualActiveValue: InternalActiveValueT;\n }) => JSX.Element;\n}\n\n/* ****************************************** Context Types ********************************************** */\n\nexport interface DSAccordionContextT {\n props: DSAccordionPropsWithDefaultsT;\n actualActiveValue: InternalActiveValueT;\n setActiveValues: (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => void;\n focusableChildrenReferences: FocusableChildrenReferences[];\n allChildrenReferences: AllChildrenReferences;\n}\nexport interface DSAccordionUseAccordionContextT {\n props: DSAccordionPropsWithDefaultsT;\n actualActiveValue: InternalActiveValueT;\n setActiveValues: (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => void;\n focusableChildrenReferences: FocusableChildrenReferences[];\n allChildrenReferences: AllChildrenReferences;\n}\n\n/* ****************************************** Hooks Types ********************************************** */\n\nexport interface UseAccordionPropsT {\n value: string | number;\n disabled: boolean;\n}\n\nexport interface UseAccordionItemReturnTypeT {\n handleOnClick: (e: React.MouseEvent) => void;\n handleOnKeyDown: (e: React.KeyboardEvent, dsIndex: number) => void;\n selected: boolean;\n}\n\nexport interface UseAccordionRefsPropsT {\n children: React.ReactElement<DSAccordionItemPropsT>[];\n}\n\nexport interface UseAccordionRefsReturnTypeT {\n focusableChildrenReferences: FocusableChildrenReferences[];\n allChildrenReferences: AllChildrenReferences;\n}\n\n/* ****************************************** Styled Types ********************************************** */\n\nexport interface StyledItemHeaderPropsT {\n withCustomActions: boolean;\n withSecondaryTitle?: string;\n isDSMobile: boolean;\n}\n\nexport interface StyledItemTitlesPropsT {\n withSecondaryTitle?: string;\n isDSMobile: boolean;\n}\n\nexport interface StyledPrimaryTitlePropsT {\n disabled: boolean;\n isDSMobile: boolean;\n}\n\nexport interface StyledItemContentPropsT {\n isDSMobile: boolean;\n}\n\nexport interface StyledSecondaryTitlePropsT {\n disabled: boolean;\n}\n\nexport interface StyledItemAddonPropsT {\n disabled: boolean;\n isDSMobile: boolean;\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/config/useAccordion.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useMemo, useState, useCallback } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useAccordionRefs } from './useAccordionRefs';\nimport { defaultProps } from '../defaultProps';\nimport type {\n DSAccordionPropsT,\n DSAccordionUseAccordionContextT,\n DSAccordionPropsWithDefaultsT,\n InternalActiveValueT,\n} from '../DSAccordionTypes';\n\nexport const useAccordion = (props: DSAccordionPropsT): DSAccordionUseAccordionContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps) as DSAccordionPropsWithDefaultsT;\n\n const { activeValue, allowMultipleOpen, onChange } = propsWithDefaults;\n\n const { focusableChildrenReferences, allChildrenReferences } = useAccordionRefs(propsWithDefaults);\n\n const [internalActiveValue, setInternalActiveValue] = useState<InternalActiveValueT>(activeValue);\n\n const actualActiveValue = useMemo(() => {\n if (activeValue === undefined) return internalActiveValue;\n return activeValue;\n }, [activeValue, internalActiveValue]);\n\n const setActiveValues = useCallback(\n (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => {\n let newState: InternalActiveValueT;\n if (allowMultipleOpen && (actualActiveValue === undefined || actualActiveValue === null)) newState = [value];\n else if (allowMultipleOpen && Array.isArray(actualActiveValue))\n if (!actualActiveValue.some((currentValues: string | number) => currentValues === value))\n newState = [...actualActiveValue, value];\n else newState = actualActiveValue.filter((currentValues: string | number) => currentValues !== value);\n else if (actualActiveValue === value) newState = null;\n else newState = value;\n setInternalActiveValue(newState);\n return onChange(newState, e);\n },\n [actualActiveValue, allowMultipleOpen, onChange],\n );\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefaults,\n actualActiveValue,\n setActiveValues,\n focusableChildrenReferences,\n allChildrenReferences,\n }),\n [actualActiveValue, allChildrenReferences, focusableChildrenReferences, propsWithDefaults, setActiveValues],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsD;AACtD,8BAA6C;AAC7C,8BAAiC;AACjC,0BAA6B;AAQtB,MAAM,eAAe,CAAC,UAA8D;AACzF,QAAM,oBAAoB,0DAA6B,OAAO;AAE9D,QAAM,EAAE,aAAa,mBAAmB,aAAa;AAErD,QAAM,EAAE,6BAA6B,0BAA0B,8CAAiB;AAEhF,QAAM,CAAC,qBAAqB,0BAA0B,2BAA+B;AAErF,QAAM,oBAAoB,0BAAQ,MAAM;AACtC,QAAI,gBAAgB;AAAW,aAAO;AACtC,WAAO;AAAA,KACN,CAAC,aAAa;AAEjB,QAAM,kBAAkB,8BACtB,CAAC,OAAwB,MAA8C;AACrE,QAAI;AACJ,QAAI,qBAAsB,uBAAsB,UAAa,sBAAsB;AAAO,iBAAW,CAAC;AAAA,aAC7F,qBAAqB,MAAM,QAAQ;AAC1C,UAAI,CAAC,kBAAkB,KAAK,CAAC,kBAAmC,kBAAkB;AAChF,mBAAW,CAAC,GAAG,mBAAmB;AAAA;AAC/B,mBAAW,kBAAkB,OAAO,CAAC,kBAAmC,kBAAkB;AAAA,aACxF,sBAAsB;AAAO,iBAAW;AAAA;AAC5C,iBAAW;AAChB,2BAAuB;AACvB,WAAO,SAAS,UAAU;AAAA,KAE5B,CAAC,mBAAmB,mBAAmB;AAGzC,QAAM,MAAM,0BACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF,CAAC,mBAAmB,uBAAuB,6BAA6B,mBAAmB;AAG7F,SAAO;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/config/useAccordionRefs.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useMemo } from 'react';\nimport type {\n UseAccordionRefsPropsT,\n UseAccordionRefsReturnTypeT,\n FocusableChildrenReferences,\n AllChildrenReferences,\n} from '../DSAccordionTypes';\n\nexport const useAccordionRefs = ({ children }: UseAccordionRefsPropsT): UseAccordionRefsReturnTypeT =>\n useMemo(() => {\n const focusableChildrenReferences: FocusableChildrenReferences[] = [];\n const allChildrenReferences: AllChildrenReferences = {};\n\n React.Children.map(children, (child, index) => {\n const { value, disabled } = child.props;\n const currentRef = React.createRef<HTMLButtonElement>();\n allChildrenReferences[index] = currentRef;\n if (!disabled) focusableChildrenReferences.push({ index, value, ref: currentRef });\n });\n return { focusableChildrenReferences, allChildrenReferences };\n }, [children]);\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+B;AAQxB,MAAM,mBAAmB,CAAC,EAAE,eACjC,0BAAQ,MAAM;AACZ,QAAM,8BAA6D;AACnE,QAAM,wBAA+C;AAErD,uBAAM,SAAS,IAAI,UAAU,CAAC,OAAO,UAAU;AAC7C,UAAM,EAAE,OAAO,aAAa,MAAM;AAClC,UAAM,aAAa,qBAAM;AACzB,0BAAsB,SAAS;AAC/B,QAAI,CAAC;AAAU,kCAA4B,KAAK,EAAE,OAAO,OAAO,KAAK;AAAA;AAEvE,SAAO,EAAE,6BAA6B;AAAA,GACrC,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { memo } from 'react';\nimport { ArrowheadRight, ArrowheadDown, ChevronRight, ChevronDown } from '@elliemae/ds-icons';\nimport type { DefaultIconPropsT, DSAccordionDefaultPropsT, DSAccordionItemDefaultPropsT } from './DSAccordionTypes';\n\nconst DefaultIconClosed = memo(({ isDSMobile = false }: DefaultIconPropsT) =>\n isDSMobile ? <ChevronRight width=\"20px\" /> : <ArrowheadRight width=\"20px\" />,\n);\n\nconst DefaultIconOpen = memo(({ isDSMobile = false }: DefaultIconPropsT) =>\n isDSMobile ? <ChevronDown width=\"20px\" /> : <ArrowheadDown width=\"20px\" />,\n);\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nexport const defaultProps: DSAccordionDefaultPropsT = {\n containerProps: {},\n allowMultipleOpen: false,\n contentExpandable: false,\n onChange: noop,\n children: [],\n isDSMobile: false,\n};\n\nexport const accordionItemDefaultProps: DSAccordionItemDefaultPropsT = {\n iconClosed: DefaultIconClosed,\n iconOpened: DefaultIconOpen,\n title: '',\n customActions: [],\n disabled: false,\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAC5B,sBAAyE;AAGzE,MAAM,oBAAoB,uBAAK,CAAC,EAAE,aAAa,YAC7C,aAAa,mDAAC,8BAAD;AAAA,EAAc,OAAM;AAAA,KAAY,mDAAC,gCAAD;AAAA,EAAgB,OAAM;AAAA;AAGrE,MAAM,kBAAkB,uBAAK,CAAC,EAAE,aAAa,YAC3C,aAAa,mDAAC,6BAAD;AAAA,EAAa,OAAM;AAAA,KAAY,mDAAC,+BAAD;AAAA,EAAe,OAAM;AAAA;AAInE,MAAM,OAAO,MAAY;AAAA;AAElB,MAAM,eAAyC;AAAA,EACpD,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA;AAGP,MAAM,4BAA0D;AAAA,EACrE,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,eAAe;AAAA,EACf,UAAU;AAAA;",
6
- "names": []
7
- }
package/cjs/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './DSAccordion';\nexport * from './parts/accordionItem/DSAccordionItem';\n\nexport type { DSAccordionPropsT, DSAccordionItemPropsT } from './DSAccordionTypes';\n\nexport { default } from './DSAccordion';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AAId,yBAAwB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/parts/accordionContent/AccordionContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useContext } from 'react';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../DSAccordionDatatestid';\nimport type { DSAccordionItemPropsT } from '../../DSAccordionTypes';\n\nexport const AccordionContent = (): JSX.Element => {\n const {\n props: { containerProps, children },\n } = useContext(DSAccordionContext);\n\n const childrenWithIndex: React.ReactElement<DSAccordionItemPropsT>[] = [];\n\n React.Children.forEach(children, (child, index) =>\n childrenWithIndex.push(\n React.cloneElement(child, {\n dsIndex: index,\n }),\n ),\n );\n\n return (\n <div {...containerProps} data-testid={DSAccordionDataTestid.GROUP}>\n {childrenWithIndex}\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,4BAAmC;AACnC,mCAAsC;AAG/B,MAAM,mBAAmB,MAAmB;AACjD,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB;AAAA,MACvB,6BAAW;AAEf,QAAM,oBAAiE;AAEvE,uBAAM,SAAS,QAAQ,UAAU,CAAC,OAAO,UACvC,kBAAkB,KAChB,qBAAM,aAAa,OAAO;AAAA,IACxB,SAAS;AAAA;AAKf,SACE,mDAAC,OAAD;AAAA,OAAS;AAAA,IAAgB,eAAa,mDAAsB;AAAA,KACzD;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/parts/accordionItem/DSAccordionItem.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useState, useContext, useCallback, useMemo } from 'react';\nimport { describe } from 'react-desc';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { DSButton, BUTTON_TYPE } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { accordionItemDefaultProps } from '../../defaultProps';\nimport {\n StyledItemAddon,\n StyledItemContainer,\n StyledItemContent,\n StyledItemCustomActions,\n StyledItemHeader,\n StyledItemHeaderContainer,\n StyledItemTitles,\n StyledPrimaryTitle,\n StyledSecondaryTitle,\n} from './styles';\nimport { accordionItemPropTypes } from '../../propTypes';\nimport { useAccordionItem } from './useAccordionItem';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../DSAccordionDatatestid';\nimport { useIsShowingEllipsis } from './useIsShowingEllipsis';\nimport type { DSAccordionItemPropsT, DSAccordionItemPropsWithDefaultsT } from '../../DSAccordionTypes';\n\nconst DSAccordionItem = (props: DSAccordionItemPropsT): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n accordionItemDefaultProps,\n ) as DSAccordionItemPropsWithDefaultsT;\n\n const {\n children,\n title,\n secondaryTitle,\n customActions,\n iconOpened: IconOpened,\n iconClosed: IconClosed,\n value,\n disabled,\n dsIndex,\n renderCustomActions,\n } = propsWithDefaults;\n\n const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled });\n const {\n allChildrenReferences,\n actualActiveValue,\n props: { isDSMobile },\n } = useContext(DSAccordionContext);\n\n const onKeyDownWithIndex = useCallback(\n (e: React.KeyboardEvent) => {\n handleOnKeyDown(e, dsIndex);\n },\n [dsIndex, handleOnKeyDown],\n );\n\n const [showPopover, setShowPopover] = useState(false);\n const [referenceElement, setReferenceElement] = useState();\n\n const CustomActionsContent = useMemo(() => {\n if (!isDSMobile && customActions?.length > 0)\n return (\n <StyledItemCustomActions>\n {customActions?.map(({ onClick, id, ...rest }) => (\n <DSButton\n key={id}\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n if (onClick) onClick(e);\n }}\n {...rest}\n buttonType={BUTTON_TYPE.SECONDARY}\n />\n ))}\n </StyledItemCustomActions>\n );\n\n if (!isDSMobile && renderCustomActions)\n return (\n <StyledItemCustomActions>\n {renderCustomActions({ allRefs: allChildrenReferences, actualActiveValue })}\n </StyledItemCustomActions>\n );\n return null;\n }, [actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);\n\n const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();\n\n const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();\n\n const handleOnFocus = useCallback(\n () => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),\n [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis],\n );\n\n const handleOnBlur = useCallback(() => setShowPopover(false), []);\n\n const Titles = useMemo(() => {\n if (isPrimaryShowingEllipsis || isSecondaryShowingEllipsis)\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n id={`accordion_${title}id`}\n disabled={disabled}\n isDSMobile={isDSMobile}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n <DSPopperJS referenceElement={referenceElement} showPopover={showPopover}>\n <div style={{ maxWidth: 260, padding: 8, background: 'white', display: 'grid', gap: 8 }}>\n <p style={{ margin: 0 }}>{title}</p>\n <p style={{ margin: 0 }}> {secondaryTitle}</p>\n </div>\n </DSPopperJS>\n </>\n );\n\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n id={`accordion_${title}id`}\n disabled={disabled}\n isDSMobile={isDSMobile}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n </>\n );\n }, [\n disabled,\n isDSMobile,\n isPrimaryShowingEllipsis,\n isSecondaryShowingEllipsis,\n referenceElement,\n secondaryTitle,\n setPrimaryElement,\n setSecondaryElement,\n showPopover,\n title,\n ]);\n\n return (\n <StyledItemContainer data-testid={DSAccordionDataTestid.ITEM.CONTAINER}>\n <StyledItemHeaderContainer disabled={disabled}>\n <StyledItemHeader\n withCustomActions={(customActions?.length > 0 || renderCustomActions !== undefined) && !isDSMobile}\n withSecondaryTitle={secondaryTitle}\n onClick={handleOnClick}\n tabIndex={!disabled ? 0 : undefined}\n disabled={disabled}\n data-disabled={disabled}\n ref={allChildrenReferences[dsIndex]}\n onKeyDown={onKeyDownWithIndex}\n isDSMobile={isDSMobile}\n data-testid={DSAccordionDataTestid.ITEM.HEADER}\n id={`ds-accordion-header-${value}`}\n aria-expanded={selected}\n aria-disabled={disabled}\n aria-controls={`ds-accordion-content-${value}`}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n >\n <StyledItemAddon disabled={disabled} isDSMobile={isDSMobile}>\n {selected ? <IconOpened isDSMobile={isDSMobile} /> : <IconClosed isDSMobile={isDSMobile} />}\n </StyledItemAddon>\n <StyledItemTitles\n onMouseEnter={handleOnFocus}\n onMouseLeave={handleOnBlur}\n isDSMobile={isDSMobile}\n ref={setReferenceElement}\n >\n {Titles}\n </StyledItemTitles>\n </StyledItemHeader>\n {CustomActionsContent}\n </StyledItemHeaderContainer>\n {selected && (\n <StyledItemContent\n data-testid={DSAccordionDataTestid.ITEM.CONTENT}\n aria-labelledby={`ds-accordion-header-${value}`}\n role=\"region\"\n isDSMobile={isDSMobile}\n id={`ds-accordion-content-${value}`}\n >\n {children}\n </StyledItemContent>\n )}\n </StyledItemContainer>\n );\n};\n\nDSAccordionItem.propTypes = accordionItemPropTypes;\n\nconst DSAccordionItemWithSchema = describe(DSAccordionItem);\nDSAccordionItemWithSchema.propTypes = accordionItemPropTypes;\n\nexport { DSAccordionItem, DSAccordionItemWithSchema };\nexport default DSAccordionItem;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": "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",
6
- "names": []
7
- }