@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.
@@ -1,63 +1,98 @@
1
- import D from "@babel/runtime/helpers/esm/classCallCheck";
2
- import O from "@babel/runtime/helpers/esm/createClass";
3
- import d from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import V from "@babel/runtime/helpers/esm/inherits";
5
- import q from "@babel/runtime/helpers/esm/createSuper";
6
- import i from "@babel/runtime/helpers/esm/defineProperty";
7
- import H, { assignProps as M, Component as j } from "@semcore/core";
8
- import x from "react";
9
- import { Box as G } from "@semcore/flex-box";
10
- import { InputField as J } from "./components/InputField/InputField.mjs";
11
- import { Counter as K } from "./components/Counter.mjs";
12
- import { ClearAll as Q } from "./components/ClearAll.mjs";
13
- import { ErrorsNavigation as U } from "./components/ErrorsNavigation.mjs";
14
- import { localizedMessages as W } from "./translations/__intergalactic-dynamic-locales.mjs";
15
- import X from "@semcore/utils/lib/enhances/i18nEnhance";
16
- import Y from "@semcore/utils/lib/enhances/focusSourceEnhance";
17
- import Z from "@semcore/utils/lib/uniqueID";
18
- var I = /* @__PURE__ */ function(_) {
19
- V(g, _);
20
- var R = q(g);
21
- function g() {
22
- var r;
23
- D(this, g);
24
- for (var e = arguments.length, t = new Array(e), l = 0; l < e; l++)
25
- t[l] = arguments[l];
26
- return r = R.call.apply(R, [this].concat(t)), i(d(r), "inputFieldRef", /* @__PURE__ */ x.createRef()), i(d(r), "clearAllButtonRef", /* @__PURE__ */ x.createRef()), i(d(r), "nextButtonRef", /* @__PURE__ */ x.createRef()), i(d(r), "prevButtonRef", /* @__PURE__ */ x.createRef()), i(d(r), "counterRef", /* @__PURE__ */ x.createRef()), i(d(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, { 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: !0,
35
+ isEmptyText: true,
29
36
  errorIndex: -1,
30
- highlightErrorIndex: !1
31
- }), i(d(r), "handleChangeLinesCount", function(n) {
32
- var s = !n;
33
- r.setState({
34
- linesCount: n,
35
- isEmptyText: s
36
- }), s && (r.handlers.showErrors(!1), r.handlers.errors([]), r.handlers.state("normal"));
37
- }), i(d(r), "handleClickClearAll", function(n) {
38
- var s;
39
- r.handlers.showErrors(!1), r.handlers.errors([]), r.setState({
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
- }), r.handlers.value("", n), r.handlers.state("normal");
42
- var a = (s = r.inputFieldRef.current) === null || s === void 0 ? void 0 : s.querySelector('[role="textbox"]');
43
- a instanceof HTMLDivElement && a.focus();
44
- }), i(d(r), "handleChangeErrorIndex", function(n) {
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 s = r.asProps.errors, a = s === void 0 ? [] : s, h = r.state.errorIndex, u = a.length - 1, o = h + n;
47
- o < 0 ? o = n + u + 1 : o > u && (o = o - u - 1), a[o] ? (r.handlers.showErrors(!1), r.setState({
48
- errorIndex: -1
49
- }), setTimeout(function() {
50
- r.handlers.showErrors(!0), r.setState({
51
- errorIndex: o,
52
- highlightErrorIndex: !0
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
- })) : r.handleChangeErrorIndex(n < 0 ? n - 1 : n + 1)();
88
+ }
55
89
  };
56
- }), r;
90
+ });
91
+ return _this;
57
92
  }
58
- return O(g, [{
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 e = this, t = this.asProps, l = t.value, n = t.size, s = t.minRows, a = t.maxRows, h = t.lineValidation, u = t.placeholder, o = t.validateOn, B = t.linesDelimiters, $ = t.maxLines, b = t.disabled, k = t.readonly, L = t.pasteProps, S = t.lineProcessing, w = t.errors, v = w === void 0 ? [] : w, y = t.showErrors, E = this.state, T = E.errorIndex, z = E.prevError, A = E.linesCount, F = E.highlightErrorIndex;
77
- return i({
78
- value: l,
79
- size: n,
80
- state: y && (v == null ? void 0 : v.length) > 0 ? "invalid" : "normal",
81
- disabled: b,
82
- readonly: k,
83
- minRows: s,
84
- maxRows: a,
85
- maxLines: $,
86
- placeholder: u,
87
- prevError: z,
88
- pasteProps: L,
89
- linesCount: A,
90
- lineProcessing: S,
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
- o != null && o.includes("blurLine") && e.handlers.showErrors(!0);
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(f, p) {
96
- var m, C;
97
- o != null && o.includes("blur") && (e.asProps.focusSourceRef.current === "keyboard" || 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() {
98
- var c;
99
- (c = e.nextButtonRef.current) === null || c === void 0 || c.focus();
100
- }, 250), (m = (C = e.props).onChange) === null || m === void 0 || m.call(C, f, p);
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: y,
103
- validateOn: o,
104
- lineValidation: h,
105
- errors: v,
106
- onErrorsChange: function(f) {
107
- var p = f.length === 0 ? v[0] : void 0;
108
- e.handlers.errors(f), e.setState({
109
- prevError: p
110
- }), setTimeout(function() {
111
- var m = e.asProps, C = m.showErrors, c = m.errors;
112
- if (C) {
113
- var N = f.length === 0 ? "normal" : "invalid";
114
- e.handlers.state(N);
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: F,
124
- errorIndex: T,
125
- onErrorIndexChange: function(f) {
126
- var p = v[T];
127
- e.setState({
128
- errorIndex: f,
129
- prevError: p,
130
- highlightErrorIndex: !1
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: B,
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 e = this.asProps, t = e.maxLines, l = e.getI18nText, n = e.size, s = this.state, a = s.linesCount, h = s.isEmptyText, u = "";
141
- return a === t ? u = "warning" : a > t && (u = "danger"), {
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: l,
145
- theme: u,
146
- linesCount: h ? 0 : a,
147
- maxLines: t,
148
- size: n
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 e = this.asProps, t = e.size, l = e.getI18nText, n = e.disabled, s = e.readonly;
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: t,
159
- getI18nText: l,
215
+ size,
216
+ getI18nText,
160
217
  ref: this.clearAllButtonRef,
161
- disabled: n || s
218
+ disabled: disabled || readonly
162
219
  };
163
220
  }
164
221
  }, {
165
222
  key: "getErrorsNavigationProps",
166
- value: function() {
167
- var e = this.asProps, t = e.size, l = e.getI18nText, n = e.disabled, s = e.readonly, a = e.errors, h = a === void 0 ? [] : a, u = e.showErrors, o = this.state.errorIndex;
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: t,
170
- getI18nText: l,
171
- errorIndex: o,
227
+ size,
228
+ getI18nText,
229
+ errorIndex,
172
230
  onPrevError: this.handleChangeErrorIndex(-1),
173
231
  onNextError: this.handleChangeErrorIndex(1),
174
- errorsCount: h.map(Boolean).length,
175
- showErrors: u,
176
- disabled: n || s || !1,
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 e = this.asProps;
185
- return /* @__PURE__ */ x.createElement(G, M({
186
- __excludeProps: ["onBlur", "value", "placeholder"]
187
- }, e));
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
- }]), g;
190
- }(j);
191
- i(I, "displayName", "BulkTextarea");
192
- i(I, "defaultProps", {
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: !1
261
+ defaultShowErrors: false
203
262
  });
204
- i(I, "enhance", [X(W), Y(), Z()]);
205
- var xr = function() {
206
- return H(I, {
207
- InputField: J,
208
- Counter: K,
209
- ClearAll: Q,
210
- ErrorsNavigation: U
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
- xr as default
273
+ BulkTextarea as default
215
274
  };
@@ -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
  };