@underverse-ui/underverse 1.0.96 → 1.0.97
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/api-reference.json +1 -1
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -6793,9 +6793,15 @@ var variantStyles5 = {
|
|
|
6793
6793
|
inactiveTab: "text-muted-foreground hover:text-foreground"
|
|
6794
6794
|
}
|
|
6795
6795
|
};
|
|
6796
|
-
function
|
|
6796
|
+
function normalizeTabsId(value) {
|
|
6797
|
+
const normalized = value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
6798
|
+
return normalized || "default";
|
|
6799
|
+
}
|
|
6800
|
+
function getTabsBaseId(tabs, id, fallbackId) {
|
|
6801
|
+
if (id) return `tabs-${normalizeTabsId(id)}`;
|
|
6802
|
+
if (fallbackId) return `tabs-${normalizeTabsId(fallbackId)}`;
|
|
6797
6803
|
const key = tabs.map((t) => t.value).join("-");
|
|
6798
|
-
return `tabs-${key || "default"}`;
|
|
6804
|
+
return `tabs-${normalizeTabsId(key || "default")}`;
|
|
6799
6805
|
}
|
|
6800
6806
|
function getTabTriggerId(baseId, index) {
|
|
6801
6807
|
return `${baseId}-tab-${index}`;
|
|
@@ -6820,6 +6826,7 @@ function shouldHandleTabClickLocally(event, target) {
|
|
|
6820
6826
|
return !(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || target === "_blank");
|
|
6821
6827
|
}
|
|
6822
6828
|
var Tabs = ({
|
|
6829
|
+
id,
|
|
6823
6830
|
tabs,
|
|
6824
6831
|
defaultValue,
|
|
6825
6832
|
className,
|
|
@@ -6836,7 +6843,8 @@ var Tabs = ({
|
|
|
6836
6843
|
const [active, setActive] = React22.useState(defaultValue || tabs[0]?.value);
|
|
6837
6844
|
const [underlineStyle, setUnderlineStyle] = React22.useState({});
|
|
6838
6845
|
const tabRefs = React22.useRef([]);
|
|
6839
|
-
const
|
|
6846
|
+
const autoId = React22.useId();
|
|
6847
|
+
const baseId = React22.useMemo(() => getTabsBaseId(tabs, id, autoId), [autoId, id, tabs]);
|
|
6840
6848
|
const handleTabChange = (value) => {
|
|
6841
6849
|
setActive(value);
|
|
6842
6850
|
onTabChange?.(value);
|