@fluentui/web-components 3.0.0-beta.65 → 3.0.0-beta.66
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.md +11 -2
- package/dist/dts/rating-display/rating-display.d.ts +25 -1
- package/dist/dts/theme/design-tokens.d.ts +40 -0
- package/dist/esm/rating-display/rating-display.js +30 -3
- package/dist/esm/rating-display/rating-display.js.map +1 -1
- package/dist/esm/rating-display/rating-display.styles.js +13 -7
- package/dist/esm/rating-display/rating-display.styles.js.map +1 -1
- package/dist/esm/rating-display/rating-display.template.js +6 -4
- package/dist/esm/rating-display/rating-display.template.js.map +1 -1
- package/dist/esm/theme/design-tokens.js +40 -0
- package/dist/esm/theme/design-tokens.js.map +1 -1
- package/dist/web-components.d.ts +73 -1
- package/dist/web-components.js +24 -4
- package/dist/web-components.min.js +133 -133
- package/package.json +2 -2
package/dist/web-components.js
CHANGED
|
@@ -9400,6 +9400,14 @@ class BaseRatingDisplay extends FASTElement {
|
|
|
9400
9400
|
this.intlNumberFormatter = new Intl.NumberFormat();
|
|
9401
9401
|
this.elementInternals.role = "img";
|
|
9402
9402
|
}
|
|
9403
|
+
/**
|
|
9404
|
+
* @internal
|
|
9405
|
+
*/
|
|
9406
|
+
slottedIconChanged() {
|
|
9407
|
+
if (this.$fastController.isConnected) {
|
|
9408
|
+
this.customIcon = this.slottedIcon[0]?.outerHTML;
|
|
9409
|
+
}
|
|
9410
|
+
}
|
|
9403
9411
|
/**
|
|
9404
9412
|
* Returns "count" as string, formatted according to the locale.
|
|
9405
9413
|
*
|
|
@@ -9431,10 +9439,14 @@ class BaseRatingDisplay extends FASTElement {
|
|
|
9431
9439
|
*/
|
|
9432
9440
|
generateIcons() {
|
|
9433
9441
|
let htmlString = "";
|
|
9442
|
+
let customIcon;
|
|
9443
|
+
if (this.customIcon) {
|
|
9444
|
+
customIcon = /<svg[^>]*>([\s\S]*?)<\/svg>/.exec(this.customIcon)?.[1] ?? "";
|
|
9445
|
+
}
|
|
9434
9446
|
const selectedValue = this.getSelectedValue();
|
|
9435
9447
|
for (let i = 0; i < this.getMaxIcons(); i++) {
|
|
9436
9448
|
const iconValue = (i + 1) / 2;
|
|
9437
|
-
htmlString += `<svg aria-hidden="true" ${iconValue === selectedValue ? "selected" : ""}
|
|
9449
|
+
htmlString += `<svg aria-hidden="true" viewBox="${this.iconViewBox ?? "0 0 20 20"}" ${iconValue === selectedValue ? "selected" : ""}>${customIcon ?? '<use href="#star"></use>'}</svg>`;
|
|
9438
9450
|
}
|
|
9439
9451
|
return htmlString;
|
|
9440
9452
|
}
|
|
@@ -9442,12 +9454,17 @@ class BaseRatingDisplay extends FASTElement {
|
|
|
9442
9454
|
__decorateClass$9([attr({
|
|
9443
9455
|
converter: nullableNumberConverter
|
|
9444
9456
|
})], BaseRatingDisplay.prototype, "count", 2);
|
|
9457
|
+
__decorateClass$9([attr({
|
|
9458
|
+
attribute: "icon-view-box"
|
|
9459
|
+
})], BaseRatingDisplay.prototype, "iconViewBox", 2);
|
|
9445
9460
|
__decorateClass$9([attr({
|
|
9446
9461
|
converter: nullableNumberConverter
|
|
9447
9462
|
})], BaseRatingDisplay.prototype, "max", 2);
|
|
9448
9463
|
__decorateClass$9([attr({
|
|
9449
9464
|
converter: nullableNumberConverter
|
|
9450
9465
|
})], BaseRatingDisplay.prototype, "value", 2);
|
|
9466
|
+
__decorateClass$9([observable], BaseRatingDisplay.prototype, "slottedIcon", 2);
|
|
9467
|
+
__decorateClass$9([observable], BaseRatingDisplay.prototype, "customIcon", 2);
|
|
9451
9468
|
class RatingDisplay extends BaseRatingDisplay {
|
|
9452
9469
|
constructor() {
|
|
9453
9470
|
super(...arguments);
|
|
@@ -9499,12 +9516,15 @@ __decorateClass$9([attr({
|
|
|
9499
9516
|
const styles$b = css`
|
|
9500
9517
|
${display("inline-flex")}
|
|
9501
9518
|
|
|
9502
|
-
:host{--icon-size:16px;align-items:center;color:${colorNeutralForeground1};font-family:${fontFamilyBase};font-size:${fontSizeBase200};line-height:${lineHeightBase200};contain:layout style;user-select:none}:host(${smallState}){--icon-size:12px}:host(${largeState}){--icon-size:20px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}svg{width:var(--icon-size);height:var(--icon-size);fill
|
|
9519
|
+
:host{--icon-size:16px;--icon-color-filled:${colorPaletteMarigoldBackground3};--icon-color-empty:${colorPaletteMarigoldBackground2};align-items:center;color:${colorNeutralForeground1};font-family:${fontFamilyBase};font-size:${fontSizeBase200};line-height:${lineHeightBase200};contain:layout style;user-select:none}:host(${smallState}){--icon-size:12px}:host(${largeState}){--icon-size:20px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}::slotted([slot='icon']){display:none}svg{width:var(--icon-size);height:var(--icon-size);fill:var(--icon-color-filled);margin-inline-end:${spacingHorizontalXXS}}svg:nth-child(odd){clip-path:inset(0 50% 0 0);margin-inline-end:calc(0px - var(--icon-size))}:host(${neutralState}) svg{--icon-color-filled:${colorNeutralForeground1}}:host(${brandState}) svg{--icon-color-filled:${colorBrandBackground}}:host(:is([value^='-'],[value='0'])) svg,:host(:not([value])) svg,svg[selected] ~ svg{fill:var(--icon-color-empty)}:host(${neutralState}:is([value^='-'],[value='0'])) svg,:host(${neutralState}:not([value])) svg,:host(${neutralState}) svg[selected] ~ svg{--icon-color-empty:${colorNeutralBackground1Pressed}}:host(${brandState}:is([value^='-'],[value='0'])) svg,:host(${brandState}:not([value])) svg,:host(${brandState}) svg[selected] ~ svg{--icon-color-empty:${colorBrandStroke2}}.value-label,::slotted([slot='value']){display:block;margin-inline-start:${spacingHorizontalXS};font-weight:${fontWeightSemibold}}:host(${smallState}) .value-label,:host(${smallState}) ::slotted([slot='value']){margin-inline-start:${spacingHorizontalXXS}}:host(${largeState}) .value-label,:host(${largeState}) ::slotted([slot='value']){margin-inline-start:${spacingHorizontalSNudge}}:host(:not([count])) .count-label{display:none}.count-label::before,::slotted([slot='count'])::before{content:'·';margin-inline:${spacingHorizontalXS}}:host(${smallState}) .count-label::before,:host(${smallState}) ::slotted([slot='count'])::before{margin-inline:${spacingHorizontalXXS}}:host(${largeState}) .count-label::before,:host(${largeState}) ::slotted([slot='count'])::before{margin-inline:${spacingHorizontalSNudge}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
9503
9520
|
:host([color]) svg{fill:CanvasText}:host([color]:is([value^='-'],[value='0'])) svg,:host(:not([value])) svg,:host([color]) svg[selected] ~ svg{fill:Canvas;stroke:CanvasText}`));
|
|
9504
9521
|
|
|
9505
|
-
const star = html`<svg xmlns="http://www.w3.org/2000/svg" style="display: none"><symbol id="star"
|
|
9522
|
+
const star = html`<svg xmlns="http://www.w3.org/2000/svg" style="display: none"><symbol id="star"><path d="M9.10433 2.89874C9.47114 2.15549 10.531 2.1555 10.8978 2.89874L12.8282 6.81024L17.1448 7.43748C17.9651 7.55666 18.2926 8.56464 17.699 9.14317L14.5755 12.1878L15.3129 16.487C15.453 17.3039 14.5956 17.9269 13.8619 17.5412L10.0011 15.5114L6.14018 17.5412C5.40655 17.9269 4.54913 17.3039 4.68924 16.487L5.4266 12.1878L2.30308 9.14317C1.70956 8.56463 2.03708 7.55666 2.8573 7.43748L7.17389 6.81024L9.10433 2.89874Z" /></symbol></svg>`;
|
|
9506
9523
|
function ratingDisplayTemplate() {
|
|
9507
|
-
return html` ${
|
|
9524
|
+
return html` ${x => html`${staticallyCompose(x.generateIcons())}`}<slot name="icon" ${slotted({
|
|
9525
|
+
property: "slottedIcon",
|
|
9526
|
+
filter: elements("svg")
|
|
9527
|
+
})}>${star}</slot><slot name="value"><span class="value-label" aria-hidden="true">${x => x.value}</span></slot><slot name="count"><span class="count-label" aria-hidden="true">${x => x.formattedCount}</span></slot>`;
|
|
9508
9528
|
}
|
|
9509
9529
|
const template$b = ratingDisplayTemplate();
|
|
9510
9530
|
|