@spaced-out/ui-design-system 0.0.2-beta.2 → 0.0.3-beta.0

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 (41) hide show
  1. package/.storybook/SenseTheme.js +1 -2
  2. package/.storybook/manager-head.html +25 -0
  3. package/.storybook/preview.js +1 -1
  4. package/.storybook/public/images/Alias.png +0 -0
  5. package/.storybook/public/images/Base.png +0 -0
  6. package/.storybook/public/images/Logo.png +0 -0
  7. package/.storybook/public/images/component-token.png +0 -0
  8. package/.storybook/public/images/components.png +0 -0
  9. package/.storybook/public/images/design-tokens.png +0 -0
  10. package/.storybook/public/images/intro-cover.png +0 -0
  11. package/CHANGELOG.md +14 -0
  12. package/README.md +0 -11
  13. package/cspell.json +2 -1
  14. package/lib/components/Button/Button.js +4 -1
  15. package/lib/components/Button/Button.js.flow +4 -1
  16. package/lib/components/{CodeBlock.js → CodeBlock/CodeBlock.js} +2 -1
  17. package/lib/components/{CodeBlock.js.flow → CodeBlock/CodeBlock.js.flow} +2 -1
  18. package/lib/components/CodeBlock/index.js +12 -0
  19. package/lib/components/CodeBlock/index.js.flow +3 -0
  20. package/lib/components/Icon/ClickableIcon.js +8 -6
  21. package/lib/components/Icon/ClickableIcon.js.flow +15 -6
  22. package/lib/components/Icon/Icon.js.flow +1 -0
  23. package/lib/components/Modal/Modal.js +43 -3
  24. package/lib/components/Modal/Modal.js.flow +54 -0
  25. package/lib/components/Modal/Modal.module.css +42 -3
  26. package/lib/components/Notification/Notification.js +2 -1
  27. package/lib/components/Notification/Notification.js.flow +1 -0
  28. package/lib/components/Notification/Notification.module.css +5 -1
  29. package/lib/components/Panel/Panel.js +2 -1
  30. package/lib/components/Panel/Panel.js.flow +1 -0
  31. package/lib/components/Panel/Panel.module.css +2 -0
  32. package/lib/components/Text/Text.js +61 -46
  33. package/lib/components/Text/Text.js.flow +58 -15
  34. package/lib/components/Toast/Toast.js +6 -3
  35. package/lib/components/Toast/Toast.js.flow +8 -3
  36. package/lib/components/Toast/Toast.module.css +4 -0
  37. package/lib/components/Toggle/Toggle.module.css +0 -2
  38. package/lib/components/Truncate/Truncate.js +28 -2
  39. package/lib/components/Truncate/Truncate.js.flow +21 -1
  40. package/lib/components/Truncate/Truncate.module.css +0 -1
  41. package/package.json +1 -1
