@fluentui/web-components 2.4.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +29 -2
  3. package/dist/dts/_docs/design-system/color-explorer/app.d.ts +25 -0
  4. package/dist/dts/_docs/design-system/color-explorer/colors.d.ts +13 -0
  5. package/dist/dts/_docs/design-system/color-explorer/component-types.d.ts +6 -0
  6. package/dist/dts/_docs/design-system/color-explorer/components/color-block.d.ts +10 -0
  7. package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.d.ts +190 -0
  8. package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.form-associated.d.ts +15 -0
  9. package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.styles.d.ts +3 -0
  10. package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.template.d.ts +8 -0
  11. package/dist/dts/_docs/design-system/color-explorer/components/color-picker/index.d.ts +9 -0
  12. package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.d.ts +8 -0
  13. package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.styles.d.ts +1 -0
  14. package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.template.d.ts +2 -0
  15. package/dist/dts/_docs/design-system/color-explorer/components/control-pane/index.d.ts +6 -0
  16. package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.d.ts +5 -0
  17. package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.styles.d.ts +1 -0
  18. package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.template.d.ts +2 -0
  19. package/dist/dts/_docs/design-system/color-explorer/components/gradient/index.d.ts +6 -0
  20. package/dist/dts/_docs/design-system/color-explorer/components/layer-background/index.d.ts +21 -0
  21. package/dist/dts/_docs/design-system/color-explorer/components/sample-app/index.d.ts +6 -0
  22. package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.d.ts +3 -0
  23. package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.styles.d.ts +1 -0
  24. package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.template.d.ts +1 -0
  25. package/dist/dts/_docs/design-system/color-explorer/components/sample-page/index.d.ts +6 -0
  26. package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.d.ts +3 -0
  27. package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.styles.d.ts +1 -0
  28. package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.template.d.ts +1 -0
  29. package/dist/dts/_docs/design-system/color-explorer/components/swatch.d.ts +30 -0
  30. package/dist/dts/_docs/design-system/color-explorer/custom-elements.d.ts +7 -0
  31. package/dist/dts/_docs/design-system/color-explorer/index.d.ts +2 -0
  32. package/dist/dts/design-tokens.d.ts +20 -0
  33. package/dist/dts/styles/patterns/index.d.ts +1 -0
  34. package/dist/dts/styles/patterns/type-ramp.d.ts +18 -0
  35. package/dist/dts/utilities/type-ramp.d.ts +12 -0
  36. package/dist/esm/_docs/design-system/color-explorer/app.js +247 -0
  37. package/dist/esm/_docs/design-system/color-explorer/colors.js +24 -0
  38. package/dist/esm/_docs/design-system/color-explorer/component-types.js +7 -0
  39. package/dist/esm/_docs/design-system/color-explorer/components/color-block.js +408 -0
  40. package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.form-associated.js +16 -0
  41. package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.js +297 -0
  42. package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.styles.js +124 -0
  43. package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.template.js +130 -0
  44. package/dist/esm/_docs/design-system/color-explorer/components/color-picker/index.js +15 -0
  45. package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.js +24 -0
  46. package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.styles.js +19 -0
  47. package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.template.js +52 -0
  48. package/dist/esm/_docs/design-system/color-explorer/components/control-pane/index.js +18 -0
  49. package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.js +11 -0
  50. package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.styles.js +31 -0
  51. package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.template.js +21 -0
  52. package/dist/esm/_docs/design-system/color-explorer/components/gradient/index.js +18 -0
  53. package/dist/esm/_docs/design-system/color-explorer/components/layer-background/index.js +70 -0
  54. package/dist/esm/_docs/design-system/color-explorer/components/sample-app/index.js +18 -0
  55. package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.js +3 -0
  56. package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.styles.js +166 -0
  57. package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.template.js +97 -0
  58. package/dist/esm/_docs/design-system/color-explorer/components/sample-page/index.js +18 -0
  59. package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.js +3 -0
  60. package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.styles.js +130 -0
  61. package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.template.js +82 -0
  62. package/dist/esm/_docs/design-system/color-explorer/components/swatch.js +163 -0
  63. package/dist/esm/_docs/design-system/color-explorer/custom-elements.js +3 -0
  64. package/dist/esm/_docs/design-system/color-explorer/index.js +14 -0
  65. package/dist/esm/accordion/accordion-item/accordion-item.styles.js +4 -5
  66. package/dist/esm/accordion/accordion.styles.js +3 -4
  67. package/dist/esm/badge/badge.styles.js +3 -4
  68. package/dist/esm/breadcrumb/breadcrumb.styles.js +2 -4
  69. package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +3 -4
  70. package/dist/esm/calendar/calendar.styles.js +3 -4
  71. package/dist/esm/checkbox/checkbox.styles.js +3 -4
  72. package/dist/esm/combobox/combobox.styles.js +3 -3
  73. package/dist/esm/data-grid/data-grid-cell.styles.js +3 -5
  74. package/dist/esm/design-tokens.js +38 -1
  75. package/dist/esm/listbox-option/listbox-option.styles.js +3 -4
  76. package/dist/esm/menu-item/menu-item.styles.js +3 -4
  77. package/dist/esm/radio/radio.styles.js +3 -4
  78. package/dist/esm/search/search.styles.js +3 -4
  79. package/dist/esm/select/select.styles.js +3 -4
  80. package/dist/esm/slider-label/slider-label.styles.js +3 -2
  81. package/dist/esm/styles/patterns/button.styles.js +3 -4
  82. package/dist/esm/styles/patterns/index.js +1 -0
  83. package/dist/esm/styles/patterns/input.styles.js +4 -6
  84. package/dist/esm/styles/patterns/type-ramp.js +74 -0
  85. package/dist/esm/switch/switch.styles.js +4 -5
  86. package/dist/esm/tabs/tab/tab.styles.js +3 -5
  87. package/dist/esm/tabs/tab-panel/tab-panel.styles.js +3 -5
  88. package/dist/esm/tabs/tabs.styles.js +3 -4
  89. package/dist/esm/tooltip/tooltip.styles.js +3 -4
  90. package/dist/esm/tree-item/tree-item.styles.js +3 -4
  91. package/dist/esm/utilities/type-ramp.js +12 -0
  92. package/dist/fluent-web-components.api.json +534 -0
  93. package/dist/web-components.d.ts +57 -0
  94. package/dist/web-components.js +191 -28
  95. package/dist/web-components.min.js +211 -139
  96. package/docs/api-report.md +57 -0
  97. package/package.json +2 -2
  98. package/public/SegoeUI-VF.ttf +0 -0
@@ -0,0 +1,82 @@
1
+ import { html } from '@microsoft/fast-element';
2
+ // import MoreIcon from "@fluentui/svg-icons/icons/more_horizontal_20_regular.svg";
3
+ // import DownloadIcon from "@fluentui/svg-icons/icons/arrow_download_20_regular.svg";
4
+ // import PlayIcon from "@fluentui/svg-icons/icons/play_20_regular.svg";
5
+ export const samplePageTemplate = html `
6
+ <template>
7
+ <fluent-card>
8
+ <div class="image-container">
9
+ <fluent-badge fill="primary" color="primary" class="badge"> Badge </fluent-badge>
10
+ </div>
11
+ <div class="text-container">
12
+ <h3>Example card</h3>
13
+ <p>
14
+ At purus lectus quis habitant commodo, cras. Aliquam malesuada velit a tortor. Felis orci tellus netus risus
15
+ et ultricies augue aliquet. Suscipit mattis mus amet nibh...
16
+ </p>
17
+ <fluent-divider></fluent-divider>
18
+ <div class="sample-control">
19
+ <span class="sample-control-icon"></span>
20
+ <span class="sample-control-text">Label</span>
21
+ <div class="sample-control-actions">
22
+ <fluent-button appearance="stealth" aria-label="Example 'more' button">
23
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
24
+ <path
25
+ d="M6.25 10a1.25 1.25 0 11-2.5 0 1.25 1.25 0 012.5 0zm5 0a1.25 1.25 0 11-2.5 0 1.25 1.25 0 012.5 0zM15 11.25a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5z"
26
+ />
27
+ </svg>
28
+ </fluent-button>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </fluent-card>
33
+ <div class="preview-controls">
34
+ <fluent-progress aria-label="Example progress bar"></fluent-progress>
35
+ <fluent-menu aria-label="Example menu">
36
+ <fluent-menu-item role="menuitem" aria-label="Example menu item"> Menu item 1 </fluent-menu-item>
37
+ <fluent-menu-item role="menuitem" aria-label="Example menu item"> Menu item 2 </fluent-menu-item>
38
+ <fluent-menu-item role="menuitem" aria-label="Example menu item"> Menu item 3 </fluent-menu-item>
39
+ <fluent-divider></fluent-divider>
40
+ <fluent-menu-item role="menuitem" aria-label="Example menu item"> Menu item 4 </fluent-menu-item>
41
+ </fluent-menu>
42
+ <div class="control-container">
43
+ <fluent-radio-group class="example-radios" name="example radio group" orientation="vertical">
44
+ <fluent-radio aria-label="Example radio 1">Radio 1</fluent-radio>
45
+ <fluent-radio aria-label="Example radio 2">Radio 2</fluent-radio>
46
+ </fluent-radio-group>
47
+ <div class="control-container-grid">
48
+ <fluent-switch aria-label="Example toggle">Toggle</fluent-switch>
49
+ <fluent-checkbox class="checkbox" aria-label="Example checkbox"> Checkbox </fluent-checkbox>
50
+ </div>
51
+ </div>
52
+ <fluent-text-field placeholder="Text field" aria-label="Example text field"></fluent-text-field>
53
+ <div class="control-container-2">
54
+ <fluent-slider aria-label="Example slider"></fluent-slider>
55
+ <fluent-flipper></fluent-flipper>
56
+ <fluent-flipper disabled></fluent-flipper>
57
+ </div>
58
+ <div class="control-container">
59
+ <fluent-button appearance="accent" aria-label="Example 'download' button">
60
+ Button
61
+ <span slot="start">
62
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
63
+ <path
64
+ d="M15.5 17a.5.5 0 01.09 1H4.5a.5.5 0 01-.09-1H15.5zM10 2a.5.5 0 01.5.41V14.3l3.64-3.65a.5.5 0 01.64-.06l.07.06c.17.17.2.44.06.63l-.06.07-4.5 4.5a.5.5 0 01-.25.14L10 16a.5.5 0 01-.4-.2l-4.46-4.45a.5.5 0 01.64-.76l.07.06 3.65 3.64V2.5c0-.27.22-.5.5-.5z"
65
+ />
66
+ </svg>
67
+ </span>
68
+ </fluent-button>
69
+ <fluent-button appearance="neutral" aria-label="Example 'play' button">
70
+ Button
71
+ <span slot="start">
72
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
73
+ <path
74
+ d="M17.22 8.69a1.5 1.5 0 010 2.62l-10 5.5A1.5 1.5 0 015 15.5v-11A1.5 1.5 0 017.22 3.2l10 5.5zm-.48 1.75a.5.5 0 000-.88l-10-5.5A.5.5 0 006 4.5v11c0 .38.4.62.74.44l10-5.5z"
75
+ />
76
+ </svg>
77
+ </span>
78
+ </fluent-button>
79
+ </div>
80
+ </div>
81
+ </template>
82
+ `;
@@ -0,0 +1,163 @@
1
+ import { __decorate } from "tslib";
2
+ import { contrastRatio, parseColor } from '@microsoft/fast-colors';
3
+ import { attr, css, customElement, html, observable } from '@microsoft/fast-element';
4
+ import { FoundationElement } from '@microsoft/fast-foundation';
5
+ import { elevation, fillColor, neutralForegroundHint } from '../../../../index-rollup';
6
+ export var SwatchTypes;
7
+ (function (SwatchTypes) {
8
+ SwatchTypes["fill"] = "fill";
9
+ SwatchTypes["foreground"] = "foreground";
10
+ SwatchTypes["outline"] = "outline";
11
+ })(SwatchTypes || (SwatchTypes = {}));
12
+ const template = html `
13
+ <template class="${x => x.type}">
14
+ <div class="icon" style="${x => x.iconStyle}" title="${x => x.contrastMessage}"></div>
15
+ <code class="recipe-name"> ${x => x.recipeName} </code>
16
+ <code class="hex-code"> ${x => x.colorValue} </code>
17
+ </template>
18
+ `;
19
+ const styles = css `
20
+ :host {
21
+ display: grid;
22
+ grid-template-columns: auto 1fr auto;
23
+ grid-template-rows: auto;
24
+ align-items: center;
25
+ width: 100%;
26
+ padding: 4px 0;
27
+ box-sizing: border-box;
28
+ color: ${neutralForegroundHint};
29
+ font-size: 12px;
30
+ grid-column-gap: 16px;
31
+ justify-items: start;
32
+ }
33
+ :host(.foreground) .icon {
34
+ border: 1px solid black;
35
+ }
36
+ :host(.foreground) .icon::before {
37
+ font-size: 13px;
38
+ content: 'A';
39
+ font-weight: 400;
40
+ }
41
+ .icon {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: 20px;
46
+ height: 20px;
47
+ border-radius: 2px;
48
+ box-sizing: border-box;
49
+ --elevation: 4;
50
+ ${elevation}
51
+ }
52
+ .recipe-name {
53
+ grid-column: 2;
54
+ grid-row: 1;
55
+ }
56
+ .hex-code {
57
+ grid-column: 3;
58
+ grid-row: 1;
59
+ }
60
+ `;
61
+ let AppSwatch = class AppSwatch extends FoundationElement {
62
+ foregroundRecipeChanged() {
63
+ this.updateObservables();
64
+ }
65
+ fillRecipeChanged() {
66
+ this.updateObservables();
67
+ }
68
+ outlineRecipeChanged() {
69
+ this.updateObservables();
70
+ }
71
+ connectedCallback() {
72
+ super.connectedCallback();
73
+ const fillColorChangeHandler = () => {
74
+ this.updateObservables();
75
+ };
76
+ fillColor.subscribe({
77
+ handleChange: fillColorChangeHandler,
78
+ }, this);
79
+ this.updateObservables();
80
+ }
81
+ updateObservables() {
82
+ this.updateIconStyle();
83
+ this.updateContrastMessage();
84
+ this.updateColorValue();
85
+ }
86
+ tokenCSS(token) {
87
+ return token && typeof token.createCSS === 'function' ? token.createCSS() : '';
88
+ }
89
+ evaluateToken(token) {
90
+ return (token === null || token === void 0 ? void 0 : token.getValueFor(this).toColorString()) || '';
91
+ }
92
+ updateIconStyle() {
93
+ const background = `background-color: ${this.tokenCSS(this.fillRecipe)}`;
94
+ this.iconStyle =
95
+ this.type === SwatchTypes.outline
96
+ ? `border: 4px solid ${this.tokenCSS(this.outlineRecipe)}; ${background}`
97
+ : this.type === SwatchTypes.foreground
98
+ ? `color: ${this.tokenCSS(this.foregroundRecipe)}; ${background}`
99
+ : background;
100
+ }
101
+ formatContrast(a, b) {
102
+ return a && b
103
+ ? contrastRatio(parseColor(this.evaluateToken(a)), parseColor(this.evaluateToken(b))).toFixed(2)
104
+ : '';
105
+ }
106
+ formatBackgroundContrast(a, b) {
107
+ return `BG contrast: ${this.formatContrast(a, b)} : 1`;
108
+ }
109
+ formatForegroundContrast(a, b) {
110
+ return `Text contrast: ${this.formatContrast(a, b)} : 1`;
111
+ }
112
+ updateContrastMessage() {
113
+ const backgroundContrastMessage = this.formatBackgroundContrast(this.type === SwatchTypes.foreground
114
+ ? this.foregroundRecipe
115
+ : this.type === SwatchTypes.outline
116
+ ? this.outlineRecipe
117
+ : this.fillRecipe, this.type === SwatchTypes.foreground || this.type === SwatchTypes.outline ? this.fillRecipe : fillColor);
118
+ this.contrastMessage =
119
+ this.type === SwatchTypes.fill
120
+ ? backgroundContrastMessage.concat('\n', this.formatForegroundContrast(this.fillRecipe, this.foregroundRecipe))
121
+ : backgroundContrastMessage;
122
+ }
123
+ updateColorValue() {
124
+ const recipe = this.type === SwatchTypes.outline
125
+ ? this.outlineRecipe
126
+ : this.type === SwatchTypes.foreground
127
+ ? this.foregroundRecipe
128
+ : this.fillRecipe;
129
+ this.colorValue = this.evaluateToken(recipe).toUpperCase();
130
+ }
131
+ };
132
+ __decorate([
133
+ attr
134
+ ], AppSwatch.prototype, "type", void 0);
135
+ __decorate([
136
+ attr({ attribute: 'recipe-name' })
137
+ ], AppSwatch.prototype, "recipeName", void 0);
138
+ __decorate([
139
+ observable
140
+ ], AppSwatch.prototype, "foregroundRecipe", void 0);
141
+ __decorate([
142
+ observable
143
+ ], AppSwatch.prototype, "fillRecipe", void 0);
144
+ __decorate([
145
+ observable
146
+ ], AppSwatch.prototype, "outlineRecipe", void 0);
147
+ __decorate([
148
+ observable
149
+ ], AppSwatch.prototype, "iconStyle", void 0);
150
+ __decorate([
151
+ observable
152
+ ], AppSwatch.prototype, "contrastMessage", void 0);
153
+ __decorate([
154
+ observable
155
+ ], AppSwatch.prototype, "colorValue", void 0);
156
+ AppSwatch = __decorate([
157
+ customElement({
158
+ name: 'app-swatch',
159
+ template,
160
+ styles,
161
+ })
162
+ ], AppSwatch);
163
+ export { AppSwatch };
@@ -0,0 +1,3 @@
1
+ import { layerBackground } from './components/layer-background';
2
+ export { layerBackground };
3
+ export const appComponents = [layerBackground()];
@@ -0,0 +1,14 @@
1
+ import { allComponents as fluentComponents, provideFluentDesignSystem } from '../../../index-rollup';
2
+ import { fastToolingColorPicker } from './components/color-picker';
3
+ import { App } from './app';
4
+ import { appComponents } from './custom-elements';
5
+ export function init() {
6
+ provideFluentDesignSystem()
7
+ .register(fluentComponents)
8
+ .withPrefix('fast-tooling')
9
+ .register(fastToolingColorPicker())
10
+ .withPrefix('app')
11
+ .register(appComponents);
12
+ }
13
+ App;
14
+ export { App } from './app';
@@ -1,7 +1,8 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { DesignToken, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
- import { bodyFont, controlCornerRadius, designUnit, focusStrokeOuter, focusStrokeWidth, layerCornerRadius, neutralFillLayerAltRest, neutralFillLayerRecipe, neutralFillLayerRest, neutralFillStealthRecipe, neutralForegroundRest, neutralStrokeLayerRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../../design-tokens';
4
+ import { controlCornerRadius, designUnit, focusStrokeOuter, focusStrokeWidth, layerCornerRadius, neutralFillLayerAltRest, neutralFillLayerRecipe, neutralFillLayerRest, neutralFillStealthRecipe, neutralForegroundRest, neutralStrokeLayerRest, strokeWidth, } from '../../design-tokens';
5
+ import { typeRampBase } from '../../styles/patterns/type-ramp';
5
6
  import { heightNumber } from '../../styles/size';
6
7
  const neutralFillStealthRestOnNeutralFillLayerRest = DesignToken.create('neutral-fill-stealth-rest-on-neutral-fill-layer-rest').withDefault((target) => {
7
8
  const baseRecipe = neutralFillLayerRecipe.getValueFor(target);
@@ -21,10 +22,8 @@ const neutralFillStealthActiveOnNeutralFillLayerRest = DesignToken.create('neutr
21
22
  export const accordionItemStyles = (context, definition) => css `
22
23
  ${display('flex')} :host {
23
24
  box-sizing: border-box;
24
- font-family: ${bodyFont};
25
+ ${typeRampBase};
25
26
  flex-direction: column;
26
- font-size: ${typeRampBaseFontSize};
27
- line-height: ${typeRampBaseLineHeight};
28
27
  background: ${neutralFillLayerRest};
29
28
  color: ${neutralForegroundRest};
30
29
  border: calc(${strokeWidth} * 1px) solid ${neutralStrokeLayerRest};
@@ -56,7 +55,7 @@ export const accordionItemStyles = (context, definition) => css `
56
55
  text-align: left;
57
56
  color: inherit;
58
57
  cursor: pointer;
59
- font-family: inherit;
58
+ font: inherit;
60
59
  }
61
60
 
62
61
  .button::before {
@@ -1,13 +1,12 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { bodyFont, designUnit, neutralForegroundRest, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
3
+ import { designUnit, neutralForegroundRest } from '../design-tokens';
4
+ import { typeRampBase } from '../styles/patterns/type-ramp';
4
5
  export const accordionStyles = (context, definition) => css `
5
6
  ${display('flex')} :host {
6
7
  box-sizing: border-box;
7
8
  flex-direction: column;
8
- font-family: ${bodyFont};
9
- font-size: ${typeRampBaseFontSize};
10
- line-height: ${typeRampBaseLineHeight};
9
+ ${typeRampBase}
11
10
  color: ${neutralForegroundRest};
12
11
  gap: calc(${designUnit} * 1px);
13
12
  }
@@ -1,12 +1,11 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { accentFillRest, bodyFont, controlCornerRadius, designUnit, foregroundOnAccentRest, neutralFillSecondaryRest, neutralForegroundRest, strokeWidth, typeRampMinus1FontSize, typeRampMinus1LineHeight, } from '../design-tokens';
3
+ import { accentFillRest, controlCornerRadius, designUnit, foregroundOnAccentRest, neutralFillSecondaryRest, neutralForegroundRest, strokeWidth, typeRampMinus1LineHeight, } from '../design-tokens';
4
+ import { typeRampMinus1 } from '../styles/patterns/type-ramp';
4
5
  export const badgeStyles = (context, definition) => css `
5
6
  ${display('inline-block')} :host {
6
7
  box-sizing: border-box;
7
- font-family: ${bodyFont};
8
- font-size: ${typeRampMinus1FontSize};
9
- line-height: ${typeRampMinus1LineHeight};
8
+ ${typeRampMinus1};
10
9
  }
11
10
 
12
11
  .control {
@@ -1,12 +1,10 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { bodyFont, typeRampBaseFontSize, typeRampBaseLineHeight } from '../design-tokens';
3
+ import { typeRampBase } from '../styles/patterns/type-ramp';
4
4
  export const breadcrumbStyles = (context, definition) => css `
5
5
  ${display('inline-block')} :host {
6
6
  box-sizing: border-box;
7
- font-family: ${bodyFont};
8
- font-size: ${typeRampBaseFontSize};
9
- line-height: ${typeRampBaseLineHeight};
7
+ ${typeRampBase};
10
8
  }
11
9
 
12
10
  .list {
@@ -1,7 +1,8 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
- import { bodyFont, controlCornerRadius, focusStrokeOuter, focusStrokeWidth, neutralForegroundActive, neutralForegroundHover, neutralForegroundRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
4
+ import { controlCornerRadius, focusStrokeOuter, focusStrokeWidth, neutralForegroundActive, neutralForegroundHover, neutralForegroundRest, strokeWidth, } from '../design-tokens';
5
+ import { typeRampBase } from '../styles/patterns/type-ramp';
5
6
  import { heightNumber } from '../styles/index';
6
7
  export const breadcrumbItemStyles = (context, definition) => css `
7
8
  ${display('inline-flex')} :host {
@@ -9,9 +10,7 @@ export const breadcrumbItemStyles = (context, definition) => css `
9
10
  color: ${neutralForegroundRest};
10
11
  fill: currentcolor;
11
12
  box-sizing: border-box;
12
- font-family: ${bodyFont};
13
- font-size: ${typeRampBaseFontSize};
14
- line-height: ${typeRampBaseLineHeight};
13
+ ${typeRampBase};
15
14
  min-width: calc(${heightNumber} * 1px);
16
15
  border-radius: calc(${controlCornerRadius} * 1px);
17
16
  outline: none;
@@ -1,8 +1,9 @@
1
1
  import { css } from "@microsoft/fast-element";
2
2
  import { display, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
- import { accentFillRest, baseHeightMultiplier, bodyFont, controlCornerRadius, density, designUnit, fillColor, foregroundOnAccentRest, neutralForegroundHint, neutralForegroundRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
4
+ import { accentFillRest, baseHeightMultiplier, controlCornerRadius, density, designUnit, fillColor, foregroundOnAccentRest, neutralForegroundHint, neutralForegroundRest, strokeWidth, } from '../design-tokens';
5
5
  import { DirectionalStyleSheetBehavior } from '../styles';
6
+ import { typeRampBase } from '../styles/patterns/type-ramp';
6
7
  /**
7
8
  * LTR styles for calendar
8
9
  * @internal
@@ -29,9 +30,7 @@ export const calendarStyles = (context, definition) => css `
29
30
  ${display("inline-block")} :host {
30
31
  --calendar-cell-size: calc((${baseHeightMultiplier} + 2 + ${density}) * ${designUnit} * 1px);
31
32
  --calendar-gap: 2px;
32
- font-family: ${bodyFont};
33
- font-size: ${typeRampBaseFontSize};
34
- line-height: ${typeRampBaseLineHeight};
33
+ ${typeRampBase}
35
34
  color: ${neutralForegroundRest};
36
35
  }
37
36
 
@@ -2,7 +2,8 @@ import { css } from '@microsoft/fast-element';
2
2
  import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
4
  import { heightNumber } from '../styles';
5
- import { accentFillActive, accentFillHover, accentFillRest, bodyFont, controlCornerRadius, designUnit, disabledOpacity, fillColor, focusStrokeOuter, foregroundOnAccentRest, neutralFillInputAltActive, neutralFillInputAltFocus, neutralFillInputAltHover, neutralFillInputAltRest, neutralForegroundRest, neutralStrokeStrongActive, neutralStrokeStrongHover, neutralStrokeStrongRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { accentFillActive, accentFillHover, accentFillRest, controlCornerRadius, designUnit, disabledOpacity, fillColor, focusStrokeOuter, foregroundOnAccentRest, neutralFillInputAltActive, neutralFillInputAltFocus, neutralFillInputAltHover, neutralFillInputAltRest, neutralForegroundRest, neutralStrokeStrongActive, neutralStrokeStrongHover, neutralStrokeStrongRest, strokeWidth, } from '../design-tokens';
6
+ import { typeRampBase } from '../styles/patterns/type-ramp';
6
7
  export const checkboxStyles = (context, definition) => css `
7
8
  ${display('inline-flex')} :host {
8
9
  align-items: center;
@@ -32,14 +33,12 @@ export const checkboxStyles = (context, definition) => css `
32
33
  }
33
34
 
34
35
  .label {
35
- font-family: ${bodyFont};
36
+ ${typeRampBase}
36
37
  color: ${neutralForegroundRest};
37
38
  ${
38
39
  /* Need to discuss with Brian how HorizontalSpacingNumber can work. https://github.com/microsoft/fast/issues/2766 */ ''} padding-inline-start: calc(${designUnit} * 2px + 2px);
39
40
  margin-inline-end: calc(${designUnit} * 2px + 2px);
40
41
  cursor: pointer;
41
- font-size: ${typeRampBaseFontSize};
42
- line-height: ${typeRampBaseLineHeight};
43
42
  }
44
43
 
45
44
  slot[name='checked-indicator'],
@@ -2,7 +2,8 @@ import { css } from '@microsoft/fast-element';
2
2
  import { disabledCursor, focusVisible } from '@microsoft/fast-foundation';
3
3
  import { selectFilledStyles, selectStyles } from '../select/select.styles';
4
4
  import { appearanceBehavior } from '../utilities/behaviors';
5
- import { strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight } from '../design-tokens';
5
+ import { strokeWidth } from '../design-tokens';
6
+ import { typeRampBase } from '../styles/patterns/type-ramp';
6
7
  export const comboboxStyles = (context, definition) => css `
7
8
  ${selectStyles(context, definition)}
8
9
 
@@ -25,8 +26,7 @@ export const comboboxStyles = (context, definition) => css `
25
26
  background: transparent;
26
27
  border: none;
27
28
  color: inherit;
28
- font-size: ${typeRampBaseFontSize};
29
- line-height: ${typeRampBaseLineHeight};
29
+ ${typeRampBase}
30
30
  height: calc(100% - ${strokeWidth} * 1px));
31
31
  margin: auto 0;
32
32
  width: 100%;
@@ -1,16 +1,14 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { SystemColors } from '@microsoft/fast-web-utilities';
3
3
  import { focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
4
- import { bodyFont, controlCornerRadius, designUnit, focusStrokeOuter, focusStrokeWidth, neutralForegroundRest, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
4
+ import { controlCornerRadius, designUnit, focusStrokeOuter, focusStrokeWidth, neutralForegroundRest, } from '../design-tokens';
5
+ import { typeRampBase } from '../styles/patterns/type-ramp';
5
6
  export const dataGridCellStyles = (context, definition) => css `
6
7
  :host {
7
8
  padding: calc(${designUnit} * 1px) calc(${designUnit} * 3px);
8
9
  color: ${neutralForegroundRest};
9
10
  box-sizing: border-box;
10
- font-family: ${bodyFont};
11
- font-size: ${typeRampBaseFontSize};
12
- line-height: ${typeRampBaseLineHeight};
13
- font-weight: 400;
11
+ ${typeRampBase}
14
12
  border: transparent calc(${focusStrokeWidth} * 1px) solid;
15
13
  overflow: hidden;
16
14
  outline: none;
@@ -17,6 +17,7 @@ import { neutralLayer4 as neutralLayer4Algorithm } from './color/recipes/neutral
17
17
  import { accentBase, middleGrey } from './color/utilities/color-constants';
18
18
  import { StandardLuminance } from './color/utilities/base-layer-luminance';
19
19
  import { directionByIsDark } from './color/utilities/direction-by-is-dark';
20
+ import { StandardFontWeight } from './utilities/type-ramp';
20
21
  const { create } = DesignToken;
21
22
  function createNonCss(name) {
22
23
  return DesignToken.create({ name, cssCustomPropertyName: null });
@@ -46,43 +47,79 @@ export const strokeWidth = create('stroke-width').withDefault(1);
46
47
  export const focusStrokeWidth = create('focus-stroke-width').withDefault(2);
47
48
  // Typography values
48
49
  /** @public */
49
- export const bodyFont = create('body-font').withDefault('Segoe UI, sans-serif');
50
+ export const bodyFont = create('body-font').withDefault('"Segoe UI Variable", "Segoe UI", sans-serif');
51
+ /** @public */
52
+ export const fontWeight = create('font-weight').withDefault(StandardFontWeight.Normal);
53
+ function fontVariations(sizeToken) {
54
+ return (element) => {
55
+ const size = sizeToken.getValueFor(element);
56
+ const weight = fontWeight.getValueFor(element);
57
+ if (size.endsWith('px')) {
58
+ const px = Number.parseFloat(size.replace('px', ''));
59
+ if (px <= 12) {
60
+ return `"wght" ${weight}, "opsz" 8`;
61
+ }
62
+ else if (px > 24) {
63
+ return `"wght" ${weight}, "opsz" 36`;
64
+ }
65
+ }
66
+ return `"wght" ${weight}, "opsz" 10.5`;
67
+ };
68
+ }
50
69
  /** @public */
51
70
  export const typeRampBaseFontSize = create('type-ramp-base-font-size').withDefault('14px');
52
71
  /** @public */
53
72
  export const typeRampBaseLineHeight = create('type-ramp-base-line-height').withDefault('20px');
54
73
  /** @public */
74
+ export const typeRampBaseFontVariations = create('type-ramp-base-font-variations').withDefault(fontVariations(typeRampBaseFontSize));
75
+ /** @public */
55
76
  export const typeRampMinus1FontSize = create('type-ramp-minus-1-font-size').withDefault('12px');
56
77
  /** @public */
57
78
  export const typeRampMinus1LineHeight = create('type-ramp-minus-1-line-height').withDefault('16px');
58
79
  /** @public */
80
+ export const typeRampMinus1FontVariations = create('type-ramp-minus-1-font-variations').withDefault(fontVariations(typeRampMinus1FontSize));
81
+ /** @public */
59
82
  export const typeRampMinus2FontSize = create('type-ramp-minus-2-font-size').withDefault('10px');
60
83
  /** @public */
61
84
  export const typeRampMinus2LineHeight = create('type-ramp-minus-2-line-height').withDefault('14px');
62
85
  /** @public */
86
+ export const typeRampMinus2FontVariations = create('type-ramp-minus-2-font-variations').withDefault(fontVariations(typeRampMinus2FontSize));
87
+ /** @public */
63
88
  export const typeRampPlus1FontSize = create('type-ramp-plus-1-font-size').withDefault('16px');
64
89
  /** @public */
65
90
  export const typeRampPlus1LineHeight = create('type-ramp-plus-1-line-height').withDefault('22px');
66
91
  /** @public */
92
+ export const typeRampPlus1FontVariations = create('type-ramp-plus-1-font-variations').withDefault(fontVariations(typeRampPlus1FontSize));
93
+ /** @public */
67
94
  export const typeRampPlus2FontSize = create('type-ramp-plus-2-font-size').withDefault('20px');
68
95
  /** @public */
69
96
  export const typeRampPlus2LineHeight = create('type-ramp-plus-2-line-height').withDefault('26px');
70
97
  /** @public */
98
+ export const typeRampPlus2FontVariations = create('type-ramp-plus-2-font-variations').withDefault(fontVariations(typeRampPlus2FontSize));
99
+ /** @public */
71
100
  export const typeRampPlus3FontSize = create('type-ramp-plus-3-font-size').withDefault('24px');
72
101
  /** @public */
73
102
  export const typeRampPlus3LineHeight = create('type-ramp-plus-3-line-height').withDefault('32px');
74
103
  /** @public */
104
+ export const typeRampPlus3FontVariations = create('type-ramp-plus-3-font-variations').withDefault(fontVariations(typeRampPlus3FontSize));
105
+ /** @public */
75
106
  export const typeRampPlus4FontSize = create('type-ramp-plus-4-font-size').withDefault('28px');
76
107
  /** @public */
77
108
  export const typeRampPlus4LineHeight = create('type-ramp-plus-4-line-height').withDefault('36px');
78
109
  /** @public */
110
+ export const typeRampPlus4FontVariations = create('type-ramp-plus-4-font-variations').withDefault(fontVariations(typeRampPlus4FontSize));
111
+ /** @public */
79
112
  export const typeRampPlus5FontSize = create('type-ramp-plus-5-font-size').withDefault('32px');
80
113
  /** @public */
81
114
  export const typeRampPlus5LineHeight = create('type-ramp-plus-5-line-height').withDefault('40px');
82
115
  /** @public */
116
+ export const typeRampPlus5FontVariations = create('type-ramp-plus-5-font-variations').withDefault(fontVariations(typeRampPlus5FontSize));
117
+ /** @public */
83
118
  export const typeRampPlus6FontSize = create('type-ramp-plus-6-font-size').withDefault('40px');
84
119
  /** @public */
85
120
  export const typeRampPlus6LineHeight = create('type-ramp-plus-6-line-height').withDefault('52px');
121
+ /** @public */
122
+ export const typeRampPlus6FontVariations = create('type-ramp-plus-6-font-variations').withDefault(fontVariations(typeRampPlus6FontSize));
86
123
  // Color recipe values
87
124
  /** @public */
88
125
  export const baseLayerLuminance = create('base-layer-luminance').withDefault(StandardLuminance.LightMode);
@@ -2,11 +2,12 @@ import { css } from '@microsoft/fast-element';
2
2
  import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
4
  import { heightNumber } from '../styles/size';
5
- import { accentFillRest, bodyFont, controlCornerRadius, designUnit, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillSecondaryActive, neutralFillSecondaryHover, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthFocus, neutralFillStealthHover, neutralFillStealthRest, neutralForegroundRest, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { accentFillRest, controlCornerRadius, designUnit, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillSecondaryActive, neutralFillSecondaryHover, neutralFillSecondaryRest, neutralFillStealthActive, neutralFillStealthFocus, neutralFillStealthHover, neutralFillStealthRest, neutralForegroundRest, } from '../design-tokens';
6
+ import { typeRampBase } from '../styles/patterns/type-ramp';
6
7
  export const optionStyles = (context, definition) => css `
7
8
  ${display('inline-flex')} :host {
8
9
  position: relative;
9
- font-family: ${bodyFont};
10
+ ${typeRampBase}
10
11
  background: ${neutralFillStealthRest};
11
12
  border-radius: calc(${controlCornerRadius} * 1px);
12
13
  border: calc(${focusStrokeWidth} * 1px) solid transparent;
@@ -14,9 +15,7 @@ export const optionStyles = (context, definition) => css `
14
15
  color: ${neutralForegroundRest};
15
16
  cursor: pointer;
16
17
  fill: currentcolor;
17
- font-size: ${typeRampBaseFontSize};
18
18
  height: calc(${heightNumber} * 1px);
19
- line-height: ${typeRampBaseLineHeight};
20
19
  outline: none;
21
20
  overflow: hidden;
22
21
  align-items: center;
@@ -2,12 +2,13 @@ import { css } from '@microsoft/fast-element';
2
2
  import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
3
3
  import { SystemColors } from '@microsoft/fast-web-utilities';
4
4
  import { DirectionalStyleSheetBehavior, heightNumber } from '../styles/index';
5
- import { bodyFont, controlCornerRadius, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillStealthActive, neutralFillStealthHover, neutralForegroundHint, neutralForegroundRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { controlCornerRadius, disabledOpacity, focusStrokeOuter, focusStrokeWidth, neutralFillStealthActive, neutralFillStealthHover, neutralForegroundHint, neutralForegroundRest, strokeWidth, } from '../design-tokens';
6
+ import { typeRampBase } from '../styles/patterns/type-ramp';
6
7
  export const menuItemStyles = (context, definition) => css `
7
8
  ${display('grid')} :host {
8
9
  contain: layout;
9
10
  overflow: visible;
10
- font-family: ${bodyFont};
11
+ ${typeRampBase}
11
12
  outline: none;
12
13
  box-sizing: border-box;
13
14
  height: calc(${heightNumber} * 1px);
@@ -20,8 +21,6 @@ export const menuItemStyles = (context, definition) => css `
20
21
  color: ${neutralForegroundRest};
21
22
  fill: currentcolor;
22
23
  cursor: pointer;
23
- font-size: ${typeRampBaseFontSize};
24
- line-height: ${typeRampBaseLineHeight};
25
24
  border-radius: calc(${controlCornerRadius} * 1px);
26
25
  border: calc(${strokeWidth} * 1px) solid transparent;
27
26
  }
@@ -2,7 +2,8 @@ import { css } from '@microsoft/fast-element';
2
2
  import { SystemColors } from '@microsoft/fast-web-utilities';
3
3
  import { disabledCursor, display, focusVisible, forcedColorsStylesheetBehavior, } from '@microsoft/fast-foundation';
4
4
  import { heightNumber } from '../styles';
5
- import { accentFillActive, accentFillHover, accentFillRest, bodyFont, designUnit, disabledOpacity, fillColor, focusStrokeOuter, foregroundOnAccentRest, neutralFillInputAltActive, neutralFillInputAltFocus, neutralFillInputAltHover, neutralFillInputAltRest, neutralForegroundRest, neutralStrokeStrongActive, neutralStrokeStrongHover, neutralStrokeStrongRest, strokeWidth, typeRampBaseFontSize, typeRampBaseLineHeight, } from '../design-tokens';
5
+ import { accentFillActive, accentFillHover, accentFillRest, designUnit, disabledOpacity, fillColor, focusStrokeOuter, foregroundOnAccentRest, neutralFillInputAltActive, neutralFillInputAltFocus, neutralFillInputAltHover, neutralFillInputAltRest, neutralForegroundRest, neutralStrokeStrongActive, neutralStrokeStrongHover, neutralStrokeStrongRest, strokeWidth, } from '../design-tokens';
6
+ import { typeRampBase } from '../styles/patterns/type-ramp';
6
7
  export const radioStyles = (context, definition) => css `
7
8
  ${display('inline-flex')} :host {
8
9
  --input-size: calc((${heightNumber} / 2) + ${designUnit});
@@ -36,14 +37,12 @@ export const radioStyles = (context, definition) => css `
36
37
  }
37
38
 
38
39
  .label {
39
- font-family: ${bodyFont};
40
+ ${typeRampBase}
40
41
  color: ${neutralForegroundRest};
41
42
  ${
42
43
  /* Need to discuss with Brian how HorizontalSpacingNumber can work. https://github.com/microsoft/fast/issues/2766 */ ''} padding-inline-start: calc(${designUnit} * 2px + 2px);
43
44
  margin-inline-end: calc(${designUnit} * 2px + 2px);
44
45
  cursor: pointer;
45
- font-size: ${typeRampBaseFontSize};
46
- line-height: ${typeRampBaseLineHeight};
47
46
  }
48
47
 
49
48
  .control,