@purpurds/text-field 8.3.0 → 8.4.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,6 +1,6 @@
1
- import { jsxs as b, jsx as l } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as l } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { forwardRef as or, useRef as yr, useId as br, isValidElement as xr } from "react";
3
+ import { forwardRef as or, useRef as hr, useId as yr, isValidElement as br } from "react";
4
4
  import "react-dom";
5
5
  const $r = {
6
6
  LG: "lg"
@@ -15,7 +15,7 @@ var D = { exports: {} };
15
15
  http://jedwatson.github.io/classnames
16
16
  */
17
17
  var L;
18
- function Sr() {
18
+ function jr() {
19
19
  return L || (L = 1, (function(e) {
20
20
  (function() {
21
21
  var u = {}.hasOwnProperty;
@@ -47,10 +47,10 @@ function Sr() {
47
47
  })();
48
48
  })(D)), D.exports;
49
49
  }
50
- var Nr = Sr();
51
- const Or = /* @__PURE__ */ wr(Nr), jr = "_rotate_12t9p_1", kr = "_dash_12t9p_1", Mr = {
50
+ var Sr = jr();
51
+ const Nr = /* @__PURE__ */ wr(Sr), Or = "_rotate_12t9p_1", kr = "_dash_12t9p_1", Mr = {
52
52
  "purpur-spinner": "_purpur-spinner_12t9p_2",
53
- rotate: jr,
53
+ rotate: Or,
54
54
  "purpur-spinner--xxs": "_purpur-spinner--xxs_12t9p_6",
55
55
  "purpur-spinner--xs": "_purpur-spinner--xs_12t9p_10",
56
56
  "purpur-spinner--sm": "_purpur-spinner--sm_12t9p_14",
@@ -60,7 +60,7 @@ const Or = /* @__PURE__ */ wr(Nr), jr = "_rotate_12t9p_1", kr = "_dash_12t9p_1",
60
60
  dash: kr,
61
61
  "purpur-spinner__circle--disabled": "_purpur-spinner__circle--disabled_12t9p_41",
62
62
  "purpur-spinner__circle--negative": "_purpur-spinner__circle--negative_12t9p_44"
63
- }, Z = Or.bind(Mr), $ = "purpur-spinner", Ar = {
63
+ }, Z = Nr.bind(Mr), $ = "purpur-spinner", Ar = {
64
64
  SM: "sm"
65
65
  }, Cr = ({
66
66
  disabled: e = !1,
@@ -123,28 +123,28 @@ function Rr() {
123
123
  }
124
124
  var Ir = Rr();
125
125
  const Br = /* @__PURE__ */ qr(Ir), Pr = {
126
- "purpur-button": "_purpur-button_1goi7_1",
127
- "purpur-button--xs": "_purpur-button--xs_1goi7_33",
128
- "purpur-button--icon-only": "_purpur-button--icon-only_1goi7_36",
129
- "purpur-button--sm": "_purpur-button--sm_1goi7_39",
130
- "purpur-button--md": "_purpur-button--md_1goi7_45",
131
- "purpur-button--lg": "_purpur-button--lg_1goi7_51",
132
- "purpur-button--full-width": "_purpur-button--full-width_1goi7_57",
133
- "purpur-button--primary": "_purpur-button--primary_1goi7_60",
134
- "purpur-button--disabled": "_purpur-button--disabled_1goi7_64",
135
- "purpur-button--primary-negative": "_purpur-button--primary-negative_1goi7_70",
136
- "purpur-button--secondary": "_purpur-button--secondary_1goi7_82",
137
- "purpur-button--secondary-negative": "_purpur-button--secondary-negative_1goi7_93",
138
- "purpur-button--expressive": "_purpur-button--expressive_1goi7_104",
139
- "purpur-button--expressive-negative": "_purpur-button--expressive-negative_1goi7_114",
140
- "purpur-button--negative": "_purpur-button--negative_1goi7_126",
141
- "purpur-button--destructive": "_purpur-button--destructive_1goi7_133",
142
- "purpur-button--destructive-negative": "_purpur-button--destructive-negative_1goi7_143",
143
- "purpur-button--tertiary-purple": "_purpur-button--tertiary-purple_1goi7_153",
144
- "purpur-button--tertiary-purple-negative": "_purpur-button--tertiary-purple-negative_1goi7_166",
145
- "purpur-button--text-negative": "_purpur-button--text-negative_1goi7_181",
146
- "purpur-button--text": "_purpur-button--text_1goi7_181"
147
- }, Er = Br.bind(Pr), y = "purpur-button", sr = or(
126
+ "purpur-button": "_purpur-button_cjx7j_1",
127
+ "purpur-button--xs": "_purpur-button--xs_cjx7j_22",
128
+ "purpur-button--icon-only": "_purpur-button--icon-only_cjx7j_25",
129
+ "purpur-button--sm": "_purpur-button--sm_cjx7j_28",
130
+ "purpur-button--md": "_purpur-button--md_cjx7j_34",
131
+ "purpur-button--lg": "_purpur-button--lg_cjx7j_40",
132
+ "purpur-button--full-width": "_purpur-button--full-width_cjx7j_46",
133
+ "purpur-button--primary": "_purpur-button--primary_cjx7j_64",
134
+ "purpur-button--disabled": "_purpur-button--disabled_cjx7j_68",
135
+ "purpur-button--primary-negative": "_purpur-button--primary-negative_cjx7j_74",
136
+ "purpur-button--secondary": "_purpur-button--secondary_cjx7j_86",
137
+ "purpur-button--secondary-negative": "_purpur-button--secondary-negative_cjx7j_97",
138
+ "purpur-button--expressive": "_purpur-button--expressive_cjx7j_108",
139
+ "purpur-button--expressive-negative": "_purpur-button--expressive-negative_cjx7j_118",
140
+ "purpur-button--negative": "_purpur-button--negative_cjx7j_130",
141
+ "purpur-button--destructive": "_purpur-button--destructive_cjx7j_137",
142
+ "purpur-button--destructive-negative": "_purpur-button--destructive-negative_cjx7j_147",
143
+ "purpur-button--tertiary-purple": "_purpur-button--tertiary-purple_cjx7j_157",
144
+ "purpur-button--tertiary-purple-negative": "_purpur-button--tertiary-purple-negative_cjx7j_170",
145
+ "purpur-button--text-negative": "_purpur-button--text-negative_cjx7j_185",
146
+ "purpur-button--text": "_purpur-button--text_cjx7j_185"
147
+ }, Er = Br.bind(Pr), h = "purpur-button", sr = or(
148
148
  ({
149
149
  children: e,
150
150
  className: u,
@@ -156,34 +156,34 @@ const Br = /* @__PURE__ */ qr(Ir), Pr = {
156
156
  onClick: i,
157
157
  size: f = "md",
158
158
  variant: d,
159
- type: x = "button",
159
+ type: b = "button",
160
160
  ...v
161
- }, N) => {
161
+ }, S) => {
162
162
  if (p && d === "destructive")
163
163
  return null;
164
- const O = Er(
164
+ const N = Er(
165
165
  [
166
- y,
167
- `${y}--${t ? `${d}-negative` : d}`,
168
- `${y}--${f}`
166
+ h,
167
+ `${h}--${t ? `${d}-negative` : d}`,
168
+ `${h}--${f}`
169
169
  ],
170
170
  {
171
- [`${y}--icon-only`]: p,
172
- [`${y}--negative`]: t,
173
- [`${y}--full-width`]: a,
174
- [`${y}--disabled`]: n || r
171
+ [`${h}--icon-only`]: p,
172
+ [`${h}--negative`]: t,
173
+ [`${h}--full-width`]: a,
174
+ [`${h}--disabled`]: n || r
175
175
  },
176
176
  u
177
- ), o = (S) => {
178
- n || r ? S.preventDefault() : i && i(S);
179
- }, h = !!v["aria-disabled"] || n || r;
180
- return /* @__PURE__ */ b(
177
+ ), o = (j) => {
178
+ n || r ? j.preventDefault() : i && i(j);
179
+ }, x = !!v["aria-disabled"] || n || r;
180
+ return /* @__PURE__ */ y(
181
181
  "button",
182
182
  {
183
- className: O,
184
- type: x,
185
- ref: N,
186
- "aria-disabled": h,
183
+ className: N,
184
+ type: b,
185
+ ref: S,
186
+ "aria-disabled": x,
187
187
  onClick: o,
188
188
  ...v,
189
189
  children: [
@@ -192,7 +192,7 @@ const Br = /* @__PURE__ */ qr(Ir), Pr = {
192
192
  {
193
193
  size: f === $r.LG ? "xs" : "xxs",
194
194
  negative: t,
195
- disabled: h
195
+ disabled: x
196
196
  }
197
197
  ),
198
198
  " ",
@@ -329,7 +329,7 @@ const Kr = /* @__PURE__ */ Xr(Jr), Qr = {
329
329
  negative: n = !1,
330
330
  ["aria-relevant"]: a = "additions text",
331
331
  ...p
332
- }) => /* @__PURE__ */ b(
332
+ }) => /* @__PURE__ */ y(
333
333
  "div",
334
334
  {
335
335
  className: Y(u, C, {
@@ -472,26 +472,26 @@ const ce = /* @__PURE__ */ le(se), de = {
472
472
  return /* @__PURE__ */ l("span", { className: t, dangerouslySetInnerHTML: { __html: r }, ...p });
473
473
  };
474
474
  B.displayName = "Icon";
475
- const he = {
475
+ const xe = {
476
476
  name: "check-circle-filled",
477
477
  svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z" clip-rule="evenodd"/></svg>',
478
478
  keywords: ["check-circle-filled"],
479
479
  category: "status"
480
- }, dr = (e) => /* @__PURE__ */ l(B, { ...e, svg: he });
480
+ }, dr = (e) => /* @__PURE__ */ l(B, { ...e, svg: xe });
481
481
  dr.displayName = "IconCheckCircleFilled";
482
- const ye = {
482
+ const he = {
483
483
  name: "close",
484
484
  svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z" clip-rule="evenodd"/></svg>',
485
485
  keywords: ["close"],
486
486
  category: "utility"
487
- }, _r = (e) => /* @__PURE__ */ l(B, { ...e, svg: ye });
487
+ }, _r = (e) => /* @__PURE__ */ l(B, { ...e, svg: he });
488
488
  _r.displayName = "IconClose";
489
489
  function tr(e, u) {
490
490
  if (typeof e == "function")
491
491
  return e(u);
492
492
  e != null && (e.current = u);
493
493
  }
494
- function be(...e) {
494
+ function ye(...e) {
495
495
  return (u) => {
496
496
  let n = !1;
497
497
  const a = e.map((p) => {
@@ -508,12 +508,12 @@ function be(...e) {
508
508
  };
509
509
  }
510
510
  // @__NO_SIDE_EFFECTS__
511
- function xe(e) {
511
+ function be(e) {
512
512
  const u = /* @__PURE__ */ $e(e), n = c.forwardRef((a, p) => {
513
- const { children: r, ...t } = a, i = c.Children.toArray(r), f = i.find(Se);
513
+ const { children: r, ...t } = a, i = c.Children.toArray(r), f = i.find(je);
514
514
  if (f) {
515
- const d = f.props.children, x = i.map((v) => v === f ? c.Children.count(d) > 1 ? c.Children.only(null) : c.isValidElement(d) ? d.props.children : null : v);
516
- return /* @__PURE__ */ l(u, { ...t, ref: p, children: c.isValidElement(d) ? c.cloneElement(d, void 0, x) : null });
515
+ const d = f.props.children, b = i.map((v) => v === f ? c.Children.count(d) > 1 ? c.Children.only(null) : c.isValidElement(d) ? d.props.children : null : v);
516
+ return /* @__PURE__ */ l(u, { ...t, ref: p, children: c.isValidElement(d) ? c.cloneElement(d, void 0, b) : null });
517
517
  }
518
518
  return /* @__PURE__ */ l(u, { ...t, ref: p, children: r });
519
519
  });
@@ -524,18 +524,18 @@ function $e(e) {
524
524
  const u = c.forwardRef((n, a) => {
525
525
  const { children: p, ...r } = n;
526
526
  if (c.isValidElement(p)) {
527
- const t = Oe(p), i = Ne(r, p.props);
528
- return p.type !== c.Fragment && (i.ref = a ? be(a, t) : t), c.cloneElement(p, i);
527
+ const t = Ne(p), i = Se(r, p.props);
528
+ return p.type !== c.Fragment && (i.ref = a ? ye(a, t) : t), c.cloneElement(p, i);
529
529
  }
530
530
  return c.Children.count(p) > 1 ? c.Children.only(null) : null;
531
531
  });
532
532
  return u.displayName = `${e}.SlotClone`, u;
533
533
  }
534
534
  var we = Symbol("radix.slottable");
535
- function Se(e) {
535
+ function je(e) {
536
536
  return c.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === we;
537
537
  }
538
- function Ne(e, u) {
538
+ function Se(e, u) {
539
539
  const n = { ...u };
540
540
  for (const a in u) {
541
541
  const p = e[a], r = u[a];
@@ -546,12 +546,12 @@ function Ne(e, u) {
546
546
  }
547
547
  return { ...e, ...n };
548
548
  }
549
- function Oe(e) {
549
+ function Ne(e) {
550
550
  var u, n;
551
551
  let a = (u = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : u.get, p = a && "isReactWarning" in a && a.isReactWarning;
552
552
  return p ? e.ref : (a = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, p = a && "isReactWarning" in a && a.isReactWarning, p ? e.props.ref : e.props.ref || e.ref);
553
553
  }
554
- var je = [
554
+ var Oe = [
555
555
  "a",
556
556
  "button",
557
557
  "div",
@@ -569,8 +569,8 @@ var je = [
569
569
  "span",
570
570
  "svg",
571
571
  "ul"
572
- ], ke = je.reduce((e, u) => {
573
- const n = /* @__PURE__ */ xe(`Primitive.${u}`), a = c.forwardRef((p, r) => {
572
+ ], ke = Oe.reduce((e, u) => {
573
+ const n = /* @__PURE__ */ be(`Primitive.${u}`), a = c.forwardRef((p, r) => {
574
574
  const { asChild: t, ...i } = p, f = t ? n : u;
575
575
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(f, { ...i, ref: r });
576
576
  });
@@ -782,7 +782,7 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
782
782
  "purpur-text-field__input--error": "_purpur-text-field__input--error_3gl1k_94",
783
783
  "purpur-text-field__adornment-container": "_purpur-text-field__adornment-container_3gl1k_106",
784
784
  "purpur-text-field__valid-icon": "_purpur-text-field__valid-icon_3gl1k_111"
785
- }, Ke = (e) => yr(e), m = Ye.bind(Je), s = "purpur-text-field", vr = or(
785
+ }, Ke = (e) => hr(e), m = Ye.bind(Je), s = "purpur-text-field", vr = or(
786
786
  ({
787
787
  ["data-testid"]: e,
788
788
  className: u,
@@ -794,20 +794,20 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
794
794
  helperText: i,
795
795
  hideRequiredAsterisk: f = !1,
796
796
  label: d,
797
- loading: x = !1,
797
+ loading: b = !1,
798
798
  onClear: v,
799
- startAdornment: N,
800
- valid: O = !1,
799
+ startAdornment: S,
800
+ valid: N = !1,
801
801
  ...o
802
- }, h) => {
802
+ }, x) => {
803
803
  var z;
804
- const S = br(), j = o.id ?? S, g = (_) => e ? `${e}-${_}` : void 0, P = O && !t, k = i ? `${j}-helper-text` : void 0, M = [N].filter((_) => !!_), E = (typeof o.value == "number" ? o.value !== void 0 : (z = o.value) == null ? void 0 : z.length) && !o.disabled && !o.readOnly && !x && v && n, V = Ke(null), gr = (_) => {
805
- V.current = _, typeof h == "function" ? h(_) : h && (h.current = _);
804
+ const j = yr(), O = o.id ?? j, g = (_) => e ? `${e}-${_}` : void 0, P = N && !t, k = i ? `${O}-helper-text` : void 0, M = [S].filter((_) => !!_), E = (typeof o.value == "number" ? o.value !== void 0 : (z = o.value) == null ? void 0 : z.length) && !o.disabled && !o.readOnly && !b && v && n, V = Ke(null), gr = (_) => {
805
+ V.current = _, typeof x == "function" ? x(_) : x && (x.current = _);
806
806
  }, mr = () => {
807
807
  var _;
808
808
  v == null || v(), (_ = V.current) == null || _.focus();
809
809
  }, A = [
810
- x && /* @__PURE__ */ l(
810
+ b && /* @__PURE__ */ l(
811
811
  Ge,
812
812
  {
813
813
  disabled: o.disabled,
@@ -837,18 +837,18 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
837
837
  },
838
838
  "valid-icon"
839
839
  )
840
- ].filter((_) => !!_), hr = m(`${s}__input-container`, {
840
+ ].filter((_) => !!_), xr = m(`${s}__input-container`, {
841
841
  [`${s}__input-container--start-adornment`]: M.length,
842
842
  [`${s}__input-container--end-adornment`]: A.length || r,
843
843
  [`${s}__input-container--disabled`]: o.disabled,
844
844
  [`${s}__input-container--has-clear-button`]: E,
845
845
  [`${s}__input-container--readonly`]: o.readOnly && !o.disabled
846
846
  });
847
- return /* @__PURE__ */ b("div", { className: m(u, s), children: [
848
- d && /* @__PURE__ */ b(
847
+ return /* @__PURE__ */ y("div", { className: m(u, s), children: [
848
+ d && /* @__PURE__ */ y(
849
849
  Ee,
850
850
  {
851
- htmlFor: j,
851
+ htmlFor: O,
852
852
  className: m(`${s}__label`),
853
853
  "data-testid": g("label"),
854
854
  disabled: o.disabled,
@@ -858,9 +858,9 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
858
858
  ]
859
859
  }
860
860
  ),
861
- /* @__PURE__ */ b("div", { className: m(`${s}__field-row`), children: [
861
+ /* @__PURE__ */ y("div", { className: m(`${s}__field-row`), children: [
862
862
  !!a && a,
863
- /* @__PURE__ */ b("div", { className: hr, children: [
863
+ /* @__PURE__ */ y("div", { className: xr, children: [
864
864
  !!M.length && /* @__PURE__ */ l(
865
865
  "div",
866
866
  {
@@ -873,7 +873,7 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
873
873
  "input",
874
874
  {
875
875
  ...o,
876
- id: j,
876
+ id: O,
877
877
  ref: gr,
878
878
  "data-testid": g("input"),
879
879
  "aria-describedby": o["aria-describedby"] || k,
@@ -888,7 +888,7 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
888
888
  }
889
889
  ),
890
890
  /* @__PURE__ */ l("div", { className: m(`${s}__frame`) }),
891
- (!!A.length || r) && /* @__PURE__ */ b(
891
+ (!!A.length || r) && /* @__PURE__ */ y(
892
892
  "div",
893
893
  {
894
894
  "data-testid": g("end-adornments"),
@@ -908,7 +908,7 @@ const Ye = /* @__PURE__ */ He(Xe), Je = {
908
908
  }
909
909
  );
910
910
  vr.displayName = "TextField";
911
- const nt = (e) => xr(e) && e.type.displayName === vr.displayName;
911
+ const nt = (e) => br(e) && e.type.displayName === vr.displayName;
912
912
  export {
913
913
  vr as TextField,
914
914
  nt as isTextField