@spaced-out/ui-design-system 0.1.8 → 0.1.10

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,23 @@
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.10](https://github.com/spaced-out/ui-design-system/compare/v0.1.9...v0.1.10) (2023-04-10)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * added tabIndex support for buttons ([e3eb705](https://github.com/spaced-out/ui-design-system/commit/e3eb705a1dee1ee6ac9b9431974f0e216dcea171))
11
+ * aded nested dialog example ([b56a835](https://github.com/spaced-out/ui-design-system/commit/b56a835350137f1b291b3a5e72e241af5f6b0b9b))
12
+ * props fix ([952c7f0](https://github.com/spaced-out/ui-design-system/commit/952c7f0c8e9bd85b9a05db3564064985d8e6d852))
13
+ * ref forwarding in text, truncate, menu etc ([#94](https://github.com/spaced-out/ui-design-system/issues/94)) ([eb4f559](https://github.com/spaced-out/ui-design-system/commit/eb4f559e83c298d0376c99abf59cea386afd4bca))
14
+
15
+ ### [0.1.9](https://github.com/spaced-out/ui-design-system/compare/v0.1.8...v0.1.9) (2023-04-05)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * search input loader and typeahead fixes ([67db0fe](https://github.com/spaced-out/ui-design-system/commit/67db0fe3ad41f6d8a40a7fc77fef835ae96cc668))
21
+
5
22
  ### [0.1.8](https://github.com/spaced-out/ui-design-system/compare/v0.1.7...v0.1.8) (2023-04-05)
6
23
 
7
24
 
@@ -41,6 +41,7 @@ const UnstyledButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
41
41
  className,
42
42
  ariaLabel,
43
43
  actionType,
44
+ tabIndex = 0,
44
45
  ...props
45
46
  } = _ref;
46
47
  return /*#__PURE__*/React.createElement("button", _extends({}, props, ariaLabel ? {
@@ -50,6 +51,7 @@ const UnstyledButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
50
51
  ref: ref,
51
52
  role: "button",
52
53
  disabled: disabled,
54
+ tabIndex: disabled ? -1 : tabIndex,
53
55
  type: actionType,
54
56
  onClick: event => {
55
57
  if (disabled) {
@@ -36,6 +36,7 @@ export type UnstyledButtonProps = {
36
36
  onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
37
37
  className?: string,
38
38
  ariaLabel?: string,
39
+ tabIndex?: number,
39
40
  ...
40
41
  };
41
42
 
@@ -53,6 +54,7 @@ export type ButtonProps = {
53
54
  disabled?: boolean,
54
55
  size?: 'medium' | 'small',
55
56
  ariaLabel?: string,
57
+ tabIndex?: number,
56
58
  ...
57
59
  };
58
60
 
@@ -75,6 +77,7 @@ export const UnstyledButton: React$AbstractComponent<
75
77
  className,
76
78
  ariaLabel,
77
79
  actionType,
80
+ tabIndex = 0,
78
81
  ...props
79
82
  }: UnstyledButtonProps,
80
83
  ref: React.Ref<'button'>,
@@ -86,6 +89,7 @@ export const UnstyledButton: React$AbstractComponent<
86
89
  ref={ref}
87
90
  role="button"
88
91
  disabled={disabled}
92
+ tabIndex={disabled ? -1 : tabIndex}
89
93
  type={actionType}
90
94
  onClick={(event) => {
91
95
  if (disabled) {
@@ -59,15 +59,14 @@ const Dropdown = _ref => {
59
59
  "data-testid": "Dropdown",
60
60
  className: (0, _classify.classify)(_DropdownModule.default.dropdownContainer, classNames?.wrapper),
61
61
  ref: dropdownRef
62
- }, /*#__PURE__*/React.createElement(_Input.Input, _extends({
62
+ }, /*#__PURE__*/React.createElement(_Input.Input, _extends({}, inputProps, {
63
63
  boxRef: reference,
64
64
  size: size,
65
65
  placeholder: placeholder,
66
66
  value: dropdownInputText,
67
67
  classNames: {
68
68
  box: _DropdownModule.default.inputBox
69
- }
70
- }, inputProps, {
69
+ },
71
70
  iconRightName: isOpen ? 'angle-up' : 'angle-down',
72
71
  readOnly: true,
73
72
  onContainerClick: e => {
@@ -35,6 +35,7 @@ export type DropdownProps = {
35
35
  onMenuClose?: () => mixed,
36
36
  dropdownInputText?: string,
37
37
  menu?: MenuProps,
38
+ ...
38
39
  };
39
40
 
40
41
  export const Dropdown = ({
@@ -69,12 +70,12 @@ export const Dropdown = ({
69
70
  ref={dropdownRef}
70
71
  >
71
72
  <Input
73
+ {...inputProps}
72
74
  boxRef={reference}
73
75
  size={size}
74
76
  placeholder={placeholder}
75
77
  value={dropdownInputText}
76
78
  classNames={{box: css.inputBox}}
77
- {...inputProps}
78
79
  iconRightName={isOpen ? 'angle-up' : 'angle-down'}
79
80
  readOnly
80
81
  onContainerClick={(e) => {
@@ -97,7 +97,7 @@ const Input_ = (props, ref) => {
97
97
  color: disabled ? 'disabled' : 'secondary',
98
98
  size: "small",
99
99
  type: iconLeftType
100
- }), /*#__PURE__*/React.createElement("input", _extends({
100
+ }), /*#__PURE__*/React.createElement("input", _extends({}, inputProps, {
101
101
  disabled: locked || disabled,
102
102
  name: name,
103
103
  ref: ref,
@@ -108,7 +108,7 @@ const Input_ = (props, ref) => {
108
108
  onBlur: onBlur,
109
109
  type: showPassword ? 'text' : type,
110
110
  readOnly: readOnly && 'readOnly'
111
- }, inputProps)), type === 'color' && /*#__PURE__*/React.createElement("div", {
111
+ })), type === 'color' && /*#__PURE__*/React.createElement("div", {
112
112
  className: (0, _classify.classify)(_InputModule.default.colorText, _InputModule.default[size], {
113
113
  [_InputModule.default.hasValue]: value
114
114
  })
@@ -72,6 +72,7 @@ export type InputProps = {
72
72
  * Only values which are equal to the basis for stepping (min if specified, value otherwise, and an
73
73
  * appropriate default value if neither of those is provided) are valid. */
74
74
  step?: string,
75
+ ...
75
76
  };
76
77
 
77
78
  const Input_ = (props: InputProps, ref): React.Node => {
@@ -156,6 +157,7 @@ const Input_ = (props: InputProps, ref): React.Node => {
156
157
  />
157
158
  )}
158
159
  <input
160
+ {...inputProps}
159
161
  disabled={locked || disabled}
160
162
  name={name}
161
163
  ref={ref}
@@ -166,7 +168,6 @@ const Input_ = (props: InputProps, ref): React.Node => {
166
168
  onBlur={onBlur}
167
169
  type={showPassword ? 'text' : type}
168
170
  readOnly={readOnly && 'readOnly'}
169
- {...inputProps}
170
171
  />
171
172
  {type === 'color' && (
172
173
  <div
@@ -59,7 +59,7 @@ const RenderOption = _ref => {
59
59
  }
60
60
  return /*#__PURE__*/React.createElement(React.Fragment, null);
61
61
  };
62
- const Menu = props => {
62
+ const Menu = /*#__PURE__*/React.forwardRef((props, ref) => {
63
63
  const {
64
64
  classNames,
65
65
  size = 'medium',
@@ -74,7 +74,8 @@ const Menu = props => {
74
74
  }, classNames?.wrapper),
75
75
  style: {
76
76
  width
77
- }
77
+ },
78
+ ref: ref
78
79
  }, /*#__PURE__*/React.createElement(RenderOption, props));
79
- };
80
+ });
80
81
  exports.Menu = Menu;
@@ -147,23 +147,27 @@ const RenderOption = ({
147
147
  return <></>;
148
148
  };
149
149
 
150
- export const Menu = (props: MenuProps): React.Node => {
151
- const {classNames, size = 'medium', width, isFluid = true} = props;
152
-
153
- return (
154
- <div
155
- className={classify(
156
- css.menuCard,
157
- {
158
- [css.fluid]: isFluid,
159
- [css.medium]: size === 'medium',
160
- [css.small]: size === 'small',
161
- },
162
- classNames?.wrapper,
163
- )}
164
- style={{width}}
165
- >
166
- <RenderOption {...props} />
167
- </div>
150
+ export const Menu: React$AbstractComponent<MenuProps, HTMLDivElement> =
151
+ React.forwardRef<MenuProps, HTMLDivElement>(
152
+ (props: MenuProps, ref): React.Node => {
153
+ const {classNames, size = 'medium', width, isFluid = true} = props;
154
+
155
+ return (
156
+ <div
157
+ className={classify(
158
+ css.menuCard,
159
+ {
160
+ [css.fluid]: isFluid,
161
+ [css.medium]: size === 'medium',
162
+ [css.small]: size === 'small',
163
+ },
164
+ classNames?.wrapper,
165
+ )}
166
+ style={{width}}
167
+ ref={ref}
168
+ >
169
+ <RenderOption {...props} />
170
+ </div>
171
+ );
172
+ },
168
173
  );
169
- };
@@ -31,9 +31,8 @@ const SearchInput = _ref => {
31
31
  };
32
32
  return /*#__PURE__*/React.createElement("div", {
33
33
  className: (0, _classify.default)(_SearchInputModule.default.searchInputWrapper, classNames?.wrapper)
34
- }, /*#__PURE__*/React.createElement(_Input.Input, _extends({
35
- type: "text"
36
- }, searchInputProps, {
34
+ }, /*#__PURE__*/React.createElement(_Input.Input, _extends({}, searchInputProps, {
35
+ type: "text",
37
36
  classNames: {
38
37
  iconRight: value && !(disabled || locked) ? _SearchInputModule.default.clickable : '',
39
38
  iconLeft: value && !disabled ? _SearchInputModule.default.primaryText : '',
@@ -53,7 +52,8 @@ const SearchInput = _ref => {
53
52
  })
54
53
  }, /*#__PURE__*/React.createElement(_CircularLoader.CircularLoader, {
55
54
  colorToken: "colorFillPrimary",
56
- size: size
55
+ className: _SearchInputModule.default.loader,
56
+ size: "small"
57
57
  })));
58
58
  };
59
59
  exports.SearchInput = SearchInput;
@@ -21,6 +21,7 @@ export type SearchInputProps = {
21
21
  classNames?: ClassNames,
22
22
  onClear?: () => void,
23
23
  isLoading?: boolean,
24
+ ...
24
25
  };
25
26
 
26
27
  export const SearchInput = ({
@@ -42,8 +43,8 @@ export const SearchInput = ({
42
43
  return (
43
44
  <div className={classify(css.searchInputWrapper, classNames?.wrapper)}>
44
45
  <Input
45
- type="text"
46
46
  {...searchInputProps}
47
+ type="text"
47
48
  classNames={{
48
49
  iconRight: value && !(disabled || locked) ? css.clickable : '',
49
50
  iconLeft: value && !disabled ? css.primaryText : '',
@@ -64,7 +65,11 @@ export const SearchInput = ({
64
65
  [css.small]: size === 'small',
65
66
  })}
66
67
  >
67
- <CircularLoader colorToken="colorFillPrimary" size={size} />
68
+ <CircularLoader
69
+ colorToken="colorFillPrimary"
70
+ className={css.loader}
71
+ size="small"
72
+ />
68
73
  </div>
69
74
  )}
70
75
  </div>
@@ -1,5 +1,6 @@
1
1
  @value (
2
- colorTextPrimary
2
+ colorTextPrimary,
3
+ colorBackgroundTertiary
3
4
  ) from '../../styles/variables/_color.css';
4
5
 
5
6
  @value (
@@ -7,15 +8,10 @@
7
8
  size34
8
9
  ) from '../../styles/variables/_size.css';
9
10
 
10
- @value (
11
- spaceXXSmall
12
- ) from '../../styles/variables/_space.css';
13
-
14
11
  .searchInputWrapper {
15
12
  display: flex;
16
13
  position: relative;
17
14
  align-items: end;
18
- gap: spaceXXSmall;
19
15
  height: fit-content;
20
16
  }
21
17
 
@@ -34,11 +30,15 @@
34
30
  align-items: center;
35
31
  justify-content: center;
36
32
  align-items: center;
37
- margin-right: calc((size42 * -1) - spaceXXSmall);
33
+ margin-left: calc(size42 * -1);
38
34
  }
39
35
 
40
36
  .loaderContainer.small {
41
37
  height: size34;
42
38
  width: size34;
43
- margin-right: calc((size34 * -1) - spaceXXSmall);
39
+ margin-left: calc(size34 * -1);
40
+ }
41
+
42
+ .loader {
43
+ background-color: colorBackgroundTertiary;
44
44
  }
@@ -77,7 +77,9 @@ function DefaultRow(_ref2) {
77
77
  sticky
78
78
  } = item;
79
79
  const value = data[key];
80
- return Renderer ? /*#__PURE__*/React.createElement(Renderer, {
80
+ return Renderer ? /*#__PURE__*/React.createElement(Renderer
81
+ // eslint-disable-next-line react/no-array-index-key
82
+ , {
81
83
  key: index,
82
84
  data: data,
83
85
  extras: extras,
@@ -85,7 +87,9 @@ function DefaultRow(_ref2) {
85
87
  className: (0, _classify.default)({
86
88
  [_TableModule.default.stickyCell]: sticky
87
89
  })
88
- }) : /*#__PURE__*/React.createElement(_Cell.SingleCell, {
90
+ }) : /*#__PURE__*/React.createElement(_Cell.SingleCell
91
+ // eslint-disable-next-line react/no-array-index-key
92
+ , {
89
93
  key: index,
90
94
  title: String(value),
91
95
  className: (0, _classify.default)(cellClassName, {
@@ -126,6 +126,7 @@ export function DefaultRow<T: GenericObject, U: GenericObject>({
126
126
  const value = data[key];
127
127
  return Renderer ? (
128
128
  <Renderer
129
+ // eslint-disable-next-line react/no-array-index-key
129
130
  key={index}
130
131
  data={data}
131
132
  extras={extras}
@@ -134,6 +135,7 @@ export function DefaultRow<T: GenericObject, U: GenericObject>({
134
135
  />
135
136
  ) : (
136
137
  <SingleCell
138
+ // eslint-disable-next-line react/no-array-index-key
137
139
  key={index}
138
140
  title={String(value)}
139
141
  className={classify(cellClassName, {[css.stickyCell]: sticky})}
@@ -100,7 +100,9 @@ function DefaultTableHeader(props) {
100
100
  return /*#__PURE__*/React.createElement(BasicHeadCell, {
101
101
  className: (0, _classify.default)({
102
102
  [_TableModule.default.selectedHeader]: sortKey === key && columnSortDirection !== 'original'
103
- }, headerClassName),
103
+ }, headerClassName)
104
+ // eslint-disable-next-line react/no-array-index-key
105
+ ,
104
106
  key: index,
105
107
  scope: "col",
106
108
  onClick: headCellClickHandler
@@ -166,6 +166,7 @@ export function DefaultTableHeader<T: GenericObject, U: GenericObject>(
166
166
  },
167
167
  headerClassName,
168
168
  )}
169
+ // eslint-disable-next-line react/no-array-index-key
169
170
  key={index}
170
171
  scope="col"
171
172
  onClick={headCellClickHandler}