@clasing/ui 0.1.136 → 0.1.137
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.d.ts +1 -0
- package/dist/components/phone-input.es.js +108 -109
- package/dist/{input-C1L8iNKq.js → input-BoPcvULq.js} +19 -19
- package/dist/input-eri6Lyeo.cjs +1 -0
- package/package.json +1 -1
- package/dist/input-Dm-TUC5P.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-eri6Lyeo.cjs");exports.Input=t.Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jsx-runtime-BuHQgaKs.cjs"),S=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jsx-runtime-BuHQgaKs.cjs"),p=require("../command-C4Y6Ixrp.cjs"),S=require("../input-eri6Lyeo.cjs"),I=require("../label-U5GnYvFO.cjs"),h=require("../popover-4V87msIT.cjs"),q=require("../scroll-area-hg-bGoRe.cjs"),c=require("../index-DoxiiusW.cjs"),w=require("react"),P=require("react-phone-number-input"),O=require("react-phone-number-input/flags"),_=require("react-phone-number-input/locale/en"),T=require("react-phone-number-input/locale/es"),k=require("react-phone-number-input/locale/fr"),y=require("../icon-component-D5YssRbR.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(w),E=C(P),N=f.forwardRef(({className:t,onChange:n,value:s,size:o="md",rounded:r="default",label:u,helperText:d,locale:x="en",error:l,touched:m,containerClassName:j,...i},b)=>e.jsxRuntimeExports.jsxs("div",{className:c.cn("flex flex-col gap-2",j),children:[u&&e.jsxRuntimeExports.jsx(I.Label,{htmlFor:i.id,className:c.cn("mb-1",{"opacity-50":i.disabled}),children:u}),e.jsxRuntimeExports.jsx(E.default,{ref:b,className:c.cn("flex",t),flagComponent:R,countrySelectComponent:A,inputComponent:v,smartCaret:!1,labels:x==="es"?T:x==="fr"?k:_,value:s||void 0,onChange:a=>n?.(a||""),countrySelectProps:{size:o,rounded:r,error:l,touched:m},numberInputProps:{size:o,rounded:r,error:l,touched:m},...i}),l&&m?e.jsxRuntimeExports.jsx("span",{id:i.id&&`${i.id}-error-text`,"aria-invalid":!0,className:"text-destructive text-label-md -mt-1",children:l}):d?e.jsxRuntimeExports.jsx("span",{id:i.id&&`${i.id}-helper-text`,className:c.cn("text-label-md -mt-1",{"text-muted-foreground":!l&&!m,"text-destructive":l&&m,"text-muted-foreground opacity-50":i.disabled}),children:d}):null]}));N.displayName="PhoneInput";const v=f.forwardRef(({className:t,rounded:n="default",error:s,touched:o,size:r,...u},d)=>{const{"data-country":x,...l}=u;return e.jsxRuntimeExports.jsx(S.Input,{size:r,containerClassName:"w-full",className:c.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:d})});v.displayName="InputComponent";const A=({disabled:t,value:n,options:s,onChange:o,size:r="md",rounded:u="default",error:d,touched:x})=>{const l=f.useRef(null),[m,j]=f.useState(""),[i,b]=f.useState(!1);return e.jsxRuntimeExports.jsxs(h.Popover,{open:i,modal:!0,onOpenChange:a=>{b(a),a&&j("")},children:[e.jsxRuntimeExports.jsx(h.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:c.cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 flex w-fit min-w-0 items-center justify-center border border-r-0 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 focus-visible:z-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",u==="default"?"rounded-e-none":"rounded-s-full rounded-e-none",{"outline-destructive":d&&x,"outline-blue-800":x&&!d,"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:c.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:m,onValueChange:a=>{j(a),setTimeout(()=>{if(l.current){const g=l.current.querySelector("[data-radix-scroll-area-viewport]");g&&(g.scrollTop=0)}},0)},placeholder:"Search country..."}),e.jsxRuntimeExports.jsx(p.CommandList,{children:e.jsxRuntimeExports.jsxs(q.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:a,label:g})=>a?e.jsxRuntimeExports.jsx(D,{country:a,countryName:g,selectedCountry:n,onChange:o,onSelectComplete:()=>b(!1)},a):null)})]})})]})})]})},D=({country:t,countryName:n,selectedCountry:s,onChange:o,onSelectComplete:r})=>{const u=()=>{o(t),r()};return e.jsxRuntimeExports.jsxs(p.CommandItem,{className:"gap-2",onSelect:u,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=O[t];return e.jsxRuntimeExports.jsx("span",{className:c.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;
|
|
@@ -9,6 +9,7 @@ type PhoneInputProps = Omit<React.ComponentProps<'input'>, 'onChange' | 'value'
|
|
|
9
9
|
locale?: 'en' | 'es' | 'fr';
|
|
10
10
|
error?: string;
|
|
11
11
|
touched?: boolean;
|
|
12
|
+
containerClassName?: string;
|
|
12
13
|
};
|
|
13
14
|
declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps>;
|
|
14
15
|
export { PhoneInput };
|
|
@@ -1,149 +1,148 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { C as N, d as v, f as I, b as w, c as S, e as P } from "../command-pED95x7-.js";
|
|
3
|
+
import { I as R } from "../input-BoPcvULq.js";
|
|
4
|
+
import { L as O } from "../label-_kG7WBoJ.js";
|
|
5
|
+
import { P as $, c as E, b as F } from "../popover-CHAUhJda.js";
|
|
6
|
+
import { S as L } from "../scroll-area-DwBiu3Jn.js";
|
|
7
|
+
import { c as m } from "../index-CRiPKpXj.js";
|
|
2
8
|
import * as f from "react";
|
|
3
9
|
import * as j from "react-phone-number-input";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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-C1L8iNKq.js";
|
|
10
|
-
import { L } from "../label-_kG7WBoJ.js";
|
|
11
|
-
import { P as V, c as k, b as A } from "../popover-CHAUhJda.js";
|
|
12
|
-
import { S as T } from "../scroll-area-DwBiu3Jn.js";
|
|
13
|
-
import { c as u } from "../index-CRiPKpXj.js";
|
|
10
|
+
import V from "react-phone-number-input/flags";
|
|
11
|
+
import k from "react-phone-number-input/locale/en";
|
|
12
|
+
import A from "react-phone-number-input/locale/es";
|
|
13
|
+
import T from "react-phone-number-input/locale/fr";
|
|
14
14
|
import { I as C } from "../icon-component-CxQsODCa.js";
|
|
15
15
|
const _ = f.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
className: t,
|
|
18
18
|
onChange: n,
|
|
19
|
-
value:
|
|
19
|
+
value: l,
|
|
20
20
|
size: s = "md",
|
|
21
21
|
rounded: o = "default",
|
|
22
|
-
label:
|
|
23
|
-
helperText:
|
|
22
|
+
label: d,
|
|
23
|
+
helperText: c,
|
|
24
24
|
locale: p = "en",
|
|
25
|
-
error:
|
|
26
|
-
touched:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
error: r,
|
|
26
|
+
touched: u,
|
|
27
|
+
containerClassName: x,
|
|
28
|
+
...a
|
|
29
|
+
}, b) => /* @__PURE__ */ e.jsxs("div", { className: m("flex flex-col gap-2", x), children: [
|
|
30
|
+
d && /* @__PURE__ */ e.jsx(
|
|
31
|
+
O,
|
|
31
32
|
{
|
|
32
|
-
htmlFor:
|
|
33
|
-
className:
|
|
34
|
-
"
|
|
33
|
+
htmlFor: a.id,
|
|
34
|
+
className: m("mb-1", {
|
|
35
|
+
"opacity-50": a.disabled
|
|
35
36
|
}),
|
|
36
|
-
children:
|
|
37
|
+
children: d
|
|
37
38
|
}
|
|
38
39
|
),
|
|
39
40
|
/* @__PURE__ */ e.jsx(
|
|
40
41
|
j.default,
|
|
41
42
|
{
|
|
42
|
-
ref:
|
|
43
|
-
className:
|
|
43
|
+
ref: b,
|
|
44
|
+
className: m("flex", t),
|
|
44
45
|
flagComponent: h,
|
|
45
46
|
countrySelectComponent: q,
|
|
46
47
|
inputComponent: y,
|
|
47
48
|
smartCaret: !1,
|
|
48
|
-
labels: p === "es" ?
|
|
49
|
-
value:
|
|
50
|
-
onChange: (
|
|
49
|
+
labels: p === "es" ? A : p === "fr" ? T : k,
|
|
50
|
+
value: l || void 0,
|
|
51
|
+
onChange: (i) => n?.(i || ""),
|
|
51
52
|
countrySelectProps: {
|
|
52
53
|
size: s,
|
|
53
54
|
rounded: o,
|
|
54
|
-
error:
|
|
55
|
-
touched:
|
|
55
|
+
error: r,
|
|
56
|
+
touched: u
|
|
56
57
|
},
|
|
57
58
|
numberInputProps: {
|
|
58
59
|
size: s,
|
|
59
60
|
rounded: o,
|
|
60
|
-
error:
|
|
61
|
-
touched:
|
|
61
|
+
error: r,
|
|
62
|
+
touched: u
|
|
62
63
|
},
|
|
63
|
-
...
|
|
64
|
+
...a
|
|
64
65
|
}
|
|
65
66
|
),
|
|
66
|
-
|
|
67
|
+
r && u ? /* @__PURE__ */ e.jsx(
|
|
67
68
|
"span",
|
|
68
69
|
{
|
|
69
|
-
id:
|
|
70
|
+
id: a.id && `${a.id}-error-text`,
|
|
70
71
|
"aria-invalid": !0,
|
|
71
72
|
className: "text-destructive text-label-md -mt-1",
|
|
72
|
-
children:
|
|
73
|
+
children: r
|
|
73
74
|
}
|
|
74
|
-
) :
|
|
75
|
+
) : c ? /* @__PURE__ */ e.jsx(
|
|
75
76
|
"span",
|
|
76
77
|
{
|
|
77
|
-
id:
|
|
78
|
-
className:
|
|
79
|
-
"text-muted-foreground": !
|
|
80
|
-
"text-destructive":
|
|
81
|
-
"text-
|
|
78
|
+
id: a.id && `${a.id}-helper-text`,
|
|
79
|
+
className: m("text-label-md -mt-1", {
|
|
80
|
+
"text-muted-foreground": !r && !u,
|
|
81
|
+
"text-destructive": r && u,
|
|
82
|
+
"text-muted-foreground opacity-50": a.disabled
|
|
82
83
|
}),
|
|
83
|
-
children:
|
|
84
|
+
children: c
|
|
84
85
|
}
|
|
85
86
|
) : null
|
|
86
87
|
] })
|
|
87
88
|
);
|
|
88
89
|
_.displayName = "PhoneInput";
|
|
89
|
-
const y = f.forwardRef(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
);
|
|
90
|
+
const y = f.forwardRef(({ className: t, rounded: n = "default", error: l, touched: s, size: o, ...d }, c) => {
|
|
91
|
+
const { "data-country": p, ...r } = d;
|
|
92
|
+
return /* @__PURE__ */ e.jsx(
|
|
93
|
+
R,
|
|
94
|
+
{
|
|
95
|
+
size: o,
|
|
96
|
+
containerClassName: "w-full",
|
|
97
|
+
className: m(
|
|
98
|
+
"w-full",
|
|
99
|
+
{
|
|
100
|
+
"border-destructive": l && s,
|
|
101
|
+
"border-blue-800": s && !l,
|
|
102
|
+
"rounded-s-none rounded-e-lg": n !== "full",
|
|
103
|
+
"rounded-s-none rounded-e-full": n === "full",
|
|
104
|
+
"rounded-e-sm": o === "sm",
|
|
105
|
+
"rounded-e-md": o === "md",
|
|
106
|
+
"rounded-e-lg": o === "lg"
|
|
107
|
+
},
|
|
108
|
+
t
|
|
109
|
+
),
|
|
110
|
+
...r,
|
|
111
|
+
ref: c
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
});
|
|
116
115
|
y.displayName = "InputComponent";
|
|
117
116
|
const q = ({
|
|
118
117
|
disabled: t,
|
|
119
118
|
value: n,
|
|
120
|
-
options:
|
|
119
|
+
options: l,
|
|
121
120
|
onChange: s,
|
|
122
121
|
size: o = "md",
|
|
123
|
-
rounded:
|
|
124
|
-
error:
|
|
122
|
+
rounded: d = "default",
|
|
123
|
+
error: c,
|
|
125
124
|
touched: p
|
|
126
125
|
}) => {
|
|
127
|
-
const
|
|
126
|
+
const r = f.useRef(null), [u, x] = f.useState(""), [a, b] = f.useState(!1);
|
|
128
127
|
return /* @__PURE__ */ e.jsxs(
|
|
129
|
-
|
|
128
|
+
$,
|
|
130
129
|
{
|
|
131
|
-
open:
|
|
130
|
+
open: a,
|
|
132
131
|
modal: !0,
|
|
133
|
-
onOpenChange: (
|
|
134
|
-
|
|
132
|
+
onOpenChange: (i) => {
|
|
133
|
+
b(i), i && x("");
|
|
135
134
|
},
|
|
136
135
|
children: [
|
|
137
|
-
/* @__PURE__ */ e.jsx(
|
|
136
|
+
/* @__PURE__ */ e.jsx(E, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
138
137
|
"button",
|
|
139
138
|
{
|
|
140
139
|
type: "button",
|
|
141
|
-
className:
|
|
142
|
-
"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
|
|
143
|
-
|
|
140
|
+
className: m(
|
|
141
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 flex w-fit min-w-0 items-center justify-center border border-r-0 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 focus-visible:z-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
142
|
+
d === "default" ? "rounded-e-none" : "rounded-s-full rounded-e-none",
|
|
144
143
|
{
|
|
145
|
-
"outline-destructive":
|
|
146
|
-
"outline-blue-800": p && !
|
|
144
|
+
"outline-destructive": c && p,
|
|
145
|
+
"outline-blue-800": p && !c,
|
|
147
146
|
"text-label-md h-8 rounded-s-sm px-2 py-1": o === "sm",
|
|
148
147
|
"text-label-lg h-12 rounded-s-md px-3 py-1": o === "md",
|
|
149
148
|
"text-label-xl h-16 rounded-s-lg px-4 py-2": o === "lg"
|
|
@@ -163,7 +162,7 @@ const q = ({
|
|
|
163
162
|
C,
|
|
164
163
|
{
|
|
165
164
|
iconName: "IconChevronDown",
|
|
166
|
-
className:
|
|
165
|
+
className: m(
|
|
167
166
|
"-mr-2 size-4 opacity-50",
|
|
168
167
|
t ? "hidden" : "opacity-100"
|
|
169
168
|
)
|
|
@@ -172,37 +171,37 @@ const q = ({
|
|
|
172
171
|
]
|
|
173
172
|
}
|
|
174
173
|
) }),
|
|
175
|
-
/* @__PURE__ */ e.jsx(
|
|
174
|
+
/* @__PURE__ */ e.jsx(F, { className: "w-[300px] p-0", children: /* @__PURE__ */ e.jsxs(N, { children: [
|
|
176
175
|
/* @__PURE__ */ e.jsx(
|
|
177
|
-
|
|
176
|
+
v,
|
|
178
177
|
{
|
|
179
|
-
value:
|
|
180
|
-
onValueChange: (
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
178
|
+
value: u,
|
|
179
|
+
onValueChange: (i) => {
|
|
180
|
+
x(i), setTimeout(() => {
|
|
181
|
+
if (r.current) {
|
|
182
|
+
const g = r.current.querySelector(
|
|
184
183
|
"[data-radix-scroll-area-viewport]"
|
|
185
184
|
);
|
|
186
|
-
|
|
185
|
+
g && (g.scrollTop = 0);
|
|
187
186
|
}
|
|
188
187
|
}, 0);
|
|
189
188
|
},
|
|
190
189
|
placeholder: "Search country..."
|
|
191
190
|
}
|
|
192
191
|
),
|
|
193
|
-
/* @__PURE__ */ e.jsx(
|
|
194
|
-
/* @__PURE__ */ e.jsx(
|
|
195
|
-
/* @__PURE__ */ e.jsx(
|
|
196
|
-
({ value:
|
|
192
|
+
/* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsxs(L, { ref: r, className: "h-72", children: [
|
|
193
|
+
/* @__PURE__ */ e.jsx(w, { children: "No country found." }),
|
|
194
|
+
/* @__PURE__ */ e.jsx(S, { children: l.map(
|
|
195
|
+
({ value: i, label: g }) => i ? /* @__PURE__ */ e.jsx(
|
|
197
196
|
D,
|
|
198
197
|
{
|
|
199
|
-
country:
|
|
200
|
-
countryName:
|
|
198
|
+
country: i,
|
|
199
|
+
countryName: g,
|
|
201
200
|
selectedCountry: n,
|
|
202
201
|
onChange: s,
|
|
203
|
-
onSelectComplete: () =>
|
|
202
|
+
onSelectComplete: () => b(!1)
|
|
204
203
|
},
|
|
205
|
-
|
|
204
|
+
i
|
|
206
205
|
) : null
|
|
207
206
|
) })
|
|
208
207
|
] }) })
|
|
@@ -213,14 +212,14 @@ const q = ({
|
|
|
213
212
|
}, D = ({
|
|
214
213
|
country: t,
|
|
215
214
|
countryName: n,
|
|
216
|
-
selectedCountry:
|
|
215
|
+
selectedCountry: l,
|
|
217
216
|
onChange: s,
|
|
218
217
|
onSelectComplete: o
|
|
219
218
|
}) => {
|
|
220
|
-
const
|
|
219
|
+
const d = () => {
|
|
221
220
|
s(t), o();
|
|
222
221
|
};
|
|
223
|
-
return /* @__PURE__ */ e.jsxs(
|
|
222
|
+
return /* @__PURE__ */ e.jsxs(P, { className: "gap-2", onSelect: d, children: [
|
|
224
223
|
/* @__PURE__ */ e.jsx(h, { country: t, countryName: n }),
|
|
225
224
|
/* @__PURE__ */ e.jsx("span", { className: "flex-1 text-sm", children: n }),
|
|
226
225
|
/* @__PURE__ */ e.jsx("span", { className: "text-foreground/50 text-sm", children: `+${j.getCountryCallingCode(t)}` }),
|
|
@@ -228,22 +227,22 @@ const q = ({
|
|
|
228
227
|
C,
|
|
229
228
|
{
|
|
230
229
|
iconName: "IconCheck",
|
|
231
|
-
className: `ml-auto size-4 ${t ===
|
|
230
|
+
className: `ml-auto size-4 ${t === l ? "opacity-100" : "opacity-0"}`
|
|
232
231
|
}
|
|
233
232
|
)
|
|
234
233
|
] });
|
|
235
234
|
}, h = ({
|
|
236
235
|
country: t,
|
|
237
236
|
countryName: n,
|
|
238
|
-
disabled:
|
|
237
|
+
disabled: l
|
|
239
238
|
}) => {
|
|
240
|
-
const s =
|
|
239
|
+
const s = V[t];
|
|
241
240
|
return /* @__PURE__ */ e.jsx(
|
|
242
241
|
"span",
|
|
243
242
|
{
|
|
244
|
-
className:
|
|
243
|
+
className: m(
|
|
245
244
|
"bg-foreground/20 flex h-4 w-6 overflow-hidden rounded-[4px] [&_svg:not([class*='size-'])]:size-full",
|
|
246
|
-
{ "opacity-50":
|
|
245
|
+
{ "opacity-50": l }
|
|
247
246
|
),
|
|
248
247
|
children: s && /* @__PURE__ */ e.jsx(s, { title: n })
|
|
249
248
|
}
|
|
@@ -2,9 +2,9 @@ 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
|
-
import * as
|
|
6
|
-
import { I as
|
|
7
|
-
const
|
|
5
|
+
import * as y from "react";
|
|
6
|
+
import { I as d } from "./icon-component-CxQsODCa.js";
|
|
7
|
+
const I = N(
|
|
8
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: {
|
|
@@ -37,7 +37,7 @@ function V({
|
|
|
37
37
|
error: t,
|
|
38
38
|
touched: i,
|
|
39
39
|
iconName: f,
|
|
40
|
-
iconPosition:
|
|
40
|
+
iconPosition: n = "left",
|
|
41
41
|
type: l = "text",
|
|
42
42
|
size: g,
|
|
43
43
|
rounded: v,
|
|
@@ -45,7 +45,7 @@ function V({
|
|
|
45
45
|
containerClassName: p,
|
|
46
46
|
...e
|
|
47
47
|
}) {
|
|
48
|
-
const [o, w] =
|
|
48
|
+
const [o, w] = y.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
51
|
return /* @__PURE__ */ s.jsxs("div", { className: r("flex flex-col gap-2", p), children: [
|
|
@@ -53,24 +53,24 @@ function V({
|
|
|
53
53
|
j,
|
|
54
54
|
{
|
|
55
55
|
htmlFor: e.id,
|
|
56
|
-
className: r({
|
|
57
|
-
"
|
|
56
|
+
className: r("mb-1", {
|
|
57
|
+
"opacity-50": e.disabled
|
|
58
58
|
}),
|
|
59
59
|
children: x
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
62
|
/* @__PURE__ */ s.jsxs("div", { className: "relative w-full", children: [
|
|
63
|
-
a &&
|
|
63
|
+
a && n === "left" && /* @__PURE__ */ s.jsx(
|
|
64
64
|
"span",
|
|
65
65
|
{
|
|
66
66
|
className: r("absolute top-1/2 left-3 -translate-y-1/2", {
|
|
67
67
|
"text-muted-foreground": c === "default",
|
|
68
68
|
"text-destructive": c === "error",
|
|
69
69
|
"text-success-main": c === "success",
|
|
70
|
-
"text-
|
|
70
|
+
"text-muted-foreground opacity-50": e.disabled
|
|
71
71
|
}),
|
|
72
72
|
children: /* @__PURE__ */ s.jsx(
|
|
73
|
-
|
|
73
|
+
d,
|
|
74
74
|
{
|
|
75
75
|
iconName: a.name,
|
|
76
76
|
stroke: a.stroke,
|
|
@@ -88,14 +88,14 @@ function V({
|
|
|
88
88
|
"aria-invalid": !!(t && i),
|
|
89
89
|
"aria-errormessage": e.id && t ? `${e.id}-error-text` : void 0,
|
|
90
90
|
className: r(
|
|
91
|
-
|
|
91
|
+
I({
|
|
92
92
|
size: g,
|
|
93
93
|
rounded: v,
|
|
94
94
|
state: c,
|
|
95
95
|
className: r(
|
|
96
96
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
97
|
-
a &&
|
|
98
|
-
a &&
|
|
97
|
+
a && n === "left" ? "pl-10" : "",
|
|
98
|
+
a && n === "right" || l === "password" ? "pr-10" : "",
|
|
99
99
|
l === "color" ? "h-[50px] p-0" : "",
|
|
100
100
|
b
|
|
101
101
|
)
|
|
@@ -113,7 +113,7 @@ function V({
|
|
|
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
115
|
children: /* @__PURE__ */ s.jsx(
|
|
116
|
-
|
|
116
|
+
d,
|
|
117
117
|
{
|
|
118
118
|
iconName: o ? "IconEyeOff" : "IconEye",
|
|
119
119
|
size: 20
|
|
@@ -121,8 +121,8 @@ function V({
|
|
|
121
121
|
)
|
|
122
122
|
}
|
|
123
123
|
),
|
|
124
|
-
a &&
|
|
125
|
-
|
|
124
|
+
a && n === "right" && l !== "password" && /* @__PURE__ */ s.jsx("span", { className: "absolute top-1/2 right-3 -translate-y-1/2", children: /* @__PURE__ */ s.jsx(
|
|
125
|
+
d,
|
|
126
126
|
{
|
|
127
127
|
iconName: a.name,
|
|
128
128
|
stroke: a.stroke,
|
|
@@ -130,7 +130,7 @@ function V({
|
|
|
130
130
|
}
|
|
131
131
|
) }),
|
|
132
132
|
!a && t && i && l !== "password" && /* @__PURE__ */ s.jsx(
|
|
133
|
-
|
|
133
|
+
d,
|
|
134
134
|
{
|
|
135
135
|
iconName: "IconAlertCircleFilled",
|
|
136
136
|
size: 20,
|
|
@@ -138,7 +138,7 @@ function V({
|
|
|
138
138
|
}
|
|
139
139
|
),
|
|
140
140
|
!a && i && !t && e.value && l !== "password" && /* @__PURE__ */ s.jsx(
|
|
141
|
-
|
|
141
|
+
d,
|
|
142
142
|
{
|
|
143
143
|
iconName: "IconCircleCheckFilled",
|
|
144
144
|
size: 20,
|
|
@@ -162,7 +162,7 @@ function V({
|
|
|
162
162
|
"text-muted-foreground": !t && !i,
|
|
163
163
|
"text-destructive": t && i,
|
|
164
164
|
"text-success-main": i && !t && e.value !== void 0,
|
|
165
|
-
"text-
|
|
165
|
+
"text-muted-foreground opacity-50": e.disabled
|
|
166
166
|
}),
|
|
167
167
|
children: u
|
|
168
168
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-BuHQgaKs.cjs"),h=require("./label-U5GnYvFO.cjs"),d=require("./index-DoxiiusW.cjs"),y=require("./index-C8P6Mn4U.cjs"),N=require("react"),c=require("./icon-component-D5YssRbR.cjs");function R(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const a in l)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(l,a);Object.defineProperty(o,a,t.get?t:{enumerable:!0,get:()=>l[a]})}}return o.default=l,Object.freeze(o)}const E=R(N),I=y.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:l,label:o,helperText:a,error:t,touched:i,iconName:b,iconPosition:u="left",type:r="text",size:p,rounded:g,state:k,containerClassName:j,...e}){const[x,v]=E.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("mb-1",{"opacity-50":e.disabled}),children:o}),s.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[n&&u==="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-muted-foreground opacity-50":e.disabled}),children:s.jsxRuntimeExports.jsx(c.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),s.jsxRuntimeExports.jsx("input",{type:r==="password"?x?"text":"password":r,"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(I({size:p,rounded:g,state:m,className:d.cn("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",n&&u==="left"?"pl-10":"",n&&u==="right"||r==="password"?"pr-10":"",r==="color"?"h-[50px] p-0":"",l)})),...e}),r==="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(c.IconComponent,{iconName:x?"IconEyeOff":"IconEye",size:20})}),n&&u==="right"&&r!=="password"&&s.jsxRuntimeExports.jsx("span",{className:"absolute top-1/2 right-3 -translate-y-1/2",children:s.jsxRuntimeExports.jsx(c.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),!n&&t&&i&&r!=="password"&&s.jsxRuntimeExports.jsx(c.IconComponent,{iconName:"IconAlertCircleFilled",size:20,className:"text-destructive absolute top-1/2 right-3 -translate-y-1/2"}),!n&&i&&!t&&e.value&&r!=="password"&&s.jsxRuntimeExports.jsx(c.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-muted-foreground opacity-50":e.disabled}),children:a}):null]})}exports.Input=z;
|
package/package.json
CHANGED
package/dist/input-Dm-TUC5P.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-BuHQgaKs.cjs"),h=require("./label-U5GnYvFO.cjs"),d=require("./index-DoxiiusW.cjs"),N=require("./index-C8P6Mn4U.cjs"),R=require("react"),c=require("./icon-component-D5YssRbR.cjs");function E(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 I=E(R),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:u="left",type:l="text",size:g,rounded:p,state:k,containerClassName:j,...e}){const[x,v]=I.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&&u==="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(c.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&&u==="left"?"pl-10":"",n&&u==="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(c.IconComponent,{iconName:x?"IconEyeOff":"IconEye",size:20})}),n&&u==="right"&&l!=="password"&&s.jsxRuntimeExports.jsx("span",{className:"absolute top-1/2 right-3 -translate-y-1/2",children:s.jsxRuntimeExports.jsx(c.IconComponent,{iconName:n.name,stroke:n.stroke,size:20})}),!n&&t&&i&&l!=="password"&&s.jsxRuntimeExports.jsx(c.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(c.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;
|