@openedx/paragon 23.0.0-alpha.1 → 23.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -22
- 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/Button/index.scss +0 -2
- 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/Chip/index.scss +6 -5
- package/dist/Chip/mixins.scss +4 -4
- package/dist/ChipCarousel/index.js +0 -2
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/Collapsible/index.scss +3 -3
- 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/Modal/ModalPopup.js +7 -1
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/_ModalDialog.scss +4 -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/Stepper/index.scss +3 -2
- package/dist/Tabs/index.scss +9 -6
- package/dist/Tooltip/index.d.ts +7 -0
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/core.css +22 -30
- 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 +11 -11
- 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 +18 -4
- package/package.json +6 -5
- 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.scss +0 -2
- package/src/Button/{index.jsx → index.tsx} +58 -16
- 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.scss +6 -5
- package/src/Chip/index.tsx +6 -8
- package/src/Chip/mixins.scss +4 -4
- package/src/ChipCarousel/index.tsx +0 -2
- package/src/Collapsible/index.scss +3 -3
- 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.jsx → index.tsx} +66 -26
- package/src/Modal/ModalPopup.jsx +9 -1
- package/src/Modal/_ModalDialog.scss +4 -0
- package/src/Modal/tests/ModalPopupNoMock.test.jsx +29 -0
- package/src/Overlay/{index.jsx → index.tsx} +13 -8
- package/src/Stepper/index.scss +3 -2
- package/src/Tabs/index.scss +9 -6
- 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/variables.css +11 -22
- package/styles/css/themes/light/variables.css +11 -11
- package/styles/scss/core/_variables.scss +4 -5
- package/styles/scss/core/core.scss +1 -1
- package/tokens/README.md +1 -2
- package/tokens/src/core/alias/size.json +3 -3
- package/tokens/src/core/components/Breadcrumb.json +0 -14
- package/tokens/src/core/components/Card.json +6 -1
- package/tokens/src/core/components/Chip.json +4 -6
- package/tokens/src/core/components/ColorPicker.json +2 -2
- package/tokens/src/core/components/DataTable.json +1 -1
- package/tokens/src/core/components/Form/size.json +3 -7
- package/tokens/src/core/components/Nav.json +0 -3
- package/tokens/src/core/components/Pagination.json +0 -4
- package/tokens/src/core/components/ProductTour.json +0 -5
- package/tokens/src/core/global/display.json +2 -1
- package/tokens/src/core/global/spacing.json +7 -5
- package/tokens/src/themes/light/alias/color.json +2 -2
- package/tokens/src/themes/light/components/Alert.json +0 -9
- package/tokens/src/themes/light/components/Annotation.json +11 -11
- package/tokens/src/themes/light/components/Avatar.json +1 -1
- package/tokens/src/themes/light/components/Breadcrumb.json +0 -1
- package/tokens/src/themes/light/components/Card.json +2 -6
- package/tokens/src/themes/light/components/DataTable.json +1 -1
- package/tokens/src/themes/light/components/Form/color.json +4 -4
- package/tokens/src/themes/light/components/Form/elevation.json +1 -1
- package/tokens/src/themes/light/components/Form/other.json +3 -3
- package/tokens/src/themes/light/components/general/input.json +1 -1
- package/tokens/src/themes/light/components/general/link.json +1 -1
- package/tokens/src/themes/light/components/general/list.json +1 -1
- package/tokens/src/themes/light/components/general/text.json +7 -1
- package/tokens/src/themes/light/global/color.json +2 -2
- package/tokens/style-dictionary.js +6 -0
- package/src/IconButton/__snapshots__/IconButton.test.jsx.snap +0 -20
- /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
package/README.md
CHANGED
|
@@ -39,29 +39,39 @@ In your React project:
|
|
|
39
39
|
import { ComponentName } from '@openedx/paragon';
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
####
|
|
42
|
+
#### CSS Foundation
|
|
43
43
|
|
|
44
|
-
Usage
|
|
44
|
+
**Usage with no theme:**
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
The Paragon CSS Foundation offers a collection of fundamental styles, encompassing padding, typography, and sizing.
|
|
47
|
+
When applied, these styles contribute to the creation of a straightforward and neat appearance for your application.
|
|
48
|
+
|
|
49
|
+
To integrate these foundational styles into your project, include the following import:
|
|
47
50
|
|
|
48
51
|
```
|
|
49
|
-
|
|
50
|
-
@import '~@openedx/paragon/styles/scss/core/core.scss';
|
|
52
|
+
@use "@openedx/paragon/dist/core.min.css";
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
Usage
|
|
55
|
+
**Usage with a theme:**
|
|
56
|
+
|
|
57
|
+
In addition to the basic styles, you can provide a theme layer that includes styles for colors, shadows, backgrounds
|
|
58
|
+
and transparency of elements. This allows you to visually represent a specific theme in your application.
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
To apply these theme-specific styles, include the following import:
|
|
56
61
|
|
|
57
62
|
```
|
|
58
|
-
@
|
|
59
|
-
@
|
|
60
|
-
@import '~@openedx/paragon/styles/scss/core/core.scss';
|
|
61
|
-
@import '~@edx/brand/paragon/overrides.scss';
|
|
63
|
+
@use "@openedx/paragon/dist/core.min.css";
|
|
64
|
+
@use "@my-brand/light.min.css";
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
**CDN links:**
|
|
68
|
+
|
|
69
|
+
Alternative style integration is available when using CDN links:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
@import url("https://cdn.jsdelivr.net/npm/@my-brand/core.min.css");
|
|
73
|
+
@import url("https://cdn.jsdelivr.net/npm/@my-brand/light.min.css");
|
|
74
|
+
```
|
|
65
75
|
|
|
66
76
|
## Paragon CLI
|
|
67
77
|
|
|
@@ -69,7 +79,8 @@ The Paragon CLI (Command Line Interface) is a tool that provides various utility
|
|
|
69
79
|
|
|
70
80
|
### Available Commands
|
|
71
81
|
|
|
72
|
-
- `paragon install-theme
|
|
82
|
+
- `paragon install-theme`: Install a [brand package](https://github.com/openedx/brand-openedx).
|
|
83
|
+
- `paragon migrate-to-openedx-scope`: Migrate from "@edx/paragon" to "@openedx/paragon".
|
|
73
84
|
- `paragon build-tokens`: Build Paragon's design tokens.
|
|
74
85
|
- `paragon replace-variables`: Replace SCSS variables usages or definitions to CSS variables and vice versa in `.scss` files.
|
|
75
86
|
- `paragon build-scss`: Compile Paragon's core and themes SCSS into CSS.
|
|
@@ -161,7 +172,7 @@ module.exports = {
|
|
|
161
172
|
};
|
|
162
173
|
```
|
|
163
174
|
|
|
164
|
-
Then, when importing Paragon's core SCSS in your MFE the import needs to begin with a tilde `~` so that path to your local Paragon repository gets resolved correctly: `@import "~@openedx/paragon/styles/scss/core";`
|
|
175
|
+
Then, when importing Paragon's core SCSS in your MFE the import needs to begin with a tilde `~` so that path to your local Paragon repository gets resolved correctly: `@import "~@openedx/paragon/styles/scss/core/core.scss";`
|
|
165
176
|
|
|
166
177
|
#### Internationalization
|
|
167
178
|
|
|
@@ -274,8 +285,7 @@ This will create a directory in `/src/` that will contain templates for all nece
|
|
|
274
285
|
MyComponent
|
|
275
286
|
├── index.jsx
|
|
276
287
|
├── README.md
|
|
277
|
-
├──
|
|
278
|
-
├── _variables.scss
|
|
288
|
+
├── index.scss
|
|
279
289
|
└── MyComponent.test.jsx
|
|
280
290
|
```
|
|
281
291
|
|
|
@@ -314,11 +324,10 @@ export default MyComponent;
|
|
|
314
324
|
##### 4. (Optional) Add styles to your component.
|
|
315
325
|
|
|
316
326
|
If your component requires additional styling (which most likely is the case), edit created SCSS style sheet in your
|
|
317
|
-
component's directory `/src/MyComponent/
|
|
327
|
+
component's directory `/src/MyComponent/index.scss` which by default contains an empty class for your component.
|
|
318
328
|
|
|
319
|
-
If you wish to use
|
|
320
|
-
easily overridden and customized by the consumers of Paragon),
|
|
321
|
-
This way the variables will also get automatically picked up by documentation site and displayed on your component's page.
|
|
329
|
+
If you wish to use CSS variables (which is the preferred way of styling the components since values can be
|
|
330
|
+
easily overridden and customized by the consumers of Paragon), you can do so by utilizing [design tokens](/tokens).
|
|
322
331
|
|
|
323
332
|
**Please note that you need to follow [Paragon's CSS styling conventions](docs/decisions/0012-css-styling-conventions).**
|
|
324
333
|
|
|
@@ -502,9 +511,9 @@ Paragon uses [style-dictionary](https://github.com/amzn/style-dictionary) to bui
|
|
|
502
511
|
6. Consuming applications would inject the `core.css` and `light.css` theme files into their applications via a mechanism similar to https://github.com/openedx/frontend-platform/pull/440 (ideally pulling from a public CDN for NPM packages, but falling back to locally installed copies, if needed).
|
|
503
512
|
|
|
504
513
|
#### Compiling CSS from design tokens for `@edx/brand` theme authors (in `@edx/brand` repos)
|
|
505
|
-
1. **`npm install`.** Install dependencies, including `@
|
|
514
|
+
1. **`npm install`.** Install dependencies, including `@openedx/paragon`.
|
|
506
515
|
2. Create tokens that will override Paragon's default tokens (matching same JSON schema).
|
|
507
|
-
3. **`npm run build-scss`.** This `@edx/brand` repo will have a new NPM script that utilizes a new CLI exported by `@
|
|
516
|
+
3. **`npm run build-scss`.** This `@edx/brand` repo will have a new NPM script that utilizes a new CLI exported by `@openedx/paragon` which exposes the `build-tokens.js` script (or possibly another if we end up needing one for the brand packages to run specifically, TBD) for `@edx/brand` consumers.
|
|
508
517
|
- The intent of running this command is to effectively deep merge the tokens defined in Paragon's default tokens with the override tokens defined by `@edx/brand`, generating its own `core.css` and `light.css` output files (exact output files still a TBD) containing CSS variable overrides based on the token overrides.
|
|
509
518
|
5. Ensure any changes to the generated `core.css` and `light.css` files are committed & released to NPM (which also "releases" them on versioned public CDNs for NPM packages).
|
|
510
519
|
- _Note: It is a bit unclear still in the above linked implementation POC for `@edx/frontend-platform` how it would integrate with `@edx/brand` in this way. Open to suggestions/feedback/ideas here._
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ButtonProps as BaseButtonProps } from 'react-bootstrap/Button';
|
|
3
|
+
import { type ButtonGroupProps as BaseButtonGroupProps } from 'react-bootstrap/ButtonGroup';
|
|
4
|
+
import { type ButtonToolbarProps } from 'react-bootstrap/ButtonToolbar';
|
|
5
|
+
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
6
|
+
interface ButtonProps extends Omit<BaseButtonProps, 'size'> {
|
|
7
|
+
/**
|
|
8
|
+
* An icon component to render. Example:
|
|
9
|
+
* ```
|
|
10
|
+
* import { Close } from '@openedx/paragon/icons';
|
|
11
|
+
* <Button iconBefore={Close}>Close</Button>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
iconBefore?: React.ComponentType;
|
|
15
|
+
/**
|
|
16
|
+
* An icon component to render. Example:
|
|
17
|
+
* ```
|
|
18
|
+
* import { Close } from '@openedx/paragon/icons';
|
|
19
|
+
* <Button iconAfter={Close}>Close</Button>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
iconAfter?: React.ComponentType;
|
|
23
|
+
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
24
|
+
}
|
|
25
|
+
type ButtonType = ComponentWithAsProp<'button', ButtonProps> & {
|
|
26
|
+
Deprecated?: any;
|
|
27
|
+
};
|
|
28
|
+
declare const Button: ButtonType;
|
|
29
|
+
interface ButtonGroupProps extends Omit<BaseButtonGroupProps, 'size'> {
|
|
30
|
+
size?: 'sm' | 'md' | 'lg' | 'inline';
|
|
31
|
+
}
|
|
32
|
+
declare const ButtonGroup: ComponentWithAsProp<'div', ButtonGroupProps>;
|
|
33
|
+
declare const ButtonToolbar: ComponentWithAsProp<'div', ButtonToolbarProps>;
|
|
34
|
+
export default Button;
|
|
35
|
+
export { ButtonGroup, ButtonToolbar };
|
package/dist/Button/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["children", "iconAfter", "iconBefore"]
|
|
2
|
+
var _excluded = ["children", "iconAfter", "iconBefore", "size"],
|
|
3
|
+
_excluded2 = ["size"];
|
|
3
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -19,21 +20,24 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
19
20
|
var children = _ref.children,
|
|
20
21
|
iconAfter = _ref.iconAfter,
|
|
21
22
|
iconBefore = _ref.iconBefore,
|
|
23
|
+
size = _ref.size,
|
|
22
24
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
return /*#__PURE__*/React.createElement(BaseButton, _extends({
|
|
25
|
+
return /*#__PURE__*/React.createElement(BaseButton, _extends({
|
|
26
|
+
size: size // Bootstrap's <Button> types do not allow 'md' or 'inline', but we do.
|
|
27
|
+
}, props, {
|
|
24
28
|
className: classNames(props.className),
|
|
25
29
|
ref: ref
|
|
26
30
|
}), iconBefore && /*#__PURE__*/React.createElement(Icon, {
|
|
27
31
|
className: "btn-icon-before",
|
|
28
|
-
size:
|
|
32
|
+
size: size,
|
|
29
33
|
src: iconBefore
|
|
30
34
|
}), children, iconAfter && /*#__PURE__*/React.createElement(Icon, {
|
|
31
35
|
className: "btn-icon-after",
|
|
32
|
-
size:
|
|
36
|
+
size: size,
|
|
33
37
|
src: iconAfter
|
|
34
38
|
}));
|
|
35
39
|
});
|
|
36
|
-
Button.propTypes =
|
|
40
|
+
Button.propTypes = {
|
|
37
41
|
/** Specifies class name to apply to the button */
|
|
38
42
|
className: PropTypes.string,
|
|
39
43
|
/** Disables the Button, preventing mouse events, even if the underlying component is an `<a>` element */
|
|
@@ -59,11 +63,14 @@ Button.propTypes = _objectSpread(_objectSpread({}, Button.propTypes), {}, {
|
|
|
59
63
|
variant: PropTypes.string,
|
|
60
64
|
/** An icon component to render.
|
|
61
65
|
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */
|
|
62
|
-
iconBefore: PropTypes.
|
|
66
|
+
iconBefore: PropTypes.elementType,
|
|
63
67
|
/** An icon component to render.
|
|
64
68
|
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */
|
|
65
|
-
iconAfter: PropTypes.
|
|
66
|
-
|
|
69
|
+
iconAfter: PropTypes.elementType
|
|
70
|
+
// The 'as' type casting above is required for TypeScript checking, because the 'PropTypes.elementType' type normally
|
|
71
|
+
// allows strings as a value (for use cases like 'div') but we don't support that for <Icon />/iconBefore/iconAfter.
|
|
72
|
+
// The React TypeScript type definitions are more specific (React.ComponentType vs React.ElementType).
|
|
73
|
+
};
|
|
67
74
|
Button.defaultProps = _objectSpread(_objectSpread({}, Button.defaultProps), {}, {
|
|
68
75
|
children: undefined,
|
|
69
76
|
className: undefined,
|
|
@@ -71,19 +78,29 @@ Button.defaultProps = _objectSpread(_objectSpread({}, Button.defaultProps), {},
|
|
|
71
78
|
iconAfter: undefined,
|
|
72
79
|
disabled: false
|
|
73
80
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
|
|
82
|
+
// We could just re-export 'ButtonGroup' and 'ButtonToolbar', but we currently
|
|
83
|
+
// override them to add propTypes validation at runtime, since most Paragon
|
|
84
|
+
// consumers aren't using TypeScript yet. We also force ButtonGroup's 'size'
|
|
85
|
+
// prop to accept our custom values of 'md' and 'inline' which are used in
|
|
86
|
+
// Paragon but not used in the base Bootstrap classes.
|
|
87
|
+
|
|
88
|
+
var ButtonGroup = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
89
|
+
var size = _ref2.size,
|
|
90
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
91
|
+
return /*#__PURE__*/React.createElement(BaseButtonGroup, _extends({
|
|
92
|
+
size: size
|
|
93
|
+
}, props, {
|
|
94
|
+
ref: ref
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
80
97
|
ButtonGroup.propTypes = {
|
|
81
98
|
/** Specifies element type for this component. */
|
|
82
99
|
as: PropTypes.elementType,
|
|
83
100
|
/** An ARIA role describing the button group. */
|
|
84
101
|
role: PropTypes.string,
|
|
85
102
|
/** Specifies the size for all Buttons in the group. */
|
|
86
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
103
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg', 'inline']),
|
|
87
104
|
/** Display as a button toggle group. */
|
|
88
105
|
toggle: PropTypes.bool,
|
|
89
106
|
/** Specifies if the set of Buttons should appear vertically stacked. */
|
|
@@ -99,6 +116,11 @@ ButtonGroup.defaultProps = {
|
|
|
99
116
|
bsPrefix: 'btn-group',
|
|
100
117
|
size: 'md'
|
|
101
118
|
};
|
|
119
|
+
var ButtonToolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
120
|
+
return /*#__PURE__*/React.createElement(BaseButtonToolbar, _extends({}, props, {
|
|
121
|
+
ref: ref
|
|
122
|
+
}));
|
|
123
|
+
});
|
|
102
124
|
ButtonToolbar.propTypes = {
|
|
103
125
|
/** An ARIA role describing the button group. */
|
|
104
126
|
role: PropTypes.string,
|
package/dist/Button/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","BaseButton","BaseButtonGroup","BaseButtonToolbar","Icon","Button","forwardRef","_ref","ref","children","iconAfter","iconBefore","props","_objectWithoutProperties","_excluded","createElement","_extends","className","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","BaseButton","BaseButtonGroup","BaseButtonToolbar","Icon","Button","forwardRef","_ref","ref","children","iconAfter","iconBefore","size","props","_objectWithoutProperties","_excluded","createElement","_extends","className","src","propTypes","string","disabled","bool","node","isRequired","onClick","func","onKeyDown","type","variant","elementType","defaultProps","_objectSpread","undefined","ButtonGroup","_ref2","_excluded2","as","role","oneOf","toggle","vertical","bsPrefix","ButtonToolbar"],"sources":["../../src/Button/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes, { type Requireable } from 'prop-types';\nimport classNames from 'classnames';\nimport BaseButton, { type ButtonProps as BaseButtonProps } from 'react-bootstrap/Button';\nimport BaseButtonGroup, { type ButtonGroupProps as BaseButtonGroupProps } from 'react-bootstrap/ButtonGroup';\nimport BaseButtonToolbar, { type ButtonToolbarProps } from 'react-bootstrap/ButtonToolbar';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nimport Icon from '../Icon';\n\ninterface ButtonProps extends Omit<BaseButtonProps, 'size'> {\n /**\n * An icon component to render. Example:\n * ```\n * import { Close } from '@openedx/paragon/icons';\n * <Button iconBefore={Close}>Close</Button>\n * ```\n */\n iconBefore?: React.ComponentType;\n /**\n * An icon component to render. Example:\n * ```\n * import { Close } from '@openedx/paragon/icons';\n * <Button iconAfter={Close}>Close</Button>\n * ```\n */\n iconAfter?: React.ComponentType;\n size?: 'sm' | 'md' | 'lg' | 'inline';\n}\n\ntype ButtonType = ComponentWithAsProp<'button', ButtonProps> & { Deprecated?: any };\n\nconst Button: ButtonType = React.forwardRef<HTMLButtonElement, ButtonProps>(({\n children,\n iconAfter,\n iconBefore,\n size,\n ...props\n}, ref) => (\n <BaseButton\n size={size as 'sm' | 'lg' | undefined} // Bootstrap's <Button> types do not allow 'md' or 'inline', but we do.\n {...props}\n className={classNames(props.className)}\n ref={ref}\n >\n {iconBefore && <Icon className=\"btn-icon-before\" size={size} src={iconBefore} />}\n {children}\n {iconAfter && <Icon className=\"btn-icon-after\" size={size} src={iconAfter} />}\n </BaseButton>\n));\n\nButton.propTypes = {\n /** Specifies class name to apply to the button */\n className: PropTypes.string,\n /** Disables the Button, preventing mouse events, even if the underlying component is an `<a>` element */\n disabled: PropTypes.bool,\n /** Specifies the text that is displayed within the button. */\n children: PropTypes.node.isRequired,\n /** A function that would specify what the button should do when the `onClick` event is triggered.\n * For example, the button could launch a `Modal`. The default is an empty function. */\n onClick: PropTypes.func,\n /** A function that would specify what the button should do when the `onKeyDown` event is triggered.\n * For example, this could handle using the `Escape` key to trigger the button's action.\n * The default is an empty function. */\n onKeyDown: PropTypes.func,\n /** Used to set the `type` attribute on the `button` tag. The default type is `button`. */\n type: PropTypes.string,\n /** Specifies variant to use.\n * Can be on of the base variants: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `dark`,\n * `light`, `link`\n *\n * as well as one of the customized variants (= base variant prefixed with `inverse-`, `outline-`\n * or `inverse-outline-`)\n * */\n variant: PropTypes.string,\n /** An icon component to render.\n * Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */\n iconBefore: PropTypes.elementType as Requireable<React.ComponentType>,\n /** An icon component to render.\n * Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';` */\n iconAfter: PropTypes.elementType as Requireable<React.ComponentType>,\n // The 'as' type casting above is required for TypeScript checking, because the 'PropTypes.elementType' type normally\n // allows strings as a value (for use cases like 'div') but we don't support that for <Icon />/iconBefore/iconAfter.\n // The React TypeScript type definitions are more specific (React.ComponentType vs React.ElementType).\n};\n\nButton.defaultProps = {\n ...Button.defaultProps,\n children: undefined,\n className: undefined,\n iconBefore: undefined,\n iconAfter: undefined,\n disabled: false,\n};\n\n// We could just re-export 'ButtonGroup' and 'ButtonToolbar', but we currently\n// override them to add propTypes validation at runtime, since most Paragon\n// consumers aren't using TypeScript yet. We also force ButtonGroup's 'size'\n// prop to accept our custom values of 'md' and 'inline' which are used in\n// Paragon but not used in the base Bootstrap classes.\n\ninterface ButtonGroupProps extends Omit<BaseButtonGroupProps, 'size'> {\n size?: 'sm' | 'md' | 'lg' | 'inline';\n}\n\nconst ButtonGroup: ComponentWithAsProp<'div', ButtonGroupProps> = (\n React.forwardRef<HTMLButtonElement, ButtonGroupProps>(({ size, ...props }, ref) => (\n <BaseButtonGroup size={size as 'sm' | 'lg'} {...props} ref={ref} />\n ))\n);\n\nButtonGroup.propTypes = {\n /** Specifies element type for this component. */\n as: PropTypes.elementType,\n /** An ARIA role describing the button group. */\n role: PropTypes.string,\n /** Specifies the size for all Buttons in the group. */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'inline']),\n /** Display as a button toggle group. */\n toggle: PropTypes.bool,\n /** Specifies if the set of Buttons should appear vertically stacked. */\n vertical: PropTypes.bool,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nButtonGroup.defaultProps = {\n as: 'div',\n role: 'group',\n toggle: false,\n vertical: false,\n bsPrefix: 'btn-group',\n size: 'md',\n};\n\nconst ButtonToolbar: ComponentWithAsProp<'div', ButtonToolbarProps> = (\n React.forwardRef<HTMLButtonElement, ButtonToolbarProps>((props, ref) => (\n <BaseButtonToolbar {...props} ref={ref} />\n ))\n);\n\nButtonToolbar.propTypes = {\n /** An ARIA role describing the button group. */\n role: PropTypes.string,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nButtonToolbar.defaultProps = {\n role: 'toolbar',\n bsPrefix: 'btn-toolbar',\n};\n\nexport default Button;\nexport { ButtonGroup, ButtonToolbar };\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAA4B,YAAY;AACxD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,UAAU,MAA+C,wBAAwB;AACxF,OAAOC,eAAe,MAAyD,6BAA6B;AAC5G,OAAOC,iBAAiB,MAAmC,+BAA+B;AAG1F,OAAOC,IAAI,MAAM,SAAS;AAwB1B,IAAMC,MAAkB,gBAAGP,KAAK,CAACQ,UAAU,CAAiC,UAAAC,IAAA,EAMzEC,GAAG;EAAA,IALJC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IACVC,IAAI,GAAAL,IAAA,CAAJK,IAAI;IACDC,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAAA,oBAERjB,KAAA,CAAAkB,aAAA,CAACf,UAAU,EAAAgB,QAAA;IACTL,IAAI,EAAEA,IAAgC,CAAC;EAAA,GACnCC,KAAK;IACTK,SAAS,EAAElB,UAAU,CAACa,KAAK,CAACK,SAAS,CAAE;IACvCV,GAAG,EAAEA;EAAI,IAERG,UAAU,iBAAIb,KAAA,CAAAkB,aAAA,CAACZ,IAAI;IAACc,SAAS,EAAC,iBAAiB;IAACN,IAAI,EAAEA,IAAK;IAACO,GAAG,EAAER;EAAW,CAAE,CAAC,EAC/EF,QAAQ,EACRC,SAAS,iBAAIZ,KAAA,CAAAkB,aAAA,CAAC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AE,CAAC;AAAA,CACpE,CACF;AAED2B,WAAW,CAACf,SAAS,GAAG;EACtB;EACAkB,EAAE,EAAEvC,SAAS,CAACgC,WAAW;EACzB;EACAQ,IAAI,EAAExC,SAAS,CAACsB,MAAM;EACtB;EACAT,IAAI,EAAEb,SAAS,CAACyC,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;EACnD;EACAC,MAAM,EAAE1C,SAAS,CAACwB,IAAI;EACtB;EACAmB,QAAQ,EAAE3C,SAAS,CAACwB,IAAI;EACxB;EACAoB,QAAQ,EAAE5C,SAAS,CAACsB;AACtB,CAAC;AAEDc,WAAW,CAACH,YAAY,GAAG;EACzBM,EAAE,EAAE,KAAK;EACTC,IAAI,EAAE,OAAO;EACbE,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,WAAW;EACrB/B,IAAI,EAAE;AACR,CAAC;AAED,IAAMgC,aAA6D,gBACjE9C,KAAK,CAACQ,UAAU,CAAwC,UAACO,KAAK,EAAEL,GAAG;EAAA,oBACjEV,KAAA,CAAAkB,aAAA,CAACb,iBAAiB,EAAAc,QAAA,KAAKJ,KAAK;IAAEL,GAAG,EAAEA;EAAI,EAAE,CAAC;AAAA,CAC3C,CACF;AAEDoC,aAAa,CAACxB,SAAS,GAAG;EACxB;EACAmB,IAAI,EAAExC,SAAS,CAACsB,MAAM;EACtB;EACAsB,QAAQ,EAAE5C,SAAS,CAACsB;AACtB,CAAC;AAEDuB,aAAa,CAACZ,YAAY,GAAG;EAC3BO,IAAI,EAAE,SAAS;EACfI,QAAQ,EAAE;AACZ,CAAC;AAED,eAAetC,MAAM;AACrB,SAAS8B,WAAW,EAAES,aAAa","ignoreList":[]}
|
package/dist/Button/index.scss
CHANGED
package/dist/Chip/ChipIcon.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
3
|
+
import { STYLE_VARIANTS } from './constants';
|
|
4
|
+
export type ChipIconProps = {
|
|
4
5
|
className: string;
|
|
5
|
-
src: React.
|
|
6
|
-
|
|
7
|
-
alt?: string;
|
|
8
|
-
variant: string;
|
|
6
|
+
src: React.ComponentType;
|
|
7
|
+
variant: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS];
|
|
9
8
|
disabled?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
9
|
+
} & ({
|
|
10
|
+
onClick: KeyboardEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLButtonElement>;
|
|
11
|
+
alt: string;
|
|
12
|
+
} | {
|
|
13
|
+
onClick?: undefined;
|
|
14
|
+
alt?: undefined;
|
|
15
|
+
});
|
|
16
|
+
declare function ChipIcon({ className, src, onClick, alt, variant, disabled, }: ChipIconProps): React.JSX.Element;
|
|
12
17
|
declare namespace ChipIcon {
|
|
13
18
|
var propTypes: {
|
|
14
19
|
className: PropTypes.Validator<string>;
|
|
@@ -21,7 +26,7 @@ declare namespace ChipIcon {
|
|
|
21
26
|
var defaultProps: {
|
|
22
27
|
onClick: undefined;
|
|
23
28
|
alt: undefined;
|
|
24
|
-
variant:
|
|
29
|
+
variant: "light";
|
|
25
30
|
disabled: boolean;
|
|
26
31
|
};
|
|
27
32
|
}
|
package/dist/Chip/ChipIcon.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Icon from '../Icon';
|
|
4
|
-
// @ts-ignore
|
|
5
4
|
import IconButton from '../IconButton';
|
|
6
|
-
// @ts-ignore
|
|
7
5
|
import { STYLE_VARIANTS } from './constants';
|
|
8
6
|
function ChipIcon(_ref) {
|
|
9
7
|
var className = _ref.className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipIcon.js","names":["React","PropTypes","Icon","IconButton","STYLE_VARIANTS","ChipIcon","_ref","className","src","onClick","alt","variant","disabled","createElement","iconAs","invertColors","DARK","tabIndex","size","propTypes","string","isRequired","oneOfType","element","func","bool","defaultProps","undefined","LIGHT"],"sources":["../../src/Chip/ChipIcon.tsx"],"sourcesContent":["import React, { KeyboardEventHandler, MouseEventHandler } from 'react';\nimport PropTypes from 'prop-types';\nimport Icon from '../Icon';\
|
|
1
|
+
{"version":3,"file":"ChipIcon.js","names":["React","PropTypes","Icon","IconButton","STYLE_VARIANTS","ChipIcon","_ref","className","src","onClick","alt","variant","disabled","createElement","iconAs","invertColors","DARK","tabIndex","size","propTypes","string","isRequired","oneOfType","element","func","bool","defaultProps","undefined","LIGHT"],"sources":["../../src/Chip/ChipIcon.tsx"],"sourcesContent":["import React, { KeyboardEventHandler, MouseEventHandler } from 'react';\nimport PropTypes from 'prop-types';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { STYLE_VARIANTS } from './constants';\n\nexport type ChipIconProps = {\n className: string,\n src: React.ComponentType,\n variant: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS],\n disabled?: boolean,\n} & (\n // Either _both_ onClick and alt are provided, or neither is:\n | { onClick: KeyboardEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLButtonElement>, alt: string }\n | { onClick?: undefined, alt?: undefined }\n);\n\nfunction ChipIcon({\n className, src, onClick, alt, variant, disabled,\n}: ChipIconProps) {\n if (onClick) {\n return (\n <IconButton\n className={className}\n src={src}\n onClick={onClick}\n iconAs={Icon}\n alt={alt}\n invertColors={variant === STYLE_VARIANTS.DARK}\n tabIndex={disabled ? -1 : 0}\n />\n );\n }\n\n return <Icon src={src} className={className} size=\"sm\" />;\n}\n\nChipIcon.propTypes = {\n className: PropTypes.string.isRequired,\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,\n onClick: PropTypes.func,\n alt: PropTypes.string,\n variant: PropTypes.string,\n disabled: PropTypes.bool,\n};\n\nChipIcon.defaultPro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AAO,EAAER,SAAS,CAACuB,IAAI;EACvBd,GAAG,EAAET,SAAS,CAACmB,MAAM;EACrBT,OAAO,EAAEV,SAAS,CAACmB,MAAM;EACzBR,QAAQ,EAAEX,SAAS,CAACwB;AACtB,CAAC;AAEDpB,QAAQ,CAACqB,YAAY,GAAG;EACtBjB,OAAO,EAAEkB,SAAS;EAClBjB,GAAG,EAAEiB,SAAS;EACdhB,OAAO,EAAEP,cAAc,CAACwB,KAAK;EAC7BhB,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeP,QAAQ","ignoreList":[]}
|
package/dist/Chip/constants.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["STYLE_VARIANTS","DARK","LIGHT"],"sources":["../../src/Chip/constants.ts"],"sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport const STYLE_VARIANTS = {\n DARK: 'dark',\n LIGHT: 'light',\n} as const;\n"],"mappings":"AAAA;AACA,OAAO,IAAMA,cAAc,GAAG;EAC5BC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAU","ignoreList":[]}
|
package/dist/Chip/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
+
import { STYLE_VARIANTS } from './constants';
|
|
2
3
|
export declare const CHIP_PGN_CLASS = "pgn__chip";
|
|
3
4
|
export interface IChip {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
onClick?: KeyboardEventHandler & MouseEventHandler;
|
|
6
7
|
className?: string;
|
|
7
|
-
variant?:
|
|
8
|
-
iconBefore?: React.
|
|
8
|
+
variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS];
|
|
9
|
+
iconBefore?: React.ComponentType;
|
|
9
10
|
iconBeforeAlt?: string;
|
|
10
|
-
iconAfter?: React.
|
|
11
|
+
iconAfter?: React.ComponentType;
|
|
11
12
|
iconAfterAlt?: string;
|
|
12
13
|
onIconBeforeClick?: KeyboardEventHandler & MouseEventHandler;
|
|
13
14
|
onIconAfterClick?: KeyboardEventHandler & MouseEventHandler;
|
package/dist/Chip/index.js
CHANGED
|
@@ -7,9 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
import { requiredWhen } from '../utils/propTypes';
|
|
10
|
-
// @ts-ignore
|
|
11
10
|
import { STYLE_VARIANTS } from './constants';
|
|
12
|
-
// @ts-ignore
|
|
13
11
|
import ChipIcon from './ChipIcon';
|
|
14
12
|
export var CHIP_PGN_CLASS = 'pgn__chip';
|
|
15
13
|
var Chip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
@@ -79,7 +77,7 @@ Chip.propTypes = {
|
|
|
79
77
|
*
|
|
80
78
|
* `import { Check } from '@openedx/paragon/icons';`
|
|
81
79
|
*/
|
|
82
|
-
iconBefore: PropTypes.
|
|
80
|
+
iconBefore: PropTypes.elementType,
|
|
83
81
|
/** Specifies icon alt text. */
|
|
84
82
|
iconBeforeAlt: requiredWhen(PropTypes.string, ['iconBefore', 'onIconBeforeClick']),
|
|
85
83
|
/** A click handler for the `Chip` icon before. */
|
|
@@ -90,7 +88,7 @@ Chip.propTypes = {
|
|
|
90
88
|
*
|
|
91
89
|
* `import { Check } from '@openedx/paragon/icons';`
|
|
92
90
|
*/
|
|
93
|
-
iconAfter: PropTypes.
|
|
91
|
+
iconAfter: PropTypes.elementType,
|
|
94
92
|
/** Specifies icon alt text. */
|
|
95
93
|
iconAfterAlt: requiredWhen(PropTypes.string, ['iconAfter', 'onIconAfterClick']),
|
|
96
94
|
/** A click handler for the `Chip` icon after. */
|
package/dist/Chip/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","requiredWhen","STYLE_VARIANTS","ChipIcon","CHIP_PGN_CLASS","Chip","forwardRef","_ref","ref","children","className","variant","iconBefore","iconBeforeAlt","iconAfter","iconAfterAlt","onIconBeforeClick","onIconAfterClick","disabled","isSelected","onClick","props","_objectWithoutProperties","_excluded","hasInteractiveIcons","isChipInteractive","interactionProps","onKeyPress","tabIndex","role","createElement","_extends","concat","selected","interactive","src","alt","propTypes","node","isRequired","string","oneOf","bool","func","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","requiredWhen","STYLE_VARIANTS","ChipIcon","CHIP_PGN_CLASS","Chip","forwardRef","_ref","ref","children","className","variant","iconBefore","iconBeforeAlt","iconAfter","iconAfterAlt","onIconBeforeClick","onIconAfterClick","disabled","isSelected","onClick","props","_objectWithoutProperties","_excluded","hasInteractiveIcons","isChipInteractive","interactionProps","onKeyPress","tabIndex","role","createElement","_extends","concat","selected","interactive","src","alt","propTypes","node","isRequired","string","oneOf","bool","func","elementType","defaultProps","undefined","LIGHT"],"sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ForwardedRef, KeyboardEventHandler, MouseEventHandler } from 'react';\nimport PropTypes, { type Requireable } from 'prop-types';\nimport classNames from 'classnames';\n// @ts-ignore\nimport { requiredWhen } from '../utils/propTypes';\nimport { STYLE_VARIANTS } from './constants';\nimport ChipIcon from './ChipIcon';\n\nexport const CHIP_PGN_CLASS = 'pgn__chip';\n\nexport interface IChip {\n children: React.ReactNode,\n onClick?: KeyboardEventHandler & MouseEventHandler,\n className?: string,\n variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS],\n iconBefore?: React.ComponentType,\n iconBeforeAlt?: string,\n iconAfter?: React.ComponentType,\n iconAfterAlt?: string,\n onIconBeforeClick?: KeyboardEventHandler & MouseEventHandler,\n onIconAfterClick?: KeyboardEventHandler & MouseEventHandler,\n disabled?: boolean,\n isSelected?: boolean,\n}\n\nconst Chip = React.forwardRef(({\n children,\n className,\n variant,\n iconBefore,\n iconBeforeAlt,\n iconAfter,\n iconAfterAlt,\n onIconBeforeClick,\n onIconAfterClick,\n disabled,\n isSelected,\n onClick,\n ...props\n}: IChip, ref: ForwardedRef<HTMLDivElement>) => {\n const hasInteractiveIcons = !!(onIconBeforeClick || onIconAfterClick);\n const isChipInteractive = !hasInteractiveIcons && !!onClick;\n\n const interactionProps = isChipInteractive ? {\n onClick,\n onKeyPress: onClick,\n tabIndex: 0,\n role: 'button',\n } : {};\n\n return (\n <div\n className={classNames(\n CHIP_PGN_CLASS,\n `pgn__chip-${variant}`,\n className,\n { disabled, selected: isSelected, interactive: isChipInteractive },\n )}\n ref={ref}\n {...interactionProps}\n {...props}\n >\n {iconBefore && (\n <ChipIcon\n className={`${CHIP_PGN_CLASS}__icon-before`}\n src={iconBefore}\n onClick={onIconBeforeClick}\n alt={iconBeforeAlt}\n variant={variant}\n disabled={disabled}\n />\n )}\n <div\n className={classNames(`${CHIP_PGN_CLASS}__label`, {\n 'p-before': iconBefore,\n 'p-after': iconAfter,\n })}\n >\n {children}\n </div>\n {iconAfter && (\n <ChipIcon\n className={`${CHIP_PGN_CLASS}__icon-after`}\n src={iconAfter}\n onClick={onIconAfterClick}\n alt={iconAfterAlt}\n variant={variant}\n disabled={disabled}\n />\n )}\n </div>\n );\n});\n\nChip.propTypes = {\n /** Specifies the content of the `Chip`. */\n children: PropTypes.node.isRequired,\n /** Specifies an additional `className` to add to the base element. */\n className: PropTypes.string,\n /** The `Chip` style variant to use. */\n variant: PropTypes.oneOf(['light', 'dark']),\n /** Disables the `Chip`. */\n disabled: PropTypes.bool,\n /** Click handler for the whole Chip, has effect only when Chip does not have any interactive icons. */\n onClick: PropTypes.func,\n /**\n * An icon component to render before the content.\n * Example import of a Paragon icon component:\n *\n * `import { Check } from '@openedx/paragon/icons';`\n */\n iconBefore: PropTypes.elementType as Requireable<React.ComponentType>,\n /** Specifies icon alt text. */\n iconBeforeAlt: requiredWhen(PropTypes.string, ['iconBefore', 'onIconBeforeClick']),\n /** A click handler for the `Chip` icon before. */\n onIconBeforeClick: PropTypes.func,\n /**\n * An icon component to render before after the content.\n * Example import of a Paragon icon component:\n *\n * `import { Check } from '@openedx/paragon/icons';`\n */\n iconAfter: PropTypes.elementType as Requireable<React.ComponentType>,\n /** Specifies icon alt text. */\n iconAfterAlt: requiredWhen(PropTypes.string, ['iconAfter', 'onIconAfterClick']),\n /** A click handler for the `Chip` icon after. */\n onIconAfterClick: PropTypes.func,\n /** Indicates if `Chip` has been selected. */\n isSelected: PropTypes.bool,\n};\n\nChip.defaultProps = {\n className: undefined,\n variant: STYLE_VARIANTS.LIGHT,\n disabled: false,\n onClick: undefined,\n iconBefore: undefined,\n iconAfter: undefined,\n onIconBeforeClick: undefined,\n onIconAfterClick: undefined,\n isSelected: false,\n iconAfterAlt: undefined,\n iconBeforeAlt: undefined,\n};\n\nexport default Chip;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAiE,OAAO;AACpF,OAAOC,SAAS,MAA4B,YAAY;AACxD,OAAOC,UAAU,MAAM,YAAY;AACnC;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,cAAc,QAAQ,aAAa;AAC5C,OAAOC,QAAQ,MAAM,YAAY;AAEjC,OAAO,IAAMC,cAAc,GAAG,WAAW;AAiBzC,IAAMC,IAAI,gBAAGP,KAAK,CAACQ,UAAU,CAAC,UAAAC,IAAA,EAcpBC,GAAiC,EAAK;EAAA,IAb9CC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,UAAU,GAAAL,IAAA,CAAVK,UAAU;IACVC,aAAa,GAAAN,IAAA,CAAbM,aAAa;IACbC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,YAAY,GAAAR,IAAA,CAAZQ,YAAY;IACZC,iBAAiB,GAAAT,IAAA,CAAjBS,iBAAiB;IACjBC,gBAAgB,GAAAV,IAAA,CAAhBU,gBAAgB;IAChBC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,UAAU,GA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,SAAS;EACpB9B,iBAAiB,EAAE8B,SAAS;EAC5B7B,gBAAgB,EAAE6B,SAAS;EAC3B3B,UAAU,EAAE,KAAK;EACjBJ,YAAY,EAAE+B,SAAS;EACvBjC,aAAa,EAAEiC;AACjB,CAAC;AAED,eAAezC,IAAI","ignoreList":[]}
|
package/dist/Chip/index.scss
CHANGED
|
@@ -93,11 +93,12 @@
|
|
|
93
93
|
background-color: var(--pgn-color-chip-bg-dark);
|
|
94
94
|
|
|
95
95
|
&.selected {
|
|
96
|
-
@include chip-outline(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
@include chip-outline(
|
|
97
|
+
var(--pgn-color-chip-outline-dark),
|
|
98
|
+
calc(var(--pgn-spacing-chip-outline-selected-distance-dark) * -1),
|
|
99
|
+
calc(var(--pgn-size-chip-border-radius) + var(--pgn-spacing-chip-outline-width)),
|
|
100
|
+
var(--pgn-spacing-chip-outline-selected-distance-dark)
|
|
101
|
+
);
|
|
101
102
|
|
|
102
103
|
&:focus {
|
|
103
104
|
border: 1px solid var(--pgn-color-chip-border-focus-selected-dark);
|
package/dist/Chip/mixins.scss
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@mixin chip-outline(
|
|
2
2
|
$outline-color: var(--pgn-color-white),
|
|
3
3
|
$distance-to-border: 0,
|
|
4
|
-
$border-radius: 50%,
|
|
5
|
-
$border-width
|
|
4
|
+
$outline-border-radius: 50%,
|
|
5
|
+
$outline-border-width: .125rem
|
|
6
6
|
) {
|
|
7
7
|
&::before {
|
|
8
8
|
content: "";
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
right: $distance-to-border;
|
|
12
12
|
bottom: $distance-to-border;
|
|
13
13
|
left: $distance-to-border;
|
|
14
|
-
border: solid $border-width
|
|
15
|
-
border-radius:
|
|
14
|
+
border: solid $outline-border-width $outline-color;
|
|
15
|
+
border-radius: $outline-border-radius;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -14,9 +14,7 @@ import { useIntl } from 'react-intl';
|
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
import { OverflowScroll, OverflowScrollContext } from '../OverflowScroll';
|
|
17
|
-
// @ts-ignore
|
|
18
17
|
import IconButton from '../IconButton';
|
|
19
|
-
// @ts-ignore
|
|
20
18
|
import Icon from '../Icon';
|
|
21
19
|
// @ts-ignore
|
|
22
20
|
import { ArrowForward, ArrowBack } from '../../icons';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","useIntl","classNames","OverflowScroll","OverflowScrollContext","IconButton","Icon","ArrowForward","ArrowBack","messages","Chip","ChipCarousel","forwardRef","_ref","ref","className","items","ariaLabel","disableOpacityMasks","onScrollPrevious","onScrollNext","_ref$canScrollHorizon","canScrollHorizontal","_ref$offset","offset","_ref$offsetType","offsetType","gap","props","_objectWithoutProperties","_excluded","intl","createElement","_extends","concat","hasInteractiveChildren","disableScroll","Consumer","_ref2","setOverflowRef","isScrolledToStart","isScrolledToEnd","scrollToPrevious","scrollToNext","Fragment","size","src","iconAs","alt","formatMessage","onClick","Items","map","item","id","_ref3","children","_objectSpread","key","propTypes","string","isRequired","arrayOf","element","bool","func","oneOfType","number","oneOf","defaultProps","undefined"],"sources":["../../src/ChipCarousel/index.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useIntl } from 'react-intl';\nimport classNames from 'classnames';\n// @ts-ignore\nimport { OverflowScroll, OverflowScrollContext } from '../OverflowScroll';\
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","useIntl","classNames","OverflowScroll","OverflowScrollContext","IconButton","Icon","ArrowForward","ArrowBack","messages","Chip","ChipCarousel","forwardRef","_ref","ref","className","items","ariaLabel","disableOpacityMasks","onScrollPrevious","onScrollNext","_ref$canScrollHorizon","canScrollHorizontal","_ref$offset","offset","_ref$offsetType","offsetType","gap","props","_objectWithoutProperties","_excluded","intl","createElement","_extends","concat","hasInteractiveChildren","disableScroll","Consumer","_ref2","setOverflowRef","isScrolledToStart","isScrolledToEnd","scrollToPrevious","scrollToNext","Fragment","size","src","iconAs","alt","formatMessage","onClick","Items","map","item","id","_ref3","children","_objectSpread","key","propTypes","string","isRequired","arrayOf","element","bool","func","oneOfType","number","oneOf","defaultProps","undefined"],"sources":["../../src/ChipCarousel/index.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useIntl } from 'react-intl';\nimport classNames from 'classnames';\n// @ts-ignore\nimport { OverflowScroll, OverflowScrollContext } from '../OverflowScroll';\nimport IconButton from '../IconButton';\nimport Icon from '../Icon';\n// @ts-ignore\nimport { ArrowForward, ArrowBack } from '../../icons';\n// @ts-ignore\nimport messages from './messages';\nimport Chip from '../Chip';\n\nexport interface OverflowScrollContextProps {\n setOverflowRef: () => void,\n isScrolledToStart: boolean,\n isScrolledToEnd: boolean,\n scrollToPrevious: () => void,\n scrollToNext: () => void,\n}\n\nexport interface ChipCarouselProps {\n className?: string;\n items: Array<React.ReactElement>;\n ariaLabel: string;\n disableOpacityMasks?: boolean;\n onScrollPrevious?: () => void;\n onScrollNext?: () => void;\n canScrollHorizontal?: boolean;\n offset?: number | string;\n offsetType?: 'percentage' | 'fixed';\n gap?: number;\n}\n\nconst ChipCarousel = React.forwardRef(({\n className,\n items,\n ariaLabel,\n disableOpacityMasks,\n onScrollPrevious,\n onScrollNext,\n canScrollHorizontal = false,\n offset = 120,\n offsetType = 'fixed',\n gap,\n ...props\n}: ChipCarouselProps, ref: ForwardedRef<HTMLDivElement>) => {\n const intl = useIntl();\n\n return (\n <div\n className={classNames('pgn__chip-carousel', className, gap ? `pgn__chip-carousel-gap__${gap}` : '')}\n {...props}\n ref={ref}\n >\n <OverflowScroll\n ariaLabel={ariaLabel}\n hasInteractiveChildren\n disableScroll={!canScrollHorizontal}\n disableOpacityMasks={disableOpacityMasks}\n onScrollPrevious={onScrollPrevious}\n onScrollNext={onScrollNext}\n offset={offset}\n offsetType={offsetType}\n >\n <OverflowScrollContext.Consumer>\n {({\n setOverflowRef,\n isScrolledToStart,\n isScrolledToEnd,\n scrollToPrevious,\n scrollToNext,\n }: OverflowScrollContextProps) => (\n <>\n <>\n {!isScrolledToStart && (\n <IconButton\n size=\"sm\"\n className=\"pgn__chip-carousel__left-control\"\n src={ArrowBack}\n iconAs={Icon}\n alt={intl.formatMessage(messages.scrollToPrevious)}\n onClick={scrollToPrevious}\n />\n )}\n {!isScrolledToEnd && (\n <IconButton\n size=\"sm\"\n className=\"pgn__chip-carousel__right-control\"\n src={ArrowForward}\n iconAs={Icon}\n alt={intl.formatMessage(messages.scrollToNext)}\n onClick={scrollToNext}\n />\n )}\n </>\n <div ref={setOverflowRef} className=\"d-flex\">\n <OverflowScroll.Items>\n {items?.map((item, id) => {\n const { children } = item?.props || {};\n if (!children) {\n return null;\n }\n // eslint-disable-next-line react/no-array-index-key\n return React.createElement(Chip, { ...item.props, key: id });\n })}\n </OverflowScroll.Items>\n </div>\n </>\n )}\n </OverflowScrollContext.Consumer>\n </OverflowScroll>\n </div>\n );\n});\n\nChipCarousel.propTypes = {\n /** Text describing the ChipCarousel for screen readers. */\n ariaLabel: PropTypes.string.isRequired,\n /** Specifies class name for the ChipCarousel. */\n className: PropTypes.string,\n /** Specifies array of `Chip` elements to be rendered inside the carousel. */\n // @ts-ignore\n items: PropTypes.arrayOf(PropTypes.element).isRequired,\n /** Whether the default opacity masks should be shown at the start/end, if applicable. */\n disableOpacityMasks: PropTypes.bool,\n /** Callback function for when the user scrolls to the previous element. */\n onScrollPrevious: PropTypes.func,\n /** Callback function for when the user scrolls to the next element. */\n onScrollNext: PropTypes.func,\n /** Whether users can scroll within the overflow container. */\n canScrollHorizontal: PropTypes.bool,\n /** A value specifying the distance the scroll should move. */\n offset: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /** Type of offset value (percentage or fixed). */\n offsetType: PropTypes.oneOf(['percentage', 'fixed']),\n /**\n * Specifies inner space between children blocks.\n *\n * Valid values are based on `the spacing classes`:\n * `0, 0.5, ... 6`.\n */\n gap: PropTypes.number,\n};\n\nChipCarousel.defaultProps = {\n className: undefined,\n disableOpacityMasks: undefined,\n onScrollPrevious: undefined,\n onScrollNext: undefined,\n canScrollHorizontal: false,\n offset: 120,\n offsetType: 'fixed',\n gap: 3,\n};\n\nexport default ChipCarousel;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,UAAU,MAAM,YAAY;AACnC;AACA,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,mBAAmB;AACzE,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,IAAI,MAAM,SAAS;AAC1B;AACA,SAASC,YAAY,EAAEC,SAAS,QAAQ,aAAa;AACrD;AACA,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,IAAI,MAAM,SAAS;AAuB1B,IAAMC,YAAY,gBAAGZ,KAAK,CAACa,UAAU,CAAC,UAAAC,IAAA,EAYhBC,GAAiC,EAAK;EAAA,IAX1DC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,mBAAmB,GAAAL,IAAA,CAAnBK,mBAAmB;IACnBC,gBAAgB,GAAAN,IAAA,CAAhBM,gBAAgB;IAChBC,YAAY,GAAAP,IAAA,CAAZO,YAAY;IAAAC,qBAAA,GAAAR,IAAA,CACZS,mBAAmB;IAAnBA,mBAAmB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,WAAA,GAAAV,IAAA,CAC3BW,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAG,GAAG,GAAAA,WAAA;IAAAE,eAAA,GAAAZ,IAAA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4D,MAAM;EAC3B;EACA;EACA5C,KAAK,EAAEhB,SAAS,CAAC8D,OAAO,CAAC9D,SAAS,CAAC+D,OAAO,CAAC,CAACF,UAAU;EACtD;EACA3C,mBAAmB,EAAElB,SAAS,CAACgE,IAAI;EACnC;EACA7C,gBAAgB,EAAEnB,SAAS,CAACiE,IAAI;EAChC;EACA7C,YAAY,EAAEpB,SAAS,CAACiE,IAAI;EAC5B;EACA3C,mBAAmB,EAAEtB,SAAS,CAACgE,IAAI;EACnC;EACAxC,MAAM,EAAExB,SAAS,CAACkE,SAAS,CAAC,CAAClE,SAAS,CAACmE,MAAM,EAAEnE,SAAS,CAAC4D,MAAM,CAAC,CAAC;EACjE;EACAlC,UAAU,EAAE1B,SAAS,CAACoE,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;EACpD;AACF;AACA;AACA;AACA;AACA;EACEzC,GAAG,EAAE3B,SAAS,CAACmE;AACjB,CAAC;AAEDxD,YAAY,CAAC0D,YAAY,GAAG;EAC1BtD,SAAS,EAAEuD,SAAS;EACpBpD,mBAAmB,EAAEoD,SAAS;EAC9BnD,gBAAgB,EAAEmD,SAAS;EAC3BlD,YAAY,EAAEkD,SAAS;EACvBhD,mBAAmB,EAAE,KAAK;EAC1BE,MAAM,EAAE,GAAG;EACXE,UAAU,EAAE,OAAO;EACnBC,GAAG,EAAE;AACP,CAAC;AAED,eAAehB,YAAY","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.collapsible-trigger {
|
|
8
8
|
padding: var(--pgn-spacing-collapsible-card-spacer-y-base) var(--pgn-spacing-collapsible-card-spacer-x-base);
|
|
9
|
-
border-radius:
|
|
9
|
+
border-radius: var(--pgn-size-card-border-radius-inner);
|
|
10
10
|
border-bottom: var(--pgn-size-card-border-width) solid transparent;
|
|
11
11
|
transition: border-color 100ms ease 150ms;
|
|
12
12
|
cursor: pointer;
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
&[aria-expanded="true"] {
|
|
24
24
|
border-radius:
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var(--pgn-size-card-border-radius-inner)
|
|
26
|
+
var(--pgn-size-card-border-radius-inner) 0 0;
|
|
27
27
|
border-color: var(--pgn-color-card-border-base);
|
|
28
28
|
transition: none;
|
|
29
29
|
text-align: start;
|