@db-ux/react-core-components 3.0.1 → 3.0.2
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/components/tabs/tabs.js +21 -16
- package/package.json +3 -3
|
@@ -102,24 +102,29 @@ function DBTabsFn(props, component) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
function handleChange(event) {
|
|
105
|
-
var _a
|
|
105
|
+
var _a;
|
|
106
106
|
event.stopPropagation();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
if (event.target) {
|
|
108
|
+
const target = event.target;
|
|
109
|
+
const parent = target.parentElement;
|
|
110
|
+
if (parent &&
|
|
111
|
+
parent.parentElement &&
|
|
112
|
+
((_a = parent.parentElement) === null || _a === void 0 ? void 0 : _a.nodeName) === "LI") {
|
|
113
|
+
const tabItem = parent.parentElement;
|
|
114
|
+
if (tabItem) {
|
|
115
|
+
const list = tabItem.parentElement;
|
|
116
|
+
if (list) {
|
|
117
|
+
const indices = Array.from(list.childNodes).indexOf(tabItem);
|
|
118
|
+
if (props.onIndexChange) {
|
|
119
|
+
props.onIndexChange(indices);
|
|
120
|
+
}
|
|
121
|
+
if (props.onTabSelect) {
|
|
122
|
+
props.onTabSelect(event);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
|
-
if (props.onTabSelect) {
|
|
121
|
-
props.onTabSelect(event);
|
|
122
|
-
}
|
|
123
128
|
}
|
|
124
129
|
useEffect(() => {
|
|
125
130
|
set_id(props.id || _id);
|
|
@@ -148,7 +153,7 @@ function DBTabsFn(props, component) {
|
|
|
148
153
|
setInitialized(false);
|
|
149
154
|
}
|
|
150
155
|
}, [_ref.current, initialized]);
|
|
151
|
-
return (React.createElement("div", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "onTabSelect", "onIndexChange"]), { id: _id }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-tabs", props.className), "data-orientation": props.orientation, "data-scroll-behavior": props.behavior, "data-alignment": (_a = props.alignment) !== null && _a !== void 0 ? _a : "start", "data-width": (_b = props.width) !== null && _b !== void 0 ? _b : "auto", onInput: (event) => handleChange(event) }),
|
|
156
|
+
return (React.createElement("div", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "onTabSelect", "onIndexChange"]), { id: _id }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-tabs", props.className), "data-orientation": props.orientation, "data-scroll-behavior": props.behavior, "data-alignment": (_a = props.alignment) !== null && _a !== void 0 ? _a : "start", "data-width": (_b = props.width) !== null && _b !== void 0 ? _b : "auto", onInput: (event) => handleChange(event), onChange: (event) => handleChange(event) }),
|
|
152
157
|
showScrollLeft ? (React.createElement(DBButton, { className: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: (event) => scroll(true) }, "Scroll left")) : null,
|
|
153
158
|
props.tabs ? (React.createElement(React.Fragment, null,
|
|
154
159
|
React.createElement(DBTabList, null, (_c = convertTabs()) === null || _c === void 0 ? void 0 : _c.map((tab, index) => (React.createElement(DBTabItem, { key: props.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_d = convertTabs()) === null || _d === void 0 ? void 0 :
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/react-core-components",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "React components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@db-ux/core-components": "3.0.
|
|
42
|
-
"@db-ux/core-foundations": "3.0.
|
|
41
|
+
"@db-ux/core-components": "3.0.2",
|
|
42
|
+
"@db-ux/core-foundations": "3.0.2"
|
|
43
43
|
}
|
|
44
44
|
}
|