@worldcoin/mini-apps-ui-kit-react 1.0.0-canary.13 → 1.0.0-canary.15
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/AlertDialog/AlertDialog.js +58 -65
- package/dist/components/CircularIcon/CircularIcon.d.ts +2 -2
- package/dist/components/CircularIcon/CircularIcon.js +15 -9
- package/dist/components/CountryDrawer/CountryDrawer.d.ts +12 -1
- package/dist/components/CountryDrawer/CountryDrawer.js +43 -41
- package/dist/components/Drawer/Drawer.js +43 -42
- package/dist/components/Input/Input.js +29 -30
- package/dist/components/Tabs/Tabs.js +16 -15
- package/dist/components/TopBar/TopBar.d.ts +3 -1
- package/dist/components/TopBar/TopBar.js +29 -19
- package/dist/components/Typography/Typography.js +9 -9
- package/package.json +1 -1
- package/public/globals.css +2 -2305
@@ -1,91 +1,84 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as
|
3
|
-
import { cn as
|
4
|
-
import * as
|
2
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
3
|
+
import { cn as i } from "../../lib/utils.js";
|
4
|
+
import * as s from "react";
|
5
5
|
import { Drawer as o } from "../../node_modules/.pnpm/vaul@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3.18_react-dom@18.3._7iqkcrcg5qjc3n2ixm6rnrnx3e/node_modules/vaul/dist/index.js";
|
6
|
-
import { BottomBar as
|
7
|
-
import { Button as
|
8
|
-
import { XMark as
|
9
|
-
import { Typography as
|
10
|
-
import { AlertDialogContext as
|
11
|
-
const
|
6
|
+
import { BottomBar as f } from "../BottomBar/BottomBar.js";
|
7
|
+
import { Button as p } from "../Button/Button.js";
|
8
|
+
import { XMark as D } from "../Icons/XMark.js";
|
9
|
+
import { Typography as d } from "../Typography/Typography.js";
|
10
|
+
import { AlertDialogContext as h, useAlertDialog as A } from "./use-alert-dialog.js";
|
11
|
+
const u = ({ dismissible: l = !0, modal: r = !0, ...a }) => /* @__PURE__ */ e(h.Provider, { value: { dismissible: l }, children: /* @__PURE__ */ e(
|
12
12
|
o.Root,
|
13
13
|
{
|
14
14
|
shouldScaleBackground: !1,
|
15
|
-
dismissible:
|
16
|
-
modal:
|
17
|
-
...
|
15
|
+
dismissible: l,
|
16
|
+
modal: r,
|
17
|
+
...a
|
18
18
|
}
|
19
19
|
) });
|
20
|
-
|
21
|
-
const
|
22
|
-
|
23
|
-
const
|
24
|
-
|
25
|
-
const y =
|
26
|
-
/* @__PURE__ */
|
20
|
+
u.displayName = "AlertDialog";
|
21
|
+
const N = s.forwardRef((l, r) => /* @__PURE__ */ e(o.Trigger, { ref: r, ...l }));
|
22
|
+
N.displayName = "AlertDialogTrigger";
|
23
|
+
const x = o.Portal, g = s.forwardRef((l, r) => /* @__PURE__ */ e(o.Close, { ref: r, ...l }));
|
24
|
+
g.displayName = "AlertDialogClose";
|
25
|
+
const y = s.forwardRef(({ className: l, children: r, ...a }, t) => /* @__PURE__ */ n(x, { children: [
|
26
|
+
/* @__PURE__ */ e(
|
27
27
|
o.Overlay,
|
28
28
|
{
|
29
|
-
ref:
|
30
|
-
className:
|
31
|
-
...
|
29
|
+
ref: t,
|
30
|
+
className: i("fixed inset-0 z-50 bg-gray-900/40", l),
|
31
|
+
...a
|
32
32
|
}
|
33
33
|
),
|
34
|
-
/* @__PURE__ */
|
34
|
+
/* @__PURE__ */ e(
|
35
35
|
o.Content,
|
36
36
|
{
|
37
|
-
ref:
|
38
|
-
className:
|
39
|
-
...
|
40
|
-
children: /* @__PURE__ */
|
37
|
+
ref: t,
|
38
|
+
className: i("fixed inset-x-0 bottom-0 z-50 mt-24 h-auto", l),
|
39
|
+
...a,
|
40
|
+
children: /* @__PURE__ */ e("div", { className: "flex flex-col rounded-[1.75rem] bg-gray-0 m-3 p-8", children: r })
|
41
41
|
}
|
42
42
|
)
|
43
43
|
] }));
|
44
44
|
y.displayName = "AlertDialogContent";
|
45
|
-
const
|
46
|
-
const { dismissible:
|
47
|
-
return /* @__PURE__ */ n(
|
48
|
-
"div",
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
e,
|
58
|
-
l
|
59
|
-
] }),
|
60
|
-
a && /* @__PURE__ */ r("div", { className: "shrink-0", children: /* @__PURE__ */ r(d, { asChild: !0, children: /* @__PURE__ */ r(g, { variant: "tertiary", size: "icon", children: /* @__PURE__ */ r(f, {}) }) }) })
|
61
|
-
]
|
62
|
-
}
|
63
|
-
);
|
45
|
+
const v = ({ icon: l, children: r, ...a }) => {
|
46
|
+
const { dismissible: t } = A(), c = t && /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e(p, { variant: "tertiary", size: "icon", children: /* @__PURE__ */ e(D, {}) }) }) }), m = "flex justify-between w-full";
|
47
|
+
return l ? /* @__PURE__ */ n("div", { className: "mb-4 flex flex-col gap-6", children: [
|
48
|
+
/* @__PURE__ */ n("div", { className: i(m), ...a, children: [
|
49
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col", children: l }),
|
50
|
+
c
|
51
|
+
] }),
|
52
|
+
r
|
53
|
+
] }) : /* @__PURE__ */ n("div", { className: i(m, "gap-4 mb-4 items-center"), ...a, children: [
|
54
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col gap-6", children: r }),
|
55
|
+
c
|
56
|
+
] });
|
64
57
|
};
|
65
|
-
|
66
|
-
const
|
67
|
-
|
68
|
-
const
|
69
|
-
|
70
|
-
const
|
58
|
+
v.displayName = "AlertDialogHeader";
|
59
|
+
const C = (l) => /* @__PURE__ */ e(f, { ...l });
|
60
|
+
C.displayName = "AlertDialogFooter";
|
61
|
+
const b = s.forwardRef(({ className: l, children: r, ...a }, t) => /* @__PURE__ */ e(o.Title, { ref: t, ...a, asChild: !0, children: /* @__PURE__ */ e(d, { variant: "heading", level: 2, children: r }) }));
|
62
|
+
b.displayName = "AlertDialogTitle";
|
63
|
+
const w = s.forwardRef(({ className: l, children: r, ...a }, t) => /* @__PURE__ */ e(
|
71
64
|
o.Description,
|
72
65
|
{
|
73
|
-
ref:
|
74
|
-
className:
|
75
|
-
...
|
66
|
+
ref: t,
|
67
|
+
className: i("text-gray-500 mb-8", l),
|
68
|
+
...a,
|
76
69
|
asChild: !0,
|
77
|
-
children: /* @__PURE__ */
|
70
|
+
children: /* @__PURE__ */ e(d, { children: r })
|
78
71
|
}
|
79
72
|
));
|
80
|
-
|
73
|
+
w.displayName = "AlertDialogDescription";
|
81
74
|
export {
|
82
|
-
|
83
|
-
|
75
|
+
u as AlertDialog,
|
76
|
+
g as AlertDialogClose,
|
84
77
|
y as AlertDialogContent,
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
78
|
+
w as AlertDialogDescription,
|
79
|
+
C as AlertDialogFooter,
|
80
|
+
v as AlertDialogHeader,
|
81
|
+
x as AlertDialogPortal,
|
82
|
+
b as AlertDialogTitle,
|
83
|
+
N as AlertDialogTrigger
|
91
84
|
};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
2
|
export type CircularIconSize = "xs" | "sm" | "md" | "lg" | "xl";
|
3
|
-
export interface CircularIconProps {
|
3
|
+
export interface CircularIconProps extends React.HTMLAttributes<HTMLDivElement> {
|
4
4
|
children?: ReactNode;
|
5
5
|
className?: string;
|
6
6
|
size?: CircularIconSize;
|
7
7
|
}
|
8
|
-
export declare function CircularIcon({ children, className, size }: CircularIconProps): import("react/jsx-runtime").JSX.Element;
|
8
|
+
export declare function CircularIcon({ children, className, size, ...props }: CircularIconProps): import("react/jsx-runtime").JSX.Element;
|
@@ -1,32 +1,38 @@
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
2
|
-
import { Slot as
|
3
|
-
import { cn as
|
4
|
-
const
|
2
|
+
import { Slot as l } from "../../node_modules/.pnpm/@radix-ui_react-slot@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.js";
|
3
|
+
import { cn as o } from "../../lib/utils.js";
|
4
|
+
const t = {
|
5
5
|
xs: "size-6",
|
6
6
|
sm: "size-11",
|
7
7
|
md: "size-12",
|
8
8
|
lg: "size-16",
|
9
9
|
xl: "size-[5.5rem]"
|
10
|
-
},
|
10
|
+
}, c = {
|
11
11
|
xs: "size-[0.875rem]",
|
12
12
|
sm: "size-[1.5rem]",
|
13
13
|
md: "size-[1.625rem]",
|
14
14
|
lg: "size-[2.125rem]",
|
15
15
|
xl: "size-12"
|
16
16
|
};
|
17
|
-
function
|
17
|
+
function d({
|
18
|
+
children: i,
|
19
|
+
className: r,
|
20
|
+
size: e = "md",
|
21
|
+
...m
|
22
|
+
}) {
|
18
23
|
return /* @__PURE__ */ s(
|
19
24
|
"div",
|
20
25
|
{
|
21
|
-
className:
|
26
|
+
className: o(
|
22
27
|
"rounded-full flex items-center justify-center",
|
23
|
-
|
28
|
+
t[e],
|
24
29
|
r
|
25
30
|
),
|
26
|
-
|
31
|
+
...m,
|
32
|
+
children: /* @__PURE__ */ s(l, { className: c[e], children: i })
|
27
33
|
}
|
28
34
|
);
|
29
35
|
}
|
30
36
|
export {
|
31
|
-
|
37
|
+
d as CircularIcon
|
32
38
|
};
|
@@ -1,12 +1,23 @@
|
|
1
1
|
import { CountryCode } from '../Flag';
|
2
2
|
interface CountryDrawerProps {
|
3
|
+
/** Currently selected country code */
|
3
4
|
value: CountryCode;
|
5
|
+
/** Optional list of country codes to show. If not provided, shows all countries */
|
4
6
|
countries?: CountryCode[];
|
7
|
+
/** Whether the drawer trigger is disabled */
|
5
8
|
disabled?: boolean;
|
9
|
+
/** Default country code when no value is selected */
|
6
10
|
defaultValue?: CountryCode;
|
11
|
+
/** Content to render as the drawer trigger */
|
7
12
|
children: React.ReactNode;
|
13
|
+
/** Title text shown in the drawer header */
|
14
|
+
title?: string;
|
15
|
+
/** Label text shown in the search field */
|
16
|
+
searchLabel?: string;
|
17
|
+
/** Callback fired when a country is selected */
|
8
18
|
onChange: (countryCode: string) => void;
|
19
|
+
/** Optional callback fired when drawer open/close animation completes */
|
9
20
|
onAnimationEnd?: (open: boolean) => void;
|
10
21
|
}
|
11
|
-
export declare function CountryDrawer({ onChange, value, countries, onAnimationEnd, disabled, children, defaultValue, }: CountryDrawerProps): import("react/jsx-runtime").JSX.Element;
|
22
|
+
export declare function CountryDrawer({ onChange, value, countries, onAnimationEnd, disabled, children, defaultValue, title, searchLabel, }: CountryDrawerProps): import("react/jsx-runtime").JSX.Element;
|
12
23
|
export {};
|
@@ -1,64 +1,66 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsxs as
|
3
|
-
import { useState as i, useRef as
|
4
|
-
import { Button as
|
5
|
-
import { Drawer as
|
6
|
-
import { XMark as
|
7
|
-
import { GroupedCountryList as
|
8
|
-
import { SearchField as
|
9
|
-
import { TopBar as
|
2
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
3
|
+
import { useState as i, useRef as v } from "react";
|
4
|
+
import { Button as x } from "../Button/Button.js";
|
5
|
+
import { Drawer as D, DrawerTrigger as T, DrawerContent as N, DrawerClose as b } from "../Drawer/Drawer.js";
|
6
|
+
import { XMark as j } from "../Icons/XMark.js";
|
7
|
+
import { GroupedCountryList as k } from "../PhoneField/GroupedCountryList.js";
|
8
|
+
import { SearchField as B } from "../SearchField/SearchField.js";
|
9
|
+
import { TopBar as F } from "../TopBar/TopBar.js";
|
10
10
|
import { useCountryFiltering as G } from "./useCountryFiltering.js";
|
11
11
|
import { useCountryGrouping as O } from "./useCountryGrouping.js";
|
12
|
-
function
|
13
|
-
onChange:
|
14
|
-
value:
|
15
|
-
countries:
|
16
|
-
onAnimationEnd:
|
17
|
-
disabled:
|
12
|
+
function J({
|
13
|
+
onChange: l,
|
14
|
+
value: s,
|
15
|
+
countries: u,
|
16
|
+
onAnimationEnd: c,
|
17
|
+
disabled: m = !1,
|
18
18
|
children: h,
|
19
|
-
defaultValue:
|
19
|
+
defaultValue: f = "US",
|
20
|
+
title: p = "Country",
|
21
|
+
searchLabel: d
|
20
22
|
}) {
|
21
|
-
const [
|
22
|
-
|
23
|
-
},
|
24
|
-
countries:
|
25
|
-
searchText:
|
26
|
-
}),
|
27
|
-
countries:
|
28
|
-
defaultValue:
|
23
|
+
const [o, t] = i(""), [C, n] = i(!1), g = v(null), w = (r) => {
|
24
|
+
t(r.target.value);
|
25
|
+
}, y = G({
|
26
|
+
countries: u,
|
27
|
+
searchText: o
|
28
|
+
}), S = O({
|
29
|
+
countries: y,
|
30
|
+
defaultValue: f
|
29
31
|
});
|
30
|
-
return /* @__PURE__ */
|
31
|
-
/* @__PURE__ */ e(
|
32
|
-
/* @__PURE__ */
|
32
|
+
return /* @__PURE__ */ a(D, { open: C, onOpenChange: n, onAnimationEnd: c, height: "full", children: [
|
33
|
+
/* @__PURE__ */ e(T, { asChild: !0, className: "outline-none", disabled: m, children: h }),
|
34
|
+
/* @__PURE__ */ a(N, { children: [
|
33
35
|
/* @__PURE__ */ e(
|
34
|
-
|
36
|
+
F,
|
35
37
|
{
|
36
|
-
title:
|
37
|
-
startAdornment: /* @__PURE__ */ e(
|
38
|
+
title: p,
|
39
|
+
startAdornment: /* @__PURE__ */ e(b, { asChild: !0, children: /* @__PURE__ */ e(x, { variant: "tertiary", size: "icon", children: /* @__PURE__ */ e(j, {}) }) })
|
38
40
|
}
|
39
41
|
),
|
40
|
-
/* @__PURE__ */ e("div", { className: "p-6", children: /* @__PURE__ */ e(
|
41
|
-
|
42
|
+
/* @__PURE__ */ e("div", { className: "p-6 shrink-0", children: /* @__PURE__ */ e(
|
43
|
+
B,
|
42
44
|
{
|
43
|
-
ref:
|
44
|
-
value:
|
45
|
-
onChange:
|
46
|
-
|
45
|
+
ref: g,
|
46
|
+
value: o,
|
47
|
+
onChange: w,
|
48
|
+
label: d
|
47
49
|
}
|
48
50
|
) }),
|
49
|
-
/* @__PURE__ */ e("div", { className: "no-scrollbar w-full overflow-auto px-6
|
50
|
-
|
51
|
+
/* @__PURE__ */ e("div", { className: "no-scrollbar w-full overflow-auto px-6 grow", children: /* @__PURE__ */ e(
|
52
|
+
k,
|
51
53
|
{
|
52
|
-
groupedCountries:
|
54
|
+
groupedCountries: S,
|
53
55
|
onSelect: (r) => {
|
54
|
-
|
56
|
+
l(r), t(""), n(!1);
|
55
57
|
},
|
56
|
-
value:
|
58
|
+
value: s
|
57
59
|
}
|
58
60
|
) })
|
59
61
|
] })
|
60
62
|
] });
|
61
63
|
}
|
62
64
|
export {
|
63
|
-
|
65
|
+
J as CountryDrawer
|
64
66
|
};
|
@@ -1,45 +1,46 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as
|
3
|
-
import { cn as
|
4
|
-
import * as
|
2
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
3
|
+
import { cn as m } from "../../lib/utils.js";
|
4
|
+
import * as l from "react";
|
5
5
|
import { Drawer as i } from "../../node_modules/.pnpm/vaul@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3.18_react-dom@18.3._7iqkcrcg5qjc3n2ixm6rnrnx3e/node_modules/vaul/dist/index.js";
|
6
6
|
import "../BottomBar/BottomBar.js";
|
7
|
-
import { Button as
|
8
|
-
import { XMark as
|
7
|
+
import { Button as f } from "../Button/Button.js";
|
8
|
+
import { XMark as h } from "../Icons/XMark.js";
|
9
9
|
import { Typography as n } from "../Typography/Typography.js";
|
10
|
-
import { useDrawer as d, DrawerContext as
|
11
|
-
const
|
10
|
+
import { useDrawer as d, DrawerContext as p } from "./use-drawer.js";
|
11
|
+
const u = ({
|
12
12
|
dismissible: a = !0,
|
13
|
-
height:
|
14
|
-
modal:
|
15
|
-
...
|
16
|
-
}) => /* @__PURE__ */
|
13
|
+
height: e = "full",
|
14
|
+
modal: t = !0,
|
15
|
+
...o
|
16
|
+
}) => /* @__PURE__ */ r(p.Provider, { value: { dismissible: a, height: e }, children: /* @__PURE__ */ r(
|
17
17
|
i.Root,
|
18
18
|
{
|
19
19
|
shouldScaleBackground: !1,
|
20
20
|
dismissible: a,
|
21
|
-
modal:
|
21
|
+
modal: t,
|
22
22
|
direction: "bottom",
|
23
|
-
|
23
|
+
handleOnly: !0,
|
24
|
+
...o
|
24
25
|
}
|
25
26
|
) });
|
26
|
-
|
27
|
-
const
|
28
|
-
|
29
|
-
const
|
30
|
-
|
31
|
-
const N =
|
32
|
-
const { height:
|
33
|
-
return /* @__PURE__ */
|
34
|
-
/* @__PURE__ */
|
35
|
-
/* @__PURE__ */
|
27
|
+
u.displayName = "Drawer";
|
28
|
+
const w = l.forwardRef((a, e) => /* @__PURE__ */ r(i.Trigger, { ref: e, ...a }));
|
29
|
+
w.displayName = i.Trigger.displayName;
|
30
|
+
const y = l.forwardRef((a, e) => /* @__PURE__ */ r(i.Close, { ref: e, ...a })), c = l.forwardRef((a, e) => /* @__PURE__ */ r(i.Overlay, { ref: e, className: "fixed inset-0 z-50 bg-gray-900/40", ...a }));
|
31
|
+
c.displayName = i.Overlay.displayName;
|
32
|
+
const N = l.forwardRef((a, e) => {
|
33
|
+
const { height: t } = d();
|
34
|
+
return /* @__PURE__ */ s(i.Portal, { children: [
|
35
|
+
/* @__PURE__ */ r(c, {}),
|
36
|
+
/* @__PURE__ */ r(
|
36
37
|
i.Content,
|
37
38
|
{
|
38
|
-
ref:
|
39
|
+
ref: e,
|
39
40
|
...a,
|
40
|
-
className:
|
41
|
-
"fixed inset-x-0 bottom-0 z-50
|
42
|
-
|
41
|
+
className: m(
|
42
|
+
"fixed inset-x-0 bottom-0 z-50 bg-gray-0 outline-none flex flex-col",
|
43
|
+
t === "full" ? "top-0 rounded-none" : "h-auto rounded-t-[1.75rem]",
|
43
44
|
a.className
|
44
45
|
)
|
45
46
|
}
|
@@ -47,24 +48,24 @@ const N = t.forwardRef((a, r) => {
|
|
47
48
|
] });
|
48
49
|
});
|
49
50
|
N.displayName = "DrawerContent";
|
50
|
-
const
|
51
|
-
const { dismissible:
|
52
|
-
return /* @__PURE__ */
|
53
|
-
|
54
|
-
/* @__PURE__ */
|
55
|
-
|
51
|
+
const D = ({ icon: a, children: e, ...t }) => {
|
52
|
+
const { dismissible: o } = d();
|
53
|
+
return /* @__PURE__ */ s("div", { className: "flex justify-between items-center gap-4 mb-2 w-full", ...t, children: [
|
54
|
+
o && /* @__PURE__ */ r("div", { className: "shrink-0", children: /* @__PURE__ */ r(y, { asChild: !0, children: /* @__PURE__ */ r(f, { variant: "tertiary", size: "icon", children: /* @__PURE__ */ r(h, {}) }) }) }),
|
55
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-6", children: e }),
|
56
|
+
o && /* @__PURE__ */ r("div", { className: "shrink-0 size-10" })
|
56
57
|
] });
|
57
58
|
};
|
58
|
-
|
59
|
-
const
|
60
|
-
|
61
|
-
const v =
|
59
|
+
D.displayName = "DrawerHeader";
|
60
|
+
const g = l.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(i.Title, { ref: t, ...e, asChild: !0, children: /* @__PURE__ */ r(n, { variant: "subtitle", level: 1, children: e.children }) }));
|
61
|
+
g.displayName = i.Title.displayName;
|
62
|
+
const v = l.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(i.Description, { ref: t, className: "text-gray-500", ...e, asChild: !0, children: /* @__PURE__ */ r(n, { variant: "body", level: 2, children: e.children }) }));
|
62
63
|
v.displayName = i.Description.displayName;
|
63
64
|
export {
|
64
|
-
|
65
|
-
|
65
|
+
u as Drawer,
|
66
|
+
y as DrawerClose,
|
66
67
|
N as DrawerContent,
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
D as DrawerHeader,
|
69
|
+
g as DrawerTitle,
|
70
|
+
w as DrawerTrigger
|
70
71
|
};
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
2
|
-
import { cva as
|
2
|
+
import { cva as p } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
3
3
|
import * as L from "react";
|
4
4
|
import { cn as e } from "../../lib/utils.js";
|
5
5
|
import { Tick as R } from "../Icons/Tick.js";
|
6
6
|
import { typographyVariants as y } from "../Typography/Typography.js";
|
7
|
-
const
|
7
|
+
const c = 1.5, F = p(
|
8
8
|
e(
|
9
9
|
"peer h-[3.5rem] w-full rounded-[0.625rem] border border-gray-100 bg-gray-100 px-4 outline-none transition duration-300",
|
10
10
|
"file:hidden",
|
11
|
-
"invalid:border-error-600 invalid:focus:border-error-600 invalid:bg-gray-0",
|
12
11
|
"placeholder:text-gray-500",
|
13
12
|
"focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
14
13
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
@@ -37,7 +36,7 @@ const d = 1.5, F = c(
|
|
37
36
|
variant: "default"
|
38
37
|
}
|
39
38
|
}
|
40
|
-
),
|
39
|
+
), h = p(
|
41
40
|
"absolute top-1 bottom-1 flex items-center justify-center overflow-hidden text-gray-400",
|
42
41
|
{
|
43
42
|
variants: {
|
@@ -50,7 +49,7 @@ const d = 1.5, F = c(
|
|
50
49
|
}
|
51
50
|
}
|
52
51
|
}
|
53
|
-
),
|
52
|
+
), x = p("border-r h-[1.625rem] absolute", {
|
54
53
|
variants: {
|
55
54
|
position: {
|
56
55
|
start: "left-0",
|
@@ -66,30 +65,30 @@ const d = 1.5, F = c(
|
|
66
65
|
}
|
67
66
|
}), T = L.forwardRef(
|
68
67
|
({
|
69
|
-
type:
|
70
|
-
error:
|
71
|
-
startAdornment:
|
68
|
+
type: v = "text",
|
69
|
+
error: a,
|
70
|
+
startAdornment: t,
|
72
71
|
endAdornment: o,
|
73
72
|
isValid: s,
|
74
|
-
startAdornmentWidth: l =
|
75
|
-
endAdornmentWidth:
|
73
|
+
startAdornmentWidth: l = c,
|
74
|
+
endAdornmentWidth: d = c,
|
76
75
|
disabled: i,
|
77
76
|
className: N,
|
78
77
|
label: f,
|
79
78
|
id: u,
|
80
|
-
showStartDivider:
|
81
|
-
showEndDivider:
|
82
|
-
variant:
|
79
|
+
showStartDivider: m,
|
80
|
+
showEndDivider: b,
|
81
|
+
variant: g = "default",
|
83
82
|
...w
|
84
83
|
}, $) => /* @__PURE__ */ n("div", { className: "relative flex w-full items-center group", children: [
|
85
|
-
|
84
|
+
t && /* @__PURE__ */ n(
|
86
85
|
"div",
|
87
86
|
{
|
88
|
-
className: e(
|
87
|
+
className: e(h({ disabled: i, position: "start" })),
|
89
88
|
style: { width: `${l + 1}rem` },
|
90
89
|
children: [
|
91
|
-
|
92
|
-
|
90
|
+
t,
|
91
|
+
m && /* @__PURE__ */ r("div", { className: x({ position: "end", error: a }) })
|
93
92
|
]
|
94
93
|
}
|
95
94
|
),
|
@@ -98,38 +97,38 @@ const d = 1.5, F = c(
|
|
98
97
|
{
|
99
98
|
ref: $,
|
100
99
|
id: u,
|
101
|
-
type:
|
100
|
+
type: v,
|
102
101
|
placeholder: f,
|
103
102
|
disabled: i,
|
104
103
|
className: e(
|
105
|
-
F({ error:
|
106
|
-
y({ variant: "body", level:
|
104
|
+
F({ error: a, isLabel: g === "floating-label" }),
|
105
|
+
y({ variant: "body", level: 2 }),
|
107
106
|
N
|
108
107
|
),
|
109
108
|
...w,
|
110
109
|
style: {
|
111
|
-
...
|
112
|
-
paddingLeft: `${(
|
110
|
+
...t && {
|
111
|
+
paddingLeft: `${(m ? 1.6 : 1) + l}rem`
|
113
112
|
},
|
114
113
|
...o && {
|
115
|
-
paddingRight: `${(
|
114
|
+
paddingRight: `${(b ? 1.6 : 1) + d}rem`
|
116
115
|
},
|
117
|
-
...s && { paddingRight: `${1 +
|
116
|
+
...s && { paddingRight: `${1 + c}rem` }
|
118
117
|
}
|
119
118
|
}
|
120
119
|
),
|
121
120
|
(s || o) && /* @__PURE__ */ n(
|
122
121
|
"div",
|
123
122
|
{
|
124
|
-
className: e(
|
125
|
-
style: { width: `${
|
123
|
+
className: e(h({ disabled: i, position: "end" })),
|
124
|
+
style: { width: `${d + 1}rem` },
|
126
125
|
children: [
|
127
126
|
s ? /* @__PURE__ */ r(R, { className: "text-success-700" }) : o,
|
128
|
-
|
127
|
+
b && /* @__PURE__ */ r("div", { className: x({ position: "start", error: a }) })
|
129
128
|
]
|
130
129
|
}
|
131
130
|
),
|
132
|
-
|
131
|
+
g === "floating-label" && /* @__PURE__ */ r(
|
133
132
|
"label",
|
134
133
|
{
|
135
134
|
htmlFor: u,
|
@@ -145,7 +144,7 @@ const d = 1.5, F = c(
|
|
145
144
|
)
|
146
145
|
),
|
147
146
|
style: {
|
148
|
-
...
|
147
|
+
...t && {
|
149
148
|
paddingLeft: `${1 + l}rem`
|
150
149
|
}
|
151
150
|
},
|
@@ -158,6 +157,6 @@ T.displayName = "Input";
|
|
158
157
|
export {
|
159
158
|
T as Input,
|
160
159
|
T as default,
|
161
|
-
|
160
|
+
h as iconVariants,
|
162
161
|
F as inputVariants
|
163
162
|
};
|