@spaced-out/ui-design-system 0.0.11 → 0.0.13

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,22 @@
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.0.13](https://github.com/spaced-out/ui-design-system/compare/v0.0.12...v0.0.13) (2023-01-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * button dropdown carat standalone fix ([507e1e4](https://github.com/spaced-out/ui-design-system/commit/507e1e4dbd834dfff36e96a569211aea4d84eeb2))
11
+ * button dropdown props change ([542d6e1](https://github.com/spaced-out/ui-design-system/commit/542d6e1bb299d95c29a793e32bd384037572ae00))
12
+ * emit more events from button dropdown ([faa9bf1](https://github.com/spaced-out/ui-design-system/commit/faa9bf15ce9f7fa5a7be4e2b1c24784f4654cb9e))
13
+
14
+ ### [0.0.12](https://github.com/spaced-out/ui-design-system/compare/v0.0.11...v0.0.12) (2022-12-28)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **tabs:** [GDS-121] tabs issues fix ([#43](https://github.com/spaced-out/ui-design-system/issues/43)) ([b5ee7fd](https://github.com/spaced-out/ui-design-system/commit/b5ee7fd9dd77b2cbeee6f28db997342694d8a03a))
20
+
5
21
  ### [0.0.11](https://github.com/spaced-out/ui-design-system/compare/v0.0.10...v0.0.11) (2022-12-21)
6
22
 
7
23
 
@@ -22,9 +22,15 @@ const ButtonDropdown = _ref => {
22
22
  anchorPosition = 'bottom-start',
23
23
  size,
24
24
  onOptionSelect,
25
- props,
25
+ menu,
26
26
  classNames,
27
- disabled
27
+ disabled,
28
+ onMenuOpen,
29
+ onMenuClose,
30
+ children,
31
+ iconRightName,
32
+ iconRightType,
33
+ ...restButtonProps
28
34
  } = _ref;
29
35
  const menuBtnRef = React.useRef();
30
36
  const {
@@ -39,7 +45,12 @@ const ButtonDropdown = _ref => {
39
45
  whileElementsMounted: _reactDom.autoUpdate,
40
46
  middleware: [(0, _reactDom.shift)(), (0, _reactDom.flip)(), (0, _reactDom.offset)(parseInt(_space.spaceXXSmall))]
41
47
  });
42
- return /*#__PURE__*/React.createElement(_clickAway.ClickAway, null, _ref2 => {
48
+ const onMenuToggle = isOpen => {
49
+ isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
50
+ };
51
+ return /*#__PURE__*/React.createElement(_clickAway.ClickAway, {
52
+ onChange: onMenuToggle
53
+ }, _ref2 => {
43
54
  let {
44
55
  isOpen,
45
56
  onOpen,
@@ -50,9 +61,9 @@ const ButtonDropdown = _ref => {
50
61
  "data-testid": "ButtonDropdown",
51
62
  className: (0, _classify.classify)(_ButtonDropdownModule.default.buttonDropdownContainer, classNames?.wrapper),
52
63
  ref: menuBtnRef
53
- }, /*#__PURE__*/React.createElement(_Button.Button, _extends({}, props?.button, {
54
- iconRightName: props?.button.children ? isOpen ? 'caret-up' : 'caret-down' : props?.button.iconRightName,
55
- iconRightType: props?.button.children ? 'solid' : props?.button.iconRightType,
64
+ }, /*#__PURE__*/React.createElement(_Button.Button, _extends({}, restButtonProps, {
65
+ iconRightName: children ? isOpen ? 'caret-up' : 'caret-down' : iconRightName ? iconRightName : isOpen ? 'caret-up' : 'caret-down',
66
+ iconRightType: children ? 'solid' : iconRightType,
56
67
  disabled: disabled,
57
68
  size: size,
58
69
  ref: reference,
@@ -60,7 +71,7 @@ const ButtonDropdown = _ref => {
60
71
  e.stopPropagation();
61
72
  onOpen();
62
73
  }
63
- })), isOpen && props?.menu && /*#__PURE__*/React.createElement("div", {
74
+ }), children), isOpen && menu && /*#__PURE__*/React.createElement("div", {
64
75
  onClickCapture: cancelNext,
65
76
  ref: floating,
66
77
  style: {
@@ -70,7 +81,7 @@ const ButtonDropdown = _ref => {
70
81
  left: x ?? _space.spaceNone,
71
82
  width: _size.sizeFluid
72
83
  }
73
- }, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, props.menu, {
84
+ }, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
74
85
  onSelect: option => {
75
86
  onOptionSelect && onOptionSelect(option);
76
87
  clickAway();
@@ -26,9 +26,9 @@ import {Menu} from '../Menu';
26
26
  import css from './ButtonDropdown.module.css';
27
27
 
28
28
 
29
- type ClassNames = $ReadOnly<{wrapper?: string}>;
30
-
31
29
  export type ButtonDropdownProps = {
30
+ ...ButtonProps,
31
+ menu: MenuProps,
32
32
  anchorPosition?:
33
33
  | 'top'
34
34
  | 'top-start'
@@ -36,23 +36,25 @@ export type ButtonDropdownProps = {
36
36
  | 'bottom'
37
37
  | 'bottom-start'
38
38
  | 'bottom-end',
39
- size?: 'medium' | 'small',
40
- props?: {
41
- button: ButtonProps,
42
- menu: MenuProps,
43
- },
44
39
  onOptionSelect?: (option: MenuOption) => mixed,
45
- classNames?: ClassNames,
46
- disabled?: boolean,
40
+ onMenuOpen?: () => mixed,
41
+ onMenuClose?: () => mixed,
42
+ ...
47
43
  };
48
44
 
49
45
  export const ButtonDropdown = ({
50
46
  anchorPosition = 'bottom-start',
51
47
  size,
52
48
  onOptionSelect,
53
- props,
49
+ menu,
54
50
  classNames,
55
51
  disabled,
52
+ onMenuOpen,
53
+ onMenuClose,
54
+ children,
55
+ iconRightName,
56
+ iconRightType,
57
+ ...restButtonProps
56
58
  }: ButtonDropdownProps): React.Node => {
57
59
  const menuBtnRef = React.useRef();
58
60
  const {x, y, reference, floating, strategy} = useFloating({
@@ -62,8 +64,12 @@ export const ButtonDropdown = ({
62
64
  middleware: [shift(), flip(), offset(parseInt(spaceXXSmall))],
63
65
  });
64
66
 
67
+ const onMenuToggle = (isOpen: boolean) => {
68
+ isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
69
+ };
70
+
65
71
  return (
66
- <ClickAway>
72
+ <ClickAway onChange={onMenuToggle}>
67
73
  {({isOpen, onOpen, cancelNext, clickAway}) => (
68
74
  <div
69
75
  data-testid="ButtonDropdown"
@@ -71,17 +77,19 @@ export const ButtonDropdown = ({
71
77
  ref={menuBtnRef}
72
78
  >
73
79
  <Button
74
- {...props?.button}
80
+ {...restButtonProps}
75
81
  iconRightName={
76
- props?.button.children
82
+ children
77
83
  ? isOpen
78
84
  ? 'caret-up'
79
85
  : 'caret-down'
80
- : props?.button.iconRightName
81
- }
82
- iconRightType={
83
- props?.button.children ? 'solid' : props?.button.iconRightType
86
+ : iconRightName
87
+ ? iconRightName
88
+ : isOpen
89
+ ? 'caret-up'
90
+ : 'caret-down'
84
91
  }
92
+ iconRightType={children ? 'solid' : iconRightType}
85
93
  disabled={disabled}
86
94
  size={size}
87
95
  ref={reference}
@@ -89,8 +97,10 @@ export const ButtonDropdown = ({
89
97
  e.stopPropagation();
90
98
  onOpen();
91
99
  }}
92
- />
93
- {isOpen && props?.menu && (
100
+ >
101
+ {children}
102
+ </Button>
103
+ {isOpen && menu && (
94
104
  <div
95
105
  onClickCapture={cancelNext}
96
106
  ref={floating}
@@ -103,7 +113,7 @@ export const ButtonDropdown = ({
103
113
  }}
104
114
  >
105
115
  <Menu
106
- {...props.menu}
116
+ {...menu}
107
117
  onSelect={(option) => {
108
118
  onOptionSelect && onOptionSelect(option);
109
119
  clickAway();
@@ -10,6 +10,7 @@
10
10
  border: borderWidthTertiary solid colorFillNone;
11
11
  box-sizing: border-box;
12
12
  display: flex;
13
+ cursor: pointer;
13
14
  }
14
15
 
15
16
  .button.mediumSize {
@@ -37,6 +38,7 @@
37
38
  flex-direction: row;
38
39
  gap: spaceXXSmall;
39
40
  align-items: center;
41
+ justify-content: center;
40
42
  color: colorTextSecondary;
41
43
  border-bottom: borderWidthTertiary solid colorFillNone;
42
44
  height: sizeFluid;
@@ -1,8 +1,10 @@
1
1
  @value ( size36) from '../../styles/variables/_size.css';
2
- @value ( spaceXSmall, spaceNone) from '../../styles/variables/_size.css';
2
+ @value ( spaceFluid ) from '../../styles/variables/_space.css';
3
3
 
4
4
  .tabDropdownContainer {
5
5
  display: flex;
6
+ align-items: center;
7
+ justify-content: center;
6
8
  position: relative;
7
9
  }
8
10
 
@@ -16,5 +18,5 @@
16
18
  }
17
19
 
18
20
  .dotTextWrap {
19
- padding: spaceNone spaceXSmall;
21
+ width: spaceFluid;
20
22
  }
@@ -1,7 +1,6 @@
1
- @value (colorFillPrimary) from '../../styles/variables/_color.css';
2
1
  @value (spaceMedium) from '../../styles/variables/_space.css';
3
2
 
4
- @value ( sizeFluid) from '../../styles/variables/_size.css';
3
+ @value ( size38, size42, sizeFluid) from '../../styles/variables/_size.css';
5
4
 
6
5
  .tabsContainer {
7
6
  display: flex;
@@ -9,3 +8,11 @@
9
8
  gap: spaceMedium;
10
9
  width: sizeFluid;
11
10
  }
11
+
12
+ .tabsContainer.mediumSize {
13
+ height: size42;
14
+ }
15
+
16
+ .tabsContainer.smallSize {
17
+ height: size38;
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {