@openedx/paragon 22.6.0 → 23.0.0-alpha.2
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 +61 -21
- 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 +15 -40
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/index.scss +855 -372
- 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/ChipIcon.d.ts +2 -2
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.d.ts +2 -2
- package/dist/Chip/index.js +2 -2
- package/dist/Chip/index.js.map +1 -1
- package/dist/Chip/index.scss +48 -38
- 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.js +32 -20
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Hyperlink/index.scss +1 -1
- package/dist/Icon/index.d.ts +2 -4
- package/dist/Icon/index.js +1 -1
- package/dist/Icon/index.js.map +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 -54
- 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 +20 -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 +29 -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 +16777 -0
- package/dist/core.css.map +1 -0
- package/dist/core.min.css +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -18
- 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 +133 -0
- package/lib/help.js +36 -23
- package/lib/replace-variables.js +38 -0
- package/lib/utils.js +30 -0
- package/package.json +30 -14
- 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/{Button.test.tsx → Button.test.jsx} +2 -14
- package/src/Button/README.md +0 -84
- package/src/Button/__snapshots__/{Button.test.tsx.snap → Button.test.jsx.snap} +2 -19
- package/src/Button/_mixins.scss +14 -0
- package/src/Button/button-group.scss +126 -0
- package/src/Button/index.jsx +113 -0
- package/src/Button/index.scss +855 -372
- 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/ChipIcon.tsx +1 -1
- package/src/Chip/index.scss +48 -38
- package/src/Chip/index.tsx +5 -5
- 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/{Hyperlink.test.tsx → Hyperlink.test.jsx} +10 -21
- package/src/Hyperlink/{index.tsx → index.jsx} +37 -41
- package/src/Hyperlink/index.scss +1 -1
- package/src/Icon/index.d.ts +2 -4
- package/src/Icon/index.jsx +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 -54
- 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 +20 -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 +29 -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.d.ts +2 -2
- package/src/index.js +4 -18
- package/src/index.scss +0 -4
- package/src/{setupTest.ts → setupTest.js} +0 -7
- 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 +603 -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 +868 -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 +157 -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 +23 -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 +96 -0
- package/tokens/src/core/components/Carousel.json +37 -0
- package/tokens/src/core/components/Chip.json +41 -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 +229 -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 +52 -0
- package/tokens/src/core/components/Navbar.json +70 -0
- package/tokens/src/core/components/Pagination.json +66 -0
- package/tokens/src/core/components/Popover.json +48 -0
- package/tokens/src/core/components/ProductTour.json +32 -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 +22 -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 +37 -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 +38 -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 +13 -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 +36 -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 +12 -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 +229 -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/Button/index.d.ts +0 -35
- 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/Hyperlink/index.d.ts +0 -24
- 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/dist/setupTest.d.ts +0 -2
- package/dist/setupTest.js.map +0 -1
- package/dist/utils/types/bootstrap.d.ts +0 -39
- package/dist/utils/types/bootstrap.js +0 -2
- package/dist/utils/types/bootstrap.js.map +0 -1
- 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/Button/index.tsx +0 -159
- 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/src/utils/types/bootstrap.test.tsx +0 -86
- package/src/utils/types/bootstrap.ts +0 -43
- /package/src/Button/{ButtonGroup.test.tsx → ButtonGroup.test.jsx} +0 -0
- /package/src/Button/{ButtonToolbar.test.tsx → ButtonToolbar.test.jsx} +0 -0
- /package/src/Button/__snapshots__/{ButtonGroup.test.tsx.snap → ButtonGroup.test.jsx.snap} +0 -0
- /package/src/Button/__snapshots__/{ButtonToolbar.test.tsx.snap → ButtonToolbar.test.jsx.snap} +0 -0
- /package/{scss → styles/scss}/core/_exports.module.scss +0 -0
- /package/{scss → styles/scss}/core/_typography.scss +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"elevation": {
|
|
3
|
+
"box-shadow": {
|
|
4
|
+
"level": {
|
|
5
|
+
"1": {
|
|
6
|
+
"value": "0 .0625rem .125rem rgba(0, 0, 0, .15), 0 .0625rem .25rem rgba(0, 0, 0, .15)",
|
|
7
|
+
"type": "shadow",
|
|
8
|
+
"source": "$level-1-box-shadow",
|
|
9
|
+
"description": "Basic box shadow of level 1."
|
|
10
|
+
},
|
|
11
|
+
"2": {
|
|
12
|
+
"value": "0 .125rem .25rem rgba(0, 0, 0, .15), 0 .125rem .5rem rgba(0, 0, 0, .15)",
|
|
13
|
+
"type": "shadow",
|
|
14
|
+
"source": "$level-2-box-shadow",
|
|
15
|
+
"description": "Basic box shadow of level 2."
|
|
16
|
+
},
|
|
17
|
+
"3": {
|
|
18
|
+
"value": "0 0 .625rem rgba(0, 0, 0, .15), 0 0 1rem rgba(0, 0, 0, .15)",
|
|
19
|
+
"type": "shadow",
|
|
20
|
+
"source": "$level-3-box-shadow",
|
|
21
|
+
"description": "Basic box shadow of level 3."
|
|
22
|
+
},
|
|
23
|
+
"4": {
|
|
24
|
+
"value": "0 .625rem 1.25rem rgba(0, 0, 0, .15), 0 .5rem 1.25rem rgba(0, 0, 0, .15)",
|
|
25
|
+
"type": "shadow",
|
|
26
|
+
"source": "$level-4-box-shadow",
|
|
27
|
+
"description": "Basic box shadow of level 4."
|
|
28
|
+
},
|
|
29
|
+
"5": {
|
|
30
|
+
"value": "0 1.25px 2.5rem rgba(0, 0, 0, .15), 0 .5rem 2.5rem rgba(0, 0, 0, .15)",
|
|
31
|
+
"type": "shadow",
|
|
32
|
+
"source": "$level-5-box-shadow",
|
|
33
|
+
"description": "Basic box shadow of level 5."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"base": { "value": "0 .125rem .25rem rgba(0, 0, 0, .3)", "type": "shadow", "source": "$box-shadow", "description": "Default box shadow." },
|
|
37
|
+
"sm": { "value": "0 .0625rem .125rem rgba(0, 0, 0, .2)", "type": "shadow", "source": "$box-shadow-sm", "description": "Small box shadow." },
|
|
38
|
+
"lg": { "value": "0 .25rem .5rem rgba(0, 0, 0, .3)", "type": "shadow", "source": "$box-shadow-lg", "description": "Large box shadow." },
|
|
39
|
+
"down": {
|
|
40
|
+
"1": {
|
|
41
|
+
"value": "0 .0625rem .125rem rgba(0, 0, 0, .15), 0 .0625rem .25rem rgba(0, 0, 0, .15)",
|
|
42
|
+
"type": "shadow",
|
|
43
|
+
"source": "$box-shadow-down-1",
|
|
44
|
+
"description": "Bottom box shadow of level 1."
|
|
45
|
+
},
|
|
46
|
+
"2": {
|
|
47
|
+
"value": "0 .125rem .25rem rgba(0, 0, 0, .15), 0 .125rem .5rem rgba(0, 0, 0, .15)",
|
|
48
|
+
"type": "shadow",
|
|
49
|
+
"source": "$box-shadow-down-2",
|
|
50
|
+
"description": "Bottom box shadow of level 2."
|
|
51
|
+
},
|
|
52
|
+
"3": {
|
|
53
|
+
"value": "0 .5rem 1rem rgba(0, 0, 0, .15), 0 .25rem .625rem rgba(0, 0, 0, .15)",
|
|
54
|
+
"type": "shadow",
|
|
55
|
+
"source": "$box-shadow-down-3",
|
|
56
|
+
"description": "Bottom box shadow of level 3."
|
|
57
|
+
},
|
|
58
|
+
"4": {
|
|
59
|
+
"value": "0 .625rem 1.25rem rgba(0, 0, 0, .15), 0 .5rem 1.25rem rgba(0, 0, 0, .15)",
|
|
60
|
+
"type": "shadow",
|
|
61
|
+
"source": "$box-shadow-down-4",
|
|
62
|
+
"description": "Bottom box shadow of level 4."
|
|
63
|
+
},
|
|
64
|
+
"5": {
|
|
65
|
+
"value": "0 1.25px 2.5rem rgba(0, 0, 0, .15), 0 .5rem 2.5rem rgba(0, 0, 0, .15)",
|
|
66
|
+
"type": "shadow",
|
|
67
|
+
"source": "$box-shadow-down-5",
|
|
68
|
+
"description": "Bottom box shadow of level 5."
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"left": {
|
|
72
|
+
"1": {
|
|
73
|
+
"value": "-.0625rem 0 .125rem rgba(0, 0, 0, .15), -.0625rem 0 .25rem rgba(0, 0, 0, .15)",
|
|
74
|
+
"type": "shadow",
|
|
75
|
+
"source": "$box-shadow-left-1",
|
|
76
|
+
"description": "Left box shadow of level 1."
|
|
77
|
+
},
|
|
78
|
+
"2": {
|
|
79
|
+
"value": "-.125rem 0 .25rem rgba(0, 0, 0, .15), -.125rem 0 .5rem rgba(0, 0, 0, .15)",
|
|
80
|
+
"type": "shadow",
|
|
81
|
+
"source": "$box-shadow-left-2",
|
|
82
|
+
"description": "Left box shadow of level 2."
|
|
83
|
+
},
|
|
84
|
+
"3": {
|
|
85
|
+
"value": "-.5rem 0 1rem rgba(0, 0, 0, .15), -.25rem 0 .625rem rgba(0, 0, 0, .15)",
|
|
86
|
+
"type": "shadow",
|
|
87
|
+
"source": "$box-shadow-left-3",
|
|
88
|
+
"description": "Left box shadow of level 3."
|
|
89
|
+
},
|
|
90
|
+
"4": {
|
|
91
|
+
"value": "-.625rem 0 1.25rem rgba(0, 0, 0, .15), -.5rem 0 1.25rem rgba(0, 0, 0, .15)",
|
|
92
|
+
"type": "shadow",
|
|
93
|
+
"source": "$box-shadow-left-4",
|
|
94
|
+
"description": "Left box shadow of level 4."
|
|
95
|
+
},
|
|
96
|
+
"5": {
|
|
97
|
+
"value": "-1.25rem 0 2.5rem rgba(0, 0, 0, .15), -.5rem 0 3rem rgba(0, 0, 0, .15)",
|
|
98
|
+
"type": "shadow",
|
|
99
|
+
"source": "$box-shadow-left-5",
|
|
100
|
+
"description": "Left box shadow of level 5."
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"up": {
|
|
104
|
+
"1": {
|
|
105
|
+
"value": "0 -.0625rem .125rem rgba(0, 0, 0, .15), 0 -.0625rem .25rem rgba(0, 0, 0, .15)",
|
|
106
|
+
"type": "shadow",
|
|
107
|
+
"source": "$box-shadow-up-1",
|
|
108
|
+
"description": "Top box shadow of level 1."
|
|
109
|
+
},
|
|
110
|
+
"2": {
|
|
111
|
+
"value": "0 -.125rem .25rem rgba(0, 0, 0, .15), 0 -.125rem .5rem rgba(0, 0, 0, .15)",
|
|
112
|
+
"type": "shadow",
|
|
113
|
+
"source": "$box-shadow-up-2",
|
|
114
|
+
"description": "Top box shadow of level 2."
|
|
115
|
+
},
|
|
116
|
+
"3": {
|
|
117
|
+
"value": "0 -.5rem 1rem rgba(0, 0, 0, .15), 0 -.25rem .625rem rgba(0, 0, 0, .15)",
|
|
118
|
+
"type": "shadow",
|
|
119
|
+
"source": "$box-shadow-up-3",
|
|
120
|
+
"description": "Top box shadow of level 3."
|
|
121
|
+
},
|
|
122
|
+
"4": {
|
|
123
|
+
"value": "0 -.625rem 1.25rem rgba(0, 0, 0, .15), 0 -.5rem 1.25rem rgba(0, 0, 0, .15)",
|
|
124
|
+
"type": "shadow",
|
|
125
|
+
"source": "$box-shadow-up-4",
|
|
126
|
+
"description": "Top box shadow of level 4."
|
|
127
|
+
},
|
|
128
|
+
"5": {
|
|
129
|
+
"value": "0 -1.25rem 2.5rem rgba(0, 0, 0, .15), 0 -.5rem 3rem rgba(0, 0, 0, .15)",
|
|
130
|
+
"type": "shadow",
|
|
131
|
+
"source": "$box-shadow-up-5",
|
|
132
|
+
"description": "Basic box shadow of level 5."
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"right": {
|
|
136
|
+
"1": {
|
|
137
|
+
"value": ".0625rem 0 .125rem rgba(0, 0, 0, .15), .0625rem 0 .25rem rgba(0, 0, 0, .15)",
|
|
138
|
+
"type": "shadow",
|
|
139
|
+
"source": "$box-shadow-right-1",
|
|
140
|
+
"description": "Right box shadow of level 1."
|
|
141
|
+
},
|
|
142
|
+
"2": {
|
|
143
|
+
"value": ".125rem 0 .25rem rgba(0, 0, 0, .15), .125rem 0 .5rem rgba(0, 0, 0, .15)",
|
|
144
|
+
"type": "shadow",
|
|
145
|
+
"source": "$box-shadow-right-2",
|
|
146
|
+
"description": "Right box shadow of level 2."
|
|
147
|
+
},
|
|
148
|
+
"3": {
|
|
149
|
+
"value": ".5rem 0 1rem rgba(0, 0, 0, .15), .25rem 0 .625rem rgba(0, 0, 0, .15)",
|
|
150
|
+
"type": "shadow",
|
|
151
|
+
"source": "$box-shadow-right-3",
|
|
152
|
+
"description": "Right box shadow of level 3."
|
|
153
|
+
},
|
|
154
|
+
"4": {
|
|
155
|
+
"value": ".625rem 0 1.25rem rgba(0, 0, 0, .15), .5rem 0 1.25rem rgba(0, 0, 0, .15)",
|
|
156
|
+
"type": "shadow",
|
|
157
|
+
"source": "$box-shadow-right-4",
|
|
158
|
+
"description": "Right box shadow of level 4."
|
|
159
|
+
},
|
|
160
|
+
"5": {
|
|
161
|
+
"value": "1.25rem 0 2.5rem rgba(0, 0, 0, .15), .5rem 0 3rem rgba(0, 0, 0, .15)",
|
|
162
|
+
"type": "shadow",
|
|
163
|
+
"source": "$box-shadow-right-5",
|
|
164
|
+
"description": "Right box shadow of level 5."
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"centered": {
|
|
168
|
+
"1": {
|
|
169
|
+
"value": "0 0 .125rem rgba(0, 0, 0, .15), 0 0 .25rem rgba(0, 0, 0, .15)",
|
|
170
|
+
"type": "shadow",
|
|
171
|
+
"source": "$box-shadow-centered-1",
|
|
172
|
+
"description": "Centered box shadow of level 1."
|
|
173
|
+
},
|
|
174
|
+
"2": {
|
|
175
|
+
"value": "0 0 .25rem rgba(0, 0, 0, .15), 0 0 .5rem rgba(0, 0, 0, .15)",
|
|
176
|
+
"type": "shadow",
|
|
177
|
+
"source": "$box-shadow-centered-2",
|
|
178
|
+
"description": "Centered box shadow of level 2."
|
|
179
|
+
},
|
|
180
|
+
"3": {
|
|
181
|
+
"value": "0 0 .625rem rgba(0, 0, 0, .15), 0 0 1rem rgba(0, 0, 0, .15)",
|
|
182
|
+
"type": "shadow",
|
|
183
|
+
"source": "$box-shadow-centered-3",
|
|
184
|
+
"description": "Centered box shadow of level 3."
|
|
185
|
+
},
|
|
186
|
+
"4": {
|
|
187
|
+
"value": "0 0 1.25rem rgba(0, 0, 0, .15), 0 0 1.25rem rgba(0, 0, 0, .15)",
|
|
188
|
+
"type": "shadow",
|
|
189
|
+
"source": "$box-shadow-centered-4",
|
|
190
|
+
"description": "Centered box shadow of level 4."
|
|
191
|
+
},
|
|
192
|
+
"5": {
|
|
193
|
+
"value": "0 0 2.5rem rgba(0, 0, 0, .15), 0 0 3rem rgba(0, 0, 0, .15)",
|
|
194
|
+
"type": "shadow",
|
|
195
|
+
"source": "$box-shadow-centered-5",
|
|
196
|
+
"description": "Centered box shadow of level 5."
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module creates and exports custom StyleDictionary instance for Paragon.
|
|
3
|
+
*/
|
|
4
|
+
const toml = require('js-toml');
|
|
5
|
+
const StyleDictionary = require('style-dictionary');
|
|
6
|
+
const chroma = require('chroma-js');
|
|
7
|
+
const { colorYiq, darken, lighten } = require('./sass-helpers');
|
|
8
|
+
const cssUtilities = require('./css-utilities');
|
|
9
|
+
const { composeBreakpointName } = require('./utils');
|
|
10
|
+
|
|
11
|
+
const { fileHeader, sortByReference } = StyleDictionary.formatHelpers;
|
|
12
|
+
|
|
13
|
+
const colorTransform = (token, theme) => {
|
|
14
|
+
const {
|
|
15
|
+
name: tokenName,
|
|
16
|
+
value,
|
|
17
|
+
original,
|
|
18
|
+
modify = [],
|
|
19
|
+
} = token;
|
|
20
|
+
const reservedColorValues = ['inherit', 'initial', 'revert', 'unset', 'currentColor'];
|
|
21
|
+
|
|
22
|
+
if (reservedColorValues.includes(original.value)) {
|
|
23
|
+
return original.value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let color = chroma(value);
|
|
27
|
+
|
|
28
|
+
if (modify && modify.length > 0) {
|
|
29
|
+
modify.forEach((modifier) => {
|
|
30
|
+
const { type, amount, otherColor } = modifier;
|
|
31
|
+
switch (type) {
|
|
32
|
+
case 'mix':
|
|
33
|
+
color = color.mix(otherColor, amount, 'rgb');
|
|
34
|
+
break;
|
|
35
|
+
case 'color-yiq': {
|
|
36
|
+
const { light, dark, threshold } = modifier;
|
|
37
|
+
color = colorYiq({
|
|
38
|
+
tokenName,
|
|
39
|
+
backgroundColor: color,
|
|
40
|
+
light,
|
|
41
|
+
dark,
|
|
42
|
+
threshold,
|
|
43
|
+
theme,
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case 'darken':
|
|
48
|
+
color = darken(color, amount);
|
|
49
|
+
break;
|
|
50
|
+
case 'lighten':
|
|
51
|
+
color = lighten(color, amount);
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
color = color[type](amount);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return color.hex('rgba').toUpperCase();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Custom formatter that extends default css/variables format to allow specifying
|
|
64
|
+
* 1. 'outputReferences' per token (by default you are only able to specify it globally for all tokens)
|
|
65
|
+
* 2. 'theme' to output only theme's variables (e.g, 'light' or 'dark'), if theme is not provided - only
|
|
66
|
+
* core tokens are built.
|
|
67
|
+
*/
|
|
68
|
+
const createCustomCSSVariables = ({
|
|
69
|
+
formatterArgs,
|
|
70
|
+
themeVariant,
|
|
71
|
+
}) => {
|
|
72
|
+
const { dictionary, options, file } = formatterArgs;
|
|
73
|
+
|
|
74
|
+
const outputTokens = themeVariant
|
|
75
|
+
? dictionary.allTokens.filter(token => token.filePath.includes(themeVariant))
|
|
76
|
+
: dictionary.allTokens;
|
|
77
|
+
|
|
78
|
+
const variables = outputTokens.sort(sortByReference(dictionary)).map(token => {
|
|
79
|
+
let { value } = token;
|
|
80
|
+
|
|
81
|
+
const outputReferencesForToken = (token.original.outputReferences === false) ? false : options.outputReferences;
|
|
82
|
+
|
|
83
|
+
if (dictionary.usesReference(token.original.value) && outputReferencesForToken) {
|
|
84
|
+
const refs = dictionary.getReferences(token.original.value);
|
|
85
|
+
refs.forEach(ref => {
|
|
86
|
+
value = value.replace(ref.value, `var(--${ref.name})`);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return ` --${token.name}: ${value};`;
|
|
91
|
+
}).join('\n');
|
|
92
|
+
|
|
93
|
+
return `${fileHeader({ file })}:root {\n${variables}\n}\n`;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Transformer that applies SASS color functions to tokens.
|
|
98
|
+
*/
|
|
99
|
+
StyleDictionary.registerTransform({
|
|
100
|
+
name: 'color/sass-color-functions',
|
|
101
|
+
transitive: true,
|
|
102
|
+
type: 'value',
|
|
103
|
+
matcher(token) {
|
|
104
|
+
return token.attributes.category === 'color' || token.value?.toString().startsWith('#');
|
|
105
|
+
},
|
|
106
|
+
transformer: colorTransform,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Transforms that implements str-replace from SASS.
|
|
111
|
+
*/
|
|
112
|
+
StyleDictionary.registerTransform({
|
|
113
|
+
name: 'str-replace',
|
|
114
|
+
transitive: true,
|
|
115
|
+
type: 'value',
|
|
116
|
+
matcher(token) {
|
|
117
|
+
return token.modify && token.modify[0].type === 'str-replace';
|
|
118
|
+
},
|
|
119
|
+
transformer(token) {
|
|
120
|
+
const { value, modify } = token;
|
|
121
|
+
const { toReplace, replaceWith } = modify[0];
|
|
122
|
+
return value.replaceAll(toReplace, replaceWith);
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The custom formatter to create CSS variables for core tokens.
|
|
128
|
+
*/
|
|
129
|
+
StyleDictionary.registerFormat({
|
|
130
|
+
name: 'css/custom-variables',
|
|
131
|
+
formatter: formatterArgs => createCustomCSSVariables({ formatterArgs }),
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Formatter to generate CSS utility classes.
|
|
136
|
+
* Looks in ./src/utilities/ to get utility classes configuration, filters tokens by 'filters' object attributes
|
|
137
|
+
* (see https://amzn.github.io/style-dictionary/#/tokens?id=category-type-item for possible keys in the object,
|
|
138
|
+
* each key should have a list of valid values) and generates CSS classes with using functions defined in
|
|
139
|
+
* 'utilityFunctionsToApply' list, those functions must be located in css-utilities.js module and return string.
|
|
140
|
+
*/
|
|
141
|
+
StyleDictionary.registerFormat({
|
|
142
|
+
name: 'css/utility-classes',
|
|
143
|
+
formatter({ dictionary, file }) {
|
|
144
|
+
const { utilities } = dictionary.properties;
|
|
145
|
+
|
|
146
|
+
if (!utilities) {
|
|
147
|
+
return '';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let utilityClasses = '';
|
|
151
|
+
|
|
152
|
+
utilities.forEach(({ filters, utilityFunctionsToApply }) => {
|
|
153
|
+
let tokens = dictionary.allTokens;
|
|
154
|
+
|
|
155
|
+
Object.entries(filters).forEach(([attributeName, allowedValues]) => {
|
|
156
|
+
tokens = tokens.filter((token) => allowedValues.includes(token.attributes[attributeName]));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
160
|
+
for (const token of tokens) {
|
|
161
|
+
// Get action token by reference
|
|
162
|
+
const ref = dictionary.getReferences(token.original.actions.default)[0];
|
|
163
|
+
token.actions = { default: `var(--${ref.name})` };
|
|
164
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
165
|
+
for (const funcName of utilityFunctionsToApply) {
|
|
166
|
+
utilityClasses += cssUtilities[funcName](token);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return fileHeader({ file }) + utilityClasses;
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Formatter to generate CSS custom media queries for responsive breakpoints.
|
|
177
|
+
* Gets input about existing tokens of the 'size' category,
|
|
178
|
+
* 'breakpoints' subcategory, and generates a CSS custom media queries.
|
|
179
|
+
*/
|
|
180
|
+
StyleDictionary.registerFormat({
|
|
181
|
+
name: 'css/custom-media-breakpoints',
|
|
182
|
+
formatter({ dictionary, file }) {
|
|
183
|
+
const { size: { breakpoint } } = dictionary.properties;
|
|
184
|
+
|
|
185
|
+
let customMediaVariables = '';
|
|
186
|
+
const breakpoints = Object.values(breakpoint || {});
|
|
187
|
+
|
|
188
|
+
for (let i = 0; i < breakpoints.length; i++) {
|
|
189
|
+
const [currentBreakpoint, nextBreakpoint] = [breakpoints[i], breakpoints[i + 1]];
|
|
190
|
+
customMediaVariables += `${composeBreakpointName(currentBreakpoint.name, 'min')} (min-width: ${currentBreakpoint.value});\n`;
|
|
191
|
+
if (nextBreakpoint) {
|
|
192
|
+
customMediaVariables += `${composeBreakpointName(currentBreakpoint.name, 'max')} (max-width: ${nextBreakpoint.value});\n`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return fileHeader({ file }) + customMediaVariables;
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Custom file header for custom and built-in formatters.
|
|
202
|
+
*/
|
|
203
|
+
StyleDictionary.registerFileHeader({
|
|
204
|
+
name: 'customFileHeader',
|
|
205
|
+
fileHeader: (defaultMessage) => [
|
|
206
|
+
'IMPORTANT: This file is the result of assembling design tokens',
|
|
207
|
+
...defaultMessage,
|
|
208
|
+
],
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Registers a filter `isSource` that filters output to only include tokens
|
|
213
|
+
* that are marked as `isSource` in their metadata.
|
|
214
|
+
*/
|
|
215
|
+
StyleDictionary.registerFilter({
|
|
216
|
+
name: 'isSource',
|
|
217
|
+
matcher: token => token?.isSource === true,
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
StyleDictionary.registerParser({
|
|
221
|
+
pattern: /\.toml$/,
|
|
222
|
+
parse: ({ contents }) => toml.load(contents),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
module.exports = {
|
|
226
|
+
StyleDictionary,
|
|
227
|
+
createCustomCSSVariables,
|
|
228
|
+
colorTransform,
|
|
229
|
+
};
|
package/tokens/utils.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const readline = require('readline');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function getFilesWithExtension(location, extension, files = [], excludeDirectories = []) {
|
|
6
|
+
const content = fs.statSync(location);
|
|
7
|
+
if (content.isDirectory()) {
|
|
8
|
+
const contentPaths = fs.readdirSync(location);
|
|
9
|
+
contentPaths.forEach(contentPath => {
|
|
10
|
+
if (!excludeDirectories.includes(contentPath)) {
|
|
11
|
+
getFilesWithExtension(path.join(location, contentPath), extension, files, excludeDirectories);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
} else if (location.endsWith(extension)) {
|
|
15
|
+
files.push(location);
|
|
16
|
+
}
|
|
17
|
+
return files;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getSCSStoCSSMap(prefix, tokensObject, result) {
|
|
21
|
+
Object.entries(tokensObject).forEach(([node, value]) => {
|
|
22
|
+
if (value?.constructor.name === 'Object') {
|
|
23
|
+
const newPrefix = `${prefix}-${node}`;
|
|
24
|
+
getSCSStoCSSMap(newPrefix, value, result);
|
|
25
|
+
} else if (node === 'source') {
|
|
26
|
+
// eslint-disable-next-line no-param-reassign
|
|
27
|
+
result[value] = `var(${prefix})`;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function replaceVariablesUsage(filePath, variablesMap, direction = 'scss-to-css') {
|
|
34
|
+
let variableRegex;
|
|
35
|
+
let result = '';
|
|
36
|
+
|
|
37
|
+
if (direction === 'css-to-scss') {
|
|
38
|
+
variableRegex = /var\((\w|-|_)*\)/g;
|
|
39
|
+
} else if (direction === 'scss-to-css') {
|
|
40
|
+
variableRegex = /(\$|#{\$)(\w|-|_)*(}|,|;|\)|\s|$)/g;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const fileStream = fs.createReadStream(filePath);
|
|
44
|
+
|
|
45
|
+
const rl = readline.createInterface({
|
|
46
|
+
input: fileStream,
|
|
47
|
+
crlfDelay: Infinity,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
51
|
+
for await (const line of rl) {
|
|
52
|
+
let parsedLine = line;
|
|
53
|
+
const variables = [...parsedLine.matchAll(variableRegex)];
|
|
54
|
+
|
|
55
|
+
variables.forEach(variableData => {
|
|
56
|
+
let varExpressionToReplace = variableData[0];
|
|
57
|
+
let actualVariable = varExpressionToReplace;
|
|
58
|
+
|
|
59
|
+
if (direction === 'scss-to-css') {
|
|
60
|
+
// handle interpolation expressions first, e.g. #{$some-variable}
|
|
61
|
+
if (varExpressionToReplace.startsWith('#{') && varExpressionToReplace.endsWith('}')) {
|
|
62
|
+
actualVariable = varExpressionToReplace.slice(2, -1);
|
|
63
|
+
|
|
64
|
+
// general case, e.g. $some-variable;
|
|
65
|
+
} else if ([',', ';', ')', ' ', '}'].includes(varExpressionToReplace.slice(-1))) {
|
|
66
|
+
varExpressionToReplace = varExpressionToReplace.slice(0, -1);
|
|
67
|
+
actualVariable = varExpressionToReplace;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (actualVariable in variablesMap) {
|
|
72
|
+
parsedLine = parsedLine.replaceAll(varExpressionToReplace, variablesMap[actualVariable]);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
result += `${parsedLine}\n`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
fs.writeFileSync(filePath, result);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Replaces SCSS variables definition with value from design tokens
|
|
84
|
+
*
|
|
85
|
+
* @async
|
|
86
|
+
* @param {string} pathToStylesheet - full path to the stylesheet where to perform replacement
|
|
87
|
+
* @param {Object} variablesMap - object that contains variables definitions to use during replacement
|
|
88
|
+
*/
|
|
89
|
+
async function replaceVariablesDefinitions(pathToStylesheet, variablesMap) {
|
|
90
|
+
const fileStream = fs.createReadStream(pathToStylesheet);
|
|
91
|
+
|
|
92
|
+
const rl = readline.createInterface({
|
|
93
|
+
input: fileStream,
|
|
94
|
+
crlfDelay: Infinity,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
let result = '';
|
|
98
|
+
let currentVar = '';
|
|
99
|
+
let currentValue = '';
|
|
100
|
+
|
|
101
|
+
function processVariable() {
|
|
102
|
+
if (currentVar) {
|
|
103
|
+
if (currentVar in variablesMap) {
|
|
104
|
+
result += `${currentVar}: ${variablesMap[currentVar]} !default;\n`;
|
|
105
|
+
} else {
|
|
106
|
+
result += `${currentVar}:${currentValue}`;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
result += currentValue;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
114
|
+
for await (const line of rl) {
|
|
115
|
+
if (line.startsWith('$')) {
|
|
116
|
+
processVariable();
|
|
117
|
+
[currentVar, ...currentValue] = line.split(':');
|
|
118
|
+
currentValue = `${currentValue.join(':')}\n`;
|
|
119
|
+
} else if (!line.trim() || line.startsWith('\\')) {
|
|
120
|
+
processVariable();
|
|
121
|
+
currentVar = '';
|
|
122
|
+
currentValue = `${line}\n`;
|
|
123
|
+
} else {
|
|
124
|
+
currentValue += `${line}\n`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// last variable was not covered by the loop
|
|
129
|
+
processVariable();
|
|
130
|
+
|
|
131
|
+
fs.writeFileSync(pathToStylesheet, result);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Update SCSS variables definitions or usages in given path with CSS variables derived from design tokens
|
|
136
|
+
*
|
|
137
|
+
* @param {string} location - path where to update variables
|
|
138
|
+
* @param {Object} variablesMap - SCSS-to-CSS or CSS-to-SCSS mapping of the variables
|
|
139
|
+
* @param {string} transformType - type of operation, one of ['definition', 'usage'].
|
|
140
|
+
* 'definition' will replace SCSS variables definitions with CSS ones, while 'usage' will replace all occurrences
|
|
141
|
+
* of SCSS / CSS variables (depends on the direction parameter).
|
|
142
|
+
* @param {Array[string]} excludePaths - exclude paths from the search
|
|
143
|
+
* @param {string} direction - replacement direction of variables, takes effect only when transformType === 'usage'.
|
|
144
|
+
* Can be either 'scss-to-css' or 'css-to-scss'.
|
|
145
|
+
* @return {Promise<void>}
|
|
146
|
+
*/
|
|
147
|
+
async function transformInPath(location, variablesMap, transformType = 'definition', excludePaths = [], direction = 'scss-to-css') {
|
|
148
|
+
const content = fs.statSync(location);
|
|
149
|
+
if (content.isDirectory()) {
|
|
150
|
+
const contentPaths = fs.readdirSync(location);
|
|
151
|
+
contentPaths.forEach(contentPath => {
|
|
152
|
+
if (!excludePaths.includes(contentPath)) {
|
|
153
|
+
transformInPath(path.join(location, contentPath), variablesMap, transformType, excludePaths, direction);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
} else if (location.endsWith('.scss')) {
|
|
157
|
+
if (transformType === 'usage') {
|
|
158
|
+
await replaceVariablesUsage(location, variablesMap, direction);
|
|
159
|
+
} else {
|
|
160
|
+
await replaceVariablesDefinitions(location, variablesMap);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function createIndexCssFile({ buildDir = path.resolve(__dirname, '../styles/css'), isTheme, themeVariant }) {
|
|
166
|
+
const directoryPath = isTheme ? `${buildDir}/themes/${themeVariant}` : `${buildDir}/core`;
|
|
167
|
+
|
|
168
|
+
fs.readdir(directoryPath, (errDir, files) => {
|
|
169
|
+
if (errDir) {
|
|
170
|
+
// eslint-disable-next-line no-console
|
|
171
|
+
console.error('Error reading directory:', errDir);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const outputCssFiles = files.filter(file => file !== 'index.css');
|
|
176
|
+
// When creating themes, there are typically two files: one for utility classes and one for variables.
|
|
177
|
+
// It's organized them to allow variables be reading first.
|
|
178
|
+
if (isTheme) { outputCssFiles.reverse(); }
|
|
179
|
+
|
|
180
|
+
const exportStatements = outputCssFiles.map((file) => `@import "${file}";`);
|
|
181
|
+
|
|
182
|
+
const indexContent = `${exportStatements.join('\n')}\n`;
|
|
183
|
+
|
|
184
|
+
fs.writeFile(path.join(directoryPath, 'index.css'), indexContent, (errFile) => {
|
|
185
|
+
if (errFile) {
|
|
186
|
+
// eslint-disable-next-line no-console
|
|
187
|
+
console.error('Error creating index file:', errFile);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Composes a breakpoint name according to the Paragon namespace.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} breakpointName - breakpoint initial name.
|
|
197
|
+
* @param {string} format - screen width format.
|
|
198
|
+
* @return {string} - new breakpoint name.
|
|
199
|
+
*/
|
|
200
|
+
function composeBreakpointName(breakpointName, format) {
|
|
201
|
+
return `@custom-media --${breakpointName.replace(/breakpoint/g, `breakpoint-${format}-width`)}`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
module.exports = {
|
|
205
|
+
createIndexCssFile,
|
|
206
|
+
getFilesWithExtension,
|
|
207
|
+
getSCSStoCSSMap,
|
|
208
|
+
transformInPath,
|
|
209
|
+
composeBreakpointName,
|
|
210
|
+
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Alerts
|
|
2
|
-
//
|
|
3
|
-
// Define alert colors, border radius, and padding.
|
|
4
|
-
|
|
5
|
-
$alert-padding-y: 1.5rem !default;
|
|
6
|
-
$alert-padding-x: 1.5rem !default;
|
|
7
|
-
$alert-margin-bottom: 1rem !default;
|
|
8
|
-
$alert-border-radius: $border-radius !default;
|
|
9
|
-
$alert-link-font-weight: $font-weight-normal !default;
|
|
10
|
-
$alert-border-width: 0 !default;
|
|
11
|
-
$alert-title-color: #000000 !default;
|
|
12
|
-
$alert-box-shadow: 0 1px 2px rgba(0, 0, 0, .15), 0 1px 4px rgba(0, 0, 0, .15) !default;
|
|
13
|
-
|
|
14
|
-
$alert-bg-level: -10 !default;
|
|
15
|
-
$alert-border-level: -9 !default;
|
|
16
|
-
$alert-color-level: 6 !default;
|
|
17
|
-
|
|
18
|
-
$alert-icon-space: .8rem !default;
|
|
19
|
-
|
|
20
|
-
$alert-font-size: .875rem !default;
|
|
21
|
-
$alert-line-height: 1.5rem !default;
|
|
22
|
-
$alert-content-color: $gray-700 !default;
|
|
23
|
-
|
|
24
|
-
$alert-actions-gap: map-get($spacers, 3);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
$annotation-padding: .5rem !default;
|
|
2
|
-
$annotation-box-shadow: drop-shadow(0 2px 4px rgba(0, 0, 0, .15))
|
|
3
|
-
drop-shadow(0 2px 8px rgba(0, 0, 0, .15)) !default;
|
|
4
|
-
$annotation-border-radius: .25rem !default;
|
|
5
|
-
$annotation-max-width: 18.75rem !default;
|
|
6
|
-
$annotation-font-size: $font-size-sm !default;
|
|
7
|
-
$annotation-line-height: $line-height-sm !default;
|
|
8
|
-
|
|
9
|
-
$annotation-variants: (
|
|
10
|
-
"success": ( "background-color": $success, "color": $white ),
|
|
11
|
-
"warning": ( "background-color": $accent-b, "color": $black ),
|
|
12
|
-
"error": ( "background-color": $danger, "color": $white ),
|
|
13
|
-
"light": ( "background-color": $white, "color": $primary-500 ),
|
|
14
|
-
"dark": ( "background-color": $dark, "color": $white ),
|
|
15
|
-
) !default;
|
|
16
|
-
|
|
17
|
-
$annotation-arrow-side-margin: .25rem !default;
|
|
18
|
-
$annotation-arrow-border-width: .5rem !default;
|