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,85 @@
|
|
|
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 _CheckBoxListItemModule = _interopRequireDefault(require("./CheckBoxListItem.module.scss"));
|
|
15
|
+
|
|
16
|
+
var _CheckBoxInput = _interopRequireDefault(require("./CheckBoxInput"));
|
|
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 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);
|
|
49
|
+
}
|
|
50
|
+
|
|
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.contentOnly ? _CheckBoxListItemModule.default.contentOnly : '')
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_CheckBoxInput.default, {
|
|
57
|
+
onChange: this.props.onChange,
|
|
58
|
+
checked: this.props.checked,
|
|
59
|
+
contentOnly: this.props.contentOnly,
|
|
60
|
+
id: this.props.id,
|
|
61
|
+
theme: this.props.theme
|
|
62
|
+
}, this.props.children));
|
|
63
|
+
}
|
|
64
|
+
}]);
|
|
65
|
+
|
|
66
|
+
return CheckBoxListItem;
|
|
67
|
+
}(_react.default.Component);
|
|
68
|
+
|
|
69
|
+
CheckBoxListItem.propTypes = {
|
|
70
|
+
/** Text content inside list item */
|
|
71
|
+
checked: _propTypes.default.bool,
|
|
72
|
+
id: _propTypes.default.string.isRequired,
|
|
73
|
+
name: _propTypes.default.string,
|
|
74
|
+
onChange: _propTypes.default.func.isRequired,
|
|
75
|
+
contentOnly: _propTypes.default.bool,
|
|
76
|
+
theme: _propTypes.default.object
|
|
77
|
+
};
|
|
78
|
+
CheckBoxListItem.defaultProps = {
|
|
79
|
+
checked: false,
|
|
80
|
+
id: '',
|
|
81
|
+
name: '',
|
|
82
|
+
contentOnly: false
|
|
83
|
+
};
|
|
84
|
+
var _default = CheckBoxListItem;
|
|
85
|
+
exports.default = _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Check box list item example:
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="checkboxListItem-1">
|
|
5
|
+
Label for checked checkbox
|
|
6
|
+
</CheckBoxListItem>
|
|
7
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="checkboxListItem-2">
|
|
8
|
+
Label for unchecked checkbox
|
|
9
|
+
</CheckBoxListItem>
|
|
10
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="checkbox" id="checkboxListItem-3" contentOnly={true}>
|
|
11
|
+
Label for checked checkbox with content only
|
|
12
|
+
</CheckBoxListItem>
|
|
13
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="checkbox" id="checkboxListItem-4" contentOnly={true}>
|
|
14
|
+
Label for unchecked checkbox with content only
|
|
15
|
+
</CheckBoxListItem>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Themed Check box list item example:
|
|
19
|
+
```js
|
|
20
|
+
import customTheme from 'data/customTheme';
|
|
21
|
+
<React.Fragment>
|
|
22
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="themed-checkbox" id="themed-checkboxListItem-1" theme={customTheme}>
|
|
23
|
+
Label for checked checkbox
|
|
24
|
+
</CheckBoxListItem>
|
|
25
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkboxListItem-2" theme={customTheme}>
|
|
26
|
+
Label for unchecked checkbox
|
|
27
|
+
</CheckBoxListItem>
|
|
28
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} checked={true} name="themed-checkbox" id="themed-checkboxListItem-3" contentOnly={true} theme={customTheme}>
|
|
29
|
+
Label for checked checkbox with content only
|
|
30
|
+
</CheckBoxListItem>
|
|
31
|
+
<CheckBoxListItem onChange={()=>{console.log('onchange')}} name="themed-checkbox" id="themed-checkboxListItem-4" contentOnly={true} theme={customTheme}>
|
|
32
|
+
Label for unchecked checkbox with content only
|
|
33
|
+
</CheckBoxListItem>
|
|
34
|
+
</React.Fragment>
|
|
35
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
|
|
3
|
+
:local(.checkBoxListItem) {
|
|
4
|
+
@include box-sizing(content-box);
|
|
5
|
+
@include box-shadow(0 0 2px $color-dark-blue);
|
|
6
|
+
@include border-radius(5px);
|
|
7
|
+
@include transition(all 0.1s ease-in-out);
|
|
8
|
+
display: -webkit-box;
|
|
9
|
+
display: -webkit-flex;
|
|
10
|
+
display: -ms-flexbox;
|
|
11
|
+
display: flex;
|
|
12
|
+
-webkit-align-items: flex-start;
|
|
13
|
+
-webkit-box-align: flex-start;
|
|
14
|
+
-ms-flex-align: flex-start;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
font-family: $default-font;
|
|
18
|
+
position: relative;
|
|
19
|
+
font-size: 1rem;
|
|
20
|
+
color: #000;
|
|
21
|
+
|
|
22
|
+
&:not(:local(.contentOnly)) {
|
|
23
|
+
background: white;
|
|
24
|
+
margin-bottom: 10px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:local(.contentOnly) {
|
|
28
|
+
@include box-shadow(none);
|
|
29
|
+
cursor: auto;
|
|
30
|
+
label {
|
|
31
|
+
cursor: auto;
|
|
32
|
+
padding: 5px 10px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:local(.checked):not(:local(.contentOnly)) {
|
|
37
|
+
@include box-shadow(0 0 0 1px $color-dark-blue, 0 0 4px 0 $color-dark-blue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:not(:local(.checked)):not(:local(.contentOnly)):hover {
|
|
41
|
+
@include box-shadow(0 0 6px $color-dark-blue);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus {
|
|
45
|
+
outline-color: #54acb8;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
label {
|
|
49
|
+
width: 100%;
|
|
50
|
+
padding: 10px;
|
|
51
|
+
margin: 0;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
input[type="checkbox"] {
|
|
56
|
+
opacity: 0;
|
|
57
|
+
position: absolute;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 _ContentBoxModule = _interopRequireDefault(require("./ContentBox.module.scss"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
+
|
|
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); 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"); } 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 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);
|
|
47
|
+
}
|
|
48
|
+
|
|
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
|
+
}
|
|
61
|
+
}
|
|
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
|
+
}]);
|
|
85
|
+
|
|
86
|
+
return ContentBox;
|
|
87
|
+
}(_react.default.Component);
|
|
88
|
+
|
|
89
|
+
ContentBox.propTypes = {
|
|
90
|
+
/** Content title inside box */
|
|
91
|
+
title: _propTypes.default.string,
|
|
92
|
+
titleSize: _propTypes.default.oneOf(['regular', 'large']),
|
|
93
|
+
|
|
94
|
+
/** Text content inside box */
|
|
95
|
+
content: _propTypes.default.string,
|
|
96
|
+
color: _propTypes.default.oneOf(['default', 'primary', 'success', 'warning', 'info', 'lightCyan', 'orange', 'lightOrange', 'lime', 'lightLime'])
|
|
97
|
+
};
|
|
98
|
+
ContentBox.defaultProps = {
|
|
99
|
+
title: null,
|
|
100
|
+
titleSize: 'regular',
|
|
101
|
+
href: null,
|
|
102
|
+
content: '',
|
|
103
|
+
color: 'default'
|
|
104
|
+
};
|
|
105
|
+
var _default = ContentBox;
|
|
106
|
+
exports.default = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
ContentBoxes without title example:
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<ContentBox content="Box with default color" color="default" />
|
|
5
|
+
<ContentBox content="Box with primary color" color="primary" />
|
|
6
|
+
<ContentBox content="Box with success color" color="success" />
|
|
7
|
+
<ContentBox content="Box with warning color" color="warning" />
|
|
8
|
+
<ContentBox content="Box with info color" color="info" />
|
|
9
|
+
<ContentBox content="Box with light cyan color" color="lightCyan" />
|
|
10
|
+
<ContentBox content="Box with orange color" color="orange" />
|
|
11
|
+
<ContentBox content="Box with light orange color" color="lightOrange" />
|
|
12
|
+
<ContentBox content="Box with lime color" color="lime" />
|
|
13
|
+
<ContentBox content="Box with light lime color" color="lightLime" />
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
ContentBoxes with title and href example:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
<ContentBox content="Box with default color" href="#" color="default" title="Box title" />
|
|
21
|
+
<ContentBox content="Box with primary color" href="#" color="primary" title="Box title" />
|
|
22
|
+
<ContentBox content="Box with success color" href="#" color="success" title="Box title" />
|
|
23
|
+
<ContentBox content="Box with warning color" href="#" color="warning" title="Box title" />
|
|
24
|
+
<ContentBox content="Box with info color" href="#" color="info" title="Box title" />
|
|
25
|
+
<ContentBox content="Box with light cyan color" href="#" color="lightCyan" title="Box title" />
|
|
26
|
+
<ContentBox content="Box with orange color" href="#" color="orange" title="Box title" />
|
|
27
|
+
<ContentBox content="Box with light orange color" href="#" color="lightOrange" title="Box title" />
|
|
28
|
+
<ContentBox content="Box with lime color" href="#" color="lime" title="Box title" />
|
|
29
|
+
<ContentBox content="Box with light lime color" href="#" color="lightLime" title="Box title" />
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
ContentBoxes with large title:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
<ContentBox content="Box with default color" color="default" title="Box title" titleSize="large" />
|
|
37
|
+
<ContentBox content="Box with primary color" color="primary" title="Box title" titleSize="large" />
|
|
38
|
+
<ContentBox content="Box with success color" color="success" title="Box title" titleSize="large" />
|
|
39
|
+
<ContentBox content="Box with warning color" color="warning" title="Box title" titleSize="large" />
|
|
40
|
+
<ContentBox content="Box with info color" color="info" title="Box title" titleSize="large" />
|
|
41
|
+
<ContentBox content="Box with light cyan color" color="lightCyan" title="Box title" titleSize="large" />
|
|
42
|
+
<ContentBox content="Box with orange color" color="orange" title="Box title" titleSize="large" />
|
|
43
|
+
<ContentBox content="Box with light orange color" color="lightOrange" title="Box title" titleSize="large" />
|
|
44
|
+
<ContentBox content="Box with lime color" color="lime" title="Box title" titleSize="large" />
|
|
45
|
+
<ContentBox content="Box with light lime color" color="lightLime" title="Box title" titleSize="large" />
|
|
46
|
+
```
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
|
|
3
|
+
:local(.contentBox) {
|
|
4
|
+
font-family: $default-font;
|
|
5
|
+
text-decoration: none;
|
|
6
|
+
padding: 20px;
|
|
7
|
+
width: 100%;
|
|
8
|
+
display: block;
|
|
9
|
+
&:local(.link){
|
|
10
|
+
color: $color-primary;
|
|
11
|
+
@include transition(filter .3s);
|
|
12
|
+
&:hover, &:focus {
|
|
13
|
+
filter: brightness(90%);
|
|
14
|
+
}
|
|
15
|
+
&:active {
|
|
16
|
+
filter: brightness(85%);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
&:local(.default) {
|
|
20
|
+
background-color: $color-default;
|
|
21
|
+
:local(.content){
|
|
22
|
+
color: #000;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&:local(.primary) {
|
|
26
|
+
background-color: $color-primary;
|
|
27
|
+
color: #fff;
|
|
28
|
+
:local(.content){
|
|
29
|
+
color: #fff;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
&:local(.success) {
|
|
33
|
+
background-color: $color-success;
|
|
34
|
+
color: #fff;
|
|
35
|
+
:local(.content){
|
|
36
|
+
color: #fff;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
&:local(.warning) {
|
|
40
|
+
background-color: $color-warning;
|
|
41
|
+
color: #fff;
|
|
42
|
+
:local(.content){
|
|
43
|
+
color: #fff;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:local(.info) {
|
|
48
|
+
background-color: $color-info;
|
|
49
|
+
:local(.content){
|
|
50
|
+
color: #000;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
&:local(.lightCyan) {
|
|
54
|
+
background-color: $color-light-cyan;
|
|
55
|
+
:local(.content){
|
|
56
|
+
color: #000;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
&:local(.orange) {
|
|
60
|
+
background-color: $color-orange;
|
|
61
|
+
color: #fff;
|
|
62
|
+
:local(.content){
|
|
63
|
+
color: #fff;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
&:local(.lightOrange) {
|
|
67
|
+
background-color: $color-light-orange;
|
|
68
|
+
:local(.content){
|
|
69
|
+
color: #000;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
&:local(.lime) {
|
|
73
|
+
background-color: $color-lime;
|
|
74
|
+
color: #fff;
|
|
75
|
+
:local(.content){
|
|
76
|
+
color: #fff;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
&:local(.lightLime) {
|
|
80
|
+
background-color: $color-light-lime;
|
|
81
|
+
:local(.content){
|
|
82
|
+
color: #000;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:local(.title){
|
|
87
|
+
&:local(.regular) {
|
|
88
|
+
font-family: "Open Sans";
|
|
89
|
+
font-weight: bold;
|
|
90
|
+
font-size: 21px;
|
|
91
|
+
font-style: normal;
|
|
92
|
+
line-height: 1.4;
|
|
93
|
+
padding-bottom: 10px;
|
|
94
|
+
border-bottom: 1px solid #e5e3e1;
|
|
95
|
+
}
|
|
96
|
+
&:local(.large){
|
|
97
|
+
font-family: "Open Sans";
|
|
98
|
+
font-weight: normal;
|
|
99
|
+
font-size: 24px;
|
|
100
|
+
margin: 0;
|
|
101
|
+
margin-bottom: 20px;
|
|
102
|
+
font-style: normal;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
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 _Button = _interopRequireDefault(require("./Button"));
|
|
15
|
+
|
|
16
|
+
var _DragAndDropFileInputModule = _interopRequireDefault(require("./DragAndDropFileInput.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 DragAndDropFileInput = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
_inherits(DragAndDropFileInput, _React$Component);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(DragAndDropFileInput);
|
|
44
|
+
|
|
45
|
+
function DragAndDropFileInput(props) {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
_classCallCheck(this, DragAndDropFileInput);
|
|
49
|
+
|
|
50
|
+
_this = _super.call(this, props);
|
|
51
|
+
_this.state = {
|
|
52
|
+
highlight: false
|
|
53
|
+
};
|
|
54
|
+
_this.setWrapperRef = _this.setWrapperRef.bind(_assertThisInitialized(_this));
|
|
55
|
+
_this.setFileInputElementRef = _this.setFileInputElementRef.bind(_assertThisInitialized(_this));
|
|
56
|
+
_this.highlight = _this.highlight.bind(_assertThisInitialized(_this));
|
|
57
|
+
_this.unhighlight = _this.unhighlight.bind(_assertThisInitialized(_this));
|
|
58
|
+
_this.handleDrop = _this.handleDrop.bind(_assertThisInitialized(_this));
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_createClass(DragAndDropFileInput, [{
|
|
63
|
+
key: "componentDidMount",
|
|
64
|
+
value: function componentDidMount() {
|
|
65
|
+
var containerElement = this.containerElement;
|
|
66
|
+
|
|
67
|
+
if (containerElement) {
|
|
68
|
+
// Prevent defaults
|
|
69
|
+
containerElement.addEventListener('dragenter', this.preventDefaults, false);
|
|
70
|
+
containerElement.addEventListener('dragover', this.preventDefaults, false);
|
|
71
|
+
containerElement.addEventListener('dragleave', this.preventDefaults, false);
|
|
72
|
+
containerElement.addEventListener('drop', this.preventDefaults, false); // Highlight
|
|
73
|
+
|
|
74
|
+
containerElement.addEventListener('dragenter', this.highlight, false);
|
|
75
|
+
containerElement.addEventListener('dragover', this.highlight, false); // Unhighlight
|
|
76
|
+
|
|
77
|
+
containerElement.addEventListener('dragleave', this.unhighlight, false);
|
|
78
|
+
containerElement.addEventListener('drop', this.unhighlight, false); // Hande drop
|
|
79
|
+
|
|
80
|
+
containerElement.addEventListener('drop', this.handleDrop, false);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "setWrapperRef",
|
|
85
|
+
value: function setWrapperRef(node) {
|
|
86
|
+
this.containerElement = node;
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "setFileInputElementRef",
|
|
90
|
+
value: function setFileInputElementRef(node) {
|
|
91
|
+
this.fileInputElement = node;
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "preventDefaults",
|
|
95
|
+
value: function preventDefaults(e) {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "highlight",
|
|
101
|
+
value: function highlight(e) {
|
|
102
|
+
this.setState({
|
|
103
|
+
highlight: true
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "unhighlight",
|
|
108
|
+
value: function unhighlight(e) {
|
|
109
|
+
this.setState({
|
|
110
|
+
highlight: false
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "handleDrop",
|
|
115
|
+
value: function handleDrop(e) {
|
|
116
|
+
var files = e.dataTransfer.files;
|
|
117
|
+
this.handleFiles(files);
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
key: "handleFiles",
|
|
121
|
+
value: function handleFiles(files) {
|
|
122
|
+
this.props.onDragAndDropChange(files);
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "renderValueAsText",
|
|
126
|
+
value: function renderValueAsText(value, defaultContent) {
|
|
127
|
+
return value ? value : defaultContent;
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "handleAddButtonOnClick",
|
|
131
|
+
value: function handleAddButtonOnClick() {
|
|
132
|
+
this.fileInputElement.click();
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "handeFileInputElementOnChange",
|
|
136
|
+
value: function handeFileInputElementOnChange(files) {
|
|
137
|
+
this.props.onSelectChange(files);
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "render",
|
|
141
|
+
value: function render() {
|
|
142
|
+
var _this2 = this;
|
|
143
|
+
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
145
|
+
className: _DragAndDropFileInputModule.default.dragAndDropFileInput
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
147
|
+
htmlFor: this.props.id
|
|
148
|
+
}, this.props.label, !this.props.contentOnly ? /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
+
ref: this.setWrapperRef,
|
|
150
|
+
className: "".concat(_DragAndDropFileInputModule.default.dragAndDropContainer, " ").concat(this.state.highlight ? _DragAndDropFileInputModule.default.highlighted : '')
|
|
151
|
+
}, this.props.selectedFileName ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("b", null, "Valgt fil:"), " ", this.props.selectedFileName)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Slipp fil her"), /*#__PURE__*/_react.default.createElement("input", {
|
|
152
|
+
ref: this.setFileInputElementRef,
|
|
153
|
+
type: "file",
|
|
154
|
+
onChange: this.props.onSelectChange
|
|
155
|
+
}), this.props.buttonContent ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "eller klikk p\xE5 knappen for \xE5 velge fil"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
156
|
+
size: "small",
|
|
157
|
+
color: this.props.buttonColor,
|
|
158
|
+
onClick: function onClick() {
|
|
159
|
+
return _this2.handleAddButtonOnClick();
|
|
160
|
+
},
|
|
161
|
+
content: this.props.buttonContent
|
|
162
|
+
})) : '')) : ''), this.props.contentOnly ? /*#__PURE__*/_react.default.createElement("span", null, this.renderValueAsText(this.props.selectedFileName, this.props.defaultContent)) : '', /*#__PURE__*/_react.default.createElement("span", {
|
|
163
|
+
className: _DragAndDropFileInputModule.default.errorMessage
|
|
164
|
+
}, this.props.errorMessage ? this.props.errorMessage : ''));
|
|
165
|
+
}
|
|
166
|
+
}]);
|
|
167
|
+
|
|
168
|
+
return DragAndDropFileInput;
|
|
169
|
+
}(_react.default.Component);
|
|
170
|
+
|
|
171
|
+
DragAndDropFileInput.propTypes = {
|
|
172
|
+
/** Text content inside list item */
|
|
173
|
+
id: _propTypes.default.string.isRequired,
|
|
174
|
+
onSelectChange: _propTypes.default.func.isRequired,
|
|
175
|
+
onDragAndDropChange: _propTypes.default.func.isRequired,
|
|
176
|
+
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]))]),
|
|
177
|
+
contentOnly: _propTypes.default.bool,
|
|
178
|
+
buttonColor: _propTypes.default.string,
|
|
179
|
+
buttonContent: _propTypes.default.string,
|
|
180
|
+
selectedFileName: _propTypes.default.string,
|
|
181
|
+
defaultContent: _propTypes.default.string,
|
|
182
|
+
hasErrors: _propTypes.default.bool,
|
|
183
|
+
errorMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]))]),
|
|
184
|
+
mandatory: _propTypes.default.bool
|
|
185
|
+
};
|
|
186
|
+
DragAndDropFileInput.defaultProps = {
|
|
187
|
+
label: '',
|
|
188
|
+
contentOnly: false,
|
|
189
|
+
buttonColor: 'default',
|
|
190
|
+
defaultContent: '',
|
|
191
|
+
hasErrors: false,
|
|
192
|
+
errorMessage: '',
|
|
193
|
+
mandatory: false
|
|
194
|
+
};
|
|
195
|
+
var _default = DragAndDropFileInput;
|
|
196
|
+
exports.default = _default;
|