@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
64 lines • 3.73 kB
JavaScript
import React from "react";
import { Slot } from "../../utils/components/slot/Slot.js";
import { cl } from "../../utils/helpers/index.js";
import { getResponsiveProps, getResponsiveValue } from "../utilities/css.js";
export const PRIMITIVE_PROPS = [
"padding",
"paddingInline",
"paddingBlock",
"margin",
"marginInline",
"marginBlock",
"width",
"minWidth",
"maxWidth",
"height",
"minHeight",
"maxHeight",
"position",
"inset",
"top",
"right",
"bottom",
"left",
"overflow",
"overflowX",
"overflowY",
"flexBasis",
"flexGrow",
"flexShrink",
"gridColumn",
];
export const BasePrimitive = ({ children, className, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, position, inset, top, right, left, bottom, overflow, overflowX, overflowY, flexBasis, flexGrow, flexShrink, gridColumn, }) => {
const style = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, getResponsiveProps("r", "p", "space", padding)), getResponsiveProps("r", "pi", "space", paddingInline)), getResponsiveProps("r", "pb", "space", paddingBlock)), getResponsiveProps("r", "m", "space", margin)), getResponsiveProps("r", "mi", "space", marginInline)), getResponsiveProps("r", "mb", "space", marginBlock)), getResponsiveValue("r", "w", width)), getResponsiveValue("r", "minw", minWidth)), getResponsiveValue("r", "maxw", maxWidth)), getResponsiveValue("r", "h", height)), getResponsiveValue("r", "minh", minHeight)), getResponsiveValue("r", "maxh", maxHeight)), getResponsiveValue("r", "position", position)), getResponsiveProps("r", "inset", "space", inset)), getResponsiveProps("r", "top", "space", top)), getResponsiveProps("r", "right", "space", right)), getResponsiveProps("r", "bottom", "space", bottom)), getResponsiveProps("r", "left", "space", left)), getResponsiveValue("r", "overflow", overflow)), getResponsiveValue("r", "overflowx", overflowX)), getResponsiveValue("r", "overflowy", overflowY)), getResponsiveValue("r", "flex-basis", flexBasis)), getResponsiveValue("r", "flex-grow", flexGrow)), getResponsiveValue("r", "flex-shrink", flexShrink)), getResponsiveValue("r", "grid-column", gridColumn));
return (React.createElement(Slot, { className: cl({
className,
"aksel-r-p": padding,
"aksel-r-pi": paddingInline,
"aksel-r-pb": paddingBlock,
"aksel-r-m": margin,
"aksel-r-mi": marginInline,
"aksel-r-mb": marginBlock,
"aksel-r-w": width,
"aksel-r-minw": minWidth,
"aksel-r-maxw": maxWidth,
"aksel-r-h": height,
"aksel-r-minh": minHeight,
"aksel-r-maxh": maxHeight,
"aksel-r-position": position,
"aksel-r-inset": inset,
"aksel-r-top": top,
"aksel-r-right": right,
"aksel-r-bottom": bottom,
"aksel-r-left": left,
"aksel-r-overflow": overflow,
"aksel-r-overflowx": overflowX,
"aksel-r-overflowy": overflowY,
"aksel-r-flex-basis": flexBasis,
"aksel-r-flex-grow": flexGrow,
"aksel-r-flex-shrink": flexShrink,
"aksel-r-grid-column": gridColumn,
}), style: style }, children));
};
export default BasePrimitive;
//# sourceMappingURL=BasePrimitive.js.map