@clasing/ui 2.0.0 → 2.0.1
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/button-BnSM-lrr.cjs +1 -0
- package/dist/{button-DU1x2trm.js → button-C5IBh3Tr.js} +92 -92
- package/dist/components/alert-dialog.cjs.js +1 -1
- package/dist/components/alert-dialog.es.js +1 -1
- package/dist/components/button.cjs.js +1 -1
- package/dist/components/button.es.js +1 -1
- package/dist/components/form.cjs.js +1 -0
- package/dist/components/form.d.ts +24 -0
- package/dist/components/form.es.js +101 -0
- package/dist/components/input.cjs.js +1 -1
- package/dist/components/input.d.ts +3 -15
- 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/entries/form.d.ts +2 -0
- package/dist/input-Bs18T-Y3.js +97 -0
- package/dist/input-wSGCWBH-.cjs +1 -0
- package/package.json +367 -359
- package/dist/button-dueLddAn.cjs +0 -1
- package/dist/input-BoPcvULq.js +0 -174
- package/dist/input-eri6Lyeo.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-wSGCWBH-.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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-DywqP_6a.js";
|
|
2
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-
|
|
3
|
+
import { I as R } from "../input-Bs18T-Y3.js";
|
|
4
4
|
import { L as O } from "../label-_kG7WBoJ.js";
|
|
5
5
|
import { P as $, c as E, b as F } from "../popover-CHAUhJda.js";
|
|
6
6
|
import { S as L } from "../scroll-area-DwBiu3Jn.js";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { j as r } from "./jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { c as u } from "./index-CRiPKpXj.js";
|
|
3
|
+
import { c as x } from "./index-BqtVL8d-.js";
|
|
4
|
+
import * as b from "react";
|
|
5
|
+
import { B as g } from "./button-C5IBh3Tr.js";
|
|
6
|
+
import { I as m } from "./icon-component-CxQsODCa.js";
|
|
7
|
+
const p = x(
|
|
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 rounded-md border bg-transparent transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
xs: "text-label-sm h-7 px-2 py-1",
|
|
13
|
+
sm: "text-label-md h-8 px-2 py-1",
|
|
14
|
+
md: "text-label-lg h-12 px-3 py-1",
|
|
15
|
+
lg: "text-label-xl h-16 px-4 py-2"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: "md"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
function k({
|
|
24
|
+
className: n,
|
|
25
|
+
type: s,
|
|
26
|
+
size: t,
|
|
27
|
+
iconName: l,
|
|
28
|
+
iconPosition: a = "left",
|
|
29
|
+
...d
|
|
30
|
+
}) {
|
|
31
|
+
const [i, c] = b.useState(!1), e = l ? ((o) => typeof o == "string" ? { name: o } : o)(l) : void 0, f = () => {
|
|
32
|
+
c(!i);
|
|
33
|
+
};
|
|
34
|
+
return !e && s !== "password" ? /* @__PURE__ */ r.jsx(
|
|
35
|
+
"input",
|
|
36
|
+
{
|
|
37
|
+
type: s,
|
|
38
|
+
"data-slot": "input",
|
|
39
|
+
className: u(
|
|
40
|
+
p({ size: t }),
|
|
41
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
42
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
43
|
+
n
|
|
44
|
+
),
|
|
45
|
+
...d
|
|
46
|
+
}
|
|
47
|
+
) : /* @__PURE__ */ r.jsxs("div", { className: "relative w-full", children: [
|
|
48
|
+
e && a === "left" && /* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground absolute top-1/2 left-3 -translate-y-1/2", children: /* @__PURE__ */ r.jsx(
|
|
49
|
+
m,
|
|
50
|
+
{
|
|
51
|
+
iconName: e.name,
|
|
52
|
+
stroke: e.stroke,
|
|
53
|
+
size: 20
|
|
54
|
+
}
|
|
55
|
+
) }),
|
|
56
|
+
/* @__PURE__ */ r.jsx(
|
|
57
|
+
"input",
|
|
58
|
+
{
|
|
59
|
+
type: s === "password" ? i ? "text" : "password" : s,
|
|
60
|
+
"data-slot": "input",
|
|
61
|
+
className: u(
|
|
62
|
+
p({ size: t }),
|
|
63
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
64
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
65
|
+
e && a === "left" ? "pl-10" : "",
|
|
66
|
+
e && a === "right" || s === "password" ? "pr-10" : "",
|
|
67
|
+
n
|
|
68
|
+
),
|
|
69
|
+
...d
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
s === "password" && /* @__PURE__ */ r.jsx(
|
|
73
|
+
g,
|
|
74
|
+
{
|
|
75
|
+
variant: "inverse",
|
|
76
|
+
type: "button",
|
|
77
|
+
size: t === "xs" || t === "sm" ? "xs" : "md",
|
|
78
|
+
tabIndex: -1,
|
|
79
|
+
"aria-label": i ? "Hide password" : "Show password",
|
|
80
|
+
className: "absolute top-1/2 right-3 -translate-y-1/2",
|
|
81
|
+
onClick: f,
|
|
82
|
+
iconName: i ? "IconEyeOff" : "IconEye"
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
e && a === "right" && s !== "password" && /* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground absolute top-1/2 right-3 -translate-y-1/2", children: /* @__PURE__ */ r.jsx(
|
|
86
|
+
m,
|
|
87
|
+
{
|
|
88
|
+
iconName: e.name,
|
|
89
|
+
stroke: e.stroke,
|
|
90
|
+
size: 20
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
k as I
|
|
97
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("./jsx-runtime-BuHQgaKs.cjs"),u=require("./index-DoxiiusW.cjs"),f=require("./index-C8P6Mn4U.cjs"),b=require("react"),g=require("./button-BnSM-lrr.cjs"),c=require("./icon-component-D5YssRbR.cjs");function v(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const j=v(b),p=f.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 rounded-md border bg-transparent transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{size:{xs:"text-label-sm h-7 px-2 py-1",sm:"text-label-md h-8 px-2 py-1",md:"text-label-lg h-12 px-3 py-1",lg:"text-label-xl h-16 px-4 py-2"}},defaultVariants:{size:"md"}});function w({className:s,type:e,size:t,iconName:i,iconPosition:a="left",...d}){const[o,x]=j.useState(!1),r=i?(l=>typeof l=="string"?{name:l}:l)(i):void 0,m=()=>{x(!o)};return!r&&e!=="password"?n.jsxRuntimeExports.jsx("input",{type:e,"data-slot":"input",className:u.cn(p({size:t}),"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",s),...d}):n.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[r&&a==="left"&&n.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground absolute top-1/2 left-3 -translate-y-1/2",children:n.jsxRuntimeExports.jsx(c.IconComponent,{iconName:r.name,stroke:r.stroke,size:20})}),n.jsxRuntimeExports.jsx("input",{type:e==="password"?o?"text":"password":e,"data-slot":"input",className:u.cn(p({size:t}),"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",r&&a==="left"?"pl-10":"",r&&a==="right"||e==="password"?"pr-10":"",s),...d}),e==="password"&&n.jsxRuntimeExports.jsx(g.Button,{variant:"inverse",type:"button",size:t==="xs"||t==="sm"?"xs":"md",tabIndex:-1,"aria-label":o?"Hide password":"Show password",className:"absolute top-1/2 right-3 -translate-y-1/2",onClick:m,iconName:o?"IconEyeOff":"IconEye"}),r&&a==="right"&&e!=="password"&&n.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground absolute top-1/2 right-3 -translate-y-1/2",children:n.jsxRuntimeExports.jsx(c.IconComponent,{iconName:r.name,stroke:r.stroke,size:20})})]})}exports.Input=w;
|