@fluentui/web-components 2.3.1 → 2.5.1
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 +61 -1
- package/CHANGELOG.md +29 -2
- package/dist/dts/_docs/design-system/color-explorer/app.d.ts +25 -0
- package/dist/dts/_docs/design-system/color-explorer/colors.d.ts +13 -0
- package/dist/dts/_docs/design-system/color-explorer/component-types.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-block.d.ts +11 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.d.ts +190 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.form-associated.d.ts +15 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.styles.d.ts +3 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.template.d.ts +8 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/index.d.ts +9 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.d.ts +8 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.template.d.ts +2 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.d.ts +5 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.template.d.ts +2 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/layer-background/index.d.ts +21 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.d.ts +3 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.template.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.d.ts +3 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.template.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/swatch.d.ts +30 -0
- package/dist/dts/_docs/design-system/color-explorer/custom-elements.d.ts +7 -0
- package/dist/dts/_docs/design-system/color-explorer/index.d.ts +2 -0
- package/dist/dts/design-tokens.d.ts +20 -0
- package/dist/dts/styles/patterns/index.d.ts +1 -0
- package/dist/dts/styles/patterns/type-ramp.d.ts +18 -0
- package/dist/dts/utilities/type-ramp.d.ts +12 -0
- package/dist/esm/_docs/design-system/color-explorer/app.js +247 -0
- package/dist/esm/_docs/design-system/color-explorer/colors.js +24 -0
- package/dist/esm/_docs/design-system/color-explorer/component-types.js +7 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-block.js +412 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.form-associated.js +16 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.js +297 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.styles.js +124 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.template.js +130 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/index.js +15 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.js +24 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.styles.js +19 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.template.js +52 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.js +11 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.styles.js +31 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.template.js +21 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/layer-background/index.js +70 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.js +3 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.styles.js +166 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.template.js +97 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.js +3 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.styles.js +130 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.template.js +82 -0
- package/dist/esm/_docs/design-system/color-explorer/components/swatch.js +157 -0
- package/dist/esm/_docs/design-system/color-explorer/custom-elements.js +3 -0
- package/dist/esm/_docs/design-system/color-explorer/index.js +14 -0
- package/dist/esm/accordion/accordion-item/accordion-item.styles.js +4 -5
- package/dist/esm/accordion/accordion.styles.js +3 -4
- package/dist/esm/badge/badge.styles.js +3 -4
- package/dist/esm/breadcrumb/breadcrumb.styles.js +2 -4
- package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +3 -4
- package/dist/esm/calendar/calendar.styles.js +3 -4
- package/dist/esm/checkbox/checkbox.styles.js +3 -4
- package/dist/esm/combobox/combobox.styles.js +3 -3
- package/dist/esm/data-grid/data-grid-cell.styles.js +3 -5
- package/dist/esm/design-tokens.js +38 -1
- package/dist/esm/listbox-option/listbox-option.styles.js +3 -4
- package/dist/esm/menu-item/menu-item.styles.js +3 -4
- package/dist/esm/radio/radio.styles.js +3 -4
- package/dist/esm/search/search.styles.js +3 -4
- package/dist/esm/select/select.styles.js +3 -4
- package/dist/esm/slider-label/slider-label.styles.js +3 -2
- package/dist/esm/styles/patterns/button.styles.js +3 -4
- package/dist/esm/styles/patterns/index.js +1 -0
- package/dist/esm/styles/patterns/input.styles.js +4 -6
- package/dist/esm/styles/patterns/type-ramp.js +74 -0
- package/dist/esm/switch/switch.styles.js +4 -5
- package/dist/esm/tabs/tab/tab.styles.js +3 -5
- package/dist/esm/tabs/tab-panel/tab-panel.styles.js +3 -5
- package/dist/esm/tabs/tabs.styles.js +3 -4
- package/dist/esm/tooltip/tooltip.styles.js +3 -4
- package/dist/esm/tree-item/tree-item.styles.js +3 -4
- package/dist/esm/utilities/type-ramp.js +12 -0
- package/dist/fluent-web-components.api.json +534 -0
- package/dist/web-components.d.ts +57 -0
- package/dist/web-components.js +3867 -3282
- package/dist/web-components.min.js +230 -158
- package/docs/api-report.md +57 -0
- package/package.json +5 -5
- package/public/SegoeUI-VF.ttf +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export declare const StandardFontWeight: {
|
|
3
|
+
readonly Thin: 100;
|
|
4
|
+
readonly ExtraLight: 200;
|
|
5
|
+
readonly Light: 300;
|
|
6
|
+
readonly Normal: 400;
|
|
7
|
+
readonly Medium: 500;
|
|
8
|
+
readonly SemiBold: 600;
|
|
9
|
+
readonly Bold: 700;
|
|
10
|
+
readonly ExtraBold: 800;
|
|
11
|
+
readonly Black: 900;
|
|
12
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { parseColorHexRGB } from '@microsoft/fast-colors';
|
|
3
|
+
import { attr, css, customElement, FASTElement, html, observable, ref, repeat, when } from '@microsoft/fast-element';
|
|
4
|
+
import { accentBaseColor, baseLayerLuminance, neutralBaseColor, neutralLayer1Recipe, neutralLayer2Recipe, neutralLayer3Recipe, neutralLayer4Recipe, neutralLayerCardContainerRecipe, neutralLayerFloatingRecipe, PaletteRGB, StandardLuminance, SwatchRGB, } from '../../../index-rollup';
|
|
5
|
+
import { ComponentTypes } from './component-types';
|
|
6
|
+
import { AppColorBlock } from './components/color-block';
|
|
7
|
+
import { AppControlPane } from './components/control-pane';
|
|
8
|
+
import { AppGradient } from './components/gradient';
|
|
9
|
+
import { AppSampleApp } from './components/sample-app';
|
|
10
|
+
AppColorBlock;
|
|
11
|
+
AppControlPane;
|
|
12
|
+
AppGradient;
|
|
13
|
+
AppSampleApp;
|
|
14
|
+
const sampleTemplate = html `
|
|
15
|
+
<fluent-design-system-provider
|
|
16
|
+
neutral-color="${x => x.neutralColor}"
|
|
17
|
+
accent-color="${x => x.accentColor}"
|
|
18
|
+
style="display: flex; align-items: stretch; align-content: stretch; justify-content: center; flex-grow: 1;"
|
|
19
|
+
>
|
|
20
|
+
<app-layer-background
|
|
21
|
+
id="light-mode"
|
|
22
|
+
base-layer-luminance="${StandardLuminance.LightMode}"
|
|
23
|
+
background-layer-recipe="L4"
|
|
24
|
+
style="flex-grow: 1; padding: 100px;"
|
|
25
|
+
>
|
|
26
|
+
<app-sample-app></app-sample-app>
|
|
27
|
+
</app-layer-background>
|
|
28
|
+
<app-layer-background
|
|
29
|
+
id="dark-mode"
|
|
30
|
+
base-layer-luminance="${StandardLuminance.DarkMode}"
|
|
31
|
+
background-layer-recipe="L4"
|
|
32
|
+
style="flex-grow: 1; padding: 100px;"
|
|
33
|
+
>
|
|
34
|
+
<app-sample-app></app-sample-app>
|
|
35
|
+
</app-layer-background>
|
|
36
|
+
</fluent-design-system-provider>
|
|
37
|
+
`;
|
|
38
|
+
const colorBlockTemplate = html `
|
|
39
|
+
${repeat(x => x.backgrounds(), html `
|
|
40
|
+
<app-color-block
|
|
41
|
+
id="${x => x.color.toUpperCase().replace('#', '')}"
|
|
42
|
+
index="${(x, c) => x.index}"
|
|
43
|
+
component="${(x, c) => c.parent.componentType}"
|
|
44
|
+
color="${x => x.color}"
|
|
45
|
+
layer-name="${x => x.title}"
|
|
46
|
+
></app-color-block>
|
|
47
|
+
`)}
|
|
48
|
+
`;
|
|
49
|
+
const template = html `
|
|
50
|
+
<div class="container fill">
|
|
51
|
+
<div class="row fill">
|
|
52
|
+
<div class="canvas" ${ref('canvasElement')}>
|
|
53
|
+
<div class="container fill">
|
|
54
|
+
<div class="row gradient">
|
|
55
|
+
<app-gradient :colors="${x => x.neutralPalette}" :markedColor="${x => x.neutralColor}"></app-gradient>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="row gradient">
|
|
58
|
+
<app-gradient :colors="${x => x.accentPalette}" :markedColor="${x => x.accentColor}"></app-gradient>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="row fill">
|
|
61
|
+
<div style="display: flex; overflow: auto;">
|
|
62
|
+
${when(x => x.componentType === ComponentTypes.sample, sampleTemplate)}
|
|
63
|
+
${when(x => x.componentType !== ComponentTypes.sample, colorBlockTemplate)}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div>
|
|
69
|
+
<app-layer-background
|
|
70
|
+
id="control-pane"
|
|
71
|
+
class="control-pane-container"
|
|
72
|
+
base-layer-luminance="${StandardLuminance.DarkMode}"
|
|
73
|
+
background-layer-recipe="L2"
|
|
74
|
+
>
|
|
75
|
+
<app-control-pane
|
|
76
|
+
:componentType="${x => x.componentType}"
|
|
77
|
+
:neutralColor="${x => x.neutralColor}"
|
|
78
|
+
:accentColor="${x => x.accentColor}"
|
|
79
|
+
:showOnlyLayerBackgrounds="${x => x.showOnlyLayerBackgrounds}"
|
|
80
|
+
@formvaluechange="${(x, c) => x.controlPaneHandler(c.event)}"
|
|
81
|
+
></app-control-pane>
|
|
82
|
+
</app-layer-background>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
|
87
|
+
const styles = css `
|
|
88
|
+
:host {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.container {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.container.fill {
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 1200px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.row {
|
|
102
|
+
position: relative;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: row;
|
|
105
|
+
flex-basis: auto;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.row.fill {
|
|
109
|
+
flex: 1;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.canvas {
|
|
114
|
+
min-width: 300px;
|
|
115
|
+
flex-grow: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.gradient {
|
|
119
|
+
height: 20px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.control-pane-container {
|
|
123
|
+
height: 100%;
|
|
124
|
+
z-index: 1;
|
|
125
|
+
padding: 40px;
|
|
126
|
+
position: relative;
|
|
127
|
+
overflow: auto;
|
|
128
|
+
width: 310px;
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
app-color-block {
|
|
133
|
+
min-width: 400px;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
let App = class App extends FASTElement {
|
|
137
|
+
constructor() {
|
|
138
|
+
super(...arguments);
|
|
139
|
+
this.componentType = ComponentTypes.backplate;
|
|
140
|
+
this.neutralPalette = [];
|
|
141
|
+
this.accentPalette = [];
|
|
142
|
+
this.showOnlyLayerBackgrounds = true;
|
|
143
|
+
this.layerRecipes = [
|
|
144
|
+
[neutralLayerFloatingRecipe, 'neutralLayerFloating'],
|
|
145
|
+
[neutralLayerCardContainerRecipe, 'neutralLayerCardContainer'],
|
|
146
|
+
[neutralLayer1Recipe, 'neutralLayer1'],
|
|
147
|
+
[neutralLayer2Recipe, 'neutralLayer2'],
|
|
148
|
+
[neutralLayer3Recipe, 'neutralLayer3'],
|
|
149
|
+
[neutralLayer4Recipe, 'neutralLayer4'],
|
|
150
|
+
];
|
|
151
|
+
this.resolveLayerRecipes = (luminance) => {
|
|
152
|
+
const designSystemElement = document.createElement('div');
|
|
153
|
+
this.canvasElement.appendChild(designSystemElement);
|
|
154
|
+
baseLayerLuminance.setValueFor(designSystemElement, luminance);
|
|
155
|
+
return this.layerRecipes
|
|
156
|
+
.map((conf) => {
|
|
157
|
+
const color = conf[0].getValueFor(document.body).evaluate(designSystemElement).toColorString();
|
|
158
|
+
return {
|
|
159
|
+
index: this.neutralPalette.indexOf(color),
|
|
160
|
+
color: color,
|
|
161
|
+
title: conf[1],
|
|
162
|
+
};
|
|
163
|
+
})
|
|
164
|
+
.reduce((accum, value) => {
|
|
165
|
+
const colorIndex = accum.findIndex((config) => config.color === value.color);
|
|
166
|
+
return colorIndex === -1
|
|
167
|
+
? accum.concat(value)
|
|
168
|
+
: accum.map((config, index) => index === colorIndex
|
|
169
|
+
? {
|
|
170
|
+
index: this.neutralPalette.indexOf(value.color),
|
|
171
|
+
color: value.color,
|
|
172
|
+
title: value.title.concat(', ', config.title),
|
|
173
|
+
}
|
|
174
|
+
: config);
|
|
175
|
+
}, [])
|
|
176
|
+
.sort((a, b) => a.index - b.index);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
neutralColorChanged(prev, next) {
|
|
180
|
+
if (this.canvasElement && next) {
|
|
181
|
+
const swatch = SwatchRGB.from(parseColorHexRGB(next));
|
|
182
|
+
neutralBaseColor.setValueFor(this.canvasElement, swatch);
|
|
183
|
+
this.neutralPalette = PaletteRGB.from(swatch).swatches.map((x) => x.toColorString());
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
accentColorChanged(prev, next) {
|
|
187
|
+
if (this.canvasElement && next) {
|
|
188
|
+
const swatch = SwatchRGB.from(parseColorHexRGB(next));
|
|
189
|
+
accentBaseColor.setValueFor(this.canvasElement, swatch);
|
|
190
|
+
this.accentPalette = PaletteRGB.from(swatch).swatches.map((x) => x.toColorString());
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
connectedCallback() {
|
|
194
|
+
super.connectedCallback();
|
|
195
|
+
this.neutralColorChanged(undefined, this.neutralColor);
|
|
196
|
+
this.accentColorChanged(undefined, this.accentColor);
|
|
197
|
+
}
|
|
198
|
+
backgrounds() {
|
|
199
|
+
const neutralLayers = this.lightModeLayers.concat(this.darkModeLayers);
|
|
200
|
+
return this.showOnlyLayerBackgrounds
|
|
201
|
+
? neutralLayers
|
|
202
|
+
: this.neutralPalette.map((color, index) => {
|
|
203
|
+
const neutralLayerIndex = neutralLayers.findIndex((config) => config.color === color);
|
|
204
|
+
return {
|
|
205
|
+
index,
|
|
206
|
+
color,
|
|
207
|
+
title: neutralLayerIndex !== -1 ? neutralLayers[neutralLayerIndex].title : undefined,
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
get lightModeLayers() {
|
|
212
|
+
return this.resolveLayerRecipes(StandardLuminance.LightMode);
|
|
213
|
+
}
|
|
214
|
+
get darkModeLayers() {
|
|
215
|
+
return this.resolveLayerRecipes(StandardLuminance.DarkMode);
|
|
216
|
+
}
|
|
217
|
+
controlPaneHandler(e) {
|
|
218
|
+
const detail = e.detail;
|
|
219
|
+
this[detail.field] = detail.value;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
__decorate([
|
|
223
|
+
attr({ attribute: 'component-type' })
|
|
224
|
+
], App.prototype, "componentType", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
attr({ attribute: 'neutral-color' })
|
|
227
|
+
], App.prototype, "neutralColor", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
observable
|
|
230
|
+
], App.prototype, "neutralPalette", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
attr({ attribute: 'accent-color' })
|
|
233
|
+
], App.prototype, "accentColor", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
observable
|
|
236
|
+
], App.prototype, "accentPalette", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
observable
|
|
239
|
+
], App.prototype, "showOnlyLayerBackgrounds", void 0);
|
|
240
|
+
App = __decorate([
|
|
241
|
+
customElement({
|
|
242
|
+
name: 'app-main',
|
|
243
|
+
template,
|
|
244
|
+
styles,
|
|
245
|
+
})
|
|
246
|
+
], App);
|
|
247
|
+
export { App };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var AccentColors;
|
|
2
|
+
(function (AccentColors) {
|
|
3
|
+
AccentColors["black"] = "#000000";
|
|
4
|
+
AccentColors["white"] = "#FFFFFF";
|
|
5
|
+
AccentColors["magenta"] = "#DA1A5F";
|
|
6
|
+
AccentColors["blue"] = "#0078D4";
|
|
7
|
+
AccentColors["green"] = "#107C10";
|
|
8
|
+
AccentColors["purple"] = "#5C2D91";
|
|
9
|
+
AccentColors["orange"] = "#D83B01";
|
|
10
|
+
AccentColors["yellow"] = "#F2C812";
|
|
11
|
+
})(AccentColors || (AccentColors = {}));
|
|
12
|
+
export const neutralColors = [
|
|
13
|
+
'#808080',
|
|
14
|
+
'#73818C',
|
|
15
|
+
'#718E71',
|
|
16
|
+
'#7F738C',
|
|
17
|
+
'#8C7A73',
|
|
18
|
+
'#0078D4',
|
|
19
|
+
'#107C10',
|
|
20
|
+
'#5C2D91',
|
|
21
|
+
'#D83B01',
|
|
22
|
+
];
|
|
23
|
+
export const defaultAccentColor = AccentColors.blue;
|
|
24
|
+
export const defaultNeutralColor = neutralColors[0];
|