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

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,13 @@
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.14](https://github.com/spaced-out/ui-design-system/compare/v0.1.13...v0.1.14) (2023-04-17)
6
+
7
+
8
+ ### Features
9
+
10
+ * 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))
11
+
5
12
  ### [0.1.13](https://github.com/spaced-out/ui-design-system/compare/v0.1.12...v0.1.13) (2023-04-14)
6
13
 
7
14
 
@@ -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';
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.14",
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
  }