@uncinc/uncinc-react-kitchen-sink 2.24.0 → 2.25.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/Download/index.d.ts +1 -0
- package/dist/components/Download/index.js +50 -21
- package/dist/components/Form/Select/Input/index.js +43 -4
- package/dist/components/Form/Select/Input/style.scss +22 -1
- package/dist/organisms/Downloads/index.d.ts +5 -0
- package/dist/organisms/Downloads/index.js +14 -2
- package/package.json +1 -1
|
@@ -8,20 +8,37 @@ import React from 'react';
|
|
|
8
8
|
import c from 'classnames';
|
|
9
9
|
import prettyBytes from 'pretty-bytes';
|
|
10
10
|
import Icon from '../Icon';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className
|
|
11
|
+
import Image from '../Image';
|
|
12
|
+
var DownloadIcon = function DownloadIcon(_ref) {
|
|
13
|
+
var materialIconName = _ref.materialIconName,
|
|
14
|
+
mimeType = _ref.mimeType,
|
|
15
|
+
mimeSubType = _ref.mimeSubType;
|
|
16
|
+
if (materialIconName) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
className: "Download__icon Icon-".concat(mimeType, " Icon-").concat(mimeSubType),
|
|
19
|
+
name: materialIconName,
|
|
20
|
+
flair: "outlined"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
24
|
+
className: "Download__icon icon icon-download icon-".concat(mimeType, " icon-").concat(mimeSubType)
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var Download = function Download(_ref2) {
|
|
28
|
+
var source = _ref2.source,
|
|
29
|
+
title = _ref2.title,
|
|
30
|
+
image = _ref2.image,
|
|
31
|
+
_ref2$description = _ref2.description,
|
|
32
|
+
description = _ref2$description === void 0 ? null : _ref2$description,
|
|
33
|
+
_ref2$filesize = _ref2.filesize,
|
|
34
|
+
filesize = _ref2$filesize === void 0 ? null : _ref2$filesize,
|
|
35
|
+
_ref2$filename = _ref2.filename,
|
|
36
|
+
filename = _ref2$filename === void 0 ? '' : _ref2$filename,
|
|
37
|
+
materialIconName = _ref2.materialIconName,
|
|
38
|
+
mime = _ref2.mime,
|
|
39
|
+
_ref2$target = _ref2.target,
|
|
40
|
+
target = _ref2$target === void 0 ? '_self' : _ref2$target,
|
|
41
|
+
className = _ref2.className;
|
|
25
42
|
var classes = c('Download', className);
|
|
26
43
|
var _mime$split = mime.split('/'),
|
|
27
44
|
_mime$split2 = _slicedToArray(_mime$split, 2),
|
|
@@ -33,12 +50,20 @@ var Download = function Download(_ref) {
|
|
|
33
50
|
target: target,
|
|
34
51
|
href: source,
|
|
35
52
|
rel: "noreferrer"
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
className: "
|
|
53
|
+
}, image ?
|
|
54
|
+
/*#__PURE__*/
|
|
55
|
+
// Thumbnail image is decorative: alt="" hides it from screen readers
|
|
56
|
+
// role="presentation" removes any implicit role from the element
|
|
57
|
+
React.createElement("div", {
|
|
58
|
+
className: "Download__image"
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
60
|
+
src: image,
|
|
61
|
+
alt: "",
|
|
62
|
+
role: "presentation"
|
|
63
|
+
})) : /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
64
|
+
materialIconName: materialIconName,
|
|
65
|
+
mimeType: mimeType,
|
|
66
|
+
mimeSubType: mimeSubType
|
|
42
67
|
}), /*#__PURE__*/React.createElement("div", {
|
|
43
68
|
className: "Download__content"
|
|
44
69
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -51,6 +76,10 @@ var Download = function Download(_ref) {
|
|
|
51
76
|
className: "Download__extension"
|
|
52
77
|
}, extension[0], "\xA0"), filesize && /*#__PURE__*/React.createElement("span", {
|
|
53
78
|
className: "Download__filesize"
|
|
54
|
-
}, "(", prettyBytes(filesize), ")"))
|
|
79
|
+
}, "(", prettyBytes(filesize), ")")), image && /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
80
|
+
materialIconName: materialIconName,
|
|
81
|
+
mimeType: mimeType,
|
|
82
|
+
mimeSubType: mimeSubType
|
|
83
|
+
}));
|
|
55
84
|
};
|
|
56
85
|
export default Download;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
var _excluded = ["fieldName", "id", "validation", "defaultValue", "onChange", "options", "placeholder", "disabled", "className", "wrapperClassName", "isClearable", "isSearchable", "multiple", "size", "required"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
11
|
import React from 'react';
|
|
6
|
-
import SelectStyled from 'react-select';
|
|
12
|
+
import SelectStyled, { components as ReactSelectComponents } from 'react-select';
|
|
7
13
|
import c from 'classnames';
|
|
8
14
|
import { Field } from 'formik';
|
|
9
15
|
import { useTranslation } from 'react-i18next';
|
|
@@ -21,6 +27,35 @@ var SelectInputOption = function SelectInputOption(props) {
|
|
|
21
27
|
})
|
|
22
28
|
);
|
|
23
29
|
};
|
|
30
|
+
|
|
31
|
+
// react-select renders the clear button as aria-hidden div by default.
|
|
32
|
+
// Replace it with a proper <button> so keyboard users can reach it.
|
|
33
|
+
var ClearIndicator = function ClearIndicator(_ref) {
|
|
34
|
+
var _ref$innerProps = _ref.innerProps,
|
|
35
|
+
onMouseDown = _ref$innerProps.onMouseDown,
|
|
36
|
+
onTouchEnd = _ref$innerProps.onTouchEnd,
|
|
37
|
+
selectProps = _ref.selectProps;
|
|
38
|
+
var _useTranslation = useTranslation(),
|
|
39
|
+
t = _useTranslation.t;
|
|
40
|
+
var selectedValue = selectProps === null || selectProps === void 0 ? void 0 : selectProps.value;
|
|
41
|
+
var selectedLabel = Array.isArray(selectedValue) ? selectedValue.map(function (v) {
|
|
42
|
+
return v.label;
|
|
43
|
+
}).join(', ') : selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label;
|
|
44
|
+
var ariaLabel = selectedLabel ? t('select.clear_with_value', {
|
|
45
|
+
value: selectedLabel,
|
|
46
|
+
defaultValue: "Wis de zoekopdracht, met ".concat(selectedLabel)
|
|
47
|
+
}) : (selectProps === null || selectProps === void 0 ? void 0 : selectProps.clearLabel) || t('select.clear', {
|
|
48
|
+
defaultValue: 'Wissen'
|
|
49
|
+
});
|
|
50
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
className: "Select__inner__indicator Select__inner__clear-indicator",
|
|
53
|
+
onMouseDown: onMouseDown,
|
|
54
|
+
onTouchEnd: onTouchEnd,
|
|
55
|
+
onClick: onMouseDown,
|
|
56
|
+
"aria-label": ariaLabel
|
|
57
|
+
}, /*#__PURE__*/React.createElement(ReactSelectComponents.CrossIcon, null));
|
|
58
|
+
};
|
|
24
59
|
var SelectInput = function SelectInput(props) {
|
|
25
60
|
var fieldName = props.fieldName,
|
|
26
61
|
id = props.id,
|
|
@@ -45,8 +80,8 @@ var SelectInput = function SelectInput(props) {
|
|
|
45
80
|
var _useExtendedFormikCon = useExtendedFormikContext(),
|
|
46
81
|
values = _useExtendedFormikCon.values,
|
|
47
82
|
setFieldValue = _useExtendedFormikCon.setFieldValue;
|
|
48
|
-
var
|
|
49
|
-
t =
|
|
83
|
+
var _useTranslation2 = useTranslation(),
|
|
84
|
+
t = _useTranslation2.t;
|
|
50
85
|
var value = getNestedFieldvalue(fieldName, values);
|
|
51
86
|
|
|
52
87
|
// Check if options is [{value, label}] or {value: label}.
|
|
@@ -89,7 +124,11 @@ var SelectInput = function SelectInput(props) {
|
|
|
89
124
|
value: value,
|
|
90
125
|
validate: handleValidation
|
|
91
126
|
}, function () {
|
|
92
|
-
return /*#__PURE__*/React.createElement(SelectStyled, _extends({
|
|
127
|
+
return /*#__PURE__*/React.createElement(SelectStyled, _extends({
|
|
128
|
+
components: _objectSpread({
|
|
129
|
+
ClearIndicator: ClearIndicator
|
|
130
|
+
}, restProps.components)
|
|
131
|
+
}, restProps, {
|
|
93
132
|
id: id,
|
|
94
133
|
inputId: fieldName,
|
|
95
134
|
className: c('Select__select', className),
|
|
@@ -1,28 +1,49 @@
|
|
|
1
1
|
@import '../../../../styles/assets/variables';
|
|
2
2
|
@import '../../../../styles/assets/mixins';
|
|
3
3
|
|
|
4
|
+
.Select__inner__clear-indicator {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
padding: 0 0.8rem;
|
|
8
|
+
background: none;
|
|
9
|
+
border: 0;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
color: var(--color--primary, #{$color--primary});
|
|
12
|
+
|
|
13
|
+
&:focus-visible {
|
|
14
|
+
z-index: 1;
|
|
15
|
+
outline: 0.2rem solid var(--border--color--focus);
|
|
16
|
+
outline-offset: 0;
|
|
17
|
+
border-radius: 2px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
4
21
|
.Select {
|
|
5
22
|
&__inner {
|
|
23
|
+
|
|
6
24
|
&__control {
|
|
7
25
|
border-radius: 0;
|
|
26
|
+
|
|
8
27
|
&--menu-is-open,
|
|
9
28
|
&--is-focused {
|
|
10
29
|
border-color: inherit;
|
|
11
30
|
box-shadow: none;
|
|
31
|
+
|
|
12
32
|
&:hover,
|
|
13
33
|
&:focus {
|
|
14
34
|
border-color: inherit;
|
|
15
35
|
box-shadow: none;
|
|
16
36
|
}
|
|
17
|
-
|
|
18
37
|
}
|
|
19
38
|
}
|
|
39
|
+
|
|
20
40
|
&__option {
|
|
21
41
|
&--is-selected {
|
|
22
42
|
background-color: transparent;
|
|
23
43
|
color: $color--primary;
|
|
24
44
|
}
|
|
25
45
|
}
|
|
46
|
+
|
|
26
47
|
&__menu {
|
|
27
48
|
border-radius: 0;
|
|
28
49
|
margin-top: 0;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DownloadProps } from '../../components/Download';
|
|
3
|
+
export interface LinkProps {
|
|
4
|
+
href: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
3
7
|
export interface DownloadsProps {
|
|
4
8
|
title?: string;
|
|
5
9
|
text?: string;
|
|
6
10
|
downloads: DownloadProps[];
|
|
7
11
|
target?: HTMLAnchorElement['target'];
|
|
8
12
|
materialIconName?: string;
|
|
13
|
+
links?: LinkProps[];
|
|
9
14
|
className?: string;
|
|
10
15
|
}
|
|
11
16
|
declare const Downloads: React.FC<DownloadsProps>;
|
|
@@ -2,25 +2,37 @@ import React from 'react';
|
|
|
2
2
|
import c from 'classnames';
|
|
3
3
|
import Download from '../../components/Download';
|
|
4
4
|
import TitleWithText from '../../components/TitleWithText';
|
|
5
|
+
import Button from '../../components/Button';
|
|
5
6
|
var Downloads = function Downloads(_ref) {
|
|
6
7
|
var title = _ref.title,
|
|
7
8
|
text = _ref.text,
|
|
8
9
|
downloads = _ref.downloads,
|
|
9
10
|
target = _ref.target,
|
|
10
11
|
materialIconName = _ref.materialIconName,
|
|
11
|
-
className = _ref.className
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
links = _ref.links;
|
|
12
14
|
var classes = c('Downloads', className);
|
|
13
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
16
|
className: classes
|
|
15
17
|
}, /*#__PURE__*/React.createElement(TitleWithText, {
|
|
16
18
|
title: title,
|
|
17
19
|
text: text
|
|
18
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
}), links && links.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "Downloads__links"
|
|
22
|
+
}, links.map(function (link) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
24
|
+
primary: false,
|
|
25
|
+
className: "Downloads__link",
|
|
26
|
+
href: link.href
|
|
27
|
+
}, link.title);
|
|
28
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
19
29
|
className: "Downloads__files"
|
|
20
30
|
}, downloads.map(function (download) {
|
|
21
31
|
return /*#__PURE__*/React.createElement(Download, {
|
|
32
|
+
key: download.source,
|
|
22
33
|
source: download.source,
|
|
23
34
|
title: download.title,
|
|
35
|
+
image: download.image,
|
|
24
36
|
description: download.description,
|
|
25
37
|
filesize: download.filesize,
|
|
26
38
|
filename: download.filename,
|