@spaced-out/ui-design-system 0.1.16 → 0.1.17

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 (84) hide show
  1. package/.cspell/custom-words.txt +3 -0
  2. package/.flowconfig +1 -1
  3. package/CHANGELOG.md +7 -0
  4. package/CONTRIBUTING.md +52 -6
  5. package/README.md +144 -8
  6. package/gulpfile.js +1 -0
  7. package/lib/components/AvatarGroup/AvatarGroup.js +4 -3
  8. package/lib/components/AvatarGroup/AvatarGroup.js.flow +119 -110
  9. package/lib/components/Badge/Badge.js +4 -3
  10. package/lib/components/Badge/Badge.js.flow +21 -21
  11. package/lib/components/Badge/index.js +11 -7
  12. package/lib/components/Badge/index.js.flow +1 -2
  13. package/lib/components/Banner/Banner.js +3 -2
  14. package/lib/components/Banner/Banner.js.flow +42 -35
  15. package/lib/components/Button/Button.js +50 -10
  16. package/lib/components/Button/Button.js.flow +87 -23
  17. package/lib/components/Button/Button.module.css +14 -0
  18. package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js +3 -2
  19. package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js.flow +48 -38
  20. package/lib/components/ButtonTabs/ButtonTabs.js +3 -2
  21. package/lib/components/ButtonTabs/ButtonTabs.js.flow +50 -41
  22. package/lib/components/Card/Card.js +16 -7
  23. package/lib/components/Card/Card.js.flow +73 -55
  24. package/lib/components/Chip/Chip.js +3 -2
  25. package/lib/components/Chip/Chip.js.flow +66 -59
  26. package/lib/components/CircularLoader/CircularLoader.js +9 -4
  27. package/lib/components/CircularLoader/CircularLoader.js.flow +38 -24
  28. package/lib/components/CollapsibleCard/CollapsibleCard.js +4 -3
  29. package/lib/components/CollapsibleCard/CollapsibleCard.js.flow +68 -59
  30. package/lib/components/Dropdown/Dropdown.js +4 -3
  31. package/lib/components/Dropdown/Dropdown.js.flow +83 -74
  32. package/lib/components/EmptyState/EmptyState.js +4 -3
  33. package/lib/components/EmptyState/EmptyState.js.flow +53 -44
  34. package/lib/components/ErrorMessage/ErrorMessage.js +4 -3
  35. package/lib/components/ErrorMessage/ErrorMessage.js.flow +58 -49
  36. package/lib/components/InContextAlert/InContextAlert.js +4 -3
  37. package/lib/components/InContextAlert/InContextAlert.js.flow +79 -73
  38. package/lib/components/InlineDropdown/InlineDropdown.js +4 -3
  39. package/lib/components/InlineDropdown/InlineDropdown.js.flow +94 -85
  40. package/lib/components/LinearLoader/LinearLoader.js +4 -3
  41. package/lib/components/LinearLoader/LinearLoader.js.flow +20 -18
  42. package/lib/components/Link/Link.js +8 -1
  43. package/lib/components/Link/Link.js.flow +44 -36
  44. package/lib/components/Notification/Notification.js +8 -6
  45. package/lib/components/Notification/Notification.js.flow +96 -84
  46. package/lib/components/OptionButton/OptionButton.js +7 -4
  47. package/lib/components/OptionButton/OptionButton.js.flow +69 -59
  48. package/lib/components/PageTitle/PageTitle.js +4 -3
  49. package/lib/components/PageTitle/PageTitle.js.flow +46 -44
  50. package/lib/components/Pagination/PaginationItem.js +2 -2
  51. package/lib/components/Pagination/PaginationItem.js.flow +2 -2
  52. package/lib/components/SearchInput/SearchInput.js +3 -2
  53. package/lib/components/SearchInput/SearchInput.js.flow +59 -50
  54. package/lib/components/SideMenuLink/SideMenuLink.js +4 -3
  55. package/lib/components/SideMenuLink/SideMenuLink.js.flow +54 -45
  56. package/lib/components/StatusIndicator/StatusIndicator.js +3 -2
  57. package/lib/components/StatusIndicator/StatusIndicator.js.flow +32 -23
  58. package/lib/components/SubMenu/SubMenu.js +4 -3
  59. package/lib/components/SubMenu/SubMenu.js.flow +41 -38
  60. package/lib/components/Table/StaticTable.js +3 -0
  61. package/lib/components/Table/StaticTable.js.flow +3 -0
  62. package/lib/components/Table/Table.js +10 -0
  63. package/lib/components/Table/Table.js.flow +10 -0
  64. package/lib/components/Table/hooks.js +1 -0
  65. package/lib/components/Table/hooks.js.flow +1 -0
  66. package/lib/components/Tabs/TabList/TabList.js +3 -2
  67. package/lib/components/Tabs/TabList/TabList.js.flow +127 -117
  68. package/lib/components/Toggle/index.js +11 -7
  69. package/lib/components/Toggle/index.js.flow +1 -1
  70. package/lib/components/Tooltip/Tooltip.js.flow +2 -2
  71. package/lib/components/index.js +511 -0
  72. package/lib/components/index.js.flow +48 -0
  73. package/lib/index.js +60 -0
  74. package/lib/index.js.flow +7 -0
  75. package/lib/styles/index.css +15 -0
  76. package/lib/styles/index.js +104 -0
  77. package/lib/styles/index.js.flow +12 -0
  78. package/lib/styles/typography.module.css +0 -1
  79. package/lib/styles/utils.module.css +26 -0
  80. package/lib/types/index.js +38 -0
  81. package/lib/types/index.js.flow +5 -0
  82. package/lib/utils/index.js +93 -0
  83. package/lib/utils/index.js.flow +10 -0
  84. package/package.json +2 -1
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
 
