@hitachivantara/uikit-uno-preset
Version:
UI Kit UnoCSS preset.
52 lines (51 loc) • 1.46 kB
JavaScript
import { next, theme } from "@hitachivantara/uikit-styles";
//#region src/theme.ts
var { light: defaultColors } = next.colors;
var { base, ...hvSpacing } = next.space;
/** HV breakpoints with added `px` suffix */
var hvBreakpoints = Object.entries(next.breakpoints.values).map(([key, value]) => [key, `${value}px`]);
var hvZIndex = Object.entries(next.zIndices).map(([key, value]) => [key, `${value}`]);
/** Extends the current theme with the Design System utilities */
var extendTheme = (baseTheme) => ({
...baseTheme,
borderRadius: {
DEFAULT: theme.radii.base,
...theme.radii
},
breakpoints: Object.fromEntries(hvBreakpoints),
containers: Object.fromEntries(hvBreakpoints.map(([k, v]) => [k, `(min-width: ${v})`])),
spacing: {
...baseTheme.spacing,
DEFAULT: hvSpacing.xs,
...hvSpacing
},
zIndex: Object.fromEntries(hvZIndex),
colors: {
...baseTheme.colors,
...defaultColors,
...theme.colors
},
accentColor: { DEFAULT: defaultColors.primary },
textColor: { DEFAULT: defaultColors.text },
backgroundColor: { DEFAULT: defaultColors.bgPage },
fontFamily: {
body: next.fontFamily.body,
sans: next.fontFamily.body,
serif: next.fontFamily.body,
mono: "monospace"
},
lineHeight: {
DEFAULT: next.lineHeights.base,
...next.lineHeights
},
fontSize: {
DEFAULT: next.fontSizes.base,
...next.fontSizes
},
fontWeight: {
DEFAULT: next.fontWeights.normal,
...next.fontWeights
}
});
//#endregion
export { extendTheme };