Files
NapCatQQ/.pnpm-store/v3/files/6a/e1af994027cda86b7829598f2bd55abbceb46ba8998a15a6059127970f6a8ebff7ab3eb4e640f40484d725a6cefd2124918cf7461d8d69f52da26966588e48
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

46 lines
1.1 KiB
Plaintext

import {
spacing
} from "./chunk-CH7FQ62Q.mjs";
// src/use-spacer.ts
import { mapPropsVariants } from "@heroui/system-rsc";
import { spacer } from "@heroui/theme";
import { clsx, dataAttr, objectToDeps } from "@heroui/shared-utils";
import { useMemo } from "react";
var getMargin = (value) => {
var _a;
return (_a = spacing[value]) != null ? _a : value;
};
function useSpacer(originalProps) {
const [props, variantProps] = mapPropsVariants(originalProps, spacer.variantKeys);
const { as, className, x = 1, y = 1, ...otherProps } = props;
const Component = as || "span";
const styles = useMemo(
() => spacer({
...variantProps,
className
}),
[objectToDeps(variantProps), className]
);
const marginLeft = getMargin(x);
const marginTop = getMargin(y);
const getSpacerProps = (props2 = {}) => ({
...props2,
...otherProps,
"aria-hidden": dataAttr(true),
className: clsx(styles, props2.className),
style: {
...props2.style,
...otherProps.style,
marginLeft,
marginTop
}
});
return { Component, getSpacerProps };
}
export {
getMargin,
useSpacer
};