@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
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.RadioButton = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _classify = _interopRequireDefault(require("../../utils/classify"));
9
- var _Text = require("../Text/Text");
10
9
  var _RadioButtonModule = _interopRequireDefault(require("./RadioButton.module.css"));
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
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); }
13
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; }
14
13
  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 RadioButton = _ref => {
14
+ const RadioButton = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
16
15
  let {
17
16
  children,
18
17
  disabled = false,
@@ -22,18 +21,23 @@ const RadioButton = _ref => {
22
21
  selectedValue,
23
22
  onChange,
24
23
  align = 'vertical',
25
- className,
24
+ classNames,
26
25
  error = false,
27
26
  tabIndex = 0,
27
+ ariaLabel = '',
28
28
  ...props
29
29
  } = _ref;
30
30
  const radioInput = /*#__PURE__*/React.createRef();
31
+ React.useImperativeHandle(forwardRef, () => radioInput.current);
31
32
  const checked = selectedValue === value;
32
33
  React.useEffect(() => {
33
34
  if (radioInput.current && focused) {
34
35
  radioInput.current.focus();
35
36
  }
36
37
  }, [focused]);
38
+ const onWrapClickHandler = () => {
39
+ radioInput.current?.click();
40
+ };
37
41
  const onChangeHandler = e => {
38
42
  if (!disabled) {
39
43
  onChange && onChange(e?.target?.value);
@@ -44,11 +48,12 @@ const RadioButton = _ref => {
44
48
  onChangeHandler(e);
45
49
  }
46
50
  };
47
- return /*#__PURE__*/React.createElement("label", {
51
+ return /*#__PURE__*/React.createElement("div", {
48
52
  className: (0, _classify.default)(_RadioButtonModule.default.container, {
49
53
  [_RadioButtonModule.default.horizontalRadioButton]: align === 'horizontal-fixed',
50
54
  [_RadioButtonModule.default.fluidRadioButton]: align === 'horizontal-fluid'
51
- }, className)
55
+ }, classNames?.wrapper),
56
+ onClick: onWrapClickHandler
52
57
  }, /*#__PURE__*/React.createElement("input", _extends({
53
58
  type: "radio",
54
59
  checked: checked,
@@ -64,10 +69,11 @@ const RadioButton = _ref => {
64
69
  onKeyDown: onKeyDownHandler,
65
70
  tabIndex: disabled ? -1 : tabIndex,
66
71
  name: name,
67
- value: value || ''
68
- }, props)), React.Children.count(children) > 0 && /*#__PURE__*/React.createElement(_Text.FormLabelMedium, {
72
+ value: value || '',
73
+ "aria-label": ariaLabel || children
74
+ }, props)), React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
69
75
  color: "secondary",
70
- className: _RadioButtonModule.default.radioLabel
76
+ className: (0, _classify.default)(_RadioButtonModule.default.radioLabel, classNames?.label)
71
77
  }, children));
72
- };
78
+ });
73
79
  exports.RadioButton = RadioButton;
@@ -4,7 +4,6 @@ import * as React from 'react';
4
4
 
5
5
  import type {GroupAlign} from '../../types/common';
6
6
  import classify from '../../utils/classify';
7
- import {FormLabelMedium} from '../Text/Text';
8
7
 
9
8
  import css from './RadioButton.module.css';
10
9
 
@@ -15,6 +14,8 @@ import css from './RadioButton.module.css';
15
14
  * nesting labels is a bad idea.
16
15
  */
17
16
 
17
+ type ClassNames = $ReadOnly<{wrapper?: string, label?: string}>;
18
+
18
19
  export type RadioButtonProps = {
19
20
  children?: React.Node,
20
21
  value?: string,
@@ -23,82 +24,102 @@ export type RadioButtonProps = {
23
24
  name?: string,
24
25
  selectedValue?: string,
25
26
  align?: GroupAlign,
26
- className?: string,
27
+ classNames?: ClassNames,
27
28
  error?: boolean,
28
29
  onChange?: (newValue: string) => mixed,
29
30
  tabIndex?: number,
31
+ ariaLabel?: string,
30
32
  };
31
33
 
32
- export const RadioButton = ({
33
- children,
34
- disabled = false,
35
- value = '',
36
- focused = false,
37
- name = 'radio',
38
- selectedValue,
39
- onChange,
40
- align = 'vertical',
41
- className,
42
- error = false,
43
- tabIndex = 0,
44
- ...props
45
- }: RadioButtonProps): React.Node => {
46
- const radioInput = React.createRef<HTMLInputElement>();
34
+ export const RadioButton: React$AbstractComponent<
35
+ RadioButtonProps,
36
+ HTMLInputElement,
37
+ > = React.forwardRef<RadioButtonProps, HTMLInputElement>(
38
+ (
39
+ {
40
+ children,
41
+ disabled = false,
42
+ value = '',
43
+ focused = false,
44
+ name = 'radio',
45
+ selectedValue,
46
+ onChange,
47
+ align = 'vertical',
48
+ classNames,
49
+ error = false,
50
+ tabIndex = 0,
51
+ ariaLabel = '',
52
+ ...props
53
+ }: RadioButtonProps,
54
+ forwardRef,
55
+ ): React.Node => {
56
+ const radioInput = React.createRef<HTMLInputElement>();
57
+ React.useImperativeHandle(forwardRef, () => radioInput.current);
47
58
 
48
- const checked = selectedValue === value;
59
+ const checked = selectedValue === value;
49
60
 
50
- React.useEffect(() => {
51
- if (radioInput.current && focused) {
52
- radioInput.current.focus();
53
- }
54
- }, [focused]);
61
+ React.useEffect(() => {
62
+ if (radioInput.current && focused) {
63
+ radioInput.current.focus();
64
+ }
65
+ }, [focused]);
55
66
 
56
- const onChangeHandler = (e) => {
57
- if (!disabled) {
58
- onChange && onChange(e?.target?.value);
59
- }
60
- };
67
+ const onWrapClickHandler = () => {
68
+ radioInput.current?.click();
69
+ };
61
70
 
62
- const onKeyDownHandler = (e) => {
63
- if (e.key === 'Enter') {
64
- onChangeHandler(e);
65
- }
66
- };
71
+ const onChangeHandler = (e) => {
72
+ if (!disabled) {
73
+ onChange && onChange(e?.target?.value);
74
+ }
75
+ };
67
76
 
68
- return (
69
- <label
70
- className={classify(
71
- css.container,
72
- {
73
- [css.horizontalRadioButton]: align === 'horizontal-fixed',
74
- [css.fluidRadioButton]: align === 'horizontal-fluid',
75
- },
76
- className,
77
- )}
78
- >
79
- <input
80
- type="radio"
81
- checked={checked}
82
- disabled={disabled}
83
- className={classify(css.radio, {
84
- [css.unselected]: !checked && !disabled && !error,
85
- [css.selected]: checked && !disabled && !error,
86
- [css.disabled]: disabled,
87
- [css.error]: error && !disabled,
88
- })}
89
- ref={radioInput}
90
- onChange={onChangeHandler}
91
- onKeyDown={onKeyDownHandler}
92
- tabIndex={disabled ? -1 : tabIndex}
93
- name={name}
94
- value={value || ''}
95
- {...props}
96
- />
97
- {React.Children.count(children) > 0 && (
98
- <FormLabelMedium color="secondary" className={css.radioLabel}>
99
- {children}
100
- </FormLabelMedium>
101
- )}
102
- </label>
103
- );
104
- };
77
+ const onKeyDownHandler = (e) => {
78
+ if (e.key === 'Enter') {
79
+ onChangeHandler(e);
80
+ }
81
+ };
82
+
83
+ return (
84
+ <div
85
+ className={classify(
86
+ css.container,
87
+ {
88
+ [css.horizontalRadioButton]: align === 'horizontal-fixed',
89
+ [css.fluidRadioButton]: align === 'horizontal-fluid',
90
+ },
91
+ classNames?.wrapper,
92
+ )}
93
+ onClick={onWrapClickHandler}
94
+ >
95
+ <input
96
+ type="radio"
97
+ checked={checked}
98
+ disabled={disabled}
99
+ className={classify(css.radio, {
100
+ [css.unselected]: !checked && !disabled && !error,
101
+ [css.selected]: checked && !disabled && !error,
102
+ [css.disabled]: disabled,
103
+ [css.error]: error && !disabled,
104
+ })}
105
+ ref={radioInput}
106
+ onChange={onChangeHandler}
107
+ onKeyDown={onKeyDownHandler}
108
+ tabIndex={disabled ? -1 : tabIndex}
109
+ name={name}
110
+ value={value || ''}
111
+ aria-label={ariaLabel || children}
112
+ {...props}
113
+ />
114
+ {React.Children.count(children) > 0 && (
115
+ <div
116
+ color="secondary"
117
+ className={classify(css.radioLabel, classNames?.label)}
118
+ >
119
+ {children}
120
+ </div>
121
+ )}
122
+ </div>
123
+ );
124
+ },
125
+ );
@@ -35,6 +35,8 @@
35
35
  flex-direction: row;
36
36
  gap: spaceSmall;
37
37
  cursor: pointer;
38
+ align-items: center;
39
+ cursor: pointer;
38
40
  }
