@nextui-org/theme
Version:
The default theme for NextUI components
231 lines (224 loc) • 5.47 kB
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/card.ts
var card_exports = {};
__export(card_exports, {
card: () => card
});
module.exports = __toCommonJS(card_exports);
// src/utils/tv.ts
var import_tailwind_variants = require("tailwind-variants");
// src/utils/tw-merge-config.ts
var COMMON_UNITS = ["small", "medium", "large"];
var twMergeConfig = {
theme: {
opacity: ["disabled"],
spacing: ["divider"],
borderWidth: COMMON_UNITS,
borderRadius: COMMON_UNITS
},
classGroups: {
shadow: [{ shadow: COMMON_UNITS }],
"font-size": [{ text: ["tiny", ...COMMON_UNITS] }],
"bg-image": [
"bg-stripe-gradient-default",
"bg-stripe-gradient-primary",
"bg-stripe-gradient-secondary",
"bg-stripe-gradient-success",
"bg-stripe-gradient-warning",
"bg-stripe-gradient-danger"
]
}
};
// src/utils/tv.ts
var tv = (options, config) => {
var _a, _b, _c;
return (0, import_tailwind_variants.tv)(options, {
...config,
twMerge: (_a = config == null ? void 0 : config.twMerge) != null ? _a : true,
twMergeConfig: {
...config == null ? void 0 : config.twMergeConfig,
theme: {
...(_b = config == null ? void 0 : config.twMergeConfig) == null ? void 0 : _b.theme,
...twMergeConfig.theme
},
classGroups: {
...(_c = config == null ? void 0 : config.twMergeConfig) == null ? void 0 : _c.classGroups,
...twMergeConfig.classGroups
}
}
});
};
// src/utils/classes.ts
var dataFocusVisibleClasses = [
"outline-none",
"data-[focus-visible=true]:z-10",
"data-[focus-visible=true]:outline-2",
"data-[focus-visible=true]:outline-focus",
"data-[focus-visible=true]:outline-offset-2"
];
// src/components/card.ts
var card = tv({
slots: {
base: [
"flex",
"flex-col",
"relative",
"overflow-hidden",
"h-auto",
"outline-none",
"text-foreground",
"box-border",
"bg-content1",
...dataFocusVisibleClasses
],
header: [
"flex",
"p-3",
"z-10",
"w-full",
"justify-start",
"items-center",
"shrink-0",
"overflow-inherit",
"color-inherit",
"subpixel-antialiased"
],
body: [
"relative",
"flex",
"flex-1",
"w-full",
"p-3",
"flex-auto",
"flex-col",
"place-content-inherit",
"align-items-inherit",
"h-auto",
"break-words",
"text-left",
"overflow-y-auto",
"subpixel-antialiased"
],
footer: [
"p-3",
"h-auto",
"flex",
"w-full",
"items-center",
"overflow-hidden",
"color-inherit",
"subpixel-antialiased"
]
},
variants: {
shadow: {
none: {
base: "shadow-none"
},
sm: {
base: "shadow-small"
},
md: {
base: "shadow-medium"
},
lg: {
base: "shadow-large"
}
},
radius: {
none: {
base: "rounded-none",
header: "rounded-none",
footer: "rounded-none"
},
sm: {
base: "rounded-small",
header: "rounded-t-small",
footer: "rounded-b-small"
},
md: {
base: "rounded-medium",
header: "rounded-t-medium",
footer: "rounded-b-medium"
},
lg: {
base: "rounded-large",
header: "rounded-t-large",
footer: "rounded-b-large"
}
},
fullWidth: {
true: {
base: "w-full"
}
},
isHoverable: {
true: {
base: "data-[hover=true]:bg-content2 dark:data-[hover=true]:bg-content2"
}
},
isPressable: {
true: { base: "cursor-pointer" }
},
isBlurred: {
true: {
base: [
"bg-background/80",
"dark:bg-background/20",
"backdrop-blur-md",
"backdrop-saturate-150"
]
}
},
isFooterBlurred: {
true: {
footer: ["bg-background/10", "backdrop-blur", "backdrop-saturate-150"]
}
},
isDisabled: {
true: {
base: "opacity-disabled cursor-not-allowed"
}
},
disableAnimation: {
true: "",
false: { base: "transition-transform-background motion-reduce:transition-none" }
}
},
compoundVariants: [
{
isPressable: true,
class: "data-[pressed=true]:scale-[0.97] tap-highlight-transparent"
}
],
defaultVariants: {
radius: "lg",
shadow: "md",
fullWidth: false,
isHoverable: false,
isPressable: false,
isDisabled: false,
isFooterBlurred: false
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
card
});