@openedx/paragon 23.14.1 → 23.14.3
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/README.md +80 -14
- package/dist/ActionRow/index.d.ts +18 -0
- package/dist/ActionRow/index.js +6 -24
- package/dist/ActionRow/index.js.map +1 -1
- package/dist/Alert/index.js +21 -24
- package/dist/Alert/index.js.map +1 -1
- package/dist/Annotation/index.d.ts +13 -0
- package/dist/Annotation/index.js +11 -30
- package/dist/Annotation/index.js.map +1 -1
- package/dist/Avatar/index.d.ts +11 -0
- package/dist/Avatar/index.js +7 -21
- package/dist/Avatar/index.js.map +1 -1
- package/dist/AvatarButton/index.d.ts +17 -0
- package/dist/AvatarButton/index.js +11 -33
- package/dist/AvatarButton/index.js.map +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.js +5 -6
- package/dist/Breadcrumb/BreadcrumbLink.js.map +1 -1
- package/dist/Breadcrumb/index.js +11 -12
- package/dist/Breadcrumb/index.js.map +1 -1
- package/dist/Bubble/index.d.ts +6 -2
- package/dist/Bubble/index.js +14 -39
- package/dist/Bubble/index.js.map +1 -1
- package/dist/Button/index.d.ts +42 -7
- package/dist/Button/index.js +43 -115
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/BaseCard.js +11 -12
- package/dist/Card/BaseCard.js.map +1 -1
- package/dist/Card/CardBody.js +9 -12
- package/dist/Card/CardBody.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarousel.js +13 -14
- package/dist/Card/CardCarousel/CardCarousel.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselHeader.js +4 -5
- package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselItems.js +3 -4
- package/dist/Card/CardCarousel/CardCarouselItems.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselProvider.js +7 -8
- package/dist/Card/CardCarousel/CardCarouselProvider.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselTitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselTitle.js.map +1 -1
- package/dist/Card/CardCarousel/messages.d.ts +13 -0
- package/dist/Card/CardCarousel/messages.js +4 -5
- package/dist/Card/CardCarousel/messages.js.map +1 -0
- package/dist/Card/CardContext.js +6 -7
- package/dist/Card/CardContext.js.map +1 -1
- package/dist/Card/CardDeck.js +9 -10
- package/dist/Card/CardDeck.js.map +1 -1
- package/dist/Card/CardDivider.js +8 -11
- package/dist/Card/CardDivider.js.map +1 -1
- package/dist/Card/CardFooter.js +9 -10
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardGrid.js +6 -7
- package/dist/Card/CardGrid.js.map +1 -1
- package/dist/Card/CardHeader.js +9 -10
- package/dist/Card/CardHeader.js.map +1 -1
- package/dist/Card/CardImageCap.js +15 -16
- package/dist/Card/CardImageCap.js.map +1 -1
- package/dist/Card/CardSection.js +9 -10
- package/dist/Card/CardSection.js.map +1 -1
- package/dist/Card/CardStatus.js +9 -10
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Card/index.js +9 -10
- package/dist/Card/index.js.map +1 -1
- package/dist/Chip/ChipIcon.js +8 -9
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.d.ts +22 -0
- package/dist/Chip/index.js +15 -70
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +49 -53
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/ChipCarousel/messages.d.ts +13 -0
- package/dist/ChipCarousel/messages.js +4 -5
- package/dist/ChipCarousel/messages.js.map +1 -0
- package/dist/CloseButton/index.js.map +1 -1
- package/dist/Collapse/index.js.map +1 -1
- package/dist/Collapsible/CollapsibleBody.js +6 -7
- package/dist/Collapsible/CollapsibleBody.js.map +1 -1
- package/dist/Collapsible/CollapsibleTrigger.js +9 -10
- package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
- package/dist/Collapsible/CollapsibleVisible.js +5 -6
- package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
- package/dist/ColorPicker/index.js +6 -7
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/Container/index.js +9 -12
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/BulkActions.js +4 -5
- package/dist/DataTable/BulkActions.js.map +1 -1
- package/dist/DataTable/CardView.js +16 -18
- package/dist/DataTable/CardView.js.map +1 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +5 -6
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/DataTableLayout.js +5 -6
- package/dist/DataTable/DataTableLayout.js.map +1 -1
- package/dist/DataTable/DropdownFilters.js +7 -2
- package/dist/DataTable/DropdownFilters.js.map +1 -1
- package/dist/DataTable/EmptyTable.js +5 -6
- package/dist/DataTable/EmptyTable.js.map +1 -1
- package/dist/DataTable/ExpandAll.js +4 -5
- package/dist/DataTable/ExpandAll.js.map +1 -1
- package/dist/DataTable/ExpandRow.js +3 -4
- package/dist/DataTable/ExpandRow.js.map +1 -1
- package/dist/DataTable/FilterStatus.js +8 -9
- package/dist/DataTable/FilterStatus.js.map +1 -1
- package/dist/DataTable/RowStatus.js +4 -5
- package/dist/DataTable/RowStatus.js.map +1 -1
- package/dist/DataTable/SidebarFilters.js +3 -4
- package/dist/DataTable/SidebarFilters.js.map +1 -1
- package/dist/DataTable/Table.js +3 -4
- package/dist/DataTable/Table.js.map +1 -1
- package/dist/DataTable/TableActions.js +3 -4
- package/dist/DataTable/TableActions.js.map +1 -1
- package/dist/DataTable/TableCell.js +5 -6
- package/dist/DataTable/TableCell.js.map +1 -1
- package/dist/DataTable/TableControlBar.js +3 -4
- package/dist/DataTable/TableControlBar.js.map +1 -1
- package/dist/DataTable/TableFilters.js +6 -7
- package/dist/DataTable/TableFilters.js.map +1 -1
- package/dist/DataTable/TableFooter.js +4 -5
- package/dist/DataTable/TableFooter.js.map +1 -1
- package/dist/DataTable/TableHeaderCell.js +13 -15
- package/dist/DataTable/TableHeaderCell.js.map +1 -1
- package/dist/DataTable/TableHeaderRow.js +3 -4
- package/dist/DataTable/TableHeaderRow.js.map +1 -1
- package/dist/DataTable/TableRow.js +3 -4
- package/dist/DataTable/TableRow.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js +25 -29
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.js +16 -20
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js +25 -29
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/TextFilter.js +8 -9
- package/dist/DataTable/filters/TextFilter.js.map +1 -1
- package/dist/DataTable/hooks.js +11 -13
- package/dist/DataTable/hooks.js.map +1 -1
- package/dist/DataTable/index.js +42 -36
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/messages.d.ts +13 -0
- package/dist/DataTable/messages.js +7 -3
- package/dist/DataTable/messages.js.map +1 -0
- package/dist/DataTable/selection/BaseSelectionStatus.js +11 -12
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelect.js +3 -4
- package/dist/DataTable/selection/ControlledSelect.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectHeader.js +3 -4
- package/dist/DataTable/selection/ControlledSelectHeader.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectionStatus.js +4 -5
- package/dist/DataTable/selection/ControlledSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/SelectionStatus.js +4 -5
- package/dist/DataTable/selection/SelectionStatus.js.map +1 -1
- package/dist/DataTable/utils/getVisibleColumns.js +9 -13
- package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
- package/dist/Dropdown/index.js +17 -20
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/DefaultContent.js +5 -6
- package/dist/Dropzone/DefaultContent.js.map +1 -1
- package/dist/Dropzone/DragError.js +3 -4
- package/dist/Dropzone/DragError.js.map +1 -1
- package/dist/Dropzone/GenericError.js +4 -5
- package/dist/Dropzone/GenericError.js.map +1 -1
- package/dist/Dropzone/UploadProgress.js +6 -7
- package/dist/Dropzone/UploadProgress.js.map +1 -1
- package/dist/Dropzone/index.js +14 -15
- package/dist/Dropzone/index.js.map +1 -1
- package/dist/Dropzone/messages.d.ts +53 -0
- package/dist/Dropzone/messages.js +12 -13
- package/dist/Dropzone/messages.js.map +1 -0
- package/dist/Fade/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +18 -20
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormAutosuggestOption.js +6 -7
- package/dist/Form/FormAutosuggestOption.js.map +1 -1
- package/dist/Form/FormCheckbox.js +16 -18
- package/dist/Form/FormCheckbox.js.map +1 -1
- package/dist/Form/FormCheckboxSet.js +11 -12
- package/dist/Form/FormCheckboxSet.js.map +1 -1
- package/dist/Form/FormCheckboxSetContext.js +9 -10
- package/dist/Form/FormCheckboxSetContext.js.map +1 -1
- package/dist/Form/FormControl.js +12 -13
- package/dist/Form/FormControl.js.map +1 -1
- package/dist/Form/FormControlDecorator.js +4 -5
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormControlDecoratorGroup.js +8 -9
- package/dist/Form/FormControlDecoratorGroup.js.map +1 -1
- package/dist/Form/FormControlFeedback.js +4 -5
- package/dist/Form/FormControlFeedback.js.map +1 -1
- package/dist/Form/FormControlFloatingLabel.js +3 -4
- package/dist/Form/FormControlFloatingLabel.js.map +1 -1
- package/dist/Form/FormControlSet.js +7 -8
- package/dist/Form/FormControlSet.js.map +1 -1
- package/dist/Form/FormGroup.js +9 -10
- package/dist/Form/FormGroup.js.map +1 -1
- package/dist/Form/FormGroupContext.js +7 -8
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormLabel.d.ts +2 -11
- package/dist/Form/FormLabel.js +5 -15
- package/dist/Form/FormLabel.js.map +1 -1
- package/dist/Form/FormRadio.js +28 -31
- package/dist/Form/FormRadio.js.map +1 -1
- package/dist/Form/FormRadioSet.js +11 -12
- package/dist/Form/FormRadioSet.js.map +1 -1
- package/dist/Form/FormRadioSetContext.js +9 -10
- package/dist/Form/FormRadioSetContext.js.map +1 -1
- package/dist/Form/FormSwitch.js +25 -29
- package/dist/Form/FormSwitch.js.map +1 -1
- package/dist/Form/FormText.js +16 -19
- package/dist/Form/FormText.js.map +1 -1
- package/dist/Form/fieldUtils.js +11 -22
- package/dist/Form/fieldUtils.js.map +1 -1
- package/dist/Form/useCheckboxSetValues.js +1 -2
- package/dist/Form/useCheckboxSetValues.js.map +1 -1
- package/dist/Hyperlink/index.js +17 -21
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.js +10 -11
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +8 -304
- package/dist/IconButton/index.js +21 -84
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButtonToggle/index.js +5 -6
- package/dist/IconButtonToggle/index.js.map +1 -1
- package/dist/Image/index.js.map +1 -1
- package/dist/Layout/index.js +4 -5
- package/dist/Layout/index.js.map +1 -1
- package/dist/Media/index.js.map +1 -1
- package/dist/Menu/MenuItem.js +8 -9
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Menu/SelectMenu.js +8 -9
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Menu/index.js +6 -7
- package/dist/Menu/index.js.map +1 -1
- package/dist/Modal/AlertModal.js +6 -7
- package/dist/Modal/AlertModal.js.map +1 -1
- package/dist/Modal/FullscreenModal.js +7 -8
- package/dist/Modal/FullscreenModal.js.map +1 -1
- package/dist/Modal/MarketingModal.js +9 -10
- package/dist/Modal/MarketingModal.js.map +1 -1
- package/dist/Modal/ModalCloseButton.js +5 -6
- package/dist/Modal/ModalCloseButton.js.map +1 -1
- package/dist/Modal/ModalContext.js +6 -7
- package/dist/Modal/ModalContext.js.map +1 -1
- package/dist/Modal/ModalDialog.d.ts +6 -65
- package/dist/Modal/ModalDialog.js +16 -81
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogBody.js +5 -6
- package/dist/Modal/ModalDialogBody.js.map +1 -1
- package/dist/Modal/ModalDialogFooter.js +5 -6
- package/dist/Modal/ModalDialogFooter.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.js +9 -12
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalDialogHero.js +5 -6
- package/dist/Modal/ModalDialogHero.js.map +1 -1
- package/dist/Modal/ModalDialogHeroBackground.js +6 -7
- package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
- package/dist/Modal/ModalDialogHeroContent.js +5 -6
- package/dist/Modal/ModalDialogHeroContent.js.map +1 -1
- package/dist/Modal/ModalDialogTitle.js +5 -6
- package/dist/Modal/ModalDialogTitle.js.map +1 -1
- package/dist/Modal/ModalLayer.d.ts +0 -25
- package/dist/Modal/ModalLayer.js +13 -35
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/ModalPopup.js +11 -12
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/PopperElement.js +7 -8
- package/dist/Modal/PopperElement.js.map +1 -1
- package/dist/Modal/StandardModal.js +7 -8
- package/dist/Modal/StandardModal.js.map +1 -1
- package/dist/OverflowScroll/OverflowScroll.js +12 -13
- package/dist/OverflowScroll/OverflowScroll.js.map +1 -1
- package/dist/OverflowScroll/OverflowScrollItems.js +3 -4
- package/dist/OverflowScroll/OverflowScrollItems.js.map +1 -1
- package/dist/Overlay/index.d.ts +2 -2
- package/dist/PageBanner/index.js +9 -10
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/Pagination/PaginationContext.js +12 -13
- package/dist/Pagination/PaginationContext.js.map +1 -1
- package/dist/Pagination/subcomponents/PageButton.js +3 -4
- package/dist/Pagination/subcomponents/PageButton.js.map +1 -1
- package/dist/Popover/index.js +11 -14
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.js +12 -13
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/CheckpointActionRow.js +10 -11
- package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
- package/dist/ProductTour/CheckpointBody.js +3 -4
- package/dist/ProductTour/CheckpointBody.js.map +1 -1
- package/dist/ProductTour/CheckpointHeader.js +7 -8
- package/dist/ProductTour/CheckpointHeader.js.map +1 -1
- package/dist/ProductTour/CheckpointTitle.js +6 -9
- package/dist/ProductTour/CheckpointTitle.js.map +1 -1
- package/dist/ProductTour/index.js +3 -4
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProductTour/messages.d.ts +23 -0
- package/dist/ProductTour/messages.js +6 -7
- package/dist/ProductTour/messages.js.map +1 -0
- package/dist/ProgressBar/index.js +11 -12
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ResponsiveEmbed/index.js.map +1 -1
- package/dist/Scrollable/index.js +4 -5
- package/dist/Scrollable/index.js.map +1 -1
- package/dist/SearchField/SearchFieldLabel.js +4 -5
- package/dist/SearchField/SearchFieldLabel.js.map +1 -1
- package/dist/SelectableBox/SelectableBoxSet.js +13 -14
- package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
- package/dist/SelectableBox/index.js +14 -15
- package/dist/SelectableBox/index.js.map +1 -1
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Spinner/index.d.ts +11 -0
- package/dist/Spinner/index.js +6 -17
- package/dist/Spinner/index.js.map +1 -1
- package/dist/Stack/index.js +12 -15
- package/dist/Stack/index.js.map +1 -1
- package/dist/StatefulButton/index.js +9 -10
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/Stepper/Stepper.js +4 -5
- package/dist/Stepper/Stepper.js.map +1 -1
- package/dist/Stepper/StepperActionRow.js +6 -7
- package/dist/Stepper/StepperActionRow.js.map +1 -1
- package/dist/Stepper/StepperContext.js +4 -5
- package/dist/Stepper/StepperContext.js.map +1 -1
- package/dist/Stepper/StepperHeader.js +23 -31
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.js +8 -9
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Stepper/StepperStep.js +10 -11
- package/dist/Stepper/StepperStep.js.map +1 -1
- package/dist/Sticky/index.js +8 -12
- package/dist/Sticky/index.js.map +1 -1
- package/dist/Tabs/index.js +8 -9
- package/dist/Tabs/index.js.map +1 -1
- package/dist/Toast/ToastContainer.js +3 -4
- package/dist/Toast/ToastContainer.js.map +1 -1
- package/dist/Toast/index.d.ts +20 -41
- package/dist/Toast/index.js +11 -48
- package/dist/Toast/index.js.map +1 -1
- package/dist/ToggleButton/index.js.map +1 -1
- package/dist/Tooltip/index.js +11 -14
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/Truncate/index.js +9 -10
- package/dist/Truncate/index.js.map +1 -1
- package/dist/asInput/index.js +9 -13
- package/dist/asInput/index.js.map +1 -1
- package/dist/hooks/useArrowKeyNavigationHook.js +17 -21
- package/dist/hooks/useArrowKeyNavigationHook.js.map +1 -1
- package/dist/hooks/useIsVisibleHook.js +4 -6
- package/dist/hooks/useIsVisibleHook.js.map +1 -1
- package/dist/hooks/useToggleHook.js +1 -3
- package/dist/hooks/useToggleHook.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/theme-urls.json +6 -6
- package/dist/utils/newId.js +1 -2
- package/dist/utils/newId.js.map +1 -1
- package/package.json +2 -2
- package/src/ActionRow/{index.jsx → index.tsx} +14 -22
- package/src/Annotation/{index.jsx → index.tsx} +15 -22
- package/src/Avatar/{index.jsx → index.tsx} +13 -19
- package/src/AvatarButton/{index.jsx → index.tsx} +23 -31
- package/src/Bubble/index.tsx +12 -32
- package/src/Button/index.tsx +68 -93
- package/src/Chip/index.tsx +26 -59
- package/src/CloseButton/index.tsx +1 -0
- package/src/Collapse/index.tsx +1 -0
- package/src/DataTable/DropdownFilters.jsx +9 -2
- package/src/DataTable/README.md +19 -18
- package/src/DataTable/index.jsx +6 -1
- package/src/DataTable/{messages.js → messages.ts} +5 -0
- package/src/DataTable/tests/DataTable.test.jsx +51 -1
- package/src/DataTable/tests/DropdownFilters.test.jsx +11 -7
- package/src/Fade/index.tsx +1 -0
- package/src/Form/FormLabel.tsx +2 -10
- package/src/IconButton/index.tsx +17 -81
- package/src/Image/index.tsx +2 -0
- package/src/Media/index.tsx +1 -0
- package/src/Modal/ModalDialog.tsx +6 -66
- package/src/Modal/ModalLayer.tsx +0 -22
- package/src/Modal/modal-popup.mdx +1 -1
- package/src/ProductTour/ProductTour.test.jsx +0 -1
- package/src/ResponsiveEmbed/index.tsx +1 -0
- package/src/Skeleton/index.tsx +1 -0
- package/src/Spinner/{index.jsx → index.tsx} +10 -15
- package/src/Toast/index.tsx +21 -40
- package/src/ToggleButton/index.tsx +2 -0
- package/src/index.ts +5 -10
- /package/{src/CloseButton/index.jsx → dist/CloseButton/index.d.ts} +0 -0
- /package/{src/Collapse/index.jsx → dist/Collapse/index.d.ts} +0 -0
- /package/{src/Fade/index.jsx → dist/Fade/index.d.ts} +0 -0
- /package/{src/Image/index.jsx → dist/Image/index.d.ts} +0 -0
- /package/{src/Media/index.jsx → dist/Media/index.d.ts} +0 -0
- /package/{src/ResponsiveEmbed/index.jsx → dist/ResponsiveEmbed/index.d.ts} +0 -0
- /package/{src/Skeleton/index.jsx → dist/Skeleton/index.d.ts} +0 -0
- /package/{src/ToggleButton/index.jsx → dist/ToggleButton/index.d.ts} +0 -0
- /package/src/Card/CardCarousel/{messages.js → messages.ts} +0 -0
- /package/src/ChipCarousel/{messages.js → messages.ts} +0 -0
- /package/src/Dropzone/{messages.js → messages.ts} +0 -0
- /package/src/ProductTour/{messages.js → messages.ts} +0 -0
- /package/src/Spinner/{Spinner.test.jsx → Spinner.test.tsx} +0 -0
- /package/src/Spinner/__snapshots__/{Spinner.test.jsx.snap → Spinner.test.tsx.snap} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVisibleColumns.js","names":["React","useMemo","useContext","useEffect","CheckboxControl","DataTableContext","useConvertIndeterminateProp","selectColumn","id","Header","
|
|
1
|
+
{"version":3,"file":"getVisibleColumns.js","names":["React","useMemo","useContext","useEffect","CheckboxControl","DataTableContext","useConvertIndeterminateProp","selectColumn","id","Header","getToggleAllPageRowsSelectedProps","getToggleAllRowsSelectedProps","page","isSelectable","maxSelectedRows","toggleRowsSelectedProps","getToggleRowsSelectedProps","updatedProps","formatMaxSelectedRows","Math","max","createElement","className","Cell","row","onMaxSelectedRows","state","selectedRowIds","selectedRowsOrdered","getToggleRowSelectedProps","index","isRowSelected","selectedRowsLength","Object","keys","length","hasMaxSelectedRows","disableCheck","lastRowSelected","disabled","disableSortBy","getVisibleColumns","visibleColumns","additionalColumns","manualSelectColumn","columns","push","concat"],"sources":["../../../src/DataTable/utils/getVisibleColumns.jsx"],"sourcesContent":["import React, { useMemo, useContext, useEffect } from 'react';\n\nimport { CheckboxControl } from '../../Form';\nimport DataTableContext from '../DataTableContext';\nimport useConvertIndeterminateProp from './useConvertIndeterminateProp';\n\nexport const selectColumn = {\n id: 'selection',\n // The header can use the table's getToggleAllPageRowsSelectedProps or getToggleAllRowsSelectedProps\n // method to render a checkbox. The method is determined based on whether pagination is enabled or\n // not (i.e., ``page`` is defined).\n // Proptypes disabled as these props are passed in separately\n /* eslint-disable-next-line react/prop-types */\n Header: ({ getToggleAllPageRowsSelectedProps, getToggleAllRowsSelectedProps, page }) => {\n const { isSelectable, maxSelectedRows } = useContext(DataTableContext);\n const toggleRowsSelectedProps = useMemo(\n () => {\n // determine if this selection is for an individual page or the entire table\n const getToggleRowsSelectedProps = page ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;\n return getToggleRowsSelectedProps();\n },\n [getToggleAllPageRowsSelectedProps, getToggleAllRowsSelectedProps, page],\n );\n const updatedProps = useConvertIndeterminateProp(toggleRowsSelectedProps);\n const formatMaxSelectedRows = Math.max(0, maxSelectedRows);\n\n if (isSelectable && formatMaxSelectedRows >= 0) {\n return null;\n }\n\n return (\n <div className=\"pgn__data-table__controlled-select\">\n <CheckboxControl\n {...updatedProps}\n data-testid=\"datatable-select-column-checkbox-header\"\n />\n </div>\n );\n },\n // The cell can use the individual row's getToggleRowSelectedProps method\n // to the render a checkbox\n // Proptypes disabled as this prop is passed in separately\n /* eslint-disable react/prop-types */\n Cell: ({ row }) => {\n const {\n isSelectable, maxSelectedRows, onMaxSelectedRows, state: { selectedRowIds, selectedRowsOrdered },\n } = useContext(DataTableContext);\n const updatedProps = useConvertIndeterminateProp(row.getToggleRowSelectedProps());\n const { index } = row;\n const isRowSelected = index in selectedRowIds;\n const selectedRowsLength = Object.keys(selectedRowIds).length;\n const formatMaxSelectedRows = Math.max(0, maxSelectedRows);\n const hasMaxSelectedRows = formatMaxSelectedRows === selectedRowsLength;\n const disableCheck = isSelectable && hasMaxSelectedRows && !isRowSelected;\n const lastRowSelected = selectedRowsOrdered?.[selectedRowsOrdered.length - 1] ?? null;\n\n useEffect(() => {\n if (hasMaxSelectedRows && lastRowSelected === index) {\n onMaxSelectedRows?.();\n }\n }, [hasMaxSelectedRows, index, isRowSelected, lastRowSelected, onMaxSelectedRows, selectedRowIds]);\n\n return (\n <div className=\"pgn__data-table__controlled-select\">\n <CheckboxControl\n {...updatedProps}\n disabled={disableCheck}\n data-testid=\"datatable-select-column-checkbox-cell\"\n />\n </div>\n );\n },\n /* eslint-enable react/prop-types */\n disableSortBy: true,\n};\n\nconst getVisibleColumns = (\n isSelectable,\n visibleColumns,\n additionalColumns = [],\n manualSelectColumn = selectColumn,\n) => {\n let columns = [];\n if (isSelectable) {\n columns.push(manualSelectColumn);\n }\n columns = columns.concat(visibleColumns);\n if (additionalColumns.length > 0) {\n columns = columns.concat(additionalColumns);\n }\n return columns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AAE;IAChBgC,OAAO,CAACC,IAAI,CAACF,kBAAkB,CAAC;EAClC;EACAC,OAAO,GAAGA,OAAO,CAACE,MAAM,CAACL,cAAc,CAAC;EACxC,IAAIC,iBAAiB,CAACR,MAAM,GAAG,CAAC,EAAE;IAChCU,OAAO,GAAGA,OAAO,CAACE,MAAM,CAACJ,iBAAiB,CAAC;EAC7C;EACA,OAAOE,OAAO;AAChB,CAAC;AAED,eAAeJ,iBAAiB","ignoreList":[]}
|
package/dist/Dropdown/index.js
CHANGED
|
@@ -9,15 +9,14 @@ import Button from '../Button';
|
|
|
9
9
|
import IconButton from '../IconButton';
|
|
10
10
|
const Dropdown = /*#__PURE__*/React.forwardRef(
|
|
11
11
|
// eslint-disable-next-line prefer-arrow-callback
|
|
12
|
-
function Dropdown(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
12
|
+
function Dropdown({
|
|
13
|
+
show,
|
|
14
|
+
autoClose,
|
|
15
|
+
onToggle,
|
|
16
|
+
variant,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
}, ref) {
|
|
21
20
|
const [internalShow, setInternalShow] = React.useState(show);
|
|
22
21
|
const isClosingPermitted = source => {
|
|
23
22
|
// autoClose=false only permits close on button click
|
|
@@ -78,12 +77,11 @@ Dropdown.defaultProps = {
|
|
|
78
77
|
};
|
|
79
78
|
const DropdownToggle = /*#__PURE__*/React.forwardRef(
|
|
80
79
|
// eslint-disable-next-line prefer-arrow-callback
|
|
81
|
-
function DropdownToggle(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} = _ref2;
|
|
80
|
+
function DropdownToggle({
|
|
81
|
+
as,
|
|
82
|
+
bsPrefix,
|
|
83
|
+
...otherProps
|
|
84
|
+
}, ref) {
|
|
87
85
|
// hide arrow from the toggle if it is rendered as IconButton
|
|
88
86
|
// because it hinders the positioning of IconButton
|
|
89
87
|
const prefix = as === IconButton ? 'pgn__dropdown-toggle-iconbutton' : bsPrefix;
|
|
@@ -108,11 +106,10 @@ DropdownToggle.defaultProps = {
|
|
|
108
106
|
};
|
|
109
107
|
Dropdown.Item = /*#__PURE__*/React.forwardRef(
|
|
110
108
|
// eslint-disable-next-line prefer-arrow-callback
|
|
111
|
-
function DropdownItem(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} = _ref3;
|
|
109
|
+
function DropdownItem({
|
|
110
|
+
className,
|
|
111
|
+
...otherProps
|
|
112
|
+
}, ref) {
|
|
116
113
|
return /*#__PURE__*/React.createElement(BaseDropdownItem, {
|
|
117
114
|
className: classNames(className, 'pgn__dropdown-item'),
|
|
118
115
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","BaseDropdown","DropdownMenu","BaseDropdownItem","BaseDropdownToggle","Button","IconButton","Dropdown","forwardRef","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","BaseDropdown","DropdownMenu","BaseDropdownItem","BaseDropdownToggle","Button","IconButton","Dropdown","forwardRef","show","autoClose","onToggle","variant","className","rest","ref","internalShow","setInternalShow","useState","isClosingPermitted","source","handleToggle","isOpen","event","metadata","currentTarget","document","key","createElement","propTypes","oneOfType","string","bool","func","oneOf","defaultProps","undefined","DropdownToggle","as","bsPrefix","otherProps","prefix","elementType","id","number","isRequired","Item","DropdownItem","Toggle","Menu","Header","Divider","default","DropdownButton","SplitButton"],"sources":["../../src/Dropdown/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseDropdown from 'react-bootstrap/Dropdown';\nimport DropdownMenu from 'react-bootstrap/DropdownMenu';\nimport BaseDropdownItem from 'react-bootstrap/DropdownItem';\nimport BaseDropdownToggle from 'react-bootstrap/DropdownToggle';\nimport Button from '../Button';\nimport IconButton from '../IconButton';\n\nconst Dropdown = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function Dropdown({\n show,\n autoClose,\n onToggle,\n variant,\n className,\n ...rest\n }, ref) {\n const [internalShow, setInternalShow] = React.useState(show);\n const isClosingPermitted = (source) => {\n // autoClose=false only permits close on button click\n if (autoClose === false) {\n return source === 'click';\n }\n // autoClose=inside doesn't permit close on rootClose\n if (autoClose === 'inside') {\n return source !== 'rootClose';\n }\n // autoClose=outside doesn't permit close on select\n if (autoClose === 'outside') {\n return source !== 'select';\n }\n return true;\n };\n\n const handleToggle = (isOpen, event, metadata) => {\n if (isOpen) {\n setInternalShow(true);\n onToggle?.(isOpen, event, metadata);\n return;\n }\n let { source } = { ...metadata };\n\n if (event.currentTarget === document && (source !== 'keydown' || event.key === 'Escape')) {\n source = 'rootClose';\n }\n if (isClosingPermitted(source)) {\n setInternalShow(false);\n onToggle?.(isOpen, event, metadata);\n }\n };\n\n return (\n <BaseDropdown\n className={classNames(\n 'pgn__dropdown',\n `pgn__dropdown-${variant}`,\n className,\n )}\n data-testid=\"dropdown\"\n onToggle={handleToggle}\n ref={ref}\n show={internalShow}\n {...rest}\n />\n );\n },\n);\n\nDropdown.propTypes = {\n autoClose: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.bool,\n ]),\n className: PropTypes.string,\n onToggle: PropTypes.func,\n show: PropTypes.bool,\n variant: PropTypes.oneOf(['light', 'dark']),\n};\n\nDropdown.defaultProps = {\n autoClose: true,\n className: '',\n onToggle: undefined,\n show: false,\n variant: 'light',\n};\n\nconst DropdownToggle = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function DropdownToggle({\n as,\n bsPrefix,\n ...otherProps\n }, ref) {\n // hide arrow from the toggle if it is rendered as IconButton\n // because it hinders the positioning of IconButton\n const prefix = as === IconButton ? 'pgn__dropdown-toggle-iconbutton' : bsPrefix;\n return <BaseDropdownToggle {...otherProps} as={as} bsPrefix={prefix} ref={ref} />;\n },\n);\n\nDropdownToggle.propTypes = {\n /** Specifies the base element. */\n as: PropTypes.elementType,\n /** Overrides underlying component base CSS class name. */\n bsPrefix: PropTypes.string,\n /** An html id attribute, necessary for assistive technologies, such as screen readers. */\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n};\n\nDropdownToggle.defaultProps = {\n as: Button,\n bsPrefix: 'dropdown-toggle',\n};\n\nDropdown.Item = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function DropdownItem({ className, ...otherProps }, ref) {\n return (\n <BaseDropdownItem\n className={classNames(className, 'pgn__dropdown-item')}\n ref={ref}\n {...otherProps}\n />\n );\n },\n);\n\nDropdown.Item.propTypes = {\n className: PropTypes.string,\n};\n\nDropdown.Item.defaultProps = {\n className: undefined,\n};\n\nDropdown.Toggle = DropdownToggle;\nDropdown.Menu = DropdownMenu;\nDropdown.Header = BaseDropdown.Header;\nDropdown.Divider = BaseDropdown.Divider;\n\nexport default Dropdown;\nexport { DropdownToggle };\nexport { default as DropdownButton } from 'react-bootstrap/DropdownButton';\nexport { default as SplitButton } from 'react-bootstrap/SplitButton';\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,YAAY,MAAM,0BAA0B;AACnD,OAAOC,YAAY,MAAM,8BAA8B;AACvD,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,kBAAkB,MAAM,gCAAgC;AAC/D,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAMC,QAAQ,gBAAGT,KAAK,CAACU,UAAU;AAC/B;AACA,SAASD,QAAQA,CAAC;EAChBE,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACT,GAAGC;AACL,CAAC,EAAEC,GAAG,EAAE;EACN,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGnB,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AEjC,MAAM;EACVkC,QAAQ,EAAE;AACZ,CAAC;AAEDhC,QAAQ,CAACuC,IAAI,gBAAGhD,KAAK,CAACU,UAAU;AAC9B;AACA,SAASuC,YAAYA,CAAC;EAAElC,SAAS;EAAE,GAAG2B;AAAW,CAAC,EAAEzB,GAAG,EAAE;EACvD,oBACEjB,KAAA,CAAA8B,aAAA,CAACzB,gBAAgB;IACfU,SAAS,EAAEd,UAAU,CAACc,SAAS,EAAE,oBAAoB,CAAE;IACvDE,GAAG,EAAEA,GAAI;IAAA,GACLyB;EAAU,CACf,CAAC;AAEN,CACF,CAAC;AAEDjC,QAAQ,CAACuC,IAAI,CAACjB,SAAS,GAAG;EACxBhB,SAAS,EAAEb,SAAS,CAAC+B;AACvB,CAAC;AAEDxB,QAAQ,CAACuC,IAAI,CAACX,YAAY,GAAG;EAC3BtB,SAAS,EAAEuB;AACb,CAAC;AAED7B,QAAQ,CAACyC,MAAM,GAAGX,cAAc;AAChC9B,QAAQ,CAAC0C,IAAI,GAAG/C,YAAY;AAC5BK,QAAQ,CAAC2C,MAAM,GAAGjD,YAAY,CAACiD,MAAM;AACrC3C,QAAQ,CAAC4C,OAAO,GAAGlD,YAAY,CAACkD,OAAO;AAEvC,eAAe5C,QAAQ;AACvB,SAAS8B,cAAc;AACvB,SAASe,OAAO,IAAIC,cAAc,QAAQ,gCAAgC;AAC1E,SAASD,OAAO,IAAIE,WAAW,QAAQ,6BAA6B","ignoreList":[]}
|
|
@@ -5,12 +5,11 @@ import { getTypesString, formatBytes } from './utils';
|
|
|
5
5
|
import messages from './messages';
|
|
6
6
|
import Icon from '../Icon';
|
|
7
7
|
import { FileUpload } from '../../icons';
|
|
8
|
-
function DefaultContent(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
8
|
+
function DefaultContent({
|
|
9
|
+
accept,
|
|
10
|
+
minSize,
|
|
11
|
+
maxSize
|
|
12
|
+
}) {
|
|
14
13
|
const intl = useIntl();
|
|
15
14
|
const getFileRestrictionMessage = () => {
|
|
16
15
|
let fileTypePart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultContent.js","names":["React","PropTypes","FormattedMessage","useIntl","getTypesString","formatBytes","messages","Icon","FileUpload","DefaultContent","
|
|
1
|
+
{"version":3,"file":"DefaultContent.js","names":["React","PropTypes","FormattedMessage","useIntl","getTypesString","formatBytes","messages","Icon","FileUpload","DefaultContent","accept","minSize","maxSize","intl","getFileRestrictionMessage","fileTypePart","fileSizePart","allTypes","lastTypeSeparatorLocation","lastIndexOf","formatMessage","fileTypeRestriction","count","firstPart","slice","secondPart","Number","isFinite","fileSizeBetween","sizeMin","sizeMax","fileSizeMax","fileSizeMin","createElement","Fragment","className","src","id","description","defaultMessage","some","value","propTypes","objectOf","arrayOf","string","number","defaultProps","undefined"],"sources":["../../src/Dropzone/DefaultContent.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormattedMessage, useIntl } from 'react-intl';\nimport { getTypesString, formatBytes } from './utils';\nimport messages from './messages';\nimport Icon from '../Icon';\nimport { FileUpload } from '../../icons';\n\nfunction DefaultContent({ accept, minSize, maxSize }) {\n const intl = useIntl();\n\n const getFileRestrictionMessage = () => {\n let fileTypePart;\n let fileSizePart;\n\n if (accept) {\n const allTypes = getTypesString(accept);\n const lastTypeSeparatorLocation = allTypes.lastIndexOf(',');\n fileTypePart = intl.formatMessage(messages.fileTypeRestriction, {\n count: lastTypeSeparatorLocation === -1 ? 1 : 2,\n firstPart: lastTypeSeparatorLocation === -1 ? allTypes : allTypes.slice(0, lastTypeSeparatorLocation),\n secondPart: lastTypeSeparatorLocation !== -1 && allTypes.slice(lastTypeSeparatorLocation + 1),\n });\n }\n\n if (minSize && maxSize && Number.isFinite(maxSize)) {\n fileSizePart = intl.formatMessage(messages.fileSizeBetween, {\n sizeMin: formatBytes(minSize),\n sizeMax: formatBytes(maxSize),\n });\n } else if (maxSize && Number.isFinite(maxSize)) {\n fileSizePart = intl.formatMessage(messages.fileSizeMax, { sizeMax: formatBytes(maxSize) });\n } else if (minSize) {\n fileSizePart = intl.formatMessage(messages.fileSizeMin, { sizeMin: formatBytes(minSize) });\n }\n\n if (fileTypePart && fileSizePart) {\n return `${fileTypePart} (${fileSizePart})`;\n }\n if (fileTypePart) {\n return fileTypePart;\n }\n return fileSizePart;\n };\n\n return (\n <>\n <div className=\"pgn__dropzone__upload-icon-wrapper\">\n <Icon src={FileUpload} className=\"pgn__dropzone__upload-icon\" />\n </div>\n <p>\n <FormattedMessage\n id=\"pgn.Dropzone.DefaultContent.label\"\n description=\"A text that appears as a label for input of Dropzone component.\"\n defaultMessage=\"Drag and drop your file here or click to upload.\"\n />\n </p>\n {[accept, minSize, maxSize].some(value => value) && (\n <p className=\"pgn__dropzone__upload-restriction-message\">\n {getFileRestrictionMessage()}\n </p>\n )}\n </>\n );\n}\n\nDefaultContent.propTypes = {\n accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),\n maxSize: PropTypes.number,\n minSize: PropTypes.number,\n};\n\nDefaultContent.defaultProps = {\n accept: undefined,\n maxSize: undefined,\n minSize: undefined,\n};\n\nexport default DefaultContent;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,gBAAgB,EAAEC,OAAO,QAAQ,YAAY;AACtD,SAASC,cAAc,EAAEC,WAAW,QAAQ,SAAS;AACrD,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,UAAU,QAAQ,aAAa;AAExC,SAASC,cAAcA,CAAC;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAQ,CAAC,EAAE;EACpD,MAAMC,IAAI,GAAGV,OAAO,CAAC,CAAC;EAEtB,MAAMW,yBAAyB,GAAGA,CAAA,KAAM;IACtC,IAAIC,YAAY;IAChB,IAAIC,YAAY;IAEhB,IAA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
-
|
|
6
|
-
} = _ref;
|
|
3
|
+
function DragError({
|
|
4
|
+
message
|
|
5
|
+
}) {
|
|
7
6
|
return /*#__PURE__*/React.createElement("div", {
|
|
8
7
|
className: "pgn__dropzone-error-wrapper"
|
|
9
8
|
}, message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragError.js","names":["React","PropTypes","DragError","
|
|
1
|
+
{"version":3,"file":"DragError.js","names":["React","PropTypes","DragError","message","createElement","className","propTypes","oneOfType","string","element","isRequired"],"sources":["../../src/Dropzone/DragError.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction DragError({ message }) {\n return (\n <div className=\"pgn__dropzone-error-wrapper\">\n {message}\n </div>\n );\n}\n\nDragError.propTypes = {\n message: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n};\n\nexport default DragError;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,SAASA,CAAC;EAAEC;AAAQ,CAAC,EAAE;EAC9B,oBACEH,KAAA,CAAAI,aAAA;IAAKC,SAAS,EAAC;EAA6B,GACzCF,OACE,CAAC;AAEV;AAEAD,SAAS,CAACI,SAAS,GAAG;EACpBH,OAAO,EAAEF,SAAS,CAACM,SAAS,CAAC,CAACN,SAAS,CAACO,MAAM,EAAEP,SAAS,CAACQ,OAAO,CAAC,CAAC,CAACC;AACtE,CAAC;AAED,eAAeR,SAAS","ignoreList":[]}
|
|
@@ -2,11 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Alert from '../Alert';
|
|
4
4
|
import { Info } from '../../icons';
|
|
5
|
-
function GenericError(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} = _ref;
|
|
5
|
+
function GenericError({
|
|
6
|
+
errorMsgs,
|
|
7
|
+
...rest
|
|
8
|
+
}) {
|
|
10
9
|
return /*#__PURE__*/React.createElement(Alert, {
|
|
11
10
|
variant: "danger",
|
|
12
11
|
icon: Info,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericError.js","names":["React","PropTypes","Alert","Info","GenericError","
|
|
1
|
+
{"version":3,"file":"GenericError.js","names":["React","PropTypes","Alert","Info","GenericError","errorMsgs","rest","createElement","variant","icon","className","map","msg","key","propTypes","arrayOf","string","isRequired"],"sources":["../../src/Dropzone/GenericError.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Alert from '../Alert';\nimport { Info } from '../../icons';\n\nfunction GenericError({ errorMsgs, ...rest }) {\n return (\n <Alert\n variant=\"danger\"\n icon={Info}\n className=\"pgn__dropzone-generic-alert\"\n {...rest}\n >\n {errorMsgs.map(msg => (\n <span key={msg}>{msg}</span>\n ))}\n </Alert>\n );\n}\n\nGenericError.propTypes = {\n errorMsgs: PropTypes.arrayOf(PropTypes.string).isRequired,\n};\n\nexport default GenericError;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,UAAU;AAC5B,SAASC,IAAI,QAAQ,aAAa;AAElC,SAASC,YAAYA,CAAC;EAAEC,SAAS;EAAE,GAAGC;AAAK,CAAC,EAAE;EAC5C,oBACEN,KAAA,CAAAO,aAAA,CAACL,KAAK;IACJM,OAAO,EAAC,QAAQ;IAChBC,IAAI,EAAEN,IAAK;IACXO,SAAS,EAAC,6BAA6B;IAAA,GACnCJ;EAAI,GAEPD,SAAS,CAACM,GAAG,CAACC,GAAG,iBAChBZ,KAAA,CAAAO,aAAA;IAAMM,GAAG,EAAED;EAAI,GAAEA,GAAU,CAC5B,CACI,CAAC;AAEZ;AAEAR,YAAY,CAACU,SAAS,GAAG;EACvBT,SAAS,EAAEJ,SAAS,CAACc,OAAO,CAACd,SAAS,CAACe,MAAM,CAAC,CAACC;AACjD,CAAC;AAED,eAAeb,YAAY","ignoreList":[]}
|
|
@@ -4,13 +4,12 @@ import { FormattedMessage } from 'react-intl';
|
|
|
4
4
|
import Button from '../Button';
|
|
5
5
|
import ProgressBar from '../ProgressBar';
|
|
6
6
|
import Spinner from '../Spinner';
|
|
7
|
-
function UploadProgress(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
7
|
+
function UploadProgress({
|
|
8
|
+
percent,
|
|
9
|
+
variant,
|
|
10
|
+
name,
|
|
11
|
+
onCancel
|
|
12
|
+
}) {
|
|
14
13
|
if (variant === 'spinner') {
|
|
15
14
|
return /*#__PURE__*/React.createElement(Spinner, {
|
|
16
15
|
animation: "border",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadProgress.js","names":["React","PropTypes","FormattedMessage","Button","ProgressBar","Spinner","UploadProgress","
|
|
1
|
+
{"version":3,"file":"UploadProgress.js","names":["React","PropTypes","FormattedMessage","Button","ProgressBar","Spinner","UploadProgress","percent","variant","name","onCancel","createElement","animation","screenReaderText","className","id","defaultMessage","description","values","filename","now","label","onClick","propTypes","oneOf","isRequired","number","string","func"],"sources":["../../src/Dropzone/UploadProgress.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormattedMessage } from 'react-intl';\nimport Button from '../Button';\nimport ProgressBar from '../ProgressBar';\nimport Spinner from '../Spinner';\n\nfunction UploadProgress({\n percent, variant, name, onCancel,\n}) {\n if (variant === 'spinner') {\n return (\n <Spinner\n animation=\"border\"\n aria-live=\"polite\"\n screenReaderText={`Uploading ${name}, ${percent}% done.`}\n data-testid=\"upload-spinner\"\n />\n );\n }\n\n return (\n <div className=\"w-50\">\n <p className=\"text-muted\">\n <FormattedMessage\n id=\"pgn.Dropzone.UploadProgress.uploadLabel\"\n defaultMessage=\"Uploading {filename}.\"\n description=\"A text that is shown near a progress bar during file upload in Dropzone component.\"\n values={{ filename: name }}\n />\n </p>\n <div className=\"d-flex justify-content-between align-items-center w-100\">\n <ProgressBar\n now={percent}\n label={`${percent}%`}\n variant=\"success\"\n className=\"flex-grow-1\"\n data-testid=\"upload-progress-bar\"\n />\n <Button variant=\"tertiary\" className=\"ml-3\" onClick={onCancel}>\n <FormattedMessage\n id=\"pgn.Dropzone.UploadProgress.cancelLabel\"\n defaultMessage=\"Cancel\"\n description=\"Label of a cancel button that is shown during file upload in Dropzone component.\"\n />\n </Button>\n </div>\n </div>\n );\n}\n\nUploadProgress.propTypes = {\n variant: PropTypes.oneOf(['spinner', 'bar']).isRequired,\n percent: PropTypes.number.isRequired,\n name: PropTypes.string.isRequired,\n onCancel: PropTypes.func.isRequired,\n};\n\nexport default UploadProgress;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,OAAO,MAAM,YAAY;AAEhC,SAASC,cAAcA,CAAC;EACtBC,OAAO;EAAEC,OAAO;EAAEC,IAAI;EAAEC;AAC1B,CAAC,EAAE;EACD,IAAIF,OAAO,KAAK,SAAS,EAAE;IACzB,oBACER,KAAA,CAAAW,aAAA,CAACN,OAAO;MACNO,SAAS,EAAC,QAAQ;MAClB,aAAU,QAAQ;MAClBC,gBAAgB,EAAE,aAAaJ,IAAI,KAAKF,OAAO,SAAU;MACzD,eAAY;IAAgB,CAC7B,CAAC;EAEN;EAEA,oBACEP,KAAA,CAAAW,aAAA;IAAKG,SAAS,EAAC;EAAM,gBACnBd,KAAA,CAAAW,aAAA;IAAGG,SAAS,EAAC;EAAY,gBACvBd,KAAA,CAAAW,aAAA,CAACT,gBAAgB;IACfa,EAAE,EAAC,yCAAyC;IAC5CC,cAAc,EAAC,uBAAuB;IACtCC,WAAW,EAAC,oFAAoF;IAChGC,MAAM,EAAE;MAAEC,QAAQ,EAAEV;IAAK;EAAE,CAC5B,CACA,CAAC,eACJT,KAAA,CAAAW,aAAA;IAAKG,SAAS,EAAC;EAAyD,gBACtEd,KAAA,CAAAW,aAAA,CAACP,WAAW;IACVgB,GAAG,EAAEb,OAAQ;IACbc,KAAK,EAAE,GAAGd,OAAO,GAAI;IACrBC,OAAO,EAAC,SAAS;IACjBM,SAAS,EAAC,aAAa;IACvB,eAAY;EAAqB,CAClC,CAAC,eACFd,KAAA,CAAAW,aAAA,CAACR,MAAM;IAACK,OAAO,EAAC,UAAU;IAACM,SAAS,EAAC,MAAM;IAACQ,OAAO,EAAEZ;EAAS,gBAC5DV,KAAA,CAAAW,aAAA,CAACT,gBAAgB;IACfa,EAAE,EAAC,yCAAyC;IAC5CC,cAAc,EAAC,QAAQ;IACvBC,WAAW,EAAC;EAAkF,CAC/F,CACK,CACL,CACF,CAAC;AAEV;AAEAX,cAAc,CAACiB,SAAS,GAAG;EACzBf,OAAO,EAAEP,SAAS,CAACuB,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAACC,UAAU;EACvDlB,OAAO,EAAEN,SAAS,CAACyB,MAAM,CAACD,UAAU;EACpChB,IAAI,EAAER,SAAS,CAAC0B,MAAM,CAACF,UAAU;EACjCf,QAAQ,EAAET,SAAS,CAAC2B,IAAI,CAACH;AAC3B,CAAC;AAED,eAAenB,cAAc","ignoreList":[]}
|
package/dist/Dropzone/index.js
CHANGED
|
@@ -10,21 +10,20 @@ import UploadProgress from './UploadProgress';
|
|
|
10
10
|
import DefaultContent from './DefaultContent';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
import { getTypesString, isMultipleTypes, formatBytes } from './utils';
|
|
13
|
-
function Dropzone(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
13
|
+
function Dropzone({
|
|
14
|
+
className,
|
|
15
|
+
accept,
|
|
16
|
+
minSize,
|
|
17
|
+
maxSize,
|
|
18
|
+
validator,
|
|
19
|
+
errorMessages,
|
|
20
|
+
progressVariant,
|
|
21
|
+
inputComponent,
|
|
22
|
+
onProcessUpload,
|
|
23
|
+
onUploadProgress,
|
|
24
|
+
onUploadCancel,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
28
27
|
const [isMultipleDragged, setIsMultipleDragged] = useState(false);
|
|
29
28
|
const [errors, setErrors] = useState([]);
|
|
30
29
|
const [progress, setProgress] = useState(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","PropTypes","classNames","useDropzone","ErrorCode","fromEvent","useIntl","DragError","GenericError","UploadProgress","DefaultContent","messages","getTypesString","isMultipleTypes","formatBytes","Dropzone","_ref","className","accept","minSize","maxSize","validator","errorMessages","progressVariant","inputComponent","onProcessUpload","onUploadProgress","onUploadCancel","props","isMultipleDragged","setIsMultipleDragged","errors","setErrors","progress","setProgress","fileName","setFileName","undefined","controller","setController","intl","uploadError","uploadErrorMsg","invalidSizeLess","invalidSizeLessMsg","invalidSizeMore","invalidSizeMoreMsg","invalidType","invalidTypeMsg","multipleDragged","multipleDraggedMsg","onDragEnter","e","files","length","onDragLeave","onDropRejected","map","error","code","FileTooLarge","formatMessage","size","FileTooSmall","FileInvalidType","count","typeString","unexpectedValidationError","handleProgressUpload","progressEvent","percentValue","Math","round","loaded","total","handleUploadError","processUpload","fileData","newController","AbortController","requestConfig","signal","handleError","onDropAccepted","file","customValidationError","formData","FormData","append","name","handleUploadCancel","abort","getRootProps","getInputProps","isDragActive","isDragReject","multiple","maxFiles","disabled","renderContent","createElement","message","Fragment","errorMsgs","variant","percent","onCancel","defaultProps","Infinity","propTypes","string","objectOf","arrayOf","number","func","isRequired","shape","oneOfType","element","oneOf","elementType","node"],"sources":["../../src/Dropzone/index.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useDropzone, ErrorCode } from 'react-dropzone';\nimport { fromEvent } from 'file-selector';\nimport { useIntl } from 'react-intl';\n\nimport DragError from './DragError';\nimport GenericError from './GenericError';\nimport UploadProgress from './UploadProgress';\nimport DefaultContent from './DefaultContent';\nimport messages from './messages';\nimport { getTypesString, isMultipleTypes, formatBytes } from './utils';\n\nfunction Dropzone({\n className, accept, minSize, maxSize, validator,\n errorMessages, progressVariant, inputComponent,\n onProcessUpload, onUploadProgress, onUploadCancel,\n ...props\n}) {\n const [isMultipleDragged, setIsMultipleDragged] = useState(false);\n const [errors, setErrors] = useState([]);\n const [progress, setProgress] = useState(0);\n const [fileName, setFileName] = useState(undefined);\n const [controller, setController] = useState(undefined);\n const intl = useIntl();\n\n const {\n uploadError: uploadErrorMsg,\n invalidSizeLess: invalidSizeLessMsg,\n invalidSizeMore: invalidSizeMoreMsg,\n invalidType: invalidTypeMsg,\n multipleDragged: multipleDraggedMsg,\n } = errorMessages;\n\n const onDragEnter = async (e) => {\n if (errors) {\n setErrors([]);\n }\n const files = await fromEvent(e);\n if (files && files.length > 1) {\n setIsMultipleDragged(true);\n }\n };\n\n const onDragLeave = () => {\n if (isMultipleDragged) {\n setIsMultipleDragged(false);\n }\n };\n\n const onDropRejected = (files) => {\n if (!isMultipleDragged) {\n setErrors(files[0].errors.map(error => {\n switch (error.code) {\n case ErrorCode.FileTooLarge:\n return invalidSizeMoreMsg || intl.formatMessage(messages.invalidSizeMore, { size: formatBytes(maxSize) });\n case ErrorCode.FileTooSmall:\n return invalidSizeLessMsg || intl.formatMessage(messages.invalidSizeLess, { size: formatBytes(minSize) });\n case ErrorCode.FileInvalidType:\n return invalidTypeMsg || intl.formatMessage(\n messages.invalidType,\n { count: isMultipleTypes(accept) ? 2 : 1, typeString: getTypesString(accept) },\n );\n default:\n return intl.formatMessage(messages.unexpectedValidationError);\n }\n }));\n } else {\n setIsMultipleDragged(false);\n }\n };\n\n const handleProgressUpload = (progressEvent) => {\n const percentValue = Math.round((progressEvent.loaded * 100) / progressEvent.total);\n setProgress(percentValue);\n onUploadProgress(percentValue, progressEvent);\n };\n\n const handleUploadError = (error) => {\n // check if request has been canceled before treating the exception as an upload error\n if (error.code !== 'ERR_CANCELED') {\n setProgress(0);\n setErrors([uploadErrorMsg || intl.formatMessage(messages.uploadError)]);\n }\n };\n\n const processUpload = (fileData) => {\n const newController = new AbortController();\n setController(newController);\n\n const requestConfig = {\n onUploadProgress: handleProgressUpload,\n signal: newController.signal,\n };\n\n onProcessUpload({\n fileData,\n requestConfig,\n handleError: handleUploadError,\n });\n };\n\n const onDropAccepted = async (files) => {\n const file = files[0];\n if (validator) {\n const customValidationError = await validator(file);\n if (customValidationError) {\n setErrors([customValidationError]);\n return;\n }\n }\n\n if (errors) {\n setErrors([]);\n }\n\n const formData = new FormData();\n formData.append('file', file);\n setFileName(file.name);\n\n processUpload(formData);\n };\n\n const handleUploadCancel = () => {\n controller.abort();\n setProgress(0);\n onUploadCancel();\n };\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragReject,\n } = useDropzone({\n multiple: false,\n maxFiles: 1,\n maxSize,\n minSize,\n onDragLeave,\n onDragEnter,\n onDropRejected,\n onDropAccepted,\n accept,\n disabled: progress && progress !== 100,\n });\n\n const renderContent = () => {\n if (isMultipleDragged) {\n return <DragError message={multipleDraggedMsg || intl.formatMessage(messages.multipleDragged)} />;\n }\n\n if (errors.length > 0) {\n return (\n <>\n <GenericError errorMsgs={errors} />\n {inputComponent || <DefaultContent minSize={minSize} maxSize={maxSize} accept={accept} />}\n </>\n );\n }\n\n if (progress && progress !== 100) {\n return (\n <UploadProgress\n variant={progressVariant}\n percent={progress}\n name={fileName}\n onCancel={handleUploadCancel}\n />\n );\n }\n\n return inputComponent || <DefaultContent minSize={minSize} maxSize={maxSize} accept={accept} />;\n };\n\n return (\n <div\n data-testid=\"dropzone-container\"\n {...getRootProps({\n className: classNames('pgn__dropzone', className, {\n 'pgn__dropzone-validation-error': isMultipleDragged || errors.length > 0 || isDragReject,\n 'pgn__dropzone-active': isDragActive && !isDragReject,\n }),\n })}\n {...props}\n >\n <input {...getInputProps()} />\n <div className=\"d-flex flex-column justify-content-around align-items-center w-100\">\n {renderContent()}\n </div>\n </div>\n );\n}\n\nDropzone.defaultProps = {\n className: undefined,\n accept: undefined,\n maxSize: Infinity,\n minSize: 0,\n onUploadProgress: () => {},\n onUploadCancel: () => {},\n errorMessages: {\n invalidType: undefined,\n invalidSizeLess: undefined,\n invalidSizeMore: undefined,\n multipleDragged: undefined,\n uploadError: undefined,\n },\n progressVariant: 'spinner',\n validator: undefined,\n inputComponent: undefined,\n};\n\nDropzone.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /**\n * Set accepted file types.\n * This should be an object with the keys set to the\n * [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)\n * and the values to an array of file extensions.\n */\n accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),\n /** Maximum file size (in bytes). */\n maxSize: PropTypes.number,\n /** Minimum file size (in bytes). */\n minSize: PropTypes.number,\n /**\n * A callback fired each time an upload progress event happens,\n * receives (percentageUploaded, progressEvent) as arguments.\n */\n onUploadProgress: PropTypes.func,\n /** A callback fired upon successful upload, receives Response object as a single argument. */\n onUploadCancel: PropTypes.func,\n /**\n * A function responsible for uploading the file.\n * Receives following object as its only argument\n * {\n * @param {object} fileData - Metadata about the uploaded file.\n * @param {object} requestConfig - Config to pass to `axios` call.\n * @param {function} handleError - Function to communicate to `Dropzone` that file upload resulted in failure,\n * expects `Error` object to be passed as its only argument.\n * }\n */\n onProcessUpload: PropTypes.func.isRequired,\n /**\n * An object containing error messages, following are supported:\n * 1) invalidType - A message to display when file of invalid type is dropped into `Dropzone`.\n * Defaults to 'The file type must be {filType} file / one of {fileTypes} files.'.\n * 2) invalidSizeLess - A message to display when file of size less than minSize value is dropped into `Dropzone`.\n * Defaults to 'File must be larger than {minSize}.'.\n * 3) invalidSizeMore - A message to display when file of size greater than maxSize value is dropped into `Dropzone`.\n * Defaults to 'File must be less than {maxSize}.'.\n * 4) multipleDragged - A message to display when multiple files are dragged over `Dropzone`.\n * 5) uploadError - A message to display in case upload results in an error\n */\n errorMessages: PropTypes.shape({\n invalidType: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n invalidSizeLess: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n invalidSizeMore: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n multipleDragged: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n uploadError: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n }),\n /** Specifies how the upload progress should be displayed, component shows either spinner or a progress bar. */\n progressVariant: PropTypes.oneOf(['spinner', 'bar']),\n /**\n * Custom validation function, receives `File` object as its only argument.\n * Note that this function will be invoked as a last validation step before beginning an upload process.\n */\n validator: PropTypes.func,\n /** A component to display initial state of the `Dropzone`. */\n inputComponent: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),\n};\n\nexport default Dropzone;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,WAAW,EAAEC,SAAS,QAAQ,gBAAgB;AACvD,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,OAAO,QAAQ,YAAY;AAEpC,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,cAAc,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAEtE,SAASC,QAAQA,CAAAC,IAAA,EAKd;EAAA,IALe;IAChBC,SA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H,WAAW,EAAEvH,SAAS,CAACwH,IAAI,CAAC;AAC7E,CAAC;AAED,eAAe1G,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","PropTypes","classNames","useDropzone","ErrorCode","fromEvent","useIntl","DragError","GenericError","UploadProgress","DefaultContent","messages","getTypesString","isMultipleTypes","formatBytes","Dropzone","className","accept","minSize","maxSize","validator","errorMessages","progressVariant","inputComponent","onProcessUpload","onUploadProgress","onUploadCancel","props","isMultipleDragged","setIsMultipleDragged","errors","setErrors","progress","setProgress","fileName","setFileName","undefined","controller","setController","intl","uploadError","uploadErrorMsg","invalidSizeLess","invalidSizeLessMsg","invalidSizeMore","invalidSizeMoreMsg","invalidType","invalidTypeMsg","multipleDragged","multipleDraggedMsg","onDragEnter","e","files","length","onDragLeave","onDropRejected","map","error","code","FileTooLarge","formatMessage","size","FileTooSmall","FileInvalidType","count","typeString","unexpectedValidationError","handleProgressUpload","progressEvent","percentValue","Math","round","loaded","total","handleUploadError","processUpload","fileData","newController","AbortController","requestConfig","signal","handleError","onDropAccepted","file","customValidationError","formData","FormData","append","name","handleUploadCancel","abort","getRootProps","getInputProps","isDragActive","isDragReject","multiple","maxFiles","disabled","renderContent","createElement","message","Fragment","errorMsgs","variant","percent","onCancel","defaultProps","Infinity","propTypes","string","objectOf","arrayOf","number","func","isRequired","shape","oneOfType","element","oneOf","elementType","node"],"sources":["../../src/Dropzone/index.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useDropzone, ErrorCode } from 'react-dropzone';\nimport { fromEvent } from 'file-selector';\nimport { useIntl } from 'react-intl';\n\nimport DragError from './DragError';\nimport GenericError from './GenericError';\nimport UploadProgress from './UploadProgress';\nimport DefaultContent from './DefaultContent';\nimport messages from './messages';\nimport { getTypesString, isMultipleTypes, formatBytes } from './utils';\n\nfunction Dropzone({\n className, accept, minSize, maxSize, validator,\n errorMessages, progressVariant, inputComponent,\n onProcessUpload, onUploadProgress, onUploadCancel,\n ...props\n}) {\n const [isMultipleDragged, setIsMultipleDragged] = useState(false);\n const [errors, setErrors] = useState([]);\n const [progress, setProgress] = useState(0);\n const [fileName, setFileName] = useState(undefined);\n const [controller, setController] = useState(undefined);\n const intl = useIntl();\n\n const {\n uploadError: uploadErrorMsg,\n invalidSizeLess: invalidSizeLessMsg,\n invalidSizeMore: invalidSizeMoreMsg,\n invalidType: invalidTypeMsg,\n multipleDragged: multipleDraggedMsg,\n } = errorMessages;\n\n const onDragEnter = async (e) => {\n if (errors) {\n setErrors([]);\n }\n const files = await fromEvent(e);\n if (files && files.length > 1) {\n setIsMultipleDragged(true);\n }\n };\n\n const onDragLeave = () => {\n if (isMultipleDragged) {\n setIsMultipleDragged(false);\n }\n };\n\n const onDropRejected = (files) => {\n if (!isMultipleDragged) {\n setErrors(files[0].errors.map(error => {\n switch (error.code) {\n case ErrorCode.FileTooLarge:\n return invalidSizeMoreMsg || intl.formatMessage(messages.invalidSizeMore, { size: formatBytes(maxSize) });\n case ErrorCode.FileTooSmall:\n return invalidSizeLessMsg || intl.formatMessage(messages.invalidSizeLess, { size: formatBytes(minSize) });\n case ErrorCode.FileInvalidType:\n return invalidTypeMsg || intl.formatMessage(\n messages.invalidType,\n { count: isMultipleTypes(accept) ? 2 : 1, typeString: getTypesString(accept) },\n );\n default:\n return intl.formatMessage(messages.unexpectedValidationError);\n }\n }));\n } else {\n setIsMultipleDragged(false);\n }\n };\n\n const handleProgressUpload = (progressEvent) => {\n const percentValue = Math.round((progressEvent.loaded * 100) / progressEvent.total);\n setProgress(percentValue);\n onUploadProgress(percentValue, progressEvent);\n };\n\n const handleUploadError = (error) => {\n // check if request has been canceled before treating the exception as an upload error\n if (error.code !== 'ERR_CANCELED') {\n setProgress(0);\n setErrors([uploadErrorMsg || intl.formatMessage(messages.uploadError)]);\n }\n };\n\n const processUpload = (fileData) => {\n const newController = new AbortController();\n setController(newController);\n\n const requestConfig = {\n onUploadProgress: handleProgressUpload,\n signal: newController.signal,\n };\n\n onProcessUpload({\n fileData,\n requestConfig,\n handleError: handleUploadError,\n });\n };\n\n const onDropAccepted = async (files) => {\n const file = files[0];\n if (validator) {\n const customValidationError = await validator(file);\n if (customValidationError) {\n setErrors([customValidationError]);\n return;\n }\n }\n\n if (errors) {\n setErrors([]);\n }\n\n const formData = new FormData();\n formData.append('file', file);\n setFileName(file.name);\n\n processUpload(formData);\n };\n\n const handleUploadCancel = () => {\n controller.abort();\n setProgress(0);\n onUploadCancel();\n };\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragReject,\n } = useDropzone({\n multiple: false,\n maxFiles: 1,\n maxSize,\n minSize,\n onDragLeave,\n onDragEnter,\n onDropRejected,\n onDropAccepted,\n accept,\n disabled: progress && progress !== 100,\n });\n\n const renderContent = () => {\n if (isMultipleDragged) {\n return <DragError message={multipleDraggedMsg || intl.formatMessage(messages.multipleDragged)} />;\n }\n\n if (errors.length > 0) {\n return (\n <>\n <GenericError errorMsgs={errors} />\n {inputComponent || <DefaultContent minSize={minSize} maxSize={maxSize} accept={accept} />}\n </>\n );\n }\n\n if (progress && progress !== 100) {\n return (\n <UploadProgress\n variant={progressVariant}\n percent={progress}\n name={fileName}\n onCancel={handleUploadCancel}\n />\n );\n }\n\n return inputComponent || <DefaultContent minSize={minSize} maxSize={maxSize} accept={accept} />;\n };\n\n return (\n <div\n data-testid=\"dropzone-container\"\n {...getRootProps({\n className: classNames('pgn__dropzone', className, {\n 'pgn__dropzone-validation-error': isMultipleDragged || errors.length > 0 || isDragReject,\n 'pgn__dropzone-active': isDragActive && !isDragReject,\n }),\n })}\n {...props}\n >\n <input {...getInputProps()} />\n <div className=\"d-flex flex-column justify-content-around align-items-center w-100\">\n {renderContent()}\n </div>\n </div>\n );\n}\n\nDropzone.defaultProps = {\n className: undefined,\n accept: undefined,\n maxSize: Infinity,\n minSize: 0,\n onUploadProgress: () => {},\n onUploadCancel: () => {},\n errorMessages: {\n invalidType: undefined,\n invalidSizeLess: undefined,\n invalidSizeMore: undefined,\n multipleDragged: undefined,\n uploadError: undefined,\n },\n progressVariant: 'spinner',\n validator: undefined,\n inputComponent: undefined,\n};\n\nDropzone.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /**\n * Set accepted file types.\n * This should be an object with the keys set to the\n * [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)\n * and the values to an array of file extensions.\n */\n accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),\n /** Maximum file size (in bytes). */\n maxSize: PropTypes.number,\n /** Minimum file size (in bytes). */\n minSize: PropTypes.number,\n /**\n * A callback fired each time an upload progress event happens,\n * receives (percentageUploaded, progressEvent) as arguments.\n */\n onUploadProgress: PropTypes.func,\n /** A callback fired upon successful upload, receives Response object as a single argument. */\n onUploadCancel: PropTypes.func,\n /**\n * A function responsible for uploading the file.\n * Receives following object as its only argument\n * {\n * @param {object} fileData - Metadata about the uploaded file.\n * @param {object} requestConfig - Config to pass to `axios` call.\n * @param {function} handleError - Function to communicate to `Dropzone` that file upload resulted in failure,\n * expects `Error` object to be passed as its only argument.\n * }\n */\n onProcessUpload: PropTypes.func.isRequired,\n /**\n * An object containing error messages, following are supported:\n * 1) invalidType - A message to display when file of invalid type is dropped into `Dropzone`.\n * Defaults to 'The file type must be {filType} file / one of {fileTypes} files.'.\n * 2) invalidSizeLess - A message to display when file of size less than minSize value is dropped into `Dropzone`.\n * Defaults to 'File must be larger than {minSize}.'.\n * 3) invalidSizeMore - A message to display when file of size greater than maxSize value is dropped into `Dropzone`.\n * Defaults to 'File must be less than {maxSize}.'.\n * 4) multipleDragged - A message to display when multiple files are dragged over `Dropzone`.\n * 5) uploadError - A message to display in case upload results in an error\n */\n errorMessages: PropTypes.shape({\n invalidType: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n invalidSizeLess: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n invalidSizeMore: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n multipleDragged: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n uploadError: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n }),\n /** Specifies how the upload progress should be displayed, component shows either spinner or a progress bar. */\n progressVariant: PropTypes.oneOf(['spinner', 'bar']),\n /**\n * Custom validation function, receives `File` object as its only argument.\n * Note that this function will be invoked as a last validation step before beginning an upload process.\n */\n validator: PropTypes.func,\n /** A component to display initial state of the `Dropzone`. */\n inputComponent: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),\n};\n\nexport default Dropzone;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,WAAW,EAAEC,SAAS,QAAQ,gBAAgB;AACvD,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,OAAO,QAAQ,YAAY;AAEpC,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,cAAc,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAEtE,SAASC,QAAQA,CAAC;EAChBC,SAAS;EAAEC,MAAM;EAAEC,OAAO;EAAEC,OAAO;EAAEC,SAAS;EAC9CC,aAAa;EAAEC,eAAe;EAAEC,cAAc;EAC9CC,eAAe;EAAEC,gBAAgB;EAAEC,cAAc;EACjD,GAAGC;AACL,CAAC,EAAE;EACD,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAG7B,QAAQ,CAAC,KAAK,CAAC;EACjE,MAAM,CAAC8B,MAAM,EAAEC,SAAS,CAAC,GAAG/B,QAAQ,CAAC,EAAE,CAAC;EACxC,MAAM,CAACgC,QAAQ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ACA;AACA;AACA;EACE7F,aAAa,EAAEpB,SAAS,CAACkH,KAAK,CAAC;IAC7BrE,WAAW,EAAE7C,SAAS,CAACmH,SAAS,CAAC,CAACnH,SAAS,CAAC4G,MAAM,EAAE5G,SAAS,CAACoH,OAAO,CAAC,CAAC;IACvE3E,eAAe,EAAEzC,SAAS,CAACmH,SAAS,CAAC,CAACnH,SAAS,CAAC4G,MAAM,EAAE5G,SAAS,CAACoH,OAAO,CAAC,CAAC;IAC3EzE,eAAe,EAAE3C,SAAS,CAACmH,SAAS,CAAC,CAACnH,SAAS,CAAC4G,MAAM,EAAE5G,SAAS,CAACoH,OAAO,CAAC,CAAC;IAC3ErE,eAAe,EAAE/C,SAAS,CAACmH,SAAS,CAAC,CAACnH,SAAS,CAAC4G,MAAM,EAAE5G,SAAS,CAACoH,OAAO,CAAC,CAAC;IAC3E7E,WAAW,EAAEvC,SAAS,CAACmH,SAAS,CAAC,CAACnH,SAAS,CAAC4G,MAAM,EAAE5G,SAAS,CAACoH,OAAO,CAAC;EACxE,CAAC,CAAC;EACF;EACA/F,eAAe,EAAErB,SAAS,CAACqH,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;EACpD;AACF;AACA;AACA;EACElG,SAAS,EAAEnB,SAAS,CAACgH,IAAI;EACzB;EACA1F,cAAc,EAAEtB,SAAS,CAACmH,SAAS,CAAC,CAACnH,SAAS,CAACsH,WAAW,EAAEtH,SAAS,CAACuH,IAAI,CAAC;AAC7E,CAAC;AAED,eAAezG,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
uploadError: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
multipleDragged: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
invalidSizeLess: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
invalidSizeMore: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
invalidType: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
unexpectedValidationError: {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
fileSizeBetween: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
fileSizeMax: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
fileSizeMin: {
|
|
43
|
+
id: string;
|
|
44
|
+
defaultMessage: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
fileTypeRestriction: {
|
|
48
|
+
id: string;
|
|
49
|
+
defaultMessage: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export default messages;
|
|
@@ -1,56 +1,55 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
2
|
const messages = defineMessages({
|
|
4
3
|
uploadError: {
|
|
5
4
|
id: 'dropzone.Dropzone.uploadError',
|
|
6
5
|
defaultMessage: 'A problem occured while uploading your file. Please try again.',
|
|
7
|
-
description: 'A message shown in case file upload in Dropzone component results in an error.'
|
|
6
|
+
description: 'A message shown in case file upload in Dropzone component results in an error.'
|
|
8
7
|
},
|
|
9
8
|
multipleDragged: {
|
|
10
9
|
id: 'dropzone.Dropzone.multipleDraggedError',
|
|
11
10
|
defaultMessage: 'Only one upload permitted.',
|
|
12
|
-
description: 'A message shown when multiple files are dragged over Dropzone.'
|
|
11
|
+
description: 'A message shown when multiple files are dragged over Dropzone.'
|
|
13
12
|
},
|
|
14
13
|
invalidSizeLess: {
|
|
15
14
|
id: 'dropzone.Dropzone.invalidSizeLessError',
|
|
16
15
|
defaultMessage: 'File must be larger than {size}.',
|
|
17
|
-
description: 'A message shown when a file with less than minimum allowed size is being uploaded in Dropzone.'
|
|
16
|
+
description: 'A message shown when a file with less than minimum allowed size is being uploaded in Dropzone.'
|
|
18
17
|
},
|
|
19
18
|
invalidSizeMore: {
|
|
20
19
|
id: 'dropzone.Dropzone.invalidSizeMoreError',
|
|
21
20
|
defaultMessage: 'File must be less than {size}.',
|
|
22
|
-
description: 'A message shown when a file with more than maximum allowed size is being uploaded in Dropzone.'
|
|
21
|
+
description: 'A message shown when a file with more than maximum allowed size is being uploaded in Dropzone.'
|
|
23
22
|
},
|
|
24
23
|
invalidType: {
|
|
25
24
|
id: 'dropzone.Dropzone.invalidType',
|
|
26
25
|
defaultMessage: 'The file type must be {count, plural, one {{typeString} file} other {one of {typeString} files}}.',
|
|
27
|
-
description: 'A message shown when a file with wrong MIME type is being uploaded.'
|
|
26
|
+
description: 'A message shown when a file with wrong MIME type is being uploaded.'
|
|
28
27
|
},
|
|
29
28
|
unexpectedValidationError: {
|
|
30
29
|
id: 'dropzone.Dropzone.unexpectedValidationError',
|
|
31
30
|
defaultMessage: 'An unexpected problem occured during file validation. Please try again.',
|
|
32
|
-
description: 'A message shown in case file validation in Dropzone component for unknown reason.'
|
|
31
|
+
description: 'A message shown in case file validation in Dropzone component for unknown reason.'
|
|
33
32
|
},
|
|
34
33
|
fileSizeBetween: {
|
|
35
34
|
id: 'pgn.Dropzone.DefaultContent.fileSizeBetween',
|
|
36
35
|
defaultMessage: 'Between {sizeMin} and {sizeMax}',
|
|
37
|
-
description: "A message shown when uploaded file's size must be in given range."
|
|
36
|
+
description: "A message shown when uploaded file's size must be in given range."
|
|
38
37
|
},
|
|
39
38
|
fileSizeMax: {
|
|
40
39
|
id: 'pgn.Dropzone.DefaultContent.fileSizeMax',
|
|
41
40
|
defaultMessage: 'Max {sizeMax}',
|
|
42
|
-
description: "A message shown when uploaded file's size must be more than some value."
|
|
41
|
+
description: "A message shown when uploaded file's size must be more than some value."
|
|
43
42
|
},
|
|
44
43
|
fileSizeMin: {
|
|
45
44
|
id: 'pgn.Dropzone.DefaultContent.fileSizeMin',
|
|
46
45
|
defaultMessage: 'Min {sizeMin}',
|
|
47
|
-
description: "A message shown when uploaded file's size must be more than some value."
|
|
46
|
+
description: "A message shown when uploaded file's size must be more than some value."
|
|
48
47
|
},
|
|
49
48
|
fileTypeRestriction: {
|
|
50
49
|
id: 'pgn.Dropzone.DefaultContent.fileTypeRestriction',
|
|
51
50
|
defaultMessage: 'Upload {count, plural, one {{firstPart} files} other {{firstPart} or {secondPart} files}}',
|
|
52
|
-
description: 'A message shown when uploaded file must be of certain type(s).'
|
|
53
|
-
}
|
|
51
|
+
description: 'A message shown when uploaded file must be of certain type(s).'
|
|
52
|
+
}
|
|
54
53
|
});
|
|
55
|
-
|
|
56
54
|
export default messages;
|
|
55
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":["defineMessages","messages","uploadError","id","defaultMessage","description","multipleDragged","invalidSizeLess","invalidSizeMore","invalidType","unexpectedValidationError","fileSizeBetween","fileSizeMax","fileSizeMin","fileTypeRestriction"],"sources":["../../src/Dropzone/messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nconst messages = defineMessages({\n uploadError: {\n id: 'dropzone.Dropzone.uploadError',\n defaultMessage: 'A problem occured while uploading your file. Please try again.',\n description: 'A message shown in case file upload in Dropzone component results in an error.',\n },\n multipleDragged: {\n id: 'dropzone.Dropzone.multipleDraggedError',\n defaultMessage: 'Only one upload permitted.',\n description: 'A message shown when multiple files are dragged over Dropzone.',\n },\n invalidSizeLess: {\n id: 'dropzone.Dropzone.invalidSizeLessError',\n defaultMessage: 'File must be larger than {size}.',\n description: 'A message shown when a file with less than minimum allowed size is being uploaded in Dropzone.',\n },\n invalidSizeMore: {\n id: 'dropzone.Dropzone.invalidSizeMoreError',\n defaultMessage: 'File must be less than {size}.',\n description: 'A message shown when a file with more than maximum allowed size is being uploaded in Dropzone.',\n },\n invalidType: {\n id: 'dropzone.Dropzone.invalidType',\n defaultMessage: 'The file type must be {count, plural, one {{typeString} file} other {one of {typeString} files}}.',\n description: 'A message shown when a file with wrong MIME type is being uploaded.',\n },\n unexpectedValidationError: {\n id: 'dropzone.Dropzone.unexpectedValidationError',\n defaultMessage: 'An unexpected problem occured during file validation. Please try again.',\n description: 'A message shown in case file validation in Dropzone component for unknown reason.',\n },\n fileSizeBetween: {\n id: 'pgn.Dropzone.DefaultContent.fileSizeBetween',\n defaultMessage: 'Between {sizeMin} and {sizeMax}',\n description: \"A message shown when uploaded file's size must be in given range.\",\n },\n fileSizeMax: {\n id: 'pgn.Dropzone.DefaultContent.fileSizeMax',\n defaultMessage: 'Max {sizeMax}',\n description: \"A message shown when uploaded file's size must be more than some value.\",\n },\n fileSizeMin: {\n id: 'pgn.Dropzone.DefaultContent.fileSizeMin',\n defaultMessage: 'Min {sizeMin}',\n description: \"A message shown when uploaded file's size must be more than some value.\",\n },\n fileTypeRestriction: {\n id: 'pgn.Dropzone.DefaultContent.fileTypeRestriction',\n defaultMessage: 'Upload {count, plural, one {{firstPart} files} other {{firstPart} or {secondPart} files}}',\n description: 'A message shown when uploaded file must be of certain type(s).',\n },\n});\n\nexport default messages;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAE3C,MAAMC,QAAQ,GAAGD,cAAc,CAAC;EAC9BE,WAAW,EAAE;IACXC,EAAE,EAAE,+BAA+B;IACnCC,cAAc,EAAE,gEAAgE;IAChFC,WAAW,EAAE;EACf,CAAC;EACDC,eAAe,EAAE;IACfH,EAAE,EAAE,wCAAwC;IAC5CC,cAAc,EAAE,4BAA4B;IAC5CC,WAAW,EAAE;EACf,CAAC;EACDE,eAAe,EAAE;IACfJ,EAAE,EAAE,wCAAwC;IAC5CC,cAAc,EAAE,kCAAkC;IAClDC,WAAW,EAAE;EACf,CAAC;EACDG,eAAe,EAAE;IACfL,EAAE,EAAE,wCAAwC;IAC5CC,cAAc,EAAE,gCAAgC;IAChDC,WAAW,EAAE;EACf,CAAC;EACDI,WAAW,EAAE;IACXN,EAAE,EAAE,+BAA+B;IACnCC,cAAc,EAAE,mGAAmG;IACnHC,WAAW,EAAE;EACf,CAAC;EACDK,yBAAyB,EAAE;IACzBP,EAAE,EAAE,6CAA6C;IACjDC,cAAc,EAAE,yEAAyE;IACzFC,WAAW,EAAE;EACf,CAAC;EACDM,eAAe,EAAE;IACfR,EAAE,EAAE,6CAA6C;IACjDC,cAAc,EAAE,iCAAiC;IACjDC,WAAW,EAAE;EACf,CAAC;EACDO,WAAW,EAAE;IACXT,EAAE,EAAE,yCAAyC;IAC7CC,cAAc,EAAE,eAAe;IAC/BC,WAAW,EAAE;EACf,CAAC;EACDQ,WAAW,EAAE;IACXV,EAAE,EAAE,yCAAyC;IAC7CC,cAAc,EAAE,eAAe;IAC/BC,WAAW,EAAE;EACf,CAAC;EACDS,mBAAmB,EAAE;IACnBX,EAAE,EAAE,iDAAiD;IACrDC,cAAc,EAAE,2FAA2F;IAC3GC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,eAAeJ,QAAQ","ignoreList":[]}
|
package/dist/Fade/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/Fade/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/Fade/index.tsx"],"sourcesContent":["export { default } from 'react-bootstrap/Fade';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,sBAAsB","ignoreList":[]}
|