@openedx/paragon 22.4.0 → 23.0.0-alpha.1
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 +36 -5
- package/bin/paragon-scripts.js +128 -9
- package/dist/ActionRow/_index.scss +2 -4
- package/dist/Alert/index.scss +41 -32
- package/dist/Annotation/_mixins.scss +104 -0
- package/dist/Annotation/index.scss +130 -103
- package/dist/Avatar/index.scss +18 -20
- package/dist/AvatarButton/index.scss +3 -5
- package/dist/Badge/index.scss +112 -2
- package/dist/Breadcrumb/index.scss +14 -16
- package/dist/Bubble/index.scss +25 -12
- package/dist/Button/_mixins.scss +14 -0
- package/dist/Button/button-group.scss +126 -0
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/index.scss +855 -370
- package/dist/Card/card-bootstrap.scss +168 -0
- package/dist/Card/index.scss +78 -79
- package/dist/Carousel/index.scss +168 -2
- package/dist/Chip/index.scss +46 -37
- package/dist/Chip/mixins.scss +8 -3
- package/dist/ChipCarousel/index.scss +4 -4
- package/dist/CloseButton/index.scss +31 -2
- package/dist/Code/index.scss +47 -2
- package/dist/Collapsible/index.scss +15 -15
- package/dist/ColorPicker/index.scss +9 -11
- package/dist/DataTable/CollapsibleButtonGroup.js +2 -2
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/index.scss +48 -50
- package/dist/Dropdown/dropdown-bootstrap.scss +181 -0
- package/dist/Dropdown/index.js +0 -2
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropdown/index.scss +11 -12
- package/dist/Dropzone/index.scss +12 -14
- package/dist/Form/_FormText.scss +8 -8
- package/dist/Form/_bootstrap-custom-forms.scss +551 -0
- package/dist/Form/_bootstrap-forms.scss +381 -0
- package/dist/Form/_index.scss +168 -146
- package/dist/Form/_input-group.scss +188 -0
- package/dist/Form/_mixins.scss +216 -3
- package/dist/Hyperlink/index.scss +1 -1
- package/dist/Icon/index.scss +10 -12
- package/dist/IconButton/_mixins.scss +4 -0
- package/dist/IconButton/index.js +5 -11
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButton/index.scss +387 -74
- package/dist/IconButtonToggle/index.scss +1 -1
- package/dist/Image/index.scss +53 -2
- package/dist/Menu/index.scss +25 -27
- package/dist/Modal/_ModalDialog.scss +52 -50
- package/dist/Modal/index.scss +6 -73
- package/dist/Nav/_mixins.scss +4 -4
- package/dist/Nav/index.scss +70 -66
- package/dist/Navbar/index.scss +276 -2
- package/dist/OverflowScroll/data/useOverflowScrollElementAttributes.js +3 -3
- package/dist/Overlay/index.js +2 -3
- package/dist/Overlay/index.js.map +1 -1
- package/dist/PageBanner/index.scss +17 -21
- package/dist/Pagination/index.scss +32 -34
- package/dist/Pagination/pagination-bootstrap.scss +83 -0
- package/dist/Popover/index.scss +9 -10
- package/dist/Popover/popover-bootstrap.scss +198 -0
- package/dist/ProductTour/Checkpoint.scss +71 -43
- package/dist/ProgressBar/_mixins.scss +22 -0
- package/dist/ProgressBar/bootstrap-progress.scss +49 -0
- package/dist/ProgressBar/index.scss +28 -36
- package/dist/Scrollable/index.scss +2 -2
- package/dist/SearchField/SearchFieldInput.js +2 -2
- package/dist/SearchField/SearchFieldInput.js.map +1 -1
- package/dist/SearchField/index.scss +15 -17
- package/dist/SelectableBox/index.scss +11 -13
- package/dist/Sheet/index.scss +10 -10
- package/dist/Spinner/index.scss +57 -2
- package/dist/Stack/index.scss +1 -3
- package/dist/Stepper/index.scss +19 -20
- package/dist/Sticky/index.scss +4 -6
- package/dist/Tabs/index.js +0 -2
- package/dist/Tabs/index.js.map +1 -1
- package/dist/Tabs/index.scss +26 -25
- package/dist/Toast/ToastContainer.scss +9 -11
- package/dist/Toast/bootstrap-toast.scss +46 -0
- package/dist/Toast/index.scss +9 -10
- package/dist/Tooltip/index.scss +136 -10
- package/dist/ValidationMessage/index.scss +1 -1
- package/dist/core.css +16788 -0
- package/dist/core.css.map +1 -0
- package/dist/core.min.css +2 -0
- package/dist/index.js +0 -14
- package/dist/index.scss +0 -4
- package/dist/light.css +4098 -0
- package/dist/light.css.map +1 -0
- package/dist/light.min.css +2 -0
- package/dist/theme-urls.json +21 -0
- package/dist/utils/breakpoints.js +1 -1
- package/lib/build-scss.js +188 -0
- package/lib/build-tokens.js +119 -0
- package/lib/help.js +36 -23
- package/lib/replace-variables.js +38 -0
- package/lib/utils.js +30 -0
- package/package.json +25 -10
- package/src/ActionRow/_index.scss +2 -4
- package/src/Alert/index.scss +41 -32
- package/src/Annotation/_mixins.scss +104 -0
- package/src/Annotation/index.scss +130 -103
- package/src/Avatar/index.scss +18 -20
- package/src/AvatarButton/index.scss +3 -5
- package/src/Badge/index.scss +112 -2
- package/src/Breadcrumb/index.scss +14 -16
- package/src/Bubble/index.scss +25 -12
- package/src/Button/README.md +0 -84
- package/src/Button/_mixins.scss +14 -0
- package/src/Button/button-group.scss +126 -0
- package/src/Button/index.jsx +0 -3
- package/src/Button/index.scss +855 -370
- package/src/Card/card-bootstrap.scss +168 -0
- package/src/Card/index.scss +78 -79
- package/src/Carousel/index.scss +168 -2
- package/src/Chip/index.scss +46 -37
- package/src/Chip/mixins.scss +8 -3
- package/src/ChipCarousel/index.scss +4 -4
- package/src/CloseButton/index.scss +31 -2
- package/src/Code/index.scss +47 -2
- package/src/Collapsible/index.scss +15 -15
- package/src/ColorPicker/index.scss +9 -11
- package/src/DataTable/CollapsibleButtonGroup.jsx +2 -2
- package/src/DataTable/index.scss +48 -50
- package/src/Dropdown/README.md +0 -93
- package/src/Dropdown/dropdown-bootstrap.scss +181 -0
- package/src/Dropdown/index.jsx +0 -2
- package/src/Dropdown/index.scss +11 -12
- package/src/Dropzone/index.scss +12 -14
- package/src/Form/_FormText.scss +8 -8
- package/src/Form/_bootstrap-custom-forms.scss +551 -0
- package/src/Form/_bootstrap-forms.scss +381 -0
- package/src/Form/_index.scss +168 -146
- package/src/Form/_input-group.scss +188 -0
- package/src/Form/_mixins.scss +216 -3
- package/src/Hyperlink/index.scss +1 -1
- package/src/Icon/index.scss +10 -12
- package/src/IconButton/README.md +1 -15
- package/src/IconButton/__snapshots__/IconButton.test.jsx.snap +5 -28
- package/src/IconButton/_mixins.scss +4 -0
- package/src/IconButton/index.jsx +6 -13
- package/src/IconButton/index.scss +387 -74
- package/src/IconButtonToggle/index.scss +1 -1
- package/src/Image/index.scss +53 -2
- package/src/Menu/index.scss +25 -27
- package/src/Modal/_ModalDialog.scss +52 -50
- package/src/Modal/index.scss +6 -73
- package/src/Nav/_mixins.scss +4 -4
- package/src/Nav/index.scss +70 -66
- package/src/Navbar/index.scss +276 -2
- package/src/OverflowScroll/data/useOverflowScrollElementAttributes.js +3 -3
- package/src/Overlay/index.jsx +2 -3
- package/src/PageBanner/index.scss +17 -21
- package/src/Pagination/index.scss +32 -34
- package/src/Pagination/pagination-bootstrap.scss +83 -0
- package/src/Popover/index.scss +9 -10
- package/src/Popover/popover-bootstrap.scss +198 -0
- package/src/ProductTour/Checkpoint.scss +71 -43
- package/src/ProgressBar/_mixins.scss +22 -0
- package/src/ProgressBar/bootstrap-progress.scss +49 -0
- package/src/ProgressBar/index.scss +28 -36
- package/src/Scrollable/index.scss +2 -2
- package/src/SearchField/SearchFieldInput.jsx +2 -2
- package/src/SearchField/__snapshots__/SearchField.test.jsx.snap +12 -8
- package/src/SearchField/index.scss +15 -17
- package/src/SelectableBox/index.scss +11 -13
- package/src/Sheet/index.scss +10 -10
- package/src/Spinner/index.scss +57 -2
- package/src/Stack/index.scss +1 -3
- package/src/Stepper/index.scss +19 -20
- package/src/Sticky/index.scss +4 -6
- package/src/Tabs/README.md +1 -23
- package/src/Tabs/index.jsx +0 -3
- package/src/Tabs/index.scss +26 -25
- package/src/Toast/ToastContainer.scss +9 -11
- package/src/Toast/bootstrap-toast.scss +46 -0
- package/src/Toast/index.scss +9 -10
- package/src/Tooltip/index.scss +136 -10
- package/src/TransitionReplace/README.md +4 -4
- package/src/ValidationMessage/index.scss +1 -1
- package/src/index.js +0 -14
- package/src/index.scss +0 -4
- package/src/setupTest.js +0 -6
- package/src/utils/breakpoints.js +1 -1
- package/styles/css/core/custom-media-breakpoints.css +17 -0
- package/styles/css/core/index.css +2 -0
- package/styles/css/core/variables.css +614 -0
- package/styles/css/themes/light/index.css +2 -0
- package/styles/css/themes/light/utility-classes.css +2454 -0
- package/styles/css/themes/light/variables.css +1644 -0
- package/{scss → styles/scss}/core/_functions.scss +1 -1
- package/styles/scss/core/_grid.scss +21 -0
- package/{scss → styles/scss}/core/_utilities.scss +17 -11
- package/styles/scss/core/_variables.scss +869 -0
- package/styles/scss/core/bootstrap-override/_functions.scss +104 -0
- package/styles/scss/core/bootstrap-override/_mixins.scss +4 -0
- package/styles/scss/core/bootstrap-override/_utilities.scss +4 -0
- package/styles/scss/core/bootstrap-override/bootstrap.scss +2 -0
- package/styles/scss/core/bootstrap-override/mixins/_grid-framework.scss +80 -0
- package/styles/scss/core/bootstrap-override/mixins/_grid.scss +69 -0
- package/styles/scss/core/bootstrap-override/mixins/_list-group.scss +22 -0
- package/styles/scss/core/bootstrap-override/utilities/_background.scss +7 -0
- package/styles/scss/core/bootstrap-override/utilities/_borders.scss +67 -0
- package/styles/scss/core/bootstrap-override/utilities/_spacing.scss +70 -0
- package/styles/scss/core/bootstrap-override/utilities/_text.scss +68 -0
- package/styles/scss/core/core.scss +21 -0
- package/{scss → styles/scss}/core/utilities-only.scss +1 -0
- package/tokens/README.md +158 -0
- package/tokens/css-utilities.js +56 -0
- package/tokens/map-scss-to-css.js +24 -0
- package/tokens/replace-variables.js +32 -0
- package/tokens/sass-helpers.js +98 -0
- package/tokens/src/core/alias/size.json +15 -0
- package/tokens/src/core/components/ActionRow.json +10 -0
- package/tokens/src/core/components/Alert.json +30 -0
- package/tokens/src/core/components/Annotation.json +25 -0
- package/tokens/src/core/components/Avatar.json +17 -0
- package/tokens/src/core/components/AvatarButton.json +11 -0
- package/tokens/src/core/components/Badge.json +33 -0
- package/tokens/src/core/components/Breadcrumb.json +37 -0
- package/tokens/src/core/components/Bubble.json +10 -0
- package/tokens/src/core/components/Button/core.json +105 -0
- package/tokens/src/core/components/Card.json +91 -0
- package/tokens/src/core/components/Carousel.json +37 -0
- package/tokens/src/core/components/Chip.json +43 -0
- package/tokens/src/core/components/ChipCarousel.json +15 -0
- package/tokens/src/core/components/CloseButton.json +14 -0
- package/tokens/src/core/components/Code.json +34 -0
- package/tokens/src/core/components/Collapsible.json +29 -0
- package/tokens/src/core/components/ColorPicker.json +8 -0
- package/tokens/src/core/components/Container.json +13 -0
- package/tokens/src/core/components/DataTable.json +27 -0
- package/tokens/src/core/components/Dropdown.json +67 -0
- package/tokens/src/core/components/Dropzone.json +21 -0
- package/tokens/src/core/components/Form/other.json +14 -0
- package/tokens/src/core/components/Form/size.json +233 -0
- package/tokens/src/core/components/Form/spacing.json +155 -0
- package/tokens/src/core/components/Form/transition.json +16 -0
- package/tokens/src/core/components/Form/typography.json +122 -0
- package/tokens/src/core/components/Icon.json +11 -0
- package/tokens/src/core/components/IconButton.json +15 -0
- package/tokens/src/core/components/Image.json +28 -0
- package/tokens/src/core/components/Menu.json +48 -0
- package/tokens/src/core/components/Modal.json +47 -0
- package/tokens/src/core/components/Nav.json +55 -0
- package/tokens/src/core/components/Navbar.json +70 -0
- package/tokens/src/core/components/Pagination.json +70 -0
- package/tokens/src/core/components/Popover.json +48 -0
- package/tokens/src/core/components/ProductTour.json +37 -0
- package/tokens/src/core/components/ProgressBar.json +39 -0
- package/tokens/src/core/components/SearchField.json +23 -0
- package/tokens/src/core/components/SelectableBox.json +9 -0
- package/tokens/src/core/components/Sheet.json +10 -0
- package/tokens/src/core/components/Spinner.json +19 -0
- package/tokens/src/core/components/Stack.json +7 -0
- package/tokens/src/core/components/Stepper.json +42 -0
- package/tokens/src/core/components/Sticky.json +7 -0
- package/tokens/src/core/components/Tab.json +19 -0
- package/tokens/src/core/components/Tabs.json +19 -0
- package/tokens/src/core/components/Toast.json +30 -0
- package/tokens/src/core/components/Tooltip.json +33 -0
- package/tokens/src/core/components/general/caret.json +13 -0
- package/tokens/src/core/components/general/headings.json +16 -0
- package/tokens/src/core/components/general/hr.json +10 -0
- package/tokens/src/core/components/general/input.json +51 -0
- package/tokens/src/core/components/general/link.json +30 -0
- package/tokens/src/core/components/general/list.json +26 -0
- package/tokens/src/core/components/general/text.json +24 -0
- package/tokens/src/core/global/breakpoints.json +12 -0
- package/tokens/src/core/global/display.json +21 -0
- package/tokens/src/core/global/elevation.json +19 -0
- package/tokens/src/core/global/other.json +4 -0
- package/tokens/src/core/global/spacing.json +35 -0
- package/tokens/src/core/global/transition.json +14 -0
- package/tokens/src/core/global/typography.json +91 -0
- package/tokens/src/core/utilities/color.json +12 -0
- package/tokens/src/themes/light/alias/color.json +114 -0
- package/tokens/src/themes/light/components/Alert.json +47 -0
- package/tokens/src/themes/light/components/Annotation.json +29 -0
- package/tokens/src/themes/light/components/Avatar.json +7 -0
- package/tokens/src/themes/light/components/Badge.json +186 -0
- package/tokens/src/themes/light/components/Breadcrumb.json +14 -0
- package/tokens/src/themes/light/components/Bubble.json +18 -0
- package/tokens/src/themes/light/components/Button/brand.json +260 -0
- package/tokens/src/themes/light/components/Button/core.json +24 -0
- package/tokens/src/themes/light/components/Button/danger.json +247 -0
- package/tokens/src/themes/light/components/Button/dark.json +230 -0
- package/tokens/src/themes/light/components/Button/info.json +238 -0
- package/tokens/src/themes/light/components/Button/light.json +236 -0
- package/tokens/src/themes/light/components/Button/primary.json +250 -0
- package/tokens/src/themes/light/components/Button/secondary.json +278 -0
- package/tokens/src/themes/light/components/Button/success.json +253 -0
- package/tokens/src/themes/light/components/Button/tertiary.json +109 -0
- package/tokens/src/themes/light/components/Button/warning.json +276 -0
- package/tokens/src/themes/light/components/Card.json +40 -0
- package/tokens/src/themes/light/components/Carousel.json +45 -0
- package/tokens/src/themes/light/components/Chip.json +50 -0
- package/tokens/src/themes/light/components/CloseButton.json +10 -0
- package/tokens/src/themes/light/components/Code.json +23 -0
- package/tokens/src/themes/light/components/DataTable.json +26 -0
- package/tokens/src/themes/light/components/Dropdown.json +41 -0
- package/tokens/src/themes/light/components/Dropzone.json +23 -0
- package/tokens/src/themes/light/components/Form/color.json +270 -0
- package/tokens/src/themes/light/components/Form/elevation.json +76 -0
- package/tokens/src/themes/light/components/Form/other.json +131 -0
- package/tokens/src/themes/light/components/IconButton.json +451 -0
- package/tokens/src/themes/light/components/Image.json +18 -0
- package/tokens/src/themes/light/components/Menu.json +30 -0
- package/tokens/src/themes/light/components/Modal.json +37 -0
- package/tokens/src/themes/light/components/Nav.json +166 -0
- package/tokens/src/themes/light/components/Navbar.json +136 -0
- package/tokens/src/themes/light/components/OverflowScroll.json +9 -0
- package/tokens/src/themes/light/components/PageBanner.json +24 -0
- package/tokens/src/themes/light/components/Pagination.json +45 -0
- package/tokens/src/themes/light/components/Popover.json +55 -0
- package/tokens/src/themes/light/components/ProductTour.json +35 -0
- package/tokens/src/themes/light/components/ProgressBar.json +20 -0
- package/tokens/src/themes/light/components/Scrollable.json +14 -0
- package/tokens/src/themes/light/components/SearchField.json +25 -0
- package/tokens/src/themes/light/components/Sheet.json +22 -0
- package/tokens/src/themes/light/components/Stepper.json +34 -0
- package/tokens/src/themes/light/components/Sticky.json +18 -0
- package/tokens/src/themes/light/components/Tab.json +62 -0
- package/tokens/src/themes/light/components/Toast.json +33 -0
- package/tokens/src/themes/light/components/Tooltip.json +30 -0
- package/tokens/src/themes/light/components/general/body.json +8 -0
- package/tokens/src/themes/light/components/general/headings.json +7 -0
- package/tokens/src/themes/light/components/general/hr.json +15 -0
- package/tokens/src/themes/light/components/general/input.json +18 -0
- package/tokens/src/themes/light/components/general/link.json +109 -0
- package/tokens/src/themes/light/components/general/list.json +38 -0
- package/tokens/src/themes/light/components/general/text.json +6 -0
- package/tokens/src/themes/light/global/color.json +1661 -0
- package/tokens/src/themes/light/global/elevation.json +201 -0
- package/tokens/src/themes/light/global/other.json +4 -0
- package/tokens/style-dictionary.js +223 -0
- package/tokens/utils.js +210 -0
- package/dist/ActionRow/_variables.scss +0 -2
- package/dist/Alert/_variables.scss +0 -24
- package/dist/Annotation/_variables.scss +0 -18
- package/dist/Avatar/_variables.scss +0 -10
- package/dist/AvatarButton/_variables.scss +0 -3
- package/dist/Badge/_variables.scss +0 -16
- package/dist/Breadcrumb/_variables.scss +0 -27
- package/dist/Bubble/_variables.scss +0 -8
- package/dist/Button/_variables.scss +0 -52
- package/dist/Button/deprecated/index.js +0 -149
- package/dist/Button/deprecated/index.js.map +0 -1
- package/dist/Card/_variables.scss +0 -55
- package/dist/Carousel/_variables.scss +0 -27
- package/dist/CheckBox/index.js +0 -102
- package/dist/CheckBox/index.js.map +0 -1
- package/dist/CheckBoxGroup/index.js +0 -15
- package/dist/CheckBoxGroup/index.js.map +0 -1
- package/dist/Chip/_variables.scss +0 -28
- package/dist/ChipCarousel/_variables.scss +0 -3
- package/dist/CloseButton/_variables.scss +0 -6
- package/dist/Code/_variables.scss +0 -17
- package/dist/Collapsible/_variables.scss +0 -12
- package/dist/ColorPicker/_variables.scss +0 -2
- package/dist/Container/_variables.scss +0 -5
- package/dist/DataTable/_variables.scss +0 -11
- package/dist/Dropdown/_variables.scss +0 -33
- package/dist/Dropdown/deprecated/DropdownButton.js +0 -44
- package/dist/Dropdown/deprecated/DropdownButton.js.map +0 -1
- package/dist/Dropdown/deprecated/DropdownItem.js +0 -33
- package/dist/Dropdown/deprecated/DropdownItem.js.map +0 -1
- package/dist/Dropdown/deprecated/DropdownMenu.js +0 -46
- package/dist/Dropdown/deprecated/DropdownMenu.js.map +0 -1
- package/dist/Dropdown/deprecated/index.js +0 -241
- package/dist/Dropdown/deprecated/index.js.map +0 -1
- package/dist/Dropzone/_variables.scss +0 -9
- package/dist/Fieldset/index.js +0 -117
- package/dist/Fieldset/index.js.map +0 -1
- package/dist/Fieldset/index.scss +0 -12
- package/dist/Form/_variables.scss +0 -267
- package/dist/Icon/_variables.scss +0 -7
- package/dist/Image/_variables.scss +0 -13
- package/dist/Input/index.js +0 -166
- package/dist/Input/index.js.map +0 -1
- package/dist/InputSelect/index.js +0 -105
- package/dist/InputSelect/index.js.map +0 -1
- package/dist/InputText/index.js +0 -45
- package/dist/InputText/index.js.map +0 -1
- package/dist/ListBox/index.js +0 -148
- package/dist/ListBox/index.js.map +0 -1
- package/dist/ListBoxOption/index.js +0 -94
- package/dist/ListBoxOption/index.js.map +0 -1
- package/dist/Menu/_variables.scss +0 -24
- package/dist/Modal/_variables.scss +0 -50
- package/dist/Modal/index.js +0 -292
- package/dist/Modal/index.js.map +0 -1
- package/dist/Nav/_variables.scss +0 -58
- package/dist/Navbar/_variables.scss +0 -40
- package/dist/OverflowScroll/_variables.scss +0 -5
- package/dist/OverflowScroll/index.scss +0 -1
- package/dist/Pagination/_variables.scss +0 -19
- package/dist/Popover/_variables.scss +0 -36
- package/dist/ProductTour/_variables.scss +0 -15
- package/dist/ProgressBar/_variables.scss +0 -23
- package/dist/RadioButtonGroup/index.js +0 -188
- package/dist/RadioButtonGroup/index.js.map +0 -1
- package/dist/SearchField/_variables.scss +0 -14
- package/dist/SelectableBox/_variables.scss +0 -5
- package/dist/Spinner/_variables.scss +0 -9
- package/dist/Stack/_variables.scss +0 -1
- package/dist/StatusAlert/index.js +0 -168
- package/dist/StatusAlert/index.js.map +0 -1
- package/dist/Stepper/_variables.scss +0 -18
- package/dist/Sticky/_variables.scss +0 -3
- package/dist/Table/_variables.scss +0 -34
- package/dist/Table/index.js +0 -267
- package/dist/Table/index.js.map +0 -1
- package/dist/Table/index.scss +0 -12
- package/dist/Tabs/_variables.scss +0 -24
- package/dist/Tabs/deprecated/Tabs.scss +0 -3
- package/dist/Tabs/deprecated/index.js +0 -123
- package/dist/Tabs/deprecated/index.js.map +0 -1
- package/dist/TextArea/index.js +0 -44
- package/dist/TextArea/index.js.map +0 -1
- package/dist/Toast/_variables.scss +0 -19
- package/dist/Tooltip/_variables.scss +0 -21
- package/dist/ValidationFormGroup/index.js +0 -106
- package/dist/ValidationFormGroup/index.js.map +0 -1
- package/dist/paragon.css +0 -45
- package/scss/core/_grid.scss +0 -21
- package/scss/core/_variables.scss +0 -875
- package/scss/core/core.scss +0 -21
- package/src/ActionRow/_variables.scss +0 -2
- package/src/Alert/_variables.scss +0 -24
- package/src/Annotation/_variables.scss +0 -18
- package/src/Avatar/_variables.scss +0 -10
- package/src/AvatarButton/_variables.scss +0 -3
- package/src/Badge/_variables.scss +0 -16
- package/src/Breadcrumb/_variables.scss +0 -27
- package/src/Bubble/_variables.scss +0 -8
- package/src/Button/_variables.scss +0 -52
- package/src/Button/deprecated/Button.test.jsx +0 -34
- package/src/Button/deprecated/index.jsx +0 -145
- package/src/Card/_variables.scss +0 -55
- package/src/Carousel/_variables.scss +0 -27
- package/src/CheckBox/CheckBox.test.jsx +0 -65
- package/src/CheckBox/README.md +0 -93
- package/src/CheckBox/index.jsx +0 -80
- package/src/CheckBoxGroup/CheckBoxGroup.test.jsx +0 -33
- package/src/CheckBoxGroup/README.md +0 -35
- package/src/CheckBoxGroup/index.jsx +0 -19
- package/src/Chip/_variables.scss +0 -28
- package/src/ChipCarousel/_variables.scss +0 -3
- package/src/CloseButton/_variables.scss +0 -6
- package/src/Code/_variables.scss +0 -17
- package/src/Collapsible/_variables.scss +0 -12
- package/src/ColorPicker/_variables.scss +0 -2
- package/src/Container/_variables.scss +0 -5
- package/src/DataTable/_variables.scss +0 -11
- package/src/Dropdown/_variables.scss +0 -33
- package/src/Dropdown/deprecated/Dropdown.test.jsx +0 -238
- package/src/Dropdown/deprecated/DropdownButton.jsx +0 -52
- package/src/Dropdown/deprecated/DropdownItem.jsx +0 -34
- package/src/Dropdown/deprecated/DropdownMenu.jsx +0 -50
- package/src/Dropdown/deprecated/__snapshots__/Dropdown.test.jsx.snap +0 -229
- package/src/Dropdown/deprecated/index.jsx +0 -222
- package/src/Dropzone/_variables.scss +0 -9
- package/src/Fieldset/Fieldset.test.jsx +0 -101
- package/src/Fieldset/README.md +0 -146
- package/src/Fieldset/index.jsx +0 -107
- package/src/Fieldset/index.scss +0 -12
- package/src/Form/_variables.scss +0 -267
- package/src/Icon/_variables.scss +0 -7
- package/src/Image/_variables.scss +0 -13
- package/src/Input/README.md +0 -74
- package/src/Input/__snapshots__/input.test.jsx.snap +0 -53
- package/src/Input/index.jsx +0 -151
- package/src/Input/input.test.jsx +0 -85
- package/src/InputSelect/README.md +0 -136
- package/src/InputSelect/index.jsx +0 -92
- package/src/InputText/InputText.test.jsx +0 -74
- package/src/InputText/README.md +0 -293
- package/src/InputText/index.jsx +0 -49
- package/src/ListBox/ListBox.test.jsx +0 -161
- package/src/ListBox/README.md +0 -185
- package/src/ListBox/index.jsx +0 -115
- package/src/ListBoxOption/ListBoxOption.test.jsx +0 -154
- package/src/ListBoxOption/index.jsx +0 -78
- package/src/Menu/_variables.scss +0 -24
- package/src/Modal/README.md +0 -148
- package/src/Modal/_variables.scss +0 -50
- package/src/Modal/index.jsx +0 -319
- package/src/Modal/tests/Modal.test.jsx +0 -261
- package/src/Nav/_variables.scss +0 -58
- package/src/Navbar/_variables.scss +0 -40
- package/src/OverflowScroll/_variables.scss +0 -5
- package/src/OverflowScroll/index.scss +0 -1
- package/src/Pagination/_variables.scss +0 -19
- package/src/Popover/_variables.scss +0 -36
- package/src/ProductTour/_variables.scss +0 -15
- package/src/ProgressBar/_variables.scss +0 -23
- package/src/RadioButtonGroup/README.md +0 -50
- package/src/RadioButtonGroup/RadioButtonGroup.test.jsx +0 -127
- package/src/RadioButtonGroup/index.jsx +0 -185
- package/src/SearchField/_variables.scss +0 -14
- package/src/SelectableBox/_variables.scss +0 -5
- package/src/Spinner/_variables.scss +0 -9
- package/src/Stack/_variables.scss +0 -1
- package/src/StatusAlert/README.md +0 -149
- package/src/StatusAlert/StatusAlert.test.jsx +0 -150
- package/src/StatusAlert/index.jsx +0 -144
- package/src/Stepper/_variables.scss +0 -18
- package/src/Sticky/_variables.scss +0 -3
- package/src/Table/README.md +0 -506
- package/src/Table/Table.test.jsx +0 -367
- package/src/Table/_variables.scss +0 -34
- package/src/Table/index.jsx +0 -264
- package/src/Table/index.scss +0 -12
- package/src/Tabs/_variables.scss +0 -24
- package/src/Tabs/deprecated/Tabs.scss +0 -3
- package/src/Tabs/deprecated/Tabs.test.jsx +0 -50
- package/src/Tabs/deprecated/index.jsx +0 -117
- package/src/TextArea/README.md +0 -63
- package/src/TextArea/index.jsx +0 -48
- package/src/Toast/_variables.scss +0 -19
- package/src/Tooltip/_variables.scss +0 -21
- package/src/ValidationFormGroup/README.md +0 -116
- package/src/ValidationFormGroup/ValidationFormGroup.test.jsx +0 -146
- package/src/ValidationFormGroup/__snapshots__/ValidationFormGroup.test.jsx.snap +0 -161
- package/src/ValidationFormGroup/index.jsx +0 -114
- /package/{scss → styles/scss}/core/_exports.module.scss +0 -0
- /package/{scss → styles/scss}/core/_typography.scss +0 -0
package/src/CheckBox/index.jsx
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import asInput from '../asInput';
|
|
5
|
-
import withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';
|
|
6
|
-
|
|
7
|
-
class Check extends React.Component {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
|
|
11
|
-
this.onChange = this.onChange.bind(this);
|
|
12
|
-
|
|
13
|
-
this.state = {
|
|
14
|
-
checked: props.checked || false,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* eslint-disable react/no-did-update-set-state */
|
|
19
|
-
componentDidUpdate(prevProps) {
|
|
20
|
-
if (prevProps.checked !== this.props.checked) {
|
|
21
|
-
this.setState({
|
|
22
|
-
checked: this.props.checked,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
onChange(event) {
|
|
28
|
-
this.setState(prevState => ({
|
|
29
|
-
checked: !prevState.checked,
|
|
30
|
-
}));
|
|
31
|
-
this.props.onChange(event);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
const {
|
|
36
|
-
inputRef,
|
|
37
|
-
...others
|
|
38
|
-
} = this.props;
|
|
39
|
-
return (
|
|
40
|
-
<input
|
|
41
|
-
{...others}
|
|
42
|
-
type="checkbox"
|
|
43
|
-
ref={inputRef}
|
|
44
|
-
checked={this.state.checked}
|
|
45
|
-
aria-checked={this.state.checked}
|
|
46
|
-
onChange={this.onChange}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
Check.propTypes = {
|
|
53
|
-
// eslint-disable-next-line max-len
|
|
54
|
-
/** (`Boolean`): `true` if the state should be checked, `false` otherwise. This prop can be used to manage the Checkbox more directly, overriding the default Checkbox checked state. */
|
|
55
|
-
checked: PropTypes.bool,
|
|
56
|
-
/** (`Boolean`): `true` if the checkbox should be disabled, `false` otherwise */
|
|
57
|
-
onChange: PropTypes.func,
|
|
58
|
-
/** function to be called when the checkbox changes state */
|
|
59
|
-
inputRef: PropTypes.oneOfType([
|
|
60
|
-
PropTypes.func,
|
|
61
|
-
PropTypes.shape({ current: PropTypes.instanceOf(PropTypes.element) }),
|
|
62
|
-
]),
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
Check.defaultProps = {
|
|
66
|
-
checked: false,
|
|
67
|
-
onChange: () => {},
|
|
68
|
-
inputRef: undefined,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const CheckBox = asInput(withDeprecatedProps(Check, 'Checkbox', {
|
|
72
|
-
className: {
|
|
73
|
-
deprType: DeprTypes.FORMAT,
|
|
74
|
-
expect: value => typeof value === 'string',
|
|
75
|
-
transform: value => (Array.isArray(value) ? value.join(' ') : value),
|
|
76
|
-
message: 'It should be a string.',
|
|
77
|
-
},
|
|
78
|
-
}), 'checkbox', false);
|
|
79
|
-
|
|
80
|
-
export default CheckBox;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import CheckBoxGroup from '.';
|
|
4
|
-
import CheckBox from '../CheckBox';
|
|
5
|
-
|
|
6
|
-
describe('<CheckBoxGroup />', () => {
|
|
7
|
-
it('correct number of children displayed in group', () => {
|
|
8
|
-
const checkBoxGroup = (
|
|
9
|
-
<CheckBoxGroup>
|
|
10
|
-
<CheckBox
|
|
11
|
-
id="checkbox1"
|
|
12
|
-
name="basicCheckBox"
|
|
13
|
-
label="CheckBox 1"
|
|
14
|
-
/>
|
|
15
|
-
<CheckBox
|
|
16
|
-
id="checkbox2"
|
|
17
|
-
name="basicCheckBox"
|
|
18
|
-
label="CheckBox 2"
|
|
19
|
-
/>
|
|
20
|
-
<CheckBox
|
|
21
|
-
id="checkbox3"
|
|
22
|
-
name="basicCheckBox"
|
|
23
|
-
label="CheckBox 3"
|
|
24
|
-
/>
|
|
25
|
-
</CheckBoxGroup>
|
|
26
|
-
);
|
|
27
|
-
const { getByLabelText } = render(checkBoxGroup);
|
|
28
|
-
|
|
29
|
-
expect(getByLabelText('CheckBox 1')).toBeInTheDocument();
|
|
30
|
-
expect(getByLabelText('CheckBox 2')).toBeInTheDocument();
|
|
31
|
-
expect(getByLabelText('CheckBox 3')).toBeInTheDocument();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 'CheckBoxGroup'
|
|
3
|
-
type: 'component'
|
|
4
|
-
components:
|
|
5
|
-
- CheckBoxGroup
|
|
6
|
-
categories:
|
|
7
|
-
- Forms (deprecated)
|
|
8
|
-
status: 'Deprecate Soon'
|
|
9
|
-
designStatus: 'To Do'
|
|
10
|
-
devStatus: 'To Do'
|
|
11
|
-
notes: |
|
|
12
|
-
Replaced by Form.Checkbox and Form.CheckboxSet
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Basic Usage
|
|
16
|
-
|
|
17
|
-
```jsx live
|
|
18
|
-
<CheckBoxGroup>
|
|
19
|
-
<CheckBox
|
|
20
|
-
id="checkbox1"
|
|
21
|
-
name="basicCheckBox1"
|
|
22
|
-
label="CheckBox 1"
|
|
23
|
-
/>
|
|
24
|
-
<CheckBox
|
|
25
|
-
id="checkbox2"
|
|
26
|
-
name="basicCheckBox2"
|
|
27
|
-
label="CheckBox 2"
|
|
28
|
-
/>
|
|
29
|
-
<CheckBox
|
|
30
|
-
id="checkbox3"
|
|
31
|
-
name="basicCheckBox3"
|
|
32
|
-
label="CheckBox 3"
|
|
33
|
-
/>
|
|
34
|
-
</CheckBoxGroup>
|
|
35
|
-
```
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
function CheckBoxGroup(props) {
|
|
5
|
-
return (
|
|
6
|
-
<div className="form-group">
|
|
7
|
-
{props.children}
|
|
8
|
-
</div>
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
CheckBoxGroup.propTypes = {
|
|
13
|
-
// eslint-disable-next-line max-len
|
|
14
|
-
/** represents the CheckBox components defined within the CheckBoxGroup component and is not a specific named prop that needs to be passed in. At least one CheckBox must be defined within the group. Example: `<CheckBoxGroup><CheckBox .../></CheckBoxGroup>`
|
|
15
|
-
*/
|
|
16
|
-
children: PropTypes.arrayOf(PropTypes.element).isRequired,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default CheckBoxGroup;
|
package/src/Chip/_variables.scss
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
$chip-padding-x: .5rem !default;
|
|
2
|
-
$chip-padding-y: 1px !default;
|
|
3
|
-
$chip-icon-margin: .25rem !default;
|
|
4
|
-
$chip-margin: .125rem !default;
|
|
5
|
-
$chip-border-radius: .375rem !default;
|
|
6
|
-
$chip-disable-opacity: .3 !default;
|
|
7
|
-
$chip-icon-size: 1.5rem !default;
|
|
8
|
-
$chip-label-color: $primary-700 !default;
|
|
9
|
-
$chip-border-color: $light-800 !default;
|
|
10
|
-
$chip-outline-width: 3px !default;
|
|
11
|
-
$chip-light-bg-color: $white !default;
|
|
12
|
-
$chip-light-outline-color: $chip-label-color !default;
|
|
13
|
-
$chip-light-selected-outline-distance: 3px !default;
|
|
14
|
-
$chip-light-selected-focus-border-color: $dark-500 !default;
|
|
15
|
-
$chip-light-hover-bg: $dark-500 !default;
|
|
16
|
-
$chip-light-hover-border-color: $chip-light-hover-bg !default;
|
|
17
|
-
$chip-light-hover-label-color: $chip-light-bg-color !default;
|
|
18
|
-
$chip-light-hover-icon-color: $chip-light-hover-label-color !default;
|
|
19
|
-
$chip-light-focus-outline-distance: .313rem !default;
|
|
20
|
-
$chip-dark-bg: $primary-300 !default;
|
|
21
|
-
$chip-dark-outline-color: $white !default;
|
|
22
|
-
$chip-dark-selected-outline-distance: 3px !default;
|
|
23
|
-
$chip-dark-selected-focus-border-color: $chip-dark-outline-color !default;
|
|
24
|
-
$chip-dark-label-color: $chip-dark-outline-color !default;
|
|
25
|
-
$chip-dark-hover-bg: $white !default;
|
|
26
|
-
$chip-dark-hover-border-color: $chip-dark-hover-bg !default;
|
|
27
|
-
$chip-dark-hover-label-color: $primary-500 !default;
|
|
28
|
-
$chip-dark-focus-outline-distance: .313rem !default;
|
package/src/Code/_variables.scss
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Code
|
|
2
|
-
|
|
3
|
-
$code-font-size: 87.5% !default;
|
|
4
|
-
$code-color: #E83E8C !default;
|
|
5
|
-
|
|
6
|
-
$kbd-box-shadow: inset 0 -.1rem 0 rgba($black, .25) !default;
|
|
7
|
-
$nested-kbd-font-weight: $font-weight-bold !default;
|
|
8
|
-
|
|
9
|
-
// HTML Keyboard Input element (<kbd>) styles
|
|
10
|
-
$kbd-padding-y: .2rem !default;
|
|
11
|
-
$kbd-padding-x: .4rem !default;
|
|
12
|
-
$kbd-font-size: $code-font-size !default;
|
|
13
|
-
$kbd-color: $white !default;
|
|
14
|
-
$kbd-bg: theme-color("gray", "hover") !default;
|
|
15
|
-
|
|
16
|
-
$pre-color: theme-color("gray", "dark-text") !default;
|
|
17
|
-
$pre-scrollable-max-height: 340px !default;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Collapsible
|
|
2
|
-
|
|
3
|
-
$collapsible-card-spacer-y: .5rem !default;
|
|
4
|
-
$collapsible-card-spacer-x: .5rem !default;
|
|
5
|
-
$collapsible-card-spacer-y-lg: $card-spacer-y !default;
|
|
6
|
-
$collapsible-card-spacer-x-lg: $card-spacer-x !default;
|
|
7
|
-
$collapsible-card-body-spacer-left: .75rem !default;
|
|
8
|
-
$collapsible-card-spacer-icon: 2.5rem !default;
|
|
9
|
-
|
|
10
|
-
$collapsible-basic-spacer-y: .5rem !default;
|
|
11
|
-
$collapsible-basic-spacer-x: .5rem !default;
|
|
12
|
-
$collapsible-basic-spacer-icon: .625rem !default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
$data-table-background-color: $white !default;
|
|
2
|
-
$data-table-border: 2px solid $light-300 !default;
|
|
3
|
-
$data-table-box-shadow: $box-shadow-sm !default;
|
|
4
|
-
$data-table-padding-x: .75rem !default;
|
|
5
|
-
$data-table-padding-y: .75rem !default;
|
|
6
|
-
$data-table-padding-small: .5rem !default;
|
|
7
|
-
$data-table-cell-padding: .5rem .75rem !default;
|
|
8
|
-
$data-table-footer-position: center !default;
|
|
9
|
-
$data-table-pagination-dropdown-max-height: 60vh !default;
|
|
10
|
-
$data-table-pagination-dropdown-min-width: 6rem !default;
|
|
11
|
-
$data-table-layout-sidebar-width: 12rem !default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Dropdowns
|
|
2
|
-
//
|
|
3
|
-
// Dropdown menu container and contents.
|
|
4
|
-
|
|
5
|
-
$dropdown-min-width: 18rem !default;
|
|
6
|
-
$dropdown-padding-x: 0 !default;
|
|
7
|
-
$dropdown-padding-y: .5rem !default;
|
|
8
|
-
$dropdown-spacer: .125rem !default;
|
|
9
|
-
$dropdown-font-size: $font-size-base !default;
|
|
10
|
-
$dropdown-color: $body-color !default;
|
|
11
|
-
$dropdown-bg: $white !default;
|
|
12
|
-
$dropdown-border-color: rgba($black, .15) !default;
|
|
13
|
-
$dropdown-border-radius: $border-radius !default;
|
|
14
|
-
$dropdown-border-width: $border-width !default;
|
|
15
|
-
$dropdown-inner-border-radius: calc(#{$dropdown-border-radius} - #{$dropdown-border-width}) !default;
|
|
16
|
-
$dropdown-divider-bg: theme-color("gray", "background") !default;
|
|
17
|
-
$dropdown-divider-margin-y: calc($spacer / 2) !default;
|
|
18
|
-
$dropdown-box-shadow: 0 .5rem 1rem rgba($black, .175) !default;
|
|
19
|
-
|
|
20
|
-
$dropdown-link-color: theme-color("gray", "dark-text") !default;
|
|
21
|
-
$dropdown-link-hover-color: darken(theme-color("gray", "dark-text"), 5%) !default;
|
|
22
|
-
$dropdown-link-hover-bg: $light-300 !default;
|
|
23
|
-
|
|
24
|
-
$dropdown-link-active-color: $component-active-color !default;
|
|
25
|
-
$dropdown-link-active-bg: $component-active-bg !default;
|
|
26
|
-
|
|
27
|
-
$dropdown-link-disabled-color: theme-color("gray", "light-text") !default;
|
|
28
|
-
|
|
29
|
-
$dropdown-item-padding-y: .25rem !default;
|
|
30
|
-
$dropdown-item-padding-x: 1rem !default;
|
|
31
|
-
|
|
32
|
-
$dropdown-header-color: theme-color("gray", "light-text") !default;
|
|
33
|
-
$dropdown-header-padding: $dropdown-padding-y $dropdown-item-padding-x !default;
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import renderer from 'react-test-renderer';
|
|
4
|
-
import userEvent from '@testing-library/user-event';
|
|
5
|
-
|
|
6
|
-
import Dropdown from './index';
|
|
7
|
-
import Icon from '../../Icon';
|
|
8
|
-
|
|
9
|
-
const menuContent = (
|
|
10
|
-
<>
|
|
11
|
-
<Dropdown.Button>
|
|
12
|
-
Search Engines
|
|
13
|
-
</Dropdown.Button>
|
|
14
|
-
<Dropdown.Menu>
|
|
15
|
-
<Dropdown.Item href="https://google.com">Google</Dropdown.Item>
|
|
16
|
-
<Dropdown.Item href="https://duckduckgo.com">DuckDuckGo</Dropdown.Item>
|
|
17
|
-
<Dropdown.Item href="https://yahoo.com">Yahoo</Dropdown.Item>
|
|
18
|
-
</Dropdown.Menu>
|
|
19
|
-
</>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const menuOpen = (isOpen, wrapper) => {
|
|
23
|
-
expect(wrapper.container.querySelector('.dropdown').classList.contains('show')).toBe(isOpen);
|
|
24
|
-
expect(wrapper.getByRole('button', { name: 'Search Engines' })).toHaveAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
describe('<Dropdown />', () => {
|
|
28
|
-
describe('Rendering', () => {
|
|
29
|
-
it('renders the happy path', () => {
|
|
30
|
-
const tree = renderer.create((
|
|
31
|
-
<Dropdown>
|
|
32
|
-
{menuContent}
|
|
33
|
-
</Dropdown>
|
|
34
|
-
)).toJSON();
|
|
35
|
-
expect(tree).toMatchSnapshot();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('renders when there is html content in the trigger button', () => {
|
|
39
|
-
const tree = renderer.create((
|
|
40
|
-
<Dropdown>
|
|
41
|
-
{menuContent}
|
|
42
|
-
</Dropdown>
|
|
43
|
-
)).toJSON();
|
|
44
|
-
expect(tree).toMatchSnapshot();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('renders with custom menu content', () => {
|
|
48
|
-
const tree = renderer.create((
|
|
49
|
-
<Dropdown>
|
|
50
|
-
Custom Content
|
|
51
|
-
</Dropdown>
|
|
52
|
-
)).toJSON();
|
|
53
|
-
expect(tree).toMatchSnapshot();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe('Mouse Interactions', () => {
|
|
58
|
-
let wrapper;
|
|
59
|
-
|
|
60
|
-
beforeEach(() => {
|
|
61
|
-
wrapper = render(<Dropdown>{menuContent}</Dropdown>);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('opens on trigger click', async () => {
|
|
65
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' }));
|
|
66
|
-
menuOpen(true, wrapper);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should focus on the first item after opening', async () => {
|
|
70
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' }));
|
|
71
|
-
expect(wrapper.getByText('Google')).toHaveFocus();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('does not close on click inside the menu', async () => {
|
|
75
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' }));
|
|
76
|
-
await userEvent.click(wrapper.getByText('Google')); // Do nothing
|
|
77
|
-
menuOpen(true, wrapper);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('closes on trigger click', async () => {
|
|
81
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' }));
|
|
82
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' })); // Close
|
|
83
|
-
menuOpen(false, wrapper);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should focus on the trigger button after closing', async () => {
|
|
87
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' }));
|
|
88
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' })); // Close
|
|
89
|
-
expect(wrapper.getByRole('button', { name: 'Search Engines' })).toHaveFocus();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('closes on document click when open', async () => {
|
|
93
|
-
await userEvent.click(wrapper.getByRole('button', { name: 'Search Engines' }));
|
|
94
|
-
menuOpen(true, wrapper);
|
|
95
|
-
document.dispatchEvent(new MouseEvent('click'));
|
|
96
|
-
menuOpen(false, wrapper);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe('Keyboard Interactions', () => {
|
|
101
|
-
let wrapper;
|
|
102
|
-
|
|
103
|
-
beforeEach(() => {
|
|
104
|
-
wrapper = render(<Dropdown>{menuContent}</Dropdown>);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('opens on Enter keyDown', async () => {
|
|
108
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
109
|
-
await userEvent.keyboard('{Enter}');
|
|
110
|
-
menuOpen(true, wrapper);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('opens on Space keyDown', async () => {
|
|
114
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
115
|
-
await userEvent.keyboard('{space}');
|
|
116
|
-
menuOpen(true, wrapper);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('should focus on the first item after opening', async () => {
|
|
120
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
121
|
-
await userEvent.keyboard('{Enter}');
|
|
122
|
-
expect(wrapper.getByText('Google')).toHaveFocus();
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('should focus the next item after ArrowDown keyDown', async () => {
|
|
126
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
127
|
-
await userEvent.keyboard('{Enter}');
|
|
128
|
-
await userEvent.keyboard('{arrowdown}');
|
|
129
|
-
expect(wrapper.getByText('DuckDuckGo')).toHaveFocus();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('should focus the next item after Tab keyDown', async () => {
|
|
133
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
134
|
-
await userEvent.keyboard('{Enter}');
|
|
135
|
-
await userEvent.tab();
|
|
136
|
-
expect(wrapper.getByText('DuckDuckGo')).toHaveFocus();
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should loop focus to the first item after Tab keyDown on last item', async () => {
|
|
140
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
141
|
-
await userEvent.keyboard('{Enter}');
|
|
142
|
-
wrapper.getByRole('link', { name: 'Yahoo' }).focus();
|
|
143
|
-
await userEvent.tab();
|
|
144
|
-
expect(wrapper.getByText('Google')).toHaveFocus();
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('should loop focus to the last item after ArrowUp keyDown on first item', async () => {
|
|
148
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
149
|
-
await userEvent.keyboard('{Enter}');
|
|
150
|
-
wrapper.getByRole('link', { name: 'Google' }).focus();
|
|
151
|
-
await userEvent.keyboard('{arrowup}');
|
|
152
|
-
expect(wrapper.getByText('Yahoo')).toHaveFocus();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('should focus the previous item after Shift + Tab keyDown', async () => {
|
|
156
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
157
|
-
await userEvent.keyboard('{Enter}');
|
|
158
|
-
wrapper.getByRole('link', { name: 'Yahoo' }).focus();
|
|
159
|
-
await userEvent.keyboard('{Shift>}{Tab}');
|
|
160
|
-
expect(wrapper.getByText('DuckDuckGo')).toHaveFocus();
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('should close the menu on Escape keyDown', async () => {
|
|
164
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
165
|
-
await userEvent.keyboard('{Enter}');
|
|
166
|
-
await userEvent.keyboard('{escape}');
|
|
167
|
-
menuOpen(false, wrapper);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('should focus on the trigger button after closing', async () => {
|
|
171
|
-
wrapper.getByRole('button', { name: 'Search Engines' }).focus();
|
|
172
|
-
await userEvent.keyboard('{Enter}');
|
|
173
|
-
await userEvent.keyboard('{escape}');
|
|
174
|
-
expect(wrapper.getByRole('button', { name: 'Search Engines' })).toHaveFocus();
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('renders the basic usage', () => {
|
|
179
|
-
const tree = renderer.create((
|
|
180
|
-
<Dropdown
|
|
181
|
-
title="Search Engines"
|
|
182
|
-
menuItems={[
|
|
183
|
-
{
|
|
184
|
-
label: 'Google',
|
|
185
|
-
href: 'https://google.com',
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
label: 'DuckDuckGo',
|
|
189
|
-
href: 'https://duckduckgo.com',
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
label: 'Yahoo',
|
|
193
|
-
href: 'https://yahoo.com',
|
|
194
|
-
},
|
|
195
|
-
]}
|
|
196
|
-
/>
|
|
197
|
-
)).toJSON();
|
|
198
|
-
expect(tree).toMatchSnapshot();
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('renders menu items as elements', () => {
|
|
202
|
-
const tree = renderer.create((
|
|
203
|
-
<Dropdown
|
|
204
|
-
title="Search Engines"
|
|
205
|
-
menuItems={[
|
|
206
|
-
<a href="http://www.google.com">Google</a>,
|
|
207
|
-
<a href="http://www.duckduckgo.com">DuckDuckGo</a>,
|
|
208
|
-
<a href="http://www.yahoo.com">Yahoo</a>,
|
|
209
|
-
]}
|
|
210
|
-
/>
|
|
211
|
-
)).toJSON();
|
|
212
|
-
expect(tree).toMatchSnapshot();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
it('renders with icon element', () => {
|
|
216
|
-
const tree = renderer.create((
|
|
217
|
-
<Dropdown
|
|
218
|
-
title="Search Engines"
|
|
219
|
-
iconElement={<Icon className="fa fa-user px-3" />}
|
|
220
|
-
menuItems={[
|
|
221
|
-
{
|
|
222
|
-
label: 'Google',
|
|
223
|
-
href: 'https://google.com',
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
label: 'DuckDuckGo',
|
|
227
|
-
href: 'https://duckduckgo.com',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
label: 'Yahoo',
|
|
231
|
-
href: 'https://yahoo.com',
|
|
232
|
-
},
|
|
233
|
-
]}
|
|
234
|
-
/>
|
|
235
|
-
)).toJSON();
|
|
236
|
-
expect(tree).toMatchSnapshot();
|
|
237
|
-
});
|
|
238
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
// eslint-disable-next-line import/no-cycle
|
|
5
|
-
import { Consumer } from './index';
|
|
6
|
-
|
|
7
|
-
function DropdownButton({ children, className, ...other }) {
|
|
8
|
-
return (
|
|
9
|
-
<Consumer>
|
|
10
|
-
{({
|
|
11
|
-
buttonRef,
|
|
12
|
-
isOpen,
|
|
13
|
-
toggle,
|
|
14
|
-
triggerId,
|
|
15
|
-
}) => (
|
|
16
|
-
<button
|
|
17
|
-
{...other}
|
|
18
|
-
id={classNames(triggerId, other.id)}
|
|
19
|
-
aria-expanded={isOpen}
|
|
20
|
-
aria-haspopup
|
|
21
|
-
type="button"
|
|
22
|
-
ref={buttonRef}
|
|
23
|
-
className={classNames(
|
|
24
|
-
'dropdown-toggle',
|
|
25
|
-
'btn',
|
|
26
|
-
className,
|
|
27
|
-
)}
|
|
28
|
-
onClick={(e) => {
|
|
29
|
-
toggle(e);
|
|
30
|
-
if (other.onClick) {
|
|
31
|
-
other.onClick(e);
|
|
32
|
-
}
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
</button>
|
|
37
|
-
)}
|
|
38
|
-
</Consumer>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
DropdownButton.propTypes = {
|
|
43
|
-
children: PropTypes.node,
|
|
44
|
-
className: PropTypes.string,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
DropdownButton.defaultProps = {
|
|
48
|
-
children: undefined,
|
|
49
|
-
className: 'btn-light',
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default DropdownButton;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
function DropdownItem(props) {
|
|
6
|
-
const {
|
|
7
|
-
type, children, className, ...other
|
|
8
|
-
} = props;
|
|
9
|
-
return React.createElement(
|
|
10
|
-
type,
|
|
11
|
-
{
|
|
12
|
-
...other,
|
|
13
|
-
className: classNames(
|
|
14
|
-
'dropdown-item',
|
|
15
|
-
className,
|
|
16
|
-
),
|
|
17
|
-
},
|
|
18
|
-
children,
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
DropdownItem.propTypes = {
|
|
23
|
-
type: PropTypes.string,
|
|
24
|
-
children: PropTypes.node,
|
|
25
|
-
className: PropTypes.string,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
DropdownItem.defaultProps = {
|
|
29
|
-
type: 'a',
|
|
30
|
-
children: undefined,
|
|
31
|
-
className: null,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default DropdownItem;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
// eslint-disable-next-line import/no-cycle
|
|
5
|
-
import { Consumer } from './index';
|
|
6
|
-
|
|
7
|
-
function DropdownMenu({ children, ...other }) {
|
|
8
|
-
return (
|
|
9
|
-
<Consumer>
|
|
10
|
-
{({
|
|
11
|
-
handleMenuKeyDown,
|
|
12
|
-
isOpen,
|
|
13
|
-
menuRef,
|
|
14
|
-
triggerId,
|
|
15
|
-
}) => (
|
|
16
|
-
/* eslint-disable-next-line jsx-a11y/interactive-supports-focus */
|
|
17
|
-
<div
|
|
18
|
-
{...other}
|
|
19
|
-
aria-labelledby={triggerId}
|
|
20
|
-
aria-hidden={!isOpen}
|
|
21
|
-
ref={menuRef}
|
|
22
|
-
role="menu"
|
|
23
|
-
className={classNames(
|
|
24
|
-
'dropdown-menu',
|
|
25
|
-
{ show: isOpen },
|
|
26
|
-
other.className,
|
|
27
|
-
)}
|
|
28
|
-
onKeyDown={(e) => {
|
|
29
|
-
handleMenuKeyDown(e);
|
|
30
|
-
if (other.onKeyDown) {
|
|
31
|
-
other.onKeyDown(e);
|
|
32
|
-
}
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
</div>
|
|
37
|
-
)}
|
|
38
|
-
</Consumer>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
DropdownMenu.propTypes = {
|
|
43
|
-
children: PropTypes.node,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
DropdownMenu.defaultProps = {
|
|
47
|
-
children: undefined,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export default DropdownMenu;
|