@openedx/paragon 23.14.9 → 23.15.0

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.
Files changed (72) hide show
  1. package/dist/Card/CardBody.d.ts +9 -0
  2. package/dist/Card/CardBody.js +0 -11
  3. package/dist/Card/CardBody.js.map +1 -1
  4. package/dist/Card/CardContext.d.ts +17 -0
  5. package/dist/Card/CardContext.js +8 -21
  6. package/dist/Card/CardContext.js.map +1 -1
  7. package/dist/Card/CardDivider.d.ts +7 -0
  8. package/dist/Card/CardDivider.js +2 -10
  9. package/dist/Card/CardDivider.js.map +1 -1
  10. package/dist/Card/CardFallbackDefaultImage.d.ts +1 -0
  11. package/dist/Card/CardFallbackDefaultImage.js +1 -0
  12. package/dist/Card/CardFallbackDefaultImage.js.map +1 -0
  13. package/dist/Card/CardGrid.d.ts +22 -0
  14. package/dist/Card/CardGrid.js +6 -31
  15. package/dist/Card/CardGrid.js.map +1 -1
  16. package/dist/DataTable/DataTableContext.d.ts +3 -0
  17. package/dist/DataTable/DataTableContext.js.map +1 -1
  18. package/dist/DataTable/TableCell.d.ts +14 -0
  19. package/dist/DataTable/TableCell.js +0 -12
  20. package/dist/DataTable/TableCell.js.map +1 -1
  21. package/dist/DataTable/TableHeaderCell.d.ts +26 -0
  22. package/dist/DataTable/TableHeaderCell.js +4 -32
  23. package/dist/DataTable/TableHeaderCell.js.map +1 -1
  24. package/dist/Menu/MenuItem.d.ts +17 -0
  25. package/dist/Menu/MenuItem.js +5 -27
  26. package/dist/Menu/MenuItem.js.map +1 -1
  27. package/dist/Menu/index.d.ts +16 -0
  28. package/dist/Menu/index.js +4 -24
  29. package/dist/Menu/index.js.map +1 -1
  30. package/dist/OverflowScroll/data/constants.d.ts +1 -0
  31. package/dist/OverflowScroll/data/constants.js +1 -0
  32. package/dist/OverflowScroll/data/constants.js.map +1 -0
  33. package/dist/PageBanner/index.d.ts +27 -0
  34. package/dist/PageBanner/index.js +5 -28
  35. package/dist/PageBanner/index.js.map +1 -1
  36. package/dist/Sheet/SheetContainer.js +30 -8
  37. package/dist/Sheet/SheetContainer.js.map +1 -1
  38. package/dist/Sheet/index.js +15 -5
  39. package/dist/Sheet/index.js.map +1 -1
  40. package/dist/Stack/index.d.ts +20 -0
  41. package/dist/Stack/index.js +3 -28
  42. package/dist/Stack/index.js.map +1 -1
  43. package/dist/Tabs/Tab.d.ts +19 -0
  44. package/dist/Tabs/Tab.js +0 -23
  45. package/dist/Tabs/Tab.js.map +1 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.js +1 -2
  48. package/dist/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/Card/CardBody.tsx +19 -0
  51. package/src/Card/{CardContext.jsx → CardContext.tsx} +24 -25
  52. package/src/Card/CardDivider.tsx +13 -0
  53. package/src/Card/{CardGrid.jsx → CardGrid.tsx} +28 -35
  54. package/src/DataTable/{TableCell.jsx → TableCell.tsx} +13 -15
  55. package/src/DataTable/{TableHeaderCell.jsx → TableHeaderCell.tsx} +32 -33
  56. package/src/Menu/MenuItem.tsx +49 -0
  57. package/src/Menu/{index.jsx → index.tsx} +18 -27
  58. package/src/PageBanner/{index.jsx → index.tsx} +27 -29
  59. package/src/Sheet/Sheet.test.jsx +63 -3
  60. package/src/Sheet/SheetContainer.jsx +34 -7
  61. package/src/Sheet/SheetContainer.test.jsx +34 -1
  62. package/src/Sheet/__snapshots__/Sheet.test.jsx.snap +15 -6
  63. package/src/Sheet/index.jsx +12 -2
  64. package/src/Stack/{index.jsx → index.tsx} +22 -35
  65. package/src/Tabs/{Tab.jsx → Tab.tsx} +10 -18
  66. package/src/index.ts +1 -2
  67. package/src/Card/CardBody.jsx +0 -23
  68. package/src/Card/CardDivider.jsx +0 -18
  69. package/src/Menu/MenuItem.jsx +0 -57
  70. /package/src/Card/{CardFallbackDefaultImage.js → CardFallbackDefaultImage.ts} +0 -0
  71. /package/src/DataTable/{DataTableContext.jsx → DataTableContext.tsx} +0 -0
  72. /package/src/OverflowScroll/data/{constants.js → constants.ts} +0 -0
