@sth87/shadcn-design-system 0.0.34 → 0.0.36

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 (29) hide show
  1. package/README.md +20 -2
  2. package/dist/AI_CONTEXT.md +3 -0
  3. package/dist/cjs/components/FloatLabel.cjs +1 -1
  4. package/dist/cjs/components/FloatLabel.cjs.map +1 -1
  5. package/dist/cjs/components/Input/Input.cjs +1 -1
  6. package/dist/cjs/components/Input/Input.cjs.map +1 -1
  7. package/dist/cjs/components/Select/Select.cjs +1 -1
  8. package/dist/cjs/components/Select/Select.cjs.map +1 -1
  9. package/dist/cjs/components/Textarea/Textarea.cjs +1 -1
  10. package/dist/cjs/components/Textarea/Textarea.cjs.map +1 -1
  11. package/dist/cjs/styles/index.css +1 -1
  12. package/dist/esm/components/FloatLabel.js +30 -19
  13. package/dist/esm/components/FloatLabel.js.map +1 -1
  14. package/dist/esm/components/Input/Input.js +91 -85
  15. package/dist/esm/components/Input/Input.js.map +1 -1
  16. package/dist/esm/components/Select/Select.js +100 -94
  17. package/dist/esm/components/Select/Select.js.map +1 -1
  18. package/dist/esm/components/Textarea/Textarea.js +58 -52
  19. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  20. package/dist/esm/styles/index.css +1 -1
  21. package/dist/types/components/FloatLabel.d.ts +1 -0
  22. package/dist/types/components/FloatLabel.d.ts.map +1 -1
  23. package/dist/types/components/Input/Input.d.ts +1 -0
  24. package/dist/types/components/Input/Input.d.ts.map +1 -1
  25. package/dist/types/components/Select/Select.d.ts +2 -0
  26. package/dist/types/components/Select/Select.d.ts.map +1 -1
  27. package/dist/types/components/Textarea/Textarea.d.ts +1 -0
  28. package/dist/types/components/Textarea/Textarea.d.ts.map +1 -1
  29. package/package.json +1 -1