39
41
 
40
42
  .radio {
@@ -88,7 +90,8 @@
88
90
  }
89
91
 
90
92
  .radioLabel {
91
- composes: truncate from '../../styles/typography.module.css';
93
+ composes: formLabelMedium from '../../styles/typography.module.css';
94
+ composes: secondary from '../../styles/typography.module.css';
92
95
  }
93
96
 
94
97
  .horizontalRadioButton {
@@ -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
 
15
- const RadioGroup = _ref => {
15
+ const RadioGroup = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
16
16
  let {
17
17
  align = 'vertical',
18
18
  name,
@@ -47,10 +47,11 @@ const RadioGroup = _ref => {
47
47
  [_RadioGroupModule.default.vertical]: align === 'vertical',
48
48
  [_RadioGroupModule.default.horizontal]: align === 'horizontal-fixed',
49
49
  [_RadioGroupModule.default.horizontalFluid]: align === 'horizontal-fluid'
50
- }, classNames?.radioGroup)
50
+ }, classNames?.radioGroup),
51
+ ref: forwardRef
51
52
  }, childrenWithProps), error && /*#__PURE__*/React.createElement(_Text.BodySmall, {
52
53
  color: "danger",
53
54
  className: classNames?.errorText
54
55
  }, errorText));
55
- };
56
+ });
56
57
  exports.RadioGroup = RadioGroup;
@@ -32,54 +32,63 @@ export type RadioGroupProps = {
32
32
  errorText?: string,
33
33
  };
34
34
 
