@fluentui/web-components 1.6.3 → 2.1.0
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.
- package/CHANGELOG.json +103 -1
- package/CHANGELOG.md +40 -2
- package/dist/dts/calendar/calendar.stories.d.ts +86 -0
- package/dist/dts/calendar/calendar.styles.d.ts +7 -0
- package/dist/dts/calendar/index.d.ts +18 -0
- package/dist/dts/color/palette.d.ts +43 -1
- package/dist/dts/color/recipes/contrast-and-delta-swatch-set.d.ts +11 -0
- package/dist/dts/color/recipes/contrast-swatch.d.ts +12 -0
- package/dist/dts/color/recipes/delta-swatch-set.d.ts +36 -0
- package/dist/dts/color/recipes/{neutral-divider.d.ts → delta-swatch.d.ts} +3 -2
- package/dist/dts/color/recipes/focus-stroke.d.ts +2 -2
- package/dist/dts/color/recipes/foreground-on-accent.d.ts +6 -0
- package/dist/dts/color/recipes/gradient-shadow-stroke.d.ts +7 -0
- package/dist/dts/color/recipes/gradient-swatch.d.ts +36 -0
- package/dist/dts/color/recipes/neutral-layer-1.d.ts +4 -0
- package/dist/dts/color/recipes/neutral-layer-2.d.ts +1 -5
- package/dist/dts/color/recipes/neutral-layer-3.d.ts +1 -1
- package/dist/dts/color/recipes/neutral-layer-4.d.ts +1 -1
- package/dist/dts/color/recipes/neutral-layer-floating.d.ts +1 -1
- package/dist/dts/color/recipes/underline-stroke.d.ts +7 -0
- package/dist/dts/color/swatch.d.ts +7 -0
- package/dist/dts/color/utilities/base-layer-luminance.d.ts +2 -2
- package/dist/dts/combobox/index.d.ts +1 -2
- package/dist/dts/custom-elements.d.ts +4 -2
- package/dist/dts/data-grid/data-grid-row.styles.d.ts +1 -1
- package/dist/dts/data-grid/index.d.ts +1 -1
- package/dist/dts/design-system-provider/index.d.ts +14 -29
- package/dist/dts/design-tokens.d.ts +198 -82
- package/dist/dts/menu/index.d.ts +11 -6
- package/dist/dts/menu/menu.stories.d.ts +1 -1
- package/dist/dts/select/index.d.ts +1 -1
- package/dist/dts/select/select.stories.d.ts +8 -0
- package/dist/dts/select/select.styles.d.ts +1 -0
- package/dist/dts/skeleton/skeleton.stories.d.ts +1 -0
- package/dist/dts/styles/elevation.d.ts +44 -5
- package/dist/dts/styles/patterns/button.styles.d.ts +7 -6
- package/dist/dts/styles/patterns/index.d.ts +1 -1
- package/dist/dts/styles/patterns/input.styles.d.ts +22 -0
- package/dist/dts/text-area/text-area.stories.d.ts +1 -1
- package/dist/dts/tree-view/tree-view.stories.d.ts +0 -5
- package/dist/esm/accordion/accordion-item/accordion-item.styles.js +54 -17
- package/dist/esm/accordion/accordion-item/index.js +4 -22
- package/dist/esm/accordion/accordion.styles.js +4 -4
- package/dist/esm/anchor/anchor.stories.js +2 -2
- package/dist/esm/anchor/anchor.styles.js +8 -2
- package/dist/esm/badge/badge.styles.js +10 -2
- package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +44 -53
- package/dist/esm/breadcrumb-item/index.js +2 -4
- package/dist/esm/button/button.stories.js +1 -1
- package/dist/esm/button/button.styles.js +21 -71
- package/dist/esm/calendar/calendar.stories.js +115 -0
- package/dist/esm/calendar/calendar.styles.js +133 -0
- package/dist/esm/calendar/index.js +31 -0
- package/dist/esm/card/card.stories.js +14 -0
- package/dist/esm/card/card.styles.js +23 -32
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/checkbox/checkbox.styles.js +58 -51
- package/dist/esm/checkbox/index.js +5 -13
- package/dist/esm/color/palette.js +174 -12
- package/dist/esm/color/recipes/contrast-and-delta-swatch-set.js +28 -0
- package/dist/esm/color/recipes/contrast-swatch.js +12 -0
- package/dist/esm/color/recipes/delta-swatch-set.js +53 -0
- package/dist/esm/color/recipes/{neutral-divider.js → delta-swatch.js} +3 -2
- package/dist/esm/color/recipes/focus-stroke.js +4 -3
- package/dist/esm/color/recipes/foreground-on-accent.js +14 -0
- package/dist/esm/color/recipes/gradient-shadow-stroke.js +54 -0
- package/dist/esm/color/recipes/gradient-swatch.js +36 -0
- package/dist/esm/color/recipes/neutral-layer-1.js +7 -1
- package/dist/esm/color/recipes/neutral-layer-2.js +3 -9
- package/dist/esm/color/recipes/neutral-layer-3.js +3 -3
- package/dist/esm/color/recipes/neutral-layer-4.js +3 -3
- package/dist/esm/color/recipes/neutral-layer-floating.js +3 -4
- package/dist/esm/color/recipes/underline-stroke.js +31 -0
- package/dist/esm/color/swatch.js +22 -2
- package/dist/esm/color/utilities/base-layer-luminance.js +2 -2
- package/dist/esm/combobox/combobox.stories.js +1 -0
- package/dist/esm/combobox/index.js +6 -9
- package/dist/esm/custom-elements.js +3 -1
- package/dist/esm/data-grid/data-grid-cell.styles.js +4 -4
- package/dist/esm/data-grid/data-grid-row.styles.js +3 -3
- package/dist/esm/design-system-provider/design-system-provider.vscode.definition.json +17 -9
- package/dist/esm/design-system-provider/index.js +24 -39
- package/dist/esm/design-tokens.js +303 -217
- package/dist/esm/dialog/dialog.styles.js +2 -3
- package/dist/esm/divider/divider.styles.js +1 -2
- package/dist/esm/flipper/flipper.styles.js +28 -65
- package/dist/esm/flipper/index.js +4 -8
- package/dist/esm/listbox/listbox.styles.js +8 -29
- package/dist/esm/listbox-option/listbox-option.styles.js +52 -35
- package/dist/esm/menu/index.js +16 -6
- package/dist/esm/menu/menu.stories.js +16 -2
- package/dist/esm/menu/menu.styles.js +38 -27
- package/dist/esm/menu-item/index.js +6 -33
- package/dist/esm/menu-item/menu-item.stories.js +1 -1
- package/dist/esm/menu-item/menu-item.styles.js +58 -84
- package/dist/esm/number-field/index.js +7 -3
- package/dist/esm/number-field/number-field.styles.js +30 -175
- package/dist/esm/progress/progress/index.js +1 -1
- package/dist/esm/progress/progress/progress.styles.js +13 -18
- package/dist/esm/progress/progress-ring/progress-ring.styles.js +65 -69
- package/dist/esm/radio/index.js +3 -1
- package/dist/esm/radio/radio.stories.js +3 -2
- package/dist/esm/radio/radio.styles.js +52 -42
- package/dist/esm/radio-group/radio-group.styles.js +0 -2
- package/dist/esm/select/index.js +6 -9
- package/dist/esm/select/select.stories.js +10 -2
- package/dist/esm/select/select.styles.js +100 -124
- package/dist/esm/select/select.vscode.definition.json +3 -0
- package/dist/esm/skeleton/skeleton.stories.js +3 -2
- package/dist/esm/skeleton/skeleton.styles.js +11 -6
- package/dist/esm/slider/slider.styles.js +54 -14
- package/dist/esm/slider-label/slider-label.styles.js +5 -6
- package/dist/esm/styles/direction.js +1 -1
- package/dist/esm/styles/elevation.js +54 -5
- package/dist/esm/styles/patterns/button.styles.js +274 -294
- package/dist/esm/styles/patterns/index.js +1 -1
- package/dist/esm/styles/patterns/input.styles.js +218 -0
- package/dist/esm/switch/index.js +3 -1
- package/dist/esm/switch/switch.stories.js +3 -3
- package/dist/esm/switch/switch.styles.js +79 -60
- package/dist/esm/tabs/tab/tab.styles.js +11 -14
- package/dist/esm/tabs/tabs.styles.js +9 -8
- package/dist/esm/text-area/text-area.stories.js +2 -2
- package/dist/esm/text-area/text-area.styles.js +16 -96
- package/dist/esm/text-field/text-field.stories.js +1 -1
- package/dist/esm/text-field/text-field.styles.js +16 -144
- package/dist/esm/toolbar/index.js +1 -0
- package/dist/esm/toolbar/toolbar.styles.js +56 -56
- package/dist/esm/tooltip/index.js +2 -4
- package/dist/esm/tooltip/tooltip.styles.js +14 -14
- package/dist/esm/tree-item/index.js +2 -8
- package/dist/esm/tree-item/tree-item.styles.js +45 -80
- package/dist/esm/tree-view/tree-view.stories.js +23 -11
- package/dist/fluent-web-components.api.json +4900 -2353
- package/dist/web-components.d.ts +397 -100
- package/dist/web-components.js +2240 -2175
- package/dist/web-components.min.js +158 -128
- package/docs/api-report.md +338 -80
- package/package.json +2 -5
- package/public/switches.ts +13 -14
- package/dist/dts/color/recipes/accent-fill.d.ts +0 -7
- package/dist/dts/color/recipes/accent-foreground.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-contrast.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-input.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-inverse.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill-layer.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-fill-stealth.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-fill.d.ts +0 -14
- package/dist/dts/color/recipes/neutral-foreground-hint.d.ts +0 -10
- package/dist/dts/color/recipes/neutral-foreground.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-layer-card-container.d.ts +0 -6
- package/dist/dts/color/recipes/neutral-stroke-strong.d.ts +0 -7
- package/dist/dts/color/recipes/neutral-stroke.d.ts +0 -7
- package/dist/dts/styles/patterns/input.d.ts +0 -4
- package/dist/dts/utilities/math.d.ts +0 -24
- package/dist/esm/color/recipes/accent-fill.js +0 -18
- package/dist/esm/color/recipes/accent-foreground.js +0 -31
- package/dist/esm/color/recipes/neutral-fill-contrast.js +0 -26
- package/dist/esm/color/recipes/neutral-fill-input.js +0 -14
- package/dist/esm/color/recipes/neutral-fill-inverse.js +0 -26
- package/dist/esm/color/recipes/neutral-fill-layer.js +0 -7
- package/dist/esm/color/recipes/neutral-fill-stealth.js +0 -14
- package/dist/esm/color/recipes/neutral-fill.js +0 -21
- package/dist/esm/color/recipes/neutral-foreground-hint.js +0 -10
- package/dist/esm/color/recipes/neutral-foreground.js +0 -6
- package/dist/esm/color/recipes/neutral-layer-card-container.js +0 -9
- package/dist/esm/color/recipes/neutral-stroke-strong.js +0 -15
- package/dist/esm/color/recipes/neutral-stroke.js +0 -18
- package/dist/esm/styles/patterns/input.js +0 -31
- package/dist/esm/utilities/math.js +0 -49
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fluentui/web-components",
|
|
3
3
|
"description": "A library of Fluent Web Components",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "2.1.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Microsoft",
|
|
8
8
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"main": "dist/esm/index.js",
|
|
19
19
|
"types": "dist/web-components.d.ts",
|
|
20
20
|
"unpkg": "dist/web-components.min.js",
|
|
21
|
-
"beachball": {
|
|
22
|
-
"disallowedChangeTypes": []
|
|
23
|
-
},
|
|
24
21
|
"scripts": {
|
|
25
22
|
"clean": "node ./build/clean.js dist",
|
|
26
23
|
"doc": "api-extractor run --local",
|
|
@@ -92,7 +89,7 @@
|
|
|
92
89
|
"dependencies": {
|
|
93
90
|
"@microsoft/fast-colors": "^5.1.0",
|
|
94
91
|
"@microsoft/fast-element": "^1.6.0",
|
|
95
|
-
"@microsoft/fast-foundation": "^2.
|
|
92
|
+
"@microsoft/fast-foundation": "^2.24.0",
|
|
96
93
|
"@microsoft/fast-web-utilities": "^5.0.0",
|
|
97
94
|
"tslib": "^1.13.0"
|
|
98
95
|
}
|
package/public/switches.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Direction } from '@microsoft/fast-web-utilities';
|
|
2
|
+
import { baseLayerLuminance, direction, StandardLuminance } from '../src/index';
|
|
2
3
|
|
|
3
4
|
export function toggleBgMode() {
|
|
4
|
-
const
|
|
5
|
+
const storyContainer = document.querySelector<HTMLElement>('.docs-story')!;
|
|
6
|
+
const bgChecked = this.checked;
|
|
5
7
|
if (bgChecked) {
|
|
6
|
-
|
|
7
|
-
document.body,
|
|
8
|
-
SwatchRGB.create(StandardLuminance.LightMode, StandardLuminance.LightMode, StandardLuminance.LightMode),
|
|
9
|
-
);
|
|
8
|
+
baseLayerLuminance.setValueFor(storyContainer, StandardLuminance.DarkMode);
|
|
10
9
|
} else {
|
|
11
|
-
|
|
12
|
-
document.body,
|
|
13
|
-
SwatchRGB.create(StandardLuminance.DarkMode, StandardLuminance.DarkMode, StandardLuminance.DarkMode),
|
|
14
|
-
);
|
|
10
|
+
baseLayerLuminance.setValueFor(storyContainer, StandardLuminance.LightMode);
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
export function toggleLtr() {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const storyContainer = document.querySelector<HTMLElement>('.docs-story')!;
|
|
16
|
+
const dirChecked = this.checked;
|
|
17
|
+
if (dirChecked) {
|
|
18
|
+
storyContainer.style.direction = 'rtl';
|
|
19
|
+
direction.setValueFor(storyContainer, Direction.rtl);
|
|
22
20
|
} else {
|
|
23
|
-
|
|
21
|
+
storyContainer.style.direction = 'ltr';
|
|
22
|
+
direction.setValueFor(storyContainer, Direction.ltr);
|
|
24
23
|
}
|
|
25
24
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function accentFill(palette: Palette, neutralPalette: Palette, reference: Swatch, hoverDelta: number, activeDelta: number, focusDelta: number, neutralFillRestDelta: number, neutralFillHoverDelta: number, neutralFillActiveDelta: number): InteractiveSwatchSet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function accentForeground(palette: Palette, reference: Swatch, contrastTarget: number, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function neutralFillContrast(palette: Palette, reference: Swatch, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function neutralFillInput(palette: Palette, reference: Swatch, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function neutralFillInverse(palette: Palette, reference: Swatch, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function neutralFillStealth(palette: Palette, reference: Swatch, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number, fillRestDelta: number, fillHoverDelta: number, fillActiveDelta: number, fillFocusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param palette - The palette to operate on
|
|
7
|
-
* @param reference - The reference color to calculate a color for
|
|
8
|
-
* @param delta - The offset from the reference's location
|
|
9
|
-
* @param threshold - Determines if a lighter or darker color than the reference will be picked.
|
|
10
|
-
* @returns
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function neutralFill(palette: Palette, reference: Swatch, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { Swatch } from '../swatch';
|
|
3
|
-
/**
|
|
4
|
-
* The neutralForegroundHint color recipe
|
|
5
|
-
* @param palette - The palette to operate on
|
|
6
|
-
* @param reference - The reference color
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare function neutralForegroundHint(palette: Palette, reference: Swatch): Swatch;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function neutralStrokeStrong(palette: Palette, reference: Swatch, restContrast: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Palette } from '../palette';
|
|
2
|
-
import { InteractiveSwatchSet } from '../recipe';
|
|
3
|
-
import { Swatch } from '../swatch';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function neutralStroke(palette: Palette, reference: Swatch, restDelta: number, hoverDelta: number, activeDelta: number, focusDelta: number): InteractiveSwatchSet;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds numbers or functions that accept a design system and return a number.
|
|
3
|
-
* @internal
|
|
4
|
-
* @deprecated
|
|
5
|
-
*/
|
|
6
|
-
export declare function add<T>(...args: Array<number | ((designSystem: T) => number)>): (designSystem?: T) => number;
|
|
7
|
-
/**
|
|
8
|
-
* Subtract numbers or functions that accept a design system and return a number.
|
|
9
|
-
* @internal
|
|
10
|
-
* @deprecated
|
|
11
|
-
*/
|
|
12
|
-
export declare function subtract<T>(...args: Array<number | ((designSystem: T) => number)>): (designSystem?: T) => number;
|
|
13
|
-
/**
|
|
14
|
-
* Multiplies numbers or functions that accept a design system and return a number.
|
|
15
|
-
* @internal
|
|
16
|
-
* @deprecated
|
|
17
|
-
*/
|
|
18
|
-
export declare function multiply<T>(...args: Array<number | ((designSystem: T) => number)>): (designSystem?: T) => number;
|
|
19
|
-
/**
|
|
20
|
-
* Divides numbers or functions that accept a design system and return a number.
|
|
21
|
-
* @internal
|
|
22
|
-
* @deprecated
|
|
23
|
-
*/
|
|
24
|
-
export declare function divide<T>(...args: Array<number | ((designSystem: T) => number)>): (designSystem?: T) => number;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export function accentFill(palette, neutralPalette, reference, hoverDelta, activeDelta, focusDelta, neutralFillRestDelta, neutralFillHoverDelta, neutralFillActiveDelta) {
|
|
5
|
-
const accent = palette.source;
|
|
6
|
-
const direction = 1;
|
|
7
|
-
const accentIndex = palette.closestIndexOf(accent);
|
|
8
|
-
const restIndex = accentIndex;
|
|
9
|
-
const hoverIndex = restIndex + direction * hoverDelta;
|
|
10
|
-
const activeIndex = restIndex + direction * activeDelta;
|
|
11
|
-
const focusIndex = restIndex + direction * focusDelta;
|
|
12
|
-
return {
|
|
13
|
-
rest: palette.get(restIndex),
|
|
14
|
-
hover: palette.get(hoverIndex),
|
|
15
|
-
active: palette.get(activeIndex),
|
|
16
|
-
focus: palette.get(focusIndex),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { directionByIsDark } from '../utilities/direction-by-is-dark';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function accentForeground(palette, reference, contrastTarget, restDelta, hoverDelta, activeDelta, focusDelta) {
|
|
6
|
-
const accent = palette.source;
|
|
7
|
-
const accentIndex = palette.closestIndexOf(accent);
|
|
8
|
-
const direction = directionByIsDark(reference);
|
|
9
|
-
const startIndex = accentIndex +
|
|
10
|
-
(direction === 1 ? Math.min(restDelta, hoverDelta) : Math.max(direction * restDelta, direction * hoverDelta));
|
|
11
|
-
const accessibleSwatch = palette.colorContrast(reference, contrastTarget, startIndex, direction);
|
|
12
|
-
const accessibleIndex1 = palette.closestIndexOf(accessibleSwatch);
|
|
13
|
-
const accessibleIndex2 = accessibleIndex1 + direction * Math.abs(restDelta - hoverDelta);
|
|
14
|
-
const indexOneIsRestState = direction === 1 ? restDelta < hoverDelta : direction * restDelta > direction * hoverDelta;
|
|
15
|
-
let restIndex;
|
|
16
|
-
let hoverIndex;
|
|
17
|
-
if (indexOneIsRestState) {
|
|
18
|
-
restIndex = accessibleIndex1;
|
|
19
|
-
hoverIndex = accessibleIndex2;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
restIndex = accessibleIndex2;
|
|
23
|
-
hoverIndex = accessibleIndex1;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
rest: palette.get(restIndex),
|
|
27
|
-
hover: palette.get(hoverIndex),
|
|
28
|
-
active: palette.get(restIndex + direction * activeDelta),
|
|
29
|
-
focus: palette.get(restIndex + direction * focusDelta),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { directionByIsDark } from '../utilities/direction-by-is-dark';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function neutralFillContrast(palette, reference, restDelta, hoverDelta, activeDelta, focusDelta) {
|
|
6
|
-
const direction = directionByIsDark(reference);
|
|
7
|
-
const accessibleIndex = palette.closestIndexOf(palette.colorContrast(reference, 4.5));
|
|
8
|
-
const accessibleIndex2 = accessibleIndex + direction * Math.abs(restDelta - hoverDelta);
|
|
9
|
-
const indexOneIsRest = direction === 1 ? restDelta < hoverDelta : direction * restDelta > direction * hoverDelta;
|
|
10
|
-
let restIndex;
|
|
11
|
-
let hoverIndex;
|
|
12
|
-
if (indexOneIsRest) {
|
|
13
|
-
restIndex = accessibleIndex;
|
|
14
|
-
hoverIndex = accessibleIndex2;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
restIndex = accessibleIndex2;
|
|
18
|
-
hoverIndex = accessibleIndex;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
rest: palette.get(restIndex),
|
|
22
|
-
hover: palette.get(hoverIndex),
|
|
23
|
-
active: palette.get(restIndex + direction * activeDelta),
|
|
24
|
-
focus: palette.get(restIndex + direction * focusDelta),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { directionByIsDark } from '../utilities/direction-by-is-dark';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function neutralFillInput(palette, reference, restDelta, hoverDelta, activeDelta, focusDelta) {
|
|
6
|
-
const direction = directionByIsDark(reference);
|
|
7
|
-
const referenceIndex = palette.closestIndexOf(reference);
|
|
8
|
-
return {
|
|
9
|
-
rest: palette.get(referenceIndex - direction * restDelta),
|
|
10
|
-
hover: palette.get(referenceIndex - direction * hoverDelta),
|
|
11
|
-
active: palette.get(referenceIndex - direction * activeDelta),
|
|
12
|
-
focus: palette.get(referenceIndex - direction * focusDelta),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { directionByIsDark } from '../utilities/direction-by-is-dark';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function neutralFillInverse(palette, reference, restDelta, hoverDelta, activeDelta, focusDelta) {
|
|
6
|
-
const direction = directionByIsDark(reference);
|
|
7
|
-
const accessibleIndex = palette.closestIndexOf(palette.colorContrast(reference, 14));
|
|
8
|
-
const accessibleIndex2 = accessibleIndex + direction * Math.abs(restDelta - hoverDelta);
|
|
9
|
-
const indexOneIsRest = direction === 1 ? restDelta < hoverDelta : direction * restDelta > direction * hoverDelta;
|
|
10
|
-
let restIndex;
|
|
11
|
-
let hoverIndex;
|
|
12
|
-
if (indexOneIsRest) {
|
|
13
|
-
restIndex = accessibleIndex;
|
|
14
|
-
hoverIndex = accessibleIndex2;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
restIndex = accessibleIndex2;
|
|
18
|
-
hoverIndex = accessibleIndex;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
rest: palette.get(restIndex),
|
|
22
|
-
hover: palette.get(hoverIndex),
|
|
23
|
-
active: palette.get(restIndex + direction * activeDelta),
|
|
24
|
-
focus: palette.get(restIndex + direction * focusDelta),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export function neutralFillStealth(palette, reference, restDelta, hoverDelta, activeDelta, focusDelta, fillRestDelta, fillHoverDelta, fillActiveDelta, fillFocusDelta) {
|
|
5
|
-
const swapThreshold = Math.max(restDelta, hoverDelta, activeDelta, focusDelta, fillRestDelta, fillHoverDelta, fillActiveDelta, fillFocusDelta);
|
|
6
|
-
const referenceIndex = palette.closestIndexOf(reference);
|
|
7
|
-
const direction = referenceIndex >= swapThreshold ? -1 : 1;
|
|
8
|
-
return {
|
|
9
|
-
rest: palette.get(referenceIndex + direction * restDelta),
|
|
10
|
-
hover: palette.get(referenceIndex + direction * hoverDelta),
|
|
11
|
-
active: palette.get(referenceIndex + direction * activeDelta),
|
|
12
|
-
focus: palette.get(referenceIndex + direction * focusDelta),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param palette - The palette to operate on
|
|
4
|
-
* @param reference - The reference color to calculate a color for
|
|
5
|
-
* @param delta - The offset from the reference's location
|
|
6
|
-
* @param threshold - Determines if a lighter or darker color than the reference will be picked.
|
|
7
|
-
* @returns
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export function neutralFill(palette, reference, restDelta, hoverDelta, activeDelta, focusDelta) {
|
|
12
|
-
const referenceIndex = palette.closestIndexOf(reference);
|
|
13
|
-
const threshold = Math.max(restDelta, hoverDelta, activeDelta, focusDelta);
|
|
14
|
-
const direction = referenceIndex >= threshold ? -1 : 1;
|
|
15
|
-
return {
|
|
16
|
-
rest: palette.get(referenceIndex + direction * restDelta),
|
|
17
|
-
hover: palette.get(referenceIndex + direction * hoverDelta),
|
|
18
|
-
active: palette.get(referenceIndex + direction * activeDelta),
|
|
19
|
-
focus: palette.get(referenceIndex + direction * focusDelta),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The neutralForegroundHint color recipe
|
|
3
|
-
* @param palette - The palette to operate on
|
|
4
|
-
* @param reference - The reference color
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export function neutralForegroundHint(palette, reference) {
|
|
9
|
-
return palette.colorContrast(reference, 4.5);
|
|
10
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { clamp } from '@microsoft/fast-colors';
|
|
2
|
-
import { baseLayerLuminanceSwatch } from '../utilities/base-layer-luminance';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export function neutralLayerCardContainer(palette, relativeLuminance, layerDelta) {
|
|
7
|
-
const oldCardIndex = clamp(palette.closestIndexOf(baseLayerLuminanceSwatch(relativeLuminance)) - layerDelta, 0, palette.swatches.length - 1);
|
|
8
|
-
return palette.get(oldCardIndex + layerDelta);
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { directionByIsDark } from '../utilities/direction-by-is-dark';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function neutralStrokeStrong(palette, reference, restContrast, hoverDelta, activeDelta, focusDelta) {
|
|
6
|
-
const direction = directionByIsDark(reference);
|
|
7
|
-
const restSwatch = palette.colorContrast(reference, restContrast);
|
|
8
|
-
const restIndex = palette.closestIndexOf(restSwatch);
|
|
9
|
-
return {
|
|
10
|
-
rest: restSwatch,
|
|
11
|
-
hover: palette.get(restIndex + direction * hoverDelta),
|
|
12
|
-
active: palette.get(restIndex + direction * activeDelta),
|
|
13
|
-
focus: palette.get(restIndex + direction * focusDelta),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { directionByIsDark } from '../utilities/direction-by-is-dark';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function neutralStroke(palette, reference, restDelta, hoverDelta, activeDelta, focusDelta) {
|
|
6
|
-
const referenceIndex = palette.closestIndexOf(reference);
|
|
7
|
-
const direction = directionByIsDark(reference);
|
|
8
|
-
const restIndex = referenceIndex + direction * restDelta;
|
|
9
|
-
const hoverIndex = restIndex + direction * (hoverDelta - restDelta);
|
|
10
|
-
const activeIndex = restIndex + direction * (activeDelta - restDelta);
|
|
11
|
-
const focusIndex = restIndex + direction * (focusDelta - restDelta);
|
|
12
|
-
return {
|
|
13
|
-
rest: palette.get(restIndex),
|
|
14
|
-
hover: palette.get(hoverIndex),
|
|
15
|
-
active: palette.get(activeIndex),
|
|
16
|
-
focus: palette.get(focusIndex),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { css } from '@microsoft/fast-element';
|
|
2
|
-
import { accentFillRest, controlCornerRadius, focusStrokeWidth } from '../../design-tokens';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export const fillStateStyles = (context, definition) => css `
|
|
7
|
-
:host([appearance='filled']:not(.disabled):active)::after,
|
|
8
|
-
:host([appearance='filled']:not(.disabled):focus-within:not(:active))::after {
|
|
9
|
-
content: '';
|
|
10
|
-
position: absolute;
|
|
11
|
-
bottom: 0;
|
|
12
|
-
border-bottom: calc(${focusStrokeWidth} * 1px) solid ${accentFillRest};
|
|
13
|
-
border-bottom-left-radius: calc(${controlCornerRadius} * 1px);
|
|
14
|
-
border-bottom-right-radius: calc(${controlCornerRadius} * 1px);
|
|
15
|
-
z-index: 2;
|
|
16
|
-
transition: all 300ms cubic-bezier(0.1, 0.9, 0.2, 1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
:host([appearance='filled']:not(.disabled):active)::after {
|
|
20
|
-
left: 50%;
|
|
21
|
-
width: 40%;
|
|
22
|
-
transform: translateX(-50%);
|
|
23
|
-
border-bottom-left-radius: 0;
|
|
24
|
-
border-bottom-right-radius: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
:host([appearance='filled']:not(.disabled):focus-within:not(:active))::after {
|
|
28
|
-
left: 0;
|
|
29
|
-
width: 100%;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function performOperation(operation) {
|
|
2
|
-
return (...args) => {
|
|
3
|
-
return (designSystem) => {
|
|
4
|
-
const firstArg = args[0];
|
|
5
|
-
let value = typeof firstArg === 'function' ? firstArg(designSystem) : firstArg;
|
|
6
|
-
for (let i = 1; i < args.length; i++) {
|
|
7
|
-
const currentValue = args[i];
|
|
8
|
-
value = operation(value, typeof currentValue === 'function' ? currentValue(designSystem) : currentValue);
|
|
9
|
-
}
|
|
10
|
-
return value;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const _add = performOperation((a, b) => a + b);
|
|
15
|
-
const _subtract = performOperation((a, b) => a - b);
|
|
16
|
-
const _multiply = performOperation((a, b) => a * b);
|
|
17
|
-
const _divide = performOperation((a, b) => a / b);
|
|
18
|
-
/**
|
|
19
|
-
* Adds numbers or functions that accept a design system and return a number.
|
|
20
|
-
* @internal
|
|
21
|
-
* @deprecated
|
|
22
|
-
*/
|
|
23
|
-
export function add(...args) {
|
|
24
|
-
return _add.apply(this, args);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Subtract numbers or functions that accept a design system and return a number.
|
|
28
|
-
* @internal
|
|
29
|
-
* @deprecated
|
|
30
|
-
*/
|
|
31
|
-
export function subtract(...args) {
|
|
32
|
-
return _subtract.apply(this, args);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Multiplies numbers or functions that accept a design system and return a number.
|
|
36
|
-
* @internal
|
|
37
|
-
* @deprecated
|
|
38
|
-
*/
|
|
39
|
-
export function multiply(...args) {
|
|
40
|
-
return _multiply.apply(this, args);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Divides numbers or functions that accept a design system and return a number.
|
|
44
|
-
* @internal
|
|
45
|
-
* @deprecated
|
|
46
|
-
*/
|
|
47
|
-
export function divide(...args) {
|
|
48
|
-
return _divide.apply(this, args);
|
|
49
|
-
}
|