Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ packages/react-components/react-virtualizer/stories @microsoft/xc-uxe @Mitch-At-
packages/react-components/react-skeleton/library @microsoft/cxe-prg

@fabricteam Fluent UI Team (fabricteam) Feb 19, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual regressions to review in the fluentui-web-components-v3 Visual Regression Report

Accordion 1 screenshots
Image Name Diff(in Pixels) Image Type
Accordion. - Dark Mode.normal.chromium_1.png 2660 Changed
Avatar 1 screenshots
Image Name Diff(in Pixels) Image Type
Avatar. - Dark Mode.normal.chromium.png 10569 Changed
Switch 2 screenshots
Image Name Diff(in Pixels) Image Type
Switch. - Dark Mode.hover.chromium_2.png 92 Changed
Switch. - Dark Mode.normal.chromium_1.png 92 Changed

packages/react-components/react-skeleton/stories @microsoft/cxe-prg
packages/tokens @microsoft/teams-prg
packages/semantic-tokens @microsoft/xc-uxe
packages/react-components/react-tags/library @microsoft/cxe-prg @microsoft/teams-prg
packages/react-components/react-tags/stories @microsoft/cxe-prg @microsoft/teams-prg
packages/react-components/react-migration-v0-v9/library @microsoft/teams-prg
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feat: Semantic token implementation",
"packageName": "@fluentui/react-link",
"email": "mifraser@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "feat: Initial semantic token package scaffolding",
"packageName": "@fluentui/semantic-tokens",
"email": "mifraser@microsoft.com",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"scripts/**/*",
"packages/eslint-plugin/**",
"packages/tokens/**",
"packages/semantic-tokens/**",
"packages/react-conformance/**",
"packages/react-components/**/*"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@fluentui/react-shared-contexts": "^9.21.2",
"@fluentui/react-tabster": "^9.24.0",
"@fluentui/react-theme": "^9.1.24",
"@fluentui/semantic-tokens": "0.0.0-alpha.1",
"@fluentui/react-utilities": "^9.18.20",
"@griffel/react": "^1.5.22",
"@swc/helpers": "^0.5.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,28 @@ import { tokens } from '@fluentui/react-theme';
import type { LinkSlots, LinkState } from './Link.types';
import type { SlotClassNames } from '@fluentui/react-utilities';

import {
ctrlFocusOuterStroke,
ctrlLinkForegroundBrandHover,
ctrlLinkForegroundBrandPressed,
ctrlLinkForegroundNeutralRest,
ctrlLinkForegroundNeutralHover,
ctrlLinkForegroundNeutralPressed,
foregroundCtrlNeutralPrimaryDisabled,
textGlobalBody3Fontsize,
textStyleDefaultRegularFontfamily,
textStyleDefaultRegularWeight,
strokewidthDefault,
ctrlLinkForegroundBrandRest,
} from '@fluentui/semantic-tokens';

export const linkClassNames: SlotClassNames<LinkSlots> = {
root: 'fui-Link',
};