35
- export const RadioGroup = ({
36
- align = 'vertical',
37
- name,
38
- value,
39
- onChange,
40
- children,
41
- classNames,
42
- error = false,
43
- errorText = '',
44
- }: RadioGroupProps): React.Node => {
45
- const onChangeHandler = (value) => {
46
- if (onChange) {
47
- onChange(value);
48
- }
49
- };
35
+ export const RadioGroup: React$AbstractComponent<
36
+ RadioGroupProps,
37
+ HTMLDivElement,
38
+ > = React.forwardRef<RadioGroupProps, HTMLDivElement>(
39
+ (
40
+ {
41
+ align = 'vertical',
42
+ name,
43
+ value,
44
+ onChange,
45
+ children,
46
+ classNames,
47
+ error = false,
48
+ errorText = '',
49
+ }: RadioGroupProps,
50
+ forwardRef,
51
+ ): React.Node => {
52
+ const onChangeHandler = (value) => {
53
+ if (onChange) {
54
+ onChange(value);
55
+ }
56
+ };
50
57
 
51
- const childrenWithProps = React.Children.map(children, (child) => {
52
- if (React.isValidElement(child)) {
53
- return React.cloneElement(child, {
54
- name,
55
- selectedValue: value,
56
- onChange: onChangeHandler,
57
- align,
58
- error,
59
- });
60
- }
61
- return child;
62
- });
58
+ const childrenWithProps = React.Children.map(children, (child) => {
59
+ if (React.isValidElement(child)) {
60
+ return React.cloneElement(child, {
61
+ name,
62
+ selectedValue: value,
63
+ onChange: onChangeHandler,
64
+ align,
65
+ error,
66
+ });
67
+ }
68
+ return child;
69
+ });
63
70
 
64
- return (
65
- <div className={classify(css.radioGroupContainer, classNames?.wrapper)}>
66
- <div
67
- className={classify(
68
- {
69
- [css.vertical]: align === 'vertical',
70
- [css.horizontal]: align === 'horizontal-fixed',
71
- [css.horizontalFluid]: align === 'horizontal-fluid',
72
- },
73
- classNames?.radioGroup,
71
+ return (
72
+ <div className={classify(css.radioGroupContainer, classNames?.wrapper)}>
73
+ <div
74
+ className={classify(
75
+ {
76
+ [css.vertical]: align === 'vertical',
77
+ [css.horizontal]: align === 'horizontal-fixed',
78
+ [css.horizontalFluid]: align === 'horizontal-fluid',
79
+ },
80
+ classNames?.radioGroup,
81
+ )}
82
+ ref={forwardRef}
83
+ >
84
+ {childrenWithProps}
85
+ </div>
86
+ {error && (
87
+ <BodySmall color="danger" className={classNames?.errorText}>
88
+ {errorText}
89
+ </BodySmall>
74
90
  )}
75
- >
76
- {childrenWithProps}
77
91
  </div>
78
- {error && (
79
- <BodySmall color="danger" className={classNames?.errorText}>
80
- {errorText}
81
- </BodySmall>
82
- )}
83
- </div>
84
- );
85
- };
92
+ );
93
+ },
94
+ );
@@ -13,7 +13,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
  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); }
14
14
  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; }
15
15
  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); }
16
- const SearchInput = _ref => {
16
+ const SearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
17
17
  let {
18
18
  value,
19
19
  disabled,
@@ -33,6 +33,7 @@ const SearchInput = _ref => {
33
33
  className: (0, _classify.default)(_SearchInputModule.default.searchInputWrapper, classNames?.wrapper)
34
34
  }, /*#__PURE__*/React.createElement(_Input.Input, _extends({}, searchInputProps, {
35
35
  type: "text",
36
+ ref: ref,
36
37
  classNames: {
37
38
  iconRight: value && !(disabled || locked) ? _SearchInputModule.default.clickable : '',
38
39
  iconLeft: value && !disabled ? _SearchInputModule.default.primaryText : '',
@@ -55,5 +56,5 @@ const SearchInput = _ref => {
55
56
  className: _SearchInputModule.default.loader,
56
57
  size: "small"
57
58
  })));
58
- };
59
+ });
59
60
  exports.SearchInput = SearchInput;
@@ -24,54 +24,63 @@ export type SearchInputProps = {
24
24
  ...
25
25
  };
26
26
 
