@purpurds/text-field 5.12.0 → 5.14.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,5 +1,5 @@
1
1
  import { jsxs as g, jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as b, Children as N, isValidElement as z, createElement as M, cloneElement as Y, useEffect as xr, Fragment as mr, useRef as gr, useId as br } from "react";
2
+ import { forwardRef as b, Children as N, isValidElement as z, createElement as M, cloneElement as W, useEffect as xr, Fragment as mr, useRef as gr, useId as br } from "react";
3
3
  import "react-dom";
4
4
  const yr = {
5
5
  SM: "sm",
@@ -9,7 +9,7 @@ const yr = {
9
9
  function hr(t) {
10
10
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
11
11
  }
12
- var J = { exports: {} };
12
+ var K = { exports: {} };
13
13
  /*!
14
14
  Copyright (c) 2018 Jed Watson.
15
15
  Licensed under the MIT License (MIT), see
@@ -44,8 +44,8 @@ var J = { exports: {} };
44
44
  }
45
45
  t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
46
46
  })();
47
- })(J);
48
- var $r = J.exports;
47
+ })(K);
48
+ var $r = K.exports;
49
49
  const R = /* @__PURE__ */ hr($r), jr = "_rotate_1xozj_1", wr = "_dash_1xozj_1", j = {
50
50
  "purpur-spinner": "_purpur-spinner_1xozj_1",
51
51
  rotate: jr,
@@ -151,7 +151,7 @@ const Mr = /* @__PURE__ */ Nr(zr), Ar = {
151
151
  "purpur-button--tertiary-purple-negative": "_purpur-button--tertiary-purple-negative_1acxn_160",
152
152
  "purpur-button--text-negative": "_purpur-button--text-negative_1acxn_175",
153
153
  "purpur-button--text": "_purpur-button--text_1acxn_175"
154
- }, qr = Mr.bind(Ar), x = "purpur-button", Cr = ({
154
+ }, Cr = Mr.bind(Ar), x = "purpur-button", qr = ({
155
155
  children: t,
156
156
  className: u,
157
157
  ["data-testid"]: n,
@@ -163,12 +163,12 @@ const Mr = /* @__PURE__ */ Nr(zr), Ar = {
163
163
  onClick: f,
164
164
  size: v = "md",
165
165
  variant: y,
166
- type: q = "button",
166
+ type: C = "button",
167
167
  ...l
168
168
  }, m) => {
169
169
  if (r && y === "destructive")
170
170
  return null;
171
- const C = qr(
171
+ const q = Cr(
172
172
  [
173
173
  x,
174
174
  `${x}--${i ? `${y}-negative` : y}`,
@@ -187,9 +187,9 @@ const Mr = /* @__PURE__ */ Nr(zr), Ar = {
187
187
  return /* @__PURE__ */ g(
188
188
  "button",
189
189
  {
190
- className: C,
190
+ className: q,
191
191
  "data-testid": n,
192
- type: q,
192
+ type: C,
193
193
  ref: m,
194
194
  "aria-disabled": c,
195
195
  onClick: h,
@@ -201,9 +201,9 @@ const Mr = /* @__PURE__ */ Nr(zr), Ar = {
201
201
  ]
202
202
  }
203
203
  );
204
- }, rr = b(Cr);
204
+ }, rr = b(qr);
205
205
  rr.displayName = "Button";
206
- function Br(t) {
206
+ function Lr(t) {
207
207
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
208
208
  }
209
209
  var tr = { exports: {} };
@@ -242,8 +242,8 @@ var tr = { exports: {} };
242
242
  t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
243
243
  })();
244
244
  })(tr);
245
- var Ir = tr.exports;
246
- const Dr = /* @__PURE__ */ Br(Ir), Fr = {
245
+ var Br = tr.exports;
246
+ const Dr = /* @__PURE__ */ Lr(Br), Fr = {
247
247
  "purpur-icon": "_purpur-icon_8u1lq_1",
248
248
  "purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
249
249
  "purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
@@ -251,31 +251,31 @@ const Dr = /* @__PURE__ */ Br(Ir), Fr = {
251
251
  "purpur-icon--md": "_purpur-icon--md_8u1lq_16",
252
252
  "purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
253
253
  "purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
254
- }, Lr = {
254
+ }, Ir = {
255
255
  name: "error-filled",
256
256
  svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="currentColor"><path fill-rule="evenodd" d="M14.268 3.5c-.77-1.333-2.694-1.333-3.464 0l-8.66 15c-.77 1.333.192 3 1.732 3h17.32c1.54 0 2.502-1.667 1.733-3l-8.66-15Zm-.694 5.067-.247 6.876h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.917c0 .649-.585 1.234-1.25 1.234-.648 0-1.25-.585-1.25-1.234 0-.633.602-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',
257
257
  keywords: ["error-filled"],
258
258
  category: "status"
259
- }, Pr = Dr.bind(Fr), T = "purpur-icon", kr = "md", Er = (t) => t.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), Zr = ({ content: t = "", title: u } = {}) => {
259
+ }, Pr = Dr.bind(Fr), V = "purpur-icon", Er = "md", kr = (t) => t.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), Xr = ({ content: t = "", title: u } = {}) => {
260
260
  const n = [
261
261
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
262
262
  { name: "fill", value: "currentColor" },
263
263
  { name: "viewBox", value: "0 0 24 24" },
264
264
  u ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
265
265
  ], a = u ? `<title>${u}</title>` : "";
266
- return `<svg ${Er(n)}>${a}${t}</svg>`;
267
- }, Xr = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Rr = ({
266
+ return `<svg ${kr(n)}>${a}${t}</svg>`;
267
+ }, Zr = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Rr = ({
268
268
  ["data-testid"]: t,
269
269
  svg: u,
270
270
  allyTitle: n,
271
271
  className: a,
272
- size: o = kr,
272
+ size: o = Er,
273
273
  ...r
274
274
  }) => {
275
- const e = Zr({
276
- content: Xr(u.svg),
275
+ const e = Xr({
276
+ content: Zr(u.svg),
277
277
  title: n
278
- }), i = Pr(a, T, `${T}--${o}`);
278
+ }), i = Pr(a, V, `${V}--${o}`);
279
279
  return /* @__PURE__ */ p(
280
280
  "span",
281
281
  {
@@ -287,7 +287,7 @@ const Dr = /* @__PURE__ */ Br(Ir), Fr = {
287
287
  }
288
288
  );
289
289
  };
290
- function Tr(t) {
290
+ function Vr(t) {
291
291
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
292
292
  }
293
293
  var er = { exports: {} };
@@ -326,8 +326,8 @@ var er = { exports: {} };
326
326
  t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
327
327
  })();
328
328
  })(er);
329
- var Vr = er.exports;
330
- const Gr = /* @__PURE__ */ Tr(Vr), V = {
329
+ var Tr = er.exports;
330
+ const Gr = /* @__PURE__ */ Vr(Tr), T = {
331
331
  "purpur-field-error-text": "_purpur-field-error-text_1u768_1",
332
332
  "purpur-field-error-text__icon": "_purpur-field-error-text__icon_1u768_12"
333
333
  }, G = "purpur-field-error-text", Hr = ({
@@ -339,18 +339,18 @@ const Gr = /* @__PURE__ */ Tr(Vr), V = {
339
339
  }) => /* @__PURE__ */ g(
340
340
  "div",
341
341
  {
342
- className: Gr([n, V[G]]),
342
+ className: Gr([n, T[G]]),
343
343
  "data-testid": t,
344
344
  "aria-live": "assertive",
345
345
  "aria-relevant": a,
346
346
  ...o,
347
347
  children: [
348
- /* @__PURE__ */ p(Rr, { svg: Lr, size: "xs", className: V[`${G}__icon`] }),
348
+ /* @__PURE__ */ p(Rr, { svg: Ir, size: "xs", className: T[`${G}__icon`] }),
349
349
  u
350
350
  ]
351
351
  }
352
352
  );
353
- function Wr(t) {
353
+ function Yr(t) {
354
354
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
355
355
  }
356
356
  var nr = { exports: {} };
@@ -389,11 +389,11 @@ var nr = { exports: {} };
389
389
  t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
390
390
  })();
391
391
  })(nr);
392
- var Kr = nr.exports;
393
- const Ur = /* @__PURE__ */ Wr(Kr), H = {
392
+ var Jr = nr.exports;
393
+ const Ur = /* @__PURE__ */ Yr(Jr), H = {
394
394
  "purpur-field-helper-text": "_purpur-field-helper-text_atw6b_1",
395
395
  "purpur-field-helper-text--disabled": "_purpur-field-helper-text--disabled_atw6b_9"
396
- }, W = "purpur-field-helper-text", Yr = ({
396
+ }, Y = "purpur-field-helper-text", Wr = ({
397
397
  ["data-testid"]: t,
398
398
  children: u,
399
399
  className: n,
@@ -403,14 +403,14 @@ const Ur = /* @__PURE__ */ Wr(Kr), H = {
403
403
  }) => {
404
404
  const e = Ur([
405
405
  n,
406
- H[W],
406
+ H[Y],
407
407
  {
408
- [H[`${W}--disabled`]]: a
408
+ [H[`${Y}--disabled`]]: a
409
409
  }
410
410
  ]);
411
411
  return /* @__PURE__ */ p("span", { id: o, className: e, "data-testid": t, ...r, children: u });
412
412
  };
413
- function Jr(t) {
413
+ function Kr(t) {
414
414
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
415
415
  }
416
416
  var ir = { exports: {} };
@@ -450,7 +450,7 @@ var ir = { exports: {} };
450
450
  })();
451
451
  })(ir);
452
452
  var Qr = ir.exports;
453
- const rt = /* @__PURE__ */ Jr(Qr), tt = {
453
+ const rt = /* @__PURE__ */ Kr(Qr), tt = {
454
454
  "purpur-icon": "_purpur-icon_8u1lq_1",
455
455
  "purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
456
456
  "purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
@@ -484,7 +484,7 @@ const ar = (t) => /* @__PURE__ */ p(
484
484
  }
485
485
  );
486
486
  ar.displayName = "IconClose";
487
- const it = rt.bind(tt), K = "purpur-icon", ut = "md", at = (t) => t.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), ot = ({ content: t = "", title: u } = {}) => {
487
+ const it = rt.bind(tt), J = "purpur-icon", ut = "md", at = (t) => t.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), ot = ({ content: t = "", title: u } = {}) => {
488
488
  const n = [
489
489
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
490
490
  { name: "fill", value: "currentColor" },
@@ -503,7 +503,7 @@ const it = rt.bind(tt), K = "purpur-icon", ut = "md", at = (t) => t.filter((u) =
503
503
  const e = ot({
504
504
  content: pt(u.svg),
505
505
  title: n
506
- }), i = it(a, K, `${K}--${o}`);
506
+ }), i = it(a, J, `${J}--${o}`);
507
507
  return /* @__PURE__ */ p(
508
508
  "span",
509
509
  {
@@ -547,23 +547,23 @@ const pr = /* @__PURE__ */ b((t, u) => {
547
547
  const { children: n, ...a } = t, o = N.toArray(n), r = o.find(dt);
548
548
  if (r) {
549
549
  const e = r.props.children, i = o.map((f) => f === r ? N.count(e) > 1 ? N.only(null) : /* @__PURE__ */ z(e) ? e.props.children : null : f);
550
- return /* @__PURE__ */ M(k, A({}, a, {
550
+ return /* @__PURE__ */ M(E, A({}, a, {
551
551
  ref: u
552
- }), /* @__PURE__ */ z(e) ? /* @__PURE__ */ Y(e, void 0, i) : null);
552
+ }), /* @__PURE__ */ z(e) ? /* @__PURE__ */ W(e, void 0, i) : null);
553
553
  }
554
- return /* @__PURE__ */ M(k, A({}, a, {
554
+ return /* @__PURE__ */ M(E, A({}, a, {
555
555
  ref: u
556
556
  }), n);
557
557
  });
558
558
  pr.displayName = "Slot";
559
- const k = /* @__PURE__ */ b((t, u) => {
559
+ const E = /* @__PURE__ */ b((t, u) => {
560
560
  const { children: n, ...a } = t;
561
- return /* @__PURE__ */ z(n) ? /* @__PURE__ */ Y(n, {
561
+ return /* @__PURE__ */ z(n) ? /* @__PURE__ */ W(n, {
562
562
  ..._t(a, n.props),
563
563
  ref: u ? st(u, n.ref) : n.ref
564
564
  }) : N.count(n) > 1 ? N.only(null) : null;
565
565
  });
566
- k.displayName = "SlotClone";
566
+ E.displayName = "SlotClone";
567
567
  const ct = ({ children: t }) => /* @__PURE__ */ M(mr, null, t);
568
568
  function dt(t) {
569
569
  return /* @__PURE__ */ z(t) && t.type === ct;
@@ -670,7 +670,7 @@ const yt = /* @__PURE__ */ gt(bt), F = {
670
670
  "purpur-label": "_purpur-label_12cfi_1",
671
671
  "purpur-label--negative": "_purpur-label--negative_12cfi_9",
672
672
  "purpur-label--disabled": "_purpur-label--disabled_12cfi_12"
673
- }, L = "purpur-label", ht = ({
673
+ }, I = "purpur-label", ht = ({
674
674
  children: t,
675
675
  className: u,
676
676
  htmlFor: n,
@@ -681,10 +681,10 @@ const yt = /* @__PURE__ */ gt(bt), F = {
681
681
  }) => {
682
682
  const i = yt([
683
683
  u,
684
- F[L],
684
+ F[I],
685
685
  {
686
- [F[`${L}--disabled`]]: o,
687
- [F[`${L}--negative`]]: r
686
+ [F[`${I}--disabled`]]: o,
687
+ [F[`${I}--negative`]]: r
688
688
  }
689
689
  ]);
690
690
  return /* @__PURE__ */ p(mt, { className: i, "data-testid": a, htmlFor: n, ...e, children: t });
@@ -813,7 +813,7 @@ var cr = { exports: {} };
813
813
  })();
814
814
  })(cr);
815
815
  var Mt = cr.exports;
816
- const At = /* @__PURE__ */ zt(Mt), qt = {
816
+ const At = /* @__PURE__ */ zt(Mt), Ct = {
817
817
  "purpur-text-field": "_purpur-text-field_nj9f4_1",
818
818
  "purpur-text-field__label": "_purpur-text-field__label_nj9f4_7",
819
819
  "purpur-text-field__label-text": "_purpur-text-field__label-text_nj9f4_13",
@@ -830,7 +830,7 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
830
830
  "purpur-text-field__input--error": "_purpur-text-field__input--error_nj9f4_94",
831
831
  "purpur-text-field__adornment-container": "_purpur-text-field__adornment-container_nj9f4_106",
832
832
  "purpur-text-field__valid-icon": "_purpur-text-field__valid-icon_nj9f4_111"
833
- }, Ct = (t) => gr(t), _ = At.bind(qt), s = "purpur-text-field", Bt = ({
833
+ }, qt = (t) => gr(t), _ = At.bind(Ct), s = "purpur-text-field", Lt = ({
834
834
  ["data-testid"]: t,
835
835
  className: u,
836
836
  clearButtonAllyLabel: n,
@@ -842,15 +842,15 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
842
842
  loading: f = !1,
843
843
  onClear: v,
844
844
  startAdornment: y,
845
- valid: q = !1,
845
+ valid: C = !1,
846
846
  ...l
847
847
  }, m) => {
848
- var X;
849
- const C = br(), h = l.id ?? C, c = (d) => t ? `${t}-${d}` : void 0, $ = q && !r, B = e ? `${h}-helper-text` : void 0, I = [y].filter((d) => !!d), E = (typeof l.value == "number" ? l.value !== void 0 : (X = l.value) == null ? void 0 : X.length) && !l.disabled && !l.readOnly && !f && v && n, Z = Ct(null), _r = (d) => {
850
- Z.current = d, typeof m == "function" ? m(d) : m && (m.current = d);
848
+ var Z;
849
+ const q = br(), h = l.id ?? q, c = (d) => t ? `${t}-${d}` : void 0, $ = C && !r, L = e ? `${h}-helper-text` : void 0, B = [y].filter((d) => !!d), k = (typeof l.value == "number" ? l.value !== void 0 : (Z = l.value) == null ? void 0 : Z.length) && !l.disabled && !l.readOnly && !f && v && n, X = qt(null), _r = (d) => {
850
+ X.current = d, typeof m == "function" ? m(d) : m && (m.current = d);
851
851
  }, fr = () => {
852
852
  var d;
853
- v == null || v(), (d = Z.current) == null || d.focus();
853
+ v == null || v(), (d = X.current) == null || d.focus();
854
854
  }, D = [
855
855
  f && /* @__PURE__ */ p(
856
856
  Nt,
@@ -861,7 +861,7 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
861
861
  },
862
862
  "spinner"
863
863
  ),
864
- E && /* @__PURE__ */ p(
864
+ k && /* @__PURE__ */ p(
865
865
  rr,
866
866
  {
867
867
  variant: "tertiary-purple",
@@ -885,10 +885,10 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
885
885
  ].filter((d) => !!d), vr = _([
886
886
  `${s}__input-container`,
887
887
  {
888
- [`${s}__input-container--start-adornment`]: I.length,
888
+ [`${s}__input-container--start-adornment`]: B.length,
889
889
  [`${s}__input-container--end-adornment`]: D.length || o,
890
890
  [`${s}__input-container--disabled`]: l.disabled,
891
- [`${s}__input-container--has-clear-button`]: E,
891
+ [`${s}__input-container--has-clear-button`]: k,
892
892
  [`${s}__input-container--readonly`]: l.readOnly && !l.disabled
893
893
  }
894
894
  ]);
@@ -905,12 +905,12 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
905
905
  ),
906
906
  /* @__PURE__ */ g("div", { className: _(`${s}__field-row`), children: [
907
907
  /* @__PURE__ */ g("div", { className: vr, children: [
908
- !!I.length && /* @__PURE__ */ p(
908
+ !!B.length && /* @__PURE__ */ p(
909
909
  "div",
910
910
  {
911
911
  "data-testid": c("start-adornments"),
912
912
  className: _(`${s}__adornment-container`),
913
- children: I
913
+ children: B
914
914
  }
915
915
  ),
916
916
  /* @__PURE__ */ p(
@@ -920,7 +920,7 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
920
920
  id: h,
921
921
  ref: _r,
922
922
  "data-testid": c("input"),
923
- "aria-describedby": l["aria-describedby"] || B,
923
+ "aria-describedby": l["aria-describedby"] || L,
924
924
  "aria-invalid": l["aria-invalid"] || !!r,
925
925
  className: _([
926
926
  `${s}__input`,
@@ -946,10 +946,10 @@ const At = /* @__PURE__ */ zt(Mt), qt = {
946
946
  ] }),
947
947
  !!a && a
948
948
  ] }),
949
- B && /* @__PURE__ */ p(Yr, { "data-testid": c("helper-text"), id: B, children: e }),
949
+ L && /* @__PURE__ */ p(Wr, { "data-testid": c("helper-text"), id: L, children: e }),
950
950
  r && /* @__PURE__ */ p(Hr, { "data-testid": c("error-text"), children: r })
951
951
  ] });
952
- }, dr = b(Bt);
952
+ }, dr = b(Lt);
953
953
  dr.displayName = "TextField";
954
954
  const Pt = (t) => z(t) && t.type.displayName === dr.displayName;
955
955
  export {