UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

75 lines 4.77 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BasePrimitive = exports.PRIMITIVE_PROPS = void 0; const react_1 = __importDefault(require("react")); const Slot_1 = require("../../slot/Slot"); const Theme_1 = require("../../theme/Theme"); const css_1 = require("../utilities/css"); exports.PRIMITIVE_PROPS = [ "className", "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", ]; 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 themeContext = (0, Theme_1.useThemeInternal)(false); const { cn } = (0, Theme_1.useRenameCSS)(); const prefix = (themeContext === null || themeContext === void 0 ? void 0 : themeContext.isDarkside) ? "ax" : "a"; 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({}, (0, css_1.getResponsiveProps)(prefix, "r", "p", "spacing", padding)), (0, css_1.getResponsiveProps)(prefix, "r", "pi", "spacing", paddingInline)), (0, css_1.getResponsiveProps)(prefix, "r", "pb", "spacing", paddingBlock)), (0, css_1.getResponsiveProps)(prefix, "r", "m", "spacing", margin)), (0, css_1.getResponsiveProps)(prefix, "r", "mi", "spacing", marginInline)), (0, css_1.getResponsiveProps)(prefix, "r", "mb", "spacing", marginBlock)), (0, css_1.getResponsiveValue)(prefix, "r", "w", width)), (0, css_1.getResponsiveValue)(prefix, "r", "minw", minWidth)), (0, css_1.getResponsiveValue)(prefix, "r", "maxw", maxWidth)), (0, css_1.getResponsiveValue)(prefix, "r", "h", height)), (0, css_1.getResponsiveValue)(prefix, "r", "minh", minHeight)), (0, css_1.getResponsiveValue)(prefix, "r", "maxh", maxHeight)), (0, css_1.getResponsiveValue)(prefix, "r", "position", position)), (0, css_1.getResponsiveProps)(prefix, "r", "inset", "spacing", inset)), (0, css_1.getResponsiveProps)(prefix, "r", "top", "spacing", top)), (0, css_1.getResponsiveProps)(prefix, "r", "right", "spacing", right)), (0, css_1.getResponsiveProps)(prefix, "r", "bottom", "spacing", bottom)), (0, css_1.getResponsiveProps)(prefix, "r", "left", "spacing", left)), (0, css_1.getResponsiveValue)(prefix, "r", "overflow", overflow)), (0, css_1.getResponsiveValue)(prefix, "r", "overflowx", overflowX)), (0, css_1.getResponsiveValue)(prefix, "r", "overflowy", overflowY)), (0, css_1.getResponsiveValue)(prefix, "r", "flex-basis", flexBasis)), (0, css_1.getResponsiveValue)(prefix, "r", "flex-grow", flexGrow)), (0, css_1.getResponsiveValue)(prefix, "r", "flex-shrink", flexShrink)), (0, css_1.getResponsiveValue)(prefix, "r", "grid-column", gridColumn)); return (react_1.default.createElement(Slot_1.Slot, { className: cn({ className, "navds-r-p": padding, "navds-r-pi": paddingInline, "navds-r-pb": paddingBlock, "navds-r-m": margin, "navds-r-mi": marginInline, "navds-r-mb": marginBlock, "navds-r-w": width, "navds-r-minw": minWidth, "navds-r-maxw": maxWidth, "navds-r-h": height, "navds-r-minh": minHeight, "navds-r-maxh": maxHeight, "navds-r-position": position, "navds-r-inset": inset, "navds-r-top": top, "navds-r-right": right, "navds-r-bottom": bottom, "navds-r-left": left, "navds-r-overflow": overflow, "navds-r-overflowx": overflowX, "navds-r-overflowy": overflowY, "navds-r-flex-basis": flexBasis, "navds-r-flex-grow": flexGrow, "navds-r-flex-shrink": flexShrink, "navds-r-grid-column": gridColumn, }), style: style }, children)); }; exports.BasePrimitive = BasePrimitive; exports.default = exports.BasePrimitive; //# sourceMappingURL=BasePrimitive.js.map