@spaced-out/ui-design-system 0.0.2-beta.1 → 0.0.2

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 (31) hide show
  1. package/.storybook/SenseTheme.js +1 -2
  2. package/.storybook/manager-head.html +24 -0
  3. package/.storybook/public/images/Alias.png +0 -0
  4. package/.storybook/public/images/Base.png +0 -0
  5. package/.storybook/public/images/Logo.svg +10 -0
  6. package/.storybook/public/images/components.svg +214 -0
  7. package/.storybook/public/images/design-tokens.png +0 -0
  8. package/.storybook/public/images/intro-cover.svg +22 -0
  9. package/CHANGELOG.md +14 -0
  10. package/README.md +0 -11
  11. package/cspell.json +2 -1
  12. package/lib/components/{CodeBlock.js → CodeBlock/CodeBlock.js} +2 -1
  13. package/lib/components/{CodeBlock.js.flow → CodeBlock/CodeBlock.js.flow} +2 -1
  14. package/lib/components/CodeBlock/index.js +12 -0
  15. package/lib/components/CodeBlock/index.js.flow +3 -0
  16. package/lib/components/Icon/ClickableIcon.js +6 -6
  17. package/lib/components/Icon/ClickableIcon.js.flow +12 -6
  18. package/lib/components/Notification/Notification.js +2 -1
  19. package/lib/components/Notification/Notification.js.flow +1 -0
  20. package/lib/components/Notification/Notification.module.css +5 -1
  21. package/lib/components/Text/Text.js +61 -46
  22. package/lib/components/Text/Text.js.flow +58 -15
  23. package/lib/components/Textarea/Textarea.module.css +4 -1
  24. package/lib/components/Toast/Toast.js +4 -2
  25. package/lib/components/Toast/Toast.js.flow +4 -3
  26. package/lib/components/Toast/Toast.module.css +4 -0
  27. package/lib/components/Toggle/Toggle.module.css +0 -2
  28. package/lib/components/Truncate/Truncate.js +28 -2
  29. package/lib/components/Truncate/Truncate.js.flow +21 -1
  30. package/lib/components/Truncate/Truncate.module.css +0 -1
  31. package/package.json +1 -1
@@ -168,9 +168,10 @@ export const Toast = ({
168
168
  const {floating, context} = useFloating();
169
169
 
170
170
  const getComp = (comp: string) => {
171
- if (children instanceof Array) {
171
+ const childrenArray = React.Children.toArray(children);
172
+ if (childrenArray.length) {
172
173
  const nodes: React.Node[] = [];
173
- for (const child of children) {
174
+ for (const child of childrenArray) {
174
175
  if (child?.type?.name === comp) {
175
176
  nodes.push(child);
176
177
  }
@@ -203,7 +204,7 @@ export const Toast = ({
203
204
  </div>
204
205
  {footerWithClose}
205
206
  </div>
206
- <CloseIcon onClick={onClose} />
207
+ <CloseIcon className={css.closeIcon} onClick={onClose} />
207
208
  </div>
208
209
  </FloatingFocusManager>
209
210
  );
@@ -50,3 +50,7 @@
50
50
  align-items: flex-start;
51
51
  gap: spaceSmall;
52
52
  }
53
+
54
+ .closeIcon {
55
+ margin-left: auto;
56
+ }
@@ -84,8 +84,6 @@
84
84
  }
85
85
 
86
86
  .toggle::before {
87
- box-shadow: shadowBoxShadow1X shadowBoxShadow1Y shadowBoxShadow1Blur
88
- shadowBoxShadow1Spread shadowBoxShadow1Color;
89
87
  position: absolute;
90
88
  content: '';
91
89
  height: size10;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Truncate = void 0;
6
+ exports.Truncate = exports.BaseTruncate = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _classify = require("../../utils/classify");
9
9
  var _TruncateModule = _interopRequireDefault(require("./Truncate.module.css"));
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
11
  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); }
12
12
  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; }
13
13
 
14
- const Truncate = _ref => {
14
+ const BaseTruncate = _ref => {
15
15
  let {
16
16
  children,
17
17
  line = 1
@@ -23,4 +23,30 @@ const Truncate = _ref => {
23
23
  }
24
24
  }, children);
25
25
  };
26
+ exports.BaseTruncate = BaseTruncate;
27
+ const Truncate = _ref2 => {
28
+ let {
29
+ children,
30
+ line = 1
31
+ } = _ref2;
32
+ const arrayChildren = React.Children.toArray(children);
33
+ if (arrayChildren.length) {
34
+ const child = arrayChildren[0];
35
+ if ( /*#__PURE__*/React.isValidElement(child)) {
36
+ const {
37
+ className
38
+ } = child.props;
39
+ return /*#__PURE__*/React.cloneElement(child, {
40
+ className: (0, _classify.classify)(_TruncateModule.default.truncateLineClamp, className),
41
+ style: {
42
+ WebkitLineClamp: `${line}`
43
+ }
44
+ });
45
+ }
46
+ return /*#__PURE__*/React.createElement(BaseTruncate, {
47
+ line: line
48
+ }, children);
49
+ }
50
+ return null;
51
+ };
26
52
  exports.Truncate = Truncate;
@@ -12,7 +12,10 @@ export type TruncateProps = {
12
12
  line?: number,
13
13
  };
14
14
 
15
- export const Truncate = ({children, line = 1}: TruncateProps): React.Node => (
15
+ export const BaseTruncate = ({
16
+ children,
17
+ line = 1,
18
+ }: TruncateProps): React.Node => (
16
19
  <span
17
20
  className={classify(css.truncateLineClamp)}
18
21
  style={{WebkitLineClamp: `${line}`}}
@@ -20,3 +23,20 @@ export const Truncate = ({children, line = 1}: TruncateProps): React.Node => (
20
23
  {children}
21
24
  </span>
22
25
  );
26
+
27
+ export const Truncate = ({children, line = 1}: TruncateProps): React.Node => {
28
+ const arrayChildren = React.Children.toArray(children);
29
+ if (arrayChildren.length) {
30
+ const child = arrayChildren[0];
31
+ if (React.isValidElement(child)) {
32
+ const {className} = child.props;
33
+
34
+ return React.cloneElement(child, {
35
+ className: classify(css.truncateLineClamp, className),
36
+ style: {WebkitLineClamp: `${line}`},
37
+ });
38
+ }
39
+ return <BaseTruncate line={line}>{children}</BaseTruncate>;
40
+ }
41
+ return null;
42
+ };
@@ -2,5 +2,4 @@
2
2
  display: -webkit-box;
3
3
  -webkit-box-orient: vertical;
4
4
  overflow: hidden;
5
- font: inherit;
6
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.2-beta.1",
3
+ "version": "0.0.2",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {