@clayui/tabs 3.156.0 → 3.158.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/README.md +4 -4
- package/lib/Content.d.ts +2 -2
- package/lib/Item.d.ts +2 -2
- package/lib/List.d.ts +2 -2
- package/lib/TabPane.d.ts +2 -2
- package/lib/cjs/Content.js +64 -39
- package/lib/cjs/Item.js +68 -36
- package/lib/cjs/List.js +90 -74
- package/lib/cjs/TabPane.js +77 -46
- package/lib/cjs/index.js +80 -60
- package/lib/esm/Content.js +36 -36
- package/lib/esm/Item.js +40 -33
- package/lib/esm/List.js +58 -65
- package/lib/esm/TabPane.js +49 -43
- package/lib/esm/index.js +43 -48
- package/lib/index.d.ts +2 -2
- package/package.json +31 -32
package/lib/esm/index.js
CHANGED
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
displayType,
|
|
21
|
-
fade = false,
|
|
22
|
-
justified,
|
|
23
|
-
modern = false,
|
|
24
|
-
onActiveChange,
|
|
25
|
-
...otherProps
|
|
26
|
-
} = _ref;
|
|
1
|
+
import { useControlledState, useId } from "@clayui/shared";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Content from "./Content";
|
|
4
|
+
import Item from "./Item";
|
|
5
|
+
import { List } from "./List";
|
|
6
|
+
import TabPane from "./TabPane";
|
|
7
|
+
function Tabs({
|
|
8
|
+
activation = "manual",
|
|
9
|
+
active: externalActive,
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
defaultActive = 0,
|
|
13
|
+
displayType,
|
|
14
|
+
fade = false,
|
|
15
|
+
justified,
|
|
16
|
+
modern = false,
|
|
17
|
+
onActiveChange,
|
|
18
|
+
...otherProps
|
|
19
|
+
}) {
|
|
27
20
|
const [active, setActive, isUncontrolled] = useControlledState({
|
|
28
|
-
defaultName:
|
|
21
|
+
defaultName: "defaultActive",
|
|
29
22
|
defaultValue: defaultActive,
|
|
30
|
-
handleName:
|
|
31
|
-
name:
|
|
23
|
+
handleName: "onActiveChange",
|
|
24
|
+
name: "active",
|
|
32
25
|
onChange: onActiveChange,
|
|
33
26
|
value: externalActive
|
|
34
27
|
});
|
|
35
28
|
const [left, right] = React.Children.toArray(children);
|
|
36
29
|
const tabsId = useId();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (left?.type?.displayName === 'ClayTabsList') {
|
|
40
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(left, {
|
|
30
|
+
if (left?.type?.displayName === "ClayTabsList") {
|
|
31
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, React.cloneElement(left, {
|
|
41
32
|
activation,
|
|
42
33
|
active,
|
|
43
34
|
displayType,
|
|
@@ -46,30 +37,34 @@ function Tabs(_ref) {
|
|
|
46
37
|
onActiveChange: setActive,
|
|
47
38
|
shouldUseActive: isUncontrolled,
|
|
48
39
|
tabsId
|
|
49
|
-
}),
|
|
40
|
+
}), React.isValidElement(right) && React.cloneElement(right, {
|
|
50
41
|
active,
|
|
51
42
|
fade,
|
|
52
43
|
tabsId
|
|
53
44
|
}));
|
|
54
45
|
}
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
return /* @__PURE__ */ React.createElement(
|
|
47
|
+
List,
|
|
48
|
+
{
|
|
49
|
+
...otherProps,
|
|
50
|
+
activation,
|
|
51
|
+
active,
|
|
52
|
+
className,
|
|
53
|
+
displayType,
|
|
54
|
+
justified,
|
|
55
|
+
modern,
|
|
56
|
+
onActiveChange: setActive
|
|
57
|
+
},
|
|
58
|
+
children
|
|
59
|
+
);
|
|
64
60
|
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated since v3.78.2 - Use new composition with Tabs.List and Tabs.Panels.
|
|
68
|
-
*/
|
|
69
61
|
Tabs.Content = Content;
|
|
70
62
|
Tabs.Panels = Content;
|
|
71
63
|
Tabs.Item = Item;
|
|
72
64
|
Tabs.List = List;
|
|
73
65
|
Tabs.TabPane = TabPane;
|
|
74
66
|
Tabs.TabPanel = TabPane;
|
|
75
|
-
|
|
67
|
+
var src_default = Tabs;
|
|
68
|
+
export {
|
|
69
|
+
src_default as default
|
|
70
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SPDX-FileCopyrightText:
|
|
3
|
-
* SPDX-License-Identifier:
|
|
2
|
+
* SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com
|
|
3
|
+
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
|
|
4
4
|
*/
|
|
5
5
|
import { InternalDispatch } from '@clayui/shared';
|
|
6
6
|
import React from 'react';
|
package/package.json
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"module": "lib/esm/index.js",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./lib/index.d.ts",
|
|
12
|
-
"import": "./lib/esm/index.js",
|
|
13
|
-
"require": "./lib/cjs/index.js"
|
|
14
|
-
}
|
|
2
|
+
"browserslist": [
|
|
3
|
+
"extends browserslist-config-clay"
|
|
4
|
+
],
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@clayui/shared": "^3.158.0",
|
|
7
|
+
"classnames": "2.3.1"
|
|
15
8
|
},
|
|
16
|
-
"
|
|
17
|
-
"ts:main": "src/index.tsx",
|
|
9
|
+
"description": "ClayTabs component",
|
|
18
10
|
"files": [
|
|
19
11
|
"lib"
|
|
20
12
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "yarn build:cjs && yarn build:esm",
|
|
23
|
-
"build:cjs": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib/cjs --extensions .ts,.tsx",
|
|
24
|
-
"build:esm": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib/esm --extensions .ts,.tsx --env-name esm",
|
|
25
|
-
"buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
|
|
26
|
-
"format": "prettier --write \"**/*.{js,ts,tsx,md,mdx,json,scss}\"",
|
|
27
|
-
"test": "jest --config ../../jest.config.js"
|
|
28
|
-
},
|
|
29
13
|
"keywords": [
|
|
30
14
|
"clay",
|
|
31
15
|
"react"
|
|
32
16
|
],
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
17
|
+
"license": "BSD-3-Clause",
|
|
18
|
+
"main": "lib/cjs/index.js",
|
|
19
|
+
"name": "@clayui/tabs",
|
|
37
20
|
"peerDependencies": {
|
|
38
|
-
"@clayui/css": "3.
|
|
21
|
+
"@clayui/css": "^3.158.0",
|
|
39
22
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
40
23
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
41
24
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
"repository": "https://github.com/liferay/clay",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "yarn build:cjs && yarn build:esm",
|
|
28
|
+
"build:cjs": "cross-env NODE_ENV=production node ../build-package-esbuild.js --format=cjs --outdir=lib/cjs",
|
|
29
|
+
"build:esm": "cross-env NODE_ENV=production node ../build-package-esbuild.js --format=esm --outdir=lib/esm",
|
|
30
|
+
"buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
|
|
31
|
+
"format": "prettier --write \"**/*.{js,ts,tsx,md,mdx,json,scss}\"",
|
|
32
|
+
"test": "jest --config ../../jest.config.js"
|
|
33
|
+
},
|
|
34
|
+
"version": "3.158.0",
|
|
35
|
+
"module": "lib/esm/index.js",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./lib/index.d.ts",
|
|
39
|
+
"import": "./lib/esm/index.js",
|
|
40
|
+
"require": "./lib/cjs/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"types": "lib/index.d.ts",
|
|
44
|
+
"ts:main": "src/index.tsx"
|
|
46
45
|
}
|