@lets-events/react 12.5.0 → 12.6.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 +24 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +15402 -0
- package/dist/index.d.ts +15402 -0
- package/dist/index.js +13413 -0
- package/dist/index.mjs +13307 -0
- package/package.json +1 -1
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +125 -125
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +45 -45
- package/src/components/Button/styledComponents.ts +313 -313
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +148 -148
- package/src/components/Calendar/styledComponents.ts +259 -259
- package/src/components/Card.tsx +67 -67
- package/src/components/CheckboxGroup.tsx +176 -176
- package/src/components/Container.tsx +39 -39
- package/src/components/Divider.tsx +7 -7
- package/src/components/DoubleCalendar/index.tsx +170 -170
- package/src/components/Drawer/index.tsx +100 -100
- package/src/components/Drawer/styledComponents.ts +103 -103
- package/src/components/Dropdown.tsx +302 -302
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
- package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
- package/src/components/FormFields/BirthDateFormField.tsx +84 -84
- package/src/components/FormFields/CNPJFormField.tsx +87 -87
- package/src/components/FormFields/CPFFormField.tsx +78 -78
- package/src/components/FormFields/CalendarFormField.tsx +95 -95
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- package/src/components/FormFields/DoubleCalendarFormField.tsx +93 -93
- package/src/components/FormFields/EmailFormField.tsx +27 -27
- package/src/components/FormFields/Form.tsx +39 -39
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
- package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
- package/src/components/FormFields/PhoneFormField.tsx +40 -40
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
- package/src/components/FormFields/RichEditorFormField.tsx +103 -103
- package/src/components/FormFields/SelectFormField.tsx +93 -93
- package/src/components/FormFields/SwitchFormField.tsx +46 -46
- package/src/components/FormFields/TextAreaFormField.tsx +61 -59
- package/src/components/FormFields/TextFormField.tsx +112 -112
- package/src/components/FormFields/TimePickerFormField.tsx +88 -88
- package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
- package/src/components/FormFields/utils/validation.ts +23 -23
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +38 -38
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +110 -110
- package/src/components/MultiSelect/index.tsx +268 -243
- package/src/components/MultiSelect/styledComponents.ts +160 -160
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +457 -457
- package/src/components/RichEditor/RichEditor.tsx +49 -49
- package/src/components/RichEditor/index.ts +2 -2
- package/src/components/RichEditor/styledComponents.ts +1151 -1151
- 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 +38 -38
- package/src/components/TextField.tsx +372 -372
- package/src/components/TextareaField.tsx +116 -138
- package/src/components/TimePicker.tsx +328 -328
- 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/useCountries.ts +41 -41
- package/src/hooks/useImageUpload.ts +139 -139
- package/src/hooks/useOnClickOutside.tsx +42 -42
- package/src/index.tsx +71 -71
- package/src/styles/index.ts +41 -41
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -3
- package/src/utils/states.ts +29 -29
- package/src/utils/uploadService.ts +180 -180
- package/tsconfig.json +3 -3
- package/tsup.config.ts +38 -38
|
@@ -1,243 +1,268 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from "react";
|
|
2
|
-
import { DropdownMenu, Theme } from "@radix-ui/themes";
|
|
3
|
-
import { CheckboxGroup, CheckboxItem } from "../CheckboxGroup";
|
|
4
|
-
import { Text } from "../Text";
|
|
5
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
-
import {
|
|
7
|
-
faChevronDown,
|
|
8
|
-
faChevronUp,
|
|
9
|
-
faSquareXmark,
|
|
10
|
-
} from "@fortawesome/free-solid-svg-icons";
|
|
11
|
-
import { colors } from "@lets-events/tokens";
|
|
12
|
-
import { ComponentProps, useMemo } from "react";
|
|
13
|
-
import { Flex } from "../Flex";
|
|
14
|
-
import { CloseBtnStyled, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
|
|
15
|
-
|
|
16
|
-
export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
value?: string[];
|
|
19
|
-
onValueChange?: (v: string[]) => void;
|
|
20
|
-
options: Array<{
|
|
21
|
-
label: string;
|
|
22
|
-
value: string;
|
|
23
|
-
}>;
|
|
24
|
-
width?: string;
|
|
25
|
-
zIndex?: string;
|
|
26
|
-
showSelectedValues?: boolean;
|
|
27
|
-
singleSelect?: boolean;
|
|
28
|
-
selectedOrientation?: "row" | "column";
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
maxHeight?: string;
|
|
31
|
-
selectedAllOptions?: boolean;
|
|
32
|
-
selectedAllText?: string;
|
|
33
|
-
selectedScroll?: boolean;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
|
|
37
|
-
(
|
|
38
|
-
{
|
|
39
|
-
placeholder,
|
|
40
|
-
value: selectedValues = [],
|
|
41
|
-
onValueChange,
|
|
42
|
-
options,
|
|
43
|
-
color,
|
|
44
|
-
width = "100%",
|
|
45
|
-
zIndex = "auto",
|
|
46
|
-
showSelectedValues = true,
|
|
47
|
-
singleSelect = false,
|
|
48
|
-
selectedOrientation = "column",
|
|
49
|
-
disabled = false,
|
|
50
|
-
maxHeight,
|
|
51
|
-
selectedAllOptions = false,
|
|
52
|
-
selectedAllText,
|
|
53
|
-
selectedScroll = false
|
|
54
|
-
},
|
|
55
|
-
fowardedRef
|
|
56
|
-
) => {
|
|
57
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
58
|
-
const triggerRef = useRef<HTMLDivElement>(null);
|
|
59
|
-
const [allOptionsSelected, setAllOptionsSelected] = useState(false)
|
|
60
|
-
const labelByValue = useMemo(() => {
|
|
61
|
-
return options.reduce<{ [key: string]: string }>((prev, curr) => {
|
|
62
|
-
return {
|
|
63
|
-
...prev,
|
|
64
|
-
[curr.value]: curr.label,
|
|
65
|
-
};
|
|
66
|
-
}, {});
|
|
67
|
-
}, [options]);
|
|
68
|
-
|
|
69
|
-
const handleRemove = useCallback(
|
|
70
|
-
(value: string) => {
|
|
71
|
-
const newValue = selectedValues.filter((v) => v !== value);
|
|
72
|
-
onValueChange?.(newValue);
|
|
73
|
-
},
|
|
74
|
-
[selectedValues, onValueChange]
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const handleSelectAll = useCallback(
|
|
78
|
-
(e: React.MouseEvent) => {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
e.stopPropagation();
|
|
81
|
-
const allSelected = selectedValues.length === options.length;
|
|
82
|
-
if (allSelected) {
|
|
83
|
-
onValueChange?.([]);
|
|
84
|
-
setAllOptionsSelected(false)
|
|
85
|
-
} else {
|
|
86
|
-
onValueChange?.(options.map((o) => o.value));
|
|
87
|
-
setAllOptionsSelected(true)
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
[selectedValues, options, onValueChange]
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const text = useMemo(() => {
|
|
94
|
-
if (selectedValues.length > 0 && singleSelect) {
|
|
95
|
-
const value = selectedValues[0];
|
|
96
|
-
return labelByValue[value];
|
|
97
|
-
}
|
|
98
|
-
return placeholder ?? "Selecione";
|
|
99
|
-
}, [selectedValues, placeholder, singleSelect]);
|
|
100
|
-
|
|
101
|
-
const handleItemClick = (v: string) => {
|
|
102
|
-
onValueChange?.([v]);
|
|
103
|
-
setIsOpen(false);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const handleToggle = useCallback(
|
|
107
|
-
(e: React.MouseEvent) => {
|
|
108
|
-
e.preventDefault();
|
|
109
|
-
e.stopPropagation();
|
|
110
|
-
if (disabled) return;
|
|
111
|
-
setIsOpen((prev) => !prev);
|
|
112
|
-
},
|
|
113
|
-
[disabled]
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<Theme style={width !== "100%" ? { width } : undefined}>
|
|
118
|
-
<DropdownMenu.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
119
|
-
<DropdownMenu.Trigger>
|
|
120
|
-
<StyledTrigger
|
|
121
|
-
ref={(r) => {
|
|
122
|
-
if (!r) return;
|
|
123
|
-
triggerRef.current = r;
|
|
124
|
-
if (fowardedRef) {
|
|
125
|
-
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
126
|
-
else fowardedRef.current = r;
|
|
127
|
-
}
|
|
128
|
-
}}
|
|
129
|
-
color={color}
|
|
130
|
-
disabled={disabled}
|
|
131
|
-
style={width !== "100%" ? { width } : undefined}
|
|
132
|
-
onClick={handleToggle}
|
|
133
|
-
>
|
|
134
|
-
<StyledText
|
|
135
|
-
typography={"labelMedium"}
|
|
136
|
-
color={disabled ? "dark400" : undefined}
|
|
137
|
-
>
|
|
138
|
-
{text}
|
|
139
|
-
</StyledText>
|
|
140
|
-
<FontAwesomeIcon
|
|
141
|
-
icon={isOpen ? faChevronUp : faChevronDown}
|
|
142
|
-
size="sm"
|
|
143
|
-
color={disabled ? colors.dark400 : colors.dark600}
|
|
144
|
-
/>
|
|
145
|
-
</StyledTrigger>
|
|
146
|
-
</DropdownMenu.Trigger>
|
|
147
|
-
<StyledContent
|
|
148
|
-
css={{
|
|
149
|
-
width: "100%",
|
|
150
|
-
zIndex: zIndex === "auto" ? 999999 : zIndex,
|
|
151
|
-
}}
|
|
152
|
-
>
|
|
153
|
-
{!singleSelect ? (
|
|
154
|
-
<CheckboxGroup
|
|
155
|
-
value={selectedValues}
|
|
156
|
-
onValueChange={(v) => {
|
|
157
|
-
onValueChange?.(v)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
1
|
+
import React, { useCallback, useRef, useState } from "react";
|
|
2
|
+
import { DropdownMenu, Theme } from "@radix-ui/themes";
|
|
3
|
+
import { CheckboxGroup, CheckboxItem } from "../CheckboxGroup";
|
|
4
|
+
import { Text } from "../Text";
|
|
5
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
+
import {
|
|
7
|
+
faChevronDown,
|
|
8
|
+
faChevronUp,
|
|
9
|
+
faSquareXmark,
|
|
10
|
+
} from "@fortawesome/free-solid-svg-icons";
|
|
11
|
+
import { colors } from "@lets-events/tokens";
|
|
12
|
+
import { ComponentProps, useMemo } from "react";
|
|
13
|
+
import { Flex } from "../Flex";
|
|
14
|
+
import { CloseBtnStyled, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
|
|
15
|
+
|
|
16
|
+
export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
value?: string[];
|
|
19
|
+
onValueChange?: (v: string[]) => void;
|
|
20
|
+
options: Array<{
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}>;
|
|
24
|
+
width?: string;
|
|
25
|
+
zIndex?: string;
|
|
26
|
+
showSelectedValues?: boolean;
|
|
27
|
+
singleSelect?: boolean;
|
|
28
|
+
selectedOrientation?: "row" | "column";
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
maxHeight?: string;
|
|
31
|
+
selectedAllOptions?: boolean;
|
|
32
|
+
selectedAllText?: string;
|
|
33
|
+
selectedScroll?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
|
|
37
|
+
(
|
|
38
|
+
{
|
|
39
|
+
placeholder,
|
|
40
|
+
value: selectedValues = [],
|
|
41
|
+
onValueChange,
|
|
42
|
+
options,
|
|
43
|
+
color,
|
|
44
|
+
width = "100%",
|
|
45
|
+
zIndex = "auto",
|
|
46
|
+
showSelectedValues = true,
|
|
47
|
+
singleSelect = false,
|
|
48
|
+
selectedOrientation = "column",
|
|
49
|
+
disabled = false,
|
|
50
|
+
maxHeight,
|
|
51
|
+
selectedAllOptions = false,
|
|
52
|
+
selectedAllText,
|
|
53
|
+
selectedScroll = false
|
|
54
|
+
},
|
|
55
|
+
fowardedRef
|
|
56
|
+
) => {
|
|
57
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
58
|
+
const triggerRef = useRef<HTMLDivElement>(null);
|
|
59
|
+
const [allOptionsSelected, setAllOptionsSelected] = useState(false)
|
|
60
|
+
const labelByValue = useMemo(() => {
|
|
61
|
+
return options.reduce<{ [key: string]: string }>((prev, curr) => {
|
|
62
|
+
return {
|
|
63
|
+
...prev,
|
|
64
|
+
[curr.value]: curr.label,
|
|
65
|
+
};
|
|
66
|
+
}, {});
|
|
67
|
+
}, [options]);
|
|
68
|
+
|
|
69
|
+
const handleRemove = useCallback(
|
|
70
|
+
(value: string) => {
|
|
71
|
+
const newValue = selectedValues.filter((v) => v !== value);
|
|
72
|
+
onValueChange?.(newValue);
|
|
73
|
+
},
|
|
74
|
+
[selectedValues, onValueChange]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const handleSelectAll = useCallback(
|
|
78
|
+
(e: React.MouseEvent) => {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
const allSelected = selectedValues.length === options.length;
|
|
82
|
+
if (allSelected) {
|
|
83
|
+
onValueChange?.([]);
|
|
84
|
+
setAllOptionsSelected(false)
|
|
85
|
+
} else {
|
|
86
|
+
onValueChange?.(options.map((o) => o.value));
|
|
87
|
+
setAllOptionsSelected(true)
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
[selectedValues, options, onValueChange]
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const text = useMemo(() => {
|
|
94
|
+
if (selectedValues.length > 0 && singleSelect) {
|
|
95
|
+
const value = selectedValues[0];
|
|
96
|
+
return labelByValue[value];
|
|
97
|
+
}
|
|
98
|
+
return placeholder ?? "Selecione";
|
|
99
|
+
}, [selectedValues, placeholder, singleSelect]);
|
|
100
|
+
|
|
101
|
+
const handleItemClick = (v: string) => {
|
|
102
|
+
onValueChange?.([v]);
|
|
103
|
+
setIsOpen(false);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const handleToggle = useCallback(
|
|
107
|
+
(e: React.MouseEvent) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
if (disabled) return;
|
|
111
|
+
setIsOpen((prev) => !prev);
|
|
112
|
+
},
|
|
113
|
+
[disabled]
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Theme style={width !== "100%" ? { width } : undefined}>
|
|
118
|
+
<DropdownMenu.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
119
|
+
<DropdownMenu.Trigger>
|
|
120
|
+
<StyledTrigger
|
|
121
|
+
ref={(r) => {
|
|
122
|
+
if (!r) return;
|
|
123
|
+
triggerRef.current = r;
|
|
124
|
+
if (fowardedRef) {
|
|
125
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
126
|
+
else fowardedRef.current = r;
|
|
127
|
+
}
|
|
128
|
+
}}
|
|
129
|
+
color={color}
|
|
130
|
+
disabled={disabled}
|
|
131
|
+
style={width !== "100%" ? { width } : undefined}
|
|
132
|
+
onClick={handleToggle}
|
|
133
|
+
>
|
|
134
|
+
<StyledText
|
|
135
|
+
typography={"labelMedium"}
|
|
136
|
+
color={disabled ? "dark400" : undefined}
|
|
137
|
+
>
|
|
138
|
+
{text}
|
|
139
|
+
</StyledText>
|
|
140
|
+
<FontAwesomeIcon
|
|
141
|
+
icon={isOpen ? faChevronUp : faChevronDown}
|
|
142
|
+
size="sm"
|
|
143
|
+
color={disabled ? colors.dark400 : colors.dark600}
|
|
144
|
+
/>
|
|
145
|
+
</StyledTrigger>
|
|
146
|
+
</DropdownMenu.Trigger>
|
|
147
|
+
<StyledContent
|
|
148
|
+
css={{
|
|
149
|
+
width: "100%",
|
|
150
|
+
zIndex: zIndex === "auto" ? 999999 : zIndex,
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{!singleSelect ? (
|
|
154
|
+
<CheckboxGroup
|
|
155
|
+
value={selectedValues}
|
|
156
|
+
onValueChange={(v) => {
|
|
157
|
+
onValueChange?.(v);
|
|
158
|
+
setAllOptionsSelected((v || []).length === options.length);
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<StyledFlexWithMaxHeight
|
|
162
|
+
direction={"column"}
|
|
163
|
+
gap={8}
|
|
164
|
+
hasMaxHeight={!!maxHeight}
|
|
165
|
+
style={maxHeight ? { maxHeight } : undefined}
|
|
166
|
+
>
|
|
167
|
+
{selectedAllOptions && (
|
|
168
|
+
<ButtonSelectAllStyled
|
|
169
|
+
css={itemStyle}
|
|
170
|
+
onClick={(e) => { handleSelectAll(e), setIsOpen(false) }}
|
|
171
|
+
type="button"
|
|
172
|
+
>
|
|
173
|
+
<div className={allOptionsSelected ? "checked" : ""}></div>
|
|
174
|
+
<Text typography="labelSmall">
|
|
175
|
+
{selectedAllText ? selectedAllText : "Selecionar Todos"}
|
|
176
|
+
</Text>
|
|
177
|
+
</ButtonSelectAllStyled>
|
|
178
|
+
)}
|
|
179
|
+
|
|
180
|
+
{options.map(({ value, label }, i) => (
|
|
181
|
+
<CheckboxItem value={value} css={itemStyle} key={i}>
|
|
182
|
+
<Text typography={"labelSmall"}>{label}</Text>
|
|
183
|
+
</CheckboxItem>
|
|
184
|
+
))}
|
|
185
|
+
</StyledFlexWithMaxHeight>
|
|
186
|
+
</CheckboxGroup>
|
|
187
|
+
) : (
|
|
188
|
+
<StyledFlexWithMaxHeight
|
|
189
|
+
direction={"column"}
|
|
190
|
+
gap={8}
|
|
191
|
+
hasMaxHeight={!!maxHeight}
|
|
192
|
+
style={maxHeight ? { maxHeight } : undefined}
|
|
193
|
+
>
|
|
194
|
+
{options.map(({ value, label }, i) => (
|
|
195
|
+
<StyledItem key={i} onClick={() => handleItemClick(value)}>
|
|
196
|
+
<Text typography={"labelSmall"}>{label}</Text>
|
|
197
|
+
</StyledItem>
|
|
198
|
+
))}
|
|
199
|
+
</StyledFlexWithMaxHeight>
|
|
200
|
+
)}
|
|
201
|
+
</StyledContent>
|
|
202
|
+
</DropdownMenu.Root>
|
|
203
|
+
{selectedValues.length > 0 && showSelectedValues && (
|
|
204
|
+
<StyledFlexSelectedItems
|
|
205
|
+
direction={selectedOrientation}
|
|
206
|
+
gap={8}
|
|
207
|
+
align={selectedOrientation === "column" ? "start" : "center"}
|
|
208
|
+
justify={"start"}
|
|
209
|
+
css={{ ...(selectedScroll && { maxHeight: maxHeight || "400px" }) }}
|
|
210
|
+
>
|
|
211
|
+
{allOptionsSelected ? (
|
|
212
|
+
<Flex
|
|
213
|
+
key="all-selected"
|
|
214
|
+
gap={4}
|
|
215
|
+
align={"center"}
|
|
216
|
+
css={{ flexWrap: "wrap" }}
|
|
217
|
+
>
|
|
218
|
+
<CloseBtnStyled
|
|
219
|
+
onClick={(e) => {
|
|
220
|
+
e.stopPropagation();
|
|
221
|
+
onValueChange?.([]);
|
|
222
|
+
setAllOptionsSelected(false);
|
|
223
|
+
}}
|
|
224
|
+
type="button"
|
|
225
|
+
>
|
|
226
|
+
<FontAwesomeIcon icon={faSquareXmark} size="sm" />
|
|
227
|
+
</CloseBtnStyled>
|
|
228
|
+
<Text
|
|
229
|
+
typography={"captionMedium"}
|
|
230
|
+
fontWeight={"regular"}
|
|
231
|
+
color="dark600"
|
|
232
|
+
>
|
|
233
|
+
{"Todos selecionados"}
|
|
234
|
+
</Text>
|
|
235
|
+
</Flex>
|
|
236
|
+
) : (
|
|
237
|
+
selectedValues.map((value) => (
|
|
238
|
+
<Flex
|
|
239
|
+
key={value}
|
|
240
|
+
gap={4}
|
|
241
|
+
align={"center"}
|
|
242
|
+
css={{ flexWrap: "wrap" }}
|
|
243
|
+
>
|
|
244
|
+
<CloseBtnStyled
|
|
245
|
+
onClick={(e) => {
|
|
246
|
+
e.stopPropagation();
|
|
247
|
+
handleRemove(value);
|
|
248
|
+
}}
|
|
249
|
+
type="button"
|
|
250
|
+
>
|
|
251
|
+
<FontAwesomeIcon icon={faSquareXmark} size="sm" />
|
|
252
|
+
</CloseBtnStyled>
|
|
253
|
+
<Text
|
|
254
|
+
typography={"captionMedium"}
|
|
255
|
+
fontWeight={"regular"}
|
|
256
|
+
color="dark600"
|
|
257
|
+
>
|
|
258
|
+
{labelByValue[value]}
|
|
259
|
+
</Text>
|
|
260
|
+
</Flex>
|
|
261
|
+
))
|
|
262
|
+
)}
|
|
263
|
+
</StyledFlexSelectedItems>
|
|
264
|
+
)}
|
|
265
|
+
</Theme>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
);
|