@sb1/ffe-form-react 8.1.1 → 9.0.1
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/Input.js +8 -2
- package/es/Input.spec.js +8 -0
- package/es/RadioBlock.js +1 -2
- package/es/RadioButton.js +3 -11
- package/es/RadioButtonInputGroup.js +2 -2
- package/lib/Input.js +8 -2
- package/lib/Input.spec.js +8 -0
- package/lib/RadioBlock.js +1 -2
- package/lib/RadioButton.js +3 -11
- package/lib/RadioButtonInputGroup.js +2 -2
- package/package.json +2 -2
- package/types/index.d.ts +1 -16
package/es/Input.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "inline", "textLike"];
|
|
1
|
+
var _excluded = ["className", "inline", "textLike", "textRightAlign"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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
|
|
|
@@ -13,6 +13,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
13
13
|
var className = props.className,
|
|
14
14
|
inline = props.inline,
|
|
15
15
|
textLike = props.textLike,
|
|
16
|
+
textRightAlign = props.textRightAlign,
|
|
16
17
|
rest = _objectWithoutProperties(props, _excluded);
|
|
17
18
|
|
|
18
19
|
return /*#__PURE__*/React.createElement("input", _extends({
|
|
@@ -20,6 +21,8 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
20
21
|
'ffe-input-field--inline': inline
|
|
21
22
|
}, {
|
|
22
23
|
'ffe-input-field--text-like': textLike
|
|
24
|
+
}, {
|
|
25
|
+
'ffe-input-field--text-right-align': textRightAlign
|
|
23
26
|
}, className),
|
|
24
27
|
ref: ref
|
|
25
28
|
}, rest));
|
|
@@ -31,6 +34,9 @@ Input.propTypes = {
|
|
|
31
34
|
inline: bool,
|
|
32
35
|
|
|
33
36
|
/** Apply the text-like modifier by setting this to `true`. */
|
|
34
|
-
textLike: bool
|
|
37
|
+
textLike: bool,
|
|
38
|
+
|
|
39
|
+
/** Make the text right aligned */
|
|
40
|
+
textRightAlign: bool
|
|
35
41
|
};
|
|
36
42
|
export default Input;
|
package/es/Input.spec.js
CHANGED
|
@@ -38,4 +38,12 @@ describe('<Input />', function () {
|
|
|
38
38
|
});
|
|
39
39
|
expect(wrapper.hasClass('ffe-input-field--text-like')).toBe(true);
|
|
40
40
|
});
|
|
41
|
+
it('sets the correct class for textRightAlign', function () {
|
|
42
|
+
var wrapper = getWrapper();
|
|
43
|
+
expect(wrapper.hasClass('ffe-input-field--text-right-align')).toBe(false);
|
|
44
|
+
wrapper.setProps({
|
|
45
|
+
textRightAlign: true
|
|
46
|
+
});
|
|
47
|
+
expect(wrapper.hasClass('ffe-input-field--text-right-align')).toBe(true);
|
|
48
|
+
});
|
|
41
49
|
});
|
package/es/RadioBlock.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
-
var _excluded = ["checked", "children", "className", "
|
|
3
|
+
var _excluded = ["checked", "children", "className", "innerRef", "label", "labelClass", "name", "selectedValue", "showChildren", "value"];
|
|
4
4
|
|
|
5
5
|
function _extends() { _extends = Object.assign || 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); }
|
|
6
6
|
|
|
@@ -63,7 +63,6 @@ var RadioBlock = /*#__PURE__*/function (_Component) {
|
|
|
63
63
|
checked = _this$props.checked,
|
|
64
64
|
children = _this$props.children,
|
|
65
65
|
className = _this$props.className,
|
|
66
|
-
dark = _this$props.dark,
|
|
67
66
|
innerRef = _this$props.innerRef,
|
|
68
67
|
label = _this$props.label,
|
|
69
68
|
labelClass = _this$props.labelClass,
|
package/es/RadioButton.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "inline"
|
|
1
|
+
var _excluded = ["className", "inline"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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
|
|
|
@@ -14,14 +14,12 @@ import BaseRadioButton from './BaseRadioButton';
|
|
|
14
14
|
var RadioButton = function RadioButton(props) {
|
|
15
15
|
var className = props.className,
|
|
16
16
|
inline = props.inline,
|
|
17
|
-
dark = props.dark,
|
|
18
17
|
rest = _objectWithoutProperties(props, _excluded);
|
|
19
18
|
|
|
20
19
|
return /*#__PURE__*/React.createElement(BaseRadioButton, _extends({
|
|
21
20
|
className: classNames('ffe-radio-button', {
|
|
22
21
|
'ffe-radio-button--inline': inline
|
|
23
|
-
}, className)
|
|
24
|
-
dark: dark
|
|
22
|
+
}, className)
|
|
25
23
|
}, rest));
|
|
26
24
|
};
|
|
27
25
|
|
|
@@ -30,12 +28,6 @@ RadioButton.propTypes = {
|
|
|
30
28
|
className: string,
|
|
31
29
|
|
|
32
30
|
/** Indicates whether the radio button is rendered inline or as a block */
|
|
33
|
-
inline: bool
|
|
34
|
-
|
|
35
|
-
/** Dark variant */
|
|
36
|
-
dark: bool
|
|
37
|
-
};
|
|
38
|
-
RadioButton.defaultProps = {
|
|
39
|
-
dark: false
|
|
31
|
+
inline: bool
|
|
40
32
|
};
|
|
41
33
|
export default RadioButton;
|
|
@@ -104,8 +104,8 @@ RadioButtonInputGroup.propTypes = {
|
|
|
104
104
|
*/
|
|
105
105
|
label: oneOfType([node, string]),
|
|
106
106
|
|
|
107
|
-
/** The name of the radio button */
|
|
108
|
-
name: string,
|
|
107
|
+
/** The name of the radio button, required to avoid missing name */
|
|
108
|
+
name: string.isRequired,
|
|
109
109
|
|
|
110
110
|
/** Change handler, receives value of selected radio button */
|
|
111
111
|
onChange: func,
|
package/lib/Input.js
CHANGED
|
@@ -11,7 +11,7 @@ var _propTypes = require("prop-types");
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
-
var _excluded = ["className", "inline", "textLike"];
|
|
14
|
+
var _excluded = ["className", "inline", "textLike", "textRightAlign"];
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -25,6 +25,7 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
25
25
|
var className = props.className,
|
|
26
26
|
inline = props.inline,
|
|
27
27
|
textLike = props.textLike,
|
|
28
|
+
textRightAlign = props.textRightAlign,
|
|
28
29
|
rest = _objectWithoutProperties(props, _excluded);
|
|
29
30
|
|
|
30
31
|
return /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
@@ -32,6 +33,8 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
32
33
|
'ffe-input-field--inline': inline
|
|
33
34
|
}, {
|
|
34
35
|
'ffe-input-field--text-like': textLike
|
|
36
|
+
}, {
|
|
37
|
+
'ffe-input-field--text-right-align': textRightAlign
|
|
35
38
|
}, className),
|
|
36
39
|
ref: ref
|
|
37
40
|
}, rest));
|
|
@@ -44,7 +47,10 @@ Input.propTypes = {
|
|
|
44
47
|
inline: _propTypes.bool,
|
|
45
48
|
|
|
46
49
|
/** Apply the text-like modifier by setting this to `true`. */
|
|
47
|
-
textLike: _propTypes.bool
|
|
50
|
+
textLike: _propTypes.bool,
|
|
51
|
+
|
|
52
|
+
/** Make the text right aligned */
|
|
53
|
+
textRightAlign: _propTypes.bool
|
|
48
54
|
};
|
|
49
55
|
var _default = Input;
|
|
50
56
|
exports.default = _default;
|
package/lib/Input.spec.js
CHANGED
|
@@ -44,4 +44,12 @@ describe('<Input />', function () {
|
|
|
44
44
|
});
|
|
45
45
|
expect(wrapper.hasClass('ffe-input-field--text-like')).toBe(true);
|
|
46
46
|
});
|
|
47
|
+
it('sets the correct class for textRightAlign', function () {
|
|
48
|
+
var wrapper = getWrapper();
|
|
49
|
+
expect(wrapper.hasClass('ffe-input-field--text-right-align')).toBe(false);
|
|
50
|
+
wrapper.setProps({
|
|
51
|
+
textRightAlign: true
|
|
52
|
+
});
|
|
53
|
+
expect(wrapper.hasClass('ffe-input-field--text-right-align')).toBe(true);
|
|
54
|
+
});
|
|
47
55
|
});
|
package/lib/RadioBlock.js
CHANGED
|
@@ -15,7 +15,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
15
15
|
|
|
16
16
|
var _uuid = require("uuid");
|
|
17
17
|
|
|
18
|
-
var _excluded = ["checked", "children", "className", "
|
|
18
|
+
var _excluded = ["checked", "children", "className", "innerRef", "label", "labelClass", "name", "selectedValue", "showChildren", "value"];
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -79,7 +79,6 @@ var RadioBlock = /*#__PURE__*/function (_Component) {
|
|
|
79
79
|
checked = _this$props.checked,
|
|
80
80
|
children = _this$props.children,
|
|
81
81
|
className = _this$props.className,
|
|
82
|
-
dark = _this$props.dark,
|
|
83
82
|
innerRef = _this$props.innerRef,
|
|
84
83
|
label = _this$props.label,
|
|
85
84
|
labelClass = _this$props.labelClass,
|
package/lib/RadioButton.js
CHANGED
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _BaseRadioButton = _interopRequireDefault(require("./BaseRadioButton"));
|
|
15
15
|
|
|
16
|
-
var _excluded = ["className", "inline"
|
|
16
|
+
var _excluded = ["className", "inline"];
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
@@ -26,14 +26,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
26
26
|
var RadioButton = function RadioButton(props) {
|
|
27
27
|
var className = props.className,
|
|
28
28
|
inline = props.inline,
|
|
29
|
-
dark = props.dark,
|
|
30
29
|
rest = _objectWithoutProperties(props, _excluded);
|
|
31
30
|
|
|
32
31
|
return /*#__PURE__*/_react.default.createElement(_BaseRadioButton.default, _extends({
|
|
33
32
|
className: (0, _classnames.default)('ffe-radio-button', {
|
|
34
33
|
'ffe-radio-button--inline': inline
|
|
35
|
-
}, className)
|
|
36
|
-
dark: dark
|
|
34
|
+
}, className)
|
|
37
35
|
}, rest));
|
|
38
36
|
};
|
|
39
37
|
|
|
@@ -42,13 +40,7 @@ RadioButton.propTypes = {
|
|
|
42
40
|
className: _propTypes.string,
|
|
43
41
|
|
|
44
42
|
/** Indicates whether the radio button is rendered inline or as a block */
|
|
45
|
-
inline: _propTypes.bool
|
|
46
|
-
|
|
47
|
-
/** Dark variant */
|
|
48
|
-
dark: _propTypes.bool
|
|
49
|
-
};
|
|
50
|
-
RadioButton.defaultProps = {
|
|
51
|
-
dark: false
|
|
43
|
+
inline: _propTypes.bool
|
|
52
44
|
};
|
|
53
45
|
var _default = RadioButton;
|
|
54
46
|
exports.default = _default;
|
|
@@ -117,8 +117,8 @@ RadioButtonInputGroup.propTypes = {
|
|
|
117
117
|
*/
|
|
118
118
|
label: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.string]),
|
|
119
119
|
|
|
120
|
-
/** The name of the radio button */
|
|
121
|
-
name: _propTypes.string,
|
|
120
|
+
/** The name of the radio button, required to avoid missing name */
|
|
121
|
+
name: _propTypes.string.isRequired,
|
|
122
122
|
|
|
123
123
|
/** Change handler, receives value of selected radio button */
|
|
124
124
|
onChange: _propTypes.func,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-form-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "React component for form elements in ffe",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2b30193c5ae19d4a6b96802f98c7f6edb7de34c8"
|
|
58
58
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export interface CheckboxProps
|
|
|
7
7
|
id?: string;
|
|
8
8
|
inline?: boolean;
|
|
9
9
|
children?: React.ReactNode;
|
|
10
|
-
dark?: boolean;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export interface BaseFieldMessageProps
|
|
@@ -22,7 +21,6 @@ export interface InputProps
|
|
|
22
21
|
className?: string;
|
|
23
22
|
inline?: boolean;
|
|
24
23
|
textLike?: boolean;
|
|
25
|
-
dark?: boolean;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
export interface PhoneNumberProps {
|
|
@@ -39,7 +37,6 @@ export interface PhoneNumberProps {
|
|
|
39
37
|
countryCodeAndNumberFieldMessage?: string | React.ReactNode;
|
|
40
38
|
className?: string;
|
|
41
39
|
extraMargin?: boolean;
|
|
42
|
-
dark?: boolean;
|
|
43
40
|
countryCodeRef?: React.Ref<HTMLInputElement>;
|
|
44
41
|
numberRef?: React.Ref<HTMLInputElement>;
|
|
45
42
|
}
|
|
@@ -50,7 +47,6 @@ export interface LabelProps
|
|
|
50
47
|
children: React.ReactNode;
|
|
51
48
|
className?: string;
|
|
52
49
|
htmlFor?: string;
|
|
53
|
-
dark?: boolean;
|
|
54
50
|
}
|
|
55
51
|
|
|
56
52
|
export interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -74,7 +70,6 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
74
70
|
isOpen?: boolean;
|
|
75
71
|
onClick?: (e: React.MouseEvent | undefined) => void;
|
|
76
72
|
tabIndex?: number;
|
|
77
|
-
dark?: boolean;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
75
|
export interface RadioBlockProps
|
|
@@ -82,12 +77,6 @@ export interface RadioBlockProps
|
|
|
82
77
|
checked?: boolean;
|
|
83
78
|
children?: React.ReactNode;
|
|
84
79
|
className?: string;
|
|
85
|
-
/* Support for the dark theme has not been added for this component
|
|
86
|
-
* but can still be passed down from a parent `RadioButtonInputGroup`.
|
|
87
|
-
* It should not be passed down manually unless support for dark theme
|
|
88
|
-
* is implemented.
|
|
89
|
-
*/
|
|
90
|
-
dark?: boolean;
|
|
91
80
|
innerRef?: React.Ref<HTMLInputElement>;
|
|
92
81
|
label: string | React.ReactNode;
|
|
93
82
|
labelClass?: string;
|
|
@@ -115,7 +104,6 @@ export interface RadioButtonProps extends WeakInputAttributes {
|
|
|
115
104
|
tooltip?: string;
|
|
116
105
|
tooltipProps?: TooltipProps;
|
|
117
106
|
value: boolean | string | number;
|
|
118
|
-
dark?: boolean;
|
|
119
107
|
}
|
|
120
108
|
|
|
121
109
|
// As onChange has a different type than React.FieldsetHTMLAttributes<T> we have to weaken it
|
|
@@ -132,11 +120,10 @@ export interface RadioButtonInputGroupProps extends WeakFieldSetAttributes {
|
|
|
132
120
|
fieldMessage?: string | React.ReactNode;
|
|
133
121
|
inline?: boolean;
|
|
134
122
|
label?: string | React.ReactNode;
|
|
135
|
-
name
|
|
123
|
+
name: string;
|
|
136
124
|
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
137
125
|
selectedValue?: string | boolean | number;
|
|
138
126
|
tooltip?: string | React.ReactNode;
|
|
139
|
-
dark?: boolean;
|
|
140
127
|
}
|
|
141
128
|
|
|
142
129
|
export interface RadioSwitchProps
|
|
@@ -156,13 +143,11 @@ export interface RadioSwitchProps
|
|
|
156
143
|
tooltip?: string;
|
|
157
144
|
tooltipProps?: TooltipProps;
|
|
158
145
|
condensed?: boolean;
|
|
159
|
-
dark?: boolean;
|
|
160
146
|
}
|
|
161
147
|
|
|
162
148
|
export interface TextAreaProps
|
|
163
149
|
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
164
150
|
className?: string;
|
|
165
|
-
dark?: boolean;
|
|
166
151
|
}
|
|
167
152
|
|
|
168
153
|
declare class Checkbox extends React.Component<CheckboxProps, any> {}
|