@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,16 +1,5 @@
|
|
1
|
-
import { VariantProps } from 'class-variance-authority';
|
2
1
|
import * as React from "react";
|
3
|
-
export
|
4
|
-
error?: boolean | null | undefined;
|
5
|
-
isLabel?: boolean | null | undefined;
|
6
|
-
isFocused?: boolean | null | undefined;
|
7
|
-
variant?: "default" | "floating-label" | null | undefined;
|
8
|
-
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
9
|
-
export declare const iconVariants: (props?: ({
|
10
|
-
disabled?: boolean | null | undefined;
|
11
|
-
position?: "end" | "start" | null | undefined;
|
12
|
-
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
13
|
-
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "className" | "style" | "placeholder">, VariantProps<typeof inputVariants> {
|
2
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "className" | "style" | "placeholder" | "size"> {
|
14
3
|
/**
|
15
4
|
* If true, the input will display in an error state with error styling
|
16
5
|
*/
|
@@ -21,41 +10,18 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
21
10
|
isValid?: boolean;
|
22
11
|
/**
|
23
12
|
* Element to be rendered at the start (left side) of the input.
|
24
|
-
* The component passed to this prop must accept a `style` prop.
|
25
|
-
* The component should use currentColor to match the Input's styling.
|
26
|
-
* To change styles based on input focus, use Tailwind's `group-*` modifiers
|
27
|
-
* since the input is wrapped in a group class.
|
28
13
|
*/
|
29
14
|
startAdornment?: React.ReactNode;
|
30
15
|
/**
|
31
16
|
* Element to be rendered at the end (right side) of the input.
|
32
|
-
* The component passed to this prop must accept a `style` prop.
|
33
|
-
* The component should use currentColor to match the Input's styling.
|
34
|
-
* To change styles based on input focus, use Tailwind's `group-*` modifiers
|
35
|
-
* since the input is wrapped in a group class.
|
36
17
|
*/
|
37
18
|
endAdornment?: React.ReactNode;
|
38
19
|
/**
|
39
|
-
*
|
40
|
-
* @default 1.25
|
41
|
-
*/
|
42
|
-
startAdornmentWidth?: number;
|
43
|
-
/**
|
44
|
-
* Width of the end adornment in rem
|
45
|
-
* @default 1.25
|
46
|
-
*/
|
47
|
-
endAdornmentWidth?: number;
|
48
|
-
/**
|
49
|
-
* If true, the input will display in a focused state with focus styling
|
50
|
-
* @default false
|
51
|
-
*/
|
52
|
-
isFocused?: boolean;
|
53
|
-
/**
|
54
|
-
* Additional class name for the input
|
20
|
+
* Additional class name for the input container
|
55
21
|
*/
|
56
22
|
className?: string;
|
57
23
|
/**
|
58
|
-
* Label text to be displayed above the input
|
24
|
+
* Label text to be displayed above the input or as floating label
|
59
25
|
*/
|
60
26
|
label?: string;
|
61
27
|
/**
|
@@ -64,15 +30,19 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
64
30
|
*/
|
65
31
|
variant?: "default" | "floating-label";
|
66
32
|
/**
|
67
|
-
* If true, the
|
68
|
-
* @default
|
33
|
+
* If true, the start divider will be shown when startAdornment is present.
|
34
|
+
* @default false // Default dividers to false
|
69
35
|
*/
|
70
36
|
showStartDivider?: boolean;
|
71
37
|
/**
|
72
|
-
* If true, the end divider will be shown
|
73
|
-
* @default
|
38
|
+
* If true, the end divider will be shown when endAdornment or isValid is present.
|
39
|
+
* @default false // Default dividers to false
|
74
40
|
*/
|
75
41
|
showEndDivider?: boolean;
|
42
|
+
/**
|
43
|
+
* Id for the input element, used for label association. Auto-generated if not provided.
|
44
|
+
*/
|
45
|
+
id?: string;
|
76
46
|
}
|
77
47
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
78
48
|
export default Input;
|
@@ -1,60 +1,110 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
|
1
|
+
"use client";
|
2
|
+
import { jsxs as t, Fragment as l, jsx as e } from "react/jsx-runtime";
|
3
|
+
import { cva as o } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
4
|
+
import * as x from "react";
|
5
|
+
import { cn as s } from "../../lib/utils.js";
|
6
|
+
import { Tick as F } from "../Icons/Tick.js";
|
7
|
+
import { typographyVariants as c } from "../Typography/Typography.js";
|
8
|
+
const R = o(
|
9
|
+
[
|
10
|
+
"bg-gray-100",
|
11
|
+
"text-gray-900",
|
12
|
+
"h-[3.5rem]",
|
13
|
+
"inline-flex",
|
14
|
+
"w-full",
|
15
|
+
"shrink",
|
16
|
+
"cursor-text",
|
17
|
+
"items-center",
|
18
|
+
"overflow-hidden",
|
19
|
+
"border",
|
20
|
+
"border-gray-100",
|
21
|
+
"rounded-[0.625rem]",
|
22
|
+
"outline-none",
|
23
|
+
"transition-all",
|
24
|
+
"duration-300",
|
25
|
+
"ease-out",
|
26
|
+
"px-4",
|
27
|
+
// Focus state
|
28
|
+
"focus-within:border-gray-300",
|
29
|
+
"focus-within:bg-gray-0",
|
30
|
+
"focus-within:isolate",
|
31
|
+
// Disabled state (applied via group-disabled on parent if needed, or directly)
|
32
|
+
"has-[input:disabled]:cursor-not-allowed",
|
33
|
+
"has-[input:disabled]:opacity-50"
|
34
|
+
],
|
15
35
|
{
|
16
36
|
variants: {
|
17
37
|
error: {
|
18
|
-
true: "border-error-600 focus:border-error-600
|
19
|
-
},
|
20
|
-
isLabel: {
|
21
|
-
true: "pt-6 pb-2 placeholder:text-transparent",
|
22
|
-
false: ""
|
23
|
-
},
|
24
|
-
isFocused: {
|
25
|
-
true: "focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
38
|
+
true: ["bg-gray-0", "border-error-600", "focus-within:border-error-600"],
|
26
39
|
false: ""
|
27
40
|
},
|
28
|
-
|
29
|
-
|
30
|
-
|
41
|
+
areDividers: {
|
42
|
+
true: "gap-2.5",
|
43
|
+
false: "gap-2"
|
31
44
|
}
|
32
45
|
},
|
33
46
|
defaultVariants: {
|
34
47
|
error: !1,
|
35
|
-
|
36
|
-
variant: "default"
|
48
|
+
areDividers: !1
|
37
49
|
}
|
38
50
|
}
|
39
|
-
),
|
40
|
-
|
51
|
+
), y = o(
|
52
|
+
[
|
53
|
+
"peer",
|
54
|
+
"inline-block",
|
55
|
+
"h-full",
|
56
|
+
"grow",
|
57
|
+
"w-full",
|
58
|
+
"appearance-none",
|
59
|
+
"bg-transparent",
|
60
|
+
"border-none",
|
61
|
+
"text-gray-900",
|
62
|
+
"placeholder:text-transparent",
|
63
|
+
"focus:outline-none",
|
64
|
+
"focus-visible:outline-none",
|
65
|
+
"disabled:cursor-not-allowed"
|
66
|
+
],
|
41
67
|
{
|
42
68
|
variants: {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
position: {
|
47
|
-
start: "left-0",
|
48
|
-
end: "right-0"
|
69
|
+
variant: {
|
70
|
+
default: "placeholder:text-gray-500",
|
71
|
+
"floating-label": ["pt-6 pb-2"]
|
49
72
|
}
|
73
|
+
},
|
74
|
+
defaultVariants: {
|
75
|
+
variant: "default"
|
50
76
|
}
|
51
77
|
}
|
52
|
-
),
|
78
|
+
), C = o([
|
79
|
+
"text-gray-500",
|
80
|
+
"pointer-events-none",
|
81
|
+
"absolute",
|
82
|
+
"start-0",
|
83
|
+
"w-fit",
|
84
|
+
"max-w-full",
|
85
|
+
"top-1/2",
|
86
|
+
"overflow-hidden",
|
87
|
+
"bg-transparent",
|
88
|
+
"text-ellipsis",
|
89
|
+
"whitespace-nowrap",
|
90
|
+
// Prevent wrapping
|
91
|
+
// Positioning & Transition
|
92
|
+
"translate-y-[-50%]",
|
93
|
+
"transition-[top,transform,scale,opacity,color]",
|
94
|
+
"duration-100",
|
95
|
+
"ease-out",
|
96
|
+
// Peer states for floating effect (when input has value or is focused)
|
97
|
+
"peer-focus:pointer-events-auto",
|
98
|
+
"peer-focus:top-[1.125rem]",
|
99
|
+
"peer-focus:text-xs",
|
100
|
+
"peer-focus:bg-base-100",
|
101
|
+
// Match input background
|
102
|
+
// State when placeholder is not shown (i.e., input has value)
|
103
|
+
"peer-[:not(:placeholder-shown)]:pointer-events-auto",
|
104
|
+
"peer-[:not(:placeholder-shown)]:top-[1.125rem]",
|
105
|
+
"peer-[:not(:placeholder-shown)]:text-xs"
|
106
|
+
]), w = o("border-r h-[1.625rem] w-1", {
|
53
107
|
variants: {
|
54
|
-
position: {
|
55
|
-
start: "left-0",
|
56
|
-
end: "right-0"
|
57
|
-
},
|
58
108
|
error: {
|
59
109
|
true: "border-error-600",
|
60
110
|
false: "border-gray-300"
|
@@ -63,100 +113,97 @@ const c = 1.5, F = p(
|
|
63
113
|
defaultVariants: {
|
64
114
|
error: !1
|
65
115
|
}
|
66
|
-
}),
|
116
|
+
}), D = x.forwardRef(
|
67
117
|
({
|
68
|
-
type:
|
69
|
-
error:
|
70
|
-
startAdornment:
|
71
|
-
endAdornment:
|
72
|
-
isValid:
|
73
|
-
|
74
|
-
endAdornmentWidth: d = c,
|
75
|
-
disabled: i,
|
118
|
+
type: d = "text",
|
119
|
+
error: r = !1,
|
120
|
+
startAdornment: u,
|
121
|
+
endAdornment: p,
|
122
|
+
isValid: f,
|
123
|
+
disabled: h,
|
76
124
|
className: N,
|
77
|
-
label:
|
78
|
-
id:
|
79
|
-
showStartDivider: m,
|
80
|
-
showEndDivider:
|
81
|
-
variant:
|
82
|
-
...
|
83
|
-
},
|
84
|
-
|
125
|
+
label: a,
|
126
|
+
id: V,
|
127
|
+
showStartDivider: m = !1,
|
128
|
+
showEndDivider: g = !1,
|
129
|
+
variant: i = "default",
|
130
|
+
...v
|
131
|
+
}, b) => {
|
132
|
+
const k = x.useId(), n = V || k, j = !!u, I = f || !!p;
|
133
|
+
return /* @__PURE__ */ t(
|
85
134
|
"div",
|
86
135
|
{
|
87
|
-
className:
|
88
|
-
|
89
|
-
children: [
|
90
|
-
t,
|
91
|
-
m && /* @__PURE__ */ r("div", { className: x({ position: "end", error: a }) })
|
92
|
-
]
|
93
|
-
}
|
94
|
-
),
|
95
|
-
/* @__PURE__ */ r(
|
96
|
-
"input",
|
97
|
-
{
|
98
|
-
ref: $,
|
99
|
-
id: u,
|
100
|
-
type: v,
|
101
|
-
placeholder: f,
|
102
|
-
disabled: i,
|
103
|
-
className: e(
|
104
|
-
F({ error: a, isLabel: g === "floating-label" }),
|
105
|
-
y({ variant: "body", level: 2 }),
|
136
|
+
className: s(
|
137
|
+
R({ error: r, areDividers: m || g }),
|
106
138
|
N
|
107
139
|
),
|
108
|
-
...w,
|
109
|
-
style: {
|
110
|
-
...t && {
|
111
|
-
paddingLeft: `${(m ? 1.6 : 1) + l}rem`
|
112
|
-
},
|
113
|
-
...o && {
|
114
|
-
paddingRight: `${(b ? 1.6 : 1) + d}rem`
|
115
|
-
},
|
116
|
-
...s && { paddingRight: `${1 + c}rem` }
|
117
|
-
}
|
118
|
-
}
|
119
|
-
),
|
120
|
-
(s || o) && /* @__PURE__ */ n(
|
121
|
-
"div",
|
122
|
-
{
|
123
|
-
className: e(h({ disabled: i, position: "end" })),
|
124
|
-
style: { width: `${d + 1}rem` },
|
125
140
|
children: [
|
126
|
-
|
127
|
-
|
141
|
+
j && /* @__PURE__ */ t(l, { children: [
|
142
|
+
/* @__PURE__ */ e("div", { className: "inline-flex items-center justify-center shrink-0 text-gray-500", children: u }),
|
143
|
+
m && /* @__PURE__ */ e("div", { className: w({ error: r }) })
|
144
|
+
] }),
|
145
|
+
i === "floating-label" ? /* @__PURE__ */ t("div", { className: "relative grow h-full", children: [
|
146
|
+
/* @__PURE__ */ e(
|
147
|
+
"input",
|
148
|
+
{
|
149
|
+
ref: b,
|
150
|
+
id: n,
|
151
|
+
type: d,
|
152
|
+
placeholder: a || " ",
|
153
|
+
disabled: h,
|
154
|
+
"aria-invalid": r,
|
155
|
+
className: s(
|
156
|
+
c({ variant: "body", level: 3 }),
|
157
|
+
y({
|
158
|
+
variant: i
|
159
|
+
})
|
160
|
+
),
|
161
|
+
...v
|
162
|
+
}
|
163
|
+
),
|
164
|
+
/* @__PURE__ */ e(
|
165
|
+
"label",
|
166
|
+
{
|
167
|
+
className: s(
|
168
|
+
C(),
|
169
|
+
c({ variant: "body", level: 3 })
|
170
|
+
),
|
171
|
+
htmlFor: n,
|
172
|
+
children: a
|
173
|
+
}
|
174
|
+
)
|
175
|
+
] }) : /* @__PURE__ */ t(l, { children: [
|
176
|
+
a && /* @__PURE__ */ e("label", { className: "sr-only", htmlFor: n, children: a }),
|
177
|
+
/* @__PURE__ */ e(
|
178
|
+
"input",
|
179
|
+
{
|
180
|
+
ref: b,
|
181
|
+
id: n,
|
182
|
+
type: d,
|
183
|
+
placeholder: a,
|
184
|
+
disabled: h,
|
185
|
+
"aria-invalid": r,
|
186
|
+
className: s(
|
187
|
+
y({
|
188
|
+
variant: i
|
189
|
+
}),
|
190
|
+
c({ variant: "body", level: 3 })
|
191
|
+
),
|
192
|
+
...v
|
193
|
+
}
|
194
|
+
)
|
195
|
+
] }),
|
196
|
+
I && /* @__PURE__ */ t(l, { children: [
|
197
|
+
g && /* @__PURE__ */ e("div", { className: w({ error: r }) }),
|
198
|
+
/* @__PURE__ */ e("div", { className: "inline-flex items-center justify-center shrink-0 text-gray-500", children: f ? /* @__PURE__ */ e(F, { className: "text-success-700" }) : p })
|
199
|
+
] })
|
128
200
|
]
|
129
201
|
}
|
130
|
-
)
|
131
|
-
|
132
|
-
"label",
|
133
|
-
{
|
134
|
-
htmlFor: u,
|
135
|
-
className: e(
|
136
|
-
y({ variant: "body", level: 3 }),
|
137
|
-
e(
|
138
|
-
// Initial state
|
139
|
-
"peer-placeholder-shown:text-sm peer-placeholder-shown:translate-y-0",
|
140
|
-
"peer-focus:-translate-y-[0.6rem] peer-focus:text-xs",
|
141
|
-
// End state
|
142
|
-
"absolute text-gray-500 duration-300 transform text-xs",
|
143
|
-
"-translate-y-[0.6rem] z-10 pl-4"
|
144
|
-
)
|
145
|
-
),
|
146
|
-
style: {
|
147
|
-
...t && {
|
148
|
-
paddingLeft: `${1 + l}rem`
|
149
|
-
}
|
150
|
-
},
|
151
|
-
children: f
|
152
|
-
}
|
153
|
-
)
|
154
|
-
] })
|
202
|
+
);
|
203
|
+
}
|
155
204
|
);
|
156
|
-
|
205
|
+
D.displayName = "Input";
|
157
206
|
export {
|
158
|
-
|
159
|
-
|
160
|
-
h as iconVariants,
|
161
|
-
F as inputVariants
|
207
|
+
D as Input,
|
208
|
+
D as default
|
162
209
|
};
|
@@ -1,5 +1,8 @@
|
|
1
1
|
import { OTPInputProps } from 'input-otp';
|
2
2
|
import * as React from "react";
|
3
|
+
export declare const inputVariants: (props?: ({
|
4
|
+
error?: boolean | null | undefined;
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
3
6
|
declare const patternDictionary: {
|
4
7
|
digits: string;
|
5
8
|
chars: string;
|
@@ -1,47 +1,65 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as
|
3
|
-
import { cn as
|
4
|
-
import {
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import { typographyVariants as
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
import { jsx as r, Fragment as u } from "react/jsx-runtime";
|
3
|
+
import { cn as o } from "../../lib/utils.js";
|
4
|
+
import { cva as m } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
5
|
+
import { OTPInput as g, REGEXP_ONLY_DIGITS as f, REGEXP_ONLY_CHARS as b, REGEXP_ONLY_DIGITS_AND_CHARS as y } from "../../node_modules/.pnpm/input-otp@1.4.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-otp/dist/index.js";
|
6
|
+
import * as h from "react";
|
7
|
+
import { typographyVariants as x } from "../Typography/Typography.js";
|
8
|
+
const _ = m(
|
9
|
+
o(
|
10
|
+
"peer h-[3.5rem] w-full rounded-[0.625rem] border border-gray-100 bg-gray-100 px-4 outline-none transition duration-300",
|
11
|
+
"placeholder:text-gray-500",
|
12
|
+
"focus:border-gray-300 focus:bg-gray-0 focus-visible:outline-none",
|
13
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
14
|
+
),
|
15
|
+
{
|
16
|
+
variants: {
|
17
|
+
error: {
|
18
|
+
true: "border-error-600 focus:border-error-600 bg-gray-0"
|
19
|
+
}
|
20
|
+
},
|
21
|
+
defaultVariants: {
|
22
|
+
error: !1
|
23
|
+
}
|
24
|
+
}
|
25
|
+
), R = {
|
26
|
+
digits: f,
|
27
|
+
chars: b,
|
28
|
+
digitsAndChars: y
|
29
|
+
}, v = {
|
13
30
|
digits: "numeric",
|
14
31
|
chars: "text",
|
15
32
|
digitsAndChars: "text"
|
16
|
-
},
|
17
|
-
({ maxLength:
|
18
|
-
|
33
|
+
}, I = h.forwardRef(
|
34
|
+
({ maxLength: i = 6, error: e, children: E, mode: t = "digits", pattern: n, ...s }, a) => /* @__PURE__ */ r(
|
35
|
+
g,
|
19
36
|
{
|
20
|
-
ref:
|
37
|
+
ref: a,
|
21
38
|
...s,
|
22
|
-
maxLength:
|
23
|
-
inputMode:
|
24
|
-
pattern: n || R[
|
39
|
+
maxLength: i,
|
40
|
+
inputMode: v[t],
|
41
|
+
pattern: n || R[t],
|
25
42
|
containerClassName: "flex items-center gap-2 has-[:disabled]:opacity-50",
|
26
|
-
render: ({ slots:
|
43
|
+
render: ({ slots: d }) => /* @__PURE__ */ r(u, { children: d.map(({ isActive: c, char: l }, p) => /* @__PURE__ */ r(
|
27
44
|
"div",
|
28
45
|
{
|
29
|
-
ref:
|
46
|
+
ref: a,
|
30
47
|
role: "textbox",
|
31
|
-
className:
|
32
|
-
|
33
|
-
|
48
|
+
className: o(
|
49
|
+
_({ error: e }),
|
50
|
+
x({ variant: "body", level: 2 }),
|
34
51
|
"w-12 h-[4.25rem] rounded-lg flex items-center justify-center",
|
35
|
-
(
|
52
|
+
(c || e) && "z-10 bg-gray-0"
|
36
53
|
),
|
37
|
-
children:
|
54
|
+
children: l
|
38
55
|
},
|
39
|
-
|
56
|
+
p
|
40
57
|
)) })
|
41
58
|
}
|
42
59
|
)
|
43
60
|
);
|
44
61
|
export {
|
45
|
-
|
46
|
-
|
62
|
+
I as OTPField,
|
63
|
+
I as default,
|
64
|
+
_ as inputVariants
|
47
65
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { InputProps } from '../Input';
|
2
|
-
export interface PasswordFieldProps extends Omit<InputProps, "startAdornment"
|
2
|
+
export interface PasswordFieldProps extends Omit<InputProps, "startAdornment"> {
|
3
3
|
/**
|
4
4
|
* If true, the input will display in an error state with error styling
|
5
5
|
*/
|
@@ -3,43 +3,40 @@ import { jsx as o } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as l, useState as w } from "react";
|
4
4
|
import { Eye as u } from "../Icons/Eye.js";
|
5
5
|
import { EyeClosed as c } from "../Icons/EyeClosed.js";
|
6
|
-
import { Input as
|
7
|
-
const
|
6
|
+
import { Input as y } from "../Input/Input.js";
|
7
|
+
const x = l(
|
8
8
|
({
|
9
|
-
isValid:
|
9
|
+
isValid: e,
|
10
10
|
disabled: r,
|
11
|
-
type:
|
12
|
-
autoComplete:
|
13
|
-
spellCheck:
|
14
|
-
inputMode:
|
15
|
-
autoCapitalize:
|
11
|
+
type: P = "password",
|
12
|
+
autoComplete: s = "current-password",
|
13
|
+
spellCheck: d = "false",
|
14
|
+
inputMode: a = "text",
|
15
|
+
autoCapitalize: f = "off",
|
16
16
|
autoCorrect: p = "off",
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}, f) => {
|
21
|
-
const [e, i] = w(!1);
|
17
|
+
...n
|
18
|
+
}, m) => {
|
19
|
+
const [t, i] = w(!1);
|
22
20
|
return /* @__PURE__ */ o(
|
23
|
-
|
21
|
+
y,
|
24
22
|
{
|
25
|
-
...
|
26
|
-
ref:
|
27
|
-
isValid:
|
23
|
+
...n,
|
24
|
+
ref: m,
|
25
|
+
isValid: e,
|
28
26
|
disabled: r,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
autoCapitalize: m,
|
27
|
+
endAdornment: /* @__PURE__ */ o("button", { type: "button", onClick: () => i(!t), children: t ? /* @__PURE__ */ o(c, {}) : /* @__PURE__ */ o(u, {}) }),
|
28
|
+
type: t ? "text" : "password",
|
29
|
+
autoComplete: s,
|
30
|
+
spellCheck: d,
|
31
|
+
inputMode: a,
|
32
|
+
autoCapitalize: f,
|
36
33
|
autoCorrect: p
|
37
34
|
}
|
38
35
|
);
|
39
36
|
}
|
40
37
|
);
|
41
|
-
|
38
|
+
x.displayName = "PasswordField";
|
42
39
|
export {
|
43
|
-
|
44
|
-
|
40
|
+
x as PasswordField,
|
41
|
+
x as default
|
45
42
|
};
|
@@ -15,6 +15,5 @@ interface PasteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
15
15
|
*/
|
16
16
|
onPaste?: (value: string) => void;
|
17
17
|
}
|
18
|
-
export declare const PASTE_BUTTON_WIDTH = 5;
|
19
18
|
declare const PasteButton: React.ForwardRefExoticComponent<PasteButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
20
19
|
export default PasteButton;
|
@@ -3,8 +3,8 @@ import * as d from "react";
|
|
3
3
|
import { cn as m } from "../../lib/utils.js";
|
4
4
|
import { MagicWand as u } from "../Icons/MagicWand.js";
|
5
5
|
import { Typography as p } from "../Typography/Typography.js";
|
6
|
-
const
|
7
|
-
({ children: x, inputRef: r, label: o = "Paste", className:
|
6
|
+
const f = d.forwardRef(
|
7
|
+
({ children: x, inputRef: r, label: o = "Paste", className: l, onPaste: a, ...n }, c) => {
|
8
8
|
const i = async () => {
|
9
9
|
try {
|
10
10
|
if (r && "current" in r && r.current) {
|
@@ -19,13 +19,13 @@ const T = 5, f = d.forwardRef(
|
|
19
19
|
"button",
|
20
20
|
{
|
21
21
|
type: "button",
|
22
|
-
ref:
|
22
|
+
ref: c,
|
23
23
|
className: m(
|
24
|
-
|
24
|
+
l,
|
25
25
|
"flex h-full w-full items-center justify-center px-4 gap-1 text-gray-900 transition duration-300 bg-transparent disabled:cursor-not-allowed"
|
26
26
|
),
|
27
27
|
onClick: i,
|
28
|
-
...
|
28
|
+
...n,
|
29
29
|
children: [
|
30
30
|
/* @__PURE__ */ e(p, { variant: "subtitle", level: 3, children: o }),
|
31
31
|
/* @__PURE__ */ e(u, {})
|
@@ -36,6 +36,5 @@ const T = 5, f = d.forwardRef(
|
|
36
36
|
);
|
37
37
|
f.displayName = "PasteButton";
|
38
38
|
export {
|
39
|
-
T as PASTE_BUTTON_WIDTH,
|
40
39
|
f as default
|
41
40
|
};
|