Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add design tokens alpha #4166

Merged
merged 299 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
299 commits
Select commit Hold shift + click to select a range
98e7ef6
Fix ThemeContext import for vite
taysea Mar 14, 2024
1f0d00f
Update native-web
taysea Mar 15, 2024
e3c4d4d
Update build script and theme toggles
taysea Mar 15, 2024
ad4c8ee
Small fixes
taysea Mar 15, 2024
dfc3f72
Persist mode and background to local storage
taysea Mar 18, 2024
184c901
Update build step, use style dictionary, adjust theme
taysea Mar 18, 2024
5d33484
Add animation tokens
taysea Mar 18, 2024
24d4e93
Fix sync_tokens_to_figma
taysea Mar 18, 2024
ad941e0
Fix script
taysea Mar 18, 2024
d599876
Add animated HPEGreenLake badge, add elevation and motion tokens
taysea Mar 21, 2024
8aefde3
Update yarn.lock
taysea Mar 21, 2024
89b3ddd
Add skeleton util
taysea Mar 21, 2024
b99af62
Fix centering
taysea Mar 22, 2024
a746564
Add motion css and user dropdown
taysea Mar 22, 2024
0200f60
Smooth transition of density table
taysea Mar 22, 2024
2a8fbb6
Add skeleton, refine animation, create workspaces
taysea Mar 26, 2024
18d6afd
Add skeleton animation, adjust icon size
taysea Mar 27, 2024
e3b7313
Update skeleton color to match Figma
taysea Mar 27, 2024
aaaaf03
Theme mode easing, buttons, anchors
taysea Mar 27, 2024
c8c1089
smooth transition
taysea Mar 28, 2024
8971244
Add dark mode skeleton, dark mode greenlake badge
taysea Mar 28, 2024
e1c8f11
Refine skeleton
taysea Mar 28, 2024
fd16399
Add transition on card icon
taysea Mar 28, 2024
01e2842
Add fadeIn after skeleton
taysea Mar 28, 2024
f84dc7e
Fix darkmode gradients
taysea Mar 28, 2024
1fca358
Allow content to load
taysea Mar 28, 2024
54477e5
Small cleanups
taysea Apr 1, 2024
f6a2a56
Fix Safari
taysea Apr 2, 2024
febeb13
Demo test
taysea Apr 2, 2024
b37f229
Revert brand change
taysea Apr 2, 2024
8e4897e
Demo test brand change
taysea Apr 2, 2024
c6aa117
Add token value to card
taysea Apr 2, 2024
2f037f3
Demo brand change
taysea Apr 3, 2024
0082f89
Incorporate updates to native-web
taysea Apr 3, 2024
0057cbd
Demo brand change
taysea Apr 3, 2024
e8eb06f
Revert demo change
taysea Apr 3, 2024
83ffd3b
Demo brand change
taysea Apr 3, 2024
b69e091
Revert demo changes
taysea Apr 4, 2024
244340b
Demo change
taysea Apr 4, 2024
ff9032d
Revert change
taysea Apr 4, 2024
f3afdb8
Demo brand change
taysea Apr 4, 2024
3007d36
Revert change
taysea Apr 4, 2024
70e9021
Demo change
taysea Apr 4, 2024
e24127e
revert change
taysea Apr 4, 2024
1f97abb
Demo change
taysea Apr 5, 2024
bf57c3f
Revert change
taysea Apr 5, 2024
2b024fc
Change brand color
taysea Apr 9, 2024
9d6828b
Revert demo change
taysea Apr 15, 2024
2a67b4f
Update yarn.lock
taysea Apr 19, 2024
df643a0
Card token refinement
taysea Apr 19, 2024
fe670f7
Demo color change
taysea Apr 19, 2024
f8b0675
Revert demo change
taysea Apr 24, 2024
50186e7
Update yarn.lock
taysea Apr 30, 2024
059a75e
Create design token manager
taysea May 2, 2024
2a7f6f8
Update yarn.lock
taysea May 2, 2024
14cfbc7
Fix warm colors build
taysea May 28, 2024
002dacc
Update node version on actions
taysea May 28, 2024
383b846
Demo change
taysea May 28, 2024
7ddd12b
Revert demo change
taysea May 28, 2024
0d9ebdd
Update yarn.lock
taysea May 29, 2024
32a377d
Demo change
taysea May 29, 2024
3c07198
Revert demo change
taysea May 31, 2024
882813d
Add token builder
taysea Jun 3, 2024
5c95d9c
Add redirects file
taysea Jun 3, 2024
a8ae7fd
Make adjustments for alpha
taysea Jun 10, 2024
43e33c5
Refine build steps and adjust tokens
taysea Jun 12, 2024
311e463
Fix token
taysea Jun 12, 2024
149802d
Color fixes
taysea Jun 12, 2024
34fb541
Add design token docs
taysea Jun 13, 2024
dca43f4
Fix github link
taysea Jun 13, 2024
765a506
Adjust token font style
taysea Jun 13, 2024
c61cfab
Fix inputs, buttons, and table dimensions
taysea Jun 13, 2024
cd056ac
Add heading sizes and icon support in css variables button
taysea Jun 13, 2024
ebb8919
Fix static border default reference
taysea Jun 13, 2024
21ec01f
Sync diffs with Figma
taysea Jun 13, 2024
1326540
Add CheckBox tokens
taysea Jun 13, 2024
f53ac87
fix token types
taysea Jun 13, 2024
bbe5d92
Add prefix
taysea Jun 13, 2024
02b0ebe
Improve nav
taysea Jun 13, 2024
d51f16a
Sync tokens with figma
taysea Jun 14, 2024
c5ec737
First draft tailwind app
taysea Jun 14, 2024
35f4096
Add esm-grommet build script and align CSS files with latest tokens
taysea Jun 26, 2024
0e72cb5
Add release-stable script
taysea Jun 26, 2024
aca696e
Trivial change to trigger action
taysea Jun 26, 2024
746c976
Merge branch 'master' into design-tokens-alpha
taysea Jun 27, 2024
bb7fc73
Merge branch 'master' into design-tokens-alpha
taysea Jun 27, 2024
05ae4b4
Merge branch 'master' into design-tokens-alpha
taysea Jun 27, 2024
789bdbf
Fix button paddingX
taysea Jun 27, 2024
914de82
Push latest tokens
taysea Jul 3, 2024
e7472f0
Update yarn.lock
taysea Jul 3, 2024
192e230
Get disabled colors for button
taysea Jul 3, 2024
8c21316
Fix secondary disabled border color and primary font weight
taysea Jul 3, 2024
28f812f
Pull in latest tokens, add to theme, adjust native-web css
taysea Jul 8, 2024
366c84a
Tokenize theme Anchor-CheckBox
jcfilben Jul 11, 2024
40b3cc5
components up to fileformField
jcfilben Jul 11, 2024
4618154
additional comments
jcfilben Jul 11, 2024
df9aec4
Merge branch 'master' into design-tokens-alpha
taysea Jul 12, 2024
e564e2d
Merge branch 'design-tokens-alpha' of github.com:grommet/hpe-design-s…
taysea Jul 12, 2024
3ca5ba1
Fix action
taysea Jul 12, 2024
de2ed16
Update tokens from Figma
taysea Jul 12, 2024
086eada
Merge pull request #4018 from grommet/update-tokens
oliverHPE Jul 12, 2024
b204d7a
Incorporate latest
taysea Jul 12, 2024
b3ec34b
tokens for theme fileformfield-heading
jcfilben Jul 12, 2024
b6eb27c
update with upstream changes
jcfilben Jul 12, 2024
e7faed1
tokens theme heading - paragraph
jcfilben Jul 12, 2024
120b193
add comments and tokens
britt6612 Jul 15, 2024
d758ca7
Merge branch 'design-tokens-alpha' of https://github.com/grommet/hpe-…
britt6612 Jul 15, 2024
f5a1370
various fixes and cleanups
jcfilben Jul 17, 2024
0724e8c
rangeinput, radiobutton, fileinput theme changes
jcfilben Jul 17, 2024
516bda0
formfield fix
jcfilben Jul 17, 2024
709eee9
fix more tokens
britt6612 Jul 18, 2024
0ac4f6c
include icons in tokens theme
jcfilben Jul 22, 2024
0b4c50a
various fixes
jcfilben Jul 23, 2024
8283c63
yarn.lock
jcfilben Jul 23, 2024
8effda1
Merge branch 'master' into design-tokens-alpha
taysea Jul 24, 2024
0f88d9c
Merge branch 'design-tokens-alpha' of github.com:grommet/hpe-design-s…
taysea Jul 24, 2024
186a263
Pull in latest values
taysea Jul 29, 2024
f2db61d
Update yarn.lock
taysea Jul 29, 2024
3c26856
Incorporate sticker sheet
taysea Jul 29, 2024
fd81f42
Add CommonJS support
taysea Jul 29, 2024
b3f5c31
Change file extension for commonjs
taysea Jul 29, 2024
8368f5d
Fix package.js
taysea Jul 29, 2024
8451c43
Fix file extension for cjs
taysea Jul 30, 2024
9822957
Fix commonjs build
taysea Jul 30, 2024
ab56166
Modify commonnjs formatter
taysea Jul 30, 2024
3282086
Update tokens from Figma
taysea Jul 31, 2024
c23c265
Merge pull request #4073 from grommet/update-tokens
taysea Jul 31, 2024
3ce3c55
Update iconOnly button tokens
taysea Jul 31, 2024
5bab294
Merge branch 'design-tokens-alpha' of github.com:grommet/hpe-design-s…
taysea Jul 31, 2024
d4c6279
add dataCell primary tokens
jcfilben Jul 31, 2024
cd074c3
Add first pass elevation tokens
taysea Jul 31, 2024
e55e2b8
add headerCell missig tokens
britt6612 Jul 31, 2024
e024038
Merge branch 'design-tokens-alpha' of https://github.com/grommet/hpe-…
britt6612 Jul 31, 2024
9610588
incorporate feedback from review
jcfilben Jul 31, 2024
d444546
fix dataCell textColor and weight
jcfilben Jul 31, 2024
3976968
take out hpe
britt6612 Jul 31, 2024
22a4251
remove background and border
britt6612 Jul 31, 2024
2a9f535
Merge pull request #4075 from grommet/fix-4069-headerCell
taysea Aug 1, 2024
200ca28
Fix incorrect reference
taysea Aug 1, 2024
78a1859
Merge pull request #4074 from grommet/primary-datacell
taysea Aug 1, 2024
7d15abd
Add paragraph maxWidth
taysea Aug 1, 2024
8539245
add anchor gapX for sizess
britt6612 Aug 7, 2024
beb1247
take out hpe
britt6612 Aug 7, 2024
f251a08
Add elevation scripts
taysea Aug 7, 2024
64c08d6
Refactor code organization
taysea Aug 7, 2024
56ed4a1
Update component.default.json
britt6612 Aug 8, 2024
d3779d7
add missing tokens
britt6612 Aug 8, 2024
f20cc0b
add missing tokens
britt6612 Aug 8, 2024
1bd67e4
Add paddingY script
taysea Aug 8, 2024
bb24f79
Merge pull request #4092 from grommet/add-anchor-gapX
taysea Aug 8, 2024
2282fda
Fix elevation
taysea Aug 8, 2024
e87f620
Pull in fixed values
taysea Aug 9, 2024
e7df737
Fix figma to tokens elevation conversion
taysea Aug 13, 2024
259786c
Use tsx instead ts-node for Node 20 support
taysea Aug 13, 2024
0aa8fa5
Update Figma tokens when stable branch updates
taysea Aug 13, 2024
38371c0
Remove fontWeight from button t-shirt sizes
taysea Aug 13, 2024
f1f03a3
Point to generic component tokens
taysea Aug 13, 2024
a0d544e
Update yarn.lock
taysea Aug 13, 2024
baeefcd
Update yarn.lock
taysea Aug 13, 2024
d475bfd
Add color.focus
taysea Aug 13, 2024
a6e624d
Add global collection for fontStack
taysea Aug 14, 2024
5732370
Move breakpoints to global
taysea Aug 14, 2024
724ee67
Apply fixed token values
taysea Aug 14, 2024
464939c
Move numberToDimension to style-dictionary
taysea Aug 14, 2024
2375322
Add remaining icon only tokens, display.medium
taysea Aug 15, 2024
094af1f
Fix footer cells
taysea Aug 15, 2024
0adc6dc
Update yarn.lock
taysea Aug 15, 2024
7d03018
Update yarn.lock
taysea Aug 15, 2024
3992123
Fix brekapoint CSS
taysea Aug 15, 2024
a229729
Fix component exclude list
taysea Aug 20, 2024
6910d4d
Remove unused tones directory
taysea Aug 20, 2024
b4541c2
Add refresh page
taysea Aug 21, 2024
519cb0e
Fix theme
taysea Aug 21, 2024
0913526
Update yarn.lock
taysea Aug 21, 2024
ac2a315
Update yarn.lock
taysea Aug 21, 2024
05457d0
Simplify release stable script
taysea Aug 21, 2024
4feac60
Trivial change
taysea Aug 21, 2024
45f49a8
Remove fontWeight from base and keep in global
taysea Aug 21, 2024
dffb55f
Add design token build as precommit check
taysea Aug 21, 2024
3247b67
Add theme toggle
taysea Aug 21, 2024
3573919
Update global header for refresh theme
taysea Aug 21, 2024
c19101c
Transform to grommet references in build-style-dictionary
taysea Aug 23, 2024
ab4ee93
Update yarn.lock
taysea Aug 23, 2024
f68fb8a
Rename format
taysea Aug 23, 2024
affd70c
Add focusIndicator.outline token and consolidate elevation build with…
taysea Aug 23, 2024
50e83db
Dont push : border to Figma
taysea Aug 23, 2024
0511cda
Update yarn.lock
taysea Aug 23, 2024
787f835
Make paddingY script exhaustive depth
taysea Aug 26, 2024
da2a138
Pull in latest
taysea Aug 26, 2024
ad61a7b
Update yarn.lock
taysea Aug 26, 2024
6e99205
Cleanups to selected colors
taysea Aug 26, 2024
b10d706
Add secondary button hover border
taysea Aug 26, 2024
cc01dfb
Update yarn.lock
taysea Aug 26, 2024
435be42
Update small, large, xlarge, shadows
taysea Aug 26, 2024
4b022e8
Add onSelectedStrong color, fontWeights to text sizes
taysea Aug 27, 2024
6e72c9c
Add text-onSelectedWeak
taysea Aug 27, 2024
e586885
Add text.onStatus, fix header cell styling
taysea Aug 27, 2024
2b0ead9
Restructure files
taysea Sep 4, 2024
ce79e31
Update to accommodate separate Figma files
taysea Sep 5, 2024
45827ae
Merge pull request #4153 from grommet/design-tokens-separate-files
taysea Sep 5, 2024
6032a64
Update yarn.lock
taysea Sep 5, 2024
b8ce18f
Break out errors
taysea Sep 5, 2024
f49def6
Update yarn.lock
taysea Sep 5, 2024
fb436f6
Fix github action env variables
taysea Sep 5, 2024
34b8ff2
Update yarn.lock
taysea Sep 5, 2024
f2b2662
Update sync figma variables to tokens action
taysea Sep 5, 2024
2dd069f
Remove console.log
taysea Sep 5, 2024
c2829dd
Remove - semantic from collection names
taysea Sep 5, 2024
355e996
Add prettier step to sync-figma-to-tokens
taysea Sep 5, 2024
37a225e
Update yarn.lock
taysea Sep 5, 2024
e6c13e3
Prettier on component file
taysea Sep 5, 2024
73d523a
Cleanups for Metric2 prep
taysea Sep 5, 2024
454c9a5
Fix anchor state grouping
taysea Sep 5, 2024
d508337
Fix content pad on formfield
taysea Sep 5, 2024
485e28e
Fix enabled toggle handle background
taysea Sep 5, 2024
290da67
Fix condensing boxShadow tokens
taysea Sep 5, 2024
ef65cdb
Include inset in shadow tokens
taysea Sep 5, 2024
0512961
Enhance scripts to flatten or condense border tokens
taysea Sep 5, 2024
ff50cf0
Update tokens from Figma
taysea Sep 5, 2024
84ef6e2
Merge pull request #4161 from grommet/update-tokens
taysea Sep 5, 2024
29a68ed
Simplify dist folder for alpha
taysea Sep 6, 2024
a7c5a39
Merge pull request #4162 from grommet/tokens-simplify-dist
taysea Sep 6, 2024
e77f2b6
Update design-tokens package name to hpe-design-tokens
taysea Sep 9, 2024
97b5515
Import cleanups
taysea Sep 9, 2024
062be22
Fix docs and visualizer to use updated docs format
taysea Sep 10, 2024
a319a7d
Add LICENSE
taysea Sep 10, 2024
9c6865c
Merge branch 'master' into design-tokens-alpha
taysea Sep 10, 2024
e0b07ca
Fix docs description and esm index files
taysea Sep 10, 2024
c242f43
Fix radioButton.label.enabled.textColor
taysea Sep 10, 2024
dbf286e
Update yarn.lock
taysea Sep 11, 2024
725c4f2
Add in new semantic steps
taysea Sep 11, 2024
0b01d27
Remove alpha-stable to avoid yarn.lock issues
taysea Sep 11, 2024
df647c4
Include typography in dimension collection
taysea Sep 11, 2024
96412c3
Add linear gradient for primary button background
taysea Sep 11, 2024
cb32afd
Update yarn.lock
taysea Sep 11, 2024
74f22dc
Fix for primary button gradient background
taysea Sep 11, 2024
f62e41f
Fix paddingY for button.large.primary
taysea Sep 11, 2024
73fb1fb
Add decorative core palette
taysea Sep 12, 2024
f152717
Rename to turquoise
taysea Sep 12, 2024
97aff86
Rename turquoise to teal
taysea Sep 12, 2024
709ed7f
Add green! etc colors to staged theme
taysea Sep 12, 2024
5bd715d
Include elevation in color collection
taysea Sep 12, 2024
77bf48b
Remove unused build script, adjust structure of stable branch
taysea Sep 12, 2024
4816a2a
Fix release stable script
taysea Sep 12, 2024
a83b48c
Update yarn.lock
taysea Sep 12, 2024
bd30dfe
Update github actions workflows in prep for merge to master
taysea Sep 12, 2024
d77c1c9
Update node version
taysea Sep 12, 2024
026a947
Fix release-stable branch
taysea Sep 12, 2024
d84139f
Remove repeated dependencies
taysea Sep 12, 2024
eedc24c
Remove elevation files, now under color
taysea Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/sync-figma-to-tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ name: Sync Figma variables to tokens
on:
workflow_dispatch:
inputs:
file_key:
description: 'The file key of the Figma file to be updated'
required: true
branch:
type: choice
description: Which branch to update
options:
- design-tokens-alpha
- design-tokens
- master
jobs:
sync-figma-to-tokens:
runs-on: ubuntu-latest
Expand All @@ -32,18 +28,24 @@ jobs:

- name: Install dependencies
run: yarn install
working-directory: design-tokens

- name: Sync variables in Figma file to tokens
run: yarn sync-figma-to-tokens -- --output tokens
working-directory: design-tokens
env:
FILE_KEY: ${{ github.event.inputs.file_key }}
FILE_KEY_PRIMITIVE: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_PRIMITIVE }}
FILE_KEY_SEMANTIC: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_SEMANTIC }}
FILE_KEY_COMPONENT: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_COMPONENT }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_ACTION_VARIABLES_SYNC_FIGMA_TOKEN }}

- name: Format token files with prettier
run: yarn prettier tokens --write
working-directory: design-tokens
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update tokens from Figma
title: Update tokens from Figma
body: 'Update tokens from Figma from file: https://www.figma.com/file/${{ github.event.inputs.file_key }}'
body: 'Update tokens from Figma from tokens files'
base: ${{ github.event.inputs.branch }}
branch: update-tokens
14 changes: 9 additions & 5 deletions .github/workflows/sync-tokens-to-figma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Sync tokens to Figma
on:
push:
branches:
- design-tokens
- master
paths:
- design-tokens/**

jobs:
sync-tokens-to-figma:
Expand All @@ -11,7 +13,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18.16.0'
node-version: '18.18.0'

- name: Set NPM version
run: npm install -g [email protected]
Expand All @@ -20,12 +22,14 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
run: npm install
run: yarn install
working-directory: design-tokens

- name: Sync tokens to Figma file
run: npm run sync-tokens-to-figma
run: yarn sync-tokens-to-figma
working-directory: design-tokens
env:
FILE_KEY: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY }}
FILE_KEY_PRIMITIVE: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_PRIMITIVE }}
FILE_KEY_SEMANTIC: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_SEMANTIC }}
FILE_KEY_COMPONENT: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_COMPONENT }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_ACTION_VARIABLES_SYNC_FIGMA_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/testcafe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18.17.x'
node-version: '18.18.x'
- name: Install latest dependencies
run: yarn upgrade
working-directory: aries-site
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Update design-tokens-alpha-stable
name: Update design-tokens-stable
on:
push:
branches:
- design-tokens-alpha
- master
paths:
- design-tokens/**

jobs:
update-design-tokens-alpha-stable:
update-design-tokens-stable:
runs-on: ubuntu-latest
steps:
- name: Install Node.js
Expand All @@ -26,12 +28,20 @@ jobs:
- name: Build
run: yarn build
working-directory: design-tokens

- name: Update design-tokens-alpha-stable
- name: Update design-tokens-stable
run: |
git config --global user.name "Grommet Community Bot"
git config --global user.email "[email protected]"
yarn release-stable
working-directory: design-tokens
env:
GH_TOKEN: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
# If stable is successfully update, push the same updates to Figma
- name: Sync tokens to Figma file
run: yarn sync-tokens-to-figma
working-directory: design-tokens
env:
FILE_KEY_PRIMITIVE: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_PRIMITIVE }}
FILE_KEY_SEMANTIC: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_SEMANTIC }}
FILE_KEY_COMPONENT: ${{ secrets.GH_ACTION_FIGMA_FILE_KEY_COMPONENT }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_ACTION_VARIABLES_SYNC_FIGMA_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
*storybook-static
*/src/data/search

