dibk-design 7.2.2 → 7.4.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/Accordion.js +2 -2
- package/dist/components/Button.js +19 -12
- package/dist/components/CheckBoxIcon.js +1 -1
- package/dist/components/CheckBoxInput.js +1 -1
- package/dist/components/CheckBoxList.js +4 -3
- package/dist/components/Container.js +2 -1
- package/dist/components/ContentBox.js +2 -1
- package/dist/components/DescriptionList.js +1 -1
- package/dist/components/Dialog.js +4 -3
- package/dist/components/DragAndDropFileInput.js +5 -4
- package/dist/components/ErrorMessage.js +4 -2
- package/dist/components/Header.js +6 -5
- package/dist/components/InputField.js +16 -11
- package/dist/components/Label.js +11 -8
- package/dist/components/List.js +2 -2
- package/dist/components/NavigationBar.js +8 -7
- package/dist/components/PDF.scss +144 -8
- package/dist/components/Paper.js +1 -1
- package/dist/components/ProgressBar.js +1 -1
- package/dist/components/RadioButtonIcon.js +1 -1
- package/dist/components/RadioButtonInput.js +1 -1
- package/dist/components/RadioButtonList.js +4 -3
- package/dist/components/Select.js +18 -16
- package/dist/components/Table.js +2 -2
- package/dist/components/Textarea.js +15 -12
- package/dist/components/Theme.js +1 -1
- package/dist/components/ThemeProvider.js +1 -1
- package/dist/components/ToggleNavigationButton.js +7 -3
- package/dist/components/WizardNavigation.js +4 -3
- package/dist/functions/helpers.js +22 -18
- package/dist/functions/theme.js +3 -3
- package/dist/style/pdf.css +128 -2
- package/dist/style/pdf.css.map +1 -1
- package/package.json +1 -1
|
@@ -33,14 +33,14 @@ const Accordion = props => {
|
|
|
33
33
|
}), _react.default.createElement("span", {
|
|
34
34
|
className: _AccordionModule.default.panelText
|
|
35
35
|
}, props.title), _react.default.createElement("span", {
|
|
36
|
-
className:
|
|
36
|
+
className: "".concat(_AccordionModule.default.panelChevron, " ").concat(expanded ? _AccordionModule.default.expanded : "")
|
|
37
37
|
}));
|
|
38
38
|
};
|
|
39
39
|
const className = (0, _helpers.classNameArrayToClassNameString)([_AccordionModule.default.accordion, props.color && _AccordionModule.default[props.color], !props.noMargin && _AccordionModule.default.margin]);
|
|
40
40
|
return _react.default.createElement("div", {
|
|
41
41
|
className: className
|
|
42
42
|
}, renderPanel(), _react.default.createElement("div", {
|
|
43
|
-
className:
|
|
43
|
+
className: "".concat(_AccordionModule.default.content, " ").concat(initialized ? _AccordionModule.default.initialized : "", " ").concat(expanded ? _AccordionModule.default.expanded : "")
|
|
44
44
|
}, props.children));
|
|
45
45
|
};
|
|
46
46
|
Accordion.propTypes = {
|
|
@@ -13,7 +13,13 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
21
|
const Button = props => {
|
|
22
|
+
var _props$href, _props$href2, _props$children;
|
|
17
23
|
const getArrowClass = arrow => {
|
|
18
24
|
switch (arrow) {
|
|
19
25
|
case "left":
|
|
@@ -24,11 +30,10 @@ const Button = props => {
|
|
|
24
30
|
return "";
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
|
-
let buttonProps = {
|
|
28
|
-
...props,
|
|
33
|
+
let buttonProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
29
34
|
"aria-invalid": props.hasErrors || null,
|
|
30
|
-
href: !props.disabled && props.href
|
|
31
|
-
};
|
|
35
|
+
href: !props.disabled && (_props$href = props.href) !== null && _props$href !== void 0 && _props$href.length ? props.href : null
|
|
36
|
+
});
|
|
32
37
|
delete buttonProps.noHover;
|
|
33
38
|
delete buttonProps.hasErrors;
|
|
34
39
|
delete buttonProps.rounded;
|
|
@@ -37,21 +42,23 @@ const Button = props => {
|
|
|
37
42
|
delete buttonProps.content;
|
|
38
43
|
delete buttonProps.arrow;
|
|
39
44
|
delete buttonProps.noMargin;
|
|
40
|
-
const buttonColor = props
|
|
41
|
-
const className = (0, _helpers.classNameArrayToClassNameString)([_ButtonModule.default.button, _ButtonModule.default[buttonColor], _ButtonModule.default[props.size], getArrowClass(props.arrow), props.noHover || props
|
|
45
|
+
const buttonColor = (props === null || props === void 0 ? void 0 : props.inputType) === "radio" ? props.defaultChecked ? "primary" : "secondary" : props.color;
|
|
46
|
+
const className = (0, _helpers.classNameArrayToClassNameString)([_ButtonModule.default.button, _ButtonModule.default[buttonColor], _ButtonModule.default[props.size], getArrowClass(props.arrow), props.noHover || (props === null || props === void 0 ? void 0 : props.inputType) === "radio" ? _ButtonModule.default.noHover : null, props.rounded && _ButtonModule.default.rounded, props.hasErrors && _ButtonModule.default.hasErrors, props.disabled && _ButtonModule.default.disabled, props.noMargin && _ButtonModule.default.noMargin]);
|
|
42
47
|
const renderReactLinkElements = childElements => {
|
|
43
48
|
const childElementsthroughFragments = (0, _helpers.cloneThroughFragments)(childElements);
|
|
44
49
|
return childElementsthroughFragments.map((childElement, index) => {
|
|
45
|
-
|
|
50
|
+
var _childElement$props;
|
|
51
|
+
if (!buttonProps.disabled && !!(childElement !== null && childElement !== void 0 && (_childElement$props = childElement.props) !== null && _childElement$props !== void 0 && _childElement$props.to)) {
|
|
52
|
+
var _childElement$props2, _childElement$props3;
|
|
46
53
|
const childElementCopy = _react.default.cloneElement(childElement, {
|
|
47
54
|
className: className,
|
|
48
|
-
key:
|
|
49
|
-
to: !buttonProps.disabled && childElement
|
|
55
|
+
key: "button-".concat(index),
|
|
56
|
+
to: !buttonProps.disabled && childElement !== null && childElement !== void 0 && (_childElement$props2 = childElement.props) !== null && _childElement$props2 !== void 0 && _childElement$props2.to ? childElement === null || childElement === void 0 || (_childElement$props3 = childElement.props) === null || _childElement$props3 === void 0 ? void 0 : _childElement$props3.to : null
|
|
50
57
|
});
|
|
51
58
|
return childElementCopy;
|
|
52
59
|
} else {
|
|
53
60
|
return _react.default.createElement("button", _extends({}, buttonProps, {
|
|
54
|
-
key:
|
|
61
|
+
key: "button-".concat(index),
|
|
55
62
|
className: className
|
|
56
63
|
}), props.content || childElement.props.children);
|
|
57
64
|
}
|
|
@@ -69,11 +76,11 @@ const Button = props => {
|
|
|
69
76
|
}, _react.default.createElement("input", _extends({}, buttonProps, {
|
|
70
77
|
type: "radio"
|
|
71
78
|
})), props.content);
|
|
72
|
-
} else if (props.href
|
|
79
|
+
} else if ((_props$href2 = props.href) !== null && _props$href2 !== void 0 && _props$href2.length && !props.disabled) {
|
|
73
80
|
return _react.default.createElement("a", _extends({}, buttonProps, {
|
|
74
81
|
className: className
|
|
75
82
|
}), props.content || props.children);
|
|
76
|
-
} else if (props
|
|
83
|
+
} else if ((props === null || props === void 0 || (_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === _reactRouterDom.Link) {
|
|
77
84
|
return _react.default.createElement(_react.Fragment, null, renderReactLinkElements(_react.default.Children.toArray(props.children)));
|
|
78
85
|
} else {
|
|
79
86
|
return _react.default.createElement("button", _extends({}, buttonProps, {
|
|
@@ -15,7 +15,7 @@ const CheckBoxIcon = props => {
|
|
|
15
15
|
fontSize: props.size
|
|
16
16
|
};
|
|
17
17
|
const checkBoxIconProps = {
|
|
18
|
-
className:
|
|
18
|
+
className: "".concat(_CheckBoxIconModule.default.checkBoxIcon, " ").concat(props.checked ? _CheckBoxIconModule.default.checked : "", " ").concat(props.disabled ? _CheckBoxIconModule.default.disabled : "", " ").concat(props.showBox ? _CheckBoxIconModule.default.showBox : "", " ").concat(props.hasErrors ? _CheckBoxIconModule.default.hasErrors : ""),
|
|
19
19
|
style: inlineStyle
|
|
20
20
|
};
|
|
21
21
|
return _react.default.createElement("span", checkBoxIconProps, _react.default.createElement("span", {
|
|
@@ -12,7 +12,7 @@ var _CheckBoxInputModule = _interopRequireDefault(require("./CheckBoxInput.modul
|
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
const CheckBoxInput = props => {
|
|
14
14
|
const labelProps = {
|
|
15
|
-
className:
|
|
15
|
+
className: "".concat(_CheckBoxInputModule.default.checkBoxInput, " ").concat(props.contentOnly ? _CheckBoxInputModule.default.contentOnly : "", " ").concat(props.disabled ? _CheckBoxInputModule.default.disabled : "", " ").concat(props.hasErrors ? _CheckBoxInputModule.default.hasErrors : ""),
|
|
16
16
|
htmlFor: props.id
|
|
17
17
|
};
|
|
18
18
|
const iconProps = {
|
|
@@ -22,12 +22,13 @@ const CheckBoxList = _ref => {
|
|
|
22
22
|
const renderChildElements = childElements => {
|
|
23
23
|
const childElementsthroughFragments = (0, _helpers.cloneThroughFragments)(childElements);
|
|
24
24
|
return childElementsthroughFragments.map((childElement, index) => {
|
|
25
|
-
|
|
25
|
+
var _childElement$props;
|
|
26
|
+
const isCheckBoxListItem = (childElement === null || childElement === void 0 || (_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : _childElement$props.type) === "CheckBoxListItem";
|
|
26
27
|
if (isCheckBoxListItem) {
|
|
27
28
|
const childElementCopy = _react.default.cloneElement(childElement, {
|
|
28
29
|
requiredGroup: required,
|
|
29
30
|
compact: compact,
|
|
30
|
-
key:
|
|
31
|
+
key: "checkboxListItem-".concat(index)
|
|
31
32
|
});
|
|
32
33
|
return childElementCopy;
|
|
33
34
|
} else {
|
|
@@ -37,7 +38,7 @@ const CheckBoxList = _ref => {
|
|
|
37
38
|
};
|
|
38
39
|
return _react.default.createElement("fieldset", {
|
|
39
40
|
className: _CheckBoxListModule.default.checkBoxList
|
|
40
|
-
}, !!legend
|
|
41
|
+
}, !!(legend !== null && legend !== void 0 && legend.length) ? _react.default.createElement("legend", null, legendSize ? _react.default.createElement(_Header.default, {
|
|
41
42
|
size: legendSize
|
|
42
43
|
}, legend) : legend, required && _react.default.createElement("img", {
|
|
43
44
|
src: _asterisk.default,
|
|
@@ -9,8 +9,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _ContainerModule = _interopRequireDefault(require("./Container.module.scss"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const Container = props => {
|
|
12
|
+
var _props$maxWidth;
|
|
12
13
|
const styleProps = {
|
|
13
|
-
"--max-width": props
|
|
14
|
+
"--max-width": (props === null || props === void 0 || (_props$maxWidth = props.maxWidth) === null || _props$maxWidth === void 0 ? void 0 : _props$maxWidth.length) && props.maxWidth
|
|
14
15
|
};
|
|
15
16
|
return _react.default.createElement("div", {
|
|
16
17
|
className: _ContainerModule.default.container,
|
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _ContentBoxModule = _interopRequireDefault(require("./ContentBox.module.scss"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const ContentBox = props => {
|
|
12
|
+
var _props$content;
|
|
12
13
|
const renderTitle = () => {
|
|
13
14
|
let className = _ContentBoxModule.default.title + " " + _ContentBoxModule.default[props.titleSize];
|
|
14
15
|
if (props.title) {
|
|
@@ -22,7 +23,7 @@ const ContentBox = props => {
|
|
|
22
23
|
let colorClass = " " + _ContentBoxModule.default[props.color];
|
|
23
24
|
let linkClass = props.href ? " " + _ContentBoxModule.default.link : "";
|
|
24
25
|
let className = _ContentBoxModule.default.contentBox + colorClass + linkClass;
|
|
25
|
-
const bodyContent = props.content
|
|
26
|
+
const bodyContent = (_props$content = props.content) !== null && _props$content !== void 0 && _props$content.length ? props.content : props.children;
|
|
26
27
|
if (props.href) {
|
|
27
28
|
return _react.default.createElement("a", {
|
|
28
29
|
href: props.href,
|
|
@@ -21,7 +21,7 @@ const DescriptionList = _ref => {
|
|
|
21
21
|
const childElementCopy = _react.default.cloneElement(childElement, {
|
|
22
22
|
compact: compact,
|
|
23
23
|
titleWidth: titleWidth,
|
|
24
|
-
key:
|
|
24
|
+
key: "descriptionListItem-".concat(index)
|
|
25
25
|
});
|
|
26
26
|
return childElementCopy;
|
|
27
27
|
});
|
|
@@ -13,6 +13,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
const Dialog = props => {
|
|
16
|
+
var _props$attachTo, _props$maxWidth;
|
|
16
17
|
const dialogRef = (0, _react.useRef)();
|
|
17
18
|
const dialogContainerRef = (0, _react.useRef)();
|
|
18
19
|
const dialogContentRef = (0, _react.useCallback)(element => {
|
|
@@ -32,7 +33,7 @@ const Dialog = props => {
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
const handleClickOutside = event => {
|
|
35
|
-
if (dialogContainerRef
|
|
36
|
+
if (dialogContainerRef !== null && dialogContainerRef !== void 0 && dialogContainerRef.current && !dialogContainerRef.current.contains(event.target)) {
|
|
36
37
|
props.onClickOutside();
|
|
37
38
|
}
|
|
38
39
|
};
|
|
@@ -45,9 +46,9 @@ const Dialog = props => {
|
|
|
45
46
|
props.modal ? dialogRef.current.showModal() : dialogRef.current.show();
|
|
46
47
|
}
|
|
47
48
|
}, [dialogRef, props.hidden, props.modal]);
|
|
48
|
-
const sideBarClassNames = props.attachTo
|
|
49
|
+
const sideBarClassNames = ((_props$attachTo = props.attachTo) === null || _props$attachTo === void 0 ? void 0 : _props$attachTo.length) && (0, _helpers.classNameArrayToClassNameString)([_DialogModule.default.isSidebar, _DialogModule.default[props.attachTo]]);
|
|
49
50
|
const dialogContentStyleProps = {
|
|
50
|
-
"--max-width": props
|
|
51
|
+
"--max-width": (props === null || props === void 0 || (_props$maxWidth = props.maxWidth) === null || _props$maxWidth === void 0 ? void 0 : _props$maxWidth.length) && props.maxWidth
|
|
51
52
|
};
|
|
52
53
|
return _react.default.createElement("dialog", {
|
|
53
54
|
className: (0, _helpers.classNameArrayToClassNameString)([_DialogModule.default.dialog, sideBarClassNames]),
|
|
@@ -16,6 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
18
|
const DragAndDropFileInput = props => {
|
|
19
|
+
var _props$errorMessage, _props$ariaDescribed;
|
|
19
20
|
const [highlight, setHighlight] = (0, _react.useState)(false);
|
|
20
21
|
const containerElementRef = (0, _react.useRef)();
|
|
21
22
|
const fileInputElementRef = (0, _react.useRef)();
|
|
@@ -30,11 +31,11 @@ const DragAndDropFileInput = props => {
|
|
|
30
31
|
fileInputElementRef.current.click();
|
|
31
32
|
};
|
|
32
33
|
const getErrorElementId = () => {
|
|
33
|
-
return
|
|
34
|
+
return "".concat(props.id, "-errorMessage");
|
|
34
35
|
};
|
|
35
36
|
const inputElementProps = {
|
|
36
37
|
id: props.id,
|
|
37
|
-
"aria-describedby": props.hasErrors && !!props.errorMessage
|
|
38
|
+
"aria-describedby": props.hasErrors && !!((_props$errorMessage = props.errorMessage) !== null && _props$errorMessage !== void 0 && _props$errorMessage.length) ? getErrorElementId() : !!((_props$ariaDescribed = props["aria-describedby"]) !== null && _props$ariaDescribed !== void 0 && _props$ariaDescribed.length) ? props["aria-describedby"] : null,
|
|
38
39
|
"aria-invalid": props.hasErrors ? "true" : null,
|
|
39
40
|
name: props.name,
|
|
40
41
|
required: props.required
|
|
@@ -53,7 +54,7 @@ const DragAndDropFileInput = props => {
|
|
|
53
54
|
const files = e.dataTransfer.files;
|
|
54
55
|
handleFiles(files);
|
|
55
56
|
};
|
|
56
|
-
if (containerElementRef
|
|
57
|
+
if (containerElementRef !== null && containerElementRef !== void 0 && containerElementRef.current) {
|
|
57
58
|
containerElementRef.current.addEventListener("dragenter", preventDefaults, false);
|
|
58
59
|
containerElementRef.current.addEventListener("dragover", preventDefaults, false);
|
|
59
60
|
containerElementRef.current.addEventListener("dragleave", preventDefaults, false);
|
|
@@ -83,7 +84,7 @@ const DragAndDropFileInput = props => {
|
|
|
83
84
|
className: _DragAndDropFileInputModule.default.requiredSymbol
|
|
84
85
|
})), _react.default.createElement("div", null, props.children), !props.contentOnly ? _react.default.createElement("div", {
|
|
85
86
|
ref: containerElementRef,
|
|
86
|
-
className:
|
|
87
|
+
className: "".concat(_DragAndDropFileInputModule.default.dragAndDropContainer, " ").concat(highlight ? _DragAndDropFileInputModule.default.highlighted : "")
|
|
87
88
|
}, props.selectedFileName ? _react.default.createElement("div", null, _react.default.createElement("span", null, _react.default.createElement("b", null, "Valgt fil:"), " ", props.selectedFileName)) : _react.default.createElement("div", null, "Slipp fil her"), _react.default.createElement("input", _extends({}, inputElementProps, {
|
|
88
89
|
ref: fileInputElementRef,
|
|
89
90
|
type: "file",
|
|
@@ -11,13 +11,15 @@ var _errorSign = _interopRequireDefault(require("../assets/svg/error-sign.svg?ur
|
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
13
|
const ErrorMessage = props => {
|
|
14
|
+
var _props$content;
|
|
14
15
|
const getErrorElementProps = () => {
|
|
16
|
+
var _props$id;
|
|
15
17
|
return {
|
|
16
|
-
id: !!props.id
|
|
18
|
+
id: !!((_props$id = props.id) !== null && _props$id !== void 0 && _props$id.length) ? props.id : null,
|
|
17
19
|
className: _ErrorMessageModule.default.errorMessage
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
|
-
return props
|
|
22
|
+
return props !== null && props !== void 0 && (_props$content = props.content) !== null && _props$content !== void 0 && _props$content.length ? _react.default.createElement("span", _extends({
|
|
21
23
|
"aria-live": "polite"
|
|
22
24
|
}, getErrorElementProps()), _react.default.createElement("img", {
|
|
23
25
|
src: _errorSign.default,
|
|
@@ -10,18 +10,19 @@ var _HeaderModule = _interopRequireDefault(require("./Header.module.scss"));
|
|
|
10
10
|
var _helpers = require("../functions/helpers");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const Header = props => {
|
|
13
|
+
var _props$htmlTag, _props$label, _props$content;
|
|
13
14
|
const bigClass = props.big ? _HeaderModule.default.bigHeader : "";
|
|
14
|
-
const htmlTag = props.htmlTag
|
|
15
|
+
const htmlTag = (_props$htmlTag = props.htmlTag) !== null && _props$htmlTag !== void 0 && _props$htmlTag.length ? props.htmlTag : "h".concat(props.size);
|
|
15
16
|
const headerClass = _HeaderModule.default.header;
|
|
16
|
-
const headerSizeClass = _HeaderModule.default[
|
|
17
|
+
const headerSizeClass = _HeaderModule.default["size-".concat(props.size)];
|
|
17
18
|
let headerElement = _react.default.createElement(htmlTag, {
|
|
18
19
|
className: (0, _helpers.classNameArrayToClassNameString)([headerClass, headerSizeClass, bigClass]),
|
|
19
20
|
id: props.id || null,
|
|
20
21
|
htmlFor: props.htmlFor || null,
|
|
21
|
-
style: props
|
|
22
|
-
"--label":
|
|
22
|
+
style: props !== null && props !== void 0 && (_props$label = props.label) !== null && _props$label !== void 0 && _props$label.length ? {
|
|
23
|
+
"--label": "\"".concat(props.label, "\"")
|
|
23
24
|
} : null
|
|
24
|
-
}, !!props.content
|
|
25
|
+
}, !!((_props$content = props.content) !== null && _props$content !== void 0 && _props$content.length) ? props.content : props.children);
|
|
25
26
|
return _react.default.createElement("div", {
|
|
26
27
|
className: _HeaderModule.default.headerContainer
|
|
27
28
|
}, " ", headerElement, " ");
|
|
@@ -14,24 +14,31 @@ var _helpers = require("../functions/helpers");
|
|
|
14
14
|
var _asterisk = _interopRequireDefault(require("../assets/svg/asterisk.svg?url"));
|
|
15
15
|
var _InputFieldModule = _interopRequireDefault(require("./InputField.module.scss"));
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
22
|
const InputField = props => {
|
|
23
|
+
var _props$width;
|
|
18
24
|
const formatDate = inputDate => {
|
|
19
25
|
if (!inputDate) {
|
|
20
26
|
return null;
|
|
21
27
|
}
|
|
22
28
|
const date = new Date(inputDate);
|
|
23
29
|
const year = date.getFullYear();
|
|
24
|
-
const month = date.getMonth() + 1 < 10 ?
|
|
25
|
-
const day = date.getDate() < 10 ?
|
|
26
|
-
return
|
|
30
|
+
const month = date.getMonth() + 1 < 10 ? "0".concat(date.getMonth() + 1) : date.getMonth() + 1;
|
|
31
|
+
const day = date.getDate() < 10 ? "0".concat(date.getDate()) : date.getDate();
|
|
32
|
+
return "".concat(day, ".").concat(month, ".").concat(year);
|
|
27
33
|
};
|
|
28
34
|
const renderValueAsText = (value, defaultContent) => {
|
|
29
35
|
return props.type === "date" ? value ? formatDate(value) : defaultContent : value ? value : defaultContent;
|
|
30
36
|
};
|
|
31
37
|
const getErrorElementId = () => {
|
|
32
|
-
return
|
|
38
|
+
return "".concat(props.id, "-errorMessage");
|
|
33
39
|
};
|
|
34
40
|
const getInputElementProps = (defaultValue, defaultKey, styleRules) => {
|
|
41
|
+
var _props$errorMessage, _props$ariaDescribed;
|
|
35
42
|
return {
|
|
36
43
|
name: props.name,
|
|
37
44
|
readOnly: props.readOnly,
|
|
@@ -40,7 +47,7 @@ const InputField = props => {
|
|
|
40
47
|
type: props.type,
|
|
41
48
|
role: props.role,
|
|
42
49
|
id: props.id,
|
|
43
|
-
key: defaultKey ||
|
|
50
|
+
key: defaultKey || "".concat(props.id, "-").concat((0, _generators.generateRandomString)(6)),
|
|
44
51
|
min: props.min || null,
|
|
45
52
|
max: props.max || null,
|
|
46
53
|
onChange: props.onChange,
|
|
@@ -48,7 +55,7 @@ const InputField = props => {
|
|
|
48
55
|
[defaultValue ? "defaultValue" : "value"]: defaultValue || props.value,
|
|
49
56
|
placeholder: props.placeholder || null,
|
|
50
57
|
className: props.hasErrors ? _InputFieldModule.default.hasErrors : null,
|
|
51
|
-
"aria-describedby": props.hasErrors && !!props.errorMessage
|
|
58
|
+
"aria-describedby": props.hasErrors && !!((_props$errorMessage = props.errorMessage) !== null && _props$errorMessage !== void 0 && _props$errorMessage.length) ? getErrorElementId() : !!((_props$ariaDescribed = props["aria-describedby"]) !== null && _props$ariaDescribed !== void 0 && _props$ariaDescribed.length) ? props["aria-describedby"] : null,
|
|
52
59
|
"aria-invalid": props.hasErrors ? "true" : null,
|
|
53
60
|
"aria-autocomplete": props["aria-autocomplete"] || null,
|
|
54
61
|
style: styleRules
|
|
@@ -56,11 +63,9 @@ const InputField = props => {
|
|
|
56
63
|
};
|
|
57
64
|
const defaultValue = props.defaultValue ? props.defaultValue : props.value || null;
|
|
58
65
|
const defaultKey = props.elementKey || null;
|
|
59
|
-
const styleRules = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
};
|
|
66
|
+
const styleRules = _objectSpread({}, ((_props$width = props.width) === null || _props$width === void 0 ? void 0 : _props$width.length) && {
|
|
67
|
+
maxWidth: props.width
|
|
68
|
+
});
|
|
64
69
|
return _react.default.createElement("div", {
|
|
65
70
|
className: (0, _helpers.classNameArrayToClassNameString)([_InputFieldModule.default.inputField, _InputFieldModule.default[props.type], props.noMargin && _InputFieldModule.default.noMargin])
|
|
66
71
|
}, _react.default.createElement(_Label.default, {
|
package/dist/components/Label.js
CHANGED
|
@@ -8,20 +8,23 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _LabelModule = _interopRequireDefault(require("./Label.module.scss"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
16
|
const Label = props => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const htmlTag = props.htmlTag?.length ? props.htmlTag : "label";
|
|
17
|
+
var _props$htmlTag;
|
|
18
|
+
let labelProps = _objectSpread({}, props);
|
|
19
|
+
const htmlTag = (_props$htmlTag = props.htmlTag) !== null && _props$htmlTag !== void 0 && _props$htmlTag.length ? props.htmlTag : "label";
|
|
16
20
|
delete labelProps.inline;
|
|
17
21
|
delete labelProps.normalCursor;
|
|
18
22
|
delete labelProps.htmlTag;
|
|
19
|
-
const className =
|
|
20
|
-
const labelElement = _react.default.createElement(htmlTag, {
|
|
21
|
-
...labelProps,
|
|
23
|
+
const className = "".concat(_LabelModule.default.label, " ").concat(props.inline ? _LabelModule.default.inline : "", " ").concat(props.normalCursor ? _LabelModule.default.normalCursor : "");
|
|
24
|
+
const labelElement = _react.default.createElement(htmlTag, _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
22
25
|
className,
|
|
23
26
|
id: props.id || null
|
|
24
|
-
}, props.children);
|
|
27
|
+
}), props.children);
|
|
25
28
|
return labelElement;
|
|
26
29
|
};
|
|
27
30
|
Label.propTypes = {
|
package/dist/components/List.js
CHANGED
|
@@ -15,7 +15,7 @@ const List = props => {
|
|
|
15
15
|
return childElementsthroughFragments.map((childElement, index) => {
|
|
16
16
|
const childElementCopy = _react.default.cloneElement(childElement, {
|
|
17
17
|
compact: props.compact,
|
|
18
|
-
key:
|
|
18
|
+
key: "listItem-".concat(index)
|
|
19
19
|
});
|
|
20
20
|
return childElementCopy;
|
|
21
21
|
});
|
|
@@ -25,7 +25,7 @@ const List = props => {
|
|
|
25
25
|
const defaultListStyle = props.ordered ? "decimal" : "disc";
|
|
26
26
|
const scssValueProperty = "--listStyle";
|
|
27
27
|
let listElement = _react.default.createElement(listType, {
|
|
28
|
-
className:
|
|
28
|
+
className: "".concat(_ListModule.default.list, " ").concat(!!props.compact ? _ListModule.default.compact : ""),
|
|
29
29
|
style: {
|
|
30
30
|
[scssValueProperty]: props.listStyle || defaultListStyle
|
|
31
31
|
}
|
|
@@ -17,6 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
19
|
const NavigationBar = props => {
|
|
20
|
+
var _props$primaryListIte, _props$secondaryListI, _props$mainContentId;
|
|
20
21
|
const [active, setActive] = (0, _react.useState)(false);
|
|
21
22
|
const toggleList = () => {
|
|
22
23
|
setActive(!active);
|
|
@@ -43,7 +44,7 @@ const NavigationBar = props => {
|
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
|
-
return !!listItems
|
|
47
|
+
return !!(listItems !== null && listItems !== void 0 && listItems.length) && _react.default.createElement("ul", {
|
|
47
48
|
className: _NavigationBarModule.default.primaryList
|
|
48
49
|
}, listItems);
|
|
49
50
|
};
|
|
@@ -55,7 +56,7 @@ const NavigationBar = props => {
|
|
|
55
56
|
theme: props.theme
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
|
-
return !!listItems
|
|
59
|
+
return !!(listItems !== null && listItems !== void 0 && listItems.length) && _react.default.createElement("ul", {
|
|
59
60
|
className: _NavigationBarModule.default.secondaryList
|
|
60
61
|
}, listItems);
|
|
61
62
|
};
|
|
@@ -66,7 +67,7 @@ const NavigationBar = props => {
|
|
|
66
67
|
if (logoLink && logoLinkTitle) {
|
|
67
68
|
return "";
|
|
68
69
|
} else if (themeLogo && themeAppName) {
|
|
69
|
-
return
|
|
70
|
+
return "".concat(themeAppName, " logo");
|
|
70
71
|
} else {
|
|
71
72
|
return "DIBK logo";
|
|
72
73
|
}
|
|
@@ -91,12 +92,12 @@ const NavigationBar = props => {
|
|
|
91
92
|
title: logoLinkTitle
|
|
92
93
|
}), renderLogoElement()) : renderLogoElement();
|
|
93
94
|
};
|
|
94
|
-
const hasListItems = !!props.primaryListItems
|
|
95
|
+
const hasListItems = !!((_props$primaryListIte = props.primaryListItems) !== null && _props$primaryListIte !== void 0 && _props$primaryListIte.length) || !!((_props$secondaryListI = props.secondaryListItems) !== null && _props$secondaryListI !== void 0 && _props$secondaryListI.length);
|
|
95
96
|
return _react.default.createElement("div", {
|
|
96
97
|
className: (0, _helpers.classNameArrayToClassNameString)([props.compact && _NavigationBarModule.default.compact, _NavigationBarModule.default.navigationBarContainer])
|
|
97
|
-
}, props.mainContentId
|
|
98
|
+
}, ((_props$mainContentId = props.mainContentId) === null || _props$mainContentId === void 0 ? void 0 : _props$mainContentId.length) && _react.default.createElement("a", {
|
|
98
99
|
id: "main-content-link",
|
|
99
|
-
href:
|
|
100
|
+
href: "#".concat(props.mainContentId),
|
|
100
101
|
className: _NavigationBarModule.default.mainContentLink
|
|
101
102
|
}, _react.default.createElement("span", {
|
|
102
103
|
id: "main-content-link-text"
|
|
@@ -108,7 +109,7 @@ const NavigationBar = props => {
|
|
|
108
109
|
className: _NavigationBarModule.default.childElements
|
|
109
110
|
}, props.children), hasListItems && _react.default.createElement("button", {
|
|
110
111
|
type: "button",
|
|
111
|
-
className:
|
|
112
|
+
className: "".concat(_NavigationBarModule.default.menuToggle, " ").concat(active ? _NavigationBarModule.default.active : ""),
|
|
112
113
|
onClick: () => toggleList(),
|
|
113
114
|
"aria-expanded": active ? "true" : "false",
|
|
114
115
|
"aria-controls": "main-menu-dropdown"
|