@versini/ui-textinput 1.2.2 → 1.3.0

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,7 +1,7 @@
1
1
  import { jsx as f, jsxs as W } from "react/jsx-runtime";
2
- import G, { useRef as y, useEffect as R, useCallback as J, useState as L, useMemo as K, useId as Q, useReducer as Y, useLayoutEffect as $ } from "react";
2
+ import G, { useRef as y, useEffect as R, useCallback as J, useState as L, useMemo as K, useId as Q, useReducer as Y, useLayoutEffect as P } from "react";
3
3
  import c from "clsx";
4
- const w = "av-text-input", be = "av-text-input-simple", Z = "av-text-input-wrapper", C = "av-text-input-helper-text";
4
+ const w = "av-text-input", be = "av-text-input-simple", Z = "av-text-input-wrapper", I = "av-text-input-helper-text";
5
5
  function B() {
6
6
  const e = y(!1);
7
7
  return R(() => (e.current = !0, () => {
@@ -40,7 +40,7 @@ function re(e) {
40
40
  return typeof t == "number" || typeof t == "string" ? `${n}${t}` : `${n}${r}`;
41
41
  }
42
42
  }
43
- const D = "SET_ANNOUNCEMENT", M = "CLEAR_ANNOUNCEMENT", ne = {
43
+ const D = "SET_ANNOUNCEMENT", U = "CLEAR_ANNOUNCEMENT", ne = {
44
44
  alert: null,
45
45
  alertdialog: null,
46
46
  log: "polite",
@@ -55,7 +55,7 @@ const D = "SET_ANNOUNCEMENT", M = "CLEAR_ANNOUNCEMENT", ne = {
55
55
  ...e,
56
56
  announcement: r.payload
57
57
  };
58
- case M:
58
+ case U:
59
59
  return {
60
60
  ...e,
61
61
  announcement: null
@@ -68,16 +68,16 @@ const D = "SET_ANNOUNCEMENT", M = "CLEAR_ANNOUNCEMENT", ne = {
68
68
  dispatch: r
69
69
  }) => {
70
70
  r({
71
- type: M
71
+ type: U
72
72
  }), typeof e == "function" && e();
73
- }, P = ({
73
+ }, S = ({
74
74
  children: e,
75
75
  clearAnnouncementDelay: r,
76
76
  clearAnnouncementTimeoutRef: t,
77
77
  onAnnouncementClear: n,
78
78
  dispatch: l
79
79
  }) => {
80
- (t == null ? void 0 : t.current) !== null && clearTimeout(t.current), e !== null && l({
80
+ clearTimeout(t.current), e !== null && l({
81
81
  type: D,
82
82
  payload: e
83
83
  }), r && (t.current = setTimeout(
@@ -96,13 +96,13 @@ const D = "SET_ANNOUNCEMENT", M = "CLEAR_ANNOUNCEMENT", ne = {
96
96
  onAnnouncementClear: o,
97
97
  dispatch: a
98
98
  }) => {
99
- clearTimeout(r.current), t ? r.current = setTimeout(P, t, {
99
+ clearTimeout(r.current), t ? r.current = setTimeout(S, t, {
100
100
  children: e,
101
101
  clearAnnouncementDelay: n,
102
102
  clearAnnouncementTimeoutRef: l,
103
103
  onAnnouncementClear: o,
104
104
  dispatch: a
105
- }) : P({
105
+ }) : S({
106
106
  children: e,
107
107
  clearAnnouncementDelay: n,
108
108
  clearAnnouncementTimeoutRef: l,
@@ -121,7 +121,7 @@ function oe({
121
121
  visible: u,
122
122
  ...p
123
123
  }) {
124
- const m = y(), x = y(), [g, s] = Y(le, {
124
+ const m = y(null), x = y(null), [g, s] = Y(le, {
125
125
  announcement: null
126
126
  });
127
127
  let d = t;
@@ -166,13 +166,13 @@ const se = (e) => {
166
166
  return r;
167
167
  };
168
168
  /*!
169
- @versini/ui-private v1.4.18
169
+ @versini/ui-private v1.5.0
170
170
  © 2024 gizmette.com
171
171
  */
172
172
  try {
173
173
  window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
174
- version: "1.4.18",
175
- buildTime: "11/19/2024 10:59 AM EST",
174
+ version: "1.5.0",
175
+ buildTime: "12/18/2024 12:34 PM EST",
176
176
  homepage: "https://github.com/aversini/ui-components",
177
177
  license: "MIT"
178
178
  });
@@ -234,18 +234,18 @@ const ue = ({
234
234
  return "";
235
235
  if (n)
236
236
  return c(
237
- C,
237
+ I,
238
238
  "absolute px-2 cursor-not-allowed opacity-50 font-medium"
239
239
  );
240
240
  if (!e)
241
- return c(C, "absolute px-2 font-medium", {
241
+ return c(I, "absolute px-2 font-medium", {
242
242
  "text-copy-lighter": t === "dark",
243
243
  "text-copy-dark": t === "light",
244
244
  "text-copy-dark dark:text-copy-lighter": t === "system",
245
245
  "text-copy-lighter dark:text-copy-dark": t === "alt-system"
246
246
  });
247
247
  if (e)
248
- return c(C, "absolute px-2 font-medium", {
248
+ return c(I, "absolute px-2 font-medium", {
249
249
  "text-copy-error-light bg-surface-darker": t === "dark",
250
250
  "text-copy-error-dark": t === "light",
251
251
  "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": t === "system",
@@ -309,14 +309,14 @@ const ue = ({
309
309
  raw: t,
310
310
  mode: u,
311
311
  disabled: n
312
- }), I = t ? void 0 : c("absolute right-3", x);
312
+ }), N = t ? void 0 : c("absolute right-3", x);
313
313
  return {
314
314
  wrapper: g,
315
315
  input: d,
316
316
  accessibleLabel: i,
317
317
  visibleLabel: b,
318
318
  helperText: E,
319
- rightElement: I
319
+ rightElement: N
320
320
  };
321
321
  }, me = G.forwardRef(
322
322
  ({
@@ -337,11 +337,11 @@ const ue = ({
337
337
  helperText: i = "",
338
338
  rightElement: b,
339
339
  rightElementClassName: E,
340
- spacing: I,
340
+ spacing: N,
341
341
  size: _ = "md",
342
- ...U
343
- }, j) => {
344
- const [F, T] = te(), [O, X] = L(0), k = re({ id: e, prefix: `${w}-` }), V = `${r} error, ${i}`, A = y(null), v = y(null), q = {
342
+ ...M
343
+ }, F) => {
344
+ const [j, T] = te(), [X, O] = L(0), k = re({ id: e, prefix: `${w}-` }), V = `${r} error, ${i}`, v = y(null), A = y(null), q = {
345
345
  xs: { label: "-25px", helperText: "30px" },
346
346
  sm: { label: "-29px", helperText: "34px" },
347
347
  md: { label: "-33px", helperText: "38px" },
@@ -355,17 +355,17 @@ const ue = ({
355
355
  focusMode: p,
356
356
  disabled: m,
357
357
  noBorder: x,
358
- spacing: I,
358
+ spacing: N,
359
359
  mode: u,
360
360
  size: _,
361
361
  rightElementClassName: E
362
362
  });
363
- return $(() => {
364
- T && T.width && X(T.width + 18 + 10);
365
- }, [T]), $(() => {
366
- var N, S;
363
+ return P(() => {
364
+ T && T.width && O(T.width + 18 + 10);
365
+ }, [T]), P(() => {
366
+ var C, $;
367
367
  const { label: H, helperText: z } = q[_];
368
- (N = A == null ? void 0 : A.current) == null || N.style.setProperty("--av-text-input-label", H), (S = v == null ? void 0 : v.current) == null || S.style.setProperty(
368
+ (C = v == null ? void 0 : v.current) == null || C.style.setProperty("--av-text-input-label", H), ($ = A == null ? void 0 : A.current) == null || $.style.setProperty(
369
369
  "--av-text-input-helper-text",
370
370
  z
371
371
  );
@@ -382,7 +382,7 @@ const ue = ({
382
382
  /* @__PURE__ */ f(
383
383
  "input",
384
384
  {
385
- ref: j,
385
+ ref: F,
386
386
  id: k,
387
387
  name: r,
388
388
  type: d,
@@ -391,14 +391,14 @@ const ue = ({
391
391
  className: h.input,
392
392
  ...i && { "aria-describedby": `${k}-helper` },
393
393
  ...n && { "aria-invalid": "true" },
394
- ...b && !l && { style: { paddingRight: O } },
395
- ...U
394
+ ...b && !l && { style: { paddingRight: X } },
395
+ ...M
396
396
  }
397
397
  ),
398
398
  !l && !s && /* @__PURE__ */ f(
399
399
  "label",
400
400
  {
401
- ref: A,
401
+ ref: v,
402
402
  "aria-hidden": !0,
403
403
  htmlFor: k,
404
404
  className: h.visibleLabel,
@@ -408,7 +408,7 @@ const ue = ({
408
408
  i && /* @__PURE__ */ f(
409
409
  "div",
410
410
  {
411
- ref: v,
411
+ ref: A,
412
412
  id: `${k}-helper`,
413
413
  className: h.helperText,
414
414
  children: i
@@ -417,7 +417,7 @@ const ue = ({
417
417
  b && /* @__PURE__ */ f(
418
418
  "div",
419
419
  {
420
- ref: F,
420
+ ref: j,
421
421
  className: h.rightElement,
422
422
  children: b
423
423
  }
@@ -429,9 +429,9 @@ const ue = ({
429
429
  me.displayName = "TextInput";
430
430
  export {
431
431
  w as TEXT_INPUT_CLASSNAME,
432
- C as TEXT_INPUT_HELPER_TEXT_CLASSNAME,
432
+ I as TEXT_INPUT_HELPER_TEXT_CLASSNAME,
433
433
  be as TEXT_INPUT_SIMPLE_CLASSNAME,
434
434
  Z as TEXT_INPUT_WRAPPER_CLASSNAME,
435
435
  me as TextInput,
436
- oe as j
436
+ oe as x
437
437
  };
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { TextInput as m } from "../../chunks/TextInput.B46x1iaZ.js";
2
+ import { TextInput as m } from "../../chunks/TextInput.B6Y-Xm3D.js";
3
3
  import "react";
4
4
  export {
5
5
  m as TextInput
@@ -1,5 +1,5 @@
1
- import { TextInput as H, j as L } from "../../chunks/TextInput.B46x1iaZ.js";
2
- import { jsxs as j, Fragment as B, jsx as w } from "react/jsx-runtime";
1
+ import { TextInput as H, x as L } from "../../chunks/TextInput.B6Y-Xm3D.js";
2
+ import { jsxs as B, Fragment as j, jsx as x } from "react/jsx-runtime";
3
3
  import A, { useMemo as b, useState as _, useRef as m, useEffect as $ } from "react";
4
4
  function q(r) {
5
5
  return b(() => r.every((t) => t == null) ? () => {
@@ -15,49 +15,49 @@ const z = 500, G = 5e3, J = 2e4, K = A.forwardRef(
15
15
  disabled: t,
16
16
  label: n,
17
17
  labelHidden: k,
18
- onMaskChange: o,
19
- onChange: d,
20
- onBlur: T,
18
+ onMaskChange: u,
19
+ onChange: T,
20
+ onBlur: d,
21
21
  onFocus: p,
22
22
  onTextInputMaskBlur: f,
23
- rightElement: x,
24
- spacing: O,
25
- ...U
23
+ rightElement: O,
24
+ spacing: U,
25
+ ...w
26
26
  }, E) => {
27
- const [h, g] = _(!0), [a, R] = _({
27
+ const [h, g] = _(!0), [l, R] = _({
28
28
  message: null,
29
29
  politeness: null
30
- }), u = m(!0), i = m(), I = m(null), C = q([E, I]), S = h ? "Show" : "Hide", c = () => {
31
- clearTimeout(i.current), u.current || (i.current = window.setTimeout(() => {
32
- u.current = !0, g(!0), R({
30
+ }), c = m(!0), o = m(null), I = m(null), C = q([E, I]), S = h ? "Show" : "Hide", a = () => {
31
+ o.current && clearTimeout(o.current), c.current || (o.current = setTimeout(() => {
32
+ c.current = !0, g(!0), R({
33
33
  announcementTimeout: G,
34
34
  politeness: "polite",
35
35
  message: `${n} hiding characters`
36
- }), o && o(!0);
36
+ }), u && u(!0);
37
37
  }, J));
38
38
  }, v = (e) => {
39
39
  e.preventDefault();
40
- const s = !u.current;
41
- u.current = s, c(), g(s), R({
40
+ const s = !c.current;
41
+ c.current = s, a(), g(s), R({
42
42
  announcementTimeout: z,
43
43
  politeness: "assertive",
44
44
  message: s ? "Characters hidden" : "Characters showing"
45
- }), o && o(s);
45
+ }), u && u(s);
46
46
  }, M = (e) => {
47
47
  var N;
48
- const { relatedTarget: s } = e, l = (N = I.current) == null ? void 0 : N.parentElement;
49
- l != null && l.contains(s) || f && f();
48
+ const { relatedTarget: s } = e, i = (N = I.current) == null ? void 0 : N.parentElement;
49
+ i != null && i.contains(s) || f && f();
50
50
  }, y = (e) => {
51
- c(), T && T(e), M(e);
51
+ a(), d && d(e), M(e);
52
52
  }, D = (e) => {
53
- c(), p && p(e);
53
+ a(), p && p(e);
54
54
  }, F = (e) => {
55
- c(), d && d(e);
55
+ a(), T && T(e);
56
56
  };
57
57
  return $(() => () => {
58
- clearTimeout(i.current);
59
- }, []), /* @__PURE__ */ j(B, { children: [
60
- /* @__PURE__ */ w(
58
+ o.current && clearTimeout(o.current);
59
+ }, []), /* @__PURE__ */ B(j, { children: [
60
+ /* @__PURE__ */ x(
61
61
  H,
62
62
  {
63
63
  ref: C,
@@ -66,27 +66,27 @@ const z = 500, G = 5e3, J = 2e4, K = A.forwardRef(
66
66
  labelHidden: k,
67
67
  type: h ? "password" : "text",
68
68
  disabled: t,
69
- spacing: O,
69
+ spacing: U,
70
70
  onBlur: y,
71
71
  onFocus: D,
72
72
  onChange: F,
73
- rightElement: A.cloneElement(x, {
73
+ rightElement: A.cloneElement(O, {
74
74
  ref: E,
75
75
  label: S,
76
76
  onClick: v,
77
77
  onBlur: M,
78
78
  disabled: t
79
79
  }),
80
- ...U
80
+ ...w
81
81
  }
82
82
  ),
83
- /* @__PURE__ */ w(
83
+ /* @__PURE__ */ x(
84
84
  L,
85
85
  {
86
86
  role: "status",
87
- politeness: a.politeness,
88
- clearAnnouncementDelay: a.announcementTimeout,
89
- children: a.message
87
+ politeness: l.politeness,
88
+ clearAnnouncementDelay: l.announcementTimeout,
89
+ children: l.message
90
90
  }
91
91
  )
92
92
  ] });
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { TEXT_INPUT_CLASSNAME as I, TEXT_INPUT_HELPER_TEXT_CLASSNAME as e, TEXT_INPUT_SIMPLE_CLASSNAME as o, TEXT_INPUT_WRAPPER_CLASSNAME as t, TextInput as N } from "./chunks/TextInput.B46x1iaZ.js";
1
+ import { TEXT_INPUT_CLASSNAME as I, TEXT_INPUT_HELPER_TEXT_CLASSNAME as e, TEXT_INPUT_SIMPLE_CLASSNAME as o, TEXT_INPUT_WRAPPER_CLASSNAME as t, TextInput as N } from "./chunks/TextInput.B6Y-Xm3D.js";
2
2
  import { TextInputMask as i } from "./components/TextInput/TextInputMask.js";
3
3
  /*!
4
- @versini/ui-textinput v1.2.2
4
+ @versini/ui-textinput v1.3.0
5
5
  © 2024 gizmette.com
6
6
  */
7
7
  try {
8
8
  window.__VERSINI_UI_TEXTINPUT__ || (window.__VERSINI_UI_TEXTINPUT__ = {
9
- version: "1.2.2",
10
- buildTime: "11/19/2024 10:59 AM EST",
9
+ version: "1.3.0",
10
+ buildTime: "12/18/2024 12:35 PM EST",
11
11
  homepage: "https://github.com/aversini/ui-components",
12
12
  license: "MIT"
13
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-textinput",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -34,18 +34,18 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "peerDependencies": {
37
- "react": "^18.3.1",
38
- "react-dom": "^18.3.1"
37
+ "react": "^18.3.1 || ^19.0.0",
38
+ "react-dom": "^18.3.1 || ^19.0.0"
39
39
  },
40
40
  "dependencies": {
41
41
  "@tailwindcss/typography": "0.5.15",
42
- "@versini/ui-hooks": "4.2.2",
43
- "@versini/ui-private": "1.4.18",
42
+ "@versini/ui-hooks": "4.3.0",
43
+ "@versini/ui-private": "1.5.0",
44
44
  "clsx": "2.1.1",
45
45
  "tailwindcss": "3.4.15"
46
46
  },
47
47
  "sideEffects": [
48
48
  "**/*.css"
49
49
  ],
50
- "gitHead": "a1eda2c717accc8904a7b0552489690d4da5dece"
50
+ "gitHead": "413e5c7cd8228d2f135f54fa897101401207229b"
51
51
  }