@worldcoin/mini-apps-ui-kit-react 1.0.0-canary.15 → 1.0.0-canary.16
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/Input.d.ts +11 -41
- package/dist/components/Input/Input.js +172 -125
- package/dist/components/Input/index.js +2 -4
- package/dist/components/OTPField/OTPField.d.ts +3 -0
- package/dist/components/OTPField/OTPField.js +46 -28
- package/dist/components/OTPField/index.js +3 -2
- package/dist/components/PasswordField/PasswordField.d.ts +1 -1
- package/dist/components/PasswordField/PasswordField.js +24 -27
- package/dist/components/PasteButton/PasteButton.d.ts +0 -1
- package/dist/components/PasteButton/PasteButton.js +5 -6
- package/dist/components/PhoneField/PhoneField.d.ts +1 -6
- package/dist/components/PhoneField/PhoneField.js +46 -49
- package/dist/components/PhoneField/constants.d.ts +0 -1
- package/dist/components/PhoneField/constants.js +12 -18
- package/dist/components/SearchField/SearchField.d.ts +1 -1
- package/dist/components/SearchField/SearchField.js +42 -45
- package/dist/components/Select/Select.d.ts +6 -0
- package/dist/components/Select/Select.js +77 -44
- package/dist/components/Select/index.js +3 -2
- package/dist/components/TextArea/TextArea.d.ts +6 -2
- package/dist/components/TextArea/TextArea.js +44 -25
- package/dist/components/TopBar/TopBar.js +9 -9
- package/dist/components/WalletAddressField/WalletAddressField.d.ts +1 -1
- package/dist/components/WalletAddressField/WalletAddressField.js +29 -31
- package/dist/index.js +21 -21
- package/dist/tailwind/index.d.ts +36 -0
- package/dist/tailwind/index.js +97 -12
- package/package.json +1 -1
- package/public/globals.css +1 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CountryCode } from '../Flag/Flag';
|
2
2
|
import { InputProps } from '../Input';
|
3
|
-
export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdornment" | "
|
3
|
+
export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdornment" | "placeholder"> {
|
4
4
|
/**
|
5
5
|
* Current phone number value.
|
6
6
|
*/
|
@@ -48,11 +48,6 @@ export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdo
|
|
48
48
|
* The component should use currentColor to match the Input's styling.
|
49
49
|
*/
|
50
50
|
endAdornment?: React.ReactNode;
|
51
|
-
/**
|
52
|
-
* Width of the end adornment in rem
|
53
|
-
* @default 1.25
|
54
|
-
*/
|
55
|
-
endAdornmentWidth?: number;
|
56
51
|
}
|
57
52
|
export declare const PhoneField: import('react').ForwardRefExoticComponent<PhoneFieldProps & import('react').RefAttributes<HTMLDivElement>>;
|
58
53
|
export default PhoneField;
|
@@ -1,92 +1,89 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as
|
3
|
-
import { forwardRef as
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
3
|
+
import { forwardRef as V, useImperativeHandle as x } from "react";
|
4
4
|
import { usePhoneInput as R } from "../../node_modules/.pnpm/react-international-phone@4.4.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
|
5
|
-
import { CountryDrawer as
|
6
|
-
import { Input as
|
7
|
-
import
|
8
|
-
import { DIAL_CODE_PREFIX as
|
9
|
-
import { getCountryDataListByCodes as
|
10
|
-
const
|
5
|
+
import { CountryDrawer as g } from "../CountryDrawer/CountryDrawer.js";
|
6
|
+
import { Input as B } from "../Input/Input.js";
|
7
|
+
import _ from "./CountrySelectorButton.js";
|
8
|
+
import { DIAL_CODE_PREFIX as $ } from "./constants.js";
|
9
|
+
import { getCountryDataListByCodes as b, getValidatedCountryCode as m } from "./utils.js";
|
10
|
+
const j = V(
|
11
11
|
({
|
12
|
-
value:
|
12
|
+
value: d,
|
13
13
|
onChange: o,
|
14
|
-
countries:
|
14
|
+
countries: a,
|
15
15
|
label: f = "Phone",
|
16
16
|
defaultCountryCode: t = "US",
|
17
17
|
disableDialCodePrefill: c = !0,
|
18
|
-
disabled:
|
19
|
-
error:
|
20
|
-
isValid:
|
18
|
+
disabled: i = !1,
|
19
|
+
error: p = !1,
|
20
|
+
isValid: h,
|
21
21
|
endAdornment: C,
|
22
|
-
|
23
|
-
|
24
|
-
inputMode: A = "tel",
|
22
|
+
type: y = "tel",
|
23
|
+
inputMode: D = "tel",
|
25
24
|
autoComplete: w = "tel",
|
26
|
-
autoCapitalize:
|
27
|
-
autoCorrect:
|
28
|
-
...
|
29
|
-
},
|
30
|
-
const { inputValue:
|
25
|
+
autoCapitalize: A = "off",
|
26
|
+
autoCorrect: P = "off",
|
27
|
+
...v
|
28
|
+
}, E) => {
|
29
|
+
const { inputValue: I, country: l, inputRef: r, handlePhoneValueChange: S, setCountry: F } = R(
|
31
30
|
{
|
32
31
|
defaultCountry: t.toLowerCase(),
|
33
32
|
disableDialCodePrefill: c,
|
34
33
|
disableDialCodeAndPrefix: !0,
|
35
|
-
value:
|
36
|
-
countries:
|
34
|
+
value: d,
|
35
|
+
countries: b(a),
|
37
36
|
onChange: (e) => {
|
38
37
|
o == null || o(
|
39
38
|
e.phone,
|
40
|
-
|
39
|
+
m(e.country.iso2, t)
|
41
40
|
);
|
42
41
|
}
|
43
42
|
}
|
44
|
-
), u =
|
45
|
-
return
|
46
|
-
|
43
|
+
), u = m(l.iso2, t), L = `${$}${l.dialCode}`;
|
44
|
+
return x(E, () => r.current), /* @__PURE__ */ n(
|
45
|
+
B,
|
47
46
|
{
|
48
|
-
...
|
49
|
-
ref:
|
50
|
-
type:
|
51
|
-
inputMode:
|
47
|
+
...v,
|
48
|
+
ref: r,
|
49
|
+
type: y,
|
50
|
+
inputMode: D,
|
52
51
|
autoComplete: w,
|
53
|
-
autoCapitalize:
|
54
|
-
autoCorrect:
|
55
|
-
value:
|
52
|
+
autoCapitalize: A,
|
53
|
+
autoCorrect: P,
|
54
|
+
value: I,
|
56
55
|
onChange: S,
|
57
56
|
label: f,
|
58
|
-
disabled:
|
59
|
-
error:
|
60
|
-
isValid:
|
57
|
+
disabled: i,
|
58
|
+
error: p,
|
59
|
+
isValid: h,
|
61
60
|
endAdornment: C,
|
62
|
-
endAdornmentWidth: y,
|
63
|
-
startAdornmentWidth: V,
|
64
61
|
showStartDivider: !0,
|
65
|
-
startAdornment: /* @__PURE__ */
|
66
|
-
|
62
|
+
startAdornment: /* @__PURE__ */ n(
|
63
|
+
g,
|
67
64
|
{
|
68
65
|
value: u,
|
69
66
|
defaultValue: t,
|
70
|
-
countries:
|
67
|
+
countries: a,
|
71
68
|
onAnimationEnd: (e) => {
|
72
69
|
e || requestAnimationFrame(() => {
|
73
70
|
var s;
|
74
|
-
(s =
|
71
|
+
(s = r.current) == null || s.focus();
|
75
72
|
});
|
76
73
|
},
|
77
74
|
onChange: (e) => {
|
78
|
-
|
75
|
+
F(e.toLowerCase());
|
79
76
|
},
|
80
|
-
disabled:
|
81
|
-
children: /* @__PURE__ */
|
77
|
+
disabled: i,
|
78
|
+
children: /* @__PURE__ */ n(_, { value: u, label: L })
|
82
79
|
}
|
83
80
|
)
|
84
81
|
}
|
85
82
|
);
|
86
83
|
}
|
87
84
|
);
|
88
|
-
|
85
|
+
j.displayName = "PhoneField";
|
89
86
|
export {
|
90
|
-
|
91
|
-
|
87
|
+
j as PhoneField,
|
88
|
+
j as default
|
92
89
|
};
|
@@ -1,26 +1,20 @@
|
|
1
1
|
import { countries as i } from "../../node_modules/.pnpm/countries-list@3.1.1/node_modules/countries-list/mjs/index.js";
|
2
2
|
import { defaultCountries as e, parseCountry as s } from "../../node_modules/.pnpm/react-international-phone@4.4.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
|
3
|
-
import { countryCodes as
|
3
|
+
import { countryCodes as c } from "../Flag/constants.js";
|
4
4
|
const r = new Set(
|
5
|
-
|
6
|
-
),
|
5
|
+
c.map((o) => o.toLowerCase())
|
6
|
+
), p = e.filter(
|
7
7
|
(o) => r.has(s(o).iso2)
|
8
|
-
),
|
9
|
-
(o) => !
|
10
|
-
),
|
8
|
+
), d = new Set(e.map((o) => s(o).iso2)), m = Array.from(r).filter(
|
9
|
+
(o) => !d.has(o)
|
10
|
+
), f = Object.entries(i).filter(([o]) => m.includes(o.toLowerCase())).map(([o, t]) => {
|
11
11
|
const { name: n, phone: a } = t, u = a[0].toString(), C = o.toLowerCase();
|
12
12
|
return [n, C, u];
|
13
|
-
}),
|
14
|
-
...
|
15
|
-
...
|
16
|
-
].sort((o, t) => o[0].localeCompare(t[0])),
|
17
|
-
1: 5.5,
|
18
|
-
2: 6,
|
19
|
-
3: 6.5,
|
20
|
-
4: 7
|
21
|
-
};
|
13
|
+
}), L = [
|
14
|
+
...p,
|
15
|
+
...f
|
16
|
+
].sort((o, t) => o[0].localeCompare(t[0])), S = "+";
|
22
17
|
export {
|
23
|
-
|
24
|
-
|
25
|
-
D as startAdornmentWidthByDialCodeLength
|
18
|
+
S as DIAL_CODE_PREFIX,
|
19
|
+
L as extendedCountryDataList
|
26
20
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { InputProps } from '../Input';
|
2
|
-
export interface SearchFieldProps extends Omit<InputProps, "startAdornment" | "
|
2
|
+
export interface SearchFieldProps extends Omit<InputProps, "startAdornment" | "placeholder"> {
|
3
3
|
/**
|
4
4
|
* If true, the input will display in an error state with error styling
|
5
5
|
*/
|
@@ -1,83 +1,80 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as
|
3
|
-
import { createChangeEvent as
|
4
|
-
import { forwardRef as
|
5
|
-
import
|
6
|
-
import { Magnifier as
|
7
|
-
import { Input as
|
8
|
-
import
|
9
|
-
const
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
3
|
+
import { createChangeEvent as l } from "../../lib/utils.js";
|
4
|
+
import { forwardRef as S, useRef as A, useState as m, useImperativeHandle as R } from "react";
|
5
|
+
import x from "../ClearButton/ClearButton.js";
|
6
|
+
import { Magnifier as N } from "../Icons/Magnifier.js";
|
7
|
+
import { Input as j } from "../Input/Input.js";
|
8
|
+
import w from "../PasteButton/PasteButton.js";
|
9
|
+
const y = S(
|
10
10
|
({
|
11
|
-
showPasteButton:
|
12
|
-
pasteButtonLabel:
|
11
|
+
showPasteButton: o,
|
12
|
+
pasteButtonLabel: i,
|
13
13
|
isValid: s,
|
14
14
|
disabled: u,
|
15
|
-
type:
|
16
|
-
autoComplete:
|
15
|
+
type: d = "search",
|
16
|
+
autoComplete: h = "off",
|
17
17
|
spellCheck: F = "false",
|
18
|
-
endAdornment:
|
19
|
-
|
20
|
-
label: I = "Search",
|
18
|
+
endAdornment: C,
|
19
|
+
label: g = "Search",
|
21
20
|
...e
|
22
|
-
},
|
23
|
-
const
|
24
|
-
|
25
|
-
let f =
|
26
|
-
return
|
27
|
-
|
21
|
+
}, v) => {
|
22
|
+
const a = A(null), [B, c] = m(!1), [I, P] = m(!1);
|
23
|
+
R(v, () => a.current);
|
24
|
+
let f = C;
|
25
|
+
return o && !u && !I ? f = /* @__PURE__ */ r(
|
26
|
+
w,
|
28
27
|
{
|
29
|
-
inputRef:
|
30
|
-
label:
|
28
|
+
inputRef: a,
|
29
|
+
label: i,
|
31
30
|
onPaste: () => {
|
32
31
|
var t;
|
33
|
-
if (
|
34
|
-
const n =
|
35
|
-
(t = e.onChange) == null || t.call(e, n),
|
32
|
+
if (a.current) {
|
33
|
+
const n = l(a.current);
|
34
|
+
(t = e.onChange) == null || t.call(e, n), P(!0);
|
36
35
|
}
|
37
36
|
}
|
38
37
|
}
|
39
|
-
)
|
40
|
-
|
38
|
+
) : B && !u && (f = /* @__PURE__ */ r(
|
39
|
+
x,
|
41
40
|
{
|
42
|
-
inputRef:
|
41
|
+
inputRef: a,
|
43
42
|
onClear: () => {
|
44
43
|
var t;
|
45
|
-
if (
|
46
|
-
const n =
|
44
|
+
if (a.current) {
|
45
|
+
const n = l(a.current);
|
47
46
|
(t = e.onChange) == null || t.call(e, n);
|
48
47
|
}
|
49
48
|
}
|
50
49
|
}
|
51
|
-
)
|
52
|
-
|
50
|
+
)), /* @__PURE__ */ r(
|
51
|
+
j,
|
53
52
|
{
|
54
53
|
...e,
|
55
|
-
ref:
|
56
|
-
startAdornment: /* @__PURE__ */
|
54
|
+
ref: a,
|
55
|
+
startAdornment: /* @__PURE__ */ r(N, {}),
|
57
56
|
isValid: s,
|
58
57
|
disabled: u,
|
59
|
-
startAdornmentWidth: 2.3,
|
60
|
-
endAdornmentWidth: m,
|
61
58
|
endAdornment: f,
|
62
|
-
type:
|
63
|
-
autoComplete:
|
59
|
+
type: d,
|
60
|
+
autoComplete: h,
|
64
61
|
spellCheck: F,
|
65
62
|
onFocus: (t) => {
|
66
63
|
var n;
|
67
|
-
|
64
|
+
c(!0), (n = e.onFocus) == null || n.call(e, t);
|
68
65
|
},
|
69
|
-
label:
|
66
|
+
label: g,
|
70
67
|
onBlur: (t) => {
|
71
68
|
var n;
|
72
|
-
|
69
|
+
c(!1), (n = e.onBlur) == null || n.call(e, t);
|
73
70
|
},
|
74
71
|
className: "rounded-full h-[3.125rem]"
|
75
72
|
}
|
76
73
|
);
|
77
74
|
}
|
78
75
|
);
|
79
|
-
|
76
|
+
y.displayName = "SearchField";
|
80
77
|
export {
|
81
|
-
|
82
|
-
|
78
|
+
y as SearchField,
|
79
|
+
y as default
|
83
80
|
};
|
@@ -1,4 +1,10 @@
|
|
1
1
|
import * as RadixSelect from "@radix-ui/react-select";
|
2
|
+
export declare const selectVariants: (props?: ({
|
3
|
+
error?: boolean | null | undefined;
|
4
|
+
isLabel?: boolean | null | undefined;
|
5
|
+
isFocused?: boolean | null | undefined;
|
6
|
+
variant?: "default" | "floating-label" | null | undefined;
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
2
8
|
export interface SelectOption {
|
3
9
|
/**
|
4
10
|
* The value of the option.
|
@@ -1,66 +1,98 @@
|
|
1
1
|
"use client";
|
2
2
|
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
3
3
|
import { DROPDOWN_CONTAINER_STYLES as x } from "../../lib/constants/dropdownStyles.js";
|
4
|
-
import { Root as N, Trigger as S, Value as
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import { typographyVariants as
|
10
|
-
const
|
4
|
+
import { Root as N, Trigger as S, Value as V, Icon as I, Portal as R, Content as j, Viewport as A, Item as T, ItemText as D } from "../../node_modules/.pnpm/@radix-ui_react-select@2.1.4_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._atdh45n5c7sked5b6tbwgdz7re/node_modules/@radix-ui/react-select/dist/index.js";
|
5
|
+
import { cva as E } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
6
|
+
import { forwardRef as F, useState as C, useEffect as L } from "react";
|
7
|
+
import { cn as a } from "../../lib/utils.js";
|
8
|
+
import { ArrowDown as O } from "../Icons/ArrowDown.js";
|
9
|
+
import { typographyVariants as f } from "../Typography/Typography.js";
|
10
|
+
const P = E(
|
11
|
+
a(
|
12
|
+
"flex items-center justify-between whitespace-nowrap [&>span:first-of-type]:line-clamp-1",
|
13
|
+
"peer h-[3.5rem] w-full rounded-[0.625rem] border border-gray-100 bg-gray-100 px-4 outline-none transition duration-300",
|
14
|
+
"placeholder:text-gray-500",
|
15
|
+
"focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
16
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
17
|
+
// Radix Select styles
|
18
|
+
"data-[placeholder]:text-gray-500",
|
19
|
+
"data-[state=closed]:bg-gray-100 data-[state=closed]:border-gray-100"
|
20
|
+
),
|
21
|
+
{
|
22
|
+
variants: {
|
23
|
+
error: {
|
24
|
+
true: "border-error-600 focus:border-error-600 bg-gray-0"
|
25
|
+
},
|
26
|
+
isLabel: {
|
27
|
+
true: "pt-6 pb-2 placeholder:text-transparent",
|
28
|
+
false: ""
|
29
|
+
},
|
30
|
+
isFocused: {
|
31
|
+
true: "focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
32
|
+
false: ""
|
33
|
+
},
|
34
|
+
variant: {
|
35
|
+
"floating-label": "pt-6 pb-2 placeholder:text-transparent",
|
36
|
+
default: ""
|
37
|
+
}
|
38
|
+
},
|
39
|
+
defaultVariants: {
|
40
|
+
error: !1,
|
41
|
+
isFocused: !1,
|
42
|
+
variant: "default"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
), _ = F(
|
11
46
|
({
|
12
47
|
options: l = [],
|
13
|
-
placeholder:
|
14
|
-
value:
|
15
|
-
onChange:
|
16
|
-
open:
|
48
|
+
placeholder: u = "Select...",
|
49
|
+
value: o,
|
50
|
+
onChange: m,
|
51
|
+
open: t,
|
17
52
|
onOpenChange: s,
|
18
|
-
error:
|
19
|
-
defaultOpen:
|
20
|
-
disabled:
|
21
|
-
name:
|
53
|
+
error: b = !1,
|
54
|
+
defaultOpen: i = !1,
|
55
|
+
disabled: g = !1,
|
56
|
+
name: p,
|
22
57
|
defaultValue: y,
|
23
|
-
...
|
58
|
+
...h
|
24
59
|
}, v) => {
|
25
|
-
const [
|
26
|
-
|
60
|
+
const [n, c] = C(t ?? i), w = (e) => {
|
61
|
+
c(e), s == null || s(e);
|
27
62
|
};
|
28
|
-
return
|
29
|
-
|
30
|
-
}, [
|
63
|
+
return L(() => {
|
64
|
+
t !== void 0 && c(t);
|
65
|
+
}, [t]), Array.isArray(l) || console.error("`options` must be an array of objects with `value` and `label` keys."), /* @__PURE__ */ d(
|
31
66
|
N,
|
32
67
|
{
|
33
|
-
value:
|
34
|
-
open:
|
35
|
-
onValueChange:
|
36
|
-
defaultOpen:
|
68
|
+
value: o,
|
69
|
+
open: n,
|
70
|
+
onValueChange: m,
|
71
|
+
defaultOpen: i,
|
37
72
|
onOpenChange: w,
|
38
|
-
name:
|
39
|
-
disabled:
|
73
|
+
name: p,
|
74
|
+
disabled: g,
|
40
75
|
defaultValue: y,
|
41
|
-
...
|
76
|
+
...h,
|
42
77
|
children: [
|
43
78
|
/* @__PURE__ */ d(
|
44
79
|
S,
|
45
80
|
{
|
46
81
|
ref: v,
|
47
|
-
className:
|
48
|
-
|
49
|
-
|
50
|
-
"flex items-center justify-between whitespace-nowrap [&>span:first-of-type]:line-clamp-1",
|
51
|
-
"data-[placeholder]:text-gray-500",
|
52
|
-
"data-[state=closed]:bg-gray-100 data-[state=closed]:border-gray-100"
|
82
|
+
className: a(
|
83
|
+
f({ variant: "body" }),
|
84
|
+
P({ error: b, isFocused: n })
|
53
85
|
),
|
54
86
|
children: [
|
55
|
-
/* @__PURE__ */ r(
|
56
|
-
/* @__PURE__ */ r(
|
87
|
+
/* @__PURE__ */ r(V, { placeholder: u }),
|
88
|
+
/* @__PURE__ */ r(I, { children: /* @__PURE__ */ r(O, { className: "text-gray-400 size-6" }) })
|
57
89
|
]
|
58
90
|
}
|
59
91
|
),
|
60
|
-
/* @__PURE__ */ r(
|
92
|
+
/* @__PURE__ */ r(R, { children: /* @__PURE__ */ r(j, { position: "popper", className: a(x), children: /* @__PURE__ */ r(
|
61
93
|
A,
|
62
94
|
{
|
63
|
-
className:
|
95
|
+
className: a(
|
64
96
|
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] p-2",
|
65
97
|
l.length === 0 && "hidden"
|
66
98
|
),
|
@@ -68,10 +100,10 @@ const $ = E(
|
|
68
100
|
T,
|
69
101
|
{
|
70
102
|
value: e.value,
|
71
|
-
className:
|
103
|
+
className: a(
|
72
104
|
"w-full cursor-pointer select-none rounded-md p-2 font-sans outline-none hover:bg-gray-50",
|
73
|
-
|
74
|
-
|
105
|
+
o === e.value && "bg-gray-100",
|
106
|
+
f({ variant: "body", level: 3 })
|
75
107
|
),
|
76
108
|
children: /* @__PURE__ */ r(D, { children: e.label })
|
77
109
|
},
|
@@ -84,8 +116,9 @@ const $ = E(
|
|
84
116
|
);
|
85
117
|
}
|
86
118
|
);
|
87
|
-
|
119
|
+
_.displayName = "Select";
|
88
120
|
export {
|
89
|
-
|
90
|
-
|
121
|
+
_ as Select,
|
122
|
+
_ as default,
|
123
|
+
P as selectVariants
|
91
124
|
};
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
2
|
-
import { inputVariants } from '../Input/Input';
|
3
2
|
import * as React from "react";
|
4
|
-
export
|
3
|
+
export declare const textAreaVariants: (props?: ({
|
4
|
+
error?: boolean | null | undefined;
|
5
|
+
isFocused?: boolean | null | undefined;
|
6
|
+
variant?: "default" | "floating-label" | null | undefined;
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
8
|
+
export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "className" | "style" | "placeholder">, VariantProps<typeof textAreaVariants> {
|
5
9
|
/**
|
6
10
|
* If true, the textarea will display in an error state with error styling
|
7
11
|
*/
|
@@ -1,37 +1,55 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { cva as
|
3
|
-
import * as
|
1
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { cva as c } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
3
|
+
import * as p from "react";
|
4
4
|
import { cn as r } from "../../lib/utils.js";
|
5
|
-
import { inputVariants as x } from "../Input/Input.js";
|
6
5
|
import { typographyVariants as l } from "../Typography/Typography.js";
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
const b = c(
|
7
|
+
r(
|
8
|
+
"min-h-[7.5rem] resize-y peer w-full rounded-[0.625rem] border border-gray-100 bg-gray-100 px-4 outline-none transition duration-300",
|
9
|
+
"placeholder:text-gray-500",
|
10
|
+
"focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
11
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
12
|
+
),
|
13
|
+
{
|
14
|
+
variants: {
|
15
|
+
error: {
|
16
|
+
true: "border-error-600 focus:border-error-600 bg-gray-0"
|
17
|
+
},
|
18
|
+
isFocused: {
|
19
|
+
true: "focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
20
|
+
false: ""
|
21
|
+
},
|
22
|
+
variant: {
|
23
|
+
"floating-label": "pt-8 pb-2 placeholder:text-transparent",
|
24
|
+
default: "pt-4"
|
25
|
+
}
|
26
|
+
},
|
27
|
+
defaultVariants: {
|
28
|
+
error: !1,
|
29
|
+
isFocused: !1,
|
30
|
+
variant: "default"
|
12
31
|
}
|
13
32
|
}
|
14
|
-
|
15
|
-
({ error: s, isFocused:
|
16
|
-
/* @__PURE__ */
|
33
|
+
), g = p.forwardRef(
|
34
|
+
({ error: s, isFocused: d = !1, disabled: i, label: e, variant: a = "default", id: o, ...n }, f) => /* @__PURE__ */ u("div", { className: "relative flex w-full items-center group", children: [
|
35
|
+
/* @__PURE__ */ t(
|
17
36
|
"textarea",
|
18
37
|
{
|
19
38
|
ref: f,
|
20
|
-
id:
|
21
|
-
placeholder:
|
22
|
-
disabled:
|
39
|
+
id: o,
|
40
|
+
placeholder: e,
|
41
|
+
disabled: i,
|
23
42
|
className: r(
|
24
|
-
|
25
|
-
l({ variant: "body"
|
26
|
-
u({ variant: e })
|
43
|
+
b({ error: s, isFocused: d, variant: a }),
|
44
|
+
l({ variant: "body" })
|
27
45
|
),
|
28
|
-
...
|
46
|
+
...n
|
29
47
|
}
|
30
48
|
),
|
31
|
-
|
49
|
+
a === "floating-label" && /* @__PURE__ */ t(
|
32
50
|
"label",
|
33
51
|
{
|
34
|
-
htmlFor:
|
52
|
+
htmlFor: o,
|
35
53
|
className: r(
|
36
54
|
l({ variant: "body", level: 3 }),
|
37
55
|
r(
|
@@ -42,13 +60,14 @@ const u = d("min-h-[7.5rem] resize-y", {
|
|
42
60
|
"absolute text-gray-500 duration-300 transform text-xs top-0 pt-4 z-10 pl-4 w-full bg-gray-100 rounded-t-[0.625rem] border-t border-x border-gray-100"
|
43
61
|
)
|
44
62
|
),
|
45
|
-
children:
|
63
|
+
children: e
|
46
64
|
}
|
47
65
|
)
|
48
66
|
] })
|
49
67
|
);
|
50
|
-
|
68
|
+
g.displayName = "TextArea";
|
51
69
|
export {
|
52
|
-
|
53
|
-
|
70
|
+
g as TextArea,
|
71
|
+
g as default,
|
72
|
+
b as textAreaVariants
|
54
73
|
};
|