14
- const ButtonTabs = _ref => {
14
+ const ButtonTabs = /*#__PURE__*/React.forwardRef((_ref, ref) => {
15
15
  let {
16
16
  classNames,
17
17
  children,
@@ -36,6 +36,7 @@ const ButtonTabs = _ref => {
36
36
  });
37
37
  return /*#__PURE__*/React.createElement("div", {
38
38
  "data-testid": "ButtonTabs",
39
+ ref: ref,
39
40
  className: (0, _classify.default)(_ButtonTabsModule.default.buttonTabsWrapper, {
40
41
  [_ButtonTabsModule.default.medium]: size === 'medium',
41
42
  [_ButtonTabsModule.default.small]: size === 'small',
@@ -43,5 +44,5 @@ const ButtonTabs = _ref => {
43
44
  [_ButtonTabsModule.default.disabled]: disabled
44
45
  }, classNames?.wrapper)
45
46
  }, childrenWithProps);
46
- };
47
+ });
47
48
  exports.ButtonTabs = ButtonTabs;
@@ -19,44 +19,53 @@ export type ButtonTabsProps = {
19
19
  onButtonTabSelect?: ?(id: string, e?: SyntheticEvent<HTMLElement>) => mixed,
20
20
  };
21
21
 
22
- export const ButtonTabs = ({
23
- classNames,
24
- children,
25
- isFluid,
26
- size = 'medium',
27
- disabled,
28
- selectedButtonTabId,
29
- onButtonTabSelect,
30
- }: ButtonTabsProps): React.Node => {
31
- const childrenWithProps = React.Children.map(children, (child) => {
32
- if (React.isValidElement(child)) {
33
- return React.cloneElement(child, {
34
- ...child.props,
35
- isFluid,
36
- size,
37
- disabled,
38
- selectedButtonTabId,
39
- onButtonTabSelect,
40
- });
41
- }
42
- return child;
43
- });
44
-
45
- return (
46
- <div
47
- data-testid="ButtonTabs"
48
- className={classify(
49
- css.buttonTabsWrapper,
50
- {
51
- [css.medium]: size === 'medium',
52
- [css.small]: size === 'small',
53
- [css.isFluid]: isFluid,
54
- [css.disabled]: disabled,
55
- },
56
- classNames?.wrapper,
57
- )}
58
- >
59
- {childrenWithProps}
60
- </div>
61
- );
62
- };
22
+ export const ButtonTabs: React$AbstractComponent<
23
+ ButtonTabsProps,
24
+ HTMLDivElement,
25
+ > = React.forwardRef<ButtonTabsProps, HTMLDivElement>(
26
+ (
27
+ {
28
+ classNames,
29
+ children,
30
+ isFluid,
31
+ size = 'medium',
32
+ disabled,
33
+ selectedButtonTabId,
34
+ onButtonTabSelect,
35
+ }: ButtonTabsProps,
36
+ ref,
37
+ ): React.Node => {
38
+ const childrenWithProps = React.Children.map(children, (child) => {
39
+ if (React.isValidElement(child)) {
40
+ return React.cloneElement(child, {
41
+ ...child.props,
42
+ isFluid,
43
+ size,
44
+ disabled,
45
+ selectedButtonTabId,
46
+ onButtonTabSelect,
47
+ });
48
+ }
49
+ return child;
50
+ });
51
+
52
+ return (
53
+ <div
54
+ data-testid="ButtonTabs"
55
+ ref={ref}
56
+ className={classify(
57
+ css.buttonTabsWrapper,
58
+ {
59
+ [css.medium]: size === 'medium',
60
+ [css.small]: size === 'small',
61
+ [css.isFluid]: isFluid,
62
+ [css.disabled]: disabled,
63
+ },
64
+ classNames?.wrapper,
65
+ )}
66
+ >
67
+ {childrenWithProps}
68
+ </div>
69
+ );
70
+ },
71
+ );
@@ -23,7 +23,7 @@ const getPaddingValue = size => {
23
23
  const spaceKey = 'space' + (0, _string.capitalize)(size);
24
24
  return SPACES[spaceKey] || SPACES['spaceNone'];
25
25
  };
26
- const Card = _ref => {
26
+ const Card = /*#__PURE__*/React.forwardRef((_ref, ref) => {
27
27
  let {
28
28
  children,
29
29
  classNames,
@@ -41,17 +41,25 @@ const Card = _ref => {
41
41
  '--card-padding-left': getPaddingValue(paddingLeft)
42
42
  },
43
43
  "data-testid": "Card",
44
- className: (0, _classify.default)(_CardModule.default.cardWrapper, classNames?.wrapper)
44
+ className: (0, _classify.default)(_CardModule.default.cardWrapper, classNames?.wrapper),
45
+ ref: ref
45
46
  }), children);
46
- };
47
+ });
47
48
  exports.Card = Card;
48
- const ClickableCard = _ref2 => {
49
+ const ClickableCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
49
50
  let {
50
51
  classNames,
51
52
  onClick,
52
53
  disabled = false,
53
54
  ...props
54
55
  } = _ref2;
56
+ const componentRef = React.useRef(null);
57
+ React.useImperativeHandle(ref, () => componentRef.current);
58
+ React.useEffect(() => {
59
+ if (disabled) {
60
+ componentRef.current?.blur();
61
+ }
62
+ }, [disabled]);
55
63
  const onClickHandler = e => {
56
64
  if (!disabled) {
57
65
  onClick && onClick(e);
@@ -68,9 +76,10 @@ const ClickableCard = _ref2 => {
68
76
  [_CardModule.default.disabled]: disabled
69
77
  }, classNames?.wrapper)
70
78
  },
71
- tabIndex: "0",
79
+ tabIndex: disabled ? -1 : 0,
72
80
  onClick: onClickHandler,
73
- onKeyDown: onKeyDownHandler
81
+ onKeyDown: onKeyDownHandler,
82
+ ref: ref
74
83
  }));
75
- };
84
+ });
76
85
  exports.ClickableCard = ClickableCard;
@@ -41,59 +41,77 @@ const getPaddingValue = (size: PaddingSizeType): string => {
41
41
  return SPACES[spaceKey] || SPACES['spaceNone'];
42
42
  };
