@free-dom/react-components 2.0.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/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/cjs/index.js +112345 -0
- package/dist/esm/index.js +112279 -0
- package/dist/types/components/AdvancedSelect/AdvancedSelect.constants.d.ts +4 -0
- package/dist/types/components/AdvancedSelect/AdvancedSelect.d.ts +108 -0
- package/dist/types/components/AdvancedSelect/AdvancedSelect.helpers.d.ts +14 -0
- package/dist/types/components/AdvancedSelect/AdvancedSelectDropdown.d.ts +14 -0
- package/dist/types/components/AdvancedSelect/index.d.ts +2 -0
- package/dist/types/components/Alert/Alert.d.ts +39 -0
- package/dist/types/components/Alert/Alert.helpers.d.ts +3 -0
- package/dist/types/components/Alert/index.d.ts +1 -0
- package/dist/types/components/Avatar/Avatar.constants.d.ts +6 -0
- package/dist/types/components/Avatar/Avatar.d.ts +34 -0
- package/dist/types/components/Avatar/Avatar.helpers.d.ts +3 -0
- package/dist/types/components/Avatar/AvatarImage.d.ts +4 -0
- package/dist/types/components/Avatar/index.d.ts +1 -0
- package/dist/types/components/Avatar/useCreateAvatarImage.d.ts +3 -0
- package/dist/types/components/BackToTop/BackToTop.d.ts +19 -0
- package/dist/types/components/BackToTop/index.d.ts +1 -0
- package/dist/types/components/Badge/Badge.constants.d.ts +1 -0
- package/dist/types/components/Badge/Badge.d.ts +35 -0
- package/dist/types/components/Badge/Badge.helpers.d.ts +1 -0
- package/dist/types/components/Badge/index.d.ts +2 -0
- package/dist/types/components/Banner/Banner.d.ts +61 -0
- package/dist/types/components/Banner/index.d.ts +1 -0
- package/dist/types/components/BarChart/BarChart.constants.d.ts +1 -0
- package/dist/types/components/BarChart/BarChart.d.ts +125 -0
- package/dist/types/components/BarChart/BarChartGraphic.d.ts +21 -0
- package/dist/types/components/BarChart/BarChartSkeleton.d.ts +8 -0
- package/dist/types/components/BarChart/CustomBarLegend.d.ts +13 -0
- package/dist/types/components/BarChart/TooltipChart.d.ts +21 -0
- package/dist/types/components/BarChart/index.d.ts +1 -0
- package/dist/types/components/Breadcrumbs/Breadcrumbs.constants.d.ts +1 -0
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/dist/types/components/Breadcrumbs/Crumb.d.ts +6 -0
- package/dist/types/components/Breadcrumbs/ShowMoreCrumbs.d.ts +6 -0
- package/dist/types/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/types/components/Button/Button.constants.d.ts +0 -0
- package/dist/types/components/Button/Button.d.ts +38 -0
- package/dist/types/components/Button/Button.helpers.d.ts +0 -0
- package/dist/types/components/Button/ButtonChildren.d.ts +0 -0
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/Card/Card.d.ts +21 -0
- package/dist/types/components/Card/CardActions.d.ts +12 -0
- package/dist/types/components/Card/CardContent.d.ts +7 -0
- package/dist/types/components/Card/CardHeader.d.ts +23 -0
- package/dist/types/components/Card/CardImage.d.ts +11 -0
- package/dist/types/components/Card/CardTag.d.ts +3 -0
- package/dist/types/components/Card/HeaderMoreOptions.d.ts +2 -0
- package/dist/types/components/Card/index.d.ts +1 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +48 -0
- package/dist/types/components/Checkbox/CheckboxIndicator.d.ts +4 -0
- package/dist/types/components/Checkbox/index.d.ts +1 -0
- package/dist/types/components/Chip/Chip.d.ts +49 -0
- package/dist/types/components/Chip/index.d.ts +1 -0
- package/dist/types/components/DatePicker/CalendarHeader.d.ts +12 -0
- package/dist/types/components/DatePicker/CalendarSelect.d.ts +10 -0
- package/dist/types/components/DatePicker/ClearButton.d.ts +9 -0
- package/dist/types/components/DatePicker/DateInput.d.ts +34 -0
- package/dist/types/components/DatePicker/DateInputRange.d.ts +11 -0
- package/dist/types/components/DatePicker/DatePicker.constants.d.ts +18 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +79 -0
- package/dist/types/components/DatePicker/DatePicker.helpers.d.ts +33 -0
- package/dist/types/components/DatePicker/index.d.ts +1 -0
- package/dist/types/components/Dialog/Dialog.d.ts +13 -0
- package/dist/types/components/Dialog/index.d.ts +1 -0
- package/dist/types/components/Divider/Divider.d.ts +15 -0
- package/dist/types/components/Divider/index.d.ts +1 -0
- package/dist/types/components/Drawer/Drawer.constants.d.ts +12 -0
- package/dist/types/components/Drawer/Drawer.d.ts +77 -0
- package/dist/types/components/Drawer/ScrollArea.d.ts +2 -0
- package/dist/types/components/Drawer/index.d.ts +1 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +60 -0
- package/dist/types/components/DropdownMenu/DropdownMenuContent.d.ts +16 -0
- package/dist/types/components/DropdownMenu/DropdownMenuGroup.d.ts +12 -0
- package/dist/types/components/DropdownMenu/DropdownMenuIcon.d.ts +14 -0
- package/dist/types/components/DropdownMenu/DropdownMenuItem.d.ts +26 -0
- package/dist/types/components/DropdownMenu/DropdownMenuSeparator.d.ts +7 -0
- package/dist/types/components/DropdownMenu/DropdownMenuSub.d.ts +33 -0
- package/dist/types/components/DropdownMenu/DropdownMenuSubContent.d.ts +16 -0
- package/dist/types/components/DropdownMenu/DropdownMenuText.d.ts +11 -0
- package/dist/types/components/DropdownMenu/index.d.ts +1 -0
- package/dist/types/components/ErrorBoundary.d.ts +34 -0
- package/dist/types/components/FileUpload/FileUpload.constants.d.ts +16 -0
- package/dist/types/components/FileUpload/FileUpload.d.ts +73 -0
- package/dist/types/components/FileUpload/FileUpload.helpers.d.ts +13 -0
- package/dist/types/components/FileUpload/FileUploadHeader.d.ts +8 -0
- package/dist/types/components/FileUpload/FileUploadInputArea.d.ts +8 -0
- package/dist/types/components/FileUpload/FileUploadItem.d.ts +8 -0
- package/dist/types/components/FileUpload/FileUploadList.d.ts +8 -0
- package/dist/types/components/FileUpload/index.d.ts +3 -0
- package/dist/types/components/FileUpload/useFileUpload.d.ts +23 -0
- package/dist/types/components/FileUpload/useUpload.d.ts +28 -0
- package/dist/types/components/Filter/Filter.constants.d.ts +1 -0
- package/dist/types/components/Filter/Filter.d.ts +67 -0
- package/dist/types/components/Filter/Filter.helpers.d.ts +4 -0
- package/dist/types/components/Filter/FilterTags.d.ts +6 -0
- package/dist/types/components/Filter/Input/DatePicker.d.ts +7 -0
- package/dist/types/components/Filter/Input/Rules.d.ts +56 -0
- package/dist/types/components/Filter/Input/Select.d.ts +7 -0
- package/dist/types/components/Filter/Input/Switch.d.ts +6 -0
- package/dist/types/components/Filter/Input/TextInput.d.ts +7 -0
- package/dist/types/components/Filter/Input/index.d.ts +10 -0
- package/dist/types/components/Filter/index.d.ts +2 -0
- package/dist/types/components/IconButton/IconButton.d.ts +22 -0
- package/dist/types/components/IconButton/index.d.ts +1 -0
- package/dist/types/components/ImageCarousel/ImageCarousel.constants.d.ts +3 -0
- package/dist/types/components/ImageCarousel/ImageCarousel.d.ts +32 -0
- package/dist/types/components/ImageCarousel/ImageCarousel.helpers.d.ts +3 -0
- package/dist/types/components/ImageCarousel/ImageCarouselFullScreen.d.ts +2 -0
- package/dist/types/components/ImageCarousel/ImageCarouselFullscreenNavigation.d.ts +1 -0
- package/dist/types/components/ImageCarousel/ImageCarouselFullscreenSidebar.d.ts +1 -0
- package/dist/types/components/ImageCarousel/ImageCarouselInline.d.ts +3 -0
- package/dist/types/components/ImageCarousel/ImageCarouselItem.d.ts +34 -0
- package/dist/types/components/ImageCarousel/ImageCarouselNavigation.d.ts +1 -0
- package/dist/types/components/ImageCarousel/ImageCarouselTrackBar.d.ts +4 -0
- package/dist/types/components/ImageCarousel/index.d.ts +1 -0
- package/dist/types/components/ImageCarousel/useImageCarousel.d.ts +21 -0
- package/dist/types/components/LineChart/CustomLineLegend.d.ts +12 -0
- package/dist/types/components/LineChart/LineChart.constants.d.ts +1 -0
- package/dist/types/components/LineChart/LineChart.d.ts +108 -0
- package/dist/types/components/LineChart/LineChartGraphic.d.ts +18 -0
- package/dist/types/components/LineChart/LineChartSkeleton.d.ts +7 -0
- package/dist/types/components/LineChart/TooltipChart.d.ts +20 -0
- package/dist/types/components/LineChart/index.d.ts +1 -0
- package/dist/types/components/Link/Link.d.ts +42 -0
- package/dist/types/components/Link/index.d.ts +2 -0
- package/dist/types/components/Modal/DragContext.d.ts +7 -0
- package/dist/types/components/Modal/Modal.d.ts +18 -0
- package/dist/types/components/Modal/ModalActions.d.ts +38 -0
- package/dist/types/components/Modal/ModalBody.d.ts +12 -0
- package/dist/types/components/Modal/ModalContent.d.ts +5 -0
- package/dist/types/components/Modal/ModalContentWrapper.d.ts +3 -0
- package/dist/types/components/Modal/ModalContext.d.ts +4 -0
- package/dist/types/components/Modal/ModalHeader.d.ts +15 -0
- package/dist/types/components/Modal/ModalTrigger.d.ts +7 -0
- package/dist/types/components/Modal/index.d.ts +2 -0
- package/dist/types/components/MultilineTextInput/ClearButton.d.ts +8 -0
- package/dist/types/components/MultilineTextInput/InputHelpers.d.ts +7 -0
- package/dist/types/components/MultilineTextInput/MultilineTextInput.constants.d.ts +1 -0
- package/dist/types/components/MultilineTextInput/MultilineTextInput.d.ts +31 -0
- package/dist/types/components/MultilineTextInput/index.d.ts +1 -0
- package/dist/types/components/NavigationMenu/NavigationMenu.d.ts +17 -0
- package/dist/types/components/NavigationMenu/NavigationMenu.helpers.d.ts +4 -0
- package/dist/types/components/NavigationMenu/NavigationMenuGroup.d.ts +21 -0
- package/dist/types/components/NavigationMenu/NavigationMenuItem.d.ts +9 -0
- package/dist/types/components/NavigationMenu/NavigationMenuLink.d.ts +34 -0
- package/dist/types/components/NavigationMenu/index.d.ts +1 -0
- package/dist/types/components/NeedPermission/NeedPermission.d.ts +27 -0
- package/dist/types/components/NeedPermission/index.d.ts +1 -0
- package/dist/types/components/PasswordInput/ClearButton.d.ts +8 -0
- package/dist/types/components/PasswordInput/InputHelpers.d.ts +7 -0
- package/dist/types/components/PasswordInput/PasswordInput.constants.d.ts +1 -0
- package/dist/types/components/PasswordInput/PasswordInput.d.ts +26 -0
- package/dist/types/components/PasswordInput/ToggleVisibility.d.ts +7 -0
- package/dist/types/components/PasswordInput/index.d.ts +1 -0
- package/dist/types/components/PieChart/CustomPieLegend.d.ts +13 -0
- package/dist/types/components/PieChart/PieChart.constants.d.ts +1 -0
- package/dist/types/components/PieChart/PieChart.d.ts +102 -0
- package/dist/types/components/PieChart/PieChart.helpers.d.ts +15 -0
- package/dist/types/components/PieChart/PieChartGraphic.d.ts +12 -0
- package/dist/types/components/PieChart/PieChartSkeleton.d.ts +8 -0
- package/dist/types/components/PieChart/TooltipChart.d.ts +11 -0
- package/dist/types/components/PieChart/index.d.ts +1 -0
- package/dist/types/components/ProgressBar/ProgressBar.d.ts +11 -0
- package/dist/types/components/ProgressBar/ProgressBar.helpers.d.ts +1 -0
- package/dist/types/components/ProgressBar/index.d.ts +1 -0
- package/dist/types/components/RadioGroup/Item.d.ts +21 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +33 -0
- package/dist/types/components/RadioGroup/index.d.ts +1 -0
- package/dist/types/components/Rating/NumericRating.d.ts +17 -0
- package/dist/types/components/Rating/Rating.constants.d.ts +9 -0
- package/dist/types/components/Rating/Rating.d.ts +12 -0
- package/dist/types/components/Rating/Rating.helpers.d.ts +4 -0
- package/dist/types/components/Rating/SatisfactionRating.d.ts +16 -0
- package/dist/types/components/Rating/SimpleRating.d.ts +17 -0
- package/dist/types/components/Rating/StarRating.d.ts +16 -0
- package/dist/types/components/Rating/index.d.ts +1 -0
- package/dist/types/components/Select/Checkbox.d.ts +12 -0
- package/dist/types/components/Select/ClearIndicator.d.ts +3 -0
- package/dist/types/components/Select/Control.d.ts +3 -0
- package/dist/types/components/Select/DropdownIndicator.d.ts +3 -0
- package/dist/types/components/Select/GroupHeading.d.ts +3 -0
- package/dist/types/components/Select/Menu.d.ts +3 -0
- package/dist/types/components/Select/MenuList.d.ts +3 -0
- package/dist/types/components/Select/MultiValue.d.ts +3 -0
- package/dist/types/components/Select/NoOptionsMessage.d.ts +3 -0
- package/dist/types/components/Select/Option.d.ts +3 -0
- package/dist/types/components/Select/Placeholder.d.ts +3 -0
- package/dist/types/components/Select/Select.constants.d.ts +2 -0
- package/dist/types/components/Select/Select.d.ts +153 -0
- package/dist/types/components/Select/Select.helpers.d.ts +6 -0
- package/dist/types/components/Select/SelectContainer.d.ts +3 -0
- package/dist/types/components/Select/SingleValue.d.ts +3 -0
- package/dist/types/components/Select/StartAdornment.d.ts +8 -0
- package/dist/types/components/Select/ValueContainer.d.ts +3 -0
- package/dist/types/components/Select/index.d.ts +2 -0
- package/dist/types/components/Skeleton/Skeleton.d.ts +37 -0
- package/dist/types/components/Skeleton/index.d.ts +2 -0
- package/dist/types/components/Stepper/Step.d.ts +31 -0
- package/dist/types/components/Stepper/Stepper.d.ts +36 -0
- package/dist/types/components/Stepper/StepperBar.d.ts +13 -0
- package/dist/types/components/Stepper/StepperIcon.d.ts +8 -0
- package/dist/types/components/Stepper/StepperLabel.d.ts +12 -0
- package/dist/types/components/Stepper/index.d.ts +1 -0
- package/dist/types/components/Switch/Switch.d.ts +61 -0
- package/dist/types/components/Switch/index.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs.d.ts +33 -0
- package/dist/types/components/Tabs/TabsContent.d.ts +14 -0
- package/dist/types/components/Tabs/TabsHeader.d.ts +10 -0
- package/dist/types/components/Tabs/TabsItem.d.ts +24 -0
- package/dist/types/components/Tabs/index.d.ts +1 -0
- package/dist/types/components/Tabs/useTabs.d.ts +9 -0
- package/dist/types/components/Tag/Tag.d.ts +15 -0
- package/dist/types/components/Tag/index.d.ts +1 -0
- package/dist/types/components/TextInput/ClearButton.d.ts +9 -0
- package/dist/types/components/TextInput/EndAdornment.d.ts +6 -0
- package/dist/types/components/TextInput/InputHelpers.d.ts +7 -0
- package/dist/types/components/TextInput/StartAdornment.d.ts +13 -0
- package/dist/types/components/TextInput/TextInput.constants.d.ts +1 -0
- package/dist/types/components/TextInput/TextInput.d.ts +61 -0
- package/dist/types/components/TextInput/TextInput.helpers.d.ts +2 -0
- package/dist/types/components/TextInput/index.d.ts +2 -0
- package/dist/types/components/TextToolbar/BackgroundColorSelector.d.ts +3 -0
- package/dist/types/components/TextToolbar/BubbleDropdown/BubbleDropdown.d.ts +8 -0
- package/dist/types/components/TextToolbar/BubbleDropdown/BubbleDropdownItem.d.ts +8 -0
- package/dist/types/components/TextToolbar/BubbleDropdown/useOutsideclick.d.ts +1 -0
- package/dist/types/components/TextToolbar/BubbleMenu.d.ts +3 -0
- package/dist/types/components/TextToolbar/CharCounter.d.ts +4 -0
- package/dist/types/components/TextToolbar/ClipboardActions.d.ts +3 -0
- package/dist/types/components/TextToolbar/FontColorSelector.d.ts +3 -0
- package/dist/types/components/TextToolbar/FormatTextSelector.d.ts +3 -0
- package/dist/types/components/TextToolbar/HistoryControls.d.ts +3 -0
- package/dist/types/components/TextToolbar/ListSelector.d.ts +3 -0
- package/dist/types/components/TextToolbar/MediaLinkControls.d.ts +9 -0
- package/dist/types/components/TextToolbar/TextAlignSelector.d.ts +3 -0
- package/dist/types/components/TextToolbar/TextToolbar.constants.d.ts +33 -0
- package/dist/types/components/TextToolbar/TextToolbar.d.ts +54 -0
- package/dist/types/components/TextToolbar/TextToolbar.helpers.d.ts +11 -0
- package/dist/types/components/TextToolbar/Toolbar.d.ts +7 -0
- package/dist/types/components/TextToolbar/TypographySelector.d.ts +3 -0
- package/dist/types/components/TextToolbar/index.d.ts +1 -0
- package/dist/types/components/Timeline/Timeline.helpers.d.ts +1 -0
- package/dist/types/components/Timeline/TimelineContainer.d.ts +6 -0
- package/dist/types/components/Timeline/TimelineContent.d.ts +2 -0
- package/dist/types/components/Timeline/TimelineDot.d.ts +30 -0
- package/dist/types/components/Timeline/TimelineLeft.d.ts +7 -0
- package/dist/types/components/Timeline/TimelineRight.d.ts +22 -0
- package/dist/types/components/Timeline/index.d.ts +12 -0
- package/dist/types/components/Toast/Toast.constants.d.ts +10 -0
- package/dist/types/components/Toast/Toast.d.ts +23 -0
- package/dist/types/components/Toast/Toast.helpers.d.ts +7 -0
- package/dist/types/components/Toast/index.d.ts +2 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +37 -0
- package/dist/types/components/Tooltip/index.d.ts +1 -0
- package/dist/types/components/TotalCard/TotalCard.constants.d.ts +8 -0
- package/dist/types/components/TotalCard/TotalCard.d.ts +48 -0
- package/dist/types/components/TotalCard/TotalCard.helpers.d.ts +1 -0
- package/dist/types/components/TotalCard/TotalCardActions.d.ts +13 -0
- package/dist/types/components/TotalCard/TotalCardContent.d.ts +10 -0
- package/dist/types/components/TotalCard/TotalCardDescription.d.ts +7 -0
- package/dist/types/components/TotalCard/TotalCardGroup.d.ts +2 -0
- package/dist/types/components/TotalCard/TotalCardMetrics.d.ts +25 -0
- package/dist/types/components/TotalCard/TotalCardSkeleton.d.ts +1 -0
- package/dist/types/components/TotalCard/index.d.ts +1 -0
- package/dist/types/components/Typography/Typography.constants.d.ts +1 -0
- package/dist/types/components/Typography/Typography.d.ts +21 -0
- package/dist/types/components/Typography/index.d.ts +2 -0
- package/dist/types/components/shared/Api/api.d.ts +35 -0
- package/dist/types/components/shared/Api/index.d.ts +1 -0
- package/dist/types/components/shared/Chart/Chart.constants.d.ts +5 -0
- package/dist/types/components/shared/Chart/Chart.helpers.d.ts +13 -0
- package/dist/types/components/shared/Chart/ChartCard.d.ts +24 -0
- package/dist/types/components/shared/Chart/ChartCheckbox.d.ts +5 -0
- package/dist/types/components/shared/Chart/ChartDescriptionModal.d.ts +7 -0
- package/dist/types/components/shared/Chart/ChartEmpty.d.ts +1 -0
- package/dist/types/components/shared/Chart/ChartFilter.d.ts +9 -0
- package/dist/types/components/shared/Chart/ChartMoreOptions.d.ts +14 -0
- package/dist/types/components/shared/Chart/index.d.ts +4 -0
- package/dist/types/components/shared/ErrorBoundary/ErrorBoundary.d.ts +15 -0
- package/dist/types/components/shared/ErrorBoundary/index.d.ts +1 -0
- package/dist/types/components/shared/InputWrapper/InputHelpers.d.ts +6 -0
- package/dist/types/components/shared/InputWrapper/InputWrapper.d.ts +52 -0
- package/dist/types/components/shared/InputWrapper/Label.d.ts +8 -0
- package/dist/types/components/shared/InputWrapper/index.d.ts +1 -0
- package/dist/types/components/shared/Loader/Loader.d.ts +5 -0
- package/dist/types/components/shared/Loader/index.d.ts +1 -0
- package/dist/types/components/shared/RippleEffect/RippleEffect.d.ts +8 -0
- package/dist/types/components/shared/RippleEffect/RippleEffect.helpers.d.ts +6 -0
- package/dist/types/components/shared/RippleEffect/index.d.ts +2 -0
- package/dist/types/components/shared/RippleEffect/useRipple.d.ts +10 -0
- package/dist/types/components/shared/hooks/index.d.ts +1 -0
- package/dist/types/components/shared/hooks/useControlledWarning.d.ts +9 -0
- package/dist/types/components/shared/withStaticProps.d.ts +24 -0
- package/dist/types/constants.d.ts +8 -0
- package/dist/types/index.d.ts +2806 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/utils.d.ts +5 -0
- package/package.json +128 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as Menu from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import { IconName } from '@freedom/react-icons';
|
|
3
|
+
import { DropdownMenuGroup } from './DropdownMenuGroup';
|
|
4
|
+
import { DropdownMenuIcon } from './DropdownMenuIcon';
|
|
5
|
+
import { DropdownMenuItem } from './DropdownMenuItem';
|
|
6
|
+
import { DropdownMenuSeparator } from './DropdownMenuSeparator';
|
|
7
|
+
import { DropdownMenuText } from './DropdownMenuText';
|
|
8
|
+
import { DropdownMenuSub } from './DropdownMenuSub';
|
|
9
|
+
export type DropdownMenuRootProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Define o estado `open` do menu ao ser renderizado.
|
|
12
|
+
*/
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Determina se o menu está aberto ou fechado. Deve ser usado em conjunto com `onOpenChange`
|
|
16
|
+
*/
|
|
17
|
+
open?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Evento disparado quando o estado `open` do menu é alterado.
|
|
20
|
+
*/
|
|
21
|
+
onOpenChange?: Menu.DropdownMenuProps['onOpenChange'];
|
|
22
|
+
/**
|
|
23
|
+
* Define um ícone customizado para o botão do menu.
|
|
24
|
+
* @default 'moreVert'
|
|
25
|
+
*/
|
|
26
|
+
icon?: IconName;
|
|
27
|
+
/**
|
|
28
|
+
* className customizada que será aplicado ao componente.
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Título que aparece em formato de tooltip para descrever componente.
|
|
33
|
+
*/
|
|
34
|
+
title?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Define o container pai onde o menu será renderizado
|
|
37
|
+
* @default document.body
|
|
38
|
+
*/
|
|
39
|
+
containerRef?: React.RefObject<HTMLElement>;
|
|
40
|
+
/**
|
|
41
|
+
* Altera a propagação do evento de click ao componente pai
|
|
42
|
+
*/
|
|
43
|
+
stopPropagation?: boolean;
|
|
44
|
+
};
|
|
45
|
+
declare function DropdownMenu({ children, icon, className, title, containerRef, stopPropagation, ...rest }: React.PropsWithChildren<DropdownMenuRootProps>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
declare namespace DropdownMenu {
|
|
47
|
+
var Content: import("react").ForwardRefExoticComponent<import("./DropdownMenuContent").DropdownMenuContentProps & {
|
|
48
|
+
children?: import("react").ReactNode | undefined;
|
|
49
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
|
+
var Group: typeof DropdownMenuGroup;
|
|
51
|
+
var Icon: typeof DropdownMenuIcon;
|
|
52
|
+
var Item: typeof DropdownMenuItem;
|
|
53
|
+
var Separator: typeof DropdownMenuSeparator;
|
|
54
|
+
var Text: typeof DropdownMenuText;
|
|
55
|
+
var Sub: typeof DropdownMenuSub;
|
|
56
|
+
var SubContent: import("react").ForwardRefExoticComponent<import("./DropdownMenuSubContent").DropdownMenuSubContentProps & {
|
|
57
|
+
children?: import("react").ReactNode | undefined;
|
|
58
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
59
|
+
}
|
|
60
|
+
export { DropdownMenu };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Menu from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
export type DropdownMenuContentProps = {
|
|
4
|
+
/**
|
|
5
|
+
* className customizada que será aplicado ao componente.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Função chamada quando um evento do mouse ocorre fora do componente.
|
|
10
|
+
* Isso pode ser evitado chamando `event.preventDefault`
|
|
11
|
+
*/
|
|
12
|
+
onPointerDownOutside?: Menu.DropdownMenuContentProps['onPointerDownOutside'];
|
|
13
|
+
};
|
|
14
|
+
export declare const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & {
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type DropdownMenuGroupProps = {
|
|
2
|
+
/**
|
|
3
|
+
* className customizada que será aplicado ao componente.
|
|
4
|
+
*/
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Texto que será exibido como nome do grupo.
|
|
8
|
+
*/
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function DropdownMenuGroup({ children, label, ...rest }: React.PropsWithChildren<DropdownMenuGroupProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconName } from '@freedom/react-icons';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type DropdownMenuIconProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Nome do ícone que será exibido.
|
|
6
|
+
*/
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/**
|
|
9
|
+
* Ícone customizado especificado pelo usuário.
|
|
10
|
+
*/
|
|
11
|
+
renderIcon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
12
|
+
};
|
|
13
|
+
export declare function DropdownMenuIcon({ icon, renderIcon }: DropdownMenuIconProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type DropdownMenuItemProps = {
|
|
2
|
+
/**
|
|
3
|
+
* className customizada que será aplicado ao componente.
|
|
4
|
+
*/
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Quando `true`, impede que o usuário interaja com o item.
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Função chamada quando o item é selecionado.
|
|
12
|
+
* Chamar `event.preventDefault` impede o fechamento do menu ao selecionar o item.
|
|
13
|
+
*/
|
|
14
|
+
onSelect?: (event: Event) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Altera o componente para o filho único (pode ser uma tag HTML ou
|
|
17
|
+
* um elemento customizado). Isso irá mesclar as props do componenente
|
|
18
|
+
* original com as props do elemento/componente fornecido
|
|
19
|
+
*/
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Altera a propagação do evento de click ao componente pai
|
|
23
|
+
*/
|
|
24
|
+
stopPropagation?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function DropdownMenuItem({ className, children, stopPropagation, ...rest }: React.PropsWithChildren<DropdownMenuItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DropdownMenuSeparatorProps = {
|
|
2
|
+
/**
|
|
3
|
+
* className customizada que será aplicado ao componente.
|
|
4
|
+
*/
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function DropdownMenuSeparator({ className, ...rest }: DropdownMenuSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type DropdownMenuSubProps = {
|
|
2
|
+
/**
|
|
3
|
+
* className customizada que será aplicado ao componente.
|
|
4
|
+
*/
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Quando `true`, impede que o usuário interaja com o item.
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Altera o componente para o filho único (pode ser uma tag HTML ou
|
|
12
|
+
* um elemento customizado). Isso irá mesclar as props do componente
|
|
13
|
+
* original com as props do elemento/componente fornecido
|
|
14
|
+
*/
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Define o estado inicial como aberto
|
|
18
|
+
*/
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Controla o estado de abertura do subItem
|
|
22
|
+
*/
|
|
23
|
+
open?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Callback disparado quando o estado de abertura do subitem muda
|
|
26
|
+
*/
|
|
27
|
+
onOpenChange?: (open: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Texto do trigger
|
|
30
|
+
*/
|
|
31
|
+
label: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function DropdownMenuSub({ className, children, asChild, disabled, label, ...rest }: React.PropsWithChildren<DropdownMenuSubProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Menu from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
export type DropdownMenuSubContentProps = {
|
|
4
|
+
/**
|
|
5
|
+
* className customizada que será aplicado ao componente.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Função chamada quando um evento do mouse ocorre fora do componente.
|
|
10
|
+
* Isso pode ser evitado chamando `event.preventDefault`
|
|
11
|
+
*/
|
|
12
|
+
onPointerDownOutside?: Menu.DropdownMenuContentProps['onPointerDownOutside'];
|
|
13
|
+
};
|
|
14
|
+
export declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<DropdownMenuSubContentProps & {
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Combine } from '../../utils';
|
|
3
|
+
type DropdownMenuTextOwnProps = {
|
|
4
|
+
/**
|
|
5
|
+
* className customizada que será aplicado ao componente.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
type DropdownMenuTextProps = Combine<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, DropdownMenuTextOwnProps>;
|
|
10
|
+
export declare function DropdownMenuText({ className, children, ...rest }: DropdownMenuTextProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownMenu } from './DropdownMenu';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Especifica componente que será renderizado quando não houver
|
|
5
|
+
* erro
|
|
6
|
+
*/
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Especifica componente que será renderizado quando houver
|
|
10
|
+
* erro
|
|
11
|
+
*/
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Evento disparado quando houver um erro
|
|
15
|
+
*/
|
|
16
|
+
onError?: (error: Error, info: any) => void | Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
shouldUpdate?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type State = {
|
|
23
|
+
hasError?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare class ErrorBoundary extends React.Component<Props, State> {
|
|
26
|
+
constructor(props: Props);
|
|
27
|
+
static getDerivedStateFromError(): {
|
|
28
|
+
hasError: boolean;
|
|
29
|
+
};
|
|
30
|
+
componentDidUpdate(prevProps: Props): void;
|
|
31
|
+
componentDidCatch(error: Error, info: any): void;
|
|
32
|
+
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IconColor, IconName } from '@freedom/react-icons';
|
|
2
|
+
export declare const CSS_PREFIX = "freedom-file-upload";
|
|
3
|
+
export declare const ITEM_ICON_CONFIG: Record<string, {
|
|
4
|
+
iconName: IconName;
|
|
5
|
+
iconColor: IconColor;
|
|
6
|
+
}>;
|
|
7
|
+
export type Unit = 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'ZB' | 'YB';
|
|
8
|
+
export declare const UNITS: Unit[];
|
|
9
|
+
export declare const KB_UNIT_INDEX = 1;
|
|
10
|
+
export declare const ONE_KB_BYTES = 1024;
|
|
11
|
+
export declare enum FILE_ERROR {
|
|
12
|
+
LIMIT_EXCEEDED = "Limite excedido",
|
|
13
|
+
SIZE_TOO_LARGE = "Arquivo muito grande",
|
|
14
|
+
INVALID_TYPE = "Tipo de arquivo inv\u00E1lido",
|
|
15
|
+
UPLOAD = "Falha no upload do arquivo"
|
|
16
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FILE_ERROR, Unit } from './FileUpload.constants';
|
|
2
|
+
import { UploadedFile } from './useFileUpload';
|
|
3
|
+
export type FileUploadProps<T> = {
|
|
4
|
+
/**
|
|
5
|
+
* URL da API para onde o BLOB dos arquivos serão enviados via POST.
|
|
6
|
+
*/
|
|
7
|
+
url: string;
|
|
8
|
+
/**
|
|
9
|
+
* Callback acionado sempre que a lista de arquivos enviados é atualizada.
|
|
10
|
+
* @param uploadResults array contendo as respostas da API para cada arquivo, incluindo erros e informações do arquivo.
|
|
11
|
+
*/
|
|
12
|
+
onUploadFiles: (uploadResults: UploadedFile<T>[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Título exibido no topo do componente de upload de arquivos.
|
|
15
|
+
* @default 'Carregar arquivos'
|
|
16
|
+
*/
|
|
17
|
+
title?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Tamanho máximo permitido para cada arquivo, usado em conjunto com `maxSizeUnity`
|
|
20
|
+
*/
|
|
21
|
+
maxSize?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Unidade de medida para `maxSize`, determinando o tamanho máximo permitido para cada arquivo.
|
|
24
|
+
* @default 'MB'
|
|
25
|
+
*/
|
|
26
|
+
maxSizeUnity?: Unit;
|
|
27
|
+
/**
|
|
28
|
+
* Lista de extensões de arquivos permitidos para upload.
|
|
29
|
+
*/
|
|
30
|
+
accept?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Quantidade máxima de arquivos que podem ser enviados.
|
|
33
|
+
* @default Infinity
|
|
34
|
+
*/
|
|
35
|
+
maxFiles?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Descrição personalizada exibida na parte superior do componente de upload de arquivos.
|
|
38
|
+
*/
|
|
39
|
+
description?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Configuração customizada para a requisição de upload, compatível com a interface `RequestInit` do Fetch API.
|
|
42
|
+
*/
|
|
43
|
+
requestConfig?: RequestInit;
|
|
44
|
+
/**
|
|
45
|
+
* Define uma lista de arquivos pré-carregados anteriormente
|
|
46
|
+
*/
|
|
47
|
+
defaultFiles?: FileItemProp<T>[];
|
|
48
|
+
/**
|
|
49
|
+
* Classes customizadas para o componente.
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Objeto de estilo para personalizar a aparência do container.
|
|
54
|
+
*/
|
|
55
|
+
style?: React.CSSProperties;
|
|
56
|
+
/**
|
|
57
|
+
* Define a largura do componente
|
|
58
|
+
*/
|
|
59
|
+
width?: string | number;
|
|
60
|
+
};
|
|
61
|
+
export type FileItemProp<T> = {
|
|
62
|
+
name: string;
|
|
63
|
+
extension: string;
|
|
64
|
+
data?: T;
|
|
65
|
+
};
|
|
66
|
+
export type FileItem = {
|
|
67
|
+
error?: FILE_ERROR;
|
|
68
|
+
extension: string;
|
|
69
|
+
file: File;
|
|
70
|
+
uploaded: boolean;
|
|
71
|
+
loading: boolean;
|
|
72
|
+
};
|
|
73
|
+
export declare function FileUpload<T>(props: FileUploadProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FileItem, FileItemProp, FileUploadProps } from './FileUpload';
|
|
2
|
+
import type { UploadedFileResponse } from './useUpload';
|
|
3
|
+
export declare function formatFileSize(fileSize: number): string;
|
|
4
|
+
export declare function getFileExtension(fileName: string): string;
|
|
5
|
+
type GetFileListArrayProps<T> = Pick<FileUploadProps<T>, 'maxSize' | 'maxSizeUnity' | 'accept' | 'maxFiles'> & {
|
|
6
|
+
files: File[];
|
|
7
|
+
selectedFilesCount: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function getFileListArray<T>({ files, selectedFilesCount, maxFiles, ...rest }: GetFileListArrayProps<T>): FileItem[];
|
|
10
|
+
export declare function getTotalFilesWithError(fileList: FileItem[]): number;
|
|
11
|
+
export declare function getFetchResponseData(response: Response): Promise<any>;
|
|
12
|
+
export declare function transformFilePropToUploadedFile<T>({ name, extension, data, }: FileItemProp<T>): UploadedFileResponse<T>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileItem, FileUploadProps } from './FileUpload';
|
|
2
|
+
import { FILE_ERROR } from './FileUpload.constants';
|
|
3
|
+
type FileUploadHeaderProps<T> = Pick<FileUploadProps<T>, 'accept' | 'description' | 'maxSize' | 'maxSizeUnity' | 'title' | 'maxFiles'> & {
|
|
4
|
+
files: FileItem[];
|
|
5
|
+
onClearErrors: (errorTypes: FILE_ERROR[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function FileUploadHeader<T>({ files, accept, description, maxSize, maxSizeUnity, title, onClearErrors, maxFiles, }: FileUploadHeaderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import type { FileUploadProps } from './FileUpload';
|
|
3
|
+
type FileUploadInputAreaProps<T> = Pick<FileUploadProps<T>, 'accept'> & {
|
|
4
|
+
onFilesChange: (files: FileList) => void;
|
|
5
|
+
enabledPickFiles: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function FileUploadInputArea<T>({ onFilesChange, accept, children, enabledPickFiles, }: PropsWithChildren<FileUploadInputAreaProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileItem } from './FileUpload';
|
|
2
|
+
type FileUploadItemProps = {
|
|
3
|
+
file: FileItem;
|
|
4
|
+
onDelete: (fileName: string) => void;
|
|
5
|
+
onRetryUpload: (file: FileItem) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function FileUploadItem({ file, onDelete, onRetryUpload, }: FileUploadItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileItem } from './FileUpload';
|
|
2
|
+
type FileUploadListProps = {
|
|
3
|
+
files: FileItem[];
|
|
4
|
+
onDelete: (fileName: string) => void;
|
|
5
|
+
onRetryUpload: (fileItem: FileItem) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function FileUploadList({ files, onDelete, onRetryUpload, }: FileUploadListProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { FILE_ERROR } from './FileUpload.constants';
|
|
3
|
+
import type { FileItem, FileUploadProps } from './FileUpload';
|
|
4
|
+
import { UploadedFileResponse } from './useUpload';
|
|
5
|
+
type FileUploadContextData = {
|
|
6
|
+
files: FileItem[];
|
|
7
|
+
enabledPickFiles: boolean;
|
|
8
|
+
handleAddFiles: (fileList: FileList) => void;
|
|
9
|
+
handleDeleteFile: (fileName: string) => void;
|
|
10
|
+
handleRetryFileUpload: (fileItem: FileItem) => void;
|
|
11
|
+
handleClearInvalidFiles: (errorTypes: FILE_ERROR[]) => void;
|
|
12
|
+
};
|
|
13
|
+
export type UploadedFile<T> = Omit<UploadedFileResponse<T>, 'file'> & {
|
|
14
|
+
file: {
|
|
15
|
+
name: string;
|
|
16
|
+
extension: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function useFileUpload(): FileUploadContextData;
|
|
20
|
+
export declare function FileUploadProvider<T>({ children, fileUploadProps, }: PropsWithChildren<{
|
|
21
|
+
fileUploadProps: FileUploadProps<T>;
|
|
22
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FileItem } from './FileUpload';
|
|
2
|
+
export type UploadedFileResponse<T> = {
|
|
3
|
+
/**
|
|
4
|
+
* Objeto de uso interno, contendo as informações relacionadas ao arquivo
|
|
5
|
+
*/
|
|
6
|
+
file: FileItem;
|
|
7
|
+
/**
|
|
8
|
+
* Corpo da resposta retornada pelo endpoint de upload dos arquivos
|
|
9
|
+
*/
|
|
10
|
+
data: T | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Status HTTP da requisição de upload do arquivo
|
|
13
|
+
*/
|
|
14
|
+
statusCode: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Erro da requisição de upload do arquivo
|
|
17
|
+
*/
|
|
18
|
+
error: {
|
|
19
|
+
code?: string;
|
|
20
|
+
message: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
};
|
|
23
|
+
export declare function useUpload<T>({ url, requestConfig, }: {
|
|
24
|
+
url: string;
|
|
25
|
+
requestConfig?: RequestInit;
|
|
26
|
+
}): {
|
|
27
|
+
handleUpload: (file: FileItem) => Promise<UploadedFileResponse<T>>;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SELECT_MULTI_OPTIONS_TO_SHOW = 3;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type FilterTag = {
|
|
3
|
+
label: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
};
|
|
6
|
+
export type FilterProps<T> = {
|
|
7
|
+
/**
|
|
8
|
+
* Componentes filhos. Para maior facilidade de uso do `Filter`, recomendamos
|
|
9
|
+
* usar os componentes que estão especificados na documentação e são acessados através
|
|
10
|
+
* de `Filter.ComponenteFilho`.
|
|
11
|
+
*/
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Evento disparado ao submeter o formulário.
|
|
15
|
+
*/
|
|
16
|
+
onSubmit?: (formData: T) => unknown;
|
|
17
|
+
/**
|
|
18
|
+
* Evento disparado ao limpar o formulário. O `formData` recebido é um objeto
|
|
19
|
+
* com os últimos valores presentes no formulario antes do reset.
|
|
20
|
+
*/
|
|
21
|
+
onClear?: (formData: T) => unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Indica se o formulário está em estado de loading.
|
|
24
|
+
*/
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Recebe uma listagem dos filtros ativos.
|
|
28
|
+
*/
|
|
29
|
+
activeFilters?: FilterTag[];
|
|
30
|
+
/**
|
|
31
|
+
* Controla o estado de abertura do filtro
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Função disparada ao expandir o filtro
|
|
36
|
+
*/
|
|
37
|
+
onExpand?: (nextValue: boolean) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Indica se o título deve ser exibido ou não.
|
|
40
|
+
*/
|
|
41
|
+
showTitle?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Define o container pai onde o dropdown menu criado será renderizado
|
|
44
|
+
* @default document.body
|
|
45
|
+
*/
|
|
46
|
+
containerRef?: React.RefObject<HTMLElement>;
|
|
47
|
+
/**
|
|
48
|
+
* Indica se o filtro deve fechar automaticamente após todas as buscas
|
|
49
|
+
*/
|
|
50
|
+
closeOnSubmit?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Indica se o filtro deve preservar os dados quando clicado em limpar
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
preserveDefaultValuesOnClear?: boolean;
|
|
56
|
+
};
|
|
57
|
+
export type FilterHandle = {
|
|
58
|
+
clearField: (key: string) => void;
|
|
59
|
+
refetch: () => Promise<void>;
|
|
60
|
+
};
|
|
61
|
+
export declare function FilterComponent<T extends Record<string, any>>({ children, onSubmit, onClear, loading, activeFilters: activeFiltersProps, onExpand, showTitle, containerRef, expanded: expandedProp, closeOnSubmit, preserveDefaultValuesOnClear, }: FilterProps<T>, forwardedRef: React.Ref<FilterHandle>): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare const Filter: (<T extends Record<string, any>>(props: FilterProps<T> & React.RefAttributes<FilterHandle>) => JSX.Element) & {
|
|
63
|
+
TextInput: typeof import("./Input/TextInput").FilterTextInput;
|
|
64
|
+
Select: typeof import("./Input/Select").FilterSelect;
|
|
65
|
+
DatePicker: typeof import("./Input/DatePicker").FilterDatePicker;
|
|
66
|
+
Switch: typeof import("./Input/Switch").FilterSwitch;
|
|
67
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DatePickerProps } from '../../DatePicker/DatePicker';
|
|
2
|
+
import { Rules } from './Rules';
|
|
3
|
+
type RequiredTextInputProps = Required<Pick<DatePickerProps, 'name'>>;
|
|
4
|
+
export declare function FilterDatePicker(props: DatePickerProps & RequiredTextInputProps & {
|
|
5
|
+
rules?: Rules;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type Rules = {
|
|
2
|
+
/**
|
|
3
|
+
* Determina se o input é obrigatório ou não, e caso falhe na validação
|
|
4
|
+
* irá exibir a mensagem `message` como um erro abaixo do input
|
|
5
|
+
* com o qual está relacionado.
|
|
6
|
+
*/
|
|
7
|
+
required?: {
|
|
8
|
+
value: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Determina o tamanho máximo, e caso falhe na validação
|
|
13
|
+
* irá exibir a mensagem `message` como um erro abaixo do input
|
|
14
|
+
* com o qual está relacionado.
|
|
15
|
+
*/
|
|
16
|
+
maxLength?: {
|
|
17
|
+
value: number;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Determina o tamanho mínimo, e caso falhe na validação
|
|
22
|
+
* irá exibir a mensagem `message` como um erro abaixo do input
|
|
23
|
+
* com o qual está relacionado.
|
|
24
|
+
*/
|
|
25
|
+
minLength?: {
|
|
26
|
+
value: number;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Determina padrão que o input deve obdecer, e caso falhe na validação
|
|
31
|
+
* irá exibir a mensagem `message` como um erro abaixo do input
|
|
32
|
+
* com o qual está relacionado.
|
|
33
|
+
*/
|
|
34
|
+
pattern?: {
|
|
35
|
+
value: RegExp;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Você pode passar uma função de callback diretamente para validar ou pode
|
|
40
|
+
* passar um objeto com múltiplas funções que serão utilizadas para validação.
|
|
41
|
+
*
|
|
42
|
+
* Para inputs que são objetos e arrays, é recomendável utilizar essa propriedade
|
|
43
|
+
* para validações, uma vez que as outras regras se aplicam principalmente aos tipos
|
|
44
|
+
* `string`, `number` e `boolean`.
|
|
45
|
+
*
|
|
46
|
+
* Caso a função de callback retorne true, significa que o input é valido, e caso
|
|
47
|
+
* retorne uma string com uma mensagem, essa mensagem será utiliza para exeibit uma
|
|
48
|
+
* mensagem de erro abaixo do input.
|
|
49
|
+
*/
|
|
50
|
+
validate?: ((value?: any) => true | string) | Record<string, (value?: any) => true | string>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Esse componente foi criado apenas para ser usado na documentação do storybook
|
|
54
|
+
* para podermos motrar uma tabela com as propriedades do tipoi `Rules`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function DumpWithRules(props: Rules): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SelectProps } from '../../Select/Select';
|
|
2
|
+
import { Rules } from './Rules';
|
|
3
|
+
type RequiredTextInputProps = Required<Pick<SelectProps, 'name'>>;
|
|
4
|
+
export declare function FilterSelect(props: SelectProps & RequiredTextInputProps & {
|
|
5
|
+
rules?: Rules;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SwitchProps } from '../../Switch/Switch';
|
|
2
|
+
type RequiredSwitchProps = Required<Pick<SwitchProps, 'name'>>;
|
|
3
|
+
export declare function FilterSwitch(props: SwitchProps & RequiredSwitchProps & {
|
|
4
|
+
compact?: boolean;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TextInputProps } from '../../TextInput/TextInput';
|
|
2
|
+
import { Rules } from './Rules';
|
|
3
|
+
type RequiredTextInputProps = Required<Pick<TextInputProps, 'name'>>;
|
|
4
|
+
export declare function FilterTextInput(props: TextInputProps & RequiredTextInputProps & {
|
|
5
|
+
rules?: Rules;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilterDatePicker } from './DatePicker';
|
|
2
|
+
import { FilterSelect } from './Select';
|
|
3
|
+
import { FilterSwitch } from './Switch';
|
|
4
|
+
import { FilterTextInput } from './TextInput';
|
|
5
|
+
export declare const Input: {
|
|
6
|
+
FilterTextInput: typeof FilterTextInput;
|
|
7
|
+
FilterSelect: typeof FilterSelect;
|
|
8
|
+
FilterDatePicker: typeof FilterDatePicker;
|
|
9
|
+
FilterSwitch: typeof FilterSwitch;
|
|
10
|
+
};
|