@sb1/ffe-form-react 16.1.7 → 17.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/es/BaseFieldMessage.js +4 -6
- package/es/BaseRadioButton.js +4 -6
- package/es/Checkbox.js +18 -17
- package/es/ErrorFieldMessage.js +10 -5
- package/es/PhoneNumber.js +17 -19
- package/es/RadioButtonInputGroup.js +2 -4
- package/es/ToggleSwitch.js +5 -7
- package/es/Tooltip.js +2 -4
- package/lib/BaseFieldMessage.js +4 -6
- package/lib/BaseRadioButton.js +4 -6
- package/lib/Checkbox.js +17 -19
- package/lib/ErrorFieldMessage.js +10 -5
- package/lib/PhoneNumber.js +17 -19
- package/lib/RadioButtonInputGroup.js +2 -4
- package/lib/ToggleSwitch.js +5 -7
- package/lib/Tooltip.js +2 -4
- package/package.json +5 -5
- package/types/index.d.ts +2 -2
package/es/BaseFieldMessage.js
CHANGED
|
@@ -14,9 +14,11 @@ import classNames from 'classnames';
|
|
|
14
14
|
var BaseFieldMessage = function BaseFieldMessage(props) {
|
|
15
15
|
var children = props.children,
|
|
16
16
|
className = props.className,
|
|
17
|
-
|
|
17
|
+
_props$element = props.element,
|
|
18
|
+
Element = _props$element === void 0 ? 'div' : _props$element,
|
|
18
19
|
type = props.type,
|
|
19
|
-
role = props.role,
|
|
20
|
+
_props$role = props.role,
|
|
21
|
+
role = _props$role === void 0 ? 'status' : _props$role,
|
|
20
22
|
rest = _objectWithoutProperties(props, _excluded);
|
|
21
23
|
var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
|
|
22
24
|
var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
|
|
@@ -55,10 +57,6 @@ var BaseFieldMessage = function BaseFieldMessage(props) {
|
|
|
55
57
|
}
|
|
56
58
|
}()), children);
|
|
57
59
|
};
|
|
58
|
-
BaseFieldMessage.defaultProps = {
|
|
59
|
-
element: 'div',
|
|
60
|
-
role: 'status'
|
|
61
|
-
};
|
|
62
60
|
BaseFieldMessage.propTypes = {
|
|
63
61
|
children: node.isRequired,
|
|
64
62
|
className: string,
|
package/es/BaseRadioButton.js
CHANGED
|
@@ -40,10 +40,12 @@ var BaseRadioButton = /*#__PURE__*/function (_Component) {
|
|
|
40
40
|
children = _this$props.children,
|
|
41
41
|
checked = _this$props.checked,
|
|
42
42
|
className = _this$props.className,
|
|
43
|
-
|
|
43
|
+
_this$props$labelProp = _this$props.labelProps,
|
|
44
|
+
labelProps = _this$props$labelProp === void 0 ? {} : _this$props$labelProp,
|
|
44
45
|
selectedValue = _this$props.selectedValue,
|
|
45
46
|
tooltip = _this$props.tooltip,
|
|
46
|
-
|
|
47
|
+
_this$props$tooltipPr = _this$props.tooltipProps,
|
|
48
|
+
tooltipProps = _this$props$tooltipPr === void 0 ? {} : _this$props$tooltipPr,
|
|
47
49
|
value = _this$props.value,
|
|
48
50
|
innerRef = _this$props.innerRef,
|
|
49
51
|
inputProps = _objectWithoutProperties(_this$props, _excluded);
|
|
@@ -68,10 +70,6 @@ var BaseRadioButton = /*#__PURE__*/function (_Component) {
|
|
|
68
70
|
}
|
|
69
71
|
}]);
|
|
70
72
|
}(Component);
|
|
71
|
-
BaseRadioButton.defaultProps = {
|
|
72
|
-
labelProps: {},
|
|
73
|
-
tooltipProps: {}
|
|
74
|
-
};
|
|
75
73
|
BaseRadioButton.propTypes = {
|
|
76
74
|
/** Whether or not the radio button is selected */
|
|
77
75
|
checked: bool,
|
package/es/Checkbox.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
var _excluded = ["children", "hiddenLabel", "inline", "noMargins"];
|
|
1
|
+
var _excluded = ["children", "hiddenLabel", "inline", "noMargins", "id"];
|
|
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
3
|
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
4
|
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
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import { bool, node, string, func, oneOfType } from 'prop-types';
|
|
7
|
-
import { v4 as
|
|
7
|
+
import { v4 as uuid } from 'uuid';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
var Checkbox = /*#__PURE__*/React.forwardRef(function (
|
|
10
|
-
var children =
|
|
11
|
-
hiddenLabel =
|
|
12
|
-
inline =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
10
|
+
var children = _ref.children,
|
|
11
|
+
hiddenLabel = _ref.hiddenLabel,
|
|
12
|
+
_ref$inline = _ref.inline,
|
|
13
|
+
inline = _ref$inline === void 0 ? true : _ref$inline,
|
|
14
|
+
noMargins = _ref.noMargins,
|
|
15
|
+
_ref$id = _ref.id,
|
|
16
|
+
id = _ref$id === void 0 ? "checkbox-".concat(uuid()) : _ref$id,
|
|
17
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
18
|
var labelProps = {
|
|
17
19
|
className: classNames({
|
|
18
20
|
'ffe-checkbox': true,
|
|
@@ -22,7 +24,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22
24
|
}),
|
|
23
25
|
htmlFor: id
|
|
24
26
|
};
|
|
25
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("input", _extends({
|
|
27
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({
|
|
26
28
|
ref: ref,
|
|
27
29
|
className: "ffe-hidden-checkbox",
|
|
28
30
|
id: id,
|
|
@@ -31,8 +33,10 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
31
33
|
/*#__PURE__*/
|
|
32
34
|
// eslint-disable-next-line jsx-a11y/label-has-for
|
|
33
35
|
React.createElement("label", labelProps, /*#__PURE__*/React.createElement("span", {
|
|
34
|
-
className:
|
|
35
|
-
|
|
36
|
+
className: classNames('ffe-checkbox__content', {
|
|
37
|
+
'ffe-screenreader-only': hiddenLabel
|
|
38
|
+
})
|
|
39
|
+
}, children)));
|
|
36
40
|
});
|
|
37
41
|
Checkbox.propTypes = {
|
|
38
42
|
/** Removes vertical margins from the checkbox */
|
|
@@ -43,9 +47,6 @@ Checkbox.propTypes = {
|
|
|
43
47
|
id: string,
|
|
44
48
|
inline: bool,
|
|
45
49
|
/** The label for the checkbox */
|
|
46
|
-
children: oneOfType([node, func])
|
|
47
|
-
};
|
|
48
|
-
Checkbox.defaultProps = {
|
|
49
|
-
inline: true
|
|
50
|
+
children: oneOfType([node, func]).isRequired
|
|
50
51
|
};
|
|
51
52
|
export default Checkbox;
|
package/es/ErrorFieldMessage.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
var _excluded = ["role"];
|
|
1
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 _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
|
+
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; }
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import { oneOf } from 'prop-types';
|
|
4
7
|
import BaseFieldMessage from './BaseFieldMessage';
|
|
5
|
-
var ErrorFieldMessage = function ErrorFieldMessage(
|
|
6
|
-
|
|
8
|
+
var ErrorFieldMessage = function ErrorFieldMessage(_ref) {
|
|
9
|
+
var _ref$role = _ref.role,
|
|
10
|
+
role = _ref$role === void 0 ? 'alert' : _ref$role,
|
|
11
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement(BaseFieldMessage, _extends({
|
|
13
|
+
role: role
|
|
14
|
+
}, rest, {
|
|
7
15
|
type: "error"
|
|
8
16
|
}));
|
|
9
17
|
};
|
|
10
18
|
ErrorFieldMessage.propTypes = {
|
|
11
19
|
role: oneOf(['status', 'alert', 'none'])
|
|
12
20
|
};
|
|
13
|
-
ErrorFieldMessage.defaultProps = {
|
|
14
|
-
role: 'alert'
|
|
15
|
-
};
|
|
16
21
|
export default ErrorFieldMessage;
|
package/es/PhoneNumber.js
CHANGED
|
@@ -38,20 +38,29 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component) {
|
|
|
38
38
|
var _fieldMessage;
|
|
39
39
|
var _this$props = this.props,
|
|
40
40
|
number = _this$props.number,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
_this$props$countryCo = _this$props.countryCode,
|
|
42
|
+
countryCode = _this$props$countryCo === void 0 ? '47' : _this$props$countryCo,
|
|
43
|
+
_this$props$onCountry = _this$props.onCountryCodeChange,
|
|
44
|
+
onCountryCodeChange = _this$props$onCountry === void 0 ? function () {} : _this$props$onCountry,
|
|
45
|
+
_this$props$onNumberC = _this$props.onNumberChange,
|
|
46
|
+
onNumberChange = _this$props$onNumberC === void 0 ? function () {} : _this$props$onNumberC,
|
|
47
|
+
_this$props$onCountry2 = _this$props.onCountryCodeBlur,
|
|
48
|
+
onCountryCodeBlur = _this$props$onCountry2 === void 0 ? function () {} : _this$props$onCountry2,
|
|
49
|
+
_this$props$onNumberB = _this$props.onNumberBlur,
|
|
50
|
+
onNumberBlur = _this$props$onNumberB === void 0 ? function () {} : _this$props$onNumberB,
|
|
46
51
|
disabled = _this$props.disabled,
|
|
47
52
|
countryCodeFieldMessage = _this$props.countryCodeFieldMessage,
|
|
48
53
|
numberFieldMessage = _this$props.numberFieldMessage,
|
|
49
54
|
countryCodeAndNumberFieldMessage = _this$props.countryCodeAndNumberFieldMessage,
|
|
50
55
|
className = _this$props.className,
|
|
51
|
-
|
|
56
|
+
_this$props$extraMarg = _this$props.extraMargin,
|
|
57
|
+
extraMargin = _this$props$extraMarg === void 0 ? true : _this$props$extraMarg,
|
|
52
58
|
countryCodeRef = _this$props.countryCodeRef,
|
|
53
59
|
numberRef = _this$props.numberRef,
|
|
54
|
-
|
|
60
|
+
_this$props$isMobileN = _this$props.isMobileNumber,
|
|
61
|
+
isMobileNumber = _this$props$isMobileN === void 0 ? false : _this$props$isMobileN,
|
|
62
|
+
_this$props$locale = _this$props.locale,
|
|
63
|
+
locale = _this$props$locale === void 0 ? 'nb' : _this$props$locale;
|
|
55
64
|
var fieldMessage;
|
|
56
65
|
if (countryCodeAndNumberFieldMessage) {
|
|
57
66
|
fieldMessage = countryCodeAndNumberFieldMessage;
|
|
@@ -64,7 +73,7 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component) {
|
|
|
64
73
|
}
|
|
65
74
|
var fieldMessageId = ((_fieldMessage = fieldMessage) === null || _fieldMessage === void 0 || (_fieldMessage = _fieldMessage.props) === null || _fieldMessage === void 0 ? void 0 : _fieldMessage.id) || this.fieldMessageId;
|
|
66
75
|
var supportedLocales = ['nb', 'nn', 'en'];
|
|
67
|
-
var text = i18n[supportedLocales.indexOf(
|
|
76
|
+
var text = i18n[supportedLocales.indexOf(locale) !== -1 ? locale : 'nb'];
|
|
68
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
69
78
|
className: classNames('ffe-phone-number', 'ffe-input-group', {
|
|
70
79
|
'ffe-input-group--message': fieldMessage
|
|
@@ -119,7 +128,6 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component) {
|
|
|
119
128
|
}]);
|
|
120
129
|
}(React.Component);
|
|
121
130
|
export { PhoneNumber as default };
|
|
122
|
-
var noop = function noop() {};
|
|
123
131
|
PhoneNumber.propTypes = {
|
|
124
132
|
number: string,
|
|
125
133
|
countryCode: string,
|
|
@@ -155,14 +163,4 @@ PhoneNumber.propTypes = {
|
|
|
155
163
|
})]),
|
|
156
164
|
/** If True label is changed from "Phone number" to "Mobile number" */
|
|
157
165
|
isMobileNumber: bool
|
|
158
|
-
};
|
|
159
|
-
PhoneNumber.defaultProps = {
|
|
160
|
-
countryCode: '47',
|
|
161
|
-
locale: 'nb',
|
|
162
|
-
onCountryCodeChange: noop,
|
|
163
|
-
onNumberChange: noop,
|
|
164
|
-
onCountryCodeBlur: noop,
|
|
165
|
-
onNumberBlur: noop,
|
|
166
|
-
extraMargin: true,
|
|
167
|
-
isMobileNumber: false
|
|
168
166
|
};
|
|
@@ -16,7 +16,8 @@ import Tooltip from './Tooltip';
|
|
|
16
16
|
var RadioButtonInputGroup = function RadioButtonInputGroup(props) {
|
|
17
17
|
var children = props.children,
|
|
18
18
|
className = props.className,
|
|
19
|
-
extraMargin = props.extraMargin,
|
|
19
|
+
_props$extraMargin = props.extraMargin,
|
|
20
|
+
extraMargin = _props$extraMargin === void 0 ? true : _props$extraMargin,
|
|
20
21
|
description = props.description,
|
|
21
22
|
fieldMessage = props.fieldMessage,
|
|
22
23
|
inline = props.inline,
|
|
@@ -96,7 +97,4 @@ RadioButtonInputGroup.propTypes = {
|
|
|
96
97
|
* */
|
|
97
98
|
tooltip: oneOfType([node, string])
|
|
98
99
|
};
|
|
99
|
-
RadioButtonInputGroup.defaultProps = {
|
|
100
|
-
extraMargin: true
|
|
101
|
-
};
|
|
102
100
|
export default RadioButtonInputGroup;
|
package/es/ToggleSwitch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "description", "hideOnOff", "onText", "offText", "id"];
|
|
1
|
+
var _excluded = ["children", "className", "description", "hideOnOff", "onText", "offText", "id", "value"];
|
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
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
4
|
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; }
|
|
@@ -44,6 +44,8 @@ var ToggleSwitch = /*#__PURE__*/function (_React$Component) {
|
|
|
44
44
|
onText = _this$props.onText,
|
|
45
45
|
offText = _this$props.offText,
|
|
46
46
|
id = _this$props.id,
|
|
47
|
+
_this$props$value = _this$props.value,
|
|
48
|
+
value = _this$props$value === void 0 ? 'on' : _this$props$value,
|
|
47
49
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
48
50
|
var supportedLocales = ['nb', 'nn', 'en'];
|
|
49
51
|
var text = i18n[supportedLocales.indexOf(this.props.locale) !== -1 ? this.props.locale : 'nb'];
|
|
@@ -54,7 +56,8 @@ var ToggleSwitch = /*#__PURE__*/function (_React$Component) {
|
|
|
54
56
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
55
57
|
className: "ffe-toggle-switch__input",
|
|
56
58
|
type: "checkbox",
|
|
57
|
-
id: id || this.id
|
|
59
|
+
id: id || this.id,
|
|
60
|
+
value: value
|
|
58
61
|
}, rest)), /*#__PURE__*/React.createElement("label", {
|
|
59
62
|
className: "ffe-toggle-switch__label",
|
|
60
63
|
htmlFor: id || this.id
|
|
@@ -96,9 +99,4 @@ ToggleSwitch.propTypes = {
|
|
|
96
99
|
/** Override the value attribute of the input with a custom one */
|
|
97
100
|
value: string
|
|
98
101
|
};
|
|
99
|
-
ToggleSwitch.defaultProps = {
|
|
100
|
-
value: 'on',
|
|
101
|
-
locale: 'nb',
|
|
102
|
-
hideOnOff: false
|
|
103
|
-
};
|
|
104
102
|
export default ToggleSwitch;
|
package/es/Tooltip.js
CHANGED
|
@@ -16,7 +16,8 @@ import { v4 as uuid } from 'uuid';
|
|
|
16
16
|
var Tooltip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
17
17
|
var isOpen = _ref.isOpen,
|
|
18
18
|
ariaControls = _ref['aria-controls'],
|
|
19
|
-
ariaLabel = _ref['aria-label'],
|
|
19
|
+
_ref$ariaLabel = _ref['aria-label'],
|
|
20
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'Vis hjelpetekst' : _ref$ariaLabel,
|
|
20
21
|
children = _ref.children,
|
|
21
22
|
className = _ref.className,
|
|
22
23
|
onClick = _ref.onClick,
|
|
@@ -76,7 +77,4 @@ Tooltip.propTypes = {
|
|
|
76
77
|
/** Sets the tabIndex of the tooltip button. */
|
|
77
78
|
tabIndex: number
|
|
78
79
|
};
|
|
79
|
-
Tooltip.defaultProps = {
|
|
80
|
-
'aria-label': 'Vis hjelpetekst'
|
|
81
|
-
};
|
|
82
80
|
export default Tooltip;
|
package/lib/BaseFieldMessage.js
CHANGED
|
@@ -20,9 +20,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
20
20
|
var BaseFieldMessage = function BaseFieldMessage(props) {
|
|
21
21
|
var children = props.children,
|
|
22
22
|
className = props.className,
|
|
23
|
-
|
|
23
|
+
_props$element = props.element,
|
|
24
|
+
Element = _props$element === void 0 ? 'div' : _props$element,
|
|
24
25
|
type = props.type,
|
|
25
|
-
role = props.role,
|
|
26
|
+
_props$role = props.role,
|
|
27
|
+
role = _props$role === void 0 ? 'status' : _props$role,
|
|
26
28
|
rest = _objectWithoutProperties(props, _excluded);
|
|
27
29
|
var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
|
|
28
30
|
var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
|
|
@@ -61,10 +63,6 @@ var BaseFieldMessage = function BaseFieldMessage(props) {
|
|
|
61
63
|
}
|
|
62
64
|
}()), children);
|
|
63
65
|
};
|
|
64
|
-
BaseFieldMessage.defaultProps = {
|
|
65
|
-
element: 'div',
|
|
66
|
-
role: 'status'
|
|
67
|
-
};
|
|
68
66
|
BaseFieldMessage.propTypes = {
|
|
69
67
|
children: _propTypes.node.isRequired,
|
|
70
68
|
className: _propTypes.string,
|
package/lib/BaseRadioButton.js
CHANGED
|
@@ -49,10 +49,12 @@ var BaseRadioButton = /*#__PURE__*/function (_Component) {
|
|
|
49
49
|
children = _this$props.children,
|
|
50
50
|
checked = _this$props.checked,
|
|
51
51
|
className = _this$props.className,
|
|
52
|
-
|
|
52
|
+
_this$props$labelProp = _this$props.labelProps,
|
|
53
|
+
labelProps = _this$props$labelProp === void 0 ? {} : _this$props$labelProp,
|
|
53
54
|
selectedValue = _this$props.selectedValue,
|
|
54
55
|
tooltip = _this$props.tooltip,
|
|
55
|
-
|
|
56
|
+
_this$props$tooltipPr = _this$props.tooltipProps,
|
|
57
|
+
tooltipProps = _this$props$tooltipPr === void 0 ? {} : _this$props$tooltipPr,
|
|
56
58
|
value = _this$props.value,
|
|
57
59
|
innerRef = _this$props.innerRef,
|
|
58
60
|
inputProps = _objectWithoutProperties(_this$props, _excluded);
|
|
@@ -77,10 +79,6 @@ var BaseRadioButton = /*#__PURE__*/function (_Component) {
|
|
|
77
79
|
}
|
|
78
80
|
}]);
|
|
79
81
|
}(_react.Component);
|
|
80
|
-
BaseRadioButton.defaultProps = {
|
|
81
|
-
labelProps: {},
|
|
82
|
-
tooltipProps: {}
|
|
83
|
-
};
|
|
84
82
|
BaseRadioButton.propTypes = {
|
|
85
83
|
/** Whether or not the radio button is selected */
|
|
86
84
|
checked: _propTypes.bool,
|
package/lib/Checkbox.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _propTypes = require("prop-types");
|
|
10
9
|
var _uuid = require("uuid");
|
|
11
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var _excluded = ["children", "hiddenLabel", "inline", "noMargins"];
|
|
11
|
+
var _excluded = ["children", "hiddenLabel", "inline", "noMargins", "id"];
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
-
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; }
|
|
16
13
|
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); }
|
|
17
14
|
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; }
|
|
18
15
|
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; }
|
|
19
|
-
var Checkbox = /*#__PURE__*/_react.default.forwardRef(function (
|
|
20
|
-
var children =
|
|
21
|
-
hiddenLabel =
|
|
22
|
-
inline =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
var Checkbox = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
hiddenLabel = _ref.hiddenLabel,
|
|
19
|
+
_ref$inline = _ref.inline,
|
|
20
|
+
inline = _ref$inline === void 0 ? true : _ref$inline,
|
|
21
|
+
noMargins = _ref.noMargins,
|
|
22
|
+
_ref$id = _ref.id,
|
|
23
|
+
id = _ref$id === void 0 ? "checkbox-".concat((0, _uuid.v4)()) : _ref$id,
|
|
24
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
25
|
var labelProps = {
|
|
27
26
|
className: (0, _classnames.default)({
|
|
28
27
|
'ffe-checkbox': true,
|
|
@@ -32,7 +31,7 @@ var Checkbox = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
32
31
|
}),
|
|
33
32
|
htmlFor: id
|
|
34
33
|
};
|
|
35
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
36
35
|
ref: ref,
|
|
37
36
|
className: "ffe-hidden-checkbox",
|
|
38
37
|
id: id,
|
|
@@ -41,8 +40,10 @@ var Checkbox = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
41
40
|
/*#__PURE__*/
|
|
42
41
|
// eslint-disable-next-line jsx-a11y/label-has-for
|
|
43
42
|
_react.default.createElement("label", labelProps, /*#__PURE__*/_react.default.createElement("span", {
|
|
44
|
-
className:
|
|
45
|
-
|
|
43
|
+
className: (0, _classnames.default)('ffe-checkbox__content', {
|
|
44
|
+
'ffe-screenreader-only': hiddenLabel
|
|
45
|
+
})
|
|
46
|
+
}, children)));
|
|
46
47
|
});
|
|
47
48
|
Checkbox.propTypes = {
|
|
48
49
|
/** Removes vertical margins from the checkbox */
|
|
@@ -53,9 +54,6 @@ Checkbox.propTypes = {
|
|
|
53
54
|
id: _propTypes.string,
|
|
54
55
|
inline: _propTypes.bool,
|
|
55
56
|
/** The label for the checkbox */
|
|
56
|
-
children: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.func])
|
|
57
|
-
};
|
|
58
|
-
Checkbox.defaultProps = {
|
|
59
|
-
inline: true
|
|
57
|
+
children: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.func]).isRequired
|
|
60
58
|
};
|
|
61
59
|
var _default = exports.default = Checkbox;
|
package/lib/ErrorFieldMessage.js
CHANGED
|
@@ -7,17 +7,22 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _BaseFieldMessage = _interopRequireDefault(require("./BaseFieldMessage"));
|
|
10
|
+
var _excluded = ["role"];
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
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); }
|
|
12
|
-
var
|
|
13
|
-
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
var ErrorFieldMessage = function ErrorFieldMessage(_ref) {
|
|
16
|
+
var _ref$role = _ref.role,
|
|
17
|
+
role = _ref$role === void 0 ? 'alert' : _ref$role,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_BaseFieldMessage.default, _extends({
|
|
20
|
+
role: role
|
|
21
|
+
}, rest, {
|
|
14
22
|
type: "error"
|
|
15
23
|
}));
|
|
16
24
|
};
|
|
17
25
|
ErrorFieldMessage.propTypes = {
|
|
18
26
|
role: (0, _propTypes.oneOf)(['status', 'alert', 'none'])
|
|
19
27
|
};
|
|
20
|
-
ErrorFieldMessage.defaultProps = {
|
|
21
|
-
role: 'alert'
|
|
22
|
-
};
|
|
23
28
|
var _default = exports.default = ErrorFieldMessage;
|
package/lib/PhoneNumber.js
CHANGED
|
@@ -45,20 +45,29 @@ var PhoneNumber = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
45
45
|
var _fieldMessage;
|
|
46
46
|
var _this$props = this.props,
|
|
47
47
|
number = _this$props.number,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
_this$props$countryCo = _this$props.countryCode,
|
|
49
|
+
countryCode = _this$props$countryCo === void 0 ? '47' : _this$props$countryCo,
|
|
50
|
+
_this$props$onCountry = _this$props.onCountryCodeChange,
|
|
51
|
+
onCountryCodeChange = _this$props$onCountry === void 0 ? function () {} : _this$props$onCountry,
|
|
52
|
+
_this$props$onNumberC = _this$props.onNumberChange,
|
|
53
|
+
onNumberChange = _this$props$onNumberC === void 0 ? function () {} : _this$props$onNumberC,
|
|
54
|
+
_this$props$onCountry2 = _this$props.onCountryCodeBlur,
|
|
55
|
+
onCountryCodeBlur = _this$props$onCountry2 === void 0 ? function () {} : _this$props$onCountry2,
|
|
56
|
+
_this$props$onNumberB = _this$props.onNumberBlur,
|
|
57
|
+
onNumberBlur = _this$props$onNumberB === void 0 ? function () {} : _this$props$onNumberB,
|
|
53
58
|
disabled = _this$props.disabled,
|
|
54
59
|
countryCodeFieldMessage = _this$props.countryCodeFieldMessage,
|
|
55
60
|
numberFieldMessage = _this$props.numberFieldMessage,
|
|
56
61
|
countryCodeAndNumberFieldMessage = _this$props.countryCodeAndNumberFieldMessage,
|
|
57
62
|
className = _this$props.className,
|
|
58
|
-
|
|
63
|
+
_this$props$extraMarg = _this$props.extraMargin,
|
|
64
|
+
extraMargin = _this$props$extraMarg === void 0 ? true : _this$props$extraMarg,
|
|
59
65
|
countryCodeRef = _this$props.countryCodeRef,
|
|
60
66
|
numberRef = _this$props.numberRef,
|
|
61
|
-
|
|
67
|
+
_this$props$isMobileN = _this$props.isMobileNumber,
|
|
68
|
+
isMobileNumber = _this$props$isMobileN === void 0 ? false : _this$props$isMobileN,
|
|
69
|
+
_this$props$locale = _this$props.locale,
|
|
70
|
+
locale = _this$props$locale === void 0 ? 'nb' : _this$props$locale;
|
|
62
71
|
var fieldMessage;
|
|
63
72
|
if (countryCodeAndNumberFieldMessage) {
|
|
64
73
|
fieldMessage = countryCodeAndNumberFieldMessage;
|
|
@@ -71,7 +80,7 @@ var PhoneNumber = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
71
80
|
}
|
|
72
81
|
var fieldMessageId = ((_fieldMessage = fieldMessage) === null || _fieldMessage === void 0 || (_fieldMessage = _fieldMessage.props) === null || _fieldMessage === void 0 ? void 0 : _fieldMessage.id) || this.fieldMessageId;
|
|
73
82
|
var supportedLocales = ['nb', 'nn', 'en'];
|
|
74
|
-
var text = _i18n.default[supportedLocales.indexOf(
|
|
83
|
+
var text = _i18n.default[supportedLocales.indexOf(locale) !== -1 ? locale : 'nb'];
|
|
75
84
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
76
85
|
className: (0, _classnames.default)('ffe-phone-number', 'ffe-input-group', {
|
|
77
86
|
'ffe-input-group--message': fieldMessage
|
|
@@ -125,7 +134,6 @@ var PhoneNumber = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
125
134
|
}
|
|
126
135
|
}]);
|
|
127
136
|
}(_react.default.Component);
|
|
128
|
-
var noop = function noop() {};
|
|
129
137
|
PhoneNumber.propTypes = {
|
|
130
138
|
number: _propTypes.string,
|
|
131
139
|
countryCode: _propTypes.string,
|
|
@@ -161,14 +169,4 @@ PhoneNumber.propTypes = {
|
|
|
161
169
|
})]),
|
|
162
170
|
/** If True label is changed from "Phone number" to "Mobile number" */
|
|
163
171
|
isMobileNumber: _propTypes.bool
|
|
164
|
-
};
|
|
165
|
-
PhoneNumber.defaultProps = {
|
|
166
|
-
countryCode: '47',
|
|
167
|
-
locale: 'nb',
|
|
168
|
-
onCountryCodeChange: noop,
|
|
169
|
-
onNumberChange: noop,
|
|
170
|
-
onCountryCodeBlur: noop,
|
|
171
|
-
onNumberBlur: noop,
|
|
172
|
-
extraMargin: true,
|
|
173
|
-
isMobileNumber: false
|
|
174
172
|
};
|
|
@@ -23,7 +23,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
23
23
|
var RadioButtonInputGroup = function RadioButtonInputGroup(props) {
|
|
24
24
|
var children = props.children,
|
|
25
25
|
className = props.className,
|
|
26
|
-
extraMargin = props.extraMargin,
|
|
26
|
+
_props$extraMargin = props.extraMargin,
|
|
27
|
+
extraMargin = _props$extraMargin === void 0 ? true : _props$extraMargin,
|
|
27
28
|
description = props.description,
|
|
28
29
|
fieldMessage = props.fieldMessage,
|
|
29
30
|
inline = props.inline,
|
|
@@ -103,7 +104,4 @@ RadioButtonInputGroup.propTypes = {
|
|
|
103
104
|
* */
|
|
104
105
|
tooltip: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.string])
|
|
105
106
|
};
|
|
106
|
-
RadioButtonInputGroup.defaultProps = {
|
|
107
|
-
extraMargin: true
|
|
108
|
-
};
|
|
109
107
|
var _default = exports.default = RadioButtonInputGroup;
|
package/lib/ToggleSwitch.js
CHANGED
|
@@ -9,7 +9,7 @@ var _propTypes = require("prop-types");
|
|
|
9
9
|
var _uuid = require("uuid");
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _i18n = _interopRequireDefault(require("./i18n/i18n"));
|
|
12
|
-
var _excluded = ["children", "className", "description", "hideOnOff", "onText", "offText", "id"];
|
|
12
|
+
var _excluded = ["children", "className", "description", "hideOnOff", "onText", "offText", "id", "value"];
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
15
|
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); }
|
|
@@ -51,6 +51,8 @@ var ToggleSwitch = /*#__PURE__*/function (_React$Component) {
|
|
|
51
51
|
onText = _this$props.onText,
|
|
52
52
|
offText = _this$props.offText,
|
|
53
53
|
id = _this$props.id,
|
|
54
|
+
_this$props$value = _this$props.value,
|
|
55
|
+
value = _this$props$value === void 0 ? 'on' : _this$props$value,
|
|
54
56
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
55
57
|
var supportedLocales = ['nb', 'nn', 'en'];
|
|
56
58
|
var text = _i18n.default[supportedLocales.indexOf(this.props.locale) !== -1 ? this.props.locale : 'nb'];
|
|
@@ -61,7 +63,8 @@ var ToggleSwitch = /*#__PURE__*/function (_React$Component) {
|
|
|
61
63
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
62
64
|
className: "ffe-toggle-switch__input",
|
|
63
65
|
type: "checkbox",
|
|
64
|
-
id: id || this.id
|
|
66
|
+
id: id || this.id,
|
|
67
|
+
value: value
|
|
65
68
|
}, rest)), /*#__PURE__*/_react.default.createElement("label", {
|
|
66
69
|
className: "ffe-toggle-switch__label",
|
|
67
70
|
htmlFor: id || this.id
|
|
@@ -103,9 +106,4 @@ ToggleSwitch.propTypes = {
|
|
|
103
106
|
/** Override the value attribute of the input with a custom one */
|
|
104
107
|
value: _propTypes.string
|
|
105
108
|
};
|
|
106
|
-
ToggleSwitch.defaultProps = {
|
|
107
|
-
value: 'on',
|
|
108
|
-
locale: 'nb',
|
|
109
|
-
hideOnOff: false
|
|
110
|
-
};
|
|
111
109
|
var _default = exports.default = ToggleSwitch;
|
package/lib/Tooltip.js
CHANGED
|
@@ -26,7 +26,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
26
26
|
var Tooltip = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
27
27
|
var isOpen = _ref.isOpen,
|
|
28
28
|
ariaControls = _ref['aria-controls'],
|
|
29
|
-
ariaLabel = _ref['aria-label'],
|
|
29
|
+
_ref$ariaLabel = _ref['aria-label'],
|
|
30
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'Vis hjelpetekst' : _ref$ariaLabel,
|
|
30
31
|
children = _ref.children,
|
|
31
32
|
className = _ref.className,
|
|
32
33
|
onClick = _ref.onClick,
|
|
@@ -86,7 +87,4 @@ Tooltip.propTypes = {
|
|
|
86
87
|
/** Sets the tabIndex of the tooltip button. */
|
|
87
88
|
tabIndex: _propTypes.number
|
|
88
89
|
};
|
|
89
|
-
Tooltip.defaultProps = {
|
|
90
|
-
'aria-label': 'Vis hjelpetekst'
|
|
91
|
-
};
|
|
92
90
|
var _default = exports.default = Tooltip;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-form-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "React component for form elements in ffe",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"test:watch": "ffe-buildtool jest --watch"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sb1/ffe-collapse-react": "^3.0.
|
|
29
|
-
"@sb1/ffe-form": "^29.0.
|
|
30
|
-
"@sb1/ffe-icons-react": "^9.0.
|
|
28
|
+
"@sb1/ffe-collapse-react": "^3.0.4",
|
|
29
|
+
"@sb1/ffe-form": "^29.0.6",
|
|
30
|
+
"@sb1/ffe-icons-react": "^9.0.8",
|
|
31
31
|
"classnames": "^2.3.1",
|
|
32
32
|
"uuid": "^9.0.0"
|
|
33
33
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "c291894cefef43c0607f844862e87031452a0d94"
|
|
49
49
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
export interface CheckboxProps
|
|
4
|
-
extends Omit<React.
|
|
4
|
+
extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {
|
|
5
5
|
noMargins?: boolean;
|
|
6
6
|
hiddenLabel?: boolean;
|
|
7
7
|
id?: string;
|
|
8
8
|
inline?: boolean;
|
|
9
9
|
children?:
|
|
10
|
-
| React.ReactNode
|
|
10
|
+
| NonNullable<React.ReactNode>
|
|
11
11
|
| ((labelProps: {
|
|
12
12
|
className: string;
|
|
13
13
|
htmlFor: string;
|