# yalc
.yalc/
yalc.lock

#logs
npm-debug.log*
yarn-debug.log*
Expand All @@ -25,3 +29,5 @@ yarn-error.log*
.tmp
report*
.DS_Store
.native-web
.tailwind-app
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__rootDir="$(CDPATH= cd "$($__dirname "${BASH_SOURCE[0]}")" && pwd)"

echo "..Running design token checks"
cd design-tokens
npm run paddingY:verify
npm run build
cd ${__rootDir}
echo "..Running aries-site checks"
cd aries-site
echo "....Linting checks for aries-site"
Expand Down
18 changes: 18 additions & 0 deletions design-tokens-manager/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions design-tokens-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions design-tokens-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# HPE Design Tokens Manager

This is a tool to manage hpe-design-tokens.
12 changes: 12 additions & 0 deletions design-tokens-manager/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HPE Design Token Manager</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions design-tokens-manager/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "design-tokens-manager",
"private": true,
"authors": [
"Taylor Seamans"
],
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"design-tokens": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "5.3.11"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"typescript": "^5.2.2",
"vite": "^5.2.0"
}
}
1 change: 1 addition & 0 deletions design-tokens-manager/public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
64 changes: 64 additions & 0 deletions design-tokens-manager/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { useEffect, useState } from 'react';
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
import { Grommet, Header, Button, Box, Text } from 'grommet';
import { hpe } from 'grommet-theme-hpe';
import { Github, Moon, Sun } from 'grommet-icons';
import { Visualizer } from './routes/Visualizer';
// import { Builder } from './routes/Builder';
import { Docs } from './routes/Docs';