27
- export const SearchInput = ({
28
- value,
29
- disabled,
30
- locked,
31
- placeholder = 'Search...',
32
- classNames,
33
- onClear,
34
- isLoading,
35
- size,
36
- iconLeftName = 'magnifying-glass',
37
- ...searchInputProps
38
- }: SearchInputProps): React.Node => {
39
- const handleClearClick = () => {
40
- onClear?.();
41
- };
27
+ export const SearchInput: React$AbstractComponent<
28
+ SearchInputProps,
29
+ HTMLInputElement,
30
+ > = React.forwardRef<SearchInputProps, HTMLInputElement>(
31
+ (
32
+ {
33
+ value,
34
+ disabled,
35
+ locked,
36
+ placeholder = 'Search...',
37
+ classNames,
38
+ onClear,
39
+ isLoading,
40
+ size,
41
+ iconLeftName = 'magnifying-glass',
42
+ ...searchInputProps
43
+ }: SearchInputProps,
44
+ ref,
45
+ ): React.Node => {
46
+ const handleClearClick = () => {
47
+ onClear?.();
48
+ };
42
49
 
43
- return (
44
- <div className={classify(css.searchInputWrapper, classNames?.wrapper)}>
45
- <Input
46
- {...searchInputProps}
47
- type="text"
48
- classNames={{
49
- iconRight: value && !(disabled || locked) ? css.clickable : '',
50
- iconLeft: value && !disabled ? css.primaryText : '',
51
- box: classNames?.box,
52
- }}
53
- placeholder={placeholder}
54
- value={value}
55
- disabled={disabled}
56
- locked={locked}
57
- iconLeftName={iconLeftName}
58
- size={size}
59
- iconRightName={value && !(disabled || locked) ? 'xmark' : 'fw'}
60
- onIconRightClick={handleClearClick}
61
- />
62
- {isLoading && (
63
- <div
64
- className={classify(css.loaderContainer, {
65
- [css.small]: size === 'small',
66
- })}
67
- >
68
- <CircularLoader
69
- colorToken="colorFillPrimary"
70
- className={css.loader}
71
- size="small"
72
- />
73
- </div>
74
- )}
75
- </div>
76
- );
77
- };
50
+ return (
51
+ <div className={classify(css.searchInputWrapper, classNames?.wrapper)}>
52
+ <Input
53
+ {...searchInputProps}
54
+ type="text"
55
+ ref={ref}
56
+ classNames={{
57
+ iconRight: value && !(disabled || locked) ? css.clickable : '',
58
+ iconLeft: value && !disabled ? css.primaryText : '',
59
+ box: classNames?.box,
60
+ }}
61
+ placeholder={placeholder}
62
+ value={value}
63
+ disabled={disabled}
64
+ locked={locked}
65
+ iconLeftName={iconLeftName}
66
+ size={size}
67
+ iconRightName={value && !(disabled || locked) ? 'xmark' : 'fw'}
68
+ onIconRightClick={handleClearClick}
69
+ />
70
+ {isLoading && (
71
+ <div
72
+ className={classify(css.loaderContainer, {
73
+ [css.small]: size === 'small',
74
+ })}
75
+ >
76
+ <CircularLoader
77
+ colorToken="colorFillPrimary"
78
+ className={css.loader}
79
+ size="small"
80
+ />
81
+ </div>
82
+ )}
83
+ </div>
84
+ );
85
+ },
86
+ );
@@ -112,7 +112,7 @@ const MENU_NAME_LIST = Object.freeze({
112
112
  }
113
113
  });
114
114
  exports.MENU_NAME_LIST = MENU_NAME_LIST;
115
- const SideMenuLink = _ref => {
115
+ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
116
116
  let {
117
117
  classNames,
118
118
  pageNameKey,
@@ -131,7 +131,8 @@ const SideMenuLink = _ref => {
131
131
  [_SideMenuLinkModule.default.disabled]: disabled,
132
132
  [_SideMenuLinkModule.default.closed]: !opened
133
133
  }, classNames?.wrapper),
134
- onClick: onChangeHandler
134
+ onClick: onChangeHandler,
135
+ ref: ref
135
136
  }, pageNameKey && MENU_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(_Icon.Icon, {
136
137
  type: MENU_NAME_LIST[pageNameKey].iconType,
137
138
  name: MENU_NAME_LIST[pageNameKey].iconName,
@@ -142,5 +143,5 @@ const SideMenuLink = _ref => {
142
143
  color: _Text.TEXT_COLORS.inverseSecondary,
143
144
  className: _SideMenuLinkModule.default.menuText
144
145
  }, MENU_NAME_LIST[pageNameKey].title) : null);
145
- };
146
+ });
146
147
  exports.SideMenuLink = SideMenuLink;