@spaced-out/ui-design-system 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.5](https://github.com/spaced-out/ui-design-system/compare/v0.1.4...v0.1.5) (2023-04-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * in context aleart and banner focus states ([9d3144d](https://github.com/spaced-out/ui-design-system/commit/9d3144dad0cc32f21cfd1ed4284b6eb5da99e742))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * typeahead and dropdown fixes ([fa9d5ed](https://github.com/spaced-out/ui-design-system/commit/fa9d5ed1276fb3381fa71ac2f57c203ca9900dd8))
16
+
17
+ ### [0.1.4](https://github.com/spaced-out/ui-design-system/compare/v0.1.3...v0.1.4) (2023-04-03)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * avatar-tooltip, panel header, table ([#93](https://github.com/spaced-out/ui-design-system/issues/93)) ([907f0c3](https://github.com/spaced-out/ui-design-system/commit/907f0c3067e7ed4fd347dacfc1d3042601f4b9f3))
23
+ * link disabled state fix ([0324fbb](https://github.com/spaced-out/ui-design-system/commit/0324fbb1e5254d7160e639cf34c756d60505f7af))
24
+
5
25
  ### [0.1.3](https://github.com/spaced-out/ui-design-system/compare/v0.1.2...v0.1.3) (2023-04-03)
6
26
 
7
27
 
@@ -105,7 +105,7 @@ const AvatarConditionalContent = _ref2 => {
105
105
  className: classNames?.text
106
106
  }) : null);
107
107
  };
108
- const Avatar = _ref3 => {
108
+ const Avatar = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
109
109
  let {
110
110
  classNames,
111
111
  size = AVATAR_SIZE.medium,
@@ -125,7 +125,8 @@ const Avatar = _ref3 => {
125
125
  [_AvatarModule.default.mediumSize]: size === 'medium',
126
126
  [_AvatarModule.default.smallSize]: size === 'small'
127
127
  }, classNames?.wrapper),
128
- style: style
128
+ style: style,
129
+ ref: ref
129
130
  }, ring ? /*#__PURE__*/React.createElement("div", {
130
131
  className: (0, _classify.default)(_AvatarModule.default.ring, classNames?.ring)
131
132
  }, /*#__PURE__*/React.createElement("div", {
@@ -151,7 +152,7 @@ const Avatar = _ref3 => {
151
152
  statusBorderColorToken: statusBorderColorToken,
152
153
  classNames: classNames
153
154
  }));
154
- };
155
+ });
155
156
  exports.Avatar = Avatar;
