dibk-design 0.4.32 → 0.4.36
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/dist/components/CheckBoxIcon.module.scss +5 -0
- package/dist/components/InputField.js +59 -56
- package/dist/components/RadioButtonIcon.js +5 -3
- package/dist/components/RadioButtonIcon.md +12 -0
- package/dist/components/RadioButtonIcon.module.scss +16 -2
- package/dist/components/RadioButtonInput.js +7 -4
- package/dist/components/RadioButtonInput.module.scss +7 -0
- package/dist/components/RadioButtonListItem.js +6 -3
- package/dist/components/RadioButtonListItem.md +17 -0
- package/dist/components/Select.js +3 -1
- package/dist/components/Textarea.js +3 -0
- package/dist/functions/generators.js +20 -0
- package/package.json +1 -1
|
@@ -11,18 +11,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
|
-
var _Button = _interopRequireDefault(require("./Button"));
|
|
15
|
-
|
|
16
|
-
var _Label = _interopRequireDefault(require("./Label"));
|
|
17
|
-
|
|
18
14
|
var _reactDatepicker = _interopRequireWildcard(require("react-datepicker"));
|
|
19
15
|
|
|
20
16
|
var _dateFns = require("date-fns");
|
|
21
17
|
|
|
22
18
|
var _nb = _interopRequireDefault(require("date-fns/locale/nb"));
|
|
23
19
|
|
|
20
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
21
|
+
|
|
22
|
+
var _Label = _interopRequireDefault(require("./Label"));
|
|
23
|
+
|
|
24
24
|
var _theme = require("../functions/theme");
|
|
25
25
|
|
|
26
|
+
var _generators = require("../functions/generators");
|
|
27
|
+
|
|
26
28
|
require("react-datepicker/dist/react-datepicker.css");
|
|
27
29
|
|
|
28
30
|
var _InputFieldModule = _interopRequireDefault(require("./InputField.module.scss"));
|
|
@@ -100,64 +102,63 @@ var InputField = /*#__PURE__*/function (_React$Component) {
|
|
|
100
102
|
return this.props.type === 'date' ? value ? this.convertDateToString(value) : defaultContent : value ? value : defaultContent;
|
|
101
103
|
}
|
|
102
104
|
}, {
|
|
103
|
-
key: "
|
|
104
|
-
value: function
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
key: "getInputElementProps",
|
|
106
|
+
value: function getInputElementProps(defaultValue, styleRules) {
|
|
107
|
+
var _ref;
|
|
108
|
+
|
|
109
|
+
return _ref = {
|
|
110
|
+
name: this.props.name,
|
|
111
|
+
readOnly: this.props.readOnly,
|
|
112
|
+
disabled: this.props.disabled,
|
|
113
|
+
type: this.props.type,
|
|
114
|
+
id: this.props.id,
|
|
115
|
+
key: "".concat(this.props.id, "-").concat((0, _generators.generateRandomString)(6)),
|
|
116
|
+
onChange: this.props.onChange,
|
|
117
|
+
onBlur: this.props.onBlur
|
|
118
|
+
}, _defineProperty(_ref, defaultValue ? 'defaultValue' : 'value', defaultValue || this.props.value), _defineProperty(_ref, "placeholder", this.props.placeholder), _defineProperty(_ref, "className", this.props.hasErrors ? _InputFieldModule.default.hasErrors : ''), _defineProperty(_ref, 'aria-required', this.props.mandatory), _defineProperty(_ref, "style", styleRules), _ref;
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "getDatePickerElementProps",
|
|
122
|
+
value: function getDatePickerElementProps(defaultValue) {
|
|
123
|
+
var _this = this;
|
|
111
124
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
-
style: styleRules
|
|
138
|
-
}, /*#__PURE__*/_react.default.createElement(_reactDatepicker.default, props));
|
|
139
|
-
} else {
|
|
140
|
-
var _props2;
|
|
141
|
-
|
|
142
|
-
var _props = (_props2 = {
|
|
143
|
-
name: this.props.name,
|
|
144
|
-
readOnly: this.props.readOnly,
|
|
145
|
-
disabled: this.props.disabled,
|
|
146
|
-
type: this.props.type,
|
|
147
|
-
id: this.props.id,
|
|
148
|
-
onChange: this.props.onChange,
|
|
149
|
-
onBlur: this.props.onBlur
|
|
150
|
-
}, _defineProperty(_props2, defaultValue ? 'defaultValue' : 'value', defaultValue || this.props.value), _defineProperty(_props2, "placeholder", this.props.placeholder), _defineProperty(_props2, "className", this.props.hasErrors ? _InputFieldModule.default.hasErrors : ''), _defineProperty(_props2, 'aria-required', this.props.mandatory), _defineProperty(_props2, "style", styleRules), _props2);
|
|
151
|
-
|
|
152
|
-
return /*#__PURE__*/_react.default.createElement("input", _props);
|
|
153
|
-
}
|
|
125
|
+
return {
|
|
126
|
+
name: this.props.name,
|
|
127
|
+
readOnly: this.props.readOnly,
|
|
128
|
+
disabled: this.props.disabled,
|
|
129
|
+
id: this.props.id,
|
|
130
|
+
key: "".concat(this.props.id, "-").concat((0, _generators.generateRandomString)(6)),
|
|
131
|
+
dateFormat: this.props.dateFormat,
|
|
132
|
+
locale: 'nb',
|
|
133
|
+
selectsStart: this.props.selectsStart,
|
|
134
|
+
selectsEnd: this.props.selectsEnd,
|
|
135
|
+
startDate: this.props.startDate ? new Date(this.props.startDate) : null,
|
|
136
|
+
endDate: this.props.endDate ? new Date(this.props.endDate) : null,
|
|
137
|
+
minDate: this.props.minDate || null,
|
|
138
|
+
maxDate: this.props.maxDate || null,
|
|
139
|
+
onChange: this.props.onChange ? function (date) {
|
|
140
|
+
return _this.props.onChange(date);
|
|
141
|
+
} : console.log("Missing onChange handler for date picker with id: ".concat(this.props.id)),
|
|
142
|
+
onBlur: this.props.onBlur ? function (date) {
|
|
143
|
+
return _this.props.onBlur(date);
|
|
144
|
+
} : null,
|
|
145
|
+
selected: defaultValue ? new Date(defaultValue) : null,
|
|
146
|
+
placeholderText: this.props.placeholder,
|
|
147
|
+
className: this.props.hasErrors ? _InputFieldModule.default.hasErrors : ''
|
|
148
|
+
};
|
|
154
149
|
}
|
|
155
150
|
}, {
|
|
156
151
|
key: "render",
|
|
157
152
|
value: function render() {
|
|
158
|
-
var
|
|
153
|
+
var _this$props$width,
|
|
154
|
+
_this2 = this;
|
|
159
155
|
|
|
160
156
|
var defaultValue = this.props.defaultValue ? this.props.defaultValue : this.props.value || null;
|
|
157
|
+
|
|
158
|
+
var styleRules = _objectSpread(_objectSpread({}, this.props.hasErrors ? this.getThemeErrorInputStyle(this.props.theme) : null), ((_this$props$width = this.props.width) === null || _this$props$width === void 0 ? void 0 : _this$props$width.length) && {
|
|
159
|
+
maxWidth: this.props.width
|
|
160
|
+
});
|
|
161
|
+
|
|
161
162
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
162
163
|
className: "".concat(_InputFieldModule.default.inputField, " ").concat(_InputFieldModule.default[this.props.type])
|
|
163
164
|
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
@@ -173,7 +174,9 @@ var InputField = /*#__PURE__*/function (_React$Component) {
|
|
|
173
174
|
},
|
|
174
175
|
content: this.props.buttonContent,
|
|
175
176
|
theme: this.props.theme
|
|
176
|
-
}) : '') : ''), !this.props.contentOnly ? this.
|
|
177
|
+
}) : '') : ''), !this.props.contentOnly ? this.props.type === 'date' ? /*#__PURE__*/_react.default.createElement("div", {
|
|
178
|
+
style: styleRules
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(_reactDatepicker.default, this.getDatePickerElementProps(defaultValue))) : /*#__PURE__*/_react.default.createElement("input", this.getInputElementProps(defaultValue, styleRules)) : /*#__PURE__*/_react.default.createElement("span", null, this.renderValueAsText(this.props.value || this.props.defaultValue, this.props.defaultContent)), /*#__PURE__*/_react.default.createElement("span", {
|
|
177
180
|
className: _InputFieldModule.default.errorMessage,
|
|
178
181
|
style: this.getThemeErrorMessageStyle(this.props.theme)
|
|
179
182
|
}, this.props.errorMessage ? this.props.errorMessage : ''));
|
|
@@ -70,7 +70,7 @@ var RadioButtonIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
73
|
-
className: "".concat(_RadioButtonIconModule.default.radioButtonIcon, " ").concat(this.props.checked ? _RadioButtonIconModule.default.checked : '', " ").concat(this.props.disabled ? _RadioButtonIconModule.default.disabled : ''),
|
|
73
|
+
className: "".concat(_RadioButtonIconModule.default.radioButtonIcon, " ").concat(this.props.checked ? _RadioButtonIconModule.default.checked : '', " ").concat(this.props.disabled ? _RadioButtonIconModule.default.disabled : '', " ").concat(this.props.hasErrors ? _RadioButtonIconModule.default.hasErrors : ''),
|
|
74
74
|
style: inlineStyle
|
|
75
75
|
});
|
|
76
76
|
}
|
|
@@ -83,12 +83,14 @@ RadioButtonIcon.propTypes = {
|
|
|
83
83
|
size: _propTypes.default.string,
|
|
84
84
|
checked: _propTypes.default.bool,
|
|
85
85
|
disabled: _propTypes.default.bool,
|
|
86
|
-
theme: _propTypes.default.object
|
|
86
|
+
theme: _propTypes.default.object,
|
|
87
|
+
hasErrors: _propTypes.default.bool
|
|
87
88
|
};
|
|
88
89
|
RadioButtonIcon.defaultProps = {
|
|
89
90
|
size: '10px',
|
|
90
91
|
checked: false,
|
|
91
|
-
disabled: false
|
|
92
|
+
disabled: false,
|
|
93
|
+
hasErrors: false
|
|
92
94
|
};
|
|
93
95
|
var _default = RadioButtonIcon;
|
|
94
96
|
exports.default = _default;
|
|
@@ -5,6 +5,10 @@ Regular radio button icons example:
|
|
|
5
5
|
<RadioButtonIcon checked={true} />
|
|
6
6
|
<RadioButtonIcon disabled={true} />
|
|
7
7
|
<RadioButtonIcon checked={true} disabled={true} />
|
|
8
|
+
<RadioButtonIcon hasErrors={true} />
|
|
9
|
+
<RadioButtonIcon hasErrors={true} disabled={true} />
|
|
10
|
+
<RadioButtonIcon checked={true} hasErrors={true} />
|
|
11
|
+
<RadioButtonIcon checked={true} hasErrors={true} disabled={true} />
|
|
8
12
|
```
|
|
9
13
|
|
|
10
14
|
Themed Regular radio button icons example:
|
|
@@ -16,6 +20,10 @@ import customTheme from 'data/customTheme';
|
|
|
16
20
|
<RadioButtonIcon checked={true} theme={customTheme} />
|
|
17
21
|
<RadioButtonIcon theme={customTheme} disabled={true} />
|
|
18
22
|
<RadioButtonIcon checked={true} theme={customTheme} disabled={true} />
|
|
23
|
+
<RadioButtonIcon hasErrors={true} theme={customTheme} />
|
|
24
|
+
<RadioButtonIcon hasErrors={true} disabled={true} theme={customTheme} />
|
|
25
|
+
<RadioButtonIcon checked={true} hasErrors={true} theme={customTheme} />
|
|
26
|
+
<RadioButtonIcon checked={true} hasErrors={true} disabled={true} theme={customTheme} />
|
|
19
27
|
</React.Fragment>
|
|
20
28
|
```
|
|
21
29
|
|
|
@@ -26,4 +34,8 @@ Radio button icons with custom size example:
|
|
|
26
34
|
<RadioButtonIcon size='36px' checked={true} />
|
|
27
35
|
<RadioButtonIcon size='36px' disabled={true} />
|
|
28
36
|
<RadioButtonIcon size='36px' checked={true} disabled={true} />
|
|
37
|
+
<RadioButtonIcon size='36px' hasErrors={true} />
|
|
38
|
+
<RadioButtonIcon size='36px' hasErrors={true} disabled={true} />
|
|
39
|
+
<RadioButtonIcon size='36px' checked={true} hasErrors={true} />
|
|
40
|
+
<RadioButtonIcon size='36px' checked={true} hasErrors={true} disabled={true} />
|
|
29
41
|
```
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:local(.radioButtonIcon) {
|
|
4
4
|
@include border-radius(50%);
|
|
5
|
-
@include box-shadow(0 0 0 1px #afaba8);
|
|
6
5
|
@include transition(all 0.1s ease-in-out);
|
|
7
6
|
@include box-sizing(content-box);
|
|
8
7
|
display: inline-block;
|
|
@@ -16,9 +15,24 @@
|
|
|
16
15
|
border: 0.3em solid white;
|
|
17
16
|
cursor: pointer;
|
|
18
17
|
|
|
18
|
+
&:not(:local(.hasErrors)) {
|
|
19
|
+
@include box-shadow(0 0 0 1px #afaba8);
|
|
20
|
+
}
|
|
21
|
+
&:local(.hasErrors) {
|
|
22
|
+
@include box-shadow(0 0 2px 1px #9d2024);
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
&:local(.checked) {
|
|
20
|
-
@include box-shadow(0 0 0 1px $color-dark-blue);
|
|
21
26
|
background: $color-primary;
|
|
27
|
+
&:local(.hasErrors) {
|
|
28
|
+
background: #9d2024;
|
|
29
|
+
}
|
|
30
|
+
&:not(:local(.hasErrors)) {
|
|
31
|
+
@include box-shadow(0 0 0 1px $color-dark-blue);
|
|
32
|
+
}
|
|
33
|
+
&:local(.hasErrors) {
|
|
34
|
+
@include box-shadow(0 0 2px 1px #9d2024);
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
&:local(.disabled) {
|
|
24
38
|
opacity: 0.5;
|
|
@@ -53,11 +53,12 @@ var RadioButtonInput = /*#__PURE__*/function (_React$Component) {
|
|
|
53
53
|
value: function render() {
|
|
54
54
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
55
55
|
htmlFor: this.props.id,
|
|
56
|
-
className: "".concat(_RadioButtonInputModule.default.radioButtonInput, " ").concat(this.props.checked ? _RadioButtonInputModule.default.checked : '', " ").concat(this.props.disabled ? _RadioButtonInputModule.default.disabled : '')
|
|
56
|
+
className: "".concat(_RadioButtonInputModule.default.radioButtonInput, " ").concat(this.props.checked ? _RadioButtonInputModule.default.checked : '', " ").concat(this.props.disabled ? _RadioButtonInputModule.default.disabled : '', " ").concat(this.props.hasErrors ? _RadioButtonInputModule.default.hasErrors : '')
|
|
57
57
|
}, !this.props.contentOnly ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_RadioButtonIcon.default, {
|
|
58
58
|
checked: this.props.checked,
|
|
59
59
|
disabled: this.props.disabled,
|
|
60
|
-
theme: this.props.theme
|
|
60
|
+
theme: this.props.theme,
|
|
61
|
+
hasErrors: this.props.hasErrors
|
|
61
62
|
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
62
63
|
type: "radio",
|
|
63
64
|
onChange: this.props.onChange,
|
|
@@ -80,13 +81,15 @@ RadioButtonInput.propTypes = {
|
|
|
80
81
|
id: _propTypes.default.string.isRequired,
|
|
81
82
|
onChange: _propTypes.default.func,
|
|
82
83
|
contentOnly: _propTypes.default.bool,
|
|
83
|
-
theme: _propTypes.default.object
|
|
84
|
+
theme: _propTypes.default.object,
|
|
85
|
+
hasErrors: _propTypes.default.bool
|
|
84
86
|
};
|
|
85
87
|
RadioButtonInput.defaultProps = {
|
|
86
88
|
name: '',
|
|
87
89
|
checked: false,
|
|
88
90
|
disabled: false,
|
|
89
|
-
contentOnly: false
|
|
91
|
+
contentOnly: false,
|
|
92
|
+
hasErrors: false
|
|
90
93
|
};
|
|
91
94
|
var _default = RadioButtonInput;
|
|
92
95
|
exports.default = _default;
|
|
@@ -52,13 +52,14 @@ var RadioButtonListItem = /*#__PURE__*/function (_React$Component) {
|
|
|
52
52
|
key: "render",
|
|
53
53
|
value: function render() {
|
|
54
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
-
className: "".concat(_RadioButtonListItemModule.default.radioButtonListItem, " ").concat(this.props.disabled ? _RadioButtonListItemModule.default.disabled : '', " ").concat(this.props.compact ? _RadioButtonListItemModule.default.compact : '', " ").concat(this.props.contentOnly ? _RadioButtonListItemModule.default.contentOnly : '')
|
|
55
|
+
className: "".concat(_RadioButtonListItemModule.default.radioButtonListItem, " ").concat(this.props.disabled ? _RadioButtonListItemModule.default.disabled : '', " ").concat(this.props.compact ? _RadioButtonListItemModule.default.compact : '', " ").concat(this.props.contentOnly ? _RadioButtonListItemModule.default.contentOnly : '', " ").concat(this.props.hasErrors ? _RadioButtonListItemModule.default.hasErrors : '')
|
|
56
56
|
}, /*#__PURE__*/_react.default.createElement(_RadioButtonInput.default, {
|
|
57
57
|
onChange: this.props.onChange,
|
|
58
58
|
inputValue: this.props.inputValue,
|
|
59
59
|
checked: this.props.checked,
|
|
60
60
|
disabled: this.props.disabled,
|
|
61
61
|
contentOnly: this.props.contentOnly,
|
|
62
|
+
hasErrors: this.props.hasErrors,
|
|
62
63
|
id: this.props.id,
|
|
63
64
|
theme: this.props.theme
|
|
64
65
|
}, this.props.children));
|
|
@@ -77,13 +78,15 @@ RadioButtonListItem.propTypes = {
|
|
|
77
78
|
id: _propTypes.default.string.isRequired,
|
|
78
79
|
onChange: _propTypes.default.func,
|
|
79
80
|
contentOnly: _propTypes.default.bool,
|
|
80
|
-
theme: _propTypes.default.object
|
|
81
|
+
theme: _propTypes.default.object,
|
|
82
|
+
hasErrors: _propTypes.default.bool
|
|
81
83
|
};
|
|
82
84
|
RadioButtonListItem.defaultProps = {
|
|
83
85
|
name: '',
|
|
84
86
|
checked: false,
|
|
85
87
|
disabled: false,
|
|
86
|
-
contentOnly: false
|
|
88
|
+
contentOnly: false,
|
|
89
|
+
hasErrors: false
|
|
87
90
|
};
|
|
88
91
|
var _default = RadioButtonListItem;
|
|
89
92
|
exports.default = _default;
|
|
@@ -15,6 +15,23 @@ Radio button list item example:
|
|
|
15
15
|
</RadioButtonListItem>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Radio button with errors list item example:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 1" name="radio-button-list-item-with-errors" id="radio-button-list-item-with-errors-1" checked={true} hasErrors={true}>
|
|
22
|
+
Checked radio button with errors
|
|
23
|
+
</RadioButtonListItem>
|
|
24
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="radio-button-list-item-with-errors" id="radio-button-list-item-with-errors-2" hasErrors={true}>
|
|
25
|
+
Unchecked radio button with errors
|
|
26
|
+
</RadioButtonListItem>
|
|
27
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 1" name="radio-button-list-item-with-errors" id="radio-button-list-item-with-errors-3" checked={true} disabled={true} hasErrors={true}>
|
|
28
|
+
Disabled checked radio button with errors
|
|
29
|
+
</RadioButtonListItem>
|
|
30
|
+
<RadioButtonListItem onChange={()=>{console.log('onchange')}} inputValue="value 2" name="radio-button-list-item-with-errors" id="radio-button-list-item-with-errors-4" disabled={true} hasErrors={true}>
|
|
31
|
+
Disabled Unchecked radio button with errors
|
|
32
|
+
</RadioButtonListItem>
|
|
33
|
+
```
|
|
34
|
+
|
|
18
35
|
Compact radio button list item example:
|
|
19
36
|
|
|
20
37
|
```js
|
|
@@ -13,6 +13,8 @@ var _Label = _interopRequireDefault(require("./Label"));
|
|
|
13
13
|
|
|
14
14
|
var _theme = require("../functions/theme");
|
|
15
15
|
|
|
16
|
+
var _generators = require("../functions/generators");
|
|
17
|
+
|
|
16
18
|
var _SelectModule = _interopRequireDefault(require("./Select.module.scss"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -151,7 +153,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
151
153
|
var props = (_props = {
|
|
152
154
|
name: this.props.name,
|
|
153
155
|
multiple: this.props.multiple
|
|
154
|
-
}, _defineProperty(_props, defaultValue ? 'defaultValue' : 'value', defaultValue || this.props.value), _defineProperty(_props, "onChange", this.props.onChange), _defineProperty(_props, "id", this.props.id), _defineProperty(_props, "className", this.props.hasErrors ? _SelectModule.default.hasErrors : ''), _defineProperty(_props, "style", styleRules), _props);
|
|
156
|
+
}, _defineProperty(_props, defaultValue ? 'defaultValue' : 'value', defaultValue || this.props.value), _defineProperty(_props, "onChange", this.props.onChange), _defineProperty(_props, "id", this.props.id), _defineProperty(_props, "key", "".concat(this.props.id, "-").concat((0, _generators.generateRandomString)(6))), _defineProperty(_props, "className", this.props.hasErrors ? _SelectModule.default.hasErrors : ''), _defineProperty(_props, "style", styleRules), _props);
|
|
155
157
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
156
158
|
className: _SelectModule.default.select
|
|
157
159
|
}, /*#__PURE__*/_react.default.createElement(_Label.default, {
|
|
@@ -15,6 +15,8 @@ var _Label = _interopRequireDefault(require("./Label"));
|
|
|
15
15
|
|
|
16
16
|
var _theme = require("../functions/theme");
|
|
17
17
|
|
|
18
|
+
var _generators = require("../functions/generators");
|
|
19
|
+
|
|
18
20
|
var _TextareaModule = _interopRequireDefault(require("./Textarea.module.scss"));
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -95,6 +97,7 @@ var Textarea = /*#__PURE__*/function (_React$Component) {
|
|
|
95
97
|
disabled: this.props.disabled,
|
|
96
98
|
type: this.props.type,
|
|
97
99
|
id: this.props.id,
|
|
100
|
+
key: "".concat(this.props.id, "-").concat((0, _generators.generateRandomString)(6)),
|
|
98
101
|
onChange: this.props.onChange,
|
|
99
102
|
onBlur: this.props.onBlur
|
|
100
103
|
}, _defineProperty(_props, defaultValue ? 'defaultValue' : 'value', defaultValue || this.props.value), _defineProperty(_props, "placeholder", this.props.placeholder), _defineProperty(_props, "rows", this.props.rows), _defineProperty(_props, "className", this.props.hasErrors ? _TextareaModule.default.hasErrors : ''), _defineProperty(_props, 'aria-required', this.props.mandatory), _defineProperty(_props, "style", styleRules), _props);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateRandomString = void 0;
|
|
7
|
+
|
|
8
|
+
var generateRandomString = function generateRandomString(length) {
|
|
9
|
+
var result = '';
|
|
10
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
11
|
+
var charactersLength = characters.length;
|
|
12
|
+
|
|
13
|
+
for (var i = 0; i < length; i++) {
|
|
14
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.generateRandomString = generateRandomString;
|