dibk-design 0.4.28 → 0.4.32
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 +142 -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
|
});
|
|
@@ -15,28 +17,64 @@ var _RadioButtonInputModule = _interopRequireDefault(require("./RadioButtonInput
|
|
|
15
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 RadioButtonInput = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
_inherits(RadioButtonInput, _React$Component);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(RadioButtonInput);
|
|
44
|
+
|
|
45
|
+
function RadioButtonInput() {
|
|
46
|
+
_classCallCheck(this, RadioButtonInput);
|
|
47
|
+
|
|
48
|
+
return _super.apply(this, arguments);
|
|
34
49
|
}
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
_createClass(RadioButtonInput, [{
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement("label", {
|
|
55
|
+
htmlFor: this.props.id,
|
|
56
|
+
className: "".concat(_RadioButtonInputModule.default.radioButtonInput, " ").concat(this.props.checked ? _RadioButtonInputModule.default.checked : '', " ").concat(this.props.disabled ? _RadioButtonInputModule.default.disabled : '')
|
|
57
|
+
}, !this.props.contentOnly ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_RadioButtonIcon.default, {
|
|
58
|
+
checked: this.props.checked,
|
|
59
|
+
disabled: this.props.disabled,
|
|
60
|
+
theme: this.props.theme
|
|
61
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
62
|
+
type: "radio",
|
|
63
|
+
onChange: this.props.onChange,
|
|
64
|
+
id: this.props.id,
|
|
65
|
+
name: this.props.name,
|
|
66
|
+
value: this.props.inputValue,
|
|
67
|
+
checked: this.props.checked
|
|
68
|
+
})) : '', /*#__PURE__*/_react.default.createElement("span", null, this.props.children));
|
|
69
|
+
}
|
|
70
|
+
}]);
|
|
71
|
+
|
|
72
|
+
return RadioButtonInput;
|
|
73
|
+
}(_react.default.Component);
|
|
37
74
|
|
|
38
75
|
RadioButtonInput.propTypes = {
|
|
39
76
|
checked: _propTypes.default.bool,
|
|
77
|
+
disabled: _propTypes.default.bool,
|
|
40
78
|
inputValue: _propTypes.default.string.isRequired,
|
|
41
79
|
name: _propTypes.default.string,
|
|
42
80
|
id: _propTypes.default.string.isRequired,
|
|
@@ -47,6 +85,7 @@ RadioButtonInput.propTypes = {
|
|
|
47
85
|
RadioButtonInput.defaultProps = {
|
|
48
86
|
name: '',
|
|
49
87
|
checked: false,
|
|
88
|
+
disabled: false,
|
|
50
89
|
contentOnly: false
|
|
51
90
|
};
|
|
52
91
|
var _default = RadioButtonInput;
|
|
@@ -4,6 +4,8 @@ Radio button input example:
|
|
|
4
4
|
<div className="flex">
|
|
5
5
|
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 1" name="radio-button-input" id="radio-button-input-1" checked={true}><span>Checked radio button</span></RadioButtonInput>
|
|
6
6
|
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 2" name="radio-button-input" id="radio-button-input-2"><span>Unchecked radio button</span></RadioButtonInput>
|
|
7
|
+
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 1" name="radio-button-input" id="radio-button-input-3" checked={true} disabled={true}><span>Checked disabled radio button</span></RadioButtonInput>
|
|
8
|
+
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 2" name="radio-button-input" id="radio-button-input-4" disabled={true}><span>Unchecked disabled radio button</span></RadioButtonInput>
|
|
7
9
|
</div>
|
|
8
10
|
```
|
|
9
11
|
|
|
@@ -18,5 +20,11 @@ import customTheme from 'data/customTheme';
|
|
|
18
20
|
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 2" name="themed-radio-button-input" id="themed-radio-button-input-2" theme={customTheme}>
|
|
19
21
|
<span>Unchecked radio button</span>
|
|
20
22
|
</RadioButtonInput>
|
|
23
|
+
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 1" name="themed-radio-button-input" id="themed-radio-button-input-3" checked={true} theme={customTheme} disabled={true}>
|
|
24
|
+
<span>Checked disabled radio button</span>
|
|
25
|
+
</RadioButtonInput>
|
|
26
|
+
<RadioButtonInput onChange={()=>{console.log('onchange')}} inputValue="value 2" name="themed-radio-button-input" id="themed-radio-button-input-4" theme={customTheme} disabled={true}>
|
|
27
|
+
<span>Unchecked disabled radio button</span>
|
|
28
|
+
</RadioButtonInput>
|
|
21
29
|
</div>
|
|
22
30
|
```
|
|
@@ -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
|
});
|
|
@@ -15,26 +17,62 @@ var _RadioButtonListItemModule = _interopRequireDefault(require("./RadioButtonLi
|
|
|
15
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
|
-
|
|
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 RadioButtonListItem = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
_inherits(RadioButtonListItem, _React$Component);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(RadioButtonListItem);
|
|
44
|
+
|
|
45
|
+
function RadioButtonListItem() {
|
|
46
|
+
_classCallCheck(this, RadioButtonListItem);
|
|
47
|
+
|
|
48
|
+
return _super.apply(this, arguments);
|
|
30
49
|
}
|
|
31
50
|
|
|
32
|
-
|
|
51
|
+
_createClass(RadioButtonListItem, [{
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: "".concat(_RadioButtonListItemModule.default.radioButtonListItem, " ").concat(this.props.disabled ? _RadioButtonListItemModule.default.disabled : '', " ").concat(this.props.compact ? _RadioButtonListItemModule.default.compact : '', " ").concat(this.props.contentOnly ? _RadioButtonListItemModule.default.contentOnly : '')
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_RadioButtonInput.default, {
|
|
57
|
+
onChange: this.props.onChange,
|
|
58
|
+
inputValue: this.props.inputValue,
|
|
59
|
+
checked: this.props.checked,
|
|
60
|
+
disabled: this.props.disabled,
|
|
61
|
+
contentOnly: this.props.contentOnly,
|
|
62
|
+
id: this.props.id,
|
|
63
|
+
theme: this.props.theme
|
|
64
|
+
}, this.props.children));
|
|
65
|
+
}
|
|
66
|
+
}]);
|
|
67
|
+
|
|
68
|
+
return RadioButtonListItem;
|
|
69
|
+
}(_react.default.Component);
|
|
33
70
|
|
|
34
71
|
RadioButtonListItem.propTypes = {
|
|
35
72
|
/** Text content inside list item */
|
|
36
73
|
inputValue: _propTypes.default.string.isRequired,
|
|
37
74
|
checked: _propTypes.default.bool,
|
|
75
|
+
disabled: _propTypes.default.bool,
|
|
38
76
|
name: _propTypes.default.string,
|
|
39
77
|
id: _propTypes.default.string.isRequired,
|
|
40
78
|
onChange: _propTypes.default.func,
|
|
@@ -44,6 +82,7 @@ RadioButtonListItem.propTypes = {
|
|
|
44
82
|
RadioButtonListItem.defaultProps = {
|
|
45
83
|
name: '',
|
|
46
84
|
checked: false,
|
|
85
|
+
disabled: false,
|
|
47
86
|
contentOnly: false
|
|
48
87
|
};
|
|
49
88
|
var _default = RadioButtonListItem;
|
|
@@ -5,7 +5,13 @@ Radio button list item example:
|
|
|
5
5
|
Checked radio button
|
|
6
6
|
</RadioButtonListItem>
|
|
7
7
|
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="radio-button-list-item" id="radio-button-list-item-2">
|
|
8
|
-
|
|
8
|
+
Unchecked radio button
|
|
9
|
+
</RadioButtonListItem>
|
|
10
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 1" name="radio-button-list-item" id="radio-button-list-item-3" checked={true} disabled={true}>
|
|
11
|
+
Disabled checked radio button
|
|
12
|
+
</RadioButtonListItem>
|
|
13
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="radio-button-list-item" id="radio-button-list-item-4" disabled={true}>
|
|
14
|
+
Disabled Unchecked radio button
|
|
9
15
|
</RadioButtonListItem>
|
|
10
16
|
```
|
|
11
17
|
|
|
@@ -16,7 +22,13 @@ Compact radio button list item example:
|
|
|
16
22
|
Checked radio button
|
|
17
23
|
</RadioButtonListItem>
|
|
18
24
|
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="compact-radio-button-list-item" id="compact-radio-button-list-item-2" compact>
|
|
19
|
-
|
|
25
|
+
Unchecked radio button
|
|
26
|
+
</RadioButtonListItem>
|
|
27
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 1" name="compact-radio-button-list-item" id="compact-radio-button-list-item-3" checked={true} compact disabled={true}>
|
|
28
|
+
Disabled checked radio button
|
|
29
|
+
</RadioButtonListItem>
|
|
30
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="compact-radio-button-list-item" id="compact-radio-button-list-item-4" compact disabled={true}>
|
|
31
|
+
Disabled unchecked radio button
|
|
20
32
|
</RadioButtonListItem>
|
|
21
33
|
```
|
|
22
34
|
|
|
@@ -29,7 +41,13 @@ import customTheme from 'data/customTheme';
|
|
|
29
41
|
Checked radio button
|
|
30
42
|
</RadioButtonListItem>
|
|
31
43
|
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="themed-radio-button-list-item" id="themed-radio-button-list-item-2" theme={customTheme}>
|
|
32
|
-
|
|
44
|
+
Unchecked radio button
|
|
45
|
+
</RadioButtonListItem>
|
|
46
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 1" name="themed-radio-button-list-item-" id="themed-radio-button-list-item-3" checked={true} theme={customTheme} disabled={true}>
|
|
47
|
+
Disabled checked radio button
|
|
48
|
+
</RadioButtonListItem>
|
|
49
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="themed-radio-button-list-item" id="themed-radio-button-list-item-4" theme={customTheme} disabled={true}>
|
|
50
|
+
Disabled unchecked radio button
|
|
33
51
|
</RadioButtonListItem>
|
|
34
52
|
</React.Fragment>
|
|
35
53
|
```
|
|
@@ -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
|
|
|
@@ -17,121 +17,163 @@ var _SelectModule = _interopRequireDefault(require("./Select.module.scss"));
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
getThemeErrorInputStyle(theme) {
|
|
22
|
-
return {
|
|
23
|
-
boxShadow: "0 0 3px ".concat((0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')),
|
|
24
|
-
borderColor: (0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')
|
|
25
|
-
};
|
|
26
|
-
}
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
color: (0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')
|
|
31
|
-
};
|
|
32
|
-
}
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
borderTopColor: (0, _theme.getThemePaletteBackgroundColor)(theme, 'primary')
|
|
37
|
-
};
|
|
38
|
-
}
|
|
24
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
29
|
+
|
|
30
|
+
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
|
+
|
|
32
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
33
|
+
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
+
|
|
38
|
+
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); }; }
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
+
|
|
44
|
+
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; } }
|
|
45
|
+
|
|
46
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
+
|
|
48
|
+
var Select = /*#__PURE__*/function (_React$Component) {
|
|
49
|
+
_inherits(Select, _React$Component);
|
|
50
|
+
|
|
51
|
+
var _super = _createSuper(Select);
|
|
52
|
+
|
|
53
|
+
function Select() {
|
|
54
|
+
_classCallCheck(this, Select);
|
|
55
|
+
|
|
56
|
+
return _super.apply(this, arguments);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
_createClass(Select, [{
|
|
60
|
+
key: "getThemeErrorInputStyle",
|
|
61
|
+
value: function getThemeErrorInputStyle(theme) {
|
|
62
|
+
return {
|
|
63
|
+
boxShadow: "0 0 3px ".concat((0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')),
|
|
64
|
+
borderColor: (0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "getThemeErrorMessageStyle",
|
|
69
|
+
value: function getThemeErrorMessageStyle(theme) {
|
|
70
|
+
return {
|
|
71
|
+
color: (0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "getThemeArrowStyle",
|
|
76
|
+
value: function getThemeArrowStyle(theme) {
|
|
77
|
+
return {
|
|
78
|
+
borderTopColor: (0, _theme.getThemePaletteBackgroundColor)(theme, 'primary')
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "getKeyByValue",
|
|
83
|
+
value: function getKeyByValue(value, options) {
|
|
84
|
+
var selectedOption = options && options.length ? options.find(function (option) {
|
|
85
|
+
if (_typeof(option) === 'object') {
|
|
86
|
+
return option.value === value;
|
|
87
|
+
} else {
|
|
88
|
+
return option === value;
|
|
89
|
+
}
|
|
90
|
+
}) : null;
|
|
61
91
|
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
92
|
+
if (selectedOption && selectedOption.key) {
|
|
93
|
+
return selectedOption.key;
|
|
94
|
+
} else if (selectedOption && selectedOption.value) {
|
|
95
|
+
return selectedOption.value;
|
|
67
96
|
} else {
|
|
68
|
-
|
|
69
|
-
key: option,
|
|
70
|
-
value: option
|
|
71
|
-
};
|
|
97
|
+
return selectedOption;
|
|
72
98
|
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "renderOptionElements",
|
|
102
|
+
value: function renderOptionElements(options) {
|
|
103
|
+
return options.map(function (option, key) {
|
|
104
|
+
var optionObject = null;
|
|
105
|
+
|
|
106
|
+
if (_typeof(option) === 'object') {
|
|
107
|
+
optionObject = {
|
|
108
|
+
key: option.key ? option.key : '',
|
|
109
|
+
value: option.value ? option.value : ''
|
|
110
|
+
};
|
|
111
|
+
} else {
|
|
112
|
+
optionObject = {
|
|
113
|
+
key: option,
|
|
114
|
+
value: option
|
|
115
|
+
};
|
|
116
|
+
}
|
|
73
117
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement("option", {
|
|
119
|
+
value: optionObject.value,
|
|
120
|
+
key: key
|
|
121
|
+
}, optionObject.key);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "renderPlaceholderOption",
|
|
126
|
+
value: function renderPlaceholderOption(placeholder, placeholderValue) {
|
|
127
|
+
return placeholder ? /*#__PURE__*/_react.default.createElement("option", {
|
|
128
|
+
value: placeholderValue,
|
|
129
|
+
disabled: true
|
|
130
|
+
}, placeholder) : '';
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "render",
|
|
134
|
+
value: function render() {
|
|
135
|
+
if (this.props.contentOnly) {
|
|
136
|
+
var value = this.props.defaultValue ? this.props.defaultValue : this.props.value || null;
|
|
137
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
138
|
+
className: _SelectModule.default.select
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
140
|
+
htmlFor: this.props.id
|
|
141
|
+
}, this.props.label), /*#__PURE__*/_react.default.createElement("span", null, value ? this.props.keyAsContent ? this.getKeyByValue(value, this.props.options) : value : this.props.defaultContent));
|
|
142
|
+
} else {
|
|
143
|
+
var _this$props$width, _props, _this$props$width2;
|
|
80
144
|
|
|
81
|
-
|
|
82
|
-
return placeholder ? /*#__PURE__*/_react.default.createElement("option", {
|
|
83
|
-
value: placeholderValue,
|
|
84
|
-
disabled: true
|
|
85
|
-
}, placeholder) : '';
|
|
86
|
-
}
|
|
145
|
+
var defaultValue = !this.props.value && this.props.defaultValue ? this.props.defaultValue : false;
|
|
87
146
|
|
|
88
|
-
|
|
89
|
-
if (this.props.contentOnly) {
|
|
90
|
-
const value = this.props.defaultValue ? this.props.defaultValue : this.props.value || null;
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
-
className: _SelectModule.default.select
|
|
93
|
-
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
94
|
-
htmlFor: this.props.id
|
|
95
|
-
}, this.props.label), /*#__PURE__*/_react.default.createElement("span", null, value ? this.props.keyAsContent ? this.getKeyByValue(value, this.props.options) : value : this.props.defaultContent));
|
|
96
|
-
} else {
|
|
97
|
-
var _this$props$width, _this$props$width2;
|
|
98
|
-
|
|
99
|
-
const defaultValue = !this.props.value && this.props.defaultValue ? this.props.defaultValue : false;
|
|
100
|
-
const styleRules = { ...(this.props.hasErrors ? this.getThemeErrorInputStyle(this.props.theme) : null),
|
|
101
|
-
...(((_this$props$width = this.props.width) === null || _this$props$width === void 0 ? void 0 : _this$props$width.length) && {
|
|
147
|
+
var styleRules = _objectSpread(_objectSpread({}, this.props.hasErrors ? this.getThemeErrorInputStyle(this.props.theme) : null), ((_this$props$width = this.props.width) === null || _this$props$width === void 0 ? void 0 : _this$props$width.length) && {
|
|
102
148
|
maxWidth: this.props.width
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
117
|
-
htmlFor: this.props.id
|
|
118
|
-
}, this.props.label), /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
-
className: _SelectModule.default.selectContainer,
|
|
120
|
-
style: { ...(((_this$props$width2 = this.props.width) === null || _this$props$width2 === void 0 ? void 0 : _this$props$width2.length) && {
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
var props = (_props = {
|
|
152
|
+
name: this.props.name,
|
|
153
|
+
multiple: this.props.multiple
|
|
154
|
+
}, _defineProperty(_props, defaultValue ? 'defaultValue' : 'value', defaultValue || this.props.value), _defineProperty(_props, "onChange", this.props.onChange), _defineProperty(_props, "id", this.props.id), _defineProperty(_props, "className", this.props.hasErrors ? _SelectModule.default.hasErrors : ''), _defineProperty(_props, "style", styleRules), _props);
|
|
155
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
156
|
+
className: _SelectModule.default.select
|
|
157
|
+
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
158
|
+
htmlFor: this.props.id
|
|
159
|
+
}, this.props.label), /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
className: _SelectModule.default.selectContainer,
|
|
161
|
+
style: _objectSpread({}, ((_this$props$width2 = this.props.width) === null || _this$props$width2 === void 0 ? void 0 : _this$props$width2.length) && {
|
|
121
162
|
maxWidth: this.props.width
|
|
122
163
|
})
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
164
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
165
|
+
className: _SelectModule.default.selectListArrow,
|
|
166
|
+
style: this.getThemeArrowStyle(this.props.theme)
|
|
167
|
+
}), /*#__PURE__*/_react.default.createElement("select", props, this.renderPlaceholderOption(this.props.placeholder, this.props.placeholderValue), this.renderOptionElements(this.props.options))), /*#__PURE__*/_react.default.createElement("span", {
|
|
168
|
+
className: _SelectModule.default.errorMessage,
|
|
169
|
+
style: this.getThemeErrorMessageStyle(this.props.theme)
|
|
170
|
+
}, this.props.errorMessage ? this.props.errorMessage : ''));
|
|
171
|
+
}
|
|
131
172
|
}
|
|
132
|
-
}
|
|
173
|
+
}]);
|
|
133
174
|
|
|
134
|
-
|
|
175
|
+
return Select;
|
|
176
|
+
}(_react.default.Component);
|
|
135
177
|
|
|
136
178
|
Select.propTypes = {
|
|
137
179
|
id: _propTypes.default.string.isRequired,
|
|
@@ -166,7 +208,7 @@ Select.defaultProps = {
|
|
|
166
208
|
defaultContent: null,
|
|
167
209
|
hasErrors: false,
|
|
168
210
|
errorMessage: '',
|
|
169
|
-
onChange: ()
|
|
211
|
+
onChange: function onChange() {
|
|
170
212
|
return false;
|
|
171
213
|
}
|
|
172
214
|
};
|