@spaced-out/ui-design-system 0.1.9 → 0.1.11

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,24 @@
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.11](https://github.com/spaced-out/ui-design-system/compare/v0.1.10...v0.1.11) (2023-04-11)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * added classnames for menu custom component ([#95](https://github.com/spaced-out/ui-design-system/issues/95)) ([a860c29](https://github.com/spaced-out/ui-design-system/commit/a860c2979592d5e69301fb46374853ae960a54de))
11
+ * propagating disabled to button ([b14be23](https://github.com/spaced-out/ui-design-system/commit/b14be23a352d136c1c73f091b36bd7d1df8c35df))
12
+
13
+ ### [0.1.10](https://github.com/spaced-out/ui-design-system/compare/v0.1.9...v0.1.10) (2023-04-10)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * added tabIndex support for buttons ([e3eb705](https://github.com/spaced-out/ui-design-system/commit/e3eb705a1dee1ee6ac9b9431974f0e216dcea171))
19
+ * aded nested dialog example ([b56a835](https://github.com/spaced-out/ui-design-system/commit/b56a835350137f1b291b3a5e72e241af5f6b0b9b))
20
+ * props fix ([952c7f0](https://github.com/spaced-out/ui-design-system/commit/952c7f0c8e9bd85b9a05db3564064985d8e6d852))
21
+ * 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))
22
+
5
23
  ### [0.1.9](https://github.com/spaced-out/ui-design-system/compare/v0.1.8...v0.1.9) (2023-04-05)
6
24
 
7
25
 
@@ -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) {
@@ -78,6 +80,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
78
80
  } = _ref2;
79
81
  return /*#__PURE__*/React.createElement(UnstyledButton, _extends({}, props, {
80
82
  actionType: actionType,
83
+ disabled: disabled,
81
84
  className: (0, _classify.classify)(_ButtonModule.default.button, {
82
85
  [_ButtonModule.default.primary]: type === 'primary',
83
86
  [_ButtonModule.default.secondary]: type === 'secondary',
@@ -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) {
@@ -120,6 +124,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
120
124
  <UnstyledButton
121
125
  {...props}
122
126
  actionType={actionType}
127
+ disabled={disabled}
123
128
  className={classify(
124
129
  css.button,
125
130
  {
@@ -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;
@@ -13,6 +13,8 @@ type ClassNames = $ReadOnly<{
13
13
  wrapper?: string,
14
14
  option?: string,
15
15
  groupTitle?: string,
16
+ optionTextContainer?: string,
17
+ optionTextLabel?: string,
16
18
  }>;
17
19
 
18
20
  export type MenuOption = {
@@ -147,23 +149,27 @@ const RenderOption = ({
147
149
  return <></>;
148
150
  };
149
151
 
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>
152
+ export const Menu: React$AbstractComponent<MenuProps, HTMLDivElement> =
153
+ React.forwardRef<MenuProps, HTMLDivElement>(
154
+ (props: MenuProps, ref): React.Node => {
155
+ const {classNames, size = 'medium', width, isFluid = true} = props;
156
+
157
+ return (
158
+ <div
159
+ className={classify(
160
+ css.menuCard,
161
+ {
162
+ [css.fluid]: isFluid,
163
+ [css.medium]: size === 'medium',
164
+ [css.small]: size === 'small',
165
+ },
166
+ classNames?.wrapper,
167
+ )}
168
+ style={{width}}
169
+ ref={ref}
170
+ >
171
+ <RenderOption {...props} />
172
+ </div>
173
+ );
174
+ },
168
175
  );
169
- };
@@ -77,10 +77,10 @@ const MenuOptionButton = props => {
77
77
  size: "small",
78
78
  className: _MenuModule.default.icon
79
79
  }), /*#__PURE__*/React.createElement("div", {
80
- className: _MenuModule.default.optionTextContainer
81
- }, /*#__PURE__*/React.createElement("div", {
82
- className: _MenuModule.default.optionTextLabel
83
- }, /*#__PURE__*/React.isValidElement(customComponent) ? customComponent : /*#__PURE__*/React.createElement(_Truncate.Truncate, null, label)), !!secondaryLabel && /*#__PURE__*/React.createElement("div", {
80
+ className: (0, _classify.classify)(_MenuModule.default.optionTextContainer, classNames?.optionTextContainer)
81
+ }, /*#__PURE__*/React.isValidElement(customComponent) ? customComponent : /*#__PURE__*/React.createElement("div", {
82
+ className: (0, _classify.classify)(_MenuModule.default.optionTextLabel, classNames?.optionTextLabel)
83
+ }, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, label)), !!secondaryLabel && /*#__PURE__*/React.createElement("div", {
84
84
  className: _MenuModule.default.optionTextSecondaryLabel
85
85
  }, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, secondaryLabel))), !!iconRight && /*#__PURE__*/React.createElement(_Icon.Icon, {
86
86
  name: iconRight,
@@ -96,14 +96,24 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
96
96
  className={css.icon}
97
97
  />
98
98
  )}
99
- <div className={css.optionTextContainer}>
100
- <div className={css.optionTextLabel}>
101
- {React.isValidElement(customComponent) ? (
102
- customComponent
103
- ) : (
99
+ <div
100
+ className={classify(
101
+ css.optionTextContainer,
102
+ classNames?.optionTextContainer,
103
+ )}
104
+ >
105
+ {React.isValidElement(customComponent) ? (
106
+ customComponent
107
+ ) : (
108
+ <div
109
+ className={classify(
110
+ css.optionTextLabel,
111
+ classNames?.optionTextLabel,
112
+ )}
113
+ >
104
114
  <Truncate>{label}</Truncate>
105
- )}
106
- </div>
115
+ </div>
116
+ )}
107
117
 
108
118
  {!!secondaryLabel && (
109
119
  <div className={css.optionTextSecondaryLabel}>
@@ -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 : '',
@@ -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 : '',