@openedx/paragon 21.12.1 → 21.12.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/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/_variables.scss +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/Pagination/index.scss +1 -0
- 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/DataTable/_variables.scss +1 -1
- 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/src/Pagination/index.scss +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","newId","Tabs","Component","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","newId","Tabs","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","toggle","bind","_assertThisInitialized","state","activeTab","uuid","_createClass","key","value","tab","setState","genLabelId","index","concat","genPanelId","buildLabels","_this2","labels","map","label","i","selected","labelId","createElement","role","id","onClick","className","active","buildPanels","_this3","children","panel","panelId","render","panels","Component","propTypes","arrayOf","node","isRequired","element"],"sources":["../../../src/Tabs/deprecated/index.jsx"],"sourcesContent":["// TODO: @jaebradley fix these eslint errors\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/anchor-is-valid */\n/* eslint-disable max-len */\nimport React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nimport newId from '../../utils/newId';\n\nclass Tabs extends React.Component {\n constructor(props) {\n super(props);\n\n this.toggle = this.toggle.bind(this);\n this.state = {\n activeTab: 0,\n uuid: newId('tabInterface'),\n };\n }\n\n toggle(tab) {\n if (this.state.activeTab !== tab) {\n this.setState({\n activeTab: tab,\n });\n }\n }\n\n genLabelId(index) {\n return `tab-label-${this.state.uuid}-${index}`;\n }\n\n genPanelId(index) {\n return `tab-panel-${this.state.uuid}-${index}`;\n }\n\n buildLabels() {\n return this.props.labels.map((label, i) => {\n const selected = this.state.activeTab === i;\n const labelId = this.genLabelId(i);\n\n return (\n <li key={labelId}>\n {/* eslint-disable-next-line react/button-has-type */}\n <button\n role=\"tab\"\n aria-selected={selected}\n aria-controls={this.genPanelId(i)}\n id={labelId}\n onClick={() => { this.toggle(i); }}\n className={classNames('nav-link nav-item', {\n active: selected,\n })}\n >\n {label}\n </button>\n </li>\n );\n });\n }\n\n buildPanels() {\n return this.props.children.map((panel, i) => {\n const selected = this.state.activeTab === i;\n const panelId = this.genPanelId(i);\n\n return (\n <div\n aria-hidden={!selected}\n aria-labelledby={this.genLabelId(i)}\n className={classNames(\n 'tab-pane',\n { active: selected },\n )}\n id={panelId}\n key={panelId}\n role=\"tabpanel\"\n >\n {panel}\n </div>\n );\n });\n }\n\n render() {\n const labels = this.buildLabels();\n const panels = this.buildPanels();\n\n return (\n <div className=\"tabs\">\n <ul\n role=\"tablist\"\n className={classNames([\n 'nav',\n 'nav-tabs',\n ])}\n >\n {labels}\n </ul>\n <div role=\"tabpanel\" className=\"tab-content\">\n {panels}\n </div>\n </div>\n );\n }\n}\n// TODO: custom validator that ensures labels and panels are the same length\nTabs.propTypes = {\n /** specifies the list of elements that will be displayed within each of the tabbed views. It is the content relevant to each label. Children should not be passed as Props, but should instead be nested between the opening and closing `<Tabs> </Tabs>` tags. */\n labels: PropTypes.arrayOf(PropTypes.node).isRequired,\n /** specifies the list of headings that will appear on all of the tabs that will be created.\n */\n children: PropTypes.arrayOf(PropTypes.element).isRequired,\n};\n\nexport default Tabs;\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,KAAK,MAAM,m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A,EAAS;MACP,IAAMjB,MAAM,GAAG,IAAI,CAACF,WAAW,CAAC,CAAC;MACjC,IAAMoB,MAAM,GAAG,IAAI,CAACN,WAAW,CAAC,CAAC;MAEjC,oBACE1C,KAAA,CAAAoC,aAAA;QAAKI,SAAS,EAAC;MAAM,gBACnBxC,KAAA,CAAAoC,aAAA;QACEC,IAAI,EAAC,SAAS;QACdG,SAAS,EAAEvC,UAAU,CAAC,CACpB,KAAK,EACL,UAAU,CACX;MAAE,GAEF6B,MACC,CAAC,eACL9B,KAAA,CAAAoC,aAAA;QAAKC,IAAI,EAAC,UAAU;QAACG,SAAS,EAAC;MAAa,GACzCQ,MACE,CACF,CAAC;IAEV;EAAC;EAAA,OAAA5C,IAAA;AAAA,EA/FgBJ,KAAK,CAACiD,SAAS,GAiGlC;AACA7C,IAAI,CAAC8C,SAAS,GAAG;EACf;EACApB,MAAM,EAAE5B,SAAS,CAACiD,OAAO,CAACjD,SAAS,CAACkD,IAAI,CAAC,CAACC,UAAU;EACpD;AACF;EACET,QAAQ,EAAE1C,SAAS,CAACiD,OAAO,CAACjD,SAAS,CAACoD,OAAO,CAAC,CAACD;AACjD,CAAC;AAED,eAAejD,IAAI"}
|
package/dist/Tabs/index.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
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", "className", "moreTabText", "defaultActiveKey", "activeKey"],
|
|
2
3
|
_excluded2 = ["title", "notification", "tabClassName"];
|
|
3
4
|
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); }
|
|
4
5
|
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; }
|
|
5
6
|
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; }
|
|
6
7
|
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; }
|
|
7
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return
|
|
8
|
-
function _toPrimitive(input, hint) { if (
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
16
|
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; }
|
|
10
17
|
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
18
|
import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
@@ -17,33 +24,36 @@ import Bubble from '../Bubble';
|
|
|
17
24
|
import Dropdown from '../Dropdown';
|
|
18
25
|
import useIndexOfLastVisibleChild from '../hooks/useIndexOfLastVisibleChild';
|
|
19
26
|
import Tab from './Tab';
|
|
20
|
-
export
|
|
27
|
+
export var MORE_TAB_TEXT = 'More...';
|
|
21
28
|
function Tabs(_ref) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
var _overflowElementRef$c, _overflowElementRef$c3;
|
|
30
|
+
var children = _ref.children,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
_ref$moreTabText = _ref.moreTabText,
|
|
33
|
+
moreTabText = _ref$moreTabText === void 0 ? MORE_TAB_TEXT : _ref$moreTabText,
|
|
34
|
+
defaultActiveKey = _ref.defaultActiveKey,
|
|
35
|
+
activeKey = _ref.activeKey,
|
|
29
36
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
var _useState = useState(null),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
containerElementRef = _useState2[0],
|
|
40
|
+
setContainerElementRef = _useState2[1];
|
|
41
|
+
var overflowElementRef = useRef(null);
|
|
42
|
+
var indexOfLastVisibleChild = useIndexOfLastVisibleChild(containerElementRef === null || containerElementRef === void 0 ? void 0 : containerElementRef.firstChild, (_overflowElementRef$c = overflowElementRef.current) === null || _overflowElementRef$c === void 0 ? void 0 : _overflowElementRef$c.parentNode);
|
|
43
|
+
useEffect(function () {
|
|
34
44
|
if (containerElementRef) {
|
|
35
|
-
|
|
36
|
-
mutations.forEach(mutation
|
|
45
|
+
var observer = new MutationObserver(function (mutations) {
|
|
46
|
+
mutations.forEach(function (mutation) {
|
|
37
47
|
// React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification
|
|
38
|
-
|
|
48
|
+
var eventKey = mutation.target.getAttribute('data-rb-event-key');
|
|
39
49
|
// React-Bootstrap attribute 'aria-selected' is responsible for selected/unselected state
|
|
40
|
-
|
|
50
|
+
var isActive = mutation.target.getAttribute('aria-selected') === 'true';
|
|
41
51
|
// datakey attribute is added manually to the dropdown
|
|
42
52
|
// elements so that they correspond to the native tabs' eventKey
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
var element = containerElementRef.querySelector("[datakey='".concat(eventKey, "']"));
|
|
54
|
+
var moreTab = containerElementRef.querySelector('.pgn__tab_more');
|
|
45
55
|
if (isActive) {
|
|
46
|
-
element
|
|
56
|
+
element === null || element === void 0 ? void 0 : element.classList.add('active');
|
|
47
57
|
// Here we add active class to the 'More Tab' if element exists in the dropdown
|
|
48
58
|
if (element) {
|
|
49
59
|
moreTab.classList.add('active');
|
|
@@ -51,7 +61,7 @@ function Tabs(_ref) {
|
|
|
51
61
|
moreTab.classList.remove('active');
|
|
52
62
|
}
|
|
53
63
|
} else {
|
|
54
|
-
element
|
|
64
|
+
element === null || element === void 0 ? void 0 : element.classList.remove('active');
|
|
55
65
|
}
|
|
56
66
|
});
|
|
57
67
|
});
|
|
@@ -60,42 +70,44 @@ function Tabs(_ref) {
|
|
|
60
70
|
subtree: true,
|
|
61
71
|
attributeFilter: ['aria-selected']
|
|
62
72
|
});
|
|
63
|
-
return ()
|
|
73
|
+
return function () {
|
|
74
|
+
return observer.disconnect();
|
|
75
|
+
};
|
|
64
76
|
}
|
|
65
77
|
return undefined;
|
|
66
78
|
}, [containerElementRef]);
|
|
67
|
-
useEffect(()
|
|
68
|
-
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
var _overflowElementRef$c2;
|
|
81
|
+
if ((_overflowElementRef$c2 = overflowElementRef.current) !== null && _overflowElementRef$c2 !== void 0 && _overflowElementRef$c2.parentNode) {
|
|
69
82
|
overflowElementRef.current.parentNode.tabIndex = -1;
|
|
70
83
|
}
|
|
71
|
-
}, [overflowElementRef.current
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
}, [(_overflowElementRef$c3 = overflowElementRef.current) === null || _overflowElementRef$c3 === void 0 ? void 0 : _overflowElementRef$c3.parentNode]);
|
|
85
|
+
var handleDropdownTabClick = useCallback(function (eventKey) {
|
|
86
|
+
var hiddenTab = containerElementRef.querySelector("[data-rb-event-key='".concat(eventKey, "']"));
|
|
74
87
|
hiddenTab.click();
|
|
75
88
|
}, [containerElementRef]);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
var tabsChildren = useMemo(function () {
|
|
90
|
+
var indexOfOverflowStart = indexOfLastVisibleChild + 1;
|
|
91
|
+
var handleDropdownKeyPress = function handleDropdownKeyPress(e, eventKey) {
|
|
79
92
|
if (e.key === 'Enter') {
|
|
80
93
|
handleDropdownTabClick(eventKey);
|
|
81
94
|
}
|
|
82
95
|
};
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
var childrenList = React.Children.map(children, function (child, index) {
|
|
97
|
+
var _child$type;
|
|
98
|
+
if ((child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) !== 'Tab' && process.env.NODE_ENV === 'development') {
|
|
85
99
|
// eslint-disable-next-line no-console
|
|
86
|
-
console.error(
|
|
100
|
+
console.error("Tabs children can only be of type Tab. ".concat(children[index], " was passed instead."));
|
|
87
101
|
}
|
|
88
102
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
89
103
|
return child;
|
|
90
104
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
tabClassName
|
|
96
|
-
} = _child$props,
|
|
105
|
+
var _child$props = child.props,
|
|
106
|
+
title = _child$props.title,
|
|
107
|
+
notification = _child$props.notification,
|
|
108
|
+
tabClassName = _child$props.tabClassName,
|
|
97
109
|
rest = _objectWithoutProperties(_child$props, _excluded2);
|
|
98
|
-
|
|
110
|
+
var newTitle;
|
|
99
111
|
if (notification) {
|
|
100
112
|
newTitle = /*#__PURE__*/React.createElement(React.Fragment, null, title, /*#__PURE__*/React.createElement(Bubble, {
|
|
101
113
|
variant: "error",
|
|
@@ -107,24 +119,28 @@ function Tabs(_ref) {
|
|
|
107
119
|
} else {
|
|
108
120
|
newTitle = title;
|
|
109
121
|
}
|
|
110
|
-
|
|
111
|
-
|
|
122
|
+
var tabClass = index > indexOfLastVisibleChild ? 'pgn__tab_invisible' : '';
|
|
123
|
+
var modifiedTab = /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, rest), {}, {
|
|
112
124
|
title: newTitle,
|
|
113
125
|
tabClassName: classNames(tabClass, tabClassName)
|
|
114
126
|
}));
|
|
115
127
|
return modifiedTab;
|
|
116
128
|
});
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
var moreTabHasNotification = false;
|
|
130
|
+
var overflowChildren = childrenList.slice(indexOfOverflowStart).map(function (overflowChild) {
|
|
119
131
|
if (!moreTabHasNotification && overflowChild.props.notification) {
|
|
120
132
|
moreTabHasNotification = true;
|
|
121
133
|
}
|
|
122
134
|
return /*#__PURE__*/React.createElement(Dropdown.Item, {
|
|
123
135
|
as: "li",
|
|
124
136
|
tabIndex: "0",
|
|
125
|
-
key:
|
|
126
|
-
onClick: ()
|
|
127
|
-
|
|
137
|
+
key: "".concat(overflowChild.props.eventKey, "overflow"),
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
return handleDropdownTabClick(overflowChild.props.eventKey);
|
|
140
|
+
},
|
|
141
|
+
onKeyPress: function onKeyPress(e) {
|
|
142
|
+
return handleDropdownKeyPress(e, overflowChild.props.eventKey);
|
|
143
|
+
},
|
|
128
144
|
disabled: overflowChild.props.disabled,
|
|
129
145
|
datakey: overflowChild.props.eventKey,
|
|
130
146
|
className: classNames({
|
package/dist/Tabs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useEffect","useMemo","useRef","useState","useCallback","classNames","PropTypes","BaseTabs","TabsDeprecated","Bubble","Dropdown","useIndexOfLastVisibleChild","Tab","MORE_TAB_TEXT","Tabs","_ref","children","className","moreTabText","defaultActiveKey","activeKey","props","_objectWithoutProperties","_excluded","containerElementRef","setContainerElementRef","overflowElementRef","indexOfLastVisibleChild","firstChild","current","parentNode","observer","MutationObserver","mutations","forEach","mutation","eventKey","target","getAttribute","isActive","element","querySelector","moreTab","classList","add","remove","observe","attributes","subtree","attributeFilter","disconnect","undefined","tabIndex","handleDropdownTabClick","hiddenTab","click","tabsChildren","indexOfOverflowStart","handleDropdownKeyPress","e","key","childrenList","Children","map","child","index","type","name","process","env","NODE_ENV","console","error","isValidElement","_child$props","title","notification","tabClassName","rest","_excluded2","newTitle","createElement","Fragment","variant","role","expandable","tabClass","modifiedTab","cloneElement","_objectSpread","moreTabHasNotification","overflowChildren","slice","overflowChild","Item","as","onClick","onKeyPress","disabled","datakey","active","splice","length","ref","Toggle","id","Menu","_extends","propTypes","oneOf","node","isRequired","string","defaultProps","Deprecated","default","TabContainer","TabContent","TabPane"],"sources":["../../src/Tabs/index.jsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useRef,\n useState,\n useCallback,\n} from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseTabs from 'react-bootstrap/Tabs';\nimport TabsDeprecated from './deprecated';\nimport Bubble from '../Bubble';\nimport Dropdown from '../Dropdown';\nimport useIndexOfLastVisibleChild from '../hooks/useIndexOfLastVisibleChild';\nimport Tab from './Tab';\n\nexport const MORE_TAB_TEXT = 'More...';\n\nfunction Tabs({\n children,\n className,\n moreTabText = MORE_TAB_TEXT,\n defaultActiveKey,\n activeKey,\n ...props\n}) {\n const [containerElementRef, setContainerElementRef] = useState(null);\n const overflowElementRef = useRef(null);\n const indexOfLastVisibleChild = useIndexOfLastVisibleChild(\n containerElementRef?.firstChild,\n overflowElementRef.current?.parentNode,\n );\n\n useEffect(() => {\n if (containerElementRef) {\n const observer = new MutationObserver((mutations => {\n mutations.forEach(mutation => {\n // React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification\n const eventKey = mutation.target.getAttribute('data-rb-event-key');\n // React-Bootstrap attribute 'aria-selected' is responsible for selected/unselected state\n const isActive = mutation.target.getAttribute('aria-selected') === 'true';\n // datakey attribute is added manually to the dropdown\n // elements so that they correspond to the native tabs' eventKey\n const element = containerElementRef.querySelector(`[datakey='${eventKey}']`);\n const moreTab = containerElementRef.querySelector('.pgn__tab_more');\n if (isActive) {\n element?.classList.add('active');\n // Here we add active class to the 'More Tab' if element exists in the dropdown\n if (element) {\n moreTab.classList.add('active');\n } else {\n moreTab.classList.remove('active');\n }\n } else {\n element?.classList.remove('active');\n }\n });\n }));\n observer.observe(containerElementRef, {\n attributes: true, subtree: true, attributeFilter: ['aria-selected'],\n });\n return () => observer.disconnect();\n }\n return undefined;\n }, [containerElementRef]);\n\n useEffect(() => {\n if (overflowElementRef.current?.parentNode) {\n overflowElementRef.current.parentNode.tabIndex = -1;\n }\n }, [overflowElementRef.current?.parentNode]);\n\n const handleDropdownTabClick = useCallback((eventKey) => {\n const hiddenTab = containerElementRef.querySelector(`[data-rb-event-key='${eventKey}']`);\n hiddenTab.click();\n }, [containerElementRef]);\n\n const tabsChildren = useMemo(() => {\n const indexOfOverflowStart = indexOfLastVisibleChild + 1;\n const handleDropdownKeyPress = (e, eventKey) => {\n if (e.key === 'Enter') {\n handleDropdownTabClick(eventKey);\n }\n };\n const childrenList = React.Children.map(children, (child, index) => {\n if (child?.type?.name !== 'Tab' && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(\n `Tabs children can only be of type Tab. ${children[index]} was passed instead.`,\n );\n }\n if (!React.isValidElement(child)) {\n return child;\n }\n const {\n title, notification, tabClassName, ...rest\n } = child.props;\n let newTitle;\n if (notification) {\n newTitle = (\n <>\n {title}\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n aria-live=\"polite\"\n expandable\n >\n {notification}\n </Bubble>\n </>\n );\n } else {\n newTitle = title;\n }\n const tabClass = index > indexOfLastVisibleChild ? 'pgn__tab_invisible' : '';\n const modifiedTab = React.cloneElement(child, {\n ...rest,\n title: newTitle,\n tabClassName: classNames(tabClass, tabClassName),\n });\n return modifiedTab;\n });\n let moreTabHasNotification = false;\n const overflowChildren = childrenList.slice(indexOfOverflowStart)\n .map(overflowChild => {\n if (!moreTabHasNotification && overflowChild.props.notification) {\n moreTabHasNotification = true;\n }\n return (\n <Dropdown.Item\n as=\"li\"\n tabIndex=\"0\"\n key={`${overflowChild.props.eventKey}overflow`}\n onClick={() => handleDropdownTabClick(overflowChild.props.eventKey)}\n onKeyPress={(e) => handleDropdownKeyPress(e, overflowChild.props.eventKey)}\n disabled={overflowChild.props.disabled}\n datakey={overflowChild.props.eventKey}\n className={classNames({\n active: overflowChild.props.eventKey === defaultActiveKey || overflowChild.props.eventKey === activeKey,\n }, 'pgn__tabs__dropdown-item')}\n >\n {overflowChild.props.title}\n </Dropdown.Item>\n );\n });\n\n childrenList.splice(indexOfOverflowStart, 0, (<Tab\n key=\"moreTabKey\"\n tabClassName={classNames(!overflowChildren.length && 'pgn__tab_invisible', 'pgn__tab_more')}\n title={(\n <Dropdown ref={overflowElementRef}>\n <Dropdown.Toggle\n variant=\"link\"\n className=\"nav-link\"\n id=\"pgn__tab-toggle\"\n >\n {moreTabText}\n {moreTabHasNotification && (\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n />\n )}\n </Dropdown.Toggle>\n <Dropdown.Menu as=\"ul\" className=\"dropdown-menu-right\">{overflowChildren}</Dropdown.Menu>\n </Dropdown>\n )}\n />\n ));\n return childrenList;\n }, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText, handleDropdownTabClick]);\n\n return (\n <div ref={setContainerElementRef}>\n <BaseTabs\n defaultActiveKey={defaultActiveKey}\n activeKey={activeKey}\n {...props}\n className={classNames(className, 'pgn__tabs')}\n >\n {tabsChildren}\n </BaseTabs>\n </div>\n );\n}\n\nTabs.propTypes = {\n /** Specifies variant to use. */\n variant: PropTypes.oneOf(['tabs', 'pills', 'inverse-tabs', 'inverse-pills', 'button-group']),\n /** Specifies elements that is processed to create tabs. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies text for the 'More' tab. */\n moreTabText: PropTypes.string,\n /** Specifies default active tab (uncontrolled usage). */\n defaultActiveKey: PropTypes.string,\n /** Specifies active tab (controlled usage). */\n activeKey: PropTypes.string,\n};\n\nTabs.defaultProps = {\n variant: 'tabs',\n className: undefined,\n moreTabText: MORE_TAB_TEXT,\n defaultActiveKey: undefined,\n activeKey: undefined,\n};\n\nTabs.Deprecated = TabsDeprecated;\n\nexport default Tabs;\nexport { Tab };\nexport { default as TabContainer } from 'react-bootstrap/TabContainer';\nexport { default as TabContent } from 'react-bootstrap/TabContent';\nexport { default as TabPane } from 'react-bootstrap/TabPane';\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,WAAW,QACN,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OAAOC,cAAc,MAAM,cAAc;AACzC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,0BAA0B,MAAM,qCAAqC;AAC5E,OAAOC,GAAG,MAAM,OAAO;AAEvB,OAAO,MAAMC,aAAa,GAAG,SAAS;AAEtC,SAASC,IAAIA,CAAAC,IAAA,EAOV;EAAA,IAPW;MACZC,QAAQ;MACRC,SAAS;MACTC,WAAW,GAAGL,aAAa;MAC3BM,gBAAgB;MAChBC;IAEF,CAAC,GAAAL,IAAA;IADIM,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAER,MAAM,CAACC,mBAAmB,EAAE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eAAeM,IAAI;AACnB,SAASF,GAAG;AACZ,SAASuG,OAAO,IAAIC,YAAY,QAAQ,8BAA8B;AACtE,SAASD,OAAO,IAAIE,UAAU,QAAQ,4BAA4B;AAClE,SAASF,OAAO,IAAIG,OAAO,QAAQ,yBAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useEffect","useMemo","useRef","useState","useCallback","classNames","PropTypes","BaseTabs","TabsDeprecated","Bubble","Dropdown","useIndexOfLastVisibleChild","Tab","MORE_TAB_TEXT","Tabs","_ref","_overflowElementRef$c","_overflowElementRef$c3","children","className","_ref$moreTabText","moreTabText","defaultActiveKey","activeKey","props","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","containerElementRef","setContainerElementRef","overflowElementRef","indexOfLastVisibleChild","firstChild","current","parentNode","observer","MutationObserver","mutations","forEach","mutation","eventKey","target","getAttribute","isActive","element","querySelector","concat","moreTab","classList","add","remove","observe","attributes","subtree","attributeFilter","disconnect","undefined","_overflowElementRef$c2","tabIndex","handleDropdownTabClick","hiddenTab","click","tabsChildren","indexOfOverflowStart","handleDropdownKeyPress","e","key","childrenList","Children","map","child","index","_child$type","type","name","process","env","NODE_ENV","console","error","isValidElement","_child$props","title","notification","tabClassName","rest","_excluded2","newTitle","createElement","Fragment","variant","role","expandable","tabClass","modifiedTab","cloneElement","_objectSpread","moreTabHasNotification","overflowChildren","slice","overflowChild","Item","as","onClick","onKeyPress","disabled","datakey","active","splice","length","ref","Toggle","id","Menu","_extends","propTypes","oneOf","node","isRequired","string","defaultProps","Deprecated","default","TabContainer","TabContent","TabPane"],"sources":["../../src/Tabs/index.jsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useRef,\n useState,\n useCallback,\n} from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseTabs from 'react-bootstrap/Tabs';\nimport TabsDeprecated from './deprecated';\nimport Bubble from '../Bubble';\nimport Dropdown from '../Dropdown';\nimport useIndexOfLastVisibleChild from '../hooks/useIndexOfLastVisibleChild';\nimport Tab from './Tab';\n\nexport const MORE_TAB_TEXT = 'More...';\n\nfunction Tabs({\n children,\n className,\n moreTabText = MORE_TAB_TEXT,\n defaultActiveKey,\n activeKey,\n ...props\n}) {\n const [containerElementRef, setContainerElementRef] = useState(null);\n const overflowElementRef = useRef(null);\n const indexOfLastVisibleChild = useIndexOfLastVisibleChild(\n containerElementRef?.firstChild,\n overflowElementRef.current?.parentNode,\n );\n\n useEffect(() => {\n if (containerElementRef) {\n const observer = new MutationObserver((mutations => {\n mutations.forEach(mutation => {\n // React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification\n const eventKey = mutation.target.getAttribute('data-rb-event-key');\n // React-Bootstrap attribute 'aria-selected' is responsible for selected/unselected state\n const isActive = mutation.target.getAttribute('aria-selected') === 'true';\n // datakey attribute is added manually to the dropdown\n // elements so that they correspond to the native tabs' eventKey\n const element = containerElementRef.querySelector(`[datakey='${eventKey}']`);\n const moreTab = containerElementRef.querySelector('.pgn__tab_more');\n if (isActive) {\n element?.classList.add('active');\n // Here we add active class to the 'More Tab' if element exists in the dropdown\n if (element) {\n moreTab.classList.add('active');\n } else {\n moreTab.classList.remove('active');\n }\n } else {\n element?.classList.remove('active');\n }\n });\n }));\n observer.observe(containerElementRef, {\n attributes: true, subtree: true, attributeFilter: ['aria-selected'],\n });\n return () => observer.disconnect();\n }\n return undefined;\n }, [containerElementRef]);\n\n useEffect(() => {\n if (overflowElementRef.current?.parentNode) {\n overflowElementRef.current.parentNode.tabIndex = -1;\n }\n }, [overflowElementRef.current?.parentNode]);\n\n const handleDropdownTabClick = useCallback((eventKey) => {\n const hiddenTab = containerElementRef.querySelector(`[data-rb-event-key='${eventKey}']`);\n hiddenTab.click();\n }, [containerElementRef]);\n\n const tabsChildren = useMemo(() => {\n const indexOfOverflowStart = indexOfLastVisibleChild + 1;\n const handleDropdownKeyPress = (e, eventKey) => {\n if (e.key === 'Enter') {\n handleDropdownTabClick(eventKey);\n }\n };\n const childrenList = React.Children.map(children, (child, index) => {\n if (child?.type?.name !== 'Tab' && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(\n `Tabs children can only be of type Tab. ${children[index]} was passed instead.`,\n );\n }\n if (!React.isValidElement(child)) {\n return child;\n }\n const {\n title, notification, tabClassName, ...rest\n } = child.props;\n let newTitle;\n if (notification) {\n newTitle = (\n <>\n {title}\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n aria-live=\"polite\"\n expandable\n >\n {notification}\n </Bubble>\n </>\n );\n } else {\n newTitle = title;\n }\n const tabClass = index > indexOfLastVisibleChild ? 'pgn__tab_invisible' : '';\n const modifiedTab = React.cloneElement(child, {\n ...rest,\n title: newTitle,\n tabClassName: classNames(tabClass, tabClassName),\n });\n return modifiedTab;\n });\n let moreTabHasNotification = false;\n const overflowChildren = childrenList.slice(indexOfOverflowStart)\n .map(overflowChild => {\n if (!moreTabHasNotification && overflowChild.props.notification) {\n moreTabHasNotification = true;\n }\n return (\n <Dropdown.Item\n as=\"li\"\n tabIndex=\"0\"\n key={`${overflowChild.props.eventKey}overflow`}\n onClick={() => handleDropdownTabClick(overflowChild.props.eventKey)}\n onKeyPress={(e) => handleDropdownKeyPress(e, overflowChild.props.eventKey)}\n disabled={overflowChild.props.disabled}\n datakey={overflowChild.props.eventKey}\n className={classNames({\n active: overflowChild.props.eventKey === defaultActiveKey || overflowChild.props.eventKey === activeKey,\n }, 'pgn__tabs__dropdown-item')}\n >\n {overflowChild.props.title}\n </Dropdown.Item>\n );\n });\n\n childrenList.splice(indexOfOverflowStart, 0, (<Tab\n key=\"moreTabKey\"\n tabClassName={classNames(!overflowChildren.length && 'pgn__tab_invisible', 'pgn__tab_more')}\n title={(\n <Dropdown ref={overflowElementRef}>\n <Dropdown.Toggle\n variant=\"link\"\n className=\"nav-link\"\n id=\"pgn__tab-toggle\"\n >\n {moreTabText}\n {moreTabHasNotification && (\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n />\n )}\n </Dropdown.Toggle>\n <Dropdown.Menu as=\"ul\" className=\"dropdown-menu-right\">{overflowChildren}</Dropdown.Menu>\n </Dropdown>\n )}\n />\n ));\n return childrenList;\n }, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText, handleDropdownTabClick]);\n\n return (\n <div ref={setContainerElementRef}>\n <BaseTabs\n defaultActiveKey={defaultActiveKey}\n activeKey={activeKey}\n {...props}\n className={classNames(className, 'pgn__tabs')}\n >\n {tabsChildren}\n </BaseTabs>\n </div>\n );\n}\n\nTabs.propTypes = {\n /** Specifies variant to use. */\n variant: PropTypes.oneOf(['tabs', 'pills', 'inverse-tabs', 'inverse-pills', 'button-group']),\n /** Specifies elements that is processed to create tabs. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies text for the 'More' tab. */\n moreTabText: PropTypes.string,\n /** Specifies default active tab (uncontrolled usage). */\n defaultActiveKey: PropTypes.string,\n /** Specifies active tab (controlled usage). */\n activeKey: PropTypes.string,\n};\n\nTabs.defaultProps = {\n variant: 'tabs',\n className: undefined,\n moreTabText: MORE_TAB_TEXT,\n defaultActiveKey: undefined,\n activeKey: undefined,\n};\n\nTabs.Deprecated = TabsDeprecated;\n\nexport default Tabs;\nexport { Tab };\nexport { default as TabContainer } from 'react-bootstrap/TabContainer';\nexport { default as TabContent } from 'react-bootstrap/TabContent';\nexport { default as TabPane } from 'react-bootstrap/TabPane';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,WAAW,QACN,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OAAOC,cAAc,MAAM,cAAc;AACzC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,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IC,YAAY,QAAQ,8BAA8B;AACtE,SAASD,OAAO,IAAIE,UAAU,QAAQ,4BAA4B;AAClE,SAASF,OAAO,IAAIG,OAAO,QAAQ,yBAAyB"}
|
package/dist/TextArea/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["className", "inputRef"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
@@ -8,10 +8,8 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import asInput from '../asInput';
|
|
9
9
|
import withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';
|
|
10
10
|
function Text(props) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
inputRef
|
|
14
|
-
} = props,
|
|
11
|
+
var className = props.className,
|
|
12
|
+
inputRef = props.inputRef,
|
|
15
13
|
others = _objectWithoutProperties(props, _excluded);
|
|
16
14
|
return /*#__PURE__*/React.createElement("textarea", _extends({}, others, {
|
|
17
15
|
className: className,
|
|
@@ -30,11 +28,15 @@ Text.defaultProps = {
|
|
|
30
28
|
className: undefined,
|
|
31
29
|
inputRef: undefined
|
|
32
30
|
};
|
|
33
|
-
|
|
31
|
+
var TextArea = asInput(withDeprecatedProps(Text, 'TextArea', {
|
|
34
32
|
className: {
|
|
35
33
|
deprType: DeprTypes.FORMAT,
|
|
36
|
-
expect:
|
|
37
|
-
|
|
34
|
+
expect: function expect(value) {
|
|
35
|
+
return typeof value === 'string';
|
|
36
|
+
},
|
|
37
|
+
transform: function transform(value) {
|
|
38
|
+
return Array.isArray(value) ? value.join(' ') : value;
|
|
39
|
+
},
|
|
38
40
|
message: 'It should be a string.'
|
|
39
41
|
}
|
|
40
42
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","asInput","withDeprecatedProps","DeprTypes","Text","props","className","inputRef","others","_objectWithoutProperties","_excluded","createElement","_extends","ref","propTypes","string","oneOfType","func","shape","current","instanceOf","element","defaultProps","undefined","TextArea","deprType","FORMAT","expect","value","transform","Array","isArray","join","message"],"sources":["../../src/TextArea/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport asInput from '../asInput';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nfunction Text(props) {\n const {\n className,\n inputRef,\n ...others\n } = props;\n\n return (\n <textarea\n {...others}\n className={className}\n ref={inputRef}\n />\n );\n}\n\nText.propTypes = {\n className: PropTypes.string,\n /** specifies all of the properties that are necessary from the included `asInput` component. Please see details for input requirements within that component.\n */\n inputRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.instanceOf(PropTypes.element) }),\n ]),\n};\n\nText.defaultProps = {\n className: undefined,\n inputRef: undefined,\n};\n\nconst TextArea = asInput(withDeprecatedProps(Text, 'TextArea', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n}));\n\nexport default TextArea;\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,SAASC,IAAIA,CAACC,KAAK,EAAE;EACnB,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","asInput","withDeprecatedProps","DeprTypes","Text","props","className","inputRef","others","_objectWithoutProperties","_excluded","createElement","_extends","ref","propTypes","string","oneOfType","func","shape","current","instanceOf","element","defaultProps","undefined","TextArea","deprType","FORMAT","expect","value","transform","Array","isArray","join","message"],"sources":["../../src/TextArea/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport asInput from '../asInput';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nfunction Text(props) {\n const {\n className,\n inputRef,\n ...others\n } = props;\n\n return (\n <textarea\n {...others}\n className={className}\n ref={inputRef}\n />\n );\n}\n\nText.propTypes = {\n className: PropTypes.string,\n /** specifies all of the properties that are necessary from the included `asInput` component. Please see details for input requirements within that component.\n */\n inputRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.instanceOf(PropTypes.element) }),\n ]),\n};\n\nText.defaultProps = {\n className: undefined,\n inputRef: undefined,\n};\n\nconst TextArea = asInput(withDeprecatedProps(Text, 'TextArea', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n}));\n\nexport default TextArea;\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,SAASC,IAAIA,CAACC,KAAK,EAAE;EACnB,IACEC,SAAS,GAGPD,KAAK,CAHPC,SAAS;IACTC,QAAQ,GAENF,KAAK,CAFPE,QAAQ;IACLC,MAAM,GAAAC,wBAAA,CACPJ,KAAK,EAAAK,SAAA;EAET,oBACEX,KAAA,CAAAY,aAAA,aAAAC,QAAA,KACMJ,MAAM;IACVF,SAAS,EAAEA,SAAU;IACrBO,GAAG,EAAEN;EAAS,EACf,CAAC;AAEN;AAEAH,IAAI,CAACU,SAAS,GAAG;EACfR,SAAS,EAAEN,SAAS,CAACe,MAAM;EAC3B;AACF;EACER,QAAQ,EAAEP,SAAS,CAACgB,SAAS,CAAC,CAC5BhB,SAAS,CAACiB,IAAI,EACdjB,SAAS,CAACkB,KAAK,CAAC;IAAEC,OAAO,EAAEnB,SAAS,CAACoB,UAAU,CAACpB,SAAS,CAACqB,OAAO;EAAE,CAAC,CAAC,CACtE;AACH,CAAC;AAEDjB,IAAI,CAACkB,YAAY,GAAG;EAClBhB,SAAS,EAAEiB,SAAS;EACpBhB,QAAQ,EAAEgB;AACZ,CAAC;AAED,IAAMC,QAAQ,GAAGvB,OAAO,CAACC,mBAAmB,CAACE,IAAI,EAAE,UAAU,EAAE;EAC7DE,SAAS,EAAE;IACTmB,QAAQ,EAAEtB,SAAS,CAACuB,MAAM;IAC1BC,MAAM,EAAE,SAAAA,OAAAC,KAAK;MAAA,OAAI,OAAOA,KAAK,KAAK,QAAQ;IAAA;IAC1CC,SAAS,EAAE,SAAAA,UAAAD,KAAK;MAAA,OAAKE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,CAACI,IAAI,CAAC,GAAG,CAAC,GAAGJ,KAAK;IAAA,CAAC;IACpEK,OAAO,EAAE;EACX;AACF,CAAC,CAAC,CAAC;AAEH,eAAeT,QAAQ"}
|
|
@@ -1,31 +1,53 @@
|
|
|
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
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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
|
+
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); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
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); }; }
|
|
10
|
+
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); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1
14
|
import React from 'react';
|
|
2
15
|
import ReactDOM from 'react-dom';
|
|
3
16
|
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
var ToastContainer = /*#__PURE__*/function (_React$Component) {
|
|
18
|
+
_inherits(ToastContainer, _React$Component);
|
|
19
|
+
var _super = _createSuper(ToastContainer);
|
|
20
|
+
function ToastContainer(props) {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, ToastContainer);
|
|
23
|
+
_this = _super.call(this, props);
|
|
24
|
+
_this.toastRootName = 'toast-root';
|
|
8
25
|
if (typeof document === 'undefined') {
|
|
9
|
-
|
|
10
|
-
} else if (document.getElementById(
|
|
11
|
-
|
|
26
|
+
_this.rootElement = null;
|
|
27
|
+
} else if (document.getElementById(_this.toastRootName)) {
|
|
28
|
+
_this.rootElement = document.getElementById(_this.toastRootName);
|
|
12
29
|
} else {
|
|
13
|
-
|
|
14
|
-
rootElement.setAttribute('id',
|
|
30
|
+
var rootElement = document.createElement('div');
|
|
31
|
+
rootElement.setAttribute('id', _this.toastRootName);
|
|
15
32
|
rootElement.setAttribute('class', 'toast-container');
|
|
16
33
|
rootElement.setAttribute('role', 'alert');
|
|
17
34
|
rootElement.setAttribute('aria-live', 'polite');
|
|
18
35
|
rootElement.setAttribute('aria-atomic', 'true');
|
|
19
|
-
|
|
36
|
+
_this.rootElement = document.body.appendChild(rootElement);
|
|
20
37
|
}
|
|
38
|
+
return _this;
|
|
21
39
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
_createClass(ToastContainer, [{
|
|
41
|
+
key: "render",
|
|
42
|
+
value: function render() {
|
|
43
|
+
if (this.rootElement) {
|
|
44
|
+
return /*#__PURE__*/ReactDOM.createPortal(this.props.children, this.rootElement);
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
25
47
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
48
|
+
}]);
|
|
49
|
+
return ToastContainer;
|
|
50
|
+
}(React.Component);
|
|
29
51
|
ToastContainer.propTypes = {
|
|
30
52
|
/** Specifies contents of the component. */
|
|
31
53
|
children: PropTypes.node.isRequired
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastContainer.js","names":["React","ReactDOM","PropTypes","ToastContainer","Component","
|
|
1
|
+
{"version":3,"file":"ToastContainer.js","names":["React","ReactDOM","PropTypes","ToastContainer","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","toastRootName","document","rootElement","getElementById","createElement","setAttribute","body","appendChild","_createClass","key","value","render","createPortal","children","Component","propTypes","node","isRequired"],"sources":["../../src/Toast/ToastContainer.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\n\nclass ToastContainer extends React.Component {\n constructor(props) {\n super(props);\n this.toastRootName = 'toast-root';\n if (typeof document === 'undefined') {\n this.rootElement = null;\n } else if (document.getElementById(this.toastRootName)) {\n this.rootElement = document.getElementById(this.toastRootName);\n } else {\n const rootElement = document.createElement('div');\n rootElement.setAttribute('id', this.toastRootName);\n rootElement.setAttribute('class', 'toast-container');\n rootElement.setAttribute('role', 'alert');\n rootElement.setAttribute('aria-live', 'polite');\n rootElement.setAttribute('aria-atomic', 'true');\n this.rootElement = document.body.appendChild(rootElement);\n }\n }\n\n render() {\n if (this.rootElement) {\n return ReactDOM.createPortal(\n this.props.children,\n this.rootElement,\n );\n }\n return null;\n }\n}\n\nToastContainer.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node.isRequired,\n};\n\nexport default ToastContainer;\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,OAAOC,SAAS,MAAM,YAAY;AAAC,IAE7BC,cAAc,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,cAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,cAAA;EAClB,SAAAA,eAAYK,KAAK,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAP,cAAA;IACjBM,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAMH,KAAK;IACXC,KAAA,CAAKG,aAAa,GAAG,YAAY;IACjC,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;MACnCJ,KAAA,CAAKK,WAAW,GAAG,IAAI;IACzB,CAAC,MAAM,IAAID,QAAQ,CAACE,cAAc,CAACN,KAAA,CAAKG,aAAa,CAAC,EAAE;MACtDH,KAAA,CAAKK,WAAW,GAAGD,QAAQ,CAACE,cAAc,CAACN,KAAA,CAAKG,aAAa,CAAC;IAChE,CAAC,MAAM;MACL,IAAME,WAAW,GAAGD,QAAQ,CAACG,aAAa,CAAC,KAAK,CAAC;MACjDF,WAAW,CAACG,YAAY,CAAC,IAAI,EAAER,KAAA,CAAKG,aAAa,CAAC;MAClDE,WAAW,CAACG,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;MACpDH,WAAW,CAACG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC;MACzCH,WAAW,CAACG,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;MAC/CH,WAAW,CAACG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC;MAC/CR,KAAA,CAAKK,WAAW,GAAGD,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACL,WAAW,CAAC;IAC3D;IAAC,OAAAL,KAAA;EACH;EAACW,YAAA,CAAAjB,cAAA;IAAAkB,GAAA;IAAAC,KAAA,EAED,SAAAC,OAAA,EAAS;MACP,IAAI,IAAI,CAACT,WAAW,EAAE;QACpB,oBAAOb,QAAQ,CAACuB,YAAY,CAC1B,IAAI,CAAChB,KAAK,CAACiB,QAAQ,EACnB,IAAI,CAACX,WACP,CAAC;MACH;MACA,OAAO,IAAI;IACb;EAAC;EAAA,OAAAX,cAAA;AAAA,EA3B0BH,KAAK,CAAC0B,SAAS;AA8B5CvB,cAAc,CAACwB,SAAS,GAAG;EACzB;EACAF,QAAQ,EAAEvB,SAAS,CAAC0B,IAAI,CAACC;AAC3B,CAAC;AAED,eAAe1B,cAAc"}
|
package/dist/Toast/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["action", "children", "className", "closeLabel", "onClose", "show"];
|
|
2
2
|
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); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3
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; }
|
|
4
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; }
|
|
5
11
|
import React, { useState } from 'react';
|
|
@@ -12,21 +18,22 @@ import ToastContainer from './ToastContainer';
|
|
|
12
18
|
import Button from '../Button';
|
|
13
19
|
import Icon from '../Icon';
|
|
14
20
|
import IconButton from '../IconButton';
|
|
15
|
-
export
|
|
16
|
-
export
|
|
21
|
+
export var TOAST_CLOSE_LABEL_TEXT = 'Close';
|
|
22
|
+
export var TOAST_DELAY = 5000;
|
|
17
23
|
function Toast(_ref) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
show
|
|
25
|
-
} = _ref,
|
|
24
|
+
var action = _ref.action,
|
|
25
|
+
children = _ref.children,
|
|
26
|
+
className = _ref.className,
|
|
27
|
+
closeLabel = _ref.closeLabel,
|
|
28
|
+
onClose = _ref.onClose,
|
|
29
|
+
show = _ref.show,
|
|
26
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
var intl = useIntl();
|
|
32
|
+
var _useState = useState(true),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
autoHide = _useState2[0],
|
|
35
|
+
setAutoHide = _useState2[1];
|
|
36
|
+
var intlCloseLabel = closeLabel || intl.formatMessage({
|
|
30
37
|
id: 'pgn.Toast.closeLabel',
|
|
31
38
|
defaultMessage: 'Close',
|
|
32
39
|
description: 'Close label for Toast component'
|
|
@@ -35,10 +42,18 @@ function Toast(_ref) {
|
|
|
35
42
|
autohide: autoHide,
|
|
36
43
|
className: classNames('pgn__toast', className),
|
|
37
44
|
onClose: onClose,
|
|
38
|
-
onBlur: ()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
onBlur: function onBlur() {
|
|
46
|
+
return setAutoHide(true);
|
|
47
|
+
},
|
|
48
|
+
onFocus: function onFocus() {
|
|
49
|
+
return setAutoHide(false);
|
|
50
|
+
},
|
|
51
|
+
onMouseOut: function onMouseOut() {
|
|
52
|
+
return setAutoHide(true);
|
|
53
|
+
},
|
|
54
|
+
onMouseOver: function onMouseOver() {
|
|
55
|
+
return setAutoHide(false);
|
|
56
|
+
},
|
|
42
57
|
show: show
|
|
43
58
|
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
44
59
|
className: "toast-header"
|
package/dist/Toast/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","classNames","PropTypes","BaseToast","useIntl","Close","ToastContainer","Button","Icon","IconButton","TOAST_CLOSE_LABEL_TEXT","TOAST_DELAY","Toast","_ref","action","children","className","closeLabel","onClose","show","rest","_objectWithoutProperties","_excluded","intl","autoHide","setAutoHide","intlCloseLabel","formatMessage","id","defaultMessage","description","createElement","_extends","autohide","onBlur","onFocus","onMouseOut","onMouseOver","iconAs","alt","src","onClick","variant","invertColors","as","href","size","label","defaultProps","undefined","delay","propTypes","string","isRequired","func","bool","shape","number"],"sources":["../../src/Toast/index.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nimport BaseToast from 'react-bootstrap/Toast';\nimport { useIntl } from 'react-intl';\n\nimport { Close } from '../../icons';\nimport ToastContainer from './ToastContainer';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\n\nexport const TOAST_CLOSE_LABEL_TEXT = 'Close';\nexport const TOAST_DELAY = 5000;\n\nfunction Toast({\n action, children, className, closeLabel, onClose, show, ...rest\n}) {\n const intl = useIntl();\n const [autoHide, setAutoHide] = useState(true);\n const intlCloseLabel = closeLabel || intl.formatMessage({\n id: 'pgn.Toast.closeLabel',\n defaultMessage: 'Close',\n description: 'Close label for Toast component',\n });\n return (\n <ToastContainer>\n <BaseToast\n autohide={autoHide}\n className={classNames('pgn__toast', className)}\n onClose={onClose}\n onBlur={() => setAutoHide(true)}\n onFocus={() => setAutoHide(false)}\n onMouseOut={() => setAutoHide(true)}\n onMouseOver={() => setAutoHide(false)}\n show={show}\n {...rest}\n >\n <div\n className=\"toast-header\"\n >\n <p className=\"small\">{children}</p>\n <div className=\"toast-header-btn-container\">\n <IconButton\n iconAs={Icon}\n alt={intlCloseLabel}\n className=\"align-self-start\"\n src={Close}\n onClick={onClose}\n variant=\"primary\"\n invertColors\n />\n </div>\n </div>\n {action && (\n <Button\n as={action.href ? 'a' : 'button'}\n href={action.href}\n onClick={action.onClick}\n size=\"sm\"\n variant=\"inverse-outline-primary\"\n >\n {action.label}\n </Button>\n )}\n </BaseToast>\n </ToastContainer>\n );\n}\n\nToast.defaultProps = {\n action: null,\n closeLabel: undefined,\n delay: TOAST_DELAY,\n className: undefined,\n};\n\nToast.propTypes = {\n /** A string or an element that is rendered inside the main body of the `Toast`. */\n children: PropTypes.string.isRequired,\n /**\n * A function that is called on close. It can be used to perform\n * actions upon closing of the `Toast`, such as setting the \"show\"\n * element to false.\n * */\n onClose: PropTypes.func.isRequired,\n /** Boolean used to control whether the `Toast` shows */\n show: PropTypes.bool.isRequired,\n /**\n * Fields used to build optional action button.\n * `label` is a string rendered inside the button.\n * `href` is a link that will render the action button as an anchor tag.\n * `onClick` is a function that is called when the button is clicked.\n */\n action: PropTypes.shape({\n label: PropTypes.string.isRequired,\n href: PropTypes.string,\n onClick: PropTypes.func,\n }),\n /**\n * Alt text for the `Toast`'s dismiss button. Defaults to 'Close'.\n */\n closeLabel: PropTypes.string,\n /** Time in milliseconds for which the `Toast` will display. */\n delay: PropTypes.number,\n /** Class names for the `BaseToast` component */\n className: PropTypes.string,\n};\n\nexport default Toast;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","classNames","PropTypes","BaseToast","useIntl","Close","ToastContainer","Button","Icon","IconButton","TOAST_CLOSE_LABEL_TEXT","TOAST_DELAY","Toast","_ref","action","children","className","closeLabel","onClose","show","rest","_objectWithoutProperties","_excluded","intl","_useState","_useState2","_slicedToArray","autoHide","setAutoHide","intlCloseLabel","formatMessage","id","defaultMessage","description","createElement","_extends","autohide","onBlur","onFocus","onMouseOut","onMouseOver","iconAs","alt","src","onClick","variant","invertColors","as","href","size","label","defaultProps","undefined","delay","propTypes","string","isRequired","func","bool","shape","number"],"sources":["../../src/Toast/index.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nimport BaseToast from 'react-bootstrap/Toast';\nimport { useIntl } from 'react-intl';\n\nimport { Close } from '../../icons';\nimport ToastContainer from './ToastContainer';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\n\nexport const TOAST_CLOSE_LABEL_TEXT = 'Close';\nexport const TOAST_DELAY = 5000;\n\nfunction Toast({\n action, children, className, closeLabel, onClose, show, ...rest\n}) {\n const intl = useIntl();\n const [autoHide, setAutoHide] = useState(true);\n const intlCloseLabel = closeLabel || intl.formatMessage({\n id: 'pgn.Toast.closeLabel',\n defaultMessage: 'Close',\n description: 'Close label for Toast component',\n });\n return (\n <ToastContainer>\n <BaseToast\n autohide={autoHide}\n className={classNames('pgn__toast', className)}\n onClose={onClose}\n onBlur={() => setAutoHide(true)}\n onFocus={() => setAutoHide(false)}\n onMouseOut={() => setAutoHide(true)}\n onMouseOver={() => setAutoHide(false)}\n show={show}\n {...rest}\n >\n <div\n className=\"toast-header\"\n >\n <p className=\"small\">{children}</p>\n <div className=\"toast-header-btn-container\">\n <IconButton\n iconAs={Icon}\n alt={intlCloseLabel}\n className=\"align-self-start\"\n src={Close}\n onClick={onClose}\n variant=\"primary\"\n invertColors\n />\n </div>\n </div>\n {action && (\n <Button\n as={action.href ? 'a' : 'button'}\n href={action.href}\n onClick={action.onClick}\n size=\"sm\"\n variant=\"inverse-outline-primary\"\n >\n {action.label}\n </Button>\n )}\n </BaseToast>\n </ToastContainer>\n );\n}\n\nToast.defaultProps = {\n action: null,\n closeLabel: undefined,\n delay: TOAST_DELAY,\n className: undefined,\n};\n\nToast.propTypes = {\n /** A string or an element that is rendered inside the main body of the `Toast`. */\n children: PropTypes.string.isRequired,\n /**\n * A function that is called on close. It can be used to perform\n * actions upon closing of the `Toast`, such as setting the \"show\"\n * element to false.\n * */\n onClose: PropTypes.func.isRequired,\n /** Boolean used to control whether the `Toast` shows */\n show: PropTypes.bool.isRequired,\n /**\n * Fields used to build optional action button.\n * `label` is a string rendered inside the button.\n * `href` is a link that will render the action button as an anchor tag.\n * `onClick` is a function that is called when the button is clicked.\n */\n action: PropTypes.shape({\n label: PropTypes.string.isRequired,\n href: PropTypes.string,\n onClick: PropTypes.func,\n }),\n /**\n * Alt text for the `Toast`'s dismiss button. Defaults to 'Close'.\n */\n closeLabel: PropTypes.string,\n /** Time in milliseconds for which the `Toast` will display. */\n delay: PropTypes.number,\n /** Class names for the `BaseToast` component */\n className: PropTypes.string,\n};\n\nexport default Toast;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,SAASC,OAAO,QAAQ,YAAY;AAEpC,SAASC,KAAK,QAAQ,aAAa;AACnC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AAEtC,OAAO,IAAMC,sBAAsB,GAAG,OAAO;AAC7C,OAAO,IAAMC,WAAW,GAAG,IAAI;AAE/B,SAASC,KAAKA,CAAAC,IAAA,EAEX;EAAA,IADDC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAEC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IAAEC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IAAEC,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