43
43
 
44
- export const Card = ({
45
- children,
46
- classNames,
47
- paddingTop = 'medium',
48
- paddingRight = 'medium',
49
- paddingBottom = 'medium',
50
- paddingLeft = 'medium',
51
- ...props
52
- }: CardProps): React.Node => (
53
- <div
54
- {...props}
55
- style={{
56
- '--card-padding-top': getPaddingValue(paddingTop),
57
- '--card-padding-right': getPaddingValue(paddingRight),
58
- '--card-padding-bottom': getPaddingValue(paddingBottom),
59
- '--card-padding-left': getPaddingValue(paddingLeft),
60
- }}
61
- data-testid="Card"
62
- className={classify(css.cardWrapper, classNames?.wrapper)}
63
- >
64
- {children}
65
- </div>
66
- );
67
-
68
- export const ClickableCard = ({
69
- classNames,
70
- onClick,
71
- disabled = false,
72
- ...props
73
- }: ClickableCardProps): React.Node => {
74
- const onClickHandler = (e) => {
75
- if (!disabled) {
76
- onClick && onClick(e);
77
- }
78
- };
79
- const onKeyDownHandler = (e) => {
80
- if (e.key === 'Enter') {
81
- onClickHandler(e);
82
- }
83
- };
84
- return (
85
- <Card
86
- {...props}
87
- classNames={{
88
- wrapper: classify(
89
- css.clickableCard,
90
- {[css.disabled]: disabled},
91
- classNames?.wrapper,
92
- ),
93
- }}
94
- tabIndex="0"
95
- onClick={onClickHandler}
96
- onKeyDown={onKeyDownHandler}
97
- />
44
+ export const Card: React$AbstractComponent<CardProps, HTMLDivElement> =
45
+ React.forwardRef<CardProps, HTMLDivElement>(
46
+ (
47
+ {
48
+ children,
49
+ classNames,
50
+ paddingTop = 'medium',
51
+ paddingRight = 'medium',
52
+ paddingBottom = 'medium',
53
+ paddingLeft = 'medium',
54
+ ...props
55
+ }: CardProps,
56
+ ref,
57
+ ): React.Node => (
58
+ <div
59
+ {...props}
60
+ style={{
61
+ '--card-padding-top': getPaddingValue(paddingTop),
62
+ '--card-padding-right': getPaddingValue(paddingRight),
63
+ '--card-padding-bottom': getPaddingValue(paddingBottom),
64
+ '--card-padding-left': getPaddingValue(paddingLeft),
65
+ }}
66
+ data-testid="Card"
67
+ className={classify(css.cardWrapper, classNames?.wrapper)}
68
+ ref={ref}
69
+ >
70
+ {children}
71
+ </div>
72
+ ),
98
73
  );
99
- };
74
+
75
+ export const ClickableCard: React$AbstractComponent<
76
+ ClickableCardProps,
77
+ HTMLDivElement,
78
+ > = React.forwardRef<ClickableCardProps, HTMLDivElement>(
79
+ (
80
+ {classNames, onClick, disabled = false, ...props}: ClickableCardProps,
81
+ ref,
82
+ ): React.Node => {
83
+ const componentRef = React.useRef(null);
84
+ React.useImperativeHandle(ref, () => componentRef.current);
85
+ React.useEffect(() => {
86
+ if (disabled) {
87
+ componentRef.current?.blur();
88
+ }
89
+ }, [disabled]);
90
+ const onClickHandler = (e) => {
91
+ if (!disabled) {
92
+ onClick && onClick(e);
93
+ }
94
+ };
95
+ const onKeyDownHandler = (e) => {
96
+ if (e.key === 'Enter') {
97
+ onClickHandler(e);
98
+ }
99
+ };
100
+ return (
101
+ <Card
102
+ {...props}
103
+ classNames={{
104
+ wrapper: classify(
105
+ css.clickableCard,
106
+ {[css.disabled]: disabled},
107
+ classNames?.wrapper,
108
+ ),
109
+ }}
110
+ tabIndex={disabled ? -1 : 0}
111
+ onClick={onClickHandler}
112
+ onKeyDown={onKeyDownHandler}
113
+ ref={ref}
114
+ />
115
+ );
116
+ },
117
+ );
@@ -22,7 +22,7 @@ const CHIP_SEMANTIC = Object.freeze({
22
22
  secondary: 'secondary'
23
23
  });
24
24
  exports.CHIP_SEMANTIC = CHIP_SEMANTIC;
25
- const Chip = _ref => {
25
+ const Chip = /*#__PURE__*/React.forwardRef((_ref, ref) => {
26
26
  let {
27
27
  classNames,
28
28
  semantic = 'primary',
@@ -39,6 +39,7 @@ const Chip = _ref => {
39
39
  return /*#__PURE__*/React.createElement("div", _extends({
40
40
  "data-testid": "Chip"
41
41
  }, rest, {
42
+ ref: ref,
42
43
  className: (0, _classify.classify)(_ChipModule.default.chipWrapper, {
43
44
  [_ChipModule.default.primary]: semantic === CHIP_SEMANTIC.primary,
44
45
  [_ChipModule.default.information]: semantic === CHIP_SEMANTIC.information,
@@ -70,5 +71,5 @@ const Chip = _ref => {
70
71
  }
71
72
  }
72
73
  }));
73
- };
74
+ });
74
75
  exports.Chip = Chip;
@@ -48,64 +48,71 @@ export type SmallChipProps = {
48
48
  };
49
49
 
50
50
  export type ChipProps = MediumChipProps | SmallChipProps;
51
- export const Chip = ({
52
- classNames,
53
- semantic = 'primary',
54
- size = 'medium',
55
- children,
56
- iconName = '',
57
- iconType = 'regular',
58
- dismissable = false,
59
- onDismiss = () => null,
60
- onClick,
61
- disabled,
62
- ...rest
63
- }: ChipProps): React.Node => (
64
- <div
65
- data-testid="Chip"
66
- {...rest}
67
- className={classify(
68
- css.chipWrapper,
51
+ export const Chip: React$AbstractComponent<ChipProps, HTMLDivElement> =
52
+ React.forwardRef<ChipProps, HTMLDivElement>(
53
+ (
69
54
  {
70
- [css.primary]: semantic === CHIP_SEMANTIC.primary,
71
- [css.information]: semantic === CHIP_SEMANTIC.information,
72
- [css.success]: semantic === CHIP_SEMANTIC.success,
73
- [css.warning]: semantic === CHIP_SEMANTIC.warning,
74
- [css.danger]: semantic === CHIP_SEMANTIC.danger,
75
- [css.secondary]: semantic === CHIP_SEMANTIC.secondary,
76
- [css.medium]: size === 'medium',
77
- [css.small]: size === 'small',
78
- [css.dismissable]: dismissable,
79
- [css.withIcon]: !!iconName && size !== 'small',
80
- [css.disabled]: disabled,
81
- },
82
- classNames?.wrapper,
83
- )}
84
- onClick={onClick}
85
- >
86
- {iconName && size !== 'small' && (
87
- <Icon
88
- className={css.chipIcon}
89
- name={iconName}
90
- type={iconType}
91
- size="small"
92
- />
93
- )}
94
- <Truncate>{children}</Truncate>
55
+ classNames,
56
+ semantic = 'primary',
57
+ size = 'medium',
58
+ children,
59
+ iconName = '',
60
+ iconType = 'regular',
61
+ dismissable = false,
62
+ onDismiss = () => null,
63
+ onClick,
64
+ disabled,
65
+ ...rest
66
+ }: ChipProps,
67
+ ref,
68
+ ): React.Node => (
69
+ <div
70
+ data-testid="Chip"
71
+ {...rest}
72
+ ref={ref}
73
+ className={classify(
74
+ css.chipWrapper,
75
+ {
76
+ [css.primary]: semantic === CHIP_SEMANTIC.primary,
77
+ [css.information]: semantic === CHIP_SEMANTIC.information,
78
+ [css.success]: semantic === CHIP_SEMANTIC.success,
79
+ [css.warning]: semantic === CHIP_SEMANTIC.warning,
80
+ [css.danger]: semantic === CHIP_SEMANTIC.danger,
81
+ [css.secondary]: semantic === CHIP_SEMANTIC.secondary,
82
+ [css.medium]: size === 'medium',
83
+ [css.small]: size === 'small',
84
+ [css.dismissable]: dismissable,
85
+ [css.withIcon]: !!iconName && size !== 'small',
86
+ [css.disabled]: disabled,
87
+ },
88
+ classNames?.wrapper,
89
+ )}
90
+ onClick={onClick}
91
+ >
92
+ {iconName && size !== 'small' && (
93
+ <Icon
94
+ className={css.chipIcon}
95
+ name={iconName}
96
+ type={iconType}
97
+ size="small"
98
+ />
99
+ )}
100
+ <Truncate>{children}</Truncate>
95
101
 
96
- {dismissable && size !== 'small' && (
97
- <Icon
98
- className={css.dismissIcon}
99
- name="xmark"
100
- type={iconType}
101
- size="small"
102
- onClick={(event) => {
103
- event.stopPropagation();
104
- if (!disabled && onDismiss) {
105
- onDismiss(event);
106
- }
107
- }}
108
- />
109
- )}
110
- </div>
111
- );
102
+ {dismissable && size !== 'small' && (
103
+ <Icon
104
+ className={css.dismissIcon}
105
+ name="xmark"
106
+ type={iconType}
107
+ size="small"
108
+ onClick={(event) => {
109
+ event.stopPropagation();
110
+ if (!disabled && onDismiss) {
111
+ onDismiss(event);
112
+ }
113
+ }}
114
+ />
115
+ )}
116
+ </div>
117
+ ),
118
+ );
@@ -12,17 +12,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
 
15
- const CircularLoader = _ref => {
15
+ const CircularLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
16
  let {
17
17
  size = 'medium',
18
18
  className,
19
- colorToken = 'colorFillPrimary'
19
+ colorToken = 'colorFillPrimary',
20
+ ariaLabel = 'Loading'
20
21
  } = _ref;
21
22
  return /*#__PURE__*/React.createElement("div", {
22
23
  className: (0, _classify.default)(_CircularLoaderModule.default.container, {
23
24
  [_CircularLoaderModule.default.mediumContainer]: size === 'medium',
24
25
  [_CircularLoaderModule.default.smallContainer]: size === 'small'
25
- }, className)
26
+ }, className),
27
+ ref: ref,
28
+ "aria-label": ariaLabel,
29
+ role: "alert",
30
+ "aria-busy": "true"
26
31
  }, /*#__PURE__*/React.createElement("div", {
27
32
  className: _CircularLoaderModule.default.spinLoader,
28
33
  "aria-hidden": "true"
@@ -37,5 +42,5 @@ const CircularLoader = _ref => {
37
42
  '--color': COLORS[colorToken]
38
43
  }
39
44
  })));
40
- };
45
+ });
41
46
  exports.CircularLoader = CircularLoader;
@@ -11,34 +11,48 @@ import css from './CircularLoader.module.css';
11
11
  export type CircularLoaderProps = {
12
12
  size?: 'large' | 'medium' | 'small',
13
13
  className?: string,
14
+ ariaLabel?: string,
14
15
  // TODO: update it to permissible colors
15
16
  colorToken?: $Keys<typeof COLORS>,
16
17
  };
17
18
 
18
- export const CircularLoader = ({
19
- size = 'medium',
20
- className,
21
- colorToken = 'colorFillPrimary',
22
- }: CircularLoaderProps): React.Node => (
23
- <div
24
- className={classify(
25
- css.container,
26
- {
27
- [css.mediumContainer]: size === 'medium',
28
- [css.smallContainer]: size === 'small',
29
- },
19
+ export const CircularLoader: React$AbstractComponent<
20
+ CircularLoaderProps,
21
+ HTMLDivElement,
22
+ > = React.forwardRef<CircularLoaderProps, HTMLDivElement>(
23
+ (
24
+ {
25
+ size = 'medium',
30
26
  className,
31
- )}
32
- >
33
- <div className={css.spinLoader} aria-hidden="true">
34
- <div
35
- className={css.outerCircle}
36
- style={{'--color': COLORS[colorToken]}}
37
- ></div>
38
- <div
39
- className={css.ellipse}
40
- style={{'--color': COLORS[colorToken]}}
41
- ></div>
27
+ colorToken = 'colorFillPrimary',
28
+ ariaLabel = 'Loading',
29
+ }: CircularLoaderProps,
30
+ ref,
31
+ ): React.Node => (
32
+ <div
33
+ className={classify(
34
+ css.container,
35
+ {
36
+ [css.mediumContainer]: size === 'medium',
37
+ [css.smallContainer]: size === 'small',
38
+ },
39
+ className,
40
+ )}
41
+ ref={ref}
42
+ aria-label={ariaLabel}
43
+ role="alert"
44
+ aria-busy="true"
45
+ >
46
+ <div className={css.spinLoader} aria-hidden="true">
47
+ <div
48
+ className={css.outerCircle}
49
+ style={{'--color': COLORS[colorToken]}}
50
+ ></div>
51
+ <div
52
+ className={css.ellipse}
53
+ style={{'--color': COLORS[colorToken]}}
54
+ ></div>
55
+ </div>
42
56
  </div>
43
- </div>
57
+ ),
44
58
  );
@@ -42,7 +42,7 @@ const CollapsibleCardContent = _ref2 => {
42
42
  }, children);
43
43
  };
44
44
  exports.CollapsibleCardContent = CollapsibleCardContent;
45
- const CollapsibleCard = _ref3 => {
45
+ const CollapsibleCard = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
46
46
  let {
47
47
  id,
48
48
  isOpen,
@@ -57,7 +57,8 @@ const CollapsibleCard = _ref3 => {
57
57
  const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(Boolean(isOpen));
58
58
  return /*#__PURE__*/React.createElement("div", {
59
59
  "data-testid": "CollapsibleCard",
60
- className: (0, _classify.default)(_CollapsibleCardModule.default.wrapper, classNames?.wrapper)
60
+ className: (0, _classify.default)(_CollapsibleCardModule.default.wrapper, classNames?.wrapper),
61
+ ref: ref
61
62
  }, /*#__PURE__*/React.createElement(_Button.UnstyledButton, {
62
63
  className: (0, _classify.default)(_CollapsibleCardModule.default.header, {
63
64
  [_CollapsibleCardModule.default.isOpen]: collapsibleCardIsOpen
@@ -86,5 +87,5 @@ const CollapsibleCard = _ref3 => {
86
87
  })), collapsibleCardIsOpen && /*#__PURE__*/React.createElement("div", {
87
88
  className: (0, _classify.default)(_CollapsibleCardModule.default.content, classNames?.content)
88
89
  }, children));
89
- };
90
+ });
90
91
  exports.CollapsibleCard = CollapsibleCard;