fe-fabric-react 0.0.1-security → 2.864.3
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.
Potentially problematic release.
This version of fe-fabric-react might be problematic. Click here for more details.
- package/build.js +40 -0
- package/lib/core/FontAwesomeContext.js +126 -0
- package/lib/core/components/FeAppLogo.js +54 -0
- package/lib/core/components/FeAvatar.js +314 -0
- package/lib/core/components/FeBadge.js +177 -0
- package/lib/core/components/FeBreadcrumb.js +205 -0
- package/lib/core/components/FeButton.js +185 -0
- package/lib/core/components/FeCheckbox.js +91 -0
- package/lib/core/components/FeCogButton.js +204 -0
- package/lib/core/components/FeDefaultLink.js +108 -0
- package/lib/core/components/FeDropdown.js +677 -0
- package/lib/core/components/FeFormGroup.js +245 -0
- package/lib/core/components/FeIcon.js +52 -0
- package/lib/core/components/FeIconStack.js +26 -0
- package/lib/core/components/FeInputField.js +500 -0
- package/lib/core/components/FeLabel.js +142 -0
- package/lib/core/components/FeListItem.js +719 -0
- package/lib/core/components/FeListItemGroup.js +364 -0
- package/lib/core/components/FeLoader.js +69 -0
- package/lib/core/components/FeNotification.js +351 -0
- package/lib/core/components/FePillBox.js +353 -0
- package/lib/core/components/FeProgressBar.js +282 -0
- package/lib/core/components/FeRadioButton.js +234 -0
- package/lib/core/components/FeSearchField.js +322 -0
- package/lib/core/components/FeSelfContainedInput.js +215 -0
- package/lib/core/components/FeTableCell.js +27 -0
- package/lib/core/components/FeTableHeaderCell.js +273 -0
- package/lib/core/components/FeTableRow.js +24 -0
- package/lib/core/components/FeTextEnrichment.js +78 -0
- package/lib/core/components/FeToggle.js +69 -0
- package/lib/core/index.js +243 -0
- package/lib/core/utils/aria-role.js +11 -0
- package/lib/core/utils/fe-filter.js +157 -0
- package/lib/core/utils/helper.js +11 -0
- package/lib/core/utils/index.js +268 -0
- package/lib/customPropTypes.js +51 -0
- package/lib/fe-filter/FeFilter.js +1312 -0
- package/lib/fe-filter/index.js +17 -0
- package/lib/fe-footer/FeFooter.js +81 -0
- package/lib/fe-footer/index.js +17 -0
- package/lib/fe-hero/FeHero.js +192 -0
- package/lib/fe-hero/index.js +17 -0
- package/lib/fe-modal/FeModal.js +409 -0
- package/lib/fe-modal/index.js +17 -0
- package/lib/fe-notifications/FeNotifications.js +235 -0
- package/lib/fe-notifications/index.js +17 -0
- package/lib/fe-pagination/FePagination.js +688 -0
- package/lib/fe-pagination/index.js +17 -0
- package/lib/fe-panel/FePanel.js +282 -0
- package/lib/fe-panel/index.js +17 -0
- package/lib/fe-sidenav/FeSideNav.js +78 -0
- package/lib/fe-sidenav/FeSideNavList.js +346 -0
- package/lib/fe-sidenav/index.js +17 -0
- package/lib/fe-table/FeTable.js +703 -0
- package/lib/fe-table/index.js +17 -0
- package/lib/fe-topnav/FeTopNav.js +110 -0
- package/lib/fe-topnav/FeTopNavList.js +401 -0
- package/lib/fe-topnav/index.js +17 -0
- package/lib/index.js +129 -0
- package/lib/layout/Col.js +187 -0
- package/lib/layout/Container.js +97 -0
- package/lib/layout/Row.js +99 -0
- package/lib/layout/index.js +35 -0
- package/package.json +42 -4
- package/README.md +0 -5
@@ -0,0 +1,409 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
+
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
|
14
|
+
var _utils = require("../core/utils");
|
15
|
+
|
16
|
+
var _core = require("../core");
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) {
|
19
|
+
return obj && obj.__esModule ? obj : {
|
20
|
+
default: obj
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj) {
|
25
|
+
if (obj && obj.__esModule) {
|
26
|
+
return obj;
|
27
|
+
} else {
|
28
|
+
var newObj = {};
|
29
|
+
|
30
|
+
if (obj != null) {
|
31
|
+
for (var key in obj) {
|
32
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
33
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
34
|
+
|
35
|
+
if (desc.get || desc.set) {
|
36
|
+
Object.defineProperty(newObj, key, desc);
|
37
|
+
} else {
|
38
|
+
newObj[key] = obj[key];
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
newObj.default = obj;
|
45
|
+
return newObj;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function _typeof(obj) {
|
50
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
51
|
+
_typeof = function _typeof(obj) {
|
52
|
+
return typeof obj;
|
53
|
+
};
|
54
|
+
} else {
|
55
|
+
_typeof = function _typeof(obj) {
|
56
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
57
|
+
};
|
58
|
+
}
|
59
|
+
|
60
|
+
return _typeof(obj);
|
61
|
+
}
|
62
|
+
|
63
|
+
function _extends() {
|
64
|
+
_extends = Object.assign || function (target) {
|
65
|
+
for (var i = 1; i < arguments.length; i++) {
|
66
|
+
var source = arguments[i];
|
67
|
+
|
68
|
+
for (var key in source) {
|
69
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
70
|
+
target[key] = source[key];
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
return target;
|
76
|
+
};
|
77
|
+
|
78
|
+
return _extends.apply(this, arguments);
|
79
|
+
}
|
80
|
+
|
81
|
+
function _objectWithoutProperties(source, excluded) {
|
82
|
+
if (source == null) return {};
|
83
|
+
|
84
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
85
|
+
|
86
|
+
var key, i;
|
87
|
+
|
88
|
+
if (Object.getOwnPropertySymbols) {
|
89
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
90
|
+
|
91
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
92
|
+
key = sourceSymbolKeys[i];
|
93
|
+
if (excluded.indexOf(key) >= 0) continue;
|
94
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
95
|
+
target[key] = source[key];
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
return target;
|
100
|
+
}
|
101
|
+
|
102
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
103
|
+
if (source == null) return {};
|
104
|
+
var target = {};
|
105
|
+
var sourceKeys = Object.keys(source);
|
106
|
+
var key, i;
|
107
|
+
|
108
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
109
|
+
key = sourceKeys[i];
|
110
|
+
if (excluded.indexOf(key) >= 0) continue;
|
111
|
+
target[key] = source[key];
|
112
|
+
}
|
113
|
+
|
114
|
+
return target;
|
115
|
+
}
|
116
|
+
|
117
|
+
function _classCallCheck(instance, Constructor) {
|
118
|
+
if (!(instance instanceof Constructor)) {
|
119
|
+
throw new TypeError("Cannot call a class as a function");
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
function _defineProperties(target, props) {
|
124
|
+
for (var i = 0; i < props.length; i++) {
|
125
|
+
var descriptor = props[i];
|
126
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
127
|
+
descriptor.configurable = true;
|
128
|
+
if ("value" in descriptor) descriptor.writable = true;
|
129
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
134
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
135
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
136
|
+
return Constructor;
|
137
|
+
}
|
138
|
+
|
139
|
+
function _possibleConstructorReturn(self, call) {
|
140
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
141
|
+
return call;
|
142
|
+
}
|
143
|
+
|
144
|
+
return _assertThisInitialized(self);
|
145
|
+
}
|
146
|
+
|
147
|
+
function _getPrototypeOf(o) {
|
148
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
149
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
150
|
+
};
|
151
|
+
return _getPrototypeOf(o);
|
152
|
+
}
|
153
|
+
|
154
|
+
function _assertThisInitialized(self) {
|
155
|
+
if (self === void 0) {
|
156
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
157
|
+
}
|
158
|
+
|
159
|
+
return self;
|
160
|
+
}
|
161
|
+
|
162
|
+
function _inherits(subClass, superClass) {
|
163
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
164
|
+
throw new TypeError("Super expression must either be null or a function");
|
165
|
+
}
|
166
|
+
|
167
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
168
|
+
constructor: {
|
169
|
+
value: subClass,
|
170
|
+
writable: true,
|
171
|
+
configurable: true
|
172
|
+
}
|
173
|
+
});
|
174
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
175
|
+
}
|
176
|
+
|
177
|
+
function _setPrototypeOf(o, p) {
|
178
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
179
|
+
o.__proto__ = p;
|
180
|
+
return o;
|
181
|
+
};
|
182
|
+
|
183
|
+
return _setPrototypeOf(o, p);
|
184
|
+
}
|
185
|
+
|
186
|
+
var FeModal =
|
187
|
+
/*#__PURE__*/
|
188
|
+
function (_Component) {
|
189
|
+
_inherits(FeModal, _Component);
|
190
|
+
|
191
|
+
function FeModal(props) {
|
192
|
+
var _this;
|
193
|
+
|
194
|
+
_classCallCheck(this, FeModal);
|
195
|
+
|
196
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(FeModal).call(this, props));
|
197
|
+
_this.state = {
|
198
|
+
isOpen: false
|
199
|
+
};
|
200
|
+
_this.hide = _this.hide.bind(_assertThisInitialized(_this));
|
201
|
+
_this.checkDocumentKeyDown = _this.checkDocumentKeyDown.bind(_assertThisInitialized(_this));
|
202
|
+
return _this;
|
203
|
+
}
|
204
|
+
|
205
|
+
_createClass(FeModal, [{
|
206
|
+
key: "hide",
|
207
|
+
value: function hide() {
|
208
|
+
this.setState({
|
209
|
+
isOpen: false
|
210
|
+
});
|
211
|
+
this.restore();
|
212
|
+
|
213
|
+
if (this.props.onHide) {
|
214
|
+
this.props.onHide({
|
215
|
+
isOpen: false
|
216
|
+
});
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}, {
|
220
|
+
key: "restore",
|
221
|
+
value: function restore() {
|
222
|
+
//restore focus
|
223
|
+
if (this.props.referId) {
|
224
|
+
var referElement = document.getElementById(this.props.referId);
|
225
|
+
referElement && referElement.focus();
|
226
|
+
}
|
227
|
+
|
228
|
+
document.body.classList.remove('fe-modal-open');
|
229
|
+
}
|
230
|
+
}, {
|
231
|
+
key: "getTitleIcon",
|
232
|
+
value: function getTitleIcon() {
|
233
|
+
return _react.default.createElement("div", {
|
234
|
+
className: "fe-modal__header--with-icon"
|
235
|
+
}, _react.default.createElement(_core.FeIcon, {
|
236
|
+
family: this.props.iconTitle.family,
|
237
|
+
icon: this.props.iconTitle.icon
|
238
|
+
}));
|
239
|
+
}
|
240
|
+
}, {
|
241
|
+
key: "getTitle",
|
242
|
+
value: function getTitle() {
|
243
|
+
return _react.default.createElement("h4", {
|
244
|
+
className: "fe-modal__title"
|
245
|
+
}, this.props.title);
|
246
|
+
}
|
247
|
+
}, {
|
248
|
+
key: "getAction",
|
249
|
+
value: function getAction(props, style) {
|
250
|
+
var autoFocus = style === 'primary';
|
251
|
+
var className = (0, _classnames.default)({
|
252
|
+
'pull-left': style === 'primary-danger'
|
253
|
+
});
|
254
|
+
|
255
|
+
var label = props.label,
|
256
|
+
buttonProps = _objectWithoutProperties(props, ["label"]);
|
257
|
+
|
258
|
+
return _react.default.createElement(_core.FeButton, _extends({}, buttonProps, {
|
259
|
+
feStyle: style,
|
260
|
+
className: className,
|
261
|
+
autoFocus: autoFocus
|
262
|
+
}), label);
|
263
|
+
}
|
264
|
+
}, {
|
265
|
+
key: "checkDocumentKeyDown",
|
266
|
+
value: function checkDocumentKeyDown(event) {
|
267
|
+
if (!this.state.isOpen) {
|
268
|
+
return false;
|
269
|
+
}
|
270
|
+
|
271
|
+
if (event.keyCode === 27) {
|
272
|
+
//Escape
|
273
|
+
this.hide();
|
274
|
+
} else if (event.keyCode === 9) {
|
275
|
+
//Tab
|
276
|
+
(0, _utils.trapFocus)(event, this.node);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}, {
|
280
|
+
key: "componentDidMount",
|
281
|
+
value: function componentDidMount() {
|
282
|
+
//add keydown event
|
283
|
+
document.addEventListener('keydown', this.checkDocumentKeyDown);
|
284
|
+
}
|
285
|
+
}, {
|
286
|
+
key: "componentWillUnmount",
|
287
|
+
value: function componentWillUnmount() {
|
288
|
+
//remove keydown event
|
289
|
+
document.removeEventListener('keydown', this.checkDocumentKeyDown);
|
290
|
+
}
|
291
|
+
}, {
|
292
|
+
key: "render",
|
293
|
+
value: function render() {
|
294
|
+
var _this2 = this;
|
295
|
+
/** Minimum condition required to render*/
|
296
|
+
|
297
|
+
|
298
|
+
if (!(this.props.isOpen && this.props.children)) {
|
299
|
+
this.restore();
|
300
|
+
return null;
|
301
|
+
}
|
302
|
+
/** Rendering of component */
|
303
|
+
|
304
|
+
|
305
|
+
document.body.classList.add('fe-modal-open');
|
306
|
+
var wrapperClass = (0, _classnames.default)('fe-modal', this.props.className);
|
307
|
+
var className = (0, _classnames.default)('fe-modal__dialog', ["fe-modal__dialog--".concat(this.props.size)]);
|
308
|
+
var iconTitle = this.props.iconTitle && this.getTitleIcon();
|
309
|
+
var title = this.props.title && this.getTitle();
|
310
|
+
var primaryAction = this.props.primaryAction && this.getAction(this.props.primaryAction, 'primary');
|
311
|
+
var secondaryAction = this.props.secondaryAction && this.getAction(this.props.secondaryAction, 'secondary');
|
312
|
+
var dangerAction = this.props.dangerAction && this.getAction(this.props.dangerAction, 'primary-danger'); //Aria attributes
|
313
|
+
|
314
|
+
var ariaAttributesForModal = {
|
315
|
+
'role': 'dialog',
|
316
|
+
'aria-labelledby': "".concat(this.props.referId),
|
317
|
+
'aria-modal': "".concat(this.state.isOpen)
|
318
|
+
};
|
319
|
+
var ariaAttributesForBody = {};
|
320
|
+
|
321
|
+
if (this.props.size === 'large') {
|
322
|
+
ariaAttributesForBody['tabIndex'] = '0';
|
323
|
+
}
|
324
|
+
|
325
|
+
return _react.default.createElement("div", _extends({
|
326
|
+
className: wrapperClass
|
327
|
+
}, ariaAttributesForModal, {
|
328
|
+
ref: function ref(node) {
|
329
|
+
return _this2.node = node;
|
330
|
+
}
|
331
|
+
}), _react.default.createElement("div", {
|
332
|
+
className: className
|
333
|
+
}, _react.default.createElement("section", {
|
334
|
+
className: "fe-modal__content"
|
335
|
+
}, _react.default.createElement("header", null, _react.default.createElement("div", {
|
336
|
+
className: "fe-modal__header"
|
337
|
+
}, iconTitle, title, _react.default.createElement("button", {
|
338
|
+
className: "fe-modal-close",
|
339
|
+
"aria-label": "Close modal",
|
340
|
+
onClick: this.hide
|
341
|
+
}, _react.default.createElement(_core.FeIcon, {
|
342
|
+
family: "light",
|
343
|
+
icon: "times"
|
344
|
+
})))), _react.default.createElement("div", _extends({
|
345
|
+
className: "fe-modal__body"
|
346
|
+
}, ariaAttributesForBody), this.props.children), dangerAction || secondaryAction || primaryAction ? _react.default.createElement("footer", {
|
347
|
+
className: "fe-modal__footer"
|
348
|
+
}, dangerAction, secondaryAction, primaryAction) : null)));
|
349
|
+
}
|
350
|
+
}], [{
|
351
|
+
key: "getDerivedStateFromProps",
|
352
|
+
value: function getDerivedStateFromProps(props, state) {
|
353
|
+
if (props.isOpen !== state.isOpen) {
|
354
|
+
return {
|
355
|
+
isOpen: props.isOpen
|
356
|
+
};
|
357
|
+
}
|
358
|
+
|
359
|
+
return null;
|
360
|
+
}
|
361
|
+
}]);
|
362
|
+
|
363
|
+
return FeModal;
|
364
|
+
}(_react.Component);
|
365
|
+
|
366
|
+
FeModal.defaultProps = {
|
367
|
+
referId: null,
|
368
|
+
title: null,
|
369
|
+
size: 'small',
|
370
|
+
isOpen: false,
|
371
|
+
primaryAction: null,
|
372
|
+
secondaryAction: null,
|
373
|
+
dangerAction: null,
|
374
|
+
children: null
|
375
|
+
};
|
376
|
+
FeModal.propTypes = {
|
377
|
+
/** Provide id of refer button, its required for aria attributes and restore focus*/
|
378
|
+
referId: _propTypes.default.string,
|
379
|
+
|
380
|
+
/** Provide modal title*/
|
381
|
+
title: _propTypes.default.string,
|
382
|
+
|
383
|
+
/** Provide icon name and family for title title*/
|
384
|
+
iconTitle: _propTypes.default.exact({
|
385
|
+
icon: _propTypes.default.string.isRequired,
|
386
|
+
family: _propTypes.default.string.isRequired
|
387
|
+
}),
|
388
|
+
|
389
|
+
/** Provide modal size like 'small', 'medium', 'large'*/
|
390
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
391
|
+
|
392
|
+
/** Set true/false to toggle modal*/
|
393
|
+
isOpen: _propTypes.default.bool,
|
394
|
+
|
395
|
+
/** Provide primary action like FeButton Attributes*/
|
396
|
+
primaryAction: _propTypes.default.object,
|
397
|
+
|
398
|
+
/** Provide secondary action like FeButton Attributes*/
|
399
|
+
secondaryAction: _propTypes.default.object,
|
400
|
+
|
401
|
+
/** Provide danger action like FeButton Attributes*/
|
402
|
+
dangerAction: _propTypes.default.object,
|
403
|
+
|
404
|
+
/** Provide body children*/
|
405
|
+
children: _propTypes.default.element
|
406
|
+
};
|
407
|
+
FeModal.displayName = 'FeModal';
|
408
|
+
var _default = FeModal;
|
409
|
+
exports.default = _default;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _FeModal = _interopRequireDefault(require("./FeModal"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) {
|
11
|
+
return obj && obj.__esModule ? obj : {
|
12
|
+
default: obj
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
var _default = _FeModal.default;
|
17
|
+
exports.default = _default;
|
@@ -0,0 +1,235 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
+
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
|
14
|
+
var _toNumber = _interopRequireDefault(require("lodash/toNumber"));
|
15
|
+
|
16
|
+
var _core = require("../core");
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) {
|
19
|
+
return obj && obj.__esModule ? obj : {
|
20
|
+
default: obj
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj) {
|
25
|
+
if (obj && obj.__esModule) {
|
26
|
+
return obj;
|
27
|
+
} else {
|
28
|
+
var newObj = {};
|
29
|
+
|
30
|
+
if (obj != null) {
|
31
|
+
for (var key in obj) {
|
32
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
33
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
34
|
+
|
35
|
+
if (desc.get || desc.set) {
|
36
|
+
Object.defineProperty(newObj, key, desc);
|
37
|
+
} else {
|
38
|
+
newObj[key] = obj[key];
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
newObj.default = obj;
|
45
|
+
return newObj;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function _typeof(obj) {
|
50
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
51
|
+
_typeof = function _typeof(obj) {
|
52
|
+
return typeof obj;
|
53
|
+
};
|
54
|
+
} else {
|
55
|
+
_typeof = function _typeof(obj) {
|
56
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
57
|
+
};
|
58
|
+
}
|
59
|
+
|
60
|
+
return _typeof(obj);
|
61
|
+
}
|
62
|
+
|
63
|
+
function _extends() {
|
64
|
+
_extends = Object.assign || function (target) {
|
65
|
+
for (var i = 1; i < arguments.length; i++) {
|
66
|
+
var source = arguments[i];
|
67
|
+
|
68
|
+
for (var key in source) {
|
69
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
70
|
+
target[key] = source[key];
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
return target;
|
76
|
+
};
|
77
|
+
|
78
|
+
return _extends.apply(this, arguments);
|
79
|
+
}
|
80
|
+
|
81
|
+
function _classCallCheck(instance, Constructor) {
|
82
|
+
if (!(instance instanceof Constructor)) {
|
83
|
+
throw new TypeError("Cannot call a class as a function");
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
function _defineProperties(target, props) {
|
88
|
+
for (var i = 0; i < props.length; i++) {
|
89
|
+
var descriptor = props[i];
|
90
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
91
|
+
descriptor.configurable = true;
|
92
|
+
if ("value" in descriptor) descriptor.writable = true;
|
93
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
98
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
99
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
100
|
+
return Constructor;
|
101
|
+
}
|
102
|
+
|
103
|
+
function _possibleConstructorReturn(self, call) {
|
104
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
105
|
+
return call;
|
106
|
+
}
|
107
|
+
|
108
|
+
return _assertThisInitialized(self);
|
109
|
+
}
|
110
|
+
|
111
|
+
function _getPrototypeOf(o) {
|
112
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
113
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
114
|
+
};
|
115
|
+
return _getPrototypeOf(o);
|
116
|
+
}
|
117
|
+
|
118
|
+
function _assertThisInitialized(self) {
|
119
|
+
if (self === void 0) {
|
120
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
121
|
+
}
|
122
|
+
|
123
|
+
return self;
|
124
|
+
}
|
125
|
+
|
126
|
+
function _inherits(subClass, superClass) {
|
127
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
128
|
+
throw new TypeError("Super expression must either be null or a function");
|
129
|
+
}
|
130
|
+
|
131
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
132
|
+
constructor: {
|
133
|
+
value: subClass,
|
134
|
+
writable: true,
|
135
|
+
configurable: true
|
136
|
+
}
|
137
|
+
});
|
138
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
139
|
+
}
|
140
|
+
|
141
|
+
function _setPrototypeOf(o, p) {
|
142
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
143
|
+
o.__proto__ = p;
|
144
|
+
return o;
|
145
|
+
};
|
146
|
+
|
147
|
+
return _setPrototypeOf(o, p);
|
148
|
+
}
|
149
|
+
|
150
|
+
var FeNotifications =
|
151
|
+
/*#__PURE__*/
|
152
|
+
function (_Component) {
|
153
|
+
_inherits(FeNotifications, _Component);
|
154
|
+
|
155
|
+
function FeNotifications(props) {
|
156
|
+
var _this;
|
157
|
+
|
158
|
+
_classCallCheck(this, FeNotifications);
|
159
|
+
|
160
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(FeNotifications).call(this, props));
|
161
|
+
_this.onDismiss = _this.onDismiss.bind(_assertThisInitialized(_this));
|
162
|
+
return _this;
|
163
|
+
}
|
164
|
+
|
165
|
+
_createClass(FeNotifications, [{
|
166
|
+
key: "onDismiss",
|
167
|
+
value: function onDismiss(index) {
|
168
|
+
index = (0, _toNumber.default)(index);
|
169
|
+
var notifications = Object.assign([], this.props.notifications);
|
170
|
+
notifications[index]['dismissed'] = true;
|
171
|
+
|
172
|
+
if (this.props.onDismiss) {
|
173
|
+
this.props.onDismiss(index, notifications);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}, {
|
177
|
+
key: "isAllDismissed",
|
178
|
+
value: function isAllDismissed(notifications) {
|
179
|
+
var index = -1;
|
180
|
+
|
181
|
+
if (notifications && notifications.length) {
|
182
|
+
index = notifications.findIndex(function (item) {
|
183
|
+
return !item.dismissed;
|
184
|
+
});
|
185
|
+
}
|
186
|
+
|
187
|
+
return index < 0;
|
188
|
+
}
|
189
|
+
}, {
|
190
|
+
key: "render",
|
191
|
+
value: function render() {
|
192
|
+
var _this2 = this;
|
193
|
+
/** Minimum condition required to render*/
|
194
|
+
|
195
|
+
/** Rendering of component */
|
196
|
+
|
197
|
+
|
198
|
+
var isAllDismissed = this.isAllDismissed(this.props.notifications);
|
199
|
+
var className = (0, _classnames.default)('fe-notice-container', {
|
200
|
+
'fe-notice-container--display': !isAllDismissed
|
201
|
+
}, this.props.className);
|
202
|
+
var otherProps = Object.assign({}, this.props);
|
203
|
+
delete otherProps.notifications;
|
204
|
+
delete otherProps.onDismiss;
|
205
|
+
delete otherProps.className;
|
206
|
+
return _react.default.createElement("div", _extends({
|
207
|
+
className: className
|
208
|
+
}, otherProps), this.props.notifications.map(function (notification, i) {
|
209
|
+
return _react.default.createElement(_core.FeNotification, _extends({
|
210
|
+
key: i
|
211
|
+
}, notification, {
|
212
|
+
index: "".concat(i),
|
213
|
+
onDismiss: _this2.onDismiss
|
214
|
+
}));
|
215
|
+
}));
|
216
|
+
}
|
217
|
+
}]);
|
218
|
+
|
219
|
+
return FeNotifications;
|
220
|
+
}(_react.Component);
|
221
|
+
|
222
|
+
FeNotifications.defaultProps = {
|
223
|
+
notifications: [],
|
224
|
+
onDismiss: null
|
225
|
+
};
|
226
|
+
FeNotifications.propTypes = {
|
227
|
+
/** Provide notifications*/
|
228
|
+
notifications: _propTypes.default.array,
|
229
|
+
|
230
|
+
/** Provide handler on notification dismiss*/
|
231
|
+
onDismiss: _propTypes.default.func
|
232
|
+
};
|
233
|
+
FeNotifications.displayName = 'FeNotifications';
|
234
|
+
var _default = FeNotifications;
|
235
|
+
exports.default = _default;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _FeNotifications = _interopRequireDefault(require("./FeNotifications"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) {
|
11
|
+
return obj && obj.__esModule ? obj : {
|
12
|
+
default: obj
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
var _default = _FeNotifications.default;
|
17
|
+
exports.default = _default;
|