@uncinc/uncinc-react-kitchen-sink 2.16.0 → 2.16.2
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/Form/Select/index.js +6 -2
- package/dist/components/Form/TextField/index.js +55 -16
- package/dist/components/Form/TextField/style.scss +32 -1
- package/dist/components/MediaPlayer/types.d.ts +11 -10
- package/dist/config/i18next/locales/en.json +2 -1
- package/dist/config/i18next/locales/nl.json +3 -2
- package/package.json +1 -1
|
@@ -27,7 +27,8 @@ var Select = function Select(props) {
|
|
|
27
27
|
var _useExtendedFormikCon = useExtendedFormikContext(),
|
|
28
28
|
errors = _useExtendedFormikCon.errors,
|
|
29
29
|
touched = _useExtendedFormikCon.touched,
|
|
30
|
-
displayRequiredIndicator = _useExtendedFormikCon.displayRequiredIndicator
|
|
30
|
+
displayRequiredIndicator = _useExtendedFormikCon.displayRequiredIndicator,
|
|
31
|
+
setFieldTouched = _useExtendedFormikCon.setFieldTouched;
|
|
31
32
|
var isTouched = getNestedFieldvalue(fieldName, touched);
|
|
32
33
|
var error = getNestedFieldvalue(fieldName, errors);
|
|
33
34
|
var errorId = "".concat(props.fieldName, "--error");
|
|
@@ -58,7 +59,10 @@ var Select = function Select(props) {
|
|
|
58
59
|
required: required,
|
|
59
60
|
validate: validation,
|
|
60
61
|
error: error,
|
|
61
|
-
errorId: errorId
|
|
62
|
+
errorId: errorId,
|
|
63
|
+
onBlur: function onBlur() {
|
|
64
|
+
setFieldTouched(fieldName, true, false);
|
|
65
|
+
}
|
|
62
66
|
})));
|
|
63
67
|
};
|
|
64
68
|
export default Select;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
var _excluded = ["title", "required", "description", "placeholder", "fieldName", "validation", "onChange", "className", "wrapperClassName", "disabled", "descriptionAboveInput", "children"];
|
|
1
|
+
var _excluded = ["title", "required", "description", "placeholder", "fieldName", "validation", "onChange", "className", "wrapperClassName", "disabled", "showPasswordReveal", "descriptionAboveInput", "children", "type"];
|
|
2
2
|
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); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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
12
|
import { Field } from 'formik';
|
|
7
13
|
import c from 'classnames';
|
|
8
14
|
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import Icon from '../../Icon';
|
|
9
16
|
import withMapping from '../../../Context/withMapping';
|
|
10
17
|
import GenericFormElement from '../GenericFormElement';
|
|
11
18
|
import { useExtendedFormikContext } from '../FormikWrapper';
|
|
12
19
|
import getNestedFieldvalue from '../getNestedFieldvalue';
|
|
13
20
|
import './style.scss';
|
|
21
|
+
var INPUT_TYPE_TEXT = 'text';
|
|
22
|
+
var INPUT_TYPE_PASSWORD = 'password';
|
|
14
23
|
export var TextField = function TextField(props) {
|
|
15
24
|
var title = props.title,
|
|
16
25
|
required = props.required,
|
|
@@ -23,10 +32,17 @@ export var TextField = function TextField(props) {
|
|
|
23
32
|
wrapperClassName = props.wrapperClassName,
|
|
24
33
|
_props$disabled = props.disabled,
|
|
25
34
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
35
|
+
_props$showPasswordRe = props.showPasswordReveal,
|
|
36
|
+
showPasswordReveal = _props$showPasswordRe === void 0 ? false : _props$showPasswordRe,
|
|
26
37
|
descriptionAboveInput = props.descriptionAboveInput,
|
|
27
38
|
children = props.children,
|
|
39
|
+
type = props.type,
|
|
28
40
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
29
|
-
var
|
|
41
|
+
var _React$useState = React.useState(false),
|
|
42
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
43
|
+
revealPassword = _React$useState2[0],
|
|
44
|
+
setRevealPassword = _React$useState2[1];
|
|
45
|
+
var inputType = type || INPUT_TYPE_TEXT;
|
|
30
46
|
var _useTranslation = useTranslation(),
|
|
31
47
|
t = _useTranslation.t;
|
|
32
48
|
var handleValidation = function handleValidation(value) {
|
|
@@ -57,32 +73,55 @@ export var TextField = function TextField(props) {
|
|
|
57
73
|
var errorId = "".concat(props.fieldName, "--error");
|
|
58
74
|
var descriptionId = "".concat(props.fieldName, "--description");
|
|
59
75
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
60
|
-
className: c('TextField', wrapperClassName
|
|
76
|
+
className: c('TextField', wrapperClassName, {
|
|
77
|
+
'RevealPassword': inputType === INPUT_TYPE_PASSWORD
|
|
78
|
+
}),
|
|
79
|
+
touched: isTouched,
|
|
61
80
|
title: title,
|
|
81
|
+
error: error,
|
|
62
82
|
required: required,
|
|
63
|
-
description: description,
|
|
64
83
|
fieldName: fieldName,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
errorId: errorId,
|
|
68
|
-
descriptionId: descriptionId,
|
|
84
|
+
description: description,
|
|
85
|
+
descriptionAboveInput: descriptionAboveInput,
|
|
69
86
|
displayRequiredIndicator: displayRequiredIndicator,
|
|
70
|
-
|
|
87
|
+
descriptionId: descriptionId,
|
|
88
|
+
errorId: errorId
|
|
71
89
|
}, /*#__PURE__*/React.createElement(Field, _extends({}, restProps, {
|
|
72
90
|
className: c(className, {
|
|
73
|
-
'error': error && isTouched
|
|
91
|
+
'error': error && isTouched,
|
|
92
|
+
'RevealPassword': inputType === INPUT_TYPE_PASSWORD
|
|
74
93
|
}),
|
|
75
94
|
id: fieldName,
|
|
76
95
|
name: fieldName,
|
|
77
|
-
type: type,
|
|
78
|
-
value: value,
|
|
79
|
-
placeholder: placeholder,
|
|
80
96
|
validate: handleValidation,
|
|
81
97
|
onKeyUp: handleChange,
|
|
98
|
+
"aria-describedby": "".concat(errorId, " ").concat(descriptionId),
|
|
99
|
+
"aria-invalid": Boolean(error && isTouched),
|
|
100
|
+
type: revealPassword ? 'text' : inputType,
|
|
101
|
+
value: value,
|
|
82
102
|
disabled: disabled,
|
|
83
103
|
required: required,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
placeholder: placeholder
|
|
105
|
+
})), children, inputType === 'password' && showPasswordReveal && /*#__PURE__*/React.createElement(RevealPasswordButton, {
|
|
106
|
+
onHandleRevealPassword: setRevealPassword,
|
|
107
|
+
revealPassword: revealPassword
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
var RevealPasswordButton = function RevealPasswordButton(_ref) {
|
|
111
|
+
var onHandleRevealPassword = _ref.onHandleRevealPassword,
|
|
112
|
+
revealPassword = _ref.revealPassword;
|
|
113
|
+
var _useTranslation2 = useTranslation(),
|
|
114
|
+
t = _useTranslation2.t;
|
|
115
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
116
|
+
onClick: function onClick() {
|
|
117
|
+
return onHandleRevealPassword(!revealPassword);
|
|
118
|
+
},
|
|
119
|
+
className: "RevealPasswordButton",
|
|
120
|
+
type: "button",
|
|
121
|
+
"aria-label": t('form.revealPassword')
|
|
122
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
123
|
+
name: revealPassword ? 'visibility_off' : 'visibility',
|
|
124
|
+
flair: "filled"
|
|
125
|
+
}));
|
|
87
126
|
};
|
|
88
127
|
export default withMapping(TextField);
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
@import "../../Icon/style";
|
|
2
|
+
|
|
3
|
+
$material-icon-names: (visibility, visibility_off);
|
|
4
|
+
|
|
5
|
+
@include generateMaterialIconClasses;
|
|
6
|
+
|
|
1
7
|
.TextField {
|
|
8
|
+
&.RevealPassword__inner {
|
|
9
|
+
display: grid;
|
|
10
|
+
grid-template-columns: 1fr auto;
|
|
11
|
+
grid-template-areas: "field button";
|
|
12
|
+
border: solid 1px #888888;
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
input {
|
|
3
16
|
width: 100%;
|
|
4
17
|
font-size: 1.8rem;
|
|
@@ -7,7 +20,25 @@
|
|
|
7
20
|
color: #939393;
|
|
8
21
|
padding: 1.2rem 5rem 1.4rem 2rem;
|
|
9
22
|
border-radius: 5px;
|
|
10
|
-
border: solid 1px #888888;
|
|
11
23
|
background-color: #ffffff;
|
|
24
|
+
border: 1px solid #888888;
|
|
25
|
+
|
|
26
|
+
&.RevealPassword {
|
|
27
|
+
grid-area: field;
|
|
28
|
+
outline: none;
|
|
29
|
+
border: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.RevealPasswordButton {
|
|
34
|
+
grid-area: button;
|
|
35
|
+
appearance: auto;
|
|
36
|
+
border: none;
|
|
37
|
+
background: none;
|
|
38
|
+
font-size: 110%;
|
|
39
|
+
|
|
40
|
+
& > .Icon {
|
|
41
|
+
margin-bottom: 0;
|
|
42
|
+
}
|
|
12
43
|
}
|
|
13
44
|
}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { VideoJsPlayer as NativeVideoJsPlayer, VideoJsPlayerOptions } from 'video.js';
|
|
2
2
|
export type MimeType = 'audio/3gpp' | 'audio/aac' | 'audio/flac' | 'audio/mpeg' | 'audio/mp3' | 'audio/mp4' | 'audio/ogg' | 'audio/wav' | 'audio/webm' | 'video/3gpp' | 'video/mpeg' | 'video/mpeg' | 'video/mp4' | 'video/ogg' | 'video/quicktime' | 'video/webm' | 'video/youtube' | 'video/vimeo';
|
|
3
3
|
export type Control = 'play' | 'currentTime' | 'timeDivider' | 'duration' | 'seekbar' | 'captions' | 'volume' | 'fullscreen';
|
|
4
4
|
export type VideoJSControls = {
|
|
5
5
|
[K in Control]: string;
|
|
6
6
|
};
|
|
7
|
+
export type VideoJsPlayer = NativeVideoJsPlayer;
|
|
7
8
|
export type MediaPlayerProps = {
|
|
8
9
|
src: string;
|
|
9
10
|
type: MimeType;
|
|
10
11
|
controls?: Control[] | false;
|
|
11
12
|
posterUrl?: string;
|
|
12
|
-
options?:
|
|
13
|
-
captions?:
|
|
13
|
+
options?: VideoJsPlayerOptions;
|
|
14
|
+
captions?: VideoJsPlayerOptions['tracks'];
|
|
14
15
|
audioOnly?: boolean;
|
|
15
16
|
notSupportedMessage?: string;
|
|
16
17
|
className?: string;
|
|
17
|
-
onPlay?: (player:
|
|
18
|
-
onPause?: (player:
|
|
19
|
-
onEnded?: (player:
|
|
20
|
-
onSeeking?: (player:
|
|
21
|
-
onVolumeChange?: (player:
|
|
22
|
-
onFullscreenChange?: (player:
|
|
23
|
-
onError?: (player:
|
|
18
|
+
onPlay?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
19
|
+
onPause?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
20
|
+
onEnded?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
21
|
+
onSeeking?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
22
|
+
onVolumeChange?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
23
|
+
onFullscreenChange?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
24
|
+
onError?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
24
25
|
};
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
},
|
|
56
56
|
"form": {
|
|
57
57
|
"required": "vereist",
|
|
58
|
-
"optional": "optioneel"
|
|
58
|
+
"optional": "optioneel",
|
|
59
|
+
"revealPassword": "Laat wachtwoord zien"
|
|
59
60
|
},
|
|
60
61
|
"searchkit": {
|
|
61
62
|
"reset_search": "Zoeken opnieuw instellen"
|
|
@@ -84,4 +85,4 @@
|
|
|
84
85
|
"of": "van"
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
}
|
|
88
|
+
}
|