@spaced-out/ui-design-system 0.1.15 → 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 (102) hide show
  1. package/.cspell/custom-words.txt +3 -0
  2. package/.flowconfig +1 -1
  3. package/CHANGELOG.md +15 -0
  4. package/CONTRIBUTING.md +52 -6
  5. package/README.md +144 -8
  6. package/gulpfile.js +1 -0
  7. package/lib/components/Avatar/Avatar.module.css +8 -2
  8. package/lib/components/AvatarGroup/AvatarGroup.js +25 -14
  9. package/lib/components/AvatarGroup/AvatarGroup.js.flow +118 -103
  10. package/lib/components/Badge/Badge.js +4 -3
  11. package/lib/components/Badge/Badge.js.flow +21 -21
  12. package/lib/components/Badge/index.js +11 -7
  13. package/lib/components/Badge/index.js.flow +1 -2
  14. package/lib/components/Banner/Banner.js +3 -2
  15. package/lib/components/Banner/Banner.js.flow +42 -35
  16. package/lib/components/Button/Button.js +50 -10
  17. package/lib/components/Button/Button.js.flow +87 -23
  18. package/lib/components/Button/Button.module.css +14 -0
  19. package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js +3 -2
  20. package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js.flow +48 -38
  21. package/lib/components/ButtonTabs/ButtonTabs.js +3 -2
  22. package/lib/components/ButtonTabs/ButtonTabs.js.flow +50 -41
  23. package/lib/components/Card/Card.js +16 -7
  24. package/lib/components/Card/Card.js.flow +73 -55
  25. package/lib/components/Checkbox/Checkbox.js +15 -10
  26. package/lib/components/Checkbox/Checkbox.js.flow +121 -100
  27. package/lib/components/Checkbox/Checkbox.module.css +4 -1
  28. package/lib/components/Checkbox/CheckboxGroup.js +4 -3
  29. package/lib/components/Checkbox/CheckboxGroup.js.flow +76 -65
  30. package/lib/components/Chip/Chip.js +3 -2
  31. package/lib/components/Chip/Chip.js.flow +66 -59
  32. package/lib/components/CircularLoader/CircularLoader.js +9 -4
  33. package/lib/components/CircularLoader/CircularLoader.js.flow +38 -24
  34. package/lib/components/CollapsibleCard/CollapsibleCard.js +4 -3
  35. package/lib/components/CollapsibleCard/CollapsibleCard.js.flow +68 -59
  36. package/lib/components/Dropdown/Dropdown.js +4 -3
  37. package/lib/components/Dropdown/Dropdown.js.flow +83 -74
  38. package/lib/components/EmptyState/EmptyState.js +4 -3
  39. package/lib/components/EmptyState/EmptyState.js.flow +53 -44
  40. package/lib/components/ErrorMessage/ErrorMessage.js +4 -3
  41. package/lib/components/ErrorMessage/ErrorMessage.js.flow +58 -49
  42. package/lib/components/InContextAlert/InContextAlert.js +4 -3
  43. package/lib/components/InContextAlert/InContextAlert.js.flow +79 -73
  44. package/lib/components/InlineDropdown/InlineDropdown.js +4 -3
  45. package/lib/components/InlineDropdown/InlineDropdown.js.flow +94 -85
  46. package/lib/components/LinearLoader/LinearLoader.js +4 -3
  47. package/lib/components/LinearLoader/LinearLoader.js.flow +20 -18
  48. package/lib/components/Link/Link.js +8 -1
  49. package/lib/components/Link/Link.js.flow +44 -36
  50. package/lib/components/Notification/Notification.js +8 -6
  51. package/lib/components/Notification/Notification.js.flow +96 -84
  52. package/lib/components/OptionButton/OptionButton.js +7 -4
  53. package/lib/components/OptionButton/OptionButton.js.flow +69 -59
  54. package/lib/components/PageTitle/PageTitle.js +4 -3
  55. package/lib/components/PageTitle/PageTitle.js.flow +46 -44
  56. package/lib/components/Pagination/PaginationItem.js +2 -2
  57. package/lib/components/Pagination/PaginationItem.js.flow +2 -2
  58. package/lib/components/RadioButton/RadioButton.js +15 -9
  59. package/lib/components/RadioButton/RadioButton.js.flow +91 -70
  60. package/lib/components/RadioButton/RadioButton.module.css +4 -1
  61. package/lib/components/RadioButton/RadioGroup.js +4 -3
  62. package/lib/components/RadioButton/RadioGroup.js.flow +56 -47
  63. package/lib/components/SearchInput/SearchInput.js +3 -2
  64. package/lib/components/SearchInput/SearchInput.js.flow +59 -50
  65. package/lib/components/SideMenuLink/SideMenuLink.js +4 -3
  66. package/lib/components/SideMenuLink/SideMenuLink.js.flow +54 -45
  67. package/lib/components/StatusIndicator/StatusIndicator.js +3 -2
  68. package/lib/components/StatusIndicator/StatusIndicator.js.flow +32 -23
  69. package/lib/components/SubMenu/SubMenu.js +4 -3
  70. package/lib/components/SubMenu/SubMenu.js.flow +41 -38
  71. package/lib/components/Table/StaticTable.js +3 -0
  72. package/lib/components/Table/StaticTable.js.flow +3 -0
  73. package/lib/components/Table/Table.js +10 -0
  74. package/lib/components/Table/Table.js.flow +10 -0
  75. package/lib/components/Table/hooks.js +1 -0
  76. package/lib/components/Table/hooks.js.flow +1 -0
  77. package/lib/components/Tabs/TabList/TabList.js +3 -2
  78. package/lib/components/Tabs/TabList/TabList.js.flow +127 -117
  79. package/lib/components/Toast/Toast.js +8 -10
  80. package/lib/components/Toast/Toast.js.flow +19 -27
  81. package/lib/components/Toast/Toast.module.css +8 -0
  82. package/lib/components/Toggle/Toggle.js +11 -7
  83. package/lib/components/Toggle/Toggle.js.flow +16 -12
  84. package/lib/components/Toggle/Toggle.module.css +2 -0
  85. package/lib/components/Toggle/index.js +11 -7
  86. package/lib/components/Toggle/index.js.flow +1 -1
  87. package/lib/components/Tooltip/Tooltip.js.flow +2 -2
  88. package/lib/components/index.js +511 -0
  89. package/lib/components/index.js.flow +48 -0
  90. package/lib/index.js +60 -0
  91. package/lib/index.js.flow +7 -0
  92. package/lib/styles/index.css +15 -0
  93. package/lib/styles/index.js +104 -0
  94. package/lib/styles/index.js.flow +12 -0
  95. package/lib/styles/typography.module.css +0 -1
  96. package/lib/styles/utils.module.css +26 -0
  97. package/lib/types/index.js +38 -0
  98. package/lib/types/index.js.flow +5 -0
  99. package/lib/utils/click-away.js.flow +1 -1
  100. package/lib/utils/index.js +93 -0
  101. package/lib/utils/index.js.flow +10 -0
  102. package/package.json +2 -1