156
157
  const BaseAvatar = _ref4 => {
157
158
  let {
@@ -167,34 +167,54 @@ const AvatarConditionalContent = ({
167
167
  </div>
168
168
  );
169
169
 
170
- export const Avatar = ({
171
- classNames,
172
- size = AVATAR_SIZE.medium,
173
- imageSrc,
174
- text,
175
- style,
176
- iconName,
177
- iconType,
178
- color,
179
- ring = false,
180
- status,
181
- statusBorderColorToken,
182
- }: AvatarProps): React.Node => (
183
- <div
184
- className={classify(
185
- css.container,
170
+ export const Avatar: React$AbstractComponent<AvatarProps, HTMLDivElement> =
171
+ React.forwardRef<AvatarProps, HTMLDivElement>(
172
+ (
186
173
  {
187
- [css.largeSize]: size === 'large',
188
- [css.mediumSize]: size === 'medium',
189
- [css.smallSize]: size === 'small',
190
- },
191
- classNames?.wrapper,
192
- )}
193
- style={style}
194
- >
195
- {ring ? (
196
- <div className={classify(css.ring, classNames?.ring)}>
197
- <div className={css.whiteCircle}>
174
+ classNames,
175
+ size = AVATAR_SIZE.medium,
176
+ imageSrc,
177
+ text,
178
+ style,
179
+ iconName,
180
+ iconType,
181
+ color,
182
+ ring = false,
183
+ status,
184
+ statusBorderColorToken,
185
+ }: AvatarProps,
186
+ ref,
187
+ ) => (
188
+ <div
189
+ className={classify(
190
+ css.container,
191
+ {
192
+ [css.largeSize]: size === 'large',
193
+ [css.mediumSize]: size === 'medium',
194
+ [css.smallSize]: size === 'small',
195
+ },
196
+ classNames?.wrapper,
197
+ )}
198
+ style={style}
199
+ ref={ref}
200
+ >
201
+ {ring ? (
202
+ <div className={classify(css.ring, classNames?.ring)}>
203
+ <div className={css.whiteCircle}>
204
+ <AvatarConditionalContent
205
+ imageSrc={imageSrc}
206
+ text={text}
207
+ iconName={iconName}
208
+ iconType={iconType}
209
+ color={color}
210
+ size={size}
211
+ status={status}
212
+ statusBorderColorToken={statusBorderColorToken}
213
+ classNames={classNames}
214
+ />
215
+ </div>
216
+ </div>
217
+ ) : (
198
218
  <AvatarConditionalContent
199
219
  imageSrc={imageSrc}
200
220
  text={text}
@@ -206,23 +226,10 @@ export const Avatar = ({
206
226
  statusBorderColorToken={statusBorderColorToken}
207
227
  classNames={classNames}
208
228
  />
209
- </div>
229
+ )}
210
230
  </div>
211
- ) : (
212
- <AvatarConditionalContent
213
- imageSrc={imageSrc}
214
- text={text}
215
- iconName={iconName}
216
- iconType={iconType}
217
- color={color}
218
- size={size}
219
- status={status}
220
- statusBorderColorToken={statusBorderColorToken}
221
- classNames={classNames}
222
- />
223
- )}
224
- </div>
225
- );
231
+ ),
232
+ );
226
233
 
227
234
  export const BaseAvatar = ({
228
235
  classNames,
@@ -23,7 +23,8 @@ const AvatarGroup = _ref => {
23
23
  borderColor = _color.colorBackgroundTertiary,
24
24
  maxTooltipLines = 7,
25
25
  placement = 'top',
26
- maxAvatars = 5
26
+ maxAvatars = 5,
27
+ tooltipElevation
27
28
  } = _ref;
28
29
  const childAvatarCount = React.Children.count(children);
29
30
  const leftOverlap = {
@@ -62,7 +63,8 @@ const AvatarGroup = _ref => {
62
63
  return /*#__PURE__*/React.createElement(_Tooltip.Tooltip, {
63
64
  body: /*#__PURE__*/React.createElement(NameListNode, null),
64
65
  bodyMaxLines: maxTooltipLines,
65
- placement: placement
66
+ placement: placement,
67
+ elevation: tooltipElevation
66
68
  }, /*#__PURE__*/React.createElement("div", {
67
69
  className: _AvatarGroupModule.default.plusAvatar
68
70
  }, /*#__PURE__*/React.createElement(_Avatar.BaseAvatar, {
@@ -26,6 +26,7 @@ export type AvatarGroupProps = {
26
26
  maxTooltipLines?: number,
27
27
  placement?: PlacementType,
28
28
  maxAvatars?: number,
29
+ tooltipElevation?: string,
29
30
  };
30
31
 
31
32
  export const AvatarGroup = ({
@@ -35,6 +36,7 @@ export const AvatarGroup = ({
35
36
  maxTooltipLines = 7,
36
37
  placement = 'top',
37
38
  maxAvatars = 5,
39
+ tooltipElevation,
38
40
  }: AvatarGroupProps): React.Node => {
39
41
  const childAvatarCount = React.Children.count(children);
40
42
 
@@ -85,6 +87,7 @@ export const AvatarGroup = ({
85
87
  body={<NameListNode />}
86
88
  bodyMaxLines={maxTooltipLines}
87
89
  placement={placement}
90
+ elevation={tooltipElevation}
88
91
  >
89
92
  <div className={css.plusAvatar}>
90
93
  <BaseAvatar
@@ -27,10 +27,9 @@ const Dropdown = _ref => {
27
27
  menu,
28
28
  onMenuOpen,
29
29
  onMenuClose,
30
- dropdownInputText,
30
+ dropdownInputText = '',
31
31
  ...inputProps
32
32
  } = _ref;
33
- const [inputValue, setInputValue] = React.useState(dropdownInputText || '');
34
33
  const dropdownRef = React.useRef();
35
34
  const {
36
35
  x,
@@ -44,9 +43,6 @@ const Dropdown = _ref => {
44
43
  whileElementsMounted: _reactDom.autoUpdate,
45
44
  middleware: [(0, _reactDom.flip)(), (0, _reactDom.offset)(parseInt(_space.spaceXXSmall))]
46
45
  });
47
- React.useEffect(() => {
48
- setInputValue(dropdownInputText || '');
49
- }, [dropdownInputText]);
50
46
  const onMenuToggle = isOpen => {
51
47
  isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
52
48
  };
@@ -67,7 +63,7 @@ const Dropdown = _ref => {
67
63
  boxRef: reference,
68
64
  size: size,
69
65
  placeholder: placeholder,
70
- value: inputValue,
66
+ value: dropdownInputText,
71
67
  classNames: {
72
68
  box: _DropdownModule.default.inputBox
73
69
  }
@@ -45,10 +45,9 @@ export const Dropdown = ({
45
45
  menu,
46
46
  onMenuOpen,
47
47
  onMenuClose,
48
- dropdownInputText,
48
+ dropdownInputText = '',
49
49
  ...inputProps
50
50
  }: DropdownProps): React.Node => {
51
- const [inputValue, setInputValue] = React.useState(dropdownInputText || '');
52
51
  const dropdownRef = React.useRef();
53
52
  const {x, y, reference, floating, strategy} = useFloating({
54
53
  strategy: 'absolute',
@@ -57,10 +56,6 @@ export const Dropdown = ({
57
56
  middleware: [flip(), offset(parseInt(spaceXXSmall))],
58
57
  });
59
58
 
60
- React.useEffect(() => {
61
- setInputValue(dropdownInputText || '');
62
- }, [dropdownInputText]);
63
-
64
59
  const onMenuToggle = (isOpen: boolean) => {
65
60
  isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
66
61
  };
@@ -77,7 +72,7 @@ export const Dropdown = ({
77
72
  boxRef={reference}
78
73
  size={size}
79
74
  placeholder={placeholder}
80
- value={inputValue}
75
+ value={dropdownInputText}
81
76
  classNames={{box: css.inputBox}}
82
77
  {...inputProps}
83
78
  iconRightName={isOpen ? 'angle-up' : 'angle-down'}
@@ -8,6 +8,7 @@ var React = _interopRequireWildcard(require("react"));
8
8
  var _typography = require("../../types/typography");
9
9
  var _classify = require("../../utils/classify");
10
10
  var _Icon = require("../Icon");
11
+ var _Link = require("../Link");
11
12
  var _Text = require("../Text");
12
13
  var _Truncate = require("../Truncate");
13
14
  var _InContextAlertModule = _interopRequireDefault(require("./InContextAlert.module.css"));
@@ -110,10 +111,10 @@ const InContextAlert = props => {
110
111
  line: 2
111
112
  }, children)), !!(actionText || dismissable) && /*#__PURE__*/React.createElement("div", {
112
113
  className: (0, _classify.classify)(_InContextAlertModule.default.actionContainer, classNames?.actionContainer)
113
- }, !!actionText && /*#__PURE__*/React.createElement(_Text.ButtonTextExtraSmall, {
114
- className: _InContextAlertModule.default.actionText,
115
- onClick: onAction
116
- }, actionText), !!dismissable && /*#__PURE__*/React.createElement(_Icon.Icon, {
114
+ }, !!actionText && /*#__PURE__*/React.createElement(_Link.Link, {
115
+ onClick: onAction,
116
+ color: "primary"
117
+ }, actionText), !!dismissable && /*#__PURE__*/React.createElement(_Icon.ClickableIcon, {
117
118
  color: _typography.TEXT_COLORS.primary,
118
119
  name: "close",
119
120
  size: "small",
@@ -5,8 +5,9 @@ import * as React from 'react';
5
5
  import {TEXT_COLORS} from '../../types/typography';
6
6
  import {classify} from '../../utils/classify';
7
7
  import type {IconType} from '../Icon';
8
- import {Icon} from '../Icon';
9
- import {ButtonTextExtraSmall, SubTitleExtraSmall} from '../Text';
8
+ import {ClickableIcon, Icon} from '../Icon';
9
+ import {Link} from '../Link';
10
+ import {SubTitleExtraSmall} from '../Text';
10
11
  import {Truncate} from '../Truncate';
11
12
 
12
13
  import css from './InContextAlert.module.css';
@@ -172,15 +173,12 @@ export const InContextAlert = (props: InContextAlertProps): React.Node => {
172
173
  )}
173
174
  >
174
175
  {!!actionText && (
175
- <ButtonTextExtraSmall
176
- className={css.actionText}
177
- onClick={onAction}
178
- >
176
+ <Link onClick={onAction} color="primary">
179
177
  {actionText}
180
- </ButtonTextExtraSmall>
178
+ </Link>
181
179
  )}
182
180
  {!!dismissable && (
183
- <Icon
181
+ <ClickableIcon
184
182
  color={TEXT_COLORS.primary}
185
183
  name="close"
186
184
  size="small"
@@ -65,7 +65,6 @@
65
65
  }
66
66
 
67
67
  .closeIcon {
68
- cursor: pointer;
69
68
  margin-left: auto;
70
69
  }
71
70
 
@@ -75,9 +74,3 @@
75
74
  align-items: center;
76
75
  gap: spaceSmall;
77
76
  }
78
-
79
- .actionText {
80
- cursor: pointer;
81
- text-decoration: underline;
82
- white-space: nowrap;
83
- }
@@ -66,7 +66,7 @@ const Link = /*#__PURE__*/React.forwardRef((_ref, ref) => {
66
66
  ...props
67
67
  } = _ref;
68
68
  return /*#__PURE__*/React.createElement("a", _extends({}, props, {
69
- tabIndex: tabIndex,
69
+ tabIndex: disabled ? -1 : tabIndex,
70
70
  innerref: ref,
71
71
  "data-testid": "Link",
72
72
  className: (0, _classify.default)(_typographyModule.default.link, _typographyModule.default[as], _typographyModule.default[color], {
@@ -66,7 +66,7 @@ export type LinkProps = {
66
66
  underline?: boolean,
67
67
  target?: AnchorTarget,
68
68
  href?: string,
69
- onClick?: (SyntheticEvent<HTMLElement>) => mixed,
69
+ onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
70
70
  tabIndex?: number,
71
71
  disabled?: boolean,
72
72
  ...
@@ -91,7 +91,7 @@ export const Link: React$AbstractComponent<
91
91
  ) => (
92
92
  <a
93
93
  {...props}
94
- tabIndex={tabIndex}
94
+ tabIndex={disabled ? -1 : tabIndex}
95
95
  innerref={ref}
96
96
  data-testid="Link"
97
97
  className={classify(
@@ -21,7 +21,8 @@ const PanelHeader = _ref => {
21
21
  children,
22
22
  hideCloseBtn,
23
23
  onCloseButtonClick,
24
- className
24
+ className,
25
+ size
25
26
  } = _ref;
26
27
  return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
27
28
  className: (0, _classify.default)(_PanelModule.default.panelHeader, className)
@@ -31,7 +32,8 @@ const PanelHeader = _ref => {
31
32
  iconLeftName: "xmark",
32
33
  type: "ghost",
33
34
  onClick: onCloseButtonClick,
34
- ariaLabel: "Close Button"
35
+ ariaLabel: "Close Button",
36
+ size: size
35
37
  })));
36
38
  };
37
39
  exports.PanelHeader = PanelHeader;
@@ -21,6 +21,7 @@ export type PanelHeaderProps = {
21
21
  hideCloseBtn?: boolean,
22
22
  onCloseButtonClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
23
23
  className?: string,
24
+ size?: 'medium' | 'small',
24
25
  };
25
26
 
26
27
  type FooterClassNames = $ReadOnly<{
@@ -49,6 +50,7 @@ export const PanelHeader = ({
49
50
  hideCloseBtn,
50
51
  onCloseButtonClick,
51
52
  className,
53
+ size,
52
54
  }: PanelHeaderProps): React.Node => (
53
55
  <>
54
56
  {React.Children.count(children) > 0 && (
@@ -62,6 +64,7 @@ export const PanelHeader = ({
62
64
  type="ghost"
63
65
  onClick={onCloseButtonClick}
64
66
  ariaLabel="Close Button"
67
+ size={size}
65
68
  ></Button>
66
69
  )}
67
70
  </div>
@@ -65,7 +65,7 @@
65
65
  .subMenuGroupWrapper {
66
66
  display: flex;
67
67
  flex-direction: column;
68
- padding: spaceSmall spaceNone;
68
+ padding: spaceXSmall spaceNone;
69
69
  flex: auto;
70
70
  }
71
71
 
@@ -8,6 +8,7 @@ exports.StaticTable = StaticTable;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _get = _interopRequireDefault(require("lodash/get"));
10
10
  var _xor = _interopRequireDefault(require("lodash/xor"));
11
+ var _classify = require("../../utils/classify");
11
12
  var _makeClassNameComponent = require("../../utils/makeClassNameComponent");
12
13
  var _Row = require("./Row");
13
14
  var _TableHeader = require("./TableHeader");
@@ -28,6 +29,7 @@ const BasicTableBody = (0, _makeClassNameComponent.makeClassNameComponent)(_Tabl
28
29
  exports.BasicTableBody = BasicTableBody;
29
30
  function StaticTable(props) {
30
31
  const {
32
+ classNames,
31
33
  className,
32
34
  Row,
33
35
  entries,
@@ -49,7 +51,8 @@ function StaticTable(props) {
49
51
  idName = 'id',
50
52
  emptyText,
51
53
  disabled,
52
- customLoader
54
+ customLoader,
55
+ borderRadius
53
56
  } = props;
54
57
 
55
58
  // this is a fallback and honestly probably doesn't need the
@@ -73,14 +76,16 @@ function StaticTable(props) {
73
76
  }
74
77
  } : undefined;
75
78
  return /*#__PURE__*/React.createElement("div", {
76
- className: _TableModule.default.tableContainer,
77
- "data-id": "table-wrap"
79
+ className: (0, _classify.classify)(_TableModule.default.tableContainer, classNames?.wrapper),
80
+ "data-id": "table-wrap",
81
+ style: {
82
+ '--border-radius': borderRadius
83
+ }
78
84
  }, /*#__PURE__*/React.createElement(BasicTable, {
79
85
  "data-id": "basic-table",
80
- className: className
86
+ className: (0, _classify.classify)(className, classNames?.table)
81
87
  }, showHeader && /*#__PURE__*/React.createElement(_TableHeader.DefaultTableHeader, {
82
- tableHeaderClassName: tableHeaderClassName,
83
- className: tableHeaderClassName,
88
+ className: (0, _classify.classify)(tableHeaderClassName, classNames?.tableHeader),
84
89
  sortable: sortable,
85
90
  columns: headers,
86
91
  handleSortClick: handleSortClick,
@@ -89,7 +94,9 @@ function StaticTable(props) {
89
94
  disabled: disabled,
90
95
  handleCheckboxClick: handleHeaderCheckboxClick,
91
96
  checked: selectedKeys == null || selectedKeys.length === 0 ? 'false' : selectedKeys.length < entries.length ? 'mixed' : 'true'
92
- }), /*#__PURE__*/React.createElement(BasicTableBody, null, isLoading || !entries.length ? /*#__PURE__*/React.createElement(_Row.EmptyRow, {
97
+ }), /*#__PURE__*/React.createElement(BasicTableBody, {
98
+ className: classNames?.tableBody
99
+ }, isLoading || !entries.length ? /*#__PURE__*/React.createElement(_Row.EmptyRow, {
93
100
  isLoading: isLoading,
94
101
  emptyText: emptyText,
95
102
  headersLength: handleHeaderCheckboxClick ? headers.length + 1 : headers.length,
@@ -4,6 +4,7 @@ import * as React from 'react';
4
4
  import get from 'lodash/get';
5
5
  import xor from 'lodash/xor';
6
6
 
7
+ import {classify} from '../../utils/classify';
7
8
  import type {ClassNameComponent} from '../../utils/makeClassNameComponent';
8
9
  import {makeClassNameComponent} from '../../utils/makeClassNameComponent';
9
10
 
@@ -37,18 +38,15 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
37
38
  rowKeys?: string[],
38
39
  }): React.Node {
39
40
  const {
41
+ classNames,
40
42
  className,
41
-
42
43
  Row,
43
-
44
44
  entries,
45
45
  extras,
46
46
  rowKeys,
47
-
48
47
  headers,
49
48
  showHeader = true,
50
49
  tableHeaderClassName,
51
-
52
50
  sortable,
53
51
  defaultSortKey,
54
52
  defaultSortDirection = 'original',
@@ -58,12 +56,12 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
58
56
  sortDirection,
59
57
  selectedKeys,
60
58
  onSelect,
61
-
62
59
  isLoading,
63
60
  idName = 'id',
64
61
  emptyText,
65
62
  disabled,
66
63
  customLoader,
64
+ borderRadius,
67
65
  } = props;
68
66
 
69
67
  // this is a fallback and honestly probably doesn't need the
@@ -92,12 +90,20 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
92
90
  : undefined;
93
91
 
94
92
  return (
95
- <div className={css.tableContainer} data-id="table-wrap">
96
- <BasicTable data-id="basic-table" className={className}>
93
+ <div
94
+ className={classify(css.tableContainer, classNames?.wrapper)}
95
+ data-id="table-wrap"
96
+ style={{
97
+ '--border-radius': borderRadius,
98
+ }}
99
+ >
100
+ <BasicTable
101
+ data-id="basic-table"
102
+ className={classify(className, classNames?.table)}
103
+ >
97
104
  {showHeader && (
98
105
  <DefaultTableHeader
99
- tableHeaderClassName={tableHeaderClassName}
100
- className={tableHeaderClassName}
106
+ className={classify(tableHeaderClassName, classNames?.tableHeader)}
101
107
  sortable={sortable}
102
108
  columns={headers}
103
109
  handleSortClick={handleSortClick}
@@ -115,7 +121,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
115
121
  />
116
122
  )}
117
123
 
118
- <BasicTableBody>
124
+ <BasicTableBody className={classNames?.tableBody}>
119
125
  {isLoading || !entries.length ? (
120
126
  <EmptyRow
121
127
  isLoading={isLoading}
@@ -26,6 +26,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
26
26
  function Table(props) {
27
27
  const {
28
28
  className,
29
+ classNames,
29
30
  Row,
30
31
  entries,
31
32
  extras,
@@ -19,7 +19,15 @@ export type GenericObject = {
19
19
  +[key: string]: mixed,
20
20
  };
21
21
 
22
+ type ClassNames = $ReadOnly<{
23
+ wrapper?: string,
24
+ table?: string,
25
+ tableHeader?: string,
26
+ tableBody?: string,
27
+ }>;
28
+
22
29
  export type TableProps<T, U> = {
30
+ classNames?: ClassNames,
23
31
  className?: string,
24
32
  Row?: TableRow<T, U>,
25
33
  headers: GenericHeaderItems<T, U>,
@@ -41,6 +49,7 @@ export type TableProps<T, U> = {
41
49
  emptyText?: React.Node,
42
50
  disabled?: boolean,
43
51
  customLoader?: React.Node,
52
+ borderRadius?: string,
44
53
  };
45
54
 
46
55
  /**
@@ -61,6 +70,7 @@ export function Table<Data: GenericObject, Extras: GenericObject>(
61
70
  ): React.Node {
62
71
  const {
63
72
  className,
73
+ classNames,
64
74
  Row,
65
75
  entries,
66
76
  extras,
@@ -21,10 +21,11 @@
21
21
  }
22
22
 
23
23
  .tableContainer {
24
+ --border-radius: borderRadiusMedium;
24
25
  composes: borderPrimary from '../../styles/border.module.css';
25
26
  width: sizeFluid;
26
27
  overflow-x: scroll;
27
- border-radius: borderRadiusMedium;
28
+ border-radius: var(--border-radius);
28
29
  }
29
30
 
30
31
  .defaultTable {
@@ -33,7 +34,7 @@
33
34
  overflow-x: scroll;
34
35
  border-collapse: collapse;
35
36
  box-sizing: border-box;
36
- border-radius: borderRadiusMedium;
37
+ border-radius: var(--border-radius);
37
38
  box-shadow: borderWidthNone borderWidthNone borderWidthNone borderWidthPrimary
38
39
  colorBorderPrimary;
39
40
  table-layout: fixed;
@@ -41,8 +42,8 @@
41
42
  }
42
43
  .defaultTableBody {
43
44
  flex-flow: column;
44
- border-radius: borderRadiusNone borderRadiusNone borderRadiusMedium
45
- borderRadiusMedium;
45
+ border-radius: borderRadiusNone borderRadiusNone var(--border-radius)
46
+ var(--border-radius);
46
47
  background: colorBackgroundTertiary;
47
48
  }
48
49
 
@@ -142,11 +143,11 @@
142
143
  }
143
144
 
144
145
  .defaultTable .defaultRow:last-child td:first-child {
145
- border-bottom-left-radius: borderRadiusMedium;
146
+ border-bottom-left-radius: var(--border-radius);
146
147
  }
147
148
 
148
149
  .defaultTable .defaultRow:last-child td:last-child {
149
- border-bottom-right-radius: borderRadiusMedium;
150
+ border-bottom-right-radius: var(--border-radius);
150
151
  }
151
152
 
152
153
  .defaultTable .defaultRow:last-child {
@@ -188,7 +189,7 @@ th:first-child {
188
189
 
189
190
  .defaultTableHead {
190
191
  flex-flow: column;
191
- border-radius: borderRadiusMedium borderRadiusMedium borderRadiusNone
192
+ border-radius: var(--border-radius) var(--border-radius) borderRadiusNone
192
193
  borderRadiusNone;
193
194
  composes: borderBottomPrimary from '../../styles/border.module.css';
194
195
  padding: spaceSmall;
@@ -197,7 +198,7 @@ th:first-child {
197
198
  .defaultHeaderRow {
198
199
  box-sizing: border-box;
199
200
  background: colorBackgroundPrimary;
200
- border-radius: borderRadiusMedium borderRadiusMedium borderRadiusNone
201
+ border-radius: var(--border-radius) var(--border-radius) borderRadiusNone
201
202
  borderRadiusNone;
202
203
  }
203
204
 
@@ -227,11 +228,11 @@ th:first-child {
227
228
  }
228
229
 
229
230
  .defaultHeaderCell:first-child {
230
- border-top-left-radius: borderRadiusMedium;
231
+ border-top-left-radius: var(--border-radius);
231
232
  }
232
233
 
233
234
  .defaultHeaderCell:last-child {
234
- border-top-right-radius: borderRadiusMedium;
235
+ border-top-right-radius: var(--border-radius);
235
236
  }
236
237
 
237
238
  .defaultHeaderCell:not(.selectedHeader):hover {
@@ -55,7 +55,6 @@ const SortIcon = _ref => {
55
55
  };
56
56
  function DefaultTableHeader(props) {
57
57
  const {
58
- tableHeaderClassName,
59
58
  className,
60
59
  sortable = false,
61
60
  columns,
@@ -129,7 +128,7 @@ function DefaultTableHeader(props) {
129
128
  }, filterIcon))));
130
129
  }));
131
130
  return /*#__PURE__*/React.createElement(BasicTableHead, {
132
- className: (0, _classify.default)(_TableModule.default.tableHeaderSortable, tableHeaderClassName, className)
131
+ className: (0, _classify.default)(_TableModule.default.tableHeaderSortable, className)
133
132
  }, /*#__PURE__*/React.createElement(_Row.BasicRow, {
134
133
  className: _TableModule.default.defaultHeaderRow
135
134
  }, handleCheckboxClick && /*#__PURE__*/React.createElement(BasicHeadCell, {
@@ -104,7 +104,6 @@ export function DefaultTableHeader<T: GenericObject, U: GenericObject>(
104
104
  props: TableHeaderProps<T, U>,
105
105
  ): React.Node {
106
106
  const {
107
- tableHeaderClassName,
108
107
  className,
109
108
  sortable = false,
110
109
  columns,
@@ -208,13 +207,7 @@ export function DefaultTableHeader<T: GenericObject, U: GenericObject>(
208
207
  );
209
208
 
210
209
  return (
211
- <BasicTableHead
212
- className={classify(
213
- css.tableHeaderSortable,
214
- tableHeaderClassName,
215
- className,
216
- )}
217
- >
210
+ <BasicTableHead className={classify(css.tableHeaderSortable, className)}>
218
211
  <BasicRow className={css.defaultHeaderRow}>
219
212
  {handleCheckboxClick && (
220
213
  <BasicHeadCell scope="col">
@@ -29,11 +29,10 @@ const Typeahead = _ref => {
29
29
  menu,
30
30
  onMenuOpen,
31
31
  onMenuClose,
32
- typeaheadInputText,
32
+ typeaheadInputText = '',
33
33
  ...inputProps
34
34
  } = _ref;
35
35
  const typeaheadRef = React.useRef();
36
- const [inputValue, setInputValue] = React.useState(typeaheadInputText || '');
37
36
  const [filteredOptions, setFilteredOptions] = React.useState(menu?.options);
38
37
  const {
39
38
  x,
@@ -47,28 +46,19 @@ const Typeahead = _ref => {
47
46
  whileElementsMounted: _reactDom.autoUpdate,
48
47
  middleware: [(0, _reactDom.flip)(), (0, _reactDom.offset)(parseInt(_space.spaceXXSmall))]
49
48
  });
50
- const handleSelect = option => {
51
- if (option?.key) {
52
- onSelect && onSelect(option);
53
- setInputValue(option.label);
54
- }
55
- };
56
- React.useEffect(() => {
57
- setInputValue(typeaheadInputText || '');
58
- }, [typeaheadInputText]);
59
49
  const onMenuToggle = isOpen => {
60
50
  isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
61
51
  };
62
52
  React.useEffect(() => {
63
53
  const optionsFiltered = menu?.options && menu.options.filter(option => {
64
- if (!option.label || !inputValue) {
54
+ if (!option.label || !typeaheadInputText) {
65
55
  return true;
66
56
  } else {
67
- return option.label.toLowerCase().indexOf(inputValue.toLowerCase()) !== -1;
57
+ return option.label.toLowerCase().indexOf(typeaheadInputText.toLowerCase()) !== -1;
68
58
  }
69
59
  });
70
60
  setFilteredOptions(optionsFiltered || []);
71
- }, [inputValue]);
61
+ }, [typeaheadInputText]);
72
62
  return /*#__PURE__*/React.createElement(_clickAway.ClickAway, {
73
63
  onChange: onMenuToggle
74
64
  }, _ref2 => {
@@ -86,14 +76,13 @@ const Typeahead = _ref => {
86
76
  boxRef: reference,
87
77
  size: size,
88
78
  placeholder: placeholder,
89
- value: inputValue,
79
+ value: typeaheadInputText,
90
80
  classNames: {
91
81
  box: classNames?.box
92
82
  }
93
83
  }, inputProps, {
94
84
  onChange: e => {
95
85
  e.stopPropagation();
96
- setInputValue(e.target.value);
97
86
  onSearch && onSearch(e);
98
87
  if (e.target.value.length > 0) {
99
88
  onOpen();
@@ -102,7 +91,6 @@ const Typeahead = _ref => {
102
91
  }
103
92
  },
104
93
  onClear: _e => {
105
- setInputValue('');
106
94
  onClear?.();
107
95
  }
108
96
  })), isOpen && menu && filteredOptions && !!filteredOptions.length && /*#__PURE__*/React.createElement("div", {
@@ -118,7 +106,7 @@ const Typeahead = _ref => {
118
106
  }, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
119
107
  options: filteredOptions,
120
108
  onSelect: option => {
121
- handleSelect(option);
109
+ onSelect && onSelect(option);
122
110
  if (!menu.optionsVariant || menu.optionsVariant === 'normal') {
123
111
  clickAway();
124
112
  }
@@ -49,12 +49,10 @@ export const Typeahead = ({
49
49
  menu,
50
50
  onMenuOpen,
51
51
  onMenuClose,
52
- typeaheadInputText,
52
+ typeaheadInputText = '',
53
53
  ...inputProps
54
54
  }: TypeaheadProps): React.Node => {
55
55
  const typeaheadRef = React.useRef();
56
-
57
- const [inputValue, setInputValue] = React.useState(typeaheadInputText || '');
58
56
  const [filteredOptions, setFilteredOptions] = React.useState(menu?.options);
59
57
 
60
58
  const {x, y, reference, floating, strategy} = useFloating({
@@ -64,17 +62,6 @@ export const Typeahead = ({
64
62
  middleware: [flip(), offset(parseInt(spaceXXSmall))],
65
63
  });
66
64
 
67
- const handleSelect = (option?: MenuOption) => {
68
- if (option?.key) {
69
- onSelect && onSelect(option);
70
- setInputValue(option.label);
71
- }
72
- };
73
-
74
- React.useEffect(() => {
75
- setInputValue(typeaheadInputText || '');
76
- }, [typeaheadInputText]);
77
-
78
65
  const onMenuToggle = (isOpen: boolean) => {
79
66
  isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
80
67
  };
@@ -83,16 +70,18 @@ export const Typeahead = ({
83
70
  const optionsFiltered =
84
71
  menu?.options &&
85
72
  menu.options.filter((option) => {
86
- if (!option.label || !inputValue) {
73
+ if (!option.label || !typeaheadInputText) {
87
74
  return true;
88
75
  } else {
89
76
  return (
90
- option.label.toLowerCase().indexOf(inputValue.toLowerCase()) !== -1
77
+ option.label
78
+ .toLowerCase()
79
+ .indexOf(typeaheadInputText.toLowerCase()) !== -1
91
80
  );
92
81
  }
93
82
  });
94
83
  setFilteredOptions(optionsFiltered || []);
95
- }, [inputValue]);
84
+ }, [typeaheadInputText]);
96
85
 
97
86
  return (
98
87
  <ClickAway onChange={onMenuToggle}>
@@ -106,12 +95,11 @@ export const Typeahead = ({
106
95
  boxRef={reference}
107
96
  size={size}
108
97
  placeholder={placeholder}
109
- value={inputValue}
98
+ value={typeaheadInputText}
110
99
  classNames={{box: classNames?.box}}
111
100
  {...inputProps}
112
101
  onChange={(e) => {
113
102
  e.stopPropagation();
114
- setInputValue(e.target.value);
115
103
  onSearch && onSearch(e);
116
104
  if (e.target.value.length > 0) {
117
105
  onOpen();
@@ -120,7 +108,6 @@ export const Typeahead = ({
120
108
  }
121
109
  }}
122
110
  onClear={(_e) => {
123
- setInputValue('');
124
111
  onClear?.();
125
112
  }}
126
113
  />
@@ -141,7 +128,7 @@ export const Typeahead = ({
141
128
  {...menu}
142
129
  options={filteredOptions}
143
130
  onSelect={(option) => {
144
- handleSelect(option);
131
+ onSelect && onSelect(option);
145
132
  if (
146
133
  !menu.optionsVariant ||
147
134
  menu.optionsVariant === 'normal'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {