@openedx/paragon 23.14.2 → 23.14.4
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.d.ts +18 -0
- package/dist/ActionRow/index.js +6 -24
- package/dist/ActionRow/index.js.map +1 -1
- package/dist/Alert/index.js +21 -24
- package/dist/Alert/index.js.map +1 -1
- package/dist/Annotation/index.d.ts +13 -0
- package/dist/Annotation/index.js +11 -30
- package/dist/Annotation/index.js.map +1 -1
- package/dist/Avatar/index.d.ts +11 -0
- package/dist/Avatar/index.js +7 -21
- package/dist/Avatar/index.js.map +1 -1
- package/dist/AvatarButton/index.d.ts +17 -0
- package/dist/AvatarButton/index.js +11 -33
- package/dist/AvatarButton/index.js.map +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.js +5 -6
- package/dist/Breadcrumb/BreadcrumbLink.js.map +1 -1
- package/dist/Breadcrumb/index.js +11 -12
- package/dist/Breadcrumb/index.js.map +1 -1
- package/dist/Bubble/index.js +15 -18
- package/dist/Bubble/index.js.map +1 -1
- package/dist/Button/index.d.ts +42 -7
- package/dist/Button/index.js +43 -115
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/BaseCard.js +11 -12
- package/dist/Card/BaseCard.js.map +1 -1
- package/dist/Card/CardBody.js +9 -12
- package/dist/Card/CardBody.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarousel.js +13 -14
- package/dist/Card/CardCarousel/CardCarousel.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselHeader.js +4 -5
- package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselItems.js +3 -4
- package/dist/Card/CardCarousel/CardCarouselItems.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselProvider.js +7 -8
- package/dist/Card/CardCarousel/CardCarouselProvider.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselTitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselTitle.js.map +1 -1
- package/dist/Card/CardCarousel/messages.d.ts +13 -0
- package/dist/Card/CardCarousel/messages.js +4 -5
- package/dist/Card/CardCarousel/messages.js.map +1 -0
- package/dist/Card/CardContext.js +6 -7
- package/dist/Card/CardContext.js.map +1 -1
- package/dist/Card/CardDeck.js +9 -10
- package/dist/Card/CardDeck.js.map +1 -1
- package/dist/Card/CardDivider.js +8 -11
- package/dist/Card/CardDivider.js.map +1 -1
- package/dist/Card/CardFooter.js +9 -10
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardGrid.js +6 -7
- package/dist/Card/CardGrid.js.map +1 -1
- package/dist/Card/CardHeader.js +9 -10
- package/dist/Card/CardHeader.js.map +1 -1
- package/dist/Card/CardImageCap.js +15 -16
- package/dist/Card/CardImageCap.js.map +1 -1
- package/dist/Card/CardSection.js +9 -10
- package/dist/Card/CardSection.js.map +1 -1
- package/dist/Card/CardStatus.js +9 -10
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Card/index.js +9 -10
- package/dist/Card/index.js.map +1 -1
- package/dist/Chip/ChipIcon.js +8 -9
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.d.ts +22 -0
- package/dist/Chip/index.js +15 -70
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +49 -53
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/ChipCarousel/messages.d.ts +13 -0
- package/dist/ChipCarousel/messages.js +4 -5
- package/dist/ChipCarousel/messages.js.map +1 -0
- package/dist/CloseButton/index.js.map +1 -1
- package/dist/Collapse/index.js.map +1 -1
- package/dist/Collapsible/CollapsibleBody.js +6 -7
- package/dist/Collapsible/CollapsibleBody.js.map +1 -1
- package/dist/Collapsible/CollapsibleTrigger.js +9 -10
- package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
- package/dist/Collapsible/CollapsibleVisible.js +5 -6
- package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
- package/dist/ColorPicker/index.js +6 -7
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/Container/index.js +9 -12
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/BulkActions.js +4 -5
- package/dist/DataTable/BulkActions.js.map +1 -1
- package/dist/DataTable/CardView.js +16 -18
- package/dist/DataTable/CardView.js.map +1 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +5 -6
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/DataTableLayout.js +5 -6
- package/dist/DataTable/DataTableLayout.js.map +1 -1
- package/dist/DataTable/EmptyTable.js +5 -6
- package/dist/DataTable/EmptyTable.js.map +1 -1
- package/dist/DataTable/ExpandAll.js +4 -5
- package/dist/DataTable/ExpandAll.js.map +1 -1
- package/dist/DataTable/ExpandRow.js +3 -4
- package/dist/DataTable/ExpandRow.js.map +1 -1
- package/dist/DataTable/FilterStatus.js +8 -9
- package/dist/DataTable/FilterStatus.js.map +1 -1
- package/dist/DataTable/RowStatus.js +4 -5
- package/dist/DataTable/RowStatus.js.map +1 -1
- package/dist/DataTable/SidebarFilters.js +3 -4
- package/dist/DataTable/SidebarFilters.js.map +1 -1
- package/dist/DataTable/Table.js +3 -4
- package/dist/DataTable/Table.js.map +1 -1
- package/dist/DataTable/TableActions.js +3 -4
- package/dist/DataTable/TableActions.js.map +1 -1
- package/dist/DataTable/TableCell.js +5 -6
- package/dist/DataTable/TableCell.js.map +1 -1
- package/dist/DataTable/TableControlBar.js +3 -4
- package/dist/DataTable/TableControlBar.js.map +1 -1
- package/dist/DataTable/TableFilters.js +6 -7
- package/dist/DataTable/TableFilters.js.map +1 -1
- package/dist/DataTable/TableFooter.js +4 -5
- package/dist/DataTable/TableFooter.js.map +1 -1
- package/dist/DataTable/TableHeaderCell.js +13 -15
- package/dist/DataTable/TableHeaderCell.js.map +1 -1
- package/dist/DataTable/TableHeaderRow.js +3 -4
- package/dist/DataTable/TableHeaderRow.js.map +1 -1
- package/dist/DataTable/TableRow.js +3 -4
- package/dist/DataTable/TableRow.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js +25 -29
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.js +16 -20
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js +25 -29
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/TextFilter.js +8 -9
- package/dist/DataTable/filters/TextFilter.js.map +1 -1
- package/dist/DataTable/hooks.js +11 -13
- package/dist/DataTable/hooks.js.map +1 -1
- package/dist/DataTable/index.js +35 -36
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/messages.d.ts +13 -0
- package/dist/DataTable/messages.js +4 -5
- package/dist/DataTable/messages.js.map +1 -0
- package/dist/DataTable/selection/BaseSelectionStatus.js +11 -12
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelect.js +3 -4
- package/dist/DataTable/selection/ControlledSelect.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectHeader.js +3 -4
- package/dist/DataTable/selection/ControlledSelectHeader.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectionStatus.js +4 -5
- package/dist/DataTable/selection/ControlledSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/SelectionStatus.js +4 -5
- package/dist/DataTable/selection/SelectionStatus.js.map +1 -1
- package/dist/DataTable/utils/getVisibleColumns.js +9 -13
- package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
- package/dist/Dropdown/index.js +17 -20
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/DefaultContent.js +5 -6
- package/dist/Dropzone/DefaultContent.js.map +1 -1
- package/dist/Dropzone/DragError.js +3 -4
- package/dist/Dropzone/DragError.js.map +1 -1
- package/dist/Dropzone/GenericError.js +4 -5
- package/dist/Dropzone/GenericError.js.map +1 -1
- package/dist/Dropzone/UploadProgress.js +6 -7
- package/dist/Dropzone/UploadProgress.js.map +1 -1
- package/dist/Dropzone/index.js +14 -15
- package/dist/Dropzone/index.js.map +1 -1
- package/dist/Dropzone/messages.d.ts +53 -0
- package/dist/Dropzone/messages.js +12 -13
- package/dist/Dropzone/messages.js.map +1 -0
- package/dist/Fade/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +18 -20
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormAutosuggestOption.js +6 -7
- package/dist/Form/FormAutosuggestOption.js.map +1 -1
- package/dist/Form/FormCheckbox.js +16 -18
- package/dist/Form/FormCheckbox.js.map +1 -1
- package/dist/Form/FormCheckboxSet.js +11 -12
- package/dist/Form/FormCheckboxSet.js.map +1 -1
- package/dist/Form/FormCheckboxSetContext.js +9 -10
- package/dist/Form/FormCheckboxSetContext.js.map +1 -1
- package/dist/Form/FormControl.js +12 -13
- package/dist/Form/FormControl.js.map +1 -1
- package/dist/Form/FormControlDecorator.js +4 -5
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormControlDecoratorGroup.js +8 -9
- package/dist/Form/FormControlDecoratorGroup.js.map +1 -1
- package/dist/Form/FormControlFeedback.js +4 -5
- package/dist/Form/FormControlFeedback.js.map +1 -1
- package/dist/Form/FormControlFloatingLabel.js +3 -4
- package/dist/Form/FormControlFloatingLabel.js.map +1 -1
- package/dist/Form/FormControlSet.js +7 -8
- package/dist/Form/FormControlSet.js.map +1 -1
- package/dist/Form/FormGroup.js +9 -10
- package/dist/Form/FormGroup.js.map +1 -1
- package/dist/Form/FormGroupContext.js +7 -8
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormLabel.d.ts +2 -11
- package/dist/Form/FormLabel.js +5 -15
- package/dist/Form/FormLabel.js.map +1 -1
- package/dist/Form/FormRadio.js +28 -31
- package/dist/Form/FormRadio.js.map +1 -1
- package/dist/Form/FormRadioSet.js +11 -12
- package/dist/Form/FormRadioSet.js.map +1 -1
- package/dist/Form/FormRadioSetContext.js +9 -10
- package/dist/Form/FormRadioSetContext.js.map +1 -1
- package/dist/Form/FormSwitch.js +25 -29
- package/dist/Form/FormSwitch.js.map +1 -1
- package/dist/Form/FormText.js +16 -19
- package/dist/Form/FormText.js.map +1 -1
- package/dist/Form/fieldUtils.js +11 -22
- package/dist/Form/fieldUtils.js.map +1 -1
- package/dist/Form/useCheckboxSetValues.js +1 -2
- package/dist/Form/useCheckboxSetValues.js.map +1 -1
- package/dist/Hyperlink/index.js +17 -21
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.js +10 -11
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +8 -304
- package/dist/IconButton/index.js +21 -84
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButtonToggle/index.js +5 -6
- package/dist/IconButtonToggle/index.js.map +1 -1
- package/dist/Image/index.js.map +1 -1
- package/dist/Layout/index.js +4 -5
- package/dist/Layout/index.js.map +1 -1
- package/dist/Media/index.js.map +1 -1
- package/dist/Menu/MenuItem.js +8 -9
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Menu/SelectMenu.js +8 -9
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Menu/index.js +6 -7
- package/dist/Menu/index.js.map +1 -1
- package/dist/Modal/AlertModal.js +6 -7
- package/dist/Modal/AlertModal.js.map +1 -1
- package/dist/Modal/FullscreenModal.js +7 -8
- package/dist/Modal/FullscreenModal.js.map +1 -1
- package/dist/Modal/MarketingModal.js +9 -10
- package/dist/Modal/MarketingModal.js.map +1 -1
- package/dist/Modal/ModalCloseButton.js +5 -6
- package/dist/Modal/ModalCloseButton.js.map +1 -1
- package/dist/Modal/ModalContext.js +6 -7
- package/dist/Modal/ModalContext.js.map +1 -1
- package/dist/Modal/ModalDialog.js +16 -17
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogBody.js +5 -6
- package/dist/Modal/ModalDialogBody.js.map +1 -1
- package/dist/Modal/ModalDialogFooter.js +5 -6
- package/dist/Modal/ModalDialogFooter.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.js +9 -12
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalDialogHero.js +5 -6
- package/dist/Modal/ModalDialogHero.js.map +1 -1
- package/dist/Modal/ModalDialogHeroBackground.js +6 -7
- package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
- package/dist/Modal/ModalDialogHeroContent.js +5 -6
- package/dist/Modal/ModalDialogHeroContent.js.map +1 -1
- package/dist/Modal/ModalDialogTitle.js +5 -6
- package/dist/Modal/ModalDialogTitle.js.map +1 -1
- package/dist/Modal/ModalLayer.js +13 -16
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/ModalPopup.js +11 -12
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/PopperElement.js +7 -8
- package/dist/Modal/PopperElement.js.map +1 -1
- package/dist/Modal/StandardModal.js +7 -8
- package/dist/Modal/StandardModal.js.map +1 -1
- package/dist/OverflowScroll/OverflowScroll.js +12 -13
- package/dist/OverflowScroll/OverflowScroll.js.map +1 -1
- package/dist/OverflowScroll/OverflowScrollItems.js +3 -4
- package/dist/OverflowScroll/OverflowScrollItems.js.map +1 -1
- package/dist/Overlay/index.d.ts +2 -2
- package/dist/PageBanner/index.js +9 -10
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/Pagination/PaginationContext.js +12 -13
- package/dist/Pagination/PaginationContext.js.map +1 -1
- package/dist/Pagination/subcomponents/PageButton.js +3 -4
- package/dist/Pagination/subcomponents/PageButton.js.map +1 -1
- package/dist/Popover/index.js +11 -14
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.js +12 -13
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/CheckpointActionRow.js +10 -11
- package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
- package/dist/ProductTour/CheckpointBody.js +3 -4
- package/dist/ProductTour/CheckpointBody.js.map +1 -1
- package/dist/ProductTour/CheckpointHeader.js +7 -8
- package/dist/ProductTour/CheckpointHeader.js.map +1 -1
- package/dist/ProductTour/CheckpointTitle.js +6 -9
- package/dist/ProductTour/CheckpointTitle.js.map +1 -1
- package/dist/ProductTour/index.js +3 -4
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProductTour/messages.d.ts +23 -0
- package/dist/ProductTour/messages.js +6 -7
- package/dist/ProductTour/messages.js.map +1 -0
- package/dist/ProgressBar/index.js +11 -12
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ResponsiveEmbed/index.js.map +1 -1
- package/dist/Scrollable/index.js +4 -5
- package/dist/Scrollable/index.js.map +1 -1
- package/dist/SearchField/SearchFieldLabel.js +4 -5
- package/dist/SearchField/SearchFieldLabel.js.map +1 -1
- package/dist/SelectableBox/SelectableBoxSet.js +13 -14
- package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
- package/dist/SelectableBox/index.js +14 -15
- package/dist/SelectableBox/index.js.map +1 -1
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Spinner/index.js +5 -6
- package/dist/Spinner/index.js.map +1 -1
- package/dist/Stack/index.js +12 -15
- package/dist/Stack/index.js.map +1 -1
- package/dist/StatefulButton/index.js +9 -10
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/Stepper/Stepper.js +4 -5
- package/dist/Stepper/Stepper.js.map +1 -1
- package/dist/Stepper/StepperActionRow.js +6 -7
- package/dist/Stepper/StepperActionRow.js.map +1 -1
- package/dist/Stepper/StepperContext.js +4 -5
- package/dist/Stepper/StepperContext.js.map +1 -1
- package/dist/Stepper/StepperHeader.js +23 -31
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.js +8 -9
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Stepper/StepperStep.js +10 -11
- package/dist/Stepper/StepperStep.js.map +1 -1
- package/dist/Sticky/index.js +8 -12
- package/dist/Sticky/index.js.map +1 -1
- package/dist/Tabs/index.js +8 -9
- package/dist/Tabs/index.js.map +1 -1
- package/dist/Toast/ToastContainer.js +3 -4
- package/dist/Toast/ToastContainer.js.map +1 -1
- package/dist/Toast/index.d.ts +20 -41
- package/dist/Toast/index.js +11 -48
- package/dist/Toast/index.js.map +1 -1
- package/dist/ToggleButton/index.js.map +1 -1
- package/dist/Tooltip/index.js +11 -14
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/Truncate/index.js +9 -10
- package/dist/Truncate/index.js.map +1 -1
- package/dist/asInput/index.js +9 -13
- package/dist/asInput/index.js.map +1 -1
- package/dist/hooks/useArrowKeyNavigationHook.js +17 -21
- package/dist/hooks/useArrowKeyNavigationHook.js.map +1 -1
- package/dist/hooks/useIsVisibleHook.js +4 -6
- package/dist/hooks/useIsVisibleHook.js.map +1 -1
- package/dist/hooks/useToggleHook.js +1 -3
- package/dist/hooks/useToggleHook.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/dist/utils/newId.js +1 -2
- package/dist/utils/newId.js.map +1 -1
- package/package.json +1 -1
- package/src/ActionRow/{index.jsx → index.tsx} +14 -22
- package/src/Annotation/{index.jsx → index.tsx} +15 -22
- package/src/Avatar/{index.jsx → index.tsx} +13 -19
- package/src/AvatarButton/{index.jsx → index.tsx} +23 -31
- package/src/Button/index.tsx +68 -93
- package/src/Chip/index.tsx +26 -59
- package/src/CloseButton/index.tsx +1 -0
- package/src/Collapse/index.tsx +1 -0
- package/src/Fade/index.tsx +1 -0
- package/src/Form/FormLabel.tsx +2 -10
- package/src/IconButton/index.tsx +17 -81
- package/src/Image/index.tsx +2 -0
- package/src/Media/index.tsx +1 -0
- package/src/Modal/modal-popup.mdx +1 -1
- package/src/ResponsiveEmbed/index.tsx +1 -0
- package/src/Skeleton/index.tsx +1 -0
- package/src/Toast/index.tsx +21 -40
- package/src/ToggleButton/index.tsx +2 -0
- package/src/index.ts +4 -8
- /package/{src/CloseButton/index.jsx → dist/CloseButton/index.d.ts} +0 -0
- /package/{src/Collapse/index.jsx → dist/Collapse/index.d.ts} +0 -0
- /package/{src/Fade/index.jsx → dist/Fade/index.d.ts} +0 -0
- /package/{src/Image/index.jsx → dist/Image/index.d.ts} +0 -0
- /package/{src/Media/index.jsx → dist/Media/index.d.ts} +0 -0
- /package/{src/ResponsiveEmbed/index.jsx → dist/ResponsiveEmbed/index.d.ts} +0 -0
- /package/{src/Skeleton/index.jsx → dist/Skeleton/index.d.ts} +0 -0
- /package/{src/ToggleButton/index.jsx → dist/ToggleButton/index.d.ts} +0 -0
- /package/src/Card/CardCarousel/{messages.js → messages.ts} +0 -0
- /package/src/ChipCarousel/{messages.js → messages.ts} +0 -0
- /package/src/DataTable/{messages.js → messages.ts} +0 -0
- /package/src/Dropzone/{messages.js → messages.ts} +0 -0
- /package/src/ProductTour/{messages.js → messages.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","OverlayTrigger","Tooltip","Icon","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","invert","activeStyle","IconComponent","createElement","type","defaultProps","undefined","propTypes","string","elementType","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","placement","overlay","id","node"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { type Placement } from 'react-bootstrap/Overlay';\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n iconAs?: React.ComponentType<any>,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options) */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** no children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n const IconComponent = iconAs;\n\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n {IconComponent && (\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n )}\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: Icon,\n src: undefined,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n children: undefined,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `Icon` */\n iconAs: PropTypes.elementType as any,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n src: PropTypes.elementType as any,\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a [Paragon icon](https://paragon-openedx.netlify.app/foundations/icons) */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }) as any,\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n};\n\ninterface PropsWithTooltip extends Props {\n /** choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: Placement,\n /** any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n ...IconButton.defaultProps,\n tooltipPlacement: 'top',\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,IAAI,MAAM,SAAS;AAkC1B,MAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAA2B,CAAAC,IAAA,EAc3DC,GAAG,KAAK;EAAA,IAdoD;IAC7DC,SAAS;IACTC,GAAG;IACHC,YAAY;IACZC,IAAI;IACJC,GAAG;IACHC,cAAc;IACdC,OAAO;IACPC,IAAI;IACJC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IAAE;IACV,GAAGC;EACL,CAAC,GAAAd,IAAA;EACC,MAAMe,MAAM,GAAGX,YAAY,GAAG,UAAU,GAAG,EAAE;EAC7C,MAAMY,WAAW,GAAGJ,QAAQ,GAAG,GAAGF,OAAO,GAAG,GAAG,EAAE;EACjD,MAAMO,aAAa,GAAGN,MAAM;EAE5B,oBACEn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Be,gBAAgB,EAAE;AACpB,CAAC;AAEDF,qBAAqB,CAACX,SAAS,GAAG;EAChC;EACAa,gBAAgB,EAAE1C,SAAS,CAAC8B,MAAM;EAClC;EACAa,cAAc,EAAE3C,SAAS,CAACgD,IAAI,CAAChB,UAAU;EACzC;EACAf,OAAO,EAAEjB,SAAS,CAACuC,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACA5B,YAAY,EAAEX,SAAS,CAACiC;AAC1B,CAAC;AAEA5B,UAAU,CAASmC,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAenC,UAAU;AAGzB,SAASmC,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","OverlayTrigger","Tooltip","Icon","IconButton","forwardRef","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","ref","invert","activeStyle","IconComponent","createElement","type","IconButtonWithTooltip","tooltipPlacement","tooltipContent","props","placement","overlay","id","undefined"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { type Placement } from 'react-bootstrap/Overlay';\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n /** Component that renders the icon, currently defaults to `Icon` */\n iconAs?: React.ComponentType<any>,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** Whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options). */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** Size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** No children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef(({\n className,\n alt,\n invertColors = false,\n icon,\n src,\n iconClassNames,\n onClick = () => {},\n size = 'md',\n variant = 'primary',\n iconAs = Icon,\n isActive = false,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n} : Props, ref: React.ForwardedRef<HTMLButtonElement>) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n const IconComponent = iconAs;\n\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n {IconComponent && (\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n )}\n </span>\n </button>\n );\n});\n\ninterface PropsWithTooltip extends Props {\n /** Tooltip placement can be top, left, right etc, choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement?: Placement,\n /** Any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement = 'top', tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,IAAI,MAAM,SAAS;AAmC1B,MAAMC,UAAU,gBAAGL,KAAK,CAACM,UAAU,CAAC,CAAC;EACnCC,SAAS;EACTC,GAAG;EACHC,YAAY,GAAG,KAAK;EACpBC,IAAI;EACJC,GAAG;EACHC,cAAc;EACdC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClBC,IAAI,GAAG,IAAI;EACXC,OAAO,GAAG,SAAS;EACnBC,MAAM,GAAGZ,IAAI;EACba,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EAAE;EACV,GAAGC;AACG,CAAC,EAAEC,GAA0C,KAAK;EACxD,MAAMC,MAAM,GAAGZ,YAAY,GAAG,UAAU,GAAG,EAAE;EAC7C,MAAMa,WAAW,GAAGL,QAAQ,GAAG,GAAGF,OAAO,GAAG,GAAG,EAAE;EACjD,MAAMQ,aAAa,GAAGP,MAAM;EAE5B,oBACEhB,KAAA,CAAAwB,aAAA;IACE,cAAYhB,GAAI;IAChBD,SAAS,EAAEN,UAAU,CACnB,UAAU,EACV,YAAYoB,MAAM,GAAGN,OAAO,EAAE,EAC9B,YAAYD,IAAI,EAAE,EAClB;MACE,CAAC,YAAYO,MAAM,GAAGC,WAAW,QAAQ,GAAGL;IAC9C,CAAC,EACDV,SACF,CAAE;IACFM,OAAO,EAAEA,OAAQ;IACjBY,IAAI,EAAC,QAAQ;IACbL,GAAG,EAAEA,GAAI;IAAA,GACLD;EAAK,gBAETnB,KAAA,CAAAwB,aAAA;IAAMjB,SAAS,EAAC;EAA0B,GACvCgB,aAAa,iBACZvB,KAAA,CAAAwB,aAAA,CAACD,aAAa;IACZhB,SAAS,EAAEN,UAAU,CAAC,gBAAgB,EAAEW,cAAc,CAAE;IACxDF,IAAI,EAAEA,IAAY;IAClBC,GAAG,EAAEA;EAAI,CACV,CAEC,CACA,CAAC;AAEb,CAAC,CAAC;AASF;AACA;AACA;AACA,SAASe,qBAAqBA,CAAC;EAC7BC,gBAAgB,GAAG,KAAK;EAAEC,cAAc;EAAE,GAAGC;AAC7B,CAAC,EAAE;EACnB,MAAMR,MAAM,GAAGQ,KAAK,CAACpB,YAAY,GAAG,UAAU,GAAG,EAAE;EACnD,oBACET,KAAA,CAAAwB,aAAA,CAACtB,cAAc;IACb4B,SAAS,EAAEH,gBAAiB;IAC5BI,OAAO,eACL/B,KAAA,CAAAwB,aAAA,CAACrB,OAAO;MACN6B,EAAE,EAAE,sBAAsBL,gBAAgB,EAAG;MAC7CZ,OAAO,EAAEM,MAAM,GAAG,OAAO,GAAGY;IAAU,GAErCL,cACM;EACT,gBAEF5B,KAAA,CAAAwB,aAAA,CAACnB,UAAU;IAAA,GAAKwB;EAAK,CAAG,CACV,CAAC;AAErB;AAECxB,UAAU,CAASqB,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAerB,UAAU;AAGzB,SAASqB,qBAAqB","ignoreList":[]}
|
|
@@ -11,12 +11,11 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
* @param {Array<IconButton>} args.children children components expected to be IconButton
|
|
12
12
|
* @returns {React.Component} A React component
|
|
13
13
|
*/
|
|
14
|
-
function IconButtonToggle(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
14
|
+
function IconButtonToggle({
|
|
15
|
+
activeValue,
|
|
16
|
+
onChange,
|
|
17
|
+
children
|
|
18
|
+
}) {
|
|
20
19
|
const iconButtons = useMemo(() => React.Children.map(children, iconButton => {
|
|
21
20
|
const isActive = iconButton.props.value === activeValue;
|
|
22
21
|
return /*#__PURE__*/React.cloneElement(iconButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","IconButtonToggle","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","IconButtonToggle","activeValue","onChange","children","iconButtons","Children","map","iconButton","isActive","props","value","cloneElement","onClick","createElement","className","defaultProps","undefined","propTypes","string","func","node","isRequired"],"sources":["../../src/IconButtonToggle/index.jsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport PropTypes from 'prop-types';\n\n/**\n *\n * @param {object} args arguments\n * @param {boolean} args.activeValue the current value of the active/selected iconButton.\n * if not provided, none of the iconButtons will initially be active\n * @param {Function} args.onChange callback to call when toggle value changes.\n * Receives value of the selected toggle button.\n * @param {Array<IconButton>} args.children children components expected to be IconButton\n * @returns {React.Component} A React component\n */\nfunction IconButtonToggle({ activeValue, onChange, children }) {\n const iconButtons = useMemo(\n () => React.Children.map(children, iconButton => {\n const isActive = iconButton.props.value === activeValue;\n return React.cloneElement(iconButton, {\n onClick: () => { onChange(iconButton.props.value); },\n isActive,\n 'aria-selected': isActive,\n 'data-testid': `icon-btn-val-${iconButton.props.value}`,\n });\n }),\n [children, activeValue, onChange],\n );\n return <div className=\"pgn__icon-button-toggle__container\">{iconButtons}</div>;\n}\n\nIconButtonToggle.defaultProps = {\n onChange: () => {},\n activeValue: undefined,\n};\n\nIconButtonToggle.propTypes = {\n /** value to use to check which button to set to active */\n activeValue: PropTypes.string,\n /** handler that is passed the currently active button's value when a button is selected */\n onChange: PropTypes.func,\n /** child nodes of type `IconButton` (or its subcomponents) to be rendered within toggle group */\n children: PropTypes.node.isRequired,\n};\n\nexport default IconButtonToggle;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,SAAS,MAAM,YAAY;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAC;EAAEC,WAAW;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAE;EAC7D,MAAMC,WAAW,GAAGN,OAAO,CACzB,MAAMD,KAAK,CAACQ,QAAQ,CAACC,GAAG,CAACH,QAAQ,EAAEI,UAAU,IAAI;IAC/C,MAAMC,QAAQ,GAAGD,UAAU,CAACE,KAAK,CAACC,KAAK,KAAKT,WAAW;IACvD,oBAAOJ,KAAK,CAACc,YAAY,CAACJ,UAAU,EAAE;MACpCK,OAAO,EAAEA,CAAA,KAAM;QAAEV,QAAQ,CAACK,UAAU,CAACE,KAAK,CAACC,KAAK,CAAC;MAAE,CAAC;MACpDF,QAAQ;MACR,eAAe,EAAEA,QAAQ;MACzB,aAAa,EAAE,gBAAgBD,UAAU,CAACE,KAAK,CAACC,KAAK;IACvD,CAAC,CAAC;EACJ,CAAC,CAAC,EACF,CAACP,QAAQ,EAAEF,WAAW,EAAEC,QAAQ,CAClC,CAAC;EACD,oBAAOL,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAC;EAAoC,GAAEV,WAAiB,CAAC;AAChF;AAEAJ,gBAAgB,CAACe,YAAY,GAAG;EAC9Bb,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBD,WAAW,EAAEe;AACf,CAAC;AAEDhB,gBAAgB,CAACiB,SAAS,GAAG;EAC3B;EACAhB,WAAW,EAAEF,SAAS,CAACmB,MAAM;EAC7B;EACAhB,QAAQ,EAAEH,SAAS,CAACoB,IAAI;EACxB;EACAhB,QAAQ,EAAEJ,SAAS,CAACqB,IAAI,CAACC;AAC3B,CAAC;AAED,eAAerB,gBAAgB","ignoreList":[]}
|
package/dist/Image/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Figure"],"sources":["../../src/Image/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","Figure"],"sources":["../../src/Image/index.tsx"],"sourcesContent":["export { default } from 'react-bootstrap/Image';\nexport { default as Figure } from 'react-bootstrap/Figure';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,uBAAuB;AAC/C,SAASA,OAAO,IAAIC,MAAM,QAAQ,wBAAwB","ignoreList":[]}
|
package/dist/Layout/index.js
CHANGED
|
@@ -8,11 +8,10 @@ const LayoutElement = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*
|
|
|
8
8
|
ref: ref,
|
|
9
9
|
...props
|
|
10
10
|
}));
|
|
11
|
-
const Layout = /*#__PURE__*/React.forwardRef((
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = _ref;
|
|
11
|
+
const Layout = /*#__PURE__*/React.forwardRef(({
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}, ref) => {
|
|
16
15
|
const childrenLength = children.length;
|
|
17
16
|
const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;
|
|
18
17
|
const errors = {};
|
package/dist/Layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","Layout","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","Layout","children","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","forEach","size","sizeProps","span","offset","undefined","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport { Col, Row };\nLayout.Element = LayoutElement;\nexport default Layout;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC;AACrE,MAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAE5C,MAAMC,aAAa,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAAKT,KAAA,CAAAU,aAAA;EAAKD,GAAG,EAAEA,GAAI;EAAA,GAAKD;AAAK,CAAG,CAAC,CAAC;AAEpF,MAAMG,MAAM,gBAAGX,KAAK,CAACO,UAAU,CAAC,CAAC;EAAEK,QAAQ;EAAE,GAAGJ;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC/D,MAAMI,cAAc,GAAGD,QAAQ,CAACE,MAAM;EAEtC,MAAMC,iBAAiB,GAAGA,CAACC,QAAQ,EAAEC,WAAW,KAAK,CAACD,QAAQ,IAAIA,QAAQ,CAACF,MAAM,KAAKG,WAAW;EACjG,MAAMC,MAAM,GA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0C,OAAO,CAAC1C,SAAS,CAAC2C,KAAK,CAAC;IACpClB,IAAI,EAAEzB,SAAS,CAAC4C,KAAK,CAAC3C,UAAU,CAAC,CAACwC,UAAU;IAC5Cf,MAAM,EAAE1B,SAAS,CAAC4C,KAAK,CAAC3C,UAAU;EACpC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM4C,gBAAgB,GAAG;EAAEpB,IAAI,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAEjDxB,KAAK,CAACoB,OAAO,CAACC,IAAI,IAAI;EACpB;EACAf,MAAM,CAACyB,YAAY,CAACV,IAAI,CAAC,GAAGsB,gBAAgB;AAC9C,CAAC,CAAC;AAEF,SAAS/C,GAAG,EAAEC,GAAG;AACjBS,MAAM,CAACsC,OAAO,GAAG3C,aAAa;AAC9B,eAAeK,MAAM","ignoreList":[]}
|
package/dist/Media/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/Media/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/Media/index.tsx"],"sourcesContent":["export { default } from 'react-bootstrap/Media';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,uBAAuB","ignoreList":[]}
|
package/dist/Menu/MenuItem.js
CHANGED
|
@@ -2,15 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import Icon from '../Icon';
|
|
5
|
-
function MenuItem(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
5
|
+
function MenuItem({
|
|
6
|
+
as,
|
|
7
|
+
children,
|
|
8
|
+
defaultSelected,
|
|
9
|
+
iconAfter,
|
|
10
|
+
iconBefore,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
14
13
|
const className = classNames(props.className, 'pgn__menu-item');
|
|
15
14
|
return /*#__PURE__*/React.createElement(as, {
|
|
16
15
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","names":["React","PropTypes","classNames","Icon","MenuItem","
|
|
1
|
+
{"version":3,"file":"MenuItem.js","names":["React","PropTypes","classNames","Icon","MenuItem","as","children","defaultSelected","iconAfter","iconBefore","props","className","createElement","Fragment","src","propTypes","bool","string","node","elementType","oneOfType","element","defaultProps","undefined"],"sources":["../../src/Menu/MenuItem.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Icon from '../Icon';\n\nfunction MenuItem({\n as,\n children,\n defaultSelected,\n iconAfter,\n iconBefore,\n ...props\n}) {\n const className = classNames(props.className, 'pgn__menu-item');\n\n return React.createElement(\n as,\n {\n ...props,\n className,\n },\n (\n <>\n {iconBefore && <Icon className=\"btn-icon-before\" src={iconBefore} />}\n <span className=\"pgn__menu-item-text\">{children}</span>\n <span className=\"pgn__menu-item-content-spacer\" />\n {iconAfter && <Icon className=\"btn-icon-after\" src={iconAfter} />}\n </>\n ),\n );\n}\n\nMenuItem.propTypes = {\n /** Specifies that this ``MenuItem`` is selected inside the ``SelectMenu`` */\n defaultSelected: PropTypes.bool,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies the content of the ``MenuItem`` */\n children: PropTypes.node,\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the jsx before the content of the ``MenuItem`` */\n iconBefore: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),\n /** Specifies the jsx after the content of the ``MenuItem`` */\n iconAfter: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),\n};\n\nMenuItem.defaultProps = {\n defaultSelected: false,\n as: 'button',\n className: undefined,\n children: null,\n iconBefore: undefined,\n iconAfter: undefined,\n};\n\nexport default MenuItem;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,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B,WAAW,CAAC;AAC3E,CAAC;AAEDf,QAAQ,CAACkB,YAAY,GAAG;EACtBf,eAAe,EAAE,KAAK;EACtBF,EAAE,EAAE,QAAQ;EACZM,SAAS,EAAEY,SAAS;EACpBjB,QAAQ,EAAE,IAAI;EACdG,UAAU,EAAEc,SAAS;EACrBf,SAAS,EAAEe;AACb,CAAC;AAED,eAAenB,QAAQ","ignoreList":[]}
|
package/dist/Menu/SelectMenu.js
CHANGED
|
@@ -8,15 +8,14 @@ import useToggle from '../hooks/useToggleHook';
|
|
|
8
8
|
import Menu from '.';
|
|
9
9
|
import withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';
|
|
10
10
|
export const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';
|
|
11
|
-
function SelectMenu(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
11
|
+
function SelectMenu({
|
|
12
|
+
defaultMessage,
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
variant,
|
|
16
|
+
disabled,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
20
19
|
const [triggerTarget, setTriggerTarget] = useState(null);
|
|
21
20
|
// this ref is used to focus the menu open button after any menu option is clicked.
|
|
22
21
|
// triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.js","names":["React","useState","useEffect","useCallback","PropTypes","classNames","ExpandMore","Button","ModalPopup","useToggle","Menu","withDeprecatedProps","DeprTypes","SELECT_MENU_DEFAULT_MESSAGE","SelectMenu","_ref","defaultMessage","children","className","variant","disabled","props","triggerTarget","setTriggerTarget","focusMenuRef","useRef","itemsCollection","useMemo","Array","from","length","map","createRef","defaultIndex","i","defaultSelected","undefined","selected","setSelected","isOpen","open","close","createMenuItems","Children","child","index","newProps","onClick","e","current","id","toString","role","cloneElement","prevOpenRef","numItems","scrollIntoView","block","focus","preventScroll","createElement","ref","iconAfter","placement","positionRef","onClose","modifiers","name","options","padding","top","bottom","key","propTypes","string","node","isRequired","bool","defaultProps","SelectMenuWithDeprecatedProp","isLink","deprType","MOVED_AND_FORMAT","message","newName","transform"],"sources":["../../src/Menu/SelectMenu.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { ExpandMore } from '../../icons';\nimport Button from '../Button';\nimport ModalPopup from '../Modal/ModalPopup';\nimport useToggle from '../hooks/useToggleHook';\nimport Menu from '.';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';\n\nfunction SelectMenu({\n defaultMessage,\n children,\n className,\n variant,\n disabled,\n ...props\n}) {\n const [triggerTarget, setTriggerTarget] = useState(null);\n // this ref is used to focus the menu open button after any menu option is clicked.\n // triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.\n const focusMenuRef = React.useRef(false);\n const itemsCollection = React.useMemo(\n () => Array.from({ length: children.length }).map(() => React.createRef()),\n [children.length],\n );\n\n const defaultIndex = useCallback(() => {\n for (let i = 0; i < children.length; i++) {\n if (children[i].props && children[i].props.defaultSelected) {\n return i;\n }\n }\n return undefined;\n }, [children]);\n\n const [selected, setSelected] = useState(defaultIndex());\n const [isOpen, open, close] = useToggle(false);\n\n const createMenuItems = () => React.Children.map(children, (child, index) => {\n const newProps = {\n onClick(e) {\n if (child.props.onClick) {\n child.props.onClick(e);\n }\n setSelected(index);\n close();\n focusMenuRef.current = true;\n },\n id: `${index.toString()}_pgn__menu-item`,\n role: 'link',\n };\n if (selected === index) {\n newProps['aria-current'] = 'page';\n }\n return React.cloneElement(child, newProps);\n });\n\n const prevOpenRef = React.useRef();\n\n useEffect(() => {\n if (isOpen && selected) {\n const numItems = children.length;\n if (numItems > 6 && selected > 1 && numItems - selected > 2) {\n // on \"middle elements\", set offset to center of block and scroll to center\n itemsCollection[selected].current.children[0].scrollIntoView({\n block: 'center',\n });\n }\n }\n // set focus on open\n if (isOpen && !prevOpenRef.current && selected) {\n itemsCollection[selected].current.children[0].focus({ preventScroll: (defaultIndex() === selected) });\n }\n if (focusMenuRef.current) {\n triggerTarget.focus();\n focusMenuRef.current = false;\n }\n prevOpenRef.current = isOpen;\n }, [isOpen, children.length, defaultIndex, itemsCollection, selected, triggerTarget]);\n\n return (\n <div className={classNames('pgn__menu-select', className)} {...props}>\n <Button\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n ref={setTriggerTarget}\n variant={variant}\n iconAfter={ExpandMore}\n onClick={open}\n disabled={disabled}\n >\n {selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage}\n </Button>\n <div className=\"pgn__menu-select-popup\">\n <ModalPopup\n placement=\"bottom-start\"\n positionRef={triggerTarget}\n isOpen={isOpen}\n onClose={close}\n modifiers={\n [\n {\n name: 'flip',\n options: {\n padding: { top: 150, bottom: 150 },\n },\n },\n ]\n }\n >\n <Menu aria-label=\"Select Menu\">\n {createMenuItems().map((child, index) => (\n <div key={child.props.id} ref={itemsCollection[index]}>\n {child}\n </div>\n ))}\n </Menu>\n </ModalPopup>\n </div>\n </div>\n );\n}\n\nSelectMenu.propTypes = {\n /** String that is displayed for default value of the ``SelectMenu`` */\n defaultMessage: PropTypes.string,\n /** Specifies the content of the ``SelectMenu`` */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.string,\n /** Specifies if the `SelectMenu` is disabled. */\n disabled: PropTypes.bool,\n};\n\nSelectMenu.defaultProps = {\n defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,\n className: undefined,\n variant: 'outline-primary',\n disabled: false,\n};\n\nconst SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {\n isLink: {\n deprType: DeprTypes.MOVED_AND_FORMAT,\n message: 'Use \"variant\" prop instead, i.e. variant=\"link\"',\n newName: 'variant',\n transform: () => 'link',\n },\n});\n\nexport default SelectMenuWithDeprecatedProp;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,OAAOC,IAAI,MAAM,GAAG;AACpB,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,OAAO,MAAMC,2BAA2B,GAAG,WAAW;AAEtD,SAASC,UAAUA,CAAAC,IAAA,EAOhB;EAAA,IAPiB;IAClBC,cAAc;IACdC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAN,IAAA;EACC,MAAM,CAACO,aAAa,EAAEC,gBAAgB,CAAC,GAAGtB,QAAQ,CAAC,IAAI,CAAC;EACxD;EACA;EACA,MAAMuB,YAAY,GAAGxB,KAAK,CAACyB,MAAM,CAAC,KAAK,CAAC;EACxC,MAAMC,eAAe,GAAG1B,KAAK,CAAC2B,OAAO,CACnC,MAAMC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEb,QAAQ,CAACa;EAAO,CAAC,CAAC,CAACC,GAAG,CAAC,mBAAM/B,KAAK,CAACgC,SAAS,CAAC,CAAC,CAAC,EAC1E,CAACf,QAAQ,CAACa,MAAM,CAClB,CAAC;EAED,MAAMG,YAAY,GAAG9B,WAAW,CAAC,MAAM;IACrC,KAAK,IAAI+B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGjB,QAAQ,CAACa,MAAM,EAAEI,CAAC,EAAE,EAAE;MACxC,IAAIjB,QAAQ,CAACiB,CAAC,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EAAE;IACNC,QAAQ,EAAErE,SAAS,CAACsE,gBAAgB;IACpCC,OAAO,EAAE,iDAAiD;IAC1DC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAEA,CAAA,KAAM;EACnB;AACF,CAAC,CAAC;AAEF,eAAeN,4BAA4B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SelectMenu.js","names":["React","useState","useEffect","useCallback","PropTypes","classNames","ExpandMore","Button","ModalPopup","useToggle","Menu","withDeprecatedProps","DeprTypes","SELECT_MENU_DEFAULT_MESSAGE","SelectMenu","defaultMessage","children","className","variant","disabled","props","triggerTarget","setTriggerTarget","focusMenuRef","useRef","itemsCollection","useMemo","Array","from","length","map","createRef","defaultIndex","i","defaultSelected","undefined","selected","setSelected","isOpen","open","close","createMenuItems","Children","child","index","newProps","onClick","e","current","id","toString","role","cloneElement","prevOpenRef","numItems","scrollIntoView","block","focus","preventScroll","createElement","ref","iconAfter","placement","positionRef","onClose","modifiers","name","options","padding","top","bottom","key","propTypes","string","node","isRequired","bool","defaultProps","SelectMenuWithDeprecatedProp","isLink","deprType","MOVED_AND_FORMAT","message","newName","transform"],"sources":["../../src/Menu/SelectMenu.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { ExpandMore } from '../../icons';\nimport Button from '../Button';\nimport ModalPopup from '../Modal/ModalPopup';\nimport useToggle from '../hooks/useToggleHook';\nimport Menu from '.';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';\n\nfunction SelectMenu({\n defaultMessage,\n children,\n className,\n variant,\n disabled,\n ...props\n}) {\n const [triggerTarget, setTriggerTarget] = useState(null);\n // this ref is used to focus the menu open button after any menu option is clicked.\n // triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.\n const focusMenuRef = React.useRef(false);\n const itemsCollection = React.useMemo(\n () => Array.from({ length: children.length }).map(() => React.createRef()),\n [children.length],\n );\n\n const defaultIndex = useCallback(() => {\n for (let i = 0; i < children.length; i++) {\n if (children[i].props && children[i].props.defaultSelected) {\n return i;\n }\n }\n return undefined;\n }, [children]);\n\n const [selected, setSelected] = useState(defaultIndex());\n const [isOpen, open, close] = useToggle(false);\n\n const createMenuItems = () => React.Children.map(children, (child, index) => {\n const newProps = {\n onClick(e) {\n if (child.props.onClick) {\n child.props.onClick(e);\n }\n setSelected(index);\n close();\n focusMenuRef.current = true;\n },\n id: `${index.toString()}_pgn__menu-item`,\n role: 'link',\n };\n if (selected === index) {\n newProps['aria-current'] = 'page';\n }\n return React.cloneElement(child, newProps);\n });\n\n const prevOpenRef = React.useRef();\n\n useEffect(() => {\n if (isOpen && selected) {\n const numItems = children.length;\n if (numItems > 6 && selected > 1 && numItems - selected > 2) {\n // on \"middle elements\", set offset to center of block and scroll to center\n itemsCollection[selected].current.children[0].scrollIntoView({\n block: 'center',\n });\n }\n }\n // set focus on open\n if (isOpen && !prevOpenRef.current && selected) {\n itemsCollection[selected].current.children[0].focus({ preventScroll: (defaultIndex() === selected) });\n }\n if (focusMenuRef.current) {\n triggerTarget.focus();\n focusMenuRef.current = false;\n }\n prevOpenRef.current = isOpen;\n }, [isOpen, children.length, defaultIndex, itemsCollection, selected, triggerTarget]);\n\n return (\n <div className={classNames('pgn__menu-select', className)} {...props}>\n <Button\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n ref={setTriggerTarget}\n variant={variant}\n iconAfter={ExpandMore}\n onClick={open}\n disabled={disabled}\n >\n {selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage}\n </Button>\n <div className=\"pgn__menu-select-popup\">\n <ModalPopup\n placement=\"bottom-start\"\n positionRef={triggerTarget}\n isOpen={isOpen}\n onClose={close}\n modifiers={\n [\n {\n name: 'flip',\n options: {\n padding: { top: 150, bottom: 150 },\n },\n },\n ]\n }\n >\n <Menu aria-label=\"Select Menu\">\n {createMenuItems().map((child, index) => (\n <div key={child.props.id} ref={itemsCollection[index]}>\n {child}\n </div>\n ))}\n </Menu>\n </ModalPopup>\n </div>\n </div>\n );\n}\n\nSelectMenu.propTypes = {\n /** String that is displayed for default value of the ``SelectMenu`` */\n defaultMessage: PropTypes.string,\n /** Specifies the content of the ``SelectMenu`` */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.string,\n /** Specifies if the `SelectMenu` is disabled. */\n disabled: PropTypes.bool,\n};\n\nSelectMenu.defaultProps = {\n defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,\n className: undefined,\n variant: 'outline-primary',\n disabled: false,\n};\n\nconst SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {\n isLink: {\n deprType: DeprTypes.MOVED_AND_FORMAT,\n message: 'Use \"variant\" prop instead, i.e. variant=\"link\"',\n newName: 'variant',\n transform: () => 'link',\n },\n});\n\nexport default SelectMenuWithDeprecatedProp;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,OAAOC,IAAI,MAAM,GAAG;AACpB,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,OAAO,MAAMC,2BAA2B,GAAG,WAAW;AAEtD,SAASC,UAAUA,CAAC;EAClBC,cAAc;EACdC,QAAQ;EACRC,SAAS;EACTC,OAAO;EACPC,QAAQ;EACR,GAAGC;AACL,CAAC,EAAE;EACD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGrB,QAAQ,CAAC,IAAI,CAAC;EACxD;EACA;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D,SAAS,GAAG;EACrB;EACAzD,cAAc,EAAEX,SAAS,CAACqE,MAAM;EAChC;EACAzD,QAAQ,EAAEZ,SAAS,CAACsE,IAAI,CAACC,UAAU;EACnC;EACA1D,SAAS,EAAEb,SAAS,CAACqE,MAAM;EAC3B;EACAvD,OAAO,EAAEd,SAAS,CAACqE,MAAM;EACzB;EACAtD,QAAQ,EAAEf,SAAS,CAACwE;AACtB,CAAC;AAED9D,UAAU,CAAC+D,YAAY,GAAG;EACxB9D,cAAc,EAAEF,2BAA2B;EAC3CI,SAAS,EAAEkB,SAAS;EACpBjB,OAAO,EAAE,iBAAiB;EAC1BC,QAAQ,EAAE;AACZ,CAAC;AAED,MAAM2D,4BAA4B,GAAGnE,mBAAmB,CAACG,UAAU,EAAE,YAAY,EAAE;EACjFiE,MAAM,EAAE;IACNC,QAAQ,EAAEpE,SAAS,CAACqE,gBAAgB;IACpCC,OAAO,EAAE,iDAAiD;IAC1DC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAEA,CAAA,KAAM;EACnB;AACF,CAAC,CAAC;AAEF,eAAeN,4BAA4B","ignoreList":[]}
|
package/dist/Menu/index.js
CHANGED
|
@@ -2,13 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';
|
|
5
|
-
function Menu(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
5
|
+
function Menu({
|
|
6
|
+
as,
|
|
7
|
+
arrowKeyNavigationSelector,
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
12
11
|
const parentRef = useArrowKeyNavigation({
|
|
13
12
|
selectors: arrowKeyNavigationSelector
|
|
14
13
|
});
|
package/dist/Menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","useArrowKeyNavigation","Menu","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","useArrowKeyNavigation","Menu","as","arrowKeyNavigationSelector","children","props","parentRef","selectors","className","createElement","ref","Fragment","propTypes","string","elementType","node","defaultProps","undefined"],"sources":["../../src/Menu/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';\n\nfunction Menu({\n as,\n arrowKeyNavigationSelector,\n children,\n ...props\n}) {\n const parentRef = useArrowKeyNavigation({ selectors: arrowKeyNavigationSelector });\n const className = classNames(props.className, 'pgn__menu');\n\n return React.createElement(\n as,\n {\n ...props,\n ref: parentRef,\n className,\n },\n (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>\n {children}\n </>\n ),\n );\n}\n\nMenu.propTypes = {\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /**\n * Specifies the CSS selector string that indicates to which elements\n * the user can navigate using the arrow keys\n */\n arrowKeyNavigationSelector: PropTypes.string,\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the content of the menu */\n children: PropTypes.node,\n};\n\nMenu.defaultProps = {\n className: undefined,\n arrowKeyNavigationSelector: 'a:not(:disabled),button:not(:disabled),input:not(:disabled)',\n as: 'div',\n children: null,\n};\n\nexport default Menu;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,qBAAqB,MAAM,oCAAoC;AAEtE,SAASC,IAAIA,CAAC;EACZC,EAAE;EACFC,0BAA0B;EAC1BC,QAAQ;EACR,GAAGC;AACL,CAAC,EAAE;EACD,MAAMC,SAAS,GAAGN,qBAAqB,CAAC;IAAEO,SAAS,EAAEJ;EAA2B,CAAC,CAAC;EAClF,MAAMK,SAAS,GAAGT,UAAU,CAACM,KAAK,CAACG,SAAS,EAAE,WAAW,CAAC;EAE1D,oBAAOX,KAAK,CAACY,aAAa,CACxBP,EAAE,EACF;IACE,GAAGG,KAAK;IACRK,GAAG,EAAEJ,SAAS;IACdE;EACF,CAAC;EAAA;EAEC;EACAX,KAAA,CAAAY,aAAA,CAAAZ,KAAA,CAAAc,QAAA,QACGP,QACD,CAEN,CAAC;AACH;AAEAH,IAAI,CAACW,SAAS,GAAG;EACf;EACAJ,SAAS,EAAEV,SAAS,CAACe,MAAM;EAC3B;AACF;AACA;AACA;EACEV,0BAA0B,EAAEL,SAAS,CAACe,MAAM;EAC5C;EACAX,EAAE,EAAEJ,SAAS,CAACgB,WAAW;EACzB;EACAV,QAAQ,EAAEN,SAAS,CAACiB;AACtB,CAAC;AAEDd,IAAI,CAACe,YAAY,GAAG;EAClBR,SAAS,EAAES,SAAS;EACpBd,0BAA0B,EAAE,6DAA6D;EACzFD,EAAE,EAAE,KAAK;EACTE,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeH,IAAI","ignoreList":[]}
|
package/dist/Modal/AlertModal.js
CHANGED
|
@@ -4,13 +4,12 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { requiredWhenNot } from '../utils/propTypes';
|
|
5
5
|
import Icon from '../Icon';
|
|
6
6
|
import ModalDialog from './ModalDialog';
|
|
7
|
-
function AlertModal(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
7
|
+
function AlertModal({
|
|
8
|
+
children,
|
|
9
|
+
footerNode,
|
|
10
|
+
icon,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
14
13
|
return /*#__PURE__*/React.createElement(ModalDialog, {
|
|
15
14
|
...props,
|
|
16
15
|
className: classNames('pgn__alert-modal', props.className)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertModal.js","names":["React","PropTypes","classNames","requiredWhenNot","Icon","ModalDialog","AlertModal","
|
|
1
|
+
{"version":3,"file":"AlertModal.js","names":["React","PropTypes","classNames","requiredWhenNot","Icon","ModalDialog","AlertModal","children","footerNode","icon","props","createElement","className","Header","Title","src","title","Body","Footer","propTypes","node","isRequired","string","isOpen","bool","isBlocking","hasCloseButton","onClose","func","size","oneOf","variant","closeLabel","isFullscreenScroll","elementType","defaultProps","undefined"],"sources":["../../src/Modal/AlertModal.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport { requiredWhenNot } from '../utils/propTypes';\nimport Icon from '../Icon';\nimport ModalDialog from './ModalDialog';\n\nfunction AlertModal({\n children,\n footerNode,\n icon,\n ...props\n}) {\n return (\n <ModalDialog\n {...props}\n className={classNames('pgn__alert-modal', props.className)}\n >\n <ModalDialog.Header>\n <ModalDialog.Title>\n {icon && (\n <Icon\n data-testid=\"title-icon\"\n src={icon}\n className={classNames('pgn__alert-modal__title_icon')}\n />\n )}\n {props.title}\n </ModalDialog.Title>\n </ModalDialog.Header>\n <ModalDialog.Body>{children}</ModalDialog.Body>\n {footerNode && <ModalDialog.Footer>{footerNode}</ModalDialog.Footer>}\n </ModalDialog>\n );\n}\n\nAlertModal.propTypes = {\n children: PropTypes.node.isRequired,\n /** The aria-label of the dialog */\n title: PropTypes.string.isRequired,\n /** Is the modal dialog open or closed */\n isOpen: PropTypes.bool,\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking: PropTypes.bool,\n /** Specifies whether the dialog box should contain 'x' icon button in the top right */\n hasCloseButton: PropTypes.bool,\n /** A callback to close the modal dialog */\n onClose: requiredWhenNot(PropTypes.func, 'isBlocking'),\n /** Sizes determine the maximum width of the dialog box */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /** The visual style of the dialog box */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success']),\n /** The label supplied to the close icon button if one is rendered */\n closeLabel: PropTypes.string,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ModalDialog.Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /** Specifies what should be displayed in the footer of the dialog box */\n footerNode: PropTypes.node,\n /** Icon that will be shown in the header of modal */\n icon: PropTypes.elementType,\n};\n\nAlertModal.defaultProps = {\n isOpen: false,\n isBlocking: false,\n hasCloseButton: false,\n onClose: () => {},\n size: 'md',\n variant: 'default',\n closeLabel: 'Close',\n className: undefined,\n isFullscreenScroll: false,\n footerNode: null,\n icon: undefined,\n};\n\nexport default AlertModal;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,WAAW,MAAM,eAAe;AAEvC,SAASC,UAAUA,CAAC;EAClBC,QAAQ;EACRC,UAAU;EACVC,IAAI;EACJ,GAAGC;AACL,CAAC,EAAE;EACD,oBACEV,KAAA,CAAAW,aAAA,CAACN,WAAW;IAAA,GACNK,KAAK;IACTE,SAAS,EAAEV,UAAU,CAAC,kBAAkB,EAAEQ,KAAK,CAACE,SAAS;EAAE,gBAE3DZ,KAAA,CAAAW,aAAA,CAACN,WAAW,CAACQ,MAAM,qBACjBb,KAAA,CAAAW,aAAA,CAACN,WAAW,CAACS,KAAK,QACfL,IAAI,iBACHT,KAAA,CAAAW,aAAA,CAACP,IAAI;IACH,eAAY,YAAY;IACxBW,GAAG,EAAEN,IAAK;IACVG,SAAS,EAAEV,UAAU,CAAC,8BAA8B;EAAE,CACvD,CACF,EACAQ,KAAK,CAACM,KACU,CACD,CAAC,eACrBhB,KAAA,CAAAW,aAAA,CAACN,WAAW,CAACY,IAAI,QAAEV,QAA2B,CAAC,EAC9CC,UAAU,iBAAIR,KAAA,CAAAW,aAAA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AI,EAAE2B;AACR,CAAC;AAED,eAAe9B,UAAU","ignoreList":[]}
|
|
@@ -2,14 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ModalDialog from './ModalDialog';
|
|
4
4
|
export const FULLSCREEN_MODAL_CLOSE_LABEL = 'Close';
|
|
5
|
-
function FullscreenModal(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
5
|
+
function FullscreenModal({
|
|
6
|
+
children,
|
|
7
|
+
footerNode,
|
|
8
|
+
beforeBodyNode,
|
|
9
|
+
afterBodyNode,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
13
12
|
return /*#__PURE__*/React.createElement(ModalDialog, {
|
|
14
13
|
...props
|
|
15
14
|
}, /*#__PURE__*/React.createElement(ModalDialog.Header, null, /*#__PURE__*/React.createElement(ModalDialog.Title, null, props.title)), beforeBodyNode, /*#__PURE__*/React.createElement(ModalDialog.Body, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenModal.js","names":["React","PropTypes","ModalDialog","FULLSCREEN_MODAL_CLOSE_LABEL","FullscreenModal","
|
|
1
|
+
{"version":3,"file":"FullscreenModal.js","names":["React","PropTypes","ModalDialog","FULLSCREEN_MODAL_CLOSE_LABEL","FullscreenModal","children","footerNode","beforeBodyNode","afterBodyNode","props","createElement","Header","Title","title","Body","className","modalBodyClassName","Footer","propTypes","node","isRequired","string","onClose","func","isOpen","bool","hasCloseButton","size","oneOf","variant","closeLabel","isFullscreenScroll","defaultProps","undefined"],"sources":["../../src/Modal/FullscreenModal.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ModalDialog from './ModalDialog';\n\nexport const FULLSCREEN_MODAL_CLOSE_LABEL = 'Close';\n\nfunction FullscreenModal({\n children,\n footerNode,\n beforeBodyNode,\n afterBodyNode,\n ...props\n}) {\n return (\n <ModalDialog {...props}>\n <ModalDialog.Header>\n <ModalDialog.Title>{props.title}</ModalDialog.Title>\n </ModalDialog.Header>\n {beforeBodyNode}\n <ModalDialog.Body className={props.modalBodyClassName}>{children}</ModalDialog.Body>\n {afterBodyNode}\n {footerNode && <ModalDialog.Footer>{footerNode}</ModalDialog.Footer>}\n </ModalDialog>\n );\n}\n\nFullscreenModal.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies the aria-label of the dialog. */\n title: PropTypes.string.isRequired,\n /** Specifies a callback to close the modal dialog. */\n onClose: PropTypes.func.isRequired,\n /** Specifies whether the modal is open. */\n isOpen: PropTypes.bool,\n /** Specifies whether the model hase close 'x' icon button in the top right of the dialog box. */\n hasCloseButton: PropTypes.bool,\n /** Specifies size of the dialog box. */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /** Specifies visual style of the dialog box. */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /** The label supplied to the close icon button if one is rendered */\n closeLabel: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ModalDialog.Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /** Specifies footer for the dialog box. */\n footerNode: PropTypes.node,\n /** Specifies content that should be rendered before modal's body. */\n beforeBodyNode: PropTypes.node,\n /** Specifies content that should be rendered after modal's body. */\n afterBodyNode: PropTypes.node,\n /** Specifies class name for modal's body component. */\n modalBodyClassName: PropTypes.string,\n};\n\nFullscreenModal.defaultProps = {\n isOpen: false,\n hasCloseButton: true,\n size: 'fullscreen',\n variant: 'dark',\n closeLabel: FULLSCREEN_MODAL_CLOSE_LABEL,\n className: undefined,\n isFullscreenScroll: false,\n footerNode: null,\n beforeBodyNode: null,\n afterBodyNode: null,\n modalBodyClassName: '',\n};\n\nexport default FullscreenMod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AAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;EAC7E;EACAE,UAAU,EAAE7B,SAAS,CAACoB,MAAM;EAC5B;AACF;AACA;AACA;AACA;EACEU,kBAAkB,EAAE9B,SAAS,CAACwB,IAAI;EAClC;EACAnB,UAAU,EAAEL,SAAS,CAACkB,IAAI;EAC1B;EACAZ,cAAc,EAAEN,SAAS,CAACkB,IAAI;EAC9B;EACAX,aAAa,EAAEP,SAAS,CAACkB,IAAI;EAC7B;EACAH,kBAAkB,EAAEf,SAAS,CAACoB;AAChC,CAAC;AAEDjB,eAAe,CAAC4B,YAAY,GAAG;EAC7BR,MAAM,EAAE,KAAK;EACbE,cAAc,EAAE,IAAI;EACpBC,IAAI,EAAE,YAAY;EAClBE,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE3B,4BAA4B;EACxCY,SAAS,EAAEkB,SAAS;EACpBF,kBAAkB,EAAE,KAAK;EACzBzB,UAAU,EAAE,IAAI;EAChBC,cAAc,EAAE,IAAI;EACpBC,aAAa,EAAE,IAAI;EACnBQ,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeZ,eAAe","ignoreList":[]}
|
|
@@ -2,16 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { requiredWhenNot } from '../utils/propTypes';
|
|
4
4
|
import ModalDialog from './ModalDialog';
|
|
5
|
-
function MarketingModal(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} = _ref;
|
|
5
|
+
function MarketingModal({
|
|
6
|
+
children,
|
|
7
|
+
footerNode,
|
|
8
|
+
heroNode,
|
|
9
|
+
heroIsDark,
|
|
10
|
+
beforeBodyNode,
|
|
11
|
+
afterBodyNode,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
15
14
|
return /*#__PURE__*/React.createElement(ModalDialog, {
|
|
16
15
|
...props,
|
|
17
16
|
variant: heroIsDark ? 'dark' : 'default'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarketingModal.js","names":["React","PropTypes","requiredWhenNot","ModalDialog","MarketingModal","
|
|
1
|
+
{"version":3,"file":"MarketingModal.js","names":["React","PropTypes","requiredWhenNot","ModalDialog","MarketingModal","children","footerNode","heroNode","heroIsDark","beforeBodyNode","afterBodyNode","props","createElement","variant","Body","Footer","propTypes","node","isRequired","title","string","isOpen","bool","isBlocking","hasCloseButton","onClose","func","size","oneOf","closeLabel","className","isFullscreenScroll","defaultProps","undefined"],"sources":["../../src/Modal/MarketingModal.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { requiredWhenNot } from '../utils/propTypes';\nimport ModalDialog from './ModalDialog';\n\nfunction MarketingModal({\n children,\n footerNode,\n heroNode,\n heroIsDark,\n beforeBodyNode,\n afterBodyNode,\n ...props\n}) {\n return (\n <ModalDialog\n {...props}\n variant={heroIsDark ? 'dark' : 'default'}\n >\n {heroNode}\n {beforeBodyNode}\n <ModalDialog.Body>{children}</ModalDialog.Body>\n {afterBodyNode}\n {footerNode && (\n <ModalDialog.Footer>{footerNode}</ModalDialog.Footer>\n )}\n </ModalDialog>\n );\n}\n\nMarketingModal.propTypes = {\n /** Specifies the content of the modal */\n children: PropTypes.node.isRequired,\n /** Title of the modal */\n title: PropTypes.string.isRequired,\n /** Is the modal dialog open or closed */\n isOpen: PropTypes.bool,\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking: PropTypes.bool,\n /** The close 'x' icon button in the top right corner */\n hasCloseButton: PropTypes.bool,\n /** Callback function for when the modal is dismissed */\n onClose: requiredWhenNot(PropTypes.func, 'isBlocking'),\n /** Size of the modal window */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /** Specifies the ``aria-label`` attribute for the close button */\n closeLabel: PropTypes.string,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ModalDialog.Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /** Specifies what should be displayed in the footer of the nodal */\n footerNode: PropTypes.node,\n /** Enables dark theme for the modal */\n heroIsDark: PropTypes.bool,\n /** Specifies what should be displayed in the header of the modal */\n heroNode: PropTypes.node,\n /** Specifies what should be displayed before the body block */\n beforeBodyNode: PropTypes.node,\n /** Specifies what should be displayed after the body block */\n afterBodyNode: PropTypes.node,\n};\n\nMarketingModal.defaultProps = {\n isOpen: false,\n isBlocking: false,\n hasCloseButton: true,\n onClose: () => {},\n size: 'md',\n closeLabel: 'Close',\n className: undefined,\n isFullscreenScroll: true,\n footerNode: null,\n heroIsDark: true,\n heroNode: null,\n beforeBodyNode: null,\n afterBodyNode: null,\n};\n\nexport default MarketingModal;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,OAAOC,WAAW,MAAM,eAAe;AAEvC,SAASC,cAAcA,CAAC;EACtBC,QAAQ;EACRC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,cAAc;EACdC,aAAa;EACb,GAAGC;AACL,CAAC,EAAE;EACD,oBACEX,KAAA,CAAAY,aAAA,CAACT,WAAW;IAAA,GACNQ,KAAK;IACTE,OAAO,EAAEL,UAAU,GAAG,MAAM,GAAG;EAAU,GAExCD,QAAQ,EACRE,cAAc,eACfT,KAAA,CAAAY,aAAA,CAACT,WAAW,CAACW,IAAI,QAAET,QAA2B,CAAC,EAC9CK,aAAa,EACbJ,UAAU,iBACXN,KAAA,CAAAY,aAAA,CAACT,WAAW,CAACY,MAAM,QAAET,UAA+B,CAEzC,CAAC;AAElB;AAEAF,cAAc,CAACY,SAAS,GAAG;EACzB;EACAX,QAAQ,EAAEJ,SAAS,CAACgB,IAAI,CA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-3,12 +3,11 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import ModalContext from './ModalContext';
|
|
5
5
|
import Button from '../Button';
|
|
6
|
-
const ModalCloseButton = /*#__PURE__*/React.forwardRef((
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
6
|
+
const ModalCloseButton = /*#__PURE__*/React.forwardRef(({
|
|
7
|
+
as,
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => {
|
|
12
11
|
const {
|
|
13
12
|
onClose
|
|
14
13
|
} = useContext(ModalContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalCloseButton.js","names":["React","useContext","PropTypes","classNames","ModalContext","Button","ModalCloseButton","forwardRef","
|
|
1
|
+
{"version":3,"file":"ModalCloseButton.js","names":["React","useContext","PropTypes","classNames","ModalContext","Button","ModalCloseButton","forwardRef","as","children","props","ref","onClose","type","componentProps","className","onClick","createElement","propTypes","elementType","node","string","func","defaultProps","undefined"],"sources":["../../src/Modal/ModalCloseButton.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport ModalContext from './ModalContext';\nimport Button from '../Button';\n\nconst ModalCloseButton = React.forwardRef(({ as, children, ...props }, ref) => {\n const { onClose } = useContext(ModalContext);\n const type = as;\n const componentProps = {\n ...props,\n className: classNames('pgn__modal-close-button', props.className),\n onClick: () => {\n onClose();\n if (props.onClick) {\n props.onClick();\n }\n },\n ref,\n };\n\n // Use the non-jsx syntax to create this element so we can more\n // finely control the component type (defaulted to Button via defaultProps)\n return React.createElement(type, componentProps, children);\n});\n\nModalCloseButton.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the content of the button */\n children: PropTypes.node,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies the callback function when the close button is clicked */\n onClick: PropTypes.func,\n};\n\nModalCloseButton.defaultProps = {\n as: Button,\n onClick: undefined,\n className: undefined,\n children: null,\n};\n\nexport default ModalCloseButton;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,MAAM,MAAM,WAAW;AAE9B,MAAMC,gBAAgB,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAAC;EAAEC,EAAE;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC7E,MAAM;IAAEC;EAAQ,CAAC,GAAGX,UAAU,CAACG,YAAY,CAAC;EAC5C,MAAMS,IAAI,GAAGL,EAAE;EACf,MAAMM,cAAc,GAAG;IACrB,GAAGJ,KAAK;IACRK,SAAS,EAAEZ,UAAU,CAAC,yBAAyB,EAAEO,KAAK,CAACK,SAAS,CAAC;IACjEC,OAAO,EAAEA,CAAA,KAAM;MACbJ,OAAO,CAAC,CAAC;MACT,IAAIF,KAAK,CAACM,OAAO,EAAE;QACjBN,KAAK,CAACM,OAAO,CAAC,CAAC;MACjB;IACF,CAAC;IACDL;EACF,CAAC;;EAED;EACA;EACA,oBAAOX,KAAK,CAACiB,aAAa,CAACJ,IAAI,EAAEC,cAAc,EAAEL,QAAQ,CAAC;AAC5D,CAAC,CAAC;AAEFH,gBAAgB,CAACY,SAAS,GAAG;EAC3B;EACAV,EAAE,EAAEN,SAAS,CAACiB,WAAW;EACzB;EACAV,QAAQ,EAAEP,SAAS,CAACkB,IAAI;EACxB;EACAL,SAAS,EAAEb,SAAS,CAACmB,MAAM;EAC3B;EACAL,OAAO,EAAEd,SAAS,CAACoB;AACrB,CAAC;AAEDhB,gBAAgB,CAACiB,YAAY,GAAG;EAC9Bf,EAAE,EAAEH,MAAM;EACVW,OAAO,EAAEQ,SAAS;EAClBT,SAAS,EAAES,SAAS;EACpBf,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeH,gBAAgB","ignoreList":[]}
|
|
@@ -4,13 +4,12 @@ const ModalContext = /*#__PURE__*/React.createContext({
|
|
|
4
4
|
isOpen: false,
|
|
5
5
|
isBlocking: false
|
|
6
6
|
});
|
|
7
|
-
function ModalContextProvider(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
7
|
+
function ModalContextProvider({
|
|
8
|
+
onClose,
|
|
9
|
+
isOpen,
|
|
10
|
+
isBlocking = false,
|
|
11
|
+
children = null
|
|
12
|
+
}) {
|
|
14
13
|
const modalContextValue = useMemo(() => ({
|
|
15
14
|
onClose,
|
|
16
15
|
isOpen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContext.js","names":["React","useMemo","ModalContext","createContext","onClose","isOpen","isBlocking","ModalContextProvider","
|
|
1
|
+
{"version":3,"file":"ModalContext.js","names":["React","useMemo","ModalContext","createContext","onClose","isOpen","isBlocking","ModalContextProvider","children","modalContextValue","createElement","Provider","value"],"sources":["../../src/Modal/ModalContext.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\n\ninterface ContextData {\n onClose: () => void;\n isOpen: boolean;\n isBlocking: boolean;\n}\n\nconst ModalContext = React.createContext<ContextData>({\n onClose: () => {},\n isOpen: false,\n isBlocking: false,\n});\n\nfunction ModalContextProvider({\n onClose,\n isOpen,\n isBlocking = false,\n children = null,\n}: {\n onClose: () => void;\n isOpen: boolean;\n isBlocking?: boolean;\n children?: React.ReactNode;\n}) {\n const modalContextValue = useMemo<ContextData>(\n () => ({ onClose, isOpen, isBlocking }),\n [onClose, isOpen, isBlocking],\n );\n\n return (\n <ModalContext.Provider value={modalContextValue}>\n {children}\n </ModalContext.Provider>\n );\n}\n\nexport { ModalContextProvider };\nexport default ModalContext;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAQtC,MAAMC,YAAY,gBAAGF,KAAK,CAACG,aAAa,CAAc;EACpDC,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE;AACd,CAAC,CAAC;AAEF,SAASC,oBAAoBA,CAAC;EAC5BH,OAAO;EACPC,MAAM;EACNC,UAAU,GAAG,KAAK;EAClBE,QAAQ,GAAG;AAMb,CAAC,EAAE;EACD,MAAMC,iBAAiB,GAAGR,OAAO,CAC/B,OAAO;IAAEG,OAAO;IAAEC,MAAM;IAAEC;EAAW,CAAC,CAAC,EACvC,CAACF,OAAO,EAAEC,MAAM,EAAEC,UAAU,CAC9B,CAAC;EAED,oBACEN,KAAA,CAAAU,aAAA,CAACR,YAAY,CAACS,QAAQ;IAACC,KAAK,EAAEH;EAAkB,GAC7CD,QACoB,CAAC;AAE5B;AAEA,SAASD,oBAAoB;AAC7B,eAAeL,YAAY","ignoreList":[]}
|