@walidsj/react-ui 0.1.4 → 0.1.5
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/README.md +8 -0
- package/dist/button-CYdt-JvA.js +39 -0
- package/dist/button-CYdt-JvA.js.map +1 -0
- package/dist/cn-BtC0eFBk.js +70 -0
- package/dist/cn-BtC0eFBk.js.map +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/index.js +3 -163
- package/dist/input-CAZTJfrq.js +36 -0
- package/dist/input-CAZTJfrq.js.map +1 -0
- package/dist/textarea-BrjTLlfm.js +35 -0
- package/dist/textarea-BrjTLlfm.js.map +1 -0
- package/package.json +13 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -45,6 +45,14 @@ export function Example() {
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
Components can also be imported individually:
|
|
49
|
+
|
|
50
|
+
``` tsx
|
|
51
|
+
import { Button } from "@walidsj/react-ui/components/button";
|
|
52
|
+
import { Input } from "@walidsj/react-ui/components/input";
|
|
53
|
+
import { Textarea } from "@walidsj/react-ui/components/textarea";
|
|
54
|
+
```
|
|
55
|
+
|
|
48
56
|
## Components
|
|
49
57
|
|
|
50
58
|
### Button
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { n as cva, t as cn } from "./cn-BtC0eFBk.js";
|
|
2
|
+
import { Button } from "@base-ui/react/button";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/button/button.tsx
|
|
6
|
+
var buttonVariants = cva("rounded-ui-md focus-visible:ring-ring focus-visible:ring-offset-background inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80",
|
|
10
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 active:bg-secondary/70",
|
|
11
|
+
outline: "border-border text-foreground hover:bg-muted active:bg-muted/70 border bg-transparent",
|
|
12
|
+
ghost: "text-foreground hover:bg-muted active:bg-muted/70 bg-transparent",
|
|
13
|
+
danger: "bg-danger text-danger-foreground hover:bg-danger/90 active:bg-danger/80"
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
sm: "h-8 gap-1.5 px-3 text-sm",
|
|
17
|
+
md: "h-10 gap-2 px-4 text-sm",
|
|
18
|
+
lg: "h-12 gap-2.5 px-6 text-base"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "primary",
|
|
23
|
+
size: "md"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var Button$1 = forwardRef(function Button$2({ className, variant = "primary", size = "md", type = "button", ...props }, ref) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
28
|
+
...props,
|
|
29
|
+
ref,
|
|
30
|
+
type,
|
|
31
|
+
className: cn(buttonVariants({
|
|
32
|
+
variant,
|
|
33
|
+
size
|
|
34
|
+
}), className)
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
export { Button$1 as t };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=button-CYdt-JvA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-CYdt-JvA.js","names":["Button","BaseButton"],"sources":["../src/components/button/button.tsx"],"sourcesContent":["import { Button as BaseButton } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nconst buttonVariants = cva(\n \"rounded-ui-md focus-visible:ring-ring focus-visible:ring-offset-background inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n primary:\n \"bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80 active:bg-secondary/70\",\n outline:\n \"border-border text-foreground hover:bg-muted active:bg-muted/70 border bg-transparent\",\n ghost:\n \"text-foreground hover:bg-muted active:bg-muted/70 bg-transparent\",\n danger:\n \"bg-danger text-danger-foreground hover:bg-danger/90 active:bg-danger/80\",\n },\n size: {\n sm: \"h-8 gap-1.5 px-3 text-sm\",\n md: \"h-10 gap-2 px-4 text-sm\",\n lg: \"h-12 gap-2.5 px-6 text-base\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n },\n);\n\nexport type ButtonVariant = NonNullable<\n VariantProps<typeof buttonVariants>[\"variant\"]\n>;\nexport type ButtonSize = NonNullable<\n VariantProps<typeof buttonVariants>[\"size\"]\n>;\n\nexport interface ButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n { className, variant = \"primary\", size = \"md\", type = \"button\", ...props },\n ref,\n ) {\n return (\n <BaseButton\n {...props}\n ref={ref as Ref<HTMLElement>}\n type={type}\n className={cn(buttonVariants({ variant, size }), className)}\n />\n );\n },\n);\n"],"mappings":";;;;;AAKA,IAAM,iBAAiB,IACrB,iSACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,WACE;GACF,SACE;GACF,OACE;GACF,QACE;EACJ;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF;AAcA,IAAaA,WAAS,WACpB,SAASA,SACP,EAAE,WAAW,UAAU,WAAW,OAAO,MAAM,OAAO,UAAU,GAAG,SACnE,KACA;CACA,OACE,oBAACC,QAAD;EACE,GAAI;EACC;EACC;EACN,WAAW,GAAG,eAAe;GAAE;GAAS;EAAK,CAAC,GAAG,SAAS;CAC3D,CAAA;AAEL,CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
3
|
+
function r(e) {
|
|
4
|
+
var t, f, n = "";
|
|
5
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
6
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
7
|
+
var o = e.length;
|
|
8
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
9
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function clsx() {
|
|
13
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
// node_modules/class-variance-authority/dist/index.mjs
|
|
17
|
+
/**
|
|
18
|
+
* Copyright 2022 Joe Bell. All rights reserved.
|
|
19
|
+
*
|
|
20
|
+
* This file is licensed to you under the Apache License, Version 2.0
|
|
21
|
+
* (the "License"); you may not use this file except in compliance with the
|
|
22
|
+
* License. You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
28
|
+
* WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the
|
|
29
|
+
* License for the specific language governing permissions and limitations under
|
|
30
|
+
* the License.
|
|
31
|
+
*/ var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
32
|
+
var cx = clsx;
|
|
33
|
+
var cva = (base, config) => (props) => {
|
|
34
|
+
var _config_compoundVariants;
|
|
35
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
36
|
+
const { variants, defaultVariants } = config;
|
|
37
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
38
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
39
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
40
|
+
if (variantProp === null) return null;
|
|
41
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
42
|
+
return variants[variant][variantKey];
|
|
43
|
+
});
|
|
44
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
45
|
+
let [key, value] = param;
|
|
46
|
+
if (value === void 0) return acc;
|
|
47
|
+
acc[key] = value;
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
50
|
+
return cx(base, getVariantClassNames, config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
51
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
52
|
+
return Object.entries(compoundVariantOptions).every((param) => {
|
|
53
|
+
let [key, value] = param;
|
|
54
|
+
return Array.isArray(value) ? value.includes({
|
|
55
|
+
...defaultVariants,
|
|
56
|
+
...propsWithoutUndefined
|
|
57
|
+
}[key]) : {
|
|
58
|
+
...defaultVariants,
|
|
59
|
+
...propsWithoutUndefined
|
|
60
|
+
}[key] === value;
|
|
61
|
+
}) ? [
|
|
62
|
+
...acc,
|
|
63
|
+
cvClass,
|
|
64
|
+
cvClassName
|
|
65
|
+
] : acc;
|
|
66
|
+
}, []), props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
67
|
+
};
|
|
68
|
+
export { cva as n, cn as t };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=cn-BtC0eFBk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn-BtC0eFBk.js","names":[],"sources":["../node_modules/clsx/dist/clsx.mjs","../node_modules/class-variance-authority/dist/index.mjs"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n"],"ignoreList":[0,1],"mappings":";;AAAA,SAAS,EAAE,GAAE;CAAC,IAAI,GAAE,GAAE,IAAE;CAAG,IAAG,YAAU,OAAO,KAAG,YAAU,OAAO,GAAE,KAAG;MAAO,IAAG,YAAU,OAAO,GAAE,IAAG,MAAM,QAAQ,CAAC,GAAE;EAAC,IAAI,IAAE,EAAE;EAAO,KAAI,IAAE,GAAE,IAAE,GAAE,KAAI,EAAE,OAAK,IAAE,EAAE,EAAE,EAAE,OAAK,MAAI,KAAG,MAAK,KAAG;CAAE,OAAM,KAAI,KAAK,GAAE,EAAE,OAAK,MAAI,KAAG,MAAK,KAAG;CAAG,OAAO;AAAC;AAAC,SAAgB,OAAM;CAAC,KAAI,IAAI,GAAE,GAAE,IAAE,GAAE,IAAE,IAAG,IAAE,UAAU,QAAO,IAAE,GAAE,KAAI,CAAC,IAAE,UAAU,QAAM,IAAE,EAAE,CAAC,OAAK,MAAI,KA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,CAAC,OAAO,UAAQ;GACzD,IAAI,CAAC,KAAK,SAAS;GACnB,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS;IACzC,GAAG;IACH,GAAG;GACP,EAAE,IAAI,IAAK;IACP,GAAG;IACH,GAAG;GACP,EAAG,SAAS;EAChB,CAAC,IAAI;GACD,GAAG;GACH;GACA;EACJ,IAAI;CACR,GAAG,CAAC,CAAC,GAC+D,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM,OAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM,SAAS;AAChM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Button } from "../../button-CYdt-JvA.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Input } from "../../input-CAZTJfrq.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Textarea } from "../../textarea-BrjTLlfm.js";
|
package/dist/index.js
CHANGED
|
@@ -1,164 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { Input as Input$1 } from "@base-ui/react/input";
|
|
6
|
-
// node_modules/clsx/dist/clsx.mjs
|
|
7
|
-
function r(e) {
|
|
8
|
-
var t, f, n = "";
|
|
9
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
10
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
11
|
-
var o = e.length;
|
|
12
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
13
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
14
|
-
return n;
|
|
15
|
-
}
|
|
16
|
-
function clsx() {
|
|
17
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
18
|
-
return n;
|
|
19
|
-
}
|
|
20
|
-
// node_modules/class-variance-authority/dist/index.mjs
|
|
21
|
-
/**
|
|
22
|
-
* Copyright 2022 Joe Bell. All rights reserved.
|
|
23
|
-
*
|
|
24
|
-
* This file is licensed to you under the Apache License, Version 2.0
|
|
25
|
-
* (the "License"); you may not use this file except in compliance with the
|
|
26
|
-
* License. You may obtain a copy of the License at
|
|
27
|
-
*
|
|
28
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
-
*
|
|
30
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
31
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
32
|
-
* WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the
|
|
33
|
-
* License for the specific language governing permissions and limitations under
|
|
34
|
-
* the License.
|
|
35
|
-
*/ var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
36
|
-
var cx = clsx;
|
|
37
|
-
var cva = (base, config) => (props) => {
|
|
38
|
-
var _config_compoundVariants;
|
|
39
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
40
|
-
const { variants, defaultVariants } = config;
|
|
41
|
-
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
42
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
43
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
44
|
-
if (variantProp === null) return null;
|
|
45
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
46
|
-
return variants[variant][variantKey];
|
|
47
|
-
});
|
|
48
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
49
|
-
let [key, value] = param;
|
|
50
|
-
if (value === void 0) return acc;
|
|
51
|
-
acc[key] = value;
|
|
52
|
-
return acc;
|
|
53
|
-
}, {});
|
|
54
|
-
return cx(base, getVariantClassNames, config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
55
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
56
|
-
return Object.entries(compoundVariantOptions).every((param) => {
|
|
57
|
-
let [key, value] = param;
|
|
58
|
-
return Array.isArray(value) ? value.includes({
|
|
59
|
-
...defaultVariants,
|
|
60
|
-
...propsWithoutUndefined
|
|
61
|
-
}[key]) : {
|
|
62
|
-
...defaultVariants,
|
|
63
|
-
...propsWithoutUndefined
|
|
64
|
-
}[key] === value;
|
|
65
|
-
}) ? [
|
|
66
|
-
...acc,
|
|
67
|
-
cvClass,
|
|
68
|
-
cvClassName
|
|
69
|
-
] : acc;
|
|
70
|
-
}, []), props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
71
|
-
};
|
|
72
|
-
// src/components/button/button.tsx
|
|
73
|
-
var buttonVariants = cva("rounded-ui-md focus-visible:ring-ring focus-visible:ring-offset-background inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
|
|
74
|
-
variants: {
|
|
75
|
-
variant: {
|
|
76
|
-
primary: "bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80",
|
|
77
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 active:bg-secondary/70",
|
|
78
|
-
outline: "border-border text-foreground hover:bg-muted active:bg-muted/70 border bg-transparent",
|
|
79
|
-
ghost: "text-foreground hover:bg-muted active:bg-muted/70 bg-transparent",
|
|
80
|
-
danger: "bg-danger text-danger-foreground hover:bg-danger/90 active:bg-danger/80"
|
|
81
|
-
},
|
|
82
|
-
size: {
|
|
83
|
-
sm: "h-8 gap-1.5 px-3 text-sm",
|
|
84
|
-
md: "h-10 gap-2 px-4 text-sm",
|
|
85
|
-
lg: "h-12 gap-2.5 px-6 text-base"
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
defaultVariants: {
|
|
89
|
-
variant: "primary",
|
|
90
|
-
size: "md"
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
var Button = forwardRef(function Button({ className, variant = "primary", size = "md", type = "button", ...props }, ref) {
|
|
94
|
-
return /* @__PURE__ */ jsx(Button$1, {
|
|
95
|
-
...props,
|
|
96
|
-
ref,
|
|
97
|
-
type,
|
|
98
|
-
className: cn(buttonVariants({
|
|
99
|
-
variant,
|
|
100
|
-
size
|
|
101
|
-
}), className)
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
// src/components/input/input.tsx
|
|
105
|
-
var inputVariants = cva("rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50", {
|
|
106
|
-
variants: {
|
|
107
|
-
size: {
|
|
108
|
-
sm: "h-8 px-2.5 text-sm",
|
|
109
|
-
md: "h-10 px-3 text-sm",
|
|
110
|
-
lg: "h-12 px-4 text-base"
|
|
111
|
-
},
|
|
112
|
-
invalid: {
|
|
113
|
-
true: "border-danger focus-visible:ring-danger/30",
|
|
114
|
-
false: ""
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
defaultVariants: {
|
|
118
|
-
size: "md",
|
|
119
|
-
invalid: false
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
var Input = forwardRef(function Input({ className, invalid = false, size = "md", "aria-invalid": ariaInvalid, ...props }, ref) {
|
|
123
|
-
return /* @__PURE__ */ jsx(Input$1, {
|
|
124
|
-
...props,
|
|
125
|
-
ref,
|
|
126
|
-
"aria-invalid": invalid || ariaInvalid,
|
|
127
|
-
className: cn(inputVariants({
|
|
128
|
-
size,
|
|
129
|
-
invalid
|
|
130
|
-
}), className)
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
// src/components/textarea/textarea.tsx
|
|
134
|
-
var textareaVariants = cva("rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full resize-y border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50", {
|
|
135
|
-
variants: {
|
|
136
|
-
size: {
|
|
137
|
-
sm: "min-h-16 px-2.5 text-sm",
|
|
138
|
-
md: "min-h-20 px-3 text-sm",
|
|
139
|
-
lg: "min-h-28 px-4 text-base"
|
|
140
|
-
},
|
|
141
|
-
invalid: {
|
|
142
|
-
true: "border-danger focus-visible:ring-danger/30",
|
|
143
|
-
false: ""
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
defaultVariants: {
|
|
147
|
-
size: "md",
|
|
148
|
-
invalid: false
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
var Textarea = forwardRef(function Textarea({ className, invalid = false, size = "md", "aria-invalid": ariaInvalid, ...props }, ref) {
|
|
152
|
-
return /* @__PURE__ */ jsx("textarea", {
|
|
153
|
-
...props,
|
|
154
|
-
ref,
|
|
155
|
-
"aria-invalid": invalid || ariaInvalid,
|
|
156
|
-
className: cn(textareaVariants({
|
|
157
|
-
size,
|
|
158
|
-
invalid
|
|
159
|
-
}), className)
|
|
160
|
-
});
|
|
161
|
-
});
|
|
1
|
+
import { t as Button } from "./button-CYdt-JvA.js";
|
|
2
|
+
import { t as Input } from "./input-CAZTJfrq.js";
|
|
3
|
+
import { t as Textarea } from "./textarea-BrjTLlfm.js";
|
|
162
4
|
export { Button, Input, Textarea };
|
|
163
|
-
|
|
164
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { n as cva, t as cn } from "./cn-BtC0eFBk.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Input } from "@base-ui/react/input";
|
|
5
|
+
// src/components/input/input.tsx
|
|
6
|
+
var inputVariants = cva("rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "h-8 px-2.5 text-sm",
|
|
10
|
+
md: "h-10 px-3 text-sm",
|
|
11
|
+
lg: "h-12 px-4 text-base"
|
|
12
|
+
},
|
|
13
|
+
invalid: {
|
|
14
|
+
true: "border-danger focus-visible:ring-danger/30",
|
|
15
|
+
false: ""
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: "md",
|
|
20
|
+
invalid: false
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
var Input$1 = forwardRef(function Input$2({ className, invalid = false, size = "md", "aria-invalid": ariaInvalid, ...props }, ref) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
25
|
+
...props,
|
|
26
|
+
ref,
|
|
27
|
+
"aria-invalid": invalid || ariaInvalid,
|
|
28
|
+
className: cn(inputVariants({
|
|
29
|
+
size,
|
|
30
|
+
invalid
|
|
31
|
+
}), className)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export { Input$1 as t };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=input-CAZTJfrq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-CAZTJfrq.js","names":["Input","BaseInput"],"sources":["../src/components/input/input.tsx"],"sourcesContent":["import { Input as BaseInput } from \"@base-ui/react/input\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nconst inputVariants = cva(\n \"rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50\",\n {\n variants: {\n size: {\n sm: \"h-8 px-2.5 text-sm\",\n md: \"h-10 px-3 text-sm\",\n lg: \"h-12 px-4 text-base\",\n },\n invalid: {\n true: \"border-danger focus-visible:ring-danger/30\",\n false: \"\",\n },\n },\n defaultVariants: {\n size: \"md\",\n invalid: false,\n },\n },\n);\n\nexport type InputSize = NonNullable<VariantProps<typeof inputVariants>[\"size\"]>;\n\nexport interface InputProps\n extends Omit<ComponentPropsWithoutRef<\"input\">, \"size\"> {\n invalid?: boolean;\n size?: InputSize;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n className,\n invalid = false,\n size = \"md\",\n \"aria-invalid\": ariaInvalid,\n ...props\n },\n ref,\n) {\n return (\n <BaseInput\n {...props}\n ref={ref as Ref<HTMLElement>}\n aria-invalid={invalid || ariaInvalid}\n className={cn(inputVariants({ size, invalid }), className)}\n />\n );\n});\n"],"mappings":";;;;;AAKA,IAAM,gBAAgB,IACpB,0RACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,SAAS;GACP,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CACF;AAUA,IAAaA,UAAQ,WAAyC,SAASA,QACrE,EACE,WACA,UAAU,OACV,OAAO,MACP,gBAAgB,aAChB,GAAG,SAEL,KACA;CACA,OACE,oBAACC,OAAD;EACE,GAAI;EACC;EACL,gBAAc,WAAW;EACzB,WAAW,GAAG,cAAc;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;CAC1D,CAAA;AAEL,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as cva, t as cn } from "./cn-BtC0eFBk.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/textarea/textarea.tsx
|
|
5
|
+
var textareaVariants = cva("rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full resize-y border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50", {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: "min-h-16 px-2.5 text-sm",
|
|
9
|
+
md: "min-h-20 px-3 text-sm",
|
|
10
|
+
lg: "min-h-28 px-4 text-base"
|
|
11
|
+
},
|
|
12
|
+
invalid: {
|
|
13
|
+
true: "border-danger focus-visible:ring-danger/30",
|
|
14
|
+
false: ""
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: "md",
|
|
19
|
+
invalid: false
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var Textarea = forwardRef(function Textarea({ className, invalid = false, size = "md", "aria-invalid": ariaInvalid, ...props }, ref) {
|
|
23
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
24
|
+
...props,
|
|
25
|
+
ref,
|
|
26
|
+
"aria-invalid": invalid || ariaInvalid,
|
|
27
|
+
className: cn(textareaVariants({
|
|
28
|
+
size,
|
|
29
|
+
invalid
|
|
30
|
+
}), className)
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
export { Textarea as t };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=textarea-BrjTLlfm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea-BrjTLlfm.js","names":[],"sources":["../src/components/textarea/textarea.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nconst textareaVariants = cva(\n \"rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full resize-y border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50\",\n {\n variants: {\n size: {\n sm: \"min-h-16 px-2.5 text-sm\",\n md: \"min-h-20 px-3 text-sm\",\n lg: \"min-h-28 px-4 text-base\",\n },\n invalid: {\n true: \"border-danger focus-visible:ring-danger/30\",\n false: \"\",\n },\n },\n defaultVariants: {\n size: \"md\",\n invalid: false,\n },\n },\n);\n\nexport type TextareaSize = NonNullable<\n VariantProps<typeof textareaVariants>[\"size\"]\n>;\n\nexport interface TextareaProps extends ComponentPropsWithoutRef<\"textarea\"> {\n invalid?: boolean;\n size?: TextareaSize;\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea(\n {\n className,\n invalid = false,\n size = \"md\",\n \"aria-invalid\": ariaInvalid,\n ...props\n },\n ref,\n ) {\n return (\n <textarea\n {...props}\n ref={ref}\n aria-invalid={invalid || ariaInvalid}\n className={cn(textareaVariants({ size, invalid }), className)}\n />\n );\n },\n);\n"],"mappings":";;;;AAIA,IAAM,mBAAmB,IACvB,mSACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,SAAS;GACP,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CACF;AAWA,IAAa,WAAW,WACtB,SAAS,SACP,EACE,WACA,UAAU,OACV,OAAO,MACP,gBAAgB,aAChB,GAAG,SAEL,KACA;CACA,OACE,oBAAC,YAAD;EACE,GAAI;EACC;EACL,gBAAc,WAAW;EACzB,WAAW,GAAG,iBAAiB;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;CAC7D,CAAA;AAEL,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walidsj/react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Accessible React components styled with Tailwind CSS v4 and built on Base UI primitives.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -30,6 +30,18 @@
|
|
|
30
30
|
"import": "./dist/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./style.css": "./dist/style.css",
|
|
33
|
+
"./components/button": {
|
|
34
|
+
"types": "./dist/components/button/index.d.ts",
|
|
35
|
+
"import": "./dist/components/button/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./components/input": {
|
|
38
|
+
"types": "./dist/components/input/index.d.ts",
|
|
39
|
+
"import": "./dist/components/input/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./components/textarea": {
|
|
42
|
+
"types": "./dist/components/textarea/index.d.ts",
|
|
43
|
+
"import": "./dist/components/textarea/index.js"
|
|
44
|
+
},
|
|
33
45
|
"./package.json": "./package.json"
|
|
34
46
|
},
|
|
35
47
|
"main": "./dist/index.js",
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["BaseButton","BaseInput"],"sources":["../node_modules/clsx/dist/clsx.mjs","../node_modules/class-variance-authority/dist/index.mjs","../src/components/button/button.tsx","../src/components/input/input.tsx","../src/components/textarea/textarea.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n","import { Button as BaseButton } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nconst buttonVariants = cva(\n \"rounded-ui-md focus-visible:ring-ring focus-visible:ring-offset-background inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n primary:\n \"bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80 active:bg-secondary/70\",\n outline:\n \"border-border text-foreground hover:bg-muted active:bg-muted/70 border bg-transparent\",\n ghost:\n \"text-foreground hover:bg-muted active:bg-muted/70 bg-transparent\",\n danger:\n \"bg-danger text-danger-foreground hover:bg-danger/90 active:bg-danger/80\",\n },\n size: {\n sm: \"h-8 gap-1.5 px-3 text-sm\",\n md: \"h-10 gap-2 px-4 text-sm\",\n lg: \"h-12 gap-2.5 px-6 text-base\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n },\n);\n\nexport type ButtonVariant = NonNullable<\n VariantProps<typeof buttonVariants>[\"variant\"]\n>;\nexport type ButtonSize = NonNullable<\n VariantProps<typeof buttonVariants>[\"size\"]\n>;\n\nexport interface ButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n { className, variant = \"primary\", size = \"md\", type = \"button\", ...props },\n ref,\n ) {\n return (\n <BaseButton\n {...props}\n ref={ref as Ref<HTMLElement>}\n type={type}\n className={cn(buttonVariants({ variant, size }), className)}\n />\n );\n },\n);\n","import { Input as BaseInput } from \"@base-ui/react/input\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nconst inputVariants = cva(\n \"rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50\",\n {\n variants: {\n size: {\n sm: \"h-8 px-2.5 text-sm\",\n md: \"h-10 px-3 text-sm\",\n lg: \"h-12 px-4 text-base\",\n },\n invalid: {\n true: \"border-danger focus-visible:ring-danger/30\",\n false: \"\",\n },\n },\n defaultVariants: {\n size: \"md\",\n invalid: false,\n },\n },\n);\n\nexport type InputSize = NonNullable<VariantProps<typeof inputVariants>[\"size\"]>;\n\nexport interface InputProps\n extends Omit<ComponentPropsWithoutRef<\"input\">, \"size\"> {\n invalid?: boolean;\n size?: InputSize;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n className,\n invalid = false,\n size = \"md\",\n \"aria-invalid\": ariaInvalid,\n ...props\n },\n ref,\n) {\n return (\n <BaseInput\n {...props}\n ref={ref as Ref<HTMLElement>}\n aria-invalid={invalid || ariaInvalid}\n className={cn(inputVariants({ size, invalid }), className)}\n />\n );\n});\n","import { cva, type VariantProps } from \"class-variance-authority\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nconst textareaVariants = cva(\n \"rounded-ui-md border-border bg-background text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 flex w-full resize-y border py-2 shadow-sm transition-colors outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50\",\n {\n variants: {\n size: {\n sm: \"min-h-16 px-2.5 text-sm\",\n md: \"min-h-20 px-3 text-sm\",\n lg: \"min-h-28 px-4 text-base\",\n },\n invalid: {\n true: \"border-danger focus-visible:ring-danger/30\",\n false: \"\",\n },\n },\n defaultVariants: {\n size: \"md\",\n invalid: false,\n },\n },\n);\n\nexport type TextareaSize = NonNullable<\n VariantProps<typeof textareaVariants>[\"size\"]\n>;\n\nexport interface TextareaProps extends ComponentPropsWithoutRef<\"textarea\"> {\n invalid?: boolean;\n size?: TextareaSize;\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea(\n {\n className,\n invalid = false,\n size = \"md\",\n \"aria-invalid\": ariaInvalid,\n ...props\n },\n ref,\n ) {\n return (\n <textarea\n {...props}\n ref={ref}\n aria-invalid={invalid || ariaInvalid}\n className={cn(textareaVariants({ size, invalid }), className)}\n />\n );\n },\n);\n"],"ignoreList":[0,1],"mappings":";;;;;;AAAA,SAAS,EAAE,GAAE;CAAC,IAAI,GAAE,GAAE,IAAE;CAAG,IAAG,YAAU,OAAO,KAAG,YAAU,OAAO,GAAE,KAAG;MAAO,IAAG,YAAU,OAAO,GAAE,IAAG,MAAM,QAAQ,CAAC,GAAE;EAAC,IAAI,IAAE,EAAE;EAAO,KAAI,IAAE,GAAE,IAAE,GAAE,KAAI,EAAE,OAAK,IAAE,EAAE,EAAE,EAAE,OAAK,MAAI,KAAG,MAAK,KAAG;CAAE,OAAM,KAAI,KAAK,GAAE,EAAE,OAAK,MAAI,KAAG,MAAK,KAAG;CAAG,OAAO;AAAC;AAAC,SAAgB,OAAM;CAAC,KAAI,IAAI,GAAE,GAAE,IAAE,GAAE,IAAE,IAAG,IAAE,UAAU,QAAO,IAAE,GAAE,KAAI,CAAC,IAAE,UAAU,QAAM,IAAE,EAAE,CAAC,OAAK,MAAI,KAAG,MAAK,KAAG;CAAG,OAAO;AAAC;;;;;;;;;;;;;;;;GCe/W,IAAM,iBAAiB,UAAQ,OAAO,UAAU,YAAY,GAAG,UAAU,UAAU,IAAI,MAAM;AAC7F,IAAa,KAAK;AAClB,IAAa,OAAO,MAAM,YAAU,UAAQ;CACpC,IAAI;CACJ,KAAK,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,aAAa,MAAM,OAAO,GAAG,MAAM,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,M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