@nxgt/material 3.95.0 → 3.95.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,7 +1,7 @@
1
1
  import { t as e } from "./utils-BLfntITJ.js";
2
2
  import { a as t, i as n, n as r } from "./field-blur-context-BLGgf_3z.js";
3
3
  import { t as i } from "./use-material-translation-BW5HZMwt.js";
4
- import { a, r as o } from "./currency-field-DzLtJtDI.js";
4
+ import { a, r as o } from "./currency-field-DipsI0Bv.js";
5
5
  import { useId as s } from "react";
6
6
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  import { LockIcon as u } from "lucide-react";
@@ -2,20 +2,21 @@ import { t as e } from "./utils-BLfntITJ.js";
2
2
  import { a as t, i as n, n as r } from "./field-blur-context-BLGgf_3z.js";
3
3
  import { t as i } from "./dist-DkQbkF9T.js";
4
4
  import { t as a } from "./icon-button-BG438okX.js";
5
- import { a as o, o as s, t as c } from "./input-CC2joTjB.js";
6
- import { isValidElement as l, useEffect as u, useId as d, useRef as f, useState as p } from "react";
7
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
- import { describedBy as g } from "@nxgt/material-core/described-by";
5
+ import { t as o } from "./compose-refs-G4J4kaUA.js";
6
+ import { a as s, o as c, t as l } from "./input-CC2joTjB.js";
7
+ import { isValidElement as u, useEffect as d, useId as f, useMemo as p, useRef as m, useState as h } from "react";
8
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
9
+ import { describedBy as v } from "@nxgt/material-core/described-by";
9
10
  //#region lib/components/ui/primitives/input-group/input-group.tsx
