@sb1/ffe-form-react 10.0.1 → 10.0.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.
@@ -1,95 +1,63 @@
1
1
  "use strict";
2
2
 
3
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
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _uuid = require("uuid");
15
-
16
11
  var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
12
  var _i18n = _interopRequireDefault(require("./i18n/i18n"));
19
-
20
13
  var _ErrorFieldMessage = _interopRequireDefault(require("./ErrorFieldMessage"));
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
15
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
26
16
  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); } }
27
-
28
17
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
-
30
18
  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); }
31
-
32
19
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
34
20
  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); }; }
35
-
36
21
  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); }
37
-
38
22
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
-
40
23
  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; } }
41
-
42
24
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
25
  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; }
45
-
46
26
  var PhoneNumber = /*#__PURE__*/function (_React$Component) {
47
27
  _inherits(PhoneNumber, _React$Component);
48
-
49
28
  var _super = _createSuper(PhoneNumber);
50
-
51
29
  function PhoneNumber() {
52
30
  var _this;
53
-
54
31
  _classCallCheck(this, PhoneNumber);
55
-
56
32
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
57
33
  args[_key] = arguments[_key];
58
34
  }
59
-
60
35
  _this = _super.call.apply(_super, [this].concat(args));
61
-
62
36
  _defineProperty(_assertThisInitialized(_this), "numberId", (0, _uuid.v4)());
63
-
64
37
  _defineProperty(_assertThisInitialized(_this), "countryCodeId", (0, _uuid.v4)());
65
-
66
38
  _defineProperty(_assertThisInitialized(_this), "fieldMessageId", "input-".concat((0, _uuid.v4)(), "-fieldmessage"));
67
-
68
39
  return _this;
69
40
  }
70
-
71
41
  _createClass(PhoneNumber, [{
72
42
  key: "render",
73
43
  value: function render() {
74
44
  var _fieldMessage, _fieldMessage$props;
75
-
76
45
  var _this$props = this.props,
77
- number = _this$props.number,
78
- countryCode = _this$props.countryCode,
79
- onCountryCodeChange = _this$props.onCountryCodeChange,
80
- onNumberChange = _this$props.onNumberChange,
81
- onCountryCodeBlur = _this$props.onCountryCodeBlur,
82
- onNumberBlur = _this$props.onNumberBlur,
83
- disabled = _this$props.disabled,
84
- countryCodeFieldMessage = _this$props.countryCodeFieldMessage,
85
- numberFieldMessage = _this$props.numberFieldMessage,
86
- countryCodeAndNumberFieldMessage = _this$props.countryCodeAndNumberFieldMessage,
87
- className = _this$props.className,
88
- extraMargin = _this$props.extraMargin,
89
- countryCodeRef = _this$props.countryCodeRef,
90
- numberRef = _this$props.numberRef;
46
+ number = _this$props.number,
47
+ countryCode = _this$props.countryCode,
48
+ onCountryCodeChange = _this$props.onCountryCodeChange,
49
+ onNumberChange = _this$props.onNumberChange,
50
+ onCountryCodeBlur = _this$props.onCountryCodeBlur,
51
+ onNumberBlur = _this$props.onNumberBlur,
52
+ disabled = _this$props.disabled,
53
+ countryCodeFieldMessage = _this$props.countryCodeFieldMessage,
54
+ numberFieldMessage = _this$props.numberFieldMessage,
55
+ countryCodeAndNumberFieldMessage = _this$props.countryCodeAndNumberFieldMessage,
56
+ className = _this$props.className,
57
+ extraMargin = _this$props.extraMargin,
58
+ countryCodeRef = _this$props.countryCodeRef,
59
+ numberRef = _this$props.numberRef;
91
60
  var fieldMessage;
92
-
93
61
  if (countryCodeAndNumberFieldMessage) {
94
62
  fieldMessage = countryCodeAndNumberFieldMessage;
95
63
  } else if (countryCodeFieldMessage && numberFieldMessage) {
@@ -99,7 +67,6 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component) {
99
67
  } else if (numberFieldMessage) {
100
68
  fieldMessage = numberFieldMessage;
101
69
  }
102
-
103
70
  var fieldMessageId = ((_fieldMessage = fieldMessage) === null || _fieldMessage === void 0 ? void 0 : (_fieldMessage$props = _fieldMessage.props) === null || _fieldMessage$props === void 0 ? void 0 : _fieldMessage$props.id) || this.fieldMessageId;
104
71
  var supportedLocales = ['nb', 'nn', 'en'];
105
72
  var text = _i18n.default[supportedLocales.indexOf(this.props.locale) !== -1 ? this.props.locale : 'nb'];
@@ -155,14 +122,10 @@ var PhoneNumber = /*#__PURE__*/function (_React$Component) {
155
122
  }));
156
123
  }
157
124
  }]);
158
-
159
125
  return PhoneNumber;
160
126
  }(_react.default.Component);
161
-
162
127
  exports.default = PhoneNumber;
163
-
164
128
  var noop = function noop() {};
165
-
166
129
  PhoneNumber.propTypes = {
167
130
  number: _propTypes.string,
168
131
  countryCode: _propTypes.string,
@@ -172,13 +135,10 @@ PhoneNumber.propTypes = {
172
135
  onNumberBlur: _propTypes.func,
173
136
  locale: _propTypes.string,
174
137
  disabled: _propTypes.bool,
175
-
176
138
  /** String or ErrorFieldMessage component with message */
177
139
  countryCodeFieldMessage: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.node]),
178
-
179
140
  /** String or ErrorFieldMessage component with message */
180
141
  numberFieldMessage: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.node]),
181
-
182
142
  /** String or ErrorFieldMessage component with message,
183
143
  * this should should be set when both countryCode and number is in an invalid state.
184
144
  * If both countryCodeFieldMessage and numberFieldMessage is set and not this prop,
@@ -186,18 +146,15 @@ PhoneNumber.propTypes = {
186
146
  */
187
147
  countryCodeAndNumberFieldMessage: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.node]),
188
148
  className: _propTypes.string,
189
-
190
149
  /** Reserve space for showing `fieldMessage`s so content below don't move
191
150
  * vertically if an errormessage shows up. Note that this will only reserve
192
151
  * space for one line of content, so keep messages short.
193
152
  */
194
153
  extraMargin: _propTypes.bool,
195
-
196
154
  /** Ref-setting function, or ref created by useRef, passed to the country code input element */
197
155
  countryCodeRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
198
156
  current: _propTypes.object
199
157
  })]),
200
-
201
158
  /** Ref-setting function, or ref created by useRef, passed to the number input element */
202
159
  numberRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
203
160
  current: _propTypes.object
package/lib/RadioBlock.js CHANGED
@@ -1,93 +1,60 @@
1
1
  "use strict";
2
2
 
3
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
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _classnames = _interopRequireDefault(require("classnames"));
15
-
16
11
  var _uuid = require("uuid");
17
-
18
12
  var _excluded = ["checked", "children", "className", "innerRef", "label", "labelClass", "name", "selectedValue", "showChildren", "value"];
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
16
  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); }
27
-
28
17
  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; }
29
-
30
18
  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; }
31
-
32
19
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
20
  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); } }
35
-
36
21
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
-
38
22
  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); }
39
-
40
23
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
42
24
  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); }; }
43
-
44
25
  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); }
45
-
46
26
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
-
48
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; } }
49
-
50
28
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
52
29
  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; }
53
-
54
30
  var RadioBlock = /*#__PURE__*/function (_Component) {
55
31
  _inherits(RadioBlock, _Component);
56
-
57
32
  var _super = _createSuper(RadioBlock);
58
-
59
33
  function RadioBlock() {
60
34
  var _this;
61
-
62
35
  _classCallCheck(this, RadioBlock);
63
-
64
36
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
65
37
  args[_key] = arguments[_key];
66
38
  }
67
-
68
39
  _this = _super.call.apply(_super, [this].concat(args));
69
-
70
40
  _defineProperty(_assertThisInitialized(_this), "id", "radio-block-".concat((0, _uuid.v4)()));
71
-
72
41
  return _this;
73
42
  }
