@spaced-out/ui-design-system 0.1.13 → 0.1.15

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,26 @@
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.1.15](https://github.com/spaced-out/ui-design-system/compare/v0.1.14...v0.1.15) (2023-04-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * tooltips now support custom components ([1096cf8](https://github.com/spaced-out/ui-design-system/commit/1096cf8efb96f1fb321e3a4e372aeafa114f9f51))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * export everything from dropdown ([b2bb628](https://github.com/spaced-out/ui-design-system/commit/b2bb6286362acccaca12f794711d2d12c895633b))
16
+ * fixed imports ([af88522](https://github.com/spaced-out/ui-design-system/commit/af88522d227895bbf67f81157ed5395dde76e75c))
17
+
18
+ ### [0.1.14](https://github.com/spaced-out/ui-design-system/compare/v0.1.13...v0.1.14) (2023-04-17)
19
+
20
+
21
+ ### Features
22
+
23
+ * focus manager component ([#102](https://github.com/spaced-out/ui-design-system/issues/102)) ([734c2a5](https://github.com/spaced-out/ui-design-system/commit/734c2a5315a9548bcbf9653b8bafd54af1d97b6a))
24
+
5
25
  ### [0.1.13](https://github.com/spaced-out/ui-design-system/compare/v0.1.12...v0.1.13) (2023-04-14)
6
26
 
7
27
 
@@ -3,16 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "Dropdown", {
7
- enumerable: true,
8
- get: function () {
9
- return _Dropdown.Dropdown;
10
- }
11
- });
12
- Object.defineProperty(exports, "DropdownProps", {
13
- enumerable: true,
14
- get: function () {
15
- return _Dropdown.DropdownProps;
16
- }
17
- });
18
- var _Dropdown = require("./Dropdown");
6
+ var _Dropdown = require("./Dropdown");
7
+ Object.keys(_Dropdown).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Dropdown[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Dropdown[key];
14
+ }
15
+ });
16
+ });
@@ -1,4 +1,3 @@
1
1
  // @flow strict
2
2
 
3
- export {Dropdown} from './Dropdown';
4
- export {DropdownProps} from './Dropdown';
3
+ export * from './Dropdown';
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FocusManager = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _reactDomInteractions = require("@floating-ui/react-dom-interactions");
9
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
10
+ var _FocusManagerModule = _interopRequireDefault(require("./FocusManager.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 FocusManager = props => {
16
+ const {
17
+ floating,
18
+ context
19
+ } = (0, _reactDomInteractions.useFloating)();
20
+ const {
21
+ classNames,
22
+ children,
23
+ initialFocus = -1,
24
+ ...restFloatingFocusManagerProps
25
+ } = props;
26
+ return /*#__PURE__*/React.createElement(_reactDomInteractions.FloatingFocusManager, _extends({
27
+ context: context,
28
+ initialFocus: initialFocus
29
+ }, restFloatingFocusManagerProps), /*#__PURE__*/React.createElement("div", {
30
+ ref: floating,
31
+ "data-testid": "FocusManager",
32
+ className: (0, _classify.default)(_FocusManagerModule.default.wrapper, classNames?.wrapper)
33
+ }, children));
34
+ };
35
+ exports.FocusManager = FocusManager;
@@ -0,0 +1,50 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+ import {
5
+ // $FlowFixMe[untyped-import]
6
+ FloatingFocusManager,
7
+ // $FlowFixMe[untyped-import]
8
+ useFloating,
9
+ } from '@floating-ui/react-dom-interactions';
10
+
11
+ import classify from '../../utils/classify';
12
+
13
+ import css from './FocusManager.module.css';
14
+
15
+
16
+ type ClassNames = $ReadOnly<{wrapper?: string}>;
17
+
18
+ export type FocusManagerProps = {
19
+ classNames?: ClassNames,
20
+ children?: React.Node,
21
+ initialFocus?: number,
22
+ returnFocus?: boolean,
23
+ guards?: boolean,
24
+ };
25
+
26
+ export const FocusManager = (props: FocusManagerProps): React.Node => {
27
+ const {floating, context} = useFloating();
28
+ const {
29
+ classNames,
30
+ children,
31
+ initialFocus = -1,
32
+ ...restFloatingFocusManagerProps
33
+ } = props;
34
+
35
+ return (
36
+ <FloatingFocusManager
37
+ context={context}
38
+ initialFocus={initialFocus}
39
+ {...restFloatingFocusManagerProps}
40
+ >
41
+ <div
42
+ ref={floating}
43
+ data-testid="FocusManager"
44
+ className={classify(css.wrapper, classNames?.wrapper)}
45
+ >
46
+ {children}
47
+ </div>
48
+ </FloatingFocusManager>
49
+ );
50
+ };
@@ -0,0 +1,3 @@
1
+ .wrapper {
2
+ display: flex;
3
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _FocusManager = require("./FocusManager");
7
+ Object.keys(_FocusManager).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _FocusManager[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _FocusManager[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './FocusManager';
@@ -13,7 +13,6 @@ var _space = require("../../styles/variables/_space");
13
13
  var _classify = require("../../utils/classify");
14
14
  var _mergeRefs = require("../../utils/merge-refs");
15
15
  var _string = require("../../utils/string");
16
- var _Text = require("../Text");
17
16
  var _Truncate = require("../Truncate");
18
17
  var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));
19
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -87,12 +86,14 @@ const Tooltip = _ref => {
87
86
  }
88
87
  }, getFloatingProps()), !!title && /*#__PURE__*/React.createElement(_Truncate.Truncate, {
89
88
  line: titleMaxLines
90
- }, /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
91
- color: "inversePrimary"
89
+ }, /*#__PURE__*/React.createElement("div", {
90
+ className: (0, _classify.classify)(_TooltipModule.default.title, classNames?.title)
92
91
  }, title)), !!body && /*#__PURE__*/React.createElement(_Truncate.Truncate, {
93
92
  line: bodyMaxLines
94
- }, /*#__PURE__*/React.createElement(_Text.BodyMedium, {
95
- color: !title ? 'inversePrimary' : 'inverseSecondary'
93
+ }, /*#__PURE__*/React.createElement("div", {
94
+ className: (0, _classify.classify)(_TooltipModule.default.body, {
95
+ [_TooltipModule.default.hasTitle]: !!title
96
+ }, classNames?.body)
96
97
  }, body))), bodyRef.current));
97
98
  };
98
99
  exports.Tooltip = Tooltip;
@@ -32,13 +32,12 @@ import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
32
32
  import {classify} from '../../utils/classify';
33
33
  import {mergeRefs} from '../../utils/merge-refs';
34
34
  import {capitalize} from '../../utils/string';
35
- import {BodyMedium, SubTitleExtraSmall} from '../Text';
36
35
  import {Truncate} from '../Truncate';
37
36
 
38
37
  import css from './Tooltip.module.css';
39
38
 
40
39
 
41
- type ClassNames = $ReadOnly<{tooltip?: string}>;
40
+ type ClassNames = $ReadOnly<{tooltip?: string, title?: string, body?: string}>;
42
41
 
43
42
  export const DELAY_MOTION_DURATION_TYPES = Object.freeze({
44
43
  none: 'none',
@@ -147,19 +146,25 @@ export const Tooltip = ({
147
146
  >
148
147
  {!!title && (
149
148
  <Truncate line={titleMaxLines}>
150
- <SubTitleExtraSmall color="inversePrimary">
149
+ <div className={classify(css.title, classNames?.title)}>
151
150
  {title}
152
- </SubTitleExtraSmall>
151
+ </div>
153
152
  </Truncate>
154
153
  )}
155
154
 
156
155
  {!!body && (
157
156
  <Truncate line={bodyMaxLines}>
158
- <BodyMedium
159
- color={!title ? 'inversePrimary' : 'inverseSecondary'}
157
+ <div
158
+ className={classify(
159
+ css.body,
160
+ {
161
+ [css.hasTitle]: !!title,
162
+ },
163
+ classNames?.body,
164
+ )}
160
165
  >
161
166
  {body}
162
- </BodyMedium>
167
+ </div>
163
168
  </Truncate>
164
169
  )}
165
170
  </div>,
@@ -1,4 +1,4 @@
1
- @value (colorTooltipFill) from '../../styles/variables/_color.css';
1
+ @value (colorTooltipFill, colorTextInversePrimary, colorTextInverseSecondary) from '../../styles/variables/_color.css';
2
2
  @value (size300) from '../../styles/variables/_size.css';
3
3
  @value (spaceXSmall, spaceSmall, spaceXXSmall) from '../../styles/variables/_space.css';
4
4
  @value (borderRadiusSmall) from '../../styles/variables/_border.css';
@@ -17,3 +17,17 @@
17
17
  word-wrap: break-word;
18
18
  z-index: var(--tooltip-elevation);
19
19
  }
20
+
21
+ .title {
22
+ composes: subTitleExtraSmall from '../../styles/typography.module.css';
23
+ color: colorTextInversePrimary;
24
+ }
25
+
26
+ .body {
27
+ composes: bodyMedium from '../../styles/typography.module.css';
28
+ color: colorTextInversePrimary;
29
+ }
30
+
31
+ .hasTitle {
32
+ color: colorTextInverseSecondary;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {
@@ -121,6 +121,7 @@
121
121
  }
122
122
  },
123
123
  "volta": {
124
- "node": "16.16.0"
124
+ "node": "16.16.0",
125
+ "yarn": "1.22.19"
125
126
  }
126
127
  }