@vritti/quantum-ui 0.1.11 → 0.1.12

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 (53) hide show
  1. package/dist/Button.js +3 -43
  2. package/dist/Button.js.map +1 -1
  3. package/dist/Checkbox.d.ts +10 -1
  4. package/dist/Checkbox.js +35 -7
  5. package/dist/Checkbox.js.map +1 -1
  6. package/dist/Form.d.ts +21 -0
  7. package/dist/Form.js +662 -0
  8. package/dist/Form.js.map +1 -0
  9. package/dist/OTPField.d.ts +3 -3
  10. package/dist/OTPField.js +135 -0
  11. package/dist/OTPField.js.map +1 -0
  12. package/dist/PasswordField.d.ts +3 -3
  13. package/dist/PasswordField.js +63 -57
  14. package/dist/PasswordField.js.map +1 -1
  15. package/dist/PhoneField.d.ts +3 -3
  16. package/dist/PhoneField.js +55 -58
  17. package/dist/PhoneField.js.map +1 -1
  18. package/dist/TextArea.d.ts +11 -0
  19. package/dist/TextArea.js +54 -0
  20. package/dist/TextArea.js.map +1 -0
  21. package/dist/TextField.d.ts +3 -3
  22. package/dist/TextField.js +26 -39
  23. package/dist/TextField.js.map +1 -1
  24. package/dist/assets/quantum-ui.css +8 -0
  25. package/dist/components/Form.d.ts +2 -0
  26. package/dist/components/Form.js +2 -0
  27. package/dist/components/Form.js.map +1 -0
  28. package/dist/components/OTPField.js +1 -134
  29. package/dist/components/OTPField.js.map +1 -1
  30. package/dist/components/Progress.js +2 -2
  31. package/dist/components/TextArea.d.ts +2 -0
  32. package/dist/components/TextArea.js +2 -0
  33. package/dist/components/TextArea.js.map +1 -0
  34. package/dist/field.js +431 -0
  35. package/dist/field.js.map +1 -0
  36. package/dist/index.d.ts +293 -8
  37. package/dist/index.js +4 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/index2.js +116 -54
  40. package/dist/index2.js.map +1 -1
  41. package/dist/index3.js +42 -38
  42. package/dist/index3.js.map +1 -1
  43. package/dist/index4.js +54 -116
  44. package/dist/index4.js.map +1 -1
  45. package/dist/index5.js +41 -0
  46. package/dist/index5.js.map +1 -0
  47. package/dist/shadcn/shadcnField.d.ts +1 -0
  48. package/dist/shadcn/shadcnField.js +2 -0
  49. package/dist/shadcn/shadcnField.js.map +1 -0
  50. package/dist/shadcnField.d.ts +1 -0
  51. package/package.json +20 -3
  52. package/dist/Label.js +0 -40
  53. package/dist/Label.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState } from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import React__default, { useState } from 'react';
3
3
  import { c as cn } from './utils.js';
4
4
  import { T as TextField } from './TextField.js';
5
5
  import { c as createLucideIcon } from './createLucideIcon.js';
@@ -74,65 +74,71 @@ const getPasswordStrength = (password) => {
74
74
  if (/[0-9]/.test(password)) strength += 1;
75
75
  if (/[^A-Za-z0-9]/.test(password)) strength += 1;
76
76
  if (strength < 2) return { label: "Weak", color: "text-destructive", bgColor: "bg-destructive", width: "25%" };
77
- if (strength < 4) return { label: "Fair", color: "text-yellow-500", bgColor: "bg-yellow-500", width: "60%" };
77
+ if (strength < 4) return { label: "Fair", color: "text-warning", bgColor: "bg-warning", width: "60%" };
78
78
  return { label: "Strong", color: "text-success", bgColor: "bg-success", width: "100%" };
79
79
  };
80
- const PasswordField = ({
81
- showStrengthIndicator = false,
82
- showMatchIndicator = false,
83
- matchPassword,
84
- toggleAriaLabel,
85
- value = "",
86
- message,
87
- error,
88
- ...props
89
- }) => {
90
- const [showPassword, setShowPassword] = useState(false);
91
- const togglePasswordVisibility = () => {
92
- setShowPassword(!showPassword);
93
- };
94
- const passwordStrength = getPasswordStrength(String(value));
95
- const passwordsMatch = matchPassword !== void 0 && value !== "" && value === matchPassword;
96
- const enhancedMessage = showStrengthIndicator && value && !error ? /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
97
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-[10px]", children: [
98
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Strength:" }),
99
- /* @__PURE__ */ jsx("span", { className: passwordStrength.color, children: passwordStrength.label })
100
- ] }),
101
- /* @__PURE__ */ jsx("div", { className: "w-full bg-muted rounded-full h-1", children: /* @__PURE__ */ jsx(
102
- "div",
80
+ const PasswordField = React__default.forwardRef(
81
+ ({
82
+ showStrengthIndicator = false,
83
+ showMatchIndicator = false,
84
+ matchPassword,
85
+ toggleAriaLabel,
86
+ value = "",
87
+ description,
88
+ error,
89
+ ...props
90
+ }, ref) => {
91
+ const [showPassword, setShowPassword] = useState(false);
92
+ const togglePasswordVisibility = () => {
93
+ setShowPassword(!showPassword);
94
+ };
95
+ const passwordStrength = getPasswordStrength(String(value));
96
+ const passwordsMatch = matchPassword !== void 0 && value !== "" && value === matchPassword;
97
+ const enhancedDescription = /* @__PURE__ */ jsxs(Fragment, { children: [
98
+ showStrengthIndicator && value && !error && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
99
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-[10px]", children: [
100
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Strength:" }),
101
+ /* @__PURE__ */ jsx("span", { className: passwordStrength.color, children: passwordStrength.label })
102
+ ] }),
103
+ /* @__PURE__ */ jsx("div", { className: "w-full bg-muted rounded-full h-1", children: /* @__PURE__ */ jsx(
104
+ "div",
105
+ {
106
+ className: cn("h-1 rounded-full transition-all duration-300", passwordStrength.bgColor),
107
+ style: { width: passwordStrength.width }
108
+ }
109
+ ) })
110
+ ] }),
111
+ showMatchIndicator && passwordsMatch && !error && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
112
+ /* @__PURE__ */ jsx(CircleCheckBig, { className: "h-3 w-3 text-success" }),
113
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-success", children: "Passwords match" })
114
+ ] }),
115
+ description
116
+ ] });
117
+ const eyeIcon = /* @__PURE__ */ jsx(
118
+ "button",
103
119
  {
104
- className: cn("h-1 rounded-full transition-all duration-300", passwordStrength.bgColor),
105
- style: { width: passwordStrength.width }
120
+ type: "button",
121
+ onClick: togglePasswordVisibility,
122
+ "aria-label": toggleAriaLabel || (showPassword ? "Hide password" : "Show password"),
123
+ className: "cursor-pointer",
124
+ children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5 text-muted-foreground" })
106
125
  }
107
- ) }),
108
- message && /* @__PURE__ */ jsx("div", { children: message })
109
- ] }) : showMatchIndicator && passwordsMatch && !error ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
110
- /* @__PURE__ */ jsx(CircleCheckBig, { className: "h-3 w-3 text-success" }),
111
- /* @__PURE__ */ jsx("span", { className: "text-[10px] text-success", children: "Passwords match" }),
112
- message && /* @__PURE__ */ jsx("div", { children: message })
113
- ] }) : message;
114
- const eyeIcon = /* @__PURE__ */ jsx(
115
- "button",
116
- {
117
- type: "button",
118
- onClick: togglePasswordVisibility,
119
- "aria-label": toggleAriaLabel || (showPassword ? "Hide password" : "Show password"),
120
- className: "cursor-pointer",
121
- children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5 text-muted-foreground" })
122
- }
123
- );
124
- return /* @__PURE__ */ jsx(
125
- TextField,
126
- {
127
- ...props,
128
- type: showPassword ? "text" : "password",
129
- value,
130
- message: enhancedMessage,
131
- error,
132
- endAdornment: eyeIcon
133
- }
134
- );
135
- };
126
+ );
127
+ return /* @__PURE__ */ jsx(
128
+ TextField,
129
+ {
130
+ ref,
131
+ ...props,
132
+ type: showPassword ? "text" : "password",
133
+ value,
134
+ description: enhancedDescription,
135
+ error,
136
+ endAdornment: eyeIcon
137
+ }
138
+ );
139
+ }
140
+ );
141
+ PasswordField.displayName = "PasswordField";
136
142
 
