@semcore/bulk-textarea 1.2.0 → 1.3.0-prerelease.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,29 +1,29 @@
1
- import O from "@babel/runtime/helpers/esm/classCallCheck";
2
- import V from "@babel/runtime/helpers/esm/createClass";
1
+ import D from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import O from "@babel/runtime/helpers/esm/createClass";
3
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";
4
+ import V from "@babel/runtime/helpers/esm/inherits";
5
+ import q from "@babel/runtime/helpers/esm/createSuper";
6
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() {
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
22
  var r;
23
- O(this, x);
23
+ D(this, g);
24
24
  for (var e = arguments.length, t = new Array(e), l = 0; l < e; l++)
25
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", {
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", {
27
27
  linesCount: 0,
28
28
  isEmptyText: !0,
29
29
  errorIndex: -1,
@@ -55,7 +55,7 @@ var E = /* @__PURE__ */ function(_) {
55
55
  };
56
56
  }), r;
57
57
  }
58
- return V(x, [{
58
+ return O(g, [{
59
59
  key: "uncontrolledProps",
60
60
  value: function() {
61
61
  return {
@@ -73,16 +73,16 @@ var E = /* @__PURE__ */ function(_) {
73
73
  }, {
74
74
  key: "getInputFieldProps",
75
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;
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
77
  return i({
78
78
  value: l,
79
79
  size: n,
80
- state: y && (c == null ? void 0 : c.length) > 0 ? "invalid" : "normal",
81
- disabled: $,
80
+ state: y && (v == null ? void 0 : v.length) > 0 ? "invalid" : "normal",
81
+ disabled: b,
82
82
  readonly: k,
83
83
  minRows: s,
84
84
  maxRows: a,
85
- maxLines: b,
85
+ maxLines: $,
86
86
  placeholder: u,
87
87
  prevError: z,
88
88
  pasteProps: L,
@@ -93,26 +93,27 @@ var E = /* @__PURE__ */ function(_) {
93
93
  o != null && o.includes("blurLine") && e.handlers.showErrors(!0);
94
94
  },
95
95
  onBlur: function(f, p) {
96
+ var m, C;
96
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() {
97
- var v;
98
- (v = e.nextButtonRef.current) === null || v === void 0 || v.focus();
99
- }, 250), C == null || C(f, p);
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);
100
101
  },
101
102
  showErrors: y,
102
103
  validateOn: o,
103
104
  lineValidation: h,
104
- errors: c,
105
+ errors: v,
105
106
  onErrorsChange: function(f) {
106
- var p = f.length === 0 ? c[0] : void 0;
107
+ var p = f.length === 0 ? v[0] : void 0;
107
108
  e.handlers.errors(f), e.setState({
108
109
  prevError: p
109
110
  }), 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);
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);
114
115
  }
115
- (P == null ? void 0 : P.length) === 0 && (e.handlers.showErrors(!1), setTimeout(function() {
116
+ (c == null ? void 0 : c.length) === 0 && (e.handlers.showErrors(!1), setTimeout(function() {
116
117
  e.setState({
117
118
  prevError: void 0
118
119
  });
@@ -122,7 +123,7 @@ var E = /* @__PURE__ */ function(_) {
122
123
  highlightErrorIndex: F,
123
124
  errorIndex: T,
124
125
  onErrorIndexChange: function(f) {
125
- var p = c[T];
126
+ var p = v[T];
126
127
  e.setState({
127
128
  errorIndex: f,
128
129
  prevError: p,
@@ -181,14 +182,14 @@ var E = /* @__PURE__ */ function(_) {
181
182
  key: "render",
182
183
  value: function() {
183
184
  var e = this.asProps;
184
- return /* @__PURE__ */ m.createElement(J, j({
185
+ return /* @__PURE__ */ x.createElement(G, M({
185
186
  __excludeProps: ["onBlur", "value", "placeholder"]
186
187
  }, e));
187
188
  }
188
- }]), x;
189
- }(G);
190
- i(E, "displayName", "BulkTextarea");
191
- i(E, "defaultProps", {
189
+ }]), g;
190
+ }(j);
191
+ i(I, "displayName", "BulkTextarea");
192
+ i(I, "defaultProps", {
192
193
  defaultValue: "",
193
194
  size: "m",
194
195
  defaultState: "normal",
@@ -200,13 +201,15 @@ i(E, "defaultProps", {
200
201
  defaultErrors: [],
201
202
  defaultShowErrors: !1
202
203
  });
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
209
- });
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
211
+ });
212
+ }();
210
213
  export {
211
- gr as default
214
+ xr as default
212
215
  };