@@ -1,7 +1,10 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Sheet /> snapshots blocking, left snapshot 1`] = `
4
- <sheet-container>
4
+ <div
5
+ className="sheet-container"
6
+ data-testid="sheet-container"
7
+ >
5
8
  <div
6
9
  className="pgn__sheet-skrim"
7
10
  role="presentation"
@@ -28,11 +31,14 @@ exports[`<Sheet /> snapshots blocking, left snapshot 1`] = `
28
31
  />
29
32
  </div>
30
33
  </focus-on>
31
- </sheet-container>
34
+ </div>
32
35
  `;
33
36
 
34
37
  exports[`<Sheet /> snapshots dark, right snapshot 1`] = `
35
- <sheet-container>
38
+ <div
39
+ className="sheet-container"
40
+ data-testid="sheet-container"
41
+ >
36
42
  <div
37
43
  className="pgn__sheet-skrim hidden"
38
44
  role="presentation"
@@ -59,11 +65,14 @@ exports[`<Sheet /> snapshots dark, right snapshot 1`] = `
59
65
  />
60
66
  </div>
61
67
  </focus-on>
62
- </sheet-container>
68
+ </div>
63
69
  `;
64
70
 
65
71
  exports[`<Sheet /> snapshots default args snapshot: bottom, show, light 1`] = `
66
- <sheet-container>
72
+ <div
73
+ className="sheet-container"
74
+ data-testid="sheet-container"
75
+ >
67
76
  <div
68
77
  className="pgn__sheet-skrim hidden"
69
78
  role="presentation"
@@ -96,5 +105,5 @@ exports[`<Sheet /> snapshots default args snapshot: bottom, show, light 1`] = `
96
105
  </div>
97
106
  </div>
98
107
  </focus-on>
99
- </sheet-container>
108
+ </div>
100
109
  `;
@@ -26,13 +26,16 @@ class Sheet extends React.Component {
26
26
  }
27
27
 
28
28
  renderSheet() {
29
- const { children, position, variant } = this.props;
29
+ const {
30
+ children, position, variant, className,
31
+ } = this.props;
30
32
  return (
31
33
  <div
32
34
  className={classNames(
33
35
  'pgn__sheet-component',
34
36
  `pgn__sheet__${variant}`,
35
37
  position,
38
+ className,
36
39
  )}
37
40
  role="alert"
38
41
  aria-live="polite"
@@ -50,12 +53,13 @@ class Sheet extends React.Component {
50
53
  blocking,
51
54
  show,
52
55
  onClose,
56
+ containerClassName,
53
57
  } = this.props;
54
58
  if (!show) {
55
59
  return null;
56
60
  }
57
61
  return (
58
- <SheetContainer>
62
+ <SheetContainer className={classNames(containerClassName)}>
59
63
  <div
60
64
  className={classNames(
61
65
  'pgn__sheet-skrim',
@@ -80,6 +84,10 @@ Sheet.propTypes = {
80
84
  blocking: PropTypes.bool,
81
85
  /** an element rendered inside the sheet */
82
86
  children: PropTypes.node,
87
+ /** A class that is appended to the sheet container element. */
88
+ containerClassName: PropTypes.string,
89
+ /** A class that is appended to the sheet element. */
90
+ className: PropTypes.string,
83
91
  /** a string designating the sheet's position on the window */
84
92
  position: PropTypes.oneOf([
85
93
  POSITIONS.left,
@@ -102,6 +110,8 @@ Sheet.defaultProps = {
102
110
  show: true,
103
111
  onClose: () => {},
104
112
  variant: VARIANTS.light,
113
+ containerClassName: undefined,
114
+ className: undefined,
105
115
  };
106
116
 
107
117
  export default Sheet;
@@ -1,20 +1,32 @@
1
- import React, { forwardRef } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import React, { forwardRef, ForwardedRef } from 'react';
3
2
  import classNames from 'classnames';
4
3
 
5
- const DIRECTION_VARIANTS = [
6
- 'horizontal',
7
- 'vertical',
8
- ];
4
+ interface StackProps {
5
+ /** Specifies the content of the `Stack`. */
6
+ children: React.ReactNode;
7
+ /** Specifies direction of the children blocks (column/row). */
8
+ direction?: 'horizontal' | 'vertical';
9
+ /**
10
+ * Specifies inner space between children blocks.
11
+ *
12
+ * Valid values are based on `the spacing classes`:
13
+ * `0, 0.5, ... 6`.
14
+ */
15
+ gap?: number;
16
+ /** Specifies the order of the children. */
17
+ reversed?: boolean;
18
+ /** Specifies an additional `className` to add to the base element. */
19
+ className?: string;
20
+ }
9
21
 
10
22
  const Stack = forwardRef(({
11
- direction,
12
- gap,
13
- reversed,
23
+ direction = 'vertical',
24
+ gap = 0,
25
+ reversed = false,
14
26
  children,
15
27
  className,
16
28
  ...rest
17
- }, ref) => (
29
+ }: StackProps, ref: ForwardedRef<HTMLDivElement>) => (
18
30
  <div
19
31
  ref={ref}
20
32
  className={classNames(
@@ -29,29 +41,4 @@ const Stack = forwardRef(({
29
41
  </div>
30
42
  ));
31
43
 
32
- Stack.propTypes = {
33
- /** Specifies the content of the `Stack`. */
34
- children: PropTypes.node.isRequired,
35
- /** Specifies direction of the children blocks (column/row). */
36
- direction: PropTypes.oneOf(DIRECTION_VARIANTS),
37
- /**
38
- * Specifies inner space between children blocks.
39
- *
40
- * Valid values are based on `the spacing classes`:
41
- * `0, 0.5, ... 6`.
42
- */
43
- gap: PropTypes.number,
44
- /** Specifies the order of the children. */
45
- reversed: PropTypes.bool,
46
- /** Specifies an additional `className` to add to the base element. */
47
- className: PropTypes.string,
48
- };
49
-
50
- Stack.defaultProps = {
51
- direction: 'vertical',
52
- gap: 0,
53
- className: undefined,
54
- reversed: false,
55
- };
56
-
57
44
  export default Stack;
@@ -1,33 +1,25 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import BaseTab from 'react-bootstrap/Tab';
4
3
 
5
- function Tab(props) {
6
- return <BaseTab {...props} />;
7
- }
8
-
9
- Tab.propTypes = {
4
+ interface TabProps {
10
5
  /** Specifies the `Tab` navigation title. */
11
- title: PropTypes.node.isRequired,
6
+ title: React.ReactNode;
12
7
  /** Specifies notification bubble content. It appears on the top right of the `Tab`. */
13
- notification: PropTypes.node,
8
+ notification?: React.ReactNode;
14
9
  /** Specifies whether `Tab` is disabled. */
15
- disabled: PropTypes.bool,
10
+ disabled?: boolean;
16
11
  /**
17
12
  * A unique identifier for the Component, the `eventKey` makes it distinguishable
18
13
  * from others in a set. Similar to React's `key` prop, in that it only needs to be
19
14
  * unique amongst the Components siblings, not globally.
20
15
  */
21
- eventKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
16
+ eventKey?: string | number;
22
17
  /** Specifies class name to append to the base element. */
23
- tabClassName: PropTypes.string,
24
- };
18
+ tabClassName?: string;
19
+ }
25
20
 
26
- Tab.defaultProps = {
27
- notification: undefined,
28
- disabled: undefined,
29
- eventKey: undefined,
30
- tabClassName: undefined,
31
- };
21
+ function Tab(props: TabProps) {
22
+ return <BaseTab {...props} />;
23
+ }
32
24
 
33
25
  export default Tab;
package/src/index.ts CHANGED
@@ -42,6 +42,7 @@ export { default as ModalLayer } from './Modal/ModalLayer';
42
42
  export { default as Overlay, OverlayTrigger } from './Overlay';
43
43
  export { default as Portal } from './Modal/Portal';
44
44
  export { default as Spinner } from './Spinner';
45
+ export { default as Stack } from './Stack';
45
46
  export { default as Toast, TOAST_CLOSE_LABEL_TEXT, TOAST_DELAY } from './Toast';
46
47
  export { default as Tooltip } from './Tooltip';
47
48
  export { default as useWindowSize, type WindowSizeData } from './hooks/useWindowSizeHook';
@@ -217,8 +218,6 @@ export { default as CardView } from './DataTable/CardView';
217
218
  // @ts-ignore: has yet to be converted to TypeScript
218
219
  export { default as Skeleton, SkeletonTheme } from './Skeleton/index';
219
220
  // @ts-ignore: has yet to be converted to TypeScript
220
- export { default as Stack } from './Stack';
221
- // @ts-ignore: has yet to be converted to TypeScript
222
221
  export { default as ToggleButton, ToggleButtonGroup } from './ToggleButton';
223
222
  // @ts-ignore: has yet to be converted to TypeScript
224
223
  export { default as Sticky } from './Sticky';
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
-
5
- const CardBody = React.forwardRef(({ className, children, ...rest }, ref) => (
6
- <div className={classNames('pgn__card-body', className)} ref={ref} {...rest}>
7
- {children}
8
- </div>
9
- ));
10
-
11
- CardBody.propTypes = {
12
- /** Specifies the content of the component. */
13
- children: PropTypes.node,
14
- /** The class to append to the base element. */
15
- className: PropTypes.string,
16
- };
17
-
18
- CardBody.defaultProps = {
19
- children: undefined,
20
- className: undefined,
21
- };
22
-
23
- export default CardBody;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
-
5
- const CardDivider = React.forwardRef(({ className, ...props }, ref) => (
6
- <div className={classNames('pgn__card-divider', className)} ref={ref} {...props} />
7
- ));
8
-
9
- CardDivider.propTypes = {
10
- /** Specifies class name to append to the base element. */
11
- className: PropTypes.string,
12
- };
13
-
14
- CardDivider.defaultProps = {
15
- className: undefined,
16
- };
17
-
18
- export default CardDivider;
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
- import Icon from '../Icon';
5
-
6
- function MenuItem({
7
- as,
8
- children,
9
- defaultSelected,
10
- iconAfter,
11
- iconBefore,
12
- ...props
13
- }) {
14
- const className = classNames(props.className, 'pgn__menu-item');
15
-
16
- return React.createElement(
17
- as,
18
- {
19
- ...props,
20
- className,
21
- },
22
- (
23
- <>
24
- {iconBefore && <Icon className="btn-icon-before" src={iconBefore} />}
25
- <span className="pgn__menu-item-text">{children}</span>
26
- <span className="pgn__menu-item-content-spacer" />
27
- {iconAfter && <Icon className="btn-icon-after" src={iconAfter} />}
28
- </>
29
- ),
30
- );
31
- }
32
-
33
- MenuItem.propTypes = {
34
- /** Specifies that this ``MenuItem`` is selected inside the ``SelectMenu`` */
35
- defaultSelected: PropTypes.bool,
36
- /** Specifies class name to append to the base element */
37
- className: PropTypes.string,
38
- /** Specifies the content of the ``MenuItem`` */
39
- children: PropTypes.node,
40
- /** Specifies the base element */
41
- as: PropTypes.elementType,
42
- /** Specifies the jsx before the content of the ``MenuItem`` */
43
- iconBefore: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
44
- /** Specifies the jsx after the content of the ``MenuItem`` */
45
- iconAfter: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
46
- };
47
-
48
- MenuItem.defaultProps = {
49
- defaultSelected: false,
50
- as: 'button',
51
- className: undefined,
52
- children: null,
53
- iconBefore: undefined,
54
- iconAfter: undefined,
55
- };
56
-
57
- export default MenuItem;