diff --git a/design-tokens-manager/src/App.jsx b/design-tokens-manager/src/App.jsx
index 87e70e126..f31b1308a 100644
--- a/design-tokens-manager/src/App.jsx
+++ b/design-tokens-manager/src/App.jsx
@@ -1,7 +1,12 @@
import { useContext, useEffect, useState } from 'react';
+import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
import styled from 'styled-components';
import {
+ Heading,
Grommet,
+ Form,
+ FormField,
+ TextInput,
Page,
Data,
PageContent,
@@ -15,10 +20,21 @@ import {
DataContext,
DataSummary,
Toolbar,
+ Anchor,
+ SelectMultiple,
+ // ToggleGroup,
} from 'grommet';
import { hpe } from 'grommet-theme-hpe';
import tokens from 'design-tokens/tree';
-import { Github, LinkNext, Moon, Sun } from 'grommet-icons';
+import {
+ Github,
+ LinkNext,
+ Moon,
+ Sun,
+ Previous,
+ Trash,
+ // Copy,
+} from 'grommet-icons';
const tokensArr = [];
Object.keys(tokens).forEach(mode => {
@@ -126,8 +142,274 @@ const buildTree = (selectedToken, showValue) => {
);
};
-function App() {
+const Visualizer = () => {
const [selected, setSelected] = useState({});
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {selected.name
+ ? buildTree(selected, true)
+ : 'Select a token to see dependencies.'}
+
+
+
+
+
+ );
+};
+
+const colors = ['background', 'foregroundColor', 'borderColor'];
+const dimensions = ['paddingX', 'paddingY', 'borderRadius', 'borderWidth'];
+
+const Builder = () => {
+ const [value, setValue] = useState({
+ prefix: 'hpe',
+ component: '',
+ size: ['medium'],
+ variants: [{ variant: '' }],
+ state: ['enabled', 'disabled', 'hover', 'selected'],
+ property: [...dimensions, ...colors],
+ });
+
+ // const [view, setView] = useState('compact');
+ const [tokens, setTokens] = useState([]);
+
+ const addVariant = () => {
+ const newVariant = { variant: '' };
+ const newVariants = [...value.variants, newVariant];
+ setValue({
+ ...value,
+ variants: newVariants,
+ });
+ };
+
+ const removeVariant = index => {
+ if (value.variants && value.variants.length > 0) {
+ setValue({
+ ...value,
+ variants: value.variants.filter((v, _idx) => _idx !== index),
+ });
+ }
+ };
+
+ const handleSubmit = ({ value: formValue }) => {
+ const nextTokens = [];
+ formValue.size.forEach(size => {
+ formValue.variants.forEach(variant => {
+ formValue.state.forEach(state => {
+ dimensions.forEach(property => {
+ nextTokens.push(
+ `${formValue.prefix}.${formValue.component}.${size}.${
+ variant.variant ? `${variant.variant}.` : ''
+ }${state}.${property}`,
+ );
+ });
+ });
+ });
+ });
+
+ formValue.variants.forEach(variant => {
+ formValue.state.forEach(state => {
+ colors.forEach(property => {
+ nextTokens.push(
+ `${formValue.prefix}.${formValue.component}.${
+ variant.variant ? `${variant.variant}.` : ''
+ }${state}.${property}`,
+ );
+ });
+ });
+ });
+ setTokens(nextTokens);
+ // let res = {};
+ // nextTokens.forEach(token => {
+ // const parts = token.split('.');
+ // parts.forEach(part => {
+ // if ()
+ // })
+ // });
+ // console.log(res);
+ };
+
+ let VariantGroup = null;
+ if (value.variants !== undefined) {
+ VariantGroup = value.variants.map((phone, index) => (
+
+
+
+
+
+
+
+ }
+ aria-label={`Remove variant ${index + 1}`}
+ onClick={() => removeVariant(index)}
+ />
+
+
+ ));
+ }
+
+ return (
+
+
+
+
+ } />
+ Token builder
+
+
+
+
+
+
+ {/*
+ setView(nextValue)}
+ />
+ }
+ alignSelf="start"
+ secondary
+ />
+ */}
+
+ {tokens.length ? (
+ tokens.map(token => {token})
+ ) : (
+ No tokens have been generated.
+ )}
+
+
+
+
+
+ );
+};
+
+function App() {
const [darkMode, setDarkMode] = useState(
localStorage.getItem('darkMode') === 'true' || false,
);
@@ -143,61 +425,38 @@ function App() {
themeMode={darkMode ? 'dark' : 'light'}
full="min"
>
-
-
- Design Token Visualizer
-
-
- }
- href="https://github.com/grommet/hpe-design-system/tree/design-tokens/design-tokens/tokens"
- target="_blank"
- rel="noopener noreferrer"
- tip="View tokens in Github"
- />
- : }
- onClick={() => setDarkMode(!darkMode)}
- tip={`Swith to ${darkMode ? 'light' : 'dark'} mode`}
- />
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {selected.name
- ? buildTree(selected, true)
- : 'Select a token to see dependencies.'}
-
-
-
-
-
+
+
+
+ }
+ href="https://github.com/grommet/hpe-design-system/tree/design-tokens/design-tokens/tokens"
+ target="_blank"
+ rel="noopener noreferrer"
+ tip="View tokens in Github"
+ />
+ : }
+ onClick={() => setDarkMode(!darkMode)}
+ tip={`Swith to ${darkMode ? 'light' : 'dark'} mode`}
+ />
+
+
+
+ } />
+ } />
+
+
);
}
diff --git a/yarn.lock b/yarn.lock
index b898e1855..3dd75ae1c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1577,9 +1577,9 @@
eslint-visitor-keys "^3.3.0"
"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1":
- version "4.10.0"
- resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63"
- integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==
+ version "4.10.1"
+ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.1.tgz#361461e5cb3845d874e61731c11cfedd664d83a0"
+ integrity sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA==
"@eslint/eslintrc@^2.1.4":
version "2.1.4"
@@ -2664,9 +2664,9 @@
"@types/node" "*"
"@types/node@*", "@types/node@^20.4.5":
- version "20.12.13"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.13.tgz#90ed3b8a4e52dd3c5dc5a42dde5b85b74ad8ed88"
- integrity sha512-gBGeanV41c1L171rR7wjbMiEpEI/l5XFQdLLfhr/REwpgDy/4U8y89+i8kRiLzDyZdOkXh+cRaTetUnCYutoXA==
+ version "20.14.0"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.0.tgz#49ceec7b34f8621470cff44677fa9d461a477f17"
+ integrity sha512-5cHBxFGJx6L4s56Bubp4fglrEpmyJypsqI6RgzMfBHWUJQGWAAi8cWcgetEbZXHYXo9C2Fa4EEds/uSyS4cxmA==
dependencies:
undici-types "~5.26.4"
@@ -2783,61 +2783,61 @@
"@types/yargs-parser" "*"
"@typescript-eslint/eslint-plugin@^7.2.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.11.0.tgz#f90f0914657ead08e1c75f66939c926edeab42dd"
- integrity sha512-P+qEahbgeHW4JQ/87FuItjBj8O3MYv5gELDzr8QaQ7fsll1gSMTYb6j87MYyxwf3DtD7uGFB9ShwgmCJB5KmaQ==
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.12.0.tgz#f87a32e8972b8a60024f2f8f12205e7c8108bc41"
+ integrity sha512-7F91fcbuDf/d3S8o21+r3ZncGIke/+eWk0EpO21LXhDfLahriZF9CGj4fbAetEjlaBdjdSm9a6VeXbpbT6Z40Q==
dependencies:
"@eslint-community/regexpp" "^4.10.0"
- "@typescript-eslint/scope-manager" "7.11.0"
- "@typescript-eslint/type-utils" "7.11.0"
- "@typescript-eslint/utils" "7.11.0"
- "@typescript-eslint/visitor-keys" "7.11.0"
+ "@typescript-eslint/scope-manager" "7.12.0"
+ "@typescript-eslint/type-utils" "7.12.0"
+ "@typescript-eslint/utils" "7.12.0"
+ "@typescript-eslint/visitor-keys" "7.12.0"
graphemer "^1.4.0"
ignore "^5.3.1"
natural-compare "^1.4.0"
ts-api-utils "^1.3.0"
"@typescript-eslint/parser@^7.2.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.11.0.tgz#525ad8bee54a8f015f134edd241d91b84ab64839"
- integrity sha512-yimw99teuaXVWsBcPO1Ais02kwJ1jmNA1KxE7ng0aT7ndr1pT1wqj0OJnsYVGKKlc4QJai86l/025L6z8CljOg==
- dependencies:
- "@typescript-eslint/scope-manager" "7.11.0"
- "@typescript-eslint/types" "7.11.0"
- "@typescript-eslint/typescript-estree" "7.11.0"
- "@typescript-eslint/visitor-keys" "7.11.0"
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.12.0.tgz#8761df3345528b35049353db80010b385719b1c3"
+ integrity sha512-dm/J2UDY3oV3TKius2OUZIFHsomQmpHtsV0FTh1WO8EKgHLQ1QCADUqscPgTpU+ih1e21FQSRjXckHn3txn6kQ==
+ dependencies:
+ "@typescript-eslint/scope-manager" "7.12.0"
+ "@typescript-eslint/types" "7.12.0"
+ "@typescript-eslint/typescript-estree" "7.12.0"
+ "@typescript-eslint/visitor-keys" "7.12.0"
debug "^4.3.4"
-"@typescript-eslint/scope-manager@7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.11.0.tgz#cf5619b01de62a226a59add15a02bde457335d1d"
- integrity sha512-27tGdVEiutD4POirLZX4YzT180vevUURJl4wJGmm6TrQoiYwuxTIY98PBp6L2oN+JQxzE0URvYlzJaBHIekXAw==
+"@typescript-eslint/scope-manager@7.12.0":
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.12.0.tgz#259c014362de72dd34f995efe6bd8dda486adf58"
+ integrity sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==
dependencies:
- "@typescript-eslint/types" "7.11.0"
- "@typescript-eslint/visitor-keys" "7.11.0"
+ "@typescript-eslint/types" "7.12.0"
+ "@typescript-eslint/visitor-keys" "7.12.0"
-"@typescript-eslint/type-utils@7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.11.0.tgz#ac216697d649084fedf4a910347b9642bd0ff099"
- integrity sha512-WmppUEgYy+y1NTseNMJ6mCFxt03/7jTOy08bcg7bxJJdsM4nuhnchyBbE8vryveaJUf62noH7LodPSo5Z0WUCg==
+"@typescript-eslint/type-utils@7.12.0":
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.12.0.tgz#9dfaaa1972952f395ec5be4f5bbfc4d3cdc63908"
+ integrity sha512-lib96tyRtMhLxwauDWUp/uW3FMhLA6D0rJ8T7HmH7x23Gk1Gwwu8UZ94NMXBvOELn6flSPiBrCKlehkiXyaqwA==
dependencies:
- "@typescript-eslint/typescript-estree" "7.11.0"
- "@typescript-eslint/utils" "7.11.0"
+ "@typescript-eslint/typescript-estree" "7.12.0"
+ "@typescript-eslint/utils" "7.12.0"
debug "^4.3.4"
ts-api-utils "^1.3.0"
-"@typescript-eslint/types@7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.11.0.tgz#5e9702a5e8b424b7fc690e338d359939257d6722"
- integrity sha512-MPEsDRZTyCiXkD4vd3zywDCifi7tatc4K37KqTprCvaXptP7Xlpdw0NR2hRJTetG5TxbWDB79Ys4kLmHliEo/w==
+"@typescript-eslint/types@7.12.0":
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.12.0.tgz#bf208f971a8da1e7524a5d9ae2b5f15192a37981"
+ integrity sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==
-"@typescript-eslint/typescript-estree@7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.11.0.tgz#7cbc569bc7336c3a494ceaf8204fdee5d5dbb7fa"
- integrity sha512-cxkhZ2C/iyi3/6U9EPc5y+a6csqHItndvN/CzbNXTNrsC3/ASoYQZEt9uMaEp+xFNjasqQyszp5TumAVKKvJeQ==
+"@typescript-eslint/typescript-estree@7.12.0":
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.12.0.tgz#e6c1074f248b3db6573ab6a7c47a39c4cd498ff9"
+ integrity sha512-5bwqLsWBULv1h6pn7cMW5dXX/Y2amRqLaKqsASVwbBHMZSnHqE/HN4vT4fE0aFsiwxYvr98kqOWh1a8ZKXalCQ==
dependencies:
- "@typescript-eslint/types" "7.11.0"
- "@typescript-eslint/visitor-keys" "7.11.0"
+ "@typescript-eslint/types" "7.12.0"
+ "@typescript-eslint/visitor-keys" "7.12.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
@@ -2845,22 +2845,22 @@
semver "^7.6.0"
ts-api-utils "^1.3.0"
-"@typescript-eslint/utils@7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.11.0.tgz#524f047f2209959424c3ef689b0d83b3bc09919c"
- integrity sha512-xlAWwPleNRHwF37AhrZurOxA1wyXowW4PqVXZVUNCLjB48CqdPJoJWkrpH2nij9Q3Lb7rtWindtoXwxjxlKKCA==
+"@typescript-eslint/utils@7.12.0":
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.12.0.tgz#c6e58fd7f724cdccc848f71e388ad80cbdb95dd0"
+ integrity sha512-Y6hhwxwDx41HNpjuYswYp6gDbkiZ8Hin9Bf5aJQn1bpTs3afYY4GX+MPYxma8jtoIV2GRwTM/UJm/2uGCVv+DQ==
dependencies:
"@eslint-community/eslint-utils" "^4.4.0"
- "@typescript-eslint/scope-manager" "7.11.0"
- "@typescript-eslint/types" "7.11.0"
- "@typescript-eslint/typescript-estree" "7.11.0"
+ "@typescript-eslint/scope-manager" "7.12.0"
+ "@typescript-eslint/types" "7.12.0"
+ "@typescript-eslint/typescript-estree" "7.12.0"
-"@typescript-eslint/visitor-keys@7.11.0":
- version "7.11.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.11.0.tgz#2c50cd292e67645eec05ac0830757071b4a4d597"
- integrity sha512-7syYk4MzjxTEk0g/w3iqtgxnFQspDJfn6QKD36xMuuhTzjcxY7F8EmBLnALjVyaOF1/bVocu3bS/2/F7rXrveQ==
+"@typescript-eslint/visitor-keys@7.12.0":
+ version "7.12.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz#c053b55a996679528beeedd8e565710ce1ae1ad3"
+ integrity sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==
dependencies:
- "@typescript-eslint/types" "7.11.0"
+ "@typescript-eslint/types" "7.12.0"
eslint-visitor-keys "^3.4.3"
"@ungap/structured-clone@^1.2.0":
@@ -3361,14 +3361,14 @@ array.prototype.toreversed@^1.1.2:
es-shim-unscopables "^1.0.0"
array.prototype.tosorted@^1.1.3:
- version "1.1.3"
- resolved "https://registry.yarnpkg.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.3.tgz#c8c89348337e51b8a3c48a9227f9ce93ceedcba8"
- integrity sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg==
+ version "1.1.4"
+ resolved "https://registry.yarnpkg.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz#fe954678ff53034e717ea3352a03f0b0b86f7ffc"
+ integrity sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==
dependencies:
- call-bind "^1.0.5"
+ call-bind "^1.0.7"
define-properties "^1.2.1"
- es-abstract "^1.22.3"
- es-errors "^1.1.0"
+ es-abstract "^1.23.3"
+ es-errors "^1.3.0"
es-shim-unscopables "^1.0.2"
arraybuffer.prototype.slice@^1.0.3:
@@ -3852,9 +3852,9 @@ camelize@^1.0.0:
integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==
caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001587:
- version "1.0.30001625"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz#ead1b155ea691d6a87938754d3cb119c24465b03"
- integrity sha512-4KE9N2gcRH+HQhpeiRZXd+1niLB/XNLAhSy4z7fI8EzcbcPoAqjNInxVHTiTwWfTIV4w096XG8OtCOCQQKPv3w==
+ version "1.0.30001627"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001627.tgz#8071c42d468e06ed2fb2c545efe79a663fd326ab"
+ integrity sha512-4zgNiB8nTyV/tHhwZrFs88ryjls/lHiqFhrxCW4qSTeuRByBVnPYpDInchOIySWknznucaf31Z4KYqjfbrecVw==
capital-case@^1.0.4:
version "1.0.4"
@@ -4739,9 +4739,9 @@ ee-first@1.1.1:
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
electron-to-chromium@^1.4.668:
- version "1.4.787"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.787.tgz#3eedd0a3b8be2b9e96e21675d399786ad90b99ed"
- integrity sha512-d0EFmtLPjctczO3LogReyM2pbBiiZbnsKnGF+cdZhsYzHm/A0GV7W94kqzLD8SN4O3f3iHlgLUChqghgyznvCQ==
+ version "1.4.788"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.788.tgz#a3545959d5cfa0a266d3e551386c040be34e7e06"
+ integrity sha512-ubp5+Ev/VV8KuRoWnfP2QF2Bg+O2ZFdb49DiiNbz2VmgkIqrnyYaqIOqj8A6K/3p1xV0QcU5hBQ1+BmB6ot1OA==
elegant-spinner@^1.0.1:
version "1.0.1"
@@ -4899,7 +4899,7 @@ es-define-property@^1.0.0:
dependencies:
get-intrinsic "^1.2.4"
-es-errors@^1.1.0, es-errors@^1.2.1, es-errors@^1.3.0:
+es-errors@^1.2.1, es-errors@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==