@nulogy/components 6.7.0 → 6.7.1
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/dist/main.js +15 -4
- package/dist/main.module.js +15 -4
- package/dist/src/utils/ts/FocusManager.d.ts +1 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -27514,9 +27514,10 @@
|
|
|
27514
27514
|
var FocusManager = function FocusManager(_ref) {
|
|
27515
27515
|
var children = _ref.children,
|
|
27516
27516
|
_ref$refs = _ref.refs,
|
|
27517
|
-
refs = _ref$refs === void 0 ? undefined : _ref$refs
|
|
27517
|
+
refs = _ref$refs === void 0 ? undefined : _ref$refs,
|
|
27518
|
+
defaultFocusedIndex = _ref.defaultFocusedIndex;
|
|
27518
27519
|
|
|
27519
|
-
var _useState = React.useState(0),
|
|
27520
|
+
var _useState = React.useState(defaultFocusedIndex !== null && defaultFocusedIndex !== void 0 ? defaultFocusedIndex : 0),
|
|
27520
27521
|
focusedIndex = _useState[0],
|
|
27521
27522
|
setFocusedIndex = _useState[1];
|
|
27522
27523
|
|
|
@@ -27987,7 +27988,8 @@
|
|
|
27987
27988
|
return /*#__PURE__*/React__default['default'].createElement(Box, {
|
|
27988
27989
|
position: "relative"
|
|
27989
27990
|
}, /*#__PURE__*/React__default['default'].createElement(FocusManager, {
|
|
27990
|
-
refs: this.tabRefs
|
|
27991
|
+
refs: this.tabRefs,
|
|
27992
|
+
defaultFocusedIndex: this.getSelectedIndex()
|
|
27991
27993
|
}, function (_ref2) {
|
|
27992
27994
|
var focusedIndex = _ref2.focusedIndex,
|
|
27993
27995
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -28036,6 +28038,14 @@
|
|
|
28036
28038
|
return value === selected;
|
|
28037
28039
|
};
|
|
28038
28040
|
|
|
28041
|
+
var getSelectedIndex = function getSelectedIndex() {
|
|
28042
|
+
return React__default['default'].Children.toArray(rest.children).findIndex(function (child) {
|
|
28043
|
+
var _a, _b;
|
|
28044
|
+
|
|
28045
|
+
return ((_b = (_a = child) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.value) === selected;
|
|
28046
|
+
});
|
|
28047
|
+
};
|
|
28048
|
+
|
|
28039
28049
|
var options = function options(focusedIndex, setFocusedIndex, handleArrowNavigation) {
|
|
28040
28050
|
return React__default['default'].Children.map(rest.children, function (child, index) {
|
|
28041
28051
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
@@ -28063,7 +28073,8 @@
|
|
|
28063
28073
|
bg: "whiteGrey",
|
|
28064
28074
|
borderRadius: "20px"
|
|
28065
28075
|
}, rest), /*#__PURE__*/React__default['default'].createElement(FocusManager, {
|
|
28066
|
-
refs: optionRefs
|
|
28076
|
+
refs: optionRefs,
|
|
28077
|
+
defaultFocusedIndex: getSelectedIndex()
|
|
28067
28078
|
}, function (_ref2) {
|
|
28068
28079
|
var focusedIndex = _ref2.focusedIndex,
|
|
28069
28080
|
setFocusedIndex = _ref2.setFocusedIndex,
|
package/dist/main.module.js
CHANGED
|
@@ -27488,9 +27488,10 @@ Tab.defaultProps = {
|
|
|
27488
27488
|
var FocusManager = function FocusManager(_ref) {
|
|
27489
27489
|
var children = _ref.children,
|
|
27490
27490
|
_ref$refs = _ref.refs,
|
|
27491
|
-
refs = _ref$refs === void 0 ? undefined : _ref$refs
|
|
27491
|
+
refs = _ref$refs === void 0 ? undefined : _ref$refs,
|
|
27492
|
+
defaultFocusedIndex = _ref.defaultFocusedIndex;
|
|
27492
27493
|
|
|
27493
|
-
var _useState = useState(0),
|
|
27494
|
+
var _useState = useState(defaultFocusedIndex !== null && defaultFocusedIndex !== void 0 ? defaultFocusedIndex : 0),
|
|
27494
27495
|
focusedIndex = _useState[0],
|
|
27495
27496
|
setFocusedIndex = _useState[1];
|
|
27496
27497
|
|
|
@@ -27961,7 +27962,8 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
27961
27962
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
27962
27963
|
position: "relative"
|
|
27963
27964
|
}, /*#__PURE__*/React__default.createElement(FocusManager, {
|
|
27964
|
-
refs: this.tabRefs
|
|
27965
|
+
refs: this.tabRefs,
|
|
27966
|
+
defaultFocusedIndex: this.getSelectedIndex()
|
|
27965
27967
|
}, function (_ref2) {
|
|
27966
27968
|
var focusedIndex = _ref2.focusedIndex,
|
|
27967
27969
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -28010,6 +28012,14 @@ var Switcher = function Switcher(_a) {
|
|
|
28010
28012
|
return value === selected;
|
|
28011
28013
|
};
|
|
28012
28014
|
|
|
28015
|
+
var getSelectedIndex = function getSelectedIndex() {
|
|
28016
|
+
return React__default.Children.toArray(rest.children).findIndex(function (child) {
|
|
28017
|
+
var _a, _b;
|
|
28018
|
+
|
|
28019
|
+
return ((_b = (_a = child) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.value) === selected;
|
|
28020
|
+
});
|
|
28021
|
+
};
|
|
28022
|
+
|
|
28013
28023
|
var options = function options(focusedIndex, setFocusedIndex, handleArrowNavigation) {
|
|
28014
28024
|
return React__default.Children.map(rest.children, function (child, index) {
|
|
28015
28025
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
@@ -28037,7 +28047,8 @@ var Switcher = function Switcher(_a) {
|
|
|
28037
28047
|
bg: "whiteGrey",
|
|
28038
28048
|
borderRadius: "20px"
|
|
28039
28049
|
}, rest), /*#__PURE__*/React__default.createElement(FocusManager, {
|
|
28040
|
-
refs: optionRefs
|
|
28050
|
+
refs: optionRefs,
|
|
28051
|
+
defaultFocusedIndex: getSelectedIndex()
|
|
28041
28052
|
}, function (_ref2) {
|
|
28042
28053
|
var focusedIndex = _ref2.focusedIndex,
|
|
28043
28054
|
setFocusedIndex = _ref2.setFocusedIndex,
|
|
@@ -10,6 +10,7 @@ declare type ChildrenHandlers = {
|
|
|
10
10
|
};
|
|
11
11
|
declare type FocusManagerProps = {
|
|
12
12
|
refs?: Array<Reference>;
|
|
13
|
+
defaultFocusedIndex: number | null;
|
|
13
14
|
children: (handlers: ChildrenHandlers) => ReactNode;
|
|
14
15
|
};
|
|
15
16
|
declare const FocusManager: React.FC<FocusManagerProps>;
|