257 lines
6.7 KiB
JavaScript
257 lines
6.7 KiB
JavaScript
"use strict";
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// src/components/tabs.ts
|
|
var tabs_exports = {};
|
|
__export(tabs_exports, {
|
|
tabsTheme: () => tabsTheme
|
|
});
|
|
module.exports = __toCommonJS(tabs_exports);
|
|
var import_anatomy = require("@chakra-ui/anatomy");
|
|
var import_styled_system = require("@chakra-ui/styled-system");
|
|
var import_theme_tools = require("@chakra-ui/theme-tools");
|
|
var $fg = (0, import_styled_system.cssVar)("tabs-color");
|
|
var $bg = (0, import_styled_system.cssVar)("tabs-bg");
|
|
var $border = (0, import_styled_system.cssVar)("tabs-border-color");
|
|
var { defineMultiStyleConfig, definePartsStyle } = (0, import_styled_system.createMultiStyleConfigHelpers)(import_anatomy.tabsAnatomy.keys);
|
|
var baseStyleRoot = (0, import_styled_system.defineStyle)((props) => {
|
|
const { orientation } = props;
|
|
return {
|
|
display: orientation === "vertical" ? "flex" : "block"
|
|
};
|
|
});
|
|
var baseStyleTab = (0, import_styled_system.defineStyle)((props) => {
|
|
const { isFitted } = props;
|
|
return {
|
|
flex: isFitted ? 1 : void 0,
|
|
transitionProperty: "common",
|
|
transitionDuration: "normal",
|
|
_focusVisible: {
|
|
zIndex: 1,
|
|
boxShadow: "outline"
|
|
},
|
|
_disabled: {
|
|
cursor: "not-allowed",
|
|
opacity: 0.4
|
|
}
|
|
};
|
|
});
|
|
var baseStyleTablist = (0, import_styled_system.defineStyle)((props) => {
|
|
const { align = "start", orientation } = props;
|
|
const alignments = {
|
|
end: "flex-end",
|
|
center: "center",
|
|
start: "flex-start"
|
|
};
|
|
return {
|
|
justifyContent: alignments[align],
|
|
flexDirection: orientation === "vertical" ? "column" : "row"
|
|
};
|
|
});
|
|
var baseStyleTabpanel = (0, import_styled_system.defineStyle)({
|
|
p: 4
|
|
});
|
|
var baseStyle = definePartsStyle((props) => ({
|
|
root: baseStyleRoot(props),
|
|
tab: baseStyleTab(props),
|
|
tablist: baseStyleTablist(props),
|
|
tabpanel: baseStyleTabpanel
|
|
}));
|
|
var sizes = {
|
|
sm: definePartsStyle({
|
|
tab: {
|
|
py: 1,
|
|
px: 4,
|
|
fontSize: "sm"
|
|
}
|
|
}),
|
|
md: definePartsStyle({
|
|
tab: {
|
|
fontSize: "md",
|
|
py: 2,
|
|
px: 4
|
|
}
|
|
}),
|
|
lg: definePartsStyle({
|
|
tab: {
|
|
fontSize: "lg",
|
|
py: 3,
|
|
px: 4
|
|
}
|
|
})
|
|
};
|
|
var variantLine = definePartsStyle((props) => {
|
|
const { colorScheme: c, orientation } = props;
|
|
const isVertical = orientation === "vertical";
|
|
const borderProp = isVertical ? "borderStart" : "borderBottom";
|
|
const marginProp = isVertical ? "marginStart" : "marginBottom";
|
|
return {
|
|
tablist: {
|
|
[borderProp]: "2px solid",
|
|
borderColor: "inherit"
|
|
},
|
|
tab: {
|
|
[borderProp]: "2px solid",
|
|
borderColor: "transparent",
|
|
[marginProp]: "-2px",
|
|
_selected: {
|
|
[$fg.variable]: `colors.${c}.600`,
|
|
_dark: {
|
|
[$fg.variable]: `colors.${c}.300`
|
|
},
|
|
borderColor: "currentColor"
|
|
},
|
|
_active: {
|
|
[$bg.variable]: "colors.gray.200",
|
|
_dark: {
|
|
[$bg.variable]: "colors.whiteAlpha.300"
|
|
}
|
|
},
|
|
_disabled: {
|
|
_active: { bg: "none" }
|
|
},
|
|
color: $fg.reference,
|
|
bg: $bg.reference
|
|
}
|
|
};
|
|
});
|
|
var variantEnclosed = definePartsStyle((props) => {
|
|
const { colorScheme: c } = props;
|
|
return {
|
|
tab: {
|
|
borderTopRadius: "md",
|
|
border: "1px solid",
|
|
borderColor: "transparent",
|
|
mb: "-1px",
|
|
[$border.variable]: "transparent",
|
|
_selected: {
|
|
[$fg.variable]: `colors.${c}.600`,
|
|
[$border.variable]: `colors.white`,
|
|
_dark: {
|
|
[$fg.variable]: `colors.${c}.300`,
|
|
[$border.variable]: `colors.gray.800`
|
|
},
|
|
borderColor: "inherit",
|
|
borderBottomColor: $border.reference
|
|
},
|
|
color: $fg.reference
|
|
},
|
|
tablist: {
|
|
mb: "-1px",
|
|
borderBottom: "1px solid",
|
|
borderColor: "inherit"
|
|
}
|
|
};
|
|
});
|
|
var variantEnclosedColored = definePartsStyle((props) => {
|
|
const { colorScheme: c } = props;
|
|
return {
|
|
tab: {
|
|
border: "1px solid",
|
|
borderColor: "inherit",
|
|
[$bg.variable]: "colors.gray.50",
|
|
_dark: {
|
|
[$bg.variable]: "colors.whiteAlpha.50"
|
|
},
|
|
mb: "-1px",
|
|
_notLast: {
|
|
marginEnd: "-1px"
|
|
},
|
|
_selected: {
|
|
[$bg.variable]: "colors.white",
|
|
[$fg.variable]: `colors.${c}.600`,
|
|
_dark: {
|
|
[$bg.variable]: "colors.gray.800",
|
|
[$fg.variable]: `colors.${c}.300`
|
|
},
|
|
borderColor: "inherit",
|
|
borderTopColor: "currentColor",
|
|
borderBottomColor: "transparent"
|
|
},
|
|
color: $fg.reference,
|
|
bg: $bg.reference
|
|
},
|
|
tablist: {
|
|
mb: "-1px",
|
|
borderBottom: "1px solid",
|
|
borderColor: "inherit"
|
|
}
|
|
};
|
|
});
|
|
var variantSoftRounded = definePartsStyle((props) => {
|
|
const { colorScheme: c, theme } = props;
|
|
return {
|
|
tab: {
|
|
borderRadius: "full",
|
|
fontWeight: "semibold",
|
|
color: "gray.600",
|
|
_selected: {
|
|
color: (0, import_theme_tools.getColor)(theme, `${c}.700`),
|
|
bg: (0, import_theme_tools.getColor)(theme, `${c}.100`)
|
|
}
|
|
}
|
|
};
|
|
});
|
|
var variantSolidRounded = definePartsStyle((props) => {
|
|
const { colorScheme: c } = props;
|
|
return {
|
|
tab: {
|
|
borderRadius: "full",
|
|
fontWeight: "semibold",
|
|
[$fg.variable]: "colors.gray.600",
|
|
_dark: {
|
|
[$fg.variable]: "inherit"
|
|
},
|
|
_selected: {
|
|
[$fg.variable]: "colors.white",
|
|
[$bg.variable]: `colors.${c}.600`,
|
|
_dark: {
|
|
[$fg.variable]: "colors.gray.800",
|
|
[$bg.variable]: `colors.${c}.300`
|
|
}
|
|
},
|
|
color: $fg.reference,
|
|
bg: $bg.reference
|
|
}
|
|
};
|
|
});
|
|
var variantUnstyled = definePartsStyle({});
|
|
var variants = {
|
|
line: variantLine,
|
|
enclosed: variantEnclosed,
|
|
"enclosed-colored": variantEnclosedColored,
|
|
"soft-rounded": variantSoftRounded,
|
|
"solid-rounded": variantSolidRounded,
|
|
unstyled: variantUnstyled
|
|
};
|
|
var tabsTheme = defineMultiStyleConfig({
|
|
baseStyle,
|
|
sizes,
|
|
variants,
|
|
defaultProps: {
|
|
size: "md",
|
|
variant: "line",
|
|
colorScheme: "blue"
|
|
}
|
|
});
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
tabsTheme
|
|
});
|
|
//# sourceMappingURL=tabs.js.map
|