@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/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -5075,15 +5075,18 @@ var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
|
5075
5075
|
var sizeStyles6 = {
|
|
5076
5076
|
sm: {
|
|
5077
5077
|
tab: "py-1.5 px-3 text-xs",
|
|
5078
|
-
|
|
5078
|
+
contentGap: "mt-3",
|
|
5079
|
+
contentPadding: "p-3"
|
|
5079
5080
|
},
|
|
5080
5081
|
md: {
|
|
5081
5082
|
tab: "py-2.5 px-4 text-sm",
|
|
5082
|
-
|
|
5083
|
+
contentGap: "mt-4",
|
|
5084
|
+
contentPadding: "p-4"
|
|
5083
5085
|
},
|
|
5084
5086
|
lg: {
|
|
5085
5087
|
tab: "py-3 px-6 text-base",
|
|
5086
|
-
|
|
5088
|
+
contentGap: "mt-6",
|
|
5089
|
+
contentPadding: "p-6"
|
|
5087
5090
|
}
|
|
5088
5091
|
};
|
|
5089
5092
|
var variantStyles5 = {
|
|
@@ -5122,11 +5125,15 @@ var Tabs = ({
|
|
|
5122
5125
|
tabs,
|
|
5123
5126
|
defaultValue,
|
|
5124
5127
|
className,
|
|
5128
|
+
contentClassName,
|
|
5125
5129
|
variant = "default",
|
|
5126
5130
|
size = "md",
|
|
5127
5131
|
orientation = "horizontal",
|
|
5128
5132
|
onTabChange,
|
|
5129
|
-
stretch = false
|
|
5133
|
+
stretch = false,
|
|
5134
|
+
noContentCard = false,
|
|
5135
|
+
noContentPadding = false,
|
|
5136
|
+
animateContent = true
|
|
5130
5137
|
}) => {
|
|
5131
5138
|
const [active, setActive] = React18.useState(defaultValue || tabs[0]?.value);
|
|
5132
5139
|
const [underlineStyle, setUnderlineStyle] = React18.useState({});
|
|
@@ -5141,8 +5148,8 @@ var Tabs = ({
|
|
|
5141
5148
|
};
|
|
5142
5149
|
React18.useEffect(() => {
|
|
5143
5150
|
if (variant === "underline" && orientation === "horizontal") {
|
|
5144
|
-
const
|
|
5145
|
-
const activeTab2 = tabRefs.current[
|
|
5151
|
+
const activeIndex2 = tabs.findIndex((tab) => tab.value === active);
|
|
5152
|
+
const activeTab2 = tabRefs.current[activeIndex2];
|
|
5146
5153
|
if (activeTab2) {
|
|
5147
5154
|
const { offsetLeft, offsetWidth } = activeTab2;
|
|
5148
5155
|
setUnderlineStyle({
|
|
@@ -5153,19 +5160,29 @@ var Tabs = ({
|
|
|
5153
5160
|
}
|
|
5154
5161
|
}, [active, variant, orientation, tabs]);
|
|
5155
5162
|
const containerClasses = cn(
|
|
5156
|
-
"
|
|
5157
|
-
orientation === "horizontal" ? "flex space-x-1 overflow-x-auto" : "flex flex-col space-y-1",
|
|
5163
|
+
"relative",
|
|
5164
|
+
orientation === "horizontal" ? "w-full flex space-x-1 overflow-x-auto" : "flex flex-col space-y-1 shrink-0",
|
|
5158
5165
|
variantStyles5[variant].container,
|
|
5159
5166
|
className
|
|
5160
5167
|
);
|
|
5161
|
-
const
|
|
5162
|
-
|
|
5168
|
+
const activeIndex = tabs.findIndex((tab) => tab.value === active);
|
|
5169
|
+
const activeTab = activeIndex >= 0 ? tabs[activeIndex] : tabs[0];
|
|
5170
|
+
const panelId = `${baseId}-panel-${activeIndex >= 0 ? activeIndex : 0}`;
|
|
5171
|
+
const tabId = `${baseId}-tab-${activeIndex >= 0 ? activeIndex : 0}`;
|
|
5172
|
+
const contentWrapperClasses = cn(
|
|
5173
|
+
orientation === "horizontal" && sizeStyles6[size].contentGap,
|
|
5174
|
+
orientation === "vertical" && "flex-1 min-w-0",
|
|
5175
|
+
!noContentPadding && sizeStyles6[size].contentPadding,
|
|
5176
|
+
!noContentCard ? "bg-card rounded-2xl md:rounded-3xl border border-border/60 shadow-sm text-card-foreground backdrop-blur-sm" : "text-foreground",
|
|
5177
|
+
contentClassName
|
|
5178
|
+
);
|
|
5179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cn("w-full", orientation === "vertical" && "flex items-start gap-6"), children: [
|
|
5163
5180
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: containerClasses, role: "tablist", "aria-orientation": orientation, children: [
|
|
5164
5181
|
tabs.map((tab, index) => {
|
|
5165
5182
|
const isActive = active === tab.value;
|
|
5166
5183
|
const Icon = tab.icon;
|
|
5167
|
-
const
|
|
5168
|
-
const
|
|
5184
|
+
const tabId2 = `${baseId}-tab-${index}`;
|
|
5185
|
+
const panelId2 = `${baseId}-panel-${index}`;
|
|
5169
5186
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5170
5187
|
"button",
|
|
5171
5188
|
{
|
|
@@ -5193,9 +5210,9 @@ var Tabs = ({
|
|
|
5193
5210
|
stretch && orientation === "horizontal" && "flex-1 justify-center"
|
|
5194
5211
|
),
|
|
5195
5212
|
role: "tab",
|
|
5196
|
-
id:
|
|
5213
|
+
id: tabId2,
|
|
5197
5214
|
"aria-selected": isActive,
|
|
5198
|
-
"aria-controls":
|
|
5215
|
+
"aria-controls": panelId2,
|
|
5199
5216
|
tabIndex: isActive ? 0 : -1,
|
|
5200
5217
|
onKeyDown: (e) => {
|
|
5201
5218
|
const count = tabs.length;
|
|
@@ -5231,17 +5248,10 @@ var Tabs = ({
|
|
|
5231
5248
|
"div",
|
|
5232
5249
|
{
|
|
5233
5250
|
role: "tabpanel",
|
|
5234
|
-
id:
|
|
5235
|
-
"aria-labelledby":
|
|
5236
|
-
className: cn(
|
|
5237
|
-
|
|
5238
|
-
"backdrop-blur-sm",
|
|
5239
|
-
"max-md:bg-transparent max-md:border-0 max-md:shadow-none max-md:rounded-none max-md:backdrop-blur-none",
|
|
5240
|
-
sizeStyles6[size].content,
|
|
5241
|
-
orientation === "vertical" && "flex-1"
|
|
5242
|
-
),
|
|
5243
|
-
tabIndex: 0,
|
|
5244
|
-
children: activeTab?.content
|
|
5251
|
+
id: panelId,
|
|
5252
|
+
"aria-labelledby": tabId,
|
|
5253
|
+
className: cn("transition-all duration-200", contentWrapperClasses),
|
|
5254
|
+
children: animateContent ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "animate-fade-in", children: activeTab?.content }, activeTab?.value) : activeTab?.content
|
|
5245
5255
|
}
|
|
5246
5256
|
)
|
|
5247
5257
|
] });
|
|
@@ -5253,7 +5263,7 @@ var PillTabs = ({ contained = true, ...props }) => {
|
|
|
5253
5263
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Tabs, { ...props, variant: "pills", className: cn(contained && "max-w-fit", props.className) });
|
|
5254
5264
|
};
|
|
5255
5265
|
var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
5256
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cn("
|
|
5266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Tabs, { ...props, orientation: "vertical", variant: "card", className: sidebarWidth }) });
|
|
5257
5267
|
};
|
|
5258
5268
|
|
|
5259
5269
|
// src/components/DropdownMenu.tsx
|