dibk-design 0.3.24
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/LICENSE +674 -0
- package/README.md +3 -0
- package/dist/components/Accordion.js +120 -0
- package/dist/components/Accordion.md +15 -0
- package/dist/components/Accordion.module.scss +180 -0
- package/dist/components/Button.js +104 -0
- package/dist/components/Button.md +48 -0
- package/dist/components/Button.module.scss +141 -0
- package/dist/components/CheckBoxIcon.js +97 -0
- package/dist/components/CheckBoxIcon.md +23 -0
- package/dist/components/CheckBoxIcon.module.scss +39 -0
- package/dist/components/CheckBoxInput.js +91 -0
- package/dist/components/CheckBoxInput.md +39 -0
- package/dist/components/CheckBoxInput.module.scss +18 -0
- package/dist/components/CheckBoxListItem.js +85 -0
- package/dist/components/CheckBoxListItem.md +35 -0
- package/dist/components/CheckBoxListItem.module.scss +59 -0
- package/dist/components/ContentBox.js +106 -0
- package/dist/components/ContentBox.md +46 -0
- package/dist/components/ContentBox.module.scss +105 -0
- package/dist/components/DragAndDropFileInput.js +196 -0
- package/dist/components/DragAndDropFileInput.md +7 -0
- package/dist/components/DragAndDropFileInput.module.scss +36 -0
- package/dist/components/Footer.js +62 -0
- package/dist/components/Footer.md +7 -0
- package/dist/components/Footer.module.scss +11 -0
- package/dist/components/Header.js +75 -0
- package/dist/components/Header.md +7 -0
- package/dist/components/Header.module.scss +30 -0
- package/dist/components/InputField.js +201 -0
- package/dist/components/InputField.md +36 -0
- package/dist/components/InputField.module.scss +91 -0
- package/dist/components/List.js +106 -0
- package/dist/components/List.md +10 -0
- package/dist/components/List.module.scss +19 -0
- package/dist/components/LoadingAnimation.js +74 -0
- package/dist/components/LoadingAnimation.md +5 -0
- package/dist/components/LoadingAnimation.module.scss +26 -0
- package/dist/components/NavigationBar.js +229 -0
- package/dist/components/NavigationBar.md +31 -0
- package/dist/components/NavigationBar.module.scss +176 -0
- package/dist/components/NavigationBarListItem.js +85 -0
- package/dist/components/NavigationBarListItem.md +16 -0
- package/dist/components/Paper.js +71 -0
- package/dist/components/Paper.md +9 -0
- package/dist/components/Paper.module.scss +17 -0
- package/dist/components/RadioButtonIcon.js +92 -0
- package/dist/components/RadioButtonIcon.md +23 -0
- package/dist/components/RadioButtonIcon.module.scss +21 -0
- package/dist/components/RadioButtonInput.js +89 -0
- package/dist/components/RadioButtonInput.md +22 -0
- package/dist/components/RadioButtonInput.module.scss +15 -0
- package/dist/components/RadioButtonListItem.js +86 -0
- package/dist/components/RadioButtonListItem.md +24 -0
- package/dist/components/RadioButtonListItem.module.scss +59 -0
- package/dist/components/Select.js +188 -0
- package/dist/components/Select.md +26 -0
- package/dist/components/Select.module.scss +84 -0
- package/dist/components/Theme.js +131 -0
- package/dist/components/Theme.md +12 -0
- package/dist/components/Theme.module.scss +76 -0
- package/dist/components/WizardNavigation/Step.js +104 -0
- package/dist/components/WizardNavigation/Step.module.scss +75 -0
- package/dist/components/WizardNavigation.js +95 -0
- package/dist/components/WizardNavigation.md +84 -0
- package/dist/components/WizardNavigation.module.scss +4 -0
- package/dist/fonts/Altis-Light.eot +0 -0
- package/dist/fonts/Altis-Light.svg +326 -0
- package/dist/fonts/Altis-Light.ttf +0 -0
- package/dist/fonts/Altis-Light.woff +0 -0
- package/dist/functions/theme.js +60 -0
- package/dist/images/dibk-logo-mobile.svg +91 -0
- package/dist/images/dibk-logo.svg +991 -0
- package/dist/images/spinner.svg +57 -0
- package/dist/index.js +185 -0
- package/dist/style/abstracts/_all.scss +2 -0
- package/dist/style/abstracts/mixins/_all.scss +12 -0
- package/dist/style/abstracts/mixins/_animation.scss +6 -0
- package/dist/style/abstracts/mixins/_appearance.scss +5 -0
- package/dist/style/abstracts/mixins/_border-radius.scss +31 -0
- package/dist/style/abstracts/mixins/_box-shadow.scss +5 -0
- package/dist/style/abstracts/mixins/_box-sizing.scss +5 -0
- package/dist/style/abstracts/mixins/_calc.scss +5 -0
- package/dist/style/abstracts/mixins/_keyframes.scss +14 -0
- package/dist/style/abstracts/mixins/_opacity.scss +5 -0
- package/dist/style/abstracts/mixins/_placeholder.scss +17 -0
- package/dist/style/abstracts/mixins/_scrollbar.scss +26 -0
- package/dist/style/abstracts/mixins/_transform.scss +6 -0
- package/dist/style/abstracts/mixins/_transition.scss +34 -0
- package/dist/style/abstracts/variables/_all.scss +3 -0
- package/dist/style/abstracts/variables/_colors.scss +35 -0
- package/dist/style/abstracts/variables/_typography.scss +1 -0
- package/dist/style/abstracts/variables/_viewports.scss +11 -0
- package/dist/style/base/_all.scss +2 -0
- package/dist/style/base/_reset.scss +15 -0
- package/dist/style/base/_typography.scss +6 -0
- package/dist/style/base/fonts.css +6 -0
- package/dist/style/global.scss +3 -0
- package/dist/style/layout/_all.scss +1 -0
- package/dist/style/layout/_containers.scss +9 -0
- package/package.json +43 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
@include keyframes(pushnext) {
|
|
3
|
+
0% {
|
|
4
|
+
@include transform(rotate(45deg) translate3d(0, 0, 0));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
50% {
|
|
8
|
+
@include transform(rotate(45deg) translate3d(2px, -2px, 0));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
100% {
|
|
12
|
+
@include transform(rotate(45deg) translate3d(0, 0, 0));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
@include keyframes(pushprev) {
|
|
16
|
+
0% {
|
|
17
|
+
@include transform(rotate(-135deg) translate3d(0, 0, 0));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
50% {
|
|
21
|
+
@include transform(rotate(-135deg) translate3d(-2px, 2px, 0));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
100% {
|
|
25
|
+
@include transform(rotate(-135deg) translate3d(0, 0, 0));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:local(.button) {
|
|
30
|
+
@include appearance(none);
|
|
31
|
+
@include border-radius(0);
|
|
32
|
+
@include transition(filter 300ms ease-out);
|
|
33
|
+
font-family: $default-font;
|
|
34
|
+
border-style: solid;
|
|
35
|
+
border-width: 0;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
line-height: normal;
|
|
38
|
+
position: relative;
|
|
39
|
+
text-align: center;
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
display: inline-block;
|
|
42
|
+
margin-right: 5px;
|
|
43
|
+
margin-bottom: 5px;
|
|
44
|
+
font-size: 18px;
|
|
45
|
+
font-weight: normal;
|
|
46
|
+
|
|
47
|
+
&:hover, &:focus {
|
|
48
|
+
filter: brightness(90%);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:active {
|
|
52
|
+
filter: brightness(85%);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:local(.regular) {
|
|
56
|
+
padding: 15px 30px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:local(.small) {
|
|
60
|
+
padding: 1px 30px;
|
|
61
|
+
height: 46px;
|
|
62
|
+
min-width: 80px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:local(.default) {
|
|
66
|
+
background-color: $color-default;
|
|
67
|
+
color: $color-primary;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:local(.primary) {
|
|
71
|
+
background-color: $color-primary;
|
|
72
|
+
color: #fff;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:local(.success) {
|
|
76
|
+
background-color: $color-success;
|
|
77
|
+
color: #fff;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:local(.warning) {
|
|
81
|
+
background-color: $color-warning;
|
|
82
|
+
color: #fff;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:disabled {
|
|
86
|
+
cursor: default;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:local(.hasArrowLeft) {
|
|
90
|
+
&:before {
|
|
91
|
+
@include transform(rotate(-135deg));
|
|
92
|
+
@include calc('top', '50% - 0.3rem');
|
|
93
|
+
content: ' ';
|
|
94
|
+
display: inline-block;
|
|
95
|
+
position: absolute;
|
|
96
|
+
left: 1em;
|
|
97
|
+
right: auto;
|
|
98
|
+
width: 0.5rem;
|
|
99
|
+
height: 0.5rem;
|
|
100
|
+
vertical-align: middle;
|
|
101
|
+
border: 2px solid white;
|
|
102
|
+
border-width: 2px 2px 0 0;
|
|
103
|
+
margin-right: 1em;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:hover {
|
|
107
|
+
&:before {
|
|
108
|
+
@include animation(pushprev 0.8s linear infinite);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
&:local(.default) {
|
|
112
|
+
&:before{
|
|
113
|
+
border-color: $color-primary;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:local(.hasArrowRight) {
|
|
119
|
+
&:after {
|
|
120
|
+
@include transform(rotate(45deg));
|
|
121
|
+
@include calc('top', '50% - 0.3rem');
|
|
122
|
+
content: ' ';
|
|
123
|
+
display: inline-block;
|
|
124
|
+
position: absolute;
|
|
125
|
+
left: auto;
|
|
126
|
+
right: 1em;
|
|
127
|
+
width: 0.5rem;
|
|
128
|
+
height: 0.5rem;
|
|
129
|
+
vertical-align: middle;
|
|
130
|
+
border: 2px solid white;
|
|
131
|
+
border-width: 2px 2px 0 0;
|
|
132
|
+
margin-left: 1em;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:hover {
|
|
136
|
+
&:after {
|
|
137
|
+
@include animation(pushnext 0.8s linear infinite);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _theme = require("../functions/theme");
|
|
15
|
+
|
|
16
|
+
var _CheckBoxIconModule = _interopRequireDefault(require("./CheckBoxIcon.module.scss"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
|
+
|
|
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; }
|
|
25
|
+
|
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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; }
|
|
41
|
+
|
|
42
|
+
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; } }
|
|
43
|
+
|
|
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
|
+
};
|
|
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'))
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
74
|
+
className: "".concat(_CheckBoxIconModule.default.checkBoxIcon, " ").concat(this.props.checked ? _CheckBoxIconModule.default.checked : '', " ").concat(this.props.showBox ? _CheckBoxIconModule.default.showBox : ''),
|
|
75
|
+
style: inlineStyle
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
77
|
+
className: _CheckBoxIconModule.default.checkmark
|
|
78
|
+
}, this.props.checked ? '✔' : ''));
|
|
79
|
+
}
|
|
80
|
+
}]);
|
|
81
|
+
|
|
82
|
+
return CheckBoxIcon;
|
|
83
|
+
}(_react.default.Component);
|
|
84
|
+
|
|
85
|
+
CheckBoxIcon.propTypes = {
|
|
86
|
+
size: _propTypes.default.string,
|
|
87
|
+
checked: _propTypes.default.bool,
|
|
88
|
+
showBox: _propTypes.default.bool,
|
|
89
|
+
theme: _propTypes.default.object
|
|
90
|
+
};
|
|
91
|
+
CheckBoxIcon.defaultProps = {
|
|
92
|
+
size: '20px',
|
|
93
|
+
checked: false,
|
|
94
|
+
showBox: true
|
|
95
|
+
};
|
|
96
|
+
var _default = CheckBoxIcon;
|
|
97
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Regular check box icons example:
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<CheckBoxIcon />
|
|
5
|
+
<CheckBoxIcon checked={true} />
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Themed Regular check box icons example:
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
import customTheme from 'data/customTheme';
|
|
12
|
+
<React.Fragment>
|
|
13
|
+
<CheckBoxIcon theme={customTheme} />
|
|
14
|
+
<CheckBoxIcon checked={true} theme={customTheme} />
|
|
15
|
+
</React.Fragment>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Check box icons with custom size example:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
<CheckBoxIcon size='43px' />
|
|
22
|
+
<CheckBoxIcon size='43px' checked={true} />
|
|
23
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
|
|
3
|
+
:local(.checkBoxIcon) {
|
|
4
|
+
@include border-radius(0);
|
|
5
|
+
@include transition(all 0.1s ease-in-out);
|
|
6
|
+
@include box-sizing(content-box);
|
|
7
|
+
display: inline-block;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
min-width: 10px;
|
|
10
|
+
width: 10px;
|
|
11
|
+
height: 10px;
|
|
12
|
+
min-width: 20px;
|
|
13
|
+
margin-right: 0.2em;
|
|
14
|
+
line-height: 1;
|
|
15
|
+
text-align: center;
|
|
16
|
+
|
|
17
|
+
&:local(.showBox) {
|
|
18
|
+
@include box-shadow(0 0 0 1px #afaba8);
|
|
19
|
+
margin-right: 0.4em;
|
|
20
|
+
background: white;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:local(.checked) {
|
|
24
|
+
color: $color-primary;
|
|
25
|
+
&:local(.showBox) {
|
|
26
|
+
@include box-shadow(0 0 0 1px $color-dark-blue);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:local(.checkmark) {
|
|
31
|
+
font-size: 1em;
|
|
32
|
+
line-height: 0.75em;
|
|
33
|
+
}
|
|
34
|
+
:not(:local(.showBox)) {
|
|
35
|
+
&:local(.checkmark) {
|
|
36
|
+
line-height: 1.05em;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _CheckBoxIcon = _interopRequireDefault(require("./CheckBoxIcon"));
|
|
15
|
+
|
|
16
|
+
var _CheckBoxInputModule = _interopRequireDefault(require("./CheckBoxInput.module.scss"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
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); 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"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); 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 CheckBoxInput = /*#__PURE__*/function (_React$Component) {
|
|
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);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_createClass(CheckBoxInput, [{
|
|
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 : ''),
|
|
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
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
61
|
+
onChange: this.props.onChange,
|
|
62
|
+
type: "checkbox",
|
|
63
|
+
name: this.props.name,
|
|
64
|
+
id: this.props.id,
|
|
65
|
+
checked: this.props.checked
|
|
66
|
+
})) : /*#__PURE__*/_react.default.createElement(_CheckBoxIcon.default, {
|
|
67
|
+
checked: this.props.checked,
|
|
68
|
+
showBox: false,
|
|
69
|
+
theme: this.props.theme
|
|
70
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, this.props.children));
|
|
71
|
+
}
|
|
72
|
+
}]);
|
|
73
|
+
|
|
74
|
+
return CheckBoxInput;
|
|
75
|
+
}(_react.default.Component);
|
|
76
|
+
|
|
77
|
+
CheckBoxInput.propTypes = {
|
|
78
|
+
checked: _propTypes.default.bool,
|
|
79
|
+
id: _propTypes.default.string.isRequired,
|
|
80
|
+
name: _propTypes.default.string,
|
|
81
|
+
onChange: _propTypes.default.func.isRequired,
|
|
82
|
+
contentOnly: _propTypes.default.bool,
|
|
83
|
+
theme: _propTypes.default.object
|
|
84
|
+
};
|
|
85
|
+
CheckBoxInput.defaultProps = {
|
|
86
|
+
checked: false,
|
|
87
|
+
name: '',
|
|
88
|
+
contentOnly: false
|
|
89
|
+
};
|
|
90
|
+
var _default = CheckBoxInput;
|
|
91
|
+
exports.default = _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Checkbox input example:
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<div className="flex">
|
|
5
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="checkBoxInput-1" checked={true}>
|
|
6
|
+
<span>Label for checked checkbox</span>
|
|
7
|
+
</CheckBoxInput>
|
|
8
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="checkBoxInput-2">
|
|
9
|
+
<span>Label for unchecked checkbox</span>
|
|
10
|
+
</CheckBoxInput>
|
|
11
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="checkBoxInput-3" checked={true} contentOnly={true}>
|
|
12
|
+
<span>Checked checkbox with content only</span>
|
|
13
|
+
</CheckBoxInput>
|
|
14
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="checkbox" id="checkBoxInput-4" contentOnly={true}>
|
|
15
|
+
<span>Unchecked checkbox with content only</span>
|
|
16
|
+
</CheckBoxInput>
|
|
17
|
+
</div>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Themed Checkbox input example:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import customTheme from 'data/customTheme';
|
|
25
|
+
<div className="flex">
|
|
26
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkBoxInput-1" checked={true} theme={customTheme}>
|
|
27
|
+
<span>Label for checked checkbox</span>
|
|
28
|
+
</CheckBoxInput>
|
|
29
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkBoxInput-2" theme={customTheme}>
|
|
30
|
+
<span>Label for unchecked checkbox</span>
|
|
31
|
+
</CheckBoxInput>
|
|
32
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkBoxInput-3" checked={true} contentOnly={true} theme={customTheme}>
|
|
33
|
+
<span>Checked checkbox with content only</span>
|
|
34
|
+
</CheckBoxInput>
|
|
35
|
+
<CheckBoxInput onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkBoxInput-4" contentOnly={true} theme={customTheme}>
|
|
36
|
+
<span>Unchecked checkbox with content only</span>
|
|
37
|
+
</CheckBoxInput>
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
|
|
3
|
+
:local(.checkBoxInput) {
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
&:not(:local(.contentOnly)){
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
input[type="checkbox"] {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
position: absolute;
|
|
13
|
+
}
|
|
14
|
+
span {
|
|
15
|
+
font-weight: 300;
|
|
16
|
+
}
|
|
17
|
+
margin-right: 1em;
|
|
18
|
+
}
|