@openedx/paragon 23.14.1 → 23.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -14
- package/dist/ActionRow/index.d.ts +18 -0
- package/dist/ActionRow/index.js +6 -24
- package/dist/ActionRow/index.js.map +1 -1
- package/dist/Alert/index.js +21 -24
- package/dist/Alert/index.js.map +1 -1
- package/dist/Annotation/index.d.ts +13 -0
- package/dist/Annotation/index.js +11 -30
- package/dist/Annotation/index.js.map +1 -1
- package/dist/Avatar/index.d.ts +11 -0
- package/dist/Avatar/index.js +7 -21
- package/dist/Avatar/index.js.map +1 -1
- package/dist/AvatarButton/index.d.ts +17 -0
- package/dist/AvatarButton/index.js +11 -33
- package/dist/AvatarButton/index.js.map +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.js +5 -6
- package/dist/Breadcrumb/BreadcrumbLink.js.map +1 -1
- package/dist/Breadcrumb/index.js +11 -12
- package/dist/Breadcrumb/index.js.map +1 -1
- package/dist/Bubble/index.d.ts +6 -2
- package/dist/Bubble/index.js +14 -39
- package/dist/Bubble/index.js.map +1 -1
- package/dist/Button/index.d.ts +42 -7
- package/dist/Button/index.js +43 -115
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/BaseCard.js +11 -12
- package/dist/Card/BaseCard.js.map +1 -1
- package/dist/Card/CardBody.js +9 -12
- package/dist/Card/CardBody.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarousel.js +13 -14
- package/dist/Card/CardCarousel/CardCarousel.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselHeader.js +4 -5
- package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselItems.js +3 -4
- package/dist/Card/CardCarousel/CardCarouselItems.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselProvider.js +7 -8
- package/dist/Card/CardCarousel/CardCarouselProvider.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselTitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselTitle.js.map +1 -1
- package/dist/Card/CardCarousel/messages.d.ts +13 -0
- package/dist/Card/CardCarousel/messages.js +4 -5
- package/dist/Card/CardCarousel/messages.js.map +1 -0
- package/dist/Card/CardContext.js +6 -7
- package/dist/Card/CardContext.js.map +1 -1
- package/dist/Card/CardDeck.js +9 -10
- package/dist/Card/CardDeck.js.map +1 -1
- package/dist/Card/CardDivider.js +8 -11
- package/dist/Card/CardDivider.js.map +1 -1
- package/dist/Card/CardFooter.js +9 -10
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardGrid.js +6 -7
- package/dist/Card/CardGrid.js.map +1 -1
- package/dist/Card/CardHeader.js +9 -10
- package/dist/Card/CardHeader.js.map +1 -1
- package/dist/Card/CardImageCap.js +15 -16
- package/dist/Card/CardImageCap.js.map +1 -1
- package/dist/Card/CardSection.js +9 -10
- package/dist/Card/CardSection.js.map +1 -1
- package/dist/Card/CardStatus.js +9 -10
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Card/index.js +9 -10
- package/dist/Card/index.js.map +1 -1
- package/dist/Chip/ChipIcon.js +8 -9
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.d.ts +22 -0
- package/dist/Chip/index.js +15 -70
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +49 -53
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/ChipCarousel/messages.d.ts +13 -0
- package/dist/ChipCarousel/messages.js +4 -5
- package/dist/ChipCarousel/messages.js.map +1 -0
- package/dist/CloseButton/index.js.map +1 -1
- package/dist/Collapse/index.js.map +1 -1
- package/dist/Collapsible/CollapsibleBody.js +6 -7
- package/dist/Collapsible/CollapsibleBody.js.map +1 -1
- package/dist/Collapsible/CollapsibleTrigger.js +9 -10
- package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
- package/dist/Collapsible/CollapsibleVisible.js +5 -6
- package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
- package/dist/ColorPicker/index.js +6 -7
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/Container/index.js +9 -12
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/BulkActions.js +4 -5
- package/dist/DataTable/BulkActions.js.map +1 -1
- package/dist/DataTable/CardView.js +16 -18
- package/dist/DataTable/CardView.js.map +1 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +5 -6
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/DataTableLayout.js +5 -6
- package/dist/DataTable/DataTableLayout.js.map +1 -1
- package/dist/DataTable/DropdownFilters.js +7 -2
- package/dist/DataTable/DropdownFilters.js.map +1 -1
- package/dist/DataTable/EmptyTable.js +5 -6
- package/dist/DataTable/EmptyTable.js.map +1 -1
- package/dist/DataTable/ExpandAll.js +4 -5
- package/dist/DataTable/ExpandAll.js.map +1 -1
- package/dist/DataTable/ExpandRow.js +3 -4
- package/dist/DataTable/ExpandRow.js.map +1 -1
- package/dist/DataTable/FilterStatus.js +8 -9
- package/dist/DataTable/FilterStatus.js.map +1 -1
- package/dist/DataTable/RowStatus.js +4 -5
- package/dist/DataTable/RowStatus.js.map +1 -1
- package/dist/DataTable/SidebarFilters.js +3 -4
- package/dist/DataTable/SidebarFilters.js.map +1 -1
- package/dist/DataTable/Table.js +3 -4
- package/dist/DataTable/Table.js.map +1 -1
- package/dist/DataTable/TableActions.js +3 -4
- package/dist/DataTable/TableActions.js.map +1 -1
- package/dist/DataTable/TableCell.js +5 -6
- package/dist/DataTable/TableCell.js.map +1 -1
- package/dist/DataTable/TableControlBar.js +3 -4
- package/dist/DataTable/TableControlBar.js.map +1 -1
- package/dist/DataTable/TableFilters.js +6 -7
- package/dist/DataTable/TableFilters.js.map +1 -1
- package/dist/DataTable/TableFooter.js +4 -5
- package/dist/DataTable/TableFooter.js.map +1 -1
- package/dist/DataTable/TableHeaderCell.js +13 -15
- package/dist/DataTable/TableHeaderCell.js.map +1 -1
- package/dist/DataTable/TableHeaderRow.js +3 -4
- package/dist/DataTable/TableHeaderRow.js.map +1 -1
- package/dist/DataTable/TableRow.js +3 -4
- package/dist/DataTable/TableRow.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js +25 -29
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.js +16 -20
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js +25 -29
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/TextFilter.js +8 -9
- package/dist/DataTable/filters/TextFilter.js.map +1 -1
- package/dist/DataTable/hooks.js +11 -13
- package/dist/DataTable/hooks.js.map +1 -1
- package/dist/DataTable/index.js +42 -36
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/messages.d.ts +13 -0
- package/dist/DataTable/messages.js +7 -3
- package/dist/DataTable/messages.js.map +1 -0
- package/dist/DataTable/selection/BaseSelectionStatus.js +11 -12
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelect.js +3 -4
- package/dist/DataTable/selection/ControlledSelect.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectHeader.js +3 -4
- package/dist/DataTable/selection/ControlledSelectHeader.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectionStatus.js +4 -5
- package/dist/DataTable/selection/ControlledSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/SelectionStatus.js +4 -5
- package/dist/DataTable/selection/SelectionStatus.js.map +1 -1
- package/dist/DataTable/utils/getVisibleColumns.js +9 -13
- package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
- package/dist/Dropdown/index.js +17 -20
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/DefaultContent.js +5 -6
- package/dist/Dropzone/DefaultContent.js.map +1 -1
- package/dist/Dropzone/DragError.js +3 -4
- package/dist/Dropzone/DragError.js.map +1 -1
- package/dist/Dropzone/GenericError.js +4 -5
- package/dist/Dropzone/GenericError.js.map +1 -1
- package/dist/Dropzone/UploadProgress.js +6 -7
- package/dist/Dropzone/UploadProgress.js.map +1 -1
- package/dist/Dropzone/index.js +14 -15
- package/dist/Dropzone/index.js.map +1 -1
- package/dist/Dropzone/messages.d.ts +53 -0
- package/dist/Dropzone/messages.js +12 -13
- package/dist/Dropzone/messages.js.map +1 -0
- package/dist/Fade/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +18 -20
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormAutosuggestOption.js +6 -7
- package/dist/Form/FormAutosuggestOption.js.map +1 -1
- package/dist/Form/FormCheckbox.js +16 -18
- package/dist/Form/FormCheckbox.js.map +1 -1
- package/dist/Form/FormCheckboxSet.js +11 -12
- package/dist/Form/FormCheckboxSet.js.map +1 -1
- package/dist/Form/FormCheckboxSetContext.js +9 -10
- package/dist/Form/FormCheckboxSetContext.js.map +1 -1
- package/dist/Form/FormControl.js +12 -13
- package/dist/Form/FormControl.js.map +1 -1
- package/dist/Form/FormControlDecorator.js +4 -5
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormControlDecoratorGroup.js +8 -9
- package/dist/Form/FormControlDecoratorGroup.js.map +1 -1
- package/dist/Form/FormControlFeedback.js +4 -5
- package/dist/Form/FormControlFeedback.js.map +1 -1
- package/dist/Form/FormControlFloatingLabel.js +3 -4
- package/dist/Form/FormControlFloatingLabel.js.map +1 -1
- package/dist/Form/FormControlSet.js +7 -8
- package/dist/Form/FormControlSet.js.map +1 -1
- package/dist/Form/FormGroup.js +9 -10
- package/dist/Form/FormGroup.js.map +1 -1
- package/dist/Form/FormGroupContext.js +7 -8
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormLabel.d.ts +2 -11
- package/dist/Form/FormLabel.js +5 -15
- package/dist/Form/FormLabel.js.map +1 -1
- package/dist/Form/FormRadio.js +28 -31
- package/dist/Form/FormRadio.js.map +1 -1
- package/dist/Form/FormRadioSet.js +11 -12
- package/dist/Form/FormRadioSet.js.map +1 -1
- package/dist/Form/FormRadioSetContext.js +9 -10
- package/dist/Form/FormRadioSetContext.js.map +1 -1
- package/dist/Form/FormSwitch.js +25 -29
- package/dist/Form/FormSwitch.js.map +1 -1
- package/dist/Form/FormText.js +16 -19
- package/dist/Form/FormText.js.map +1 -1
- package/dist/Form/fieldUtils.js +11 -22
- package/dist/Form/fieldUtils.js.map +1 -1
- package/dist/Form/useCheckboxSetValues.js +1 -2
- package/dist/Form/useCheckboxSetValues.js.map +1 -1
- package/dist/Hyperlink/index.js +17 -21
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.js +10 -11
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +8 -304
- package/dist/IconButton/index.js +21 -84
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButtonToggle/index.js +5 -6
- package/dist/IconButtonToggle/index.js.map +1 -1
- package/dist/Image/index.js.map +1 -1
- package/dist/Layout/index.js +4 -5
- package/dist/Layout/index.js.map +1 -1
- package/dist/Media/index.js.map +1 -1
- package/dist/Menu/MenuItem.js +8 -9
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Menu/SelectMenu.js +8 -9
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Menu/index.js +6 -7
- package/dist/Menu/index.js.map +1 -1
- package/dist/Modal/AlertModal.js +6 -7
- package/dist/Modal/AlertModal.js.map +1 -1
- package/dist/Modal/FullscreenModal.js +7 -8
- package/dist/Modal/FullscreenModal.js.map +1 -1
- package/dist/Modal/MarketingModal.js +9 -10
- package/dist/Modal/MarketingModal.js.map +1 -1
- package/dist/Modal/ModalCloseButton.js +5 -6
- package/dist/Modal/ModalCloseButton.js.map +1 -1
- package/dist/Modal/ModalContext.js +6 -7
- package/dist/Modal/ModalContext.js.map +1 -1
- package/dist/Modal/ModalDialog.d.ts +6 -65
- package/dist/Modal/ModalDialog.js +16 -81
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogBody.js +5 -6
- package/dist/Modal/ModalDialogBody.js.map +1 -1
- package/dist/Modal/ModalDialogFooter.js +5 -6
- package/dist/Modal/ModalDialogFooter.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.js +9 -12
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalDialogHero.js +5 -6
- package/dist/Modal/ModalDialogHero.js.map +1 -1
- package/dist/Modal/ModalDialogHeroBackground.js +6 -7
- package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
- package/dist/Modal/ModalDialogHeroContent.js +5 -6
- package/dist/Modal/ModalDialogHeroContent.js.map +1 -1
- package/dist/Modal/ModalDialogTitle.js +5 -6
- package/dist/Modal/ModalDialogTitle.js.map +1 -1
- package/dist/Modal/ModalLayer.d.ts +0 -25
- package/dist/Modal/ModalLayer.js +13 -35
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/ModalPopup.js +11 -12
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/PopperElement.js +7 -8
- package/dist/Modal/PopperElement.js.map +1 -1
- package/dist/Modal/StandardModal.js +7 -8
- package/dist/Modal/StandardModal.js.map +1 -1
- package/dist/OverflowScroll/OverflowScroll.js +12 -13
- package/dist/OverflowScroll/OverflowScroll.js.map +1 -1
- package/dist/OverflowScroll/OverflowScrollItems.js +3 -4
- package/dist/OverflowScroll/OverflowScrollItems.js.map +1 -1
- package/dist/Overlay/index.d.ts +2 -2
- package/dist/PageBanner/index.js +9 -10
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/Pagination/PaginationContext.js +12 -13
- package/dist/Pagination/PaginationContext.js.map +1 -1
- package/dist/Pagination/subcomponents/PageButton.js +3 -4
- package/dist/Pagination/subcomponents/PageButton.js.map +1 -1
- package/dist/Popover/index.js +11 -14
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.js +12 -13
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/CheckpointActionRow.js +10 -11
- package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
- package/dist/ProductTour/CheckpointBody.js +3 -4
- package/dist/ProductTour/CheckpointBody.js.map +1 -1
- package/dist/ProductTour/CheckpointHeader.js +7 -8
- package/dist/ProductTour/CheckpointHeader.js.map +1 -1
- package/dist/ProductTour/CheckpointTitle.js +6 -9
- package/dist/ProductTour/CheckpointTitle.js.map +1 -1
- package/dist/ProductTour/index.js +3 -4
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProductTour/messages.d.ts +23 -0
- package/dist/ProductTour/messages.js +6 -7
- package/dist/ProductTour/messages.js.map +1 -0
- package/dist/ProgressBar/index.js +11 -12
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ResponsiveEmbed/index.js.map +1 -1
- package/dist/Scrollable/index.js +4 -5
- package/dist/Scrollable/index.js.map +1 -1
- package/dist/SearchField/SearchFieldLabel.js +4 -5
- package/dist/SearchField/SearchFieldLabel.js.map +1 -1
- package/dist/SelectableBox/SelectableBoxSet.js +13 -14
- package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
- package/dist/SelectableBox/index.js +14 -15
- package/dist/SelectableBox/index.js.map +1 -1
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Spinner/index.d.ts +11 -0
- package/dist/Spinner/index.js +6 -17
- package/dist/Spinner/index.js.map +1 -1
- package/dist/Stack/index.js +12 -15
- package/dist/Stack/index.js.map +1 -1
- package/dist/StatefulButton/index.js +9 -10
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/Stepper/Stepper.js +4 -5
- package/dist/Stepper/Stepper.js.map +1 -1
- package/dist/Stepper/StepperActionRow.js +6 -7
- package/dist/Stepper/StepperActionRow.js.map +1 -1
- package/dist/Stepper/StepperContext.js +4 -5
- package/dist/Stepper/StepperContext.js.map +1 -1
- package/dist/Stepper/StepperHeader.js +23 -31
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.js +8 -9
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Stepper/StepperStep.js +10 -11
- package/dist/Stepper/StepperStep.js.map +1 -1
- package/dist/Sticky/index.js +8 -12
- package/dist/Sticky/index.js.map +1 -1
- package/dist/Tabs/index.js +8 -9
- package/dist/Tabs/index.js.map +1 -1
- package/dist/Toast/ToastContainer.js +3 -4
- package/dist/Toast/ToastContainer.js.map +1 -1
- package/dist/Toast/index.d.ts +20 -41
- package/dist/Toast/index.js +11 -48
- package/dist/Toast/index.js.map +1 -1
- package/dist/ToggleButton/index.js.map +1 -1
- package/dist/Tooltip/index.js +11 -14
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/Truncate/index.js +9 -10
- package/dist/Truncate/index.js.map +1 -1
- package/dist/asInput/index.js +9 -13
- package/dist/asInput/index.js.map +1 -1
- package/dist/hooks/useArrowKeyNavigationHook.js +17 -21
- package/dist/hooks/useArrowKeyNavigationHook.js.map +1 -1
- package/dist/hooks/useIsVisibleHook.js +4 -6
- package/dist/hooks/useIsVisibleHook.js.map +1 -1
- package/dist/hooks/useToggleHook.js +1 -3
- package/dist/hooks/useToggleHook.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/theme-urls.json +6 -6
- package/dist/utils/newId.js +1 -2
- package/dist/utils/newId.js.map +1 -1
- package/package.json +2 -2
- package/src/ActionRow/{index.jsx → index.tsx} +14 -22
- package/src/Annotation/{index.jsx → index.tsx} +15 -22
- package/src/Avatar/{index.jsx → index.tsx} +13 -19
- package/src/AvatarButton/{index.jsx → index.tsx} +23 -31
- package/src/Bubble/index.tsx +12 -32
- package/src/Button/index.tsx +68 -93
- package/src/Chip/index.tsx +26 -59
- package/src/CloseButton/index.tsx +1 -0
- package/src/Collapse/index.tsx +1 -0
- package/src/DataTable/DropdownFilters.jsx +9 -2
- package/src/DataTable/README.md +19 -18
- package/src/DataTable/index.jsx +6 -1
- package/src/DataTable/{messages.js → messages.ts} +5 -0
- package/src/DataTable/tests/DataTable.test.jsx +51 -1
- package/src/DataTable/tests/DropdownFilters.test.jsx +11 -7
- package/src/Fade/index.tsx +1 -0
- package/src/Form/FormLabel.tsx +2 -10
- package/src/IconButton/index.tsx +17 -81
- package/src/Image/index.tsx +2 -0
- package/src/Media/index.tsx +1 -0
- package/src/Modal/ModalDialog.tsx +6 -66
- package/src/Modal/ModalLayer.tsx +0 -22
- package/src/Modal/modal-popup.mdx +1 -1
- package/src/ProductTour/ProductTour.test.jsx +0 -1
- package/src/ResponsiveEmbed/index.tsx +1 -0
- package/src/Skeleton/index.tsx +1 -0
- package/src/Spinner/{index.jsx → index.tsx} +10 -15
- package/src/Toast/index.tsx +21 -40
- package/src/ToggleButton/index.tsx +2 -0
- package/src/index.ts +5 -10
- /package/{src/CloseButton/index.jsx → dist/CloseButton/index.d.ts} +0 -0
- /package/{src/Collapse/index.jsx → dist/Collapse/index.d.ts} +0 -0
- /package/{src/Fade/index.jsx → dist/Fade/index.d.ts} +0 -0
- /package/{src/Image/index.jsx → dist/Image/index.d.ts} +0 -0
- /package/{src/Media/index.jsx → dist/Media/index.d.ts} +0 -0
- /package/{src/ResponsiveEmbed/index.jsx → dist/ResponsiveEmbed/index.d.ts} +0 -0
- /package/{src/Skeleton/index.jsx → dist/Skeleton/index.d.ts} +0 -0
- /package/{src/ToggleButton/index.jsx → dist/ToggleButton/index.d.ts} +0 -0
- /package/src/Card/CardCarousel/{messages.js → messages.ts} +0 -0
- /package/src/ChipCarousel/{messages.js → messages.ts} +0 -0
- /package/src/Dropzone/{messages.js → messages.ts} +0 -0
- /package/src/ProductTour/{messages.js → messages.ts} +0 -0
- /package/src/Spinner/{Spinner.test.jsx → Spinner.test.tsx} +0 -0
- /package/src/Spinner/__snapshots__/{Spinner.test.jsx.snap → Spinner.test.tsx.snap} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { ForwardedRef } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Button from '../Button';
|
|
5
|
-
import Avatar from '../Avatar';
|
|
4
|
+
import Avatar, { AvatarProps } from '../Avatar';
|
|
6
5
|
|
|
7
6
|
const buttonSizesToAvatarSize = {
|
|
8
7
|
sm: 'xs',
|
|
@@ -10,14 +9,30 @@ const buttonSizesToAvatarSize = {
|
|
|
10
9
|
lg: 'md',
|
|
11
10
|
};
|
|
12
11
|
|
|
12
|
+
interface AvatarButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
/** The button text */
|
|
14
|
+
children?: string;
|
|
15
|
+
/** A class name to append to the button */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Show the label or only the avatar */
|
|
18
|
+
showLabel?: boolean;
|
|
19
|
+
/** The button size */
|
|
20
|
+
size?: 'sm' | 'md' | 'lg';
|
|
21
|
+
/** Image src of the avatar image */
|
|
22
|
+
src?: string;
|
|
23
|
+
/** The button style variant to use */
|
|
24
|
+
variant?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
const AvatarButton = React.forwardRef(({
|
|
14
28
|
children,
|
|
15
29
|
className,
|
|
16
|
-
showLabel,
|
|
17
|
-
size,
|
|
30
|
+
showLabel = true,
|
|
31
|
+
size = 'md',
|
|
18
32
|
src,
|
|
33
|
+
variant = 'tertiary',
|
|
19
34
|
...attrs
|
|
20
|
-
}, ref) => {
|
|
35
|
+
}: AvatarButtonProps, ref: ForwardedRef<HTMLButtonElement>) => {
|
|
21
36
|
const avatarSize = buttonSizesToAvatarSize[size] || 'sm';
|
|
22
37
|
return (
|
|
23
38
|
<Button
|
|
@@ -31,35 +46,12 @@ const AvatarButton = React.forwardRef(({
|
|
|
31
46
|
)}
|
|
32
47
|
size={size}
|
|
33
48
|
ref={ref}
|
|
49
|
+
variant={variant}
|
|
34
50
|
>
|
|
35
|
-
<Avatar src={src} alt={showLabel ? '' : children} size={avatarSize} />
|
|
51
|
+
<Avatar src={src} alt={showLabel ? '' : children} size={avatarSize as AvatarProps['size']} />
|
|
36
52
|
{showLabel && children}
|
|
37
53
|
</Button>
|
|
38
54
|
);
|
|
39
55
|
});
|
|
40
56
|
|
|
41
|
-
AvatarButton.propTypes = {
|
|
42
|
-
/** The button text */
|
|
43
|
-
children: PropTypes.string,
|
|
44
|
-
/** A class name to append to the button */
|
|
45
|
-
className: PropTypes.string,
|
|
46
|
-
/** Show the label or only the avatar */
|
|
47
|
-
showLabel: PropTypes.bool,
|
|
48
|
-
/** The button size */
|
|
49
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
50
|
-
/** Image src of the avatar image */
|
|
51
|
-
src: PropTypes.string,
|
|
52
|
-
/** The button style variant to use */
|
|
53
|
-
variant: PropTypes.string,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
AvatarButton.defaultProps = {
|
|
57
|
-
children: undefined,
|
|
58
|
-
className: undefined,
|
|
59
|
-
showLabel: true,
|
|
60
|
-
size: 'md',
|
|
61
|
-
src: undefined,
|
|
62
|
-
variant: 'tertiary',
|
|
63
|
-
};
|
|
64
|
-
|
|
65
57
|
export default AvatarButton;
|
package/src/Bubble/index.tsx
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type BubbleVariant = typeof STYLE_VARIANTS[number];
|
|
4
|
+
export type BubbleVariant = 'primary' | 'success' | 'error' | 'warning';
|
|
8
5
|
|
|
9
6
|
export interface BubbleProps {
|
|
7
|
+
/** Specifies contents of the component. */
|
|
10
8
|
children: React.ReactNode;
|
|
9
|
+
/** The `Bubble` style variant to use. */
|
|
11
10
|
variant?: BubbleVariant;
|
|
11
|
+
/** Activates disabled variant. */
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
/** Optional class name(s) to append to the base element. */
|
|
13
14
|
className?: string;
|
|
15
|
+
/** Specifies whether to add padding to the `Bubble` or not. */
|
|
14
16
|
expandable?: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
const Bubble = React.forwardRef
|
|
18
|
-
variant,
|
|
19
|
+
const Bubble = React.forwardRef(({
|
|
20
|
+
variant = 'primary',
|
|
19
21
|
className,
|
|
20
|
-
children,
|
|
21
|
-
disabled,
|
|
22
|
-
expandable,
|
|
22
|
+
children = null,
|
|
23
|
+
disabled = false,
|
|
24
|
+
expandable = false,
|
|
23
25
|
...props
|
|
24
|
-
}, ref) => (
|
|
26
|
+
}: BubbleProps, ref: React.ForwardedRef<HTMLDivElement>) => (
|
|
25
27
|
<div
|
|
26
28
|
ref={ref}
|
|
27
29
|
className={classNames(
|
|
@@ -36,26 +38,4 @@ const Bubble = React.forwardRef<HTMLDivElement, BubbleProps>(({
|
|
|
36
38
|
</div>
|
|
37
39
|
));
|
|
38
40
|
|
|
39
|
-
Bubble.propTypes = {
|
|
40
|
-
/** Specifies contents of the component. */
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
children: PropTypes.node,
|
|
43
|
-
/** The `Bubble` style variant to use. */
|
|
44
|
-
variant: PropTypes.oneOf(STYLE_VARIANTS),
|
|
45
|
-
/** Activates disabled variant. */
|
|
46
|
-
disabled: PropTypes.bool,
|
|
47
|
-
/** A class name to append to the base element. */
|
|
48
|
-
className: PropTypes.string,
|
|
49
|
-
/** Specifies whether to add padding to the `Bubble` or not. */
|
|
50
|
-
expandable: PropTypes.bool,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
Bubble.defaultProps = {
|
|
54
|
-
children: null,
|
|
55
|
-
variant: 'primary',
|
|
56
|
-
disabled: false,
|
|
57
|
-
className: undefined,
|
|
58
|
-
expandable: false,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
41
|
export default Bubble;
|
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';
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
2
3
|
import DataTableContext from './DataTableContext';
|
|
3
4
|
import { DropdownButton } from '../Dropdown';
|
|
4
5
|
import useWindowSize from '../hooks/useWindowSizeHook';
|
|
5
6
|
import breakpoints from '../utils/breakpoints';
|
|
7
|
+
import messages from './messages';
|
|
6
8
|
|
|
7
9
|
/** The first filter will be as an input, additional filters will be available in a dropdown. */
|
|
8
10
|
function DropdownFilters() {
|
|
11
|
+
const intl = useIntl();
|
|
9
12
|
const { width } = useWindowSize();
|
|
10
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
columns, numBreakoutFilters, filtersTitle,
|
|
15
|
+
} = useContext(DataTableContext);
|
|
11
16
|
|
|
12
17
|
const [breakoutFilters, otherFilters] = useMemo(() => {
|
|
13
18
|
if (!columns) {
|
|
@@ -25,6 +30,8 @@ function DropdownFilters() {
|
|
|
25
30
|
return [boFilters, dropdownFilters];
|
|
26
31
|
}, [columns, width, numBreakoutFilters]);
|
|
27
32
|
|
|
33
|
+
const dropdownTitle = filtersTitle || intl.formatMessage(messages.filtersDropdownTitle);
|
|
34
|
+
|
|
28
35
|
return (
|
|
29
36
|
<div className="pgn__data-table-filters">
|
|
30
37
|
{breakoutFilters.length > 0 && breakoutFilters.map((column) => (
|
|
@@ -33,7 +40,7 @@ function DropdownFilters() {
|
|
|
33
40
|
</div>
|
|
34
41
|
))}
|
|
35
42
|
{otherFilters.length > 0 && (
|
|
36
|
-
<DropdownButton variant="outline-primary" id="table-filters-dropdown" title=
|
|
43
|
+
<DropdownButton variant="outline-primary" id="table-filters-dropdown" title={dropdownTitle}>
|
|
37
44
|
{otherFilters.map((column) => (
|
|
38
45
|
<div
|
|
39
46
|
key={column.Header}
|
package/src/DataTable/README.md
CHANGED
|
@@ -176,7 +176,7 @@ To enable proper selection behavior with backend pagination (i.e., when ``isSele
|
|
|
176
176
|
producer: 'Isao Takahata',
|
|
177
177
|
release_date: 1986,
|
|
178
178
|
rt_score: 95,
|
|
179
|
-
},
|
|
179
|
+
},
|
|
180
180
|
{
|
|
181
181
|
id: '12cfb892-aac0-4c5b-94af-521852e46d6a',
|
|
182
182
|
title: 'Grave of the Fireflies',
|
|
@@ -567,7 +567,7 @@ Can be used to show the loading state when ``DataTable`` is asynchronously fetch
|
|
|
567
567
|
},
|
|
568
568
|
];
|
|
569
569
|
{/* end example state */}
|
|
570
|
-
|
|
570
|
+
|
|
571
571
|
return (
|
|
572
572
|
<>
|
|
573
573
|
{/* start example form block */}
|
|
@@ -634,7 +634,7 @@ You can pass a function to render custom components for bulk actions and table a
|
|
|
634
634
|
Enroll
|
|
635
635
|
</Button>
|
|
636
636
|
);
|
|
637
|
-
|
|
637
|
+
|
|
638
638
|
const EnrollAction = ({ selectedFlatRows, ...rest }) => (
|
|
639
639
|
// Here is access to the selectedFlatRows, isEntireTableSelected, tableInstance
|
|
640
640
|
<Button variant="danger" onClick={() => console.log('Enroll', selectedFlatRows, rest)}>
|
|
@@ -647,13 +647,13 @@ You can pass a function to render custom components for bulk actions and table a
|
|
|
647
647
|
Assign
|
|
648
648
|
</Button>
|
|
649
649
|
);
|
|
650
|
-
|
|
650
|
+
|
|
651
651
|
const ExtraAction = ({ text, selectedFlatRows, ...rest }) => (
|
|
652
652
|
<Button onClick={() => console.log(`Extra Action ${text}`, selectedFlatRows, rest)}>
|
|
653
653
|
{`Extra Action ${text}`}
|
|
654
654
|
</Button>
|
|
655
655
|
);
|
|
656
|
-
|
|
656
|
+
|
|
657
657
|
return (
|
|
658
658
|
<DataTable
|
|
659
659
|
isSelectable
|
|
@@ -734,7 +734,7 @@ You can pass a function to render custom components for bulk actions and table a
|
|
|
734
734
|
</DataTable>
|
|
735
735
|
)
|
|
736
736
|
}
|
|
737
|
-
|
|
737
|
+
|
|
738
738
|
```
|
|
739
739
|
|
|
740
740
|
#### Actions with Data view toggle enabled
|
|
@@ -889,7 +889,7 @@ a responsive grid of cards.
|
|
|
889
889
|
Clear Selection
|
|
890
890
|
</Component>
|
|
891
891
|
);
|
|
892
|
-
|
|
892
|
+
|
|
893
893
|
return (
|
|
894
894
|
<DataTable
|
|
895
895
|
isFilterable
|
|
@@ -1103,7 +1103,7 @@ Use `columnSizes` prop of `CardView` component to define how many `Cards` are sh
|
|
|
1103
1103
|
|
|
1104
1104
|
const ExampleCard = ({ className, original }) => {
|
|
1105
1105
|
const { name, color, famous_for: famousFor } = original;
|
|
1106
|
-
|
|
1106
|
+
|
|
1107
1107
|
return (
|
|
1108
1108
|
<Card className={className}>
|
|
1109
1109
|
<Card.ImageCap src="https://picsum.photos/360/200/" srcAlt="Card image" />
|
|
@@ -1195,7 +1195,7 @@ You can also display `Cards` with horizontal view. If the table is selectable co
|
|
|
1195
1195
|
<Card.Header title={name} />
|
|
1196
1196
|
<Card.Section>
|
|
1197
1197
|
<dl>
|
|
1198
|
-
<dt>Color</dt>
|
|
1198
|
+
<dt>Color</dt>
|
|
1199
1199
|
<dd>{color}</dd>
|
|
1200
1200
|
<dt>Famous For</dt>
|
|
1201
1201
|
<dd>{famousFor}</dd>
|
|
@@ -1217,7 +1217,7 @@ You can also display `Cards` with horizontal view. If the table is selectable co
|
|
|
1217
1217
|
name: 'Lil Bub',
|
|
1218
1218
|
color: 'brown tabby',
|
|
1219
1219
|
famous_for: 'weird tongue',
|
|
1220
|
-
},
|
|
1220
|
+
},
|
|
1221
1221
|
{
|
|
1222
1222
|
name: 'Grumpy Cat',
|
|
1223
1223
|
color: 'siamese',
|
|
@@ -1258,6 +1258,7 @@ For a more desktop friendly view, you can move filters into a sidebar by providi
|
|
|
1258
1258
|
```jsx live
|
|
1259
1259
|
<DataTable
|
|
1260
1260
|
showFiltersInSidebar
|
|
1261
|
+
filtersTitle="Color filters"
|
|
1261
1262
|
isFilterable
|
|
1262
1263
|
isSortable
|
|
1263
1264
|
defaultColumnValues={{ Filter: TextFilter }}
|
|
@@ -1330,17 +1331,17 @@ For a more desktop friendly view, you can move filters into a sidebar by providi
|
|
|
1330
1331
|
```
|
|
1331
1332
|
|
|
1332
1333
|
## Expandable rows
|
|
1333
|
-
`DataTable` supports expandable rows which once expanded render additional content under the row. Displayed content
|
|
1334
|
+
`DataTable` supports expandable rows which once expanded render additional content under the row. Displayed content
|
|
1334
1335
|
is controlled by the `renderRowSubComponent` prop, which is a function that receives `row` as its single prop and renders expanded view, you also
|
|
1335
1336
|
need to pass `isEpandable` prop to `DataTable` to indicate that it should support expand behavior for rows.
|
|
1336
|
-
Finally, an additional column is required to be included into `columns` prop which will contain handlers for expand / collapse behavior, see examples below.
|
|
1337
|
+
Finally, an additional column is required to be included into `columns` prop which will contain handlers for expand / collapse behavior, see examples below.
|
|
1337
1338
|
|
|
1338
1339
|
### Default view
|
|
1339
1340
|
|
|
1340
1341
|
Here we use default expander column offered by Paragon and for each row render value of the `name` attribute as its subcomponent.
|
|
1341
1342
|
|
|
1342
1343
|
```jsx live
|
|
1343
|
-
<DataTable
|
|
1344
|
+
<DataTable
|
|
1344
1345
|
isExpandable
|
|
1345
1346
|
itemCount={7}
|
|
1346
1347
|
renderRowSubComponent={({ row }) => <div className='text-center'>{row.values.name}</div>}
|
|
@@ -1457,10 +1458,10 @@ You can create your own custom expander column and use it, see code example belo
|
|
|
1457
1458
|
</DataTable>
|
|
1458
1459
|
</div>
|
|
1459
1460
|
)
|
|
1460
|
-
|
|
1461
|
+
|
|
1461
1462
|
return (
|
|
1462
1463
|
<DataTable
|
|
1463
|
-
isExpandable
|
|
1464
|
+
isExpandable
|
|
1464
1465
|
renderRowSubComponent={renderSubComponent}
|
|
1465
1466
|
itemCount={3}
|
|
1466
1467
|
data={[
|
|
@@ -1481,7 +1482,7 @@ You can create your own custom expander column and use it, see code example belo
|
|
|
1481
1482
|
reason: 'Felt like it',
|
|
1482
1483
|
},
|
|
1483
1484
|
{
|
|
1484
|
-
name: 'Smoothie',
|
|
1485
|
+
name: 'Smoothie',
|
|
1485
1486
|
color: 'orange tabby',
|
|
1486
1487
|
famous_for: 'modeling',
|
|
1487
1488
|
date_modified: currentDate,
|
|
@@ -1527,7 +1528,7 @@ You can create your own cell content by passing the `Cell` property to a specifi
|
|
|
1527
1528
|
newColors[index] = cellColors[index] < 3 ? cellColors[index] + 1 : 0;
|
|
1528
1529
|
setCellColors(newColors);
|
|
1529
1530
|
};
|
|
1530
|
-
|
|
1531
|
+
|
|
1531
1532
|
return (
|
|
1532
1533
|
<DataTable
|
|
1533
1534
|
isExpandable
|
|
@@ -1544,7 +1545,7 @@ You can create your own cell content by passing the `Cell` property to a specifi
|
|
|
1544
1545
|
famous_for: 'serving moods',
|
|
1545
1546
|
},
|
|
1546
1547
|
{
|
|
1547
|
-
name: 'Smoothie',
|
|
1548
|
+
name: 'Smoothie',
|
|
1548
1549
|
color: 'orange tabby',
|
|
1549
1550
|
famous_for: 'modeling',
|
|
1550
1551
|
},
|