@pibit.ai/cure-design-system 0.3.40 → 0.3.45

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.
Files changed (45) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +25 -21
  4. package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
  5. package/dist/patterns/table/TableWrapper.js +543 -566
  6. package/dist/patterns/table/TableZoomControl.d.ts +12 -0
  7. package/dist/patterns/table/TableZoomControl.d.ts.map +1 -0
  8. package/dist/patterns/table/TableZoomControl.js +58 -0
  9. package/dist/patterns/table/index.d.ts +2 -0
  10. package/dist/patterns/table/index.d.ts.map +1 -1
  11. package/dist/patterns/table/tableZoomLayout.d.ts +23 -1
  12. package/dist/patterns/table/tableZoomLayout.d.ts.map +1 -1
  13. package/dist/patterns/table/tableZoomLayout.js +39 -27
  14. package/dist/patterns/table/types.d.ts +3 -0
  15. package/dist/patterns/table/types.d.ts.map +1 -1
  16. package/dist/patterns/table-component/TableComponent.d.ts +6 -0
  17. package/dist/patterns/table-component/TableComponent.d.ts.map +1 -0
  18. package/dist/patterns/table-component/TableComponent.js +809 -0
  19. package/dist/patterns/table-component/buildTableColumns.d.ts +10 -0
  20. package/dist/patterns/table-component/buildTableColumns.d.ts.map +1 -0
  21. package/dist/patterns/table-component/buildTableColumns.js +65 -0
  22. package/dist/patterns/table-component/buildTableColumns.test.d.ts +2 -0
  23. package/dist/patterns/table-component/buildTableColumns.test.d.ts.map +1 -0
  24. package/dist/patterns/table-component/index.d.ts +5 -0
  25. package/dist/patterns/table-component/index.d.ts.map +1 -0
  26. package/dist/patterns/table-component/rowMetrics.d.ts +11 -0
  27. package/dist/patterns/table-component/rowMetrics.d.ts.map +1 -0
  28. package/dist/patterns/table-component/rowMetrics.js +15 -0
  29. package/dist/patterns/table-component/tableFeatures.d.ts +12 -0
  30. package/dist/patterns/table-component/tableFeatures.d.ts.map +1 -0
  31. package/dist/patterns/table-component/tableFeatures.js +14 -0
  32. package/dist/patterns/table-component/types.d.ts +205 -0
  33. package/dist/patterns/table-component/types.d.ts.map +1 -0
  34. package/dist/patterns/table-component/useCellRangeSelection.d.ts +50 -0
  35. package/dist/patterns/table-component/useCellRangeSelection.d.ts.map +1 -0
  36. package/dist/patterns/table-component/useCellRangeSelection.js +218 -0
  37. package/dist/patterns/table-component/useRowReorderDrag.d.ts +17 -0
  38. package/dist/patterns/table-component/useRowReorderDrag.d.ts.map +1 -0
  39. package/dist/patterns/table-component/useRowReorderDrag.js +109 -0
  40. package/dist/primitives/input/input.d.ts +1 -1
  41. package/dist/primitives/input/input.d.ts.map +1 -1
  42. package/dist/primitives/input/input.js +131 -125
  43. package/dist/styles/components.css +1 -1
  44. package/dist/styles/theme.css +1 -1
  45. package/package.json +2 -1
@@ -0,0 +1,17 @@
1
+ import { PointerEvent as ReactPointerEvent } from 'react';
2
+ import { RowDragSession } from '../table/rowReorderDrag';
3
+ export type UseRowReorderDragOptions = {
4
+ enabled: boolean;
5
+ onReorderRows?: (fromSourceIndex: number, toSourceIndex: number, item: Record<string, unknown>) => void;
6
+ containerRef: {
7
+ current: HTMLElement | null;
8
+ };
9
+ /** Called when a drag starts, so row-action popovers can close. */
10
+ onDragStart?: () => void;
11
+ };
12
+ export type UseRowReorderDragResult = {
13
+ session: RowDragSession | null;
14
+ startDrag: (event: ReactPointerEvent<HTMLElement>, rowId: string, sourceRowIndex: number, item: Record<string, unknown>) => void;
15
+ };
16
+ export declare function useRowReorderDrag({ enabled, onReorderRows, containerRef, onDragStart, }: UseRowReorderDragOptions): UseRowReorderDragResult;
17
+ //# sourceMappingURL=useRowReorderDrag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRowReorderDrag.d.ts","sourceRoot":"","sources":["../../../src/patterns/table-component/useRowReorderDrag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAKL,KAAK,YAAY,IAAI,iBAAiB,EACvC,MAAM,OAAO,CAAC;AACf,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,CACd,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,IAAI,CAAC;IACV,YAAY,EAAE;QAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;KAAE,CAAC;IAC9C,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,CACT,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,EACrC,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,IAAI,CAAC;CACX,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,EAAE,wBAAwB,GAAG,uBAAuB,CAmJpD"}
@@ -0,0 +1,109 @@
1
+ import { useState as C, useRef as P, useCallback as S, useEffect as Y } from "react";
2
+ import { ROW_REORDER_ATTR as T, cloneRowForPreview as X, measureRowPreview as g, getRowDragScrollDelta as D, ROW_DRAG_THRESHOLD_PX as A, computeDropTarget as W, clipDropLineToScrollport as _ } from "../table/rowReorderDrag.js";
3
+ function b({
4
+ enabled: E,
5
+ onReorderRows: w,
6
+ containerRef: p,
7
+ onDragStart: v
8
+ }) {
9
+ const [i, h] = C(null), d = P(null), a = S((t) => {
10
+ d.current = t, h(t);
11
+ }, []), x = S(
12
+ (t, c, u, s) => {
13
+ var o, e;
14
+ if (!E || t.button !== 0) return;
15
+ const n = (o = p.current) == null ? void 0 : o.querySelector(
16
+ `tr[${T}="${CSS.escape(c)}"]`
17
+ );
18
+ if (!n) return;
19
+ t.preventDefault();
20
+ try {
21
+ t.currentTarget.setPointerCapture(t.pointerId);
22
+ } catch {
23
+ }
24
+ const r = ((e = n.closest("table")) == null ? void 0 : e.getBoundingClientRect()) ?? n.getBoundingClientRect();
25
+ a({
26
+ rowId: c,
27
+ fromSourceIndex: u,
28
+ item: s,
29
+ pointerId: t.pointerId,
30
+ startX: t.clientX,
31
+ startY: t.clientY,
32
+ currentX: t.clientX,
33
+ currentY: t.clientY,
34
+ active: !1,
35
+ preview: g(n),
36
+ toSourceIndex: u,
37
+ dropLineY: null,
38
+ dropLineLeft: r.left,
39
+ dropLineWidth: r.width,
40
+ rowClone: X(n)
41
+ });
42
+ },
43
+ [E, p, a]
44
+ );
45
+ return Y(() => {
46
+ if (!i) return;
47
+ const t = (r, o) => {
48
+ const e = d.current;
49
+ if (!e) return;
50
+ const I = Math.hypot(
51
+ r - e.startX,
52
+ o - e.startY
53
+ ), l = e.active || I >= A;
54
+ l && !e.active && (v == null || v());
55
+ let f = {
56
+ ...e,
57
+ currentX: r,
58
+ currentY: o,
59
+ active: l
60
+ };
61
+ const m = p.current;
62
+ if (l && m) {
63
+ const L = W(
64
+ m,
65
+ o,
66
+ e.fromSourceIndex,
67
+ e.rowId
68
+ );
69
+ L && (f = {
70
+ ...f,
71
+ toSourceIndex: L.toSourceIndex,
72
+ // Clipped so the line never draws over sticky chrome or outside the card.
73
+ dropLineY: _(L.dropLineY, m),
74
+ dropLineLeft: L.dropLineLeft,
75
+ dropLineWidth: L.dropLineWidth
76
+ });
77
+ }
78
+ a(f);
79
+ }, c = (r) => {
80
+ var o;
81
+ r.pointerId === ((o = d.current) == null ? void 0 : o.pointerId) && (r.preventDefault(), t(r.clientX, r.clientY));
82
+ }, u = (r) => (o) => {
83
+ const e = d.current;
84
+ if (!e || o.pointerId !== e.pointerId) return;
85
+ const { fromSourceIndex: I, toSourceIndex: l, item: f, active: m } = e;
86
+ a(null), r && m && I !== l && (w == null || w(I, l, f));
87
+ }, s = u(!0), n = u(!1);
88
+ return window.addEventListener("pointermove", c), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", n), () => {
89
+ window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", n);
90
+ };
91
+ }, [i, p, a, w, v]), Y(() => {
92
+ if (!(i != null && i.active)) return;
93
+ const t = p.current;
94
+ if (!t) return;
95
+ let c = 0;
96
+ const u = () => {
97
+ const s = d.current;
98
+ if (s) {
99
+ const n = D(t, s.currentY);
100
+ n !== 0 && (t.scrollTop += n);
101
+ }
102
+ c = requestAnimationFrame(u);
103
+ };
104
+ return c = requestAnimationFrame(u), () => cancelAnimationFrame(c);
105
+ }, [i == null ? void 0 : i.active, p]), { session: i, startDrag: x };
106
+ }
107
+ export {
108
+ b as useRowReorderDrag
109
+ };
@@ -84,7 +84,7 @@ export interface InputProps extends InputBaseProps, BaseProps {
84
84
  * <Input errorMessage="This field is required" />
85
85
  */
86
86
  export declare const Input: {
87
- ({ size, placeholder, icon: Icon, iconTrailing: IconTrailing, label, supportingText, hint, shortcut, hideRequiredIndicator, className, ref, groupRef, tooltip, iconClassName, inputClassName, wrapperClassName, tooltipClassName, inputType, customStyles, containerStyles, trailingAction, trailingIconCount, mode, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
87
+ ({ size, placeholder, icon: Icon, iconTrailing: IconTrailing, label, supportingText, hint, shortcut, hideRequiredIndicator, className, ref, groupRef, tooltip, iconClassName, inputClassName, wrapperClassName, tooltipClassName, inputType, customStyles, containerStyles, trailingAction, trailingIconCount, mode, isDisabled, isInvalid, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
88
88
  displayName: string;
89
89
  };
90
90
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/primitives/input/input.tsx"],"names":[],"mappings":"AAA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cACf,SACE,SAAS,EACT,kBAAkB,EAClB,IAAI,CACF,cAAc,EACZ,MAAM,GACN,kBAAkB,GAClB,gBAAgB,GAChB,eAAe,GACf,kBAAkB,CACrB;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAID,eAAO,MAAM,SAAS;8BAA6B,cAAc;;CAehE,CAAC;AAIF,MAAM,WAAW,UAAW,SAAQ,cAAc,EAAE,SAAS;IAC3D,+CAA+C;IAC/C,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,oDAAoD;IACpD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,kCAAkC;IAClC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,sCAAsC;IACtC,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACtC,6BAA6B;IAC7B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;4VA2Bf,UAAU;;CAmFZ,CAAC"}
@@ -1,14 +1,14 @@
1
- import { jsx as r, jsxs as S, Fragment as Y } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as R, Fragment as Y } from "react/jsx-runtime";
2
2
  import { TextField as Z, Group as A, Input as W } from "react-aria-components";
3
3
  import { cx as i, sortCx as D } from "../../utils/cn.js";
4
- import { useState as O, createContext as ee, useContext as re, useEffect as ae } from "react";
5
- import { HintText as V } from "./hint-text.js";
6
- import { EyeOff as te, Eye as ie, XClose as le, HelpCircle as se, InfoCircle as ne } from "@untitledui/icons";
4
+ import { useState as H, createContext as ee, useContext as re, useEffect as ae } from "react";
5
+ import { HintText as G } from "./hint-text.js";
6
+ import { EyeOff as te, Eye as ie, XClose as se, HelpCircle as le, InfoCircle as ne } from "@untitledui/icons";
7
7
  import { Label as oe } from "./label.js";
8
8
  import { Tooltip as de, TooltipTrigger as pe } from "../tooltip/tooltip.js";
9
9
  import { getPlatformShortcutLabel as ue } from "../../utils/keyboard-shortcut.js";
10
10
  import { Badge as ge } from "../badge/badge.js";
11
- const G = {
11
+ const X = {
12
12
  sm: "text-xs",
13
13
  md: "text-sm",
14
14
  lg: "text-md"
@@ -16,19 +16,19 @@ const G = {
16
16
  sm: "text-xs",
17
17
  md: "text-xs",
18
18
  lg: "text-sm"
19
- }, I = ({
20
- ref: d,
21
- isReadOnly: c,
22
- tooltip: h,
19
+ }, J = ({
20
+ ref: o,
21
+ isReadOnly: f,
22
+ tooltip: c,
23
23
  shortcut: N,
24
24
  groupRef: C,
25
25
  size: _ = "sm",
26
- isInvalid: y,
27
- isDisabled: o,
28
- icon: b,
29
- iconTrailing: v,
26
+ isInvalid: h,
27
+ isDisabled: u,
28
+ icon: v,
29
+ iconTrailing: x,
30
30
  placeholder: B,
31
- wrapperClassName: R,
31
+ wrapperClassName: E,
32
32
  tooltipClassName: j,
33
33
  inputClassName: k,
34
34
  iconClassName: L,
@@ -36,11 +36,11 @@ const G = {
36
36
  trailingIconCount: g,
37
37
  mode: m,
38
38
  // Omit this prop to avoid invalid HTML attribute warning
39
- isRequired: H,
40
- customStyles: E,
41
- ...F
39
+ isRequired: V,
40
+ customStyles: F,
41
+ ...P
42
42
  }) => {
43
- const z = h || y || v || T, q = b, [f, p] = O([]), [x, w] = O(""), e = re(X), l = (e == null ? void 0 : e.size) || _, s = D({
43
+ const z = c || h || x || T, q = v, [w, y] = H([]), [d, b] = H(""), e = re(M), s = (e == null ? void 0 : e.size) || _, l = D({
44
44
  sm: {
45
45
  root: i(
46
46
  "p-2 h-8",
@@ -86,55 +86,55 @@ const G = {
86
86
  tag: "rounded-md bg-primary border border-secondary p-2.5",
87
87
  wrapper: "rounded-lg"
88
88
  }
89
- }), P = () => {
89
+ }), $ = () => {
90
90
  var t;
91
- const a = x.trim();
91
+ const a = d.trim();
92
92
  a && ((t = e == null ? void 0 : e.onChange) == null || t.call(
93
93
  e,
94
94
  e != null && e.value ? (e == null ? void 0 : e.value) + "," + a : a
95
- ), p((n) => [...n, a]), w(""));
96
- }, M = (a) => {
97
- var t, n, $;
95
+ ), y((n) => [...n, a]), b(""));
96
+ }, I = (a) => {
97
+ var t, n, K;
98
98
  if (m === "tag") {
99
99
  if (a.key === "Enter" || a.key === ",") {
100
100
  a.preventDefault();
101
- const u = x.trim();
102
- u && ((t = e == null ? void 0 : e.onChange) == null || t.call(
101
+ const p = d.trim();
102
+ p && ((t = e == null ? void 0 : e.onChange) == null || t.call(
103
103
  e,
104
- e != null && e.value ? (e == null ? void 0 : e.value) + "," + u : u
105
- ), p((K) => [...K, u]), w(""));
104
+ e != null && e.value ? (e == null ? void 0 : e.value) + "," + p : p
105
+ ), y((O) => [...O, p]), b(""));
106
106
  }
107
- if (a.key === "Backspace" && !x)
107
+ if (a.key === "Backspace" && !d)
108
108
  if (e != null && e.value) {
109
- const u = e.value.split(",").map((K) => K.trim()).filter(Boolean);
110
- u.pop(), (n = e.onChange) == null || n.call(e, u.join(", "));
109
+ const p = e.value.split(",").map((O) => O.trim()).filter(Boolean);
110
+ p.pop(), (n = e.onChange) == null || n.call(e, p.join(", "));
111
111
  } else
112
- ($ = e == null ? void 0 : e.onChange) == null || $.call(e, "");
112
+ (K = e == null ? void 0 : e.onChange) == null || K.call(e, "");
113
113
  }
114
- }, Q = (a) => {
114
+ }, S = (a) => {
115
115
  const t = a.target.value;
116
- m === "tag" && w(t);
116
+ m === "tag" && b(t);
117
117
  }, U = (a) => {
118
118
  var n;
119
- const t = f.filter(($, u) => u !== a);
120
- p(t), (n = e == null ? void 0 : e.onChange) == null || n.call(e, t.join(", "));
119
+ const t = w.filter((K, p) => p !== a);
120
+ y(t), (n = e == null ? void 0 : e.onChange) == null || n.call(e, t.join(", "));
121
121
  };
122
122
  return ae(() => {
123
123
  if (m === "tag")
124
124
  if (e != null && e.value) {
125
125
  const a = e.value.split(",").map((t) => t.trim()).filter(Boolean);
126
- p(a);
126
+ y(a);
127
127
  } else
128
- p([]);
129
- }, [e == null ? void 0 : e.value]), /* @__PURE__ */ S(
128
+ y([]);
129
+ }, [e == null ? void 0 : e.value]), /* @__PURE__ */ R(
130
130
  A,
131
131
  {
132
- isDisabled: o,
133
- isInvalid: y,
132
+ isDisabled: u,
133
+ isInvalid: h,
134
134
  ref: C,
135
135
  className: ({ isFocusWithin: a, isDisabled: t, isInvalid: n }) => i(
136
136
  "relative flex w-full flex-row place-content-center place-items-center bg-primary border border-secondary duration-100 ease-linear",
137
- a && !t && !c && "ring-1 ring-brand",
137
+ a && !t && !f && "ring-1 ring-brand",
138
138
  // Disabled state styles
139
139
  t && "cursor-not-allowed bg-disabled_subtle ring-disabled",
140
140
  "group-disabled:cursor-not-allowed group-disabled:bg-disabled_subtle group-disabled:ring-disabled",
@@ -145,36 +145,36 @@ const G = {
145
145
  n && a && "ring-2 ring-error",
146
146
  a && "group-invalid:ring-2 group-invalid:ring-error",
147
147
  e == null ? void 0 : e.wrapperClassName,
148
- R,
149
- s[l].wrapper
148
+ E,
149
+ l[s].wrapper
150
150
  ),
151
151
  children: [
152
- b && /* @__PURE__ */ r(
153
- b,
152
+ v && /* @__PURE__ */ r(
153
+ v,
154
154
  {
155
155
  className: i(
156
156
  "pointer-events-none absolute size-5 text-fg-quaternary",
157
- o && "text-fg-disabled",
158
- s[l].iconLeading,
157
+ u && "text-fg-disabled",
158
+ l[s].iconLeading,
159
159
  e == null ? void 0 : e.iconClassName,
160
160
  L
161
161
  )
162
162
  }
163
163
  ),
164
- m === "tag" && /* @__PURE__ */ S(
164
+ m === "tag" && /* @__PURE__ */ R(
165
165
  "div",
166
166
  {
167
167
  className: i(
168
168
  "flex flex-wrap w-full items-center justify-start gap-1 pl-1.5",
169
- o && "text-fg-disabled"
169
+ u && "text-fg-disabled"
170
170
  ),
171
171
  children: [
172
- f.map((a, t) => (
172
+ w.map((a, t) => (
173
173
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events
174
- /* @__PURE__ */ r("div", { onClick: (n) => n.stopPropagation(), children: /* @__PURE__ */ S(ge, { className: "rounded-md bg-primary border border-secondary px-2 py-1 pointer-events-auto!", children: [
174
+ /* @__PURE__ */ r("div", { onClick: (n) => n.stopPropagation(), children: /* @__PURE__ */ R(ge, { className: "rounded-md bg-primary border border-secondary px-2 py-1 pointer-events-auto!", children: [
175
175
  a,
176
176
  /* @__PURE__ */ r(
177
- le,
177
+ se,
178
178
  {
179
179
  className: "size-4 cursor-pointer text-fg-quaternary hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
180
180
  onClick: () => U(t)
@@ -186,17 +186,17 @@ const G = {
186
186
  "input",
187
187
  {
188
188
  type: "text",
189
- value: x,
190
- onChange: Q,
191
- onKeyDown: M,
192
- placeholder: f.length === 0 ? B : "",
193
- disabled: o,
194
- onBlur: P,
189
+ value: d,
190
+ onChange: S,
191
+ onKeyDown: I,
192
+ placeholder: w.length === 0 ? B : "",
193
+ disabled: u,
194
+ onBlur: $,
195
195
  className: i(
196
196
  "bg-transparent outline-none flex-1 min-w-[50px] w-full text-primary placeholder:text-placeholder_subtle",
197
- o && "cursor-not-allowed text-disabled",
198
- s[l].root,
199
- G[l],
197
+ "disabled:cursor-not-allowed disabled:text-disabled group-disabled:pointer-events-none",
198
+ l[s].root,
199
+ X[s],
200
200
  k
201
201
  )
202
202
  }
@@ -207,49 +207,49 @@ const G = {
207
207
  m !== "tag" && /* @__PURE__ */ r(
208
208
  W,
209
209
  {
210
- ...F,
211
- ref: d,
210
+ ...P,
211
+ ref: o,
212
212
  placeholder: B,
213
213
  className: i(
214
214
  "m-0 w-full bg-transparent text-primary ring-0 outline-hidden placeholder:text-placeholder_subtle autofill:rounded-lg autofill:text-primary",
215
- o && "cursor-not-allowed text-disabled",
216
- s[l].root,
217
- G[l],
215
+ "disabled:cursor-not-allowed disabled:text-disabled group-disabled:pointer-events-none",
216
+ l[s].root,
217
+ X[s],
218
218
  e == null ? void 0 : e.inputClassName,
219
219
  k
220
220
  ),
221
- style: { ...E }
221
+ style: { ...F }
222
222
  }
223
223
  ),
224
- T && !v && /* @__PURE__ */ r(
224
+ T && !x && /* @__PURE__ */ r(
225
225
  "div",
226
226
  {
227
227
  className: i(
228
228
  "absolute flex items-center justify-center",
229
- s[l].iconTrailing,
230
- s[l].trailingIconCount
229
+ l[s].iconTrailing,
230
+ l[s].trailingIconCount
231
231
  ),
232
232
  children: T
233
233
  }
234
234
  ),
235
- h && !y && /* @__PURE__ */ r(de, { title: h, placement: "top", children: /* @__PURE__ */ r(
235
+ c && !h && /* @__PURE__ */ r(de, { title: c, placement: "top", children: /* @__PURE__ */ r(
236
236
  pe,
237
237
  {
238
238
  className: i(
239
239
  "absolute cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
240
- s[l].iconTrailing,
240
+ l[s].iconTrailing,
241
241
  e == null ? void 0 : e.tooltipClassName,
242
242
  j
243
243
  ),
244
- children: /* @__PURE__ */ r(se, { className: "size-4" })
244
+ children: /* @__PURE__ */ r(le, { className: "size-4" })
245
245
  }
246
246
  ) }),
247
- y && /* @__PURE__ */ r(
247
+ h && /* @__PURE__ */ r(
248
248
  ne,
249
249
  {
250
250
  className: i(
251
251
  "pointer-events-none absolute size-4 text-fg-error-secondary",
252
- s[l].iconTrailing,
252
+ l[s].iconTrailing,
253
253
  e == null ? void 0 : e.tooltipClassName,
254
254
  j
255
255
  )
@@ -260,14 +260,14 @@ const G = {
260
260
  {
261
261
  className: i(
262
262
  "pointer-events-none absolute inset-y-0.5 right-0.5 z-10 flex items-center rounded-r-[inherit] bg-linear-to-r from-transparent pl-8",
263
- s[l].shortcut
263
+ l[s].shortcut
264
264
  ),
265
265
  children: /* @__PURE__ */ r(
266
266
  "span",
267
267
  {
268
268
  className: i(
269
269
  "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
270
- o && "bg-transparent text-disabled"
270
+ u && "bg-transparent text-disabled"
271
271
  ),
272
272
  "aria-hidden": "true",
273
273
  children: typeof N == "string" ? N : ue(["meta"], "K")
@@ -275,13 +275,13 @@ const G = {
275
275
  )
276
276
  }
277
277
  ),
278
- v && /* @__PURE__ */ r(
279
- v,
278
+ x && /* @__PURE__ */ r(
279
+ x,
280
280
  {
281
281
  className: i(
282
282
  "pointer-events-none absolute size-5 text-fg-quaternary",
283
- o && "text-fg-disabled",
284
- s[l].iconTrailing,
283
+ u && "text-fg-disabled",
284
+ l[s].iconTrailing,
285
285
  e == null ? void 0 : e.iconClassName,
286
286
  L
287
287
  )
@@ -291,95 +291,101 @@ const G = {
291
291
  }
292
292
  );
293
293
  };
294
- I.displayName = "InputBase";
295
- const X = ee({}), J = ({ className: d, ...c }) => /* @__PURE__ */ r(X.Provider, { value: c, children: /* @__PURE__ */ r(
294
+ J.displayName = "InputBase";
295
+ const M = ee({}), Q = ({ className: o, ...f }) => /* @__PURE__ */ r(M.Provider, { value: f, children: /* @__PURE__ */ r(
296
296
  Z,
297
297
  {
298
- ...c,
298
+ ...f,
299
299
  "data-input-wrapper": !0,
300
- className: (h) => i(
300
+ className: (c) => i(
301
301
  "group flex h-max w-full flex-col items-start justify-start gap-1.5",
302
- typeof d == "function" ? d(h) : d
302
+ typeof o == "function" ? o(c) : o
303
303
  )
304
304
  }
305
305
  ) });
306
- J.displayName = "TextField";
306
+ Q.displayName = "TextField";
307
307
  const fe = ({
308
- size: d = "sm",
309
- placeholder: c,
310
- icon: h,
308
+ size: o = "sm",
309
+ placeholder: f,
310
+ icon: c,
311
311
  iconTrailing: N,
312
312
  label: C,
313
313
  supportingText: _,
314
- hint: y,
315
- shortcut: o,
316
- hideRequiredIndicator: b,
317
- className: v,
314
+ hint: h,
315
+ shortcut: u,
316
+ hideRequiredIndicator: v,
317
+ className: x,
318
318
  ref: B,
319
- groupRef: R,
319
+ groupRef: E,
320
320
  tooltip: j,
321
321
  iconClassName: k,
322
322
  inputClassName: L,
323
323
  wrapperClassName: T,
324
324
  tooltipClassName: g,
325
325
  inputType: m = "text",
326
- customStyles: H = {},
327
- containerStyles: E = {},
328
- trailingAction: F,
326
+ customStyles: V = {},
327
+ containerStyles: F = {},
328
+ trailingAction: P,
329
329
  trailingIconCount: z,
330
330
  mode: q,
331
- ...f
331
+ isDisabled: w,
332
+ isInvalid: y,
333
+ ...d
332
334
  }) => {
333
- const [p, x] = O(!1), w = m === "password", e = w ? p ? "text" : "password" : m, l = f == null ? void 0 : f.isReadOnly;
335
+ const [b, e] = H(!1), s = m === "password", l = s ? b ? "text" : "password" : m, $ = d == null ? void 0 : d.isReadOnly;
334
336
  return /* @__PURE__ */ r(
335
- J,
337
+ Q,
336
338
  {
337
- style: E,
338
- "aria-label": C ? void 0 : c,
339
- ...f,
340
- className: v,
341
- children: ({ isRequired: s, isInvalid: P }) => /* @__PURE__ */ S(Y, { children: [
339
+ style: F,
340
+ "aria-label": C ? void 0 : f,
341
+ ...d,
342
+ isDisabled: w,
343
+ isInvalid: y,
344
+ className: x,
345
+ children: ({ isRequired: I, isInvalid: S }) => /* @__PURE__ */ R(Y, { children: [
342
346
  C && /* @__PURE__ */ r(
343
347
  oe,
344
348
  {
345
- className: i("color-text-label", me[d]),
346
- isRequired: b ? !b : s,
349
+ className: i("color-text-label", me[o]),
350
+ isRequired: v ? !v : I,
347
351
  children: C
348
352
  }
349
353
  ),
350
- _ && /* @__PURE__ */ r(V, { className: "mt-[-5px] text-tertiary!", isInvalid: !1, children: _ }),
354
+ _ && /* @__PURE__ */ r(G, { className: "mt-[-5px] text-tertiary!", isInvalid: !1, children: _ }),
351
355
  /* @__PURE__ */ r(
352
- I,
356
+ J,
353
357
  {
354
358
  ref: B,
355
- groupRef: R,
356
- size: d,
357
- placeholder: c,
358
- isReadOnly: l,
359
- icon: h,
359
+ groupRef: E,
360
+ size: o,
361
+ placeholder: f,
362
+ isReadOnly: $,
363
+ isDisabled: w,
364
+ isInvalid: S,
365
+ icon: c,
360
366
  iconTrailing: N,
361
- shortcut: o,
367
+ shortcut: u,
362
368
  iconClassName: k,
363
369
  inputClassName: L,
364
370
  wrapperClassName: T,
365
371
  tooltipClassName: g,
366
372
  tooltip: j,
367
- type: e,
368
- customStyles: H,
373
+ type: l,
374
+ customStyles: V,
369
375
  mode: q,
370
- trailingAction: w ? /* @__PURE__ */ r(
376
+ trailingAction: s ? /* @__PURE__ */ r(
371
377
  "button",
372
378
  {
373
379
  type: "button",
374
- onClick: () => x(!p),
380
+ onClick: () => e(!b),
375
381
  className: "text-fg-quaternary hover:text-fg-quaternary_hover focus:outline-none",
376
- children: p ? /* @__PURE__ */ r(te, { className: "size-5" }) : /* @__PURE__ */ r(ie, { className: "size-5" })
382
+ children: b ? /* @__PURE__ */ r(te, { className: "size-5" }) : /* @__PURE__ */ r(ie, { className: "size-5" })
377
383
  }
378
- ) : F,
384
+ ) : P,
379
385
  trailingIconCount: z
380
386
  }
381
387
  ),
382
- y && /* @__PURE__ */ r(V, { size: d, isInvalid: P, children: y })
388
+ h && /* @__PURE__ */ r(G, { size: o, isInvalid: S, children: h })
383
389
  ] })
384
390
  }
385
391
  );
@@ -387,6 +393,6 @@ const fe = ({
387
393
  fe.displayName = "Input";
388
394
  export {
389
395
  fe as Input,
390
- I as InputBase,
391
- J as TextField
396
+ J as InputBase,
397
+ Q as TextField
392
398
  };