@@ -3,8 +3,7 @@ import {create} from '@storybook/theming';
3
3
  export default create({
4
4
  base: 'light',
5
5
  brandTitle: 'Genesis',
6
- brandImage:
7
- 'https://assets-global.website-files.com/613f2494a7d5cd1817022b81/618cffd78219af09f95a7446_Group%204.svg',
6
+ brandImage: 'images/Logo.png',
8
7
 
9
8
  fontBase: '"Centra No 2", "proxima-nova", "Helvetica Neue"',
10
9
  textColor: '#17172A',
@@ -37,5 +37,30 @@
37
37
  body {
38
38
  /* This will target all of the children */
39
39
  font-family: 'Centra No 2' !important;
40
+ background: #17172a;
41
+ }
42
+
43
+ .sidebar-container {
44
+ background: #17172a !important;
45
+ }
46
+
47
+ .sidebar-item {
48
+ color: #efebfa !important;
49
+ }
50
+
51
+ .search-result-item--label {
52
+ color: #efebfa !important;
53
+ }
54
+
55
+ .sidebar-item[data-selected='true'] {
56
+ background: #5c34cd !important;
57
+ }
58
+
59
+ .search-field input {
60
+ border-color: #efebfa !important;
61
+ }
62
+
63
+ #root > div:first-child {
64
+ background: #17172a;
40
65
  }
41
66
  </style>
@@ -62,8 +62,8 @@ export const parameters = {
62
62
  method: 'alphabetical',
63
63
  order: [
64
64
  'Introduction',
65
- 'Changelog',
66
65
  'Design Tokens',
66
+ 'Changelog',
67
67
  'Tokens',
68
68
  'Components',
69
69
  [
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.3-beta.0 (2022-11-21)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * documentation fixes and modal semantics ([45770ab](https://github.com/Spaced-Out/ui-design-system/commit/45770ab7e7a04ffa78c962fdef7bfc8971b54b3e))
11
+
12
+ ### 0.0.2 (2022-11-16)
13
+
14
+
15
+ ### Features
16
+
17
+ * documentation changes, storybook sidepanel redesign ([eb93ac3](https://github.com/Spaced-Out/ui-design-system/commit/eb93ac3ff1ffce7ab163f382633997a5c9999f6d))
18
+
5
19
  ### 0.0.2-beta.2 (2022-11-16)
6
20
 
7
21
 
package/README.md CHANGED
@@ -124,17 +124,6 @@ in `consumer`
124
124
  yarn upgrade @spaced-out/ui-design-system@file:../../ui-design-system
125
125
  ```
126
126
 
127
- ## Publishing
128
-
129
- ### Hosting via NPM
130
-
131
- First, make sure you have an NPM account and are [logged into NPM using the `npm login` command.](https://docs.npmjs.com/creating-a-new-npm-user-account)
132
-
133
- ```
134
- yarn prepublishOnly
135
- yarn publish
136
- ```
137
-
138
127
  ## Usage
139
128
 
140
129
  Let's say you created a public NPM package called `@spaced-out/ui-design-system` with the `Button` component created in this repository.
package/cspell.json CHANGED
@@ -6,7 +6,8 @@
6
6
  "lib",
7
7
  "storybook-static",
8
8
  ".vscode",
9
- "CHANGELOG.md"
9
+ "CHANGELOG.md",
10
+ ".storybook/public"
10
11
  ],
11
12
  // Enable your dictionary by adding it to the list of `dictionaries`
12
13
  "dictionaries": ["custom-words"],
@@ -32,9 +32,12 @@ const UnstyledButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
32
32
  disabled,
33
33
  onClick,
34
34
  className,
35
+ ariaLabel,
35
36
  ...props
36
37
  } = _ref;
37
- return /*#__PURE__*/React.createElement("button", _extends({}, props, {
38
+ return /*#__PURE__*/React.createElement("button", _extends({}, props, ariaLabel ? {
39
+ 'aria-label': ariaLabel
40
+ } : {}, {
38
41
  className: className,
39
42
  ref: ref,
40
43
  role: "button",
@@ -16,6 +16,7 @@ export type UnstyledButtonProps = {
16
16
  disabled?: mixed,
17
17
  onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
18
18
  className?: string,
19
+ ariaLabel?: string,
19
20
  ...
20
21
  };
21
22
 
@@ -41,6 +42,7 @@ export type ButtonProps = {
41
42
  isFluid?: boolean,
42
43
  disabled?: boolean,
43
44
  size?: 'medium' | 'small',
45
+ ariaLabel?: string,
44
46
  ...
45
47
  };
46
48
 
@@ -57,11 +59,12 @@ export const UnstyledButton: React$AbstractComponent<
57
59
  HTMLButtonElement,
58
60
  > = React.forwardRef<UnstyledButtonProps, HTMLButtonElement>(
59
61
  (
60
- {disabled, onClick, className, ...props}: UnstyledButtonProps,
62
+ {disabled, onClick, className, ariaLabel, ...props}: UnstyledButtonProps,
61
63
  ref: React.Ref<'button'>,
62
64
  ) => (
63
65
  <button
64
66
  {...props}
67
+ {...(ariaLabel ? {'aria-label': ariaLabel} : {})}
65
68
  className={className}
66
69
  ref={ref}
67
70
  role="button"
@@ -16,7 +16,8 @@ const CodeBlock = _ref => {
16
16
  } = _ref;
17
17
  return /*#__PURE__*/React.createElement(_reactCodeBlocks.CodeBlock, _extends({
18
18
  text: children,
19
- showLineNumbers: false
19
+ showLineNumbers: false,
20
+ theme: _reactCodeBlocks.dracula
20
21
  }, props));
21
22
  };
22
23
  exports.CodeBlock = CodeBlock;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  // $FlowFixMe[untyped-import]
5
- import {CodeBlock as ReactCodeBlock} from 'react-code-blocks';
5
+ import {CodeBlock as ReactCodeBlock, dracula} from 'react-code-blocks';
6
6
 
7
7
 
8
8
  type CodeBlockProps = {
@@ -14,6 +14,7 @@ export const CodeBlock = ({children, ...props}: CodeBlockProps): React.Node => (
14
14
  <ReactCodeBlock
15
15
  text={children}
16
16
  showLineNumbers={false}
17
+ theme={dracula}
17
18
  {...props}
18
19
  ></ReactCodeBlock>
19
20
  );
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CodeBlock", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _CodeBlock.CodeBlock;
10
+ }
11
+ });
12
+ var _CodeBlock = require("./CodeBlock");
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export {CodeBlock} from './CodeBlock';
@@ -17,13 +17,16 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
17
17
  const ClickableIcon = _ref => {
18
18
  let {
19
19
  size = 'medium',
20
+ className,
21
+ ariaLabel,
20
22
  ...props
21
23
  } = _ref;
22
24
  return /*#__PURE__*/React.createElement(_Button.UnstyledButton, _extends({}, props, {
25
+ ariaLabel: ariaLabel,
23
26
  className: (0, _classify.default)(_ClickableIconModule.default.button, {
24
27
  [_ClickableIconModule.default.small]: size === 'small',
25
28
  [_ClickableIconModule.default.medium]: size === 'medium'
26
- })
29
+ }, className)
27
30
  }), /*#__PURE__*/React.createElement(_.Icon, _extends({
28
31
  size: size
29
32
  }, props)));
@@ -34,14 +37,13 @@ const CloseIcon = _ref2 => {
34
37
  size = 'medium',
35
38
  type = 'regular',
36
39
  color = _Text.TEXT_COLORS.primary,
37
- onClick
40
+ ...props
38
41
  } = _ref2;
39
- return /*#__PURE__*/React.createElement(ClickableIcon, {
42
+ return /*#__PURE__*/React.createElement(ClickableIcon, _extends({
40
43
  name: "close",
41
44
  size: size,
42
45
  type: type,
43
- color: color,
44
- onClick: onClick
45
- });
46
+ color: color
47
+ }, props));
46
48
  };
47
49
  exports.CloseIcon = CloseIcon;
@@ -15,14 +15,21 @@ import css from './ClickableIcon.module.css';
15
15
 
16
16
  export const ClickableIcon = ({
17
17
  size = 'medium',
18
+ className,
19
+ ariaLabel,
18
20
  ...props
19
21
  }: IconProps): React.Node => (
20
22
  <UnstyledButton
21
23
  {...props}
22
- className={classify(css.button, {
23
- [css.small]: size === 'small',
24
- [css.medium]: size === 'medium',
25
- })}
24
+ ariaLabel={ariaLabel}
25
+ className={classify(
26
+ css.button,
27
+ {
28
+ [css.small]: size === 'small',
29
+ [css.medium]: size === 'medium',
30
+ },
31
+ className,
32
+ )}
26
33
  >
27
34
  <Icon size={size} {...props} />
28
35
  </UnstyledButton>
@@ -33,19 +40,21 @@ export type CloseIconProps = {
33
40
  type?: IconType,
34
41
  color?: ColorTypes,
35
42
  onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
43
+ className?: string,
44
+ ariaLabel?: string,
36
45
  };
37
46
 
38
47
  export const CloseIcon = ({
39
48
  size = 'medium',
40
49
  type = 'regular',
41
50
  color = TEXT_COLORS.primary,
42
- onClick,
51
+ ...props
43
52
  }: CloseIconProps): React.Node => (
44
53
  <ClickableIcon
45
54
  name="close"
46
55
  size={size}
47
56
  type={type}
48
57
  color={color}
49
- onClick={onClick}
58
+ {...props}
50
59
  />
51
60
  );
@@ -23,6 +23,7 @@ export type IconProps = {
23
23
  color?: ColorTypes,
24
24
  className?: string,
25
25
  onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
26
+ ariaLabel?: string,
26
27
  };
27
28
 
28
29
  export const Icon = ({
@@ -3,13 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Modal = void 0;
6
+ exports.ModalHeader = exports.ModalFooter = exports.ModalBody = exports.Modal = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _reactDom = require("react-dom");
9
9
  var _reactDomInteractions = require("@floating-ui/react-dom-interactions");
10
10
  var _useMountTransition = _interopRequireDefault(require("../../hooks/useMountTransition"));
11
11
  var _motion = require("../../styles/variables/_motion");
12
12
  var _classify = _interopRequireDefault(require("../../utils/classify"));
13
+ var _Button = require("../Button/Button.js");
14
+ var _Truncate = require("../Truncate/Truncate.js");
13
15
  var _ModalModule = _interopRequireDefault(require("./Modal.module.css"));
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
  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); }
@@ -17,12 +19,50 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17
19
 
18
20
  // $FlowFixMe[untyped-import]
19
21
 
22
+ const ModalHeader = _ref => {
23
+ let {
24
+ children,
25
+ hideCloseBtn,
26
+ onCloseButtonClick
27
+ } = _ref;
28
+ return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
29
+ className: _ModalModule.default.modalHeader
30
+ }, /*#__PURE__*/React.createElement("div", {
31
+ className: _ModalModule.default.headerContent
32
+ }, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children)), !hideCloseBtn && /*#__PURE__*/React.createElement(_Button.Button, {
33
+ iconLeftName: "xmark",
34
+ type: "ghost",
35
+ onClick: onCloseButtonClick,
36
+ ariaLabel: "Close Button"
37
+ })));
38
+ };
39
+ exports.ModalHeader = ModalHeader;
40
+ const ModalBody = _ref2 => {
41
+ let {
42
+ children
43
+ } = _ref2;
44
+ return /*#__PURE__*/React.createElement("div", {
45
+ className: _ModalModule.default.modalBody
46
+ }, children);
47
+ };
48
+ exports.ModalBody = ModalBody;
49
+ const ModalFooter = _ref3 => {
50
+ let {
51
+ children
52
+ } = _ref3;
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
54
+ className: _ModalModule.default.modalFooter
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: _ModalModule.default.modalFooterActions
57
+ }, children)));
58
+ };
59
+ exports.ModalFooter = ModalFooter;
20
60
  const createPortalRoot = () => {
21
61
  const modalRoot = document.createElement('div');
22
62
  modalRoot.setAttribute('id', 'modal-root');
23
63
  return modalRoot;
24
64
  };
25
- const Modal = _ref => {
65
+ const Modal = _ref4 => {
26
66
  let {
27
67
  classNames,
28
68
  children,
@@ -32,7 +72,7 @@ const Modal = _ref => {
32
72
  removeWhenClosed = true,
33
73
  tapOutsideToClose = true,
34
74
  initialFocus = -1
35
- } = _ref;
75
+ } = _ref4;
36
76
  const {
37
77
  floating,
38
78
  context
@@ -13,6 +13,8 @@ import {
13
13
  import useMountTransition from '../../hooks/useMountTransition';
14
14
  import {motionDurationNormal} from '../../styles/variables/_motion';
15
15
  import classify from '../../utils/classify';
16
+ import {Button} from '../Button/Button.js';
17
+ import {Truncate} from '../Truncate/Truncate.js';
16
18
 
17
19
  import css from './Modal.module.css';
18
20
 
@@ -34,6 +36,58 @@ export type ModalProps = {
34
36
  initialFocus?: number,
35
37
  };
36
38
 
39
+ export type ModalHeaderProps = {
40
+ children?: React.Node,
41
+ hideCloseBtn?: boolean,
42
+ onCloseButtonClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
43
+ };
44
+
45
+ export type ModalFooterProps = {
46
+ children?: React.Node,
47
+ };
48
+
49
+ export type ModalBodyProps = {
50
+ children?: React.Node,
51
+ };
52
+
53
+ export const ModalHeader = ({
54
+ children,
55
+ hideCloseBtn,
56
+ onCloseButtonClick,
57
+ }: ModalHeaderProps): React.Node => (
58
+ <>
59
+ {React.Children.count(children) > 0 && (
60
+ <div className={css.modalHeader}>
61
+ <div className={css.headerContent}>
62
+ <Truncate>{children}</Truncate>
63
+ </div>
64
+ {!hideCloseBtn && (
65
+ <Button
66
+ iconLeftName="xmark"
67
+ type="ghost"
68
+ onClick={onCloseButtonClick}
69
+ ariaLabel="Close Button"
70
+ ></Button>
71
+ )}
72
+ </div>
73
+ )}
74
+ </>
75
+ );
76
+
77
+ export const ModalBody = ({children}: ModalBodyProps): React.Node => (
78
+ <div className={css.modalBody}>{children}</div>
79
+ );
80
+
81
+ export const ModalFooter = ({children}: ModalFooterProps): React.Node => (
82
+ <>
83
+ {React.Children.count(children) > 0 && (
84
+ <div className={css.modalFooter}>
85
+ <div className={css.modalFooterActions}>{children}</div>
86
+ </div>
87
+ )}
88
+ </>
89
+ );
90
+
37
91
  const createPortalRoot = () => {
38
92
  const modalRoot = document.createElement('div');
39
93
  modalRoot.setAttribute('id', 'modal-root');
@@ -1,9 +1,10 @@
1
- @value (colorBackgroundTertiary, colorBackdropFill) from '../../styles/variables/_color.css';
2
- @value (spaceNone, spaceXXSmall, spaceHalfFluid, spaceNegHalfFluid) from '../../styles/variables/_space.css';
3
- @value (sizeFluid) from '../../styles/variables/_size.css';
1
+ @value (colorBackgroundTertiary, colorBackgroundPrimary, colorBackdropFill) from '../../styles/variables/_color.css';
2
+ @value (spaceNone, spaceSmall, spaceMedium, spaceXXSmall, spaceHalfFluid, spaceNegHalfFluid) from '../../styles/variables/_space.css';
3
+ @value (sizeFluid, size60) from '../../styles/variables/_size.css';
4
4
  @value (elevationNone, elevationModal, elevationBackdrop) from '../../styles/variables/_elevation.css';
5
5
  @value (opacity100, opacity0) from '../../styles/variables/_opacity.css';
6
6
  @value (motionDurationNormal, motionEaseInEaseOut) from '../../styles/variables/_motion.css';
7
+ @value (borderRadiusMedium) from '../../styles/variables/_border.css';
7
8
 
8
9
  .modalContainer {
9
10
  display: flex;
@@ -24,6 +25,7 @@
24
25
  overflow: auto;
25
26
  z-index: elevationModal;
26
27
  transition: opacity motionDurationNormal, transform motionDurationNormal;
28
+ border-radius: borderRadiusMedium;
27
29
  }
28
30
 
29
31
  .modalContainer.open.in .modal {
@@ -60,3 +62,40 @@
60
62
  backdrop-filter: blur(spaceXXSmall);
61
63
  background-color: colorBackdropFill;
62
64
  }
65
+
66
+ .modalHeader {
67
+ composes: borderBottomPrimary from '../../styles/border.module.css';
68
+ composes: subTitleLarge from '../../styles/typography.module.css';
69
+ padding: spaceNone spaceSmall spaceNone spaceMedium;
70
+ min-height: size60;
71
+ display: flex;
72
+ justify-content: space-between;
73
+ align-items: center;
74
+ gap: spaceMedium;
75
+ }
76
+
77
+ .headerContent {
78
+ display: flex;
79
+ }
80
+
81
+ .modalBody {
82
+ padding: spaceMedium;
83
+ height: sizeFluid;
84
+ overflow: auto;
85
+ }
86
+
87
+ .modalFooter {
88
+ composes: borderTopPrimary from '../../styles/border.module.css';
89
+ background-color: colorBackgroundPrimary;
90
+ margin-top: auto;
91
+ padding: spaceMedium;
92
+ display: flex;
93
+ justify-content: flex-end;
94
+ align-items: center;
95
+ gap: spaceMedium;
96
+ }
97
+
98
+ .modalFooterActions {
99
+ display: flex;
100
+ gap: spaceSmall;
101
+ }
@@ -36,7 +36,8 @@ const BaseNotification = props => {
36
36
  className: (0, _classify.classify)(_NotificationModule.default.baseContainer, {
37
37
  [_NotificationModule.default.success]: semantic === NOTIFICATION_SEMANTIC.success,
38
38
  [_NotificationModule.default.information]: semantic === NOTIFICATION_SEMANTIC.information,
39
- [_NotificationModule.default.danger]: semantic === NOTIFICATION_SEMANTIC.danger
39
+ [_NotificationModule.default.danger]: semantic === NOTIFICATION_SEMANTIC.danger,
40
+ [_NotificationModule.default.dismissable]: dismissable
40
41
  }, classNames?.wrapper)
41
42
  }, iconLeftName ? /*#__PURE__*/React.createElement(_Icon.Icon, {
42
43
  name: iconLeftName,
@@ -51,6 +51,7 @@ const BaseNotification = (props: BaseNotificationProps): React.Node => {
51
51
  [css.success]: semantic === NOTIFICATION_SEMANTIC.success,
52
52
  [css.information]: semantic === NOTIFICATION_SEMANTIC.information,
53
53
  [css.danger]: semantic === NOTIFICATION_SEMANTIC.danger,
54
+ [css.dismissable]: dismissable,
54
55
  },
55
56
  classNames?.wrapper,
56
57
  )}
@@ -26,11 +26,15 @@
26
26
  width: sizeFluid;
27
27
  min-height: size34;
28
28
  position: relative;
29
- padding: spaceXSmall spaceLarge spaceXSmall spaceSmall;
29
+ padding: spaceXSmall spaceSmall;
30
30
  word-break: normal;
31
31
  overflow-wrap: anywhere;
32
32
  }
33
33
 
34
+ .baseContainer.dismissable {
35
+ padding-right: spaceLarge;
36
+ }
37
+
34
38
  .content {
35
39
  display: flex;
36
40
  }
@@ -29,7 +29,8 @@ const PanelHeader = _ref => {
29
29
  }, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children)), !hideCloseBtn && /*#__PURE__*/React.createElement(_Button.Button, {
30
30
  iconLeftName: "xmark",
31
31
  type: "ghost",
32
- onClick: onCloseButtonClick
32
+ onClick: onCloseButtonClick,
33
+ ariaLabel: "Close Button"
33
34
  })));
34
35
  };
35
36
  exports.PanelHeader = PanelHeader;
@@ -52,6 +52,7 @@ export const PanelHeader = ({
52
52
  iconLeftName="xmark"
53
53
  type="ghost"
54
54
  onClick={onCloseButtonClick}
55
+ ariaLabel="Close Button"
55
56
  ></Button>
56
57
  )}
57
58
  </div>
@@ -2,12 +2,14 @@
2
2
  @value (size4, size60, size480, size580, size720, sizeFluid) from '../../styles/variables/_size.css';
3
3
  @value (motionDurationNormal, motionEaseInEaseOut) from '../../styles/variables/_motion.css';
4
4
  @value (colorBackgroundTertiary, colorBackgroundPrimary) from '../../styles/variables/_color.css';
5
+ @value (borderRadiusNone) from '../../styles/variables/_border.css';
5
6
 
6
7
  .panel {
7
8
  opacity: initial;
8
9
  height: sizeFluid;
9
10
  transition: transform motionDurationNormal motionEaseInEaseOut;
10
11
  background-color: colorBackgroundTertiary;
12
+ border-radius: borderRadiusNone;
11
13
  }
12
14
 
13
15
  .panel.small {
@@ -11,169 +11,184 @@ var _typographyModule = _interopRequireDefault(require("../../styles/typography.
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
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
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
-
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
15
  const JumboMedium = _ref => {
16
16
  let {
17
17
  color = _typography.TEXT_COLORS.primary,
18
18
  children,
19
- className
19
+ className,
20
+ ...props
20
21
  } = _ref;
21
- return /*#__PURE__*/React.createElement("span", {
22
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
22
23
  className: (0, _classify.default)(_typographyModule.default.jumboMedium, _typographyModule.default[color], className)
23
- }, children);
24
+ }), children);
24
25
  };
25
26
  exports.JumboMedium = JumboMedium;
26
27
  const TitleMedium = _ref2 => {
27
28
  let {
28
29
  color = _typography.TEXT_COLORS.primary,
29
30
  children,
30
- className
31
+ className,
32
+ ...props
31
33
  } = _ref2;
32
- return /*#__PURE__*/React.createElement("h1", {
34
+ return /*#__PURE__*/React.createElement("h1", _extends({}, props, {
33
35
  className: (0, _classify.default)(_typographyModule.default.titleMedium, _typographyModule.default[color], className)
34
- }, children);
36
+ }), children);
35
37
  };
36
38
  exports.TitleMedium = TitleMedium;
37
39
  const SubTitleLarge = _ref3 => {
38
40
  let {
39
41
  color = _typography.TEXT_COLORS.primary,
40
42
  children,
41
- className
43
+ className,
44
+ ...props
42
45
  } = _ref3;
43
- return /*#__PURE__*/React.createElement("h2", {
46
+ return /*#__PURE__*/React.createElement("h2", _extends({}, props, {
44
47
  className: (0, _classify.default)(_typographyModule.default.subTitleLarge, _typographyModule.default[color], className)
45
- }, children);
48
+ }), children);
46
49
  };
47
50
  exports.SubTitleLarge = SubTitleLarge;
48
51
  const SubTitleMedium = _ref4 => {
49
52
  let {
50
53
  color = _typography.TEXT_COLORS.primary,
51
54
  children,
52
- className
55
+ className,
56
+ ...props
53
57
  } = _ref4;
54
- return /*#__PURE__*/React.createElement("h3", {
58
+ return /*#__PURE__*/React.createElement("h3", _extends({}, props, {
55
59
  className: (0, _classify.default)(_typographyModule.default.subTitleMedium, _typographyModule.default[color], className)
56
- }, children);
60
+ }), children);
57
61
  };
58
62
  exports.SubTitleMedium = SubTitleMedium;
59
63
  const SubTitleSmall = _ref5 => {
60
64
  let {
61
65
  color = _typography.TEXT_COLORS.primary,
62
66
  children,
63
- className
67
+ className,
68
+ ...props
64
69
  } = _ref5;
65
- return /*#__PURE__*/React.createElement("h4", {
70
+ return /*#__PURE__*/React.createElement("h4", _extends({}, props, {
66
71
  className: (0, _classify.default)(_typographyModule.default.subTitleSmall, _typographyModule.default[color], className)
67
- }, children);
72
+ }), children);
68
73
  };
69
74
  exports.SubTitleSmall = SubTitleSmall;
70
75
  const SubTitleExtraSmall = _ref6 => {
71
76
  let {
72
77
  color = _typography.TEXT_COLORS.primary,
73
78
  children,
74
- className
79
+ className,
80
+ ...props
75
81
  } = _ref6;
76
- return /*#__PURE__*/React.createElement("h5", {
82
+ return /*#__PURE__*/React.createElement("h5", _extends({}, props, {
77
83
  className: (0, _classify.default)(_typographyModule.default.subTitleExtraSmall, _typographyModule.default[color], className)
78
- }, children);
84
+ }), children);
79
85
  };
80
86
  exports.SubTitleExtraSmall = SubTitleExtraSmall;
81
87
  const ButtonTextMedium = _ref7 => {
82
88
  let {
83
89
  color = _typography.TEXT_COLORS.primary,
84
90
  children,
85
- className
91
+ className,
92
+ ...props
86
93
  } = _ref7;
87
- return /*#__PURE__*/React.createElement("span", {
94
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
88
95
  className: (0, _classify.default)(_typographyModule.default.buttonTextMedium, _typographyModule.default[color], className)
89
- }, children);
96
+ }), children);
90
97
  };
91
98
  exports.ButtonTextMedium = ButtonTextMedium;
92
99
  const ButtonTextSmall = _ref8 => {
93
100
  let {
94
101
  color = _typography.TEXT_COLORS.primary,
95
102
  children,
96
- className
103
+ className,
104
+ ...props
97
105
  } = _ref8;
98
- return /*#__PURE__*/React.createElement("span", {
106
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
99
107
  className: (0, _classify.default)(_typographyModule.default.buttonTextSmall, _typographyModule.default[color], className)
100
- }, children);
108
+ }), children);
101
109
  };
102
110
  exports.ButtonTextSmall = ButtonTextSmall;
103
111
  const FormInputMedium = _ref9 => {
104
112
  let {
105
113
  color = _typography.TEXT_COLORS.primary,
106
114
  children,
107
- className
115
+ className,
116
+ ...props
108
117
  } = _ref9;
109
- return /*#__PURE__*/React.createElement("p", {
118
+ return /*#__PURE__*/React.createElement("p", _extends({}, props, {
110
119
  className: (0, _classify.default)(_typographyModule.default.formInputMedium, _typographyModule.default[color], className)
111
- }, children);
120
+ }), children);
112
121
  };
113
122
  exports.FormInputMedium = FormInputMedium;
114
123
  const FormInputSmall = _ref10 => {
115
124
  let {
116
125
  color = _typography.TEXT_COLORS.primary,
117
126
  children,
118
- className
127
+ className,
128
+ ...props
119
129
  } = _ref10;
120
- return /*#__PURE__*/React.createElement("p", {
130
+ return /*#__PURE__*/React.createElement("p", _extends({}, props, {
121
131
  className: (0, _classify.default)(_typographyModule.default.formInputSmall, _typographyModule.default[color], className)
122
- }, children);
132
+ }), children);
123
133
  };
124
134
  exports.FormInputSmall = FormInputSmall;
125
135
  const BodyLarge = _ref11 => {
126
136
  let {
127
137
  color = _typography.TEXT_COLORS.primary,
128
138
  children,
129
- className
139
+ className,
140
+ ...props
130
141
  } = _ref11;
131
- return /*#__PURE__*/React.createElement("p", {
142
+ return /*#__PURE__*/React.createElement("p", _extends({}, props, {
132
143
  className: (0, _classify.default)(_typographyModule.default.bodyLarge, _typographyModule.default[color], className)
133
- }, children);
144
+ }), children);
134
145
  };
135
146
  exports.BodyLarge = BodyLarge;
136
147
  const BodyMedium = _ref12 => {
137
148
  let {
138
149
  color = _typography.TEXT_COLORS.primary,
139
150
  children,
140
- className
151
+ className,
152
+ ...props
141
153
  } = _ref12;
142
- return /*#__PURE__*/React.createElement("p", {
154
+ return /*#__PURE__*/React.createElement("p", _extends({}, props, {
143
155
  className: (0, _classify.default)(_typographyModule.default.bodyMedium, _typographyModule.default[color], className)
144
- }, children);
156
+ }), children);
145
157
  };
146
158
  exports.BodyMedium = BodyMedium;
147
159
  const BodySmall = _ref13 => {
148
160
  let {
149
161
  color = _typography.TEXT_COLORS.primary,
150
162
  children,
151
- className
163
+ className,
164
+ ...props
152
165
  } = _ref13;
153
- return /*#__PURE__*/React.createElement("p", {
166
+ return /*#__PURE__*/React.createElement("p", _extends({}, props, {
154
167
  className: (0, _classify.default)(_typographyModule.default.bodySmall, _typographyModule.default[color], className)
155
- }, children);
168
+ }), children);
156
169
  };
157
170
  exports.BodySmall = BodySmall;
158
171
  const FormLabelMedium = _ref14 => {
159
172
  let {
160
173
  color = _typography.TEXT_COLORS.primary,
161
174
  children,
162
- className
175
+ className,
176
+ ...props
163
177
  } = _ref14;
164
- return /*#__PURE__*/React.createElement("span", {
178
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
165
179
  className: (0, _classify.default)(_typographyModule.default.formLabelMedium, _typographyModule.default[color], className)
166
- }, children);
180
+ }), children);
167
181
  };
168
182
  exports.FormLabelMedium = FormLabelMedium;
169
183
  const FormLabelSmall = _ref15 => {
170
184
  let {
171
185
  color = _typography.TEXT_COLORS.primary,
172
186
  children,
173
- className
187
+ className,
188
+ ...props
174
189
  } = _ref15;
175
- return /*#__PURE__*/React.createElement("span", {
190
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
176
191
  className: (0, _classify.default)(_typographyModule.default.formLabelSmall, _typographyModule.default[color], className)
177
- }, children);
192
+ }), children);
178
193
  };
179
194
  exports.FormLabelSmall = FormLabelSmall;
@@ -13,14 +13,16 @@ export type TextProps = {
13
13
  color?: ColorTypes,
14
14
  children?: React.Node,
15
15
  className?: string,
16
+ ...
16
17
  };
17
18
 
18
19
  export const JumboMedium = ({
19
20
  color = TEXT_COLORS.primary,
20
21
  children,
21
22
  className,
23
+ ...props
22
24
  }: TextProps): React.Node => (
23
- <span className={classify(css.jumboMedium, css[color], className)}>
25
+ <span {...props} className={classify(css.jumboMedium, css[color], className)}>
24
26
  {children}
25
27
  </span>
26
28
  );
@@ -29,8 +31,9 @@ export const TitleMedium = ({
29
31
  color = TEXT_COLORS.primary,
30
32
  children,
31
33
  className,
34
+ ...props
32
35
  }: TextProps): React.Node => (
33
- <h1 className={classify(css.titleMedium, css[color], className)}>
36
+ <h1 {...props} className={classify(css.titleMedium, css[color], className)}>
34
37
  {children}
35
38
  </h1>
36
39
  );
@@ -39,8 +42,9 @@ export const SubTitleLarge = ({
39
42
  color = TEXT_COLORS.primary,
40
43
  children,
41
44
  className,
45
+ ...props
42
46
  }: TextProps): React.Node => (
43
- <h2 className={classify(css.subTitleLarge, css[color], className)}>
47
+ <h2 {...props} className={classify(css.subTitleLarge, css[color], className)}>
44
48
  {children}
45
49
  </h2>
46
50
  );
@@ -49,8 +53,12 @@ export const SubTitleMedium = ({
49
53
  color = TEXT_COLORS.primary,
50
54
  children,
51
55
  className,
56
+ ...props
52
57
  }: TextProps): React.Node => (
53
- <h3 className={classify(css.subTitleMedium, css[color], className)}>
58
+ <h3
59
+ {...props}
60
+ className={classify(css.subTitleMedium, css[color], className)}
61
+ >
54
62
  {children}
55
63
  </h3>
56
64
  );
@@ -59,8 +67,9 @@ export const SubTitleSmall = ({
59
67
  color = TEXT_COLORS.primary,
60
68
  children,
61
69
  className,
70
+ ...props
62
71
  }: TextProps): React.Node => (
63
- <h4 className={classify(css.subTitleSmall, css[color], className)}>
72
+ <h4 {...props} className={classify(css.subTitleSmall, css[color], className)}>
64
73
  {children}
65
74
  </h4>
66
75
  );
@@ -69,8 +78,12 @@ export const SubTitleExtraSmall = ({
69
78
  color = TEXT_COLORS.primary,
70
79
  children,
71
80
  className,
81
+ ...props
72
82
  }: TextProps): React.Node => (
73
- <h5 className={classify(css.subTitleExtraSmall, css[color], className)}>
83
+ <h5
84
+ {...props}
85
+ className={classify(css.subTitleExtraSmall, css[color], className)}
86
+ >
74
87
  {children}
75
88
  </h5>
76
89
  );
@@ -79,8 +92,12 @@ export const ButtonTextMedium = ({
79
92
  color = TEXT_COLORS.primary,
80
93
  children,
81
94
  className,
95
+ ...props
82
96
  }: TextProps): React.Node => (
83
- <span className={classify(css.buttonTextMedium, css[color], className)}>
97
+ <span
98
+ {...props}
99
+ className={classify(css.buttonTextMedium, css[color], className)}
100
+ >
84
101
  {children}
85
102
  </span>
86
103
  );
@@ -89,8 +106,12 @@ export const ButtonTextSmall = ({
89
106
  color = TEXT_COLORS.primary,
90
107
  children,
91
108
  className,
109
+ ...props
92
110
  }: TextProps): React.Node => (
93
- <span className={classify(css.buttonTextSmall, css[color], className)}>
111
+ <span
112
+ {...props}
113
+ className={classify(css.buttonTextSmall, css[color], className)}
114
+ >
94
115
  {children}
95
116
  </span>
96
117
  );
@@ -99,8 +120,12 @@ export const FormInputMedium = ({
99
120
  color = TEXT_COLORS.primary,
100
121
  children,
101
122
  className,
123
+ ...props
102
124
  }: TextProps): React.Node => (
103
- <p className={classify(css.formInputMedium, css[color], className)}>
125
+ <p
126
+ {...props}
127
+ className={classify(css.formInputMedium, css[color], className)}
128
+ >
104
129
  {children}
105
130
  </p>
106
131
  );
@@ -109,8 +134,9 @@ export const FormInputSmall = ({
109
134
  color = TEXT_COLORS.primary,
110
135
  children,
111
136
  className,
137
+ ...props
112
138
  }: TextProps): React.Node => (
113
- <p className={classify(css.formInputSmall, css[color], className)}>
139
+ <p {...props} className={classify(css.formInputSmall, css[color], className)}>
114
140
  {children}
115
141
  </p>
116
142
  );
@@ -119,32 +145,45 @@ export const BodyLarge = ({
119
145
  color = TEXT_COLORS.primary,
120
146
  children,
121
147
  className,
148
+ ...props
122
149
  }: TextProps): React.Node => (
123
- <p className={classify(css.bodyLarge, css[color], className)}>{children}</p>
150
+ <p {...props} className={classify(css.bodyLarge, css[color], className)}>
151
+ {children}
152
+ </p>
124
153
  );
125
154
 
126
155
  export const BodyMedium = ({
127
156
  color = TEXT_COLORS.primary,
128
157
  children,
129
158
  className,
159
+ ...props
130
160
  }: TextProps): React.Node => (
131
- <p className={classify(css.bodyMedium, css[color], className)}>{children}</p>
161
+ <p {...props} className={classify(css.bodyMedium, css[color], className)}>
162
+ {children}
163
+ </p>
132
164
  );
133
165
 
134
166
  export const BodySmall = ({
135
167
  color = TEXT_COLORS.primary,
136
168
  children,
137
169
  className,
170
+ ...props
138
171
  }: TextProps): React.Node => (
139
- <p className={classify(css.bodySmall, css[color], className)}>{children}</p>
172
+ <p {...props} className={classify(css.bodySmall, css[color], className)}>
173
+ {children}
174
+ </p>
140
175
  );
141
176
 
142
177
  export const FormLabelMedium = ({
143
178
  color = TEXT_COLORS.primary,
144
179
  children,
145
180
  className,
181
+ ...props
146
182
  }: TextProps): React.Node => (
147
- <span className={classify(css.formLabelMedium, css[color], className)}>
183
+ <span
184
+ {...props}
185
+ className={classify(css.formLabelMedium, css[color], className)}
186
+ >
148
187
  {children}
149
188
  </span>
150
189
  );
@@ -153,8 +192,12 @@ export const FormLabelSmall = ({
153
192
  color = TEXT_COLORS.primary,
154
193
  children,
155
194
  className,
195
+ ...props
156
196
  }: TextProps): React.Node => (
157
- <span className={classify(css.formLabelSmall, css[color], className)}>
197
+ <span
198
+ {...props}
199
+ className={classify(css.formLabelSmall, css[color], className)}
200
+ >
158
201
  {children}
159
202
  </span>
160
203
  );
@@ -136,9 +136,10 @@ const Toast = _ref5 => {
136
136
  context
137
137
  } = (0, _reactDomInteractions.useFloating)();
138
138
  const getComp = comp => {
139
- if (children instanceof Array) {
139
+ const childrenArray = React.Children.toArray(children);
140
+ if (childrenArray.length) {
140
141
  const nodes = [];
141
- for (const child of children) {
142
+ for (const child of childrenArray) {
142
143
  if (child?.type?.name === comp) {
143
144
  nodes.push(child);
144
145
  }
@@ -169,7 +170,9 @@ const Toast = _ref5 => {
169
170
  }, /*#__PURE__*/React.createElement(_Text.SubTitleSmall, {
170
171
  color: TOAST_TITLE_COLOR[semantic]
171
172
  }, getComp('ToastTitle')), /*#__PURE__*/React.createElement(_Text.BodyMedium, null, getComp('ToastBody'))), time && /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, null, time)), footerWithClose), /*#__PURE__*/React.createElement(_Icon.CloseIcon, {
172
- onClick: onClose
173
+ className: _ToastModule.default.closeIcon,
174
+ onClick: onClose,
175
+ ariaLabel: "Close Button"
173
176
  })));
174
177
  };
175
178
  exports.Toast = Toast;
@@ -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,11 @@ export const Toast = ({
203
204
  </div>
204
205
  {footerWithClose}
205
206
  </div>
206
- <CloseIcon onClick={onClose} />
207
+ <CloseIcon
208
+ className={css.closeIcon}
209
+ onClick={onClose}
210
+ ariaLabel="Close Button"
211
+ />
207
212
  </div>
208
213
  </FloatingFocusManager>
209
214
  );
@@ -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.2",
3
+ "version": "0.0.3-beta.0",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {