@fabio.caffarello/react-design-system 4.0.0 → 4.2.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,82 +1,50 @@
1
1
  "use client";
2
- var ie = Object.defineProperty;
3
- var P = Object.getOwnPropertySymbols;
4
- var K = Object.prototype.hasOwnProperty, Q = Object.prototype.propertyIsEnumerable;
5
- var J = (r, t, e) => t in r ? ie(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, U = (r, t) => {
6
- for (var e in t || (t = {}))
7
- K.call(t, e) && J(r, e, t[e]);
8
- if (P)
9
- for (var e of P(t))
10
- Q.call(t, e) && J(r, e, t[e]);
11
- return r;
12
- };
13
- var Y = (r, t) => {
14
- var e = {};
15
- for (var s in r)
16
- K.call(r, s) && t.indexOf(s) < 0 && (e[s] = r[s]);
17
- if (r != null && P)
18
- for (var s of P(r))
19
- t.indexOf(s) < 0 && Q.call(r, s) && (e[s] = r[s]);
2
+ var K = Object.defineProperty;
3
+ var c = Object.getOwnPropertySymbols;
4
+ var S = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
5
+ var b = (e, s, t) => s in e ? K(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t, E = (e, s) => {
6
+ for (var t in s || (s = {}))
7
+ S.call(s, t) && b(e, t, s[t]);
8
+ if (c)
9
+ for (var t of c(s))
10
+ N.call(s, t) && b(e, t, s[t]);
20
11
  return e;
21
12
  };
22
- import { jsxs as F, jsx as n } from "react/jsx-runtime";
23
- import { memo as _, forwardRef as de, useId as ue, useMemo as o, useState as fe, useCallback as T } from "react";
24
- import { getTypographySize as j, getTypographyClasses as z } from "../../tokens/typography.js";
25
- import { getRadiusClass as pe } from "../../tokens/radius.js";
26
- import { getSpacingClass as l } from "../../tokens/spacing.js";
27
- import { X as me, EyeOff as be, Eye as ge } from "lucide-react";
28
- import { Button as Z } from "../Button/Button.js";
29
- import { cva as ve } from "../../utils/cva.js";
30
- import { cn as c } from "../../utils/cn.js";
31
- const he = _(function({
32
- error: t,
33
- success: e,
34
- helperText: s,
35
- errorId: i,
36
- helperId: d
37
- }) {
38
- const a = o(
39
- () => c(
40
- l("xs", "mt"),
41
- z("caption"),
42
- t && "text-fg-error",
43
- e && "text-fg-success",
44
- !t && !e && "text-fg-secondary"
45
- ),
46
- [t, e]
47
- ), v = o(
48
- () => s || (t ? "Error" : e ? "Success" : ""),
49
- [s, t, e]
50
- );
51
- return /* @__PURE__ */ n(
52
- "div",
53
- {
54
- id: i || d,
55
- className: a,
56
- role: t || e ? "alert" : void 0,
57
- children: v
58
- }
59
- );
60
- }), ye = _(
61
- de(function(xe, ee) {
62
- var O = xe, {
63
- id: t,
64
- label: e,
65
- error: s = !1,
66
- success: i = !1,
67
- helperText: d,
68
- size: a = "md",
69
- variant: v = "outlined",
70
- leftIcon: h,
71
- rightIcon: y,
72
- showClearButton: k = !1,
73
- onClear: C,
74
- className: H = "",
75
- disabled: m = !1,
13
+ var T = (e, s) => {
14
+ var t = {};
15
+ for (var a in e)
16
+ S.call(e, a) && s.indexOf(a) < 0 && (t[a] = e[a]);
17
+ if (e != null && c)
18
+ for (var a of c(e))
19
+ s.indexOf(a) < 0 && N.call(e, a) && (t[a] = e[a]);
20
+ return t;
21
+ };
22
+ import { jsxs as L, Fragment as M, jsx as o } from "react/jsx-runtime";
23
+ import { memo as Q, forwardRef as U, useId as W, useState as Y } from "react";
24
+ import { getSpacingClass as I } from "../../tokens/spacing.js";
25
+ import { X as Z, EyeOff as _, Eye as ee } from "lucide-react";
26
+ import { Button as j } from "../Button/Button.js";
27
+ import te from "./InputBase.js";
28
+ const se = Q(
29
+ U(function(ae, D) {
30
+ var y = ae, {
31
+ id: s,
32
+ label: t,
33
+ error: a = !1,
34
+ success: $ = !1,
35
+ helperText: B,
36
+ size: p = "md",
37
+ variant: C = "outlined",
38
+ leftIcon: O,
39
+ rightIcon: u,
40
+ showClearButton: R = !1,
41
+ onClear: g,
42
+ className: k = "",
43
+ disabled: v = !1,
76
44
  type: x = "text",
77
- value: b,
78
- onChange: w
79
- } = O, q = Y(O, [
45
+ value: r,
46
+ onChange: d
47
+ } = y, A = T(y, [
80
48
  "id",
81
49
  "label",
82
50
  "error",
@@ -94,258 +62,94 @@ const he = _(function({
94
62
  "value",
95
63
  "onChange"
96
64
  ]);
97
- const te = ue(), u = t || `input-${te}`, V = o(
98
- () => s ? `${u}-error` : void 0,
99
- [s, u]
100
- ), D = o(
101
- () => d ? `${u}-helper` : void 0,
102
- [d, u]
103
- ), [N, se] = fe(!1), f = o(() => x === "password", [x]), oe = o(
104
- () => f && N ? "text" : x,
105
- [f, N, x]
106
- ), I = o(
107
- () => s ? "error" : i ? "success" : "default",
108
- [s, i]
109
- ), L = o(
110
- () => b != null && b !== "",
111
- [b]
112
- ), S = o(
113
- () => k && L && !m,
114
- [k, L, m]
115
- ), M = o(() => "focus:border-line-focus", []), W = o(() => "focus:border-error", []), X = o(() => "focus:border-success", []), A = o(
116
- () => M.replace("focus:border-", "focus:ring-"),
117
- [M]
118
- ), $ = T(
119
- (p) => p === "error" ? W.replace("focus:border-", "focus:ring-") : X.replace("focus:border-", "focus:ring-"),
120
- [W, X]
121
- ), B = o(
122
- () => ve(
123
- // Base classes
124
- c(
125
- "w-full",
126
- pe("md"),
127
- "transition-colors",
128
- "focus:outline-none",
129
- "focus:ring-2",
130
- "focus:ring-offset-2",
131
- "disabled:opacity-50",
132
- "disabled:cursor-not-allowed"
133
- ),
134
- {
135
- variants: {
136
- variant: {
137
- default: c(
138
- "border-0",
139
- "border-b-2",
140
- "border-line-default",
141
- "focus:border-line-focus"
142
- ),
143
- outlined: c(
144
- "border",
145
- "border-line-default",
146
- "focus:border-line-focus"
147
- ),
148
- filled: c(
149
- "bg-surface-muted",
150
- "border-0",
151
- "focus:bg-surface-base",
152
- "focus:ring-2",
153
- A
154
- )
65
+ const q = W(), z = s || `input-${q}`, [f, F] = Y(!1), n = x === "password", H = n && f ? "text" : x, V = r != null && r !== "", m = R && V && !v, i = p === "sm" ? "h-4 w-4" : p === "lg" ? "h-5 w-5" : "h-4 w-4", X = (l) => {
66
+ var P;
67
+ if (l.stopPropagation(), g)
68
+ g();
69
+ else if (d) {
70
+ const h = (P = l.currentTarget.closest(".relative")) == null ? void 0 : P.querySelector("input");
71
+ if (h) {
72
+ const w = {
73
+ target: h,
74
+ currentTarget: h,
75
+ bubbles: !0,
76
+ cancelable: !0,
77
+ defaultPrevented: !1,
78
+ eventPhase: 2,
79
+ isTrusted: !1,
80
+ nativeEvent: new Event("change"),
81
+ preventDefault: () => {
155
82
  },
156
- size: {
157
- sm: c(
158
- "h-8",
159
- j("bodySmall"),
160
- l("md", "px")
161
- ),
162
- md: c(
163
- "h-10",
164
- j("body"),
165
- l("base", "px")
166
- ),
167
- lg: c(
168
- "h-12",
169
- j("bodyLarge"),
170
- l("lg", "px")
171
- )
83
+ stopPropagation: () => {
172
84
  },
173
- state: {
174
- default: "",
175
- error: c(
176
- "border-error",
177
- "focus:border-error",
178
- $("error")
179
- ),
180
- success: c(
181
- "border-success",
182
- "focus:border-success",
183
- $("success")
184
- )
185
- }
186
- },
187
- defaultVariants: {
188
- variant: "outlined",
189
- size: "md",
190
- state: "default"
191
- }
85
+ persist: () => {
86
+ },
87
+ timeStamp: Date.now()
88
+ };
89
+ Object.defineProperty(w.target, "value", {
90
+ value: "",
91
+ writable: !0
92
+ }), Object.defineProperty(w.currentTarget, "value", {
93
+ value: "",
94
+ writable: !0
95
+ }), d(w);
96
+ }
97
+ }
98
+ }, G = () => F((l) => !l), J = m || n || !!u ? /* @__PURE__ */ L(M, { children: [
99
+ m && /* @__PURE__ */ o(
100
+ j,
101
+ {
102
+ variant: "ghost",
103
+ size: "sm",
104
+ onClick: X,
105
+ className: `h-auto ${I("xs", "p")}`,
106
+ "aria-label": "Clear input",
107
+ children: /* @__PURE__ */ o(Z, { className: i })
192
108
  }
193
109
  ),
194
- [A, $]
195
- ), re = o(
196
- () => c(
197
- B({ variant: v, size: a, state: I }),
198
- // Icon padding - specific values for icon positioning.
199
- // `pl-9` / `pr-9` aren't on the spacing scale (no semantic
200
- // key for 36px); they stay raw until a future PR either
201
- // extends the scale or refactors the icon-padding contract.
202
- h && (a === "sm" ? "pl-9" : a === "lg" ? l("3xl", "pl") : l("2xl", "pl")),
203
- (y || S || f) && (a === "sm" ? "pr-9" : a === "lg" ? l("3xl", "pr") : l("2xl", "pr")),
204
- H
205
- ),
206
- [
207
- B,
208
- v,
209
- a,
210
- I,
211
- h,
212
- y,
213
- S,
214
- f,
215
- H
216
- ]
217
- ), ae = o(
218
- () => c(
219
- "block",
220
- z("label"),
221
- l("xs", "mb"),
222
- m && "opacity-50"
223
- ),
224
- [m]
225
- ), g = o(
226
- () => a === "sm" ? "h-4 w-4" : a === "lg" ? "h-5 w-5" : "h-4 w-4",
227
- [a]
228
- ), ne = o(
229
- () => a === "sm" ? "top-2" : a === "lg" ? "top-3.5" : "top-2.5",
230
- [a]
231
- ), le = T(
232
- (p) => {
233
- var G;
234
- if (p.stopPropagation(), C)
235
- C();
236
- else if (w) {
237
- const E = (G = p.currentTarget.closest(".relative")) == null ? void 0 : G.querySelector("input");
238
- if (E) {
239
- const R = {
240
- target: E,
241
- currentTarget: E,
242
- bubbles: !0,
243
- cancelable: !0,
244
- defaultPrevented: !1,
245
- eventPhase: 2,
246
- isTrusted: !1,
247
- nativeEvent: new Event("change"),
248
- preventDefault: () => {
249
- },
250
- stopPropagation: () => {
251
- },
252
- persist: () => {
253
- },
254
- timeStamp: Date.now()
255
- };
256
- Object.defineProperty(R.target, "value", {
257
- value: "",
258
- writable: !0
259
- }), Object.defineProperty(R.currentTarget, "value", {
260
- value: "",
261
- writable: !0
262
- }), w(R);
263
- }
110
+ n && /* @__PURE__ */ o(
111
+ j,
112
+ {
113
+ variant: "ghost",
114
+ size: "sm",
115
+ onClick: G,
116
+ className: `h-auto ${I("xs", "p")}`,
117
+ "aria-label": f ? "Hide password" : "Show password",
118
+ children: f ? /* @__PURE__ */ o(_, { className: i }) : /* @__PURE__ */ o(ee, { className: i })
264
119
  }
265
- },
266
- [C, w]
267
- ), ce = T(() => {
268
- se((p) => !p);
269
- }, []);
270
- return /* @__PURE__ */ F("div", { className: "w-full", children: [
271
- e && /* @__PURE__ */ n("label", { htmlFor: u, className: ae, children: e }),
272
- /* @__PURE__ */ F("div", { className: "relative", children: [
273
- h && /* @__PURE__ */ n(
274
- "div",
275
- {
276
- className: `absolute left-3 ${ne} text-fg-secondary opacity-60 pointer-events-none`,
277
- children: /* @__PURE__ */ n("div", { className: g, children: h })
278
- }
279
- ),
280
- /* @__PURE__ */ n(
281
- "input",
282
- U({
283
- id: u,
284
- ref: ee,
285
- type: oe,
286
- className: re,
287
- disabled: m,
288
- value: b,
289
- onChange: w,
290
- "aria-invalid": s,
291
- "aria-required": q.required,
292
- "aria-describedby": V || D,
293
- suppressHydrationWarning: !0
294
- }, q)
295
- ),
296
- /* @__PURE__ */ F(
297
- "div",
298
- {
299
- className: `absolute right-3 top-0 bottom-0 flex items-center ${l("xs", "gap")}`,
300
- children: [
301
- S && /* @__PURE__ */ n(
302
- Z,
303
- {
304
- variant: "ghost",
305
- size: "sm",
306
- onClick: le,
307
- className: `h-auto ${l("xs", "p")}`,
308
- "aria-label": "Clear input",
309
- children: /* @__PURE__ */ n(me, { className: g })
310
- }
311
- ),
312
- f && /* @__PURE__ */ n(
313
- Z,
314
- {
315
- variant: "ghost",
316
- size: "sm",
317
- onClick: ce,
318
- className: `h-auto ${l("xs", "p")}`,
319
- "aria-label": N ? "Hide password" : "Show password",
320
- children: N ? /* @__PURE__ */ n(be, { className: g }) : /* @__PURE__ */ n(ge, { className: g })
321
- }
322
- ),
323
- y && !S && !f && /* @__PURE__ */ n(
324
- "div",
325
- {
326
- className: `text-fg-secondary opacity-60 pointer-events-none ${g}`,
327
- children: y
328
- }
329
- )
330
- ]
331
- }
332
- )
333
- ] }),
334
- (s || i || d) && /* @__PURE__ */ n(
335
- he,
120
+ ),
121
+ u && !m && !n && /* @__PURE__ */ o(
122
+ "div",
336
123
  {
337
- error: s,
338
- success: i,
339
- helperText: d,
340
- errorId: V,
341
- helperId: D
124
+ className: `text-fg-secondary opacity-60 pointer-events-none ${i}`,
125
+ children: u
342
126
  }
343
127
  )
344
- ] });
128
+ ] }) : void 0;
129
+ return /* @__PURE__ */ o(
130
+ te,
131
+ E({
132
+ ref: D,
133
+ id: z,
134
+ label: t,
135
+ error: a,
136
+ success: $,
137
+ helperText: B,
138
+ size: p,
139
+ variant: C,
140
+ leftIcon: O,
141
+ rightSlot: J,
142
+ className: k,
143
+ disabled: v,
144
+ type: H,
145
+ value: r,
146
+ onChange: d
147
+ }, A)
148
+ );
345
149
  })
346
150
  );
347
- ye.displayName = "Input";
151
+ se.displayName = "Input";
348
152
  export {
349
- ye as default
153
+ se as default
350
154
  };
351
155
  //# sourceMappingURL=Input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../../src/ui/primitives/Input/Input.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useState, memo, useId, useMemo, useCallback } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport {\n getTypographyClasses,\n getTypographySize,\n} from \"../../tokens/typography\";\nimport { getRadiusClass } from \"../../tokens/radius\";\nimport { getSpacingClass } from \"../../tokens/spacing\";\nimport { cn, cva } from \"../../utils\";\nimport { X, Eye, EyeOff } from \"lucide-react\";\nimport Button from \"../Button/Button\";\n\n/**\n * Helper Text Component\n * Memoized component for helper/error text\n */\nconst HelperText = memo(function HelperText({\n error,\n success,\n helperText,\n errorId,\n helperId,\n}: {\n error: boolean;\n success: boolean;\n helperText?: string;\n errorId?: string;\n helperId?: string;\n}) {\n const helperClasses = useMemo(\n () =>\n cn(\n getSpacingClass(\"xs\", \"mt\"),\n getTypographyClasses(\"caption\"),\n error && \"text-fg-error\",\n success && \"text-fg-success\",\n !error && !success && \"text-fg-secondary\",\n ),\n [error, success],\n );\n\n const text = useMemo(\n () => helperText || (error ? \"Error\" : success ? \"Success\" : \"\"),\n [helperText, error, success],\n );\n\n return (\n <div\n id={errorId || helperId}\n className={helperClasses}\n role={error || success ? \"alert\" : undefined}\n >\n {text}\n </div>\n );\n});\n\nexport type InputSize = \"sm\" | \"md\" | \"lg\";\nexport type InputVariant = \"default\" | \"outlined\" | \"filled\";\nexport type InputState = \"default\" | \"error\" | \"success\";\n\nexport interface InputProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"size\"\n> {\n label?: ReactNode;\n error?: boolean;\n success?: boolean;\n helperText?: string;\n size?: InputSize;\n variant?: InputVariant;\n leftIcon?: ReactNode;\n rightIcon?: ReactNode;\n showClearButton?: boolean;\n onClear?: () => void;\n}\n\n/**\n * Input Component\n *\n * A styled text input component with label, error/success states, icons, and clear button.\n * Uses Composite Pattern when combined with Label and ErrorMessage.\n *\n * @example\n * ```tsx\n * <Input\n * id=\"email\"\n * label=\"Email\"\n * type=\"email\"\n * placeholder=\"Enter your email\"\n * error={hasError}\n * helperText={errorMessage}\n * leftIcon={<MailIcon />}\n * />\n * ```\n */\nconst Input = memo(\n forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n id,\n label,\n error = false,\n success = false,\n helperText,\n size = \"md\",\n variant = \"outlined\",\n leftIcon,\n rightIcon,\n showClearButton = false,\n onClear,\n className = \"\",\n disabled = false,\n type = \"text\",\n value,\n onChange,\n ...props\n },\n ref,\n ) {\n // Stable fallback id when the consumer doesn't provide one. useId\n // is SSR-safe and stable across renders, replacing the deprecated\n // Math.random().substr() pattern.\n const reactId = useId();\n const inputId = id || `input-${reactId}`;\n\n // Memoize error and helper IDs\n const errorId = useMemo(\n () => (error ? `${inputId}-error` : undefined),\n [error, inputId],\n );\n\n const helperId = useMemo(\n () => (helperText ? `${inputId}-helper` : undefined),\n [helperText, inputId],\n );\n\n // Password toggle state\n const [showPassword, setShowPassword] = useState(false);\n\n // Memoize password-related values\n const isPassword = useMemo(() => type === \"password\", [type]);\n const inputType = useMemo(\n () => (isPassword && showPassword ? \"text\" : type),\n [isPassword, showPassword, type],\n );\n\n // Memoize state\n const state = useMemo<InputState>(\n () => (error ? \"error\" : success ? \"success\" : \"default\"),\n [error, success],\n );\n\n // Memoize clear button visibility\n const hasValue = useMemo(\n () => value !== undefined && value !== null && value !== \"\",\n [value],\n );\n\n const shouldShowClear = useMemo(\n () => showClearButton && hasValue && !disabled,\n [showClearButton, hasValue, disabled],\n );\n\n // Memoize focus ring colors\n const primaryFocusRing = useMemo(() => \"focus:border-line-focus\", []);\n\n const errorFocusRing = useMemo(() => \"focus:border-error\", []);\n\n const successFocusRing = useMemo(() => \"focus:border-success\", []);\n\n const getFocusRingColor = useMemo(\n () => primaryFocusRing.replace(\"focus:border-\", \"focus:ring-\"),\n [primaryFocusRing],\n );\n\n const getStateFocusRingColor = useCallback(\n (stateType: \"error\" | \"success\"): string => {\n return stateType === \"error\"\n ? errorFocusRing.replace(\"focus:border-\", \"focus:ring-\")\n : successFocusRing.replace(\"focus:border-\", \"focus:ring-\");\n },\n [errorFocusRing, successFocusRing],\n );\n\n // Input variants using CVA — memoize so the function reference is\n // stable across renders. inputClasses below depends on this; without\n // memoization a fresh cva() each render would invalidate that memo\n // on every render (defeating its purpose).\n const inputVariants = useMemo(\n () =>\n cva(\n // Base classes\n cn(\n \"w-full\",\n getRadiusClass(\"md\"),\n \"transition-colors\",\n \"focus:outline-none\",\n \"focus:ring-2\",\n \"focus:ring-offset-2\",\n \"disabled:opacity-50\",\n \"disabled:cursor-not-allowed\",\n ),\n {\n variants: {\n variant: {\n default: cn(\n \"border-0\",\n \"border-b-2\",\n \"border-line-default\",\n \"focus:border-line-focus\",\n ),\n outlined: cn(\n \"border\",\n \"border-line-default\",\n \"focus:border-line-focus\",\n ),\n filled: cn(\n \"bg-surface-muted\",\n \"border-0\",\n \"focus:bg-surface-base\",\n \"focus:ring-2\",\n getFocusRingColor,\n ),\n },\n size: {\n sm: cn(\n \"h-8\",\n getTypographySize(\"bodySmall\"),\n getSpacingClass(\"md\", \"px\"),\n ),\n md: cn(\n \"h-10\",\n getTypographySize(\"body\"),\n getSpacingClass(\"base\", \"px\"),\n ),\n lg: cn(\n \"h-12\",\n getTypographySize(\"bodyLarge\"),\n getSpacingClass(\"lg\", \"px\"),\n ),\n },\n state: {\n default: \"\",\n error: cn(\n \"border-error\",\n \"focus:border-error\",\n getStateFocusRingColor(\"error\"),\n ),\n success: cn(\n \"border-success\",\n \"focus:border-success\",\n getStateFocusRingColor(\"success\"),\n ),\n },\n },\n defaultVariants: {\n variant: \"outlined\",\n size: \"md\",\n state: \"default\",\n },\n },\n ),\n [getFocusRingColor, getStateFocusRingColor],\n );\n\n // Memoize input classes\n const inputClasses = useMemo(\n () =>\n cn(\n inputVariants({ variant, size, state }),\n // Icon padding - specific values for icon positioning.\n // `pl-9` / `pr-9` aren't on the spacing scale (no semantic\n // key for 36px); they stay raw until a future PR either\n // extends the scale or refactors the icon-padding contract.\n leftIcon &&\n (size === \"sm\"\n ? \"pl-9\"\n : size === \"lg\"\n ? getSpacingClass(\"3xl\", \"pl\")\n : getSpacingClass(\"2xl\", \"pl\")),\n (rightIcon || shouldShowClear || isPassword) &&\n (size === \"sm\"\n ? \"pr-9\"\n : size === \"lg\"\n ? getSpacingClass(\"3xl\", \"pr\")\n : getSpacingClass(\"2xl\", \"pr\")),\n className,\n ),\n [\n inputVariants,\n variant,\n size,\n state,\n leftIcon,\n rightIcon,\n shouldShowClear,\n isPassword,\n className,\n ],\n );\n\n // Memoize label classes\n const labelClasses = useMemo(\n () =>\n cn(\n \"block\",\n getTypographyClasses(\"label\"),\n getSpacingClass(\"xs\", \"mb\"),\n disabled && \"opacity-50\",\n ),\n [disabled],\n );\n\n // Memoize icon size and position\n const iconSize = useMemo(\n () => (size === \"sm\" ? \"h-4 w-4\" : size === \"lg\" ? \"h-5 w-5\" : \"h-4 w-4\"),\n [size],\n );\n\n const iconPosition = useMemo(\n () => (size === \"sm\" ? \"top-2\" : size === \"lg\" ? \"top-3.5\" : \"top-2.5\"),\n [size],\n );\n\n // Memoize clear handler\n const handleClear = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (onClear) {\n onClear();\n } else if (onChange) {\n // Create synthetic event to clear input\n const inputElement = e.currentTarget\n .closest(\".relative\")\n ?.querySelector(\"input\") as HTMLInputElement;\n if (inputElement) {\n const syntheticEvent = {\n target: inputElement,\n currentTarget: inputElement,\n bubbles: true,\n cancelable: true,\n defaultPrevented: false,\n eventPhase: 2,\n isTrusted: false,\n nativeEvent: new Event(\"change\"),\n preventDefault: () => {},\n stopPropagation: () => {},\n persist: () => {},\n timeStamp: Date.now(),\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n Object.defineProperty(syntheticEvent.target, \"value\", {\n value: \"\",\n writable: true,\n });\n Object.defineProperty(syntheticEvent.currentTarget, \"value\", {\n value: \"\",\n writable: true,\n });\n onChange(syntheticEvent);\n }\n }\n },\n [onClear, onChange],\n );\n\n // Memoize password toggle handler\n const handleTogglePassword = useCallback(() => {\n setShowPassword((prev) => !prev);\n }, []);\n\n return (\n <div className=\"w-full\">\n {label && (\n <label htmlFor={inputId} className={labelClasses}>\n {label}\n </label>\n )}\n <div className=\"relative\">\n {leftIcon && (\n <div\n className={`absolute left-3 ${iconPosition} text-fg-secondary opacity-60 pointer-events-none`}\n >\n <div className={iconSize}>{leftIcon}</div>\n </div>\n )}\n <input\n id={inputId}\n ref={ref}\n type={inputType}\n className={inputClasses}\n disabled={disabled}\n value={value}\n onChange={onChange}\n aria-invalid={error}\n aria-required={props.required}\n aria-describedby={errorId || helperId}\n suppressHydrationWarning\n {...props}\n />\n <div\n className={`absolute right-3 top-0 bottom-0 flex items-center ${getSpacingClass(\"xs\", \"gap\")}`}\n >\n {shouldShowClear && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleClear}\n className={`h-auto ${getSpacingClass(\"xs\", \"p\")}`}\n aria-label=\"Clear input\"\n >\n <X className={iconSize} />\n </Button>\n )}\n {isPassword && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleTogglePassword}\n className={`h-auto ${getSpacingClass(\"xs\", \"p\")}`}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n >\n {showPassword ? (\n <EyeOff className={iconSize} />\n ) : (\n <Eye className={iconSize} />\n )}\n </Button>\n )}\n {rightIcon && !shouldShowClear && !isPassword && (\n <div\n className={`text-fg-secondary opacity-60 pointer-events-none ${iconSize}`}\n >\n {rightIcon}\n </div>\n )}\n </div>\n </div>\n {(error || success || helperText) && (\n <HelperText\n error={error}\n success={success}\n helperText={helperText}\n errorId={errorId}\n helperId={helperId}\n />\n )}\n </div>\n );\n }),\n);\n\nInput.displayName = \"Input\";\n\nexport default Input;\n"],"names":["HelperText","memo","error","success","helperText","errorId","helperId","helperClasses","useMemo","cn","getSpacingClass","getTypographyClasses","text","jsx","Input","forwardRef","_a","ref","_b","id","label","size","variant","leftIcon","rightIcon","showClearButton","onClear","className","disabled","type","value","onChange","props","__objRest","reactId","useId","inputId","showPassword","setShowPassword","useState","isPassword","inputType","state","hasValue","shouldShowClear","primaryFocusRing","errorFocusRing","successFocusRing","getFocusRingColor","getStateFocusRingColor","useCallback","stateType","inputVariants","cva","getRadiusClass","getTypographySize","inputClasses","labelClasses","iconSize","iconPosition","handleClear","e","inputElement","syntheticEvent","handleTogglePassword","prev","jsxs","__spreadValues","Button","X","EyeOff","Eye"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,KAAaC,EAAK,SAAoB;AAAA,EAC1C,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAMG;AACD,QAAMC,IAAgBC;AAAA,IACpB,MACEC;AAAA,MACEC,EAAgB,MAAM,IAAI;AAAA,MAC1BC,EAAqB,SAAS;AAAA,MAC9BT,KAAS;AAAA,MACTC,KAAW;AAAA,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AA,gBAACuD;AAAA,gBAAA;AAAA,kBACC,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,SAASR;AAAA,kBACT,WAAW,UAAUlD,EAAgB,MAAM,GAAG,CAAC;AAAA,kBAC/C,cAAW;AAAA,kBAEX,UAAA,gBAAAG,EAACwD,IAAA,EAAE,WAAWX,EAAA,CAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,cAG3BlB,KACC,gBAAA3B;AAAA,gBAACuD;AAAA,gBAAA;AAAA,kBACC,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,SAASJ;AAAA,kBACT,WAAW,UAAUtD,EAAgB,MAAM,GAAG,CAAC;AAAA,kBAC/C,cAAY2B,IAAe,kBAAkB;AAAA,kBAE5C,UAAAA,sBACEiC,IAAA,EAAO,WAAWZ,GAAU,IAE7B,gBAAA7C,EAAC0D,IAAA,EAAI,WAAWb,EAAA,CAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,cAI/BlC,KAAa,CAACoB,KAAmB,CAACJ,KACjC,gBAAA3B;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAW,oDAAoD6C,CAAQ;AAAA,kBAEtE,UAAAlC;AAAA,gBAAA;AAAA,cAAA;AAAA,YACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ,GACF;AAAA,OACEtB,KAASC,KAAWC,MACpB,gBAAAS;AAAA,QAACb;AAAA,QAAA;AAAA,UACC,OAAAE;AAAA,UACA,SAAAC;AAAA,UACA,YAAAC;AAAA,UACA,SAAAC;AAAA,UACA,UAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GAEJ;AAAA,EAEJ,CAAC;AACH;AAEAQ,GAAM,cAAc;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../../src/ui/primitives/Input/Input.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useState, memo, useId } from \"react\";\nimport { getSpacingClass } from \"../../tokens/spacing\";\nimport { X, Eye, EyeOff } from \"lucide-react\";\nimport Button from \"../Button/Button\";\nimport InputBase from \"./InputBase\";\nimport type { InputBaseProps } from \"./InputBase\";\n\n// The presentational variant types live on InputBase now (the shared,\n// server-safe core). Re-exported here so existing deep imports and the\n// folder index keep resolving them from \"./Input\".\nexport type { InputSize, InputVariant, InputState } from \"./InputBase\";\n\nexport interface InputProps extends Omit<InputBaseProps, \"rightSlot\"> {\n showClearButton?: boolean;\n onClear?: () => void;\n}\n\n/**\n * Input Component\n *\n * The interactive text input: everything `InputBase` renders, plus the\n * client-only affordances that require React state — the password\n * visibility toggle (`type=\"password\"`), the clear button\n * (`showClearButton`), and the `useId` auto-id fallback. It **composes**\n * `InputBase` (issue #224): the presentational shell lives once in\n * `InputBase`, and `Input` layers the stateful affixes on top, passing\n * the resolved `id`, the toggled `type`, and its buttons via `rightSlot`.\n *\n * Need a server-renderable / native-form input with no client state?\n * Import `InputBase` from `@fabio.caffarello/react-design-system/server`.\n *\n * @example\n * ```tsx\n * <Input\n * id=\"email\"\n * label=\"Email\"\n * type=\"email\"\n * placeholder=\"Enter your email\"\n * error={hasError}\n * helperText={errorMessage}\n * leftIcon={<MailIcon />}\n * />\n * ```\n */\nconst Input = memo(\n forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n id,\n label,\n error = false,\n success = false,\n helperText,\n size = \"md\",\n variant = \"outlined\",\n leftIcon,\n rightIcon,\n showClearButton = false,\n onClear,\n className = \"\",\n disabled = false,\n type = \"text\",\n value,\n onChange,\n ...props\n },\n ref,\n ) {\n // Stable fallback id when the consumer doesn't provide one. This is\n // the client hook that keeps Input on the main entry; InputBase (no\n // useId) is the server-safe half and receives the resolved id below.\n const reactId = useId();\n const inputId = id || `input-${reactId}`;\n\n // Password toggle state.\n const [showPassword, setShowPassword] = useState(false);\n const isPassword = type === \"password\";\n const inputType = isPassword && showPassword ? \"text\" : type;\n\n const hasValue = value !== undefined && value !== null && value !== \"\";\n const shouldShowClear = showClearButton && hasValue && !disabled;\n\n const iconSize =\n size === \"sm\" ? \"h-4 w-4\" : size === \"lg\" ? \"h-5 w-5\" : \"h-4 w-4\";\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation();\n if (onClear) {\n onClear();\n } else if (onChange) {\n // Create a synthetic event to clear the input when the consumer\n // is controlled but didn't pass onClear.\n const inputElement = e.currentTarget\n .closest(\".relative\")\n ?.querySelector(\"input\") as HTMLInputElement;\n if (inputElement) {\n const syntheticEvent = {\n target: inputElement,\n currentTarget: inputElement,\n bubbles: true,\n cancelable: true,\n defaultPrevented: false,\n eventPhase: 2,\n isTrusted: false,\n nativeEvent: new Event(\"change\"),\n preventDefault: () => {},\n stopPropagation: () => {},\n persist: () => {},\n timeStamp: Date.now(),\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n Object.defineProperty(syntheticEvent.target, \"value\", {\n value: \"\",\n writable: true,\n });\n Object.defineProperty(syntheticEvent.currentTarget, \"value\", {\n value: \"\",\n writable: true,\n });\n onChange(syntheticEvent);\n }\n }\n };\n\n const handleTogglePassword = () => setShowPassword((prev) => !prev);\n\n // Trailing-affix slot: the interactive clear + password-toggle\n // buttons (the reason Input stays client), falling back to the\n // decorative rightIcon when neither is active. Same content and DOM\n // order the pre-composition Input rendered, now projected into\n // InputBase's right-affix container.\n const hasRightAffix = shouldShowClear || isPassword || Boolean(rightIcon);\n const rightSlot = hasRightAffix ? (\n <>\n {shouldShowClear && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleClear}\n className={`h-auto ${getSpacingClass(\"xs\", \"p\")}`}\n aria-label=\"Clear input\"\n >\n <X className={iconSize} />\n </Button>\n )}\n {isPassword && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleTogglePassword}\n className={`h-auto ${getSpacingClass(\"xs\", \"p\")}`}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n >\n {showPassword ? (\n <EyeOff className={iconSize} />\n ) : (\n <Eye className={iconSize} />\n )}\n </Button>\n )}\n {rightIcon && !shouldShowClear && !isPassword && (\n <div\n className={`text-fg-secondary opacity-60 pointer-events-none ${iconSize}`}\n >\n {rightIcon}\n </div>\n )}\n </>\n ) : undefined;\n\n return (\n <InputBase\n ref={ref}\n id={inputId}\n label={label}\n error={error}\n success={success}\n helperText={helperText}\n size={size}\n variant={variant}\n leftIcon={leftIcon}\n rightSlot={rightSlot}\n className={className}\n disabled={disabled}\n type={inputType}\n value={value}\n onChange={onChange}\n {...props}\n />\n );\n }),\n);\n\nInput.displayName = \"Input\";\n\nexport default Input;\n"],"names":["Input","memo","forwardRef","_a","ref","_b","id","label","error","success","helperText","size","variant","leftIcon","rightIcon","showClearButton","onClear","className","disabled","type","value","onChange","props","__objRest","reactId","useId","inputId","showPassword","setShowPassword","useState","isPassword","inputType","hasValue","shouldShowClear","iconSize","handleClear","e","inputElement","syntheticEvent","handleTogglePassword","prev","rightSlot","jsxs","Fragment","jsx","Button","getSpacingClass","X","EyeOff","Eye","InputBase","__spreadValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAMA,KAAQC;AAAA,EACZC,EAAyC,SACvCC,IAmBAC,GACA;AApBA,QAAAC,IAAAF,IACE;AAAA,UAAAG;AAAA,MACA,OAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,SAAAC,IAAU;AAAA,MACV,YAAAC;AAAA,MACA,MAAAC,IAAO;AAAA,MACP,SAAAC,IAAU;AAAA,MACV,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,iBAAAC,IAAkB;AAAA,MAClB,SAAAC;AAAA,MACA,WAAAC,IAAY;AAAA,MACZ,UAAAC,IAAW;AAAA,MACX,MAAAC,IAAO;AAAA,MACP,OAAAC;AAAA,MACA,UAAAC;AAAA,QAhBFhB,GAiBKiB,IAAAC,EAjBLlB,GAiBK;AAAA,MAhBH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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