137
143
  export { PasswordField as P };
138
144
  //# sourceMappingURL=PasswordField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordField.js","sources":["../node_modules/lucide-react/dist/esm/icons/circle-check-big.js","../node_modules/lucide-react/dist/esm/icons/eye-off.js","../node_modules/lucide-react/dist/esm/icons/eye.js","../lib/components/PasswordField/PasswordField.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.544.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M21.801 10A10 10 0 1 1 17 3.335\", key: \"yps3ct\" }],\n [\"path\", { d: \"m9 11 3 3L22 4\", key: \"1pflzl\" }]\n];\nconst CircleCheckBig = createLucideIcon(\"circle-check-big\", __iconNode);\n\nexport { __iconNode, CircleCheckBig as default };\n//# sourceMappingURL=circle-check-big.js.map\n","/**\n * @license lucide-react v0.544.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\",\n key: \"ct8e1f\"\n }\n ],\n [\"path\", { d: \"M14.084 14.158a3 3 0 0 1-4.242-4.242\", key: \"151rxh\" }],\n [\n \"path\",\n {\n d: \"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\",\n key: \"13bj9a\"\n }\n ],\n [\"path\", { d: \"m2 2 20 20\", key: \"1ooewy\" }]\n];\nconst EyeOff = createLucideIcon(\"eye-off\", __iconNode);\n\nexport { __iconNode, EyeOff as default };\n//# sourceMappingURL=eye-off.js.map\n","/**\n * @license lucide-react v0.544.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\",\n key: \"1nclc0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Eye = createLucideIcon(\"eye\", __iconNode);\n\nexport { __iconNode, Eye as default };\n//# sourceMappingURL=eye.js.map\n","import { CheckCircle, Eye, EyeOff } from 'lucide-react';\nimport React, { useState } from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport { TextField, TextFieldProps } from '../TextField/TextField';\n\nexport interface PasswordFieldProps extends Omit<TextFieldProps, 'type' | 'endAdornment'> {\n /**\n * Whether to show password strength indicator\n */\n showStrengthIndicator?: boolean;\n\n /**\n * Whether to show password match indicator\n */\n showMatchIndicator?: boolean;\n\n /**\n * Password to match against (for confirm password fields)\n */\n matchPassword?: string;\n\n /**\n * Custom aria-label for the visibility toggle button\n */\n toggleAriaLabel?: string;\n}\n\n// Helper function to calculate password strength\nconst getPasswordStrength = (password: string) => {\n let strength = 0;\n if (password.length >= 8) strength += 1;\n if (/[A-Z]/.test(password)) strength += 1;\n if (/[a-z]/.test(password)) strength += 1;\n if (/[0-9]/.test(password)) strength += 1;\n if (/[^A-Za-z0-9]/.test(password)) strength += 1;\n\n if (strength < 2) return { label: 'Weak', color: 'text-destructive', bgColor: 'bg-destructive', width: '25%' };\n if (strength < 4) return { label: 'Fair', color: 'text-yellow-500', bgColor: 'bg-yellow-500', width: '60%' };\n return { label: 'Strong', color: 'text-success', bgColor: 'bg-success', width: '100%' };\n};\n\n// PasswordField component - specialized TextField for password inputs\nexport const PasswordField: React.FC<PasswordFieldProps> = ({\n showStrengthIndicator = false,\n showMatchIndicator = false,\n matchPassword,\n toggleAriaLabel,\n value = '',\n message,\n error,\n ...props\n}) => {\n const [showPassword, setShowPassword] = useState(false);\n\n const togglePasswordVisibility = () => {\n setShowPassword(!showPassword);\n };\n\n const passwordStrength = getPasswordStrength(String(value));\n const passwordsMatch = matchPassword !== undefined && value !== '' && value === matchPassword;\n\n // Combine strength indicator with existing message\n const enhancedMessage =\n showStrengthIndicator && value && !error ? (\n <div className='space-y-1'>\n <div className='flex justify-between items-center text-[10px]'>\n <span className='text-muted-foreground'>Strength:</span>\n <span className={passwordStrength.color}>{passwordStrength.label}</span>\n </div>\n <div className='w-full bg-muted rounded-full h-1'>\n <div\n className={cn('h-1 rounded-full transition-all duration-300', passwordStrength.bgColor)}\n style={{ width: passwordStrength.width }}\n />\n </div>\n {message && <div>{message}</div>}\n </div>\n ) : showMatchIndicator && passwordsMatch && !error ? (\n <div className='flex items-center gap-1'>\n <CheckCircle className='h-3 w-3 text-success' />\n <span className='text-[10px] text-success'>Passwords match</span>\n {message && <div>{message}</div>}\n </div>\n ) : (\n message\n );\n\n const eyeIcon = (\n <button\n type='button'\n onClick={togglePasswordVisibility}\n aria-label={toggleAriaLabel || (showPassword ? 'Hide password' : 'Show password')}\n className='cursor-pointer'\n >\n {showPassword ? (\n <EyeOff className='h-3.5 w-3.5 text-muted-foreground' />\n ) : (\n <Eye className='h-3.5 w-3.5 text-muted-foreground' />\n )}\n </button>\n );\n\n return (\n <TextField\n {...props}\n type={showPassword ? 'text' : 'password'}\n value={value}\n message={enhancedMessage}\n error={error}\n endAdornment={eyeIcon}\n />\n );\n};\n"],"names":["__iconNode","CheckCircle"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAMA,YAAU,GAAG;AACnB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,iCAAiC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACnE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,EAAE;AACjD,CAAC;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QAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACL,OAAA,EAAS,wBAAA;AAAA,MACT,YAAA,EAAY,eAAA,KAAoB,YAAA,GAAe,eAAA,GAAkB,eAAA,CAAA;AAAA,MACjE,SAAA,EAAU,gBAAA;AAAA,MAET,QAAA,EAAA,YAAA,uBACE,MAAA,EAAA,EAAO,SAAA,EAAU,qCAAoC,CAAA,mBAEtD,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAU,mCAAA,EAAoC;AAAA;AAAA,GAEvD;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,IAAA,EAAM,eAAe,MAAA,GAAS,UAAA;AAAA,MAC9B,KAAA;AAAA,MACA,OAAA,EAAS,eAAA;AAAA,MACT,KAAA;AAAA,MACA,YAAA,EAAc;AAAA;AAAA,GAChB;AAEJ;;;;","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"PasswordField.js","sources":["../node_modules/lucide-react/dist/esm/icons/circle-check-big.js","../node_modules/lucide-react/dist/esm/icons/eye-off.js","../node_modules/lucide-react/dist/esm/icons/eye.js","../lib/components/PasswordField/PasswordField.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.544.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M21.801 10A10 10 0 1 1 17 3.335\", key: \"yps3ct\" }],\n [\"path\", { d: \"m9 11 3 3L22 4\", key: \"1pflzl\" }]\n];\nconst CircleCheckBig = createLucideIcon(\"circle-check-big\", __iconNode);\n\nexport { __iconNode, CircleCheckBig as default };\n//# sourceMappingURL=circle-check-big.js.map\n","/**\n * @license lucide-react v0.544.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\",\n key: \"ct8e1f\"\n }\n ],\n [\"path\", { d: \"M14.084 14.158a3 3 0 0 1-4.242-4.242\", key: \"151rxh\" }],\n [\n \"path\",\n {\n d: \"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\",\n key: \"13bj9a\"\n }\n ],\n [\"path\", { d: \"m2 2 20 20\", key: \"1ooewy\" }]\n];\nconst EyeOff = createLucideIcon(\"eye-off\", __iconNode);\n\nexport { __iconNode, EyeOff as default };\n//# sourceMappingURL=eye-off.js.map\n","/**\n * @license lucide-react v0.544.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\",\n key: \"1nclc0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Eye = createLucideIcon(\"eye\", __iconNode);\n\nexport { __iconNode, Eye as default };\n//# sourceMappingURL=eye.js.map\n","import { CheckCircle, Eye, EyeOff } from 'lucide-react';\nimport React, { useState } from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport { TextField, TextFieldProps } from '../TextField/TextField';\n\nexport interface PasswordFieldProps extends Omit<TextFieldProps, 'type' | 'endAdornment'> {\n /**\n * Whether to show password strength indicator\n */\n showStrengthIndicator?: boolean;\n\n /**\n * Whether to show password match indicator\n */\n showMatchIndicator?: boolean;\n\n /**\n * Password to match against (for confirm password fields)\n */\n matchPassword?: string;\n\n /**\n * Custom aria-label for the visibility toggle button\n */\n toggleAriaLabel?: string;\n}\n\n// PasswordField automatically forwards ref from TextField\ntype PasswordFieldComponentType = React.ForwardRefExoticComponent<\n PasswordFieldProps & React.RefAttributes<HTMLInputElement>\n>;\n\n// Helper function to calculate password strength\nconst getPasswordStrength = (password: string) => {\n let strength = 0;\n if (password.length >= 8) strength += 1;\n if (/[A-Z]/.test(password)) strength += 1;\n if (/[a-z]/.test(password)) strength += 1;\n if (/[0-9]/.test(password)) strength += 1;\n if (/[^A-Za-z0-9]/.test(password)) strength += 1;\n\n if (strength < 2) return { label: 'Weak', color: 'text-destructive', bgColor: 'bg-destructive', width: '25%' };\n if (strength < 4) return { label: 'Fair', color: 'text-warning', bgColor: 'bg-warning', width: '60%' };\n return { label: 'Strong', color: 'text-success', bgColor: 'bg-success', width: '100%' };\n};\n\n// PasswordField component - specialized TextField for password inputs\nexport const PasswordField = React.forwardRef<HTMLInputElement, PasswordFieldProps>(\n (\n {\n showStrengthIndicator = false,\n showMatchIndicator = false,\n matchPassword,\n toggleAriaLabel,\n value = '',\n description,\n error,\n ...props\n },\n ref\n ) => {\n const [showPassword, setShowPassword] = useState(false);\n\n const togglePasswordVisibility = () => {\n setShowPassword(!showPassword);\n };\n\n const passwordStrength = getPasswordStrength(String(value));\n const passwordsMatch = matchPassword !== undefined && value !== '' && value === matchPassword;\n\n // Build enhanced description by stacking indicators and description separately\n const enhancedDescription = (\n <>\n {/* Password strength indicator */}\n {showStrengthIndicator && value && !error && (\n <div className='space-y-1'>\n <div className='flex justify-between items-center text-[10px]'>\n <span className='text-muted-foreground'>Strength:</span>\n <span className={passwordStrength.color}>{passwordStrength.label}</span>\n </div>\n <div className='w-full bg-muted rounded-full h-1'>\n <div\n className={cn('h-1 rounded-full transition-all duration-300', passwordStrength.bgColor)}\n style={{ width: passwordStrength.width }}\n />\n </div>\n </div>\n )}\n\n {/* Password match indicator */}\n {showMatchIndicator && passwordsMatch && !error && (\n <div className='flex items-center gap-1'>\n <CheckCircle className='h-3 w-3 text-success' />\n <span className='text-[10px] text-success'>Passwords match</span>\n </div>\n )}\n\n {/* Original description (e.g., from zod schema) */}\n {description}\n </>\n );\n\n const eyeIcon = (\n <button\n type='button'\n onClick={togglePasswordVisibility}\n aria-label={toggleAriaLabel || (showPassword ? 'Hide password' : 'Show password')}\n className='cursor-pointer'\n >\n {showPassword ? (\n <EyeOff className='h-3.5 w-3.5 text-muted-foreground' />\n ) : (\n <Eye className='h-3.5 w-3.5 text-muted-foreground' />\n )}\n </button>\n );\n\n return (\n <TextField\n ref={ref}\n {...props}\n type={showPassword ? 'text' : 'password'}\n value={value}\n description={enhancedDescription}\n error={error}\n endAdornment={eyeIcon}\n />\n );\n }\n);\n\nPasswordField.displayName = 'PasswordField';\n"],"names":["__iconNode","React","CheckCircle"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAMA,YAAU,GAAG;AACnB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,iCAAiC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACnE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,EAAE;AACjD,CAAC;AACD,MAAM,cAAc,GAAG,gBAAgB,CAAC,kBAAkB,EAAEA,YAAU,CAAC;;ACbvE;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAMA,YAAU,GAAG;AACnB,EAAE;AACF,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,CAAC,EAAE,gGAAgG;AACzG,MAAM,GAAG,EAAE;AACX;AACA,GAAG;AACH,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,sCAAsC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACxE,EAAE;AACF,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,CAAC,EAAE,8FAA8F;AACvG,MAAM,GAAG,EAAE;AACX;AACA,GAAG;AACH,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,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KAAA;AAAA,QACA,YAAA,EAAc;AAAA;AAAA,KAChB;AAAA,EAEJ;AACF;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA;;;;","x_google_ignoreList":[0,1,2]}
@@ -5,15 +5,15 @@ import { Value as PhoneValue } from 'react-phone-number-input';
5
5
 
6
6
  export { isValidPhoneNumber }
7
7
 
8
- export declare const PhoneField: default_2.FC<PhoneFieldProps>;
8
+ export declare const PhoneField: default_2.ForwardRefExoticComponent<PhoneFieldProps & default_2.RefAttributes<HTMLInputElement>>;
9
9
 
10
10
  export declare interface PhoneFieldProps {
11
11
  value?: PhoneValue;
12
12
  onChange: (value: PhoneValue | undefined) => void;
13
13
  defaultCountry?: Country;
14
14
  label?: string;
15
- message?: string;
16
- error?: boolean;
15
+ description?: default_2.ReactNode;
16
+ error?: string;
17
17
  disabled?: boolean;
18
18
  className?: string;
19
19
  placeholder?: string;
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import React__default, { useRef, useCallback, useMemo } from 'react';
3
3
  import { c as cn } from './utils.js';
4
- import { L as Label } from './Label.js';
4
+ import { F as Field, a as FieldLabel, h as FieldContent, b as FieldDescription, c as FieldError } from './field.js';
5
5
 
6
6
  // This file is a workaround for a bug in web browsers' "native"
7
7
  // ES6 importing system which is uncapable of importing "*.json" files.
@@ -10348,64 +10348,61 @@ function isValidPhoneNumber() {
10348
10348
  return call(isValidPhoneNumber$1, arguments)
10349
10349
  }
10350
10350
 
10351
- const PhoneField = ({
10352
- value,
10353
- onChange,
10354
- defaultCountry = "IN",
10355
- label,
10356
- message,
10357
- error,
10358
- disabled,
10359
- className,
10360
- placeholder
10361
- }) => {
10362
- const fieldId = React__default.useId();
10363
- return /* @__PURE__ */ jsxs("div", { className: "space-y-2", "data-slot": "field", children: [
10364
- label && /* @__PURE__ */ jsx(Label, { "data-slot": "label", children: label }),
10365
- /* @__PURE__ */ jsx(
10366
- PhoneInputBase,
10367
- {
10368
- international: true,
10369
- defaultCountry,
10370
- value,
10371
- onChange,
10372
- disabled,
10373
- placeholder,
10374
- "aria-describedby": message ? `${fieldId}-message` : void 0,
10375
- "aria-invalid": error,
10376
- "data-slot": "input",
10377
- className: cn(
10378
- "flex h-9 w-full rounded-md border border-input bg-transparent dark:bg-input/30 px-3 py-1 text-sm shadow-xs transition-[color,box-shadow]",
10379
- "placeholder:text-muted-foreground",
10380
- "focus-within:outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
10381
- "disabled:cursor-not-allowed disabled:opacity-50",
10382
- error && "border-destructive focus-within:ring-destructive/20 dark:focus-within:ring-destructive/40",
10383
- className
10351
+ const PhoneField = React__default.forwardRef(
10352
+ ({
10353
+ value,
10354
+ onChange,
10355
+ defaultCountry = "IN",
10356
+ label,
10357
+ description,
10358
+ error,
10359
+ disabled,
10360
+ className,
10361
+ placeholder
10362
+ }, ref) => {
10363
+ const fieldId = React__default.useId();
10364
+ const hasError = !!error;
10365
+ return /* @__PURE__ */ jsxs(Field, { "data-disabled": disabled, children: [
10366
+ label && /* @__PURE__ */ jsx(FieldLabel, { children: label }),
10367
+ /* @__PURE__ */ jsxs(FieldContent, { children: [
10368
+ /* @__PURE__ */ jsx(
10369
+ PhoneInputBase,
10370
+ {
10371
+ international: true,
10372
+ defaultCountry,
10373
+ value,
10374
+ onChange,
10375
+ disabled,
10376
+ placeholder,
10377
+ "aria-describedby": description || error ? `${fieldId}-description ${fieldId}-error` : void 0,
10378
+ "aria-invalid": hasError,
10379
+ className: cn(
10380
+ "flex h-9 w-full rounded-md border border-input bg-transparent dark:bg-input/30 px-3 py-1 text-sm shadow-xs transition-[color,box-shadow]",
10381
+ "placeholder:text-muted-foreground",
10382
+ "focus-within:outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
10383
+ "disabled:cursor-not-allowed disabled:opacity-50",
10384
+ hasError && "border-destructive focus-within:ring-destructive/20 dark:focus-within:ring-destructive/40",
10385
+ className
10386
+ ),
10387
+ numberInputProps: {
10388
+ className: cn(
10389
+ "flex-1 bg-transparent outline-none",
10390
+ "placeholder:text-muted-foreground",
10391
+ "disabled:cursor-not-allowed"
10392
+ )
10393
+ },
10394
+ countrySelectProps: {
10395
+ className: cn("mr-2 bg-transparent border-none outline-none", "focus:ring-0", "disabled:cursor-not-allowed")
10396
+ }
10397
+ }
10384
10398
  ),
10385
- numberInputProps: {
10386
- className: cn(
10387
- "flex-1 bg-transparent outline-none",
10388
- "placeholder:text-muted-foreground",
10389
- "disabled:cursor-not-allowed"
10390
- )
10391
- },
10392
- countrySelectProps: {
10393
- className: cn("mr-2 bg-transparent border-none outline-none", "focus:ring-0", "disabled:cursor-not-allowed")
10394
- }
10395
- }
10396
- ),
10397
- message && /* @__PURE__ */ jsx(
10398
- "div",
10399
- {
10400
- id: `${fieldId}-message`,
10401
- className: cn("text-xs", error ? "text-destructive" : "text-muted-foreground"),
10402
- role: error ? "alert" : void 0,
10403
- "data-slot": "message",
10404
- children: message
10405
- }
10406
- )
10407
- ] });
10408
- };
10399
+ description && /* @__PURE__ */ jsx(FieldDescription, { id: `${fieldId}-description`, children: description }),
10400
+ error && /* @__PURE__ */ jsx(FieldError, { id: `${fieldId}-error`, children: error })
10401
+ ] })
10402
+ ] });
10403
+ }
10404
+ );
10405
+ PhoneField.displayName = "PhoneField";
10409
10406
 
10410
10407
  export { PhoneField as P, isValidPhoneNumber as i };
10411
10408
  //# sourceMappingURL=PhoneField.js.map