From 89c254050233623a8de06fd82414284c6d07aeb6 Mon Sep 17 00:00:00 2001 From: Supernova Bot Date: Mon, 24 Jul 2023 19:44:17 +0000 Subject: [PATCH 1/6] Updated styles and tokens --- tokens/default/borders.json | 3 + tokens/default/colors.json | 498 ++++++++++++++++++++++++++ tokens/default/fonts.json | 3 + tokens/default/gradients.json | 3 + tokens/default/measures.json | 621 +++++++++++++++++++++++++++++++++ tokens/default/radii.json | 68 ++++ tokens/default/shadows.json | 134 +++++++ tokens/default/text.json | 3 + tokens/default/typography.json | 416 ++++++++++++++++++++++ 9 files changed, 1749 insertions(+) create mode 100644 tokens/default/borders.json create mode 100644 tokens/default/colors.json create mode 100644 tokens/default/fonts.json create mode 100644 tokens/default/gradients.json create mode 100644 tokens/default/measures.json create mode 100644 tokens/default/radii.json create mode 100644 tokens/default/shadows.json create mode 100644 tokens/default/text.json create mode 100644 tokens/default/typography.json diff --git a/tokens/default/borders.json b/tokens/default/borders.json new file mode 100644 index 00000000..71d48533 --- /dev/null +++ b/tokens/default/borders.json @@ -0,0 +1,3 @@ +{ + "border": {} +} \ No newline at end of file diff --git a/tokens/default/colors.json b/tokens/default/colors.json new file mode 100644 index 00000000..bb535a71 --- /dev/null +++ b/tokens/default/colors.json @@ -0,0 +1,498 @@ +{ + "color": { + "extra": { + "frog": { + "100": { + "value": "#b4efbaff", + "type": "color" + }, + "200": { + "value": "#69ff78ff", + "type": "color" + }, + "300": { + "value": "#00ac11ff", + "type": "color" + } + }, + "pink": { + "100": { + "value": "#ffd7ecff", + "type": "color" + }, + "200": { + "value": "#ff7dc3ff", + "type": "color" + }, + "300": { + "value": "#da2185ff", + "type": "color" + } + }, + "brown": { + "100": { + "value": "#f4e6d5ff", + "type": "color" + }, + "200": { + "value": "#ffba69ff", + "type": "color" + }, + "300": { + "value": "#aa5c00ff", + "type": "color" + } + }, + "purple": { + "100": { + "value": "#f3daffff", + "type": "color" + }, + "200": { + "value": "#e372ffff", + "type": "color" + }, + "300": { + "value": "#ad00ffff", + "type": "color" + } + } + }, + "states": { + "danger": { + "100": { + "value": "#fceaeaff", + "type": "color" + }, + "200": { + "value": "#f4b9b9ff", + "type": "color" + }, + "300": { + "value": "#da1414ff", + "type": "color" + } + }, + "success": { + "100": { + "value": "#e5fff8ff", + "type": "color" + }, + "200": { + "value": "#9ee4ceff", + "type": "color" + }, + "300": { + "value": "#37c99bff", + "type": "color" + } + }, + "warning": { + "100": { + "value": "#ffe8e0ff", + "type": "color" + }, + "200": { + "value": "#ffc5b1ff", + "type": "color" + }, + "300": { + "value": "#fc6533ff", + "type": "color" + } + }, + "informative": { + "100": { + "value": "#f1effeff", + "type": "color" + }, + "200": { + "value": "#bdb7ffff", + "type": "color" + }, + "300": { + "value": "#1500f7ff", + "type": "color" + } + } + }, + "neutral": { + "100": { + "value": "#f9f9f9ff", + "type": "color" + }, + "200": { + "value": "#f5f5f5ff", + "type": "color" + }, + "300": { + "value": "#e2e2e2ff", + "type": "color" + }, + "400": { + "value": "#cbcbcbff", + "type": "color" + }, + "500": { + "value": "#b5b5b5ff", + "type": "color" + }, + "600": { + "value": "#9e9e9eff", + "type": "color" + }, + "700": { + "value": "#878787ff", + "type": "color" + }, + "800": { + "value": "#6e6e71ff", + "type": "color" + }, + "900": { + "value": "#57575aff", + "type": "color" + }, + "1000": { + "value": "#404043ff", + "type": "color" + }, + "white": { + "value": "#ffffffff", + "type": "color" + }, + "black": { + "value": "#141416ff", + "type": "color" + } + }, + "primary": { + "100": { + "value": "#f1effeff", + "type": "color" + }, + "200": { + "value": "#bdb7ffff", + "type": "color" + }, + "300": { + "value": "#948affff", + "type": "color" + }, + "400": { + "value": "#6a5cffff", + "type": "color" + }, + "500": { + "value": "#402effff", + "type": "color" + }, + "600": { + "value": "#1500f7ff", + "type": "color" + }, + "700": { + "value": "#0f00b8ff", + "type": "color" + }, + "800": { + "value": "#0e00a5ff", + "type": "color" + }, + "900": { + "value": "#0b007dff", + "type": "color" + }, + "1000": { + "value": "#070054ff", + "type": "color" + } + }, + "secondary": { + "agrume": { + "100": { + "value": "#fffbfaff", + "type": "color" + }, + "200": { + "value": "#fff3efff", + "type": "color" + }, + "300": { + "value": "#ffeae3ff", + "type": "color" + }, + "400": { + "value": "#ffd9ccff", + "type": "color" + }, + "500": { + "value": "#ffbfaaff", + "type": "color" + }, + "600": { + "value": "#ffa587ff", + "type": "color" + }, + "700": { + "value": "#ff8b64ff", + "type": "color" + }, + "800": { + "value": "#fc6533ff", + "type": "color" + } + }, + "paleyellow": { + "100": { + "value": "#fffcf6ff", + "type": "color" + }, + "200": { + "value": "#fff4dcff", + "type": "color" + }, + "300": { + "value": "#ffecc2ff", + "type": "color" + }, + "400": { + "value": "#ffe3a7ff", + "type": "color" + }, + "500": { + "value": "#ffdb8dff", + "type": "color" + }, + "600": { + "value": "#ffd373ff", + "type": "color" + }, + "700": { + "value": "#ffc850ff", + "type": "color" + }, + "800": { + "value": "#ffae00ff", + "type": "color" + } + }, + "watergreen": { + "100": { + "value": "#f8fdfbff", + "type": "color" + }, + "200": { + "value": "#e1f7f0ff", + "type": "color" + }, + "300": { + "value": "#cbf1e5ff", + "type": "color" + }, + "400": { + "value": "#b4ebd9ff", + "type": "color" + }, + "500": { + "value": "#9ee4ceff", + "type": "color" + }, + "600": { + "value": "#88dec3ff", + "type": "color" + }, + "700": { + "value": "#6ad6b4ff", + "type": "color" + }, + "800": { + "value": "#37c99bff", + "type": "color" + } + } + }, + "text": { + "neutral": { + "strong": { + "value": "{color.neutral.black.value}", + "type": "color" + }, + "standard": { + "value": "{color.neutral.800.value}", + "type": "color" + }, + "weak": { + "value": "{color.neutral.500.value}", + "type": "color" + } + }, + "brand": { + "standard": { + "value": "{color.primary.600.value}", + "type": "color" + } + }, + "danger": { + "standard": { + "value": "{color.states.danger.300.value}", + "type": "color" + }, + "weak": { + "value": "{color.states.danger.200.value}", + "type": "color" + } + }, + "inverse": { + "strong": { + "value": "{color.neutral.white.value}", + "type": "color" + }, + "standard": { + "value": "{color.neutral.100.value}", + "type": "color" + } + }, + "disabled": { + "value": "#00000000", + "type": "color" + } + }, + "component": { + "button": { + "background": { + "secondary": { + "default": { + "value": "#000000ff", + "type": "color" + }, + "hover": { + "value": "{color.neutral.white.value}", + "type": "color" + }, + "disabled": { + "value": "{color.neutral.white.value}", + "type": "color" + } + }, + "error": { + "default": { + "value": "{color.background.danger.standard.value}", + "type": "color" + }, + "disabled": { + "value": "{color.states.danger.100.value}", + "type": "color" + } + }, + "primary": { + "default": { + "value": "{color.background.brand.standard.value}", + "type": "color" + }, + "hover": { + "value": "{color.primary.800.value}", + "type": "color" + }, + "disabled": { + "value": "{color.background.brand.weak.value}", + "type": "color" + } + } + }, + "border": { + "secondary": { + "default": { + "value": "{color.border.neutral.standard.value}", + "type": "color" + }, + "hover": { + "value": "{color.border.neutral.strong.value}", + "type": "color" + }, + "disabled": { + "value": "{color.border.neutral.weak.value}", + "type": "color" + } + }, + "danger": { + "hover": { + "value": "{color.border.danger.standard.value}", + "type": "color" + } + } + }, + "text": { + "on-primary": { + "value": "{color.text.inverse.strong.value}", + "type": "color" + }, + "on-secondary": { + "value": "{color.text.neutral.standard.value}", + "type": "color" + }, + "disabled": { + "value": "{color.text.neutral.weak.value}", + "type": "color" + } + } + } + }, + "background": { + "neutral": { + "standard": { + "value": "{color.neutral.100.value}", + "type": "color" + } + }, + "brand": { + "standard": { + "value": "{color.primary.600.value}", + "type": "color" + }, + "weak": { + "value": "{color.primary.100.value}", + "type": "color" + } + }, + "danger": { + "standard": { + "value": "{color.states.danger.300.value}", + "type": "color" + }, + "weak": { + "value": "{color.states.danger.100.value}", + "type": "color" + } + } + }, + "border": { + "neutral": { + "standard": { + "value": "{color.neutral.400.value}", + "type": "color" + }, + "strong": { + "value": "{color.neutral.600.value}", + "type": "color" + }, + "weak": { + "value": "{color.neutral.200.value}", + "type": "color" + } + }, + "brand": { + "standard": { + "value": "{color.primary.600.value}", + "type": "color" + } + }, + "danger": { + "standard": { + "value": "{color.states.danger.300.value}", + "type": "color" + } + } + } + } +} \ No newline at end of file diff --git a/tokens/default/fonts.json b/tokens/default/fonts.json new file mode 100644 index 00000000..b1d025a6 --- /dev/null +++ b/tokens/default/fonts.json @@ -0,0 +1,3 @@ +{ + "font": {} +} \ No newline at end of file diff --git a/tokens/default/gradients.json b/tokens/default/gradients.json new file mode 100644 index 00000000..11d1d34b --- /dev/null +++ b/tokens/default/gradients.json @@ -0,0 +1,3 @@ +{ + "gradient": {} +} diff --git a/tokens/default/measures.json b/tokens/default/measures.json new file mode 100644 index 00000000..c704c128 --- /dev/null +++ b/tokens/default/measures.json @@ -0,0 +1,621 @@ +{ + "measure": { + "font-size": { + "fontsize": { + "0": { + "value": { + "measure": { + "type": "size", + "value": 11 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "1": { + "value": { + "measure": { + "type": "size", + "value": 12 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "2": { + "value": { + "measure": { + "type": "size", + "value": 14 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "3": { + "value": { + "measure": { + "type": "size", + "value": 16 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "4": { + "value": { + "measure": { + "type": "size", + "value": 18 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "5": { + "value": { + "measure": { + "type": "size", + "value": 24 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + } + }, + "spacing": { + "large-spaces": { + "l-space-xs": { + "value": { + "measure": { + "type": "size", + "value": 40 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "l-space-s": { + "value": { + "measure": { + "type": "size", + "value": 48 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "l-space-md": { + "value": { + "measure": { + "type": "size", + "value": 64 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-lg": { + "value": { + "measure": { + "type": "size", + "value": 80 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "l-space-xl": { + "value": { + "measure": { + "type": "size", + "value": 96 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "l-space-xxl": { + "value": { + "measure": { + "type": "size", + "value": 128 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + }, + "small-spaces": { + "s-space-xxs": { + "value": { + "measure": { + "type": "size", + "value": 4 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-xs": { + "value": { + "measure": { + "type": "size", + "value": 8 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-s": { + "value": { + "measure": { + "type": "size", + "value": 12 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-md": { + "value": { + "measure": { + "type": "size", + "value": 16 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-lg": { + "value": { + "measure": { + "type": "size", + "value": 20 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-xl": { + "value": { + "measure": { + "type": "size", + "value": 24 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s-space-xxl": { + "value": { + "measure": { + "type": "size", + "value": 32 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + }, + "layout": { + "xs": { + "value": { + "measure": { + "type": "size", + "value": 24 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s": { + "value": { + "measure": { + "type": "size", + "value": 32 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "m": { + "value": { + "measure": { + "type": "size", + "value": 40 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "l": { + "value": { + "measure": { + "type": "size", + "value": 48 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "xl": { + "value": { + "measure": { + "type": "size", + "value": 56 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + }, + "component": { + "button-l": { + "padding": { + "value": "{measure.spacing.l.value}", + "type": "measure" + } + }, + "button-m": { + "padding": { + "value": "{measure.spacing.m.value}", + "type": "measure" + } + }, + "button-s": { + "padding": { + "value": "{measure.spacing.s.value}", + "type": "measure" + } + } + }, + "no-space": { + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "xs": { + "value": { + "measure": { + "type": "size", + "value": 8 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "s": { + "value": { + "measure": { + "type": "size", + "value": 12 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "m": { + "value": { + "measure": { + "type": "size", + "value": 16 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "l": { + "value": { + "measure": { + "type": "size", + "value": 20 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "xl": { + "value": { + "measure": { + "type": "size", + "value": 32 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + }, + "line-height": { + "lineheights": { + "0": { + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "1": { + "value": { + "measure": { + "type": "size", + "value": 26 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "2": { + "value": { + "measure": { + "type": "size", + "value": 24 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "3": { + "value": { + "measure": { + "type": "size", + "value": 22 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "4": { + "value": { + "measure": { + "type": "size", + "value": 20 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + } + }, + "letter-spacing": { + "letterspacing": { + "0": { + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "percent" + } + }, + "type": "measure" + }, + "1": { + "value": { + "measure": { + "type": "size", + "value": 8 + }, + "unit": { + "type": "string", + "value": "percent" + } + }, + "type": "measure" + } + } + }, + "dimension": { + "paragraphindent": { + "0": { + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + } + }, + "paragraph-spacing": { + "paragraphspacing": { + "0": { + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + }, + "1": { + "value": { + "measure": { + "type": "size", + "value": 8 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + } + }, + "sizing": { + "component": { + "button-l": { + "height": { + "value": { + "measure": { + "type": "size", + "value": 50 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + }, + "button-m": { + "height": { + "value": { + "measure": { + "type": "size", + "value": 40 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + }, + "button-s": { + "height": { + "value": { + "measure": { + "type": "size", + "value": 32 + }, + "unit": { + "type": "string", + "value": "pixels" + } + }, + "type": "measure" + } + } + } + } + } +} \ No newline at end of file diff --git a/tokens/default/radii.json b/tokens/default/radii.json new file mode 100644 index 00000000..1346b803 --- /dev/null +++ b/tokens/default/radii.json @@ -0,0 +1,68 @@ +{ + "radius": { + "border-radius": { + "radius-default": { + "value": { + "radius": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 4 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + } + }, + "type": "radius" + }, + "radius-md": { + "value": { + "radius": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 8 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + } + }, + "type": "radius" + }, + "radius-lg": { + "value": { + "radius": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 12 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + } + }, + "type": "radius" + }, + "button": { + "value": "{radius.border-radius.radius-default.value}", + "type": "radius" + }, + "card": { + "value": "{radius.border-radius.radius-md.value}", + "type": "radius" + } + } + } +} \ No newline at end of file diff --git a/tokens/default/shadows.json b/tokens/default/shadows.json new file mode 100644 index 00000000..91ed158d --- /dev/null +++ b/tokens/default/shadows.json @@ -0,0 +1,134 @@ +{ + "shadow": { + "shadow-card": { + "value": { + "color": { + "type": "color", + "value": "#0000000a" + }, + "x": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "y": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "radius": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 6 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "spread": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "opacity": { + "type": "size", + "value": 1 + } + }, + "type": "shadow" + }, + "shadow-modal": { + "value": { + "color": { + "type": "color", + "value": "#0000000a" + }, + "x": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "y": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "radius": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 32 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "spread": { + "type": "measure", + "value": { + "measure": { + "type": "size", + "value": 0 + }, + "unit": { + "type": "string", + "value": "pixels" + } + } + }, + "opacity": { + "type": "size", + "value": 1 + } + }, + "type": "shadow" + } + } +} diff --git a/tokens/default/text.json b/tokens/default/text.json new file mode 100644 index 00000000..89f1152b --- /dev/null +++ b/tokens/default/text.json @@ -0,0 +1,3 @@ +{ + "text": {} +} diff --git a/tokens/default/typography.json b/tokens/default/typography.json new file mode 100644 index 00000000..df73f95c --- /dev/null +++ b/tokens/default/typography.json @@ -0,0 +1,416 @@ +{ + "typography": { + "ui": { + "tableheader-11px": { + "regular": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Regular" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.0.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.1.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.0.value}" + } + }, + "type": "typography" + }, + "bold": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Bold" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.0.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.1.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.0.value}" + } + }, + "type": "typography" + } + } + }, + "body": { + "l-18px": { + "regular": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Regular" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.4.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.1.value}" + } + }, + "type": "typography" + }, + "bold": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Bold" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.4.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.1.value}" + } + }, + "type": "typography" + } + }, + "m-16px": { + "regular": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Regular" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.3.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.2.value}" + } + }, + "type": "typography" + }, + "bold": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Bold" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.3.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.2.value}" + } + }, + "type": "typography" + } + }, + "s-14px": { + "regular": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Regular" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.2.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.3.value}" + } + }, + "type": "typography" + }, + "bold": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Bold" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.2.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.3.value}" + } + }, + "type": "typography" + } + }, + "xs-12px": { + "regular": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Regular" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.1.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.4.value}" + } + }, + "type": "typography" + }, + "bold": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Bold" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.1.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.4.value}" + } + }, + "type": "typography" + } + } + }, + "headings": { + "h1-24px": { + "value": { + "font": { + "type": "font", + "value": { + "family": { + "type": "string", + "value": "Heebo" + }, + "subfamily": { + "type": "string", + "value": "Bold" + } + } + }, + "fontSize": { + "type": "measure", + "value": "{measure.font-size.fontsize.5.value}" + }, + "textDecoration": "None", + "textCase": "Original", + "letterSpacing": { + "type": "measure", + "value": "{measure.letter-spacing.letterspacing.0.value}" + }, + "paragraphIndent": { + "type": "measure", + "value": "{measure.dimension.paragraphindent.0.value}" + }, + "lineHeight": { + "type": "measure", + "value": "{measure.line-height.lineheights.0.value}" + } + }, + "type": "typography" + } + } + } +} From 57685e35ad05e8903150a4860aed8d1756b07f48 Mon Sep 17 00:00:00 2001 From: Supernova Bot Date: Tue, 25 Jul 2023 13:55:58 +0000 Subject: [PATCH 2/6] Updated styles and tokens --- tokens/default/colors.json | 190 +++++++++++++++++------------------ tokens/default/measures.json | 35 ++----- 2 files changed, 102 insertions(+), 123 deletions(-) diff --git a/tokens/default/colors.json b/tokens/default/colors.json index bb535a71..b42d27ed 100644 --- a/tokens/default/colors.json +++ b/tokens/default/colors.json @@ -313,6 +313,32 @@ } }, "text": { + "brand": { + "standard": { + "value": "{color.primary.600.value}", + "type": "color" + } + }, + "danger": { + "standard": { + "value": "{color.states.danger.300.value}", + "type": "color" + }, + "weak": { + "value": "{color.states.danger.200.value}", + "type": "color" + } + }, + "inverse": { + "strong": { + "value": "{color.neutral.white.value}", + "type": "color" + }, + "standard": { + "value": "{color.neutral.100.value}", + "type": "color" + } + }, "neutral": { "strong": { "value": "{color.neutral.black.value}", @@ -327,6 +353,12 @@ "type": "color" } }, + "disabled": { + "value": "#00000000", + "type": "color" + } + }, + "border": { "brand": { "standard": { "value": "{color.primary.600.value}", @@ -337,44 +369,90 @@ "standard": { "value": "{color.states.danger.300.value}", "type": "color" + } + }, + "neutral": { + "standard": { + "value": "{color.neutral.400.value}", + "type": "color" + }, + "strong": { + "value": "{color.neutral.600.value}", + "type": "color" }, "weak": { - "value": "{color.states.danger.200.value}", + "value": "{color.neutral.200.value}", + "type": "color" + } + } + }, + "background": { + "brand": { + "standard": { + "value": "{color.primary.600.value}", + "type": "color" + }, + "weak": { + "value": "{color.primary.200.value}", "type": "color" } }, - "inverse": { - "strong": { - "value": "{color.neutral.white.value}", + "danger": { + "standard": { + "value": "{color.states.danger.300.value}", "type": "color" }, + "weak": { + "value": "{color.states.danger.100.value}", + "type": "color" + } + }, + "neutral": { "standard": { "value": "{color.neutral.100.value}", "type": "color" } - }, - "disabled": { - "value": "#00000000", - "type": "color" } }, "component": { "button": { - "background": { + "text": { + "on-primary": { + "value": "{color.text.inverse.strong.value}", + "type": "color" + }, + "on-secondary": { + "value": "{color.text.neutral.standard.value}", + "type": "color" + }, + "disabled": { + "value": "{color.text.neutral.weak.value}", + "type": "color" + } + }, + "border": { + "danger": { + "hover": { + "value": "{color.border.danger.standard.value}", + "type": "color" + } + }, "secondary": { "default": { - "value": "#000000ff", + "value": "{color.border.neutral.standard.value}", "type": "color" }, "hover": { - "value": "{color.neutral.white.value}", + "value": "{color.border.neutral.strong.value}", "type": "color" }, "disabled": { - "value": "{color.neutral.white.value}", + "value": "{color.border.neutral.weak.value}", "type": "color" } - }, + } + }, + "background": { "error": { "default": { "value": "{color.background.danger.standard.value}", @@ -398,99 +476,21 @@ "value": "{color.background.brand.weak.value}", "type": "color" } - } - }, - "border": { + }, "secondary": { "default": { - "value": "{color.border.neutral.standard.value}", + "value": "{color.neutral.white.value}", "type": "color" }, "hover": { - "value": "{color.border.neutral.strong.value}", + "value": "{color.neutral.white.value}", "type": "color" }, "disabled": { - "value": "{color.border.neutral.weak.value}", - "type": "color" - } - }, - "danger": { - "hover": { - "value": "{color.border.danger.standard.value}", + "value": "{color.neutral.white.value}", "type": "color" } } - }, - "text": { - "on-primary": { - "value": "{color.text.inverse.strong.value}", - "type": "color" - }, - "on-secondary": { - "value": "{color.text.neutral.standard.value}", - "type": "color" - }, - "disabled": { - "value": "{color.text.neutral.weak.value}", - "type": "color" - } - } - } - }, - "background": { - "neutral": { - "standard": { - "value": "{color.neutral.100.value}", - "type": "color" - } - }, - "brand": { - "standard": { - "value": "{color.primary.600.value}", - "type": "color" - }, - "weak": { - "value": "{color.primary.100.value}", - "type": "color" - } - }, - "danger": { - "standard": { - "value": "{color.states.danger.300.value}", - "type": "color" - }, - "weak": { - "value": "{color.states.danger.100.value}", - "type": "color" - } - } - }, - "border": { - "neutral": { - "standard": { - "value": "{color.neutral.400.value}", - "type": "color" - }, - "strong": { - "value": "{color.neutral.600.value}", - "type": "color" - }, - "weak": { - "value": "{color.neutral.200.value}", - "type": "color" - } - }, - "brand": { - "standard": { - "value": "{color.primary.600.value}", - "type": "color" - } - }, - "danger": { - "standard": { - "value": "{color.states.danger.300.value}", - "type": "color" } } } diff --git a/tokens/default/measures.json b/tokens/default/measures.json index c704c128..8d1621c8 100644 --- a/tokens/default/measures.json +++ b/tokens/default/measures.json @@ -324,23 +324,17 @@ } }, "component": { - "button-l": { + "button-s": { "padding": { - "value": "{measure.spacing.l.value}", + "value": "{measure.spacing.s.value}", "type": "measure" } }, - "button-m": { + "button-regular": { "padding": { "value": "{measure.spacing.m.value}", "type": "measure" } - }, - "button-s": { - "padding": { - "value": "{measure.spacing.s.value}", - "type": "measure" - } } }, "no-space": { @@ -570,27 +564,12 @@ }, "sizing": { "component": { - "button-l": { - "height": { - "value": { - "measure": { - "type": "size", - "value": 50 - }, - "unit": { - "type": "string", - "value": "pixels" - } - }, - "type": "measure" - } - }, - "button-m": { + "button-s": { "height": { "value": { "measure": { "type": "size", - "value": 40 + "value": 32 }, "unit": { "type": "string", @@ -600,12 +579,12 @@ "type": "measure" } }, - "button-s": { + "button-regular": { "height": { "value": { "measure": { "type": "size", - "value": 32 + "value": 42 }, "unit": { "type": "string", From 1d58fdb5fee55c9bfde52647b323b2981b0b8f7b Mon Sep 17 00:00:00 2001 From: Dmitry Naumkin Date: Tue, 25 Jul 2023 12:59:00 +0300 Subject: [PATCH 3/6] Add buttons example --- README.md | 227 ++- build.js | 50 + package.json | 12 +- src/App.tsx | 11 +- src/build/theme.ts | 2285 +++++++++++++++++++++++++++++++ src/components/Button/index.tsx | 21 + src/components/Button/styles.ts | 44 + src/components/Button/types.ts | 3 + src/index.css | 10 + src/styles.ts | 8 + yarn.lock | 1402 ++++++++++++------- 11 files changed, 3510 insertions(+), 563 deletions(-) create mode 100644 build.js create mode 100644 src/build/theme.ts create mode 100644 src/components/Button/index.tsx create mode 100644 src/components/Button/styles.ts create mode 100644 src/components/Button/types.ts create mode 100644 src/styles.ts diff --git a/README.md b/README.md index b58e0af8..985b48fe 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,181 @@ -# Getting Started with Create React App - -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - -## Available Scripts - -In the project directory, you can run: - -### `yarn start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.\ -You will also see any lint errors in the console. - -### `yarn test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `yarn build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `yarn eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). +# Basic Style Dictionary + +This example code is bare-bones to show you what this framework can do. If you have the style-dictionary module installed globally, you can `cd` into this directory and run: +```bash +style-dictionary build +``` + +You should see something like this output: +``` +Copying starter files... + +Source style dictionary starter files created! + +Running `style-dictionary build` for the first time to generate build artifacts. + + +scss +✔︎ build/scss/_variables.scss + +android +✔︎ build/android/font_dimens.xml +✔︎ build/android/colors.xml + +compose +✔︎ build/compose/StyleDictionaryColor.kt +✔︎ build/compose/StyleDictionarySize.kt + +ios +✔︎ build/ios/StyleDictionaryColor.h +✔︎ build/ios/StyleDictionaryColor.m +✔︎ build/ios/StyleDictionarySize.h +✔︎ build/ios/StyleDictionarySize.m + +ios-swift +✔︎ build/ios-swift/StyleDictionary.swift + +ios-swift-separate-enums +✔︎ build/ios-swift/StyleDictionaryColor.swift +✔︎ build/ios-swift/StyleDictionarySize.swift +``` + +Good for you! You have now built your first style dictionary! Moving on, take a look at what we have built. This should have created a build directory and it should look like this: +``` +├── README.md +├── config.json +├── tokens/ +│ ├── color/ +│ ├── base.json +│ ├── font.json +│ ├── size/ +│ ├── font.json +├── build/ +│ ├── android/ +│ ├── font_dimens.xml +│ ├── colors.xml +│ ├── compose/ +│ ├── StyleDictionaryColor.kt +│ ├── StyleDictionarySize.kt +│ ├── scss/ +│ ├── _variables.scss +│ ├── ios/ +│ ├── StyleDictionaryColor.h +│ ├── StyleDictionaryColor.m +│ ├── StyleDictionarySize.h +│ ├── StyleDictionarySize.m +│ ├── ios-swift/ +│ ├── StyleDictionary.swift +│ ├── StyleDictionaryColor.swift +│ ├── StyleDictionarySize.swift +``` + +If you open `config.json` you will see there are 5 platforms defined: scss, android, compose, ios, and ios-swift. Each platform has a transformGroup, buildPath, and files. The buildPath and files of the platform should match up to the files what were built. The files built should look like these: + +**Android** +```xml + + + 12.00sp + 16.00sp + 32.00sp + 16.00sp + + + + + #ffcccccc + #ff999999 + #ff111111 + #ffff0000 + #ff00ff00 + #ffff0000 + #ff00ff00 + #ffcccccc + +``` + +**Compose** +```kotlin +object StyleDictionaryColor { + val colorBaseGrayDark = Color(0xff111111) + val colorBaseGrayLight = Color(0xffcccccc) + val colorBaseGrayMedium = Color(0xff999999) + val colorBaseGreen = Color(0xff00ff00) + val colorBaseRed = Color(0xffff0000) + val colorFontBase = Color(0xffff0000) + val colorFontSecondary = Color(0xff00ff00) + val colorFontTertiary = Color(0xffcccccc) +} + +object StyleDictionarySize { + /** the base size of the font */ + val sizeFontBase = 16.00.sp + /** the large size of the font */ + val sizeFontLarge = 32.00.sp + /** the medium size of the font */ + val sizeFontMedium = 16.00.sp + /** the small size of the font */ + val sizeFontSmall = 12.00.sp +} +``` + +**SCSS** +```scss +// variables.scss +$color-base-gray-light: #cccccc; +$color-base-gray-medium: #999999; +$color-base-gray-dark: #111111; +$color-base-red: #ff0000; +$color-base-green: #00ff00; +$color-font-base: #ff0000; +$color-font-secondary: #00ff00; +$color-font-tertiary: #cccccc; +$size-font-small: 0.75rem; +$size-font-medium: 1rem; +$size-font-large: 2rem; +$size-font-base: 1rem; +``` + +**iOS** +```objc +#import "StyleDictionaryColor.h" + +@implementation StyleDictionaryColor + ++ (UIColor *)color:(StyleDictionaryColorName)colorEnum{ + return [[self values] objectAtIndex:colorEnum]; +} + ++ (NSArray *)values { + static NSArray* colorArray; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + colorArray = @[ +[UIColor colorWithRed:0.800f green:0.800f blue:0.800f alpha:1.000f], +[UIColor colorWithRed:0.600f green:0.600f blue:0.600f alpha:1.000f], +[UIColor colorWithRed:0.067f green:0.067f blue:0.067f alpha:1.000f], +[UIColor colorWithRed:1.000f green:0.000f blue:0.000f alpha:1.000f], +[UIColor colorWithRed:0.000f green:1.000f blue:0.000f alpha:1.000f], +[UIColor colorWithRed:1.000f green:0.000f blue:0.000f alpha:1.000f], +[UIColor colorWithRed:0.000f green:1.000f blue:0.000f alpha:1.000f], +[UIColor colorWithRed:0.800f green:0.800f blue:0.800f alpha:1.000f] + ]; + }); + + return colorArray; +} + +@end +``` + +Pretty nifty! This shows a few things happening: +1. The build system does a deep merge of all the token JSON files defined in the `source` attribute of `config.json`. This allows you to split up the token JSON files however you want. There are 2 JSON files with `color` as the top level key, but they get merged properly. +1. The build system resolves references to other design tokens. `{size.font.medium.value}` gets resolved properly. +1. The build system handles references to token values in other files as well as you can see in `tokens/color/font.json`. + +Now let's make a change and see how that affects things. Open up `tokens/color/base.json` and change `"#111111"` to `"#000000"`. After you make that change, save the file and re-run the build command `style-dictionary build`. Open up the build files and take a look. + +**Huzzah!** + +Now go forth and create! Take a look at all the built-in [transforms](https://amzn.github.io/style-dictionary/#/transforms?id=pre-defined-transforms) and [formats](https://amzn.github.io/style-dictionary/#/formats?id=pre-defined-formats). diff --git a/build.js b/build.js new file mode 100644 index 00000000..0bb8cf80 --- /dev/null +++ b/build.js @@ -0,0 +1,50 @@ +const StyleDictionary = require('style-dictionary').extend({ + source: ['tokens/default/*.json'], + platforms: { + js: { + transformGroup: 'web', + buildPath: 'src/build/', + files: [ + { + destination: 'theme.ts', + format: 'javascript/esm', + }, + ], + }, + }, +}); + +const { fileHeader } = StyleDictionary.formatHelpers; + +const javascriptEsm = ({ dictionary, file, options, platform = {} }) => { + const { prefix } = platform; + const tokens = prefix ? { [prefix]: dictionary.tokens } : dictionary.tokens; + const output = + fileHeader({ file }) + + `export const theme = \n${JSON.stringify( + jsonToNestedValue(tokens), + null, + 2 + )}\n`; + return output; +}; + +const jsonToNestedValue = (token) => { + // is non-object value + if (!token || typeof token !== 'object') return token; + // is design token + if ('value' in token) return token.value; + // is obj + const nextObj = {}; + for (const [prop, value] of Object.entries(token)) { + nextObj[prop] = jsonToNestedValue(value); + } + return nextObj; +}; + +StyleDictionary.registerFormat({ + name: 'javascript/esm', + formatter: javascriptEsm, +}); + +StyleDictionary.buildAllPlatforms(); diff --git a/package.json b/package.json index 8b63872f..ffb74f66 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,15 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", + "styled-components": "^6.0.5", "typescript": "^4.4.2", "web-vitals": "^2.1.0" }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "build-dict": "node build.js" }, "eslintConfig": { "extends": [ @@ -28,6 +29,13 @@ "react-app/jest" ] }, + "devDependencies": { + "color2k": "^2.0.2", + "eslint": "^8.45.0", + "prettier": "^3.0.0", + "style-dictionary": "^3.8.0", + "style-dictionary-utils": "^1.6.1" + }, "browserslist": { "production": [ ">0.2%", diff --git a/src/App.tsx b/src/App.tsx index 62320e1f..006ffd81 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,16 @@ import React from 'react'; +import { Container } from './styles'; +import { Button } from './components/Button'; function App() { - return
Empty
; + return ( + +