@spaced-out/ui-design-system 0.1.37 → 0.1.38

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.38](https://github.com/spaced-out/ui-design-system/compare/v0.1.37...v0.1.38) (2023-07-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * focus manager with arrow key navigation enhancements ([#127](https://github.com/spaced-out/ui-design-system/issues/127)) ([ca183a0](https://github.com/spaced-out/ui-design-system/commit/ca183a04a6dc5c11cbe24267cf95471ef9f698e5))
11
+
5
12
  ### [0.1.37](https://github.com/spaced-out/ui-design-system/compare/v0.1.37-beta.1...v0.1.37) (2023-07-18)
6
13
 
7
14
 
@@ -43,6 +43,7 @@ const ButtonDropdown = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
43
43
  iconRightType = 'solid',
44
44
  isFluid,
45
45
  tooltip,
46
+ onClick,
46
47
  ...restButtonProps
47
48
  } = _ref;
48
49
  const menuBtnRef = React.useRef(null);
@@ -96,6 +97,7 @@ const ButtonDropdown = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
96
97
  size: size,
97
98
  ref: refs.setReference,
98
99
  onClick: e => {
100
+ onClick?.(e);
99
101
  e.stopPropagation();
100
102
  onOpen();
101
103
  },
@@ -76,6 +76,7 @@ export const ButtonDropdown: React$AbstractComponent<
76
76
  iconRightType = 'solid',
77
77
  isFluid,
78
78
  tooltip,
79
+ onClick,
79
80
  ...restButtonProps
80
81
  }: ButtonDropdownProps,
81
82
  forwardRef,
@@ -138,6 +139,7 @@ export const ButtonDropdown: React$AbstractComponent<
138
139
  size={size}
139
140
  ref={refs.setReference}
140
141
  onClick={(e) => {
142
+ onClick?.(e);
141
143
  e.stopPropagation();
142
144
  onOpen();
143
145
  }}
@@ -7,14 +7,24 @@ exports.SkipElementFromNavigation = exports.FocusManagerWithArrowKeyNavigation =
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _react2 = require("@floating-ui/react");
9
9
  var _classify = _interopRequireDefault(require("../../utils/classify"));
10
- var _makeClassNameComponent = require("../../utils/makeClassNameComponent");
11
10
  var _FocusManagerWithArrowKeyNavigationModule = _interopRequireDefault(require("./FocusManagerWithArrowKeyNavigation.module.css"));
12
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
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); }
14
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; }
15
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); }
16
15
  const SKIP_ELEMENT_DISPLAY_NAME = 'SkipElementFromNavigation';
17
- const SkipElementFromNavigation = (0, _makeClassNameComponent.makeClassNameComponent)(_FocusManagerWithArrowKeyNavigationModule.default.skipElementWrapper);
16
+ const SkipElementFromNavigation = /*#__PURE__*/React.forwardRef((_ref, ref) => {
17
+ let {
18
+ children,
19
+ className,
20
+ ...restProps
21
+ } = _ref;
22
+ return /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
23
+ className: className,
24
+ tabIndex: -1,
25
+ ref: ref
26
+ }), children);
27
+ });
18
28
  exports.SkipElementFromNavigation = SkipElementFromNavigation;
19
29
  SkipElementFromNavigation.displayName = SKIP_ELEMENT_DISPLAY_NAME;
20
30
  const FocusManagerWithArrowKeyNavigation = props => {
@@ -25,6 +35,8 @@ const FocusManagerWithArrowKeyNavigation = props => {
25
35
  orientation = 'vertical',
26
36
  modal = false,
27
37
  cols = 1,
38
+ focusItemOnOpen = 'auto',
39
+ loop = false,
28
40
  ...restFloatingFocusManagerProps
29
41
  } = props;
30
42
  const {
@@ -83,7 +95,9 @@ const FocusManagerWithArrowKeyNavigation = props => {
83
95
  cols,
84
96
  listRef,
85
97
  activeIndex,
86
- onNavigate: setActiveIndex
98
+ onNavigate: setActiveIndex,
99
+ focusItemOnOpen,
100
+ loop
87
101
  });
88
102
  const {
89
103
  getFloatingProps
@@ -13,8 +13,6 @@ import {
13
13
  } from '@floating-ui/react';
14
14
 
15
15
  import classify from '../../utils/classify';
16
- import type {ClassNameComponent} from '../../utils/makeClassNameComponent';
17
- import {makeClassNameComponent} from '../../utils/makeClassNameComponent';
18
16
  import type {FocusManagerProps} from '../FocusManager';
19
17
 
20
18
  import css from './FocusManagerWithArrowKeyNavigation.module.css';
@@ -22,19 +20,38 @@ import css from './FocusManagerWithArrowKeyNavigation.module.css';
22
20
 
23
21
  const SKIP_ELEMENT_DISPLAY_NAME = 'SkipElementFromNavigation';
24
22
 
25
- export const SkipElementFromNavigation: ClassNameComponent<'div'> =
26
- makeClassNameComponent(css.skipElementWrapper);
23
+ export type SkipElementFromNavigationProps = {
24
+ children: React.Node,
25
+ className?: string,
26
+ ...
27
+ };
28
+
29
+ export const SkipElementFromNavigation: React$AbstractComponent<
30
+ SkipElementFromNavigationProps,
31
+ HTMLDivElement,
32
+ > = React.forwardRef<SkipElementFromNavigationProps, HTMLDivElement>(
33
+ (
34
+ {children, className, ...restProps}: SkipElementFromNavigationProps,
35
+ ref,
36
+ ) => (
37
+ <div {...restProps} className={className} tabIndex={-1} ref={ref}>
38
+ {children}
39
+ </div>
40
+ ),
41
+ );
27
42
 
28
43
  SkipElementFromNavigation.displayName = SKIP_ELEMENT_DISPLAY_NAME;
29
44
 
30
- export type FocusManagerWithListNavigationProps = {
45
+ export type FocusManagerWithArrowKeyNavigationProps = {
31
46
  ...FocusManagerProps,
32
47
  cols?: number,
33
48
  orientation?: 'horizontal' | 'vertical',
49
+ focusItemOnOpen?: 'auto' | boolean,
50
+ loop?: boolean,
34
51
  };
35
52
 
36
53
  export const FocusManagerWithArrowKeyNavigation = (
37
- props: FocusManagerWithListNavigationProps,
54
+ props: FocusManagerWithArrowKeyNavigationProps,
38
55
  ): React.Node => {
39
56
  const {
40
57
  classNames,
@@ -43,6 +60,8 @@ export const FocusManagerWithArrowKeyNavigation = (
43
60
  orientation = 'vertical',
44
61
  modal = false,
45
62
  cols = 1,
63
+ focusItemOnOpen = 'auto',
64
+ loop = false,
46
65
  ...restFloatingFocusManagerProps
47
66
  } = props;
48
67
 
@@ -95,6 +114,8 @@ export const FocusManagerWithArrowKeyNavigation = (
95
114
  listRef,
96
115
  activeIndex,
97
116
  onNavigate: setActiveIndex,
117
+ focusItemOnOpen,
118
+ loop,
98
119
  });
99
120
  const {getFloatingProps} = useInteractions([listNavigation]);
100
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {