@lets-events/react 11.0.6 → 11.2.0
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +411 -5
- package/dist/index.d.ts +411 -5
- package/dist/index.js +152 -5
- package/dist/index.mjs +150 -5
- package/package.json +5 -2
- package/src/components/FormFields/ErrorFormMessage.tsx +36 -0
- package/src/components/FormFields/Form.tsx +25 -0
- package/src/components/FormFields/FormLabel.tsx +29 -0
- package/src/components/FormFields/TextAreaFormField.tsx +46 -0
- package/src/components/FormFields/TextFormField.tsx +46 -0
- package/src/components/TextField.tsx +2 -2
- package/src/components/TextareaField.tsx +23 -7
- package/src/index.tsx +33 -26
package/dist/index.mjs
CHANGED
|
@@ -2537,14 +2537,14 @@ var TextFieldStyled = styled(TextFieldRadix.Root, {
|
|
|
2537
2537
|
color: {
|
|
2538
2538
|
default: {
|
|
2539
2539
|
color: "$dark400",
|
|
2540
|
-
border: "1px solid $
|
|
2540
|
+
border: "1px solid $dark300",
|
|
2541
2541
|
"&:has(input:focus)": {
|
|
2542
2542
|
border: "2px solid $brand300"
|
|
2543
2543
|
},
|
|
2544
2544
|
"&:has(input:disabled)": {
|
|
2545
2545
|
backgroundColor: "$dark100",
|
|
2546
2546
|
color: "$dark400",
|
|
2547
|
-
border: "1px solid $
|
|
2547
|
+
border: "1px solid $dark300",
|
|
2548
2548
|
cursor: "not-allowed"
|
|
2549
2549
|
}
|
|
2550
2550
|
},
|
|
@@ -8696,7 +8696,6 @@ var TextareaContainer = styled("div", {
|
|
|
8696
8696
|
overflow: "hidden",
|
|
8697
8697
|
width: "100%",
|
|
8698
8698
|
border: "1px solid",
|
|
8699
|
-
borderColor: "$dark300",
|
|
8700
8699
|
borderRadius: "$sm",
|
|
8701
8700
|
"&:has(textarea:focus)": {
|
|
8702
8701
|
border: "1px solid $brand300"
|
|
@@ -8706,6 +8705,19 @@ var TextareaContainer = styled("div", {
|
|
|
8706
8705
|
color: "$dark400",
|
|
8707
8706
|
border: "1px solid $dark200",
|
|
8708
8707
|
cursor: "not-allowed"
|
|
8708
|
+
},
|
|
8709
|
+
variants: {
|
|
8710
|
+
color: {
|
|
8711
|
+
default: {
|
|
8712
|
+
borderColor: "$dark300"
|
|
8713
|
+
},
|
|
8714
|
+
error: {
|
|
8715
|
+
borderColor: "$error400"
|
|
8716
|
+
}
|
|
8717
|
+
}
|
|
8718
|
+
},
|
|
8719
|
+
defaultVariants: {
|
|
8720
|
+
color: "default"
|
|
8709
8721
|
}
|
|
8710
8722
|
});
|
|
8711
8723
|
var TextareaLimitIndicator = styled("div", {
|
|
@@ -8723,7 +8735,7 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
8723
8735
|
}
|
|
8724
8736
|
});
|
|
8725
8737
|
var TextareaField = React6.forwardRef((_a, fowardedRef) => {
|
|
8726
|
-
var _b = _a, { maxLength } = _b, props = __objRest(_b, ["maxLength"]);
|
|
8738
|
+
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
8727
8739
|
const inputRef = useRef3(null);
|
|
8728
8740
|
const badgeRef = useRef3(null);
|
|
8729
8741
|
const updateCharCountBadge = () => {
|
|
@@ -8737,7 +8749,7 @@ var TextareaField = React6.forwardRef((_a, fowardedRef) => {
|
|
|
8737
8749
|
updateCharCountBadge();
|
|
8738
8750
|
(_a2 = props.onInput) == null ? void 0 : _a2.call(props, e);
|
|
8739
8751
|
};
|
|
8740
|
-
return /* @__PURE__ */ jsxs8(TextareaContainer, { children: [
|
|
8752
|
+
return /* @__PURE__ */ jsxs8(TextareaContainer, { color, children: [
|
|
8741
8753
|
/* @__PURE__ */ jsx20(
|
|
8742
8754
|
TextareaFieldStyle,
|
|
8743
8755
|
__spreadValues({
|
|
@@ -9211,6 +9223,134 @@ function Section(_a) {
|
|
|
9211
9223
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
9212
9224
|
return /* @__PURE__ */ jsx26(SectionStyled, __spreadProps(__spreadValues({}, props), { children }));
|
|
9213
9225
|
}
|
|
9226
|
+
|
|
9227
|
+
// src/components/FormFields/ErrorFormMessage.tsx
|
|
9228
|
+
import { faXmarkCircle } from "@fortawesome/free-solid-svg-icons";
|
|
9229
|
+
import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
|
|
9230
|
+
import { jsx as jsx27, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9231
|
+
var ErrorFormMessage = ({ message: message2 }) => {
|
|
9232
|
+
if (!message2) return null;
|
|
9233
|
+
if (typeof message2 !== "string") {
|
|
9234
|
+
return null;
|
|
9235
|
+
}
|
|
9236
|
+
return /* @__PURE__ */ jsxs12(Flex2, { justify: "start", align: "center", gap: 6, children: [
|
|
9237
|
+
/* @__PURE__ */ jsx27(FontAwesomeIcon2, { icon: faXmarkCircle, color: colors.error600, size: "1x" }),
|
|
9238
|
+
/* @__PURE__ */ jsx27(Text, { typography: "bodyXS", fontWeight: "medium", color: "error600", children: message2 })
|
|
9239
|
+
] });
|
|
9240
|
+
};
|
|
9241
|
+
|
|
9242
|
+
// src/components/FormFields/FormLabel.tsx
|
|
9243
|
+
import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
9244
|
+
var FormLabel = ({
|
|
9245
|
+
name,
|
|
9246
|
+
label,
|
|
9247
|
+
haveError,
|
|
9248
|
+
required
|
|
9249
|
+
}) => {
|
|
9250
|
+
if (!label) return null;
|
|
9251
|
+
return /* @__PURE__ */ jsxs13(
|
|
9252
|
+
Text,
|
|
9253
|
+
{
|
|
9254
|
+
typography: "labelMedium",
|
|
9255
|
+
fontWeight: "medium",
|
|
9256
|
+
color: haveError ? "error600" : "dark700",
|
|
9257
|
+
id: `${name}-label`,
|
|
9258
|
+
children: [
|
|
9259
|
+
label,
|
|
9260
|
+
!required && /* @__PURE__ */ jsx28(Text, { color: "dark500", children: " (opcional)" })
|
|
9261
|
+
]
|
|
9262
|
+
}
|
|
9263
|
+
);
|
|
9264
|
+
};
|
|
9265
|
+
|
|
9266
|
+
// src/components/FormFields/TextAreaFormField.tsx
|
|
9267
|
+
import { useFormContext } from "react-hook-form";
|
|
9268
|
+
import { jsx as jsx29, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9269
|
+
var TextAreaFormField = ({
|
|
9270
|
+
name,
|
|
9271
|
+
label,
|
|
9272
|
+
required,
|
|
9273
|
+
placeholder
|
|
9274
|
+
}) => {
|
|
9275
|
+
var _a;
|
|
9276
|
+
const {
|
|
9277
|
+
register,
|
|
9278
|
+
formState: { errors }
|
|
9279
|
+
} = useFormContext();
|
|
9280
|
+
const haveError = !!errors[name];
|
|
9281
|
+
const errorMsg = (_a = errors[name]) == null ? void 0 : _a.message;
|
|
9282
|
+
return /* @__PURE__ */ jsxs14(Flex2, { direction: "column", children: [
|
|
9283
|
+
/* @__PURE__ */ jsx29(
|
|
9284
|
+
FormLabel,
|
|
9285
|
+
{
|
|
9286
|
+
name,
|
|
9287
|
+
label,
|
|
9288
|
+
required,
|
|
9289
|
+
haveError
|
|
9290
|
+
}
|
|
9291
|
+
),
|
|
9292
|
+
/* @__PURE__ */ jsx29(
|
|
9293
|
+
TextareaField,
|
|
9294
|
+
__spreadProps(__spreadValues({}, register(name, { required })), {
|
|
9295
|
+
placeholder,
|
|
9296
|
+
color: haveError ? "error" : "default",
|
|
9297
|
+
"aria-labelledby": `${name}-label`
|
|
9298
|
+
})
|
|
9299
|
+
),
|
|
9300
|
+
/* @__PURE__ */ jsx29(ErrorFormMessage, { message: errorMsg })
|
|
9301
|
+
] });
|
|
9302
|
+
};
|
|
9303
|
+
|
|
9304
|
+
// src/components/FormFields/TextFormField.tsx
|
|
9305
|
+
import { useFormContext as useFormContext2 } from "react-hook-form";
|
|
9306
|
+
import { jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9307
|
+
var TextFormField = ({
|
|
9308
|
+
name,
|
|
9309
|
+
label,
|
|
9310
|
+
required,
|
|
9311
|
+
placeholder
|
|
9312
|
+
}) => {
|
|
9313
|
+
var _a;
|
|
9314
|
+
const {
|
|
9315
|
+
register,
|
|
9316
|
+
formState: { errors }
|
|
9317
|
+
} = useFormContext2();
|
|
9318
|
+
const haveError = !!errors[name];
|
|
9319
|
+
const errorMsg = (_a = errors[name]) == null ? void 0 : _a.message;
|
|
9320
|
+
return /* @__PURE__ */ jsxs15(Flex2, { direction: "column", children: [
|
|
9321
|
+
/* @__PURE__ */ jsx30(
|
|
9322
|
+
FormLabel,
|
|
9323
|
+
{
|
|
9324
|
+
name,
|
|
9325
|
+
label,
|
|
9326
|
+
required,
|
|
9327
|
+
haveError
|
|
9328
|
+
}
|
|
9329
|
+
),
|
|
9330
|
+
/* @__PURE__ */ jsx30(
|
|
9331
|
+
TextField,
|
|
9332
|
+
__spreadProps(__spreadValues({}, register(name, { required })), {
|
|
9333
|
+
placeholder,
|
|
9334
|
+
color: haveError ? "error" : "default",
|
|
9335
|
+
"aria-labelledby": `${name}-label`
|
|
9336
|
+
})
|
|
9337
|
+
),
|
|
9338
|
+
/* @__PURE__ */ jsx30(ErrorFormMessage, { message: errorMsg })
|
|
9339
|
+
] });
|
|
9340
|
+
};
|
|
9341
|
+
|
|
9342
|
+
// src/components/FormFields/Form.tsx
|
|
9343
|
+
import {
|
|
9344
|
+
FormProvider,
|
|
9345
|
+
useForm
|
|
9346
|
+
} from "react-hook-form";
|
|
9347
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
9348
|
+
var Form = (_a) => {
|
|
9349
|
+
var _b = _a, { onSubmit, children } = _b, props = __objRest(_b, ["onSubmit", "children"]);
|
|
9350
|
+
const methods = useForm(props);
|
|
9351
|
+
const { handleSubmit } = methods;
|
|
9352
|
+
return /* @__PURE__ */ jsx31(FormProvider, __spreadProps(__spreadValues({}, methods), { children: /* @__PURE__ */ jsx31("form", { onSubmit: handleSubmit(onSubmit), children }) }));
|
|
9353
|
+
};
|
|
9214
9354
|
export {
|
|
9215
9355
|
Alert,
|
|
9216
9356
|
AlertDialogCompleteStyled,
|
|
@@ -9240,10 +9380,13 @@ export {
|
|
|
9240
9380
|
ContainerStyled,
|
|
9241
9381
|
DropdownMenu2 as DropdownMenu,
|
|
9242
9382
|
DropdownMenuItem,
|
|
9383
|
+
ErrorFormMessage,
|
|
9243
9384
|
Filter,
|
|
9244
9385
|
FilterItem,
|
|
9245
9386
|
Flex2 as Flex,
|
|
9246
9387
|
FlexStyled,
|
|
9388
|
+
Form,
|
|
9389
|
+
FormLabel,
|
|
9247
9390
|
Grid,
|
|
9248
9391
|
GridStyled,
|
|
9249
9392
|
Icon,
|
|
@@ -9263,10 +9406,12 @@ export {
|
|
|
9263
9406
|
Switch,
|
|
9264
9407
|
SwitchStyled,
|
|
9265
9408
|
Text,
|
|
9409
|
+
TextAreaFormField,
|
|
9266
9410
|
TextField,
|
|
9267
9411
|
TextFieldSlot,
|
|
9268
9412
|
TextFieldSlotStyled,
|
|
9269
9413
|
TextFieldStyled,
|
|
9414
|
+
TextFormField,
|
|
9270
9415
|
TextStyle,
|
|
9271
9416
|
TextareaField,
|
|
9272
9417
|
TextareaFieldStyle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lets-events/react",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
"@radix-ui/themes": "^3.2.1",
|
|
37
37
|
"@react-input/mask": "^2.0.4",
|
|
38
38
|
"@stitches/react": "^1.2.8",
|
|
39
|
+
"install": "^0.13.0",
|
|
40
|
+
"npm": "^11.4.2",
|
|
39
41
|
"radix-ui": "^1.4.2",
|
|
40
|
-
"react-day-picker": "^9.6.7"
|
|
42
|
+
"react-day-picker": "^9.6.7",
|
|
43
|
+
"react-hook-form": "^7.57.0"
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { faXmarkCircle } from "@fortawesome/free-solid-svg-icons";
|
|
2
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
+
import { colors } from "@lets-events/tokens";
|
|
4
|
+
import { Flex } from "../Flex";
|
|
5
|
+
import { Text } from "../Text";
|
|
6
|
+
import {
|
|
7
|
+
FieldError,
|
|
8
|
+
FieldErrorsImpl,
|
|
9
|
+
FieldValues,
|
|
10
|
+
Merge,
|
|
11
|
+
} from "react-hook-form";
|
|
12
|
+
|
|
13
|
+
export type ErrorFormMessageProps = {
|
|
14
|
+
message?:
|
|
15
|
+
| string
|
|
16
|
+
| FieldError
|
|
17
|
+
| Merge<FieldError, FieldErrorsImpl<any>>
|
|
18
|
+
| undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const ErrorFormMessage = ({ message }: ErrorFormMessageProps) => {
|
|
22
|
+
if (!message) return null;
|
|
23
|
+
|
|
24
|
+
if (typeof message !== "string") {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Flex justify={"start"} align={"center"} gap={6}>
|
|
30
|
+
<FontAwesomeIcon icon={faXmarkCircle} color={colors.error600} size="1x" />
|
|
31
|
+
<Text typography={"bodyXS"} fontWeight={"medium"} color="error600">
|
|
32
|
+
{message}
|
|
33
|
+
</Text>
|
|
34
|
+
</Flex>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JSX } from "react";
|
|
2
|
+
import {
|
|
3
|
+
FormProvider,
|
|
4
|
+
useForm,
|
|
5
|
+
SubmitHandler,
|
|
6
|
+
FieldValues,
|
|
7
|
+
UseFormProps,
|
|
8
|
+
} from "react-hook-form";
|
|
9
|
+
|
|
10
|
+
export type FormProps = UseFormProps & {
|
|
11
|
+
onSubmit: SubmitHandler<FieldValues>;
|
|
12
|
+
children: JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Form = ({ onSubmit, children, ...props }: FormProps) => {
|
|
16
|
+
const methods = useForm(props);
|
|
17
|
+
|
|
18
|
+
const { handleSubmit } = methods;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FormProvider {...methods}>
|
|
22
|
+
<form onSubmit={handleSubmit(onSubmit)}>{children}</form>
|
|
23
|
+
</FormProvider>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Text } from "../Text";
|
|
2
|
+
|
|
3
|
+
export type FormLabelProps = {
|
|
4
|
+
name: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
haveError?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const FormLabel = ({
|
|
11
|
+
name,
|
|
12
|
+
label,
|
|
13
|
+
haveError,
|
|
14
|
+
required,
|
|
15
|
+
}: FormLabelProps) => {
|
|
16
|
+
if (!label) return null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Text
|
|
20
|
+
typography={"labelMedium"}
|
|
21
|
+
fontWeight={"medium"}
|
|
22
|
+
color={haveError ? "error600" : "dark700"}
|
|
23
|
+
id={`${name}-label`}
|
|
24
|
+
>
|
|
25
|
+
{label}
|
|
26
|
+
{!required && <Text color="dark500"> (opcional)</Text>}
|
|
27
|
+
</Text>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useFormContext } from "react-hook-form";
|
|
2
|
+
import { Flex } from "../Flex";
|
|
3
|
+
import { FormLabel } from "./FormLabel";
|
|
4
|
+
import { ErrorFormMessage } from "./ErrorFormMessage";
|
|
5
|
+
import { TextareaField } from "../TextareaField";
|
|
6
|
+
|
|
7
|
+
export type TextAreaFormFieldProps = {
|
|
8
|
+
name: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const TextAreaFormField = ({
|
|
15
|
+
name,
|
|
16
|
+
label,
|
|
17
|
+
required,
|
|
18
|
+
placeholder,
|
|
19
|
+
}: TextAreaFormFieldProps) => {
|
|
20
|
+
const {
|
|
21
|
+
register,
|
|
22
|
+
formState: { errors },
|
|
23
|
+
} = useFormContext();
|
|
24
|
+
|
|
25
|
+
const haveError = !!errors[name];
|
|
26
|
+
|
|
27
|
+
const errorMsg = errors[name]?.message;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Flex direction={"column"}>
|
|
31
|
+
<FormLabel
|
|
32
|
+
name={name}
|
|
33
|
+
label={label}
|
|
34
|
+
required={required}
|
|
35
|
+
haveError={haveError}
|
|
36
|
+
/>
|
|
37
|
+
<TextareaField
|
|
38
|
+
{...register(name, { required })}
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
color={haveError ? "error" : "default"}
|
|
41
|
+
aria-labelledby={`${name}-label`}
|
|
42
|
+
/>
|
|
43
|
+
<ErrorFormMessage message={errorMsg} />
|
|
44
|
+
</Flex>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useFormContext } from "react-hook-form";
|
|
2
|
+
import { Flex } from "../Flex";
|
|
3
|
+
import { FormLabel } from "./FormLabel";
|
|
4
|
+
import { TextField } from "../TextField";
|
|
5
|
+
import { ErrorFormMessage } from "./ErrorFormMessage";
|
|
6
|
+
|
|
7
|
+
export type TextFormFieldProps = {
|
|
8
|
+
name: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const TextFormField = ({
|
|
15
|
+
name,
|
|
16
|
+
label,
|
|
17
|
+
required,
|
|
18
|
+
placeholder,
|
|
19
|
+
}: TextFormFieldProps) => {
|
|
20
|
+
const {
|
|
21
|
+
register,
|
|
22
|
+
formState: { errors },
|
|
23
|
+
} = useFormContext();
|
|
24
|
+
|
|
25
|
+
const haveError = !!errors[name];
|
|
26
|
+
|
|
27
|
+
const errorMsg = errors[name]?.message;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Flex direction={"column"}>
|
|
31
|
+
<FormLabel
|
|
32
|
+
name={name}
|
|
33
|
+
label={label}
|
|
34
|
+
required={required}
|
|
35
|
+
haveError={haveError}
|
|
36
|
+
/>
|
|
37
|
+
<TextField
|
|
38
|
+
{...register(name, { required })}
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
color={haveError ? "error" : "default"}
|
|
41
|
+
aria-labelledby={`${name}-label`}
|
|
42
|
+
/>
|
|
43
|
+
<ErrorFormMessage message={errorMsg} />
|
|
44
|
+
</Flex>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -45,14 +45,14 @@ export const TextFieldStyled = styled(TextFieldRadix.Root, {
|
|
|
45
45
|
color: {
|
|
46
46
|
default: {
|
|
47
47
|
color: "$dark400",
|
|
48
|
-
border: "1px solid $
|
|
48
|
+
border: "1px solid $dark300",
|
|
49
49
|
"&:has(input:focus)": {
|
|
50
50
|
border: "2px solid $brand300",
|
|
51
51
|
},
|
|
52
52
|
"&:has(input:disabled)": {
|
|
53
53
|
backgroundColor: "$dark100",
|
|
54
54
|
color: "$dark400",
|
|
55
|
-
border: "1px solid $
|
|
55
|
+
border: "1px solid $dark300",
|
|
56
56
|
cursor: "not-allowed",
|
|
57
57
|
},
|
|
58
58
|
},
|
|
@@ -25,17 +25,12 @@ export const TextareaFieldStyle = styled(TextAreaRadix, {
|
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
export type TextareaFieldProps = ComponentProps<typeof TextareaFieldStyle> & {
|
|
29
|
-
limit: number;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
28
|
const TextareaContainer = styled("div", {
|
|
33
29
|
display: "flex",
|
|
34
30
|
flexDirection: "column",
|
|
35
31
|
overflow: "hidden",
|
|
36
32
|
width: "100%",
|
|
37
33
|
border: "1px solid",
|
|
38
|
-
borderColor: "$dark300",
|
|
39
34
|
borderRadius: "$sm",
|
|
40
35
|
|
|
41
36
|
"&:has(textarea:focus)": {
|
|
@@ -47,8 +42,29 @@ const TextareaContainer = styled("div", {
|
|
|
47
42
|
border: "1px solid $dark200",
|
|
48
43
|
cursor: "not-allowed",
|
|
49
44
|
},
|
|
45
|
+
|
|
46
|
+
variants: {
|
|
47
|
+
color: {
|
|
48
|
+
default: {
|
|
49
|
+
borderColor: "$dark300",
|
|
50
|
+
},
|
|
51
|
+
error: {
|
|
52
|
+
borderColor: "$error400",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
color: "default",
|
|
59
|
+
},
|
|
50
60
|
});
|
|
51
61
|
|
|
62
|
+
export type TextareaFieldProps = Omit<
|
|
63
|
+
ComponentProps<typeof TextareaFieldStyle>,
|
|
64
|
+
"color"
|
|
65
|
+
> &
|
|
66
|
+
ComponentProps<typeof TextareaContainer>;
|
|
67
|
+
|
|
52
68
|
const TextareaLimitIndicator = styled("div", {
|
|
53
69
|
padding: "$12 $16",
|
|
54
70
|
borderTop: "1px solid $neutral300",
|
|
@@ -67,7 +83,7 @@ const TextareaLimitIndicator = styled("div", {
|
|
|
67
83
|
export const TextareaField = React.forwardRef<
|
|
68
84
|
HTMLTextAreaElement,
|
|
69
85
|
TextareaFieldProps
|
|
70
|
-
>(({ maxLength, ...props }, fowardedRef) => {
|
|
86
|
+
>(({ maxLength, color, ...props }, fowardedRef) => {
|
|
71
87
|
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
72
88
|
const badgeRef = useRef<HTMLSpanElement>(null);
|
|
73
89
|
|
|
@@ -83,7 +99,7 @@ export const TextareaField = React.forwardRef<
|
|
|
83
99
|
};
|
|
84
100
|
|
|
85
101
|
return (
|
|
86
|
-
<TextareaContainer>
|
|
102
|
+
<TextareaContainer color={color}>
|
|
87
103
|
<TextareaFieldStyle
|
|
88
104
|
rows={4}
|
|
89
105
|
ref={(r) => {
|
package/src/index.tsx
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
// Icon
|
|
2
|
-
export * from
|
|
2
|
+
export * from "./components/Icon";
|
|
3
3
|
|
|
4
4
|
// Text
|
|
5
|
-
export * from
|
|
5
|
+
export * from "./components/Text";
|
|
6
6
|
|
|
7
7
|
// Components
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
8
|
+
export * from "./components/Button";
|
|
9
|
+
export * from "./components/ButtonGroup";
|
|
10
|
+
export * from "./components/Avatar";
|
|
11
|
+
export * from "./components/TextField";
|
|
12
|
+
export * from "./components/RadioGroup";
|
|
13
|
+
export * from "./components/CheckboxGroup";
|
|
14
|
+
export * from "./components/Filter";
|
|
15
|
+
export * from "./components/Dropdown";
|
|
16
|
+
export * from "./components/Badge";
|
|
17
|
+
export * from "./components/Modal";
|
|
18
|
+
export * from "./components/Calendar";
|
|
19
|
+
export * from "./components/TimePicker";
|
|
20
|
+
export * from "./components/Alert";
|
|
21
|
+
export * from "./components/Switch";
|
|
22
|
+
export * from "./components/Step";
|
|
23
|
+
export * from "./components/Card";
|
|
24
|
+
export * from "./components/TextareaField";
|
|
25
|
+
export * from "./components/Toast";
|
|
26
|
+
export * from "./components/Tooltip";
|
|
27
27
|
|
|
28
28
|
// Layouts
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
29
|
+
export * from "./components/Flex";
|
|
30
|
+
export * from "./components/Box";
|
|
31
|
+
export * from "./components/Grid";
|
|
32
|
+
export * from "./components/Container";
|
|
33
|
+
export * from "./components/Section";
|
|
34
|
+
|
|
35
|
+
//Form
|
|
36
|
+
export * from "./components/FormFields/ErrorFormMessage";
|
|
37
|
+
export * from "./components/FormFields/FormLabel";
|
|
38
|
+
export * from "./components/FormFields/TextAreaFormField";
|
|
39
|
+
export * from "./components/FormFields/TextFormField";
|
|
40
|
+
export * from "./components/FormFields/Form";
|