@sb1/ffe-form-react 18.0.4 → 19.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/BaseRadioButton.js +35 -95
- package/es/Checkbox.js +43 -49
- package/es/Input.js +25 -26
- package/es/InputGroup.js +91 -109
- package/es/InputTextLike.js +25 -19
- package/es/Label.js +27 -28
- package/es/PhoneNumber.js +48 -158
- package/es/RadioBlock.js +37 -98
- package/es/RadioButton.js +26 -22
- package/es/RadioButtonInputGroup.js +47 -98
- package/es/RadioSwitch.js +38 -64
- package/es/TextArea.js +25 -16
- package/es/ToggleSwitch.js +36 -98
- package/es/Tooltip.js +29 -75
- package/es/i18n/en.js +6 -6
- package/es/i18n/i18n.js +4 -4
- package/es/i18n/nb.js +6 -6
- package/es/i18n/nn.js +6 -6
- package/es/index.js +14 -17
- package/es/message/BaseFieldMessage.js +49 -0
- package/es/message/ErrorFieldMessage.js +28 -0
- package/es/message/InfoFieldMessage.js +28 -0
- package/es/message/SuccessFieldMessage.js +28 -0
- package/es/message/index.js +3 -0
- package/es/types.js +1 -0
- package/lib/BaseRadioButton.js +63 -103
- package/lib/Checkbox.js +72 -56
- package/lib/Input.js +32 -34
- package/lib/InputGroup.js +121 -119
- package/lib/InputTextLike.js +32 -27
- package/lib/Label.js +34 -35
- package/lib/PhoneNumber.js +79 -165
- package/lib/RadioBlock.js +65 -106
- package/lib/RadioButton.js +33 -29
- package/lib/RadioButtonInputGroup.js +75 -103
- package/lib/RadioSwitch.js +44 -73
- package/lib/TextArea.js +32 -24
- package/lib/ToggleSwitch.js +67 -106
- package/lib/Tooltip.js +59 -86
- package/lib/i18n/en.js +8 -12
- package/lib/i18n/i18n.js +12 -14
- package/lib/i18n/nb.js +8 -12
- package/lib/i18n/nn.js +8 -12
- package/lib/index.js +32 -117
- package/lib/message/BaseFieldMessage.js +56 -0
- package/lib/message/ErrorFieldMessage.js +35 -0
- package/lib/message/InfoFieldMessage.js +35 -0
- package/lib/message/SuccessFieldMessage.js +35 -0
- package/lib/message/index.js +9 -0
- package/lib/types.js +2 -0
- package/package.json +6 -5
- package/types/BaseRadioButton.d.ts +14 -0
- package/types/Checkbox.d.ts +13 -0
- package/types/Input.d.ts +8 -0
- package/types/InputGroup.d.ts +36 -0
- package/types/InputTextLike.d.ts +5 -0
- package/types/Label.d.ts +9 -0
- package/types/PhoneNumber.d.ts +40 -0
- package/types/RadioBlock.d.ts +18 -0
- package/types/RadioButton.d.ts +7 -0
- package/types/RadioButtonInputGroup.d.ts +48 -0
- package/types/RadioSwitch.d.ts +23 -0
- package/types/TextArea.d.ts +4 -0
- package/types/ToggleSwitch.d.ts +16 -0
- package/types/Tooltip.d.ts +6 -0
- package/types/i18n/en.d.ts +8 -0
- package/types/i18n/i18n.d.ts +24 -0
- package/types/i18n/nb.d.ts +8 -0
- package/types/i18n/nn.d.ts +8 -0
- package/types/index.d.ts +14 -212
- package/types/message/BaseFieldMessage.d.ts +11 -0
- package/types/message/ErrorFieldMessage.d.ts +6 -0
- package/types/message/InfoFieldMessage.d.ts +6 -0
- package/types/message/SuccessFieldMessage.d.ts +6 -0
- package/types/message/index.d.ts +3 -0
- package/types/types.d.ts +11 -0
- package/es/BaseFieldMessage.js +0 -67
- package/es/ErrorFieldMessage.js +0 -21
- package/es/InfoFieldMessage.js +0 -9
- package/es/SuccessFieldMessage.js +0 -9
- package/es/index.d.js +0 -5
- package/lib/BaseFieldMessage.js +0 -73
- package/lib/ErrorFieldMessage.js +0 -28
- package/lib/InfoFieldMessage.js +0 -16
- package/lib/SuccessFieldMessage.js +0 -16
- package/lib/index.d.js +0 -6
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { BaseFieldMessage } from './BaseFieldMessage';
|
|
25
|
+
export var SuccessFieldMessage = function (_a) {
|
|
26
|
+
var rest = __rest(_a, []);
|
|
27
|
+
return React.createElement(BaseFieldMessage, __assign({ role: "none" }, rest, { type: "success" }));
|
|
28
|
+
};
|
package/es/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/BaseRadioButton.js
CHANGED
|
@@ -1,106 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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; }
|
|
19
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
20
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
24
|
-
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); }
|
|
25
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
26
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
-
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); }
|
|
29
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
32
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
|
-
var BaseRadioButton = /*#__PURE__*/function (_Component) {
|
|
34
|
-
function BaseRadioButton() {
|
|
35
|
-
var _this;
|
|
36
|
-
_classCallCheck(this, BaseRadioButton);
|
|
37
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
-
args[_key] = arguments[_key];
|
|
39
|
-
}
|
|
40
|
-
_this = _callSuper(this, BaseRadioButton, [].concat(args));
|
|
41
|
-
_defineProperty(_this, "id", "base-radio-button-".concat((0, _uuid.v4)()));
|
|
42
|
-
return _this;
|
|
43
|
-
}
|
|
44
|
-
_inherits(BaseRadioButton, _Component);
|
|
45
|
-
return _createClass(BaseRadioButton, [{
|
|
46
|
-
key: "render",
|
|
47
|
-
value: function render() {
|
|
48
|
-
var _this$props = this.props,
|
|
49
|
-
children = _this$props.children,
|
|
50
|
-
checked = _this$props.checked,
|
|
51
|
-
className = _this$props.className,
|
|
52
|
-
_this$props$labelProp = _this$props.labelProps,
|
|
53
|
-
labelProps = _this$props$labelProp === void 0 ? {} : _this$props$labelProp,
|
|
54
|
-
selectedValue = _this$props.selectedValue,
|
|
55
|
-
tooltip = _this$props.tooltip,
|
|
56
|
-
_this$props$tooltipPr = _this$props.tooltipProps,
|
|
57
|
-
tooltipProps = _this$props$tooltipPr === void 0 ? {} : _this$props$tooltipPr,
|
|
58
|
-
value = _this$props.value,
|
|
59
|
-
innerRef = _this$props.innerRef,
|
|
60
|
-
inputProps = _objectWithoutProperties(_this$props, _excluded);
|
|
61
|
-
var labelClasses = (0, _classnames.default)({
|
|
62
|
-
'ffe-radio-button--with-tooltip': tooltip
|
|
63
|
-
}, className);
|
|
64
|
-
var isSelected = selectedValue !== undefined ? selectedValue === value : checked;
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
66
|
-
className: "ffe-radio-input",
|
|
67
|
-
id: this.id,
|
|
68
|
-
ref: innerRef,
|
|
69
|
-
type: "radio",
|
|
70
|
-
checked: isSelected,
|
|
71
|
-
value: value
|
|
72
|
-
}, inputProps)), /*#__PURE__*/_react.default.createElement("label", _extends({
|
|
73
|
-
htmlFor: this.id
|
|
74
|
-
}, labelProps, {
|
|
75
|
-
className: labelClasses
|
|
76
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
77
|
-
className: "ffe-radio-input__content"
|
|
78
|
-
}, children)), tooltip && /*#__PURE__*/_react.default.createElement(_Tooltip.default, tooltipProps, tooltip));
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
79
18
|
}
|
|
80
|
-
|
|
81
|
-
}(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
tooltip: _propTypes.string,
|
|
97
|
-
/** Additional props passed to the Tooltip component */
|
|
98
|
-
tooltipProps: (0, _propTypes.shape)({}),
|
|
99
|
-
/** The value of the radio button */
|
|
100
|
-
value: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string, _propTypes.number]).isRequired,
|
|
101
|
-
/** Ref-setting function, or ref created by useRef, passed to the input element */
|
|
102
|
-
innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
|
|
103
|
-
current: _propTypes.object
|
|
104
|
-
})])
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
105
35
|
};
|
|
106
|
-
var
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.BaseRadioButton = void 0;
|
|
52
|
+
var react_1 = __importStar(require("react"));
|
|
53
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
54
|
+
var uuid_1 = require("uuid");
|
|
55
|
+
var Tooltip_1 = require("./Tooltip");
|
|
56
|
+
exports.BaseRadioButton = react_1.default.forwardRef(function (_a, ref) {
|
|
57
|
+
var children = _a.children, checked = _a.checked, className = _a.className, labelProps = _a.labelProps, selectedValue = _a.selectedValue, tooltip = _a.tooltip, _b = _a.tooltipProps, tooltipProps = _b === void 0 ? {} : _b, value = _a.value, inputProps = __rest(_a, ["children", "checked", "className", "labelProps", "selectedValue", "tooltip", "tooltipProps", "value"]);
|
|
58
|
+
var id = (0, react_1.useRef)("base-radio-button-".concat((0, uuid_1.v4)())).current;
|
|
59
|
+
var labelClasses = (0, classnames_1.default)({ 'ffe-radio-button--with-tooltip': tooltip }, className);
|
|
60
|
+
var isSelected = selectedValue === undefined ? checked : selectedValue === value;
|
|
61
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
|
+
react_1.default.createElement("input", __assign({ className: "ffe-radio-input", id: id, ref: ref, type: "radio", checked: isSelected, value: "".concat(value) }, inputProps)),
|
|
63
|
+
react_1.default.createElement("label", __assign({ htmlFor: id }, labelProps, { className: labelClasses }),
|
|
64
|
+
react_1.default.createElement("span", { className: "ffe-radio-input__content" }, children)),
|
|
65
|
+
tooltip && react_1.default.createElement(Tooltip_1.Tooltip, __assign({}, tooltipProps), tooltip)));
|
|
66
|
+
});
|
package/lib/Checkbox.js
CHANGED
|
@@ -1,59 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'ffe-checkbox--inline': inline,
|
|
29
|
-
'ffe-checkbox--no-margin': noMargins,
|
|
30
|
-
'ffe-checkbox--hidden-label': hiddenLabel
|
|
31
|
-
}),
|
|
32
|
-
htmlFor: id
|
|
33
|
-
};
|
|
34
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
35
|
-
ref: ref,
|
|
36
|
-
className: "ffe-hidden-checkbox",
|
|
37
|
-
id: id,
|
|
38
|
-
type: "checkbox"
|
|
39
|
-
}, rest)), typeof children === 'function' ? children(labelProps) :
|
|
40
|
-
/*#__PURE__*/
|
|
41
|
-
// eslint-disable-next-line jsx-a11y/label-has-for
|
|
42
|
-
_react.default.createElement("label", labelProps, /*#__PURE__*/_react.default.createElement("span", {
|
|
43
|
-
className: (0, _classnames.default)('ffe-checkbox__content', {
|
|
44
|
-
'ffe-screenreader-only': hiddenLabel
|
|
45
|
-
})
|
|
46
|
-
}, children)));
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
47
28
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
58
46
|
};
|
|
59
|
-
var
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.Checkbox = void 0;
|
|
52
|
+
var react_1 = __importStar(require("react"));
|
|
53
|
+
var uuid_1 = require("uuid");
|
|
54
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
55
|
+
exports.Checkbox = react_1.default.forwardRef(function (_a, ref) {
|
|
56
|
+
var children = _a.children, hiddenLabel = _a.hiddenLabel, _b = _a.inline, inline = _b === void 0 ? true : _b, noMargins = _a.noMargins, id = _a.id, rest = __rest(_a, ["children", "hiddenLabel", "inline", "noMargins", "id"]);
|
|
57
|
+
var generatedId = (0, react_1.useRef)(id !== null && id !== void 0 ? id : "checkbox-".concat((0, uuid_1.v4)())).current;
|
|
58
|
+
var labelProps = {
|
|
59
|
+
className: (0, classnames_1.default)({
|
|
60
|
+
'ffe-checkbox': true,
|
|
61
|
+
'ffe-checkbox--inline': inline,
|
|
62
|
+
'ffe-checkbox--no-margin': noMargins,
|
|
63
|
+
'ffe-checkbox--hidden-label': hiddenLabel,
|
|
64
|
+
}),
|
|
65
|
+
htmlFor: generatedId,
|
|
66
|
+
};
|
|
67
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
68
|
+
react_1.default.createElement("input", __assign({ ref: ref, className: "ffe-hidden-checkbox", id: generatedId, type: "checkbox" }, rest)),
|
|
69
|
+
typeof children === 'function' ? (children(labelProps)) : (
|
|
70
|
+
// eslint-disable-next-line jsx-a11y/label-has-for
|
|
71
|
+
react_1.default.createElement("label", __assign({}, labelProps),
|
|
72
|
+
react_1.default.createElement("span", { className: (0, classnames_1.default)('ffe-checkbox__content', {
|
|
73
|
+
'ffe-screenreader-only': hiddenLabel,
|
|
74
|
+
}) }, children)))));
|
|
75
|
+
});
|
package/lib/Input.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, {
|
|
24
|
-
'ffe-input-field--text-right-align': textRightAlign
|
|
25
|
-
}, className),
|
|
26
|
-
ref: ref
|
|
27
|
-
}, rest));
|
|
28
|
-
});
|
|
29
|
-
Input.propTypes = {
|
|
30
|
-
className: _propTypes.string,
|
|
31
|
-
/** Input fields default to `display: block;`. Set this to `true` to apply the inline modifier. */
|
|
32
|
-
inline: _propTypes.bool,
|
|
33
|
-
/** Make the text right aligned */
|
|
34
|
-
textRightAlign: _propTypes.bool
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
35
23
|
};
|
|
36
|
-
var
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.Input = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
31
|
+
exports.Input = react_1.default.forwardRef(function (_a, ref) {
|
|
32
|
+
var className = _a.className, inline = _a.inline, textRightAlign = _a.textRightAlign, rest = __rest(_a, ["className", "inline", "textRightAlign"]);
|
|
33
|
+
return (react_1.default.createElement("input", __assign({ className: (0, classnames_1.default)('ffe-input-field', { 'ffe-input-field--inline': inline }, { 'ffe-input-field--text-right-align': textRightAlign }, className), ref: ref }, rest)));
|
|
34
|
+
});
|