const useStyles = makeStyles({
focusIndicator: createCustomFocusIndicatorStyle({
textDecorationColor: tokens.colorStrokeFocus2,
textDecorationColor: ctrlFocusOuterStroke,
textDecorationLine: 'underline',
textDecorationStyle: 'double',
outlineStyle: 'none',
Expand All @@ -22,29 +37,29 @@ const useStyles = makeStyles({
},
backgroundColor: 'transparent',
boxSizing: 'border-box',
color: tokens.colorBrandForegroundLink,
color: ctrlLinkForegroundBrandRest,
cursor: 'pointer',
display: 'inline',
fontFamily: tokens.fontFamilyBase,
fontSize: tokens.fontSizeBase300,
fontWeight: tokens.fontWeightRegular,
fontFamily: textStyleDefaultRegularFontfamily,
fontSize: textGlobalBody3Fontsize,
fontWeight: textStyleDefaultRegularWeight,
margin: '0',
padding: '0',
overflow: 'inherit',
textAlign: 'left',
textDecorationLine: 'none',
textDecorationThickness: tokens.strokeWidthThin,
textDecorationThickness: strokewidthDefault,
textOverflow: 'inherit',
userSelect: 'text',

':hover': {
textDecorationLine: 'underline',
color: tokens.colorBrandForegroundLinkHover,
color: ctrlLinkForegroundBrandHover,
},

':active': {
textDecorationLine: 'underline',
color: tokens.colorBrandForegroundLinkPressed,
color: ctrlLinkForegroundBrandPressed,
},
},
// Overrides when the Link renders as a button.
Expand All @@ -57,16 +72,16 @@ const useStyles = makeStyles({
},
// Overrides when the Link appears subtle.
subtle: {
color: tokens.colorNeutralForeground2,
color: ctrlLinkForegroundNeutralRest,

':hover': {
textDecorationLine: 'underline',
color: tokens.colorNeutralForeground2Hover,
color: ctrlLinkForegroundNeutralHover,
},

':active': {
textDecorationLine: 'underline',
color: tokens.colorNeutralForeground2Pressed,
color: ctrlLinkForegroundNeutralPressed,
},
},
// Overrides when the Link is rendered inline within text.
Expand All @@ -76,20 +91,21 @@ const useStyles = makeStyles({
// Overrides when the Link is disabled.
disabled: {
textDecorationLine: 'none',
color: tokens.colorNeutralForegroundDisabled,
color: foregroundCtrlNeutralPrimaryDisabled,
cursor: 'not-allowed',

':hover': {
textDecorationLine: 'none',
color: tokens.colorNeutralForegroundDisabled,
color: foregroundCtrlNeutralPrimaryDisabled,
},

':active': {
textDecorationLine: 'none',
color: tokens.colorNeutralForegroundDisabled,
color: foregroundCtrlNeutralPrimaryDisabled,
},
},

// TODO: Add semantic tokens for inverted colors (not yet defined).
inverted: {
color: tokens.colorBrandForegroundInverted,
':hover': {
Expand Down
3 changes: 3 additions & 0 deletions packages/semantic-tokens/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"]
}
12 changes: 12 additions & 0 deletions packages/semantic-tokens/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": ["plugin:@fluentui/eslint-plugin/react"],
"root": true,
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": ["@fluentui/*", "react", "react-dom"]
}
]
}
}
32 changes: 32 additions & 0 deletions packages/semantic-tokens/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"exclude": [
"/testing",
"/**/*.cy.ts",
"/**/*.cy.tsx",
"/**/*.spec-e2e.ts",
"/**/*.spec.ts",
"/**/*.spec.tsx",
"/**/*.test.ts",
"/**/*.test.tsx"
],
"jsc": {
"baseUrl": ".",
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": false,
"dynamicImport": false
},
"externalHelpers": true,
"transform": {
"react": {
"runtime": "classic",
"useSpread": true
}
},
"target": "es2019"
},
"minify": false,
"sourceMaps": true
}
4 changes: 4 additions & 0 deletions packages/semantic-tokens/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@fluentui/semantic-tokens",
"entries": []
}
5 changes: 5 additions & 0 deletions packages/semantic-tokens/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log - @fluentui/semantic-tokens

This log was last generated on Thurs, 2 Feb 2025 16:26:46 GMT and should not be manually modified.

<!-- Start content -->
15 changes: 15 additions & 0 deletions packages/semantic-tokens/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@fluentui/semantic-tokens

Copyright (c) Microsoft Corporation

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
3 changes: 3 additions & 0 deletions packages/semantic-tokens/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @fluentui/semantic-tokens

**Fluent UI Theme semantic-tokens**
6 changes: 6 additions & 0 deletions packages/semantic-tokens/config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluentui/scripts-api-extractor/api-extractor.common.v-next.json",

"mainEntryPointFilePath": "<projectFolder>/../../dist/out-tsc/types/packages/<unscopedPackageName>/src/index.d.ts"
}
1 change: 1 addition & 0 deletions packages/semantic-tokens/config/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** Jest test setup file. */
84 changes: 84 additions & 0 deletions packages/semantic-tokens/etc/semantic-tokens.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
## API Report File for "@fluentui/semantic-tokens"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
export const ctrlFocusOuterStroke: string;

// @public (undocumented)
export const ctrlLinkForegroundBrandHover: string;

// @public (undocumented)
export const ctrlLinkForegroundBrandHoverRaw = "--ctrl-link-foreground-brand-hover";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shipped prefixing our tokens with --smtc-, we shoudl probably align on that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little concerned this isn't matching the JSON I've received, it's easy enough for us to add but need to be sure we are all synced on this - can discuss this at our meeting today.


// @public (undocumented)
export const ctrlLinkForegroundBrandPressed: string;

// @public (undocumented)
export const ctrlLinkForegroundBrandPressedRaw = "--ctrl-link-foreground-brand-pressed";

// @public (undocumented)
export const ctrlLinkForegroundBrandRest: string;

// @public (undocumented)
export const ctrlLinkForegroundBrandRestRaw = "--ctrl-link-foreground-brand-rest";

// @public (undocumented)
export const ctrlLinkForegroundNeutralHover: string;

// @public (undocumented)
export const ctrlLinkForegroundNeutralHoverRaw = "--ctrl-link-foreground-neutral-hover";

// @public (undocumented)
export const ctrlLinkForegroundNeutralPressed: string;

// @public (undocumented)
export const ctrlLinkForegroundNeutralPressedRaw = "--ctrl-link-foreground-neutral-pressed";

// @public (undocumented)
export const ctrlLinkForegroundNeutralRest: string;

// @public (undocumented)
export const ctrlLinkForegroundNeutralRestRaw = "--ctrl-link-foreground-neutral-rest";

// @public (undocumented)
export const foregroundCtrlBrandHoverRaw = "--foreground-ctrl-brand-hover";

// @public (undocumented)
export const foregroundCtrlBrandPressedRaw = "--foreground-ctrl-brand-pressed";

// @public (undocumented)
export const foregroundCtrlBrandRestRaw = "--foreground-ctrl-brand-rest";

// @public (undocumented)
export const foregroundCtrlNeutralPrimaryDisabled: string;

// @public (undocumented)
export const foregroundCtrlNeutralPrimaryHoverRaw = "--foreground-ctrl-neutral-primary-hover";

// @public (undocumented)
export const foregroundCtrlNeutralPrimaryPressedRaw = "--foreground-ctrl-neutral-primary-pressed";

// @public (undocumented)
export const foregroundCtrlNeutralPrimaryRestRaw = "--foreground-ctrl-neutral-primary-rest";

// @public (undocumented)
export const foregroundCtrlOntransparentDisabled: string;

// @public (undocumented)
export const strokewidthDefault: string;

// @public (undocumented)
export const textGlobalBody3Fontsize: string;

// @public (undocumented)
export const textStyleDefaultRegularFontfamily: string;

// @public (undocumented)
export const textStyleDefaultRegularWeight: string;

// (No @packageDocumentation comment for this package)

```
33 changes: 33 additions & 0 deletions packages/semantic-tokens/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// @ts-check
/* eslint-disable */

const { readFileSync } = require('node:fs');
const { join } = require('node:path');

// Reading the SWC compilation config and remove the "exclude"
// for the test files to be compiled by SWC
const { exclude: _, ...swcJestConfig } = JSON.parse(readFileSync(join(__dirname, '.swcrc'), 'utf-8'));

// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
if (swcJestConfig.swcrc === undefined) {
swcJestConfig.swcrc = false;
}

// Uncomment if using global setup/teardown files being transformed via swc
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
// jest needs EsModule Interop to find the default exported setup/teardown functions
// swcJestConfig.module.noInterop = false;

/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
displayName: 'semantic-tokens',
preset: '../../jest.preset.js',
transform: {
'^.+\\.tsx?$': ['@swc/jest', swcJestConfig],
},
coverageDirectory: './coverage',
setupFilesAfterEnv: ['./config/tests.js'],
};
Loading