@spaced-out/ui-design-system 0.0.58 → 0.0.60

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,20 @@
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.60](https://github.com/spaced-out/ui-design-system/compare/v0.0.59...v0.0.60) (2023-03-27)
6
+
7
+
8
+ ### Features
9
+
10
+ * 🎡 menu now supports groupTitleOptions 🎡 ([ad43075](https://github.com/spaced-out/ui-design-system/commit/ad430758ca9751064ef9da165591a9d1eac460cb))
11
+
12
+ ### [0.0.59](https://github.com/spaced-out/ui-design-system/compare/v0.0.58...v0.0.59) (2023-03-27)
13
+
14
+
15
+ ### Features
16
+
17
+ * changed secondary button colors ([3a3c3e0](https://github.com/spaced-out/ui-design-system/commit/3a3c3e0cf1c15d3149403ceb2f187d5e0a113ad1))
18
+
5
19
  ### [0.0.58](https://github.com/spaced-out/ui-design-system/compare/v0.0.57...v0.0.58) (2023-03-25)
6
20
 
7
21
 
@@ -29,7 +29,7 @@ const BUTTON_ACTION_TYPE = Object.freeze({
29
29
  exports.BUTTON_ACTION_TYPE = BUTTON_ACTION_TYPE;
30
30
  const ButtonTypeToIconColorMap = {
31
31
  primary: 'inversePrimary',
32
- secondary: 'primary',
32
+ secondary: 'clickable',
33
33
  tertiary: 'primary',
34
34
  ghost: 'primary',
35
35
  danger: 'inversePrimary'
@@ -58,7 +58,7 @@ export type ButtonProps = {
58
58
 
59
59
  const ButtonTypeToIconColorMap = {
60
60
  primary: 'inversePrimary',
61
- secondary: 'primary',
61
+ secondary: 'clickable',
62
62
  tertiary: 'primary',
63
63
  ghost: 'primary',
64
64
  danger: 'inversePrimary',
@@ -26,6 +26,7 @@
26
26
 
27
27
  colorTextPrimary,
28
28
  colorTextInversePrimary,
29
+ colorTextClickable,
29
30
  colorTextDisabled,
30
31
 
31
32
  colorBorderSecondary
@@ -145,8 +146,7 @@ button {
145
146
  }
146
147
 
147
148
  .secondary {
148
- color: colorTextPrimary;
149
- border: borderWidthPrimary solid colorButtonFillPrimaryEnabled;
149
+ color: colorTextClickable;
150
150
  background-color: colorButtonFillSecondaryEnabled;
151
151
  }
152
152
 
@@ -22,6 +22,7 @@ const Dropdown = _ref => {
22
22
  let {
23
23
  options,
24
24
  composeOptions,
25
+ groupTitleOptions,
25
26
  size,
26
27
  classNames,
27
28
  placeholder = 'Select...',
@@ -81,7 +82,7 @@ const Dropdown = _ref => {
81
82
  e.stopPropagation();
82
83
  onOpen();
83
84
  }
84
- })), isOpen && (options || composeOptions) && /*#__PURE__*/React.createElement("div", {
85
+ })), isOpen && (options || composeOptions || groupTitleOptions) && /*#__PURE__*/React.createElement("div", {
85
86
  onClickCapture: cancelNext,
86
87
  ref: floating,
87
88
  style: {
@@ -95,6 +96,7 @@ const Dropdown = _ref => {
95
96
  isFluid: true,
96
97
  options: options,
97
98
  composeOptions: composeOptions,
99
+ groupTitleOptions: groupTitleOptions,
98
100
  onSelect: option => {
99
101
  handleSelect(option);
100
102
  clickAway();
@@ -18,7 +18,7 @@ import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
18
18
  import {classify} from '../../utils/classify';
19
19
  import {ClickAway} from '../../utils/click-away';
20
20
  import {Input} from '../Input';
21
- import type {MenuOption} from '../Menu';
21
+ import type {MenuGroupTitleOption, MenuOption} from '../Menu';
22
22
  import {Menu} from '../Menu';
23
23
 
24
24
  import css from './Dropdown.module.css';
@@ -43,6 +43,7 @@ export type DropdownProps = {
43
43
  required?: boolean,
44
44
  options?: Array<MenuOption>,
45
45
  composeOptions?: Array<Array<MenuOption>>,
46
+ groupTitleOptions?: Array<MenuGroupTitleOption>,
46
47
  selectedOption?: MenuOption,
47
48
  menuSize?: 'medium' | 'small',
48
49
  };
@@ -50,6 +51,7 @@ export type DropdownProps = {
50
51
  export const Dropdown = ({
51
52
  options,
52
53
  composeOptions,
54
+ groupTitleOptions,
53
55
  size,
54
56
  classNames,
55
57
  placeholder = 'Select...',
@@ -105,7 +107,7 @@ export const Dropdown = ({
105
107
  }}
106
108
  />
107
109
 
108
- {isOpen && (options || composeOptions) && (
110
+ {isOpen && (options || composeOptions || groupTitleOptions) && (
109
111
  <div
110
112
  onClickCapture={cancelNext}
111
113
  ref={floating}
@@ -121,6 +123,7 @@ export const Dropdown = ({
121
123
  isFluid
122
124
  options={options}
123
125
  composeOptions={composeOptions}
126
+ groupTitleOptions={groupTitleOptions}
124
127
  onSelect={(option) => {
125
128
  handleSelect(option);
126
129
  clickAway();
@@ -16,6 +16,7 @@ const RenderOption = _ref => {
16
16
  let {
17
17
  options,
18
18
  composeOptions,
19
+ groupTitleOptions,
19
20
  ...restProps
20
21
  } = _ref;
21
22
  if (options && Array.isArray(options) && options.length) {
@@ -38,6 +39,20 @@ const RenderOption = _ref => {
38
39
  option: option
39
40
  }, restProps)))))));
40
41
  }
42
+ if (groupTitleOptions && Array.isArray(groupTitleOptions) && groupTitleOptions.length) {
43
+ return /*#__PURE__*/React.createElement(React.Fragment, null, groupTitleOptions.map((optionsGroup, index) =>
44
+ /*#__PURE__*/
45
+ // eslint-disable-next-line react/no-array-index-key
46
+ React.createElement(React.Fragment, {
47
+ key: index
48
+ }, !!optionsGroup.groupTitle && /*#__PURE__*/React.createElement("div", {
49
+ className: _MenuModule.default.groupTitleWrapper
50
+ }, optionsGroup.groupTitle), optionsGroup.options?.map(option => /*#__PURE__*/React.createElement(React.Fragment, {
51
+ key: option.key
52
+ }, /*#__PURE__*/React.createElement(_MenuOptionButton.MenuOptionButton, _extends({
53
+ option: option
54
+ }, restProps)))))));
55
+ }
41
56
  return /*#__PURE__*/React.createElement(React.Fragment, null);
42
57
  };
43
58
  const Menu = props => {
@@ -39,14 +39,21 @@ export type MenuProps = {
39
39
 
40
40
  export type MenuSizeTypes = 'medium' | 'small';
41
41
 
42
+ export type MenuGroupTitleOption = {
43
+ groupTitle?: React.Node,
44
+ options?: Array<MenuOption>,
45
+ };
46
+
42
47
  export type MenuOptionTypes = {
43
48
  options?: Array<MenuOption>,
44
49
  composeOptions?: Array<Array<MenuOption>>,
50
+ groupTitleOptions?: Array<MenuGroupTitleOption>,
45
51
  };
46
52
 
47
53
  const RenderOption = ({
48
54
  options,
49
55
  composeOptions,
56
+ groupTitleOptions,
50
57
  ...restProps
51
58
  }: MenuProps): React.Node => {
52
59
  if (options && Array.isArray(options) && options.length) {
@@ -80,6 +87,32 @@ const RenderOption = ({
80
87
  </>
81
88
  );
82
89
  }
90
+ if (
91
+ groupTitleOptions &&
92
+ Array.isArray(groupTitleOptions) &&
93
+ groupTitleOptions.length
94
+ ) {
95
+ return (
96
+ <>
97
+ {groupTitleOptions.map((optionsGroup, index) => (
98
+ // eslint-disable-next-line react/no-array-index-key
99
+ <React.Fragment key={index}>
100
+ {!!optionsGroup.groupTitle && (
101
+ <div className={css.groupTitleWrapper}>
102
+ {optionsGroup.groupTitle}
103
+ </div>
104
+ )}
105
+
106
+ {optionsGroup.options?.map((option) => (
107
+ <React.Fragment key={option.key}>
108
+ <MenuOptionButton option={option} {...restProps} />
109
+ </React.Fragment>
110
+ ))}
111
+ </React.Fragment>
112
+ ))}
113
+ </>
114
+ );
115
+ }
83
116
  return <></>;
84
117
  };
85
118
 
@@ -34,6 +34,7 @@
34
34
  spaceSmall,
35
35
  spaceXSmall,
36
36
  spaceXXSmall,
37
+ spaceMedium,
37
38
  spaceNone
38
39
  ) from '../../styles/variables/_space.css';
39
40
 
@@ -185,3 +186,13 @@
185
186
  .menuDivider:last-child {
186
187
  padding-bottom: spaceNone;
187
188
  }
189
+
190
+ .groupTitleWrapper {
191
+ composes: formLabelSmall from '../../styles/typography.module.css';
192
+ display: flex;
193
+ margin-bottom: spaceXSmall;
194
+ padding-left: spaceSmall;
195
+ padding-right: calc(spaceXSmall / 2);
196
+ color: colorTextTertiary;
197
+ margin-top: spaceSmall;
198
+ }
@@ -3,17 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "Menu", {
7
- enumerable: true,
8
- get: function () {
9
- return _Menu.Menu;
10
- }
11
- });
12
- Object.defineProperty(exports, "MenuOptionButton", {
13
- enumerable: true,
14
- get: function () {
15
- return _MenuOptionButton.MenuOptionButton;
16
- }
17
- });
18
6
  var _Menu = require("./Menu");
19
- var _MenuOptionButton = require("./MenuOptionButton");
7
+ Object.keys(_Menu).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Menu[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Menu[key];
14
+ }
15
+ });
16
+ });
17
+ var _MenuOptionButton = require("./MenuOptionButton");
18
+ Object.keys(_MenuOptionButton).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _MenuOptionButton[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _MenuOptionButton[key];
25
+ }
26
+ });
27
+ });
@@ -1,5 +1,4 @@
1
1
  // @flow strict
2
2
 
3
- export type {MenuOption, MenuProps} from './Menu';
4
- export {Menu} from './Menu';
5
- export {MenuOptionButton} from './MenuOptionButton';
3
+ export * from './Menu';
4
+ export * from './MenuOptionButton';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {