@semcore/bulk-textarea 1.2.0 → 16.0.0-prerelease.10

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/lib/cjs/BulkTextarea.js +6 -8
  3. package/lib/cjs/BulkTextarea.js.map +1 -1
  4. package/lib/cjs/BulkTextarea.types.js.map +1 -1
  5. package/lib/cjs/components/ClearAll.js.map +1 -1
  6. package/lib/cjs/components/Counter.js.map +1 -1
  7. package/lib/cjs/components/ErrorsNavigation.js.map +1 -1
  8. package/lib/cjs/components/InputField/InputField.js +14 -15
  9. package/lib/cjs/components/InputField/InputField.js.map +1 -1
  10. package/lib/es6/BulkTextarea.js +5 -6
  11. package/lib/es6/BulkTextarea.js.map +1 -1
  12. package/lib/es6/BulkTextarea.types.js.map +1 -1
  13. package/lib/es6/components/ClearAll.js.map +1 -1
  14. package/lib/es6/components/Counter.js.map +1 -1
  15. package/lib/es6/components/ErrorsNavigation.js.map +1 -1
  16. package/lib/es6/components/InputField/InputField.js +15 -15
  17. package/lib/es6/components/InputField/InputField.js.map +1 -1
  18. package/lib/esm/BulkTextarea.mjs +199 -141
  19. package/lib/esm/components/ClearAll.mjs +14 -13
  20. package/lib/esm/components/Counter.mjs +15 -14
  21. package/lib/esm/components/ErrorsNavigation.mjs +30 -30
  22. package/lib/esm/components/InputField/InputField.mjs +853 -413
  23. package/lib/esm/index.mjs +2 -2
  24. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
  25. package/lib/esm/translations/de.json.mjs +2 -2
  26. package/lib/esm/translations/en.json.mjs +2 -2
  27. package/lib/esm/translations/es.json.mjs +2 -2
  28. package/lib/esm/translations/fr.json.mjs +2 -2
  29. package/lib/esm/translations/it.json.mjs +2 -2
  30. package/lib/esm/translations/ja.json.mjs +2 -2
  31. package/lib/esm/translations/ko.json.mjs +2 -2
  32. package/lib/esm/translations/nl.json.mjs +2 -2
  33. package/lib/esm/translations/pl.json.mjs +2 -2
  34. package/lib/esm/translations/pt.json.mjs +2 -2
  35. package/lib/esm/translations/sv.json.mjs +2 -2
  36. package/lib/esm/translations/tr.json.mjs +2 -2
  37. package/lib/esm/translations/vi.json.mjs +2 -2
  38. package/lib/esm/translations/zh.json.mjs +2 -2
  39. package/lib/types/BulkTextarea.types.d.ts +1 -1
  40. package/lib/types/components/ClearAll.d.ts +1 -1
  41. package/lib/types/components/Counter.d.ts +1 -1
  42. package/lib/types/components/ErrorsNavigation.d.ts +1 -1
  43. package/package.json +9 -12
@@ -1,63 +1,97 @@
1
- import O from "@babel/runtime/helpers/esm/classCallCheck";
2
- import V from "@babel/runtime/helpers/esm/createClass";
3
- import d 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 M, { 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 K } from "./components/InputField/InputField.mjs";
11
- import { Counter as Q } from "./components/Counter.mjs";
12
- import { ClearAll as U } from "./components/ClearAll.mjs";
13
- import { ErrorsNavigation as W } from "./components/ErrorsNavigation.mjs";
14
- import { localizedMessages as X } from "./translations/__intergalactic-dynamic-locales.mjs";
15
- import Y from "@semcore/utils/lib/enhances/i18nEnhance";
16
- import Z from "@semcore/utils/lib/enhances/focusSourceEnhance";
17
- import rr from "@semcore/utils/lib/uniqueID";
18
- var E = /* @__PURE__ */ function(_) {
19
- q(x, _);
20
- var R = H(x);
21
- function x() {
22
- var r;
23
- O(this, x);
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__ */ m.createRef()), i(d(r), "clearAllButtonRef", /* @__PURE__ */ m.createRef()), i(d(r), "nextButtonRef", /* @__PURE__ */ m.createRef()), i(d(r), "prevButtonRef", /* @__PURE__ */ m.createRef()), i(d(r), "counterRef", /* @__PURE__ */ m.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, 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", {
27
33
  linesCount: 0,
28
- isEmptyText: !0,
34
+ isEmptyText: true,
29
35
  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({
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({
40
55
  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) {
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) {
45
63
  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
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
+ });
53
86
  });
54
- })) : r.handleChangeErrorIndex(n < 0 ? n - 1 : n + 1)();
87
+ }
55
88
  };
56
- }), r;
89
+ });
90
+ return _this;
57
91
  }
58
- return V(x, [{
92
+ _createClass(BulkTextareaRoot2, [{
59
93
  key: "uncontrolledProps",
60
- value: function() {
94
+ value: function uncontrolledProps() {
61
95
  return {
62
96
  value: null,
63
97
  state: null,
@@ -67,128 +101,152 @@ var E = /* @__PURE__ */ function(_) {
67
101
  }
68
102
  }, {
69
103
  key: "counterId",
70
- get: function() {
104
+ get: function get() {
71
105
  return "".concat(this.asProps.uid, "_counter");
72
106
  }
73
107
  }, {
74
108
  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, C = t.onChange, B = t.linesDelimiters, b = t.maxLines, $ = t.disabled, k = t.readonly, L = t.pasteProps, S = t.lineProcessing, w = t.errors, c = w === void 0 ? [] : w, y = t.showErrors, g = this.state, T = g.errorIndex, z = g.prevError, A = g.linesCount, F = g.highlightErrorIndex;
77
- return i({
78
- value: l,
79
- size: n,
80
- state: y && (c == null ? void 0 : c.length) > 0 ? "invalid" : "normal",
81
- disabled: $,
82
- readonly: k,
83
- minRows: s,
84
- maxRows: a,
85
- maxLines: b,
86
- placeholder: u,
87
- prevError: z,
88
- pasteProps: L,
89
- linesCount: A,
90
- lineProcessing: S,
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,
91
127
  onChangeLinesCount: this.handleChangeLinesCount,
92
- onChangeLineIndex: function() {
93
- 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
+ }
94
132
  },
95
- onBlur: function(f, p) {
96
- 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() {
97
- var v;
98
- (v = e.nextButtonRef.current) === null || v === void 0 || v.focus();
99
- }, 250), C == null || C(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);
100
144
  },
101
- showErrors: y,
102
- validateOn: o,
103
- lineValidation: h,
104
- errors: c,
105
- onErrorsChange: function(f) {
106
- var p = f.length === 0 ? c[0] : void 0;
107
- e.handlers.errors(f), e.setState({
108
- prevError: p
109
- }), setTimeout(function() {
110
- var v = e.asProps, N = v.showErrors, P = v.errors;
111
- if (N) {
112
- var D = f.length === 0 ? "normal" : "invalid";
113
- 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);
114
168
  }
115
- (P == null ? void 0 : P.length) === 0 && (e.handlers.showErrors(!1), setTimeout(function() {
116
- e.setState({
117
- prevError: void 0
118
- });
119
- }, 150));
120
169
  }, 10);
121
170
  },
122
- highlightErrorIndex: F,
123
- errorIndex: T,
124
- onErrorIndexChange: function(f) {
125
- var p = c[T];
126
- e.setState({
127
- errorIndex: f,
128
- prevError: p,
129
- 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
130
179
  });
131
180
  },
132
- linesDelimiters: B,
181
+ linesDelimiters,
133
182
  ref: this.inputFieldRef
134
183
  }, "aria-describedby", this.counterId);
135
184
  }
136
185
  }, {
137
186
  key: "getCounterProps",
138
- value: function() {
139
- var e = this.asProps, t = e.maxLines, l = e.getI18nText, n = e.size, s = this.state, a = s.linesCount, h = s.isEmptyText, u = "";
140
- return a === t ? u = "warning" : a > t && (u = "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 {
141
197
  id: this.counterId,
142
198
  ref: this.counterRef,
143
- getI18nText: l,
144
- theme: u,
145
- linesCount: h ? 0 : a,
146
- maxLines: t,
147
- size: n
199
+ getI18nText,
200
+ theme: counterTheme,
201
+ linesCount: isEmptyText ? 0 : linesCount,
202
+ maxLines,
203
+ size
148
204
  };
149
205
  }
150
206
  }, {
151
207
  key: "getClearAllProps",
152
- value: function() {
153
- 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;
154
210
  return {
155
211
  onClick: this.handleClickClearAll,
156
212
  isHidden: this.state.isEmptyText,
157
- size: t,
158
- getI18nText: l,
213
+ size,
214
+ getI18nText,
159
215
  ref: this.clearAllButtonRef,
160
- disabled: n || s
216
+ disabled: disabled || readonly
161
217
  };
162
218
  }
163
219
  }, {
164
220
  key: "getErrorsNavigationProps",
165
- value: function() {
166
- 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;
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;
167
224
  return {
168
- size: t,
169
- getI18nText: l,
170
- errorIndex: o,
225
+ size,
226
+ getI18nText,
227
+ errorIndex,
171
228
  onPrevError: this.handleChangeErrorIndex(-1),
172
229
  onNextError: this.handleChangeErrorIndex(1),
173
- errorsCount: h.map(Boolean).length,
174
- showErrors: u,
175
- disabled: n || s || !1,
230
+ errorsCount: errors.map(Boolean).length,
231
+ showErrors,
232
+ disabled: disabled || readonly || false,
176
233
  nextButtonRef: this.nextButtonRef,
177
234
  prevButtonRef: this.prevButtonRef
178
235
  };
179
236
  }
180
237
  }, {
181
238
  key: "render",
182
- value: function() {
183
- var e = this.asProps;
184
- return /* @__PURE__ */ m.createElement(J, j({
185
- __excludeProps: ["onBlur", "value", "placeholder"]
186
- }, e));
239
+ value: function render() {
240
+ var _ref = this.asProps;
241
+ return /* @__PURE__ */ React.createElement(Box, assignProps({
242
+ "__excludeProps": ["onBlur", "value", "placeholder"]
243
+ }, _ref));
187
244
  }
188
- }]), x;
189
- }(G);
190
- i(E, "displayName", "BulkTextarea");
191
- i(E, "defaultProps", {
245
+ }]);
246
+ return BulkTextareaRoot2;
247
+ }(Component);
248
+ _defineProperty(BulkTextareaRoot, "displayName", "BulkTextarea");
249
+ _defineProperty(BulkTextareaRoot, "defaultProps", {
192
250
  defaultValue: "",
193
251
  size: "m",
194
252
  defaultState: "normal",
@@ -198,15 +256,15 @@ i(E, "defaultProps", {
198
256
  validateOn: "blur",
199
257
  locale: "en",
200
258
  defaultErrors: [],
201
- defaultShowErrors: !1
259
+ defaultShowErrors: false
202
260
  });
203
- i(E, "enhance", [Y(X), Z(), rr()]);
204
- var gr = M(E, {
205
- InputField: K,
206
- Counter: Q,
207
- ClearAll: U,
208
- ErrorsNavigation: W
261
+ _defineProperty(BulkTextareaRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement()]);
262
+ var BulkTextarea = createComponent(BulkTextareaRoot, {
263
+ InputField,
264
+ Counter,
265
+ ClearAll,
266
+ ErrorsNavigation
209
267
  });
210
268
  export {
211
- gr as default
269
+ BulkTextarea as default
212
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
  };