74
-
75
43
  _createClass(RadioBlock, [{
76
44
  key: "render",
77
45
  value: function render() {
78
46
  var _this$props = this.props,
79
- checked = _this$props.checked,
80
- children = _this$props.children,
81
- className = _this$props.className,
82
- innerRef = _this$props.innerRef,
83
- label = _this$props.label,
84
- labelClass = _this$props.labelClass,
85
- name = _this$props.name,
86
- selectedValue = _this$props.selectedValue,
87
- showChildren = _this$props.showChildren,
88
- value = _this$props.value,
89
- inputProps = _objectWithoutProperties(_this$props, _excluded);
90
-
47
+ checked = _this$props.checked,
48
+ children = _this$props.children,
49
+ className = _this$props.className,
50
+ innerRef = _this$props.innerRef,
51
+ label = _this$props.label,
52
+ labelClass = _this$props.labelClass,
53
+ name = _this$props.name,
54
+ selectedValue = _this$props.selectedValue,
55
+ showChildren = _this$props.showChildren,
56
+ value = _this$props.value,
57
+ inputProps = _objectWithoutProperties(_this$props, _excluded);
91
58
  var isSelected = checked || selectedValue === value;
92
59
  return /*#__PURE__*/_react.default.createElement("div", {
93
60
  className: (0, _classnames.default)('ffe-radio-block', className)
@@ -113,40 +80,29 @@ var RadioBlock = /*#__PURE__*/function (_Component) {
113
80
  }, children)));
114
81
  }
115
82
  }]);
116
-
117
83
  return RadioBlock;
118
84
  }(_react.Component);
119
-
120
85
  RadioBlock.propTypes = {
121
86
  /** Whether or not the radio block is selected */
122
87
  checked: _propTypes.bool,
123
-
124
88
  /** The content rendered when choice is selected */
125
89
  children: _propTypes.node,
126
-
127
90
  /** Additional class names applied to the outer div */
128
91
  className: _propTypes.string,
129
-
130
92
  /** Ref-setting function, or ref created by useRef, passed to the input element */
131
93
  innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
132
94
  current: _propTypes.object
133
95
  })]),
134
-
135
96
  /** The always visible label of the radio block */
136
97
  label: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.string]).isRequired,
137
-
138
98
  /** Additional class names applied to the label element */
139
99
  labelClass: _propTypes.string,
140
-
141
100
  /** The name of the radio button set */
142
101
  name: _propTypes.string.isRequired,
143
-
144
102
  /** The selected value of the radio button set */
145
103
  selectedValue: _propTypes.string,
146
-
147
104
  /** Whether or not children are always visible */
148
105
  showChildren: _propTypes.bool,
149
-
150
106
  /** The value of the radio block */
151
107
  value: _propTypes.string.isRequired
152
108
  };
@@ -4,41 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _propTypes = require("prop-types");
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _BaseRadioButton = _interopRequireDefault(require("./BaseRadioButton"));
15
-
16
11
  var _excluded = ["className", "inline"];
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
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); }
21
-
22
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; }
23
-
24
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; }
25
-
26
16
  var RadioButton = function RadioButton(props) {
27
17
  var className = props.className,
28
- inline = props.inline,
29
- rest = _objectWithoutProperties(props, _excluded);
30
-
18
+ inline = props.inline,
19
+ rest = _objectWithoutProperties(props, _excluded);
31
20
  return /*#__PURE__*/_react.default.createElement(_BaseRadioButton.default, _extends({
32
21
  className: (0, _classnames.default)('ffe-radio-button', {
33
22
  'ffe-radio-button--inline': inline
34
23
  }, className)
35
24
  }, rest));
36
25
  };
37
-
38
26
  RadioButton.propTypes = {
39
27
  /** Additional class names applied to the label */
40
28
  className: _propTypes.string,
41
-
42
29
  /** Indicates whether the radio button is rendered inline or as a block */
43
30
  inline: _propTypes.bool
44
31
  };
@@ -4,56 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _propTypes = require("prop-types");
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _ErrorFieldMessage = _interopRequireDefault(require("./ErrorFieldMessage"));
15
-
16
11
  var _Tooltip = _interopRequireDefault(require("./Tooltip"));
17
-
18
12
  var _excluded = ["children", "className", "extraMargin", "description", "fieldMessage", "inline", "label", "name", "selectedValue", "tooltip"];
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  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); }
23
-
24
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
-
26
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27
-
28
17
  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; }
29
-
30
18
  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; }
31
-
32
19
  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; }
