@spaced-out/ui-design-system 0.1.0 → 0.1.1

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,14 @@
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.1](https://github.com/spaced-out/ui-design-system/compare/v0.1.0...v0.1.1) (2023-03-31)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * forward ref in clickableIcon ([#92](https://github.com/spaced-out/ui-design-system/issues/92)) ([8037aa4](https://github.com/spaced-out/ui-design-system/commit/8037aa4b4c5ee77076ea6a8dc002e5526e3d9da7))
11
+ * tooltip fixes menu option accepts optionVariant override ([2d23b04](https://github.com/spaced-out/ui-design-system/commit/2d23b040885a5bf380c383e596647e76d988454b))
12
+
5
13
  ## [0.1.0](https://github.com/spaced-out/ui-design-system/compare/v0.0.68...v0.1.0) (2023-03-31)
6
14
 
7
15
 
@@ -14,7 +14,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  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); }
15
15
  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; }
16
16
  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); }
17
- const ClickableIcon = _ref => {
17
+ const ClickableIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
18
18
  let {
19
19
  size = 'medium',
20
20
  className,
@@ -35,13 +35,14 @@ const ClickableIcon = _ref => {
35
35
  className: (0, _classify.default)(_ClickableIconModule.default.button, {
36
36
  [_ClickableIconModule.default.small]: size === 'small',
37
37
  [_ClickableIconModule.default.medium]: size === 'medium'
38
- }, className)
38
+ }, className),
39
+ ref: ref
39
40
  }), /*#__PURE__*/React.createElement(_.Icon, _extends({
40
41
  size: size
41
42
  }, props)));
42
- };
43
+ });
43
44
  exports.ClickableIcon = ClickableIcon;
44
- const CloseIcon = _ref2 => {
45
+ const CloseIcon = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
45
46
  let {
46
47
  size = 'medium',
47
48
  type = 'regular',
@@ -53,6 +54,8 @@ const CloseIcon = _ref2 => {
53
54
  size: size,
54
55
  type: type,
55
56
  color: color
56
- }, props));
57
- };
57
+ }, props, {
58
+ ref: ref
59
+ }));
60
+ });
58
61
  exports.CloseIcon = CloseIcon;
@@ -13,38 +13,41 @@ import {Icon} from './';
13
13
  import css from './ClickableIcon.module.css';
14
14
 
15
15
 
16
- export const ClickableIcon = ({
17
- size = 'medium',
18
- className,
19
- ariaLabel,
20
- onClick,
21
- ...props
22
- }: IconProps): React.Node => {
23
- const onKeyDownHandler = (e) => {
24
- if (e.key === 'Enter') {
25
- e.preventDefault();
26
- onClick && onClick(e);
27
- }
28
- };
29
- return (
30
- <UnstyledButton
31
- {...props}
32
- onClick={onClick}
33
- onKeyDown={onKeyDownHandler}
34
- ariaLabel={ariaLabel}
35
- className={classify(
36
- css.button,
37
- {
38
- [css.small]: size === 'small',
39
- [css.medium]: size === 'medium',
40
- },
41
- className,
42
- )}
43
- >
44
- <Icon size={size} {...props} />
45
- </UnstyledButton>
46
- );
47
- };
16
+ export const ClickableIcon: React$AbstractComponent<
17
+ IconProps,
18
+ HTMLButtonElement,
19
+ > = React.forwardRef<IconProps, HTMLButtonElement>(
20
+ (
21
+ {size = 'medium', className, ariaLabel, onClick, ...props}: IconProps,
22
+ ref,
23
+ ) => {
24
+ const onKeyDownHandler = (e) => {
25
+ if (e.key === 'Enter') {
26
+ e.preventDefault();
27
+ onClick && onClick(e);
28
+ }
29
+ };
30
+ return (
31
+ <UnstyledButton
32
+ {...props}
33
+ onClick={onClick}
34
+ onKeyDown={onKeyDownHandler}
35
+ ariaLabel={ariaLabel}
36
+ className={classify(
37
+ css.button,
38
+ {
39
+ [css.small]: size === 'small',
40
+ [css.medium]: size === 'medium',
41
+ },
42
+ className,
43
+ )}
44
+ ref={ref}
45
+ >
46
+ <Icon size={size} {...props} />
47
+ </UnstyledButton>
48
+ );
49
+ },
50
+ );
48
51
 
49
52
  export type CloseIconProps = {
50
53
  size?: IconSize,
@@ -55,17 +58,26 @@ export type CloseIconProps = {
55
58
  ariaLabel?: string,
56
59
  };
57
60
 
58
- export const CloseIcon = ({
59
- size = 'medium',
60
- type = 'regular',
61
- color = TEXT_COLORS.primary,
62
- ...props
63
- }: CloseIconProps): React.Node => (
64
- <ClickableIcon
65
- name="close"
66
- size={size}
67
- type={type}
68
- color={color}
69
- {...props}
70
- />
61
+ export const CloseIcon: React$AbstractComponent<
62
+ CloseIconProps,
63
+ HTMLButtonElement,
64
+ > = React.forwardRef<CloseIconProps, HTMLButtonElement>(
65
+ (
66
+ {
67
+ size = 'medium',
68
+ type = 'regular',
69
+ color = TEXT_COLORS.primary,
70
+ ...props
71
+ }: CloseIconProps,
72
+ ref,
73
+ ) => (
74
+ <ClickableIcon
75
+ name="close"
76
+ size={size}
77
+ type={type}
78
+ color={color}
79
+ {...props}
80
+ ref={ref}
81
+ />
82
+ ),
71
83
  );
@@ -26,6 +26,7 @@ export type MenuOption = {
26
26
  iconRightType?: IconType,
27
27
  disabled?: boolean,
28
28
  optionSize?: MenuSizeTypes,
29
+ optionVariant?: MenuOptionsVariant,
29
30
  };
30
31
 
31
32
  // Render first available option set
@@ -37,7 +37,8 @@ const MenuOptionButton = props => {
37
37
  iconRight,
38
38
  iconRightType,
39
39
  disabled,
40
- optionSize
40
+ optionSize,
41
+ optionVariant = optionsVariant
41
42
  } = option;
42
43
  const [buttonSize, setButtonSize] = React.useState(optionSize || size);
43
44
  const isSelected = () => {
@@ -61,11 +62,11 @@ const MenuOptionButton = props => {
61
62
  disabled: menuDisabled || disabled,
62
63
  onClick: () => onSelect && onSelect(option),
63
64
  autoFocus: selectedOption?.key === key
64
- }, optionsVariant === 'checkbox' && /*#__PURE__*/React.createElement(_Checkbox.Checkbox, {
65
+ }, optionVariant === 'checkbox' && /*#__PURE__*/React.createElement(_Checkbox.Checkbox, {
65
66
  tabIndex: -1,
66
67
  disabled: menuDisabled || disabled,
67
68
  checked: isSelected()
68
- }), optionsVariant === 'radio' && /*#__PURE__*/React.createElement(_RadioButton.RadioButton, {
69
+ }), optionVariant === 'radio' && /*#__PURE__*/React.createElement(_RadioButton.RadioButton, {
69
70
  disabled: menuDisabled || disabled,
70
71
  value: option.key,
71
72
  selectedValue: selectedKeys?.[0],
@@ -40,6 +40,7 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
40
40
  iconRightType,
41
41
  disabled,
42
42
  optionSize,
43
+ optionVariant = optionsVariant,
43
44
  } = option;
44
45
  const [buttonSize, setButtonSize] = React.useState(optionSize || size);
45
46
  const isSelected = () => {
@@ -72,14 +73,14 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
72
73
  onClick={() => onSelect && onSelect(option)}
73
74
  autoFocus={selectedOption?.key === key}
74
75
  >
75
- {optionsVariant === 'checkbox' && (
76
+ {optionVariant === 'checkbox' && (
76
77
  <Checkbox
77
78
  tabIndex={-1}
78
79
  disabled={menuDisabled || disabled}
79
80
  checked={isSelected()}
80
81
  />
81
82
  )}
82
- {optionsVariant === 'radio' && (
83
+ {optionVariant === 'radio' && (
83
84
  <RadioButton
84
85
  disabled={menuDisabled || disabled}
85
86
  value={option.key}
@@ -47,6 +47,7 @@ const Tooltip = _ref => {
47
47
  strategy,
48
48
  context
49
49
  } = (0, _reactDomInteractions.useFloating)({
50
+ strategy: 'fixed',
50
51
  placement,
51
52
  open,
52
53
  onOpenChange: setOpen,
@@ -85,6 +85,7 @@ export const Tooltip = ({
85
85
  }: TooltipProps): React.Node => {
86
86
  const [open, setOpen] = React.useState(false);
87
87
  const {x, y, reference, floating, strategy, context} = useFloating({
88
+ strategy: 'fixed',
88
89
  placement,
89
90
  open,
90
91
  onOpenChange: setOpen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {