Files
wdi-dashboard/node_modules/@chakra-ui/layout/dist/chunk-NEK3OOAM.mjs
2024-08-16 15:06:52 +05:30

52 lines
1.3 KiB
JavaScript

'use client'
import {
Grid
} from "./chunk-JARCRF6W.mjs";
// src/simple-grid.tsx
import {
forwardRef,
getToken,
useTheme
} from "@chakra-ui/system";
import { mapResponsive } from "@chakra-ui/breakpoint-utils";
import { jsx } from "react/jsx-runtime";
var SimpleGrid = forwardRef(
function SimpleGrid2(props, ref) {
const { columns, spacingX, spacingY, spacing, minChildWidth, ...rest } = props;
const theme = useTheme();
const templateColumns = minChildWidth ? widthToColumns(minChildWidth, theme) : countToColumns(columns);
return /* @__PURE__ */ jsx(
Grid,
{
ref,
gap: spacing,
columnGap: spacingX,
rowGap: spacingY,
templateColumns,
...rest
}
);
}
);
SimpleGrid.displayName = "SimpleGrid";
function toPx(n) {
return typeof n === "number" ? `${n}px` : n;
}
function widthToColumns(width, theme) {
return mapResponsive(width, (value) => {
const _value = getToken("sizes", value, toPx(value))(theme);
return value === null ? null : `repeat(auto-fit, minmax(${_value}, 1fr))`;
});
}
function countToColumns(count) {
return mapResponsive(
count,
(value) => value === null ? null : `repeat(${value}, minmax(0, 1fr))`
);
}
export {
SimpleGrid
};
//# sourceMappingURL=chunk-NEK3OOAM.mjs.map