@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
package/src/Button/index.tsx
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes, { type Requireable } from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import BaseButton, { type ButtonProps as BaseButtonProps } from 'react-bootstrap/Button';
|
|
5
4
|
import BaseButtonGroup, { type ButtonGroupProps as BaseButtonGroupProps } from 'react-bootstrap/ButtonGroup';
|
|
6
|
-
import BaseButtonToolbar, { type ButtonToolbarProps } from 'react-bootstrap/ButtonToolbar';
|
|
5
|
+
import BaseButtonToolbar, { type ButtonToolbarProps as BaseButtonToolbarProps } from 'react-bootstrap/ButtonToolbar';
|
|
7
6
|
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
8
7
|
|
|
9
8
|
import Icon from '../Icon';
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
type BaseVariant = (
|
|
11
|
+
| 'primary'
|
|
12
|
+
| 'secondary'
|
|
13
|
+
| 'tertiary'
|
|
14
|
+
| 'brand'
|
|
15
|
+
| 'success'
|
|
16
|
+
| 'danger'
|
|
17
|
+
| 'warning'
|
|
18
|
+
| 'info'
|
|
19
|
+
| 'dark'
|
|
20
|
+
| 'light'
|
|
21
|
+
| 'link'
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This was added so these types could be added as a non-breaking change.
|
|
26
|
+
* @deprecated - remove in Paragon 24
|
|
27
|
+
*/
|
|
28
|
+
type OtherDeprecatedValue = string & {}; // Allow any other string value for now, even though it's invalid
|
|
29
|
+
|
|
30
|
+
export interface ButtonProps extends Omit<BaseButtonProps, 'size'> {
|
|
31
|
+
/** Set a custom element for this component (default: `button`, with `type="button"`). */
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
12
34
|
/**
|
|
13
35
|
* An icon component to render. Example:
|
|
14
36
|
* ```
|
|
@@ -25,18 +47,32 @@ interface ButtonProps extends Omit<BaseButtonProps, 'size'> {
|
|
|
25
47
|
* ```
|
|
26
48
|
*/
|
|
27
49
|
iconAfter?: React.ComponentType;
|
|
28
|
-
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
29
|
-
}
|
|
30
50
|
|
|
31
|
-
|
|
51
|
+
// The following are the same as in BaseButtonProps, but we re-define them to add documentation.
|
|
52
|
+
// The upstream type defintions do not have any comments/docs.
|
|
53
|
+
|
|
54
|
+
/** Disables the Button, preventing mouse events, even if the underlying component is an `<a>` element */
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/** Optional: Specify additional class name(s) to apply to the button */
|
|
57
|
+
className?: string;
|
|
58
|
+
/** Specifies the text that is displayed within the button. */
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
/** Specifies variant to use.
|
|
61
|
+
* Can be one of the base variants: `primary`, `secondary`, `tertiary`, `brand`, `success`, `danger`, `warning`,
|
|
62
|
+
* `info`, `dark`, `light`, `link`,
|
|
63
|
+
* as well as one of the customized variants (= base variant prefixed with `inverse-`, `outline-`
|
|
64
|
+
* or `inverse-outline-`)
|
|
65
|
+
* */
|
|
66
|
+
variant?: BaseVariant | `inverse-${BaseVariant}` | `outline-${BaseVariant}` | `inverse-outline-${BaseVariant}` | OtherDeprecatedValue;
|
|
67
|
+
}
|
|
32
68
|
|
|
33
|
-
const Button:
|
|
69
|
+
const Button: ComponentWithAsProp<'button', ButtonProps> = React.forwardRef(({
|
|
34
70
|
children,
|
|
35
71
|
iconAfter,
|
|
36
72
|
iconBefore,
|
|
37
73
|
size,
|
|
38
74
|
...props
|
|
39
|
-
}, ref) => (
|
|
75
|
+
}: ButtonProps, ref: React.ForwardedRef<HTMLDivElement>) => (
|
|
40
76
|
<BaseButton
|
|
41
77
|
size={size as 'sm' | 'lg' | undefined} // Bootstrap's <Button> types do not allow 'md' or 'inline', but we do.
|
|
42
78
|
{...props}
|
|
@@ -49,107 +85,46 @@ const Button: ButtonType = React.forwardRef<HTMLButtonElement, ButtonProps>(({
|
|
|
49
85
|
</BaseButton>
|
|
50
86
|
));
|
|
51
87
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/** Disables the Button, preventing mouse events, even if the underlying component is an `<a>` element */
|
|
56
|
-
disabled: PropTypes.bool,
|
|
57
|
-
/** Specifies the text that is displayed within the button. */
|
|
58
|
-
children: PropTypes.node.isRequired,
|
|
59
|
-
/** A function that would specify what the button should do when the `onClick` event is triggered.
|
|
60
|
-
* For example, the button could launch a `Modal`. The default is an empty function. */
|
|
61
|
-
onClick: PropTypes.func,
|
|
62
|
-
/** A function that would specify what the button should do when the `onKeyDown` event is triggered.
|
|
63
|
-
* For example, this could handle using the `Escape` key to trigger the button's action.
|
|
64
|
-
* The default is an empty function. */
|
|
65
|
-
onKeyDown: PropTypes.func,
|
|
66
|
-
/** Used to set the `type` attribute on the `button` tag. The default type is `button`. */
|
|
67
|
-
type: PropTypes.string,
|
|
68
|
-
/** Specifies variant to use.
|
|
69
|
-
* Can be on of the base variants: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `dark`,
|
|
70
|
-
* `light`, `link`
|
|
71
|
-
*
|
|
72
|
-
* as well as one of the customized variants (= base variant prefixed with `inverse-`, `outline-`
|
|
73
|
-
* or `inverse-outline-`)
|
|
74
|
-
* */
|
|
75
|
-
variant: PropTypes.string,
|
|
76
|
-
/** An icon component to render.
|
|
77
|
-
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */
|
|
78
|
-
iconBefore: PropTypes.elementType as Requireable<React.ComponentType>,
|
|
79
|
-
/** An icon component to render.
|
|
80
|
-
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */
|
|
81
|
-
iconAfter: PropTypes.elementType as Requireable<React.ComponentType>,
|
|
82
|
-
// The 'as' type casting above is required for TypeScript checking, because the 'PropTypes.elementType' type normally
|
|
83
|
-
// allows strings as a value (for use cases like 'div') but we don't support that for <Icon />/iconBefore/iconAfter.
|
|
84
|
-
// The React TypeScript type definitions are more specific (React.ComponentType vs React.ElementType).
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
Button.defaultProps = {
|
|
88
|
-
...Button.defaultProps,
|
|
89
|
-
children: undefined,
|
|
90
|
-
className: undefined,
|
|
91
|
-
iconBefore: undefined,
|
|
92
|
-
iconAfter: undefined,
|
|
93
|
-
disabled: false,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// We could just re-export 'ButtonGroup' and 'ButtonToolbar', but we currently
|
|
97
|
-
// override them to add propTypes validation at runtime, since most Paragon
|
|
98
|
-
// consumers aren't using TypeScript yet. We also force ButtonGroup's 'size'
|
|
99
|
-
// prop to accept our custom values of 'md' and 'inline' which are used in
|
|
100
|
-
// Paragon but not used in the base Bootstrap classes.
|
|
88
|
+
// We could just re-export 'ButtonGroup', but we currently override it to
|
|
89
|
+
// force ButtonGroup's 'size' prop to accept our custom values of 'md' and
|
|
90
|
+
// 'inline' which are used in Paragon but not used in the base Bootstrap classes.
|
|
101
91
|
|
|
102
92
|
interface ButtonGroupProps extends Omit<BaseButtonGroupProps, 'size'> {
|
|
93
|
+
/** Specifies element type for this component. */
|
|
94
|
+
as?: React.ElementType;
|
|
95
|
+
/** An ARIA role describing the button group (default: `group`). */
|
|
96
|
+
role?: React.AriaRole;
|
|
97
|
+
/** Specifies the size for all Buttons in the group (default: `md`). */
|
|
103
98
|
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
99
|
+
/** Display as a button toggle group (default: `false`). */
|
|
100
|
+
toggle?: boolean;
|
|
101
|
+
/** Specifies if the set of Buttons should appear vertically stacked (default: `false`). */
|
|
102
|
+
vertical?: boolean;
|
|
103
|
+
/** Overrides underlying component base CSS class name (default: `btn-group`). */
|
|
104
|
+
bsPrefix?: string;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
const ButtonGroup: ComponentWithAsProp<'div', ButtonGroupProps> = (
|
|
107
|
-
React.forwardRef
|
|
108
|
+
React.forwardRef(({ size = 'md', ...props }: ButtonGroupProps, ref: React.ForwardedRef<HTMLDivElement>) => (
|
|
108
109
|
<BaseButtonGroup size={size as 'sm' | 'lg'} {...props} ref={ref} />
|
|
109
110
|
))
|
|
110
111
|
);
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
as: PropTypes.elementType,
|
|
115
|
-
/** An ARIA role describing the button group. */
|
|
116
|
-
role: PropTypes.string,
|
|
117
|
-
/** Specifies the size for all Buttons in the group. */
|
|
118
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg', 'inline']),
|
|
119
|
-
/** Display as a button toggle group. */
|
|
120
|
-
toggle: PropTypes.bool,
|
|
121
|
-
/** Specifies if the set of Buttons should appear vertically stacked. */
|
|
122
|
-
vertical: PropTypes.bool,
|
|
123
|
-
/** Overrides underlying component base CSS class name */
|
|
124
|
-
bsPrefix: PropTypes.string,
|
|
125
|
-
};
|
|
113
|
+
// We could just re-export 'ButtonToolbar', but we currently override it to
|
|
114
|
+
// narrow the type of 'role' to valid roles and to document its properties.
|
|
126
115
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
role
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
size: 'md',
|
|
134
|
-
};
|
|
116
|
+
interface ButtonToolbarProps extends BaseButtonToolbarProps {
|
|
117
|
+
/** An ARIA role describing the button group (default: `toolbar`). */
|
|
118
|
+
role?: React.AriaRole;
|
|
119
|
+
/** Overrides underlying component base CSS class name (default: `btn-toolbar`) */
|
|
120
|
+
bsPrefix?: string;
|
|
121
|
+
}
|
|
135
122
|
|
|
136
123
|
const ButtonToolbar: ComponentWithAsProp<'div', ButtonToolbarProps> = (
|
|
137
|
-
React.forwardRef
|
|
124
|
+
React.forwardRef((props: ButtonToolbarProps, ref: React.ForwardedRef<HTMLDivElement>) => (
|
|
138
125
|
<BaseButtonToolbar {...props} ref={ref} />
|
|
139
126
|
))
|
|
140
127
|
);
|
|
141
128
|
|
|
142
|
-
ButtonToolbar.propTypes = {
|
|
143
|
-
/** An ARIA role describing the button group. */
|
|
144
|
-
role: PropTypes.string,
|
|
145
|
-
/** Overrides underlying component base CSS class name */
|
|
146
|
-
bsPrefix: PropTypes.string,
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
ButtonToolbar.defaultProps = {
|
|
150
|
-
role: 'toolbar',
|
|
151
|
-
bsPrefix: 'btn-toolbar',
|
|
152
|
-
};
|
|
153
|
-
|
|
154
129
|
export default Button;
|
|
155
130
|
export { ButtonGroup, ButtonToolbar };
|
package/src/Chip/index.tsx
CHANGED
|
@@ -1,40 +1,59 @@
|
|
|
1
1
|
import React, { ForwardedRef, KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
-
import PropTypes, { type Requireable } from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { requiredWhen } from '../utils/propTypes';
|
|
6
|
-
import { STYLE_VARIANTS } from './constants';
|
|
7
3
|
import ChipIcon from './ChipIcon';
|
|
4
|
+
import { STYLE_VARIANTS } from './constants';
|
|
8
5
|
|
|
9
6
|
export const CHIP_PGN_CLASS = 'pgn__chip';
|
|
10
7
|
|
|
11
8
|
export interface IChip {
|
|
9
|
+
/** Specifies the content of the `Chip`. */
|
|
12
10
|
children: React.ReactNode,
|
|
11
|
+
/** Click handler for the whole `Chip`, has effect only when Chip does not have any interactive icons. */
|
|
13
12
|
onClick?: KeyboardEventHandler & MouseEventHandler,
|
|
13
|
+
/** Specifies an additional `className` to add to the base element. */
|
|
14
14
|
className?: string,
|
|
15
|
+
/** The `Chip` style [variant](https://github.com/openedx/paragon/blob/release-23.x/src/Chip/constants.ts) to use. */
|
|
15
16
|
variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS],
|
|
17
|
+
/**
|
|
18
|
+
* An icon component to render before the content.
|
|
19
|
+
* Example import of a Paragon icon component:
|
|
20
|
+
*
|
|
21
|
+
* `import { Check } from '@openedx/paragon/icons';`
|
|
22
|
+
*/
|
|
16
23
|
iconBefore?: React.ComponentType,
|
|
24
|
+
/** Specifies icon alt text. */
|
|
17
25
|
iconBeforeAlt?: string,
|
|
26
|
+
/**
|
|
27
|
+
* An icon component to render before after the content.
|
|
28
|
+
* Example import of a Paragon icon component:
|
|
29
|
+
*
|
|
30
|
+
* `import { Check } from '@openedx/paragon/icons';`
|
|
31
|
+
*/
|
|
18
32
|
iconAfter?: React.ComponentType,
|
|
33
|
+
/** Specifies icon alt text. */
|
|
19
34
|
iconAfterAlt?: string,
|
|
35
|
+
/** A click handler for the `Chip` icon before. */
|
|
20
36
|
onIconBeforeClick?: KeyboardEventHandler & MouseEventHandler,
|
|
37
|
+
/** A click handler for the `Chip` icon after. */
|
|
21
38
|
onIconAfterClick?: KeyboardEventHandler & MouseEventHandler,
|
|
39
|
+
/** Disables the `Chip`. */
|
|
22
40
|
disabled?: boolean,
|
|
41
|
+
/** Indicates if `Chip` has been selected. */
|
|
23
42
|
isSelected?: boolean,
|
|
24
43
|
}
|
|
25
44
|
|
|
26
45
|
const Chip = React.forwardRef(({
|
|
27
46
|
children,
|
|
28
47
|
className,
|
|
29
|
-
variant,
|
|
48
|
+
variant = 'light',
|
|
30
49
|
iconBefore,
|
|
31
50
|
iconBeforeAlt,
|
|
32
51
|
iconAfter,
|
|
33
52
|
iconAfterAlt,
|
|
34
53
|
onIconBeforeClick,
|
|
35
54
|
onIconAfterClick,
|
|
36
|
-
disabled,
|
|
37
|
-
isSelected,
|
|
55
|
+
disabled = false,
|
|
56
|
+
isSelected = false,
|
|
38
57
|
onClick,
|
|
39
58
|
...props
|
|
40
59
|
}: IChip, ref: ForwardedRef<HTMLDivElement>) => {
|
|
@@ -92,56 +111,4 @@ const Chip = React.forwardRef(({
|
|
|
92
111
|
);
|
|
93
112
|
});
|
|
94
113
|
|
|
95
|
-
Chip.propTypes = {
|
|
96
|
-
/** Specifies the content of the `Chip`. */
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
children: PropTypes.node.isRequired,
|
|
99
|
-
/** Specifies an additional `className` to add to the base element. */
|
|
100
|
-
className: PropTypes.string,
|
|
101
|
-
/** The `Chip` style variant to use. */
|
|
102
|
-
variant: PropTypes.oneOf(['light', 'dark']),
|
|
103
|
-
/** Disables the `Chip`. */
|
|
104
|
-
disabled: PropTypes.bool,
|
|
105
|
-
/** Click handler for the whole Chip, has effect only when Chip does not have any interactive icons. */
|
|
106
|
-
onClick: PropTypes.func,
|
|
107
|
-
/**
|
|
108
|
-
* An icon component to render before the content.
|
|
109
|
-
* Example import of a Paragon icon component:
|
|
110
|
-
*
|
|
111
|
-
* `import { Check } from '@openedx/paragon/icons';`
|
|
112
|
-
*/
|
|
113
|
-
iconBefore: PropTypes.elementType as Requireable<React.ComponentType>,
|
|
114
|
-
/** Specifies icon alt text. */
|
|
115
|
-
iconBeforeAlt: requiredWhen(PropTypes.string, ['iconBefore', 'onIconBeforeClick']),
|
|
116
|
-
/** A click handler for the `Chip` icon before. */
|
|
117
|
-
onIconBeforeClick: PropTypes.func,
|
|
118
|
-
/**
|
|
119
|
-
* An icon component to render before after the content.
|
|
120
|
-
* Example import of a Paragon icon component:
|
|
121
|
-
*
|
|
122
|
-
* `import { Check } from '@openedx/paragon/icons';`
|
|
123
|
-
*/
|
|
124
|
-
iconAfter: PropTypes.elementType as Requireable<React.ComponentType>,
|
|
125
|
-
/** Specifies icon alt text. */
|
|
126
|
-
iconAfterAlt: requiredWhen(PropTypes.string, ['iconAfter', 'onIconAfterClick']),
|
|
127
|
-
/** A click handler for the `Chip` icon after. */
|
|
128
|
-
onIconAfterClick: PropTypes.func,
|
|
129
|
-
/** Indicates if `Chip` has been selected. */
|
|
130
|
-
isSelected: PropTypes.bool,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
Chip.defaultProps = {
|
|
134
|
-
className: undefined,
|
|
135
|
-
variant: STYLE_VARIANTS.LIGHT,
|
|
136
|
-
disabled: false,
|
|
137
|
-
onClick: undefined,
|
|
138
|
-
iconBefore: undefined,
|
|
139
|
-
iconAfter: undefined,
|
|
140
|
-
onIconBeforeClick: undefined,
|
|
141
|
-
onIconAfterClick: undefined,
|
|
142
|
-
isSelected: false,
|
|
143
|
-
iconAfterAlt: undefined,
|
|
144
|
-
iconBeforeAlt: undefined,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
114
|
export default Chip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'react-bootstrap/CloseButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'react-bootstrap/Collapse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'react-bootstrap/Fade';
|
package/src/Form/FormLabel.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { useFormGroupContext } from './FormGroupContext';
|
|
5
4
|
import { FORM_CONTROL_SIZES } from './constants';
|
|
@@ -9,6 +8,8 @@ interface Props {
|
|
|
9
8
|
children: React.ReactNode;
|
|
10
9
|
/** Specifies whether the component should be displayed with inline styling. */
|
|
11
10
|
isInline?: boolean;
|
|
11
|
+
/** Specifies an additional `className` to add to the base element. */
|
|
12
|
+
className?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
function FormLabel({ children, isInline = false, ...props }: Props & React.ComponentPropsWithoutRef<'label'>) {
|
|
@@ -27,13 +28,4 @@ function FormLabel({ children, isInline = false, ...props }: Props & React.Compo
|
|
|
27
28
|
return React.createElement(componentType, labelProps, children);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
FormLabel.propTypes = {
|
|
31
|
-
/** Specifies class name to append to the base element. */
|
|
32
|
-
className: PropTypes.string,
|
|
33
|
-
/** Specifies contents of the component. */
|
|
34
|
-
children: PropTypes.node.isRequired,
|
|
35
|
-
/** Specifies whether the component should be displayed with inline styling. */
|
|
36
|
-
isInline: PropTypes.bool,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
31
|
export default FormLabel;
|
package/src/IconButton/index.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { type Placement } from 'react-bootstrap/Overlay';
|
|
5
4
|
import { OverlayTrigger } from '../Overlay';
|
|
@@ -7,6 +6,7 @@ import Tooltip from '../Tooltip';
|
|
|
7
6
|
import Icon from '../Icon';
|
|
8
7
|
|
|
9
8
|
interface Props extends React.HTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
/** Component that renders the icon, currently defaults to `Icon` */
|
|
10
10
|
iconAs?: React.ComponentType<any>,
|
|
11
11
|
/** Additional CSS class[es] to apply to this button */
|
|
12
12
|
className?: string;
|
|
@@ -26,33 +26,33 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
26
26
|
iconClassNames?: string;
|
|
27
27
|
/** Click handler for the button */
|
|
28
28
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
29
|
-
/**
|
|
29
|
+
/** Whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
30
30
|
isActive?: boolean;
|
|
31
31
|
/** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */
|
|
32
32
|
icon?: { prefix?: string; iconName?: string, icon?: any[] },
|
|
33
|
-
/** Type of button (uses Bootstrap options) */
|
|
33
|
+
/** Type of button (uses Bootstrap options). */
|
|
34
34
|
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';
|
|
35
|
-
/**
|
|
35
|
+
/** Size of button to render */
|
|
36
36
|
size?: 'sm' | 'md' | 'inline';
|
|
37
|
-
/**
|
|
37
|
+
/** No children */
|
|
38
38
|
children?: never;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const IconButton = React.forwardRef
|
|
41
|
+
const IconButton = React.forwardRef(({
|
|
42
42
|
className,
|
|
43
43
|
alt,
|
|
44
|
-
invertColors,
|
|
44
|
+
invertColors = false,
|
|
45
45
|
icon,
|
|
46
46
|
src,
|
|
47
47
|
iconClassNames,
|
|
48
|
-
onClick,
|
|
49
|
-
size,
|
|
50
|
-
variant,
|
|
51
|
-
iconAs,
|
|
52
|
-
isActive,
|
|
48
|
+
onClick = () => {},
|
|
49
|
+
size = 'md',
|
|
50
|
+
variant = 'primary',
|
|
51
|
+
iconAs = Icon,
|
|
52
|
+
isActive = false,
|
|
53
53
|
children, // unused, just here because we don't want it to be part of 'attrs'
|
|
54
54
|
...attrs
|
|
55
|
-
}, ref) => {
|
|
55
|
+
} : Props, ref: React.ForwardedRef<HTMLButtonElement>) => {
|
|
56
56
|
const invert = invertColors ? 'inverse-' : '';
|
|
57
57
|
const activeStyle = isActive ? `${variant}-` : '';
|
|
58
58
|
const IconComponent = iconAs;
|
|
@@ -87,58 +87,10 @@ const IconButton = React.forwardRef<HTMLButtonElement, Props>(({
|
|
|
87
87
|
);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
IconButton.defaultProps = {
|
|
91
|
-
iconAs: Icon,
|
|
92
|
-
src: undefined,
|
|
93
|
-
icon: undefined,
|
|
94
|
-
iconClassNames: undefined,
|
|
95
|
-
className: undefined,
|
|
96
|
-
invertColors: false,
|
|
97
|
-
variant: 'primary',
|
|
98
|
-
size: 'md',
|
|
99
|
-
onClick: () => {},
|
|
100
|
-
isActive: false,
|
|
101
|
-
children: undefined,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
IconButton.propTypes = {
|
|
105
|
-
/** A custom class name. */
|
|
106
|
-
className: PropTypes.string,
|
|
107
|
-
/** Component that renders the icon, currently defaults to `Icon` */
|
|
108
|
-
iconAs: PropTypes.elementType as any,
|
|
109
|
-
/** An icon component to render. Example import of a Paragon icon component:
|
|
110
|
-
* `import { Check } from '@openedx/paragon/icons';`
|
|
111
|
-
* */
|
|
112
|
-
src: PropTypes.elementType as any,
|
|
113
|
-
/** Alt text for your icon. For best practice, avoid using alt text to describe
|
|
114
|
-
* the image in the `IconButton`. Instead, we recommend describing the function
|
|
115
|
-
* of the button. */
|
|
116
|
-
alt: PropTypes.string.isRequired,
|
|
117
|
-
/** Changes icon styles for dark background */
|
|
118
|
-
invertColors: PropTypes.bool,
|
|
119
|
-
/** Accepts a [Paragon icon](https://paragon-openedx.netlify.app/foundations/icons) */
|
|
120
|
-
icon: PropTypes.shape({
|
|
121
|
-
prefix: PropTypes.string,
|
|
122
|
-
iconName: PropTypes.string,
|
|
123
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
124
|
-
icon: PropTypes.array,
|
|
125
|
-
}) as any,
|
|
126
|
-
/** Extra class names that will be added to the icon */
|
|
127
|
-
iconClassNames: PropTypes.string,
|
|
128
|
-
/** Click handler for the button */
|
|
129
|
-
onClick: PropTypes.func,
|
|
130
|
-
/** Type of button (uses Bootstrap options) */
|
|
131
|
-
variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),
|
|
132
|
-
/** size of button to render */
|
|
133
|
-
size: PropTypes.oneOf(['sm', 'md', 'inline']),
|
|
134
|
-
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
135
|
-
isActive: PropTypes.bool,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
90
|
interface PropsWithTooltip extends Props {
|
|
139
|
-
/** choose from https://popper.js.org/docs/v2/constructors/#options */
|
|
140
|
-
tooltipPlacement
|
|
141
|
-
/**
|
|
91
|
+
/** Tooltip placement can be top, left, right etc, choose from https://popper.js.org/docs/v2/constructors/#options */
|
|
92
|
+
tooltipPlacement?: Placement,
|
|
93
|
+
/** Any content to pass to tooltip content area */
|
|
142
94
|
tooltipContent: React.ReactNode,
|
|
143
95
|
}
|
|
144
96
|
|
|
@@ -146,7 +98,7 @@ interface PropsWithTooltip extends Props {
|
|
|
146
98
|
* An icon button wrapped in overlaytrigger to display a tooltip.
|
|
147
99
|
*/
|
|
148
100
|
function IconButtonWithTooltip({
|
|
149
|
-
tooltipPlacement, tooltipContent, ...props
|
|
101
|
+
tooltipPlacement = 'top', tooltipContent, ...props
|
|
150
102
|
}: PropsWithTooltip) {
|
|
151
103
|
const invert = props.invertColors ? 'inverse-' : '';
|
|
152
104
|
return (
|
|
@@ -166,22 +118,6 @@ function IconButtonWithTooltip({
|
|
|
166
118
|
);
|
|
167
119
|
}
|
|
168
120
|
|
|
169
|
-
IconButtonWithTooltip.defaultProps = {
|
|
170
|
-
...IconButton.defaultProps,
|
|
171
|
-
tooltipPlacement: 'top',
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
IconButtonWithTooltip.propTypes = {
|
|
175
|
-
/** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */
|
|
176
|
-
tooltipPlacement: PropTypes.string,
|
|
177
|
-
/** any valid JSX or text to be rendered as tooltip contents */
|
|
178
|
-
tooltipContent: PropTypes.node.isRequired,
|
|
179
|
-
/** Type of button (uses Bootstrap options) */
|
|
180
|
-
variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),
|
|
181
|
-
/** Changes icon styles for dark background */
|
|
182
|
-
invertColors: PropTypes.bool,
|
|
183
|
-
};
|
|
184
|
-
|
|
185
121
|
(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;
|
|
186
122
|
|
|
187
123
|
export default IconButton as typeof IconButton & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'react-bootstrap/Media';
|
|
@@ -16,7 +16,7 @@ notes: |
|
|
|
16
16
|
A generic component for creating accessible modal popup objects.
|
|
17
17
|
|
|
18
18
|
Note that `ModalPopup` expects DOM node, not ref, in order to be able to update when the node changes.
|
|
19
|
-
A proper way to implement this is to use [callback refs](https://
|
|
19
|
+
A proper way to implement this is to use [callback refs](https://react.dev/reference/react-dom/components/common#ref-callback) with `useState` hook as in the example below.
|
|
20
20
|
|
|
21
21
|
## Basic Usage
|
|
22
22
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'react-bootstrap/ResponsiveEmbed';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, SkeletonTheme } from 'react-loading-skeleton';
|
package/src/Toast/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import BaseToast from 'react-bootstrap/Toast';
|
|
5
4
|
import { useIntl } from 'react-intl';
|
|
6
5
|
|
|
@@ -20,12 +19,31 @@ interface ToastAction {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
interface ToastProps {
|
|
22
|
+
/** A string or an element that is rendered inside the main body of the `Toast`. */
|
|
23
23
|
children: string;
|
|
24
|
+
/**
|
|
25
|
+
* A function that is called on close. It can be used to perform
|
|
26
|
+
* actions upon closing of the `Toast`, such as setting the "show"
|
|
27
|
+
* element to false.
|
|
28
|
+
* */
|
|
24
29
|
onClose: () => void;
|
|
30
|
+
/** Boolean used to control whether the `Toast` shows. */
|
|
25
31
|
show: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Fields used to build optional action button.
|
|
34
|
+
* `label` is a string rendered inside the button.
|
|
35
|
+
* `href` is a link that will render the action button as an anchor tag.
|
|
36
|
+
* `onClick` is a function that is called when the button is clicked.
|
|
37
|
+
* The full type definition can be seen [here](https://github.com/openedx/paragon/blob/release-23.x/src/Toast/index.tsx#L16)
|
|
38
|
+
*/
|
|
26
39
|
action?: ToastAction;
|
|
40
|
+
/**
|
|
41
|
+
* Alt text for the `Toast`'s dismiss button. Defaults to 'Close'.
|
|
42
|
+
*/
|
|
27
43
|
closeLabel?: string;
|
|
44
|
+
/** Time in milliseconds for which the `Toast` will display. */
|
|
28
45
|
delay?: number;
|
|
46
|
+
/** Class names for the `BaseToast` component. */
|
|
29
47
|
className?: string;
|
|
30
48
|
}
|
|
31
49
|
|
|
@@ -36,6 +54,7 @@ function Toast({
|
|
|
36
54
|
closeLabel,
|
|
37
55
|
onClose,
|
|
38
56
|
show,
|
|
57
|
+
delay = TOAST_DELAY,
|
|
39
58
|
...rest
|
|
40
59
|
}: ToastProps) {
|
|
41
60
|
const intl = useIntl();
|
|
@@ -58,6 +77,7 @@ function Toast({
|
|
|
58
77
|
onMouseOut={() => setAutoHide(true)}
|
|
59
78
|
onMouseOver={() => setAutoHide(false)}
|
|
60
79
|
show={show}
|
|
80
|
+
delay={delay}
|
|
61
81
|
{...rest}
|
|
62
82
|
>
|
|
63
83
|
<div className="toast-header">
|
|
@@ -90,43 +110,4 @@ function Toast({
|
|
|
90
110
|
);
|
|
91
111
|
}
|
|
92
112
|
|
|
93
|
-
Toast.defaultProps = {
|
|
94
|
-
action: null,
|
|
95
|
-
closeLabel: undefined,
|
|
96
|
-
delay: TOAST_DELAY,
|
|
97
|
-
className: undefined,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
Toast.propTypes = {
|
|
101
|
-
/** A string or an element that is rendered inside the main body of the `Toast`. */
|
|
102
|
-
children: PropTypes.string.isRequired,
|
|
103
|
-
/**
|
|
104
|
-
* A function that is called on close. It can be used to perform
|
|
105
|
-
* actions upon closing of the `Toast`, such as setting the "show"
|
|
106
|
-
* element to false.
|
|
107
|
-
* */
|
|
108
|
-
onClose: PropTypes.func.isRequired,
|
|
109
|
-
/** Boolean used to control whether the `Toast` shows */
|
|
110
|
-
show: PropTypes.bool.isRequired,
|
|
111
|
-
/**
|
|
112
|
-
* Fields used to build optional action button.
|
|
113
|
-
* `label` is a string rendered inside the button.
|
|
114
|
-
* `href` is a link that will render the action button as an anchor tag.
|
|
115
|
-
* `onClick` is a function that is called when the button is clicked.
|
|
116
|
-
*/
|
|
117
|
-
action: PropTypes.shape({
|
|
118
|
-
label: PropTypes.string.isRequired,
|
|
119
|
-
href: PropTypes.string,
|
|
120
|
-
onClick: PropTypes.func,
|
|
121
|
-
}),
|
|
122
|
-
/**
|
|
123
|
-
* Alt text for the `Toast`'s dismiss button. Defaults to 'Close'.
|
|
124
|
-
*/
|
|
125
|
-
closeLabel: PropTypes.string,
|
|
126
|
-
/** Time in milliseconds for which the `Toast` will display. */
|
|
127
|
-
delay: PropTypes.number,
|
|
128
|
-
/** Class names for the `BaseToast` component */
|
|
129
|
-
className: PropTypes.string,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
113
|
export default Toast;
|