@lets-events/react 12.4.1 → 12.5.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.
@@ -20,7 +20,8 @@ export const TextAreaFormField = ({
20
20
  placeholder,
21
21
  validate,
22
22
  validationErrorMessage = "Este campo é obrigatório.",
23
- simpleLayout = false,
23
+ maxLength,
24
+ top,
24
25
  ...props
25
26
  }: TextAreaFormFieldProps) => {
26
27
  const {
@@ -50,8 +51,9 @@ export const TextAreaFormField = ({
50
51
  {...register(name, validationRules)}
51
52
  placeholder={placeholder}
52
53
  color={haveError ? "error" : "default"}
53
- simpleLayout={simpleLayout}
54
54
  aria-labelledby={`${name}-label`}
55
+ maxLength={maxLength}
56
+ top={top}
55
57
  />
56
58
  <ErrorFormMessage message={errorMsg} />
57
59
  </Flex>
@@ -1,10 +1,9 @@
1
1
  import { TextArea as TextAreaRadix } from "@radix-ui/themes";
2
- import { styled } from "../styles";
3
2
  import React, { ComponentProps, useRef, useState, useEffect } from "react";
4
3
  import { typographyValues } from "../types/typographyValues";
5
- import { Text } from "./Text";
6
4
  import { Badge } from "./Badge";
7
5
  import { Flex } from "./Flex";
6
+ import { styled } from "../styles";
8
7
 
9
8
  export const TextareaFieldStyle = styled(TextAreaRadix, {
10
9
  display: "flex",
@@ -60,33 +59,19 @@ const TextareaContainer = styled("div", {
60
59
  },
61
60
  });
62
61
 
63
- const TextareaLimitIndicator = styled("div", {
64
- padding: "$12 $16",
65
- borderTop: "1px solid $neutral300",
66
- width: "100%",
67
- flex: 1,
68
- display: "flex",
69
- backgroundColor: "$dark50",
70
- span: {
71
- backgroundColor: "$neutral200",
72
- color: "$neutral700",
73
- borderRadius: "$2xs",
74
- padding: "$4",
75
- },
76
- });
77
-
78
62
  export type TextareaFieldProps = Omit<
79
63
  ComponentProps<typeof TextareaFieldStyle>,
80
64
  "color"
81
65
  > &
82
66
  ComponentProps<typeof TextareaContainer> & {
83
- simpleLayout?: boolean;
84
- };
67
+ maxLength?: number;
68
+ top?: string;
69
+ }
85
70
 
86
71
  export const TextareaField = React.forwardRef<
87
72
  HTMLTextAreaElement,
88
73
  TextareaFieldProps
89
- >(({ maxLength, color, simpleLayout = false, ...props }, forwardedRef) => {
74
+ >(({ maxLength, color, top = "-1.75rem", ...props }, forwardedRef) => {
90
75
  const inputRef = useRef<HTMLTextAreaElement>(null);
91
76
  const [remaining, setRemaining] = useState(maxLength);
92
77
 
@@ -105,7 +90,7 @@ export const TextareaField = React.forwardRef<
105
90
 
106
91
  return (
107
92
  <Flex direction="column" align="end" style={{ position: 'relative' }}>
108
- {maxLength && simpleLayout && (
93
+ {maxLength && (
109
94
  <Badge size="sm" color="grey" style={{ position: 'absolute', right: 0, top: '-1.75rem' }}>
110
95
  {remaining}
111
96
  </Badge>
@@ -125,13 +110,6 @@ export const TextareaField = React.forwardRef<
125
110
  maxLength={maxLength}
126
111
  {...props}
127
112
  />
128
- {maxLength && !simpleLayout && (
129
- <TextareaLimitIndicator>
130
- <Text typography="badgeMedium">
131
- {remaining}
132
- </Text>
133
- </TextareaLimitIndicator>
134
- )}
135
113
  </TextareaContainer>
136
114
  </Flex>
137
115
  );