@@ -1,16 +1,24 @@
1
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { cn as u } from "../packages/ui/src/lib/utils.js";
4
- import { Label as f } from "../packages/ui/src/components/label.js";
5
- import { Tooltip as h } from "./Tooltip/Tooltip.js";
6
- import { Info as g } from "lucide-react";
7
- const w = i.forwardRef(
8
- ({ className: a, infoTooltip: p, size: t = "xl", shouldFloat: o, children: n, ...c }, s) => {
9
- const e = t === "lg" || !1;
10
- return /* @__PURE__ */ l(
11
- f,
1
+ import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
+ import * as u from "react";
3
+ import { cn as f } from "../packages/ui/src/lib/utils.js";
4
+ import { Label as h } from "../packages/ui/src/components/label.js";
5
+ import { Tooltip as g } from "./Tooltip/Tooltip.js";
6
+ import { Info as w } from "lucide-react";
7
+ const m = u.forwardRef(
8
+ ({
9
+ className: t,
10
+ infoTooltip: a,
11
+ size: n = "xl",
12
+ shouldFloat: o,
13
+ required: c,
14
+ children: s,
15
+ ...l
16
+ }, i) => {
17
+ const e = n === "lg" || !1;
18
+ return /* @__PURE__ */ p(
19
+ h,
12
20
  {
13
- className: u(
21
+ className: f(
14
22
  "absolute start-2 select-none pointer-events-none",
15
23
  "bg-background px-3 translate-y-2",
16
24
  "flex",
@@ -40,20 +48,23 @@ const w = i.forwardRef(
40
48
  "top-0 scale-100 translate-x-0 w-[calc(100%-(--spacing(4)))] h-[calc(100%-(--spacing(4)))] py-3 bg-background": typeof o == "boolean" && !o && e
41
49
  },
42
50
  "will-change-transform transition-all duration-300 ease-in-out",
43
- a
51
+ t
44
52
  ),
45
- ref: s,
46
- ...c,
53
+ ref: i,
54
+ ...l,
47
55
  children: [
48
- /* @__PURE__ */ r("span", { className: "truncate whitespace-nowrap max-w-full pointer-events-none", children: n }),
49
- p && /* @__PURE__ */ r(h, { content: p, children: /* @__PURE__ */ r(g, { className: "size-3.5 min-w-3.5 z-10 pointer-events-auto" }) })
56
+ /* @__PURE__ */ p("span", { className: "truncate whitespace-nowrap max-w-full pointer-events-none", children: [
57
+ s,
58
+ c && /* @__PURE__ */ r("span", { className: "text-error ml-0.5", children: "*" })
59
+ ] }),
60
+ a && /* @__PURE__ */ r(g, { content: a, children: /* @__PURE__ */ r(w, { className: "size-3.5 min-w-3.5 z-10 pointer-events-auto" }) })
50
61
  ]
51
62
  }
52
63
  );
53
64
  }
54
65
  );
55
- w.displayName = "FloatingLabel";
66
+ m.displayName = "FloatingLabel";
56
67
  export {
57
- w as FloatingLabel
68
+ m as FloatingLabel
58
69
  };
59
70
  //# sourceMappingURL=FloatLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloatLabel.js","sources":["../../../src/components/FloatLabel.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { Label } from \"@dsui/ui/components/label\";\nimport { Tooltip } from \"./Tooltip/Tooltip\";\nimport { Info } from \"lucide-react\";\n\nconst FloatingLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label> & {\n infoTooltip?: React.ReactNode;\n size?: string;\n shouldFloat?: boolean;\n }\n>(\n (\n { className, infoTooltip, size = \"xl\", shouldFloat, children, ...props },\n ref\n ) => {\n const lagerSize = size === \"lg\" || false;\n\n return (\n <Label\n className={cn(\n \"absolute start-2 select-none pointer-events-none\",\n \"bg-background px-3 translate-y-2\",\n \"flex\",\n {\n \"top-0.5 origin-left scale-75 translate-x-1 max-w-full h-3 py-0 bg-transparent\":\n !lagerSize,\n // State empty (placeholder shown) - ở giữa input\n \"peer-placeholder-shown:top-0 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-x-0 peer-placeholder-shown:w-[calc(100%-(--spacing(4)))] peer-placeholder-shown:h-[calc(100%-(--spacing(4)))] peer-placeholder-shown:py-3 peer-placeholder-shown:bg-background\":\n !lagerSize,\n // // State focus - nằm trên input\n \"peer-focus:top-0.5 peer-focus:origin-left peer-focus:scale-75 peer-focus:translate-x-1 peer-focus:text-primary peer-focus:max-w-full peer-focus:h-3 peer-focus:py-0 peer-focus:bg-transparent\":\n !lagerSize,\n \"group-focus-within:top-0.5 group-focus-within:origin-left group-focus-within:scale-75 group-focus-within:translate-x-1 group-focus-within:text-primary group-focus-within:max-w-full group-focus-within:h-3 group-focus-within:py-0 group-focus-within:bg-transparent\":\n !lagerSize,\n },\n {\n \"-top-3.5 origin-left scale-75 translate-x-0 max-w-full w-auto h-3 py-0\":\n lagerSize,\n // State empty (placeholder shown) - ở giữa input\n \"peer-placeholder-shown:-top-0.5 peer-placeholder-shown:scale-100 peer-placeholder-shown:w-[calc(100%-(--spacing(4)))] peer-placeholder-shown:h-[calc(100%-(--spacing(3)))] peer-placeholder-shown:py-2 peer-placeholder-shown:bg-background\":\n lagerSize,\n // // State focus - nằm trên input\n \"peer-focus:-top-3.5 peer-focus:origin-left peer-focus:scale-75 peer-focus:text-primary peer-focus:max-w-full peer-focus:w-auto peer-focus:h-3 peer-focus:py-0\":\n lagerSize,\n \"group-focus-within:-top-3.5 group-focus-within:origin-left group-focus-within:scale-75 group-focus-within:text-primary group-focus-within:max-w-full group-focus-within:w-auto group-focus-within:h-3 group-focus-within:py-0\":\n lagerSize,\n },\n\n // State when shouldFloat prop is set\n {\n \"top-0.5 origin-left scale-75 translate-x-1 max-w-full h-3 py-0\":\n typeof shouldFloat === \"boolean\" && shouldFloat && !lagerSize,\n \"top-0 scale-100 translate-x-0 w-[calc(100%-(--spacing(4)))] h-[calc(100%-(--spacing(4)))] py-3 bg-background\":\n typeof shouldFloat === \"boolean\" && !shouldFloat && !lagerSize,\n },\n {\n \"-top-3.5 origin-left scale-75 translate-x-0 max-w-full h-3 py-0\":\n typeof shouldFloat === \"boolean\" && shouldFloat && lagerSize,\n \"top-0 scale-100 translate-x-0 w-[calc(100%-(--spacing(4)))] h-[calc(100%-(--spacing(4)))] py-3 bg-background\":\n typeof shouldFloat === \"boolean\" && !shouldFloat && lagerSize,\n },\n \"will-change-transform transition-all duration-300 ease-in-out\",\n className\n )}\n ref={ref}\n {...props}\n >\n <span className=\"truncate whitespace-nowrap max-w-full pointer-events-none\">\n {children}\n </span>\n\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"size-3.5 min-w-3.5 z-10 pointer-events-auto\" />\n </Tooltip>\n )}\n </Label>\n );\n }\n);\n\nFloatingLabel.displayName = \"FloatingLabel\";\n\nexport { FloatingLabel };\n"],"names":["FloatingLabel","React","className","infoTooltip","size","shouldFloat","children","props","ref","lagerSize","jsxs","Label","cn","jsx","Tooltip","Info"],"mappings":";;;;;;AAOA,MAAMA,IAAgBC,EAAM;AAAA,EAQ1B,CACE,EAAE,WAAAC,GAAW,aAAAC,GAAa,MAAAC,IAAO,MAAM,aAAAC,GAAa,UAAAC,GAAU,GAAGC,EAAA,GACjEC,MACG;AACH,UAAMC,IAAYL,MAAS,QAAQ;AAEnC,WACE,gBAAAM;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,YACE,iFACE,CAACH;AAAA;AAAA,YAEH,iRACE,CAACA;AAAA;AAAA,YAEH,iMACE,CAACA;AAAA,YACH,yQACE,CAACA;AAAA,UAAA;AAAA,UAEL;AAAA,YACE,0EACEA;AAAA;AAAA,YAEF,+OACEA;AAAA;AAAA,YAEF,iKACEA;AAAA,YACF,iOACEA;AAAA,UAAA;AAAA;AAAA,UAIJ;AAAA,YACE,kEACE,OAAOJ,KAAgB,aAAaA,KAAe,CAACI;AAAA,YACtD,gHACE,OAAOJ,KAAgB,aAAa,CAACA,KAAe,CAACI;AAAA,UAAA;AAAA,UAEzD;AAAA,YACE,mEACE,OAAOJ,KAAgB,aAAaA,KAAeI;AAAA,YACrD,gHACE,OAAOJ,KAAgB,aAAa,CAACA,KAAeI;AAAA,UAAA;AAAA,UAExD;AAAA,UACAP;AAAA,QAAA;AAAA,QAEF,KAAAM;AAAA,QACC,GAAGD;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAM,EAAC,QAAA,EAAK,WAAU,6DACb,UAAAP,EAAA,CACH;AAAA,UAECH,uBACEW,GAAA,EAAQ,SAASX,GAChB,UAAA,gBAAAU,EAACE,GAAA,EAAK,WAAU,8CAAA,CAA8C,EAAA,CAChE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAf,EAAc,cAAc;"}
1
+ {"version":3,"file":"FloatLabel.js","sources":["../../../src/components/FloatLabel.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { Label } from \"@dsui/ui/components/label\";\nimport { Tooltip } from \"./Tooltip/Tooltip\";\nimport { Info } from \"lucide-react\";\n\nconst FloatingLabel = React.forwardRef<\n React.ElementRef<typeof Label>,\n React.ComponentPropsWithoutRef<typeof Label> & {\n infoTooltip?: React.ReactNode;\n size?: string;\n shouldFloat?: boolean;\n required?: boolean;\n }\n>(\n (\n {\n className,\n infoTooltip,\n size = \"xl\",\n shouldFloat,\n required,\n children,\n ...props\n },\n ref\n ) => {\n const lagerSize = size === \"lg\" || false;\n\n return (\n <Label\n className={cn(\n \"absolute start-2 select-none pointer-events-none\",\n \"bg-background px-3 translate-y-2\",\n \"flex\",\n {\n \"top-0.5 origin-left scale-75 translate-x-1 max-w-full h-3 py-0 bg-transparent\":\n !lagerSize,\n // State empty (placeholder shown) - ở giữa input\n \"peer-placeholder-shown:top-0 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-x-0 peer-placeholder-shown:w-[calc(100%-(--spacing(4)))] peer-placeholder-shown:h-[calc(100%-(--spacing(4)))] peer-placeholder-shown:py-3 peer-placeholder-shown:bg-background\":\n !lagerSize,\n // // State focus - nằm trên input\n \"peer-focus:top-0.5 peer-focus:origin-left peer-focus:scale-75 peer-focus:translate-x-1 peer-focus:text-primary peer-focus:max-w-full peer-focus:h-3 peer-focus:py-0 peer-focus:bg-transparent\":\n !lagerSize,\n \"group-focus-within:top-0.5 group-focus-within:origin-left group-focus-within:scale-75 group-focus-within:translate-x-1 group-focus-within:text-primary group-focus-within:max-w-full group-focus-within:h-3 group-focus-within:py-0 group-focus-within:bg-transparent\":\n !lagerSize,\n },\n {\n \"-top-3.5 origin-left scale-75 translate-x-0 max-w-full w-auto h-3 py-0\":\n lagerSize,\n // State empty (placeholder shown) - ở giữa input\n \"peer-placeholder-shown:-top-0.5 peer-placeholder-shown:scale-100 peer-placeholder-shown:w-[calc(100%-(--spacing(4)))] peer-placeholder-shown:h-[calc(100%-(--spacing(3)))] peer-placeholder-shown:py-2 peer-placeholder-shown:bg-background\":\n lagerSize,\n // // State focus - nằm trên input\n \"peer-focus:-top-3.5 peer-focus:origin-left peer-focus:scale-75 peer-focus:text-primary peer-focus:max-w-full peer-focus:w-auto peer-focus:h-3 peer-focus:py-0\":\n lagerSize,\n \"group-focus-within:-top-3.5 group-focus-within:origin-left group-focus-within:scale-75 group-focus-within:text-primary group-focus-within:max-w-full group-focus-within:w-auto group-focus-within:h-3 group-focus-within:py-0\":\n lagerSize,\n },\n\n // State when shouldFloat prop is set\n {\n \"top-0.5 origin-left scale-75 translate-x-1 max-w-full h-3 py-0\":\n typeof shouldFloat === \"boolean\" && shouldFloat && !lagerSize,\n \"top-0 scale-100 translate-x-0 w-[calc(100%-(--spacing(4)))] h-[calc(100%-(--spacing(4)))] py-3 bg-background\":\n typeof shouldFloat === \"boolean\" && !shouldFloat && !lagerSize,\n },\n {\n \"-top-3.5 origin-left scale-75 translate-x-0 max-w-full h-3 py-0\":\n typeof shouldFloat === \"boolean\" && shouldFloat && lagerSize,\n \"top-0 scale-100 translate-x-0 w-[calc(100%-(--spacing(4)))] h-[calc(100%-(--spacing(4)))] py-3 bg-background\":\n typeof shouldFloat === \"boolean\" && !shouldFloat && lagerSize,\n },\n \"will-change-transform transition-all duration-300 ease-in-out\",\n className\n )}\n ref={ref}\n {...props}\n >\n <span className=\"truncate whitespace-nowrap max-w-full pointer-events-none\">\n {children}\n {required && <span className=\"text-error ml-0.5\">*</span>}\n </span>\n\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"size-3.5 min-w-3.5 z-10 pointer-events-auto\" />\n </Tooltip>\n )}\n </Label>\n );\n }\n);\n\nFloatingLabel.displayName = \"FloatingLabel\";\n\nexport { FloatingLabel };\n"],"names":["FloatingLabel","React","className","infoTooltip","size","shouldFloat","required","children","props","ref","lagerSize","jsxs","Label","cn","jsx","Tooltip","Info"],"mappings":";;;;;;AAOA,MAAMA,IAAgBC,EAAM;AAAA,EAS1B,CACE;AAAA,IACE,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAYN,MAAS,QAAQ;AAEnC,WACE,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,YACE,iFACE,CAACH;AAAA;AAAA,YAEH,iRACE,CAACA;AAAA;AAAA,YAEH,iMACE,CAACA;AAAA,YACH,yQACE,CAACA;AAAA,UAAA;AAAA,UAEL;AAAA,YACE,0EACEA;AAAA;AAAA,YAEF,+OACEA;AAAA;AAAA,YAEF,iKACEA;AAAA,YACF,iOACEA;AAAA,UAAA;AAAA;AAAA,UAIJ;AAAA,YACE,kEACE,OAAOL,KAAgB,aAAaA,KAAe,CAACK;AAAA,YACtD,gHACE,OAAOL,KAAgB,aAAa,CAACA,KAAe,CAACK;AAAA,UAAA;AAAA,UAEzD;AAAA,YACE,mEACE,OAAOL,KAAgB,aAAaA,KAAeK;AAAA,YACrD,gHACE,OAAOL,KAAgB,aAAa,CAACA,KAAeK;AAAA,UAAA;AAAA,UAExD;AAAA,UACAR;AAAA,QAAA;AAAA,QAEF,KAAAO;AAAA,QACC,GAAGD;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAG,EAAC,QAAA,EAAK,WAAU,6DACb,UAAA;AAAA,YAAAJ;AAAA,YACAD,KAAY,gBAAAQ,EAAC,QAAA,EAAK,WAAU,qBAAoB,UAAA,IAAA,CAAC;AAAA,UAAA,GACpD;AAAA,UAECX,uBACEY,GAAA,EAAQ,SAASZ,GAChB,UAAA,gBAAAW,EAACE,GAAA,EAAK,WAAU,8CAAA,CAA8C,EAAA,CAChE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAhB,EAAc,cAAc;"}
@@ -1,60 +1,61 @@
1
- import { jsx as n, jsxs as m } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as c } from "react/jsx-runtime";
2
2
  import s from "react";
3
- import { Input as K } from "../../packages/ui/src/components/input.js";
3
+ import { Input as Q } from "../../packages/ui/src/components/input.js";
4
4
  import { cn as l } from "../../packages/ui/src/lib/utils.js";
5
- import { FloatingLabel as O } from "../FloatLabel.js";
6
- import { Info as Q, ChevronUp as W, ChevronDown as Y, X as Z, EyeOff as T, Eye as F } from "lucide-react";
7
- import { withMask as L } from "use-mask-input";
8
- import { Tooltip as ee } from "../Tooltip/Tooltip.js";
9
- import { Label as te } from "../../packages/ui/src/components/label.js";
10
- const ne = s.forwardRef(
5
+ import { FloatingLabel as W } from "../FloatLabel.js";
6
+ import { Info as Y, ChevronUp as Z, ChevronDown as T, X as q, EyeOff as F, Eye as L } from "lucide-react";
7
+ import { withMask as ee } from "use-mask-input";
8
+ import { Tooltip as te } from "../Tooltip/Tooltip.js";
9
+ import { Label as ne } from "../../packages/ui/src/components/label.js";
10
+ const re = s.forwardRef(
11
11
  ({
12
- className: D,
12
+ className: _,
13
13
  label: x,
14
14
  helperText: v,
15
15
  state: N,
16
16
  size: i,
17
- isFloatLabel: c,
17
+ isFloatLabel: d,
18
18
  type: a,
19
- mask: h,
20
- maskOptions: E,
19
+ mask: g,
20
+ maskOptions: P,
21
21
  maxLength: b,
22
- showCharCount: P,
22
+ showCharCount: V,
23
23
  infoTooltip: w,
24
24
  clearable: p,
25
- onClear: V,
25
+ onClear: I,
26
26
  prefixIcon: u,
27
27
  suffixIcon: o,
28
- placeholder: _ = " ",
28
+ placeholder: B = " ",
29
+ required: C,
29
30
  ...e
30
- }, B) => {
31
- const [f, I] = s.useState(() => typeof e.value == "string" ? e.value.length : typeof e.defaultValue == "string" ? e.defaultValue.length : 0), H = (t) => {
32
- I(t.target.value.length), e.onChange && e.onChange(t);
33
- }, U = () => {
31
+ }, H) => {
32
+ const [f, M] = s.useState(() => typeof e.value == "string" ? e.value.length : typeof e.defaultValue == "string" ? e.defaultValue.length : 0), U = (t) => {
33
+ M(t.target.value.length), e.onChange && e.onChange(t);
34
+ }, X = () => {
34
35
  if (r.current) {
35
- r.current.value = "", I(0);
36
+ r.current.value = "", M(0);
36
37
  const t = {
37
38
  target: r.current,
38
39
  currentTarget: r.current
39
40
  };
40
- e.onChange?.(t), V && V();
41
+ e.onChange?.(t), I && I();
41
42
  }
42
- }, C = s.useId(), r = s.useRef(null), X = s.useCallback(
43
+ }, y = s.useId(), r = s.useRef(null), $ = s.useCallback(
43
44
  (t) => {
44
- if (r && (r.current = t), h && t) {
45
- const d = L(h, E);
46
- typeof d == "function" && d(t);
45
+ if (r && (r.current = t), g && t) {
46
+ const m = ee(g, P);
47
+ typeof m == "function" && m(t);
47
48
  }
48
49
  },
49
- [h, E]
50
+ [g, P]
50
51
  );
51
- s.useImperativeHandle(B, () => r.current);
52
- const [M, $] = s.useState(!1), q = {
52
+ s.useImperativeHandle(H, () => r.current);
53
+ const [R, A] = s.useState(!1), G = {
53
54
  default: "text-muted-foreground",
54
55
  success: "text-success",
55
56
  warning: "text-warning",
56
57
  error: "text-error"
57
- }, y = c ? i === "xl" || i === "lg" ? i : "xl" : i || "normal", R = (() => {
58
+ }, z = d ? i === "xl" || i === "lg" ? i : "xl" : i || "normal", k = (() => {
58
59
  const t = {
59
60
  xs: { prefix: "pl-8", suffix: "pr-8" },
60
61
  sm: { prefix: "pl-9", suffix: "pr-9" },
@@ -62,17 +63,17 @@ const ne = s.forwardRef(
62
63
  lg: { prefix: "pl-11", suffix: "pr-11" },
63
64
  xl: { prefix: "pl-12", suffix: "pr-12" }
64
65
  };
65
- return t[y] || t.normal;
66
- })(), k = {
66
+ return t[z] || t.normal;
67
+ })(), j = {
67
68
  xs: "size-3",
68
69
  sm: "size-3.5",
69
70
  normal: "size-4",
70
71
  lg: "size-4",
71
72
  xl: "size-4"
72
- }[y] || "size-4", A = () => {
73
+ }[z] || "size-4", J = () => {
73
74
  const t = a === "number" || a === "password" || a === "datetime" || p && (f > 0 || e?.value);
74
- return t && o ? a === "password" && p && (f > 0 || e?.value) ? "pr-20" : "pr-16" : t ? a === "password" && p && (f > 0 || e?.value) ? "pr-16" : "pr-10" : o ? R.suffix : "";
75
- }, j = (() => {
75
+ return t && o ? a === "password" && p && (f > 0 || e?.value) ? "pr-20" : "pr-16" : t ? a === "password" && p && (f > 0 || e?.value) ? "pr-16" : "pr-10" : o ? k.suffix : "";
76
+ }, D = (() => {
76
77
  const t = {
77
78
  xs: { left: "left-2.5", right: "right-2.5" },
78
79
  sm: { left: "left-3", right: "right-3" },
@@ -80,118 +81,123 @@ const ne = s.forwardRef(
80
81
  lg: { left: "left-3.5", right: "right-3.5" },
81
82
  xl: { left: "left-4", right: "right-4" }
82
83
  };
83
- return t[y] || t.normal;
84
- })(), G = () => {
84
+ return t[z] || t.normal;
85
+ })(), K = () => {
85
86
  if (r.current) {
86
- const t = Number(e.step || 1), d = e.max ? Number(e.max) : 1 / 0, z = Number(r.current.value || 0), S = Math.min(z + t, d);
87
- r.current.value = String(S);
88
- const g = new Event("input", { bubbles: !0 });
89
- r.current.dispatchEvent(g), e.onChange?.(g);
87
+ const t = Number(e.step || 1), m = e.max ? Number(e.max) : 1 / 0, S = Number(r.current.value || 0), E = Math.min(S + t, m);
88
+ r.current.value = String(E);
89
+ const h = new Event("input", { bubbles: !0 });
90
+ r.current.dispatchEvent(h), e.onChange?.(h);
90
91
  }
91
- }, J = () => {
92
+ }, O = () => {
92
93
  if (r.current) {
93
- const t = Number(e.step || 1), d = e.min ? Number(e.min) : -1 / 0, z = Number(r.current.value || 0), S = Math.max(z - t, d);
94
- r.current.value = String(S);
95
- const g = new Event("input", { bubbles: !0 });
96
- r.current.dispatchEvent(g), e.onChange?.(g);
94
+ const t = Number(e.step || 1), m = e.min ? Number(e.min) : -1 / 0, S = Number(r.current.value || 0), E = Math.max(S - t, m);
95
+ r.current.value = String(E);
96
+ const h = new Event("input", { bubbles: !0 });
97
+ r.current.dispatchEvent(h), e.onChange?.(h);
97
98
  }
98
99
  };
99
- return /* @__PURE__ */ n("div", { className: D, children: /* @__PURE__ */ m(
100
+ return /* @__PURE__ */ n("div", { className: _, children: /* @__PURE__ */ c(
100
101
  "div",
101
102
  {
102
103
  className: l("flex flex-col gap-1.5 relative flex-auto", {
103
- "floating-label relative": c
104
+ "floating-label relative": d
104
105
  }),
105
106
  children: [
106
- !c && x && /* @__PURE__ */ m(
107
- te,
107
+ !d && x && /* @__PURE__ */ c(
108
+ ne,
108
109
  {
109
- htmlFor: C,
110
+ htmlFor: y,
110
111
  className: "flex gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
111
112
  children: [
112
- x,
113
- w && /* @__PURE__ */ n(ee, { content: w, children: /* @__PURE__ */ n(Q, { className: "size-3.5 min-w-3.5" }) })
113
+ /* @__PURE__ */ c("span", { children: [
114
+ x,
115
+ C && /* @__PURE__ */ n("span", { className: "text-error ml-0.5", children: "*" })
116
+ ] }),
117
+ w && /* @__PURE__ */ n(te, { content: w, children: /* @__PURE__ */ n(Y, { className: "size-3.5 min-w-3.5" }) })
114
118
  ]
115
119
  }
116
120
  ),
117
- /* @__PURE__ */ m("div", { className: "relative", children: [
121
+ /* @__PURE__ */ c("div", { className: "relative", children: [
118
122
  u && /* @__PURE__ */ n(
119
123
  "div",
120
124
  {
121
125
  className: l(
122
126
  "absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0",
123
- j.left
127
+ D.left
124
128
  ),
125
129
  children: s.isValidElement(u) ? s.cloneElement(u, {
126
130
  className: l(
127
- k,
131
+ j,
128
132
  u.props?.className
129
133
  )
130
134
  }) : u
131
135
  }
132
136
  ),
133
137
  /* @__PURE__ */ n(
134
- K,
138
+ Q,
135
139
  {
136
- ref: X,
137
- id: C,
140
+ ref: $,
141
+ id: y,
138
142
  className: l(
139
143
  "peer",
140
144
  {
141
- "pt-5 pb-1": c && i !== "lg",
145
+ "pt-5 pb-1": d && i !== "lg",
142
146
  "[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield] pr-8": a === "number"
143
147
  // "[-webkit-text-fill-color:var(--foreground)]": mask,
144
148
  },
145
- u && R.prefix,
146
- h && "placeholder:text-slate-400 placeholder:opacity-100",
147
- A()
149
+ u && k.prefix,
150
+ g && "placeholder:text-slate-400 placeholder:opacity-100",
151
+ J()
148
152
  // className,
149
153
  ),
150
154
  state: N,
151
- size: c ? i === "xl" || i === "lg" ? i : "xl" : i,
152
- type: a === "password" ? M ? "text" : "password" : a,
153
- placeholder: _,
155
+ size: d ? i === "xl" || i === "lg" ? i : "xl" : i,
156
+ type: a === "password" ? R ? "text" : "password" : a,
157
+ placeholder: B,
154
158
  maxLength: b,
155
- onChange: H,
159
+ onChange: U,
160
+ required: C,
156
161
  ...e
157
162
  }
158
163
  ),
159
- c && /* @__PURE__ */ n(
160
- O,
164
+ d && /* @__PURE__ */ n(
165
+ W,
161
166
  {
162
- htmlFor: C,
167
+ htmlFor: y,
163
168
  size: i,
164
169
  infoTooltip: w,
170
+ required: C,
165
171
  children: x
166
172
  }
167
173
  ),
168
- a === "number" && /* @__PURE__ */ m("div", { className: "absolute right-1 top-0 h-full flex flex-col gap-0.5", children: [
174
+ a === "number" && /* @__PURE__ */ c("div", { className: "absolute right-1 top-0 h-full flex flex-col gap-0.5", children: [
169
175
  /* @__PURE__ */ n(
170
176
  "button",
171
177
  {
172
178
  type: "button",
173
- onClick: G,
179
+ onClick: K,
174
180
  disabled: e.disabled,
175
181
  className: l(
176
182
  "h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform",
177
183
  "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"
178
184
  ),
179
185
  tabIndex: -1,
180
- children: /* @__PURE__ */ n(W, { className: "size-3" })
186
+ children: /* @__PURE__ */ n(Z, { className: "size-3" })
181
187
  }
182
188
  ),
183
189
  /* @__PURE__ */ n(
184
190
  "button",
185
191
  {
186
192
  type: "button",
187
- onClick: J,
193
+ onClick: O,
188
194
  disabled: e.disabled,
189
195
  className: l(
190
196
  "h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform",
191
197
  "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"
192
198
  ),
193
199
  tabIndex: -1,
194
- children: /* @__PURE__ */ n(Y, { className: "size-3" })
200
+ children: /* @__PURE__ */ n(T, { className: "size-3" })
195
201
  }
196
202
  )
197
203
  ] }),
@@ -204,9 +210,9 @@ const ne = s.forwardRef(
204
210
  "absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors cursor-pointer",
205
211
  a === "password" ? o ? "right-14" : "right-10" : o ? "right-10" : "right-2"
206
212
  ),
207
- onClick: U,
213
+ onClick: X,
208
214
  disabled: e.disabled,
209
- children: /* @__PURE__ */ n(Z, { className: "size-4" })
215
+ children: /* @__PURE__ */ n(q, { className: "size-4" })
210
216
  }
211
217
  ),
212
218
  a === "password" && /* @__PURE__ */ n(
@@ -218,9 +224,9 @@ const ne = s.forwardRef(
218
224
  "absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors",
219
225
  o ? "right-10" : "right-2"
220
226
  ),
221
- onClick: () => $((t) => !t),
227
+ onClick: () => A((t) => !t),
222
228
  disabled: e.disabled,
223
- children: M ? /* @__PURE__ */ n(T, { className: "size-4" }) : /* @__PURE__ */ n(F, { className: "size-4" })
229
+ children: R ? /* @__PURE__ */ n(F, { className: "size-4" }) : /* @__PURE__ */ n(L, { className: "size-4" })
224
230
  }
225
231
  ),
226
232
  o && /* @__PURE__ */ n(
@@ -228,29 +234,29 @@ const ne = s.forwardRef(
228
234
  {
229
235
  className: l(
230
236
  "absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0",
231
- j.right
237
+ D.right
232
238
  ),
233
239
  children: s.isValidElement(o) ? s.cloneElement(o, {
234
240
  className: l(
235
- k,
241
+ j,
236
242
  o.props?.className
237
243
  )
238
244
  }) : o
239
245
  }
240
246
  )
241
247
  ] }),
242
- (v || P && typeof b == "number") && /* @__PURE__ */ m("div", { className: "flex items-center justify-between text-xs gap-2", children: [
248
+ (v || V && typeof b == "number") && /* @__PURE__ */ c("div", { className: "flex items-center justify-between text-xs gap-2", children: [
243
249
  v && /* @__PURE__ */ n(
244
250
  "p",
245
251
  {
246
252
  className: l(
247
253
  "text-xs",
248
- N ? q?.[N] : ""
254
+ N ? G?.[N] : ""
249
255
  ),
250
256
  children: v
251
257
  }
252
258
  ),
253
- P && typeof b == "number" && /* @__PURE__ */ m("span", { className: "ml-auto text-muted-foreground", children: [
259
+ V && typeof b == "number" && /* @__PURE__ */ c("span", { className: "ml-auto text-muted-foreground", children: [
254
260
  f,
255
261
  " / ",
256
262
  b
@@ -261,8 +267,8 @@ const ne = s.forwardRef(
261
267
  ) });
262
268
  }
263
269
  );
264
- ne.displayName = "Input";
270
+ re.displayName = "Input";
265
271
  export {
266
- ne as default
272
+ re as default
267
273
  };
268
274
  //# sourceMappingURL=Input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { type ChangeEvent } from \"react\";\nimport {\n Input as SInput,\n type InputProps as SInputProps,\n} from \"@dsui/ui/components/input\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\nimport { Eye, EyeOff, ChevronDown, ChevronUp, Info, X } from \"lucide-react\";\nimport { withMask, type Options } from \"use-mask-input\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { Label } from \"../Label\";\n\n// Re-export base input props to avoid external dependency issues\nexport type BaseInputProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n size?: \"normal\" | \"sm\" | \"xs\" | \"lg\" | \"xl\";\n state?: \"default\" | \"success\" | \"error\" | \"warning\";\n};\n\nexport type InputProps = BaseInputProps & {\n label?: string;\n helperText?: React.ReactNode;\n isFloatLabel?: boolean;\n mask?: string;\n maskOptions?: {\n placeholder?: string;\n inputFormat?: string;\n outputFormat?: string;\n showMaskOnHover?: boolean;\n showMaskOnFocus?: boolean;\n separate?: boolean;\n } & Options;\n maxLength?: number;\n showCharCount?: boolean;\n infoTooltip?: React.ReactNode;\n clearable?: boolean;\n onClear?: () => void;\n prefixIcon?: React.ReactNode;\n suffixIcon?: React.ReactNode;\n};\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n label,\n helperText,\n state,\n size,\n isFloatLabel,\n type,\n mask,\n maskOptions,\n maxLength,\n showCharCount,\n infoTooltip,\n clearable,\n onClear,\n prefixIcon,\n suffixIcon,\n placeholder = \" \",\n ...props\n },\n ref\n ) => {\n // Character count state\n const [charCount, setCharCount] = React.useState(() => {\n if (typeof props.value === \"string\") return props.value.length;\n if (typeof props.defaultValue === \"string\")\n return props.defaultValue.length;\n return 0;\n });\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n setCharCount(e.target.value.length);\n if (props.onChange) props.onChange(e);\n };\n\n const handleClear = () => {\n if (innerRef.current) {\n innerRef.current.value = \"\";\n setCharCount(0);\n const event = {\n target: innerRef.current,\n currentTarget: innerRef.current,\n } as React.ChangeEvent<HTMLInputElement>;\n props.onChange?.(event);\n if (onClear) onClear();\n }\n };\n\n const inputId = React.useId();\n const innerRef = React.useRef<HTMLInputElement>(null);\n\n // Combine refs\n const combinedRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n // Set innerRef\n if (innerRef) {\n (\n innerRef as React.MutableRefObject<HTMLInputElement | null>\n ).current = element;\n }\n\n // Apply mask if provided\n if (mask && element) {\n const maskRefCallback = withMask(mask, maskOptions);\n if (typeof maskRefCallback === \"function\") {\n maskRefCallback(element);\n }\n }\n },\n [mask, maskOptions]\n );\n\n // Expose ref to parent\n React.useImperativeHandle(ref, () => innerRef.current!);\n\n const [showPassword, setShowPassword] = React.useState(false);\n\n // State\n const helperTextStyles = {\n default: \"text-muted-foreground\",\n success: \"text-success\",\n warning: \"text-warning\",\n error: \"text-error\",\n };\n\n // Calculate current size\n const currentSize = isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size || \"normal\";\n\n // Calculate padding based on size and icons\n const getPadding = () => {\n const sizeMap = {\n xs: { prefix: \"pl-8\", suffix: \"pr-8\" },\n sm: { prefix: \"pl-9\", suffix: \"pr-9\" },\n normal: { prefix: \"pl-10\", suffix: \"pr-10\" },\n lg: { prefix: \"pl-11\", suffix: \"pr-11\" },\n xl: { prefix: \"pl-12\", suffix: \"pr-12\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const padding = getPadding();\n\n // Get icon size class based on current size\n const getIconSizeClass = () => {\n const sizeMap = {\n xs: \"size-3\",\n sm: \"size-3.5\",\n normal: \"size-4\",\n lg: \"size-4\",\n xl: \"size-4\",\n };\n return sizeMap[currentSize as keyof typeof sizeMap] || \"size-4\";\n };\n\n const iconSizeClass = getIconSizeClass();\n\n // Calculate right padding considering built-in icons\n const getRightPadding = () => {\n const hasBuiltInSuffix =\n type === \"number\" ||\n type === \"password\" ||\n type === \"datetime\" ||\n (clearable && (charCount > 0 || props?.value));\n\n if (hasBuiltInSuffix && suffixIcon) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-20\" // password + clear + custom icon\n : \"pr-16\"; // one built-in + custom icon\n }\n\n if (hasBuiltInSuffix) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-16\" // password + clear\n : \"pr-10\"; // single built-in icon\n }\n\n if (suffixIcon) {\n return padding.suffix;\n }\n\n return \"\";\n };\n\n // Icon position calculations\n const getIconPosition = () => {\n const sizeMap = {\n xs: { left: \"left-2.5\", right: \"right-2.5\" },\n sm: { left: \"left-3\", right: \"right-3\" },\n normal: { left: \"left-3\", right: \"right-3\" },\n lg: { left: \"left-3.5\", right: \"right-3.5\" },\n xl: { left: \"left-4\", right: \"right-4\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const iconPosition = getIconPosition();\n\n /* Spinner Button Handlers */\n const handleIncrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const max = props.max ? Number(props.max) : Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.min(currentValue + step, max);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n\n const handleDecrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const min = props.min ? Number(props.min) : -Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.max(currentValue - step, min);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n /* End Spinner Button Handlers */\n\n return (\n <div className={className}>\n <div\n className={cn(\"flex flex-col gap-1.5 relative flex-auto\", {\n \"floating-label relative\": isFloatLabel,\n })}\n >\n {!isFloatLabel && label && (\n <Label\n htmlFor={inputId}\n className=\"flex gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"size-3.5 min-w-3.5\" />\n </Tooltip>\n )}\n </Label>\n )}\n\n <div className=\"relative\">\n {/* Prefix Icon */}\n {prefixIcon && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0\",\n iconPosition.left\n )}\n >\n {React.isValidElement(prefixIcon)\n ? React.cloneElement(prefixIcon, {\n className: cn(\n iconSizeClass,\n (prefixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : prefixIcon}\n </div>\n )}\n\n <SInput\n ref={combinedRef}\n id={inputId}\n className={cn(\n \"peer\",\n {\n \"pt-5 pb-1\": isFloatLabel && size !== \"lg\",\n \"[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield] pr-8\":\n type === \"number\",\n // \"[-webkit-text-fill-color:var(--foreground)]\": mask,\n },\n prefixIcon && padding.prefix,\n mask && \"placeholder:text-slate-400 placeholder:opacity-100\",\n getRightPadding()\n // className,\n )}\n state={state}\n size={\n isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size\n }\n type={\n type === \"password\"\n ? showPassword\n ? \"text\"\n : \"password\"\n : type\n }\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={handleInput}\n {...props}\n />\n {isFloatLabel && (\n <FloatingLabel\n htmlFor={inputId}\n size={size}\n infoTooltip={infoTooltip}\n >\n {label}\n </FloatingLabel>\n )}\n\n {/* Spinner Buttons */}\n {type === \"number\" && (\n <div className=\"absolute right-1 top-0 h-full flex flex-col gap-0.5\">\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={props.disabled}\n className={cn(\n \"h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform\",\n \"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronUp className=\"size-3\" />\n </button>\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={props.disabled}\n className={cn(\n \"h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform\",\n \"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronDown className=\"size-3\" />\n </button>\n </div>\n )}\n\n {/* Clear Button */}\n {clearable &&\n (charCount > 0 || props?.value) &&\n !props.disabled &&\n type !== \"number\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors cursor-pointer\",\n type === \"password\"\n ? suffixIcon\n ? \"right-14\"\n : \"right-10\"\n : suffixIcon\n ? \"right-10\"\n : \"right-2\"\n )}\n onClick={handleClear}\n disabled={props.disabled}\n >\n <X className=\"size-4\" />\n </button>\n )}\n\n {/* Show/Hide Password Button */}\n {type === \"password\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors\",\n suffixIcon ? \"right-10\" : \"right-2\"\n )}\n onClick={() => setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n <EyeOff className=\"size-4\" />\n ) : (\n <Eye className=\"size-4\" />\n )}\n </button>\n )}\n\n {/* Suffix Icon */}\n {suffixIcon && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0\",\n iconPosition.right\n )}\n >\n {React.isValidElement(suffixIcon)\n ? React.cloneElement(suffixIcon, {\n className: cn(\n iconSizeClass,\n (suffixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : suffixIcon}\n </div>\n )}\n </div>\n\n {(helperText || (showCharCount && typeof maxLength === \"number\")) && (\n <div className=\"flex items-center justify-between text-xs gap-2\">\n {helperText && (\n <p\n className={cn(\n \"text-xs\",\n state ? helperTextStyles?.[state] : \"\"\n )}\n >\n {helperText}\n </p>\n )}\n {showCharCount && typeof maxLength === \"number\" && (\n <span className=\"ml-auto text-muted-foreground\">\n {charCount} / {maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nInput.displayName = \"Input\";\nexport default Input;\n"],"names":["Input","React","className","label","helperText","state","size","isFloatLabel","type","mask","maskOptions","maxLength","showCharCount","infoTooltip","clearable","onClear","prefixIcon","suffixIcon","placeholder","props","ref","charCount","setCharCount","handleInput","e","handleClear","innerRef","event","inputId","combinedRef","element","maskRefCallback","withMask","showPassword","setShowPassword","helperTextStyles","currentSize","padding","sizeMap","iconSizeClass","getRightPadding","hasBuiltInSuffix","iconPosition","handleIncrement","step","max","currentValue","newValue","handleDecrement","min","jsx","jsxs","cn","Label","Tooltip","Info","SInput","FloatingLabel","ChevronUp","ChevronDown","X","prev","EyeOff","Eye"],"mappings":";;;;;;;;;AAwCA,MAAMA,KAAQC,EAAM;AAAA,EAClB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,GAAGC;AAAA,EAAA,GAELC,MACG;AAEH,UAAM,CAACC,GAAWC,CAAY,IAAIrB,EAAM,SAAS,MAC3C,OAAOkB,EAAM,SAAU,WAAiBA,EAAM,MAAM,SACpD,OAAOA,EAAM,gBAAiB,WACzBA,EAAM,aAAa,SACrB,CACR,GAEKI,IAAc,CAACC,MAA2C;AAC9D,MAAAF,EAAaE,EAAE,OAAO,MAAM,MAAM,GAC9BL,EAAM,YAAUA,EAAM,SAASK,CAAC;AAAA,IACtC,GAEMC,IAAc,MAAM;AACxB,UAAIC,EAAS,SAAS;AACpB,QAAAA,EAAS,QAAQ,QAAQ,IACzBJ,EAAa,CAAC;AACd,cAAMK,IAAQ;AAAA,UACZ,QAAQ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AAA8C;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWE;AAAA,kBACT;AAAA,kBACA/C,IAAQ8B,IAAmB9B,CAAK,IAAI;AAAA,gBAAA;AAAA,gBAGrC,UAAAD;AAAA,cAAA;AAAA,YAAA;AAAA,YAGJQ,KAAiB,OAAOD,KAAc,YACrC,gBAAAwC,EAAC,QAAA,EAAK,WAAU,iCACb,UAAA;AAAA,cAAA9B;AAAA,cAAU;AAAA,cAAIV;AAAA,YAAA,EAAA,CACjB;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAGN;AAAA,EAEJ;AACF;AAEAX,GAAM,cAAc;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { type ChangeEvent } from \"react\";\nimport {\n Input as SInput,\n type InputProps as SInputProps,\n} from \"@dsui/ui/components/input\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\nimport { Eye, EyeOff, ChevronDown, ChevronUp, Info, X } from \"lucide-react\";\nimport { withMask, type Options } from \"use-mask-input\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { Label } from \"../Label\";\n\n// Re-export base input props to avoid external dependency issues\nexport type BaseInputProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n size?: \"normal\" | \"sm\" | \"xs\" | \"lg\" | \"xl\";\n state?: \"default\" | \"success\" | \"error\" | \"warning\";\n};\n\nexport type InputProps = BaseInputProps & {\n label?: string;\n helperText?: React.ReactNode;\n isFloatLabel?: boolean;\n mask?: string;\n maskOptions?: {\n placeholder?: string;\n inputFormat?: string;\n outputFormat?: string;\n showMaskOnHover?: boolean;\n showMaskOnFocus?: boolean;\n separate?: boolean;\n } & Options;\n maxLength?: number;\n showCharCount?: boolean;\n infoTooltip?: React.ReactNode;\n clearable?: boolean;\n onClear?: () => void;\n prefixIcon?: React.ReactNode;\n suffixIcon?: React.ReactNode;\n required?: boolean;\n};\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n label,\n helperText,\n state,\n size,\n isFloatLabel,\n type,\n mask,\n maskOptions,\n maxLength,\n showCharCount,\n infoTooltip,\n clearable,\n onClear,\n prefixIcon,\n suffixIcon,\n placeholder = \" \",\n required,\n ...props\n },\n ref\n ) => {\n // Character count state\n const [charCount, setCharCount] = React.useState(() => {\n if (typeof props.value === \"string\") return props.value.length;\n if (typeof props.defaultValue === \"string\")\n return props.defaultValue.length;\n return 0;\n });\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n setCharCount(e.target.value.length);\n if (props.onChange) props.onChange(e);\n };\n\n const handleClear = () => {\n if (innerRef.current) {\n innerRef.current.value = \"\";\n setCharCount(0);\n const event = {\n target: innerRef.current,\n currentTarget: innerRef.current,\n } as React.ChangeEvent<HTMLInputElement>;\n props.onChange?.(event);\n if (onClear) onClear();\n }\n };\n\n const inputId = React.useId();\n const innerRef = React.useRef<HTMLInputElement>(null);\n\n // Combine refs\n const combinedRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n // Set innerRef\n if (innerRef) {\n (\n innerRef as React.MutableRefObject<HTMLInputElement | null>\n ).current = element;\n }\n\n // Apply mask if provided\n if (mask && element) {\n const maskRefCallback = withMask(mask, maskOptions);\n if (typeof maskRefCallback === \"function\") {\n maskRefCallback(element);\n }\n }\n },\n [mask, maskOptions]\n );\n\n // Expose ref to parent\n React.useImperativeHandle(ref, () => innerRef.current!);\n\n const [showPassword, setShowPassword] = React.useState(false);\n\n // State\n const helperTextStyles = {\n default: \"text-muted-foreground\",\n success: \"text-success\",\n warning: \"text-warning\",\n error: \"text-error\",\n };\n\n // Calculate current size\n const currentSize = isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size || \"normal\";\n\n // Calculate padding based on size and icons\n const getPadding = () => {\n const sizeMap = {\n xs: { prefix: \"pl-8\", suffix: \"pr-8\" },\n sm: { prefix: \"pl-9\", suffix: \"pr-9\" },\n normal: { prefix: \"pl-10\", suffix: \"pr-10\" },\n lg: { prefix: \"pl-11\", suffix: \"pr-11\" },\n xl: { prefix: \"pl-12\", suffix: \"pr-12\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const padding = getPadding();\n\n // Get icon size class based on current size\n const getIconSizeClass = () => {\n const sizeMap = {\n xs: \"size-3\",\n sm: \"size-3.5\",\n normal: \"size-4\",\n lg: \"size-4\",\n xl: \"size-4\",\n };\n return sizeMap[currentSize as keyof typeof sizeMap] || \"size-4\";\n };\n\n const iconSizeClass = getIconSizeClass();\n\n // Calculate right padding considering built-in icons\n const getRightPadding = () => {\n const hasBuiltInSuffix =\n type === \"number\" ||\n type === \"password\" ||\n type === \"datetime\" ||\n (clearable && (charCount > 0 || props?.value));\n\n if (hasBuiltInSuffix && suffixIcon) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-20\" // password + clear + custom icon\n : \"pr-16\"; // one built-in + custom icon\n }\n\n if (hasBuiltInSuffix) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"pr-16\" // password + clear\n : \"pr-10\"; // single built-in icon\n }\n\n if (suffixIcon) {\n return padding.suffix;\n }\n\n return \"\";\n };\n\n // Icon position calculations\n const getIconPosition = () => {\n const sizeMap = {\n xs: { left: \"left-2.5\", right: \"right-2.5\" },\n sm: { left: \"left-3\", right: \"right-3\" },\n normal: { left: \"left-3\", right: \"right-3\" },\n lg: { left: \"left-3.5\", right: \"right-3.5\" },\n xl: { left: \"left-4\", right: \"right-4\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const iconPosition = getIconPosition();\n\n /* Spinner Button Handlers */\n const handleIncrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const max = props.max ? Number(props.max) : Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.min(currentValue + step, max);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n\n const handleDecrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const min = props.min ? Number(props.min) : -Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.max(currentValue - step, min);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n /* End Spinner Button Handlers */\n\n return (\n <div className={className}>\n <div\n className={cn(\"flex flex-col gap-1.5 relative flex-auto\", {\n \"floating-label relative\": isFloatLabel,\n })}\n >\n {!isFloatLabel && label && (\n <Label\n htmlFor={inputId}\n className=\"flex gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n <span>\n {label}\n {required && <span className=\"text-error ml-0.5\">*</span>}\n </span>\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"size-3.5 min-w-3.5\" />\n </Tooltip>\n )}\n </Label>\n )}\n\n <div className=\"relative\">\n {/* Prefix Icon */}\n {prefixIcon && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0\",\n iconPosition.left\n )}\n >\n {React.isValidElement(prefixIcon)\n ? React.cloneElement(prefixIcon, {\n className: cn(\n iconSizeClass,\n (prefixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : prefixIcon}\n </div>\n )}\n\n <SInput\n ref={combinedRef}\n id={inputId}\n className={cn(\n \"peer\",\n {\n \"pt-5 pb-1\": isFloatLabel && size !== \"lg\",\n \"[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield] pr-8\":\n type === \"number\",\n // \"[-webkit-text-fill-color:var(--foreground)]\": mask,\n },\n prefixIcon && padding.prefix,\n mask && \"placeholder:text-slate-400 placeholder:opacity-100\",\n getRightPadding()\n // className,\n )}\n state={state}\n size={\n isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size\n }\n type={\n type === \"password\"\n ? showPassword\n ? \"text\"\n : \"password\"\n : type\n }\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={handleInput}\n required={required}\n {...props}\n />\n {isFloatLabel && (\n <FloatingLabel\n htmlFor={inputId}\n size={size}\n infoTooltip={infoTooltip}\n required={required}\n >\n {label}\n </FloatingLabel>\n )}\n\n {/* Spinner Buttons */}\n {type === \"number\" && (\n <div className=\"absolute right-1 top-0 h-full flex flex-col gap-0.5\">\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={props.disabled}\n className={cn(\n \"h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform\",\n \"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronUp className=\"size-3\" />\n </button>\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={props.disabled}\n className={cn(\n \"h-1/2 w-6 flex items-center justify-center rounded cursor-pointer hover:scale-150 transition-transform\",\n \"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronDown className=\"size-3\" />\n </button>\n </div>\n )}\n\n {/* Clear Button */}\n {clearable &&\n (charCount > 0 || props?.value) &&\n !props.disabled &&\n type !== \"number\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors cursor-pointer\",\n type === \"password\"\n ? suffixIcon\n ? \"right-14\"\n : \"right-10\"\n : suffixIcon\n ? \"right-10\"\n : \"right-2\"\n )}\n onClick={handleClear}\n disabled={props.disabled}\n >\n <X className=\"size-4\" />\n </button>\n )}\n\n {/* Show/Hide Password Button */}\n {type === \"password\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 p-1 rounded hover:bg-accent transition-colors\",\n suffixIcon ? \"right-10\" : \"right-2\"\n )}\n onClick={() => setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n <EyeOff className=\"size-4\" />\n ) : (\n <Eye className=\"size-4\" />\n )}\n </button>\n )}\n\n {/* Suffix Icon */}\n {suffixIcon && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground leading-0\",\n iconPosition.right\n )}\n >\n {React.isValidElement(suffixIcon)\n ? React.cloneElement(suffixIcon, {\n className: cn(\n iconSizeClass,\n (suffixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : suffixIcon}\n </div>\n )}\n </div>\n\n {(helperText || (showCharCount && typeof maxLength === \"number\")) && (\n <div className=\"flex items-center justify-between text-xs gap-2\">\n {helperText && (\n <p\n className={cn(\n \"text-xs\",\n state ? helperTextStyles?.[state] : \"\"\n )}\n >\n {helperText}\n </p>\n )}\n {showCharCount && typeof maxLength === \"number\" && (\n <span className=\"ml-auto text-muted-foreground\">\n {charCount} / {maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nInput.displayName = \"Input\";\nexport default Input;\n"],"names":["Input","React","className","label","helperText","state","size","isFloatLabel","type","mask","maskOptions","maxLength","showCharCount","infoTooltip","clearable","onClear","prefixIcon","suffixIcon","placeholder","required","props","ref","charCount","setCharCount","handleInput","e","handleClear","innerRef","event","inputId","combinedRef","element","maskRefCallback","withMask","showPassword","setShowPassword","helperTextStyles","currentSize","padding","sizeMap","iconSizeClass","getRightPadding","hasBuiltInSuffix","iconPosition","handleIncrement","step","max","currentValue","newValue","handleDecrement","min","jsx","jsxs","cn","Label","Tooltip","Info","SInput","FloatingLabel","ChevronUp","ChevronDown","X","prev","EyeOff","Eye"],"mappings":";;;;;;;;;AAyCA,MAAMA,KAAQC,EAAM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