2024-06-15 00:55:43 +03:00

185 lines
4.6 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/progress.ts
var progress_exports = {};
__export(progress_exports, {
progress: () => progress
});
module.exports = __toCommonJS(progress_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"]
}
};
// 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/components/progress.ts
var progress = tv(
{
slots: {
base: "flex flex-col gap-2 w-full",
label: "",
labelWrapper: "flex justify-between",
value: "",
track: "z-0 relative bg-default-300/50 overflow-hidden",
indicator: "h-full"
},
variants: {
color: {
default: {
indicator: "bg-default-400"
},
primary: {
indicator: "bg-primary"
},
secondary: {
indicator: "bg-secondary"
},
success: {
indicator: "bg-success"
},
warning: {
indicator: "bg-warning"
},
danger: {
indicator: "bg-danger"
}
},
size: {
sm: {
label: "text-small",
value: "text-small",
track: "h-1"
},
md: {
label: "text-medium",
value: "text-medium",
track: "h-3"
},
lg: {
label: "text-large",
value: "text-large",
track: "h-5"
}
},
radius: {
none: {
track: "rounded-none",
indicator: "rounded-none"
},
sm: {
track: "rounded-small",
indicator: "rounded-small"
},
md: {
track: "rounded-medium",
indicator: "rounded-medium"
},
lg: {
track: "rounded-large",
indicator: "rounded-large"
},
full: {
track: "rounded-full",
indicator: "rounded-full"
}
},
isStriped: {
true: {
indicator: "bg-stripe-gradient bg-[length:1.25rem_1.25rem]"
}
},
isIndeterminate: {
true: {
indicator: ["absolute", "w-full", "origin-left", "animate-indeterminate-bar"]
}
},
isDisabled: {
true: {
base: "opacity-disabled cursor-not-allowed"
}
},
disableAnimation: {
true: {},
false: {
indicator: "transition-transform !duration-500"
}
}
},
defaultVariants: {
color: "primary",
size: "md",
radius: "full",
isStriped: false,
isIndeterminate: false,
isDisabled: false
},
compoundVariants: [
{
disableAnimation: true,
isIndeterminate: false,
class: {
indicator: "!transition-none motion-reduce:transition-none"
}
}
]
},
{
twMerge: true
}
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
progress
});