10
- function _({ className: t, ...n }) {
11
- return /* @__PURE__ */ m("div", {
11
+ function y({ className: t, ...n }) {
12
+ return /* @__PURE__ */ g("div", {
12
13
  "data-slot": "input-group",
13
14
  role: "group",
14
- className: e(s, "group/input-group relative flex w-full items-center outline-none", "h-11 max-h-full min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:ps-2", "has-[>[data-align=inline-end]]:[&>input]:pe-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", t),
15
+ className: e(c, "group/input-group relative flex w-full items-center outline-none", "h-11 max-h-full min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:ps-2", "has-[>[data-align=inline-end]]:[&>input]:pe-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", t),
15
16
  ...n
16
17
  });
17
18
  }
18
- var v = i("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none [&>kbd]:rounded-field-inner [&>svg:not([class*='size-'])]:size-4", {
19
+ var b = i("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none [&>kbd]:rounded-field-inner [&>svg:not([class*='size-'])]:size-4", {
19
20
  variants: { align: {
20
21
  "inline-start": "order-first ps-3 has-[>button]:ps-[0.3rem] has-[>kbd]:ps-[0.4rem]",
21
22
  "inline-end": "order-last pe-3 has-[>button]:pe-[0.3rem] has-[>kbd]:pe-[0.4rem]",
@@ -24,125 +25,139 @@ var v = i("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text
24
25
  } },
25
26
  defaultVariants: { align: "inline-start" }
26
27
  });
27
- function y({ className: t, align: n = "inline-start", ...r }) {
28
- return /* @__PURE__ */ m("div", {
28
+ function x({ className: t, align: n = "inline-start", ...r }) {
29
+ return /* @__PURE__ */ g("div", {
29
30
  role: "group",
30
31
  "data-slot": "input-group-addon",
31
32
  "data-align": n,
32
- className: e(v({ align: n }), t),
33
+ className: e(b({ align: n }), t),
33
34
  onClick: (e) => {
34
35
  e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
35
36
  },
36
37
  ...r
37
38
  });
38
39
  }
39
- function b({ className: t, type: n = "button", variant: r = "ghost", ...i }) {
40
- return /* @__PURE__ */ m(a, {
40
+ function S({ className: t, type: n = "button", variant: r = "ghost", ...i }) {
41
+ return /* @__PURE__ */ g(a, {
41
42
  type: n,
42
43
  variant: r,
43
44
  className: e("size-8", t),
44
45
  ...i
45
46
  });
46
47
  }
47
- function x({ className: t, ...n }) {
48
- return /* @__PURE__ */ m("span", {
48
+ function C({ className: t, ...n }) {
49
+ return /* @__PURE__ */ g("span", {
49
50
  className: e("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", t),
50
51
  ...n
51
52
  });
52
53
  }
53
- function S({ className: t, type: n = "text", ...r }) {
54
- return /* @__PURE__ */ m("input", {
54
+ function w({ className: t, type: n = "text", ...r }) {
55
+ return /* @__PURE__ */ g("input", {
55
56
  type: n,
56
57
  "data-slot": "input-group-control",
57
58
  "data-pw": r.name ?? "input",
58
59
  className: e("h-full w-full min-w-0 flex-1 bg-transparent px-2 py-1 text-base outline-none md:text-sm", "pointer-coarse:-my-px pointer-coarse:h-[calc(100%+2px)]", "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground disabled:pointer-events-none", t),
59
60
  ...r,
60
- placeholder: o(r.placeholder, n)
61
+ placeholder: s(r.placeholder, n)
61
62
  });
62
63
  }
63
- function C({ className: t, ...n }) {
64
- return /* @__PURE__ */ m("textarea", {
64
+ function T({ className: t, ...n }) {
65
+ return /* @__PURE__ */ g("textarea", {
65
66
  "data-slot": "input-group-control",
66
67
  "data-pw": n.name ?? "textarea",
67
68
  className: e("field-sizing-content min-h-16 w-full min-w-[min(280px,100%)] flex-1 resize-none bg-transparent px-3 py-3 text-base outline-none md:text-sm", "placeholder:text-muted-foreground disabled:pointer-events-none", t),
68
69
  ...n,
69
- placeholder: o(n.placeholder, "text")
70
+ placeholder: s(n.placeholder, "text")
70
71
  });
71
72
  }
72
73
  //#endregion
73
74
  //#region lib/components/ui/fields/text-field/text-field-units.tsx
74
- function w(e, t, n) {
75
+ function E(e, t, n) {
75
76
  return e === "password" && t ? "•".repeat(t.length) : t || n || " ";
76
77
  }
77
- function T({ leading: t, trailing: n, ...r }) {
78
- let i = r.value !== void 0, [a, o] = p(null), s = f(null);
79
- u(() => {
80
- let e = s.current?.form;
81
- if (!e || i) return;
82
- let t = () => o(null);
83
- return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
84
- }, [i]);
85
- let c = i ? String(r.value ?? "") : a ?? String(r.defaultValue ?? ""), d = w(r.type, c, r.placeholder), g = !!n, v = (t, n) => n ? /* @__PURE__ */ m(y, {
78
+ var D = "button, a, input, select, textarea, label, [role=button], [role=menuitem]";
79
+ function O(e, t) {
80
+ e.defaultPrevented || e.target.closest(D) || t?.focus();
81
+ }
82
+ function k({ align: t, node: n }) {
83
+ return n ? /* @__PURE__ */ g(x, {
86
84
  align: t,
87
85
  "data-slot": t === "inline-start" ? "text-field-leading" : "text-field-trailing",
88
- className: e("flex-none py-1 text-base md:text-sm font-normal whitespace-nowrap tabular-nums", l(n) && "[&>*]:size-8 pointer-coarse:[&>*]:size-11"),
86
+ className: e("flex-none py-1 text-base md:text-sm font-normal whitespace-nowrap tabular-nums", u(n) && "[&>*]:size-8 pointer-coarse:[&>*]:size-11"),
89
87
  children: n
90
88
  }) : null;
91
- return /* @__PURE__ */ h(_, {
89
+ }
90
+ function A({ leading: t, trailing: n, ref: r, ...i }) {
91
+ let a = i.value !== void 0, [s, c] = h(null), l = m(null), u = p(() => o(l, r), [r]);
92
+ d(() => {
93
+ let e = l.current?.form;
94
+ if (!e || a) return;
95
+ let t = () => c(null);
96
+ return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
97
+ }, [a]);
98
+ let f = a ? String(i.value ?? "") : s ?? String(i.defaultValue ?? ""), v = E(i.type, f, i.placeholder);
99
+ return /* @__PURE__ */ _(y, {
92
100
  className: "gap-1",
101
+ onClick: (e) => O(e, l.current),
93
102
  children: [
94
- v("inline-start", t),
95
- /* @__PURE__ */ m("span", {
103
+ /* @__PURE__ */ g(k, {
104
+ align: "inline-start",
105
+ node: t
106
+ }),
107
+ /* @__PURE__ */ g("span", {
96
108
  "data-slot": "text-field-value",
97
- "data-value": d,
98
- className: e("inline-grid h-full max-w-full min-w-4 items-center text-base md:text-sm", "after:invisible after:col-start-1 after:row-start-1 after:whitespace-pre after:content-[attr(data-value)]", g ? "flex-none shrink" : "flex-1", !t && "ps-3", !n && "pe-3"),
99
- children: /* @__PURE__ */ m(S, {
100
- ...r,
101
- ref: s,
109
+ "data-value": v,
110
+ className: e("inline-grid h-full max-w-full min-w-4 items-center text-base md:text-sm", "after:invisible after:col-start-1 after:row-start-1 after:whitespace-pre after:content-[attr(data-value)]", n ? "flex-none shrink" : "flex-1", t ? "pointer-coarse:min-w-11" : "ps-3 pointer-coarse:min-w-14", !n && "pe-3"),
111
+ children: /* @__PURE__ */ g(w, {
112
+ ...i,
113
+ ref: u,
102
114
  className: "col-start-1 row-start-1 w-0 min-w-full px-0 md:pb-1.5 [font:inherit] [font-variant-numeric:inherit] [letter-spacing:inherit]",
103
115
  onChange: (e) => {
104
- i || o(e.target.value), r.onChange?.(e);
116
+ a || c(e.target.value), i.onChange?.(e);
105
117
  }
106
118
  })
107
119
  }),
108
- v("inline-end", n)
120
+ /* @__PURE__ */ g(k, {
121
+ align: "inline-end",
122
+ node: n
123
+ })
109
124
  ]
110
125
  });
111
126
  }
112
127
  //#endregion
113
128
  //#region lib/components/ui/fields/text-field/text-field.tsx
114
- function E({ error: i, helperText: a, label: o, className: s, leading: u, trailing: f, ...p }) {
115
- let _ = r(), v = d(), y = d(), b = g(p["aria-describedby"], !!a && y), x = !!u && !l(u), S = !!f && !l(f), C = {
129
+ function j({ error: i, helperText: a, label: o, className: s, leading: c, trailing: d, ...p }) {
130
+ let m = r(), h = f(), y = f(), b = v(p["aria-describedby"], !!a && y), x = !!c && !u(c), S = !!d && !u(d), C = {
116
131
  "aria-invalid": i,
117
132
  ...p,
118
- id: p.id ?? v,
133
+ id: p.id ?? h,
119
134
  "aria-describedby": b
120
- }, w = x || S ? /* @__PURE__ */ m(T, {
135
+ }, w = x || S ? /* @__PURE__ */ g(A, {
121
136
  ...C,
122
- leading: u,
123
- trailing: f
124
- }) : /* @__PURE__ */ h("div", {
137
+ leading: c,
138
+ trailing: d
139
+ }) : /* @__PURE__ */ _("div", {
125
140
  className: e("relative", {
126
- "*:first:size-8 *:first:absolute *:first:top-[calc(50%-16px)] *:first:left-1.5 [&_input]:pl-10 *:first:text-muted-foreground": !!u,
127
- "*:last:size-8 *:last:absolute *:last:top-[calc(50%-16px)] *:last:right-1.5 *:last:pointer-coarse:size-11 *:last:pointer-coarse:top-[calc(50%-22px)] *:last:pointer-coarse:right-0 [&_input]:pr-.5 *:last:text-muted-foreground": !!f
141
+ "*:first:size-8 *:first:absolute *:first:top-[calc(50%-16px)] *:first:left-1.5 [&_input]:pl-10 *:first:text-muted-foreground": !!c,
142
+ "*:last:size-8 *:last:absolute *:last:top-[calc(50%-16px)] *:last:right-1.5 *:last:pointer-coarse:size-11 *:last:pointer-coarse:top-[calc(50%-22px)] *:last:pointer-coarse:right-0 [&_input]:pr-.5 *:last:text-muted-foreground": !!d
128
143
  }),
129
144
  children: [
130
- u,
131
- /* @__PURE__ */ m(c, { ...C }),
132
- f
145
+ c,
146
+ /* @__PURE__ */ g(l, { ...C }),
147
+ d
133
148
  ]
134
149
  });
135
- return /* @__PURE__ */ h("div", {
136
- ref: _,
150
+ return /* @__PURE__ */ _("div", {
151
+ ref: m,
137
152
  "data-slot": "text-field",
138
153
  className: e("grid w-full content-start gap-1.5", s),
139
- children: [/* @__PURE__ */ m(n, {
154
+ children: [/* @__PURE__ */ g(n, {
140
155
  withAsterisk: p.required,
141
- htmlFor: p.id ?? v,
156
+ htmlFor: p.id ?? h,
142
157
  children: o
143
- }), /* @__PURE__ */ h("div", {
158
+ }), /* @__PURE__ */ _("div", {
144
159
  className: "flex flex-col gap-0.5",
145
- children: [w, a ? /* @__PURE__ */ m(t, {
160
+ children: [w, a ? /* @__PURE__ */ g(t, {
146
161
  id: y,
147
162
  error: i,
148
163
  children: a
@@ -151,4 +166,4 @@ function E({ error: i, helperText: a, label: o, className: s, leading: u, traili
151
166
  });
152
167
  }
153
168
  //#endregion
154
- export { S as a, b as i, _ as n, x as o, y as r, C as s, E as t };
169
+ export { w as a, S as i, y as n, C as o, x as r, T as s, j as t };
@@ -38,7 +38,7 @@ import { t as Ht } from "./browser-only-DQ94lWF8.js";
38
38
  import { t as Ut } from "./compose-refs-G4J4kaUA.js";
39
39
  import { n as Wt, r as Gt, t as Kt } from "./chip-Bb9SM3Ly.js";
40
40
  import { c as qt, o as Jt, r as Yt, s as Xt, t as Zt } from "./input-CC2joTjB.js";
41
- import { a as Qt, n as $t, r as en, t as tn } from "./text-field-DxKSPY0T.js";
41
+ import { a as Qt, n as $t, r as en, t as tn } from "./text-field-DOndWDT5.js";
42
42
  import { r as nn } from "./use-csp-nonce-ZKs9k-ov.js";
43
43
  import { t as rn } from "./empty-state-n2zb23YG.js";
44
44
  import { t as an } from "./skeleton-DSdtr2qc.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.95.0",
3
+ "version": "3.95.1",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"