@openedx/paragon 21.12.1 → 21.12.2
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/dist/ActionRow/index.js +7 -8
- package/dist/ActionRow/index.js.map +1 -1
- package/dist/Alert/index.js +33 -25
- package/dist/Alert/index.js.map +1 -1
- package/dist/Annotation/index.js +7 -9
- package/dist/Annotation/index.js.map +1 -1
- package/dist/Avatar/index.js +5 -7
- package/dist/Avatar/index.js.map +1 -1
- package/dist/AvatarButton/index.js +10 -12
- package/dist/AvatarButton/index.js.map +1 -1
- package/dist/Badge/index.js +6 -4
- package/dist/Badge/index.js.map +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.js +11 -14
- package/dist/Breadcrumb/BreadcrumbLink.js.map +1 -1
- package/dist/Breadcrumb/index.js +29 -29
- package/dist/Breadcrumb/index.js.map +1 -1
- package/dist/Bubble/index.js +11 -13
- package/dist/Bubble/index.js.map +1 -1
- package/dist/Button/deprecated/index.js +87 -66
- package/dist/Button/deprecated/index.js.map +1 -1
- package/dist/Button/index.js +10 -11
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/CardBody.js +4 -6
- package/dist/Card/CardBody.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarousel.js +11 -13
- package/dist/Card/CardCarousel/CardCarousel.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselControls.js +6 -7
- package/dist/Card/CardCarousel/CardCarouselControls.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselHeader.js +9 -12
- package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselItems.js +6 -9
- package/dist/Card/CardCarousel/CardCarouselItems.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselProvider.js +27 -28
- package/dist/Card/CardCarousel/CardCarouselProvider.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js +4 -6
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselTitle.js +4 -6
- package/dist/Card/CardCarousel/CardCarouselTitle.js.map +1 -1
- package/dist/Card/CardContext.js +8 -10
- package/dist/Card/CardContext.js.map +1 -1
- package/dist/Card/CardDeck.js +19 -17
- package/dist/Card/CardDeck.js.map +1 -1
- package/dist/Card/CardDivider.js +3 -5
- package/dist/Card/CardDivider.js.map +1 -1
- package/dist/Card/CardFooter.js +15 -18
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardGrid.js +13 -11
- package/dist/Card/CardGrid.js.map +1 -1
- package/dist/Card/CardHeader.js +17 -22
- package/dist/Card/CardHeader.js.map +1 -1
- package/dist/Card/CardImageCap.js +48 -33
- package/dist/Card/CardImageCap.js.map +1 -1
- package/dist/Card/CardSection.js +11 -14
- package/dist/Card/CardSection.js.map +1 -1
- package/dist/Card/CardStatus.js +11 -14
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Card/index.js +18 -20
- package/dist/Card/index.js.map +1 -1
- package/dist/Carousel/index.js +17 -11
- package/dist/Carousel/index.js.map +1 -1
- package/dist/CheckBox/index.js +66 -36
- package/dist/CheckBox/index.js.map +1 -1
- package/dist/Chip/index.js +14 -16
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +29 -30
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/Collapsible/CollapsibleAdvanced.js +82 -62
- package/dist/Collapsible/CollapsibleAdvanced.js.map +1 -1
- package/dist/Collapsible/CollapsibleBody.js +13 -15
- package/dist/Collapsible/CollapsibleBody.js.map +1 -1
- package/dist/Collapsible/CollapsibleTrigger.js +18 -20
- package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
- package/dist/Collapsible/CollapsibleVisible.js +6 -9
- package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
- package/dist/Collapsible/index.js +17 -18
- package/dist/Collapsible/index.js.map +1 -1
- package/dist/ColorPicker/index.js +58 -33
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/Container/index.js +8 -9
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/ActionDisplay.js +8 -9
- package/dist/DataTable/ActionDisplay.js.map +1 -1
- package/dist/DataTable/BulkActions.js +23 -20
- package/dist/DataTable/BulkActions.js.map +1 -1
- package/dist/DataTable/CardView.js +46 -43
- package/dist/DataTable/CardView.js.map +1 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +57 -39
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/DataTableContext.js +1 -1
- package/dist/DataTable/DataTableContext.js.map +1 -1
- package/dist/DataTable/DataTableLayout.js +6 -9
- package/dist/DataTable/DataTableLayout.js.map +1 -1
- package/dist/DataTable/DataViewToggle.js +25 -20
- package/dist/DataTable/DataViewToggle.js.map +1 -1
- package/dist/DataTable/DropdownFilters.js +41 -28
- package/dist/DataTable/DropdownFilters.js.map +1 -1
- package/dist/DataTable/EmptyTable.js +6 -9
- package/dist/DataTable/EmptyTable.js.map +1 -1
- package/dist/DataTable/ExpandAll.js +2 -4
- package/dist/DataTable/ExpandAll.js.map +1 -1
- package/dist/DataTable/ExpandRow.js +2 -4
- package/dist/DataTable/ExpandRow.js.map +1 -1
- package/dist/DataTable/FilterStatus.js +18 -17
- package/dist/DataTable/FilterStatus.js.map +1 -1
- package/dist/DataTable/RowStatus.js +15 -18
- package/dist/DataTable/RowStatus.js.map +1 -1
- package/dist/DataTable/SidebarFilters.js +16 -13
- package/dist/DataTable/SidebarFilters.js.map +1 -1
- package/dist/DataTable/SmartStatus.js +14 -16
- package/dist/DataTable/SmartStatus.js.map +1 -1
- package/dist/DataTable/Table.js +17 -19
- package/dist/DataTable/Table.js.map +1 -1
- package/dist/DataTable/TableActions.js +11 -13
- package/dist/DataTable/TableActions.js.map +1 -1
- package/dist/DataTable/TableCell.js +6 -10
- package/dist/DataTable/TableCell.js.map +1 -1
- package/dist/DataTable/TableControlBar.js +7 -12
- package/dist/DataTable/TableControlBar.js.map +1 -1
- package/dist/DataTable/TableFilters.js +14 -12
- package/dist/DataTable/TableFilters.js.map +1 -1
- package/dist/DataTable/TableFooter.js +5 -8
- package/dist/DataTable/TableFooter.js.map +1 -1
- package/dist/DataTable/TableHeaderCell.js +11 -15
- package/dist/DataTable/TableHeaderCell.js.map +1 -1
- package/dist/DataTable/TableHeaderRow.js +6 -4
- package/dist/DataTable/TableHeaderRow.js.map +1 -1
- package/dist/DataTable/TablePagination.js +8 -7
- package/dist/DataTable/TablePagination.js.map +1 -1
- package/dist/DataTable/TablePaginationMinimal.js +9 -8
- package/dist/DataTable/TablePaginationMinimal.js.map +1 -1
- package/dist/DataTable/TableRow.js +15 -18
- package/dist/DataTable/TableRow.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js +23 -22
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.js +14 -19
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js +19 -20
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/TextFilter.js +10 -13
- package/dist/DataTable/filters/TextFilter.js.map +1 -1
- package/dist/DataTable/hooks.js +29 -25
- package/dist/DataTable/hooks.js.map +1 -1
- package/dist/DataTable/index.js +120 -104
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/selection/BaseSelectionStatus.js +29 -31
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelect.js +13 -9
- package/dist/DataTable/selection/ControlledSelect.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectHeader.js +19 -15
- package/dist/DataTable/selection/ControlledSelectHeader.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectionStatus.js +34 -24
- package/dist/DataTable/selection/ControlledSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/SelectionStatus.js +23 -23
- package/dist/DataTable/selection/SelectionStatus.js.map +1 -1
- package/dist/DataTable/utils/getVisibleColumns.js +36 -44
- package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
- package/dist/Dropdown/deprecated/DropdownButton.js +9 -13
- package/dist/Dropdown/deprecated/DropdownButton.js.map +1 -1
- package/dist/Dropdown/deprecated/DropdownItem.js +7 -8
- package/dist/Dropdown/deprecated/DropdownItem.js.map +1 -1
- package/dist/Dropdown/deprecated/DropdownMenu.js +8 -12
- package/dist/Dropdown/deprecated/DropdownMenu.js.map +1 -1
- package/dist/Dropdown/deprecated/index.js +136 -103
- package/dist/Dropdown/deprecated/index.js.map +1 -1
- package/dist/Dropdown/index.js +32 -29
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/DefaultContent.js +13 -13
- package/dist/Dropzone/DefaultContent.js.map +1 -1
- package/dist/Dropzone/DragError.js +1 -3
- package/dist/Dropzone/DragError.js.map +1 -1
- package/dist/Dropzone/GenericError.js +7 -7
- package/dist/Dropzone/GenericError.js.map +1 -1
- package/dist/Dropzone/UploadProgress.js +6 -8
- package/dist/Dropzone/UploadProgress.js.map +1 -1
- package/dist/Dropzone/index.js +145 -86
- package/dist/Dropzone/index.js.map +1 -1
- package/dist/Fieldset/index.js +82 -57
- package/dist/Fieldset/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +137 -95
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormAutosuggestOption.js +4 -6
- package/dist/Form/FormAutosuggestOption.js.map +1 -1
- package/dist/Form/FormCheckbox.js +35 -42
- package/dist/Form/FormCheckbox.js.map +1 -1
- package/dist/Form/FormCheckboxSet.js +13 -16
- package/dist/Form/FormCheckboxSet.js.map +1 -1
- package/dist/Form/FormCheckboxSetContext.js +39 -34
- package/dist/Form/FormCheckboxSetContext.js.map +1 -1
- package/dist/Form/FormControl.js +41 -35
- package/dist/Form/FormControl.js.map +1 -1
- package/dist/Form/FormControlDecorator.js +3 -5
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormControlDecoratorGroup.js +8 -10
- package/dist/Form/FormControlDecoratorGroup.js.map +1 -1
- package/dist/Form/FormControlFeedback.js +12 -15
- package/dist/Form/FormControlFeedback.js.map +1 -1
- package/dist/Form/FormControlFloatingLabel.js +3 -6
- package/dist/Form/FormControlFloatingLabel.js.map +1 -1
- package/dist/Form/FormControlSet.js +8 -9
- package/dist/Form/FormControlSet.js.map +1 -1
- package/dist/Form/FormGroup.js +11 -12
- package/dist/Form/FormGroup.js.map +1 -1
- package/dist/Form/FormGroupContext.js +64 -39
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormLabel.js +15 -17
- package/dist/Form/FormLabel.js.map +1 -1
- package/dist/Form/FormRadio.js +19 -22
- package/dist/Form/FormRadio.js.map +1 -1
- package/dist/Form/FormRadioSet.js +13 -16
- package/dist/Form/FormRadioSet.js.map +1 -1
- package/dist/Form/FormRadioSetContext.js +39 -34
- package/dist/Form/FormRadioSetContext.js.map +1 -1
- package/dist/Form/FormSwitch.js +16 -20
- package/dist/Form/FormSwitch.js.map +1 -1
- package/dist/Form/FormText.js +20 -29
- package/dist/Form/FormText.js.map +1 -1
- package/dist/Form/useCheckboxSetValues.js +46 -23
- package/dist/Form/useCheckboxSetValues.js.map +1 -1
- package/dist/Hyperlink/index.js +25 -25
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Hyperlink/index.scss +2 -2
- package/dist/Icon/index.js +21 -20
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.js +30 -32
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButtonToggle/index.js +16 -16
- package/dist/IconButtonToggle/index.js.map +1 -1
- package/dist/Input/index.js +122 -92
- package/dist/Input/index.js.map +1 -1
- package/dist/InputSelect/index.js +78 -51
- package/dist/InputSelect/index.js.map +1 -1
- package/dist/InputText/index.js +11 -9
- package/dist/InputText/index.js.map +1 -1
- package/dist/Layout/index.js +33 -29
- package/dist/Layout/index.js.map +1 -1
- package/dist/ListBox/index.js +112 -80
- package/dist/ListBox/index.js.map +1 -1
- package/dist/ListBoxOption/index.js +68 -45
- package/dist/ListBoxOption/index.js.map +1 -1
- package/dist/MailtoLink/index.js +37 -34
- package/dist/MailtoLink/index.js.map +1 -1
- package/dist/Menu/MenuItem.js +13 -14
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Menu/SelectMenu.js +68 -44
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Menu/index.js +10 -11
- package/dist/Menu/index.js.map +1 -1
- package/dist/Modal/AlertModal.js +5 -7
- package/dist/Modal/AlertModal.js.map +1 -1
- package/dist/Modal/FullscreenModal.js +6 -8
- package/dist/Modal/FullscreenModal.js.map +1 -1
- package/dist/Modal/MarketingModal.js +8 -10
- package/dist/Modal/MarketingModal.js.map +1 -1
- package/dist/Modal/ModalCloseButton.js +13 -15
- package/dist/Modal/ModalCloseButton.js.map +1 -1
- package/dist/Modal/ModalContext.js +13 -13
- package/dist/Modal/ModalContext.js.map +1 -1
- package/dist/Modal/ModalDialog.js +22 -23
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogBody.js +22 -11
- package/dist/Modal/ModalDialogBody.js.map +1 -1
- package/dist/Modal/ModalDialogFooter.js +6 -7
- package/dist/Modal/ModalDialogFooter.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.js +6 -7
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalDialogHero.js +6 -7
- package/dist/Modal/ModalDialogHero.js.map +1 -1
- package/dist/Modal/ModalDialogHeroBackground.js +8 -9
- package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
- package/dist/Modal/ModalDialogHeroContent.js +6 -7
- package/dist/Modal/ModalDialogHeroContent.js.map +1 -1
- package/dist/Modal/ModalDialogTitle.js +6 -7
- package/dist/Modal/ModalDialogTitle.js.map +1 -1
- package/dist/Modal/ModalLayer.js +11 -17
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/ModalPopup.js +17 -17
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/PopperElement.js +25 -18
- package/dist/Modal/PopperElement.js.map +1 -1
- package/dist/Modal/Portal.js +40 -18
- package/dist/Modal/Portal.js.map +1 -1
- package/dist/Modal/StandardModal.js +6 -8
- package/dist/Modal/StandardModal.js.map +1 -1
- package/dist/Modal/index.js +215 -187
- package/dist/Modal/index.js.map +1 -1
- package/dist/Nav/index.js +3 -2
- package/dist/Nav/index.js.map +1 -1
- package/dist/Navbar/index.js +7 -6
- package/dist/Navbar/index.js.map +1 -1
- package/dist/OverflowScroll/OverflowScroll.js +45 -37
- package/dist/OverflowScroll/OverflowScroll.js.map +1 -1
- package/dist/OverflowScroll/OverflowScrollContext.js +1 -1
- package/dist/OverflowScroll/OverflowScrollContext.js.map +1 -1
- package/dist/OverflowScroll/OverflowScrollItems.js +2 -4
- package/dist/OverflowScroll/OverflowScrollItems.js.map +1 -1
- package/dist/Overlay/index.js +4 -4
- package/dist/Overlay/index.js.map +1 -1
- package/dist/PageBanner/index.js +11 -13
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/Pagination/index.js +331 -296
- package/dist/Pagination/index.js.map +1 -1
- package/dist/Popover/index.js +11 -14
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.js +29 -22
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/CheckpointActionRow.js +18 -16
- package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
- package/dist/ProductTour/CheckpointBody.js +2 -4
- package/dist/ProductTour/CheckpointBody.js.map +1 -1
- package/dist/ProductTour/CheckpointBreadcrumbs.js +16 -16
- package/dist/ProductTour/CheckpointBreadcrumbs.js.map +1 -1
- package/dist/ProductTour/CheckpointTitle.js +2 -4
- package/dist/ProductTour/CheckpointTitle.js.map +1 -1
- package/dist/ProductTour/index.js +66 -47
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProgressBar/index.js +37 -35
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/RadioButtonGroup/index.js +133 -102
- package/dist/RadioButtonGroup/index.js.map +1 -1
- package/dist/Scrollable/index.js +30 -15
- package/dist/Scrollable/index.js.map +1 -1
- package/dist/SearchField/SearchFieldAdvanced.js +54 -44
- package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
- package/dist/SearchField/SearchFieldClearButton.js +7 -8
- package/dist/SearchField/SearchFieldClearButton.js.map +1 -1
- package/dist/SearchField/SearchFieldInput.js +8 -9
- package/dist/SearchField/SearchFieldInput.js.map +1 -1
- package/dist/SearchField/SearchFieldLabel.js +5 -8
- package/dist/SearchField/SearchFieldLabel.js.map +1 -1
- package/dist/SearchField/SearchFieldSubmitButton.js +12 -15
- package/dist/SearchField/SearchFieldSubmitButton.js.map +1 -1
- package/dist/SearchField/index.js +22 -22
- package/dist/SearchField/index.js.map +1 -1
- package/dist/SelectableBox/SelectableBoxSet.js +25 -26
- package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
- package/dist/SelectableBox/index.js +42 -38
- package/dist/SelectableBox/index.js.map +1 -1
- package/dist/Sheet/SheetContainer.js +38 -16
- package/dist/Sheet/SheetContainer.js.map +1 -1
- package/dist/Sheet/index.js +65 -43
- package/dist/Sheet/index.js.map +1 -1
- package/dist/Spinner/index.js +8 -9
- package/dist/Spinner/index.js.map +1 -1
- package/dist/Stack/index.js +9 -11
- package/dist/Stack/index.js.map +1 -1
- package/dist/StatefulButton/index.js +15 -17
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/StatusAlert/index.js +120 -82
- package/dist/StatusAlert/index.js.map +1 -1
- package/dist/Stepper/Stepper.js +2 -4
- package/dist/Stepper/Stepper.js.map +1 -1
- package/dist/Stepper/StepperActionRow.js +7 -10
- package/dist/Stepper/StepperActionRow.js.map +1 -1
- package/dist/Stepper/StepperContext.js +64 -32
- package/dist/Stepper/StepperContext.js.map +1 -1
- package/dist/Stepper/StepperHeader.js +23 -30
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.js +14 -17
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Stepper/StepperStep.js +23 -24
- package/dist/Stepper/StepperStep.js.map +1 -1
- package/dist/Sticky/index.js +30 -22
- package/dist/Sticky/index.js.map +1 -1
- package/dist/Table/index.js +178 -109
- package/dist/Table/index.js.map +1 -1
- package/dist/Tabs/deprecated/index.js +99 -66
- package/dist/Tabs/deprecated/index.js.map +1 -1
- package/dist/Tabs/index.js +65 -49
- package/dist/Tabs/index.js.map +1 -1
- package/dist/TextArea/index.js +10 -8
- package/dist/TextArea/index.js.map +1 -1
- package/dist/Toast/ToastContainer.js +38 -16
- package/dist/Toast/ToastContainer.js.map +1 -1
- package/dist/Toast/index.js +33 -18
- package/dist/Toast/index.js.map +1 -1
- package/dist/Tooltip/index.js +8 -9
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/TransitionReplace/DemoTransitionReplace.js +12 -3
- package/dist/TransitionReplace/DemoTransitionReplace.js.map +1 -1
- package/dist/TransitionReplace/index.js +136 -100
- package/dist/TransitionReplace/index.js.map +1 -1
- package/dist/Truncate/index.js +30 -24
- package/dist/Truncate/index.js.map +1 -1
- package/dist/ValidationFormGroup/index.js +38 -37
- package/dist/ValidationFormGroup/index.js.map +1 -1
- package/dist/ValidationMessage/index.js +76 -51
- package/dist/ValidationMessage/index.js.map +1 -1
- package/dist/asInput/index.js +251 -202
- package/dist/asInput/index.js.map +1 -1
- package/dist/hooks/useArrowKeyNavigation.js +46 -43
- package/dist/hooks/useArrowKeyNavigation.js.map +1 -1
- package/dist/hooks/useIndexOfLastVisibleChild.js +40 -26
- package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
- package/dist/hooks/useIsVisible.js +20 -13
- package/dist/hooks/useIsVisible.js.map +1 -1
- package/dist/hooks/useToggle.js +18 -11
- package/dist/hooks/useToggle.js.map +1 -1
- package/dist/hooks/useWindowSize.js +17 -6
- package/dist/hooks/useWindowSize.js.map +1 -1
- package/dist/paragon.css +1 -1
- package/dist/withDeprecatedProps.js +79 -58
- package/dist/withDeprecatedProps.js.map +1 -1
- package/package.json +1 -5
- package/src/Button/index.jsx +2 -2
- package/src/Dropzone/index.jsx +1 -1
- package/src/Hyperlink/index.scss +2 -2
- package/src/Icon/index.jsx +1 -1
- package/src/IconButton/__snapshots__/IconButton.test.jsx.snap +12 -10
- package/src/IconButton/index.jsx +1 -1
- package/src/Menu/MenuItem.jsx +2 -2
- package/src/Overlay/README.md +1 -1
- package/src/Overlay/index.jsx +1 -1
package/dist/Tooltip/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["children", "variant"];
|
|
2
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return
|
|
6
|
-
function _toPrimitive(input, hint) { if (
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
8
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -11,12 +12,10 @@ import React from 'react';
|
|
|
11
12
|
import PropTypes from 'prop-types';
|
|
12
13
|
import classNames from 'classnames';
|
|
13
14
|
import BaseTooltip from 'react-bootstrap/Tooltip';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
variant
|
|
19
|
-
} = _ref,
|
|
15
|
+
var PLACEMENT_VARIANTS = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
|
16
|
+
var Tooltip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
variant = _ref.variant,
|
|
20
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
20
|
return /*#__PURE__*/React.createElement(BaseTooltip, _extends({}, props, {
|
|
22
21
|
className: classNames({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","BaseTooltip","PLACEMENT_VARIANTS","Tooltip","forwardRef","_ref","ref","children","variant","props","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","_objectSpread","id","string","isRequired","placement","oneOf","arrowProps","shape","oneOfType","func","current","element","style","show","bool","popper","bsPrefix","node","defaultProps","undefined"],"sources":["../../src/Tooltip/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport BaseTooltip from 'react-bootstrap/Tooltip';\n\nconst PLACEMENT_VARIANTS = [\n 'auto-start',\n 'auto',\n 'auto-end',\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n\nconst Tooltip = React.forwardRef(({\n children,\n variant,\n ...props\n}, ref) => (\n <BaseTooltip\n {...props}\n className={classNames({ 'tooltip-light': variant === 'light' }, props.className)}\n ref={ref}\n >\n {children}\n </BaseTooltip>\n));\n\nTooltip.propTypes = {\n ...BaseTooltip.propTypes,\n /** An html id attribute, necessary for accessibility. */\n id: PropTypes.string.isRequired,\n /**\n * Sets the direction the `Tooltip` is positioned towards.\n *\n * This is generally provided by the `Overlay` component positioning the tooltip.\n */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /**\n * An `Overlay` injected set of props for positioning the `Tooltip` arrow.\n *\n * This is generally provided by the `Overlay` component positioning the tooltip.\n */\n arrowProps: PropTypes.shape({\n ref: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.element }),\n ]),\n style: PropTypes.shape({}),\n }),\n /** Whether the `Overlay` is shown. */\n show: PropTypes.bool,\n /** A `Popper.js` config object passed to the the underlying popper instance. */\n popper: PropTypes.shape({}),\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n /** Specifies the content of the `Tooltip` */\n children: PropTypes.node,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** The visual style of the `Tooltip` */\n variant: PropTypes.string,\n};\n\nTooltip.defaultProps = {\n ...Tooltip.defaultProps,\n id: undefined,\n placement: 'right',\n arrowProps: undefined,\n show: undefined,\n popper: undefined,\n children: undefined,\n className: undefined,\n variant: undefined,\n bsPrefix: 'tooltip',\n};\n\nexport default Tooltip;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","BaseTooltip","PLACEMENT_VARIANTS","Tooltip","forwardRef","_ref","ref","children","variant","props","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","_objectSpread","id","string","isRequired","placement","oneOf","arrowProps","shape","oneOfType","func","current","element","style","show","bool","popper","bsPrefix","node","defaultProps","undefined"],"sources":["../../src/Tooltip/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport BaseTooltip from 'react-bootstrap/Tooltip';\n\nconst PLACEMENT_VARIANTS = [\n 'auto-start',\n 'auto',\n 'auto-end',\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n];\n\nconst Tooltip = React.forwardRef(({\n children,\n variant,\n ...props\n}, ref) => (\n <BaseTooltip\n {...props}\n className={classNames({ 'tooltip-light': variant === 'light' }, props.className)}\n ref={ref}\n >\n {children}\n </BaseTooltip>\n));\n\nTooltip.propTypes = {\n ...BaseTooltip.propTypes,\n /** An html id attribute, necessary for accessibility. */\n id: PropTypes.string.isRequired,\n /**\n * Sets the direction the `Tooltip` is positioned towards.\n *\n * This is generally provided by the `Overlay` component positioning the tooltip.\n */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /**\n * An `Overlay` injected set of props for positioning the `Tooltip` arrow.\n *\n * This is generally provided by the `Overlay` component positioning the tooltip.\n */\n arrowProps: PropTypes.shape({\n ref: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.element }),\n ]),\n style: PropTypes.shape({}),\n }),\n /** Whether the `Overlay` is shown. */\n show: PropTypes.bool,\n /** A `Popper.js` config object passed to the the underlying popper instance. */\n popper: PropTypes.shape({}),\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n /** Specifies the content of the `Tooltip` */\n children: PropTypes.node,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** The visual style of the `Tooltip` */\n variant: PropTypes.string,\n};\n\nTooltip.defaultProps = {\n ...Tooltip.defaultProps,\n id: undefined,\n placement: 'right',\n arrowProps: undefined,\n show: undefined,\n popper: undefined,\n children: undefined,\n className: undefined,\n variant: undefined,\n bsPrefix: 'tooltip',\n};\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,yBAAyB;AAEjD,IAAMC,kBAAkB,GAAG,CACzB,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,UAAU,EACV,MAAM,EACN,YAAY,CACb;AAED,IAAMC,OAAO,gBAAGL,KAAK,CAACM,UAAU,CAAC,UAAA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S,CAACmB;AAAM,EAC1B;AAEDf,OAAO,CAAC+B,YAAY,GAAAlB,aAAA,CAAAA,aAAA,KACfb,OAAO,CAAC+B,YAAY;EACvBjB,EAAE,EAAEkB,SAAS;EACbf,SAAS,EAAE,OAAO;EAClBE,UAAU,EAAEa,SAAS;EACrBN,IAAI,EAAEM,SAAS;EACfJ,MAAM,EAAEI,SAAS;EACjB5B,QAAQ,EAAE4B,SAAS;EACnBrB,SAAS,EAAEqB,SAAS;EACpB3B,OAAO,EAAE2B,SAAS;EAClBH,QAAQ,EAAE;AAAS,EACpB;AAED,eAAe7B,OAAO"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
7
|
import React, { useState } from 'react';
|
|
2
8
|
import TransitionReplace from './index';
|
|
3
9
|
export default function DemoTransitionReplace() {
|
|
4
|
-
|
|
10
|
+
var contentOptions = [/*#__PURE__*/React.createElement("blockquote", {
|
|
5
11
|
className: "h2 m-0",
|
|
6
12
|
key: 0
|
|
7
13
|
}, /*#__PURE__*/React.createElement("p", null, "You know the golden rule, don\u2019t you boy? Those who have the gold make the rules."), /*#__PURE__*/React.createElement("footer", null, "\u2014 Crazy hunch-backed old guy in Aladdin")), /*#__PURE__*/React.createElement("blockquote", {
|
|
@@ -14,8 +20,11 @@ export default function DemoTransitionReplace() {
|
|
|
14
20
|
className: "m-0",
|
|
15
21
|
key: 3
|
|
16
22
|
}, /*#__PURE__*/React.createElement("p", null, "The first time I see a jogger smiling, I\u2019ll consider it."), /*#__PURE__*/React.createElement("footer", null, "\u2014 Joan Rivers"))];
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
var _useState = useState(0),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
currentContentIndex = _useState2[0],
|
|
26
|
+
setCurrentContentIndex = _useState2[1];
|
|
27
|
+
var changeContent = function changeContent() {
|
|
19
28
|
setCurrentContentIndex((currentContentIndex + 1) % contentOptions.length);
|
|
20
29
|
};
|
|
21
30
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DemoTransitionReplace.js","names":["React","useState","TransitionReplace","DemoTransitionReplace","contentOptions","createElement","className","key","currentContentIndex","setCurrentContentIndex","changeContent","length","onClick","style","background","padding","maxWidth"],"sources":["../../src/TransitionReplace/DemoTransitionReplace.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport TransitionReplace from './index';\n\nexport default function DemoTransitionReplace() {\n const contentOptions = [\n (\n <blockquote className=\"h2 m-0\" key={0}>\n <p>You know the golden rule, don’t you boy? Those who have the gold make the rules.</p>\n <footer>— Crazy hunch-backed old guy in Aladdin</footer>\n </blockquote>\n ),\n (\n <blockquote className=\"m-0\" key={1}>\n <p>People say nothing is impossible, but I do nothing every day.</p>\n <footer>— A. A. Milne</footer>\n </blockquote>\n ),\n (\n <blockquote className=\"h2 m-0\" key={2}>\n <p>\n I won’t go into a big spiel about reincarnation, but the first time I was in the\n Gucci store in Chicago was the closest I’ve ever felt to home.\n </p>\n <footer>— Kanye</footer>\n </blockquote>\n ),\n (\n <blockquote className=\"m-0\" key={3}>\n <p>The first time I see a jogger smiling, I’ll consider it.</p>\n <footer>— Joan Rivers</footer>\n </blockquote>\n ),\n ];\n\n const [currentContentIndex, setCurrentContentIndex] = useState(0);\n const changeContent = () => {\n setCurrentContentIndex((currentContentIndex + 1) % contentOptions.length);\n };\n\n return (\n <div>\n {/* eslint-disable-next-line react/button-has-type */}\n <button className=\"btn btn-primary mb-2\" onClick={changeContent}>Next Quote</button>\n <div\n style={{\n background: '#eee',\n padding: '1rem',\n maxWidth: '15rem',\n }}\n >\n <TransitionReplace>\n {contentOptions[currentContentIndex]}\n </TransitionReplace>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,iBAAiB,MAAM,SAAS;AAEvC,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC9C,
|
|
1
|
+
{"version":3,"file":"DemoTransitionReplace.js","names":["React","useState","TransitionReplace","DemoTransitionReplace","contentOptions","createElement","className","key","_useState","_useState2","_slicedToArray","currentContentIndex","setCurrentContentIndex","changeContent","length","onClick","style","background","padding","maxWidth"],"sources":["../../src/TransitionReplace/DemoTransitionReplace.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport TransitionReplace from './index';\n\nexport default function DemoTransitionReplace() {\n const contentOptions = [\n (\n <blockquote className=\"h2 m-0\" key={0}>\n <p>You know the golden rule, don’t you boy? Those who have the gold make the rules.</p>\n <footer>— Crazy hunch-backed old guy in Aladdin</footer>\n </blockquote>\n ),\n (\n <blockquote className=\"m-0\" key={1}>\n <p>People say nothing is impossible, but I do nothing every day.</p>\n <footer>— A. A. Milne</footer>\n </blockquote>\n ),\n (\n <blockquote className=\"h2 m-0\" key={2}>\n <p>\n I won’t go into a big spiel about reincarnation, but the first time I was in the\n Gucci store in Chicago was the closest I’ve ever felt to home.\n </p>\n <footer>— Kanye</footer>\n </blockquote>\n ),\n (\n <blockquote className=\"m-0\" key={3}>\n <p>The first time I see a jogger smiling, I’ll consider it.</p>\n <footer>— Joan Rivers</footer>\n </blockquote>\n ),\n ];\n\n const [currentContentIndex, setCurrentContentIndex] = useState(0);\n const changeContent = () => {\n setCurrentContentIndex((currentContentIndex + 1) % contentOptions.length);\n };\n\n return (\n <div>\n {/* eslint-disable-next-line react/button-has-type */}\n <button className=\"btn btn-primary mb-2\" onClick={changeContent}>Next Quote</button>\n <div\n style={{\n background: '#eee',\n padding: '1rem',\n maxWidth: '15rem',\n }}\n >\n <TransitionReplace>\n {contentOptions[currentContentIndex]}\n </TransitionReplace>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,iBAAiB,MAAM,SAAS;AAEvC,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC9C,IAAMC,cAAc,GAAG,cAEnBJ,KAAA,CAAAK,aAAA;IAAYC,SAAS,EAAC,QAAQ;IAACC,GAAG,EAAE;EAAE,gBACpCP,KAAA,CAAAK,aAAA,YAAG,uFAAmF,CAAC,eACvFL,KAAA,CAAAK,aAAA,iBAAQ,8CAA+C,CAC7C,CAAC,eAGbL,KAAA,CAAAK,aAAA;IAAYC,SAAS,EAAC,K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of Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function
|
|
5
|
-
function
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
6
17
|
import React from 'react';
|
|
7
18
|
import PropTypes from 'prop-types';
|
|
8
19
|
import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|
9
20
|
import classNames from 'classnames';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
var TransitionReplace = /*#__PURE__*/function (_React$Component) {
|
|
22
|
+
_inherits(TransitionReplace, _React$Component);
|
|
23
|
+
var _super = _createSuper(TransitionReplace);
|
|
24
|
+
function TransitionReplace(props) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, TransitionReplace);
|
|
27
|
+
_this = _super.call(this, props);
|
|
28
|
+
_this.state = {
|
|
14
29
|
height: null
|
|
15
30
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
_this.onChildEnter = _this.onChildEnter.bind(_assertThisInitialized(_this));
|
|
32
|
+
_this.onChildEntering = _this.onChildEntering.bind(_assertThisInitialized(_this));
|
|
33
|
+
_this.onChildEntered = _this.onChildEntered.bind(_assertThisInitialized(_this));
|
|
34
|
+
_this.onChildExit = _this.onChildExit.bind(_assertThisInitialized(_this));
|
|
35
|
+
_this.onChildExiting = _this.onChildExiting.bind(_assertThisInitialized(_this));
|
|
36
|
+
_this.onChildExited = _this.onChildExited.bind(_assertThisInitialized(_this));
|
|
37
|
+
return _this;
|
|
22
38
|
}
|
|
23
39
|
|
|
24
40
|
// Transition events are fired in this order:
|
|
@@ -34,101 +50,121 @@ class TransitionReplace extends React.Component {
|
|
|
34
50
|
// 1. onChildExit (explicitly set the height to match the current current)
|
|
35
51
|
// 2. onChildEntering (set the height to match the new content)
|
|
36
52
|
// 3. onChildExited (reset the height to null)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.props.onChildEnter
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onChildEntering(htmlNode) {
|
|
44
|
-
this.setState({
|
|
45
|
-
height: htmlNode.offsetHeight
|
|
46
|
-
});
|
|
47
|
-
if (this.props.onChildEntering) {
|
|
48
|
-
this.props.onChildEntering(htmlNode);
|
|
53
|
+
_createClass(TransitionReplace, [{
|
|
54
|
+
key: "onChildEnter",
|
|
55
|
+
value: function onChildEnter(htmlNode) {
|
|
56
|
+
if (this.props.onChildEnter) {
|
|
57
|
+
this.props.onChildEnter(htmlNode);
|
|
58
|
+
}
|
|
49
59
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.props.
|
|
60
|
+
}, {
|
|
61
|
+
key: "onChildEntering",
|
|
62
|
+
value: function onChildEntering(htmlNode) {
|
|
63
|
+
this.setState({
|
|
64
|
+
height: htmlNode.offsetHeight
|
|
65
|
+
});
|
|
66
|
+
if (this.props.onChildEntering) {
|
|
67
|
+
this.props.onChildEntering(htmlNode);
|
|
68
|
+
}
|
|
57
69
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.props.
|
|
70
|
+
}, {
|
|
71
|
+
key: "onChildEntered",
|
|
72
|
+
value: function onChildEntered(htmlNode) {
|
|
73
|
+
this.setState({
|
|
74
|
+
height: null
|
|
75
|
+
});
|
|
76
|
+
if (this.props.onChildEntered) {
|
|
77
|
+
this.props.onChildEntered(htmlNode);
|
|
78
|
+
}
|
|
65
79
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.
|
|
80
|
+
}, {
|
|
81
|
+
key: "onChildExit",
|
|
82
|
+
value: function onChildExit(htmlNode) {
|
|
83
|
+
this.setState({
|
|
84
|
+
height: htmlNode.offsetHeight
|
|
85
|
+
});
|
|
86
|
+
if (this.props.onChildExit) {
|
|
87
|
+
this.props.onChildExit(htmlNode);
|
|
88
|
+
}
|
|
70
89
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.props.onChildExited(htmlNode);
|
|
90
|
+
}, {
|
|
91
|
+
key: "onChildExiting",
|
|
92
|
+
value: function onChildExiting(htmlNode) {
|
|
93
|
+
if (this.props.onChildExiting) {
|
|
94
|
+
this.props.onChildExiting(htmlNode);
|
|
95
|
+
}
|
|
78
96
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
}, {
|
|
98
|
+
key: "onChildExited",
|
|
99
|
+
value: function onChildExited(htmlNode) {
|
|
100
|
+
this.setState({
|
|
101
|
+
height: null
|
|
102
|
+
});
|
|
103
|
+
if (this.props.onChildExited) {
|
|
104
|
+
this.props.onChildExited(htmlNode);
|
|
105
|
+
}
|
|
84
106
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
entering: {},
|
|
93
|
-
entered: {},
|
|
94
|
-
exiting: {
|
|
95
|
-
position: 'absolute',
|
|
96
|
-
top: 0,
|
|
97
|
-
left: 0,
|
|
98
|
-
right: 0,
|
|
99
|
-
pointerEvents: 'none'
|
|
100
|
-
},
|
|
101
|
-
exited: {}
|
|
102
|
-
};
|
|
103
|
-
return /*#__PURE__*/React.createElement(CSSTransition, {
|
|
104
|
-
timeout: {
|
|
105
|
-
enter: this.props.enterDuration,
|
|
106
|
-
exit: this.props.exitDuration
|
|
107
|
-
},
|
|
108
|
-
unmountOnExit: true,
|
|
109
|
-
mountOnEnter: true,
|
|
110
|
-
onEnter: this.onChildEnter,
|
|
111
|
-
onEntering: this.onChildEntering,
|
|
112
|
-
onEntered: this.onChildEntered,
|
|
113
|
-
onExit: this.onChildExit,
|
|
114
|
-
onExiting: this.onChildExiting,
|
|
115
|
-
onExited: this.onChildExited,
|
|
116
|
-
classNames: this.props.transitionClassNames
|
|
117
|
-
}, state => /*#__PURE__*/React.createElement("div", {
|
|
118
|
-
style: _objectSpread(_objectSpread(_objectSpread({}, commonChildStyles), transitionStyles[state]), this.props.transitionStyles[state])
|
|
119
|
-
}, child));
|
|
120
|
-
}
|
|
121
|
-
render() {
|
|
122
|
-
return /*#__PURE__*/React.createElement(TransitionGroup, {
|
|
123
|
-
className: classNames('pgn-transition-replace-group', 'position-relative', {
|
|
124
|
-
'overflow-hidden': this.state.height !== null
|
|
125
|
-
}, this.props.className),
|
|
126
|
-
style: {
|
|
127
|
-
height: this.state.height
|
|
107
|
+
}, {
|
|
108
|
+
key: "renderChildTransition",
|
|
109
|
+
value: function renderChildTransition(child) {
|
|
110
|
+
var _this2 = this;
|
|
111
|
+
if (!child.key && process.env.NODE_ENV === 'development') {
|
|
112
|
+
// eslint-disable-next-line no-console
|
|
113
|
+
console.warn("TransitionReplace: A child is missing a 'key' prop. Keys are required for any child of this component.");
|
|
128
114
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
// Makes the exiting and entering children occupy the same space
|
|
116
|
+
// SCSS handles the crossfade so it can be easily overridden
|
|
117
|
+
var commonChildStyles = {
|
|
118
|
+
// Prevent margin-collapsing which throws off height calculations
|
|
119
|
+
padding: '.1px 0'
|
|
120
|
+
};
|
|
121
|
+
var transitionStyles = {
|
|
122
|
+
entering: {},
|
|
123
|
+
entered: {},
|
|
124
|
+
exiting: {
|
|
125
|
+
position: 'absolute',
|
|
126
|
+
top: 0,
|
|
127
|
+
left: 0,
|
|
128
|
+
right: 0,
|
|
129
|
+
pointerEvents: 'none'
|
|
130
|
+
},
|
|
131
|
+
exited: {}
|
|
132
|
+
};
|
|
133
|
+
return /*#__PURE__*/React.createElement(CSSTransition, {
|
|
134
|
+
timeout: {
|
|
135
|
+
enter: this.props.enterDuration,
|
|
136
|
+
exit: this.props.exitDuration
|
|
137
|
+
},
|
|
138
|
+
unmountOnExit: true,
|
|
139
|
+
mountOnEnter: true,
|
|
140
|
+
onEnter: this.onChildEnter,
|
|
141
|
+
onEntering: this.onChildEntering,
|
|
142
|
+
onEntered: this.onChildEntered,
|
|
143
|
+
onExit: this.onChildExit,
|
|
144
|
+
onExiting: this.onChildExiting,
|
|
145
|
+
onExited: this.onChildExited,
|
|
146
|
+
classNames: this.props.transitionClassNames
|
|
147
|
+
}, function (state) {
|
|
148
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, commonChildStyles), transitionStyles[state]), _this2.props.transitionStyles[state])
|
|
150
|
+
}, child);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "render",
|
|
155
|
+
value: function render() {
|
|
156
|
+
return /*#__PURE__*/React.createElement(TransitionGroup, {
|
|
157
|
+
className: classNames('pgn-transition-replace-group', 'position-relative', {
|
|
158
|
+
'overflow-hidden': this.state.height !== null
|
|
159
|
+
}, this.props.className),
|
|
160
|
+
style: {
|
|
161
|
+
height: this.state.height
|
|
162
|
+
}
|
|
163
|
+
}, React.Children.map(this.props.children, this.renderChildTransition, this));
|
|
164
|
+
}
|
|
165
|
+
}]);
|
|
166
|
+
return TransitionReplace;
|
|
167
|
+
}(React.Component);
|
|
132
168
|
TransitionReplace.propTypes = {
|
|
133
169
|
/** Specifies an additional class for the base element */
|
|
134
170
|
children: PropTypes.element,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","CSSTransition","TransitionGroup","classNames","TransitionReplace","Component","constructor","props","state","height","onChildEnter","bind","onChildEntering","onChildEntered","onChildExit","onChildExiting","onChildExited","htmlNode","setState","offsetHeight","renderChildTransition","child","key","process","env","NODE_ENV","console","warn","commonChildStyles","padding","transitionStyles","entering","entered","exiting","position","top","left","right","pointerEvents","exited","createElement","timeout","enter","enterDuration","exit","exitDuration","unmountOnExit","mountOnEnter","onEnter","onEntering","onEntered","onExit","onExiting","onExited","transitionClassNames","style","_objectSpread","render","className","Children","map","children","propTypes","element","number","string","func","shape","defaultProps","undefined"],"sources":["../../src/TransitionReplace/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport classNames from 'classnames';\n\nclass TransitionReplace extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = { height: null };\n\n this.onChildEnter = this.onChildEnter.bind(this);\n this.onChildEntering = this.onChildEntering.bind(this);\n this.onChildEntered = this.onChildEntered.bind(this);\n this.onChildExit = this.onChildExit.bind(this);\n this.onChildExiting = this.onChildExiting.bind(this);\n this.onChildExited = this.onChildExited.bind(this);\n }\n\n // Transition events are fired in this order:\n //\n // onEnter > onEntering > onEntered\n // onExit > onExiting > onExited\n //\n // Keep in mind that we always have two transitions happening\n // both the entering and leaving children\n //\n // We set the container height (for animation) in this order:\n //\n // 1. onChildExit (explicitly set the height to match the current current)\n // 2. onChildEntering (set the height to match the new content)\n // 3. onChildExited (reset the height to null)\n\n onChildEnter(htmlNode) {\n if (this.props.onChildEnter) { this.props.onChildEnter(htmlNode); }\n }\n\n onChildEntering(htmlNode) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildEntering) { this.props.onChildEntering(htmlNode); }\n }\n\n onChildEntered(htmlNode) {\n this.setState({ height: null });\n if (this.props.onChildEntered) { this.props.onChildEntered(htmlNode); }\n }\n\n onChildExit(htmlNode) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildExit) { this.props.onChildExit(htmlNode); }\n }\n\n onChildExiting(htmlNode) {\n if (this.props.onChildExiting) { this.props.onChildExiting(htmlNode); }\n }\n\n onChildExited(htmlNode) {\n this.setState({ height: null });\n if (this.props.onChildExited) { this.props.onChildExited(htmlNode); }\n }\n\n renderChildTransition(child) {\n if (!child.key && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\"TransitionReplace: A child is missing a 'key' prop. Keys are required for any child of this component.\");\n }\n // Makes the exiting and entering children occupy the same space\n // SCSS handles the crossfade so it can be easily overridden\n const commonChildStyles = {\n // Prevent margin-collapsing which throws off height calculations\n padding: '.1px 0',\n };\n\n const transitionStyles = {\n entering: {},\n entered: {},\n exiting: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n pointerEvents: 'none',\n },\n exited: {},\n };\n\n return (\n <CSSTransition\n timeout={{\n enter: this.props.enterDuration,\n exit: this.props.exitDuration,\n }}\n unmountOnExit\n mountOnEnter\n onEnter={this.onChildEnter}\n onEntering={this.onChildEntering}\n onEntered={this.onChildEntered}\n onExit={this.onChildExit}\n onExiting={this.onChildExiting}\n onExited={this.onChildExited}\n classNames={this.props.transitionClassNames}\n >\n {state => (\n <div\n style={{\n ...commonChildStyles,\n ...transitionStyles[state],\n ...this.props.transitionStyles[state],\n }}\n >\n {child}\n </div>\n )}\n </CSSTransition>\n );\n }\n\n render() {\n return (\n <TransitionGroup\n className={classNames(\n 'pgn-transition-replace-group',\n 'position-relative',\n { 'overflow-hidden': this.state.height !== null },\n this.props.className,\n )}\n style={{ height: this.state.height }}\n >\n {React.Children.map(this.props.children, this.renderChildTransition, this)}\n </TransitionGroup>\n );\n }\n}\n\nTransitionReplace.propTypes = {\n /** Specifies an additional class for the base element */\n children: PropTypes.element,\n /** Duration of the element appearance transition. */\n enterDuration: PropTypes.number,\n /** Duration of the element dismiss transition. */\n exitDuration: PropTypes.number,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** A `Transition` callback fired immediately after the `enter` or `appear` class is applied. */\n onChildEnter: PropTypes.func,\n /** A `Transition` callback fired immediately after the `enter-active` or `appear-active` class is applied. */\n onChildEntering: PropTypes.func,\n /**\n * A `Transition` callback fired immediately after the `enter` or\n * `appear` classes are removed and the done class is added to the DOM node.\n */\n onChildEntered: PropTypes.func,\n /** A `Transition` callback fired immediately after the `exit` class is applied. */\n onChildExit: PropTypes.func,\n /** A `Transition` callback fired immediately after the `exit-active` is applied. */\n onChildExiting: PropTypes.func,\n /**\n * A `Transition` callback fired immediately after the `exit` classes\n * are removed and the exit-done class is added to the DOM node.\n */\n onChildExited: PropTypes.func,\n /** An object that specifies transition styles. */\n transitionStyles: PropTypes.shape({\n entering: PropTypes.shape({}),\n entered: PropTypes.shape({}),\n exiting: PropTypes.shape({}),\n exited: PropTypes.shape({}),\n }),\n /** Specifies class name to append to the `Transition`. */\n transitionClassNames: PropTypes.string,\n};\n\nTransitionReplace.defaultProps = {\n children: undefined,\n enterDuration: 300,\n exitDuration: 300,\n className: undefined,\n onChildEnter: undefined,\n onChildEntering: undefined,\n onChildEntered: undefined,\n onChildExit: undefined,\n onChildExiting: undefined,\n onChildExited: undefined,\n transitionStyles: {},\n transitionClassNames: 'pgn__transition-replace',\n};\n\nexport default TransitionReplace;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,EAAEC,eAAe,QAAQ,wBAAwB;AACvE,OAAOC,UAAU,MAAM,YAAY;AAEnC,MAAMC,iBAAiB,SAASL,KAAK,CAACM,SAAS,CAAC;EAC9CC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG;MAAEC,MAAM,EAAE;IAAK,CAAC;IAE7B,IAAI,CAACC,YAAY,GAAG,IAAI,CAACA,YAAY,CAACC,IAAI,CAAC,IAAI,CAAC;IAChD,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACD,IAAI,CAAC,IAAI,CAAC;IACtD,IAAI,CAACE,cAAc,GAAG,IAAI,CAACA,cAAc,CAACF,IAAI,CAAC,IAAI,CAAC;IACpD,IAAI,CAACG,WAAW,GAAG,IAAI,CAACA,WAAW,CAACH,IAAI,CAAC,IAAI,CAAC;IAC9C,IAAI,CAACI,cAAc,GAAG,IAAI,CAACA,cAAc,CAACJ,IAAI,CAAC,IAAI,CAAC;IACpD,IAAI,CAAC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S,CAACmE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7BnC,OAAO,EAAEhC,SAAS,CAACmE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5BlC,OAAO,EAAEjC,SAAS,CAACmE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B5B,MAAM,EAAEvC,SAAS,CAACmE,KAAK,CAAC,CAAC,CAAC;EAC5B,CAAC,CAAC;EACF;EACAb,oBAAoB,EAAEtD,SAAS,CAACiE;AAClC,CAAC;AAED7D,iBAAiB,CAACgE,YAAY,GAAG;EAC/BP,QAAQ,EAAEQ,SAAS;EACnB1B,aAAa,EAAE,GAAG;EAClBE,YAAY,EAAE,GAAG;EACjBa,SAAS,EAAEW,SAAS;EACpB3D,YAAY,EAAE2D,SAAS;EACvBzD,eAAe,EAAEyD,SAAS;EAC1BxD,cAAc,EAAEwD,SAAS;EACzBvD,WAAW,EAAEuD,SAAS;EACtBtD,cAAc,EAAEsD,SAAS;EACzBrD,aAAa,EAAEqD,SAAS;EACxBvC,gBAAgB,EAAE,CAAC,CAAC;EACpBwB,oBAAoB,EAAE;AACxB,CAAC;AAED,eAAelD,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","CSSTransition","TransitionGroup","classNames","TransitionReplace","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","state","height","onChildEnter","bind","_assertThisInitialized","onChildEntering","onChildEntered","onChildExit","onChildExiting","onChildExited","_createClass","key","value","htmlNode","setState","offsetHeight","renderChildTransition","child","_this2","process","env","NODE_ENV","console","warn","commonChildStyles","padding","transitionStyles","entering","entered","exiting","position","top","left","right","pointerEvents","exited","createElement","timeout","enter","enterDuration","exit","exitDuration","unmountOnExit","mountOnEnter","onEnter","onEntering","onEntered","onExit","onExiting","onExited","transitionClassNames","style","_objectSpread","render","className","Children","map","children","Component","propTypes","element","number","string","func","shape","defaultProps","undefined"],"sources":["../../src/TransitionReplace/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport classNames from 'classnames';\n\nclass TransitionReplace extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = { height: null };\n\n this.onChildEnter = this.onChildEnter.bind(this);\n this.onChildEntering = this.onChildEntering.bind(this);\n this.onChildEntered = this.onChildEntered.bind(this);\n this.onChildExit = this.onChildExit.bind(this);\n this.onChildExiting = this.onChildExiting.bind(this);\n this.onChildExited = this.onChildExited.bind(this);\n }\n\n // Transition events are fired in this order:\n //\n // onEnter > onEntering > onEntered\n // onExit > onExiting > onExited\n //\n // Keep in mind that we always have two transitions happening\n // both the entering and leaving children\n //\n // We set the container height (for animation) in this order:\n //\n // 1. onChildExit (explicitly set the height to match the current current)\n // 2. onChildEntering (set the height to match the new content)\n // 3. onChildExited (reset the height to null)\n\n onChildEnter(htmlNode) {\n if (this.props.onChildEnter) { this.props.onChildEnter(htmlNode); }\n }\n\n onChildEntering(htmlNode) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildEntering) { this.props.onChildEntering(htmlNode); }\n }\n\n onChildEntered(htmlNode) {\n this.setState({ height: null });\n if (this.props.onChildEntered) { this.props.onChildEntered(htmlNode); }\n }\n\n onChildExit(htmlNode) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildExit) { this.props.onChildExit(htmlNode); }\n }\n\n onChildExiting(htmlNode) {\n if (this.props.onChildExiting) { this.props.onChildExiting(htmlNode); }\n }\n\n onChildExited(htmlNode) {\n this.setState({ height: null });\n if (this.props.onChildExited) { this.props.onChildExited(htmlNode); }\n }\n\n renderChildTransition(child) {\n if (!child.key && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\"TransitionReplace: A child is missing a 'key' prop. Keys are required for any child of this component.\");\n }\n // Makes the exiting and entering children occupy the same space\n // SCSS handles the crossfade so it can be easily overridden\n const commonChildStyles = {\n // Prevent margin-collapsing which throws off height calculations\n padding: '.1px 0',\n };\n\n const transitionStyles = {\n entering: {},\n entered: {},\n exiting: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n pointerEvents: 'none',\n },\n exited: {},\n };\n\n return (\n <CSSTransition\n timeout={{\n enter: this.props.enterDuration,\n exit: this.props.exitDuration,\n }}\n unmountOnExit\n mountOnEnter\n onEnter={this.onChildEnter}\n onEntering={this.onChildEntering}\n onEntered={this.onChildEntered}\n onExit={this.onChildExit}\n onExiting={this.onChildExiting}\n onExited={this.onChildExited}\n classNames={this.props.transitionClassNames}\n >\n {state => (\n <div\n style={{\n ...commonChildStyles,\n ...transitionStyles[state],\n ...this.props.transitionStyles[state],\n }}\n >\n {child}\n </div>\n )}\n </CSSTransition>\n );\n }\n\n render() {\n return (\n <TransitionGroup\n className={classNames(\n 'pgn-transition-replace-group',\n 'position-relative',\n { 'overflow-hidden': this.state.height !== null },\n this.props.className,\n )}\n style={{ height: this.state.height }}\n >\n {React.Children.map(this.props.children, this.renderChildTransition, this)}\n </TransitionGroup>\n );\n }\n}\n\nTransitionReplace.propTypes = {\n /** Specifies an additional class for the base element */\n children: PropTypes.element,\n /** Duration of the element appearance transition. */\n enterDuration: PropTypes.number,\n /** Duration of the element dismiss transition. */\n exitDuration: PropTypes.number,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** A `Transition` callback fired immediately after the `enter` or `appear` class is applied. */\n onChildEnter: PropTypes.func,\n /** A `Transition` callback fired immediately after the `enter-active` or `appear-active` class is applied. */\n onChildEntering: PropTypes.func,\n /**\n * A `Transition` callback fired immediately after the `enter` or\n * `appear` classes are removed and the done class is added to the DOM node.\n */\n onChildEntered: PropTypes.func,\n /** A `Transition` callback fired immediately after the `exit` class is applied. */\n onChildExit: PropTypes.func,\n /** A `Transition` callback fired immediately after the `exit-active` is applied. */\n onChildExiting: PropTypes.func,\n /**\n * A `Transition` callback fired immediately after the `exit` classes\n * are removed and the exit-done class is added to the DOM node.\n */\n onChildExited: PropTypes.func,\n /** An object that specifies transition styles. */\n transitionStyles: PropTypes.shape({\n entering: PropTypes.shape({}),\n entered: PropTypes.shape({}),\n exiting: PropTypes.shape({}),\n exited: PropTypes.shape({}),\n }),\n /** Specifies class name to append to the `Transition`. */\n transitionClassNames: PropTypes.string,\n};\n\nTransitionReplace.defaultProps = {\n children: undefined,\n enterDuration: 300,\n exitDuration: 300,\n className: undefined,\n onChildEnter: undefined,\n onChildEntering: undefined,\n onChildEntered: undefined,\n onChildExit: undefined,\n onChildExiting: undefined,\n onChildExited: undefined,\n transitionStyles: {},\n transitionClassNames: 'pgn__transition-replace',\n};\n\nexport default TransitionReplace;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,EAAEC,eAAe,QAAQ,wBAAwB;AACvE,OAAOC,UAAU,MAAM,YAAY;AAAC,IAE9BC,iBAAiB,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,iBAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,iBAAA;EACrB,SAAAA,kBAAYK,KAAK,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAP,iBAAA;IACjBM,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAMH,KAAK;IAEXC,KAAA,CAAKG,KAAK,GAAG;MAAEC,MAAM,EAAE;IAAK,CAAC;IAE7BJ,KAAA,CAAKK,YAAY,GAAGL,KAAA,CAAKK,YAAY,CAACC,IAAI,CAAAC,sBAAA,CAAAP,KAAA,CAAK,CAAC;IAChDA,KAAA,CAAKQ,eAAe,GAAGR,KAAA,CAAKQ,eAAe,CAACF,IAAI,CAAAC,sBAAA,CAAAP,KAAA,CAAK,CAAC;IACtDA,KAAA,CAAKS,cAAc,GAAGT,KAAA,CAAKS,cAAc,CAACH,IAAI,CAAAC,sBAAA,CAAAP,KAAA,CAAK,CAAC;IACpDA,KAAA,CAAKU,WAAW,GAAGV,KAAA,C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Ac,EAAE0D,SAAS;EACzBzD,aAAa,EAAEyD,SAAS;EACxBxC,gBAAgB,EAAE,CAAC,CAAC;EACpBwB,oBAAoB,EAAE;AACxB,CAAC;AAED,eAAe3D,iBAAiB"}
|
package/dist/Truncate/index.js
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
7
|
import React, { useLayoutEffect, useRef } from 'react';
|
|
2
8
|
import PropTypes from 'prop-types';
|
|
3
9
|
import { truncateLines } from './utils';
|
|
4
10
|
import useWindowSize from '../hooks/useWindowSize';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
var DEFAULT_TRUNCATE_LINES = 1;
|
|
12
|
+
var DEFAULT_TRUNCATE_ELLIPSIS = '...';
|
|
13
|
+
var DEFAULT_TRUNCATE_ELEMENT_TYPE = 'div';
|
|
8
14
|
function Truncate(_ref) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
width
|
|
21
|
-
} = useWindowSize();
|
|
22
|
-
useLayoutEffect(() => {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
lines = _ref.lines,
|
|
17
|
+
ellipsis = _ref.ellipsis,
|
|
18
|
+
elementType = _ref.elementType,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
whiteSpace = _ref.whiteSpace,
|
|
21
|
+
onTruncate = _ref.onTruncate;
|
|
22
|
+
var textContainer = useRef();
|
|
23
|
+
var _useWindowSize = useWindowSize(),
|
|
24
|
+
width = _useWindowSize.width;
|
|
25
|
+
useLayoutEffect(function () {
|
|
23
26
|
if (textContainer.current) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var _truncateLines = truncateLines(children, textContainer.current, {
|
|
28
|
+
ellipsis: ellipsis,
|
|
29
|
+
whiteSpace: whiteSpace,
|
|
30
|
+
lines: lines
|
|
31
|
+
}),
|
|
32
|
+
_truncateLines2 = _slicedToArray(_truncateLines, 2),
|
|
33
|
+
truncated = _truncateLines2[0],
|
|
34
|
+
original = _truncateLines2[1];
|
|
29
35
|
textContainer.current.setAttribute('title', original);
|
|
30
36
|
textContainer.current.setAttribute('aria-label', original);
|
|
31
37
|
textContainer.current.innerHTML = '';
|
|
32
|
-
truncated.forEach(element
|
|
38
|
+
truncated.forEach(function (element) {
|
|
33
39
|
textContainer.current.appendChild(element);
|
|
34
40
|
});
|
|
35
41
|
if (onTruncate) {
|
|
@@ -39,7 +45,7 @@ function Truncate(_ref) {
|
|
|
39
45
|
}, [children, ellipsis, lines, onTruncate, whiteSpace, width]);
|
|
40
46
|
return /*#__PURE__*/React.createElement(elementType, {
|
|
41
47
|
ref: textContainer,
|
|
42
|
-
className
|
|
48
|
+
className: className
|
|
43
49
|
});
|
|
44
50
|
}
|
|
45
51
|
Truncate.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useLayoutEffect","useRef","PropTypes","truncateLines","useWindowSize","DEFAULT_TRUNCATE_LINES","DEFAULT_TRUNCATE_ELLIPSIS","DEFAULT_TRUNCATE_ELEMENT_TYPE","Truncate","_ref","children","lines","ellipsis","elementType","className","whiteSpace","onTruncate","textContainer","width","current","truncated","original","setAttribute","innerHTML","forEach","element","appendChild","createElement","ref","propTypes","string","isRequired","oneOfType","number","node","bool","func","defaultProps","undefined"],"sources":["../../src/Truncate/index.jsx"],"sourcesContent":["import React, {\n useLayoutEffect, useRef,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport { truncateLines } from './utils';\nimport useWindowSize from '../hooks/useWindowSize';\n\nconst DEFAULT_TRUNCATE_LINES = 1;\nconst DEFAULT_TRUNCATE_ELLIPSIS = '...';\nconst DEFAULT_TRUNCATE_ELEMENT_TYPE = 'div';\n\nfunction Truncate({\n children, lines, ellipsis, elementType, className, whiteSpace, onTruncate,\n}) {\n const textContainer = useRef();\n const { width } = useWindowSize();\n\n useLayoutEffect(() => {\n if (textContainer.current) {\n const [truncated, original] = truncateLines(children, textContainer.current, {\n ellipsis,\n whiteSpace,\n lines,\n });\n textContainer.current.setAttribute('title', original);\n textContainer.current.setAttribute('aria-label', original);\n textContainer.current.innerHTML = '';\n truncated.forEach(element => {\n textContainer.current.appendChild(element);\n });\n if (onTruncate) {\n onTruncate(truncated);\n }\n }\n }, [children, ellipsis, lines, onTruncate, whiteSpace, width]);\n\n return React.createElement(elementType, {\n ref: textContainer,\n className,\n });\n}\n\nTruncate.propTypes = {\n /** The expected text to which the ellipsis would be applied. */\n children: PropTypes.string.isRequired,\n /** The number of lines the text to be truncated to. */\n lines: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Text content for the ellipsis - will appear after the truncated lines. */\n ellipsis: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),\n /** Adds the whitespace from before the ellipsis. */\n whiteSpace: PropTypes.bool,\n /** Custom html element for truncated text. */\n elementType: PropTypes.string,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Callback fired when a text truncating */\n onTruncate: PropTypes.func,\n};\n\nTruncate.defaultProps = {\n lines: DEFAULT_TRUNCATE_LINES,\n ellipsis: DEFAULT_TRUNCATE_ELLIPSIS,\n whiteSpace: false,\n elementType: DEFAULT_TRUNCATE_ELEMENT_TYPE,\n className: undefined,\n onTruncate: undefined,\n};\n\nexport default Truncate;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,eAAe,EAAEC,MAAM,QAClB,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,QAAQ,SAAS;AACvC,OAAOC,aAAa,MAAM,wBAAwB;AAElD,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useLayoutEffect","useRef","PropTypes","truncateLines","useWindowSize","DEFAULT_TRUNCATE_LINES","DEFAULT_TRUNCATE_ELLIPSIS","DEFAULT_TRUNCATE_ELEMENT_TYPE","Truncate","_ref","children","lines","ellipsis","elementType","className","whiteSpace","onTruncate","textContainer","_useWindowSize","width","current","_truncateLines","_truncateLines2","_slicedToArray","truncated","original","setAttribute","innerHTML","forEach","element","appendChild","createElement","ref","propTypes","string","isRequired","oneOfType","number","node","bool","func","defaultProps","undefined"],"sources":["../../src/Truncate/index.jsx"],"sourcesContent":["import React, {\n useLayoutEffect, useRef,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport { truncateLines } from './utils';\nimport useWindowSize from '../hooks/useWindowSize';\n\nconst DEFAULT_TRUNCATE_LINES = 1;\nconst DEFAULT_TRUNCATE_ELLIPSIS = '...';\nconst DEFAULT_TRUNCATE_ELEMENT_TYPE = 'div';\n\nfunction Truncate({\n children, lines, ellipsis, elementType, className, whiteSpace, onTruncate,\n}) {\n const textContainer = useRef();\n const { width } = useWindowSize();\n\n useLayoutEffect(() => {\n if (textContainer.current) {\n const [truncated, original] = truncateLines(children, textContainer.current, {\n ellipsis,\n whiteSpace,\n lines,\n });\n textContainer.current.setAttribute('title', original);\n textContainer.current.setAttribute('aria-label', original);\n textContainer.current.innerHTML = '';\n truncated.forEach(element => {\n textContainer.current.appendChild(element);\n });\n if (onTruncate) {\n onTruncate(truncated);\n }\n }\n }, [children, ellipsis, lines, onTruncate, whiteSpace, width]);\n\n return React.createElement(elementType, {\n ref: textContainer,\n className,\n });\n}\n\nTruncate.propTypes = {\n /** The expected text to which the ellipsis would be applied. */\n children: PropTypes.string.isRequired,\n /** The number of lines the text to be truncated to. */\n lines: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Text content for the ellipsis - will appear after the truncated lines. */\n ellipsis: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),\n /** Adds the whitespace from before the ellipsis. */\n whiteSpace: PropTypes.bool,\n /** Custom html element for truncated text. */\n elementType: PropTypes.string,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Callback fired when a text truncating */\n onTruncate: PropTypes.func,\n};\n\nTruncate.defaultProps = {\n lines: DEFAULT_TRUNCATE_LINES,\n ellipsis: DEFAULT_TRUNCATE_ELLIPSIS,\n whiteSpace: false,\n elementType: DEFAULT_TRUNCATE_ELEMENT_TYPE,\n className: undefined,\n onTruncate: undefined,\n};\n\nexport default Truncate;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IACVC,eAAe,E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