Skip to content

Commit

Permalink
Merge branch 'theme-update' into design-tokens-NEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
taysea committed Nov 18, 2024
2 parents ede02d1 + f97e5c0 commit 32b3758
Show file tree
Hide file tree
Showing 32 changed files with 1,217 additions and 1,493 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/main.yml

This file was deleted.

13 changes: 6 additions & 7 deletions aries-site/src/examples/foundation/icons/IconPlainExample.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import { Box } from 'grommet';
import { Hpe, Aruba, Hpi } from 'grommet-icons';
import { Hpe, Hpi } from 'grommet-icons';

export const IconPlainExample = () => (
<Box direction="row-responsive" gap="medium">
<Hpe color="plain" size="large" />
<Hpi color="plain" size="large" />
<Aruba color="plain" size="large" />
</Box>
);
<Box direction="row-responsive" gap="medium">
<Hpe color="plain" size="large" />
<Hpi color="plain" size="large" />
</Box>
);
2 changes: 1 addition & 1 deletion aries-site/src/pages/foundation/icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The icon should be centered aligned with any text that is being used next to it.

### Icon plain color

The default icon color is 'text-strong' for the corresponding light/dark mode. For some icons there are spcific colors in how they are represented, such as HPE, HP, Aruba that need to respect the built in colors for those SVGs so the color prop can be given 'plain'.
The default icon color is 'text-strong' for the corresponding light/dark mode. For some icons there are spcific colors in how they are represented, such as HPE, HP that need to respect the built in colors for those SVGs so the color prop can be given 'plain'.

<Example code="https://raw.githubusercontent.com/grommet/hpe-design-system/master/aries-site/src/examples/foundation/icons/IconPlainExample.js">
<IconPlainExample />
Expand Down
43 changes: 3 additions & 40 deletions aries-site/src/pages/foundation/our-brand.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ customers and their success, with a color which signals growth and
opportunity, and an approachable word-mark which says we are welcoming
to our partners.

This guide also supports, Aruba, a Hewlett Packard Enterprise company,
a leading provider of next-generation networking solutions for
enterprise whose cloud first approach is part of HPE's effort to help
our partners address the fundamental changes in today's business
environment.

