@underverse-ui/underverse 1.0.46 → 1.0.47
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 +36 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +36 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -593,11 +593,15 @@ interface TabsProps {
|
|
|
593
593
|
tabs: Tab[];
|
|
594
594
|
defaultValue?: string;
|
|
595
595
|
className?: string;
|
|
596
|
+
contentClassName?: string;
|
|
596
597
|
variant?: "default" | "pills" | "underline" | "card" | "underline-card";
|
|
597
598
|
size?: "sm" | "md" | "lg";
|
|
598
599
|
orientation?: "horizontal" | "vertical";
|
|
599
600
|
onTabChange?: (value: string) => void;
|
|
600
601
|
stretch?: boolean;
|
|
602
|
+
noContentCard?: boolean;
|
|
603
|
+
noContentPadding?: boolean;
|
|
604
|
+
animateContent?: boolean;
|
|
601
605
|
}
|
|
602
606
|
declare const Tabs: React$1.FC<TabsProps>;
|
|
603
607
|
interface SimpleTabsProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -593,11 +593,15 @@ interface TabsProps {
|
|
|
593
593
|
tabs: Tab[];
|
|
594
594
|
defaultValue?: string;
|
|
595
595
|
className?: string;
|
|
596
|
+
contentClassName?: string;
|
|
596
597
|
variant?: "default" | "pills" | "underline" | "card" | "underline-card";
|
|
597
598
|
size?: "sm" | "md" | "lg";
|
|
598
599
|
orientation?: "horizontal" | "vertical";
|
|
599
600
|
onTabChange?: (value: string) => void;
|
|
600
601
|
stretch?: boolean;
|
|
602
|
+
noContentCard?: boolean;
|
|
603
|
+
noContentPadding?: boolean;
|
|
604
|
+
animateContent?: boolean;
|
|
601
605
|
}
|
|
602
606
|
declare const Tabs: React$1.FC<TabsProps>;
|
|
603
607
|
interface SimpleTabsProps {
|
package/dist/index.js
CHANGED
|
@@ -4886,15 +4886,18 @@ import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
|
4886
4886
|
var sizeStyles6 = {
|
|
4887
4887
|
sm: {
|
|
4888
4888
|
tab: "py-1.5 px-3 text-xs",
|
|
4889
|
-
|
|
4889
|
+
contentGap: "mt-3",
|
|
4890
|
+
contentPadding: "p-3"
|
|
4890
4891
|
},
|
|
4891
4892
|
md: {
|
|
4892
4893
|
tab: "py-2.5 px-4 text-sm",
|
|
4893
|
-
|
|
4894
|
+
contentGap: "mt-4",
|
|
4895
|
+
contentPadding: "p-4"
|
|
4894
4896
|
},
|
|
4895
4897
|
lg: {
|
|
4896
4898
|
tab: "py-3 px-6 text-base",
|
|
4897
|
-
|
|
4899
|
+
contentGap: "mt-6",
|
|
4900
|
+
contentPadding: "p-6"
|
|
4898
4901
|
}
|
|
4899
4902
|
};
|
|
4900
4903
|
var variantStyles5 = {
|
|
@@ -4933,11 +4936,15 @@ var Tabs = ({
|
|
|
4933
4936
|
tabs,
|
|
4934
4937
|
defaultValue,
|
|
4935
4938
|
className,
|
|
4939
|
+
contentClassName,
|
|
4936
4940
|
variant = "default",
|
|
4937
4941
|
size = "md",
|
|
4938
4942
|
orientation = "horizontal",
|
|
4939
4943
|
onTabChange,
|
|
4940
|
-
stretch = false
|
|
4944
|
+
stretch = false,
|
|
4945
|
+
noContentCard = false,
|
|
4946
|
+
noContentPadding = false,
|
|
4947
|
+
animateContent = true
|
|
4941
4948
|
}) => {
|
|
4942
4949
|
const [active, setActive] = React18.useState(defaultValue || tabs[0]?.value);
|
|
4943
4950
|
const [underlineStyle, setUnderlineStyle] = React18.useState({});
|
|
@@ -4952,8 +4959,8 @@ var Tabs = ({
|
|
|
4952
4959
|
};
|
|
4953
4960
|
React18.useEffect(() => {
|
|
4954
4961
|
if (variant === "underline" && orientation === "horizontal") {
|
|
4955
|
-
const
|
|
4956
|
-
const activeTab2 = tabRefs.current[
|
|
4962
|
+
const activeIndex2 = tabs.findIndex((tab) => tab.value === active);
|
|
4963
|
+
const activeTab2 = tabRefs.current[activeIndex2];
|
|
4957
4964
|
if (activeTab2) {
|
|
4958
4965
|
const { offsetLeft, offsetWidth } = activeTab2;
|
|
4959
4966
|
setUnderlineStyle({
|
|
@@ -4964,19 +4971,29 @@ var Tabs = ({
|
|
|
4964
4971
|
}
|
|
4965
4972
|
}, [active, variant, orientation, tabs]);
|
|
4966
4973
|
const containerClasses = cn(
|
|
4967
|
-
"
|
|
4968
|
-
orientation === "horizontal" ? "flex space-x-1 overflow-x-auto" : "flex flex-col space-y-1",
|
|
4974
|
+
"relative",
|
|
4975
|
+
orientation === "horizontal" ? "w-full flex space-x-1 overflow-x-auto" : "flex flex-col space-y-1 shrink-0",
|
|
4969
4976
|
variantStyles5[variant].container,
|
|
4970
4977
|
className
|
|
4971
4978
|
);
|
|
4972
|
-
const
|
|
4973
|
-
|
|
4979
|
+
const activeIndex = tabs.findIndex((tab) => tab.value === active);
|
|
4980
|
+
const activeTab = activeIndex >= 0 ? tabs[activeIndex] : tabs[0];
|
|
4981
|
+
const panelId = `${baseId}-panel-${activeIndex >= 0 ? activeIndex : 0}`;
|
|
4982
|
+
const tabId = `${baseId}-tab-${activeIndex >= 0 ? activeIndex : 0}`;
|
|
4983
|
+
const contentWrapperClasses = cn(
|
|
4984
|
+
orientation === "horizontal" && sizeStyles6[size].contentGap,
|
|
4985
|
+
orientation === "vertical" && "flex-1 min-w-0",
|
|
4986
|
+
!noContentPadding && sizeStyles6[size].contentPadding,
|
|
4987
|
+
!noContentCard ? "bg-card rounded-2xl md:rounded-3xl border border-border/60 shadow-sm text-card-foreground backdrop-blur-sm" : "text-foreground",
|
|
4988
|
+
contentClassName
|
|
4989
|
+
);
|
|
4990
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn("w-full", orientation === "vertical" && "flex items-start gap-6"), children: [
|
|
4974
4991
|
/* @__PURE__ */ jsxs19("div", { className: containerClasses, role: "tablist", "aria-orientation": orientation, children: [
|
|
4975
4992
|
tabs.map((tab, index) => {
|
|
4976
4993
|
const isActive = active === tab.value;
|
|
4977
4994
|
const Icon = tab.icon;
|
|
4978
|
-
const
|
|
4979
|
-
const
|
|
4995
|
+
const tabId2 = `${baseId}-tab-${index}`;
|
|
4996
|
+
const panelId2 = `${baseId}-panel-${index}`;
|
|
4980
4997
|
return /* @__PURE__ */ jsxs19(
|
|
4981
4998
|
"button",
|
|
4982
4999
|
{
|
|
@@ -5004,9 +5021,9 @@ var Tabs = ({
|
|
|
5004
5021
|
stretch && orientation === "horizontal" && "flex-1 justify-center"
|
|
5005
5022
|
),
|
|
5006
5023
|
role: "tab",
|
|
5007
|
-
id:
|
|
5024
|
+
id: tabId2,
|
|
5008
5025
|
"aria-selected": isActive,
|
|
5009
|
-
"aria-controls":
|
|
5026
|
+
"aria-controls": panelId2,
|
|
5010
5027
|
tabIndex: isActive ? 0 : -1,
|
|
5011
5028
|
onKeyDown: (e) => {
|
|
5012
5029
|
const count = tabs.length;
|
|
@@ -5042,17 +5059,10 @@ var Tabs = ({
|
|
|
5042
5059
|
"div",
|
|
5043
5060
|
{
|
|
5044
5061
|
role: "tabpanel",
|
|
5045
|
-
id:
|
|
5046
|
-
"aria-labelledby":
|
|
5047
|
-
className: cn(
|
|
5048
|
-
|
|
5049
|
-
"backdrop-blur-sm",
|
|
5050
|
-
"max-md:bg-transparent max-md:border-0 max-md:shadow-none max-md:rounded-none max-md:backdrop-blur-none",
|
|
5051
|
-
sizeStyles6[size].content,
|
|
5052
|
-
orientation === "vertical" && "flex-1"
|
|
5053
|
-
),
|
|
5054
|
-
tabIndex: 0,
|
|
5055
|
-
children: activeTab?.content
|
|
5062
|
+
id: panelId,
|
|
5063
|
+
"aria-labelledby": tabId,
|
|
5064
|
+
className: cn("transition-all duration-200", contentWrapperClasses),
|
|
5065
|
+
children: animateContent ? /* @__PURE__ */ jsx23("div", { className: "animate-fade-in", children: activeTab?.content }, activeTab?.value) : activeTab?.content
|
|
5056
5066
|
}
|
|
5057
5067
|
)
|
|
5058
5068
|
] });
|
|
@@ -5064,7 +5074,7 @@ var PillTabs = ({ contained = true, ...props }) => {
|
|
|
5064
5074
|
return /* @__PURE__ */ jsx23(Tabs, { ...props, variant: "pills", className: cn(contained && "max-w-fit", props.className) });
|
|
5065
5075
|
};
|
|
5066
5076
|
var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
5067
|
-
return /* @__PURE__ */ jsx23("div", { className: cn("
|
|
5077
|
+
return /* @__PURE__ */ jsx23("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx23(Tabs, { ...props, orientation: "vertical", variant: "card", className: sidebarWidth }) });
|
|
5068
5078
|
};
|
|
5069
5079
|
|
|
5070
5080
|
// src/components/DropdownMenu.tsx
|