@semcore/bulk-textarea 16.0.0-prerelease.4 → 16.0.0-prerelease.7

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