dibk-design 0.4.23 → 0.4.27
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 +39 -77
- package/dist/components/Button.js +31 -75
- package/dist/components/Button.module.scss +25 -2
- package/dist/components/CheckBoxIcon.js +24 -64
- package/dist/components/CheckBoxIcon.md +6 -0
- package/dist/components/CheckBoxInput.js +26 -59
- package/dist/components/CheckBoxInput.md +6 -0
- package/dist/components/CheckBoxListItem.js +18 -51
- package/dist/components/CheckBoxListItem.md +9 -0
- package/dist/components/ContentBox.js +30 -67
- package/dist/components/Dialog.js +57 -98
- package/dist/components/DragAndDropFileInput.js +91 -132
- package/dist/components/DragAndDropFileInput.md +7 -1
- package/dist/components/DragAndDropFileInput.module.scss +10 -1
- package/dist/components/Footer.js +8 -44
- package/dist/components/Header.js +11 -47
- package/dist/components/InputField.js +92 -141
- package/dist/components/InputField.module.scss +1 -0
- package/dist/components/Label.js +11 -53
- package/dist/components/List.js +21 -72
- package/dist/components/LoadingAnimation.js +6 -42
- package/dist/components/NavigationBar.js +126 -179
- package/dist/components/NavigationBarListItem.js +22 -59
- package/dist/components/Paper.js +6 -42
- package/dist/components/RadioButtonIcon.js +18 -60
- package/dist/components/RadioButtonInput.js +17 -53
- package/dist/components/RadioButtonListItem.js +13 -49
- package/dist/components/Select.js +100 -142
- package/dist/components/Select.module.scss +1 -0
- package/dist/components/Textarea.js +52 -91
- package/dist/components/Textarea.module.scss +5 -1
- package/dist/components/Theme.js +55 -98
- package/dist/components/WizardNavigation/Step.js +35 -72
- package/dist/components/WizardNavigation.js +25 -59
- package/dist/functions/theme.js +10 -10
- package/dist/index.js +24 -24
- package/package.json +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -15,88 +13,52 @@ var _AccordionModule = _interopRequireDefault(require("./Accordion.module.scss")
|
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 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 Accordion = /*#__PURE__*/function (_React$Component) {
|
|
39
|
-
_inherits(Accordion, _React$Component);
|
|
40
|
-
|
|
41
|
-
var _super = _createSuper(Accordion);
|
|
42
|
-
|
|
43
|
-
function Accordion(props) {
|
|
44
|
-
var _this;
|
|
45
|
-
|
|
46
|
-
_classCallCheck(this, Accordion);
|
|
47
|
-
|
|
48
|
-
_this = _super.call(this, props);
|
|
49
|
-
_this.state = {
|
|
50
|
-
expanded: _this.props.expanded,
|
|
51
|
-
initialized: _this.props.expanded
|
|
16
|
+
class Accordion extends _react.default.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = {
|
|
20
|
+
expanded: this.props.expanded,
|
|
21
|
+
initialized: this.props.expanded
|
|
52
22
|
};
|
|
53
|
-
|
|
54
|
-
|
|
23
|
+
this.handleToggleExpand = this.handleToggleExpand.bind(this);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handleToggleExpand() {
|
|
27
|
+
this.setState({
|
|
28
|
+
expanded: !this.state.expanded,
|
|
29
|
+
initialized: true
|
|
30
|
+
});
|
|
55
31
|
}
|
|
56
32
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
value: function handleToggleExpand() {
|
|
33
|
+
componentDidUpdate(prevProps) {
|
|
34
|
+
if (this.props.expanded !== prevProps.expanded) {
|
|
60
35
|
this.setState({
|
|
61
|
-
expanded:
|
|
62
|
-
initialized: true
|
|
36
|
+
expanded: this.props.expanded
|
|
63
37
|
});
|
|
64
38
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, {
|
|
87
|
-
key: "render",
|
|
88
|
-
value: function render() {
|
|
89
|
-
var className = "".concat(_AccordionModule.default.accordion, " ").concat(this.props.color ? _AccordionModule.default[this.props.color] : '');
|
|
90
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
-
className: className
|
|
92
|
-
}, this.renderPanel(), /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
-
className: "".concat(_AccordionModule.default.content, " ").concat(this.state.initialized ? _AccordionModule.default.initialized : '', " ").concat(this.state.expanded ? _AccordionModule.default.expanded : '')
|
|
94
|
-
}, this.props.children));
|
|
95
|
-
}
|
|
96
|
-
}]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
renderPanel() {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: _AccordionModule.default.panel,
|
|
44
|
+
onClick: this.handleToggleExpand
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
46
|
+
className: _AccordionModule.default.panelText
|
|
47
|
+
}, this.props.title), /*#__PURE__*/_react.default.createElement("span", {
|
|
48
|
+
className: "".concat(_AccordionModule.default.panelChevron, " ").concat(this.state.expanded ? _AccordionModule.default.expanded : '')
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
const className = "".concat(_AccordionModule.default.accordion, " ").concat(this.props.color ? _AccordionModule.default[this.props.color] : '');
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: className
|
|
56
|
+
}, this.renderPanel(), /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
className: "".concat(_AccordionModule.default.content, " ").concat(this.state.initialized ? _AccordionModule.default.initialized : '', " ").concat(this.state.expanded ? _AccordionModule.default.expanded : '')
|
|
58
|
+
}, this.props.children));
|
|
59
|
+
}
|
|
97
60
|
|
|
98
|
-
|
|
99
|
-
}(_react.default.Component);
|
|
61
|
+
}
|
|
100
62
|
|
|
101
63
|
Accordion.propTypes = {
|
|
102
64
|
/** Content title inside box */
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -19,85 +17,43 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
17
|
|
|
20
18
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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); 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"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 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; } }
|
|
20
|
+
class Button extends _react.default.Component {
|
|
21
|
+
getArrowClass() {
|
|
22
|
+
switch (this.props.arrow) {
|
|
23
|
+
case 'left':
|
|
24
|
+
return _ButtonModule.default.hasArrowLeft;
|
|
45
25
|
|
|
46
|
-
|
|
26
|
+
case 'right':
|
|
27
|
+
return _ButtonModule.default.hasArrowRight;
|
|
47
28
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var _super = _createSuper(Button);
|
|
52
|
-
|
|
53
|
-
function Button() {
|
|
54
|
-
_classCallCheck(this, Button);
|
|
55
|
-
|
|
56
|
-
return _super.apply(this, arguments);
|
|
29
|
+
default:
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
57
32
|
}
|
|
58
33
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return _ButtonModule.default.hasArrowRight;
|
|
68
|
-
|
|
69
|
-
default:
|
|
70
|
-
return '';
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "getThemeStyle",
|
|
75
|
-
value: function getThemeStyle(theme, color) {
|
|
76
|
-
return {
|
|
77
|
-
backgroundColor: (0, _theme.getThemePaletteBackgroundColor)(theme, color),
|
|
78
|
-
color: (0, _theme.getThemePaletteTextColor)(theme, color),
|
|
79
|
-
borderColor: (0, _theme.getThemePaletteBorderColor)(theme, color),
|
|
80
|
-
borderWidth: (0, _theme.getThemePaletteBorderColor)(theme, color) ? '1px' : '0'
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "render",
|
|
85
|
-
value: function render() {
|
|
86
|
-
var buttonProps = _objectSpread({}, this.props);
|
|
34
|
+
getThemeStyle(theme, color) {
|
|
35
|
+
return {
|
|
36
|
+
backgroundColor: (0, _theme.getThemePaletteBackgroundColor)(theme, color),
|
|
37
|
+
color: (0, _theme.getThemePaletteTextColor)(theme, color),
|
|
38
|
+
borderColor: (0, _theme.getThemePaletteBorderColor)(theme, color),
|
|
39
|
+
borderWidth: (0, _theme.getThemePaletteBorderColor)(theme, color) ? '1px' : '0'
|
|
40
|
+
};
|
|
41
|
+
}
|
|
87
42
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
43
|
+
render() {
|
|
44
|
+
let buttonProps = { ...this.props
|
|
45
|
+
};
|
|
46
|
+
delete buttonProps.noHover;
|
|
47
|
+
delete buttonProps.rounded;
|
|
48
|
+
const themeStyle = this.props.theme ? this.getThemeStyle(this.props.theme, this.props.color) : null;
|
|
49
|
+
const className = "".concat(_ButtonModule.default.button, " ").concat(_ButtonModule.default[this.props.color], " ").concat(_ButtonModule.default[this.props.size], " ").concat(this.getArrowClass(), " ").concat(this.props.theme ? _ButtonModule.default.hasTheme : '', " ").concat(this.props.noHover ? _ButtonModule.default.noHover : '', " ").concat(this.props.rounded ? _ButtonModule.default.rounded : '');
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement("button", _extends({}, buttonProps, {
|
|
51
|
+
className: className,
|
|
52
|
+
style: themeStyle
|
|
53
|
+
}), this.props.content);
|
|
54
|
+
}
|
|
98
55
|
|
|
99
|
-
|
|
100
|
-
}(_react.default.Component);
|
|
56
|
+
}
|
|
101
57
|
|
|
102
58
|
Button.propTypes = {
|
|
103
59
|
/** Text content inside button */
|
|
@@ -106,8 +106,7 @@
|
|
|
106
106
|
&:disabled {
|
|
107
107
|
&:local(.hasTheme),
|
|
108
108
|
&:not(:local(.hasTheme)) {
|
|
109
|
-
&:local(.default)
|
|
110
|
-
&:local(.primary) {
|
|
109
|
+
&:local(.default) {
|
|
111
110
|
background-color: #fff;
|
|
112
111
|
cursor: default;
|
|
113
112
|
opacity: 0.6;
|
|
@@ -131,6 +130,30 @@
|
|
|
131
130
|
border-color: #afaba8;
|
|
132
131
|
}
|
|
133
132
|
}
|
|
133
|
+
&:local(.primary) {
|
|
134
|
+
background-color: $color-primary;
|
|
135
|
+
cursor: default;
|
|
136
|
+
opacity: 0.6;
|
|
137
|
+
color: #fff;
|
|
138
|
+
border: 1px solid $color-primary;
|
|
139
|
+
&:hover,
|
|
140
|
+
&:focus,
|
|
141
|
+
&:active {
|
|
142
|
+
background-color: $color-primary;
|
|
143
|
+
cursor: default;
|
|
144
|
+
opacity: 0.6;
|
|
145
|
+
color: #fff;
|
|
146
|
+
border: 1px solid $color-primary;
|
|
147
|
+
&:before,
|
|
148
|
+
&:after {
|
|
149
|
+
border-color: $color-primary;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
&:before,
|
|
153
|
+
&:after {
|
|
154
|
+
border-color: $color-primary;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
134
157
|
}
|
|
135
158
|
}
|
|
136
159
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -17,84 +15,46 @@ var _CheckBoxIconModule = _interopRequireDefault(require("./CheckBoxIcon.module.
|
|
|
17
15
|
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
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); } }
|
|
29
|
-
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
31
|
-
|
|
32
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
|
-
|
|
34
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
-
|
|
36
|
-
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); }; }
|
|
37
|
-
|
|
38
|
-
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); }
|
|
39
|
-
|
|
40
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
class CheckBoxIcon extends _react.default.Component {
|
|
19
|
+
render() {
|
|
20
|
+
let inlineStyle = {
|
|
21
|
+
height: this.props.size,
|
|
22
|
+
width: this.props.size,
|
|
23
|
+
fontSize: this.props.size
|
|
24
|
+
};
|
|
41
25
|
|
|
42
|
-
|
|
26
|
+
if (this.props.theme && this.props.checked) {
|
|
27
|
+
inlineStyle = { ...inlineStyle,
|
|
28
|
+
color: (0, _theme.getThemePaletteBackgroundColor)(this.props.theme, 'primary'),
|
|
29
|
+
boxShadow: "0 0 0 1px ".concat((0, _theme.getThemePaletteBackgroundColor)(this.props.theme, 'primary')) // TODO: support theme error color
|
|
43
30
|
|
|
44
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
-
|
|
46
|
-
var CheckBoxIcon = /*#__PURE__*/function (_React$Component) {
|
|
47
|
-
_inherits(CheckBoxIcon, _React$Component);
|
|
48
|
-
|
|
49
|
-
var _super = _createSuper(CheckBoxIcon);
|
|
50
|
-
|
|
51
|
-
function CheckBoxIcon() {
|
|
52
|
-
_classCallCheck(this, CheckBoxIcon);
|
|
53
|
-
|
|
54
|
-
return _super.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
_createClass(CheckBoxIcon, [{
|
|
58
|
-
key: "render",
|
|
59
|
-
value: function render() {
|
|
60
|
-
var inlineStyle = {
|
|
61
|
-
height: this.props.size,
|
|
62
|
-
width: this.props.size,
|
|
63
|
-
fontSize: this.props.size
|
|
64
31
|
};
|
|
65
|
-
|
|
66
|
-
if (this.props.theme && this.props.checked) {
|
|
67
|
-
inlineStyle = _objectSpread(_objectSpread({}, inlineStyle), {}, {
|
|
68
|
-
color: (0, _theme.getThemePaletteBackgroundColor)(this.props.theme, 'primary'),
|
|
69
|
-
boxShadow: "0 0 0 1px ".concat((0, _theme.getThemePaletteBackgroundColor)(this.props.theme, 'primary')) // TODO: support theme error color
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
75
|
-
className: "".concat(_CheckBoxIconModule.default.checkBoxIcon, " ").concat(this.props.checked ? _CheckBoxIconModule.default.checked : '', " ").concat(this.props.showBox ? _CheckBoxIconModule.default.showBox : '', " ").concat(this.props.hasErrors ? _CheckBoxIconModule.default.hasErrors : ''),
|
|
76
|
-
style: inlineStyle
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
78
|
-
className: _CheckBoxIconModule.default.checkmark
|
|
79
|
-
}, this.props.checked ? '✔' : ''));
|
|
80
32
|
}
|
|
81
|
-
}]);
|
|
82
33
|
|
|
83
|
-
|
|
84
|
-
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
35
|
+
className: "".concat(_CheckBoxIconModule.default.checkBoxIcon, " ").concat(this.props.checked ? _CheckBoxIconModule.default.checked : '', " ").concat(this.props.showBox ? _CheckBoxIconModule.default.showBox : '', " ").concat(this.props.hasErrors ? _CheckBoxIconModule.default.hasErrors : ''),
|
|
36
|
+
style: inlineStyle
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
38
|
+
className: _CheckBoxIconModule.default.checkmark
|
|
39
|
+
}, this.props.checked ? this.props.checkmarkCharacter : ''));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
85
43
|
|
|
86
44
|
CheckBoxIcon.propTypes = {
|
|
87
45
|
size: _propTypes.default.string,
|
|
88
46
|
checked: _propTypes.default.bool,
|
|
89
47
|
showBox: _propTypes.default.bool,
|
|
90
48
|
theme: _propTypes.default.object,
|
|
91
|
-
hasErrors: _propTypes.default.bool
|
|
49
|
+
hasErrors: _propTypes.default.bool,
|
|
50
|
+
checkmarkCharacter: _propTypes.default.string
|
|
92
51
|
};
|
|
93
52
|
CheckBoxIcon.defaultProps = {
|
|
94
53
|
size: '20px',
|
|
95
54
|
checked: false,
|
|
96
55
|
showBox: true,
|
|
97
|
-
hasErrors: false
|
|
56
|
+
hasErrors: false,
|
|
57
|
+
checkmarkCharacter: '✔'
|
|
98
58
|
};
|
|
99
59
|
var _default = CheckBoxIcon;
|
|
100
60
|
exports.default = _default;
|
|
@@ -3,6 +3,7 @@ Regular check box icons example:
|
|
|
3
3
|
```js
|
|
4
4
|
<CheckBoxIcon />
|
|
5
5
|
<CheckBoxIcon checked={true} />
|
|
6
|
+
<CheckBoxIcon checked={true} checkmarkCharacter="✕" />
|
|
6
7
|
```
|
|
7
8
|
|
|
8
9
|
Themed Regular check box icons example:
|
|
@@ -12,6 +13,7 @@ import customTheme from 'data/customTheme';
|
|
|
12
13
|
<React.Fragment>
|
|
13
14
|
<CheckBoxIcon theme={customTheme} />
|
|
14
15
|
<CheckBoxIcon checked={true} theme={customTheme} />
|
|
16
|
+
<CheckBoxIcon checked={true} theme={customTheme} checkmarkCharacter="✕" />
|
|
15
17
|
</React.Fragment>
|
|
16
18
|
```
|
|
17
19
|
|
|
@@ -20,4 +22,8 @@ Check box icons with custom size example:
|
|
|
20
22
|
```js
|
|
21
23
|
<CheckBoxIcon size='43px' />
|
|
22
24
|
<CheckBoxIcon size='43px' checked={true} />
|
|
25
|
+
<CheckBoxIcon size='43px' checked={true} checkmarkCharacter="✕" />
|
|
23
26
|
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -17,63 +15,30 @@ var _CheckBoxInputModule = _interopRequireDefault(require("./CheckBoxInput.modul
|
|
|
17
15
|
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_inherits(CheckBoxInput, _React$Component);
|
|
42
|
-
|
|
43
|
-
var _super = _createSuper(CheckBoxInput);
|
|
44
|
-
|
|
45
|
-
function CheckBoxInput() {
|
|
46
|
-
_classCallCheck(this, CheckBoxInput);
|
|
47
|
-
|
|
48
|
-
return _super.apply(this, arguments);
|
|
18
|
+
class CheckBoxInput extends _react.default.Component {
|
|
19
|
+
render() {
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement("label", {
|
|
21
|
+
className: "".concat(_CheckBoxInputModule.default.checkBoxInput, " ").concat(this.props.contentOnly ? _CheckBoxInputModule.default.contentOnly : '', " ").concat(this.props.hasErrors ? _CheckBoxInputModule.default.hasErrors : ''),
|
|
22
|
+
htmlFor: this.props.id
|
|
23
|
+
}, !this.props.contentOnly ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CheckBoxIcon.default, {
|
|
24
|
+
checked: this.props.checked,
|
|
25
|
+
theme: this.props.theme,
|
|
26
|
+
hasErrors: this.props.hasErrors,
|
|
27
|
+
checkmarkCharacter: this.props.checkmarkCharacter
|
|
28
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
29
|
+
onChange: this.props.onChange,
|
|
30
|
+
type: "checkbox",
|
|
31
|
+
name: this.props.name,
|
|
32
|
+
id: this.props.id,
|
|
33
|
+
checked: this.props.checked
|
|
34
|
+
})) : /*#__PURE__*/_react.default.createElement(_CheckBoxIcon.default, {
|
|
35
|
+
checked: this.props.checked,
|
|
36
|
+
showBox: false,
|
|
37
|
+
theme: this.props.theme
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, this.props.children));
|
|
49
39
|
}
|
|
50
40
|
|
|
51
|
-
|
|
52
|
-
key: "render",
|
|
53
|
-
value: function render() {
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement("label", {
|
|
55
|
-
className: "".concat(_CheckBoxInputModule.default.checkBoxInput, " ").concat(this.props.contentOnly ? _CheckBoxInputModule.default.contentOnly : '', " ").concat(this.props.hasErrors ? _CheckBoxInputModule.default.hasErrors : ''),
|
|
56
|
-
htmlFor: this.props.id
|
|
57
|
-
}, !this.props.contentOnly ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CheckBoxIcon.default, {
|
|
58
|
-
checked: this.props.checked,
|
|
59
|
-
theme: this.props.theme,
|
|
60
|
-
hasErrors: this.props.hasErrors
|
|
61
|
-
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
62
|
-
onChange: this.props.onChange,
|
|
63
|
-
type: "checkbox",
|
|
64
|
-
name: this.props.name,
|
|
65
|
-
id: this.props.id,
|
|
66
|
-
checked: this.props.checked
|
|
67
|
-
})) : /*#__PURE__*/_react.default.createElement(_CheckBoxIcon.default, {
|
|
68
|
-
checked: this.props.checked,
|
|
69
|
-
showBox: false,
|
|
70
|
-
theme: this.props.theme
|
|
71
|
-
}), /*#__PURE__*/_react.default.createElement("span", null, this.props.children));
|
|
72
|
-
}
|
|
73
|
-
}]);
|
|
74
|
-
|
|
75
|
-
return CheckBoxInput;
|
|
76
|
-
}(_react.default.Component);
|
|
41
|
+
}
|
|
77
42
|
|
|
78
43
|
CheckBoxInput.propTypes = {
|
|
79
44
|
checked: _propTypes.default.bool,
|
|
@@ -82,13 +47,15 @@ CheckBoxInput.propTypes = {
|
|
|
82
47
|
onChange: _propTypes.default.func.isRequired,
|
|
83
48
|
contentOnly: _propTypes.default.bool,
|
|
84
49
|
hasErrors: _propTypes.default.bool,
|
|
85
|
-
theme: _propTypes.default.object
|
|
50
|
+
theme: _propTypes.default.object,
|
|
51
|
+
checkmarkCharacter: _propTypes.default.string
|
|
86
52
|
};
|
|
87
53
|
CheckBoxInput.defaultProps = {
|
|
88
54
|
checked: false,
|
|
89
55
|
name: '',
|
|
90
56
|
contentOnly: false,
|
|
91
|
-
hasErrors: false
|
|
57
|
+
hasErrors: false,
|
|
58
|
+
checkmarkCharacter: '✔'
|
|
92
59
|
};
|
|
93
60
|
var _default = CheckBoxInput;
|
|
94
61
|
exports.default = _default;
|
|
@@ -14,6 +14,9 @@ Checkbox input example:
|
|
|
14
14
|
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="checkBoxInput-4" contentOnly={true}>
|
|
15
15
|
<span>Unchecked checkbox with content only</span>
|
|
16
16
|
</CheckBoxInput>
|
|
17
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="checkBoxInput-5" checked={true} checkmarkCharacter="✕">
|
|
18
|
+
<span>Label for checked checkbox with custom checkmark</span>
|
|
19
|
+
</CheckBoxInput>
|
|
17
20
|
</div>
|
|
18
21
|
```
|
|
19
22
|
|
|
@@ -35,5 +38,8 @@ import customTheme from 'data/customTheme';
|
|
|
35
38
|
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkBoxInput-4" contentOnly={true} theme={customTheme}>
|
|
36
39
|
<span>Unchecked checkbox with content only</span>
|
|
37
40
|
</CheckBoxInput>
|
|
41
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="themed-checkBoxInput-5" checked={true} checkmarkCharacter="✕" theme={customTheme}>
|
|
42
|
+
<span>Label for checked checkbox with custom checkmark</span>
|
|
43
|
+
</CheckBoxInput>
|
|
38
44
|
</div>
|
|
39
45
|
```
|