function App() {
const [darkMode, setDarkMode] = useState(
localStorage.getItem('darkMode') === 'true' || false,
);
useEffect(() => {
if (darkMode) localStorage.setItem('darkMode', 'true');
else localStorage.setItem('darkMode', 'false');
}, [darkMode]);

return (
<Grommet
background="background-back"
theme={hpe}
themeMode={darkMode ? 'dark' : 'light'}
full="min"
>
<BrowserRouter>
<Header
background="background-front"
pad={{ vertical: 'small', horizontal: 'medium' }}
border={{ side: 'bottom', color: 'border-weak' }}
>
<Button as={Link} to="/">
<Text weight={500} color="text-strong">
HPE Design Tokens Manager
</Text>
</Button>
<Box direction="row" gap="xsmall">
<Button as={Link} to="/visualizer" label="Token Visualizer" />
{/* <Button as={Link} to="/builder" label="Token builder" /> */}
<Button
icon={<Github />}
href="https://github.com/grommet/hpe-design-system/tree/design-tokens-alpha/design-tokens/tokens"
target="_blank"
rel="noopener noreferrer"
tip="View tokens in Github"
/>
<Button
icon={darkMode ? <Moon /> : <Sun />}
onClick={() => setDarkMode(!darkMode)}
tip={`Swith to ${darkMode ? 'light' : 'dark'} mode`}
/>
</Box>
</Header>
<Routes>
<Route path="/" element={<Docs />} />
{/* <Route path="/builder" element={<Builder />} /> */}
<Route path="/visualizer" element={<Visualizer />} />
</Routes>
</BrowserRouter>
</Grommet>
);
}