All usage of the Hewlett Packard Enterprise brand elements is
subject to the requirements and restrictions
outlined in the [Terms of Use](https://www.hpe.com/us/en/about/legal/terms-of-use.html).
For additional guidance refer
For additional guidance and logo usage refer
to [Brand Central](https://brandcentral.hpe.com/home).

## Hewlett Packard Enterprise
Expand Down Expand Up @@ -71,38 +65,7 @@ not veer from the layout and spacing of the elements.
<HpeElementExample />
</UsageExample>

## Aruba Networks

Aruba Networks, also referenced as Aruba, has a couple logo
variations. Each variation should be used in the appropriate context.
Being aware of the different uses will help make your experience more
compliant.

For additional information and guidance view [Brand Central](https://h10014.www1.hpe.com/brand-central/content/aruba).

### Aruba logo

Use the Aruba logo when establishing the brand and building layouts
with less dense content. Place the logo on the top-left or bottom-left
depending on the layout; neither placement is necessarily preferred.

<UsageExample label="aruba-logo" themeMode="light">
<Image src="/static/images/aruba-logo.svg" alt="Aruba Logo" />
</UsageExample>
<UsageExample label="aruba-logo-invert" themeMode="dark">
<Image src="/static/images/aruba-logo.svg" alt="Aruba Logo" />
</UsageExample>

### Aruba icon
## HPE Aruba Networks

Always use the Aruba icon at the top-left of your service or product
experience. To ensure consistency across Aruba, the icon should always
be accompanied by the company name and product/service name. Do not
veer from the layout and spacing of the elements.
For additional information and guidance on HPE Aruba Networking view [Brand Central](https://brandcentral.hpe.com/brand-central/content/hpe-logo-and-hpe-greenlake-badge#hpe-aruba-networking-wordmark).

<UsageExample label="aruba-icon" themeMode="light">
<ArubaIconExample />
</UsageExample>
<UsageExample label="aruba-icon-invert" themeMode="dark">
<ArubaIconExample />
</UsageExample>
4 changes: 2 additions & 2 deletions design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"jest": "^29.6.2",
"prettier": "3.0.0",
"simple-git": "^3.24.0",
"style-dictionary": "^3.9.2",
"style-dictionary-utils": "^2.0.7",
"style-dictionary": "^4.2.0",
"style-dictionary-utils": "^3.0.0",
"ts-jest": "^29.1.1",
"tsx": "^4.19.1",
"typescript": "^5.1.6"
Expand Down
57 changes: 34 additions & 23 deletions design-tokens/src/HPEStyleDictionary.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,76 @@
import StyleDictionary from 'style-dictionary-utils';
import { StyleDictionary } from 'style-dictionary-utils';
import {
commonJs,
commonJsGrommetRefs,
cssColorModes,
cssBreakpoints,
esmGrommetRefs,
javascriptEsm,
jsonFlat,
} from './formats/index.js';
import {
cssW3c,
javascriptW3c,
linearGradientCss,
numberToDimension,
shadowCSS,
} from './transforms/index.js';

StyleDictionary.registerFormat({
export const HPEStyleDictionary = new StyleDictionary({
log: {
verbosity: 'verbose',
},
});

HPEStyleDictionary.registerFormat({
name: 'javascript/commonJs',
formatter: commonJs,
format: commonJs,
});
StyleDictionary.registerFormat({
HPEStyleDictionary.registerFormat({
name: 'javascript/esm',
format: javascriptEsm,
});
HPEStyleDictionary.registerFormat({
name: 'css/variables-themed',
formatter: cssColorModes,
format: cssColorModes,
});
StyleDictionary.registerFormat({
HPEStyleDictionary.registerFormat({
name: 'css/variables-breakpoints',
formatter: cssBreakpoints,
format: cssBreakpoints,
});
StyleDictionary.registerFormat({
HPEStyleDictionary.registerFormat({
name: `esmGrommetRefs`,
formatter: esmGrommetRefs,
format: esmGrommetRefs,
});
StyleDictionary.registerFormat({
HPEStyleDictionary.registerFormat({
name: `commonJsGrommetRefs`,
formatter: commonJsGrommetRefs,
format: commonJsGrommetRefs,
});
StyleDictionary.registerFormat({
HPEStyleDictionary.registerFormat({
name: `jsonFlat`,
formatter: jsonFlat,
format: jsonFlat,
});
StyleDictionary.registerTransform({
name: 'numberToDimension',
HPEStyleDictionary.registerTransform({
...numberToDimension,
});
StyleDictionary.registerTransform({
HPEStyleDictionary.registerTransform({
...shadowCSS,
});
HPEStyleDictionary.registerTransform({
name: 'name/dot',
type: 'name',
transformer: (token, config) => {
transform: (token, config) => {
return [config.prefix].concat(token.path).join('.');
},
});
StyleDictionary.registerTransform({
name: 'linearGradient/css',
HPEStyleDictionary.registerTransform({
...linearGradientCss,
});
StyleDictionary.registerTransformGroup({
HPEStyleDictionary.registerTransformGroup({
name: 'js/w3c',
transforms: javascriptW3c,
});
StyleDictionary.registerTransformGroup({
HPEStyleDictionary.registerTransformGroup({
name: 'css/w3c',
transforms: cssW3c,
});

export const HPEStyleDictionary: StyleDictionary.Core = StyleDictionary;
15 changes: 8 additions & 7 deletions design-tokens/src/formats/commonJs.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import StyleDictionary from 'style-dictionary';
import { FormatterArguments } from 'style-dictionary/types/Format.js';
import { fileHeader, minifyDictionary } from 'style-dictionary/utils';
import { FormatFn, FormatFnArguments } from 'style-dictionary/types';
import { jsonToNestedValue } from './utils/jsonToNestedValue.js';
const { fileHeader } = StyleDictionary.formatHelpers;

export const commonJs = ({
export const commonJs: FormatFn = async ({
dictionary,
file,
platform = {},
}: FormatterArguments) => {
}: FormatFnArguments) => {
const { prefix } = platform;
const tokens = prefix ? { [prefix]: dictionary.tokens } : dictionary.tokens;
//
const output = `${fileHeader({ file })}module.exports = ${JSON.stringify(
jsonToNestedValue(tokens),
const output = `${await fileHeader({
file,
})}module.exports = ${JSON.stringify(
jsonToNestedValue(minifyDictionary(tokens, true)), // build in minify
null,
2,
)}\n`;
Expand Down
18 changes: 9 additions & 9 deletions design-tokens/src/formats/commonJsGrommetRefs.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import StyleDictionary from 'style-dictionary';
import { FormatterArguments } from 'style-dictionary/types/Format.js';
import { fileHeader, minifyDictionary } from 'style-dictionary/utils';
import { FormatFn, FormatFnArguments } from 'style-dictionary/types';
import { getGrommetValue } from './utils/getGrommetValue.js';
import { jsonToNestedValue } from './utils/jsonToNestedValue.js';
import { access } from '../utils.js';

const { fileHeader } = StyleDictionary.formatHelpers;

export const commonJsGrommetRefs = ({
export const commonJsGrommetRefs: FormatFn = async ({
dictionary,
file,
platform = {},
}: FormatterArguments) => {
}: FormatFnArguments) => {
const { prefix } = platform;
let tokens = dictionary.tokens;

dictionary.allTokens.forEach((token: any) => {
const value = getGrommetValue(token, dictionary);
const originalToken = access(token.path.join('.'), tokens);
originalToken.value = value;
originalToken.$value = value;
});

tokens = prefix ? { [prefix]: tokens } : tokens;
const output = `${fileHeader({ file })}module.exports = ${JSON.stringify(
jsonToNestedValue(tokens),
const output = `${await fileHeader({
file,
})}module.exports = ${JSON.stringify(
jsonToNestedValue(minifyDictionary(tokens, true)), // build in minify
null,
2,
)}\n`;
Expand Down
13 changes: 7 additions & 6 deletions design-tokens/src/formats/cssBreakpoints.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import StyleDictionary from 'style-dictionary';
import { FormatterArguments } from 'style-dictionary/types/Format.js';
import { FormatFn, FormatFnArguments } from 'style-dictionary/types';
import { fileHeader, formattedVariables } from 'style-dictionary/utils';

export const cssBreakpoints = ({
export const cssBreakpoints: FormatFn = async ({
dictionary,
file,
options,
}: FormatterArguments) => {
}: FormatFnArguments) => {
const { outputReferences, mediaQuery } = options;
let output = `:root {\n${StyleDictionary.formatHelpers.formattedVariables({
let output = `:root {\n${formattedVariables({
format: 'css',
dictionary,
outputReferences,
usesDtcg: true,
})}\n}`;
if (mediaQuery) output = `@media (${mediaQuery}) {\n${output}\n}\n`;

return `${StyleDictionary.formatHelpers.fileHeader({
return `${await fileHeader({
file,
})}${output}`;
};
13 changes: 7 additions & 6 deletions design-tokens/src/formats/cssColorModes.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import StyleDictionary from 'style-dictionary';
import { FormatterArguments } from 'style-dictionary/types/Format.js';
import { FormatFn, FormatFnArguments } from 'style-dictionary/types';
import { formattedVariables, fileHeader } from 'style-dictionary/utils';

export const cssColorModes = ({
export const cssColorModes: FormatFn = async ({
dictionary,
file,
options,
}: FormatterArguments) => {
}: FormatFnArguments) => {
const { outputReferences, theme, mode } = options;
const darkTokens = StyleDictionary.formatHelpers.formattedVariables({
const darkTokens = formattedVariables({
format: 'css',
dictionary,
outputReferences,
usesDtcg: true,
});
const dataTheme = theme ? `[data-theme=${theme}]` : '';
// TO DO "mode" is fairly coupled with concept of "dark" right now
// just confirm this would be able to expand to concepts like "high-contrast"
const dataMode = mode ? `[data-mode=${mode}]` : '';
return `${StyleDictionary.formatHelpers.fileHeader({
return `${await fileHeader({
file,
})}:root${dataTheme}${dataMode} {\n${darkTokens}\n}\n
${
Expand Down
15 changes: 7 additions & 8 deletions design-tokens/src/formats/esmGrommetRefs.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import StyleDictionary from 'style-dictionary';
import { FormatterArguments } from 'style-dictionary/types/Format.js';
import { fileHeader, minifyDictionary } from 'style-dictionary/utils';
import { FormatFn, FormatFnArguments } from 'style-dictionary/types';
import { getGrommetValue } from './utils/getGrommetValue.js';
import { jsonToNestedValue } from './utils/jsonToNestedValue.js';
import { access } from '../utils.js';
const { fileHeader } = StyleDictionary.formatHelpers;

export const esmGrommetRefs = ({
export const esmGrommetRefs: FormatFn = async ({
dictionary,
file,
platform = {},
}: FormatterArguments) => {
}: FormatFnArguments) => {
const { prefix } = platform;
let tokens = dictionary.tokens;
dictionary.allTokens.forEach((token: any) => {
const value = getGrommetValue(token, dictionary);
const originalToken = access(token.path.join('.'), tokens);
originalToken.value = value;
originalToken.$value = value;
});

tokens = prefix ? { [prefix]: tokens } : tokens;
const output = `${fileHeader({ file })}export default ${JSON.stringify(
jsonToNestedValue(tokens),
const output = `${await fileHeader({ file })}export default ${JSON.stringify(
jsonToNestedValue(minifyDictionary(tokens, true)), // build in minify
null,
2,
)}\n`;
Expand Down
1 change: 1 addition & 0 deletions design-tokens/src/formats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export { commonJsGrommetRefs } from './commonJsGrommetRefs.js';
export { cssColorModes } from './cssColorModes.js';
export { cssBreakpoints } from './cssBreakpoints.js';
export { esmGrommetRefs } from './esmGrommetRefs.js';
export { javascriptEsm } from './javascriptEsm.js';
export { jsonFlat } from './jsonFlat.js';
Loading

0 comments on commit 32b3758

Please sign in to comment.