@openedx/paragon 23.0.0-alpha.2 → 23.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/paragon-scripts.js +10 -0
- package/dist/Annotation/index.scss +16 -0
- package/dist/Button/index.d.ts +35 -0
- package/dist/Button/index.js +37 -15
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/CardDeck.js +0 -2
- package/dist/Card/CardDeck.js.map +1 -1
- package/dist/Card/index.scss +6 -6
- package/dist/Carousel/index.scss +24 -1
- package/dist/Chip/ChipIcon.d.ts +13 -8
- package/dist/Chip/ChipIcon.js +0 -2
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/constants.d.ts +4 -0
- package/dist/Chip/constants.js +3 -2
- package/dist/Chip/constants.js.map +1 -0
- package/dist/Chip/index.d.ts +4 -3
- package/dist/Chip/index.js +2 -4
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +0 -2
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/CloseButton/index.scss +8 -0
- package/dist/ColorPicker/index.scss +1 -1
- package/dist/DataTable/index.scss +12 -0
- package/dist/Dropdown/dropdown-bootstrap.scss +6 -0
- package/dist/Dropzone/index.scss +34 -0
- package/dist/Form/_FormText.scss +1 -1
- package/dist/Form/_bootstrap-custom-forms.scss +40 -0
- package/dist/Form/_index.scss +9 -0
- package/dist/Form/_mixins.scss +22 -0
- package/dist/Hyperlink/index.d.ts +24 -0
- package/dist/Hyperlink/index.js +20 -32
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.d.ts +4 -2
- package/dist/Icon/index.js +1 -1
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +342 -0
- package/dist/IconButton/index.js +18 -26
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButton/index.scss +146 -0
- package/dist/Menu/index.scss +8 -0
- package/dist/Modal/ModalDialog.js +8 -4
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalPopup.js +7 -1
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/_ModalDialog.scss +26 -2
- package/dist/Nav/index.scss +8 -0
- package/dist/Overlay/index.d.ts +128 -0
- package/dist/Overlay/index.js +8 -2
- package/dist/Overlay/index.js.map +1 -1
- package/dist/PageBanner/index.scss +2 -2
- package/dist/Pagination/pagination-bootstrap.scss +9 -0
- package/dist/Popover/index.scss +1 -1
- package/dist/ProductTour/Checkpoint.scss +1 -1
- package/dist/ProgressBar/bootstrap-progress.scss +20 -5
- package/dist/ProgressBar/index.scss +3 -3
- package/dist/Stepper/index.scss +1 -1
- package/dist/Sticky/index.scss +12 -0
- package/dist/Toast/index.scss +13 -1
- package/dist/Tooltip/index.d.ts +7 -0
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/Tooltip/index.scss +16 -0
- package/dist/core.css +914 -470
- package/dist/core.css.map +1 -1
- package/dist/core.min.css +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/light.css +2035 -1315
- package/dist/light.css.map +1 -1
- package/dist/light.min.css +1 -1
- package/dist/setupTest.d.ts +2 -0
- package/dist/setupTest.js.map +1 -0
- package/dist/utils/types/bootstrap.d.ts +39 -0
- package/dist/utils/types/bootstrap.js +2 -0
- package/dist/utils/types/bootstrap.js.map +1 -0
- package/lib/build-tokens.js +67 -31
- package/package.json +11 -8
- package/src/Annotation/index.scss +16 -0
- package/src/Button/{Button.test.jsx → Button.test.tsx} +14 -2
- package/src/Button/__snapshots__/{Button.test.jsx.snap → Button.test.tsx.snap} +19 -2
- package/src/Button/{index.jsx → index.tsx} +58 -16
- package/src/Card/CardDeck.jsx +0 -3
- package/src/Card/README.md +0 -31
- package/src/Card/index.scss +6 -6
- package/src/Carousel/index.scss +24 -1
- package/src/Chip/{Chip.test.jsx → Chip.test.tsx} +5 -7
- package/src/Chip/ChipIcon.tsx +8 -8
- package/src/Chip/{constants.js → constants.ts} +1 -1
- package/src/Chip/index.tsx +6 -8
- package/src/ChipCarousel/index.tsx +0 -2
- package/src/CloseButton/index.scss +8 -0
- package/src/ColorPicker/index.scss +1 -1
- package/src/DataTable/index.scss +12 -0
- package/src/Dropdown/dropdown-bootstrap.scss +6 -0
- package/src/Dropzone/index.scss +34 -0
- package/src/Form/_FormText.scss +1 -1
- package/src/Form/_bootstrap-custom-forms.scss +40 -0
- package/src/Form/_index.scss +9 -0
- package/src/Form/_mixins.scss +22 -0
- package/src/Hyperlink/{Hyperlink.test.jsx → Hyperlink.test.tsx} +21 -10
- package/src/Hyperlink/{index.jsx → index.tsx} +41 -37
- package/src/Icon/index.d.ts +4 -2
- package/src/Icon/index.jsx +1 -1
- package/src/IconButton/{IconButton.test.jsx → IconButton.test.tsx} +24 -3
- package/src/IconButton/__snapshots__/IconButton.test.tsx.snap +90 -0
- package/src/IconButton/index.scss +146 -0
- package/src/IconButton/{index.jsx → index.tsx} +66 -26
- package/src/Menu/index.scss +8 -0
- package/src/Modal/ModalDialog.jsx +7 -3
- package/src/Modal/ModalPopup.jsx +9 -1
- package/src/Modal/_ModalDialog.scss +26 -2
- package/src/Modal/modal-dialog.mdx +95 -6
- package/src/Modal/tests/ModalDialog.test.jsx +2 -0
- package/src/Modal/tests/ModalPopupNoMock.test.jsx +29 -0
- package/src/Nav/index.scss +8 -0
- package/src/Overlay/{index.jsx → index.tsx} +13 -8
- package/src/PageBanner/index.scss +2 -2
- package/src/Pagination/pagination-bootstrap.scss +9 -0
- package/src/Popover/index.scss +1 -1
- package/src/ProductTour/Checkpoint.scss +1 -1
- package/src/ProgressBar/bootstrap-progress.scss +20 -5
- package/src/ProgressBar/index.scss +3 -3
- package/src/Stepper/index.scss +1 -1
- package/src/Sticky/index.scss +12 -0
- package/src/Toast/index.scss +13 -1
- package/src/Tooltip/index.scss +16 -0
- package/src/Tooltip/{index.jsx → index.tsx} +9 -3
- package/src/index.d.ts +5 -5
- package/src/index.js +7 -7
- package/src/{setupTest.js → setupTest.ts} +1 -0
- package/src/utils/types/bootstrap.test.tsx +86 -0
- package/src/utils/types/bootstrap.ts +43 -0
- package/styles/css/core/abstraction-variables.css +44 -0
- package/styles/css/core/custom-media-breakpoints.css +3 -4
- package/styles/css/core/index.css +2 -1
- package/styles/css/core/variables.css +494 -430
- package/styles/css/themes/light/abstraction-variables.css +304 -0
- package/styles/css/themes/light/index.css +1 -0
- package/styles/css/themes/light/utility-classes.css +2 -3
- package/styles/css/themes/light/variables.css +1753 -1334
- package/styles/scss/core/_typography.scss +16 -4
- package/styles/scss/core/_utilities.scss +7 -3
- package/styles/scss/core/_variables.scss +43 -30
- package/styles/scss/core/core.scss +1 -0
- package/tokens/src/core/alias/size.json +6 -5
- package/tokens/src/core/components/ActionRow.json +3 -2
- package/tokens/src/core/components/Alert.json +12 -10
- package/tokens/src/core/components/Annotation.json +9 -7
- package/tokens/src/core/components/Avatar.json +9 -9
- package/tokens/src/core/components/AvatarButton.json +4 -3
- package/tokens/src/core/components/Badge.json +12 -9
- package/tokens/src/core/components/Breadcrumb.json +7 -5
- package/tokens/src/core/components/Bubble.json +4 -3
- package/tokens/src/core/components/Button/core.json +35 -59
- package/tokens/src/core/components/Card.json +33 -44
- package/tokens/src/core/components/Carousel.json +39 -13
- package/tokens/src/core/components/Chip.json +13 -21
- package/tokens/src/core/components/ChipCarousel.json +4 -5
- package/tokens/src/core/components/CloseButton.json +2 -6
- package/tokens/src/core/components/Code.json +9 -8
- package/tokens/src/core/components/Collapsible.json +10 -13
- package/tokens/src/core/components/ColorPicker.json +3 -2
- package/tokens/src/core/components/Container.json +6 -5
- package/tokens/src/core/components/DataTable.json +17 -9
- package/tokens/src/core/components/Dropdown.json +24 -29
- package/tokens/src/core/components/Dropzone.json +5 -7
- package/tokens/src/core/components/Form/other.json +5 -4
- package/tokens/src/core/components/Form/size.json +72 -119
- package/tokens/src/core/components/Form/spacing.json +39 -83
- package/tokens/src/core/components/Form/transition.json +43 -7
- package/tokens/src/core/components/Form/typography.json +24 -88
- package/tokens/src/core/components/Icon.json +6 -5
- package/tokens/src/core/components/IconButton.json +4 -7
- package/tokens/src/core/components/Image.json +7 -6
- package/tokens/src/core/components/Menu.json +14 -12
- package/tokens/src/core/components/Modal.json +26 -21
- package/tokens/src/core/components/Nav.json +14 -16
- package/tokens/src/core/components/Navbar.json +15 -30
- package/tokens/src/core/components/Pagination.json +23 -24
- package/tokens/src/core/components/Popover.json +18 -14
- package/tokens/src/core/components/ProductTour.json +8 -14
- package/tokens/src/core/components/ProgressBar.json +29 -14
- package/tokens/src/core/components/SearchField.json +7 -9
- package/tokens/src/core/components/SelectableBox.json +4 -3
- package/tokens/src/core/components/Sheet.json +3 -2
- package/tokens/src/core/components/Spinner.json +9 -7
- package/tokens/src/core/components/Stack.json +2 -1
- package/tokens/src/core/components/Stepper.json +12 -14
- package/tokens/src/core/components/Sticky.json +2 -1
- package/tokens/src/core/components/Tab.json +8 -7
- package/tokens/src/core/components/Tabs.json +5 -5
- package/tokens/src/core/components/Toast.json +11 -8
- package/tokens/src/core/components/Tooltip.json +13 -11
- package/tokens/src/core/components/general/caret.json +5 -3
- package/tokens/src/core/components/general/headings.json +5 -4
- package/tokens/src/core/components/general/hr.json +3 -2
- package/tokens/src/core/components/general/input.json +19 -19
- package/tokens/src/core/components/general/link.json +13 -12
- package/tokens/src/core/components/general/list.json +9 -6
- package/tokens/src/core/components/general/text.json +6 -12
- package/tokens/src/core/global/breakpoints.json +25 -6
- package/tokens/src/core/global/elevation.json +55 -13
- package/tokens/src/core/global/other.json +5 -1
- package/tokens/src/core/global/spacing.json +70 -17
- package/tokens/src/core/global/transition.json +41 -4
- package/tokens/src/core/global/typography.json +248 -53
- package/tokens/src/core/utilities/color.json +35 -4
- package/tokens/src/themes/light/alias/color.json +276 -75
- package/tokens/src/themes/light/components/Alert.json +15 -26
- package/tokens/src/themes/light/components/Annotation.json +27 -13
- package/tokens/src/themes/light/components/Avatar.json +2 -1
- package/tokens/src/themes/light/components/Badge.json +57 -122
- package/tokens/src/themes/light/components/Breadcrumb.json +6 -5
- package/tokens/src/themes/light/components/Bubble.json +9 -8
- package/tokens/src/themes/light/components/Button/brand.json +171 -119
- package/tokens/src/themes/light/components/Button/core.json +8 -9
- package/tokens/src/themes/light/components/Button/danger.json +171 -112
- package/tokens/src/themes/light/components/Button/dark.json +188 -106
- package/tokens/src/themes/light/components/Button/info.json +186 -112
- package/tokens/src/themes/light/components/Button/light.json +186 -110
- package/tokens/src/themes/light/components/Button/primary.json +178 -116
- package/tokens/src/themes/light/components/Button/secondary.json +166 -132
- package/tokens/src/themes/light/components/Button/success.json +176 -117
- package/tokens/src/themes/light/components/Button/tertiary.json +34 -60
- package/tokens/src/themes/light/components/Button/warning.json +164 -128
- package/tokens/src/themes/light/components/Card.json +10 -21
- package/tokens/src/themes/light/components/Carousel.json +12 -11
- package/tokens/src/themes/light/components/Chip.json +14 -26
- package/tokens/src/themes/light/components/CloseButton.json +12 -2
- package/tokens/src/themes/light/components/Code.json +7 -9
- package/tokens/src/themes/light/components/DataTable.json +7 -11
- package/tokens/src/themes/light/components/Dropdown.json +17 -20
- package/tokens/src/themes/light/components/Dropzone.json +49 -11
- package/tokens/src/themes/light/components/Form/color.json +101 -155
- package/tokens/src/themes/light/components/Form/elevation.json +38 -42
- package/tokens/src/themes/light/components/Form/other.json +44 -41
- package/tokens/src/themes/light/components/IconButton.json +408 -256
- package/tokens/src/themes/light/components/Image.json +7 -4
- package/tokens/src/themes/light/components/Menu.json +12 -10
- package/tokens/src/themes/light/components/Modal.json +22 -12
- package/tokens/src/themes/light/components/Nav.json +82 -94
- package/tokens/src/themes/light/components/Navbar.json +32 -76
- package/tokens/src/themes/light/components/OverflowScroll.json +3 -1
- package/tokens/src/themes/light/components/PageBanner.json +11 -10
- package/tokens/src/themes/light/components/Pagination.json +19 -23
- package/tokens/src/themes/light/components/Popover.json +22 -27
- package/tokens/src/themes/light/components/ProductTour.json +9 -20
- package/tokens/src/themes/light/components/ProgressBar.json +12 -10
- package/tokens/src/themes/light/components/Scrollable.json +3 -3
- package/tokens/src/themes/light/components/SearchField.json +9 -9
- package/tokens/src/themes/light/components/Sheet.json +6 -7
- package/tokens/src/themes/light/components/Stepper.json +12 -17
- package/tokens/src/themes/light/components/Sticky.json +31 -6
- package/tokens/src/themes/light/components/Tab.json +47 -24
- package/tokens/src/themes/light/components/Toast.json +26 -14
- package/tokens/src/themes/light/components/Tooltip.json +25 -10
- package/tokens/src/themes/light/components/general/body.json +3 -2
- package/tokens/src/themes/light/components/general/headings.json +2 -1
- package/tokens/src/themes/light/components/general/hr.json +3 -6
- package/tokens/src/themes/light/components/general/input.json +11 -4
- package/tokens/src/themes/light/components/general/link.json +34 -43
- package/tokens/src/themes/light/components/general/list.json +15 -19
- package/tokens/src/themes/light/components/general/text.json +5 -6
- package/tokens/src/themes/light/global/color.json +1592 -867
- package/tokens/src/themes/light/global/elevation.json +481 -93
- package/tokens/style-dictionary.js +342 -144
- package/tokens/utils.js +176 -6
- package/src/IconButton/__snapshots__/IconButton.test.jsx.snap +0 -20
- package/tokens/src/core/global/display.json +0 -22
- /package/src/Button/{ButtonGroup.test.jsx → ButtonGroup.test.tsx} +0 -0
- /package/src/Button/{ButtonToolbar.test.jsx → ButtonToolbar.test.tsx} +0 -0
- /package/src/Button/__snapshots__/{ButtonGroup.test.jsx.snap → ButtonGroup.test.tsx.snap} +0 -0
- /package/src/Button/__snapshots__/{ButtonToolbar.test.jsx.snap → ButtonToolbar.test.tsx.snap} +0 -0
- /package/src/Chip/__snapshots__/{Chip.test.jsx.snap → Chip.test.tsx.snap} +0 -0
- /package/src/Tooltip/{Tooltip.test.jsx → Tooltip.test.tsx} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupTest.js","names":["ResizeObserver","_classCallCheck","_createClass","key","value","observe","unobserve","disconnect","window"],"sources":["../src/setupTest.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport 'regenerator-runtime/runtime';\n\nimport '@testing-library/jest-dom';\n\nclass ResizeObserver {\n observe() {\n // do nothing\n }\n\n unobserve() {\n // do nothing\n }\n\n disconnect() {\n // do nothing\n }\n}\n\nwindow.ResizeObserver = ResizeObserver;\n"],"mappings":";;;;;;AAAA;AACA,OAAO,6BAA6B;AAEpC,OAAO,2BAA2B;AAAC,IAE7BA,cAAc;EAAA,SAAAA,eAAA;IAAAC,eAAA,OAAAD,cAAA;EAAA;EAAAE,YAAA,CAAAF,cAAA;IAAAG,GAAA;IAAAC,KAAA,EAClB,SAAAC,QAAA,EAAU;MACR;IAAA;EACD;IAAAF,GAAA;IAAAC,KAAA,EAED,SAAAE,UAAA,EAAY;MACV;IAAA;EACD;IAAAH,GAAA;IAAAC,KAAA,EAED,SAAAG,WAAA,EAAa;MACX;IAAA;EACD;EAAA,OAAAP,cAAA;AAAA;AAGHQ,MAAM,CAACR,cAAc,GAAGA,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types related to bootstrap components
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from 'react-bootstrap/esm/helpers';
|
|
6
|
+
/**
|
|
7
|
+
* Type helper for defining props of a component that wraps a bootstrap
|
|
8
|
+
* component. This type defines three props:
|
|
9
|
+
* 1. `className`: this component accepts additional CSS classes.
|
|
10
|
+
* 2. `bsPrefix`: locally change the class name prefix used for this component.
|
|
11
|
+
* 3. `as`: optionally specify which HTML element or Component is used, e.g. `"div"`
|
|
12
|
+
*
|
|
13
|
+
* This type assumes no `children` are allowed, but you can extend it to allow children.
|
|
14
|
+
*/
|
|
15
|
+
export type BsPropsWithAs<As extends React.ElementType = React.ElementType> = BsPrefixProps<As>;
|
|
16
|
+
/**
|
|
17
|
+
* This is a helper that can be used to define the type of a Paragon component
|
|
18
|
+
* that accepts an `as` prop.
|
|
19
|
+
*
|
|
20
|
+
* It:
|
|
21
|
+
* - assumes you are using `forwardRef`, and sets the type of the `ref` prop
|
|
22
|
+
* to match the type of the component passed in the `as` prop.
|
|
23
|
+
* - assumes you are passing all unused props to the component, so adds any
|
|
24
|
+
* props from the `as` component type to the props you specify as `Props`.
|
|
25
|
+
*
|
|
26
|
+
* Example;
|
|
27
|
+
* ```
|
|
28
|
+
* interface MyProps extends BsPropsWithAs {
|
|
29
|
+
* customProp?: string;
|
|
30
|
+
* }
|
|
31
|
+
* export const MyComponent: ComponentWithAsProp<'div', MyProps> = (
|
|
32
|
+
* React.forwardRef<HTMLDivElement, MyProps>(
|
|
33
|
+
* ({ as: Inner = 'div', ...props }, ref) => <Inner {...props} ref={ref} />,
|
|
34
|
+
* )
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
* Note that you need to define the default (e.g. `'div'`) in three different places.
|
|
38
|
+
*/
|
|
39
|
+
export type ComponentWithAsProp<DefaultElementType extends React.ElementType, Props> = BsPrefixRefForwardingComponent<DefaultElementType, Props>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","names":[],"sources":["../../../src/utils/types/bootstrap.ts"],"sourcesContent":["/**\n * Types related to bootstrap components\n */\nimport React from 'react';\n\nimport type { BsPrefixProps, BsPrefixRefForwardingComponent } from 'react-bootstrap/esm/helpers';\n\n/**\n * Type helper for defining props of a component that wraps a bootstrap\n * component. This type defines three props:\n * 1. `className`: this component accepts additional CSS classes.\n * 2. `bsPrefix`: locally change the class name prefix used for this component.\n * 3. `as`: optionally specify which HTML element or Component is used, e.g. `\"div\"`\n *\n * This type assumes no `children` are allowed, but you can extend it to allow children.\n */\nexport type BsPropsWithAs<As extends React.ElementType = React.ElementType> = BsPrefixProps<As>;\n\n/**\n * This is a helper that can be used to define the type of a Paragon component\n * that accepts an `as` prop.\n *\n * It:\n * - assumes you are using `forwardRef`, and sets the type of the `ref` prop\n * to match the type of the component passed in the `as` prop.\n * - assumes you are passing all unused props to the component, so adds any\n * props from the `as` component type to the props you specify as `Props`.\n *\n * Example;\n * ```\n * interface MyProps extends BsPropsWithAs {\n * customProp?: string;\n * }\n * export const MyComponent: ComponentWithAsProp<'div', MyProps> = (\n * React.forwardRef<HTMLDivElement, MyProps>(\n * ({ as: Inner = 'div', ...props }, ref) => <Inner {...props} ref={ref} />,\n * )\n * );\n * ```\n * Note that you need to define the default (e.g. `'div'`) in three different places.\n */\nexport type ComponentWithAsProp<DefaultElementType extends React.ElementType, Props>\n = BsPrefixRefForwardingComponent<DefaultElementType, Props>;\n"],"mappings":"","ignoreList":[]}
|
package/lib/build-tokens.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const minimist = require('minimist');
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
initializeStyleDictionary,
|
|
5
|
+
getTokensStudioTransforms,
|
|
6
|
+
colorTransform,
|
|
7
|
+
} = require('../tokens/style-dictionary');
|
|
4
8
|
const { createIndexCssFile } = require('../tokens/utils');
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -16,19 +20,34 @@ async function buildTokensCommand(commandArgs) {
|
|
|
16
20
|
const defaultParams = {
|
|
17
21
|
themes: ['light'],
|
|
18
22
|
'build-dir': './build/',
|
|
23
|
+
'source-tokens-only': false,
|
|
24
|
+
'output-references': true,
|
|
25
|
+
verbose: false,
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
const alias = {
|
|
22
29
|
'build-dir': 'b',
|
|
23
30
|
themes: 't',
|
|
31
|
+
verbose: '-v',
|
|
24
32
|
};
|
|
25
33
|
|
|
26
34
|
const {
|
|
27
35
|
'build-dir': buildDir,
|
|
28
36
|
source: tokensSource,
|
|
29
|
-
'source-tokens-only':
|
|
37
|
+
'source-tokens-only': transformSourceTokensOnly,
|
|
38
|
+
'output-references': outputReferences,
|
|
30
39
|
themes,
|
|
31
|
-
|
|
40
|
+
verbose,
|
|
41
|
+
} = minimist(
|
|
42
|
+
commandArgs,
|
|
43
|
+
{
|
|
44
|
+
alias,
|
|
45
|
+
default: defaultParams,
|
|
46
|
+
boolean: ['source-tokens-only', 'output-references', 'verbose'],
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const StyleDictionary = await initializeStyleDictionary({ themes });
|
|
32
51
|
|
|
33
52
|
const coreConfig = {
|
|
34
53
|
include: [
|
|
@@ -38,36 +57,42 @@ async function buildTokensCommand(commandArgs) {
|
|
|
38
57
|
source: tokensSource
|
|
39
58
|
? [`${tokensSource}/core/**/*.json`, `${tokensSource}/core/**/*.toml`]
|
|
40
59
|
: [],
|
|
60
|
+
preprocessors: ['pgn-annotate-token-extensions-with-references', 'tokens-studio'],
|
|
61
|
+
expand: {
|
|
62
|
+
typesMap: (await getTokensStudioTransforms()).expandTypesMap,
|
|
63
|
+
},
|
|
41
64
|
platforms: {
|
|
42
65
|
css: {
|
|
43
66
|
prefix: 'pgn',
|
|
44
|
-
transformGroup: 'css',
|
|
67
|
+
transformGroup: 'paragon-css',
|
|
45
68
|
// NOTE: buildPath must end with a slash
|
|
46
69
|
buildPath: buildDir.slice(-1) === '/' ? buildDir : `${buildDir}/`,
|
|
70
|
+
options: {
|
|
71
|
+
fileHeader: 'customFileHeader',
|
|
72
|
+
},
|
|
47
73
|
files: [
|
|
48
74
|
{
|
|
49
75
|
format: 'css/custom-variables',
|
|
50
76
|
destination: 'core/variables.css',
|
|
51
|
-
filter:
|
|
77
|
+
filter: transformSourceTokensOnly ? 'isSource' : undefined,
|
|
52
78
|
options: {
|
|
53
|
-
outputReferences
|
|
79
|
+
outputReferences,
|
|
54
80
|
},
|
|
55
81
|
},
|
|
56
82
|
{
|
|
57
83
|
format: 'css/custom-media-breakpoints',
|
|
58
84
|
destination: 'core/custom-media-breakpoints.css',
|
|
59
|
-
filter:
|
|
85
|
+
filter: transformSourceTokensOnly ? 'isSource' : undefined,
|
|
60
86
|
options: {
|
|
61
|
-
outputReferences
|
|
87
|
+
outputReferences,
|
|
62
88
|
},
|
|
63
89
|
},
|
|
64
90
|
],
|
|
65
|
-
transforms: StyleDictionary.transformGroup.css.filter(item => item !== 'size/rem').concat('color/sass-color-functions', 'str-replace'),
|
|
66
|
-
options: {
|
|
67
|
-
fileHeader: 'customFileHeader',
|
|
68
|
-
},
|
|
69
91
|
},
|
|
70
92
|
},
|
|
93
|
+
log: {
|
|
94
|
+
verbosity: verbose ? 'verbose' : 'default',
|
|
95
|
+
},
|
|
71
96
|
};
|
|
72
97
|
|
|
73
98
|
const getStyleDictionaryConfig = (themeVariant) => ({
|
|
@@ -85,16 +110,10 @@ async function buildTokensCommand(commandArgs) {
|
|
|
85
110
|
: [],
|
|
86
111
|
transform: {
|
|
87
112
|
'color/sass-color-functions': {
|
|
88
|
-
...StyleDictionary.
|
|
89
|
-
|
|
113
|
+
...StyleDictionary.hooks.transforms['color/sass-color-functions'],
|
|
114
|
+
transform: (token) => colorTransform(token, themeVariant),
|
|
90
115
|
},
|
|
91
116
|
},
|
|
92
|
-
format: {
|
|
93
|
-
'css/custom-variables': formatterArgs => createCustomCSSVariables({
|
|
94
|
-
formatterArgs,
|
|
95
|
-
themeVariant,
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
117
|
platforms: {
|
|
99
118
|
css: {
|
|
100
119
|
...coreConfig.platforms.css,
|
|
@@ -102,17 +121,19 @@ async function buildTokensCommand(commandArgs) {
|
|
|
102
121
|
{
|
|
103
122
|
format: 'css/custom-variables',
|
|
104
123
|
destination: `themes/${themeVariant}/variables.css`,
|
|
105
|
-
filter:
|
|
124
|
+
filter: transformSourceTokensOnly
|
|
125
|
+
? `isSource.${themeVariant}`
|
|
126
|
+
: `isThemeVariant.${themeVariant}`,
|
|
106
127
|
options: {
|
|
107
|
-
outputReferences
|
|
128
|
+
outputReferences,
|
|
108
129
|
},
|
|
109
130
|
},
|
|
110
131
|
{
|
|
111
132
|
format: 'css/utility-classes',
|
|
112
133
|
destination: `themes/${themeVariant}/utility-classes.css`,
|
|
113
|
-
filter:
|
|
134
|
+
filter: transformSourceTokensOnly ? 'isSource' : undefined,
|
|
114
135
|
options: {
|
|
115
|
-
outputReferences
|
|
136
|
+
outputReferences,
|
|
116
137
|
},
|
|
117
138
|
},
|
|
118
139
|
],
|
|
@@ -120,14 +141,29 @@ async function buildTokensCommand(commandArgs) {
|
|
|
120
141
|
},
|
|
121
142
|
});
|
|
122
143
|
|
|
123
|
-
|
|
124
|
-
|
|
144
|
+
// Create list of style-dictionary configurations to build (core + theme variants)
|
|
145
|
+
const configs = [
|
|
146
|
+
{ config: coreConfig },
|
|
147
|
+
...themes.map((themeVariant) => {
|
|
148
|
+
const config = getStyleDictionaryConfig(themeVariant);
|
|
149
|
+
return {
|
|
150
|
+
config,
|
|
151
|
+
themeVariant,
|
|
152
|
+
};
|
|
153
|
+
}),
|
|
154
|
+
];
|
|
125
155
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
StyleDictionary
|
|
129
|
-
|
|
130
|
-
|
|
156
|
+
// Build tokens for each configuration
|
|
157
|
+
await Promise.all(configs.map(async ({ config, themeVariant }) => {
|
|
158
|
+
const sd = new StyleDictionary(config);
|
|
159
|
+
await sd.cleanAllPlatforms();
|
|
160
|
+
await sd.buildAllPlatforms();
|
|
161
|
+
createIndexCssFile({
|
|
162
|
+
buildDir,
|
|
163
|
+
isThemeVariant: !!themeVariant,
|
|
164
|
+
themeVariant,
|
|
165
|
+
});
|
|
166
|
+
}));
|
|
131
167
|
}
|
|
132
168
|
|
|
133
169
|
module.exports = buildTokensCommand;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openedx/paragon",
|
|
3
|
-
"version": "23.0.0-alpha.
|
|
3
|
+
"version": "23.0.0-alpha.4",
|
|
4
4
|
"description": "Accessible, responsive UI component library based on Bootstrap.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -51,11 +51,14 @@
|
|
|
51
51
|
"playroom:build": "npm run playroom:build --workspace=www",
|
|
52
52
|
"prepare": "husky || true",
|
|
53
53
|
"build-tokens": "./bin/paragon-scripts.js build-tokens --build-dir ./styles/css",
|
|
54
|
+
"build-tokens:watch": "npx nodemon --ignore styles/css -x \"npm run build-tokens\"",
|
|
54
55
|
"replace-variables-usage-with-css": "./bin/paragon-scripts.js replace-variables -p src -t usage",
|
|
55
|
-
"replace-variables-definition-with-css": "./bin/paragon-scripts.js replace-variables -p src -t definition"
|
|
56
|
+
"replace-variables-definition-with-css": "./bin/paragon-scripts.js replace-variables -p src -t definition",
|
|
57
|
+
"cli:help": "./bin/paragon-scripts.js help"
|
|
56
58
|
},
|
|
57
59
|
"dependencies": {
|
|
58
60
|
"@popperjs/core": "^2.11.4",
|
|
61
|
+
"@tokens-studio/sd-transforms": "^1.2.4",
|
|
59
62
|
"axios": "^0.27.2",
|
|
60
63
|
"bootstrap": "^4.6.2",
|
|
61
64
|
"chalk": "^4.1.2",
|
|
@@ -93,7 +96,7 @@
|
|
|
93
96
|
"react-table": "^7.7.0",
|
|
94
97
|
"react-transition-group": "^4.4.2",
|
|
95
98
|
"sass": "^1.58.3",
|
|
96
|
-
"style-dictionary": "^
|
|
99
|
+
"style-dictionary": "^4.0.1",
|
|
97
100
|
"tabbable": "^5.3.3",
|
|
98
101
|
"uncontrollable": "^7.2.1",
|
|
99
102
|
"uuid": "^9.0.0"
|
|
@@ -114,7 +117,7 @@
|
|
|
114
117
|
"@babel/preset-typescript": "^7.16.7",
|
|
115
118
|
"@edx/eslint-config": "^3.2.0",
|
|
116
119
|
"@edx/stylelint-config-edx": "^2.3.0",
|
|
117
|
-
"@edx/typescript-config": "^1.0
|
|
120
|
+
"@edx/typescript-config": "^1.1.0",
|
|
118
121
|
"@formatjs/cli": "^5.0.2",
|
|
119
122
|
"@semantic-release/changelog": "^6.0.1",
|
|
120
123
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -123,8 +126,8 @@
|
|
|
123
126
|
"@testing-library/react-hooks": "^8.0.1",
|
|
124
127
|
"@testing-library/user-event": "^13.5.0",
|
|
125
128
|
"@types/jest": "^29.5.10",
|
|
126
|
-
"@types/react": "17.0.
|
|
127
|
-
"@types/react-dom": "17.0.11",
|
|
129
|
+
"@types/react": "^17.0.80",
|
|
130
|
+
"@types/react-dom": "^17.0.11",
|
|
128
131
|
"@types/react-responsive": "^8.0.8",
|
|
129
132
|
"@types/react-table": "^7.7.19",
|
|
130
133
|
"@types/react-test-renderer": "^18.0.0",
|
|
@@ -169,7 +172,7 @@
|
|
|
169
172
|
"^.+\\.tsx?$": "ts-jest"
|
|
170
173
|
},
|
|
171
174
|
"setupFilesAfterEnv": [
|
|
172
|
-
"./src/setupTest.
|
|
175
|
+
"./src/setupTest.ts"
|
|
173
176
|
],
|
|
174
177
|
"moduleNameMapper": {
|
|
175
178
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
|
|
@@ -180,7 +183,7 @@
|
|
|
180
183
|
],
|
|
181
184
|
"coveragePathIgnorePatterns": [
|
|
182
185
|
"/node_modules/",
|
|
183
|
-
"src/setupTest.
|
|
186
|
+
"src/setupTest.ts",
|
|
184
187
|
"src/index.js",
|
|
185
188
|
"/tests/",
|
|
186
189
|
"/www/",
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
@import "mixins";
|
|
2
2
|
|
|
3
|
+
:root {
|
|
4
|
+
--pgn-elevation-annotation-box-shadow:
|
|
5
|
+
drop-shadow(
|
|
6
|
+
var(--pgn-elevation-annotation-box-shadow-1-offset-x)
|
|
7
|
+
var(--pgn-elevation-annotation-box-shadow-1-offset-y)
|
|
8
|
+
var(--pgn-elevation-annotation-box-shadow-1-blur)
|
|
9
|
+
var(--pgn-elevation-annotation-box-shadow-1-color)
|
|
10
|
+
)
|
|
11
|
+
drop-shadow(
|
|
12
|
+
var(--pgn-elevation-annotation-box-shadow-2-offset-x)
|
|
13
|
+
var(--pgn-elevation-annotation-box-shadow-2-offset-y)
|
|
14
|
+
var(--pgn-elevation-annotation-box-shadow-2-blur)
|
|
15
|
+
var(--pgn-elevation-annotation-box-shadow-2-color)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
.pgn__annotation {
|
|
4
20
|
padding: var(--pgn-spacing-annotation-padding);
|
|
5
21
|
border-radius: var(--pgn-size-annotation-border-radius);
|
|
@@ -30,7 +30,7 @@ describe('<Button />', () => {
|
|
|
30
30
|
|
|
31
31
|
it('renders with props iconAfter and size', () => {
|
|
32
32
|
const tree = renderer.create((
|
|
33
|
-
<Button iconAfter={Close} size="
|
|
33
|
+
<Button iconAfter={Close} size="sm">Button</Button>
|
|
34
34
|
)).toJSON();
|
|
35
35
|
expect(tree).toMatchSnapshot();
|
|
36
36
|
});
|
|
@@ -94,9 +94,21 @@ describe('<Button />', () => {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
test('test button as hyperlink', () => {
|
|
97
|
-
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
98
|
+
const ref = (_current: HTMLAnchorElement) => {}; // Check typing of a ref - should not show type errors.
|
|
99
|
+
render(<Button as={Hyperlink} ref={ref} destination="https://www.poop.com/💩">Button</Button>);
|
|
98
100
|
expect(screen.getByRole('link').getAttribute('href')).toEqual('https://www.poop.com/💩');
|
|
99
101
|
});
|
|
100
102
|
});
|
|
103
|
+
|
|
104
|
+
test('with size="inline"', () => {
|
|
105
|
+
const tree = renderer.create((
|
|
106
|
+
<p>
|
|
107
|
+
<span className="mr-1">2 items selected.</span>
|
|
108
|
+
<Button variant="link" size="inline">Clear</Button>
|
|
109
|
+
</p>
|
|
110
|
+
)).toJSON();
|
|
111
|
+
expect(tree).toMatchSnapshot();
|
|
112
|
+
});
|
|
101
113
|
});
|
|
102
114
|
});
|
|
@@ -55,13 +55,13 @@ exports[`<Button /> correct rendering renders with props iconAfter 1`] = `
|
|
|
55
55
|
|
|
56
56
|
exports[`<Button /> correct rendering renders with props iconAfter and size 1`] = `
|
|
57
57
|
<button
|
|
58
|
-
className="btn btn-primary btn-
|
|
58
|
+
className="btn btn-primary btn-sm"
|
|
59
59
|
disabled={false}
|
|
60
60
|
type="button"
|
|
61
61
|
>
|
|
62
62
|
Button
|
|
63
63
|
<span
|
|
64
|
-
className="pgn__icon
|
|
64
|
+
className="pgn__icon pgn__icon__sm btn-icon-after"
|
|
65
65
|
>
|
|
66
66
|
<svg
|
|
67
67
|
aria-hidden={true}
|
|
@@ -197,3 +197,20 @@ exports[`<Button /> correct rendering renders without props 1`] = `
|
|
|
197
197
|
Button
|
|
198
198
|
</button>
|
|
199
199
|
`;
|
|
200
|
+
|
|
201
|
+
exports[`<Button /> correct rendering with size="inline" 1`] = `
|
|
202
|
+
<p>
|
|
203
|
+
<span
|
|
204
|
+
className="mr-1"
|
|
205
|
+
>
|
|
206
|
+
2 items selected.
|
|
207
|
+
</span>
|
|
208
|
+
<button
|
|
209
|
+
className="btn btn-link btn-inline"
|
|
210
|
+
disabled={false}
|
|
211
|
+
type="button"
|
|
212
|
+
>
|
|
213
|
+
Clear
|
|
214
|
+
</button>
|
|
215
|
+
</p>
|
|
216
|
+
`;
|
|
@@ -1,31 +1,55 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
2
|
+
import PropTypes, { type Requireable } from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import BaseButton from 'react-bootstrap/Button';
|
|
5
|
-
import BaseButtonGroup from 'react-bootstrap/ButtonGroup';
|
|
6
|
-
import BaseButtonToolbar from 'react-bootstrap/ButtonToolbar';
|
|
4
|
+
import BaseButton, { type ButtonProps as BaseButtonProps } from 'react-bootstrap/Button';
|
|
5
|
+
import BaseButtonGroup, { type ButtonGroupProps as BaseButtonGroupProps } from 'react-bootstrap/ButtonGroup';
|
|
6
|
+
import BaseButtonToolbar, { type ButtonToolbarProps } from 'react-bootstrap/ButtonToolbar';
|
|
7
|
+
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
7
8
|
|
|
8
9
|
import Icon from '../Icon';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
interface ButtonProps extends Omit<BaseButtonProps, 'size'> {
|
|
12
|
+
/**
|
|
13
|
+
* An icon component to render. Example:
|
|
14
|
+
* ```
|
|
15
|
+
* import { Close } from '@openedx/paragon/icons';
|
|
16
|
+
* <Button iconBefore={Close}>Close</Button>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
iconBefore?: React.ComponentType;
|
|
20
|
+
/**
|
|
21
|
+
* An icon component to render. Example:
|
|
22
|
+
* ```
|
|
23
|
+
* import { Close } from '@openedx/paragon/icons';
|
|
24
|
+
* <Button iconAfter={Close}>Close</Button>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
iconAfter?: React.ComponentType;
|
|
28
|
+
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type ButtonType = ComponentWithAsProp<'button', ButtonProps> & { Deprecated?: any };
|
|
32
|
+
|
|
33
|
+
const Button: ButtonType = React.forwardRef<HTMLButtonElement, ButtonProps>(({
|
|
11
34
|
children,
|
|
12
35
|
iconAfter,
|
|
13
36
|
iconBefore,
|
|
37
|
+
size,
|
|
14
38
|
...props
|
|
15
39
|
}, ref) => (
|
|
16
40
|
<BaseButton
|
|
41
|
+
size={size as 'sm' | 'lg' | undefined} // Bootstrap's <Button> types do not allow 'md' or 'inline', but we do.
|
|
17
42
|
{...props}
|
|
18
43
|
className={classNames(props.className)}
|
|
19
44
|
ref={ref}
|
|
20
45
|
>
|
|
21
|
-
{iconBefore && <Icon className="btn-icon-before" size={
|
|
46
|
+
{iconBefore && <Icon className="btn-icon-before" size={size} src={iconBefore} />}
|
|
22
47
|
{children}
|
|
23
|
-
{iconAfter && <Icon className="btn-icon-after" size={
|
|
48
|
+
{iconAfter && <Icon className="btn-icon-after" size={size} src={iconAfter} />}
|
|
24
49
|
</BaseButton>
|
|
25
50
|
));
|
|
26
51
|
|
|
27
52
|
Button.propTypes = {
|
|
28
|
-
...Button.propTypes,
|
|
29
53
|
/** Specifies class name to apply to the button */
|
|
30
54
|
className: PropTypes.string,
|
|
31
55
|
/** Disables the Button, preventing mouse events, even if the underlying component is an `<a>` element */
|
|
@@ -51,10 +75,13 @@ Button.propTypes = {
|
|
|
51
75
|
variant: PropTypes.string,
|
|
52
76
|
/** An icon component to render.
|
|
53
77
|
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */
|
|
54
|
-
iconBefore: PropTypes.
|
|
78
|
+
iconBefore: PropTypes.elementType as Requireable<React.ComponentType>,
|
|
55
79
|
/** An icon component to render.
|
|
56
80
|
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */
|
|
57
|
-
iconAfter: PropTypes.
|
|
81
|
+
iconAfter: PropTypes.elementType as Requireable<React.ComponentType>,
|
|
82
|
+
// The 'as' type casting above is required for TypeScript checking, because the 'PropTypes.elementType' type normally
|
|
83
|
+
// allows strings as a value (for use cases like 'div') but we don't support that for <Icon />/iconBefore/iconAfter.
|
|
84
|
+
// The React TypeScript type definitions are more specific (React.ComponentType vs React.ElementType).
|
|
58
85
|
};
|
|
59
86
|
|
|
60
87
|
Button.defaultProps = {
|
|
@@ -66,20 +93,29 @@ Button.defaultProps = {
|
|
|
66
93
|
disabled: false,
|
|
67
94
|
};
|
|
68
95
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
96
|
+
// We could just re-export 'ButtonGroup' and 'ButtonToolbar', but we currently
|
|
97
|
+
// override them to add propTypes validation at runtime, since most Paragon
|
|
98
|
+
// consumers aren't using TypeScript yet. We also force ButtonGroup's 'size'
|
|
99
|
+
// prop to accept our custom values of 'md' and 'inline' which are used in
|
|
100
|
+
// Paragon but not used in the base Bootstrap classes.
|
|
101
|
+
|
|
102
|
+
interface ButtonGroupProps extends Omit<BaseButtonGroupProps, 'size'> {
|
|
103
|
+
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
74
104
|
}
|
|
75
105
|
|
|
106
|
+
const ButtonGroup: ComponentWithAsProp<'div', ButtonGroupProps> = (
|
|
107
|
+
React.forwardRef<HTMLButtonElement, ButtonGroupProps>(({ size, ...props }, ref) => (
|
|
108
|
+
<BaseButtonGroup size={size as 'sm' | 'lg'} {...props} ref={ref} />
|
|
109
|
+
))
|
|
110
|
+
);
|
|
111
|
+
|
|
76
112
|
ButtonGroup.propTypes = {
|
|
77
113
|
/** Specifies element type for this component. */
|
|
78
114
|
as: PropTypes.elementType,
|
|
79
115
|
/** An ARIA role describing the button group. */
|
|
80
116
|
role: PropTypes.string,
|
|
81
117
|
/** Specifies the size for all Buttons in the group. */
|
|
82
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
118
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg', 'inline']),
|
|
83
119
|
/** Display as a button toggle group. */
|
|
84
120
|
toggle: PropTypes.bool,
|
|
85
121
|
/** Specifies if the set of Buttons should appear vertically stacked. */
|
|
@@ -97,6 +133,12 @@ ButtonGroup.defaultProps = {
|
|
|
97
133
|
size: 'md',
|
|
98
134
|
};
|
|
99
135
|
|
|
136
|
+
const ButtonToolbar: ComponentWithAsProp<'div', ButtonToolbarProps> = (
|
|
137
|
+
React.forwardRef<HTMLButtonElement, ButtonToolbarProps>((props, ref) => (
|
|
138
|
+
<BaseButtonToolbar {...props} ref={ref} />
|
|
139
|
+
))
|
|
140
|
+
);
|
|
141
|
+
|
|
100
142
|
ButtonToolbar.propTypes = {
|
|
101
143
|
/** An ARIA role describing the button group. */
|
|
102
144
|
role: PropTypes.string,
|
package/src/Card/CardDeck.jsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Children, useMemo } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import BaseCardDeck from 'react-bootstrap/CardDeck';
|
|
5
4
|
import Row from 'react-bootstrap/Row';
|
|
6
5
|
import Col from 'react-bootstrap/Col';
|
|
7
6
|
import { useOverflowScrollItems } from '../OverflowScroll';
|
|
@@ -102,6 +101,4 @@ CardDeck.defaultProps = {
|
|
|
102
101
|
hasEqualColumnHeights: true,
|
|
103
102
|
};
|
|
104
103
|
|
|
105
|
-
CardDeck.Deprecated = BaseCardDeck;
|
|
106
|
-
|
|
107
104
|
export default CardDeck;
|
package/src/Card/README.md
CHANGED
|
@@ -899,37 +899,6 @@ For accessibility, if the child `Card` components are interactive (e.g., `isClic
|
|
|
899
899
|
}
|
|
900
900
|
```
|
|
901
901
|
|
|
902
|
-
### CardDeck.Deprecated
|
|
903
|
-
|
|
904
|
-
Gives any child `Card` components equal height with an appropriate gutter between cards. Each child `Card` component's width will be adjusted (e.g., become more narrow) to ensure all `Card` components fit within its parent's width.
|
|
905
|
-
|
|
906
|
-
Note: This component is a pass-thru from `react-bootstrap`.
|
|
907
|
-
|
|
908
|
-
```jsx live
|
|
909
|
-
() => {
|
|
910
|
-
const CardComponent = () => (
|
|
911
|
-
<Card>
|
|
912
|
-
<Card.ImageCap
|
|
913
|
-
src="https://picsum.photos/360/200/"
|
|
914
|
-
srcAlt="Card image"
|
|
915
|
-
/>
|
|
916
|
-
<Card.Header title="Card title" />
|
|
917
|
-
<Card.Section title="Section title">
|
|
918
|
-
<HipsterIpsum numShortParagraphs={1} />
|
|
919
|
-
</Card.Section>
|
|
920
|
-
</Card>
|
|
921
|
-
);
|
|
922
|
-
|
|
923
|
-
return (
|
|
924
|
-
<CardDeck.Deprecated>
|
|
925
|
-
<CardComponent />
|
|
926
|
-
<CardComponent />
|
|
927
|
-
<CardComponent />
|
|
928
|
-
</CardDeck.Deprecated>
|
|
929
|
-
)
|
|
930
|
-
}
|
|
931
|
-
```
|
|
932
|
-
|
|
933
902
|
## CardCarousel
|
|
934
903
|
|
|
935
904
|
Extends `CardDeck` to support navigating between any overflow `Card` components via left and right `IconButton` components as a scrollable carousel.
|
package/src/Card/index.scss
CHANGED
|
@@ -136,11 +136,11 @@ a.pgn__card {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
.pgn__card-header-title-sm {
|
|
139
|
-
font-size: var(--pgn-typography-font-size-h4);
|
|
139
|
+
font-size: var(--pgn-typography-font-size-h4-base);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.pgn__card-header-title-md {
|
|
143
|
-
font-size: var(--pgn-typography-font-size-h3);
|
|
143
|
+
font-size: var(--pgn-typography-font-size-h3-base);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
%header-subtitle {
|
|
@@ -155,11 +155,11 @@ a.pgn__card {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
.pgn__card-header-subtitle-sm {
|
|
158
|
-
font-size: var(--pgn-typography-font-size-h5);
|
|
158
|
+
font-size: var(--pgn-typography-font-size-h5-base);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.pgn__card-header-subtitle-md {
|
|
162
|
-
font-size: var(--pgn-typography-font-size-h4);
|
|
162
|
+
font-size: var(--pgn-typography-font-size-h4-base);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.pgn__card-header-actions {
|
|
@@ -271,7 +271,7 @@ a.pgn__card {
|
|
|
271
271
|
.pgn__card-section-title {
|
|
272
272
|
color: var(--pgn-color-black);
|
|
273
273
|
font-weight: var(--pgn-typography-font-weight-bold);
|
|
274
|
-
font-size: var(--pgn-typography-font-size-h5);
|
|
274
|
+
font-size: var(--pgn-typography-font-size-h5-base);
|
|
275
275
|
margin-bottom: var(--pgn-spacing-card-spacer-y);
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -392,7 +392,7 @@ a.pgn__card {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
.pgn__card-status__heading {
|
|
395
|
-
font-size: var(--pgn-typography-font-size-h4);
|
|
395
|
+
font-size: var(--pgn-typography-font-size-h4-base);
|
|
396
396
|
color: var(--pgn-color-black);
|
|
397
397
|
display: flex;
|
|
398
398
|
font-weight: var(--pgn-typography-font-weight-bold);
|
package/src/Carousel/index.scss
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--pgn-transition-carousel-base:
|
|
3
|
+
var(--pgn-transition-carousel-base-property)
|
|
4
|
+
var(--pgn-transition-carousel-base-duration)
|
|
5
|
+
var(--pgn-transition-carousel-base-timing-function)
|
|
6
|
+
var(--pgn-transition-carousel-base-delay)
|
|
7
|
+
var(--pgn-transition-carousel-base-behavior);
|
|
8
|
+
|
|
9
|
+
--pgn-transition-carousel-indicator:
|
|
10
|
+
var(--pgn-transition-carousel-indicator-property)
|
|
11
|
+
var(--pgn-transition-carousel-indicator-duration)
|
|
12
|
+
var(--pgn-transition-carousel-indicator-timing-function)
|
|
13
|
+
var(--pgn-transition-carousel-indicator-delay)
|
|
14
|
+
var(--pgn-transition-carousel-indicator-behavior);
|
|
15
|
+
|
|
16
|
+
--pgn-transition-carousel-control:
|
|
17
|
+
var(--pgn-transition-carousel-control-property)
|
|
18
|
+
var(--pgn-transition-carousel-control-duration)
|
|
19
|
+
var(--pgn-transition-carousel-control-timing-function)
|
|
20
|
+
var(--pgn-transition-carousel-control-delay)
|
|
21
|
+
var(--pgn-transition-carousel-control-behavior);
|
|
22
|
+
}
|
|
23
|
+
|
|
1
24
|
.carousel {
|
|
2
25
|
position: relative;
|
|
3
26
|
}
|
|
@@ -58,7 +81,7 @@
|
|
|
58
81
|
.active.carousel-item-right {
|
|
59
82
|
z-index: 0;
|
|
60
83
|
opacity: 0;
|
|
61
|
-
transition:
|
|
84
|
+
transition: var(--pgn-transition-carousel-base);
|
|
62
85
|
}
|
|
63
86
|
}
|
|
64
87
|
|