@entur/expand 3.6.12 → 3.6.13-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.
- package/dist/expand.cjs.js +867 -0
- package/dist/expand.cjs.js.map +1 -0
- package/dist/expand.esm.js +837 -218
- package/dist/expand.esm.js.map +1 -1
- package/dist/index.d.ts +121 -8
- package/dist/styles.css +113 -123
- package/package.json +32 -14
- package/dist/Accordion.d.ts +0 -17
- package/dist/AccordionItem.d.ts +0 -16
- package/dist/BaseExpand.d.ts +0 -11
- package/dist/BaseExpandablePanel.d.ts +0 -20
- package/dist/ExpandArrow.d.ts +0 -13
- package/dist/ExpandablePanel.d.ts +0 -17
- package/dist/ExpandableText.d.ts +0 -25
- package/dist/ExpandableTextButton.d.ts +0 -14
- package/dist/expand.cjs.development.js +0 -259
- package/dist/expand.cjs.development.js.map +0 -1
- package/dist/expand.cjs.production.min.js +0 -2
- package/dist/expand.cjs.production.min.js.map +0 -1
- package/dist/index.js +0 -8
package/dist/expand.esm.js
CHANGED
|
@@ -1,248 +1,867 @@
|
|
|
1
|
-
import { useRandomId, warnAboutMissingStyles } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Heading5, SubParagraph, Paragraph, Heading2, Heading3, Heading4 } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
11
|
-
var t = arguments[e];
|
|
12
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
13
|
-
}
|
|
14
|
-
return n;
|
|
15
|
-
}, _extends.apply(null, arguments);
|
|
16
|
-
}
|
|
17
|
-
function _objectDestructuringEmpty(t) {
|
|
18
|
-
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
19
|
-
}
|
|
20
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
21
|
-
if (null == r) return {};
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
24
|
-
if (e.includes(n)) continue;
|
|
25
|
-
t[n] = r[n];
|
|
26
|
-
}
|
|
27
|
-
return t;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var AccordionContext = /*#__PURE__*/React.createContext(null);
|
|
31
|
-
var Accordion = function Accordion(_ref) {
|
|
32
|
-
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
33
|
-
var currentlyOpenState = React.useState(null);
|
|
34
|
-
return React.createElement(AccordionContext.Provider, _extends({
|
|
35
|
-
value: currentlyOpenState
|
|
36
|
-
}, rest));
|
|
1
|
+
import { useRandomId, warnAboutMissingStyles } from "@entur/utils";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Heading5, SubParagraph, Paragraph, Heading2, Heading3, Heading4 } from "@entur/typography";
|
|
5
|
+
import { DownArrowIcon } from "@entur/icons";
|
|
6
|
+
const AccordionContext = React.createContext(null);
|
|
7
|
+
const Accordion = ({ ...rest }) => {
|
|
8
|
+
const currentlyOpenState = React.useState(null);
|
|
9
|
+
return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: currentlyOpenState, ...rest });
|
|
37
10
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
defaultOpen = _ref2.defaultOpen;
|
|
41
|
-
var contextValue = React.useContext(AccordionContext);
|
|
11
|
+
const useAccordion = ({ id, defaultOpen }) => {
|
|
12
|
+
const contextValue = React.useContext(AccordionContext);
|
|
42
13
|
if (!contextValue) {
|
|
43
|
-
throw new Error(
|
|
14
|
+
throw new Error("You need to wrap your AccordionItem inside an Accordion");
|
|
44
15
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
React.useEffect(function () {
|
|
16
|
+
const [openId, setOpenId] = contextValue;
|
|
17
|
+
React.useEffect(() => {
|
|
48
18
|
if (defaultOpen) {
|
|
49
19
|
setOpenId(id);
|
|
50
20
|
}
|
|
51
21
|
}, [defaultOpen, id, setOpenId]);
|
|
52
|
-
|
|
22
|
+
const isOpen = openId === id;
|
|
53
23
|
return {
|
|
54
|
-
isOpen
|
|
55
|
-
toggle:
|
|
56
|
-
return setOpenId(isOpen ? null : id);
|
|
57
|
-
}
|
|
24
|
+
isOpen,
|
|
25
|
+
toggle: () => setOpenId(isOpen ? null : id)
|
|
58
26
|
};
|
|
59
27
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
28
|
+
function getDefaultExportFromCjs(x) {
|
|
29
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
30
|
+
}
|
|
31
|
+
var classnames = { exports: {} };
|
|
32
|
+
/*!
|
|
33
|
+
Copyright (c) 2018 Jed Watson.
|
|
34
|
+
Licensed under the MIT License (MIT), see
|
|
35
|
+
http://jedwatson.github.io/classnames
|
|
36
|
+
*/
|
|
37
|
+
var hasRequiredClassnames;
|
|
38
|
+
function requireClassnames() {
|
|
39
|
+
if (hasRequiredClassnames) return classnames.exports;
|
|
40
|
+
hasRequiredClassnames = 1;
|
|
41
|
+
(function(module) {
|
|
42
|
+
(function() {
|
|
43
|
+
var hasOwn = {}.hasOwnProperty;
|
|
44
|
+
function classNames2() {
|
|
45
|
+
var classes = "";
|
|
46
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
47
|
+
var arg = arguments[i];
|
|
48
|
+
if (arg) {
|
|
49
|
+
classes = appendClass(classes, parseValue(arg));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return classes;
|
|
53
|
+
}
|
|
54
|
+
function parseValue(arg) {
|
|
55
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
56
|
+
return arg;
|
|
57
|
+
}
|
|
58
|
+
if (typeof arg !== "object") {
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
if (Array.isArray(arg)) {
|
|
62
|
+
return classNames2.apply(null, arg);
|
|
63
|
+
}
|
|
64
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
65
|
+
return arg.toString();
|
|
66
|
+
}
|
|
67
|
+
var classes = "";
|
|
68
|
+
for (var key in arg) {
|
|
69
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
70
|
+
classes = appendClass(classes, key);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return classes;
|
|
74
|
+
}
|
|
75
|
+
function appendClass(value, newClass) {
|
|
76
|
+
if (!newClass) {
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
if (value) {
|
|
80
|
+
return value + " " + newClass;
|
|
81
|
+
}
|
|
82
|
+
return value + newClass;
|
|
83
|
+
}
|
|
84
|
+
if (module.exports) {
|
|
85
|
+
classNames2.default = classNames2;
|
|
86
|
+
module.exports = classNames2;
|
|
87
|
+
} else {
|
|
88
|
+
window.classNames = classNames2;
|
|
89
|
+
}
|
|
90
|
+
})();
|
|
91
|
+
})(classnames);
|
|
92
|
+
return classnames.exports;
|
|
93
|
+
}
|
|
94
|
+
var classnamesExports = requireClassnames();
|
|
95
|
+
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
96
|
+
var Collapse = {};
|
|
97
|
+
var hasRequiredCollapse;
|
|
98
|
+
function requireCollapse() {
|
|
99
|
+
if (hasRequiredCollapse) return Collapse;
|
|
100
|
+
hasRequiredCollapse = 1;
|
|
101
|
+
function _typeof(obj) {
|
|
102
|
+
"@babel/helpers - typeof";
|
|
103
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
104
|
+
_typeof = function _typeof2(obj2) {
|
|
105
|
+
return typeof obj2;
|
|
106
|
+
};
|
|
107
|
+
} else {
|
|
108
|
+
_typeof = function _typeof2(obj2) {
|
|
109
|
+
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return _typeof(obj);
|
|
113
|
+
}
|
|
114
|
+
Object.defineProperty(Collapse, "__esModule", {
|
|
115
|
+
value: true
|
|
116
|
+
});
|
|
117
|
+
Collapse.Collapse = void 0;
|
|
118
|
+
var _react = _interopRequireDefault(React);
|
|
119
|
+
function _interopRequireDefault(obj) {
|
|
120
|
+
return obj && obj.__esModule ? obj : { "default": obj };
|
|
121
|
+
}
|
|
122
|
+
function _classCallCheck(instance, Constructor) {
|
|
123
|
+
if (!(instance instanceof Constructor)) {
|
|
124
|
+
throw new TypeError("Cannot call a class as a function");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function _defineProperties(target, props) {
|
|
128
|
+
for (var i = 0; i < props.length; i++) {
|
|
129
|
+
var descriptor = props[i];
|
|
130
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
131
|
+
descriptor.configurable = true;
|
|
132
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
133
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
137
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
138
|
+
return Constructor;
|
|
139
|
+
}
|
|
140
|
+
function _inherits(subClass, superClass) {
|
|
141
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
142
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
143
|
+
}
|
|
144
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
145
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
146
|
+
}
|
|
147
|
+
function _setPrototypeOf(o, p) {
|
|
148
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
149
|
+
o2.__proto__ = p2;
|
|
150
|
+
return o2;
|
|
151
|
+
};
|
|
152
|
+
return _setPrototypeOf(o, p);
|
|
153
|
+
}
|
|
154
|
+
function _createSuper(Derived) {
|
|
155
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
156
|
+
return function _createSuperInternal() {
|
|
157
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
158
|
+
if (hasNativeReflectConstruct) {
|
|
159
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
160
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
161
|
+
} else {
|
|
162
|
+
result = Super.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
return _possibleConstructorReturn(this, result);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function _possibleConstructorReturn(self, call) {
|
|
168
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
169
|
+
return call;
|
|
170
|
+
} else if (call !== void 0) {
|
|
171
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
172
|
+
}
|
|
173
|
+
return _assertThisInitialized(self);
|
|
174
|
+
}
|
|
175
|
+
function _assertThisInitialized(self) {
|
|
176
|
+
if (self === void 0) {
|
|
177
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
178
|
+
}
|
|
179
|
+
return self;
|
|
180
|
+
}
|
|
181
|
+
function _isNativeReflectConstruct() {
|
|
182
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
183
|
+
if (Reflect.construct.sham) return false;
|
|
184
|
+
if (typeof Proxy === "function") return true;
|
|
185
|
+
try {
|
|
186
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
187
|
+
}));
|
|
188
|
+
return true;
|
|
189
|
+
} catch (e) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function _getPrototypeOf(o) {
|
|
194
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
195
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
196
|
+
};
|
|
197
|
+
return _getPrototypeOf(o);
|
|
198
|
+
}
|
|
199
|
+
function _defineProperty(obj, key, value) {
|
|
200
|
+
if (key in obj) {
|
|
201
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
202
|
+
} else {
|
|
203
|
+
obj[key] = value;
|
|
204
|
+
}
|
|
205
|
+
return obj;
|
|
206
|
+
}
|
|
207
|
+
var Collapse$1 = /* @__PURE__ */ function(_React$Component) {
|
|
208
|
+
_inherits(Collapse2, _React$Component);
|
|
209
|
+
var _super = _createSuper(Collapse2);
|
|
210
|
+
function Collapse2(props) {
|
|
211
|
+
var _this;
|
|
212
|
+
_classCallCheck(this, Collapse2);
|
|
213
|
+
_this = _super.call(this, props);
|
|
214
|
+
_defineProperty(_assertThisInitialized(_this), "timeout", void 0);
|
|
215
|
+
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
|
216
|
+
_defineProperty(_assertThisInitialized(_this), "content", void 0);
|
|
217
|
+
_defineProperty(_assertThisInitialized(_this), "onResize", function() {
|
|
218
|
+
clearTimeout(_this.timeout);
|
|
219
|
+
if (!_this.container || !_this.content) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
var _this$props = _this.props, isOpened = _this$props.isOpened, checkTimeout = _this$props.checkTimeout;
|
|
223
|
+
var containerHeight = Math.floor(_this.container.clientHeight);
|
|
224
|
+
var contentHeight = Math.floor(_this.content.clientHeight);
|
|
225
|
+
var isFullyOpened = isOpened && Math.abs(contentHeight - containerHeight) <= 1;
|
|
226
|
+
var isFullyClosed = !isOpened && Math.abs(containerHeight) <= 1;
|
|
227
|
+
if (isFullyOpened || isFullyClosed) {
|
|
228
|
+
_this.onRest({
|
|
229
|
+
isFullyOpened,
|
|
230
|
+
isFullyClosed,
|
|
231
|
+
isOpened,
|
|
232
|
+
containerHeight,
|
|
233
|
+
contentHeight
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
_this.onWork({
|
|
237
|
+
isFullyOpened,
|
|
238
|
+
isFullyClosed,
|
|
239
|
+
isOpened,
|
|
240
|
+
containerHeight,
|
|
241
|
+
contentHeight
|
|
242
|
+
});
|
|
243
|
+
_this.timeout = setTimeout(function() {
|
|
244
|
+
return _this.onResize();
|
|
245
|
+
}, checkTimeout);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
_defineProperty(_assertThisInitialized(_this), "onRest", function(_ref) {
|
|
249
|
+
var isFullyOpened = _ref.isFullyOpened, isFullyClosed = _ref.isFullyClosed, isOpened = _ref.isOpened, containerHeight = _ref.containerHeight, contentHeight = _ref.contentHeight;
|
|
250
|
+
if (!_this.container || !_this.content) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
var hasOpened = isOpened && _this.container.style.height === "".concat(contentHeight, "px");
|
|
254
|
+
var hasClosed = !isOpened && _this.container.style.height === "0px";
|
|
255
|
+
if (hasOpened || hasClosed) {
|
|
256
|
+
_this.container.style.overflow = isOpened ? "initial" : "hidden";
|
|
257
|
+
_this.container.style.height = isOpened ? "auto" : "0px";
|
|
258
|
+
var onRest = _this.props.onRest;
|
|
259
|
+
if (onRest) {
|
|
260
|
+
onRest({
|
|
261
|
+
isFullyOpened,
|
|
262
|
+
isFullyClosed,
|
|
263
|
+
isOpened,
|
|
264
|
+
containerHeight,
|
|
265
|
+
contentHeight
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
_defineProperty(_assertThisInitialized(_this), "onWork", function(_ref2) {
|
|
271
|
+
var isFullyOpened = _ref2.isFullyOpened, isFullyClosed = _ref2.isFullyClosed, isOpened = _ref2.isOpened, containerHeight = _ref2.containerHeight, contentHeight = _ref2.contentHeight;
|
|
272
|
+
if (!_this.container || !_this.content) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
var isOpenining = isOpened && _this.container.style.height === "".concat(contentHeight, "px");
|
|
276
|
+
var isClosing = !isOpened && _this.container.style.height === "0px";
|
|
277
|
+
if (isOpenining || isClosing) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
_this.container.style.overflow = "hidden";
|
|
281
|
+
_this.container.style.height = isOpened ? "".concat(contentHeight, "px") : "0px";
|
|
282
|
+
var onWork = _this.props.onWork;
|
|
283
|
+
if (onWork) {
|
|
284
|
+
onWork({
|
|
285
|
+
isFullyOpened,
|
|
286
|
+
isFullyClosed,
|
|
287
|
+
isOpened,
|
|
288
|
+
containerHeight,
|
|
289
|
+
contentHeight
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
_defineProperty(_assertThisInitialized(_this), "onRefContainer", function(container) {
|
|
294
|
+
_this.container = container;
|
|
295
|
+
});
|
|
296
|
+
_defineProperty(_assertThisInitialized(_this), "onRefContent", function(content) {
|
|
297
|
+
_this.content = content;
|
|
298
|
+
});
|
|
299
|
+
if (props.initialStyle) {
|
|
300
|
+
_this.initialStyle = props.initialStyle;
|
|
301
|
+
} else {
|
|
302
|
+
_this.initialStyle = props.isOpened ? {
|
|
303
|
+
height: "auto",
|
|
304
|
+
overflow: "initial"
|
|
305
|
+
} : {
|
|
306
|
+
height: "0px",
|
|
307
|
+
overflow: "hidden"
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
return _this;
|
|
311
|
+
}
|
|
312
|
+
_createClass(Collapse2, [{
|
|
313
|
+
key: "componentDidMount",
|
|
314
|
+
value: function componentDidMount() {
|
|
315
|
+
this.onResize();
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "shouldComponentUpdate",
|
|
319
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
320
|
+
var _this$props2 = this.props, theme = _this$props2.theme, isOpened = _this$props2.isOpened, children = _this$props2.children;
|
|
321
|
+
return children !== nextProps.children || isOpened !== nextProps.isOpened || Object.keys(theme).some(function(c) {
|
|
322
|
+
return theme[c] !== nextProps.theme[c];
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}, {
|
|
326
|
+
key: "getSnapshotBeforeUpdate",
|
|
327
|
+
value: function getSnapshotBeforeUpdate() {
|
|
328
|
+
if (!this.container || !this.content) {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
if (this.container.style.height === "auto") {
|
|
332
|
+
var contentHeight = this.content.clientHeight;
|
|
333
|
+
this.container.style.height = "".concat(contentHeight, "px");
|
|
334
|
+
}
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
}, {
|
|
338
|
+
key: "componentDidUpdate",
|
|
339
|
+
value: function componentDidUpdate() {
|
|
340
|
+
this.onResize();
|
|
341
|
+
}
|
|
342
|
+
}, {
|
|
343
|
+
key: "componentWillUnmount",
|
|
344
|
+
value: function componentWillUnmount() {
|
|
345
|
+
clearTimeout(this.timeout);
|
|
346
|
+
}
|
|
347
|
+
}, {
|
|
348
|
+
key: "render",
|
|
349
|
+
value: function render() {
|
|
350
|
+
var _this$props3 = this.props, theme = _this$props3.theme, children = _this$props3.children, isOpened = _this$props3.isOpened;
|
|
351
|
+
return /* @__PURE__ */ _react["default"].createElement("div", {
|
|
352
|
+
ref: this.onRefContainer,
|
|
353
|
+
className: theme.collapse,
|
|
354
|
+
style: this.initialStyle,
|
|
355
|
+
"aria-hidden": !isOpened
|
|
356
|
+
}, /* @__PURE__ */ _react["default"].createElement("div", {
|
|
357
|
+
ref: this.onRefContent,
|
|
358
|
+
className: theme.content
|
|
359
|
+
}, children));
|
|
360
|
+
}
|
|
361
|
+
}]);
|
|
362
|
+
return Collapse2;
|
|
363
|
+
}(_react["default"].Component);
|
|
364
|
+
Collapse.Collapse = Collapse$1;
|
|
365
|
+
_defineProperty(Collapse$1, "defaultProps", {
|
|
366
|
+
theme: {
|
|
367
|
+
collapse: "ReactCollapse--collapse",
|
|
368
|
+
content: "ReactCollapse--content"
|
|
369
|
+
},
|
|
370
|
+
initialStyle: void 0,
|
|
371
|
+
onRest: void 0,
|
|
372
|
+
onWork: void 0,
|
|
373
|
+
checkTimeout: 50
|
|
374
|
+
});
|
|
375
|
+
return Collapse;
|
|
376
|
+
}
|
|
377
|
+
var UnmountClosed = {};
|
|
378
|
+
var hasRequiredUnmountClosed;
|
|
379
|
+
function requireUnmountClosed() {
|
|
380
|
+
if (hasRequiredUnmountClosed) return UnmountClosed;
|
|
381
|
+
hasRequiredUnmountClosed = 1;
|
|
382
|
+
function _typeof(obj) {
|
|
383
|
+
"@babel/helpers - typeof";
|
|
384
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
385
|
+
_typeof = function _typeof2(obj2) {
|
|
386
|
+
return typeof obj2;
|
|
387
|
+
};
|
|
388
|
+
} else {
|
|
389
|
+
_typeof = function _typeof2(obj2) {
|
|
390
|
+
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
return _typeof(obj);
|
|
394
|
+
}
|
|
395
|
+
Object.defineProperty(UnmountClosed, "__esModule", {
|
|
396
|
+
value: true
|
|
397
|
+
});
|
|
398
|
+
UnmountClosed.UnmountClosed = void 0;
|
|
399
|
+
var _react = _interopRequireDefault(React);
|
|
400
|
+
var _Collapse = requireCollapse();
|
|
401
|
+
var _excluded = ["isOpened"], _excluded2 = ["isOpened"];
|
|
402
|
+
function _interopRequireDefault(obj) {
|
|
403
|
+
return obj && obj.__esModule ? obj : { "default": obj };
|
|
404
|
+
}
|
|
405
|
+
function _extends() {
|
|
406
|
+
_extends = Object.assign || function(target) {
|
|
407
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
408
|
+
var source = arguments[i];
|
|
409
|
+
for (var key in source) {
|
|
410
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
411
|
+
target[key] = source[key];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return target;
|
|
416
|
+
};
|
|
417
|
+
return _extends.apply(this, arguments);
|
|
418
|
+
}
|
|
419
|
+
function ownKeys(object, enumerableOnly) {
|
|
420
|
+
var keys = Object.keys(object);
|
|
421
|
+
if (Object.getOwnPropertySymbols) {
|
|
422
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
423
|
+
if (enumerableOnly) {
|
|
424
|
+
symbols = symbols.filter(function(sym) {
|
|
425
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
keys.push.apply(keys, symbols);
|
|
429
|
+
}
|
|
430
|
+
return keys;
|
|
431
|
+
}
|
|
432
|
+
function _objectSpread(target) {
|
|
433
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
434
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
435
|
+
if (i % 2) {
|
|
436
|
+
ownKeys(Object(source), true).forEach(function(key) {
|
|
437
|
+
_defineProperty(target, key, source[key]);
|
|
438
|
+
});
|
|
439
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
440
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
441
|
+
} else {
|
|
442
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
443
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return target;
|
|
448
|
+
}
|
|
449
|
+
function _objectWithoutProperties(source, excluded) {
|
|
450
|
+
if (source == null) return {};
|
|
451
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
452
|
+
var key, i;
|
|
453
|
+
if (Object.getOwnPropertySymbols) {
|
|
454
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
455
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
456
|
+
key = sourceSymbolKeys[i];
|
|
457
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
458
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
459
|
+
target[key] = source[key];
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return target;
|
|
463
|
+
}
|
|
464
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
465
|
+
if (source == null) return {};
|
|
466
|
+
var target = {};
|
|
467
|
+
var sourceKeys = Object.keys(source);
|
|
468
|
+
var key, i;
|
|
469
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
470
|
+
key = sourceKeys[i];
|
|
471
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
472
|
+
target[key] = source[key];
|
|
473
|
+
}
|
|
474
|
+
return target;
|
|
475
|
+
}
|
|
476
|
+
function _classCallCheck(instance, Constructor) {
|
|
477
|
+
if (!(instance instanceof Constructor)) {
|
|
478
|
+
throw new TypeError("Cannot call a class as a function");
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function _defineProperties(target, props) {
|
|
482
|
+
for (var i = 0; i < props.length; i++) {
|
|
483
|
+
var descriptor = props[i];
|
|
484
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
485
|
+
descriptor.configurable = true;
|
|
486
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
487
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
491
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
492
|
+
return Constructor;
|
|
493
|
+
}
|
|
494
|
+
function _inherits(subClass, superClass) {
|
|
495
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
496
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
497
|
+
}
|
|
498
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
499
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
500
|
+
}
|
|
501
|
+
function _setPrototypeOf(o, p) {
|
|
502
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
503
|
+
o2.__proto__ = p2;
|
|
504
|
+
return o2;
|
|
505
|
+
};
|
|
506
|
+
return _setPrototypeOf(o, p);
|
|
507
|
+
}
|
|
508
|
+
function _createSuper(Derived) {
|
|
509
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
510
|
+
return function _createSuperInternal() {
|
|
511
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
512
|
+
if (hasNativeReflectConstruct) {
|
|
513
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
514
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
515
|
+
} else {
|
|
516
|
+
result = Super.apply(this, arguments);
|
|
517
|
+
}
|
|
518
|
+
return _possibleConstructorReturn(this, result);
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
function _possibleConstructorReturn(self, call) {
|
|
522
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
523
|
+
return call;
|
|
524
|
+
} else if (call !== void 0) {
|
|
525
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
526
|
+
}
|
|
527
|
+
return _assertThisInitialized(self);
|
|
528
|
+
}
|
|
529
|
+
function _assertThisInitialized(self) {
|
|
530
|
+
if (self === void 0) {
|
|
531
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
532
|
+
}
|
|
533
|
+
return self;
|
|
534
|
+
}
|
|
535
|
+
function _isNativeReflectConstruct() {
|
|
536
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
537
|
+
if (Reflect.construct.sham) return false;
|
|
538
|
+
if (typeof Proxy === "function") return true;
|
|
539
|
+
try {
|
|
540
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
541
|
+
}));
|
|
542
|
+
return true;
|
|
543
|
+
} catch (e) {
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function _getPrototypeOf(o) {
|
|
548
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
549
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
550
|
+
};
|
|
551
|
+
return _getPrototypeOf(o);
|
|
552
|
+
}
|
|
553
|
+
function _defineProperty(obj, key, value) {
|
|
554
|
+
if (key in obj) {
|
|
555
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
556
|
+
} else {
|
|
557
|
+
obj[key] = value;
|
|
558
|
+
}
|
|
559
|
+
return obj;
|
|
560
|
+
}
|
|
561
|
+
var UnmountClosed$1 = /* @__PURE__ */ function(_React$PureComponent) {
|
|
562
|
+
_inherits(UnmountClosed2, _React$PureComponent);
|
|
563
|
+
var _super = _createSuper(UnmountClosed2);
|
|
564
|
+
function UnmountClosed2(props) {
|
|
565
|
+
var _this;
|
|
566
|
+
_classCallCheck(this, UnmountClosed2);
|
|
567
|
+
_this = _super.call(this, props);
|
|
568
|
+
_defineProperty(_assertThisInitialized(_this), "onWork", function(_ref) {
|
|
569
|
+
var isOpened = _ref.isOpened, rest = _objectWithoutProperties(_ref, _excluded);
|
|
570
|
+
_this.setState({
|
|
571
|
+
isResting: false,
|
|
572
|
+
isOpened
|
|
573
|
+
});
|
|
574
|
+
var onWork = _this.props.onWork;
|
|
575
|
+
if (onWork) {
|
|
576
|
+
onWork(_objectSpread({
|
|
577
|
+
isOpened
|
|
578
|
+
}, rest));
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
_defineProperty(_assertThisInitialized(_this), "onRest", function(_ref2) {
|
|
582
|
+
var isOpened = _ref2.isOpened, rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
583
|
+
_this.setState({
|
|
584
|
+
isResting: true,
|
|
585
|
+
isOpened,
|
|
586
|
+
isInitialRender: false
|
|
587
|
+
});
|
|
588
|
+
var onRest = _this.props.onRest;
|
|
589
|
+
if (onRest) {
|
|
590
|
+
onRest(_objectSpread({
|
|
591
|
+
isOpened
|
|
592
|
+
}, rest));
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
_defineProperty(_assertThisInitialized(_this), "getInitialStyle", function() {
|
|
596
|
+
var _this$state = _this.state, isOpened = _this$state.isOpened, isInitialRender = _this$state.isInitialRender;
|
|
597
|
+
if (isInitialRender) {
|
|
598
|
+
return isOpened ? {
|
|
599
|
+
height: "auto",
|
|
600
|
+
overflow: "initial"
|
|
601
|
+
} : {
|
|
602
|
+
height: "0px",
|
|
603
|
+
overflow: "hidden"
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
return {
|
|
607
|
+
height: "0px",
|
|
608
|
+
overflow: "hidden"
|
|
609
|
+
};
|
|
610
|
+
});
|
|
611
|
+
_this.state = {
|
|
612
|
+
isResting: true,
|
|
613
|
+
isOpened: props.isOpened,
|
|
614
|
+
isInitialRender: true
|
|
615
|
+
};
|
|
616
|
+
return _this;
|
|
617
|
+
}
|
|
618
|
+
_createClass(UnmountClosed2, [{
|
|
619
|
+
key: "componentDidUpdate",
|
|
620
|
+
value: function componentDidUpdate(prevProps) {
|
|
621
|
+
var isOpened = this.props.isOpened;
|
|
622
|
+
if (prevProps.isOpened !== isOpened) {
|
|
623
|
+
this.setState({
|
|
624
|
+
isResting: false,
|
|
625
|
+
isOpened,
|
|
626
|
+
isInitialRender: false
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}, {
|
|
631
|
+
key: "render",
|
|
632
|
+
value: function render() {
|
|
633
|
+
var _this$state2 = this.state, isResting = _this$state2.isResting, isOpened = _this$state2.isOpened;
|
|
634
|
+
return isResting && !isOpened ? null : /* @__PURE__ */ _react["default"].createElement(_Collapse.Collapse, _extends({}, this.props, {
|
|
635
|
+
initialStyle: this.getInitialStyle(),
|
|
636
|
+
onWork: this.onWork,
|
|
637
|
+
onRest: this.onRest
|
|
638
|
+
}));
|
|
639
|
+
}
|
|
640
|
+
}]);
|
|
641
|
+
return UnmountClosed2;
|
|
642
|
+
}(_react["default"].PureComponent);
|
|
643
|
+
UnmountClosed.UnmountClosed = UnmountClosed$1;
|
|
644
|
+
_defineProperty(UnmountClosed$1, "defaultProps", {
|
|
645
|
+
onWork: void 0,
|
|
646
|
+
onRest: void 0
|
|
647
|
+
});
|
|
648
|
+
return UnmountClosed;
|
|
649
|
+
}
|
|
650
|
+
var lib;
|
|
651
|
+
var hasRequiredLib;
|
|
652
|
+
function requireLib() {
|
|
653
|
+
if (hasRequiredLib) return lib;
|
|
654
|
+
hasRequiredLib = 1;
|
|
655
|
+
var _require = requireCollapse(), Collapse2 = _require.Collapse;
|
|
656
|
+
var _require2 = requireUnmountClosed(), UnmountClosed2 = _require2.UnmountClosed;
|
|
657
|
+
lib = UnmountClosed2;
|
|
658
|
+
UnmountClosed2.Collapse = Collapse2;
|
|
659
|
+
UnmountClosed2.UnmountClosed = UnmountClosed2;
|
|
660
|
+
return lib;
|
|
661
|
+
}
|
|
662
|
+
var libExports = requireLib();
|
|
663
|
+
const BaseExpand = ({ open, ...rest }) => {
|
|
664
|
+
return /* @__PURE__ */ jsx(libExports.UnmountClosed, { isOpened: open, children: /* @__PURE__ */ jsx("div", { ...rest }) });
|
|
68
665
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
666
|
+
const ExpandArrow = ({
|
|
667
|
+
open = false,
|
|
668
|
+
className,
|
|
669
|
+
...rest
|
|
670
|
+
}) => {
|
|
671
|
+
return /* @__PURE__ */ jsx(
|
|
672
|
+
DownArrowIcon,
|
|
673
|
+
{
|
|
674
|
+
className: classNames(className, "eds-expandable-arrow", {
|
|
675
|
+
"eds-expandable-arrow--open": open
|
|
676
|
+
}),
|
|
677
|
+
...rest,
|
|
678
|
+
"aria-hidden": "true"
|
|
679
|
+
}
|
|
680
|
+
);
|
|
83
681
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
682
|
+
const BaseExpandablePanel = ({
|
|
683
|
+
title,
|
|
684
|
+
children,
|
|
685
|
+
className,
|
|
686
|
+
id,
|
|
687
|
+
open,
|
|
688
|
+
onToggle,
|
|
689
|
+
contentStyle,
|
|
690
|
+
disableAnimation,
|
|
691
|
+
...rest
|
|
692
|
+
}) => {
|
|
693
|
+
return /* @__PURE__ */ jsxs(
|
|
694
|
+
"div",
|
|
695
|
+
{
|
|
696
|
+
className: classNames("eds-expandable-panel", className, {
|
|
697
|
+
"eds-expandable-panel--disable-animation": disableAnimation
|
|
698
|
+
}),
|
|
699
|
+
children: [
|
|
700
|
+
/* @__PURE__ */ jsx(
|
|
701
|
+
"button",
|
|
702
|
+
{
|
|
703
|
+
type: "button",
|
|
704
|
+
className: "eds-expandable-panel__trigger",
|
|
705
|
+
onClick: onToggle,
|
|
706
|
+
"aria-expanded": open,
|
|
707
|
+
"aria-controls": open ? id : void 0,
|
|
708
|
+
...rest,
|
|
709
|
+
children: /* @__PURE__ */ jsxs("span", { className: "eds-expandable-panel__grid", children: [
|
|
710
|
+
/* @__PURE__ */ jsx(Heading5, { margin: "none", as: "span", children: title }),
|
|
711
|
+
/* @__PURE__ */ jsx("span", { className: "eds-expandable-panel__icon-container", children: /* @__PURE__ */ jsx(ExpandArrow, { open }) })
|
|
712
|
+
] })
|
|
713
|
+
}
|
|
714
|
+
),
|
|
715
|
+
/* @__PURE__ */ jsx(
|
|
716
|
+
BaseExpand,
|
|
717
|
+
{
|
|
718
|
+
className: "eds-expandable-panel__content",
|
|
719
|
+
id,
|
|
720
|
+
open,
|
|
721
|
+
style: contentStyle,
|
|
722
|
+
children
|
|
723
|
+
}
|
|
724
|
+
)
|
|
725
|
+
]
|
|
726
|
+
}
|
|
727
|
+
);
|
|
121
728
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
onToggle: toggle,
|
|
142
|
-
open: isOpen
|
|
143
|
-
}));
|
|
729
|
+
const AccordionItem = ({
|
|
730
|
+
defaultOpen = false,
|
|
731
|
+
id: overrideId,
|
|
732
|
+
contentStyle,
|
|
733
|
+
...rest
|
|
734
|
+
}) => {
|
|
735
|
+
const randomId = useRandomId("eds-accordion-item");
|
|
736
|
+
const id = overrideId || randomId;
|
|
737
|
+
const { isOpen, toggle } = useAccordion({ id, defaultOpen });
|
|
738
|
+
return /* @__PURE__ */ jsx(
|
|
739
|
+
BaseExpandablePanel,
|
|
740
|
+
{
|
|
741
|
+
...rest,
|
|
742
|
+
contentStyle,
|
|
743
|
+
id,
|
|
744
|
+
onToggle: toggle,
|
|
745
|
+
open: isOpen
|
|
746
|
+
}
|
|
747
|
+
);
|
|
144
748
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
contentStyle: contentStyle
|
|
165
|
-
}, rest));
|
|
749
|
+
const ExpandablePanel = ({
|
|
750
|
+
defaultOpen = false,
|
|
751
|
+
contentStyle,
|
|
752
|
+
...rest
|
|
753
|
+
}) => {
|
|
754
|
+
const randomId = useRandomId("eds-expandable");
|
|
755
|
+
const [isOpen, setOpen] = React.useState(defaultOpen);
|
|
756
|
+
return /* @__PURE__ */ jsx(
|
|
757
|
+
BaseExpandablePanel,
|
|
758
|
+
{
|
|
759
|
+
id: randomId,
|
|
760
|
+
open: isOpen,
|
|
761
|
+
onToggle: () => setOpen((prev) => !prev),
|
|
762
|
+
contentStyle,
|
|
763
|
+
...rest
|
|
764
|
+
}
|
|
765
|
+
);
|
|
166
766
|
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
767
|
+
const ExpandableTextButton = ({
|
|
768
|
+
children,
|
|
769
|
+
open,
|
|
770
|
+
onToggle,
|
|
771
|
+
as: Component = Heading5,
|
|
772
|
+
...rest
|
|
773
|
+
}) => {
|
|
774
|
+
return /* @__PURE__ */ jsxs(
|
|
775
|
+
"button",
|
|
776
|
+
{
|
|
777
|
+
className: "eds-expandable-text__trigger",
|
|
778
|
+
"aria-expanded": open,
|
|
779
|
+
type: "button",
|
|
780
|
+
onClick: onToggle,
|
|
781
|
+
...rest,
|
|
782
|
+
children: [
|
|
783
|
+
/* @__PURE__ */ jsx(Component, { children }),
|
|
784
|
+
/* @__PURE__ */ jsx(ExpandArrow, { open, className: "eds-expandable-text__arrow" })
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
);
|
|
185
788
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
789
|
+
const ExpandableText = ({
|
|
790
|
+
title,
|
|
791
|
+
children,
|
|
792
|
+
defaultOpen = false,
|
|
793
|
+
contentStyle,
|
|
794
|
+
titleElement = "Heading5",
|
|
795
|
+
disableAnimation,
|
|
796
|
+
className,
|
|
797
|
+
...rest
|
|
798
|
+
}) => {
|
|
799
|
+
const randomId = useRandomId("eds-expandable-text");
|
|
800
|
+
const [isOpen, setOpen] = React.useState(defaultOpen);
|
|
801
|
+
const Element = React.useMemo(
|
|
802
|
+
() => GetTypographyComponent(titleElement),
|
|
803
|
+
[titleElement]
|
|
804
|
+
);
|
|
805
|
+
return /* @__PURE__ */ jsxs(
|
|
806
|
+
"div",
|
|
807
|
+
{
|
|
808
|
+
className: classNames("eds-expandable-text", className, {
|
|
809
|
+
"eds-expandable-text--disable-animation": disableAnimation
|
|
810
|
+
}),
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ jsx(
|
|
813
|
+
ExpandableTextButton,
|
|
814
|
+
{
|
|
815
|
+
open: isOpen,
|
|
816
|
+
onToggle: () => setOpen((prev) => !prev),
|
|
817
|
+
"aria-controls": isOpen ? randomId : void 0,
|
|
818
|
+
as: Element,
|
|
819
|
+
...rest,
|
|
820
|
+
children: title
|
|
821
|
+
}
|
|
822
|
+
),
|
|
823
|
+
/* @__PURE__ */ jsx(
|
|
824
|
+
BaseExpand,
|
|
825
|
+
{
|
|
826
|
+
className: "eds-expandable-text__content",
|
|
827
|
+
id: randomId,
|
|
828
|
+
open: isOpen,
|
|
829
|
+
style: contentStyle,
|
|
830
|
+
...rest,
|
|
831
|
+
children
|
|
832
|
+
}
|
|
833
|
+
)
|
|
834
|
+
]
|
|
835
|
+
}
|
|
836
|
+
);
|
|
225
837
|
};
|
|
226
838
|
function GetTypographyComponent(element) {
|
|
227
839
|
switch (element) {
|
|
228
|
-
case
|
|
840
|
+
case "Heading5":
|
|
229
841
|
return Heading5;
|
|
230
|
-
case
|
|
842
|
+
case "Heading4":
|
|
231
843
|
return Heading4;
|
|
232
|
-
case
|
|
844
|
+
case "Heading3":
|
|
233
845
|
return Heading3;
|
|
234
|
-
case
|
|
846
|
+
case "Heading2":
|
|
235
847
|
return Heading2;
|
|
236
|
-
case
|
|
848
|
+
case "Paragraph":
|
|
237
849
|
return Paragraph;
|
|
238
|
-
case
|
|
850
|
+
case "SubParagraph":
|
|
239
851
|
return SubParagraph;
|
|
240
852
|
default:
|
|
241
853
|
return Heading5;
|
|
242
854
|
}
|
|
243
855
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
856
|
+
warnAboutMissingStyles("expand", "typography", "icons");
|
|
857
|
+
export {
|
|
858
|
+
Accordion,
|
|
859
|
+
AccordionItem,
|
|
860
|
+
BaseExpand,
|
|
861
|
+
ExpandArrow,
|
|
862
|
+
ExpandablePanel,
|
|
863
|
+
ExpandableText,
|
|
864
|
+
ExpandableTextButton,
|
|
865
|
+
useAccordion
|
|
866
|
+
};
|
|
248
867
|
//# sourceMappingURL=expand.esm.js.map
|