@equinor/fusion-web-theme
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ import type { Properties } from 'csstype'; | ||
} | ||
export declare type StyleAttribute = { | ||
export type StyleAttribute = { | ||
attribute: string; | ||
@@ -8,0 +8,0 @@ value?: string | number; |
const camel2kebab = (x) => x.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase(); | ||
// Type of style(). Previous type caused an error in dependant apps. | ||
// type CSSProperties = Omit<StandardProperties, 'fontSizeAdjust'>; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export class StyleProperty { | ||
constructor(name, value) { | ||
this.name = name; | ||
this.value = value; | ||
} | ||
name; | ||
value; | ||
static makeCssVar(element, module) { | ||
@@ -23,2 +22,6 @@ return `--fusion-${element}__${module}`; | ||
} | ||
constructor(name, value) { | ||
this.name = name; | ||
this.value = value; | ||
} | ||
get style() { | ||
@@ -25,0 +28,0 @@ const { value, attributes } = this; |
import StyleProperty, { CSSProperties, StyleAttribute } from '../style-property'; | ||
export declare type Color = { | ||
export type Color = { | ||
hex: string; | ||
@@ -7,3 +7,3 @@ hsla: string; | ||
}; | ||
export declare type ColorStyleAttribute = 'color'; | ||
export type ColorStyleAttribute = 'color'; | ||
export declare class ColorStyleProperty extends StyleProperty<Color, ColorStyleAttribute> { | ||
@@ -10,0 +10,0 @@ get attributes(): Record<ColorStyleAttribute, StyleAttribute>; |
import { tokens } from '@equinor/eds-tokens'; | ||
import { StyleAttribute, StyleProperty, CSSProperties } from '../style-property'; | ||
export declare type ElevationType = keyof typeof tokens.elevation; | ||
export declare type ElevationAttribute = 'shadow'; | ||
export type ElevationType = keyof typeof tokens.elevation; | ||
export type ElevationAttribute = 'shadow'; | ||
export declare class ElevationStyleProperty extends StyleProperty<string, ElevationAttribute> { | ||
@@ -6,0 +6,0 @@ get attributes(): Record<ElevationAttribute, StyleAttribute>; |
@@ -16,3 +16,3 @@ export declare const styles: { | ||
input: Record<"text" | "label" | "text_monospaced" | "helper", import("./typography").TypographyStyleProperty>; | ||
navigation: Record<"button" | "label" | "menu_title" | "menu_tabs" | "drawer_active" | "drawer_inactive" | "breadcrumb" | "breadcrumb_hover", import("./typography").TypographyStyleProperty>; | ||
navigation: Record<"button" | "label" | "menu_title" | "menu_tabs" | "drawer_active" | "drawer_inactive" | "breadcrumb" | "breadcrumb_hover" | "menu_title_hover", import("./typography").TypographyStyleProperty>; | ||
paragraph: Record<"overline" | "caption" | "body_short_italic" | "meta" | "body_short" | "body_short_bold_italic" | "body_short_bold" | "body_short_link" | "ingress" | "body_long" | "body_long_link" | "body_long_italic" | "body_long_bold" | "body_long_bold_italic", import("./typography").TypographyStyleProperty>; | ||
@@ -19,0 +19,0 @@ table: Record<"cell_header" | "cell_text" | "cell_text_bold" | "cell_text_link" | "cell_numeric_monospaced", import("./typography").TypographyStyleProperty>; |
import { StyleProperty, CSSProperties } from '../style-property'; | ||
export declare type SpacingStyleAttribute = 'padding'; | ||
export type SpacingStyleAttribute = 'padding'; | ||
export declare class SpacingStyleProperty extends StyleProperty<string, SpacingStyleAttribute> { | ||
@@ -4,0 +4,0 @@ get attributes(): { |
import { Typography } from '@equinor/eds-tokens'; | ||
import { StyleProperty, StyleAttribute } from '../style-property'; | ||
declare type TypographyAttribute = keyof Typography; | ||
type TypographyAttribute = keyof Typography; | ||
export declare class TypographyStyleProperty extends StyleProperty<Typography, TypographyAttribute> { | ||
@@ -56,3 +56,3 @@ get attributes(): { | ||
input: Record<"text" | "label" | "text_monospaced" | "helper", TypographyStyleProperty>; | ||
navigation: Record<"button" | "label" | "menu_title" | "menu_tabs" | "drawer_active" | "drawer_inactive" | "breadcrumb" | "breadcrumb_hover", TypographyStyleProperty>; | ||
navigation: Record<"button" | "label" | "menu_title" | "menu_tabs" | "drawer_active" | "drawer_inactive" | "breadcrumb" | "breadcrumb_hover" | "menu_title_hover", TypographyStyleProperty>; | ||
paragraph: Record<"overline" | "caption" | "body_short_italic" | "meta" | "body_short" | "body_short_bold_italic" | "body_short_bold" | "body_short_link" | "ingress" | "body_long" | "body_long_link" | "body_long_italic" | "body_long_bold" | "body_long_bold_italic", TypographyStyleProperty>; | ||
@@ -59,0 +59,0 @@ table: Record<"cell_header" | "cell_text" | "cell_text_bold" | "cell_text_link" | "cell_numeric_monospaced", TypographyStyleProperty>; |
@@ -58,2 +58,3 @@ import { tokens } from '@equinor/eds-tokens'; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const createStyleProperty = (obj, name) => Object.keys(obj).reduce((cur, key) => Object.assign(cur, { [key]: new TypographyStyleProperty(`${name}-${key}`, obj[key]) }), {}); | ||
@@ -60,0 +61,0 @@ export const typography = { |
{ | ||
"name": "@equinor/fusion-web-theme", | ||
"version": "0.1.7", | ||
"version": "0.1.9", | ||
"description": "fusion web theme", | ||
@@ -16,4 +16,6 @@ "keywords": [ | ||
"files": [ | ||
"dist/" | ||
"dist/", | ||
"src/" | ||
], | ||
"type": "module", | ||
"publishConfig": { | ||
@@ -28,3 +30,2 @@ "access": "public" | ||
"scripts": { | ||
"test": "jest --passWithNoTests", | ||
"lint": "eslint 'src/**/*.{js,ts,tsx}' --fix", | ||
@@ -40,9 +41,10 @@ "clean": "rimraf ./dist", | ||
"dependencies": { | ||
"@equinor/eds-tokens": "0.5.5", | ||
"csstype": "^3.0.10" | ||
"@equinor/eds-tokens": "0.9.2", | ||
"csstype": "^3.1.3" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "^3.0.2" | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.4.2" | ||
}, | ||
"gitHead": "f62e299bb042b2e6d873277195b23a9114d8fcf6" | ||
"gitHead": "aada67e4315462825c4e49799ef64c9dad6c2a24" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
43522
19.02%30
15.38%706
65.34%Yes
NaN2
100%1
Infinity%+ Added
- Removed
Updated
Updated