@strapi/design-system 1.16.0 → 1.17.0
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/Tabs/TabGroup.js +9 -3
- package/dist/Tabs/TabGroup.mjs +9 -3
- package/package.json +6 -6
package/dist/Tabs/TabGroup.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
const React = require('react');
|
|
7
7
|
const TabsContext = require('./TabsContext.js');
|
|
8
|
+
const useControllableState = require('../hooks/useControllableState.js');
|
|
8
9
|
const useId = require('../hooks/useId.js');
|
|
9
10
|
|
|
10
11
|
function _interopNamespace(e) {
|
|
@@ -27,13 +28,18 @@ function _interopNamespace(e) {
|
|
|
27
28
|
|
|
28
29
|
const React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
30
|
|
|
30
|
-
const TabGroup = React__namespace.forwardRef(({ id, initialSelectedTabIndex
|
|
31
|
+
const TabGroup = React__namespace.forwardRef(({ id, initialSelectedTabIndex, label, onTabChange, selectedTabIndex: selectedTabIndexProp, variant, ...props }, ref) => {
|
|
31
32
|
const tabsId = useId.useId(id);
|
|
32
|
-
const [selectedTabIndex, setSelectedTabIndex] =
|
|
33
|
+
const [selectedTabIndex = 0, setSelectedTabIndex] = useControllableState.useControllableState({
|
|
34
|
+
prop: selectedTabIndexProp,
|
|
35
|
+
defaultProp: initialSelectedTabIndex,
|
|
36
|
+
// @ts-expect-error
|
|
37
|
+
onChange: onTabChange,
|
|
38
|
+
});
|
|
33
39
|
React__namespace.useImperativeHandle(ref, () => ({
|
|
34
40
|
_handlers: { setSelectedTabIndex },
|
|
35
41
|
}));
|
|
36
|
-
const context = React__namespace.useMemo(() => ({ id: tabsId, selectedTabIndex, selectTabIndex: setSelectedTabIndex, label, variant, onTabChange }), [label, onTabChange, selectedTabIndex, tabsId, variant]);
|
|
42
|
+
const context = React__namespace.useMemo(() => ({ id: tabsId, selectedTabIndex, selectTabIndex: setSelectedTabIndex, label, variant, onTabChange }), [label, onTabChange, selectedTabIndex, tabsId, variant, setSelectedTabIndex]);
|
|
37
43
|
return (jsxRuntime.jsx(TabsContext.TabsContext.Provider, { value: context, children: jsxRuntime.jsx("div", { ...props }) }));
|
|
38
44
|
});
|
|
39
45
|
TabGroup.displayName = 'TabGroup';
|
package/dist/Tabs/TabGroup.mjs
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { TabsContext } from './TabsContext.mjs';
|
|
4
|
+
import { useControllableState } from '../hooks/useControllableState.mjs';
|
|
4
5
|
import { useId } from '../hooks/useId.mjs';
|
|
5
6
|
|
|
6
|
-
const TabGroup = React.forwardRef(({ id, initialSelectedTabIndex
|
|
7
|
+
const TabGroup = React.forwardRef(({ id, initialSelectedTabIndex, label, onTabChange, selectedTabIndex: selectedTabIndexProp, variant, ...props }, ref) => {
|
|
7
8
|
const tabsId = useId(id);
|
|
8
|
-
const [selectedTabIndex, setSelectedTabIndex] =
|
|
9
|
+
const [selectedTabIndex = 0, setSelectedTabIndex] = useControllableState({
|
|
10
|
+
prop: selectedTabIndexProp,
|
|
11
|
+
defaultProp: initialSelectedTabIndex,
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
onChange: onTabChange,
|
|
14
|
+
});
|
|
9
15
|
React.useImperativeHandle(ref, () => ({
|
|
10
16
|
_handlers: { setSelectedTabIndex },
|
|
11
17
|
}));
|
|
12
|
-
const context = React.useMemo(() => ({ id: tabsId, selectedTabIndex, selectTabIndex: setSelectedTabIndex, label, variant, onTabChange }), [label, onTabChange, selectedTabIndex, tabsId, variant]);
|
|
18
|
+
const context = React.useMemo(() => ({ id: tabsId, selectedTabIndex, selectTabIndex: setSelectedTabIndex, label, variant, onTabChange }), [label, onTabChange, selectedTabIndex, tabsId, variant, setSelectedTabIndex]);
|
|
13
19
|
return (jsx(TabsContext.Provider, { value: context, children: jsx("div", { ...props }) }));
|
|
14
20
|
});
|
|
15
21
|
TabGroup.displayName = 'TabGroup';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"@radix-ui/react-dismissable-layer": "^1.0.5",
|
|
34
34
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
|
35
35
|
"@radix-ui/react-focus-scope": "1.0.4",
|
|
36
|
-
"@strapi/ui-primitives": "^1.
|
|
37
|
-
"@uiw/react-codemirror": "^4.21.
|
|
38
|
-
"aria-hidden": "^1.2.
|
|
36
|
+
"@strapi/ui-primitives": "^1.17.0",
|
|
37
|
+
"@uiw/react-codemirror": "^4.21.25",
|
|
38
|
+
"aria-hidden": "^1.2.4",
|
|
39
39
|
"compute-scroll-into-view": "^3.1.0",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
|
-
"react-remove-scroll": "^2.5.
|
|
41
|
+
"react-remove-scroll": "^2.5.9"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@playwright/test": "1.42.1",
|
|
45
|
-
"@strapi/icons": "^1.
|
|
45
|
+
"@strapi/icons": "^1.17.0",
|
|
46
46
|
"@types/react-router-dom": "^5.3.3",
|
|
47
47
|
"@types/styled-components": "^5.1.26",
|
|
48
48
|
"axe-playwright": "^2.0.1",
|