@@ -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;
@@ -69,65 +69,74 @@ export const CollapsibleCardContent = ({
69
69
  <div className={classify(css.contentContainer, className)}>{children}</div>
70
70
  );
71
71
 
72
- export const CollapsibleCard = ({
73
- id,
74
- isOpen,
75
- onChange,
76
- classNames,
77
- title,
78
- children,
79
- semantic = 'neutral',
80
- headerIconName,
81
- headerIconType = 'solid',
82
- }: CollapsibleCardProps): React.Node => {
83
- const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(
84
- Boolean(isOpen),
85
- );
86
-
87
- return (
88
- <div
89
- data-testid="CollapsibleCard"
90
- className={classify(css.wrapper, classNames?.wrapper)}
91
- >
92
- <UnstyledButton
93
- className={classify(
94
- css.header,
95
- {
96
- [css.isOpen]: collapsibleCardIsOpen,
97
- },
98
- classNames?.title,
99
- )}
100
- onClick={(e) => {
101
- onChange?.(e, !collapsibleCardIsOpen, id);
102
- setCollapsibleCardIsOpen(!collapsibleCardIsOpen);
103
- }}
72
+ export const CollapsibleCard: React$AbstractComponent<
73
+ CollapsibleCardProps,
74
+ HTMLDivElement,
75
+ > = React.forwardRef<CollapsibleCardProps, HTMLDivElement>(
76
+ (
77
+ {
78
+ id,
79
+ isOpen,
80
+ onChange,
81
+ classNames,
82
+ title,
83
+ children,
84
+ semantic = 'neutral',
85
+ headerIconName,
86
+ headerIconType = 'solid',
87
+ }: CollapsibleCardProps,
88
+ ref,
89
+ ): React.Node => {
90
+ const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(
91
+ Boolean(isOpen),
92
+ );
93
+
94
+ return (
95
+ <div
96
+ data-testid="CollapsibleCard"
97
+ className={classify(css.wrapper, classNames?.wrapper)}
98
+ ref={ref}
104
99
  >
105
- <div className={css.headerContent}>
106
- {!!headerIconName && (
107
- <div className={classify(css.iconContainer, css[semantic])}>
108
- <Icon
109
- name={headerIconName}
110
- type={headerIconType}
111
- size="small"
112
- className={css[semantic]}
113
- />
114
- </div>
100
+ <UnstyledButton
101
+ className={classify(
102
+ css.header,
103
+ {
104
+ [css.isOpen]: collapsibleCardIsOpen,
105
+ },
106
+ classNames?.title,
115
107
  )}
116
-
117
- <Truncate>{title}</Truncate>
118
- </div>
119
-
120
- {collapsibleCardIsOpen ? (
121
- <Icon name="chevron-up" color="secondary" size="small" />
122
- ) : (
123
- <Icon name="chevron-down" color="secondary" size="small" />
108
+ onClick={(e) => {
109
+ onChange?.(e, !collapsibleCardIsOpen, id);
110
+ setCollapsibleCardIsOpen(!collapsibleCardIsOpen);
111
+ }}
112
+ >
113
+ <div className={css.headerContent}>
114
+ {!!headerIconName && (
115
+ <div className={classify(css.iconContainer, css[semantic])}>
116
+ <Icon
117
+ name={headerIconName}
118
+ type={headerIconType}
119
+ size="small"
120
+ className={css[semantic]}
121
+ />
122
+ </div>
123
+ )}
124
+
125
+ <Truncate>{title}</Truncate>
126
+ </div>
127
+
128
+ {collapsibleCardIsOpen ? (
129
+ <Icon name="chevron-up" color="secondary" size="small" />
130
+ ) : (
131
+ <Icon name="chevron-down" color="secondary" size="small" />
132
+ )}
133
+ </UnstyledButton>
134
+ {collapsibleCardIsOpen && (
135
+ <div className={classify(css.content, classNames?.content)}>
136
+ {children}
137
+ </div>
124
138
  )}
125
- </UnstyledButton>
126
- {collapsibleCardIsOpen && (
127
- <div className={classify(css.content, classNames?.content)}>
128
- {children}
129
- </div>
130
- )}
131
- </div>
132
- );
133
- };
139
+ </div>
140
+ );
141
+ },
142
+ );
@@ -18,7 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  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); }
19
19
  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; }
20
20
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
- const Dropdown = _ref => {
21
+ const Dropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
22
22
  let {
23
23
  size = 'medium',
24
24
  classNames,
@@ -72,7 +72,8 @@ const Dropdown = _ref => {
72
72
  onContainerClick: e => {
73
73
  e.stopPropagation();
74
74
  onOpen();
75
- }
75
+ },
76
+ ref: ref
76
77
  })), isOpen && menu && /*#__PURE__*/React.createElement("div", {
77
78
  onClickCapture: cancelNext,
78
79
  ref: floating,
@@ -93,5 +94,5 @@ const Dropdown = _ref => {
93
94
  size: menu.size || size
94
95
  }))));
95
96
  });
96
- };
97
+ });
97
98
  exports.Dropdown = Dropdown;
@@ -38,81 +38,90 @@ export type DropdownProps = {
38
38
  ...
39
39
  };
40
40
 
41
- export const Dropdown = ({
42
- size = 'medium',
43
- classNames,
44
- placeholder = 'Select...',
45
- onChange,
46
- menu,
47
- onMenuOpen,
48
- onMenuClose,
49
- dropdownInputText = '',
50
- ...inputProps
51
- }: DropdownProps): React.Node => {
52
- const dropdownRef = React.useRef();
53
- const {x, y, reference, floating, strategy} = useFloating({
54
- strategy: 'absolute',
55
- placement: 'bottom-start',
56
- whileElementsMounted: autoUpdate,
57
- middleware: [flip(), offset(parseInt(spaceXXSmall))],
58
- });
41
+ export const Dropdown: React$AbstractComponent<
42
+ DropdownProps,
43
+ HTMLInputElement,
44
+ > = React.forwardRef<DropdownProps, HTMLInputElement>(
45
+ (
46
+ {
47
+ size = 'medium',
48
+ classNames,
49
+ placeholder = 'Select...',
50
+ onChange,
51
+ menu,
52
+ onMenuOpen,
53
+ onMenuClose,
54
+ dropdownInputText = '',
55
+ ...inputProps
56
+ }: DropdownProps,
57
+ ref,
58
+ ): React.Node => {
59
+ const dropdownRef = React.useRef();
60
+ const {x, y, reference, floating, strategy} = useFloating({
61
+ strategy: 'absolute',
62
+ placement: 'bottom-start',
63
+ whileElementsMounted: autoUpdate,
64
+ middleware: [flip(), offset(parseInt(spaceXXSmall))],
65
+ });
59
66
 
60
- const onMenuToggle = (isOpen: boolean) => {
61
- isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
62
- };
67
+ const onMenuToggle = (isOpen: boolean) => {
68
+ isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
69
+ };
63
70
 
64
- return (
65
- <ClickAway onChange={onMenuToggle}>
66
- {({isOpen, onOpen, cancelNext, clickAway}) => (
67
- <div
68
- data-testid="Dropdown"
69
- className={classify(css.dropdownContainer, classNames?.wrapper)}
70
- ref={dropdownRef}
71
- >
72
- <Input
73
- {...inputProps}
74
- boxRef={reference}
75
- size={size}
76
- placeholder={placeholder}
77
- value={dropdownInputText}
78
- classNames={{box: css.inputBox}}
79
- iconRightName={isOpen ? 'angle-up' : 'angle-down'}
80
- readOnly
81
- onContainerClick={(e) => {
82
- e.stopPropagation();
83
- onOpen();
84
- }}
85
- />
86
-
87
- {isOpen && menu && (
88
- <div
89
- onClickCapture={cancelNext}
90
- ref={floating}
91
- style={{
92
- position: strategy,
93
- top: y ?? spaceNone,
94
- left: x ?? spaceNone,
95
- width: sizeFluid,
96
- backgroundColor: colorBackgroundTertiary,
71
+ return (
72
+ <ClickAway onChange={onMenuToggle}>
73
+ {({isOpen, onOpen, cancelNext, clickAway}) => (
74
+ <div
75
+ data-testid="Dropdown"
76
+ className={classify(css.dropdownContainer, classNames?.wrapper)}
77
+ ref={dropdownRef}
78
+ >
79
+ <Input
80
+ {...inputProps}
81
+ boxRef={reference}
82
+ size={size}
83
+ placeholder={placeholder}
84
+ value={dropdownInputText}
85
+ classNames={{box: css.inputBox}}
86
+ iconRightName={isOpen ? 'angle-up' : 'angle-down'}
87
+ readOnly
88
+ onContainerClick={(e) => {
89
+ e.stopPropagation();
90
+ onOpen();
97
91
  }}
98
- >
99
- <Menu
100
- {...menu}
101
- onSelect={(option) => {
102
- onChange && onChange(option);
103
- if (
104
- !menu.optionsVariant ||
105
- menu.optionsVariant === 'normal'
106
- ) {
107
- clickAway();
108
- }
92
+ ref={ref}
93
+ />
94
+
95
+ {isOpen && menu && (
96
+ <div
97
+ onClickCapture={cancelNext}
98
+ ref={floating}
99
+ style={{
100
+ position: strategy,
101
+ top: y ?? spaceNone,
102
+ left: x ?? spaceNone,
103
+ width: sizeFluid,
104
+ backgroundColor: colorBackgroundTertiary,
109
105
  }}
110
- size={menu.size || size}
111
- />
112
- </div>
113
- )}
114
- </div>
115
- )}
116
- </ClickAway>
117
- );
118
- };
106
+ >
107
+ <Menu
108
+ {...menu}
109
+ onSelect={(option) => {
110
+ onChange && onChange(option);
111
+ if (
112
+ !menu.optionsVariant ||
113
+ menu.optionsVariant === 'normal'
114
+ ) {
115
+ clickAway();
116
+ }
117
+ }}
118
+ size={menu.size || size}
119
+ />
120
+ </div>
121
+ )}
122
+ </div>
123
+ )}
124
+ </ClickAway>
125
+ );
126
+ },
127
+ );
@@ -12,7 +12,7 @@ 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
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
- const EmptyState = _ref => {
15
+ const EmptyState = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
16
  let {
17
17
  classNames,
18
18
  children,
@@ -24,7 +24,8 @@ const EmptyState = _ref => {
24
24
  } = _ref;
25
25
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
26
26
  "data-testid": "EmptyState",
27
- className: (0, _classify.default)(_EmptyStateModule.default.wrapper, classNames?.wrapper)
27
+ className: (0, _classify.default)(_EmptyStateModule.default.wrapper, classNames?.wrapper),
28
+ ref: ref
28
29
  }), !!imageVariant && !customImageUrl && /*#__PURE__*/React.createElement("div", {
29
30
  className: (0, _classify.default)(_EmptyStateModule.default.image, classNames?.image)
30
31
  }, imageVariant === 'calendar' && /*#__PURE__*/React.createElement(_EmptyImages.CalendarEmptyImage, null), imageVariant === 'data' && /*#__PURE__*/React.createElement(_EmptyImages.DataEmptyImage, null), imageVariant === 'file' && /*#__PURE__*/React.createElement(_EmptyImages.FileEmptyImage, null), imageVariant === 'message' && /*#__PURE__*/React.createElement(_EmptyImages.MessageEmptyImage, null), imageVariant === 'upload' && /*#__PURE__*/React.createElement(_EmptyImages.UploadEmptyImage, null)), customImageUrl && /*#__PURE__*/React.createElement("img", {
@@ -38,5 +39,5 @@ const EmptyState = _ref => {
38
39
  }, description), !!children && /*#__PURE__*/React.createElement("div", {
39
40
  className: (0, _classify.default)(_EmptyStateModule.default.childrenWrapper, classNames?.children)
40
41
  }, children));
41
- };
42
+ });
42
43
  exports.EmptyState = EmptyState;
@@ -33,48 +33,57 @@ export type EmptyStateProps = {
33
33
  ...
34
34
  };
35
35
 
36
- export const EmptyState = ({
37
- classNames,
38
- children,
39
- imageVariant,
40
- title,
41
- description,
42
- customImageUrl,
43
- ...props
44
- }: EmptyStateProps): React.Node => (
45
- <div
46
- {...props}
47
- data-testid="EmptyState"
48
- className={classify(css.wrapper, classNames?.wrapper)}
49
- >
50
- {!!imageVariant && !customImageUrl && (
51
- <div className={classify(css.image, classNames?.image)}>
52
- {imageVariant === 'calendar' && <CalendarEmptyImage />}
53
- {imageVariant === 'data' && <DataEmptyImage />}
54
- {imageVariant === 'file' && <FileEmptyImage />}
55
- {imageVariant === 'message' && <MessageEmptyImage />}
56
- {imageVariant === 'upload' && <UploadEmptyImage />}
57
- </div>
58
- )}
59
- {customImageUrl && (
60
- <img
61
- className={classify(css.image, classNames?.image)}
62
- src={customImageUrl}
63
- alt="Empty State"
64
- />
65
- )}
66
- {!!title && (
67
- <div className={classify(css.title, classNames?.title)}>{title}</div>
68
- )}
69
- {!!description && (
70
- <div className={classify(css.description, classNames?.description)}>
71
- {description}
72
- </div>
73
- )}
74
- {!!children && (
75
- <div className={classify(css.childrenWrapper, classNames?.children)}>
76
- {children}
77
- </div>
78
- )}
79
- </div>
36
+ export const EmptyState: React$AbstractComponent<
37
+ EmptyStateProps,
38
+ HTMLDivElement,
39
+ > = React.forwardRef<EmptyStateProps, HTMLDivElement>(
40
+ (
41
+ {
42
+ classNames,
43
+ children,
44
+ imageVariant,
45
+ title,
46
+ description,
47
+ customImageUrl,
48
+ ...props
49
+ }: EmptyStateProps,
50
+ ref,
51
+ ): React.Node => (
52
+ <div
53
+ {...props}
54
+ data-testid="EmptyState"
55
+ className={classify(css.wrapper, classNames?.wrapper)}
56
+ ref={ref}
57
+ >
58
+ {!!imageVariant && !customImageUrl && (
59
+ <div className={classify(css.image, classNames?.image)}>
60
+ {imageVariant === 'calendar' && <CalendarEmptyImage />}
61
+ {imageVariant === 'data' && <DataEmptyImage />}
62
+ {imageVariant === 'file' && <FileEmptyImage />}
63
+ {imageVariant === 'message' && <MessageEmptyImage />}
64
+ {imageVariant === 'upload' && <UploadEmptyImage />}
65
+ </div>
66
+ )}
67
+ {customImageUrl && (
68
+ <img
69
+ className={classify(css.image, classNames?.image)}
70
+ src={customImageUrl}
71
+ alt="Empty State"
72
+ />
73
+ )}
74
+ {!!title && (
75
+ <div className={classify(css.title, classNames?.title)}>{title}</div>
76
+ )}
77
+ {!!description && (
78
+ <div className={classify(css.description, classNames?.description)}>
79
+ {description}
80
+ </div>
81
+ )}
82
+ {!!children && (
83
+ <div className={classify(css.childrenWrapper, classNames?.children)}>
84
+ {children}
85
+ </div>
86
+ )}
87
+ </div>
88
+ ),
80
89
  );
@@ -12,7 +12,7 @@ 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
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
- const ErrorMessage = _ref => {
15
+ const ErrorMessage = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
16
  let {
17
17
  classNames,
18
18
  children,
@@ -25,7 +25,8 @@ const ErrorMessage = _ref => {
25
25
  } = _ref;
26
26
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
27
27
  "data-testid": "ErrorMessage",
28
- className: (0, _classify.default)(_ErrorMessageModule.default.wrapper, classNames?.wrapper)
28
+ className: (0, _classify.default)(_ErrorMessageModule.default.wrapper, classNames?.wrapper),
29
+ ref: ref
29
30
  }), !!imageVariant && !customImageUrl && /*#__PURE__*/React.createElement("div", {
30
31
  className: (0, _classify.default)(_ErrorMessageModule.default.image, classNames?.image)
31
32
  }, imageVariant === 'unauthorized' && /*#__PURE__*/React.createElement(_ErrorImages.UnauthorizedImage, null), imageVariant === 'forbidden' && /*#__PURE__*/React.createElement(_ErrorImages.ForbiddenImage, null), imageVariant === 'notFound' && /*#__PURE__*/React.createElement(_ErrorImages.NotFoundImage, null), imageVariant === 'serverError' && /*#__PURE__*/React.createElement(_ErrorImages.ServerErrorImage, null)), customImageUrl && /*#__PURE__*/React.createElement("img", {
@@ -41,5 +42,5 @@ const ErrorMessage = _ref => {
41
42
  }, description), !!children && /*#__PURE__*/React.createElement("div", {
42
43
  className: (0, _classify.default)(_ErrorMessageModule.default.childrenWrapper, classNames?.children)
43
44
  }, children));
44
- };
45
+ });
45
46
  exports.ErrorMessage = ErrorMessage;