Skip to content

Commit ea5e7e4

Browse files
authored
Bring design tokens and styles closer to design token community group guidelines (#74)
* Bring design tokens and styles closer to design token community group guidelines - Add token bridge and helpers between CG standard types and Adaptive UI - Updated border radius and thickness tokens and migrated to style modules - Updated font tokens
1 parent 66d7aba commit ea5e7e4

File tree

64 files changed

+875
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+875
-506
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
22
"extends": ["@microsoft/eslint-config-fast-dna"],
3-
"ignorePatterns": ["dist", "*.spec.ts"]
3+
"ignorePatterns": ["dist", "*.spec.ts"],
4+
"rules": {
5+
"max-len": "warn"
6+
}
47
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Bridge token structure between Adaptive UI and DT community group",
4+
"packageName": "@adaptive-web/adaptive-ui",
5+
"email": "47367562+bheston@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Migrate border styling to modules",
4+
"packageName": "@adaptive-web/adaptive-web-components",
5+
"email": "47367562+bheston@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

examples/customize-component/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
accentFillReadableControlStyles,
3-
accentStrokeReadableInteractiveSet,
3+
accentStrokeReadable,
44
accentStrokeReadableRecipe,
55
createForegroundSet,
6-
neutralFillSubtleInteractiveSet,
6+
neutralFillSubtle,
77
Styles,
88
} from '@adaptive-web/adaptive-ui';
99
import {
@@ -35,9 +35,9 @@ AdaptiveDesignSystem.defineComponents({
3535

3636
// Define a custom style module.
3737
const accentOutlineReadableControlStyles: Styles = Styles.fromProperties({
38-
backgroundFill: neutralFillSubtleInteractiveSet,
39-
borderFill: accentStrokeReadableInteractiveSet,
40-
foregroundFill: createForegroundSet(accentStrokeReadableRecipe, "rest", neutralFillSubtleInteractiveSet),
38+
backgroundFill: neutralFillSubtle,
39+
borderFill: accentStrokeReadable,
40+
foregroundFill: createForegroundSet(accentStrokeReadableRecipe, "rest", neutralFillSubtle),
4141
});
4242

4343
const myDS = new DesignSystem("my");

packages/adaptive-ui-explorer/src/components/style-example.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { fillColor, InteractiveTokenSet, StyleProperty, Styles, Swatch } from "@adaptive-web/adaptive-ui";
1+
import { fillColor, InteractiveTokenGroup, StyleProperty, Styles, Swatch, TypedCSSDesignToken } from "@adaptive-web/adaptive-ui";
22
import { css, customElement, FASTElement, html, observable, repeat, volatile } from "@microsoft/fast-element";
3-
import { CSSDesignToken } from "@microsoft/fast-foundation";
43
import { SwatchType } from "./swatch.js";
54
import "./adaptive-component.js";
65
import "./swatch.js";
@@ -43,9 +42,9 @@ const styles = css`
4342
interface StyleValue {
4443
type: SwatchType;
4544
tokenName: string;
46-
foregroundRecipe?: CSSDesignToken<Swatch>;
47-
fillRecipe?: CSSDesignToken<Swatch>;
48-
outlineRecipe?: CSSDesignToken<Swatch>;
45+
foregroundRecipe?: TypedCSSDesignToken<Swatch>;
46+
fillRecipe?: TypedCSSDesignToken<Swatch>;
47+
outlineRecipe?: TypedCSSDesignToken<Swatch>;
4948
}
5049

5150
@customElement({
@@ -70,15 +69,15 @@ export class StyleExample extends FASTElement {
7069
if (backgroundValue) {
7170
if (typeof backgroundValue === "string") {
7271
// ignore for now
73-
} else if (backgroundValue instanceof CSSDesignToken) {
72+
} else if (backgroundValue instanceof TypedCSSDesignToken) {
7473
backgroundRest = backgroundValue;
7574
values.push({
7675
type: SwatchType.fill,
77-
tokenName: (backgroundValue as CSSDesignToken<any>).name,
76+
tokenName: (backgroundValue as TypedCSSDesignToken<any>).name,
7877
fillRecipe: backgroundValue,
7978
});
8079
} else {
81-
const set = backgroundValue as InteractiveTokenSet<any>;
80+
const set = backgroundValue as InteractiveTokenGroup<any>;
8281
backgroundRest = set.rest;
8382
backgroundHover = set.hover;
8483
backgroundActive = set.active;
@@ -110,15 +109,15 @@ export class StyleExample extends FASTElement {
110109
if (colorValue) {
111110
if (typeof colorValue === "string") {
112111
// ignore for now
113-
} else if (colorValue instanceof CSSDesignToken) {
112+
} else if (colorValue instanceof TypedCSSDesignToken) {
114113
values.push({
115114
type: SwatchType.foreground,
116-
tokenName: (colorValue as CSSDesignToken<any>).name,
115+
tokenName: (colorValue as TypedCSSDesignToken<any>).name,
117116
foregroundRecipe: colorValue,
118117
fillRecipe: backgroundRest,
119118
});
120119
} else {
121-
const set = colorValue as InteractiveTokenSet<any>;
120+
const set = colorValue as InteractiveTokenGroup<any>;
122121
values.push({
123122
type: SwatchType.foreground,
124123
tokenName: set.rest.name,
@@ -150,15 +149,15 @@ export class StyleExample extends FASTElement {
150149
if (borderValue) {
151150
if (typeof borderValue === "string") {
152151
// ignore for now
153-
} else if (borderValue instanceof CSSDesignToken) {
152+
} else if (borderValue instanceof TypedCSSDesignToken) {
154153
values.push({
155154
type: SwatchType.outline,
156-
tokenName: (borderValue as CSSDesignToken<any>).name,
155+
tokenName: (borderValue as TypedCSSDesignToken<any>).name,
157156
outlineRecipe: borderValue,
158157
fillRecipe: backgroundRest,
159158
});
160159
} else {
161-
const set = borderValue as InteractiveTokenSet<any>;
160+
const set = borderValue as InteractiveTokenGroup<any>;
162161
values.push({
163162
type: SwatchType.outline,
164163
tokenName: set.rest.name,

0 commit comments

Comments
 (0)