@dt-dds/react-tabs 1.0.0-beta.44 → 1.0.0-beta.45
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/CHANGELOG.md +13 -0
- package/dist/index.d.mts +38 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -9
- package/dist/index.mjs +3 -6
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @dt-ui/react-tabs
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore(dependencies): upgrade builders versions
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies [223664b]
|
|
10
|
+
- @dt-dds/react-box@1.0.0-beta.16
|
|
11
|
+
- @dt-dds/react-core@1.0.0-beta.45
|
|
12
|
+
- @dt-dds/react-icon@1.0.0-beta.46
|
|
13
|
+
- @dt-dds/react-icon-button@1.0.0-beta.13
|
|
14
|
+
- @dt-dds/themes@1.0.0-beta.5
|
|
15
|
+
|
|
3
16
|
## 1.0.0-beta.44
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CustomTheme } from '@dt-dds/themes';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { BaseProps } from '@dt-dds/react-core';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
type Variant = 'default' | 'contained';
|
|
7
|
+
|
|
8
|
+
interface TabItemProps extends BaseProps {
|
|
9
|
+
activeTab?: number;
|
|
10
|
+
variant?: Variant;
|
|
11
|
+
index?: number;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
handleChange?: (value: number) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface TabsProps extends BaseProps {
|
|
19
|
+
activeTab: number;
|
|
20
|
+
variant?: Variant;
|
|
21
|
+
handleChange: (value: number) => void;
|
|
22
|
+
}
|
|
23
|
+
declare const Tabs: {
|
|
24
|
+
({ children, style, activeTab, dataTestId, variant, handleChange, }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
Item: ({ activeTab, dataTestId, isDisabled, index, variant, label, icon, handleChange, }: TabItemProps) => react_jsx_runtime.JSX.Element;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
declare const useTabs: (initialTab?: number) => {
|
|
29
|
+
activeTab: number;
|
|
30
|
+
handleChange: (value: number) => void;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare module '@emotion/react' {
|
|
34
|
+
interface Theme extends CustomTheme {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Tabs, type TabsProps, useTabs };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -45,12 +45,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
45
45
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
46
|
|
|
47
47
|
// index.ts
|
|
48
|
-
var
|
|
49
|
-
__export(
|
|
48
|
+
var index_exports = {};
|
|
49
|
+
__export(index_exports, {
|
|
50
50
|
Tabs: () => Tabs,
|
|
51
51
|
useTabs: () => useTabs
|
|
52
52
|
});
|
|
53
|
-
module.exports = __toCommonJS(
|
|
53
|
+
module.exports = __toCommonJS(index_exports);
|
|
54
54
|
|
|
55
55
|
// src/Tabs.tsx
|
|
56
56
|
var import_react_box = require("@dt-dds/react-box");
|
|
@@ -106,8 +106,7 @@ var TabItem = ({
|
|
|
106
106
|
}) => {
|
|
107
107
|
const ref = (0, import_react.useRef)(null);
|
|
108
108
|
const handleOnClick = () => {
|
|
109
|
-
if (!ref || !ref.current || !ref.current.parentElement)
|
|
110
|
-
return;
|
|
109
|
+
if (!ref || !ref.current || !ref.current.parentElement) return;
|
|
111
110
|
const elementClientRect = ref.current.getBoundingClientRect();
|
|
112
111
|
const parentClientRect = ref.current.parentElement.getBoundingClientRect();
|
|
113
112
|
if (elementClientRect.left < parentClientRect.left) {
|
|
@@ -183,8 +182,7 @@ var Tabs = ({
|
|
|
183
182
|
[children, activeTab, variant, handleChange]
|
|
184
183
|
);
|
|
185
184
|
const handleScroll = (scrollOffset) => {
|
|
186
|
-
if (!ref || !ref.current)
|
|
187
|
-
return;
|
|
185
|
+
if (!ref || !ref.current) return;
|
|
188
186
|
const left = ref.current.scrollLeft + scrollOffset;
|
|
189
187
|
ref.current.scroll({
|
|
190
188
|
left,
|
|
@@ -193,8 +191,7 @@ var Tabs = ({
|
|
|
193
191
|
calculateIfIsOverflowing(left);
|
|
194
192
|
};
|
|
195
193
|
const calculateIfIsOverflowing = (currentScrollLeft) => {
|
|
196
|
-
if (!ref || !ref.current)
|
|
197
|
-
return;
|
|
194
|
+
if (!ref || !ref.current) return;
|
|
198
195
|
const scrollLeft = currentScrollLeft != null ? currentScrollLeft : ref.current.scrollLeft;
|
|
199
196
|
setIsLeftSideOverflowing(scrollLeft > 0);
|
|
200
197
|
setIsRightSideOverflowing(
|
package/dist/index.mjs
CHANGED
|
@@ -79,8 +79,7 @@ var TabItem = ({
|
|
|
79
79
|
}) => {
|
|
80
80
|
const ref = useRef(null);
|
|
81
81
|
const handleOnClick = () => {
|
|
82
|
-
if (!ref || !ref.current || !ref.current.parentElement)
|
|
83
|
-
return;
|
|
82
|
+
if (!ref || !ref.current || !ref.current.parentElement) return;
|
|
84
83
|
const elementClientRect = ref.current.getBoundingClientRect();
|
|
85
84
|
const parentClientRect = ref.current.parentElement.getBoundingClientRect();
|
|
86
85
|
if (elementClientRect.left < parentClientRect.left) {
|
|
@@ -156,8 +155,7 @@ var Tabs = ({
|
|
|
156
155
|
[children, activeTab, variant, handleChange]
|
|
157
156
|
);
|
|
158
157
|
const handleScroll = (scrollOffset) => {
|
|
159
|
-
if (!ref || !ref.current)
|
|
160
|
-
return;
|
|
158
|
+
if (!ref || !ref.current) return;
|
|
161
159
|
const left = ref.current.scrollLeft + scrollOffset;
|
|
162
160
|
ref.current.scroll({
|
|
163
161
|
left,
|
|
@@ -166,8 +164,7 @@ var Tabs = ({
|
|
|
166
164
|
calculateIfIsOverflowing(left);
|
|
167
165
|
};
|
|
168
166
|
const calculateIfIsOverflowing = (currentScrollLeft) => {
|
|
169
|
-
if (!ref || !ref.current)
|
|
170
|
-
return;
|
|
167
|
+
if (!ref || !ref.current) return;
|
|
171
168
|
const scrollLeft = currentScrollLeft != null ? currentScrollLeft : ref.current.scrollLeft;
|
|
172
169
|
setIsLeftSideOverflowing(scrollLeft > 0);
|
|
173
170
|
setIsRightSideOverflowing(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dt-dds/react-tabs",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"test:update:snapshot": "jest -u"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dt-dds/react-core": "1.0.0-beta.
|
|
24
|
-
"@dt-dds/react-icon": "1.0.0-beta.
|
|
25
|
-
"@dt-dds/react-icon-button": "1.0.0-beta.
|
|
26
|
-
"@dt-dds/react-box": "1.0.0-beta.
|
|
27
|
-
"@dt-dds/themes": "1.0.0-beta.
|
|
23
|
+
"@dt-dds/react-core": "1.0.0-beta.45",
|
|
24
|
+
"@dt-dds/react-icon": "1.0.0-beta.46",
|
|
25
|
+
"@dt-dds/react-icon-button": "1.0.0-beta.13",
|
|
26
|
+
"@dt-dds/react-box": "1.0.0-beta.16",
|
|
27
|
+
"@dt-dds/themes": "1.0.0-beta.5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/core": "^7.22.9",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react": "^18.1.0",
|
|
46
46
|
"react-dom": "^18.2.0",
|
|
47
47
|
"tsconfig": "*",
|
|
48
|
-
"tsup": "^
|
|
48
|
+
"tsup": "^8.5.0",
|
|
49
49
|
"typescript": "^4.5.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|