export default App;
72 changes: 72 additions & 0 deletions design-tokens-manager/src/build-token-tree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
export const buildTokenTree = tokens => {
const tree = {};

Object.keys(tokens).forEach(collection => {
let mode = collection;
if (
collection === 'base' ||
collection === 'components' ||
collection === 'global'
) {
mode = 'default';
} else if (collection.includes('elevation'))
mode = collection.replace('elevation', '');

const flat = Object.fromEntries(
Object.keys(tokens[collection]).map(token => [
token,
tokens[collection][token],
]),
);
if (!(mode in tree)) tree[mode] = {};
tree[mode] = { ...tree[mode], ...flat };
});

Object.keys(tree).forEach(mode => {
Object.keys(tree[mode]).forEach(key => {
// if it's a reference, add it to the "usedBy" for the referenced token
const value = tree[mode][key].original.value;
if (/^{.*}$/.test(value)) {
const token = value.slice(1, -1);
// for color tokens, add it to the used by for "light" and "dark" modes
// for dimension tokens, addit to the used by for "large" and "small"
// otherwise, mode is "default"
const referenceModes = [];
if (mode === 'default') {
if (token.includes('component')) referenceModes.push('default');
if (tree[mode][key].$type === 'color')
referenceModes.push(...['light', 'dark']);
else if (tree[mode][key].$type === 'number')
referenceModes.push(...['large', 'small']);
} else {
referenceModes.push(tree[mode][token] ? mode : 'default');
}
referenceModes.forEach(referenceMode => {
// if this is the first reference, create `usedBy`
const reference = tree[referenceMode][`hpe.${token}`];
if (reference) {
if (!('usedBy' in reference)) {
reference.usedBy = [
{
name: key,
mode,
},
];
} else if (
!reference.usedBy.find(
ref => ref.name === key && ref.mode === mode,
)
) {
reference.usedBy.push({
name: key,
mode,
});
}
}
});
}
});
});

return tree;
};
Loading
Loading