@sb1/ffe-form-react 9.0.8 → 9.1.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/es/ToggleSwitch.js +140 -0
- package/es/i18n/en.js +3 -1
- package/es/i18n/nb.js +3 -1
- package/es/i18n/nn.js +3 -1
- package/es/index.js +2 -1
- package/lib/ToggleSwitch.js +154 -0
- package/lib/i18n/en.js +3 -1
- package/lib/i18n/nb.js +3 -1
- package/lib/i18n/nn.js +3 -1
- package/lib/index.js +8 -0
- package/package.json +2 -2
- package/types/index.d.ts +33 -5
|
@@ -0,0 +1,140 @@
|
|
|
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); }
|
|
2
|
+
|
|
3
|
+
var _excluded = ["children", "className", "description", "hideOnOff", "onText", "offText", "id"];
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
|
|
13
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
14
|
+
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
|
|
17
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
|
+
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
+
|
|
21
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
22
|
+
|
|
23
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
24
|
+
|
|
25
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
26
|
+
|
|
27
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
28
|
+
|
|
29
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
|
+
|
|
31
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
+
|
|
33
|
+
import React from 'react';
|
|
34
|
+
import { bool, node, string } from 'prop-types';
|
|
35
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
36
|
+
import classNames from 'classnames';
|
|
37
|
+
import i18n from './i18n/i18n';
|
|
38
|
+
|
|
39
|
+
var ToggleSwitch = /*#__PURE__*/function (_React$Component) {
|
|
40
|
+
_inherits(ToggleSwitch, _React$Component);
|
|
41
|
+
|
|
42
|
+
var _super = _createSuper(ToggleSwitch);
|
|
43
|
+
|
|
44
|
+
function ToggleSwitch() {
|
|
45
|
+
var _this;
|
|
46
|
+
|
|
47
|
+
_classCallCheck(this, ToggleSwitch);
|
|
48
|
+
|
|
49
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
args[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
54
|
+
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "id", "toggle-".concat(uuidv4()));
|
|
56
|
+
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
_createClass(ToggleSwitch, [{
|
|
61
|
+
key: "render",
|
|
62
|
+
value: function render() {
|
|
63
|
+
var _this$props = this.props,
|
|
64
|
+
children = _this$props.children,
|
|
65
|
+
className = _this$props.className,
|
|
66
|
+
description = _this$props.description,
|
|
67
|
+
hideOnOff = _this$props.hideOnOff,
|
|
68
|
+
onText = _this$props.onText,
|
|
69
|
+
offText = _this$props.offText,
|
|
70
|
+
id = _this$props.id,
|
|
71
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
72
|
+
|
|
73
|
+
var supportedLocales = ['nb', 'nn', 'en'];
|
|
74
|
+
var text = i18n[supportedLocales.indexOf(this.props.locale) !== -1 ? this.props.locale : 'nb'];
|
|
75
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: classNames('ffe-toggle-switch', {
|
|
77
|
+
'ffe-toggle-switch--hide-on-off': hideOnOff
|
|
78
|
+
}, className)
|
|
79
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
80
|
+
className: "ffe-toggle-switch__input",
|
|
81
|
+
type: "checkbox",
|
|
82
|
+
id: id || this.id
|
|
83
|
+
}, rest)), /*#__PURE__*/React.createElement("label", {
|
|
84
|
+
className: "ffe-toggle-switch__label",
|
|
85
|
+
htmlFor: id || this.id
|
|
86
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
87
|
+
className: "ffe-toggle-switch__label-text"
|
|
88
|
+
}, children, description && /*#__PURE__*/React.createElement("span", {
|
|
89
|
+
className: "ffe-toggle-switch__label-description"
|
|
90
|
+
}, description)), !hideOnOff && /*#__PURE__*/React.createElement("span", {
|
|
91
|
+
className: "ffe-toggle-switch__label-off",
|
|
92
|
+
"aria-hidden": "true"
|
|
93
|
+
}, offText ? offText : text.OFF), /*#__PURE__*/React.createElement("span", {
|
|
94
|
+
className: "ffe-toggle-switch__switch",
|
|
95
|
+
"aria-hidden": "true"
|
|
96
|
+
}), !hideOnOff && /*#__PURE__*/React.createElement("span", {
|
|
97
|
+
className: "ffe-toggle-switch__label-on",
|
|
98
|
+
id: "test",
|
|
99
|
+
"aria-hidden": "true"
|
|
100
|
+
}, onText ? onText : text.ON)));
|
|
101
|
+
}
|
|
102
|
+
}]);
|
|
103
|
+
|
|
104
|
+
return ToggleSwitch;
|
|
105
|
+
}(React.Component);
|
|
106
|
+
|
|
107
|
+
ToggleSwitch.propTypes = {
|
|
108
|
+
/** The label text */
|
|
109
|
+
children: node.isRequired,
|
|
110
|
+
|
|
111
|
+
/** Any extra classes */
|
|
112
|
+
className: string,
|
|
113
|
+
|
|
114
|
+
/** A second line of text in the label */
|
|
115
|
+
locale: string,
|
|
116
|
+
|
|
117
|
+
/** On/Off text language */
|
|
118
|
+
description: string,
|
|
119
|
+
|
|
120
|
+
/** Custom text to specify the on-option */
|
|
121
|
+
onText: string,
|
|
122
|
+
|
|
123
|
+
/** Custom text to specify the off-option */
|
|
124
|
+
offText: string,
|
|
125
|
+
|
|
126
|
+
/** Hide On & Off labels next to switch */
|
|
127
|
+
hideOnOff: bool,
|
|
128
|
+
|
|
129
|
+
/** Override the generated id with a custom one */
|
|
130
|
+
id: string,
|
|
131
|
+
|
|
132
|
+
/** Override the value attribute of the input with a custom one */
|
|
133
|
+
value: string
|
|
134
|
+
};
|
|
135
|
+
ToggleSwitch.defaultProps = {
|
|
136
|
+
value: 'on',
|
|
137
|
+
locale: 'nb',
|
|
138
|
+
hideOnOff: false
|
|
139
|
+
};
|
|
140
|
+
export default ToggleSwitch;
|
package/es/i18n/en.js
CHANGED
package/es/i18n/nb.js
CHANGED
package/es/i18n/nn.js
CHANGED
package/es/index.js
CHANGED
|
@@ -12,4 +12,5 @@ import RadioButtonInputGroup from './RadioButtonInputGroup';
|
|
|
12
12
|
import RadioSwitch from './RadioSwitch';
|
|
13
13
|
import TextArea from './TextArea';
|
|
14
14
|
import Tooltip from './Tooltip';
|
|
15
|
-
|
|
15
|
+
import ToggleSwitch from './ToggleSwitch';
|
|
16
|
+
export { Checkbox, ErrorFieldMessage, InfoFieldMessage, SuccessFieldMessage, Input, PhoneNumber, InputGroup, Label, RadioBlock, RadioButton, RadioButtonInputGroup, RadioSwitch, TextArea, Tooltip, ToggleSwitch };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("prop-types");
|
|
13
|
+
|
|
14
|
+
var _uuid = require("uuid");
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _i18n = _interopRequireDefault(require("./i18n/i18n"));
|
|
19
|
+
|
|
20
|
+
var _excluded = ["children", "className", "description", "hideOnOff", "onText", "offText", "id"];
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
+
|
|
32
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
33
|
+
|
|
34
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
+
|
|
36
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
|
+
|
|
38
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
+
|
|
40
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
41
|
+
|
|
42
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
|
+
|
|
44
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
|
+
|
|
46
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
+
|
|
48
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
+
|
|
50
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
|
+
|
|
52
|
+
var ToggleSwitch = /*#__PURE__*/function (_React$Component) {
|
|
53
|
+
_inherits(ToggleSwitch, _React$Component);
|
|
54
|
+
|
|
55
|
+
var _super = _createSuper(ToggleSwitch);
|
|
56
|
+
|
|
57
|
+
function ToggleSwitch() {
|
|
58
|
+
var _this;
|
|
59
|
+
|
|
60
|
+
_classCallCheck(this, ToggleSwitch);
|
|
61
|
+
|
|
62
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
63
|
+
args[_key] = arguments[_key];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
67
|
+
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "id", "toggle-".concat((0, _uuid.v4)()));
|
|
69
|
+
|
|
70
|
+
return _this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_createClass(ToggleSwitch, [{
|
|
74
|
+
key: "render",
|
|
75
|
+
value: function render() {
|
|
76
|
+
var _this$props = this.props,
|
|
77
|
+
children = _this$props.children,
|
|
78
|
+
className = _this$props.className,
|
|
79
|
+
description = _this$props.description,
|
|
80
|
+
hideOnOff = _this$props.hideOnOff,
|
|
81
|
+
onText = _this$props.onText,
|
|
82
|
+
offText = _this$props.offText,
|
|
83
|
+
id = _this$props.id,
|
|
84
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
85
|
+
|
|
86
|
+
var supportedLocales = ['nb', 'nn', 'en'];
|
|
87
|
+
var text = _i18n.default[supportedLocales.indexOf(this.props.locale) !== -1 ? this.props.locale : 'nb'];
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
89
|
+
className: (0, _classnames.default)('ffe-toggle-switch', {
|
|
90
|
+
'ffe-toggle-switch--hide-on-off': hideOnOff
|
|
91
|
+
}, className)
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
93
|
+
className: "ffe-toggle-switch__input",
|
|
94
|
+
type: "checkbox",
|
|
95
|
+
id: id || this.id
|
|
96
|
+
}, rest)), /*#__PURE__*/_react.default.createElement("label", {
|
|
97
|
+
className: "ffe-toggle-switch__label",
|
|
98
|
+
htmlFor: id || this.id
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
100
|
+
className: "ffe-toggle-switch__label-text"
|
|
101
|
+
}, children, description && /*#__PURE__*/_react.default.createElement("span", {
|
|
102
|
+
className: "ffe-toggle-switch__label-description"
|
|
103
|
+
}, description)), !hideOnOff && /*#__PURE__*/_react.default.createElement("span", {
|
|
104
|
+
className: "ffe-toggle-switch__label-off",
|
|
105
|
+
"aria-hidden": "true"
|
|
106
|
+
}, offText ? offText : text.OFF), /*#__PURE__*/_react.default.createElement("span", {
|
|
107
|
+
className: "ffe-toggle-switch__switch",
|
|
108
|
+
"aria-hidden": "true"
|
|
109
|
+
}), !hideOnOff && /*#__PURE__*/_react.default.createElement("span", {
|
|
110
|
+
className: "ffe-toggle-switch__label-on",
|
|
111
|
+
id: "test",
|
|
112
|
+
"aria-hidden": "true"
|
|
113
|
+
}, onText ? onText : text.ON)));
|
|
114
|
+
}
|
|
115
|
+
}]);
|
|
116
|
+
|
|
117
|
+
return ToggleSwitch;
|
|
118
|
+
}(_react.default.Component);
|
|
119
|
+
|
|
120
|
+
ToggleSwitch.propTypes = {
|
|
121
|
+
/** The label text */
|
|
122
|
+
children: _propTypes.node.isRequired,
|
|
123
|
+
|
|
124
|
+
/** Any extra classes */
|
|
125
|
+
className: _propTypes.string,
|
|
126
|
+
|
|
127
|
+
/** A second line of text in the label */
|
|
128
|
+
locale: _propTypes.string,
|
|
129
|
+
|
|
130
|
+
/** On/Off text language */
|
|
131
|
+
description: _propTypes.string,
|
|
132
|
+
|
|
133
|
+
/** Custom text to specify the on-option */
|
|
134
|
+
onText: _propTypes.string,
|
|
135
|
+
|
|
136
|
+
/** Custom text to specify the off-option */
|
|
137
|
+
offText: _propTypes.string,
|
|
138
|
+
|
|
139
|
+
/** Hide On & Off labels next to switch */
|
|
140
|
+
hideOnOff: _propTypes.bool,
|
|
141
|
+
|
|
142
|
+
/** Override the generated id with a custom one */
|
|
143
|
+
id: _propTypes.string,
|
|
144
|
+
|
|
145
|
+
/** Override the value attribute of the input with a custom one */
|
|
146
|
+
value: _propTypes.string
|
|
147
|
+
};
|
|
148
|
+
ToggleSwitch.defaultProps = {
|
|
149
|
+
value: 'on',
|
|
150
|
+
locale: 'nb',
|
|
151
|
+
hideOnOff: false
|
|
152
|
+
};
|
|
153
|
+
var _default = ToggleSwitch;
|
|
154
|
+
exports.default = _default;
|
package/lib/i18n/en.js
CHANGED
package/lib/i18n/nb.js
CHANGED
package/lib/i18n/nn.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -81,6 +81,12 @@ Object.defineProperty(exports, "TextArea", {
|
|
|
81
81
|
return _TextArea.default;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "ToggleSwitch", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _ToggleSwitch.default;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
84
90
|
Object.defineProperty(exports, "Tooltip", {
|
|
85
91
|
enumerable: true,
|
|
86
92
|
get: function get() {
|
|
@@ -116,4 +122,6 @@ var _TextArea = _interopRequireDefault(require("./TextArea"));
|
|
|
116
122
|
|
|
117
123
|
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
118
124
|
|
|
125
|
+
var _ToggleSwitch = _interopRequireDefault(require("./ToggleSwitch"));
|
|
126
|
+
|
|
119
127
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-form-react",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "React component for form elements in ffe",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "158c4d5d48cb6268c7b69414197a75a5bec128b7"
|
|
49
49
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -49,10 +49,17 @@ export interface LabelProps
|
|
|
49
49
|
htmlFor?: string;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export interface InputGroupProps
|
|
52
|
+
export interface InputGroupProps
|
|
53
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
53
54
|
inputId?: string;
|
|
54
55
|
/** Unless you only have one element in your `InputGroup` you will have to use the function-as-a-child pattern. */
|
|
55
|
-
children:
|
|
56
|
+
children:
|
|
57
|
+
| React.ReactNode
|
|
58
|
+
| ((extraProps: {
|
|
59
|
+
id: string;
|
|
60
|
+
'aria-invalid': string;
|
|
61
|
+
'aria-describedby': string;
|
|
62
|
+
}) => React.ReactNode);
|
|
56
63
|
className?: string;
|
|
57
64
|
extraMargin?: boolean;
|
|
58
65
|
fieldMessage?: string | React.ReactNode;
|
|
@@ -112,8 +119,17 @@ interface WeakFieldSetAttributes
|
|
|
112
119
|
onChange?: any;
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
export interface RadioButtonInputGroupProps
|
|
116
|
-
children
|
|
122
|
+
export interface RadioButtonInputGroupProps
|
|
123
|
+
extends Omit<WeakFieldSetAttributes, 'children'> {
|
|
124
|
+
children:
|
|
125
|
+
| React.ReactNode
|
|
126
|
+
| ((inputProps: {
|
|
127
|
+
'aria-invalid'?: 'true' | 'false';
|
|
128
|
+
inline?: boolean;
|
|
129
|
+
name: string;
|
|
130
|
+
onChange: (...args: any) => any;
|
|
131
|
+
selectedValue?: boolean | string | number;
|
|
132
|
+
}) => React.ReactNode);
|
|
117
133
|
className?: string;
|
|
118
134
|
description?: string | React.ReactNode;
|
|
119
135
|
extraMargin?: boolean;
|
|
@@ -129,7 +145,6 @@ export interface RadioButtonInputGroupProps extends WeakFieldSetAttributes {
|
|
|
129
145
|
export interface RadioSwitchProps
|
|
130
146
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
131
147
|
checked?: boolean;
|
|
132
|
-
children: React.ReactNode;
|
|
133
148
|
className?: string;
|
|
134
149
|
labelProps?: {};
|
|
135
150
|
leftLabel: string;
|
|
@@ -150,6 +165,18 @@ export interface TextAreaProps
|
|
|
150
165
|
className?: string;
|
|
151
166
|
}
|
|
152
167
|
|
|
168
|
+
export interface ToggleSwitchProps
|
|
169
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
170
|
+
children: React.ReactNode;
|
|
171
|
+
className: string;
|
|
172
|
+
id: string;
|
|
173
|
+
description: string;
|
|
174
|
+
onText: string;
|
|
175
|
+
offText: string;
|
|
176
|
+
hideOnOff: boolean;
|
|
177
|
+
value: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
153
180
|
declare class Checkbox extends React.Component<CheckboxProps, any> {}
|
|
154
181
|
declare class ErrorFieldMessage extends React.Component<
|
|
155
182
|
BaseFieldMessageProps,
|
|
@@ -168,6 +195,7 @@ declare class PhoneNumber extends React.Component<PhoneNumberProps, any> {}
|
|
|
168
195
|
declare class Label extends React.Component<LabelProps, any> {}
|
|
169
196
|
declare class InputGroup extends React.Component<InputGroupProps, any> {}
|
|
170
197
|
declare class Tooltip extends React.Component<TooltipProps, any> {}
|
|
198
|
+
declare class ToggleSwitch extends React.Component<ToggleSwitchProps, any> {}
|
|
171
199
|
declare class RadioBlock extends React.Component<RadioBlockProps, any> {}
|
|
172
200
|
declare class RadioButton extends React.Component<RadioButtonProps, any> {}
|
|
173
201
|
declare class RadioButtonInputGroup extends React.Component<
|