dibk-design 0.4.52 → 1.0.0
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/Button.js +2 -3
- package/dist/components/Button.md +2 -0
- package/dist/components/ContentBox.module.scss +2 -2
- package/dist/components/DragAndDropFileInput.module.scss +1 -1
- package/dist/components/ErrorBox.js +44 -0
- package/dist/components/ErrorBox.md +27 -0
- package/dist/components/ErrorBox.module.scss +25 -0
- package/dist/components/ErrorMessage.module.scss +1 -1
- package/dist/components/Header.module.scss +2 -2
- package/dist/components/InputField.js +38 -70
- package/dist/components/InputField.md +7 -8
- package/dist/components/Label.module.scss +3 -1
- package/dist/components/NavigationBar.module.scss +2 -2
- package/dist/index.js +8 -0
- package/dist/style/abstracts/variables/_typography.scss +1 -1
- package/package.json +1 -2
|
@@ -94,10 +94,10 @@ var Button = /*#__PURE__*/function (_React$Component) {
|
|
|
94
94
|
return (_this$props$href = this.props.href) !== null && _this$props$href !== void 0 && _this$props$href.length ? /*#__PURE__*/_react.default.createElement("a", _extends({}, buttonProps, {
|
|
95
95
|
className: className,
|
|
96
96
|
style: themeStyle
|
|
97
|
-
}), this.props.content) : /*#__PURE__*/_react.default.createElement("button", _extends({}, buttonProps, {
|
|
97
|
+
}), this.props.content || this.props.children) : /*#__PURE__*/_react.default.createElement("button", _extends({}, buttonProps, {
|
|
98
98
|
className: className,
|
|
99
99
|
style: themeStyle
|
|
100
|
-
}), this.props.content);
|
|
100
|
+
}), this.props.content || this.props.children);
|
|
101
101
|
}
|
|
102
102
|
}]);
|
|
103
103
|
|
|
@@ -117,7 +117,6 @@ Button.propTypes = {
|
|
|
117
117
|
href: _propTypes.default.string
|
|
118
118
|
};
|
|
119
119
|
Button.defaultProps = {
|
|
120
|
-
content: 'button',
|
|
121
120
|
color: 'default',
|
|
122
121
|
size: 'regular',
|
|
123
122
|
disabled: false,
|
|
@@ -6,6 +6,7 @@ Regular buttons example:
|
|
|
6
6
|
<Button content="Click me" color="default" disabled />
|
|
7
7
|
<Button content="Click me" color="primary" disabled />
|
|
8
8
|
<Button content="Link button" color="primary" href="#" />
|
|
9
|
+
<Button color="default"><span>Button with <b>HTML</b> content</span></Button>
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
Rounded buttons example:
|
|
@@ -15,6 +16,7 @@ Rounded buttons example:
|
|
|
15
16
|
<Button rounded content="Click me" color="primary" />
|
|
16
17
|
<Button rounded content="Click me" color="default" disabled />
|
|
17
18
|
<Button rounded content="Click me" color="primary" disabled />
|
|
19
|
+
<Button rounded color="default"><span>Button with <b>HTML</b> content</span></Button>
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
Regular buttons with arrow example:
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
|
|
97
97
|
:local(.title) {
|
|
98
98
|
&:local(.regular) {
|
|
99
|
-
font-family:
|
|
99
|
+
font-family: $default-font;
|
|
100
100
|
font-weight: bold;
|
|
101
101
|
font-size: 21px;
|
|
102
102
|
font-style: normal;
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
border-bottom: 1px solid #e5e3e1;
|
|
106
106
|
}
|
|
107
107
|
&:local(.large) {
|
|
108
|
-
font-family:
|
|
108
|
+
font-family: $default-font;
|
|
109
109
|
font-weight: normal;
|
|
110
110
|
font-size: 24px;
|
|
111
111
|
margin: 0;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _theme = require("../functions/theme");
|
|
13
|
+
|
|
14
|
+
var _ErrorBoxModule = _interopRequireDefault(require("./ErrorBox.module.scss"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
// Dependencies
|
|
19
|
+
// Functions
|
|
20
|
+
// Stylesheets
|
|
21
|
+
var ErrorBox = function ErrorBox(_ref) {
|
|
22
|
+
var theme = _ref.theme,
|
|
23
|
+
children = _ref.children;
|
|
24
|
+
|
|
25
|
+
var getThemeErrorBoxStyle = function getThemeErrorBoxStyle() {
|
|
26
|
+
return {
|
|
27
|
+
borderColor: (0, _theme.getThemePaletteBackgroundColor)(theme, 'warning')
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: _ErrorBoxModule.default.errorBox,
|
|
33
|
+
style: getThemeErrorBoxStyle()
|
|
34
|
+
}, children);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
ErrorBox.propTypes = {
|
|
38
|
+
theme: _propTypes.default.object
|
|
39
|
+
};
|
|
40
|
+
ErrorBox.defaultProps = {
|
|
41
|
+
children: ''
|
|
42
|
+
};
|
|
43
|
+
var _default = ErrorBox;
|
|
44
|
+
exports.default = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Error box example:
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<ErrorBox>
|
|
5
|
+
<h3>Du kan ikke signere erklæringen før alle opplysningene er fylt ut:</h3>
|
|
6
|
+
<ul>
|
|
7
|
+
<li>Du må krysse av for at foretaket erklærer ansvar i henhold til plan- og bygningsloven.</li>
|
|
8
|
+
<li>Du må fylle ut mobil- eller telefonnummeret til kontaktpersonen.</li>
|
|
9
|
+
</ul>
|
|
10
|
+
</ErrorBox>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Themed error box example:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import customTheme from 'data/customTheme';
|
|
18
|
+
<React.Fragment>
|
|
19
|
+
<ErrorBox theme={customTheme}>
|
|
20
|
+
<h3>Du kan ikke signere erklæringen før alle opplysningene er fylt ut:</h3>
|
|
21
|
+
<ul>
|
|
22
|
+
<li>Du må krysse av for at foretaket erklærer ansvar i henhold til plan- og bygningsloven.</li>
|
|
23
|
+
<li>Du må fylle ut mobil- eller telefonnummeret til kontaktpersonen.</li>
|
|
24
|
+
</ul>
|
|
25
|
+
</ErrorBox>
|
|
26
|
+
</React.Fragment>
|
|
27
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
|
|
3
|
+
:local(.errorBox) {
|
|
4
|
+
@include box-shadow(0 2px 3px rgb(0 0 0 / 18%));
|
|
5
|
+
border-left: 12px solid $color-error;
|
|
6
|
+
background: white;
|
|
7
|
+
padding: 30px 33px 46px 21px;
|
|
8
|
+
font-family: $default-font;
|
|
9
|
+
margin: 0;
|
|
10
|
+
h1,
|
|
11
|
+
h2,
|
|
12
|
+
h3,
|
|
13
|
+
h4 {
|
|
14
|
+
font-size: 20px;
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
line-height: 1.3;
|
|
17
|
+
margin: 0;
|
|
18
|
+
@media only screen and (min-width: $screen-sm) {
|
|
19
|
+
font-size: 24px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
ul {
|
|
23
|
+
padding-left: 20px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
&:local(.size-3) {
|
|
44
|
-
font-family:
|
|
44
|
+
font-family: $default-font;
|
|
45
45
|
font-size: 19px;
|
|
46
46
|
font-style: normal;
|
|
47
47
|
font-weight: bold;
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
&:local(.size-4) {
|
|
54
|
-
font-family:
|
|
54
|
+
font-family: $default-font;
|
|
55
55
|
font-size: 17px;
|
|
56
56
|
font-style: italic;
|
|
57
57
|
font-weight: normal;
|
|
@@ -11,12 +11,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
|
-
var _reactDatepicker = _interopRequireWildcard(require("react-datepicker"));
|
|
15
|
-
|
|
16
|
-
var _dateFns = require("date-fns");
|
|
17
|
-
|
|
18
|
-
var _nb = _interopRequireDefault(require("date-fns/locale/nb"));
|
|
19
|
-
|
|
20
14
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
21
15
|
|
|
22
16
|
var _Label = _interopRequireDefault(require("./Label"));
|
|
@@ -27,22 +21,14 @@ var _theme = require("../functions/theme");
|
|
|
27
21
|
|
|
28
22
|
var _generators = require("../functions/generators");
|
|
29
23
|
|
|
30
|
-
require("react-datepicker/dist/react-datepicker.css");
|
|
31
|
-
|
|
32
24
|
var _InputFieldModule = _interopRequireDefault(require("./InputField.module.scss"));
|
|
33
25
|
|
|
34
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
-
|
|
36
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
-
|
|
38
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
27
|
|
|
40
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
29
|
|
|
42
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
31
|
|
|
44
|
-
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; }
|
|
45
|
-
|
|
46
32
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
47
33
|
|
|
48
34
|
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); } }
|
|
@@ -63,7 +49,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
63
49
|
|
|
64
50
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
65
51
|
|
|
66
|
-
(
|
|
52
|
+
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; }
|
|
67
53
|
|
|
68
54
|
var InputField = /*#__PURE__*/function (_React$Component) {
|
|
69
55
|
_inherits(InputField, _React$Component);
|
|
@@ -71,30 +57,43 @@ var InputField = /*#__PURE__*/function (_React$Component) {
|
|
|
71
57
|
var _super = _createSuper(InputField);
|
|
72
58
|
|
|
73
59
|
function InputField() {
|
|
60
|
+
var _this;
|
|
61
|
+
|
|
74
62
|
_classCallCheck(this, InputField);
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
|
+
args[_key] = arguments[_key];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
|
+
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "formatDate", function (inputDate) {
|
|
71
|
+
if (!inputDate) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var date = new Date(inputDate);
|
|
76
|
+
var year = date.getFullYear();
|
|
77
|
+
var month = date.getMonth() + 1 < 10 ? "0".concat(date.getMonth() + 1) : date.getMonth() + 1;
|
|
78
|
+
var day = date.getDate() < 10 ? "0".concat(date.getDate()) : date.getDate();
|
|
79
|
+
return "".concat(day, ".").concat(month, ".").concat(year);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return _this;
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
_createClass(InputField, [{
|
|
80
86
|
key: "getThemeErrorInputStyle",
|
|
81
87
|
value: function getThemeErrorInputStyle(theme) {
|
|
82
88
|
return {
|
|
83
|
-
boxShadow: "0 0 3px ".concat((0, _theme.getThemePaletteBackgroundColor)(theme,
|
|
84
|
-
borderColor: (0, _theme.getThemePaletteBackgroundColor)(theme,
|
|
89
|
+
boxShadow: "0 0 3px ".concat((0, _theme.getThemePaletteBackgroundColor)(theme, "warning")),
|
|
90
|
+
borderColor: (0, _theme.getThemePaletteBackgroundColor)(theme, "warning")
|
|
85
91
|
};
|
|
86
92
|
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "convertDateToString",
|
|
89
|
-
value: function convertDateToString(date) {
|
|
90
|
-
return date ? (0, _dateFns.format)(new Date(date), this.props.dateFormat, {
|
|
91
|
-
locale: _nb.default
|
|
92
|
-
}) : '';
|
|
93
|
-
}
|
|
94
93
|
}, {
|
|
95
94
|
key: "renderValueAsText",
|
|
96
95
|
value: function renderValueAsText(value, defaultContent) {
|
|
97
|
-
return this.props.type ===
|
|
96
|
+
return this.props.type === "date" ? value ? this.formatDate(value) : defaultContent : value ? value : defaultContent;
|
|
98
97
|
}
|
|
99
98
|
}, {
|
|
100
99
|
key: "getInputElementProps",
|
|
@@ -108,39 +107,11 @@ var InputField = /*#__PURE__*/function (_React$Component) {
|
|
|
108
107
|
type: this.props.type,
|
|
109
108
|
id: this.props.id,
|
|
110
109
|
key: defaultKey || "".concat(this.props.id, "-").concat((0, _generators.generateRandomString)(6)),
|
|
110
|
+
min: this.props.min || null,
|
|
111
|
+
max: this.props.max || null,
|
|
111
112
|
onChange: this.props.onChange,
|
|
112
113
|
onBlur: this.props.onBlur
|
|
113
|
-
}, _defineProperty(_ref, defaultValue ?
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "getDatePickerElementProps",
|
|
117
|
-
value: function getDatePickerElementProps(defaultValue, defaultKey) {
|
|
118
|
-
var _this = this;
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
name: this.props.name,
|
|
122
|
-
readOnly: this.props.readOnly,
|
|
123
|
-
disabled: this.props.disabled,
|
|
124
|
-
id: this.props.id,
|
|
125
|
-
key: defaultKey || "".concat(this.props.id, "-").concat((0, _generators.generateRandomString)(6)),
|
|
126
|
-
dateFormat: this.props.dateFormat,
|
|
127
|
-
locale: 'nb',
|
|
128
|
-
selectsStart: this.props.selectsStart,
|
|
129
|
-
selectsEnd: this.props.selectsEnd,
|
|
130
|
-
startDate: this.props.startDate ? new Date(this.props.startDate) : null,
|
|
131
|
-
endDate: this.props.endDate ? new Date(this.props.endDate) : null,
|
|
132
|
-
minDate: this.props.minDate || null,
|
|
133
|
-
maxDate: this.props.maxDate || null,
|
|
134
|
-
onChange: this.props.onChange ? function (date) {
|
|
135
|
-
return _this.props.onChange(date);
|
|
136
|
-
} : console.log("Missing onChange handler for date picker with id: ".concat(this.props.id)),
|
|
137
|
-
onBlur: this.props.onBlur ? function (date) {
|
|
138
|
-
return _this.props.onBlur(date);
|
|
139
|
-
} : null,
|
|
140
|
-
selected: defaultValue ? new Date(defaultValue) : null,
|
|
141
|
-
placeholderText: this.props.placeholder,
|
|
142
|
-
className: this.props.hasErrors ? _InputFieldModule.default.hasErrors : ''
|
|
143
|
-
};
|
|
114
|
+
}, _defineProperty(_ref, defaultValue ? "defaultValue" : "value", defaultValue || this.props.value), _defineProperty(_ref, "placeholder", this.props.placeholder || null), _defineProperty(_ref, "className", this.props.hasErrors ? _InputFieldModule.default.hasErrors : ""), _defineProperty(_ref, "aria-required", this.props.mandatory), _defineProperty(_ref, "style", styleRules), _ref;
|
|
144
115
|
}
|
|
145
116
|
}, {
|
|
146
117
|
key: "render",
|
|
@@ -159,7 +130,7 @@ var InputField = /*#__PURE__*/function (_React$Component) {
|
|
|
159
130
|
className: "".concat(_InputFieldModule.default.inputField, " ").concat(_InputFieldModule.default[this.props.type])
|
|
160
131
|
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
161
132
|
htmlFor: this.props.id
|
|
162
|
-
}, this.props.label, this.props.type ===
|
|
133
|
+
}, this.props.label, this.props.type === "file" ? /*#__PURE__*/_react.default.createElement("div", {
|
|
163
134
|
className: _InputFieldModule.default.fileInputContainer
|
|
164
135
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
165
136
|
className: _InputFieldModule.default.input
|
|
@@ -170,9 +141,7 @@ var InputField = /*#__PURE__*/function (_React$Component) {
|
|
|
170
141
|
},
|
|
171
142
|
content: this.props.buttonContent,
|
|
172
143
|
theme: this.props.theme
|
|
173
|
-
}) :
|
|
174
|
-
style: styleRules
|
|
175
|
-
}, /*#__PURE__*/_react.default.createElement(_reactDatepicker.default, this.getDatePickerElementProps(defaultValue, defaultKey))) : /*#__PURE__*/_react.default.createElement("input", this.getInputElementProps(defaultValue, defaultKey, styleRules)) : /*#__PURE__*/_react.default.createElement("span", null, this.renderValueAsText(this.props.value || this.props.defaultValue, this.props.defaultContent)), /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
144
|
+
}) : null) : null), !this.props.contentOnly ? /*#__PURE__*/_react.default.createElement("input", this.getInputElementProps(defaultValue, defaultKey, styleRules)) : /*#__PURE__*/_react.default.createElement("span", null, this.renderValueAsText(this.props.value || this.props.defaultValue, this.props.defaultContent)), /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
176
145
|
content: this.props.errorMessage,
|
|
177
146
|
theme: this.props.theme
|
|
178
147
|
}));
|
|
@@ -198,7 +167,6 @@ InputField.propTypes = {
|
|
|
198
167
|
buttonColor: _propTypes.default.string,
|
|
199
168
|
buttonContent: _propTypes.default.string,
|
|
200
169
|
selectedFileName: _propTypes.default.string,
|
|
201
|
-
dateFormat: _propTypes.default.string,
|
|
202
170
|
placeholder: _propTypes.default.string,
|
|
203
171
|
defaultContent: _propTypes.default.string,
|
|
204
172
|
hasErrors: _propTypes.default.bool,
|
|
@@ -207,16 +175,16 @@ InputField.propTypes = {
|
|
|
207
175
|
theme: _propTypes.default.object
|
|
208
176
|
};
|
|
209
177
|
InputField.defaultProps = {
|
|
210
|
-
name:
|
|
211
|
-
type:
|
|
212
|
-
label:
|
|
178
|
+
name: "",
|
|
179
|
+
type: "text",
|
|
180
|
+
label: "",
|
|
213
181
|
contentOnly: false,
|
|
214
|
-
buttonColor:
|
|
215
|
-
dateFormat:
|
|
216
|
-
placeholder:
|
|
217
|
-
defaultContent:
|
|
182
|
+
buttonColor: "default",
|
|
183
|
+
dateFormat: "d. MMMM, yyyy",
|
|
184
|
+
placeholder: "",
|
|
185
|
+
defaultContent: "",
|
|
218
186
|
hasErrors: false,
|
|
219
|
-
errorMessage:
|
|
187
|
+
errorMessage: "",
|
|
220
188
|
mandatory: false,
|
|
221
189
|
onChange: function onChange() {
|
|
222
190
|
return false;
|
|
@@ -15,13 +15,12 @@ Input field example:
|
|
|
15
15
|
<InputField id="textInput10" onChange={() => {console.log('onChange')}} label="InputField without value, contentOnly set to true and defaultContent" contentOnly={true} defaultContent="Please insert a value" />
|
|
16
16
|
<InputField id="fileInput1" onChange={()=>{console.log('onchange')}} type="file" label="InputField with label, value and type set to file" />
|
|
17
17
|
<InputField id="fileInput1" onChange={()=>{console.log('onchange')}} type="file" label="InputField with label, value, fileName, buttonContent and type set to file" selectedFileName="file.txt" buttonContent="Legg til fil" />
|
|
18
|
-
<InputField id="dateInput1" onChange={(date) => console.log("date", date)} type="date" label="
|
|
19
|
-
<InputField id="dateInput2" onChange={(date) => console.log("date", date)} type="date" label="
|
|
20
|
-
<InputField id="dateInput3" onChange={(date) => console.log("date", date)} type="date" label="
|
|
21
|
-
<InputField id="dateInput4" onChange={(date) => console.log("date", date)} type="date" label="
|
|
22
|
-
<InputField id="dateInput5" onChange={(date) => console.log("date", date)} type="date" label="
|
|
23
|
-
<InputField id="dateInput6" onChange={(date) => console.log("date", date)} type="date" label="
|
|
24
|
-
<InputField id="dateInput7" onChange={(date) => console.log("date", date)} type="date" label="Datepicker with defaultContent and contentOnly set to true" contentOnly={true} defaultContent="Please insert a value" />
|
|
18
|
+
<InputField id="dateInput1" onChange={(date) => console.log("date", date)} type="date" label="Date input without value" value="" />
|
|
19
|
+
<InputField id="dateInput2" onChange={(date) => console.log("date", date)} type="date" label="Date input with value" value="2020-05-10" />
|
|
20
|
+
<InputField id="dateInput3" onChange={(date) => console.log("date", date)} type="date" label="Date input with value, errors and error message" value="2020-05-10" hasErrors={true} errorMessage="Wrong date value" />
|
|
21
|
+
<InputField id="dateInput4" onChange={(date) => console.log("date", date)} type="date" label="Date input with value and contentOnly set to true" value="2020-05-10" contentOnly={true} />
|
|
22
|
+
<InputField id="dateInput5" onChange={(date) => console.log("date", date)} type="date" label="Date input with min and max date" value="2020-05-10" selectsStart min="2020-05-04" max="2020-05-19" />
|
|
23
|
+
<InputField id="dateInput6" onChange={(date) => console.log("date", date)} type="date" label="Date input with defaultContent and contentOnly set to true" contentOnly={true} defaultContent="Please insert a value" />
|
|
25
24
|
<InputField id="textInput9" value="InputField with value and custom width" width="400px" />
|
|
26
25
|
<InputField id="textInput10" value="InputField with a not auto generated key" elementKey="inputKeyHere" />
|
|
27
26
|
```
|
|
@@ -34,7 +33,7 @@ import customTheme from 'data/customTheme';
|
|
|
34
33
|
<InputField id="themedTextInput4" onChange={()=>{console.log('onchange')}} value="InputField with link in label" label={['InputField with ', <a key="labelLink" href="#">link</a>, ' in label']} theme={customTheme} />
|
|
35
34
|
<InputField id="themedTextInput5" onChange={()=>{console.log('onchange')}} value="InputField with label, value, errors and error message" label="InputField with label, value, errors and error message" hasErrors={true} errorMessage="Wrong value" theme={customTheme} />
|
|
36
35
|
<InputField id="themedFileInput1" onChange={()=>{console.log('onchange')}} type="file" label="InputField with label, value, fileName, buttonContent and type set to file" selectedFileName="file.txt" buttonContent="Legg til fil" theme={customTheme} />
|
|
37
|
-
<InputField id="themedDateInput3" onChange={(date) => console.log("date", date)} type="date" label="
|
|
36
|
+
<InputField id="themedDateInput3" onChange={(date) => console.log("date", date)} type="date" label="Date input with value, errors and error message" value="2020-05-10" hasErrors={true} errorMessage="Wrong date value" theme={customTheme} />
|
|
38
37
|
<InputField id="themedDateInput4" value="InputField with value, error and custom width" width="420px" hasErrors={true} theme={customTheme} errorMessage="Wrong value" />
|
|
39
38
|
|
|
40
39
|
</React.Fragment>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import "../style/global.scss";
|
|
2
|
+
|
|
1
3
|
:local(.label) {
|
|
2
4
|
color: #000;
|
|
3
5
|
display: block;
|
|
@@ -5,7 +7,7 @@
|
|
|
5
7
|
font-weight: bold;
|
|
6
8
|
line-height: 1.2;
|
|
7
9
|
margin-bottom: 2px;
|
|
8
|
-
font-family:
|
|
10
|
+
font-family: $default-font;
|
|
9
11
|
overflow-wrap: break-word;
|
|
10
12
|
&:local(.inline) {
|
|
11
13
|
display: inline-block;
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
color: #fff;
|
|
108
108
|
text-transform: uppercase;
|
|
109
109
|
text-decoration: none;
|
|
110
|
-
font-family:
|
|
110
|
+
font-family: $default-font;
|
|
111
111
|
padding: 10px 0;
|
|
112
112
|
display: block;
|
|
113
113
|
border-bottom: 1px solid $color-primary;
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
color: #fff;
|
|
124
124
|
text-transform: none;
|
|
125
125
|
text-decoration: none;
|
|
126
|
-
font-family:
|
|
126
|
+
font-family: $default-font;
|
|
127
127
|
padding: 10px 0;
|
|
128
128
|
margin-left: 20px;
|
|
129
129
|
display: block;
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "DragAndDropFileInput", {
|
|
|
57
57
|
return _DragAndDropFileInput.default;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "ErrorBox", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _ErrorBox.default;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
Object.defineProperty(exports, "ErrorMessage", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function get() {
|
|
@@ -184,6 +190,8 @@ var _Dialog = _interopRequireDefault(require("./components/Dialog"));
|
|
|
184
190
|
|
|
185
191
|
var _DragAndDropFileInput = _interopRequireDefault(require("./components/DragAndDropFileInput"));
|
|
186
192
|
|
|
193
|
+
var _ErrorBox = _interopRequireDefault(require("./components/ErrorBox"));
|
|
194
|
+
|
|
187
195
|
var _ErrorMessage = _interopRequireDefault(require("./components/ErrorMessage"));
|
|
188
196
|
|
|
189
197
|
var _Footer = _interopRequireDefault(require("./components/Footer"));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
$default-font: "Open Sans";
|
|
1
|
+
$default-font: "Open Sans", arial, sans-serif;
|
|
2
2
|
$heading-font: "Altis"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dibk-design",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"prop-types": "^15.6.2",
|
|
13
13
|
"react": "^17.0.1",
|
|
14
|
-
"react-datepicker": "^4.1.1",
|
|
15
14
|
"react-dom": "^17.0.1",
|
|
16
15
|
"react-router-dom": "^6.2.2",
|
|
17
16
|
"react-scripts": "^4.0.0"
|