33
-
34
20
  var RadioButtonInputGroup = function RadioButtonInputGroup(props) {
35
21
  var children = props.children,
36
- className = props.className,
37
- extraMargin = props.extraMargin,
38
- description = props.description,
39
- fieldMessage = props.fieldMessage,
40
- inline = props.inline,
41
- label = props.label,
42
- name = props.name,
43
- selectedValue = props.selectedValue,
44
- tooltip = props.tooltip,
45
- rest = _objectWithoutProperties(props, _excluded);
46
-
22
+ className = props.className,
23
+ extraMargin = props.extraMargin,
24
+ description = props.description,
25
+ fieldMessage = props.fieldMessage,
26
+ inline = props.inline,
27
+ label = props.label,
28
+ name = props.name,
29
+ selectedValue = props.selectedValue,
30
+ tooltip = props.tooltip,
31
+ rest = _objectWithoutProperties(props, _excluded);
47
32
  if (tooltip && description) {
48
33
  throw new Error('Don\'t use both "tooltip" and "description" on an <RadioButtonInputGroup />, pick one of them');
49
34
  }
50
-
51
35
  var buttonProps = {
52
36
  inline: inline,
53
37
  name: name,
54
- onChange:
55
- /* istanbul ignore next */
56
- function onChange(f) {
38
+ onChange: /* istanbul ignore next */function onChange(f) {
57
39
  return f;
58
40
  },
59
41
  selectedValue: selectedValue
@@ -72,58 +54,46 @@ var RadioButtonInputGroup = function RadioButtonInputGroup(props) {
72
54
  element: "p"
73
55
  }, fieldMessage), /*#__PURE__*/_react.default.isValidElement(fieldMessage) && fieldMessage);
74
56
  };
75
-
76
57
  RadioButtonInputGroup.propTypes = {
77
58
  /**
78
59
  * Indicates whether the radio buttons inside this radio button group is
79
60
  * invalid or not. Propagated to all children.
80
61
  * */
81
62
  'aria-invalid': (0, _propTypes.oneOf)(['true', 'false']),
82
-
83
63
  /**
84
64
  * Function receiving props relevant to each radio button as an object
85
65
  * argument. Expected to return a set of radio buttons, which should get
86
66
  * these properties applied to them.
87
67
  * */
88
68
  children: _propTypes.func.isRequired,
89
-
90
69
  /** Additional class names applied to the fieldset */
91
70
  className: _propTypes.string,
92
-
93
71
  /** To just render a static, always visible tooltip, use this. */
94
72
  description: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.string]),
95
-
96
73
  /** Reserve space for showing `fieldMessage`s so content below don't move
97
74
  * vertically if an errormessage shows up. Note that this will only reserve
98
75
  * space for one line of content, so keep messages short.
99
76
  */
100
77
  extraMargin: _propTypes.bool,
101
-
102
78
  /** String or ErrorFieldMessage component with message */
103
79
  fieldMessage: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.string]),
104
-
105
80
  /**
106
81
  * Indicates whether the radio buttons inside this radio button group is
107
82
  * rendered inline or as a block.
108
83
  * */
109
84
  inline: _propTypes.bool,
110
-
111
85
  /**
112
86
  * The text describing the radio button set. Note that if you don't use this
113
87
  * prop but provide your own label you should make sure your solution passes
114
88
  * acessibility validation using a tool such as aXe DevTools.
115
89
  */
116
90
  label: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.string]),
117
-
118
91
  /** The name of the radio button, required to avoid missing name */
119
92
  name: _propTypes.string.isRequired,
120
-
121
93
  /** Change handler, receives value of selected radio button */
122
94
  onChange: _propTypes.func,
123
-
124
95
  /** The currently selected value */
125
96
  selectedValue: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string, _propTypes.number]),
