@spaced-out/ui-design-system 0.0.27 → 0.0.29

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/components/ButtonDropdown/ButtonDropdown.js +1 -1
  3. package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +1 -1
  4. package/lib/components/Dropdown/Dropdown.js +2 -1
  5. package/lib/components/Dropdown/Dropdown.js.flow +3 -1
  6. package/lib/components/EmptyState/EmptyImages/CalendarEmptyImage.js +98 -0
  7. package/lib/components/EmptyState/EmptyImages/CalendarEmptyImage.js.flow +112 -0
  8. package/lib/components/EmptyState/EmptyImages/DataEmptyImage.js +110 -0
  9. package/lib/components/EmptyState/EmptyImages/DataEmptyImage.js.flow +120 -0
  10. package/lib/components/EmptyState/EmptyImages/FileEmptyImage.js +115 -0
  11. package/lib/components/EmptyState/EmptyImages/FileEmptyImage.js.flow +137 -0
  12. package/lib/components/EmptyState/EmptyImages/MessageEmptyImage.js +60 -0
  13. package/lib/components/EmptyState/EmptyImages/MessageEmptyImage.js.flow +68 -0
  14. package/lib/components/EmptyState/EmptyImages/UploadEmptyImage.js +62 -0
  15. package/lib/components/EmptyState/EmptyImages/UploadEmptyImage.js.flow +71 -0
  16. package/lib/components/EmptyState/EmptyImages/index.js +60 -0
  17. package/lib/components/EmptyState/EmptyImages/index.js.flow +7 -0
  18. package/lib/components/EmptyState/EmptyState.js +42 -0
  19. package/lib/components/EmptyState/EmptyState.js.flow +80 -0
  20. package/lib/components/EmptyState/EmptyState.module.css +30 -0
  21. package/lib/components/EmptyState/index.js +16 -0
  22. package/lib/components/EmptyState/index.js.flow +3 -0
  23. package/lib/components/Tabs/TabList/TabDropdown.js +1 -1
  24. package/lib/components/Tabs/TabList/TabDropdown.js.flow +1 -1
  25. package/lib/components/Typeahead/Typeahead.js +2 -1
  26. package/lib/components/Typeahead/Typeahead.js.flow +3 -1
  27. package/package.json +1 -1
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EmptyState = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
9
+ var _EmptyImages = require("./EmptyImages");
10
+ var _EmptyStateModule = _interopRequireDefault(require("./EmptyState.module.css"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ 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); }
13
+ 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; }
14
+ 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); }
15
+ const EmptyState = _ref => {
16
+ let {
17
+ classNames,
18
+ children,
19
+ imageVariant,
20
+ title,
21
+ description,
22
+ customImageUrl,
23
+ ...props
24
+ } = _ref;
25
+ return /*#__PURE__*/React.createElement("div", _extends({}, props, {
26
+ "data-testid": "EmptyState",
27
+ className: (0, _classify.default)(_EmptyStateModule.default.wrapper, classNames?.wrapper)
28
+ }), !!imageVariant && !customImageUrl && /*#__PURE__*/React.createElement("div", {
29
+ className: (0, _classify.default)(_EmptyStateModule.default.image, classNames?.image)
30
+ }, imageVariant === 'calendar' && /*#__PURE__*/React.createElement(_EmptyImages.CalendarEmptyImage, null), imageVariant === 'data' && /*#__PURE__*/React.createElement(_EmptyImages.DataEmptyImage, null), imageVariant === 'file' && /*#__PURE__*/React.createElement(_EmptyImages.FileEmptyImage, null), imageVariant === 'message' && /*#__PURE__*/React.createElement(_EmptyImages.MessageEmptyImage, null), imageVariant === 'upload' && /*#__PURE__*/React.createElement(_EmptyImages.UploadEmptyImage, null)), customImageUrl && /*#__PURE__*/React.createElement("img", {
31
+ className: (0, _classify.default)(_EmptyStateModule.default.image, classNames?.image),
32
+ src: customImageUrl,
33
+ alt: "Empty State"
34
+ }), !!title && /*#__PURE__*/React.createElement("div", {
35
+ className: (0, _classify.default)(_EmptyStateModule.default.title, classNames?.title)
36
+ }, title), !!description && /*#__PURE__*/React.createElement("div", {
37
+ className: (0, _classify.default)(_EmptyStateModule.default.description, classNames?.description)
38
+ }, description), !!children && /*#__PURE__*/React.createElement("div", {
39
+ className: (0, _classify.default)(_EmptyStateModule.default.childrenWrapper, classNames?.children)
40
+ }, children));
41
+ };
42
+ exports.EmptyState = EmptyState;
@@ -0,0 +1,80 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import classify from '../../utils/classify';
6
+
7
+ import {
8
+ CalendarEmptyImage,
9
+ DataEmptyImage,
10
+ FileEmptyImage,
11
+ MessageEmptyImage,
12
+ UploadEmptyImage,
13
+ } from './EmptyImages';
14
+
15
+ import css from './EmptyState.module.css';
16
+
17
+
18
+ type ClassNames = $ReadOnly<{
19
+ wrapper?: string,
20
+ image?: string,
21
+ title?: string,
22
+ description?: string,
23
+ children?: string,
24
+ }>;
25
+
26
+ export type EmptyStateProps = {
27
+ classNames?: ClassNames,
28
+ children?: React.Node,
29
+ imageVariant?: 'calendar' | 'data' | 'file' | 'message' | 'upload',
30
+ title?: React.Node,
31
+ description?: React.Node,
32
+ customImageUrl?: string,
33
+ ...
34
+ };
35
+
36
+ export const EmptyState = ({
37
+ classNames,
38
+ children,
39
+ imageVariant,
40
+ title,
41
+ description,
42
+ customImageUrl,
43
+ ...props
44
+ }: EmptyStateProps): React.Node => (
45
+ <div
46
+ {...props}
47
+ data-testid="EmptyState"
48
+ className={classify(css.wrapper, classNames?.wrapper)}
49
+ >
50
+ {!!imageVariant && !customImageUrl && (
51
+ <div className={classify(css.image, classNames?.image)}>
52
+ {imageVariant === 'calendar' && <CalendarEmptyImage />}
53
+ {imageVariant === 'data' && <DataEmptyImage />}
54
+ {imageVariant === 'file' && <FileEmptyImage />}
55
+ {imageVariant === 'message' && <MessageEmptyImage />}
56
+ {imageVariant === 'upload' && <UploadEmptyImage />}
57
+ </div>
58
+ )}
59
+ {customImageUrl && (
60
+ <img
61
+ className={classify(css.image, classNames?.image)}
62
+ src={customImageUrl}
63
+ alt="Empty State"
64
+ />
65
+ )}
66
+ {!!title && (
67
+ <div className={classify(css.title, classNames?.title)}>{title}</div>
68
+ )}
69
+ {!!description && (
70
+ <div className={classify(css.description, classNames?.description)}>
71
+ {description}
72
+ </div>
73
+ )}
74
+ {!!children && (
75
+ <div className={classify(css.childrenWrapper, classNames?.children)}>
76
+ {children}
77
+ </div>
78
+ )}
79
+ </div>
80
+ );
@@ -0,0 +1,30 @@
1
+ @value (colorTextSecondary) from '../../styles/variables/_color.css';
2
+ @value (spaceMedium, spaceXSmall) from '../../styles/variables/_space.css';
3
+ @value (sizeFluid, size140) from '../../styles/variables/_size.css';
4
+
5
+ .wrapper {
6
+ display: flex;
7
+ width: sizeFluid;
8
+ height: sizeFluid;
9
+ flex-flow: column;
10
+ align-items: center;
11
+ justify-content: center;
12
+ text-align: center;
13
+ padding: spaceMedium;
14
+ }
15
+
16
+ .image {
17
+ margin-bottom: spaceMedium;
18
+ max-width: size140;
19
+ }
20
+
21
+ .title {
22
+ composes: subTitleMedium from '../../styles/typography.module.css';
23
+ margin-bottom: spaceXSmall;
24
+ }
25
+
26
+ .description {
27
+ composes: bodyMedium from '../../styles/typography.module.css';
28
+ color: colorTextSecondary;
29
+ margin-bottom: spaceMedium;
30
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _EmptyState = require("./EmptyState");
7
+ Object.keys(_EmptyState).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _EmptyState[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _EmptyState[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './EmptyState';
@@ -73,7 +73,7 @@ const TabDropdown = _ref => {
73
73
  onOptionSelect && onOptionSelect(option);
74
74
  clickAway();
75
75
  },
76
- size: size
76
+ size: props.menu.size || size
77
77
  }))));
78
78
  });
79
79
  };
@@ -94,7 +94,7 @@ export const TabDropdown = ({
94
94
  onOptionSelect && onOptionSelect(option);
95
95
  clickAway();
96
96
  }}
97
- size={size}
97
+ size={props.menu.size || size}
98
98
  />
99
99
  </div>
100
100
  )}
@@ -27,6 +27,7 @@ const Typeahead = _ref => {
27
27
  onSelect,
28
28
  onSearch,
29
29
  selectedOption,
30
+ menuSize,
30
31
  ...inputProps
31
32
  } = _ref;
32
33
  const typeaheadRef = React.useRef();
@@ -112,7 +113,7 @@ const Typeahead = _ref => {
112
113
  handleSelect(option);
113
114
  clickAway();
114
115
  },
115
- size: size
116
+ size: menuSize || size
116
117
  })));
117
118
  });
118
119
  };
@@ -44,6 +44,7 @@ export type TypeaheadProps = {
44
44
  required?: boolean,
45
45
  options?: Array<MenuOption>,
46
46
  selectedOption?: MenuOption,
47
+ menuSize?: 'medium' | 'small',
47
48
  };
48
49
 
49
50
  export const Typeahead = ({
@@ -54,6 +55,7 @@ export const Typeahead = ({
54
55
  onSelect,
55
56
  onSearch,
56
57
  selectedOption,
58
+ menuSize,
57
59
  ...inputProps
58
60
  }: TypeaheadProps): React.Node => {
59
61
  const typeaheadRef = React.useRef();
@@ -142,7 +144,7 @@ export const Typeahead = ({
142
144
  handleSelect(option);
143
145
  clickAway();
144
146
  }}
145
- size={size}
147
+ size={menuSize || size}
146
148
  />
147
149
  </div>
148
150
  )}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {