@decisiv/ui-components 2.0.1-alpha.162 → 2.0.1-alpha.163
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.
|
@@ -34,14 +34,20 @@ var Tab = (0, _react.forwardRef)(function (_ref, ref) {
|
|
|
34
34
|
disabled = _ref.disabled,
|
|
35
35
|
rest = _objectWithoutProperties(_ref, ["id", "children", "icon", "title", "onClick", "disabled"]);
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _useTabs = (0, _context.useTabs)(),
|
|
38
|
+
register = _useTabs.register,
|
|
39
|
+
activate = _useTabs.activate,
|
|
40
|
+
activeId = _useTabs.activeId,
|
|
41
|
+
onKeyDown = _useTabs.onKeyDown,
|
|
42
|
+
size = _useTabs.size;
|
|
43
|
+
|
|
38
44
|
var Icon = icon;
|
|
39
|
-
var isActive = id ===
|
|
45
|
+
var isActive = id === activeId;
|
|
40
46
|
var internalRef = (0, _react.useRef)(null);
|
|
41
47
|
var handleClick = (0, _react.useCallback)(function (e) {
|
|
42
|
-
!disabled &&
|
|
48
|
+
!disabled && activate(id);
|
|
43
49
|
onClick && onClick(e);
|
|
44
|
-
}, [id,
|
|
50
|
+
}, [id, activate, disabled, onClick]);
|
|
45
51
|
|
|
46
52
|
var assignRefs = function assignRefs(node) {
|
|
47
53
|
(0, _assignRef.default)(ref, node);
|
|
@@ -49,23 +55,23 @@ var Tab = (0, _react.forwardRef)(function (_ref, ref) {
|
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
(0, _react.useEffect)(function () {
|
|
52
|
-
var unregister =
|
|
58
|
+
var unregister = register(id, {
|
|
53
59
|
isDisabled: !!disabled,
|
|
54
60
|
content: children,
|
|
55
61
|
ref: internalRef
|
|
56
62
|
});
|
|
57
63
|
return unregister;
|
|
58
|
-
}, [id, disabled, children, internalRef,
|
|
64
|
+
}, [id, disabled, children, internalRef, register]);
|
|
59
65
|
return _react.default.createElement(_styles.TabContainer, _extends({}, rest, {
|
|
60
66
|
"aria-controls": "tab-panel-".concat(id),
|
|
61
67
|
"aria-selected": isActive,
|
|
62
68
|
disabled: !!disabled,
|
|
63
69
|
id: "tab-".concat(id),
|
|
64
70
|
onClick: handleClick,
|
|
65
|
-
onKeyDown:
|
|
71
|
+
onKeyDown: onKeyDown,
|
|
66
72
|
ref: assignRefs,
|
|
67
73
|
role: "tab",
|
|
68
|
-
size:
|
|
74
|
+
size: size || 'normal',
|
|
69
75
|
tabIndex: isActive ? 0 : -1,
|
|
70
76
|
type: "button"
|
|
71
77
|
}), Icon && _react.default.createElement(Icon, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decisiv/ui-components",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.163+3f12471",
|
|
4
4
|
"description": "Decisiv's design system React components",
|
|
5
5
|
"author": "Decisiv UI Development Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"private": false,
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "3f12471f57335fdd25a3860b1f1d6a3fa9eb8a33"
|
|
75
75
|
}
|