@kavagy/react 0.1.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/CHANGELOG.md +35 -0
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/avatar/avatar.d.ts +189 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/avatar.js +185 -0
- package/dist/avatar/avatar.js.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +2 -0
- package/dist/badges/badges.d.ts +149 -0
- package/dist/badges/badges.d.ts.map +1 -0
- package/dist/badges/badges.js +269 -0
- package/dist/badges/badges.js.map +1 -0
- package/dist/badges/index.d.ts +2 -0
- package/dist/badges/index.js +2 -0
- package/dist/button/button.d.ts +208 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +158 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +2 -0
- package/dist/button-utility/button-utility.d.ts +59 -0
- package/dist/button-utility/button-utility.d.ts.map +1 -0
- package/dist/button-utility/button-utility.js +78 -0
- package/dist/button-utility/button-utility.js.map +1 -0
- package/dist/button-utility/index.d.ts +2 -0
- package/dist/button-utility/index.js +2 -0
- package/dist/checkbox/checkbox.d.ts +23 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +81 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/dropdown/dropdown.d.ts +33 -0
- package/dist/dropdown/dropdown.d.ts.map +1 -0
- package/dist/dropdown/dropdown.js +128 -0
- package/dist/dropdown/dropdown.js.map +1 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/featured-icon/featured-icon.d.ts +141 -0
- package/dist/featured-icon/featured-icon.d.ts.map +1 -0
- package/dist/featured-icon/featured-icon.js +292 -0
- package/dist/featured-icon/featured-icon.js.map +1 -0
- package/dist/featured-icon/index.d.ts +2 -0
- package/dist/featured-icon/index.js +2 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +2 -0
- package/dist/input/input.d.ts +42 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +136 -0
- package/dist/input/input.js.map +1 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/modal/modal.d.ts +8 -0
- package/dist/modal/modal.d.ts.map +1 -0
- package/dist/modal/modal.js +35 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/radio-buttons/index.d.ts +2 -0
- package/dist/radio-buttons/index.js +2 -0
- package/dist/radio-buttons/radio-buttons.d.ts +30 -0
- package/dist/radio-buttons/radio-buttons.d.ts.map +1 -0
- package/dist/radio-buttons/radio-buttons.js +71 -0
- package/dist/radio-buttons/radio-buttons.js.map +1 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/index.js +2 -0
- package/dist/select/select.d.ts +40 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +198 -0
- package/dist/select/select.js.map +1 -0
- package/dist/styles.css +2843 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/table/index.js +2 -0
- package/dist/table/table.d.ts +61 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +208 -0
- package/dist/table/table.js.map +1 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.d.ts +62 -0
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +120 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -0
- package/dist/textarea/textarea.d.ts +26 -0
- package/dist/textarea/textarea.d.ts.map +1 -0
- package/dist/textarea/textarea.js +74 -0
- package/dist/textarea/textarea.js.map +1 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +2 -0
- package/dist/toggle/toggle.d.ts +151 -0
- package/dist/toggle/toggle.d.ts.map +1 -0
- package/dist/toggle/toggle.js +145 -0
- package/dist/toggle/toggle.js.map +1 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/tooltip.d.ts +59 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.js +86 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/dist/utils/cx.d.ts +21 -0
- package/dist/utils/cx.d.ts.map +1 -0
- package/dist/utils/cx.js +75 -0
- package/dist/utils/cx.js.map +1 -0
- package/dist/utils/is-react-component.d.ts +9 -0
- package/dist/utils/is-react-component.d.ts.map +1 -0
- package/dist/utils/is-react-component.js +17 -0
- package/dist/utils/is-react-component.js.map +1 -0
- package/dist/utils/tv.d.ts +6 -0
- package/dist/utils/tv.d.ts.map +1 -0
- package/dist/utils/tv.js +11 -0
- package/dist/utils/tv.js.map +1 -0
- package/package.json +146 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { VariantProps } from "../utils/tv.js";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
//#region src/featured-icon/featured-icon.d.ts
|
|
4
|
+
export declare const featuredIconStyles: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
sm: {
|
|
7
|
+
root: string;
|
|
8
|
+
};
|
|
9
|
+
md: {
|
|
10
|
+
root: string;
|
|
11
|
+
};
|
|
12
|
+
lg: {
|
|
13
|
+
root: string;
|
|
14
|
+
};
|
|
15
|
+
xl: {
|
|
16
|
+
root: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
theme: {
|
|
20
|
+
light: {
|
|
21
|
+
root: string;
|
|
22
|
+
};
|
|
23
|
+
gradient: {
|
|
24
|
+
root: string;
|
|
25
|
+
};
|
|
26
|
+
dark: {
|
|
27
|
+
root: string;
|
|
28
|
+
};
|
|
29
|
+
modern: {
|
|
30
|
+
root: string;
|
|
31
|
+
};
|
|
32
|
+
outline: {
|
|
33
|
+
root: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
color: {
|
|
37
|
+
brand: {};
|
|
38
|
+
gray: {};
|
|
39
|
+
error: {};
|
|
40
|
+
warning: {};
|
|
41
|
+
success: {};
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
root: string;
|
|
45
|
+
}, undefined, {
|
|
46
|
+
size: {
|
|
47
|
+
sm: {
|
|
48
|
+
root: string;
|
|
49
|
+
};
|
|
50
|
+
md: {
|
|
51
|
+
root: string;
|
|
52
|
+
};
|
|
53
|
+
lg: {
|
|
54
|
+
root: string;
|
|
55
|
+
};
|
|
56
|
+
xl: {
|
|
57
|
+
root: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
theme: {
|
|
61
|
+
light: {
|
|
62
|
+
root: string;
|
|
63
|
+
};
|
|
64
|
+
gradient: {
|
|
65
|
+
root: string;
|
|
66
|
+
};
|
|
67
|
+
dark: {
|
|
68
|
+
root: string;
|
|
69
|
+
};
|
|
70
|
+
modern: {
|
|
71
|
+
root: string;
|
|
72
|
+
};
|
|
73
|
+
outline: {
|
|
74
|
+
root: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
color: {
|
|
78
|
+
brand: {};
|
|
79
|
+
gray: {};
|
|
80
|
+
error: {};
|
|
81
|
+
warning: {};
|
|
82
|
+
success: {};
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
root: string;
|
|
86
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
87
|
+
size: {
|
|
88
|
+
sm: {
|
|
89
|
+
root: string;
|
|
90
|
+
};
|
|
91
|
+
md: {
|
|
92
|
+
root: string;
|
|
93
|
+
};
|
|
94
|
+
lg: {
|
|
95
|
+
root: string;
|
|
96
|
+
};
|
|
97
|
+
xl: {
|
|
98
|
+
root: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
theme: {
|
|
102
|
+
light: {
|
|
103
|
+
root: string;
|
|
104
|
+
};
|
|
105
|
+
gradient: {
|
|
106
|
+
root: string;
|
|
107
|
+
};
|
|
108
|
+
dark: {
|
|
109
|
+
root: string;
|
|
110
|
+
};
|
|
111
|
+
modern: {
|
|
112
|
+
root: string;
|
|
113
|
+
};
|
|
114
|
+
outline: {
|
|
115
|
+
root: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
color: {
|
|
119
|
+
brand: {};
|
|
120
|
+
gray: {};
|
|
121
|
+
error: {};
|
|
122
|
+
warning: {};
|
|
123
|
+
success: {};
|
|
124
|
+
};
|
|
125
|
+
}, {
|
|
126
|
+
root: string;
|
|
127
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
128
|
+
type FeaturedIconVariants = VariantProps<typeof featuredIconStyles>;
|
|
129
|
+
export interface FeaturedIconProps {
|
|
130
|
+
children?: ReactNode;
|
|
131
|
+
className?: string;
|
|
132
|
+
icon?: FC<{
|
|
133
|
+
className?: string;
|
|
134
|
+
}> | ReactNode;
|
|
135
|
+
size?: FeaturedIconVariants['size'];
|
|
136
|
+
color?: FeaturedIconVariants['color'];
|
|
137
|
+
theme?: FeaturedIconVariants['theme'];
|
|
138
|
+
}
|
|
139
|
+
export declare const FeaturedIcon: import("react").ForwardRefExoticComponent<FeaturedIconProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
140
|
+
//#endregion
|
|
141
|
+
//# sourceMappingURL=featured-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featured-icon.d.ts","names":[],"sources":["../../src/featured-icon/featured-icon.tsx"],"mappings":";;;qBAYa,gDAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4K1B,uBAAuB,oBAAoB;iBAE/B;EACf,WAAW;EACX;EACA,OAAO;IAAK;OAAwB;EACpC,OAAO;EACP,QAAQ;EACR,QAAQ;;qBAGG,8BAAY,0BAAA,oCAAA,cAAA"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { cx } from "../utils/cx.js";
|
|
2
|
+
import { tv } from "../utils/tv.js";
|
|
3
|
+
import { isReactComponent } from "../utils/is-react-component.js";
|
|
4
|
+
import { forwardRef, isValidElement } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/featured-icon/featured-icon.tsx
|
|
7
|
+
const featuredIconStyles = tv({
|
|
8
|
+
slots: { root: "relative flex shrink-0 items-center justify-center" },
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: { root: "*:data-icon:size-4 *:data-icon:stroke-[2.25px]" },
|
|
12
|
+
md: { root: "*:data-icon:size-5" },
|
|
13
|
+
lg: { root: "*:data-icon:size-6" },
|
|
14
|
+
xl: { root: "*:data-icon:size-7" }
|
|
15
|
+
},
|
|
16
|
+
theme: {
|
|
17
|
+
light: { root: "rounded-full" },
|
|
18
|
+
gradient: { root: "rounded-full text-fg-white before:absolute before:inset-0 before:size-full before:rounded-full before:border before:mask-b-from-0% after:absolute after:block after:rounded-full" },
|
|
19
|
+
dark: { root: "text-fg-white shadow-xs-skeuomorphic before:absolute before:inset-px before:border before:border-white/12 before:mask-b-from-0%" },
|
|
20
|
+
modern: { root: "bg-primary shadow-xs-skeuomorphic ring-1 ring-primary ring-inset" },
|
|
21
|
+
outline: { root: "before:absolute before:rounded-full before:border-2 after:absolute after:rounded-full after:border-2" }
|
|
22
|
+
},
|
|
23
|
+
color: {
|
|
24
|
+
brand: {},
|
|
25
|
+
gray: {},
|
|
26
|
+
error: {},
|
|
27
|
+
warning: {},
|
|
28
|
+
success: {}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
{
|
|
33
|
+
theme: "light",
|
|
34
|
+
size: "sm",
|
|
35
|
+
class: { root: "size-8" }
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
theme: "light",
|
|
39
|
+
size: "md",
|
|
40
|
+
class: { root: "size-10" }
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
theme: "light",
|
|
44
|
+
size: "lg",
|
|
45
|
+
class: { root: "size-12" }
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
theme: "light",
|
|
49
|
+
size: "xl",
|
|
50
|
+
class: { root: "size-14" }
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
theme: "light",
|
|
54
|
+
color: "brand",
|
|
55
|
+
class: { root: "bg-brand-secondary text-fg-brand-primary" }
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
theme: "light",
|
|
59
|
+
color: "gray",
|
|
60
|
+
class: { root: "bg-tertiary text-fg-secondary" }
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
theme: "light",
|
|
64
|
+
color: "error",
|
|
65
|
+
class: { root: "bg-error-secondary text-fg-error-primary" }
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
theme: "light",
|
|
69
|
+
color: "warning",
|
|
70
|
+
class: { root: "bg-warning-secondary text-fg-warning-primary" }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
theme: "light",
|
|
74
|
+
color: "success",
|
|
75
|
+
class: { root: "bg-success-secondary text-fg-success-primary" }
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
theme: "gradient",
|
|
79
|
+
size: "sm",
|
|
80
|
+
class: { root: "size-8 after:size-6 *:data-icon:size-4" }
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
theme: "gradient",
|
|
84
|
+
size: "md",
|
|
85
|
+
class: { root: "size-10 after:size-7 *:data-icon:size-4" }
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
theme: "gradient",
|
|
89
|
+
size: "lg",
|
|
90
|
+
class: { root: "size-12 after:size-8 *:data-icon:size-5" }
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
theme: "gradient",
|
|
94
|
+
size: "xl",
|
|
95
|
+
class: { root: "size-14 after:size-10 *:data-icon:size-5" }
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
theme: "gradient",
|
|
99
|
+
color: "brand",
|
|
100
|
+
class: { root: "before:border-utility-brand-200 before:bg-utility-brand-50 after:bg-brand-solid" }
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
theme: "gradient",
|
|
104
|
+
color: "gray",
|
|
105
|
+
class: { root: "before:border-utility-neutral-200 before:bg-utility-neutral-50 after:bg-secondary-solid" }
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
theme: "gradient",
|
|
109
|
+
color: "error",
|
|
110
|
+
class: { root: "before:border-utility-red-200 before:bg-utility-red-50 after:bg-error-solid" }
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
theme: "gradient",
|
|
114
|
+
color: "warning",
|
|
115
|
+
class: { root: "before:border-utility-yellow-200 before:bg-utility-yellow-50 after:bg-warning-solid" }
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
theme: "gradient",
|
|
119
|
+
color: "success",
|
|
120
|
+
class: { root: "before:border-utility-green-200 before:bg-utility-green-50 after:bg-success-solid" }
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
theme: "dark",
|
|
124
|
+
size: "sm",
|
|
125
|
+
class: { root: "size-8 rounded-md before:rounded-[5px]" }
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
theme: "dark",
|
|
129
|
+
size: "md",
|
|
130
|
+
class: { root: "size-10 rounded-lg before:rounded-[7px]" }
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
theme: "dark",
|
|
134
|
+
size: "lg",
|
|
135
|
+
class: { root: "size-12 rounded-[10px] before:rounded-[9px]" }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
theme: "dark",
|
|
139
|
+
size: "xl",
|
|
140
|
+
class: { root: "size-14 rounded-xl before:rounded-[11px]" }
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
theme: "dark",
|
|
144
|
+
color: "brand",
|
|
145
|
+
class: { root: "bg-brand-solid before:border-utility-brand-200/12" }
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
theme: "dark",
|
|
149
|
+
color: "gray",
|
|
150
|
+
class: { root: "bg-secondary-solid before:border-utility-neutral-200/12" }
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
theme: "dark",
|
|
154
|
+
color: "error",
|
|
155
|
+
class: { root: "bg-error-solid before:border-utility-red-200/12" }
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
theme: "dark",
|
|
159
|
+
color: "warning",
|
|
160
|
+
class: { root: "bg-warning-solid before:border-utility-yellow-200/12" }
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
theme: "dark",
|
|
164
|
+
color: "success",
|
|
165
|
+
class: { root: "bg-success-solid before:border-utility-green-200/12" }
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
theme: "modern",
|
|
169
|
+
size: "sm",
|
|
170
|
+
class: { root: "size-8 rounded-md" }
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
theme: "modern",
|
|
174
|
+
size: "md",
|
|
175
|
+
class: { root: "size-10 rounded-lg" }
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
theme: "modern",
|
|
179
|
+
size: "lg",
|
|
180
|
+
class: { root: "size-12 rounded-[10px]" }
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
theme: "modern",
|
|
184
|
+
size: "xl",
|
|
185
|
+
class: { root: "size-14 rounded-xl" }
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
theme: "modern",
|
|
189
|
+
color: "brand",
|
|
190
|
+
class: { root: "text-fg-brand-primary" }
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
theme: "modern",
|
|
194
|
+
color: "gray",
|
|
195
|
+
class: { root: "text-fg-secondary" }
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
theme: "modern",
|
|
199
|
+
color: "error",
|
|
200
|
+
class: { root: "text-fg-error-primary" }
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
theme: "modern",
|
|
204
|
+
color: "warning",
|
|
205
|
+
class: { root: "text-fg-warning-primary" }
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
theme: "modern",
|
|
209
|
+
color: "success",
|
|
210
|
+
class: { root: "text-fg-success-primary" }
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
theme: "outline",
|
|
214
|
+
size: "sm",
|
|
215
|
+
class: { root: "size-4 before:size-6 after:size-8.5" }
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
theme: "outline",
|
|
219
|
+
size: "md",
|
|
220
|
+
class: { root: "size-5 before:size-7 after:size-9.5" }
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
theme: "outline",
|
|
224
|
+
size: "lg",
|
|
225
|
+
class: { root: "size-6 before:size-8 after:size-10.5" }
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
theme: "outline",
|
|
229
|
+
size: "xl",
|
|
230
|
+
class: { root: "size-7 before:size-9 after:size-11.5" }
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
theme: "outline",
|
|
234
|
+
color: "brand",
|
|
235
|
+
class: { root: "text-fg-brand-primary before:border-fg-brand-primary/30 after:border-fg-brand-primary/10" }
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
theme: "outline",
|
|
239
|
+
color: "gray",
|
|
240
|
+
class: { root: "text-fg-tertiary before:border-fg-tertiary/30 after:border-fg-tertiary/10" }
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
theme: "outline",
|
|
244
|
+
color: "error",
|
|
245
|
+
class: { root: "text-fg-error-primary before:border-fg-error-primary/30 after:border-fg-error-primary/10" }
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
theme: "outline",
|
|
249
|
+
color: "warning",
|
|
250
|
+
class: { root: "text-fg-warning-primary before:border-fg-warning-primary/30 after:border-fg-warning-primary/10" }
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
theme: "outline",
|
|
254
|
+
color: "success",
|
|
255
|
+
class: { root: "text-fg-success-primary before:border-fg-success-primary/30 after:border-fg-success-primary/10" }
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
defaultVariants: {
|
|
259
|
+
size: "sm",
|
|
260
|
+
theme: "light",
|
|
261
|
+
color: "brand"
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
const FeaturedIcon = forwardRef(function FeaturedIcon(props, ref) {
|
|
265
|
+
const { size, theme, color, icon: Icon, children, className, ...rest } = props;
|
|
266
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
267
|
+
...rest,
|
|
268
|
+
ref,
|
|
269
|
+
"data-featured-icon": true,
|
|
270
|
+
className: cx(featuredIconStyles({
|
|
271
|
+
size,
|
|
272
|
+
theme,
|
|
273
|
+
color
|
|
274
|
+
}).root(), className),
|
|
275
|
+
children: [
|
|
276
|
+
isReactComponent(Icon) && /* @__PURE__ */ jsx(Icon, {
|
|
277
|
+
"data-icon": true,
|
|
278
|
+
className: "z-1"
|
|
279
|
+
}),
|
|
280
|
+
isValidElement(Icon) && /* @__PURE__ */ jsx("div", {
|
|
281
|
+
className: "z-1",
|
|
282
|
+
children: Icon
|
|
283
|
+
}),
|
|
284
|
+
children
|
|
285
|
+
]
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
FeaturedIcon.displayName = "FeaturedIcon";
|
|
289
|
+
//#endregion
|
|
290
|
+
export { FeaturedIcon, featuredIconStyles };
|
|
291
|
+
|
|
292
|
+
//# sourceMappingURL=featured-icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featured-icon.js","names":[],"sources":["../../src/featured-icon/featured-icon.tsx"],"sourcesContent":["/* @kavagy-source: untitledui/foundations/featured-icon/featured-icon.tsx */\n\nimport type { FC, ReactNode } from 'react';\nimport { forwardRef, isValidElement } from 'react';\nimport { cx } from '../utils/cx';\nimport { isReactComponent } from '../utils/is-react-component';\nimport type { VariantProps } from '../utils/tv';\nimport { tv } from '../utils/tv';\n\n// The original scaffold references `text-featured-icon-<theme>-fg-<color>` tokens that\n// don't exist in the Kavagy semantic taxonomy (see docs/ARCHITECTURE.md). Replaced with\n// the equivalent `fg-*` tokens already used by the scaffold's own \"modern\" theme.\nexport const featuredIconStyles = tv({\n slots: {\n root: 'relative flex shrink-0 items-center justify-center',\n },\n variants: {\n size: {\n sm: { root: '*:data-icon:size-4 *:data-icon:stroke-[2.25px]' },\n md: { root: '*:data-icon:size-5' },\n lg: { root: '*:data-icon:size-6' },\n xl: { root: '*:data-icon:size-7' },\n },\n theme: {\n light: { root: 'rounded-full' },\n gradient: {\n root: 'rounded-full text-fg-white before:absolute before:inset-0 before:size-full before:rounded-full before:border before:mask-b-from-0% after:absolute after:block after:rounded-full',\n },\n dark: {\n root: 'text-fg-white shadow-xs-skeuomorphic before:absolute before:inset-px before:border before:border-white/12 before:mask-b-from-0%',\n },\n modern: { root: 'bg-primary shadow-xs-skeuomorphic ring-1 ring-primary ring-inset' },\n outline: {\n root: 'before:absolute before:rounded-full before:border-2 after:absolute after:rounded-full after:border-2',\n },\n },\n color: {\n brand: {},\n gray: {},\n error: {},\n warning: {},\n success: {},\n },\n },\n compoundVariants: [\n { theme: 'light', size: 'sm', class: { root: 'size-8' } },\n { theme: 'light', size: 'md', class: { root: 'size-10' } },\n { theme: 'light', size: 'lg', class: { root: 'size-12' } },\n { theme: 'light', size: 'xl', class: { root: 'size-14' } },\n { theme: 'light', color: 'brand', class: { root: 'bg-brand-secondary text-fg-brand-primary' } },\n { theme: 'light', color: 'gray', class: { root: 'bg-tertiary text-fg-secondary' } },\n { theme: 'light', color: 'error', class: { root: 'bg-error-secondary text-fg-error-primary' } },\n {\n theme: 'light',\n color: 'warning',\n class: { root: 'bg-warning-secondary text-fg-warning-primary' },\n },\n {\n theme: 'light',\n color: 'success',\n class: { root: 'bg-success-secondary text-fg-success-primary' },\n },\n\n { theme: 'gradient', size: 'sm', class: { root: 'size-8 after:size-6 *:data-icon:size-4' } },\n { theme: 'gradient', size: 'md', class: { root: 'size-10 after:size-7 *:data-icon:size-4' } },\n { theme: 'gradient', size: 'lg', class: { root: 'size-12 after:size-8 *:data-icon:size-5' } },\n { theme: 'gradient', size: 'xl', class: { root: 'size-14 after:size-10 *:data-icon:size-5' } },\n {\n theme: 'gradient',\n color: 'brand',\n class: {\n root: 'before:border-utility-brand-200 before:bg-utility-brand-50 after:bg-brand-solid',\n },\n },\n {\n theme: 'gradient',\n color: 'gray',\n class: {\n root: 'before:border-utility-neutral-200 before:bg-utility-neutral-50 after:bg-secondary-solid',\n },\n },\n {\n theme: 'gradient',\n color: 'error',\n class: {\n root: 'before:border-utility-red-200 before:bg-utility-red-50 after:bg-error-solid',\n },\n },\n {\n theme: 'gradient',\n color: 'warning',\n class: {\n root: 'before:border-utility-yellow-200 before:bg-utility-yellow-50 after:bg-warning-solid',\n },\n },\n {\n theme: 'gradient',\n color: 'success',\n class: {\n root: 'before:border-utility-green-200 before:bg-utility-green-50 after:bg-success-solid',\n },\n },\n\n { theme: 'dark', size: 'sm', class: { root: 'size-8 rounded-md before:rounded-[5px]' } },\n { theme: 'dark', size: 'md', class: { root: 'size-10 rounded-lg before:rounded-[7px]' } },\n { theme: 'dark', size: 'lg', class: { root: 'size-12 rounded-[10px] before:rounded-[9px]' } },\n { theme: 'dark', size: 'xl', class: { root: 'size-14 rounded-xl before:rounded-[11px]' } },\n {\n theme: 'dark',\n color: 'brand',\n class: { root: 'bg-brand-solid before:border-utility-brand-200/12' },\n },\n {\n theme: 'dark',\n color: 'gray',\n class: { root: 'bg-secondary-solid before:border-utility-neutral-200/12' },\n },\n {\n theme: 'dark',\n color: 'error',\n class: { root: 'bg-error-solid before:border-utility-red-200/12' },\n },\n {\n theme: 'dark',\n color: 'warning',\n class: { root: 'bg-warning-solid before:border-utility-yellow-200/12' },\n },\n {\n theme: 'dark',\n color: 'success',\n class: { root: 'bg-success-solid before:border-utility-green-200/12' },\n },\n\n { theme: 'modern', size: 'sm', class: { root: 'size-8 rounded-md' } },\n { theme: 'modern', size: 'md', class: { root: 'size-10 rounded-lg' } },\n { theme: 'modern', size: 'lg', class: { root: 'size-12 rounded-[10px]' } },\n { theme: 'modern', size: 'xl', class: { root: 'size-14 rounded-xl' } },\n { theme: 'modern', color: 'brand', class: { root: 'text-fg-brand-primary' } },\n { theme: 'modern', color: 'gray', class: { root: 'text-fg-secondary' } },\n { theme: 'modern', color: 'error', class: { root: 'text-fg-error-primary' } },\n { theme: 'modern', color: 'warning', class: { root: 'text-fg-warning-primary' } },\n { theme: 'modern', color: 'success', class: { root: 'text-fg-success-primary' } },\n\n { theme: 'outline', size: 'sm', class: { root: 'size-4 before:size-6 after:size-8.5' } },\n { theme: 'outline', size: 'md', class: { root: 'size-5 before:size-7 after:size-9.5' } },\n { theme: 'outline', size: 'lg', class: { root: 'size-6 before:size-8 after:size-10.5' } },\n { theme: 'outline', size: 'xl', class: { root: 'size-7 before:size-9 after:size-11.5' } },\n {\n theme: 'outline',\n color: 'brand',\n class: {\n root: 'text-fg-brand-primary before:border-fg-brand-primary/30 after:border-fg-brand-primary/10',\n },\n },\n {\n theme: 'outline',\n color: 'gray',\n class: { root: 'text-fg-tertiary before:border-fg-tertiary/30 after:border-fg-tertiary/10' },\n },\n {\n theme: 'outline',\n color: 'error',\n class: {\n root: 'text-fg-error-primary before:border-fg-error-primary/30 after:border-fg-error-primary/10',\n },\n },\n {\n theme: 'outline',\n color: 'warning',\n class: {\n root: 'text-fg-warning-primary before:border-fg-warning-primary/30 after:border-fg-warning-primary/10',\n },\n },\n {\n theme: 'outline',\n color: 'success',\n class: {\n root: 'text-fg-success-primary before:border-fg-success-primary/30 after:border-fg-success-primary/10',\n },\n },\n ],\n defaultVariants: { size: 'sm', theme: 'light', color: 'brand' },\n});\n\ntype FeaturedIconVariants = VariantProps<typeof featuredIconStyles>;\n\nexport interface FeaturedIconProps {\n children?: ReactNode;\n className?: string;\n icon?: FC<{ className?: string }> | ReactNode;\n size?: FeaturedIconVariants['size'];\n color?: FeaturedIconVariants['color'];\n theme?: FeaturedIconVariants['theme'];\n}\n\nexport const FeaturedIcon = forwardRef<HTMLDivElement, FeaturedIconProps>(\n function FeaturedIcon(props, ref) {\n const { size, theme, color, icon: Icon, children, className, ...rest } = props;\n\n return (\n <div\n {...rest}\n ref={ref}\n data-featured-icon\n className={cx(featuredIconStyles({ size, theme, color }).root(), className)}\n >\n {isReactComponent(Icon) && <Icon data-icon className=\"z-1\" />}\n {isValidElement(Icon) && <div className=\"z-1\">{Icon}</div>}\n {children}\n </div>\n );\n },\n);\n\nFeaturedIcon.displayName = 'FeaturedIcon';\n"],"mappings":"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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TooltipProps as TooltipProps$1 } from "../tooltip/tooltip.js";
|
|
2
|
+
import "../tooltip/index.js";
|
|
3
|
+
import { ComponentType, HTMLAttributes, ReactNode, Ref } from "react";
|
|
4
|
+
import { InputProps as InputProps$1, LabelProps as LabelProps$1, TextFieldProps, TextProps } from "react-aria-components";
|
|
5
|
+
//#region src/input/input.d.ts
|
|
6
|
+
export interface LabelProps extends LabelProps$1 {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
isInvalid?: boolean;
|
|
9
|
+
isRequired?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const Label: import("react").ForwardRefExoticComponent<LabelProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
12
|
+
export interface HintTextProps extends TextProps {
|
|
13
|
+
isInvalid?: boolean;
|
|
14
|
+
size?: 'sm' | 'md';
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const HintText: import("react").ForwardRefExoticComponent<HintTextProps & import("react").RefAttributes<HTMLElement>>;
|
|
18
|
+
export interface InputBaseProps extends Omit<InputProps$1, 'size'> {
|
|
19
|
+
isInvalid?: boolean;
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
isRequired?: boolean;
|
|
22
|
+
size?: 'sm' | 'md' | 'lg';
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
iconClassName?: string;
|
|
25
|
+
inputClassName?: string;
|
|
26
|
+
wrapperClassName?: string;
|
|
27
|
+
groupRef?: Ref<HTMLDivElement>;
|
|
28
|
+
icon?: ComponentType<HTMLAttributes<HTMLOrSVGElement>>;
|
|
29
|
+
}
|
|
30
|
+
export declare const InputBase: import("react").ForwardRefExoticComponent<InputBaseProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
31
|
+
export interface InputProps extends TextFieldProps, Pick<InputBaseProps, 'placeholder' | 'icon' | 'groupRef' | 'size' | 'wrapperClassName' | 'inputClassName' | 'iconClassName'> {
|
|
32
|
+
label?: string;
|
|
33
|
+
hint?: ReactNode;
|
|
34
|
+
hideRequiredIndicator?: boolean;
|
|
35
|
+
/** Tooltip content displayed next to the label. */
|
|
36
|
+
tooltip?: ReactNode;
|
|
37
|
+
/** Placement of the tooltip. @default 'top' */
|
|
38
|
+
tooltipPlacement?: TooltipProps$1['placement'];
|
|
39
|
+
}
|
|
40
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","names":[],"sources":["../../src/input/input.tsx"],"mappings":";;;;;iBAyBiB,mBAAmB;EAClC,UAAU;EACV;EACA;;qBAGW,uBAAK,0BAAA,6BAAA,cAAA;iBAgCD,sBAAsB;EACrC;EACA;EACA,UAAU;;qBAGC,0BAAQ,0BAAA,gCAAA,cAAA;iBAuBJ,uBAAuB,KAAK;EAC3C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,IAAI;EACf,OAAO,cAAc,eAAe;;qBA+BzB,2BAAS,0BAAA,iCAAA,cAAA;iBAqGL,mBACP,gBACN,KACE;EASJ;EACA,OAAO;EACP;;EAEA,UAAU;;EAEV,mBAAmB;;qBAGR,uBAAK,0BAAA,6BAAA,cAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../utils/cx.js";
|
|
3
|
+
import { Tooltip as Tooltip$1, TooltipTrigger as TooltipTrigger$1 } from "../tooltip/tooltip.js";
|
|
4
|
+
import "../tooltip/index.js";
|
|
5
|
+
import { Eye, EyeOff, HelpCircle, InfoCircle } from "@kavagy/icons";
|
|
6
|
+
import { createContext, forwardRef, useContext, useState } from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Button, Group, Input as Input$1, Label as Label$1, Text, TextField } from "react-aria-components";
|
|
9
|
+
//#region src/input/input.tsx
|
|
10
|
+
const Label = forwardRef(function Label({ isInvalid, isRequired, className, children, ...props }, ref) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(Label$1, {
|
|
12
|
+
"data-label": "true",
|
|
13
|
+
ref,
|
|
14
|
+
...props,
|
|
15
|
+
className: cx("flex cursor-default items-center gap-0.5 text-sm font-medium text-secondary", className),
|
|
16
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
17
|
+
className: cx("hidden text-brand-tertiary", isRequired && "block", typeof isRequired === "undefined" && "group-required:block", isInvalid && "text-error-primary", typeof isInvalid === "undefined" && "group-invalid:text-error-primary"),
|
|
18
|
+
children: "*"
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
Label.displayName = "Label";
|
|
23
|
+
const HintText = forwardRef(function HintText({ isInvalid, className, size = "md", ...props }, ref) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
25
|
+
ref,
|
|
26
|
+
...props,
|
|
27
|
+
slot: isInvalid ? "errorMessage" : "description",
|
|
28
|
+
className: cx("text-sm text-tertiary", size === "sm" && "text-xs", "in-data-[input-size=sm]:text-xs", isInvalid && "text-error-primary", "group-invalid:text-error-primary", className)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
HintText.displayName = "HintText";
|
|
32
|
+
const TextFieldContext = createContext({});
|
|
33
|
+
const inputSizes = {
|
|
34
|
+
sm: {
|
|
35
|
+
root: (hasLeading, hasTrailing) => cx("px-3 py-2 text-sm", hasLeading && "pl-9", hasTrailing && "pr-9"),
|
|
36
|
+
iconLeading: "left-3 size-4 stroke-[2.25px]",
|
|
37
|
+
iconTrailing: "right-3"
|
|
38
|
+
},
|
|
39
|
+
md: {
|
|
40
|
+
root: (hasLeading, hasTrailing) => cx("px-3 py-2 text-md", hasLeading && "pl-10", hasTrailing && "pr-9"),
|
|
41
|
+
iconLeading: "left-3 size-5",
|
|
42
|
+
iconTrailing: "right-3"
|
|
43
|
+
},
|
|
44
|
+
lg: {
|
|
45
|
+
root: (hasLeading, hasTrailing) => cx("px-3.5 py-2.5 text-md", hasLeading && "pl-10.5", hasTrailing && "pr-9.5"),
|
|
46
|
+
iconLeading: "left-3.5 size-5",
|
|
47
|
+
iconTrailing: "right-3.5"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const InputBase = forwardRef(function InputBase({ groupRef, size = "md", isInvalid, isDisabled, isRequired, icon: Icon, placeholder, wrapperClassName, inputClassName, iconClassName, type = "text", ...inputProps }, ref) {
|
|
51
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
52
|
+
const hasTrailingIcon = Boolean(isInvalid) || type === "password";
|
|
53
|
+
const hasLeadingIcon = Boolean(Icon);
|
|
54
|
+
const context = useContext(TextFieldContext);
|
|
55
|
+
const inputSize = context.size ?? size;
|
|
56
|
+
const sizeConfig = inputSizes[inputSize];
|
|
57
|
+
return /* @__PURE__ */ jsxs(Group, {
|
|
58
|
+
isDisabled,
|
|
59
|
+
isInvalid,
|
|
60
|
+
ref: groupRef,
|
|
61
|
+
className: ({ isFocusWithin, isDisabled: disabled, isInvalid: invalid }) => cx("group/input relative flex w-full flex-row place-content-center place-items-center rounded-lg bg-primary shadow-xs ring-1 ring-primary transition-shadow duration-100 ease-linear ring-inset", isFocusWithin && !disabled && "ring-2 ring-focus-ring", disabled && "cursor-not-allowed opacity-50", "group-disabled:cursor-not-allowed group-disabled:opacity-50", invalid && "ring-error_subtle", "group-invalid:ring-error_subtle", invalid && isFocusWithin && "ring-2 ring-error", isFocusWithin && "group-invalid:ring-2 group-invalid:ring-error", context.wrapperClassName, wrapperClassName),
|
|
62
|
+
children: [
|
|
63
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: cx("pointer-events-none absolute text-fg-quaternary", sizeConfig.iconLeading, context.iconClassName, iconClassName) }),
|
|
64
|
+
/* @__PURE__ */ jsx(Input$1, {
|
|
65
|
+
...inputProps,
|
|
66
|
+
ref,
|
|
67
|
+
required: isRequired,
|
|
68
|
+
type: type === "password" && isPasswordVisible ? "text" : type,
|
|
69
|
+
placeholder,
|
|
70
|
+
className: cx("m-0 w-full bg-transparent text-primary ring-0 outline-hidden placeholder:text-placeholder autofill:rounded-lg autofill:text-primary disabled:cursor-not-allowed", sizeConfig.root(hasLeadingIcon, hasTrailingIcon), context.inputClassName, inputClassName)
|
|
71
|
+
}),
|
|
72
|
+
type !== "password" && /* @__PURE__ */ jsx(InfoCircle, { className: cx("pointer-events-none absolute hidden size-4 stroke-[2.25px] text-fg-error-secondary group-invalid/input:block", sizeConfig.iconTrailing) }),
|
|
73
|
+
type === "password" && /* @__PURE__ */ jsx(Button, {
|
|
74
|
+
"aria-label": "Toggle password visibility",
|
|
75
|
+
onPress: () => setIsPasswordVisible((visible) => !visible),
|
|
76
|
+
className: cx("absolute flex cursor-pointer items-center justify-center text-fg-quaternary transition duration-100 ease-linear hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover focus:outline-hidden", sizeConfig.iconTrailing),
|
|
77
|
+
children: isPasswordVisible ? /* @__PURE__ */ jsx(EyeOff, { className: "size-4 stroke-[2.25px]" }) : /* @__PURE__ */ jsx(Eye, { className: "size-4 stroke-[2.25px]" })
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
InputBase.displayName = "InputBase";
|
|
83
|
+
const Input = forwardRef(function Input({ size = "md", placeholder, icon: Icon, label, hint, hideRequiredIndicator, tooltip, tooltipPlacement, className, groupRef, iconClassName, inputClassName, wrapperClassName, type = "text", ...props }, ref) {
|
|
84
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
85
|
+
"aria-label": !label ? placeholder : void 0,
|
|
86
|
+
...props,
|
|
87
|
+
"data-input-wrapper": true,
|
|
88
|
+
"data-input-size": size,
|
|
89
|
+
className: (state) => cx("group flex h-max w-full flex-col items-start justify-start gap-1.5", typeof className === "function" ? className(state) : className),
|
|
90
|
+
children: ({ isRequired, isInvalid }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
|
+
(label || tooltip) && /* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: "flex w-full items-center justify-between gap-1",
|
|
93
|
+
children: [label && /* @__PURE__ */ jsx(Label, {
|
|
94
|
+
isRequired: hideRequiredIndicator ? !hideRequiredIndicator : isRequired,
|
|
95
|
+
isInvalid,
|
|
96
|
+
children: label
|
|
97
|
+
}), tooltip && /* @__PURE__ */ jsx(Tooltip$1, {
|
|
98
|
+
title: tooltip,
|
|
99
|
+
placement: tooltipPlacement ?? "top",
|
|
100
|
+
children: /* @__PURE__ */ jsxs(TooltipTrigger$1, {
|
|
101
|
+
className: "text-fg-quaternary hover:text-fg-quaternary_hover",
|
|
102
|
+
children: [/* @__PURE__ */ jsx(HelpCircle, {
|
|
103
|
+
"aria-hidden": "true",
|
|
104
|
+
className: "size-4"
|
|
105
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: "sr-only",
|
|
107
|
+
children: "More information"
|
|
108
|
+
})]
|
|
109
|
+
})
|
|
110
|
+
})]
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx(InputBase, {
|
|
113
|
+
ref,
|
|
114
|
+
groupRef,
|
|
115
|
+
size,
|
|
116
|
+
placeholder,
|
|
117
|
+
icon: Icon,
|
|
118
|
+
iconClassName,
|
|
119
|
+
inputClassName,
|
|
120
|
+
wrapperClassName,
|
|
121
|
+
isInvalid,
|
|
122
|
+
isRequired,
|
|
123
|
+
type
|
|
124
|
+
}),
|
|
125
|
+
hint && /* @__PURE__ */ jsx(HintText, {
|
|
126
|
+
isInvalid,
|
|
127
|
+
children: hint
|
|
128
|
+
})
|
|
129
|
+
] })
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
Input.displayName = "Input";
|
|
133
|
+
//#endregion
|
|
134
|
+
export { HintText, Input, InputBase, Label };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=input.js.map
|