@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,147 +1,133 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var styles_exports = {};
29
- __export(styles_exports, {
30
- StyledItemAddon: () => StyledItemAddon,
31
- StyledItemContainer: () => StyledItemContainer,
32
- StyledItemContent: () => StyledItemContent,
33
- StyledItemCustomActions: () => StyledItemCustomActions,
34
- StyledItemHeader: () => StyledItemHeader,
35
- StyledItemHeaderContainer: () => StyledItemHeaderContainer,
36
- StyledItemTitles: () => StyledItemTitles,
37
- StyledPrimaryTitle: () => StyledPrimaryTitle,
38
- StyledSecondaryTitle: () => StyledSecondaryTitle
39
- });
40
- var React = __toESM(require("react"));
41
- var import_styled_components = __toESM(require("styled-components"));
42
- const StyledItemContainer = import_styled_components.default.div`
43
- display: grid;
44
- grid-template-rows: auto auto;
45
- border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[200]};
46
- align-items: center;
47
- `;
48
- const StyledItemHeader = import_styled_components.default.button`
49
- display: grid;
50
- height: ${({ withSecondaryTitle }) => withSecondaryTitle ? "48px" : "32px"};
51
- grid-template-columns: ${({ withCustomActions, isDSMobile }) => withCustomActions ? "32px auto" : `${isDSMobile ? `auto 32px` : `32px auto`}`};
52
- width: 100%;
53
- align-items: center;
54
- border: none;
55
- outline: none;
56
- background: none;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
57
4
 
58
- &:hover {
59
- cursor: ${({ disabled }) => disabled ? "not-allowed" : "pointer"};
60
- }
5
+ var styled = require('styled-components');
61
6
 
62
- padding: ${({ isDSMobile }) => isDSMobile ? `0 16px` : `0`};
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
63
8
 
64
- ${({ isDSMobile }) => isDSMobile ? `grid-template-areas: 'title addon';` : ``}
9
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
65
10
 
66
- &:focus {
67
- &:after {
68
- position: absolute;
69
- content: '';
70
- left: 0;
71
- top: 0;
72
- width: 100%;
73
- height: 100%;
74
- border-radius: 2px;
75
- border: 2px solid ${({ theme }) => theme.colors.brand[700]};
76
- pointer-events: none;
77
- }
78
- }
79
- `;
80
- const StyledItemContent = import_styled_components.default.div`
81
- margin: ${({ isDSMobile }) => isDSMobile ? `16px 16px 24px 16px` : `16px 16px 16px 32px`};
82
- grid-column: 1/2;
83
- `;
84
- const StyledItemAddon = import_styled_components.default.div`
85
- ${({ isDSMobile }) => !isDSMobile ? ` padding: 0 8px;
86
-
87
- ` : `
88
- grid-area: addon;
89
- `}
90
- height: 100%;
91
- display: grid;
92
- place-items: center;
11
+ const StyledItemContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
12
+ componentId: "sc-fnpjby-0"
13
+ })(["display:grid;grid-template-rows:auto auto;border-bottom:1px solid ", ";align-items:center;"], _ref => {
14
+ let {
15
+ theme
16
+ } = _ref;
17
+ return theme.colors.neutral[200];
18
+ });
19
+ const StyledItemHeader = /*#__PURE__*/styled__default["default"].button.withConfig({
20
+ componentId: "sc-fnpjby-1"
21
+ })(["display:grid;height:", ";grid-template-columns:", ";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 => {
22
+ let {
23
+ withSecondaryTitle
24
+ } = _ref2;
25
+ return withSecondaryTitle ? '48px' : '32px';
26
+ }, _ref3 => {
27
+ let {
28
+ withCustomActions,
29
+ isDSMobile
30
+ } = _ref3;
31
+ return withCustomActions ? '32px auto' : "".concat(isDSMobile ? "auto 32px" : "32px auto");
32
+ }, _ref4 => {
33
+ let {
34
+ disabled
35
+ } = _ref4;
36
+ return disabled ? 'not-allowed' : 'pointer';
37
+ }, _ref5 => {
38
+ let {
39
+ isDSMobile
40
+ } = _ref5;
41
+ return isDSMobile ? "0 16px" : "0";
42
+ }, _ref6 => {
43
+ let {
44
+ isDSMobile
45
+ } = _ref6;
46
+ return isDSMobile ? "grid-template-areas: 'title addon';" : "";
47
+ }, _ref7 => {
48
+ let {
49
+ theme
50
+ } = _ref7;
51
+ return theme.colors.brand[700];
52
+ });
53
+ const StyledItemContent = /*#__PURE__*/styled__default["default"].div.withConfig({
54
+ componentId: "sc-fnpjby-2"
55
+ })(["margin:", ";grid-column:1/2;"], _ref8 => {
56
+ let {
57
+ isDSMobile
58
+ } = _ref8;
59
+ return isDSMobile ? "16px 16px 24px 16px" : "16px 16px 16px 32px";
60
+ });
61
+ const StyledItemAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
62
+ componentId: "sc-fnpjby-3"
63
+ })(["", " height:100%;display:grid;place-items:center;& .em-ds-icon svg{fill:", ";}"], _ref9 => {
64
+ let {
65
+ isDSMobile
66
+ } = _ref9;
67
+ return !isDSMobile ? " padding: 0 8px;\n \n" : "\n grid-area: addon;\n ";
68
+ }, _ref10 => {
69
+ let {
70
+ disabled,
71
+ theme
72
+ } = _ref10;
73
+ return disabled ? theme.colors.neutral[200] : theme.colors.brand[800];
74
+ });
75
+ const StyledItemTitles = /*#__PURE__*/styled__default["default"].div.withConfig({
76
+ componentId: "sc-fnpjby-4"
77
+ })(["display:grid;grid-template-columns:100%;align-content:center;", ""], _ref11 => {
78
+ let {
79
+ isDSMobile
80
+ } = _ref11;
81
+ return isDSMobile ? "grid-area: title;" : "";
82
+ });
83
+ const StyledPrimaryTitle = /*#__PURE__*/styled__default["default"].div.withConfig({
84
+ componentId: "sc-fnpjby-5"
85
+ })(["margin:0;font-size:16px;color:", ";font-weight:", ";text-overflow:ellipsis;overflow:hidden;height:16px;width:100%;text-align:left;display:block;white-space:nowrap;"], _ref12 => {
86
+ let {
87
+ disabled,
88
+ theme
89
+ } = _ref12;
90
+ return disabled ? theme.colors.neutral[200] : theme.colors.neutral[700];
91
+ }, _ref13 => {
92
+ let {
93
+ theme,
94
+ isDSMobile
95
+ } = _ref13;
96
+ return isDSMobile ? theme.fontWeights.regular : theme.fontWeights.regular;
97
+ });
98
+ const StyledSecondaryTitle = /*#__PURE__*/styled__default["default"].span.withConfig({
99
+ componentId: "sc-fnpjby-6"
100
+ })(["margin:0;font-size:", ";text-align:left;color:", ";text-overflow:ellipsis;overflow:hidden;height:16px;width:100%;text-align:left;display:block;white-space:nowrap;"], _ref14 => {
101
+ let {
102
+ theme
103
+ } = _ref14;
104
+ return theme.fontSizes.label[200];
105
+ }, _ref15 => {
106
+ let {
107
+ disabled,
108
+ theme
109
+ } = _ref15;
110
+ return disabled ? theme.colors.neutral[200] : theme.colors.neutral[500];
111
+ });
112
+ const StyledItemCustomActions = /*#__PURE__*/styled__default["default"].div.withConfig({
113
+ componentId: "sc-fnpjby-7"
114
+ })(["display:grid;grid-auto-flow:column;grid-gap:8px;margin:0 16px;justify-content:flex-end;"]);
115
+ const StyledItemHeaderContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
116
+ componentId: "sc-fnpjby-8"
117
+ })(["display:grid;grid-template-columns:auto max-content;place-items:center;position:relative;&:hover{", ";}"], _ref16 => {
118
+ let {
119
+ disabled,
120
+ theme
121
+ } = _ref16;
122
+ return !disabled ? "background: ".concat(theme.colors.brand[200]) : "";
123
+ });
93
124
 
94
- & .em-ds-icon svg {
95
- fill: ${({ disabled, theme }) => disabled ? theme.colors.neutral[200] : theme.colors.brand[800]};
96
- }
97
- `;
98
- const StyledItemTitles = import_styled_components.default.div`
99
- display: grid;
100
- grid-template-columns: 100%;
101
- align-content: center;
102
- ${({ isDSMobile }) => isDSMobile ? `grid-area: title;` : ``}
103
- `;
104
- const StyledPrimaryTitle = import_styled_components.default.div`
105
- margin: 0;
106
- font-size: 16px;
107
- color: ${({ disabled, theme }) => disabled ? theme.colors.neutral[200] : theme.colors.neutral[700]};
108
- font-weight: ${({ theme, isDSMobile }) => isDSMobile ? theme.fontWeights.regular : theme.fontWeights.regular};
109
- text-overflow: ellipsis;
110
- overflow: hidden;
111
- height: 16px;
112
- width: 100%;
113
- text-align: left;
114
- display: block;
115
- white-space: nowrap;
116
- `;
117
- const StyledSecondaryTitle = import_styled_components.default.span`
118
- margin: 0;
119
- font-size: ${({ theme }) => theme.fontSizes.label[200]};
120
- text-align: left;
121
- color: ${({ disabled, theme }) => disabled ? theme.colors.neutral[200] : theme.colors.neutral[500]};
122
- text-overflow: ellipsis;
123
- overflow: hidden;
124
- height: 16px;
125
- width: 100%;
126
- text-align: left;
127
- display: block;
128
- white-space: nowrap;
129
- `;
130
- const StyledItemCustomActions = import_styled_components.default.div`
131
- display: grid;
132
- grid-auto-flow: column;
133
- grid-gap: 8px;
134
- margin: 0 16px;
135
- justify-content: flex-end;
136
- `;
137
- const StyledItemHeaderContainer = import_styled_components.default.div`
138
- display: grid;
139
- grid-template-columns: auto max-content;
140
- place-items: center;
141
- position: relative;
142
- &:hover {
143
- ${({ disabled, theme }) => !disabled ? `background: ${theme.colors.brand[200]}` : ``};
144
- }
145
- `;
146
- module.exports = __toCommonJS(styles_exports);
147
- //# sourceMappingURL=styles.js.map
125
+ exports.StyledItemAddon = StyledItemAddon;
126
+ exports.StyledItemContainer = StyledItemContainer;
127
+ exports.StyledItemContent = StyledItemContent;
128
+ exports.StyledItemCustomActions = StyledItemCustomActions;
129
+ exports.StyledItemHeader = StyledItemHeader;
130
+ exports.StyledItemHeaderContainer = StyledItemHeaderContainer;
131
+ exports.StyledItemTitles = StyledItemTitles;
132
+ exports.StyledPrimaryTitle = StyledPrimaryTitle;
133
+ exports.StyledSecondaryTitle = StyledSecondaryTitle;
@@ -1,59 +1,46 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var useAccordionItem_exports = {};
29
- __export(useAccordionItem_exports, {
30
- useAccordionItem: () => useAccordionItem
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = require("react");
34
- var import_DSAccordionCTX = require("../../DSAccordionCTX");
35
- const useAccordionItem = ({ value, disabled }) => {
36
- const { actualActiveValue, setActiveValues, focusableChildrenReferences } = (0, import_react.useContext)(import_DSAccordionCTX.DSAccordionContext);
37
- const selected = (0, import_react.useMemo)(() => {
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.some.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.some.js');
8
+ var React = require('react');
9
+ var DSAccordionCTX = require('../../DSAccordionCTX.js');
10
+
11
+ const useAccordionItem = _ref => {
12
+ let {
13
+ value,
14
+ disabled
15
+ } = _ref;
16
+ const {
17
+ actualActiveValue,
18
+ setActiveValues,
19
+ focusableChildrenReferences
20
+ } = React.useContext(DSAccordionCTX.DSAccordionContext);
21
+ const selected = React.useMemo(() => {
38
22
  if (Array.isArray(actualActiveValue)) {
39
- return actualActiveValue.some((currentValue) => currentValue === value);
23
+ return actualActiveValue.some(currentValue => currentValue === value);
40
24
  }
25
+
41
26
  return value === actualActiveValue;
42
27
  }, [actualActiveValue, value]);
43
- const handleOnClick = (0, import_react.useCallback)((e) => {
44
- if (!disabled)
45
- setActiveValues(value, e);
28
+ const handleOnClick = React.useCallback(e => {
29
+ if (!disabled) setActiveValues(value, e);
46
30
  }, [disabled, setActiveValues, value]);
47
- const handleOnKeyDown = (0, import_react.useCallback)((e, _dsIndex) => {
48
- if (!disabled && e.key === "ArrowDown") {
49
- const currentIndex = focusableChildrenReferences.findIndex((item) => item.index === _dsIndex);
50
- if (focusableChildrenReferences[currentIndex + 1]?.ref?.current)
51
- focusableChildrenReferences[currentIndex + 1]?.ref?.current?.focus();
31
+ const handleOnKeyDown = React.useCallback((e, _dsIndex) => {
32
+ if (!disabled && e.key === 'ArrowDown') {
33
+ var _focusableChildrenRef, _focusableChildrenRef2, _focusableChildrenRef3, _focusableChildrenRef4, _focusableChildrenRef5;
34
+
35
+ const currentIndex = focusableChildrenReferences.findIndex(item => item.index === _dsIndex);
36
+ 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();
52
37
  }
53
- if (!disabled && e.key === "ArrowUp") {
54
- const currentIndex = focusableChildrenReferences.findIndex((item) => item.index === _dsIndex);
55
- if (focusableChildrenReferences[currentIndex - 1]?.ref?.current)
56
- focusableChildrenReferences[currentIndex - 1]?.ref?.current?.focus();
38
+
39
+ if (!disabled && e.key === 'ArrowUp') {
40
+ var _focusableChildrenRef6, _focusableChildrenRef7, _focusableChildrenRef8, _focusableChildrenRef9, _focusableChildrenRef10;
41
+
42
+ const currentIndex = focusableChildrenReferences.findIndex(item => item.index === _dsIndex);
43
+ 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();
57
44
  }
58
45
  }, [disabled, focusableChildrenReferences]);
59
46
  return {
@@ -62,5 +49,5 @@ const useAccordionItem = ({ value, disabled }) => {
62
49
  selected
63
50
  };
64
51
  };
65
- module.exports = __toCommonJS(useAccordionItem_exports);
66
- //# sourceMappingURL=useAccordionItem.js.map
52
+
53
+ exports.useAccordionItem = useAccordionItem;
@@ -1,58 +1,37 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var useIsShowingEllipsis_exports = {};
29
- __export(useIsShowingEllipsis_exports, {
30
- useIsShowingEllipsis: () => useIsShowingEllipsis
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = require("react");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/web.dom-collections.iterator.js');
6
+ var React = require('react');
7
+
34
8
  const useIsShowingEllipsis = () => {
35
- const [element, setElement] = (0, import_react.useState)();
36
- const [isShowingEllipsis, setIsShowingEllipsis] = (0, import_react.useState)(false);
37
- const resizeObserver = (0, import_react.useMemo)(() => new ResizeObserver((entries) => {
9
+ const [element, setElement] = React.useState();
10
+ const [isShowingEllipsis, setIsShowingEllipsis] = React.useState(false); // const isShowingEllipsis = element?.scrollWidth > primaryTitleWrapperEl?.clientWidth;
11
+
12
+ const resizeObserver = React.useMemo(() => new ResizeObserver(entries => {
38
13
  if (entries.length) {
39
14
  const [textWrapperEntry] = entries;
40
15
  const el = textWrapperEntry.target;
41
- setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);
16
+ setIsShowingEllipsis((el === null || el === void 0 ? void 0 : el.scrollWidth) > (el === null || el === void 0 ? void 0 : el.clientWidth));
42
17
  }
43
18
  }), []);
44
- (0, import_react.useEffect)(() => {
19
+ React.useEffect(() => {
45
20
  if (element) {
46
- setIsShowingEllipsis(element?.scrollWidth > element?.clientWidth);
21
+ setIsShowingEllipsis((element === null || element === void 0 ? void 0 : element.scrollWidth) > (element === null || element === void 0 ? void 0 : element.clientWidth));
47
22
  resizeObserver.observe(element);
48
23
  }
24
+
49
25
  return () => {
50
26
  if (element) {
51
27
  resizeObserver.unobserve(element);
52
28
  }
53
29
  };
54
30
  }, [resizeObserver, element]);
55
- return { setElement, isShowingEllipsis };
31
+ return {
32
+ setElement,
33
+ isShowingEllipsis
34
+ };
56
35
  };
57
- module.exports = __toCommonJS(useIsShowingEllipsis_exports);
58
- //# sourceMappingURL=useIsShowingEllipsis.js.map
36
+
37
+ exports.useIsShowingEllipsis = useIsShowingEllipsis;
package/cjs/propTypes.js CHANGED
@@ -1,57 +1,26 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var propTypes_exports = {};
29
- __export(propTypes_exports, {
30
- accordionItemPropTypes: () => accordionItemPropTypes,
31
- accordionPropTypes: () => accordionPropTypes
32
- });
33
- var React = __toESM(require("react"));
34
- var import_react_desc = require("react-desc");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var reactDesc = require('react-desc');
6
+
35
7
  const accordionItemPropTypes = {
36
- children: import_react_desc.PropTypes.node.description("Dimsum AccordionItem content.").isRequired,
37
- title: import_react_desc.PropTypes.string.description("Set a primary title."),
38
- value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("Dimsum AccordionItem value, this value should be unique.").isRequired,
39
- iconClosed: import_react_desc.PropTypes.node.description("Custom Dimsum Icon when it is closed."),
40
- iconOpened: import_react_desc.PropTypes.node.description("Custom Dimsum Icon when it is open."),
41
- secondaryTitle: import_react_desc.PropTypes.string.description("Set a secondary title"),
42
- customActions: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.object).description("Set Dimsum AccordionItem custom actions."),
43
- renderCustomActions: import_react_desc.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.")
8
+ children: reactDesc.PropTypes.node.description('Dimsum AccordionItem content.').isRequired,
9
+ title: reactDesc.PropTypes.string.description('Set a primary title.'),
10
+ value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Dimsum AccordionItem value, this value should be unique.').isRequired,
11
+ iconClosed: reactDesc.PropTypes.node.description('Custom Dimsum Icon when it is closed.'),
12
+ iconOpened: reactDesc.PropTypes.node.description('Custom Dimsum Icon when it is open.'),
13
+ secondaryTitle: reactDesc.PropTypes.string.description('Set a secondary title'),
14
+ customActions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('Set Dimsum AccordionItem custom actions.'),
15
+ renderCustomActions: reactDesc.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.')
44
16
  };
45
17
  const accordionPropTypes = {
46
- containerProps: import_react_desc.PropTypes.object.description("Adds props to the container."),
47
- activeValue: import_react_desc.PropTypes.oneOfType([
48
- import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number])),
49
- import_react_desc.PropTypes.string,
50
- import_react_desc.PropTypes.number
51
- ]).description("Selected active value. This property makes the component a controlled one."),
52
- children: import_react_desc.PropTypes.node.description("Dimsum AccordionItems to show."),
53
- allowMultipleOpen: import_react_desc.PropTypes.bool.description("Allows multiple Dimsum AccordionItems to be open at the same time."),
54
- onChange: import_react_desc.PropTypes.func.description("Callback function once the Dimsum Accordion changes.")
18
+ containerProps: reactDesc.PropTypes.object.description('Adds props to the container.'),
19
+ activeValue: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number])), reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('Selected active value. This property makes the component a controlled one.'),
20
+ children: reactDesc.PropTypes.node.description('Dimsum AccordionItems to show.'),
21
+ allowMultipleOpen: reactDesc.PropTypes.bool.description('Allows multiple Dimsum AccordionItems to be open at the same time.'),
22
+ onChange: reactDesc.PropTypes.func.description('Callback function once the Dimsum Accordion changes.')
55
23
  };
56
- module.exports = __toCommonJS(propTypes_exports);
57
- //# sourceMappingURL=propTypes.js.map
24
+
25
+ exports.accordionItemPropTypes = accordionItemPropTypes;
26
+ exports.accordionPropTypes = accordionPropTypes;
@@ -1,23 +1,21 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { describe } from "react-desc";
4
- import { AccordionContent } from "./parts/accordionContent/AccordionContent";
5
- import { useAccordion } from "./config/useAccordion";
6
- import { DSAccordionContext } from "./DSAccordionCTX";
7
- import { accordionPropTypes } from "./propTypes";
8
- const DSAccordion = (props) => {
1
+ import _jsx2 from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
3
+ import { describe } from 'react-desc';
4
+ import { AccordionContent } from './parts/accordionContent/AccordionContent.js';
5
+ import { useAccordion } from './config/useAccordion.js';
6
+ import { DSAccordionContext } from './DSAccordionCTX.js';
7
+ import { accordionPropTypes } from './propTypes.js';
8
+
9
+ var _AccordionContent;
10
+
11
+ const DSAccordion = props => {
9
12
  const ctx = useAccordion(props);
10
- return /* @__PURE__ */ React2.createElement(DSAccordionContext.Provider, {
13
+ return /*#__PURE__*/_jsx2(DSAccordionContext.Provider, {
11
14
  value: ctx
12
- }, /* @__PURE__ */ React2.createElement(AccordionContent, null));
15
+ }, void 0, _AccordionContent || (_AccordionContent = /*#__PURE__*/_jsx2(AccordionContent, {})));
13
16
  };
14
- DSAccordion.propTypes = accordionPropTypes;
17
+
15
18
  const DSAccordionWithSchema = describe(DSAccordion);
16
19
  DSAccordionWithSchema.propTypes = accordionPropTypes;
17
- var DSAccordion_default = DSAccordion;
18
- export {
19
- DSAccordion,
20
- DSAccordionWithSchema,
21
- DSAccordion_default as default
22
- };
23
- //# sourceMappingURL=DSAccordion.js.map
20
+
21
+ export { DSAccordion, DSAccordionWithSchema, DSAccordion as default };
@@ -1,8 +1,9 @@
1
- import * as React from "react";
2
- import { createContext } from "react";
3
- import { defaultProps } from "./defaultProps";
4
- const noop = () => {
5
- };
1
+ import { createContext } from 'react';
2
+ import { defaultProps } from './defaultProps.js';
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
5
+ const noop = () => {};
6
+
6
7
  const defaultContext = {
7
8
  props: defaultProps,
8
9
  actualActiveValue: [],
@@ -10,8 +11,6 @@ const defaultContext = {
10
11
  focusableChildrenReferences: [],
11
12
  allChildrenReferences: {}
12
13
  };
13
- const DSAccordionContext = createContext(defaultContext);
14
- export {
15
- DSAccordionContext
16
- };
17
- //# sourceMappingURL=DSAccordionCTX.js.map
14
+ const DSAccordionContext = /*#__PURE__*/createContext(defaultContext);
15
+
16
+ export { DSAccordionContext };
@@ -1,13 +1,10 @@
1
- import * as React from "react";
2
1
  const DSAccordionDataTestid = {
3
2
  ITEM: {
4
- CONTENT: "ds-accordion_item-content",
5
- HEADER: "ds-accordion_item-header",
6
- CONTAINER: "ds-accordion_item"
3
+ CONTENT: 'ds-accordion_item-content',
4
+ HEADER: 'ds-accordion_item-header',
5
+ CONTAINER: 'ds-accordion_item'
7
6
  },
8
- GROUP: "ds-accordion_group"
7
+ GROUP: 'ds-accordion_group'
9
8
  };
10
- export {
11
- DSAccordionDataTestid
12
- };
13
- //# sourceMappingURL=DSAccordionDatatestid.js.map
9
+
10
+ export { DSAccordionDataTestid };
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=DSAccordionTypes.js.map
1
+