dibk-design 0.4.27 → 0.4.31
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/components/Accordion.js +77 -39
- package/dist/components/Button.js +75 -31
- package/dist/components/CheckBoxIcon.js +64 -20
- package/dist/components/CheckBoxIcon.md +13 -4
- package/dist/components/CheckBoxIcon.module.scss +7 -0
- package/dist/components/CheckBoxInput.js +63 -22
- package/dist/components/CheckBoxInput.md +14 -8
- package/dist/components/CheckBoxInput.module.scss +4 -1
- package/dist/components/CheckBoxListItem.js +55 -16
- package/dist/components/CheckBoxListItem.md +20 -5
- package/dist/components/CheckBoxListItem.module.scss +8 -2
- package/dist/components/ContentBox.js +67 -30
- package/dist/components/Dialog.js +98 -57
- package/dist/components/DragAndDropFileInput.js +140 -90
- package/dist/components/Footer.js +44 -8
- package/dist/components/Header.js +47 -11
- package/dist/components/InputField.js +144 -92
- package/dist/components/Label.js +53 -11
- package/dist/components/List.js +72 -21
- package/dist/components/LoadingAnimation.js +42 -6
- package/dist/components/NavigationBar.js +179 -126
- package/dist/components/NavigationBarListItem.js +59 -22
- package/dist/components/Paper.js +42 -6
- package/dist/components/RadioButtonIcon.js +63 -19
- package/dist/components/RadioButtonIcon.md +7 -1
- package/dist/components/RadioButtonIcon.module.scss +9 -1
- package/dist/components/RadioButtonInput.js +56 -17
- package/dist/components/RadioButtonInput.md +8 -0
- package/dist/components/RadioButtonInput.module.scss +7 -0
- package/dist/components/RadioButtonListItem.js +52 -13
- package/dist/components/RadioButtonListItem.md +21 -3
- package/dist/components/RadioButtonListItem.module.scss +8 -2
- package/dist/components/Select.js +142 -100
- package/dist/components/Textarea.js +91 -52
- package/dist/components/Theme.js +98 -55
- package/dist/components/WizardNavigation/Step.js +72 -35
- package/dist/components/WizardNavigation.js +59 -25
- package/dist/functions/theme.js +10 -10
- package/dist/index.js +24 -24
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -9,32 +11,68 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
11
|
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
13
|
|
|
12
|
-
var _CheckBoxListItemModule = _interopRequireDefault(require("./CheckBoxListItem.module.scss"));
|
|
13
|
-
|
|
14
14
|
var _CheckBoxInput = _interopRequireDefault(require("./CheckBoxInput"));
|
|
15
15
|
|
|
16
|
+
var _CheckBoxListItemModule = _interopRequireDefault(require("./CheckBoxListItem.module.scss"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
|
-
class
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
|
|
26
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
+
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
+
|
|
32
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
33
|
+
|
|
34
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
+
|
|
36
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
+
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
|
|
40
|
+
var CheckBoxListItem = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
_inherits(CheckBoxListItem, _React$Component);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(CheckBoxListItem);
|
|
44
|
+
|
|
45
|
+
function CheckBoxListItem() {
|
|
46
|
+
_classCallCheck(this, CheckBoxListItem);
|
|
47
|
+
|
|
48
|
+
return _super.apply(this, arguments);
|
|
31
49
|
}
|
|
32
50
|
|
|
33
|
-
|
|
51
|
+
_createClass(CheckBoxListItem, [{
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: "".concat(_CheckBoxListItemModule.default.checkBoxListItem, " ").concat(this.props.checked ? _CheckBoxListItemModule.default.checked : '', " ").concat(this.props.disabled ? _CheckBoxListItemModule.default.disabled : '', " ").concat(this.props.contentOnly ? _CheckBoxListItemModule.default.contentOnly : '', " ").concat(this.props.compact ? _CheckBoxListItemModule.default.compact : '', " ").concat(this.props.hasErrors ? _CheckBoxListItemModule.default.hasErrors : '')
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_CheckBoxInput.default, {
|
|
57
|
+
onChange: this.props.onChange,
|
|
58
|
+
checked: this.props.checked,
|
|
59
|
+
disabled: this.props.disabled,
|
|
60
|
+
contentOnly: this.props.contentOnly,
|
|
61
|
+
hasErrors: this.props.hasErrors,
|
|
62
|
+
id: this.props.id,
|
|
63
|
+
theme: this.props.theme,
|
|
64
|
+
checkmarkCharacter: this.props.checkmarkCharacter
|
|
65
|
+
}, this.props.children));
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
|
|
69
|
+
return CheckBoxListItem;
|
|
70
|
+
}(_react.default.Component);
|
|
34
71
|
|
|
35
72
|
CheckBoxListItem.propTypes = {
|
|
36
73
|
/** Text content inside list item */
|
|
37
74
|
checked: _propTypes.default.bool,
|
|
75
|
+
disabled: _propTypes.default.bool,
|
|
38
76
|
id: _propTypes.default.string.isRequired,
|
|
39
77
|
name: _propTypes.default.string,
|
|
40
78
|
onChange: _propTypes.default.func.isRequired,
|
|
@@ -46,6 +84,7 @@ CheckBoxListItem.propTypes = {
|
|
|
46
84
|
};
|
|
47
85
|
CheckBoxListItem.defaultProps = {
|
|
48
86
|
checked: false,
|
|
87
|
+
disabled: false,
|
|
49
88
|
id: '',
|
|
50
89
|
name: '',
|
|
51
90
|
contentOnly: false,
|
|
@@ -16,6 +16,15 @@ Check box list item example:
|
|
|
16
16
|
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="checkboxListItem-5" checkmarkCharacter="✕">
|
|
17
17
|
Label for checked checkbox with custom checkmark
|
|
18
18
|
</CheckBoxListItem>
|
|
19
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="checkboxListItem-6" disabled={true}>
|
|
20
|
+
Label for disabled checked checkbox
|
|
21
|
+
</CheckBoxListItem>
|
|
22
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="checkboxListItem-7" disabled={true}>
|
|
23
|
+
Label for disabled unchecked checkbox
|
|
24
|
+
</CheckBoxListItem>
|
|
25
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="checkboxListItem-8" checkmarkCharacter="✕" disabled={true}>
|
|
26
|
+
Label for disabled checked checkbox with custom checkmark
|
|
27
|
+
</CheckBoxListItem>
|
|
19
28
|
```
|
|
20
29
|
|
|
21
30
|
Compact check box list item example:
|
|
@@ -33,15 +42,21 @@ Compact check box list item example:
|
|
|
33
42
|
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="compact-checkboxListItem-4" contentOnly={true} compact>
|
|
34
43
|
Label for unchecked checkbox with content only
|
|
35
44
|
</CheckBoxListItem>
|
|
36
|
-
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-
|
|
37
|
-
Label for checked checkbox with
|
|
45
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-5" compact hasErrors>
|
|
46
|
+
Label for checked checkbox with error
|
|
38
47
|
</CheckBoxListItem>
|
|
39
|
-
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="compact-checkboxListItem-
|
|
40
|
-
Label for unchecked checkbox with
|
|
48
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="compact-checkboxListItem-6" compact hasErrors>
|
|
49
|
+
Label for unchecked checkbox with error
|
|
41
50
|
</CheckBoxListItem>
|
|
42
|
-
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-
|
|
51
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-7" compact checkmarkCharacter="✕">
|
|
43
52
|
Label for checked checkbox with custom checkmark
|
|
44
53
|
</CheckBoxListItem>
|
|
54
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-8" compact disabled={true}>
|
|
55
|
+
Label for disabled checked checkbox
|
|
56
|
+
</CheckBoxListItem>
|
|
57
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="compact-checkboxListItem-9" compact hasErrors disabled={true}>
|
|
58
|
+
Label for disabled checked checkbox with error
|
|
59
|
+
</CheckBoxListItem>
|
|
45
60
|
```
|
|
46
61
|
|
|
47
62
|
Themed Check box list item example:
|
|
@@ -32,11 +32,17 @@
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
&:local(.
|
|
35
|
+
&:local(.disabled) {
|
|
36
|
+
label {
|
|
37
|
+
cursor: auto;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:local(.checked):not(:local(.contentOnly)):not(:local(.compact)):not(:local(.disabled)) {
|
|
36
42
|
@include box-shadow(0 0 0 1px $color-dark-blue, 0 0 4px 0 $color-dark-blue);
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
&:not(:local(.checked)):not(:local(.contentOnly)):not(:local(.compact)):hover {
|
|
45
|
+
&:not(:local(.checked)):not(:local(.contentOnly)):not(:local(.compact)):not(:local(.disabled)):hover {
|
|
40
46
|
@include box-shadow(0 0 6px $color-dark-blue);
|
|
41
47
|
}
|
|
42
48
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -13,41 +15,76 @@ var _ContentBoxModule = _interopRequireDefault(require("./ContentBox.module.scss
|
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
|
-
class
|
|
17
|
-
renderTitle() {
|
|
18
|
-
let className = _ContentBoxModule.default.title + " " + _ContentBoxModule.default[this.props.titleSize];
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
+
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
|
+
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
+
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
+
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
|
+
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
31
|
+
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
36
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
|
+
|
|
38
|
+
var ContentBox = /*#__PURE__*/function (_React$Component) {
|
|
39
|
+
_inherits(ContentBox, _React$Component);
|
|
40
|
+
|
|
41
|
+
var _super = _createSuper(ContentBox);
|
|
42
|
+
|
|
43
|
+
function ContentBox() {
|
|
44
|
+
_classCallCheck(this, ContentBox);
|
|
45
|
+
|
|
46
|
+
return _super.apply(this, arguments);
|
|
27
47
|
}
|
|
28
48
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
-
className: className
|
|
44
|
-
}, this.renderTitle(), /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className: _ContentBoxModule.default.content
|
|
46
|
-
}, this.props.content));
|
|
49
|
+
_createClass(ContentBox, [{
|
|
50
|
+
key: "renderTitle",
|
|
51
|
+
value: function renderTitle() {
|
|
52
|
+
var className = _ContentBoxModule.default.title + " " + _ContentBoxModule.default[this.props.titleSize];
|
|
53
|
+
|
|
54
|
+
if (this.props.title) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement("h2", {
|
|
56
|
+
className: className
|
|
57
|
+
}, this.props.title);
|
|
58
|
+
} else {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
|
-
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "render",
|
|
64
|
+
value: function render() {
|
|
65
|
+
var colorClass = " " + _ContentBoxModule.default[this.props.color];
|
|
66
|
+
var linkClass = this.props.href ? " " + _ContentBoxModule.default.link : "";
|
|
67
|
+
var className = _ContentBoxModule.default.contentBox + colorClass + linkClass;
|
|
68
|
+
|
|
69
|
+
if (this.props.href) {
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
71
|
+
href: this.props.href,
|
|
72
|
+
className: className
|
|
73
|
+
}, this.renderTitle(), /*#__PURE__*/_react.default.createElement("div", {
|
|
74
|
+
className: _ContentBoxModule.default.content
|
|
75
|
+
}, this.props.content));
|
|
76
|
+
} else {
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: className
|
|
79
|
+
}, this.renderTitle(), /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
+
className: _ContentBoxModule.default.content
|
|
81
|
+
}, this.props.content));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}]);
|
|
49
85
|
|
|
50
|
-
|
|
86
|
+
return ContentBox;
|
|
87
|
+
}(_react.default.Component);
|
|
51
88
|
|
|
52
89
|
ContentBox.propTypes = {
|
|
53
90
|
/** Content title inside box */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -13,74 +15,113 @@ var _DialogModule = _interopRequireDefault(require("./Dialog.module.scss"));
|
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
|
-
class
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.state = {};
|
|
20
|
-
this.setWrapperRef = this.setWrapperRef.bind(this);
|
|
21
|
-
this.setHiddenInputWrapperRef = this.setHiddenInputWrapperRef.bind(this);
|
|
22
|
-
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
23
|
-
this.keyDownFunction = this.keyDownFunction.bind(this);
|
|
24
|
-
}
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
document.addEventListener('mousedown', this.handleClickOutside);
|
|
28
|
-
document.addEventListener("keydown", this.keyDownFunction, false);
|
|
29
|
-
this.hiddenInputWrapperRef.tabIndex = -1;
|
|
30
|
-
}
|
|
20
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
34
|
-
document.removeEventListener("keydown", this.keyDownFunction, false);
|
|
35
|
-
}
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
36
23
|
|
|
37
|
-
|
|
38
|
-
switch (event.keyCode) {
|
|
39
|
-
case 27:
|
|
40
|
-
// Escape
|
|
41
|
-
if (this.props.onClickOutside) this.props.onClickOutside();
|
|
42
|
-
break;
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
25
|
|
|
44
|
-
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
48
27
|
|
|
49
|
-
|
|
50
|
-
this.wrapperRef = node;
|
|
51
|
-
}
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
52
29
|
|
|
53
|
-
|
|
54
|
-
this.hiddenInputWrapperRef = node;
|
|
55
|
-
}
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
56
31
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
36
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
|
+
|
|
38
|
+
var Dialog = /*#__PURE__*/function (_React$Component) {
|
|
39
|
+
_inherits(Dialog, _React$Component);
|
|
40
|
+
|
|
41
|
+
var _super = _createSuper(Dialog);
|
|
42
|
+
|
|
43
|
+
function Dialog(props) {
|
|
44
|
+
var _this;
|
|
45
|
+
|
|
46
|
+
_classCallCheck(this, Dialog);
|
|
47
|
+
|
|
48
|
+
_this = _super.call(this, props);
|
|
49
|
+
_this.state = {};
|
|
50
|
+
_this.setWrapperRef = _this.setWrapperRef.bind(_assertThisInitialized(_this));
|
|
51
|
+
_this.setHiddenInputWrapperRef = _this.setHiddenInputWrapperRef.bind(_assertThisInitialized(_this));
|
|
52
|
+
_this.handleClickOutside = _this.handleClickOutside.bind(_assertThisInitialized(_this));
|
|
53
|
+
_this.keyDownFunction = _this.keyDownFunction.bind(_assertThisInitialized(_this));
|
|
54
|
+
return _this;
|
|
61
55
|
}
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
_createClass(Dialog, [{
|
|
58
|
+
key: "componentDidMount",
|
|
59
|
+
value: function componentDidMount() {
|
|
60
|
+
document.addEventListener('mousedown', this.handleClickOutside);
|
|
61
|
+
document.addEventListener("keydown", this.keyDownFunction, false);
|
|
62
|
+
this.hiddenInputWrapperRef.tabIndex = -1;
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
key: "componentWillUnmount",
|
|
66
|
+
value: function componentWillUnmount() {
|
|
67
|
+
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
68
|
+
document.removeEventListener("keydown", this.keyDownFunction, false);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "keyDownFunction",
|
|
72
|
+
value: function keyDownFunction(event) {
|
|
73
|
+
switch (event.keyCode) {
|
|
74
|
+
case 27:
|
|
75
|
+
// Escape
|
|
76
|
+
if (this.props.onClickOutside) this.props.onClickOutside();
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
default:
|
|
80
|
+
return null;
|
|
71
81
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "setWrapperRef",
|
|
85
|
+
value: function setWrapperRef(node) {
|
|
86
|
+
this.wrapperRef = node;
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "setHiddenInputWrapperRef",
|
|
90
|
+
value: function setHiddenInputWrapperRef(node) {
|
|
91
|
+
this.hiddenInputWrapperRef = node;
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "handleClickOutside",
|
|
95
|
+
value: function handleClickOutside(event) {
|
|
96
|
+
if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {
|
|
97
|
+
this.props.onClickOutside();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "render",
|
|
102
|
+
value: function render() {
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
className: _DialogModule.default.dialogOverlay
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
ref: this.setWrapperRef,
|
|
107
|
+
className: "".concat(_DialogModule.default.dialogContent, " ").concat(this.props.noPadding ? _DialogModule.default.noPadding : ''),
|
|
108
|
+
style: {
|
|
109
|
+
maxWidth: this.props.maxWidth
|
|
110
|
+
}
|
|
111
|
+
}, this.props.closeButton ? /*#__PURE__*/_react.default.createElement("button", {
|
|
112
|
+
onClick: this.props.onClickOutside,
|
|
113
|
+
className: _DialogModule.default.closeButton
|
|
114
|
+
}) : '', /*#__PURE__*/_react.default.createElement("input", {
|
|
115
|
+
type: "button",
|
|
116
|
+
ref: this.setHiddenInputWrapperRef,
|
|
117
|
+
className: _DialogModule.default.hidden,
|
|
118
|
+
autoFocus: true
|
|
119
|
+
}), this.props.children));
|
|
120
|
+
}
|
|
121
|
+
}]);
|
|
82
122
|
|
|
83
|
-
|
|
123
|
+
return Dialog;
|
|
124
|
+
}(_react.default.Component);
|
|
84
125
|
|
|
85
126
|
;
|
|
86
127
|
Dialog.propTypes = {
|