@elliemae/ds-accordion 2.0.0-alpha.0 → 2.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSAccordion.js +21 -13
- package/cjs/DSAccordionHeader.js +22 -24
- package/cjs/DSAccordionHeaderActions.js +18 -10
- package/cjs/DSAccordionHeaderTitle.js +13 -12
- package/cjs/DSAccordionItem.js +16 -21
- package/cjs/index.js +1 -1
- package/esm/DSAccordion.js +16 -8
- package/esm/DSAccordionHeader.js +16 -16
- package/esm/DSAccordionHeaderActions.js +15 -7
- package/esm/DSAccordionHeaderTitle.js +8 -7
- package/esm/DSAccordionItem.js +6 -8
- package/package.json +13 -7
- package/types/DSAccordion.d.ts +43 -6
- package/types/DSAccordionHeader.d.ts +1 -1
- package/types/DSAccordionItem.d.ts +6 -1
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/DSAccordion.js
CHANGED
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
14
|
var React = require('react');
|
|
8
15
|
var reactDesc = require('react-desc');
|
|
9
16
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
@@ -21,16 +28,17 @@ var Group__default = /*#__PURE__*/_interopDefaultLegacy(Group);
|
|
|
21
28
|
|
|
22
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
23
30
|
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
25
|
-
|
|
26
|
-
const DSAccordion =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
32
|
+
|
|
33
|
+
const DSAccordion = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
containerProps = {},
|
|
36
|
+
activeValue = '',
|
|
37
|
+
children,
|
|
38
|
+
allowMultipleOpen = false,
|
|
39
|
+
contentExpandable = false,
|
|
40
|
+
onChange = () => {}
|
|
41
|
+
} = _ref;
|
|
34
42
|
const {
|
|
35
43
|
cssClassName
|
|
36
44
|
} = dsClassnames.convertPropToCssClassName('accordion');
|
|
@@ -50,14 +58,14 @@ const DSAccordion = ({
|
|
|
50
58
|
}
|
|
51
59
|
};
|
|
52
60
|
|
|
53
|
-
return /*#__PURE__*/_jsx__default[
|
|
61
|
+
return /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText.TooltipTextProvider, {}, void 0, /*#__PURE__*/_jsx__default["default"](Group__default["default"], {
|
|
54
62
|
activeValue: activeValue,
|
|
55
63
|
multiple: allowMultipleOpen,
|
|
56
64
|
onChange: onChange
|
|
57
65
|
}, void 0, /*#__PURE__*/jsxRuntime.jsx("section", _objectSpread(_objectSpread({
|
|
58
66
|
className: cssClassName
|
|
59
67
|
}, containerProps), {}, {
|
|
60
|
-
children: React__default[
|
|
68
|
+
children: React__default["default"].Children.map(children, (child, idx) => /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
61
69
|
key: idx,
|
|
62
70
|
idx,
|
|
63
71
|
expandable: contentExpandable,
|
|
@@ -105,4 +113,4 @@ DSAccordionWithSchema.propTypes = props;
|
|
|
105
113
|
|
|
106
114
|
exports.DSAccordion = DSAccordion;
|
|
107
115
|
exports.DSAccordionWithSchema = DSAccordionWithSchema;
|
|
108
|
-
exports[
|
|
116
|
+
exports["default"] = DSAccordion;
|
package/cjs/DSAccordionHeader.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
require('react');
|
|
5
5
|
var dsSystem = require('@elliemae/ds-system');
|
|
6
|
-
var
|
|
7
|
-
var ChevronRight = require('@elliemae/ds-icons/ChevronRight');
|
|
6
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
8
7
|
var DSButton = require('@elliemae/ds-button');
|
|
9
8
|
var DSAccordionHeaderActions = require('./DSAccordionHeaderActions.js');
|
|
10
9
|
var DSAccordionHeaderTitle = require('./DSAccordionHeaderTitle.js');
|
|
@@ -13,44 +12,43 @@ var blocks = require('./blocks.js');
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
13
|
|
|
15
14
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
-
var ChevronDown__default = /*#__PURE__*/_interopDefaultLegacy(ChevronDown);
|
|
17
|
-
var ChevronRight__default = /*#__PURE__*/_interopDefaultLegacy(ChevronRight);
|
|
18
15
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
19
16
|
|
|
20
|
-
const DSAccordionHeader = dsSystem.withTheme(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
const DSAccordionHeader = dsSystem.withTheme(_ref => {
|
|
18
|
+
let {
|
|
19
|
+
title,
|
|
20
|
+
secondaryTitle,
|
|
21
|
+
customActions,
|
|
22
|
+
idx,
|
|
23
|
+
icon,
|
|
24
|
+
selected,
|
|
25
|
+
setTabRef,
|
|
26
|
+
onClick,
|
|
27
|
+
onKeyDown
|
|
28
|
+
} = _ref;
|
|
31
29
|
const mobile = dsSystem.useIsMobile();
|
|
32
30
|
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
33
31
|
const selectedClass = selected ? 'selected' : '';
|
|
34
32
|
const labelClass = hasSecondaryTitle ? 'secondary-title' : '';
|
|
35
|
-
const IconMobile = selected ?
|
|
36
|
-
return /*#__PURE__*/_jsx__default[
|
|
37
|
-
"aria-controls":
|
|
33
|
+
const IconMobile = selected ? dsIcons.ChevronDown : dsIcons.ChevronRight;
|
|
34
|
+
return /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
35
|
+
"aria-controls": "sec".concat(idx),
|
|
38
36
|
"aria-expanded": selected,
|
|
39
37
|
"aria-label": title,
|
|
40
38
|
as: "div",
|
|
41
39
|
buttonType: "secondary",
|
|
42
|
-
className:
|
|
40
|
+
className: "".concat(blocks.accordionButton, " ").concat(selectedClass, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : ''),
|
|
43
41
|
"data-testid": "ds-accordion_item-header",
|
|
44
42
|
innerRef: setTabRef,
|
|
45
|
-
labelText: /*#__PURE__*/_jsx__default[
|
|
46
|
-
className:
|
|
47
|
-
}, void 0, !mobile && icon, /*#__PURE__*/_jsx__default[
|
|
43
|
+
labelText: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
44
|
+
className: "".concat(blocks.accordionTitle, " ").concat(selectedClass, " ").concat(labelClass)
|
|
45
|
+
}, void 0, !mobile && icon, /*#__PURE__*/_jsx__default["default"](DSAccordionHeaderTitle, {
|
|
48
46
|
idx: idx,
|
|
49
47
|
secondaryTitle: secondaryTitle,
|
|
50
48
|
title: title
|
|
51
|
-
}), !mobile && /*#__PURE__*/_jsx__default[
|
|
49
|
+
}), !mobile && /*#__PURE__*/_jsx__default["default"](DSAccordionHeaderActions, {
|
|
52
50
|
customActions: customActions
|
|
53
|
-
}), mobile && /*#__PURE__*/_jsx__default[
|
|
51
|
+
}), mobile && /*#__PURE__*/_jsx__default["default"](IconMobile, {})),
|
|
54
52
|
onClick: onClick,
|
|
55
53
|
onKeyDown: onKeyDown
|
|
56
54
|
});
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
require('react');
|
|
7
14
|
var DSButton = require('@elliemae/ds-button');
|
|
8
15
|
var blocks = require('./blocks.js');
|
|
@@ -19,21 +26,22 @@ const _excluded = ["onClick"];
|
|
|
19
26
|
|
|
20
27
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
21
28
|
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
30
|
|
|
24
|
-
const DSAccordionHeaderActions =
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
const DSAccordionHeaderActions = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
customActions
|
|
34
|
+
} = _ref;
|
|
27
35
|
if (!customActions) return null;
|
|
28
|
-
return /*#__PURE__*/_jsx__default[
|
|
29
|
-
className:
|
|
30
|
-
}, void 0, customActions.map((
|
|
36
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
37
|
+
className: "".concat(blocks.accordionActions)
|
|
38
|
+
}, void 0, customActions.map((_ref2, key) => {
|
|
31
39
|
let {
|
|
32
40
|
onClick
|
|
33
|
-
} =
|
|
34
|
-
rest = _objectWithoutProperties__default[
|
|
41
|
+
} = _ref2,
|
|
42
|
+
rest = _objectWithoutProperties__default["default"](_ref2, _excluded);
|
|
35
43
|
|
|
36
|
-
return /*#__PURE__*/jsxRuntime.jsx(DSButton__default[
|
|
44
|
+
return /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread(_objectSpread({
|
|
37
45
|
onClick: e => {
|
|
38
46
|
e.stopPropagation();
|
|
39
47
|
if (onClick) onClick(e);
|
|
@@ -12,22 +12,23 @@ var DSTruncatedTooltipText__default = /*#__PURE__*/_interopDefaultLegacy(DSTrunc
|
|
|
12
12
|
|
|
13
13
|
var _div;
|
|
14
14
|
|
|
15
|
-
const DSAccordionHeader =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const DSAccordionHeader = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
title,
|
|
18
|
+
secondaryTitle,
|
|
19
|
+
idx
|
|
20
|
+
} = _ref;
|
|
20
21
|
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
21
|
-
return /*#__PURE__*/_jsx__default[
|
|
22
|
-
className:
|
|
23
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
24
|
-
id:
|
|
25
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
22
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
23
|
+
className: "".concat(blocks.accordionTitleWrapper, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : '')
|
|
24
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("h2", {
|
|
25
|
+
id: "accordion_".concat(idx, "id")
|
|
26
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
26
27
|
className: blocks.accordionH2Title,
|
|
27
28
|
value: title
|
|
28
|
-
})), hasSecondaryTitle && /*#__PURE__*/_jsx__default[
|
|
29
|
+
})), hasSecondaryTitle && /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
29
30
|
className: blocks.accordionSecondaryTitle,
|
|
30
|
-
containerComponent: _div || (_div = /*#__PURE__*/_jsx__default[
|
|
31
|
+
containerComponent: _div || (_div = /*#__PURE__*/_jsx__default["default"]("div", {})),
|
|
31
32
|
value: secondaryTitle
|
|
32
33
|
}));
|
|
33
34
|
};
|
package/cjs/DSAccordionItem.js
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
6
|
var React = require('react');
|
|
8
|
-
var
|
|
9
|
-
var ArrowheadDown = require('@elliemae/ds-icons/ArrowheadDown');
|
|
7
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
10
8
|
var GroupItem = require('@elliemae/ds-shared/GroupContext/GroupItem');
|
|
11
9
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
12
10
|
var reactDesc = require('react-desc');
|
|
@@ -16,10 +14,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
16
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
15
|
|
|
18
16
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
17
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
-
var ArrowheadRight__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadRight);
|
|
22
|
-
var ArrowheadDown__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadDown);
|
|
23
18
|
var GroupItem__default = /*#__PURE__*/_interopDefaultLegacy(GroupItem);
|
|
24
19
|
|
|
25
20
|
const ICON_SIZE = 's';
|
|
@@ -34,7 +29,7 @@ class DSAccordionItem extends React.Component {
|
|
|
34
29
|
constructor(props) {
|
|
35
30
|
super(props);
|
|
36
31
|
|
|
37
|
-
|
|
32
|
+
this.setHeight = element => {
|
|
38
33
|
const {
|
|
39
34
|
actualHeight
|
|
40
35
|
} = this.state;
|
|
@@ -52,9 +47,9 @@ class DSAccordionItem extends React.Component {
|
|
|
52
47
|
});
|
|
53
48
|
}
|
|
54
49
|
}, 0);
|
|
55
|
-
}
|
|
50
|
+
};
|
|
56
51
|
|
|
57
|
-
this.childElements = /*#__PURE__*/React__default[
|
|
52
|
+
this.childElements = /*#__PURE__*/React__default["default"].createRef();
|
|
58
53
|
this.state = {
|
|
59
54
|
actualHeight: null
|
|
60
55
|
};
|
|
@@ -90,19 +85,19 @@ class DSAccordionItem extends React.Component {
|
|
|
90
85
|
const {
|
|
91
86
|
actualHeight
|
|
92
87
|
} = this.state;
|
|
93
|
-
return /*#__PURE__*/_jsx__default[
|
|
88
|
+
return /*#__PURE__*/_jsx__default["default"](GroupItem__default["default"], {
|
|
94
89
|
render: context => {
|
|
95
90
|
const {
|
|
96
91
|
activeValue
|
|
97
92
|
} = context;
|
|
98
93
|
const selected = activeValue !== undefined && (activeValue === value || activeValue.length && activeValue.indexOf(value) > -1);
|
|
99
94
|
const OpenedCloseIcon = selected ? iconOpened : iconClosed;
|
|
100
|
-
return /*#__PURE__*/_jsx__default[
|
|
95
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
101
96
|
className: cssClassName,
|
|
102
97
|
"data-testid": "ds-accordion_item"
|
|
103
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
98
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSAccordionHeader, {
|
|
104
99
|
customActions: customActions,
|
|
105
|
-
icon: /*#__PURE__*/_jsx__default[
|
|
100
|
+
icon: /*#__PURE__*/_jsx__default["default"](OpenedCloseIcon, {
|
|
106
101
|
size: ICON_SIZE
|
|
107
102
|
}),
|
|
108
103
|
idx: idx,
|
|
@@ -112,13 +107,13 @@ class DSAccordionItem extends React.Component {
|
|
|
112
107
|
selected: selected,
|
|
113
108
|
setTabRef: setTabRef,
|
|
114
109
|
title: title
|
|
115
|
-
}), /*#__PURE__*/_jsx__default[
|
|
110
|
+
}), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
116
111
|
"data-testid": "ds-accordion_item-content",
|
|
117
112
|
"aria-hidden": !selected,
|
|
118
|
-
"aria-labelledby":
|
|
119
|
-
className:
|
|
113
|
+
"aria-labelledby": "accordion_".concat(idx, "id"),
|
|
114
|
+
className: "".concat(classNameElement('container'), " ").concat(selected ? 'expanded' : 'closed'),
|
|
120
115
|
"data-testid": "ds-accordion_item-content",
|
|
121
|
-
id:
|
|
116
|
+
id: "sec".concat(idx),
|
|
122
117
|
role: "region",
|
|
123
118
|
style: {
|
|
124
119
|
height: selected ? actualHeight : 0
|
|
@@ -126,7 +121,7 @@ class DSAccordionItem extends React.Component {
|
|
|
126
121
|
}, void 0, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
127
122
|
ref: this.childElements,
|
|
128
123
|
className: classNameElement('expand-zone'),
|
|
129
|
-
children: /*#__PURE__*/_jsx__default[
|
|
124
|
+
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
130
125
|
className: classNameElement('expand-zone-space')
|
|
131
126
|
}, void 0, selected && children)
|
|
132
127
|
})));
|
|
@@ -159,11 +154,11 @@ const props = {
|
|
|
159
154
|
customActions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('accordion item custom actions')
|
|
160
155
|
};
|
|
161
156
|
DSAccordionItem.defaultProps = {
|
|
162
|
-
iconClosed: () => /*#__PURE__*/_jsx__default[
|
|
157
|
+
iconClosed: () => /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadRight, {
|
|
163
158
|
width: "20px",
|
|
164
159
|
color: ['brand-primary', 800]
|
|
165
160
|
}),
|
|
166
|
-
iconOpened: () => /*#__PURE__*/_jsx__default[
|
|
161
|
+
iconOpened: () => /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadDown, {
|
|
167
162
|
width: "20px",
|
|
168
163
|
color: ['brand-primary', 800]
|
|
169
164
|
}),
|
|
@@ -176,4 +171,4 @@ DSAccordionItemWithSchema.propTypes = props;
|
|
|
176
171
|
|
|
177
172
|
exports.DSAccordionItem = DSAccordionItem;
|
|
178
173
|
exports.DSAccordionItemWithSchema = DSAccordionItemWithSchema;
|
|
179
|
-
exports[
|
|
174
|
+
exports["default"] = DSAccordionItem;
|
package/cjs/index.js
CHANGED
|
@@ -9,6 +9,6 @@ var DSAccordionItem = require('./DSAccordionItem.js');
|
|
|
9
9
|
|
|
10
10
|
exports.DSAccordion = DSAccordion.DSAccordion;
|
|
11
11
|
exports.DSAccordionWithSchema = DSAccordion.DSAccordionWithSchema;
|
|
12
|
-
exports
|
|
12
|
+
exports["default"] = DSAccordion.DSAccordion;
|
|
13
13
|
exports.DSAccordionItem = DSAccordionItem.DSAccordionItem;
|
|
14
14
|
exports.DSAccordionItemWithSchema = DSAccordionItem.DSAccordionItemWithSchema;
|
package/esm/DSAccordion.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
10
|
import React from 'react';
|
|
4
11
|
import { PropTypes, describe } from 'react-desc';
|
|
5
12
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
@@ -12,14 +19,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
19
|
|
|
13
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
21
|
|
|
15
|
-
const DSAccordion =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const DSAccordion = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
containerProps = {},
|
|
25
|
+
activeValue = '',
|
|
26
|
+
children,
|
|
27
|
+
allowMultipleOpen = false,
|
|
28
|
+
contentExpandable = false,
|
|
29
|
+
onChange = () => {}
|
|
30
|
+
} = _ref;
|
|
23
31
|
const {
|
|
24
32
|
cssClassName
|
|
25
33
|
} = convertPropToCssClassName('accordion');
|
package/esm/DSAccordionHeader.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'react';
|
|
3
3
|
import { withTheme, useIsMobile } from '@elliemae/ds-system';
|
|
4
|
-
import ChevronDown from '@elliemae/ds-icons
|
|
5
|
-
import ChevronRight from '@elliemae/ds-icons/ChevronRight';
|
|
4
|
+
import { ChevronDown, ChevronRight } from '@elliemae/ds-icons';
|
|
6
5
|
import DSButton from '@elliemae/ds-button';
|
|
7
6
|
import DSAccordionHeaderActions from './DSAccordionHeaderActions.js';
|
|
8
7
|
import DSAccordionHeader$1 from './DSAccordionHeaderTitle.js';
|
|
9
8
|
import { accordionButton, accordionTitle } from './blocks.js';
|
|
10
9
|
|
|
11
|
-
const DSAccordionHeader = withTheme(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
const DSAccordionHeader = withTheme(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
title,
|
|
13
|
+
secondaryTitle,
|
|
14
|
+
customActions,
|
|
15
|
+
idx,
|
|
16
|
+
icon,
|
|
17
|
+
selected,
|
|
18
|
+
setTabRef,
|
|
19
|
+
onClick,
|
|
20
|
+
onKeyDown
|
|
21
|
+
} = _ref;
|
|
22
22
|
const mobile = useIsMobile();
|
|
23
23
|
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
24
24
|
const selectedClass = selected ? 'selected' : '';
|
|
25
25
|
const labelClass = hasSecondaryTitle ? 'secondary-title' : '';
|
|
26
26
|
const IconMobile = selected ? ChevronDown : ChevronRight;
|
|
27
27
|
return /*#__PURE__*/_jsx(DSButton, {
|
|
28
|
-
"aria-controls":
|
|
28
|
+
"aria-controls": "sec".concat(idx),
|
|
29
29
|
"aria-expanded": selected,
|
|
30
30
|
"aria-label": title,
|
|
31
31
|
as: "div",
|
|
32
32
|
buttonType: "secondary",
|
|
33
|
-
className:
|
|
33
|
+
className: "".concat(accordionButton, " ").concat(selectedClass, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : ''),
|
|
34
34
|
"data-testid": "ds-accordion_item-header",
|
|
35
35
|
innerRef: setTabRef,
|
|
36
36
|
labelText: /*#__PURE__*/_jsx("div", {
|
|
37
|
-
className:
|
|
37
|
+
className: "".concat(accordionTitle, " ").concat(selectedClass, " ").concat(labelClass)
|
|
38
38
|
}, void 0, !mobile && icon, /*#__PURE__*/_jsx(DSAccordionHeader$1, {
|
|
39
39
|
idx: idx,
|
|
40
40
|
secondaryTitle: secondaryTitle,
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
11
|
import 'react';
|
|
5
12
|
import DSButton, { BUTTON_TYPE } from '@elliemae/ds-button';
|
|
6
13
|
import { accordionActions } from './blocks.js';
|
|
@@ -12,17 +19,18 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
19
|
|
|
13
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
21
|
|
|
15
|
-
const DSAccordionHeaderActions =
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
const DSAccordionHeaderActions = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
customActions
|
|
25
|
+
} = _ref;
|
|
18
26
|
if (!customActions) return null;
|
|
19
27
|
return /*#__PURE__*/_jsx("div", {
|
|
20
|
-
className:
|
|
21
|
-
}, void 0, customActions.map((
|
|
28
|
+
className: "".concat(accordionActions)
|
|
29
|
+
}, void 0, customActions.map((_ref2, key) => {
|
|
22
30
|
let {
|
|
23
31
|
onClick
|
|
24
|
-
} =
|
|
25
|
-
rest = _objectWithoutProperties(
|
|
32
|
+
} = _ref2,
|
|
33
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
26
34
|
|
|
27
35
|
return /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({
|
|
28
36
|
onClick: e => {
|
|
@@ -5,16 +5,17 @@ import { accordionTitleWrapper, accordionH2Title, accordionSecondaryTitle } from
|
|
|
5
5
|
|
|
6
6
|
var _div;
|
|
7
7
|
|
|
8
|
-
const DSAccordionHeader =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const DSAccordionHeader = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
title,
|
|
11
|
+
secondaryTitle,
|
|
12
|
+
idx
|
|
13
|
+
} = _ref;
|
|
13
14
|
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
14
15
|
return /*#__PURE__*/_jsx("div", {
|
|
15
|
-
className:
|
|
16
|
+
className: "".concat(accordionTitleWrapper, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : '')
|
|
16
17
|
}, void 0, /*#__PURE__*/_jsx("h2", {
|
|
17
|
-
id:
|
|
18
|
+
id: "accordion_".concat(idx, "id")
|
|
18
19
|
}, void 0, /*#__PURE__*/_jsx(DSTruncatedTooltipText, {
|
|
19
20
|
className: accordionH2Title,
|
|
20
21
|
value: title
|
package/esm/DSAccordionItem.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
2
|
import React, { Component } from 'react';
|
|
4
|
-
import ArrowheadRight from '@elliemae/ds-icons
|
|
5
|
-
import ArrowheadDown from '@elliemae/ds-icons/ArrowheadDown';
|
|
3
|
+
import { ArrowheadRight, ArrowheadDown } from '@elliemae/ds-icons';
|
|
6
4
|
import GroupItem from '@elliemae/ds-shared/GroupContext/GroupItem';
|
|
7
5
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
8
6
|
import { PropTypes, describe } from 'react-desc';
|
|
@@ -21,7 +19,7 @@ class DSAccordionItem extends Component {
|
|
|
21
19
|
constructor(props) {
|
|
22
20
|
super(props);
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
this.setHeight = element => {
|
|
25
23
|
const {
|
|
26
24
|
actualHeight
|
|
27
25
|
} = this.state;
|
|
@@ -39,7 +37,7 @@ class DSAccordionItem extends Component {
|
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
39
|
}, 0);
|
|
42
|
-
}
|
|
40
|
+
};
|
|
43
41
|
|
|
44
42
|
this.childElements = /*#__PURE__*/React.createRef();
|
|
45
43
|
this.state = {
|
|
@@ -102,10 +100,10 @@ class DSAccordionItem extends Component {
|
|
|
102
100
|
}), /*#__PURE__*/_jsx("div", {
|
|
103
101
|
"data-testid": "ds-accordion_item-content",
|
|
104
102
|
"aria-hidden": !selected,
|
|
105
|
-
"aria-labelledby":
|
|
106
|
-
className:
|
|
103
|
+
"aria-labelledby": "accordion_".concat(idx, "id"),
|
|
104
|
+
className: "".concat(classNameElement('container'), " ").concat(selected ? 'expanded' : 'closed'),
|
|
107
105
|
"data-testid": "ds-accordion_item-content",
|
|
108
|
-
id:
|
|
106
|
+
id: "sec".concat(idx),
|
|
109
107
|
role: "region",
|
|
110
108
|
style: {
|
|
111
109
|
height: selected ? actualHeight : 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-accordion",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Accordion",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -56,14 +56,20 @@
|
|
|
56
56
|
"build": "node ../../scripts/build/build.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@elliemae/ds-button": "2.0.0-alpha.
|
|
60
|
-
"@elliemae/ds-classnames": "2.0.0-alpha.
|
|
61
|
-
"@elliemae/ds-icons": "2.0.0-alpha.
|
|
62
|
-
"@elliemae/ds-shared": "2.0.0-alpha.
|
|
63
|
-
"@elliemae/ds-system": "2.0.0-alpha.
|
|
64
|
-
"@elliemae/ds-truncated-tooltip-text": "2.0.0-alpha.
|
|
59
|
+
"@elliemae/ds-button": "2.0.0-alpha.12",
|
|
60
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.12",
|
|
61
|
+
"@elliemae/ds-icons": "2.0.0-alpha.12",
|
|
62
|
+
"@elliemae/ds-shared": "2.0.0-alpha.12",
|
|
63
|
+
"@elliemae/ds-system": "2.0.0-alpha.12",
|
|
64
|
+
"@elliemae/ds-truncated-tooltip-text": "2.0.0-alpha.12",
|
|
65
65
|
"react-desc": "^4.1.3"
|
|
66
66
|
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
69
|
+
"@testing-library/react": "~12.1.2",
|
|
70
|
+
"react": "^17.0.2",
|
|
71
|
+
"react-dom": "^17.0.2"
|
|
72
|
+
},
|
|
67
73
|
"peerDependencies": {
|
|
68
74
|
"react": "^17.0.2",
|
|
69
75
|
"react-dom": "^17.0.2"
|
package/types/DSAccordion.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare const DSAccordion: {
|
|
3
4
|
({ containerProps, activeValue, children, allowMultipleOpen, contentExpandable, onChange, }: {
|
|
@@ -10,11 +11,21 @@ declare const DSAccordion: {
|
|
|
10
11
|
}): JSX.Element;
|
|
11
12
|
propTypes: {
|
|
12
13
|
/** inject props to wrapper */
|
|
13
|
-
containerProps:
|
|
14
|
+
containerProps: {
|
|
15
|
+
defaultValue<T = unknown>(arg: T): {
|
|
16
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
17
|
+
};
|
|
18
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
19
|
+
};
|
|
14
20
|
/**
|
|
15
21
|
* Selected default active value
|
|
16
22
|
*/
|
|
17
|
-
activeValue:
|
|
23
|
+
activeValue: {
|
|
24
|
+
defaultValue<T = unknown>(arg: T): {
|
|
25
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
26
|
+
};
|
|
27
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
18
29
|
/**
|
|
19
30
|
* Accordion items to show
|
|
20
31
|
*/
|
|
@@ -22,17 +33,43 @@ declare const DSAccordion: {
|
|
|
22
33
|
/**
|
|
23
34
|
* Allows multiple accordion items to be open at the same time
|
|
24
35
|
*/
|
|
25
|
-
allowMultipleOpen:
|
|
36
|
+
allowMultipleOpen: {
|
|
37
|
+
defaultValue<T = unknown>(arg: T): {
|
|
38
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
39
|
+
};
|
|
40
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
41
|
+
};
|
|
26
42
|
/**
|
|
27
43
|
* Whether content is expandable or not
|
|
28
44
|
*/
|
|
29
|
-
contentExpandable:
|
|
45
|
+
contentExpandable: {
|
|
46
|
+
defaultValue<T = unknown>(arg: T): {
|
|
47
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
48
|
+
};
|
|
49
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
50
|
+
};
|
|
30
51
|
/**
|
|
31
52
|
* Allows a function that is triggered once the accordion changes
|
|
32
53
|
*/
|
|
33
|
-
onChange:
|
|
54
|
+
onChange: {
|
|
55
|
+
defaultValue<T = unknown>(arg: T): {
|
|
56
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
57
|
+
};
|
|
58
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
59
|
+
};
|
|
34
60
|
};
|
|
35
61
|
};
|
|
36
|
-
declare const DSAccordionWithSchema:
|
|
62
|
+
declare const DSAccordionWithSchema: {
|
|
63
|
+
(props?: {
|
|
64
|
+
containerProps?: {} | undefined;
|
|
65
|
+
activeValue?: string | undefined;
|
|
66
|
+
children: any;
|
|
67
|
+
allowMultipleOpen?: boolean | undefined;
|
|
68
|
+
contentExpandable?: boolean | undefined;
|
|
69
|
+
onChange?: (() => void) | undefined;
|
|
70
|
+
} | undefined): JSX.Element;
|
|
71
|
+
propTypes: unknown;
|
|
72
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
73
|
+
};
|
|
37
74
|
export { DSAccordion, DSAccordionWithSchema };
|
|
38
75
|
export default DSAccordion;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
import { Component } from 'react';
|
|
2
3
|
declare class DSAccordionItem extends Component {
|
|
3
4
|
constructor(props: any);
|
|
@@ -6,6 +7,10 @@ declare class DSAccordionItem extends Component {
|
|
|
6
7
|
setHeight: (element: any) => void;
|
|
7
8
|
render(): JSX.Element;
|
|
8
9
|
}
|
|
9
|
-
declare const DSAccordionItemWithSchema:
|
|
10
|
+
declare const DSAccordionItemWithSchema: {
|
|
11
|
+
(props?: unknown): JSX.Element;
|
|
12
|
+
propTypes: unknown;
|
|
13
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
14
|
+
};
|
|
10
15
|
export { DSAccordionItem, DSAccordionItemWithSchema };
|
|
11
16
|
export default DSAccordionItem;
|
package/cjs/package.json
DELETED