@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/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Tabs organize similar content together into individual sections in the same page.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
5
|
+
- [Documentation](https://clayui.com/docs/components/tabs.html)
|
|
6
|
+
- [Changelog](./CHANGELOG.md)
|
|
7
|
+
- [Breaking change schedule](./BREAKING.md)
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -16,4 +16,4 @@ yarn add @clayui/tabs
|
|
|
16
16
|
|
|
17
17
|
## Contribute
|
|
18
18
|
|
|
19
|
-
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.
|
|
19
|
+
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.
|
package/lib/Content.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 React from 'react';
|
|
6
6
|
export interface IProps extends React.HTMLAttributes<HTMLDivElement> {
|
package/lib/Item.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 React from 'react';
|
|
6
6
|
export interface IProps extends Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> {
|
package/lib/List.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/lib/TabPane.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 React from 'react';
|
|
6
6
|
export interface ITabPaneProps extends React.HTMLAttributes<HTMLDivElement> {
|
package/lib/cjs/Content.js
CHANGED
|
@@ -1,42 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Content_exports = {};
|
|
30
|
+
__export(Content_exports, {
|
|
31
|
+
default: () => Content_default
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
}));
|
|
33
|
+
module.exports = __toCommonJS(Content_exports);
|
|
34
|
+
var import_classnames = __toESM(require("classnames"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
const Content = import_react.default.forwardRef(function Content2({
|
|
37
|
+
active,
|
|
38
|
+
activeIndex = 0,
|
|
39
|
+
children,
|
|
40
|
+
className,
|
|
41
|
+
fade = false,
|
|
42
|
+
tabsId,
|
|
43
|
+
...otherProps
|
|
44
|
+
}, ref) {
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: (0, import_classnames.default)("tab-content", className),
|
|
49
|
+
...otherProps,
|
|
50
|
+
ref
|
|
51
|
+
},
|
|
52
|
+
import_react.default.Children.map(children, (child, index) => {
|
|
53
|
+
if (!import_react.default.isValidElement(child)) {
|
|
54
|
+
return child;
|
|
55
|
+
}
|
|
56
|
+
return import_react.default.cloneElement(child, {
|
|
57
|
+
...child.props,
|
|
58
|
+
"active": typeof active === "number" ? active === index : activeIndex === index,
|
|
59
|
+
"aria-labelledby": tabsId ? `${tabsId}-tab-${index}` : child.props["aria-labelledby"],
|
|
60
|
+
fade,
|
|
61
|
+
"id": tabsId ? `${tabsId}-tabpanel-${index}` : child.props.id,
|
|
62
|
+
"key": index
|
|
63
|
+
});
|
|
64
|
+
})
|
|
65
|
+
);
|
|
41
66
|
});
|
|
42
|
-
var
|
|
67
|
+
var Content_default = Content;
|
package/lib/cjs/Item.js
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Item_exports = {};
|
|
30
|
+
__export(Item_exports, {
|
|
31
|
+
default: () => Item_default
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
13
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
|
-
*/
|
|
15
|
-
const Item = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
16
|
-
let {
|
|
33
|
+
module.exports = __toCommonJS(Item_exports);
|
|
34
|
+
var import_shared = require("@clayui/shared");
|
|
35
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
const Item = import_react.default.forwardRef(
|
|
38
|
+
({
|
|
17
39
|
active = false,
|
|
18
40
|
children,
|
|
19
41
|
className,
|
|
@@ -22,25 +44,35 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
22
44
|
innerProps = {},
|
|
23
45
|
onClick,
|
|
24
46
|
...otherProps
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
}, ref) => /* @__PURE__ */ import_react.default.createElement(
|
|
48
|
+
"li",
|
|
49
|
+
{
|
|
50
|
+
...otherProps,
|
|
51
|
+
className: (0, import_classnames.default)("nav-item", className),
|
|
52
|
+
role: "none"
|
|
53
|
+
},
|
|
54
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
55
|
+
import_shared.LinkOrButton,
|
|
56
|
+
{
|
|
57
|
+
...innerProps,
|
|
58
|
+
"aria-selected": active,
|
|
59
|
+
buttonDisplayType: "unstyled",
|
|
60
|
+
buttonType: "button",
|
|
61
|
+
className: (0, import_classnames.default)("nav-link", {
|
|
62
|
+
active,
|
|
63
|
+
disabled
|
|
64
|
+
}),
|
|
65
|
+
"data-testid": "tabItem",
|
|
66
|
+
disabled,
|
|
67
|
+
href,
|
|
68
|
+
onClick,
|
|
69
|
+
ref,
|
|
70
|
+
role: "tab",
|
|
71
|
+
tabIndex: !active ? -1 : 0
|
|
72
|
+
},
|
|
73
|
+
children
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
Item.displayName = "ClayTabsItem";
|
|
78
|
+
var Item_default = Item;
|
package/lib/cjs/List.js
CHANGED
|
@@ -1,91 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var List_exports = {};
|
|
30
|
+
__export(List_exports, {
|
|
31
|
+
List: () => List
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
modern: __,
|
|
26
|
-
onActiveChange,
|
|
27
|
-
shouldUseActive = false,
|
|
28
|
-
tabsId,
|
|
29
|
-
...otherProps
|
|
30
|
-
} = _ref;
|
|
31
|
-
const tabsRef = (0, _react.useRef)(null);
|
|
32
|
-
const {
|
|
33
|
-
navigationProps
|
|
34
|
-
} = (0, _shared.useNavigation)({
|
|
33
|
+
module.exports = __toCommonJS(List_exports);
|
|
34
|
+
var import_shared = require("@clayui/shared");
|
|
35
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
const List = import_react.default.forwardRef(function List2({
|
|
38
|
+
activation,
|
|
39
|
+
active,
|
|
40
|
+
children,
|
|
41
|
+
className,
|
|
42
|
+
displayType = null,
|
|
43
|
+
justified,
|
|
44
|
+
modern: __,
|
|
45
|
+
onActiveChange,
|
|
46
|
+
shouldUseActive = false,
|
|
47
|
+
tabsId,
|
|
48
|
+
...otherProps
|
|
49
|
+
}, ref) {
|
|
50
|
+
const tabsRef = (0, import_react.useRef)(null);
|
|
51
|
+
const { navigationProps } = (0, import_shared.useNavigation)({
|
|
35
52
|
activation,
|
|
36
53
|
containerRef: tabsRef,
|
|
37
|
-
orientation:
|
|
54
|
+
orientation: "horizontal"
|
|
38
55
|
});
|
|
39
|
-
(0,
|
|
40
|
-
(0,
|
|
41
|
-
// Internal API to maintain compatibility with the old Tabs pattern and to
|
|
42
|
-
// only update the initial state when the component is in
|
|
43
|
-
// uncontrolled mode.
|
|
56
|
+
(0, import_react.useImperativeHandle)(ref, () => tabsRef.current, [tabsRef]);
|
|
57
|
+
(0, import_react.useEffect)(() => {
|
|
44
58
|
if (!shouldUseActive) {
|
|
45
59
|
return;
|
|
46
60
|
}
|
|
47
|
-
const childrenArray =
|
|
48
|
-
|
|
49
|
-
// The `active` API in the new pattern has uncontrolled behavior, working
|
|
50
|
-
// just like defaultActive as in the prop declared in the root component.
|
|
61
|
+
const childrenArray = import_react.default.Children.toArray(children);
|
|
51
62
|
for (let index = 0; index < childrenArray.length; index++) {
|
|
52
63
|
const child = childrenArray[index];
|
|
53
|
-
if (
|
|
64
|
+
if (import_react.default.isValidElement(child) && child.props.active) {
|
|
54
65
|
onActiveChange(index);
|
|
55
66
|
break;
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
}, []);
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
...(child.props.innerProps ?? {})
|
|
77
|
-
},
|
|
78
|
-
onClick: event => {
|
|
79
|
-
const {
|
|
80
|
-
onClick
|
|
81
|
-
} = child.props;
|
|
82
|
-
if (onClick) {
|
|
83
|
-
onClick(event);
|
|
84
|
-
} else {
|
|
85
|
-
onActiveChange(index);
|
|
86
|
-
}
|
|
70
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
71
|
+
"ul",
|
|
72
|
+
{
|
|
73
|
+
...otherProps,
|
|
74
|
+
...navigationProps,
|
|
75
|
+
className: (0, import_classnames.default)(
|
|
76
|
+
"nav nav-tabs",
|
|
77
|
+
{ "nav-justified": justified },
|
|
78
|
+
{ [`nav-tabs-${displayType}`]: displayType === "light" },
|
|
79
|
+
className
|
|
80
|
+
),
|
|
81
|
+
ref: tabsRef,
|
|
82
|
+
role: "tablist"
|
|
83
|
+
},
|
|
84
|
+
import_react.default.Children.map(children, (child, index) => {
|
|
85
|
+
if (!import_react.default.isValidElement(child)) {
|
|
86
|
+
return child;
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
return import_react.default.cloneElement(child, {
|
|
89
|
+
active: !shouldUseActive && child.props.active !== void 0 ? child.props.active : active === index,
|
|
90
|
+
innerProps: {
|
|
91
|
+
"aria-controls": tabsId && `${tabsId}-tabpanel-${index}`,
|
|
92
|
+
"id": tabsId && `${tabsId}-tab-${index}`,
|
|
93
|
+
...child.props.innerProps ?? {}
|
|
94
|
+
},
|
|
95
|
+
onClick: (event) => {
|
|
96
|
+
const { onClick } = child.props;
|
|
97
|
+
if (onClick) {
|
|
98
|
+
onClick(event);
|
|
99
|
+
} else {
|
|
100
|
+
onActiveChange(index);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
})
|
|
105
|
+
);
|
|
90
106
|
});
|
|
91
|
-
List.displayName =
|
|
107
|
+
List.displayName = "ClayTabsList";
|
package/lib/cjs/TabPane.js
CHANGED
|
@@ -1,57 +1,88 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var TabPane_exports = {};
|
|
30
|
+
__export(TabPane_exports, {
|
|
31
|
+
default: () => TabPane_default
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /**
|
|
11
|
-
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
12
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/
|
|
14
|
-
const delay = function (fn) {
|
|
15
|
-
let val = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 150;
|
|
33
|
+
module.exports = __toCommonJS(TabPane_exports);
|
|
34
|
+
var import_classnames = __toESM(require("classnames"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
function delay(fn, val = 150) {
|
|
16
37
|
return setTimeout(() => {
|
|
17
38
|
fn();
|
|
18
39
|
}, val);
|
|
19
|
-
}
|
|
20
|
-
const TabPane =
|
|
21
|
-
|
|
40
|
+
}
|
|
41
|
+
const TabPane = import_react.default.forwardRef(
|
|
42
|
+
function TabPane2({
|
|
22
43
|
active = false,
|
|
23
44
|
children,
|
|
24
45
|
className,
|
|
25
46
|
fade,
|
|
26
47
|
tabIndex = 0,
|
|
27
48
|
...otherProps
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
49
|
+
}, ref) {
|
|
50
|
+
const [internalActive, setInternalActive] = import_react.default.useState(active);
|
|
51
|
+
const [internalShow, setInternalShow] = import_react.default.useState(active);
|
|
52
|
+
import_react.default.useEffect(() => {
|
|
53
|
+
let delayFn = () => {
|
|
54
|
+
setInternalActive(true);
|
|
55
|
+
delay(() => setInternalShow(true), 50);
|
|
56
|
+
};
|
|
57
|
+
if (!active) {
|
|
58
|
+
setInternalShow(false);
|
|
59
|
+
delayFn = () => setInternalActive(false);
|
|
60
|
+
}
|
|
61
|
+
const timer = delay(delayFn);
|
|
62
|
+
return () => {
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
setInternalShow(false);
|
|
65
|
+
};
|
|
66
|
+
}, [active]);
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
...otherProps,
|
|
71
|
+
className: (0, import_classnames.default)(
|
|
72
|
+
"tab-pane",
|
|
73
|
+
{
|
|
74
|
+
active: internalActive,
|
|
75
|
+
fade,
|
|
76
|
+
show: internalShow
|
|
77
|
+
},
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
ref,
|
|
81
|
+
role: "tabpanel",
|
|
82
|
+
tabIndex
|
|
83
|
+
},
|
|
84
|
+
children
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
var TabPane_default = TabPane;
|