@semcore/bulk-textarea 1.4.0 → 1.4.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/CHANGELOG.md +6 -0
- package/lib/cjs/components/InputField/InputField.js +15 -13
- package/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/lib/es6/components/InputField/InputField.js +15 -13
- package/lib/es6/components/InputField/InputField.js.map +1 -1
- package/lib/esm/BulkTextarea.mjs +202 -143
- package/lib/esm/components/ClearAll.mjs +14 -13
- package/lib/esm/components/Counter.mjs +15 -14
- package/lib/esm/components/ErrorsNavigation.mjs +30 -30
- package/lib/esm/components/InputField/InputField.mjs +872 -429
- package/lib/esm/components/InputField/inputField.shadow.css +171 -0
- package/lib/esm/index.mjs +2 -2
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +2 -2
- package/lib/esm/translations/en.json.mjs +2 -2
- package/lib/esm/translations/es.json.mjs +2 -2
- package/lib/esm/translations/fr.json.mjs +2 -2
- package/lib/esm/translations/it.json.mjs +2 -2
- package/lib/esm/translations/ja.json.mjs +2 -2
- package/lib/esm/translations/ko.json.mjs +2 -2
- package/lib/esm/translations/nl.json.mjs +2 -2
- package/lib/esm/translations/pl.json.mjs +2 -2
- package/lib/esm/translations/pt.json.mjs +2 -2
- package/lib/esm/translations/sv.json.mjs +2 -2
- package/lib/esm/translations/tr.json.mjs +2 -2
- package/lib/esm/translations/vi.json.mjs +2 -2
- package/lib/esm/translations/zh.json.mjs +2 -2
- package/package.json +9 -9
package/lib/esm/BulkTextarea.mjs
CHANGED
|
@@ -1,63 +1,98 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Box
|
|
10
|
-
import { InputField
|
|
11
|
-
import { Counter
|
|
12
|
-
import { ClearAll
|
|
13
|
-
import { ErrorsNavigation
|
|
14
|
-
import { localizedMessages
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
for (var
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import createComponent, { assignProps, Component } from "@semcore/core";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { Box } from "@semcore/flex-box";
|
|
10
|
+
import { InputField } from "./components/InputField/InputField.mjs";
|
|
11
|
+
import { Counter } from "./components/Counter.mjs";
|
|
12
|
+
import { ClearAll } from "./components/ClearAll.mjs";
|
|
13
|
+
import { ErrorsNavigation } from "./components/ErrorsNavigation.mjs";
|
|
14
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
15
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
16
|
+
import focusSourceEnhance from "@semcore/utils/lib/enhances/focusSourceEnhance";
|
|
17
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
18
|
+
var BulkTextareaRoot = /* @__PURE__ */ function(_Component) {
|
|
19
|
+
_inherits(BulkTextareaRoot2, _Component);
|
|
20
|
+
var _super = _createSuper(BulkTextareaRoot2);
|
|
21
|
+
function BulkTextareaRoot2() {
|
|
22
|
+
var _this;
|
|
23
|
+
_classCallCheck(this, BulkTextareaRoot2);
|
|
24
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
+
args[_key] = arguments[_key];
|
|
26
|
+
}
|
|
27
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
28
|
+
_defineProperty(_assertThisInitialized(_this), "inputFieldRef", /* @__PURE__ */ React.createRef());
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "clearAllButtonRef", /* @__PURE__ */ React.createRef());
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "nextButtonRef", /* @__PURE__ */ React.createRef());
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "prevButtonRef", /* @__PURE__ */ React.createRef());
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "counterRef", /* @__PURE__ */ React.createRef());
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
27
34
|
linesCount: 0,
|
|
28
|
-
isEmptyText:
|
|
35
|
+
isEmptyText: true,
|
|
29
36
|
errorIndex: -1,
|
|
30
|
-
highlightErrorIndex:
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
highlightErrorIndex: false
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "handleChangeLinesCount", function(linesCount) {
|
|
40
|
+
var isEmpty = !linesCount;
|
|
41
|
+
_this.setState({
|
|
42
|
+
linesCount,
|
|
43
|
+
isEmptyText: isEmpty
|
|
44
|
+
});
|
|
45
|
+
if (isEmpty) {
|
|
46
|
+
_this.handlers.showErrors(false);
|
|
47
|
+
_this.handlers.errors([]);
|
|
48
|
+
_this.handlers.state("normal");
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "handleClickClearAll", function(e) {
|
|
52
|
+
var _this$inputFieldRef$c;
|
|
53
|
+
_this.handlers.showErrors(false);
|
|
54
|
+
_this.handlers.errors([]);
|
|
55
|
+
_this.setState({
|
|
40
56
|
errorIndex: -1
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
});
|
|
58
|
+
_this.handlers.value("", e);
|
|
59
|
+
_this.handlers.state("normal");
|
|
60
|
+
var textarea = (_this$inputFieldRef$c = _this.inputFieldRef.current) === null || _this$inputFieldRef$c === void 0 ? void 0 : _this$inputFieldRef$c.querySelector('[role="textbox"]');
|
|
61
|
+
textarea instanceof HTMLDivElement && textarea.focus();
|
|
62
|
+
});
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "handleChangeErrorIndex", function(amount) {
|
|
45
64
|
return function() {
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
var _this$asProps$errors = _this.asProps.errors, errors = _this$asProps$errors === void 0 ? [] : _this$asProps$errors;
|
|
66
|
+
var errorIndex = _this.state.errorIndex;
|
|
67
|
+
var itemsIndex = errors.length - 1;
|
|
68
|
+
var newIndex = errorIndex + amount;
|
|
69
|
+
if (newIndex < 0) {
|
|
70
|
+
newIndex = amount + itemsIndex + 1;
|
|
71
|
+
} else if (newIndex > itemsIndex) {
|
|
72
|
+
newIndex = newIndex - itemsIndex - 1;
|
|
73
|
+
}
|
|
74
|
+
if (!errors[newIndex]) {
|
|
75
|
+
_this.handleChangeErrorIndex(amount < 0 ? amount - 1 : amount + 1)();
|
|
76
|
+
} else {
|
|
77
|
+
_this.handlers.showErrors(false);
|
|
78
|
+
_this.setState({
|
|
79
|
+
errorIndex: -1
|
|
80
|
+
});
|
|
81
|
+
setTimeout(function() {
|
|
82
|
+
_this.handlers.showErrors(true);
|
|
83
|
+
_this.setState({
|
|
84
|
+
errorIndex: newIndex,
|
|
85
|
+
highlightErrorIndex: true
|
|
86
|
+
});
|
|
53
87
|
});
|
|
54
|
-
}
|
|
88
|
+
}
|
|
55
89
|
};
|
|
56
|
-
})
|
|
90
|
+
});
|
|
91
|
+
return _this;
|
|
57
92
|
}
|
|
58
|
-
|
|
93
|
+
_createClass(BulkTextareaRoot2, [{
|
|
59
94
|
key: "uncontrolledProps",
|
|
60
|
-
value: function() {
|
|
95
|
+
value: function uncontrolledProps() {
|
|
61
96
|
return {
|
|
62
97
|
value: null,
|
|
63
98
|
state: null,
|
|
@@ -67,129 +102,153 @@ var I = /* @__PURE__ */ function(_) {
|
|
|
67
102
|
}
|
|
68
103
|
}, {
|
|
69
104
|
key: "counterId",
|
|
70
|
-
get: function() {
|
|
105
|
+
get: function get() {
|
|
71
106
|
return "".concat(this.asProps.uid, "_counter");
|
|
72
107
|
}
|
|
73
108
|
}, {
|
|
74
109
|
key: "getInputFieldProps",
|
|
75
|
-
value: function() {
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
110
|
+
value: function getInputFieldProps() {
|
|
111
|
+
var _this2 = this;
|
|
112
|
+
var _this$asProps = this.asProps, value = _this$asProps.value, size = _this$asProps.size, minRows = _this$asProps.minRows, maxRows = _this$asProps.maxRows, lineValidation = _this$asProps.lineValidation, placeholder = _this$asProps.placeholder, validateOn = _this$asProps.validateOn, linesDelimiters = _this$asProps.linesDelimiters, maxLines = _this$asProps.maxLines, disabled = _this$asProps.disabled, readonly = _this$asProps.readonly, pasteProps = _this$asProps.pasteProps, lineProcessing = _this$asProps.lineProcessing, _this$asProps$errors2 = _this$asProps.errors, errors = _this$asProps$errors2 === void 0 ? [] : _this$asProps$errors2, showErrors = _this$asProps.showErrors;
|
|
113
|
+
var _this$state = this.state, errorIndex = _this$state.errorIndex, prevError = _this$state.prevError, linesCount = _this$state.linesCount, highlightErrorIndex = _this$state.highlightErrorIndex;
|
|
114
|
+
return _defineProperty({
|
|
115
|
+
value,
|
|
116
|
+
size,
|
|
117
|
+
state: showErrors && (errors === null || errors === void 0 ? void 0 : errors.length) > 0 ? "invalid" : "normal",
|
|
118
|
+
disabled,
|
|
119
|
+
readonly,
|
|
120
|
+
minRows,
|
|
121
|
+
maxRows,
|
|
122
|
+
maxLines,
|
|
123
|
+
placeholder,
|
|
124
|
+
prevError,
|
|
125
|
+
pasteProps,
|
|
126
|
+
linesCount,
|
|
127
|
+
lineProcessing,
|
|
91
128
|
onChangeLinesCount: this.handleChangeLinesCount,
|
|
92
|
-
onChangeLineIndex: function() {
|
|
93
|
-
|
|
129
|
+
onChangeLineIndex: function onChangeLineIndex() {
|
|
130
|
+
if (validateOn !== null && validateOn !== void 0 && validateOn.includes("blurLine")) {
|
|
131
|
+
_this2.handlers.showErrors(true);
|
|
132
|
+
}
|
|
94
133
|
},
|
|
95
|
-
onBlur: function(
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
134
|
+
onBlur: function onBlur(value2, event) {
|
|
135
|
+
var _this2$props$onChange, _this2$props;
|
|
136
|
+
if (validateOn !== null && validateOn !== void 0 && validateOn.includes("blur") && (_this2.asProps.focusSourceRef.current === "keyboard" || event instanceof FocusEvent && event.relatedTarget !== _this2.clearAllButtonRef.current)) {
|
|
137
|
+
_this2.handlers.showErrors(true);
|
|
138
|
+
}
|
|
139
|
+
if (_this2.asProps.showErrors === false && (validateOn !== null && validateOn !== void 0 && validateOn.includes("blur") || validateOn !== null && validateOn !== void 0 && validateOn.includes("blurLine"))) {
|
|
140
|
+
setTimeout(function() {
|
|
141
|
+
var _this2$nextButtonRef$;
|
|
142
|
+
(_this2$nextButtonRef$ = _this2.nextButtonRef.current) === null || _this2$nextButtonRef$ === void 0 ? void 0 : _this2$nextButtonRef$.focus();
|
|
143
|
+
}, 250);
|
|
144
|
+
}
|
|
145
|
+
(_this2$props$onChange = (_this2$props = _this2.props).onChange) === null || _this2$props$onChange === void 0 ? void 0 : _this2$props$onChange.call(_this2$props, value2, event);
|
|
101
146
|
},
|
|
102
|
-
showErrors
|
|
103
|
-
validateOn
|
|
104
|
-
lineValidation
|
|
105
|
-
errors
|
|
106
|
-
onErrorsChange: function(
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
147
|
+
showErrors,
|
|
148
|
+
validateOn,
|
|
149
|
+
lineValidation,
|
|
150
|
+
errors,
|
|
151
|
+
onErrorsChange: function onErrorsChange(newErrors) {
|
|
152
|
+
var prevError2 = newErrors.length === 0 ? errors[0] : void 0;
|
|
153
|
+
_this2.handlers.errors(newErrors);
|
|
154
|
+
_this2.setState({
|
|
155
|
+
prevError: prevError2
|
|
156
|
+
});
|
|
157
|
+
setTimeout(function() {
|
|
158
|
+
var _this2$asProps = _this2.asProps, showErrors2 = _this2$asProps.showErrors, errors2 = _this2$asProps.errors;
|
|
159
|
+
if (showErrors2) {
|
|
160
|
+
var newState = newErrors.length === 0 ? "normal" : "invalid";
|
|
161
|
+
_this2.handlers.state(newState);
|
|
162
|
+
}
|
|
163
|
+
if ((errors2 === null || errors2 === void 0 ? void 0 : errors2.length) === 0) {
|
|
164
|
+
_this2.handlers.showErrors(false);
|
|
165
|
+
setTimeout(function() {
|
|
166
|
+
_this2.setState({
|
|
167
|
+
prevError: void 0
|
|
168
|
+
});
|
|
169
|
+
}, 150);
|
|
115
170
|
}
|
|
116
|
-
(c == null ? void 0 : c.length) === 0 && (e.handlers.showErrors(!1), setTimeout(function() {
|
|
117
|
-
e.setState({
|
|
118
|
-
prevError: void 0
|
|
119
|
-
});
|
|
120
|
-
}, 150));
|
|
121
171
|
}, 10);
|
|
122
172
|
},
|
|
123
|
-
highlightErrorIndex
|
|
124
|
-
errorIndex
|
|
125
|
-
onErrorIndexChange: function(
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
errorIndex:
|
|
129
|
-
prevError:
|
|
130
|
-
highlightErrorIndex:
|
|
173
|
+
highlightErrorIndex,
|
|
174
|
+
errorIndex,
|
|
175
|
+
onErrorIndexChange: function onErrorIndexChange(newErrorIndex) {
|
|
176
|
+
var prevError2 = errors[errorIndex];
|
|
177
|
+
_this2.setState({
|
|
178
|
+
errorIndex: newErrorIndex,
|
|
179
|
+
prevError: prevError2,
|
|
180
|
+
highlightErrorIndex: false
|
|
131
181
|
});
|
|
132
182
|
},
|
|
133
|
-
linesDelimiters
|
|
183
|
+
linesDelimiters,
|
|
134
184
|
ref: this.inputFieldRef
|
|
135
185
|
}, "aria-describedby", this.counterId);
|
|
136
186
|
}
|
|
137
187
|
}, {
|
|
138
188
|
key: "getCounterProps",
|
|
139
|
-
value: function() {
|
|
140
|
-
var
|
|
141
|
-
|
|
189
|
+
value: function getCounterProps() {
|
|
190
|
+
var _this$asProps2 = this.asProps, maxLines = _this$asProps2.maxLines, getI18nText = _this$asProps2.getI18nText, size = _this$asProps2.size;
|
|
191
|
+
var _this$state2 = this.state, linesCount = _this$state2.linesCount, isEmptyText = _this$state2.isEmptyText;
|
|
192
|
+
var counterTheme = "";
|
|
193
|
+
if (linesCount === maxLines) {
|
|
194
|
+
counterTheme = "warning";
|
|
195
|
+
} else if (linesCount > maxLines) {
|
|
196
|
+
counterTheme = "danger";
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
142
199
|
id: this.counterId,
|
|
143
200
|
ref: this.counterRef,
|
|
144
|
-
getI18nText
|
|
145
|
-
theme:
|
|
146
|
-
linesCount:
|
|
147
|
-
maxLines
|
|
148
|
-
size
|
|
201
|
+
getI18nText,
|
|
202
|
+
theme: counterTheme,
|
|
203
|
+
linesCount: isEmptyText ? 0 : linesCount,
|
|
204
|
+
maxLines,
|
|
205
|
+
size
|
|
149
206
|
};
|
|
150
207
|
}
|
|
151
208
|
}, {
|
|
152
209
|
key: "getClearAllProps",
|
|
153
|
-
value: function() {
|
|
154
|
-
var
|
|
210
|
+
value: function getClearAllProps() {
|
|
211
|
+
var _this$asProps3 = this.asProps, size = _this$asProps3.size, getI18nText = _this$asProps3.getI18nText, disabled = _this$asProps3.disabled, readonly = _this$asProps3.readonly;
|
|
155
212
|
return {
|
|
156
213
|
onClick: this.handleClickClearAll,
|
|
157
214
|
isHidden: this.state.isEmptyText,
|
|
158
|
-
size
|
|
159
|
-
getI18nText
|
|
215
|
+
size,
|
|
216
|
+
getI18nText,
|
|
160
217
|
ref: this.clearAllButtonRef,
|
|
161
|
-
disabled:
|
|
218
|
+
disabled: disabled || readonly
|
|
162
219
|
};
|
|
163
220
|
}
|
|
164
221
|
}, {
|
|
165
222
|
key: "getErrorsNavigationProps",
|
|
166
|
-
value: function() {
|
|
167
|
-
var
|
|
223
|
+
value: function getErrorsNavigationProps() {
|
|
224
|
+
var _this$asProps4 = this.asProps, size = _this$asProps4.size, getI18nText = _this$asProps4.getI18nText, disabled = _this$asProps4.disabled, readonly = _this$asProps4.readonly, _this$asProps4$errors = _this$asProps4.errors, errors = _this$asProps4$errors === void 0 ? [] : _this$asProps4$errors, showErrors = _this$asProps4.showErrors;
|
|
225
|
+
var errorIndex = this.state.errorIndex;
|
|
168
226
|
return {
|
|
169
|
-
size
|
|
170
|
-
getI18nText
|
|
171
|
-
errorIndex
|
|
227
|
+
size,
|
|
228
|
+
getI18nText,
|
|
229
|
+
errorIndex,
|
|
172
230
|
onPrevError: this.handleChangeErrorIndex(-1),
|
|
173
231
|
onNextError: this.handleChangeErrorIndex(1),
|
|
174
|
-
errorsCount:
|
|
175
|
-
showErrors
|
|
176
|
-
disabled:
|
|
232
|
+
errorsCount: errors.map(Boolean).length,
|
|
233
|
+
showErrors,
|
|
234
|
+
disabled: disabled || readonly || false,
|
|
177
235
|
nextButtonRef: this.nextButtonRef,
|
|
178
236
|
prevButtonRef: this.prevButtonRef
|
|
179
237
|
};
|
|
180
238
|
}
|
|
181
239
|
}, {
|
|
182
240
|
key: "render",
|
|
183
|
-
value: function() {
|
|
184
|
-
var
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
__excludeProps: ["onBlur", "value", "placeholder"]
|
|
187
|
-
},
|
|
241
|
+
value: function render() {
|
|
242
|
+
var _ref = this.asProps;
|
|
243
|
+
return /* @__PURE__ */ React.createElement(Box, assignProps({
|
|
244
|
+
"__excludeProps": ["onBlur", "value", "placeholder"]
|
|
245
|
+
}, _ref));
|
|
188
246
|
}
|
|
189
|
-
}])
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
247
|
+
}]);
|
|
248
|
+
return BulkTextareaRoot2;
|
|
249
|
+
}(Component);
|
|
250
|
+
_defineProperty(BulkTextareaRoot, "displayName", "BulkTextarea");
|
|
251
|
+
_defineProperty(BulkTextareaRoot, "defaultProps", {
|
|
193
252
|
defaultValue: "",
|
|
194
253
|
size: "m",
|
|
195
254
|
defaultState: "normal",
|
|
@@ -199,17 +258,17 @@ i(I, "defaultProps", {
|
|
|
199
258
|
validateOn: "blur",
|
|
200
259
|
locale: "en",
|
|
201
260
|
defaultErrors: [],
|
|
202
|
-
defaultShowErrors:
|
|
261
|
+
defaultShowErrors: false
|
|
203
262
|
});
|
|
204
|
-
|
|
205
|
-
var
|
|
206
|
-
return
|
|
207
|
-
InputField
|
|
208
|
-
Counter
|
|
209
|
-
ClearAll
|
|
210
|
-
ErrorsNavigation
|
|
263
|
+
_defineProperty(BulkTextareaRoot, "enhance", [i18nEnhance(localizedMessages), focusSourceEnhance(), uniqueIDEnhancement()]);
|
|
264
|
+
var BulkTextarea = function() {
|
|
265
|
+
return createComponent(BulkTextareaRoot, {
|
|
266
|
+
InputField,
|
|
267
|
+
Counter,
|
|
268
|
+
ClearAll,
|
|
269
|
+
ErrorsNavigation
|
|
211
270
|
});
|
|
212
271
|
}();
|
|
213
272
|
export {
|
|
214
|
-
|
|
273
|
+
BulkTextarea as default
|
|
215
274
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { sstyled
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
function
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { sstyled, assignProps } from "@semcore/core";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import Button from "@semcore/button";
|
|
5
|
+
import CloseM from "@semcore/icon/Close/m";
|
|
6
|
+
function ClearAll(props) {
|
|
7
|
+
var _ref = arguments[0], _ref2;
|
|
8
|
+
var SButton = Button;
|
|
9
|
+
return !props.isHidden && (_ref2 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SButton, _ref2.cn("SButton", _objectSpread({}, assignProps({
|
|
10
|
+
"theme": "muted",
|
|
11
|
+
"use": "tertiary",
|
|
12
|
+
"addonLeft": CloseM
|
|
13
|
+
}, _ref))), props.getI18nText("BulkTextarea.ClearAllButton.buttonText")));
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
ClearAll
|
|
16
17
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { assignProps
|
|
2
|
-
import
|
|
3
|
-
import { ScreenReaderOnly
|
|
4
|
-
import
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { assignProps } from "@semcore/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ScreenReaderOnly } from "@semcore/flex-box";
|
|
4
|
+
import CounterKit from "@semcore/counter";
|
|
5
|
+
function Counter(props) {
|
|
6
|
+
var _ref = arguments[0];
|
|
7
|
+
var theme = props.theme, linesCount = props.linesCount, maxLines = props.maxLines, getI18nText = props.getI18nText;
|
|
8
|
+
return /* @__PURE__ */ React.createElement(CounterKit, assignProps({
|
|
9
|
+
"ml": 1,
|
|
10
|
+
"theme": theme
|
|
11
|
+
}, _ref), linesCount, /* @__PURE__ */ React.createElement("span", {
|
|
11
12
|
"aria-hidden": "true"
|
|
12
|
-
}, "/",
|
|
13
|
-
rowsNumber:
|
|
14
|
-
})),
|
|
13
|
+
}, "/", maxLines), /* @__PURE__ */ React.createElement(ScreenReaderOnly, null, getI18nText("BulkTextarea.Counter.ofAllowedRows:sr-message", {
|
|
14
|
+
rowsNumber: maxLines
|
|
15
|
+
})), theme === "warning" && /* @__PURE__ */ React.createElement(ScreenReaderOnly, null, getI18nText("BulkTextarea.Counter.limitReached:sr-message")), theme === "danger" && /* @__PURE__ */ React.createElement(ScreenReaderOnly, null, getI18nText("BulkTextarea.Counter.limitExceeded:sr-message")));
|
|
15
16
|
}
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
Counter
|
|
18
19
|
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Flex
|
|
4
|
-
import { Text
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
function
|
|
8
|
-
var
|
|
9
|
-
return /* @__PURE__ */
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Button from "@semcore/button";
|
|
3
|
+
import { Flex } from "@semcore/flex-box";
|
|
4
|
+
import { Text } from "@semcore/typography";
|
|
5
|
+
import ChevronUpM from "@semcore/icon/ChevronUp/m";
|
|
6
|
+
import ChevronDownM from "@semcore/icon/ChevronDown/m";
|
|
7
|
+
function ErrorsNavigation(props) {
|
|
8
|
+
var errorIndex = props.errorIndex, errorsCount = props.errorsCount, onPrevError = props.onPrevError, onNextError = props.onNextError, size = props.size, showErrors = props.showErrors, getI18nText = props.getI18nText, disabled = props.disabled, nextButtonRef = props.nextButtonRef, prevButtonRef = props.prevButtonRef;
|
|
9
|
+
return /* @__PURE__ */ React.createElement(Flex, {
|
|
10
10
|
alignItems: "center"
|
|
11
|
-
},
|
|
12
|
-
onClick:
|
|
13
|
-
addonLeft:
|
|
11
|
+
}, errorsCount > 0 && showErrors && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
|
|
12
|
+
onClick: onNextError,
|
|
13
|
+
addonLeft: ChevronDownM,
|
|
14
14
|
use: "tertiary",
|
|
15
15
|
theme: "muted",
|
|
16
|
-
"aria-label":
|
|
16
|
+
"aria-label": getI18nText("BulkTextarea.ErrorsNavigation.nextError:aria-label"),
|
|
17
17
|
hintPlacement: "bottom",
|
|
18
|
-
disabled
|
|
19
|
-
ref:
|
|
20
|
-
}), /* @__PURE__ */
|
|
21
|
-
onClick:
|
|
22
|
-
addonLeft:
|
|
18
|
+
disabled,
|
|
19
|
+
ref: nextButtonRef
|
|
20
|
+
}), /* @__PURE__ */ React.createElement(Button, {
|
|
21
|
+
onClick: onPrevError,
|
|
22
|
+
addonLeft: ChevronUpM,
|
|
23
23
|
use: "tertiary",
|
|
24
24
|
theme: "muted",
|
|
25
|
-
"aria-label":
|
|
25
|
+
"aria-label": getI18nText("BulkTextarea.ErrorsNavigation.previousError:aria-label"),
|
|
26
26
|
hintPlacement: "bottom",
|
|
27
|
-
disabled
|
|
28
|
-
ref:
|
|
29
|
-
}), /* @__PURE__ */
|
|
30
|
-
size:
|
|
27
|
+
disabled,
|
|
28
|
+
ref: prevButtonRef
|
|
29
|
+
}), /* @__PURE__ */ React.createElement(Text, {
|
|
30
|
+
size: size === "l" ? 300 : 200,
|
|
31
31
|
color: "text-critical",
|
|
32
32
|
ml: 1,
|
|
33
|
-
disabled
|
|
34
|
-
},
|
|
35
|
-
errorsCount
|
|
36
|
-
}) :
|
|
37
|
-
errorIndex:
|
|
38
|
-
errorsCount
|
|
33
|
+
disabled
|
|
34
|
+
}, errorIndex === -1 ? getI18nText("BulkTextarea.ErrorsNavigation.totalErrors", {
|
|
35
|
+
errorsCount
|
|
36
|
+
}) : getI18nText("BulkTextarea.ErrorsNavigation.selectedError", {
|
|
37
|
+
errorIndex: errorIndex + 1,
|
|
38
|
+
errorsCount
|
|
39
39
|
}))));
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
ErrorsNavigation
|
|
43
43
|
};
|