@lets-events/react 11.1.0 → 11.3.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/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +20 -18
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +902 -137
- package/dist/index.d.ts +902 -137
- package/dist/index.js +294 -145
- package/dist/index.mjs +273 -124
- package/package.json +1 -1
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +128 -128
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +16 -13
- package/src/components/Button/styledComponents.ts +287 -276
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +136 -136
- package/src/components/Calendar/styledComponents.ts +209 -209
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +214 -214
- package/src/components/Container.tsx +39 -39
- package/src/components/Drawer/index.tsx +48 -0
- package/src/components/Drawer/styledComponents.ts +46 -0
- package/src/components/Dropdown.tsx +167 -167
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/Form.tsx +25 -0
- package/src/components/FormFields/FormLabel.tsx +29 -29
- package/src/components/FormFields/TextAreaFormField.tsx +46 -46
- package/src/components/FormFields/TextFormField.tsx +46 -46
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +30 -0
- package/src/components/MenuDropdown/styledComponents.ts +31 -0
- package/src/components/Modal.tsx +90 -90
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/Section.tsx +33 -33
- package/src/components/Step.tsx +164 -164
- package/src/components/Switch.tsx +108 -108
- package/src/components/Text.tsx +39 -39
- package/src/components/TextField.tsx +315 -315
- package/src/components/TextareaField.tsx +128 -128
- package/src/components/TimePicker.tsx +298 -298
- package/src/components/Toast/components/ToastItem.tsx +41 -41
- package/src/components/Toast/components/ToastProvider.tsx +63 -63
- package/src/components/Toast/hooks/useToast.ts +12 -12
- package/src/components/Toast/index.tsx +5 -5
- package/src/components/Toast/styles/index.ts +135 -135
- package/src/components/Toast/types/index.ts +46 -46
- package/src/components/Tooltip/index.tsx +66 -66
- package/src/components/Tooltip/styles.ts +77 -77
- package/src/hooks/useOnClickOutside.tsx +20 -20
- package/src/index.tsx +42 -40
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +178 -178
- package/tsconfig.json +3 -3
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import { TextArea as TextAreaRadix, Flex, Box } from "@radix-ui/themes";
|
|
2
|
-
import { styled } from "../styles";
|
|
3
|
-
import React, { ComponentProps, useRef } from "react";
|
|
4
|
-
|
|
5
|
-
import { typographyValues } from "../types/typographyValues";
|
|
6
|
-
import { Text } from "./Text";
|
|
7
|
-
|
|
8
|
-
export const TextareaFieldStyle = styled(TextAreaRadix, {
|
|
9
|
-
display: "flex",
|
|
10
|
-
flex: 1,
|
|
11
|
-
textarea: {
|
|
12
|
-
width: "100%",
|
|
13
|
-
border: "none",
|
|
14
|
-
padding: "$12 $14",
|
|
15
|
-
fontFamily: "$default",
|
|
16
|
-
outline: "none",
|
|
17
|
-
resize: "vertical",
|
|
18
|
-
height: "auto",
|
|
19
|
-
},
|
|
20
|
-
variants: {
|
|
21
|
-
typography: typographyValues,
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
typography: "labelSmall",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const TextareaContainer = styled("div", {
|
|
29
|
-
display: "flex",
|
|
30
|
-
flexDirection: "column",
|
|
31
|
-
overflow: "hidden",
|
|
32
|
-
width: "100%",
|
|
33
|
-
border: "1px solid",
|
|
34
|
-
borderRadius: "$sm",
|
|
35
|
-
|
|
36
|
-
"&:has(textarea:focus)": {
|
|
37
|
-
border: "1px solid $brand300",
|
|
38
|
-
},
|
|
39
|
-
"&:has(textarea:disabled)": {
|
|
40
|
-
backgroundColor: "$dark100",
|
|
41
|
-
color: "$dark400",
|
|
42
|
-
border: "1px solid $dark200",
|
|
43
|
-
cursor: "not-allowed",
|
|
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
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export type TextareaFieldProps = Omit<
|
|
63
|
-
ComponentProps<typeof TextareaFieldStyle>,
|
|
64
|
-
"color"
|
|
65
|
-
> &
|
|
66
|
-
ComponentProps<typeof TextareaContainer>;
|
|
67
|
-
|
|
68
|
-
const TextareaLimitIndicator = styled("div", {
|
|
69
|
-
padding: "$12 $16",
|
|
70
|
-
borderTop: "1px solid $neutral300",
|
|
71
|
-
width: "100%",
|
|
72
|
-
flex: 1,
|
|
73
|
-
display: "flex",
|
|
74
|
-
backgroundColor: "$dark50",
|
|
75
|
-
span: {
|
|
76
|
-
backgroundColor: "$neutral200",
|
|
77
|
-
color: "$neutral700",
|
|
78
|
-
borderRadius: "$2xs",
|
|
79
|
-
padding: "$4",
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export const TextareaField = React.forwardRef<
|
|
84
|
-
HTMLTextAreaElement,
|
|
85
|
-
TextareaFieldProps
|
|
86
|
-
>(({ maxLength, color, ...props }, fowardedRef) => {
|
|
87
|
-
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
88
|
-
const badgeRef = useRef<HTMLSpanElement>(null);
|
|
89
|
-
|
|
90
|
-
const updateCharCountBadge = () => {
|
|
91
|
-
if (!maxLength || !badgeRef.current) return;
|
|
92
|
-
const remainingChars = maxLength - (inputRef?.current?.value.length ?? 0);
|
|
93
|
-
badgeRef.current.textContent = String(remainingChars);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
|
|
97
|
-
updateCharCountBadge();
|
|
98
|
-
props.onInput?.(e);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<TextareaContainer color={color}>
|
|
103
|
-
<TextareaFieldStyle
|
|
104
|
-
rows={4}
|
|
105
|
-
ref={(r) => {
|
|
106
|
-
if (!r) return;
|
|
107
|
-
inputRef.current = r;
|
|
108
|
-
if (fowardedRef) {
|
|
109
|
-
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
110
|
-
else {
|
|
111
|
-
fowardedRef.current = r;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}}
|
|
115
|
-
onInput={handleInput}
|
|
116
|
-
maxLength={maxLength}
|
|
117
|
-
{...props}
|
|
118
|
-
/>
|
|
119
|
-
{maxLength && (
|
|
120
|
-
<TextareaLimitIndicator>
|
|
121
|
-
<Text typography={"badgeMedium"} ref={badgeRef}>
|
|
122
|
-
{maxLength}
|
|
123
|
-
</Text>
|
|
124
|
-
</TextareaLimitIndicator>
|
|
125
|
-
)}
|
|
126
|
-
</TextareaContainer>
|
|
127
|
-
);
|
|
128
|
-
});
|
|
1
|
+
import { TextArea as TextAreaRadix, Flex, Box } from "@radix-ui/themes";
|
|
2
|
+
import { styled } from "../styles";
|
|
3
|
+
import React, { ComponentProps, useRef } from "react";
|
|
4
|
+
|
|
5
|
+
import { typographyValues } from "../types/typographyValues";
|
|
6
|
+
import { Text } from "./Text";
|
|
7
|
+
|
|
8
|
+
export const TextareaFieldStyle = styled(TextAreaRadix, {
|
|
9
|
+
display: "flex",
|
|
10
|
+
flex: 1,
|
|
11
|
+
textarea: {
|
|
12
|
+
width: "100%",
|
|
13
|
+
border: "none",
|
|
14
|
+
padding: "$12 $14",
|
|
15
|
+
fontFamily: "$default",
|
|
16
|
+
outline: "none",
|
|
17
|
+
resize: "vertical",
|
|
18
|
+
height: "auto",
|
|
19
|
+
},
|
|
20
|
+
variants: {
|
|
21
|
+
typography: typographyValues,
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
typography: "labelSmall",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const TextareaContainer = styled("div", {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
width: "100%",
|
|
33
|
+
border: "1px solid",
|
|
34
|
+
borderRadius: "$sm",
|
|
35
|
+
|
|
36
|
+
"&:has(textarea:focus)": {
|
|
37
|
+
border: "1px solid $brand300",
|
|
38
|
+
},
|
|
39
|
+
"&:has(textarea:disabled)": {
|
|
40
|
+
backgroundColor: "$dark100",
|
|
41
|
+
color: "$dark400",
|
|
42
|
+
border: "1px solid $dark200",
|
|
43
|
+
cursor: "not-allowed",
|
|
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
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export type TextareaFieldProps = Omit<
|
|
63
|
+
ComponentProps<typeof TextareaFieldStyle>,
|
|
64
|
+
"color"
|
|
65
|
+
> &
|
|
66
|
+
ComponentProps<typeof TextareaContainer>;
|
|
67
|
+
|
|
68
|
+
const TextareaLimitIndicator = styled("div", {
|
|
69
|
+
padding: "$12 $16",
|
|
70
|
+
borderTop: "1px solid $neutral300",
|
|
71
|
+
width: "100%",
|
|
72
|
+
flex: 1,
|
|
73
|
+
display: "flex",
|
|
74
|
+
backgroundColor: "$dark50",
|
|
75
|
+
span: {
|
|
76
|
+
backgroundColor: "$neutral200",
|
|
77
|
+
color: "$neutral700",
|
|
78
|
+
borderRadius: "$2xs",
|
|
79
|
+
padding: "$4",
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const TextareaField = React.forwardRef<
|
|
84
|
+
HTMLTextAreaElement,
|
|
85
|
+
TextareaFieldProps
|
|
86
|
+
>(({ maxLength, color, ...props }, fowardedRef) => {
|
|
87
|
+
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
88
|
+
const badgeRef = useRef<HTMLSpanElement>(null);
|
|
89
|
+
|
|
90
|
+
const updateCharCountBadge = () => {
|
|
91
|
+
if (!maxLength || !badgeRef.current) return;
|
|
92
|
+
const remainingChars = maxLength - (inputRef?.current?.value.length ?? 0);
|
|
93
|
+
badgeRef.current.textContent = String(remainingChars);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
|
|
97
|
+
updateCharCountBadge();
|
|
98
|
+
props.onInput?.(e);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<TextareaContainer color={color}>
|
|
103
|
+
<TextareaFieldStyle
|
|
104
|
+
rows={4}
|
|
105
|
+
ref={(r) => {
|
|
106
|
+
if (!r) return;
|
|
107
|
+
inputRef.current = r;
|
|
108
|
+
if (fowardedRef) {
|
|
109
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
110
|
+
else {
|
|
111
|
+
fowardedRef.current = r;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}}
|
|
115
|
+
onInput={handleInput}
|
|
116
|
+
maxLength={maxLength}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
{maxLength && (
|
|
120
|
+
<TextareaLimitIndicator>
|
|
121
|
+
<Text typography={"badgeMedium"} ref={badgeRef}>
|
|
122
|
+
{maxLength}
|
|
123
|
+
</Text>
|
|
124
|
+
</TextareaLimitIndicator>
|
|
125
|
+
)}
|
|
126
|
+
</TextareaContainer>
|
|
127
|
+
);
|
|
128
|
+
});
|