@pismo/marola 2.1.54 → 2.1.56

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.
@@ -18,6 +18,8 @@ export type SingleInputProps = InputHTMLAttributes<HTMLInputElement> & {
18
18
  rightIcon?: ReactNode;
19
19
  /** Input type. Default: text */
20
20
  type?: CustomInputTypeAttribute | 'number-as-text';
21
+ /** How many milliseconds to wait before trigger the onChange event */
22
+ triggerDelay?: number;
21
23
  /** allow leading zeros to use as a number code (000123) or phone number (08001234567) */
22
24
  allowLeadingZeros?: boolean;
23
25
  /** allow only integer value. Default: false */
@@ -1,229 +1,229 @@
1
- import { jsxs as $, jsx as Y } from "react/jsx-runtime";
2
- import * as F from "react";
3
- import { forwardRef as ge, useState as he, useId as ye, useMemo as re } from "react";
4
- import { formatDecimalValue as ce, allowOnlyIntegerNumbers as xe, allowOnlyNumbers as we, parseToInteger as Ne } from "../../utils/inputNumberAsText.js";
1
+ import { jsxs as M, jsx as H } from "react/jsx-runtime";
2
+ import * as E from "react";
3
+ import { forwardRef as xe, useState as we, useId as Ne, useRef as Ce, useMemo as ue } from "react";
4
+ import { formatDecimalValue as me, allowOnlyIntegerNumbers as ve, allowOnlyNumbers as Pe, parseToInteger as Re } from "../../utils/inputNumberAsText.js";
5
5
  import { c as U } from "../../clsx-OuTLNxxd.js";
6
- import { Icon as Ce } from "../Icon/Icon.js";
7
- import { Typography as ie } from "../Typography/Typography.js";
8
- import { g as ve, a as Pe, u as Re, f as ue, _ as N, b as Ee, c as pe, i as Ve, d as Fe, e as Se, P as n } from "../../useSlotProps-CYHDC4TN.js";
9
- import '../../assets/Input.css';function Oe(u) {
10
- let d = "https://mui.com/production-error/?code=" + u;
11
- for (let b = 1; b < arguments.length; b += 1)
12
- d += "&args[]=" + encodeURIComponent(arguments[b]);
13
- return "Minified MUI error #" + u + "; visit " + d + " for the full message.";
6
+ import { Icon as Ee } from "../Icon/Icon.js";
7
+ import { Typography as se } from "../Typography/Typography.js";
8
+ import { g as Ve, a as Fe, u as Se, f as de, _ as w, b as Oe, c as _e, i as Te, d as Ie, e as Be, P as n } from "../../useSlotProps-CYHDC4TN.js";
9
+ import '../../assets/Input.css';function Ue(r) {
10
+ let u = "https://mui.com/production-error/?code=" + r;
11
+ for (let _ = 1; _ < arguments.length; _ += 1)
12
+ u += "&args[]=" + encodeURIComponent(arguments[_]);
13
+ return "Minified MUI error #" + r + "; visit " + u + " for the full message.";
14
14
  }
15
- const fe = "Input";
16
- function Te(u) {
17
- return ve(fe, u);
15
+ const be = "Input";
16
+ function je(r) {
17
+ return Ve(be, r);
18
18
  }
19
- Pe(fe, ["root", "formControl", "focused", "disabled", "error", "multiline", "input", "inputMultiline", "inputTypeSearch", "adornedStart", "adornedEnd"]);
20
- const me = /* @__PURE__ */ F.createContext(void 0);
21
- process.env.NODE_ENV !== "production" && (me.displayName = "FormControlContext");
22
- function Ie() {
23
- return F.useContext(me);
19
+ Fe(be, ["root", "formControl", "focused", "disabled", "error", "multiline", "input", "inputMultiline", "inputTypeSearch", "adornedStart", "adornedEnd"]);
20
+ const ge = /* @__PURE__ */ E.createContext(void 0);
21
+ process.env.NODE_ENV !== "production" && (ge.displayName = "FormControlContext");
22
+ function Ae() {
23
+ return E.useContext(ge);
24
24
  }
25
- function Be(u = {}) {
25
+ function ke(r = {}) {
26
26
  const {
27
- defaultValue: d,
28
- disabled: b = !1,
27
+ defaultValue: u,
28
+ disabled: _ = !1,
29
29
  error: p = !1,
30
- onBlur: g,
30
+ onBlur: b,
31
31
  onChange: h,
32
- onFocus: S,
33
- required: O = !1,
32
+ onFocus: V,
33
+ required: F = !1,
34
34
  value: f,
35
- inputRef: T
36
- } = u, l = Ie();
37
- let y, c, C, x, v;
38
- if (l) {
39
- var j, s, A;
40
- if (y = void 0, c = (j = l.disabled) != null ? j : !1, C = (s = l.error) != null ? s : !1, x = (A = l.required) != null ? A : !1, v = l.value, process.env.NODE_ENV !== "production") {
41
- const o = ["defaultValue", "disabled", "error", "required", "value"].filter((r) => u[r] !== void 0);
42
- o.length > 0 && console.warn(["MUI: You have set props on an input that is inside a FormControl.", "Set these props on a FormControl instead. Otherwise they will be ignored.", `Ignored props: ${o.join(", ")}`].join(`
35
+ inputRef: S
36
+ } = r, o = Ae();
37
+ let y, s, N, x, C;
38
+ if (o) {
39
+ var j, i, v;
40
+ if (y = void 0, s = (j = o.disabled) != null ? j : !1, N = (i = o.error) != null ? i : !1, x = (v = o.required) != null ? v : !1, C = o.value, process.env.NODE_ENV !== "production") {
41
+ const e = ["defaultValue", "disabled", "error", "required", "value"].filter((a) => r[a] !== void 0);
42
+ e.length > 0 && console.warn(["MUI: You have set props on an input that is inside a FormControl.", "Set these props on a FormControl instead. Otherwise they will be ignored.", `Ignored props: ${e.join(", ")}`].join(`
43
43
  `));
44
44
  }
45
45
  } else
46
- y = d, c = b, C = p, x = O, v = f;
46
+ y = u, s = _, N = p, x = F, C = f;
47
47
  const {
48
- current: L
49
- } = F.useRef(v != null), W = F.useCallback((o) => {
50
- process.env.NODE_ENV !== "production" && o && o.nodeName !== "INPUT" && !o.focus && console.error(["MUI: You have provided a `slots.input` to the input component", "that does not correctly handle the `ref` prop.", "Make sure the `ref` prop is called with a HTMLInputElement."].join(`
48
+ current: K
49
+ } = E.useRef(C != null), q = E.useCallback((e) => {
50
+ process.env.NODE_ENV !== "production" && e && e.nodeName !== "INPUT" && !e.focus && console.error(["MUI: You have provided a `slots.input` to the input component", "that does not correctly handle the `ref` prop.", "Make sure the `ref` prop is called with a HTMLInputElement."].join(`
51
51
  `));
52
- }, []), R = F.useRef(null), k = Re(R, T, W), [I, B] = F.useState(!1);
53
- F.useEffect(() => {
54
- !l && c && I && (B(!1), g == null || g());
55
- }, [l, c, I, g]);
56
- const z = (o) => (r) => {
57
- var a;
58
- if (l != null && l.disabled) {
59
- r.stopPropagation();
52
+ }, []), R = E.useRef(null), A = Se(R, S, q), [O, T] = E.useState(!1);
53
+ E.useEffect(() => {
54
+ !o && s && O && (T(!1), b == null || b());
55
+ }, [o, s, O, b]);
56
+ const D = (e) => (a) => {
57
+ var l;
58
+ if (o != null && o.disabled) {
59
+ a.stopPropagation();
60
60
  return;
61
61
  }
62
- if ((a = o.onFocus) == null || a.call(o, r), l && l.onFocus) {
63
- var m;
64
- l == null || (m = l.onFocus) == null || m.call(l);
62
+ if ((l = e.onFocus) == null || l.call(e, a), o && o.onFocus) {
63
+ var d;
64
+ o == null || (d = o.onFocus) == null || d.call(o);
65
65
  } else
66
- B(!0);
67
- }, G = (o) => (r) => {
68
- var a;
69
- (a = o.onBlur) == null || a.call(o, r), l && l.onBlur ? l.onBlur() : B(!1);
70
- }, J = (o) => (r, ...a) => {
71
- var m, E;
72
- if (!L && (r.target || R.current) == null)
73
- throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." : Oe(17));
74
- l == null || (m = l.onChange) == null || m.call(l, r), (E = o.onChange) == null || E.call(o, r, ...a);
75
- }, Q = (o) => (r) => {
76
- var a;
77
- R.current && r.currentTarget === r.target && R.current.focus(), (a = o.onClick) == null || a.call(o, r);
66
+ T(!0);
67
+ }, $ = (e) => (a) => {
68
+ var l;
69
+ (l = e.onBlur) == null || l.call(e, a), o && o.onBlur ? o.onBlur() : T(!1);
70
+ }, Y = (e) => (a, ...l) => {
71
+ var d, I;
72
+ if (!K && (a.target || R.current) == null)
73
+ throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." : Ue(17));
74
+ o == null || (d = o.onChange) == null || d.call(o, a), (I = e.onChange) == null || I.call(e, a, ...l);
75
+ }, L = (e) => (a) => {
76
+ var l;
77
+ R.current && a.currentTarget === a.target && R.current.focus(), (l = e.onClick) == null || l.call(e, a);
78
78
  };
79
79
  return {
80
- disabled: c,
81
- error: C,
82
- focused: I,
83
- formControlContext: l,
84
- getInputProps: (o = {}) => {
85
- const a = N({}, {
86
- onBlur: g,
80
+ disabled: s,
81
+ error: N,
82
+ focused: O,
83
+ formControlContext: o,
84
+ getInputProps: (e = {}) => {
85
+ const l = w({}, {
86
+ onBlur: b,
87
87
  onChange: h,
88
- onFocus: S
89
- }, ue(o)), m = N({}, a, {
90
- onBlur: G(a),
91
- onChange: J(a),
92
- onFocus: z(a)
88
+ onFocus: V
89
+ }, de(e)), d = w({}, l, {
90
+ onBlur: $(l),
91
+ onChange: Y(l),
92
+ onFocus: D(l)
93
93
  });
94
- return N({}, m, {
95
- "aria-invalid": C || void 0,
94
+ return w({}, d, {
95
+ "aria-invalid": N || void 0,
96
96
  defaultValue: y,
97
- value: v,
97
+ value: C,
98
98
  required: x,
99
- disabled: c
100
- }, o, {
101
- ref: k
102
- }, m);
99
+ disabled: s
100
+ }, e, {
101
+ ref: A
102
+ }, d);
103
103
  },
104
- getRootProps: (o = {}) => {
105
- const r = ue(u, ["onBlur", "onChange", "onFocus"]), a = N({}, r, ue(o));
106
- return N({}, o, a, {
107
- onClick: Q(a)
104
+ getRootProps: (e = {}) => {
105
+ const a = de(r, ["onBlur", "onChange", "onFocus"]), l = w({}, a, de(e));
106
+ return w({}, e, l, {
107
+ onClick: L(l)
108
108
  });
109
109
  },
110
- inputRef: k,
110
+ inputRef: A,
111
111
  required: x,
112
- value: v
112
+ value: C
113
113
  };
114
114
  }
115
- const Ue = ["aria-describedby", "aria-label", "aria-labelledby", "autoComplete", "autoFocus", "className", "defaultValue", "disabled", "endAdornment", "error", "id", "multiline", "name", "onClick", "onChange", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "placeholder", "readOnly", "required", "startAdornment", "value", "type", "rows", "slotProps", "slots", "minRows", "maxRows"], je = (u) => {
115
+ const Me = ["aria-describedby", "aria-label", "aria-labelledby", "autoComplete", "autoFocus", "className", "defaultValue", "disabled", "endAdornment", "error", "id", "multiline", "name", "onClick", "onChange", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "placeholder", "readOnly", "required", "startAdornment", "value", "type", "rows", "slotProps", "slots", "minRows", "maxRows"], He = (r) => {
116
116
  const {
117
- disabled: d,
118
- error: b,
117
+ disabled: u,
118
+ error: _,
119
119
  focused: p,
120
- formControlContext: g,
120
+ formControlContext: b,
121
121
  multiline: h,
122
- startAdornment: S,
123
- endAdornment: O
124
- } = u;
125
- return Fe({
126
- root: ["root", d && "disabled", b && "error", p && "focused", !!g && "formControl", h && "multiline", !!S && "adornedStart", !!O && "adornedEnd"],
127
- input: ["input", d && "disabled", h && "multiline"]
128
- }, Se(Te));
129
- }, _e = /* @__PURE__ */ F.forwardRef(function(d, b) {
130
- var p, g, h;
122
+ startAdornment: V,
123
+ endAdornment: F
124
+ } = r;
125
+ return Ie({
126
+ root: ["root", u && "disabled", _ && "error", p && "focused", !!b && "formControl", h && "multiline", !!V && "adornedStart", !!F && "adornedEnd"],
127
+ input: ["input", u && "disabled", h && "multiline"]
128
+ }, Be(je));
129
+ }, he = /* @__PURE__ */ E.forwardRef(function(u, _) {
130
+ var p, b, h;
131
131
  const {
132
- "aria-describedby": S,
133
- "aria-label": O,
132
+ "aria-describedby": V,
133
+ "aria-label": F,
134
134
  "aria-labelledby": f,
135
- autoComplete: T,
136
- autoFocus: l,
135
+ autoComplete: S,
136
+ autoFocus: o,
137
137
  className: y,
138
- defaultValue: c,
139
- disabled: C,
138
+ defaultValue: s,
139
+ disabled: N,
140
140
  endAdornment: x,
141
- error: v,
141
+ error: C,
142
142
  id: j,
143
- multiline: s = !1,
144
- name: A,
145
- onClick: L,
146
- onChange: W,
143
+ multiline: i = !1,
144
+ name: v,
145
+ onClick: K,
146
+ onChange: q,
147
147
  onKeyDown: R,
148
- onKeyUp: k,
149
- onFocus: I,
150
- onBlur: B,
151
- placeholder: z,
152
- readOnly: G,
153
- required: J,
154
- startAdornment: Q,
148
+ onKeyUp: A,
149
+ onFocus: O,
150
+ onBlur: T,
151
+ placeholder: D,
152
+ readOnly: $,
153
+ required: Y,
154
+ startAdornment: L,
155
155
  value: Z,
156
- type: e,
157
- rows: o,
158
- slotProps: r = {},
159
- slots: a = {},
160
- minRows: m,
161
- maxRows: E
162
- } = d, D = Ee(d, Ue), {
163
- getRootProps: ee,
164
- getInputProps: ne,
165
- focused: te,
166
- formControlContext: oe,
167
- error: le,
168
- disabled: ae
169
- } = Be({
170
- disabled: C,
171
- defaultValue: c,
172
- error: v,
173
- onBlur: B,
174
- onClick: L,
175
- onChange: W,
176
- onFocus: I,
177
- required: J,
156
+ type: W,
157
+ rows: e,
158
+ slotProps: a = {},
159
+ slots: l = {},
160
+ minRows: d,
161
+ maxRows: I
162
+ } = u, z = Oe(u, Me), {
163
+ getRootProps: G,
164
+ getInputProps: J,
165
+ focused: ae,
166
+ formControlContext: ee,
167
+ error: re,
168
+ disabled: ie
169
+ } = ke({
170
+ disabled: N,
171
+ defaultValue: s,
172
+ error: C,
173
+ onBlur: T,
174
+ onClick: K,
175
+ onChange: q,
176
+ onFocus: O,
177
+ required: Y,
178
178
  value: Z
179
- }), X = s ? void 0 : e ?? "text", M = N({}, d, {
180
- disabled: ae,
181
- error: le,
182
- focused: te,
183
- formControlContext: oe,
184
- multiline: s,
185
- type: X
186
- }), t = je(M), w = {
187
- "aria-describedby": S,
188
- "aria-label": O,
179
+ }), ne = i ? void 0 : W ?? "text", Q = w({}, u, {
180
+ disabled: ie,
181
+ error: re,
182
+ focused: ae,
183
+ formControlContext: ee,
184
+ multiline: i,
185
+ type: ne
186
+ }), te = He(Q), oe = {
187
+ "aria-describedby": V,
188
+ "aria-label": F,
189
189
  "aria-labelledby": f,
190
- autoComplete: T,
191
- autoFocus: l,
190
+ autoComplete: S,
191
+ autoFocus: o,
192
192
  id: j,
193
193
  onKeyDown: R,
194
- onKeyUp: k,
195
- name: A,
196
- placeholder: z,
197
- readOnly: G,
198
- type: X
199
- }, V = (p = a.root) != null ? p : "div", P = pe({
200
- elementType: V,
201
- getSlotProps: ee,
202
- externalSlotProps: r.root,
203
- externalForwardedProps: D,
194
+ onKeyUp: A,
195
+ name: v,
196
+ placeholder: D,
197
+ readOnly: $,
198
+ type: ne
199
+ }, X = (p = l.root) != null ? p : "div", t = _e({
200
+ elementType: X,
201
+ getSlotProps: G,
202
+ externalSlotProps: a.root,
203
+ externalForwardedProps: z,
204
204
  additionalProps: {
205
- ref: b
205
+ ref: _
206
206
  },
207
- ownerState: M,
208
- className: [t.root, y]
209
- }), H = s ? (g = a.textarea) != null ? g : "textarea" : (h = a.input) != null ? h : "input", i = pe({
210
- elementType: H,
211
- getSlotProps: (K) => ne(N({}, w, K)),
212
- externalSlotProps: r.input,
213
- additionalProps: N({
214
- rows: s ? o : void 0
215
- }, s && !Ve(H) && {
216
- minRows: o || m,
217
- maxRows: o || E
207
+ ownerState: Q,
208
+ className: [te.root, y]
209
+ }), g = i ? (b = l.textarea) != null ? b : "textarea" : (h = l.input) != null ? h : "input", B = _e({
210
+ elementType: g,
211
+ getSlotProps: (P) => J(w({}, oe, P)),
212
+ externalSlotProps: a.input,
213
+ additionalProps: w({
214
+ rows: i ? e : void 0
215
+ }, i && !Te(g) && {
216
+ minRows: e || d,
217
+ maxRows: e || I
218
218
  }),
219
- ownerState: M,
220
- className: t.input
219
+ ownerState: Q,
220
+ className: te.input
221
221
  });
222
- return process.env.NODE_ENV !== "production" && s && o && (m || E) && console.warn("MUI: You can not use the `minRows` or `maxRows` props when the input `rows` prop is set."), /* @__PURE__ */ $(V, N({}, P, {
223
- children: [Q, /* @__PURE__ */ Y(H, N({}, i)), x]
222
+ return process.env.NODE_ENV !== "production" && i && e && (d || I) && console.warn("MUI: You can not use the `minRows` or `maxRows` props when the input `rows` prop is set."), /* @__PURE__ */ M(X, w({}, t, {
223
+ children: [L, /* @__PURE__ */ H(g, w({}, B)), x]
224
224
  }));
225
225
  });
226
- process.env.NODE_ENV !== "production" && (_e.propTypes = {
226
+ process.env.NODE_ENV !== "production" && (he.propTypes = {
227
227
  // ┌────────────────────────────── Warning ──────────────────────────────┐
228
228
  // │ These PropTypes are generated from the TypeScript type definitions. │
229
229
  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
@@ -373,11 +373,11 @@ process.env.NODE_ENV !== "production" && (_e.propTypes = {
373
373
  */
374
374
  value: n.any
375
375
  });
376
- const Ae = "_input_1cxiy_58", ke = "_input__label_1cxiy_85", _ = {
376
+ const Ke = "_input_1cxiy_58", qe = "_input__label_1cxiy_85", m = {
377
377
  "input__input-el": "_input__input-el_1cxiy_58",
378
- input: Ae,
378
+ input: Ke,
379
379
  "input__messages-wrapper": "_input__messages-wrapper_1cxiy_82",
380
- input__label: ke,
380
+ input__label: qe,
381
381
  "input__input-el-wrapper": "_input__input-el-wrapper_1cxiy_90",
382
382
  "input__left-icon": "_input__left-icon_1cxiy_115",
383
383
  "input__right-icon": "_input__right-icon_1cxiy_115",
@@ -387,83 +387,88 @@ const Ae = "_input_1cxiy_58", ke = "_input__label_1cxiy_85", _ = {
387
387
  "input--disabled": "_input--disabled_1cxiy_157",
388
388
  "input--focused": "_input--focused_1cxiy_163",
389
389
  "input--error": "_input--error_1cxiy_166"
390
- }, Le = ge(
390
+ }, Je = xe(
391
391
  ({
392
- label: u,
393
- infoMessage: d,
394
- error: b,
392
+ label: r,
393
+ infoMessage: u,
394
+ error: _,
395
395
  errorMessage: p,
396
- leftIcon: g,
396
+ leftIcon: b,
397
397
  rightIcon: h,
398
- id: S,
399
- disabled: O,
398
+ id: V,
399
+ disabled: F,
400
400
  type: f = "text",
401
- maxLength: T,
402
- allowLeadingZeros: l = !1,
401
+ maxLength: S,
402
+ allowLeadingZeros: o = !1,
403
403
  isInteger: y,
404
- useCommaInDecimal: c,
405
- allowNegativeNumbers: C = !1,
404
+ useCommaInDecimal: s,
405
+ allowNegativeNumbers: N = !1,
406
406
  decimalLength: x = 10,
407
- hideCharsCounter: v = !1,
407
+ hideCharsCounter: C = !1,
408
408
  required: j,
409
- onChange: s,
410
- classNameWrapper: A,
411
- classNameLabel: L,
412
- classNameInput: W,
413
- classNameInfoMessage: R,
414
- classNameErrorMessage: k,
415
- classNameCharsCounter: I,
416
- "data-testid-wrapper": B,
417
- "data-testid-label": z,
418
- "data-testid-input": G,
419
- "data-testid-infoMessage": J,
420
- "data-testid-errorMessage": Q,
421
- "data-testid-charsCounter": Z,
409
+ onChange: i,
410
+ triggerDelay: v,
411
+ classNameWrapper: K,
412
+ classNameLabel: q,
413
+ classNameInput: R,
414
+ classNameInfoMessage: A,
415
+ classNameErrorMessage: O,
416
+ classNameCharsCounter: T,
417
+ "data-testid-wrapper": D,
418
+ "data-testid-label": $,
419
+ "data-testid-input": Y,
420
+ "data-testid-infoMessage": L,
421
+ "data-testid-errorMessage": Z,
422
+ "data-testid-charsCounter": W,
422
423
  ...e
423
- }, o) => {
424
- var X, M;
425
- const [r, a] = he(
426
- ((X = e.value) == null ? void 0 : X.length) || ((M = e.defaultValue) == null ? void 0 : M.length) || 0
427
- ), m = ye(), E = S || `input_${m}`;
428
- Object.assign(e, { "data-testid": G });
429
- const D = T && !v, ee = (t) => {
430
- var w, V, P, H;
424
+ }, a) => {
425
+ var oe, X;
426
+ const [l, d] = we(
427
+ ((oe = e.value) == null ? void 0 : oe.length) || ((X = e.defaultValue) == null ? void 0 : X.length) || 0
428
+ ), I = Ne(), z = V || `input_${I}`;
429
+ Object.assign(e, { "data-testid": Y });
430
+ const G = S && !C, J = Ce(), ae = (t) => {
431
+ J.current && clearTimeout(J.current), J.current = setTimeout(() => {
432
+ ee(t);
433
+ }, v);
434
+ }, ee = (t) => {
435
+ var g, B, P, ce;
431
436
  if (f === "number-as-text") {
432
- let i = y ? Ne(t.target.value, l) : c ? t.target.value.replace(".", ",") : t.target.value.replace(",", ".");
437
+ let c = y ? Re(t.target.value, o) : s ? t.target.value.replace(".", ",") : t.target.value.replace(",", ".");
433
438
  if (!y && x > 0) {
434
- const se = String(i), [be, de] = se.split(/,|\./);
435
- se !== "" && de && (i = [be, de.slice(0, x)].join(c ? "," : "."));
439
+ const pe = String(c), [ye, fe] = pe.split(/,|\./);
440
+ pe !== "" && fe && (c = [ye, fe.slice(0, x)].join(s ? "," : "."));
436
441
  }
437
- t.target.value = String(i);
438
- const K = !isNaN(Number(String(i).replace(",", "."))), q = String(i).length ? String(i).replace(",", ".") : "";
439
- s == null || s({
442
+ t.target.value = String(c);
443
+ const le = !isNaN(Number(String(c).replace(",", "."))), k = String(c).length ? String(c).replace(",", ".") : "";
444
+ i == null || i({
440
445
  ...t,
441
446
  target: {
442
447
  ...t.target,
443
- value: q,
444
- valueAsNumber: K && String(i).length ? Number(String(i).replace(",", ".")) : NaN
448
+ value: k,
449
+ valueAsNumber: le && String(c).length ? Number(String(c).replace(",", ".")) : NaN
445
450
  }
446
- }), D && a((V = (w = t == null ? void 0 : t.target) == null ? void 0 : w.value) == null ? void 0 : V.length);
451
+ }), G && d((B = (g = t == null ? void 0 : t.target) == null ? void 0 : g.value) == null ? void 0 : B.length);
447
452
  return;
448
453
  }
449
454
  if (f === "number") {
450
- let i = String(t.target.value);
451
- const [K, q] = i.split(".");
452
- i !== "" && (q != null && q.length ? i = [Number(K), q.slice(0, x)].join(".") : i = String(Number(K))), t.target.value = i;
455
+ let c = String(t.target.value);
456
+ const [le, k] = c.split(".");
457
+ c !== "" && (k != null && k.length ? c = [Number(le), k.slice(0, x)].join(".") : c = String(Number(le))), t.target.value = c;
453
458
  }
454
- D && a((H = (P = t == null ? void 0 : t.target) == null ? void 0 : P.value) == null ? void 0 : H.length), s && s(t);
455
- }, ne = (t) => {
456
- var w;
457
- f === "number-as-text" && (y ? xe(t, C) : we(t, C)), (w = e == null ? void 0 : e.onKeyDown) == null || w.call(e, t);
458
- }, te = (t) => {
459
- var w;
459
+ G && d((ce = (P = t == null ? void 0 : t.target) == null ? void 0 : P.value) == null ? void 0 : ce.length), i && i(t);
460
+ }, re = (t) => {
461
+ var g;
462
+ f === "number-as-text" && (y ? ve(t, N) : Pe(t, N)), (g = e == null ? void 0 : e.onKeyDown) == null || g.call(e, t);
463
+ }, ie = (t) => {
464
+ var g;
460
465
  if (f === "number-as-text" && t.target.value.length) {
461
- const V = y ? t.target.value.replace(/(,\.)/gi, "") : t.target.value.replace(",", ".");
462
- let P = String(l ? V : Number(V));
463
- isNaN(Number(P)) && (P = ""), t.target.value = c ? P.replace(".", ",") : P;
466
+ const B = y ? t.target.value.replace(/(,\.)/gi, "") : t.target.value.replace(",", ".");
467
+ let P = String(o ? B : Number(B));
468
+ isNaN(Number(P)) && (P = ""), t.target.value = s ? P.replace(".", ",") : P;
464
469
  }
465
- (w = e == null ? void 0 : e.onBlur) == null || w.call(e, t);
466
- }, oe = re(() => e.multiline !== !0 ? {
470
+ (g = e == null ? void 0 : e.onBlur) == null || g.call(e, t);
471
+ }, ne = ue(() => e.multiline !== !0 ? {
467
472
  type: f === "number-as-text" ? "text" : f,
468
473
  multiline: e.multiline
469
474
  } : {
@@ -472,75 +477,81 @@ const Ae = "_input_1cxiy_58", ke = "_input__label_1cxiy_85", _ = {
472
477
  rows: (e == null ? void 0 : e.rows) || 5,
473
478
  minRows: e == null ? void 0 : e.minRows,
474
479
  maxRows: e == null ? void 0 : e.maxRows
475
- }, [e]), le = re(() => f === "number-as-text" && (e != null && e.defaultValue) ? ce(e == null ? void 0 : e.defaultValue, c) : e == null ? void 0 : e.defaultValue, [e.defaultValue]), ae = re(() => f === "number-as-text" && (e != null && e.value) ? ce(e == null ? void 0 : e.value, c) : e == null ? void 0 : e.value, [e.value]);
476
- return /* @__PURE__ */ $("div", { className: U(_.input, A), "data-testid": B, children: [
477
- u && /* @__PURE__ */ $(
478
- ie,
480
+ }, [e]), Q = ue(() => {
481
+ const t = v ? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.defaultValue) : e == null ? void 0 : e.defaultValue;
482
+ return f === "number-as-text" && t ? me(t, s) : t;
483
+ }, [e.defaultValue]), te = ue(() => {
484
+ if (!v)
485
+ return f === "number-as-text" && (e != null && e.value) ? me(e == null ? void 0 : e.value, s) : e == null ? void 0 : e.value;
486
+ }, [e.value]);
487
+ return /* @__PURE__ */ M("div", { className: U(m.input, K), "data-testid": D, children: [
488
+ r && /* @__PURE__ */ M(
489
+ se,
479
490
  {
480
491
  bold: !0,
481
492
  element: "label",
482
- elementProps: { htmlFor: E },
483
- className: U(_.input__label, L),
484
- "data-testid": z,
493
+ elementProps: { htmlFor: z },
494
+ className: U(m.input__label, q),
495
+ "data-testid": $,
485
496
  children: [
486
- u,
487
- j && /* @__PURE__ */ Y("span", { children: "*" })
497
+ r,
498
+ j && /* @__PURE__ */ H("span", { children: "*" })
488
499
  ]
489
500
  }
490
501
  ),
491
- /* @__PURE__ */ Y(
492
- _e,
502
+ /* @__PURE__ */ H(
503
+ he,
493
504
  {
494
- id: E,
495
- disabled: O,
496
- error: typeof b == "boolean" ? b : !!p,
497
- "aria-label": u,
505
+ id: z,
506
+ disabled: F,
507
+ error: typeof _ == "boolean" ? _ : !!p,
508
+ "aria-label": r,
498
509
  slotProps: {
499
510
  root: (t) => ({
500
- className: U(_["input__input-el-wrapper"], {
501
- [_["input--disabled"]]: t.disabled,
502
- [_["input--focused"]]: t.focused,
503
- [_["input--error"]]: t.error
511
+ className: U(m["input__input-el-wrapper"], {
512
+ [m["input--disabled"]]: t.disabled,
513
+ [m["input--focused"]]: t.focused,
514
+ [m["input--error"]]: t.error
504
515
  })
505
516
  }),
506
517
  input: {
507
- ref: o,
508
- className: U(_["input__input-el"], W),
509
- maxLength: T,
510
- onChange: ee,
518
+ ref: a,
519
+ className: U(m["input__input-el"], R),
520
+ maxLength: S,
521
+ onChange: v ? ae : ee,
511
522
  ...e,
512
- onKeyDown: ne,
513
- onBlur: te,
514
- defaultValue: le,
515
- value: ae
523
+ onKeyDown: re,
524
+ onBlur: ie,
525
+ defaultValue: Q,
526
+ value: te
516
527
  }
517
528
  },
518
- startAdornment: g && /* @__PURE__ */ Y("span", { className: _["input__left-icon"], children: g }),
519
- endAdornment: h && /* @__PURE__ */ Y("span", { className: _["input__right-icon"], children: h }),
520
- ...oe
529
+ startAdornment: b && /* @__PURE__ */ H("span", { className: m["input__left-icon"], children: b }),
530
+ endAdornment: h && /* @__PURE__ */ H("span", { className: m["input__right-icon"], children: h }),
531
+ ...ne
521
532
  }
522
533
  ),
523
- /* @__PURE__ */ $("div", { className: _["input__messages-wrapper"], children: [
524
- (p || d) && /* @__PURE__ */ $(
525
- ie,
534
+ /* @__PURE__ */ M("div", { className: m["input__messages-wrapper"], children: [
535
+ (p || u) && /* @__PURE__ */ M(
536
+ se,
526
537
  {
527
- className: p ? U(_["input__error-message"], k) : U(_["input__info-message"], R),
528
- "data-testid": p ? Q : J,
538
+ className: p ? U(m["input__error-message"], O) : U(m["input__info-message"], A),
539
+ "data-testid": p ? Z : L,
529
540
  children: [
530
- /* @__PURE__ */ Y(Ce, { icon: p ? "circle-exclamation" : "circle-info" }),
531
- p || d
541
+ /* @__PURE__ */ H(Ee, { icon: p ? "circle-exclamation" : "circle-info" }),
542
+ p || u
532
543
  ]
533
544
  }
534
545
  ),
535
- D && /* @__PURE__ */ $(
536
- ie,
546
+ G && /* @__PURE__ */ M(
547
+ se,
537
548
  {
538
- className: U(_["input__chars-counter"], I),
539
- "data-testid": Z,
549
+ className: U(m["input__chars-counter"], T),
550
+ "data-testid": W,
540
551
  children: [
541
- r,
552
+ l,
542
553
  " / ",
543
- T
554
+ S
544
555
  ]
545
556
  }
546
557
  )
@@ -549,5 +560,5 @@ const Ae = "_input_1cxiy_58", ke = "_input__label_1cxiy_85", _ = {
549
560
  }
550
561
  );
551
562
  export {
552
- Le as Input
563
+ Je as Input
553
564
  };
@@ -1,7 +1,5 @@
1
1
  import { ForwardedRef } from 'react';
2
2
  export declare const InputSearch: import('react').ForwardRefExoticComponent<(Omit<{
3
- /** How many milliseconds to wait before trigger the onChange event */
4
- triggerDelay?: number | undefined;
5
3
  ref?: ForwardedRef<HTMLInputElement> | undefined;
6
4
  } & import('react').InputHTMLAttributes<HTMLInputElement> & {
7
5
  label?: string | undefined;
@@ -12,6 +10,7 @@ export declare const InputSearch: import('react').ForwardRefExoticComponent<(Omi
12
10
  leftIcon?: import('react').ReactNode;
13
11
  rightIcon?: import('react').ReactNode;
14
12
  type?: ("number" | "url" | "file" | "color" | "search" | (string & {}) | "button" | "time" | "image" | "text" | "reset" | "tel" | "email" | "date" | "hidden" | "range" | "datetime-local" | "month" | "password" | "week") | "number-as-text" | undefined;
13
+ triggerDelay?: number | undefined;
15
14
  allowLeadingZeros?: boolean | undefined;
16
15
  isInteger?: boolean | undefined;
17
16
  useCommaInDecimal?: boolean | undefined;
@@ -31,8 +30,6 @@ export declare const InputSearch: import('react').ForwardRefExoticComponent<(Omi
31
30
  'data-testid-errorMessage'?: string | undefined;
32
31
  'data-testid-charsCounter'?: string | undefined;
33
32
  } & import('react').RefAttributes<HTMLInputElement>, "ref"> | Omit<{
34
- /** How many milliseconds to wait before trigger the onChange event */
35
- triggerDelay?: number | undefined;
36
33
  ref?: ForwardedRef<HTMLInputElement> | undefined;
37
34
  } & Omit<import('../Input/Input').SingleInputProps, "multiline"> & {
38
35
  multiline: true;
@@ -1,31 +1,13 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { c as u } from "../../clsx-OuTLNxxd.js";
4
- import { Icon as f } from "../Icon/Icon.js";
5
- import { Input as l } from "../Input/Input.js";
6
- import '../../assets/InputSearch.css';const h = "_inputSearch_114e1_1", g = {
7
- inputSearch: h
8
- };
9
- let r;
10
- const _ = p(
11
- ({ classNameWrapper: n, triggerDelay: o = 500, value: c, onChange: i = () => {
12
- }, ...a }, s) => {
13
- const m = (t) => {
14
- r && clearTimeout(r), r = setTimeout(() => i(t), o);
15
- };
16
- return /* @__PURE__ */ e("div", { className: u(g.inputSearch, n), children: /* @__PURE__ */ e(
17
- l,
18
- {
19
- type: "search",
20
- ref: s,
21
- ...a,
22
- leftIcon: /* @__PURE__ */ e(f, { icon: "magnifying-glass" }),
23
- defaultValue: c,
24
- onChange: (t) => m(t)
25
- }
26
- ) });
27
- }
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ import { c as a } from "../../clsx-OuTLNxxd.js";
4
+ import { Icon as i } from "../Icon/Icon.js";
5
+ import { Input as p } from "../Input/Input.js";
6
+ import '../../assets/InputSearch.css';const s = "_inputSearch_114e1_1", m = {
7
+ inputSearch: s
8
+ }, d = n(
9
+ ({ classNameWrapper: t, value: o, ...e }, c) => /* @__PURE__ */ r("div", { className: a(m.inputSearch, t), children: /* @__PURE__ */ r(p, { type: "search", ref: c, ...e, leftIcon: /* @__PURE__ */ r(i, { icon: "magnifying-glass" }), defaultValue: o }) })
28
10
  );
29
11
  export {
30
- _ as InputSearch
12
+ d as InputSearch
31
13
  };
@@ -2,7 +2,6 @@ import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
4
  component: import('react').ForwardRefExoticComponent<(Omit<{
5
- triggerDelay?: number | undefined;
6
5
  ref?: import('react').ForwardedRef<HTMLInputElement> | undefined;
7
6
  } & import('react').InputHTMLAttributes<HTMLInputElement> & {
8
7
  label?: string | undefined;
@@ -13,6 +12,7 @@ declare const meta: {
13
12
  leftIcon?: import('react').ReactNode;
14
13
  rightIcon?: import('react').ReactNode;
15
14
  type?: ("number" | "url" | "file" | "color" | "search" | (string & {}) | "button" | "time" | "image" | "text" | "reset" | "tel" | "email" | "date" | "hidden" | "range" | "datetime-local" | "month" | "password" | "week") | "number-as-text" | undefined;
15
+ triggerDelay?: number | undefined;
16
16
  allowLeadingZeros?: boolean | undefined;
17
17
  isInteger?: boolean | undefined;
18
18
  useCommaInDecimal?: boolean | undefined;
@@ -32,7 +32,6 @@ declare const meta: {
32
32
  'data-testid-errorMessage'?: string | undefined;
33
33
  'data-testid-charsCounter'?: string | undefined;
34
34
  } & import('react').RefAttributes<HTMLInputElement>, "ref"> | Omit<{
35
- triggerDelay?: number | undefined;
36
35
  ref?: import('react').ForwardedRef<HTMLInputElement> | undefined;
37
36
  } & Omit<import('../Input/Input').SingleInputProps, "multiline"> & {
38
37
  multiline: true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pismo/marola",
3
3
  "description": "CDX tribe component library",
4
- "version": "2.1.54",
4
+ "version": "2.1.56",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",