@clasing/ui 0.1.132 → 0.1.133
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.
- package/dist/components/input.cjs.js +1 -1
- package/dist/components/input.es.js +1 -1
- package/dist/components/phone-input.cjs.js +1 -1
- package/dist/components/phone-input.es.js +1 -1
- package/dist/components/textarea.cjs.js +1 -0
- package/dist/components/textarea.d.ts +32 -0
- package/dist/components/textarea.es.js +163 -0
- package/dist/entries/textarea.d.ts +2 -0
- package/dist/input-BJHrtCkE.cjs +1 -0
- package/dist/{input-CUSAqhCy.js → input-C1L8iNKq.js} +23 -23
- package/package.json +1 -1
- package/dist/input-DHz92pYC.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../input-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../input-BJHrtCkE.cjs");exports.Input=t.Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jsx-runtime-CEDi24JD.cjs"),S=require("react"),I=require("react-phone-number-input"),q=require("react-phone-number-input/flags"),w=require("react-phone-number-input/locale/en"),P=require("react-phone-number-input/locale/es"),O=require("react-phone-number-input/locale/fr"),p=require("../command-8g6GQBZ9.cjs"),_=require("../input-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jsx-runtime-CEDi24JD.cjs"),S=require("react"),I=require("react-phone-number-input"),q=require("react-phone-number-input/flags"),w=require("react-phone-number-input/locale/en"),P=require("react-phone-number-input/locale/es"),O=require("react-phone-number-input/locale/fr"),p=require("../command-8g6GQBZ9.cjs"),_=require("../input-BJHrtCkE.cjs"),T=require("../label-DzIkWgU7.cjs"),h=require("../popover-DuG87bap.cjs"),k=require("../scroll-area-DWxaYCKb.cjs"),m=require("../index-DoxiiusW.cjs"),y=require("../icon-component-DuSAouum.cjs");function C(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const f=C(S),E=C(I),N=f.forwardRef(({className:t,onChange:n,value:s,size:o="md",rounded:r="default",label:a,helperText:c,locale:x="en",error:l,touched:d,...i},g)=>e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3",children:[a&&e.jsxRuntimeExports.jsx(T.Label,{htmlFor:i.id,className:m.cn({"text-neutral-700":i.disabled}),children:a}),e.jsxRuntimeExports.jsx(E.default,{ref:g,className:m.cn("flex",t),flagComponent:R,countrySelectComponent:A,inputComponent:v,smartCaret:!1,labels:x==="es"?P:x==="fr"?O:w,value:s||void 0,onChange:j=>n?.(j||""),countrySelectProps:{size:o,rounded:r,error:l,touched:d},numberInputProps:{size:o,rounded:r,error:l,touched:d},...i}),l&&d?e.jsxRuntimeExports.jsx("span",{id:i.id&&`${i.id}-error-text`,"aria-invalid":!0,className:"text-destructive text-label-md -mt-1",children:l}):c?e.jsxRuntimeExports.jsx("span",{id:i.id&&`${i.id}-helper-text`,className:m.cn("text-label-md -mt-1",{"text-muted-foreground":!l&&!d,"text-destructive":l&&d,"text-neutral-700":i.disabled}),children:c}):null]}));N.displayName="PhoneInput";const v=f.forwardRef(({className:t,rounded:n="default",error:s,touched:o,size:r,...a},c)=>{const{"data-country":x,...l}=a;return e.jsxRuntimeExports.jsx(_.Input,{size:r,containerClassName:"w-full",className:m.cn("w-full",{"border-destructive":s&&o,"border-blue-800":o&&!s,"rounded-s-none rounded-e-lg":n!=="full","rounded-s-none rounded-e-full":n==="full","rounded-e-sm":r==="sm","rounded-e-md":r==="md","rounded-e-lg":r==="lg"},t),...l,ref:c})});v.displayName="InputComponent";const A=({disabled:t,value:n,options:s,onChange:o,size:r="md",rounded:a="default",error:c,touched:x})=>{const l=f.useRef(null),[d,i]=f.useState(""),[g,j]=f.useState(!1);return e.jsxRuntimeExports.jsxs(h.Popover,{open:g,modal:!0,onOpenChange:u=>{j(u),u&&i("")},children:[e.jsxRuntimeExports.jsx(h.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:m.cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-fit items-center justify-center min-w-0 border bg-transparent text-base transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-semibold disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm border-r-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:z-1",a==="default"?"rounded-e-none":"rounded-s-full rounded-e-none",{"outline-destructive":c&&x,"outline-blue-800":x&&!c,"text-label-md h-8 rounded-s-sm px-2 py-1":r==="sm","text-label-lg h-12 rounded-s-md px-3 py-1":r==="md","text-label-xl h-16 rounded-s-lg px-4 py-2":r==="lg"}),disabled:t,children:[e.jsxRuntimeExports.jsx(R,{country:n,countryName:n,disabled:t}),e.jsxRuntimeExports.jsx(y.IconComponent,{iconName:"IconChevronDown",className:m.cn("-mr-2 size-4 opacity-50",t?"hidden":"opacity-100")})]})}),e.jsxRuntimeExports.jsx(h.PopoverContent,{className:"w-[300px] p-0",children:e.jsxRuntimeExports.jsxs(p.Command,{children:[e.jsxRuntimeExports.jsx(p.CommandInput,{value:d,onValueChange:u=>{i(u),setTimeout(()=>{if(l.current){const b=l.current.querySelector("[data-radix-scroll-area-viewport]");b&&(b.scrollTop=0)}},0)},placeholder:"Search country..."}),e.jsxRuntimeExports.jsx(p.CommandList,{children:e.jsxRuntimeExports.jsxs(k.ScrollArea,{ref:l,className:"h-72",children:[e.jsxRuntimeExports.jsx(p.CommandEmpty,{children:"No country found."}),e.jsxRuntimeExports.jsx(p.CommandGroup,{children:s.map(({value:u,label:b})=>u?e.jsxRuntimeExports.jsx(D,{country:u,countryName:b,selectedCountry:n,onChange:o,onSelectComplete:()=>j(!1)},u):null)})]})})]})})]})},D=({country:t,countryName:n,selectedCountry:s,onChange:o,onSelectComplete:r})=>{const a=()=>{o(t),r()};return e.jsxRuntimeExports.jsxs(p.CommandItem,{className:"gap-2",onSelect:a,children:[e.jsxRuntimeExports.jsx(R,{country:t,countryName:n}),e.jsxRuntimeExports.jsx("span",{className:"flex-1 text-sm",children:n}),e.jsxRuntimeExports.jsx("span",{className:"text-foreground/50 text-sm",children:`+${E.getCountryCallingCode(t)}`}),e.jsxRuntimeExports.jsx(y.IconComponent,{iconName:"IconCheck",className:`ml-auto size-4 ${t===s?"opacity-100":"opacity-0"}`})]})},R=({country:t,countryName:n,disabled:s})=>{const o=q[t];return e.jsxRuntimeExports.jsx("span",{className:m.cn("bg-foreground/20 flex h-4 w-6 overflow-hidden rounded-[4px] [&_svg:not([class*='size-'])]:size-full",{"opacity-50":s}),children:o&&e.jsxRuntimeExports.jsx(o,{title:n})})};exports.PhoneInput=N;
|
|
@@ -6,7 +6,7 @@ import v from "react-phone-number-input/locale/en";
|
|
|
6
6
|
import I from "react-phone-number-input/locale/es";
|
|
7
7
|
import w from "react-phone-number-input/locale/fr";
|
|
8
8
|
import { C as S, d as P, f as R, b as O, c as $, e as E } from "../command-pED95x7-.js";
|
|
9
|
-
import { I as F } from "../input-
|
|
9
|
+
import { I as F } from "../input-C1L8iNKq.js";
|
|
10
10
|
import { L } from "../label-_kG7WBoJ.js";
|
|
11
11
|
import { P as V, c as k, b as A } from "../popover-CHAUhJda.js";
|
|
12
12
|
import { S as T } from "../scroll-area-DwBiu3Jn.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../jsx-runtime-CEDi24JD.cjs"),y=require("../label-DzIkWgU7.cjs"),a=require("../index-DoxiiusW.cjs"),R=require("../index-C8P6Mn4U.cjs"),u=require("../icon-component-DuSAouum.cjs"),E=R.cva("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 resize-none border bg-transparent transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{size:{sm:"text-label-md min-h-20 rounded-sm px-2 py-1",md:"text-label-lg min-h-24 rounded-md px-3 py-2",lg:"text-label-xl min-h-32 rounded-lg px-4 py-3"},rounded:{default:"",full:"rounded-2xl"},state:{default:"",error:"border-destructive ring-destructive/20 dark:ring-destructive/40",success:"border-success ring-success/20 dark:ring-success/40"},resize:{none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"}},defaultVariants:{size:"md",rounded:"default",state:"default",resize:"vertical"}});function h({className:b,label:x,helperText:c,error:s,touched:i,iconName:m,size:v,rounded:f,state:p,resize:j,containerClassName:g,maxLength:n,showCharacterCount:z=!1,...e}){const l=m?(o=>typeof o=="string"?{name:o}:o)(m):void 0,r=s&&i?"error":i&&!s&&e.value?"success":"default",d=e.value?String(e.value).length:0,N=z||n;return t.jsxRuntimeExports.jsxs("div",{className:a.cn("flex flex-col gap-2",g),children:[x&&t.jsxRuntimeExports.jsx(y.Label,{htmlFor:e.id,className:a.cn({"text-neutral-700":e.disabled}),children:x}),t.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[t.jsxRuntimeExports.jsx("textarea",{"data-slot":"textarea","aria-describedby":e.id&&c?`${e.id}-helper-text`:void 0,"aria-invalid":!!(s&&i),"aria-errormessage":e.id&&s?`${e.id}-error-text`:void 0,maxLength:n,className:a.cn(E({size:v,rounded:f,resize:j,state:r,className:a.cn("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",l?"pr-10":"",b)})),...e}),l&&t.jsxRuntimeExports.jsx("span",{className:a.cn("absolute top-3 right-3",{"text-muted-foreground":r==="default","text-destructive":r==="error","text-success-main":r==="success","text-neutral-700":e.disabled}),children:t.jsxRuntimeExports.jsx(u.IconComponent,{iconName:l.name,stroke:l.stroke,size:20})}),!l&&s&&i&&t.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconAlertCircleFilled",size:20,className:"text-destructive absolute top-3 right-3"}),!l&&i&&!s&&e.value&&t.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconCircleCheckFilled",size:20,className:"text-success-main absolute top-3 right-3"})]}),N&&t.jsxRuntimeExports.jsx("div",{className:"flex justify-end",children:t.jsxRuntimeExports.jsx("span",{className:a.cn("text-label-sm",{"text-muted-foreground":!n||d<=n,"text-destructive":n&&d>n}),children:n?`${d}/${n}`:d})}),s&&i?t.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-error-text`,"aria-invalid":!0,className:"text-destructive text-label-md",children:s}):c?t.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-helper-text`,className:a.cn("text-label-md",{"text-muted-foreground":!s&&!i,"text-destructive":s&&i,"text-success-main":i&&!s&&e.value!==void 0,"text-neutral-700":e.disabled}),children:c}):null]})}exports.Textarea=h;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { TablerIconName } from './icon-component';
|
|
4
|
+
declare const textareaStyles: (props?: ({
|
|
5
|
+
size?: "lg" | "md" | "sm" | null | undefined;
|
|
6
|
+
rounded?: "default" | "full" | null | undefined;
|
|
7
|
+
state?: "default" | "error" | "success" | null | undefined;
|
|
8
|
+
resize?: "none" | "horizontal" | "vertical" | "both" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export interface TextareaProps extends VariantProps<typeof textareaStyles> {
|
|
11
|
+
/** Label text shown above the textarea */
|
|
12
|
+
label?: string;
|
|
13
|
+
/** Helper text shown below the textarea */
|
|
14
|
+
helperText?: string;
|
|
15
|
+
/** Error message shown below the textarea */
|
|
16
|
+
error?: string;
|
|
17
|
+
/** Whether the textarea has been touched/blurred */
|
|
18
|
+
touched?: boolean;
|
|
19
|
+
/** Icon to display in the top-right corner of the textarea */
|
|
20
|
+
iconName?: TablerIconName | {
|
|
21
|
+
name: TablerIconName;
|
|
22
|
+
stroke?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Container className for the entire textarea component including label and helper text */
|
|
25
|
+
containerClassName?: string;
|
|
26
|
+
/** Maximum number of characters allowed */
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
/** Show character count */
|
|
29
|
+
showCharacterCount?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare function Textarea({ className, label, helperText, error, touched, iconName, size, rounded, state, resize, containerClassName, maxLength, showCharacterCount, ...props }: Omit<React.ComponentProps<'textarea'>, 'size'> & TextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export { Textarea, textareaStyles };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { j as t } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { L as y } from "../label-_kG7WBoJ.js";
|
|
3
|
+
import { c as l } from "../index-CRiPKpXj.js";
|
|
4
|
+
import { c as h } from "../index-BqtVL8d-.js";
|
|
5
|
+
import { I as u } from "../icon-component-CxQsODCa.js";
|
|
6
|
+
const I = h(
|
|
7
|
+
"placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 resize-none border bg-transparent transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "text-label-md min-h-20 rounded-sm px-2 py-1",
|
|
12
|
+
md: "text-label-lg min-h-24 rounded-md px-3 py-2",
|
|
13
|
+
lg: "text-label-xl min-h-32 rounded-lg px-4 py-3"
|
|
14
|
+
},
|
|
15
|
+
rounded: {
|
|
16
|
+
default: "",
|
|
17
|
+
full: "rounded-2xl"
|
|
18
|
+
},
|
|
19
|
+
state: {
|
|
20
|
+
default: "",
|
|
21
|
+
error: "border-destructive ring-destructive/20 dark:ring-destructive/40",
|
|
22
|
+
success: "border-success ring-success/20 dark:ring-success/40"
|
|
23
|
+
},
|
|
24
|
+
resize: {
|
|
25
|
+
none: "resize-none",
|
|
26
|
+
vertical: "resize-y",
|
|
27
|
+
horizontal: "resize-x",
|
|
28
|
+
both: "resize"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
size: "md",
|
|
33
|
+
rounded: "default",
|
|
34
|
+
state: "default",
|
|
35
|
+
resize: "vertical"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
function E({
|
|
40
|
+
className: f,
|
|
41
|
+
label: x,
|
|
42
|
+
helperText: c,
|
|
43
|
+
error: s,
|
|
44
|
+
touched: i,
|
|
45
|
+
iconName: m,
|
|
46
|
+
size: v,
|
|
47
|
+
rounded: b,
|
|
48
|
+
state: k,
|
|
49
|
+
resize: g,
|
|
50
|
+
containerClassName: z,
|
|
51
|
+
maxLength: a,
|
|
52
|
+
showCharacterCount: j = !1,
|
|
53
|
+
...e
|
|
54
|
+
}) {
|
|
55
|
+
const r = m ? ((o) => typeof o == "string" ? { name: o } : o)(m) : void 0, n = s && i ? "error" : i && !s && e.value ? "success" : "default", d = e.value ? String(e.value).length : 0, N = j || a;
|
|
56
|
+
return /* @__PURE__ */ t.jsxs("div", { className: l("flex flex-col gap-2", z), children: [
|
|
57
|
+
x && /* @__PURE__ */ t.jsx(
|
|
58
|
+
y,
|
|
59
|
+
{
|
|
60
|
+
htmlFor: e.id,
|
|
61
|
+
className: l({
|
|
62
|
+
"text-neutral-700": e.disabled
|
|
63
|
+
}),
|
|
64
|
+
children: x
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ t.jsxs("div", { className: "relative w-full", children: [
|
|
68
|
+
/* @__PURE__ */ t.jsx(
|
|
69
|
+
"textarea",
|
|
70
|
+
{
|
|
71
|
+
"data-slot": "textarea",
|
|
72
|
+
"aria-describedby": e.id && c ? `${e.id}-helper-text` : void 0,
|
|
73
|
+
"aria-invalid": !!(s && i),
|
|
74
|
+
"aria-errormessage": e.id && s ? `${e.id}-error-text` : void 0,
|
|
75
|
+
maxLength: a,
|
|
76
|
+
className: l(
|
|
77
|
+
I({
|
|
78
|
+
size: v,
|
|
79
|
+
rounded: b,
|
|
80
|
+
resize: g,
|
|
81
|
+
state: n,
|
|
82
|
+
className: l(
|
|
83
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
84
|
+
r ? "pr-10" : "",
|
|
85
|
+
f
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
),
|
|
89
|
+
...e
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
r && /* @__PURE__ */ t.jsx(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: l("absolute top-3 right-3", {
|
|
96
|
+
"text-muted-foreground": n === "default",
|
|
97
|
+
"text-destructive": n === "error",
|
|
98
|
+
"text-success-main": n === "success",
|
|
99
|
+
"text-neutral-700": e.disabled
|
|
100
|
+
}),
|
|
101
|
+
children: /* @__PURE__ */ t.jsx(
|
|
102
|
+
u,
|
|
103
|
+
{
|
|
104
|
+
iconName: r.name,
|
|
105
|
+
stroke: r.stroke,
|
|
106
|
+
size: 20
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
!r && s && i && /* @__PURE__ */ t.jsx(
|
|
112
|
+
u,
|
|
113
|
+
{
|
|
114
|
+
iconName: "IconAlertCircleFilled",
|
|
115
|
+
size: 20,
|
|
116
|
+
className: "text-destructive absolute top-3 right-3"
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
!r && i && !s && e.value && /* @__PURE__ */ t.jsx(
|
|
120
|
+
u,
|
|
121
|
+
{
|
|
122
|
+
iconName: "IconCircleCheckFilled",
|
|
123
|
+
size: 20,
|
|
124
|
+
className: "text-success-main absolute top-3 right-3"
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] }),
|
|
128
|
+
N && /* @__PURE__ */ t.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ t.jsx(
|
|
129
|
+
"span",
|
|
130
|
+
{
|
|
131
|
+
className: l("text-label-sm", {
|
|
132
|
+
"text-muted-foreground": !a || d <= a,
|
|
133
|
+
"text-destructive": a && d > a
|
|
134
|
+
}),
|
|
135
|
+
children: a ? `${d}/${a}` : d
|
|
136
|
+
}
|
|
137
|
+
) }),
|
|
138
|
+
s && i ? /* @__PURE__ */ t.jsx(
|
|
139
|
+
"span",
|
|
140
|
+
{
|
|
141
|
+
id: e.id && `${e.id}-error-text`,
|
|
142
|
+
"aria-invalid": !0,
|
|
143
|
+
className: "text-destructive text-label-md",
|
|
144
|
+
children: s
|
|
145
|
+
}
|
|
146
|
+
) : c ? /* @__PURE__ */ t.jsx(
|
|
147
|
+
"span",
|
|
148
|
+
{
|
|
149
|
+
id: e.id && `${e.id}-helper-text`,
|
|
150
|
+
className: l("text-label-md", {
|
|
151
|
+
"text-muted-foreground": !s && !i,
|
|
152
|
+
"text-destructive": s && i,
|
|
153
|
+
"text-success-main": i && !s && e.value !== void 0,
|
|
154
|
+
"text-neutral-700": e.disabled
|
|
155
|
+
}),
|
|
156
|
+
children: c
|
|
157
|
+
}
|
|
158
|
+
) : null
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
E as Textarea
|
|
163
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-CEDi24JD.cjs"),h=require("./label-DzIkWgU7.cjs"),d=require("./index-DoxiiusW.cjs"),N=require("./index-C8P6Mn4U.cjs"),E=require("react"),u=require("./icon-component-DuSAouum.cjs");function I(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(o,a,t.get?t:{enumerable:!0,get:()=>r[a]})}}return o.default=r,Object.freeze(o)}const R=I(E),y=N.cva("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 border bg-transparent transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-semibold disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{size:{sm:"text-label-md h-8 rounded-sm px-2 py-1",md:"text-label-lg h-12 rounded-md px-3 py-1",lg:"text-label-xl h-16 rounded-lg px-4 py-2"},rounded:{default:"",full:"rounded-full"},state:{default:"",error:"border-destructive ring-destructive/20 dark:ring-destructive/40",success:"border-success ring-success/20 dark:ring-success/40"}},defaultVariants:{size:"md",rounded:"default",state:"default"}});function z({className:r,label:o,helperText:a,error:t,touched:i,iconName:b,iconPosition:c="left",type:l="text",size:g,rounded:p,state:k,containerClassName:j,...e}){const[x,v]=R.useState(!1),n=b?(f=>typeof f=="string"?{name:f}:f)(b):void 0,m=t&&i?"error":i&&!t&&e.value?"success":"default",w=()=>{v(!x)};return s.jsxRuntimeExports.jsxs("div",{className:d.cn("flex flex-col gap-2",j),children:[o&&s.jsxRuntimeExports.jsx(h.Label,{htmlFor:e.id,className:d.cn({"text-neutral-700":e.disabled}),children:o}),s.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[n&&c==="left"&&s.jsxRuntimeExports.jsx("span",{className:d.cn("absolute top-1/2 left-3 -translate-y-1/2",{"text-muted-foreground":m==="default","text-destructive":m==="error","text-success-main":m==="success","text-neutral-700":e.disabled}),children:s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),s.jsxRuntimeExports.jsx("input",{type:l==="password"?x?"text":"password":l,"data-slot":"input","aria-describedby":e.id&&a?`${e.id}-helper-text`:void 0,"aria-invalid":!!(t&&i),"aria-errormessage":e.id&&t?`${e.id}-error-text`:void 0,className:d.cn(y({size:g,rounded:p,state:m,className:d.cn("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",n&&c==="left"?"pl-10":"",n&&c==="right"||l==="password"?"pr-10":"",l==="color"?"h-[50px] p-0":"",r)})),...e}),l==="password"&&s.jsxRuntimeExports.jsx("button",{type:"button",tabIndex:-1,"aria-label":x?"Hide password":"Show password",className:"absolute top-1/2 right-3 -translate-y-1/2 rounded-md p-1 hover:bg-neutral-100/50 focus-visible:ring-[1.5px] focus-visible:ring-offset-1 focus-visible:outline-none",onClick:w,children:s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:x?"IconEyeOff":"IconEye",size:20})}),n&&c==="right"&&l!=="password"&&s.jsxRuntimeExports.jsx("span",{className:"absolute top-1/2 right-3 -translate-y-1/2",children:s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),!n&&t&&i&&l!=="password"&&s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconAlertCircleFilled",size:20,className:"text-destructive absolute top-1/2 right-3 -translate-y-1/2"}),!n&&i&&!t&&e.value&&l!=="password"&&s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconCircleCheckFilled",size:20,className:"text-success-main absolute top-1/2 right-3 -translate-y-1/2"})]}),t&&i?s.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-error-text`,"aria-invalid":!0,className:"text-destructive text-label-md",children:t}):a?s.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-helper-text`,className:d.cn("text-label-md",{"text-muted-foreground":!t&&!i,"text-destructive":t&&i,"text-success-main":i&&!t&&e.value!==void 0,"text-neutral-700":e.disabled}),children:a}):null]})}exports.Input=z;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as s } from "./jsx-runtime-DywqP_6a.js";
|
|
2
2
|
import { L as j } from "./label-_kG7WBoJ.js";
|
|
3
3
|
import { c as r } from "./index-CRiPKpXj.js";
|
|
4
4
|
import { c as N } from "./index-BqtVL8d-.js";
|
|
5
5
|
import * as I from "react";
|
|
6
6
|
import { I as n } from "./icon-component-CxQsODCa.js";
|
|
7
7
|
const y = N(
|
|
8
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 border bg-transparent
|
|
8
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 border bg-transparent transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-semibold disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
@@ -34,7 +34,7 @@ function V({
|
|
|
34
34
|
className: b,
|
|
35
35
|
label: x,
|
|
36
36
|
helperText: u,
|
|
37
|
-
error:
|
|
37
|
+
error: t,
|
|
38
38
|
touched: i,
|
|
39
39
|
iconName: f,
|
|
40
40
|
iconPosition: d = "left",
|
|
@@ -45,11 +45,11 @@ function V({
|
|
|
45
45
|
containerClassName: p,
|
|
46
46
|
...e
|
|
47
47
|
}) {
|
|
48
|
-
const [o, w] = I.useState(!1), a = f ? ((m) => typeof m == "string" ? { name: m } : m)(f) : void 0, c =
|
|
48
|
+
const [o, w] = I.useState(!1), a = f ? ((m) => typeof m == "string" ? { name: m } : m)(f) : void 0, c = t && i ? "error" : i && !t && e.value ? "success" : "default", h = () => {
|
|
49
49
|
w(!o);
|
|
50
50
|
};
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
x && /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ s.jsxs("div", { className: r("flex flex-col gap-2", p), children: [
|
|
52
|
+
x && /* @__PURE__ */ s.jsx(
|
|
53
53
|
j,
|
|
54
54
|
{
|
|
55
55
|
htmlFor: e.id,
|
|
@@ -59,8 +59,8 @@ function V({
|
|
|
59
59
|
children: x
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
a && d === "left" && /* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ s.jsxs("div", { className: "relative w-full", children: [
|
|
63
|
+
a && d === "left" && /* @__PURE__ */ s.jsx(
|
|
64
64
|
"span",
|
|
65
65
|
{
|
|
66
66
|
className: r("absolute top-1/2 left-3 -translate-y-1/2", {
|
|
@@ -69,7 +69,7 @@ function V({
|
|
|
69
69
|
"text-success-main": c === "success",
|
|
70
70
|
"text-neutral-700": e.disabled
|
|
71
71
|
}),
|
|
72
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ s.jsx(
|
|
73
73
|
n,
|
|
74
74
|
{
|
|
75
75
|
iconName: a.name,
|
|
@@ -79,14 +79,14 @@ function V({
|
|
|
79
79
|
)
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ s.jsx(
|
|
83
83
|
"input",
|
|
84
84
|
{
|
|
85
85
|
type: l === "password" ? o ? "text" : "password" : l,
|
|
86
86
|
"data-slot": "input",
|
|
87
87
|
"aria-describedby": e.id && u ? `${e.id}-helper-text` : void 0,
|
|
88
|
-
"aria-invalid": !!(
|
|
89
|
-
"aria-errormessage": e.id &&
|
|
88
|
+
"aria-invalid": !!(t && i),
|
|
89
|
+
"aria-errormessage": e.id && t ? `${e.id}-error-text` : void 0,
|
|
90
90
|
className: r(
|
|
91
91
|
y({
|
|
92
92
|
size: g,
|
|
@@ -104,7 +104,7 @@ function V({
|
|
|
104
104
|
...e
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
|
-
l === "password" && /* @__PURE__ */
|
|
107
|
+
l === "password" && /* @__PURE__ */ s.jsx(
|
|
108
108
|
"button",
|
|
109
109
|
{
|
|
110
110
|
type: "button",
|
|
@@ -112,7 +112,7 @@ function V({
|
|
|
112
112
|
"aria-label": o ? "Hide password" : "Show password",
|
|
113
113
|
className: "absolute top-1/2 right-3 -translate-y-1/2 rounded-md p-1 hover:bg-neutral-100/50 focus-visible:ring-[1.5px] focus-visible:ring-offset-1 focus-visible:outline-none",
|
|
114
114
|
onClick: h,
|
|
115
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ s.jsx(
|
|
116
116
|
n,
|
|
117
117
|
{
|
|
118
118
|
iconName: o ? "IconEyeOff" : "IconEye",
|
|
@@ -121,7 +121,7 @@ function V({
|
|
|
121
121
|
)
|
|
122
122
|
}
|
|
123
123
|
),
|
|
124
|
-
a && d === "right" && l !== "password" && /* @__PURE__ */
|
|
124
|
+
a && d === "right" && l !== "password" && /* @__PURE__ */ s.jsx("span", { className: "absolute top-1/2 right-3 -translate-y-1/2", children: /* @__PURE__ */ s.jsx(
|
|
125
125
|
n,
|
|
126
126
|
{
|
|
127
127
|
iconName: a.name,
|
|
@@ -129,7 +129,7 @@ function V({
|
|
|
129
129
|
size: 20
|
|
130
130
|
}
|
|
131
131
|
) }),
|
|
132
|
-
!a &&
|
|
132
|
+
!a && t && i && l !== "password" && /* @__PURE__ */ s.jsx(
|
|
133
133
|
n,
|
|
134
134
|
{
|
|
135
135
|
iconName: "IconAlertCircleFilled",
|
|
@@ -137,7 +137,7 @@ function V({
|
|
|
137
137
|
className: "text-destructive absolute top-1/2 right-3 -translate-y-1/2"
|
|
138
138
|
}
|
|
139
139
|
),
|
|
140
|
-
!a && i && !
|
|
140
|
+
!a && i && !t && e.value && l !== "password" && /* @__PURE__ */ s.jsx(
|
|
141
141
|
n,
|
|
142
142
|
{
|
|
143
143
|
iconName: "IconCircleCheckFilled",
|
|
@@ -146,22 +146,22 @@ function V({
|
|
|
146
146
|
}
|
|
147
147
|
)
|
|
148
148
|
] }),
|
|
149
|
-
|
|
149
|
+
t && i ? /* @__PURE__ */ s.jsx(
|
|
150
150
|
"span",
|
|
151
151
|
{
|
|
152
152
|
id: e.id && `${e.id}-error-text`,
|
|
153
153
|
"aria-invalid": !0,
|
|
154
154
|
className: "text-destructive text-label-md",
|
|
155
|
-
children:
|
|
155
|
+
children: t
|
|
156
156
|
}
|
|
157
|
-
) : u ? /* @__PURE__ */
|
|
157
|
+
) : u ? /* @__PURE__ */ s.jsx(
|
|
158
158
|
"span",
|
|
159
159
|
{
|
|
160
160
|
id: e.id && `${e.id}-helper-text`,
|
|
161
161
|
className: r("text-label-md", {
|
|
162
|
-
"text-muted-foreground": !
|
|
163
|
-
"text-destructive":
|
|
164
|
-
"text-success-main": i && !
|
|
162
|
+
"text-muted-foreground": !t && !i,
|
|
163
|
+
"text-destructive": t && i,
|
|
164
|
+
"text-success-main": i && !t && e.value !== void 0,
|
|
165
165
|
"text-neutral-700": e.disabled
|
|
166
166
|
}),
|
|
167
167
|
children: u
|
package/package.json
CHANGED
package/dist/input-DHz92pYC.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-CEDi24JD.cjs"),h=require("./label-DzIkWgU7.cjs"),d=require("./index-DoxiiusW.cjs"),N=require("./index-C8P6Mn4U.cjs"),E=require("react"),u=require("./icon-component-DuSAouum.cjs");function I(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(o,a,t.get?t:{enumerable:!0,get:()=>r[a]})}}return o.default=r,Object.freeze(o)}const R=I(E),y=N.cva("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 border bg-transparent text-base transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-semibold disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",{variants:{size:{sm:"text-label-md h-8 rounded-sm px-2 py-1",md:"text-label-lg h-12 rounded-md px-3 py-1",lg:"text-label-xl h-16 rounded-lg px-4 py-2"},rounded:{default:"",full:"rounded-full"},state:{default:"",error:"border-destructive ring-destructive/20 dark:ring-destructive/40",success:"border-success ring-success/20 dark:ring-success/40"}},defaultVariants:{size:"md",rounded:"default",state:"default"}});function z({className:r,label:o,helperText:a,error:t,touched:i,iconName:b,iconPosition:c="left",type:l="text",size:g,rounded:p,state:k,containerClassName:j,...e}){const[x,v]=R.useState(!1),n=b?(f=>typeof f=="string"?{name:f}:f)(b):void 0,m=t&&i?"error":i&&!t&&e.value?"success":"default",w=()=>{v(!x)};return s.jsxRuntimeExports.jsxs("div",{className:d.cn("flex flex-col gap-2",j),children:[o&&s.jsxRuntimeExports.jsx(h.Label,{htmlFor:e.id,className:d.cn({"text-neutral-700":e.disabled}),children:o}),s.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[n&&c==="left"&&s.jsxRuntimeExports.jsx("span",{className:d.cn("absolute top-1/2 left-3 -translate-y-1/2",{"text-muted-foreground":m==="default","text-destructive":m==="error","text-success-main":m==="success","text-neutral-700":e.disabled}),children:s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),s.jsxRuntimeExports.jsx("input",{type:l==="password"?x?"text":"password":l,"data-slot":"input","aria-describedby":e.id&&a?`${e.id}-helper-text`:void 0,"aria-invalid":!!(t&&i),"aria-errormessage":e.id&&t?`${e.id}-error-text`:void 0,className:d.cn(y({size:g,rounded:p,state:m,className:d.cn("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",n&&c==="left"?"pl-10":"",n&&c==="right"||l==="password"?"pr-10":"",l==="color"?"h-[50px] p-0":"",r)})),...e}),l==="password"&&s.jsxRuntimeExports.jsx("button",{type:"button",tabIndex:-1,"aria-label":x?"Hide password":"Show password",className:"absolute top-1/2 right-3 -translate-y-1/2 rounded-md p-1 hover:bg-neutral-100/50 focus-visible:ring-[1.5px] focus-visible:ring-offset-1 focus-visible:outline-none",onClick:w,children:s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:x?"IconEyeOff":"IconEye",size:20})}),n&&c==="right"&&l!=="password"&&s.jsxRuntimeExports.jsx("span",{className:"absolute top-1/2 right-3 -translate-y-1/2",children:s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),!n&&t&&i&&l!=="password"&&s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconAlertCircleFilled",size:20,className:"text-destructive absolute top-1/2 right-3 -translate-y-1/2"}),!n&&i&&!t&&e.value&&l!=="password"&&s.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconCircleCheckFilled",size:20,className:"text-success-main absolute top-1/2 right-3 -translate-y-1/2"})]}),t&&i?s.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-error-text`,"aria-invalid":!0,className:"text-destructive text-label-md",children:t}):a?s.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-helper-text`,className:d.cn("text-label-md",{"text-muted-foreground":!t&&!i,"text-destructive":t&&i,"text-success-main":i&&!t&&e.value!==void 0,"text-neutral-700":e.disabled}),children:a}):null]})}exports.Input=z;
|