126
-
127
97
  /**
128
98
  * String or Tooltip component with further detail about the radio button
129
99
  * set
@@ -1,46 +1,32 @@
1
1
  "use strict";
2
2
 
3
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
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = require("prop-types");
13
-
14
10
  var _classnames = _interopRequireDefault(require("classnames"));
15
-
16
11
  var _BaseRadioButton = _interopRequireDefault(require("./BaseRadioButton"));
17
-
18
12
  var _excluded = ["className", "leftLabel", "leftValue", "leftInnerRef", "rightLabel", "rightValue", "rightInnerRef", "condensed", "aria-invalid"];
19
-
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
16
  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); }
27
-
28
17
  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; }
29
-
30
18
  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; }
31
-
32
19
  var RadioSwitch = function RadioSwitch(props) {
33
20
  var className = props.className,
34
- leftLabel = props.leftLabel,
35
- leftValue = props.leftValue,
36
- leftInnerRef = props.leftInnerRef,
37
- rightLabel = props.rightLabel,
38
- rightValue = props.rightValue,
39
- rightInnerRef = props.rightInnerRef,
40
- condensed = props.condensed,
41
- ariaInvalid = props['aria-invalid'],
42
- rest = _objectWithoutProperties(props, _excluded);
43
-
21
+ leftLabel = props.leftLabel,
22
+ leftValue = props.leftValue,
23
+ leftInnerRef = props.leftInnerRef,
24
+ rightLabel = props.rightLabel,
25
+ rightValue = props.rightValue,
26
+ rightInnerRef = props.rightInnerRef,
27
+ condensed = props.condensed,
28
+ ariaInvalid = props['aria-invalid'],
29
+ rest = _objectWithoutProperties(props, _excluded);
44
30
  var noneSelected = [null, undefined, ''].includes(props.selectedValue);
45
31
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_BaseRadioButton.default, _extends({
46
32
  className: (0, _classnames.default)('ffe-radio-switch', className, {
@@ -58,39 +44,29 @@ var RadioSwitch = function RadioSwitch(props) {
58
44
  "aria-invalid": String(ariaInvalid === 'true' && (props.selectedValue === rightValue || noneSelected))
59
45
  }, rest), rightLabel));
60
46
  };
61
-
62
47
  RadioSwitch.propTypes = {
63
48
  /** Additional class names applied to both radio buttons */
64
49
  className: _propTypes.string,
65
-
66
50
  /** The label of the choice to the left */
67
51
  leftLabel: _propTypes.string.isRequired,
68
-
69
52
  /** The value of the choice to the left */
70
53
  leftValue: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string, _propTypes.number]).isRequired,
71
-
72
54
  /** Ref-setting function, or ref created by useRef, passed to the input element */
73
55
  leftInnerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
74
56
  current: _propTypes.object
75
57
  })]),
76
-
77
58
  /** The label of the choice to the right */
78
59
  rightLabel: _propTypes.string.isRequired,
79
-
80
60
  /** The value of the choice to the right */
81
61
  rightValue: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string, _propTypes.number]).isRequired,
82
-
83
62
  /** Ref-setting function, or ref created by useRef, passed to the input element */
84
63
  rightInnerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
85
64
  current: _propTypes.object
86
65
  })]),
87
-
88
66
  /** The selected value of the radio button set */
89
67
  selectedValue: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string, _propTypes.number]),
90
-
91
68
  /** Condensed modifier. Use in condensed designs */
92
69
  condensed: _propTypes.bool,
93
-
94
70
  /**
95
71
  * Indicates whether the radio buttons inside this radio button group is
96
72
  * invalid or not. Propagated to all children.
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _BaseFieldMessage = _interopRequireDefault(require("./BaseFieldMessage"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  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); }
15
-
16
11
  var SuccessFieldMessage = function SuccessFieldMessage(props) {
17
12
  return /*#__PURE__*/_react.default.createElement(_BaseFieldMessage.default, _extends({}, props, {
18
13
  type: "success"
19
14
  }));
20
15
  };
21
-
22
16
  var _default = SuccessFieldMessage;
23
17
  exports.default = _default;
package/lib/TextArea.js CHANGED
@@ -4,33 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _propTypes = require("prop-types");
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _excluded = ["className"];
15
-
16
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
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); }
19
-
20
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; }
21
-
22
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; }
23
-
24
15
  var TextArea = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
25
16
  var className = props.className,
26
- rest = _objectWithoutProperties(props, _excluded);
27
-
17
+ rest = _objectWithoutProperties(props, _excluded);
28
18
  return /*#__PURE__*/_react.default.createElement("textarea", _extends({
29
19
  className: (0, _classnames.default)('ffe-textarea', className),
30
20
  ref: ref
31
21
  }, rest));
32
22
  });
33
-
34
23
  TextArea.propTypes = {
35
24
  className: _propTypes.string
36
25
  };