UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

31 lines (27 loc) 1.27 kB
"use client"; import { utils_exports } from "../../utils/index.js"; import { createComponent } from "../../core/components/create-component.js"; import { Grid } from "../grid/grid.js"; import { simpleGridStyle } from "./simple-grid.style.js"; import { useMemo } from "react"; //#region src/components/simple-grid/simple-grid.tsx const { PropsContext: SimpleGridPropsContext, usePropsContext: useSimpleGridPropsContext, withContext } = createComponent("simple-grid", simpleGridStyle); /** * `SimpleGrid` is a component that makes `Grid` simpler and more user-friendly. * * @see https://yamada-ui.com/docs/components/simple-grid */ const SimpleGrid = withContext(Grid)(void 0, ({ columns, minChildWidth,...rest }) => { return { templateColumns: useMemo(() => { if (minChildWidth) return (0, utils_exports.replaceObject)(minChildWidth, (value) => { return value != null ? `repeat(auto-fit, minmax({sizes.${value}, ${value}}, 1fr))` : void 0; }); else return (0, utils_exports.replaceObject)(columns, (value) => value != null ? `repeat(${value}, minmax(0, 1fr))` : void 0); }, [minChildWidth, columns]), ...rest }; }); //#endregion export { SimpleGrid, SimpleGridPropsContext, useSimpleGridPropsContext }; //# sourceMappingURL=simple-grid.js.map