@fluentui/web-components 3.0.0-beta.40 → 3.0.0-beta.42
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 +21 -2
- package/dist/dts/index-rollup.d.ts +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/menu-item/menu-item.d.ts +31 -2
- package/dist/dts/menu-item/menu-item.styles.d.ts +5 -0
- package/dist/dts/menu-item/menu-item.template.d.ts +1 -1
- package/dist/dts/menu-list/menu-list.d.ts +7 -0
- package/dist/dts/slider/slider.d.ts +180 -35
- package/dist/dts/slider/slider.options.d.ts +2 -2
- package/dist/dts/slider/slider.template.d.ts +2 -2
- package/dist/dts/styles/states/index.d.ts +5 -0
- package/dist/dts/utils/converters.d.ts +17 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.js.map +1 -1
- package/dist/esm/avatar/avatar.js +2 -1
- package/dist/esm/avatar/avatar.js.map +1 -1
- package/dist/esm/badge/badge.js.map +1 -1
- package/dist/esm/button/button.js +2 -1
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +2 -1
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/counter-badge/counter-badge.js.map +1 -1
- package/dist/esm/dialog/dialog.js.map +1 -1
- package/dist/esm/dialog-body/dialog-body.js.map +1 -1
- package/dist/esm/divider/divider.js.map +1 -1
- package/dist/esm/drawer/drawer.js.map +1 -1
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/image/image.js.map +1 -1
- package/dist/esm/index-rollup.js +1 -0
- package/dist/esm/index-rollup.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/label/label.js.map +1 -1
- package/dist/esm/link/link.js.map +1 -1
- package/dist/esm/menu/menu.js +0 -4
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/menu-item/menu-item.js +55 -4
- package/dist/esm/menu-item/menu-item.js.map +1 -1
- package/dist/esm/menu-item/menu-item.styles.js +19 -17
- package/dist/esm/menu-item/menu-item.styles.js.map +1 -1
- package/dist/esm/menu-item/menu-item.template.js +3 -7
- package/dist/esm/menu-item/menu-item.template.js.map +1 -1
- package/dist/esm/menu-list/menu-list.js +18 -10
- package/dist/esm/menu-list/menu-list.js.map +1 -1
- package/dist/esm/menu-list/menu-list.template.js +0 -1
- package/dist/esm/menu-list/menu-list.template.js.map +1 -1
- package/dist/esm/message-bar/message-bar.js.map +1 -1
- package/dist/esm/patterns/aria-globals.js.map +1 -1
- package/dist/esm/progress-bar/progress-bar.js.map +1 -1
- package/dist/esm/radio-group/radio-group.js +2 -1
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/rating-display/rating-display.js.map +1 -1
- package/dist/esm/slider/slider.js +442 -220
- package/dist/esm/slider/slider.js.map +1 -1
- package/dist/esm/slider/slider.styles.js +107 -132
- package/dist/esm/slider/slider.styles.js.map +1 -1
- package/dist/esm/slider/slider.template.js +11 -28
- package/dist/esm/slider/slider.template.js.map +1 -1
- package/dist/esm/spinner/spinner.js.map +1 -1
- package/dist/esm/styles/states/index.js +5 -0
- package/dist/esm/styles/states/index.js.map +1 -1
- package/dist/esm/tab/tab.js.map +1 -1
- package/dist/esm/tabs/tabs.js.map +1 -1
- package/dist/esm/text-input/text-input.js +2 -1
- package/dist/esm/text-input/text-input.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.js.map +1 -1
- package/dist/esm/utils/converters.js +26 -0
- package/dist/esm/utils/converters.js.map +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/web-components.d.ts +231 -102
- package/dist/web-components.js +531 -594
- package/dist/web-components.min.js +207 -203
- package/package.json +3 -1
package/dist/web-components.js
CHANGED
|
@@ -3450,6 +3450,17 @@ __decorateClass$u([attr({
|
|
|
3450
3450
|
attribute: "aria-roledescription"
|
|
3451
3451
|
})], ARIAGlobalStatesAndProperties.prototype, "ariaRoledescription", 2);
|
|
3452
3452
|
|
|
3453
|
+
const numberLikeStringConverter = {
|
|
3454
|
+
fromView(value) {
|
|
3455
|
+
const valueAsNumber = parseFloat(value);
|
|
3456
|
+
return Number.isNaN(valueAsNumber) ? "" : valueAsNumber.toString();
|
|
3457
|
+
},
|
|
3458
|
+
toView(value) {
|
|
3459
|
+
const valueAsNumber = parseFloat(value);
|
|
3460
|
+
return Number.isNaN(valueAsNumber) ? void 0 : valueAsNumber.toString();
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3463
|
+
|
|
3453
3464
|
const getDirection = rootNode => {
|
|
3454
3465
|
return rootNode.closest("[dir]")?.dir === "rtl" ? Direction.rtl : Direction.ltr;
|
|
3455
3466
|
};
|
|
@@ -3743,6 +3754,7 @@ const squareState = css.partial`:is([state--square], :state(square))`;
|
|
|
3743
3754
|
const tinyState = css.partial`:is([state--tiny], :state(tiny))`;
|
|
3744
3755
|
const extraSmallState = css.partial`:is([state--extra-small], :state(extra-small))`;
|
|
3745
3756
|
const smallState = css.partial`:is([state--small], :state(small))`;
|
|
3757
|
+
css.partial`:is([state--medium], :state(medium))`;
|
|
3746
3758
|
const largeState = css.partial`:is([state--large], :state(large))`;
|
|
3747
3759
|
const extraLargeState = css.partial`:is([state--extra-large], :state(extra-large))`;
|
|
3748
3760
|
const hugeState = css.partial`:is([state--huge], :state(huge))`;
|
|
@@ -3979,6 +3991,7 @@ const spacingHorizontalS = "var(--spacingHorizontalS)";
|
|
|
3979
3991
|
const spacingHorizontalMNudge = "var(--spacingHorizontalMNudge)";
|
|
3980
3992
|
const spacingHorizontalM = "var(--spacingHorizontalM)";
|
|
3981
3993
|
const spacingHorizontalL = "var(--spacingHorizontalL)";
|
|
3994
|
+
const spacingHorizontalXL = "var(--spacingHorizontalXL)";
|
|
3982
3995
|
const spacingHorizontalXXL = "var(--spacingHorizontalXXL)";
|
|
3983
3996
|
const spacingVerticalXXS = "var(--spacingVerticalXXS)";
|
|
3984
3997
|
const spacingVerticalXS = "var(--spacingVerticalXS)";
|
|
@@ -4005,7 +4018,7 @@ const curveEasyEaseMax = "var(--curveEasyEaseMax)";
|
|
|
4005
4018
|
const curveEasyEase = "var(--curveEasyEase)";
|
|
4006
4019
|
const curveLinear = "var(--curveLinear)";
|
|
4007
4020
|
|
|
4008
|
-
const styles$
|
|
4021
|
+
const styles$y = css`
|
|
4009
4022
|
${display("block")}
|
|
4010
4023
|
|
|
4011
4024
|
:host{max-width:fit-content;contain:content}.heading{height:44px;display:grid;position:relative;padding-inline:${spacingHorizontalM} ${spacingHorizontalMNudge};border-radius:${borderRadiusMedium};font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};grid-template-columns:auto auto 1fr auto}.button{appearance:none;background:${colorTransparentBackground};border:none;box-sizing:border-box;color:${colorNeutralForeground1};cursor:pointer;font:inherit;grid-column:auto / span 2;grid-row:1;height:44px;outline:none;padding:0;text-align:start}.button::before{content:'';position:absolute;inset:0px;cursor:pointer;border-radius:${borderRadiusSmall}}:where(.default-marker-collapsed,.default-marker-expanded),::slotted(:is([slot='marker-collapsed'],[slot='marker-expanded'])){display:flex;align-items:center;justify-content:center;pointer-events:none;position:relative;height:100%;padding-inline-end:${spacingHorizontalS};grid-column:1 / span 1;grid-row:1}.content{margin:0 ${spacingHorizontalM}}::slotted([slot='start']){display:flex;justify-content:center;align-items:center;padding-right:${spacingHorizontalS};grid-column:2 / span 1;grid-row:1}button:focus-visible::after{content:'';position:absolute;inset:0px;cursor:pointer;border-radius:${borderRadiusSmall};outline:none;border:2px solid ${colorStrokeFocus1};box-shadow:inset 0 0 0 1px ${colorStrokeFocus2}}:host(${disabledState}) .button{color:${colorNeutralForegroundDisabled}}:host(${disabledState}) svg{filter:invert(89%) sepia(0%) saturate(569%) hue-rotate(155deg) brightness(88%) contrast(87%)}:host(${expandedState}) .content{display:block}:host(${expandedState}) .default-marker-collapsed,:host(${expandedState}) ::slotted([slot='marker-collapsed']),:host(:not(${expandedState})) :is(.default-marker-expanded,.content),:host(:not(${expandedState})) ::slotted([slot='marker-expanded']){display:none}:host(${expandedState}) ::slotted([slot='marker-expanded']),:host(:not(${expandedState})) ::slotted([slot='marker-collapsed']){display:flex}.heading{font-size:${fontSizeBase300};line-height:${lineHeightBase300}}:host(${smallState}) .heading{font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host(${largeState}) .heading{font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${extraLargeState}) .heading{font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host(${alignEndState}) :slotted([slot='start']){grid-column:1 / span 1}:host(${alignEndState}) :is(.default-marker-collapsed,.default-marker-expanded){grid-column:4 / span 1;padding-inline-start:${spacingHorizontalS};padding-inline-end:0}:host(${alignEndState}) .button{grid-column:2 / span 3}:host([block]){max-width:100%}:host(${alignEndState}) .heading{grid-template-columns:auto auto 28px;padding-inline:${spacingHorizontalM}}:host(${alignEndState}:has([slot='start'])) .heading{padding-inline:${spacingHorizontalMNudge} ${spacingHorizontalM}}:host(${blockState}${alignEndState}) .heading{grid-template-columns:auto 1fr}:host(${alignEndState}) :is(.default-marker-collapsed,.default-marker-expanded){grid-column:5 / span 1}`;
|
|
@@ -4041,18 +4054,18 @@ const chevronDown20Filled = html.partial(`<svg
|
|
|
4041
4054
|
function accordionItemTemplate(options = {}) {
|
|
4042
4055
|
return html`<div class="heading" part="heading" role="heading" aria-level="${x => x.headinglevel}"><button class="button" part="button" ${ref("expandbutton")} ?disabled="${x => x.disabled ? "true" : void 0}" aria-expanded="${x => x.expanded}" aria-controls="${x => x.id}-panel" id="${x => x.id}"><slot name="heading"></slot></button>${startSlotTemplate(options)}<slot name="marker-expanded">${staticallyCompose(options.expandedIcon)}</slot><slot name="marker-collapsed">${staticallyCompose(options.collapsedIcon)}</slot></div><div class="content" part="content" id="${x => x.id}-panel" role="region" aria-labelledby="${x => x.id}"><slot></slot></div>`;
|
|
4043
4056
|
}
|
|
4044
|
-
const template$
|
|
4057
|
+
const template$z = accordionItemTemplate({
|
|
4045
4058
|
collapsedIcon: chevronRight20Filled,
|
|
4046
4059
|
expandedIcon: chevronDown20Filled
|
|
4047
4060
|
});
|
|
4048
4061
|
|
|
4049
|
-
const definition$
|
|
4062
|
+
const definition$z = AccordionItem.compose({
|
|
4050
4063
|
name: `${FluentDesignSystem.prefix}-accordion-item`,
|
|
4051
|
-
template: template$
|
|
4052
|
-
styles: styles$
|
|
4064
|
+
template: template$z,
|
|
4065
|
+
styles: styles$y
|
|
4053
4066
|
});
|
|
4054
4067
|
|
|
4055
|
-
definition$
|
|
4068
|
+
definition$z.define(FluentDesignSystem.registry);
|
|
4056
4069
|
|
|
4057
4070
|
const AccordionExpandMode = {
|
|
4058
4071
|
single: "single",
|
|
@@ -4208,7 +4221,7 @@ __decorateClass$s([attr({
|
|
|
4208
4221
|
})], Accordion.prototype, "expandmode", 2);
|
|
4209
4222
|
__decorateClass$s([observable], Accordion.prototype, "slottedAccordionItems", 2);
|
|
4210
4223
|
|
|
4211
|
-
const styles$
|
|
4224
|
+
const styles$x = css`
|
|
4212
4225
|
${display("flex")}
|
|
4213
4226
|
|
|
4214
4227
|
:host{flex-direction:column;width:100%;contain:content}`;
|
|
@@ -4219,15 +4232,15 @@ function accordionTemplate() {
|
|
|
4219
4232
|
filter: elements()
|
|
4220
4233
|
})}></slot></template>`;
|
|
4221
4234
|
}
|
|
4222
|
-
const template$
|
|
4235
|
+
const template$y = accordionTemplate();
|
|
4223
4236
|
|
|
4224
|
-
const definition$
|
|
4237
|
+
const definition$y = Accordion.compose({
|
|
4225
4238
|
name: `${FluentDesignSystem.prefix}-accordion`,
|
|
4226
|
-
template: template$
|
|
4227
|
-
styles: styles$
|
|
4239
|
+
template: template$y,
|
|
4240
|
+
styles: styles$x
|
|
4228
4241
|
});
|
|
4229
4242
|
|
|
4230
|
-
definition$
|
|
4243
|
+
definition$y.define(FluentDesignSystem.registry);
|
|
4231
4244
|
|
|
4232
4245
|
const ButtonType = {
|
|
4233
4246
|
submit: "submit",
|
|
@@ -4433,13 +4446,13 @@ const baseButtonStyles = css`
|
|
|
4433
4446
|
${display("inline-flex")}
|
|
4434
4447
|
|
|
4435
4448
|
:host{--icon-spacing:${spacingHorizontalSNudge};position:relative;contain:layout style;vertical-align:middle;align-items:center;box-sizing:border-box;justify-content:center;text-align:center;text-decoration-line:none;margin:0;min-height:32px;outline-style:none;background-color:${colorNeutralBackground1};color:${colorNeutralForeground1};border:${strokeWidthThin} solid ${colorNeutralStroke1};padding:0 ${spacingHorizontalM};min-width:96px;border-radius:${borderRadiusMedium};font-size:${fontSizeBase300};font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};line-height:${lineHeightBase300};transition-duration:${durationFaster};transition-property:background,border,color;transition-timing-function:${curveEasyEase};cursor:pointer;user-select:none}.content{display:inherit}:host(:hover){background-color:${colorNeutralBackground1Hover};color:${colorNeutralForeground1Hover};border-color:${colorNeutralStroke1Hover}}:host(:hover:active){background-color:${colorNeutralBackground1Pressed};border-color:${colorNeutralStroke1Pressed};color:${colorNeutralForeground1Pressed};outline-style:none}:host(:focus-visible){border-color:${colorTransparentStroke};outline:${strokeWidthThick} solid ${colorTransparentStroke};box-shadow:${shadow4},0 0 0 2px ${colorStrokeFocus2}}@media screen and (prefers-reduced-motion:reduce){transition-duration:0.01ms}::slotted(svg){font-size:20px;height:20px;width:20px;fill:currentColor}:is([slot='start'],::slotted([slot='start'])){margin-inline-end:var(--icon-spacing)}:is([slot='end'],::slotted([slot='end'])){margin-inline-start:var(--icon-spacing)}:host(${iconOnlyState}){min-width:32px;max-width:32px}:host(${smallState}){--icon-spacing:${spacingHorizontalXS};min-height:24px;min-width:64px;padding:0 ${spacingHorizontalS};border-radius:${borderRadiusSmall};font-size:${fontSizeBase200};line-height:${lineHeightBase200};font-weight:${fontWeightRegular}}:host(${smallState}${iconOnlyState}){min-width:24px;max-width:24px}:host(${largeState}){min-height:40px;border-radius:${borderRadiusLarge};padding:0 ${spacingHorizontalL};font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${largeState}${iconOnlyState}){min-width:40px;max-width:40px}:host(${largeState}) ::slotted(svg){font-size:24px;height:24px;width:24px}:host(:is(${circularState},${circularState}:focus-visible)){border-radius:${borderRadiusCircular}}:host(:is(${squareState},${squareState}:focus-visible)){border-radius:${borderRadiusNone}}:host(${primaryState}){background-color:${colorBrandBackground};color:${colorNeutralForegroundOnBrand};border-color:transparent}:host(${primaryState}:hover){background-color:${colorBrandBackgroundHover}}:host(${primaryState}:is(:hover,:hover:active)){border-color:transparent;color:${colorNeutralForegroundOnBrand}}:host(${primaryState}:hover:active){background-color:${colorBrandBackgroundPressed}}:host(${primaryState}:focus-visible){border-color:${colorNeutralForegroundOnBrand};box-shadow:${shadow2},0 0 0 2px ${colorStrokeFocus2}}:host(${outlineState}){background-color:${colorTransparentBackground}}:host(${outlineState}:hover){background-color:${colorTransparentBackgroundHover}}:host(${outlineState}:hover:active){background-color:${colorTransparentBackgroundPressed}}:host(${subtleState}){background-color:${colorSubtleBackground};color:${colorNeutralForeground2};border-color:transparent}:host(${subtleState}:hover){background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover};border-color:transparent}:host(${subtleState}:hover:active){background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed};border-color:transparent}:host(${subtleState}:hover) ::slotted(svg){fill:${colorNeutralForeground2BrandHover}}:host(${subtleState}:hover:active) ::slotted(svg){fill:${colorNeutralForeground2BrandPressed}}:host(${transparentState}){background-color:${colorTransparentBackground};color:${colorNeutralForeground2}}:host(${transparentState}:hover){background-color:${colorTransparentBackgroundHover};color:${colorNeutralForeground2BrandHover}}:host(${transparentState}:hover:active){background-color:${colorTransparentBackgroundPressed};color:${colorNeutralForeground2BrandPressed}}:host(:is(${transparentState},${transparentState}:is(:hover,:active))){border-color:transparent}`;
|
|
4436
|
-
const styles$
|
|
4449
|
+
const styles$w = css`
|
|
4437
4450
|
${baseButtonStyles}
|
|
4438
4451
|
|
|
4439
4452
|
:host(:is(:disabled,[disabled-focusable],[appearance]:disabled,[appearance][disabled-focusable])),:host(:is(:disabled,[disabled-focusable],[appearance]:disabled,[appearance][disabled-focusable]):hover),:host(:is(:disabled,[disabled-focusable],[appearance]:disabled,[appearance][disabled-focusable]):hover:active){background-color:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled};color:${colorNeutralForegroundDisabled};cursor:not-allowed}:host(${primaryState}:is(:disabled,[disabled-focusable])),:host(${primaryState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){border-color:transparent}:host(${outlineState}:is(:disabled,[disabled-focusable])),:host(${outlineState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){background-color:${colorTransparentBackground}}:host(${subtleState}:is(:disabled,[disabled-focusable])),:host(${subtleState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){background-color:${colorTransparentBackground};border-color:transparent}:host(${transparentState}:is(:disabled,[disabled-focusable])),:host(${transparentState}:is(:disabled,[disabled-focusable]):is(:hover,:hover:active)){border-color:transparent;background-color:${colorTransparentBackground}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
4440
4453
|
:host{background:ButtonFace;color:ButtonText}:host(:is(:hover,:focus-visible)){border-color:Highlight}`));
|
|
4441
4454
|
|
|
4442
|
-
const styles$
|
|
4455
|
+
const styles$v = css`
|
|
4443
4456
|
${baseButtonStyles}
|
|
4444
4457
|
|
|
4445
4458
|
::slotted(a){position:absolute;inset:0}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
@@ -4448,15 +4461,15 @@ const styles$u = css`
|
|
|
4448
4461
|
function anchorTemplate$1(options = {}) {
|
|
4449
4462
|
return html`<template tabindex="0" @click="${(x, c) => x.clickHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}">${startSlotTemplate(options)}<span class="content" part="content"><slot></slot></span>${endSlotTemplate(options)}</template>`;
|
|
4450
4463
|
}
|
|
4451
|
-
const template$
|
|
4464
|
+
const template$x = anchorTemplate$1();
|
|
4452
4465
|
|
|
4453
|
-
const definition$
|
|
4466
|
+
const definition$x = AnchorButton.compose({
|
|
4454
4467
|
name: `${FluentDesignSystem.prefix}-anchor-button`,
|
|
4455
|
-
template: template$
|
|
4456
|
-
styles: styles$
|
|
4468
|
+
template: template$x,
|
|
4469
|
+
styles: styles$v
|
|
4457
4470
|
});
|
|
4458
4471
|
|
|
4459
|
-
definition$
|
|
4472
|
+
definition$x.define(FluentDesignSystem.registry);
|
|
4460
4473
|
|
|
4461
4474
|
const UNWANTED_ENCLOSURES_REGEX = /[\(\[\{][^\)\]\}]*[\)\]\}]/g;
|
|
4462
4475
|
const UNWANTED_CHARS_REGEX = /[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g;
|
|
@@ -4643,22 +4656,22 @@ const animations = {
|
|
|
4643
4656
|
normalEase: curveEasyEase,
|
|
4644
4657
|
nullEasing: curveLinear
|
|
4645
4658
|
};
|
|
4646
|
-
const styles$
|
|
4659
|
+
const styles$u = css`
|
|
4647
4660
|
${display("inline-flex")} :host{position:relative;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};font-size:${fontSizeBase300};border-radius:${borderRadiusCircular};color:${colorNeutralForeground3};background-color:${colorNeutralBackground6};contain:layout style}.default-icon,::slotted(svg){width:20px;height:20px;font-size:20px}::slotted(img){box-sizing:border-box;width:100%;height:100%;border-radius:${borderRadiusCircular}}::slotted([slot='badge']){position:absolute;bottom:0;right:0;box-shadow:0 0 0 ${strokeWidthThin}) ${colorNeutralBackground1}}:host([size='64']) ::slotted([slot='badge']),:host([size='72']) ::slotted([slot='badge']),:host([size='96']) ::slotted([slot='badge']),:host([size='120']) ::slotted([slot='badge']),:host([size='128']) ::slotted([slot='badge']){box-shadow:0 0 0 ${strokeWidthThick}) ${colorNeutralBackground1}}:host([size='16']),:host([size='20']),:host([size='24']){font-size:${fontSizeBase100};font-weight:${fontWeightRegular}}:host([size='16']){width:16px;height:16px}:host([size='20']){width:20px;height:20px}:host([size='24']){width:24px;height:24px}:host([size='16']) .default-icon,:host([size='16']) ::slotted(svg){width:12px;height:12px;font-size:12px}:host([size='20']) .default-icon,:host([size='24']) .default-icon,:host([size='20']) ::slotted(svg),:host([size='24']) ::slotted(svg){width:16px;height:16px;font-size:16px}:host([size='28']){width:28px;height:28px;font-size:${fontSizeBase200}}:host([size='36']){width:36px;height:36px}:host([size='40']){width:40px;height:40px}:host([size='48']),:host([size='56']){font-size:${fontSizeBase400}}:host([size='48']){width:48px;height:48px}:host([size='48']) .default-icon,:host([size='48']) ::slotted(svg){width:24px;height:24px;font-size:24px}:host([size='56']){width:56px;height:56px}:host([size='56']) .default-icon,:host([size='56']) ::slotted(svg){width:28px;height:28px;font-size:28px}:host([size='64']),:host([size='72']),:host([size='96']){font-size:${fontSizeBase500}}:host([size='64']) .default-icon,:host([size='72']) .default-icon,:host([size='64']) ::slotted(svg),:host([size='72']) ::slotted(svg){width:32px;height:32px;font-size:32px}:host([size='64']){width:64px;height:64px}:host([size='72']){width:72px;height:72px}:host([size='96']){width:96px;height:96px}:host([size='96']) .default-icon,:host([size='120']) .default-icon,:host([size='128']) .default-icon,:host([size='96']) ::slotted(svg),:host([size='120']) ::slotted(svg),:host([size='128']) ::slotted(svg){width:48px;height:48px;font-size:48px}:host([size='120']),:host([size='128']){font-size:${fontSizeBase600}}:host([size='120']){width:120px;height:120px}:host([size='128']){width:128px;height:128px}:host([shape='square']){border-radius:${borderRadiusMedium}}:host([shape='square'][size='20']),:host([shape='square'][size='24']){border-radius:${borderRadiusSmall}}:host([shape='square'][size='56']),:host([shape='square'][size='64']),:host([shape='square'][size='72']){border-radius:${borderRadiusLarge}}:host([shape='square'][size='96']),:host([shape='square'][size='120']),:host([shape='square'][size='128']){border-radius:${borderRadiusXLarge}}:host(:is([state--brand],:state(brand))){color:${colorNeutralForegroundStaticInverted};background-color:${colorBrandBackgroundStatic}}:host(:is([state--dark-red],:state(dark-red))){color:${colorPaletteDarkRedForeground2};background-color:${colorPaletteDarkRedBackground2}}:host(:is([state--cranberry],:state(cranberry))){color:${colorPaletteCranberryForeground2};background-color:${colorPaletteCranberryBackground2}}:host(:is([state--red],:state(red))){color:${colorPaletteRedForeground2};background-color:${colorPaletteRedBackground2}}:host(:is([state--pumpkin],:state(pumpkin))){color:${colorPalettePumpkinForeground2};background-color:${colorPalettePumpkinBackground2}}:host(:is([state--peach],:state(peach))){color:${colorPalettePeachForeground2};background-color:${colorPalettePeachBackground2}}:host(:is([state--marigold],:state(marigold))){color:${colorPaletteMarigoldForeground2};background-color:${colorPaletteMarigoldBackground2}}:host(:is([state--gold],:state(gold))){color:${colorPaletteGoldForeground2};background-color:${colorPaletteGoldBackground2}}:host(:is([state--brass],:state(brass))){color:${colorPaletteBrassForeground2};background-color:${colorPaletteBrassBackground2}}:host(:is([state--brown],:state(brown))){color:${colorPaletteBrownForeground2};background-color:${colorPaletteBrownBackground2}}:host(:is([state--forest],:state(forest))){color:${colorPaletteForestForeground2};background-color:${colorPaletteForestBackground2}}:host(:is([state--seafoam],:state(seafoam))){color:${colorPaletteSeafoamForeground2};background-color:${colorPaletteSeafoamBackground2}}:host(:is([state--dark-green],:state(dark-green))){color:${colorPaletteDarkGreenForeground2};background-color:${colorPaletteDarkGreenBackground2}}:host(:is([state--light-teal],:state(light-teal))){color:${colorPaletteLightTealForeground2};background-color:${colorPaletteLightTealBackground2}}:host(:is([state--teal],:state(teal))){color:${colorPaletteTealForeground2};background-color:${colorPaletteTealBackground2}}:host(:is([state--steel],:state(steel))){color:${colorPaletteSteelForeground2};background-color:${colorPaletteSteelBackground2}}:host(:is([state--blue],:state(blue))){color:${colorPaletteBlueForeground2};background-color:${colorPaletteBlueBackground2}}:host(:is([state--royal-blue],:state(royal-blue))){color:${colorPaletteRoyalBlueForeground2};background-color:${colorPaletteRoyalBlueBackground2}}:host(:is([state--cornflower],:state(cornflower))){color:${colorPaletteCornflowerForeground2};background-color:${colorPaletteCornflowerBackground2}}:host(:is([state--navy],:state(navy))){color:${colorPaletteNavyForeground2};background-color:${colorPaletteNavyBackground2}}:host(:is([state--lavender],:state(lavender))){color:${colorPaletteLavenderForeground2};background-color:${colorPaletteLavenderBackground2}}:host(:is([state--purple],:state(purple))){color:${colorPalettePurpleForeground2};background-color:${colorPalettePurpleBackground2}}:host(:is([state--grape],:state(grape))){color:${colorPaletteGrapeForeground2};background-color:${colorPaletteGrapeBackground2}}:host(:is([state--lilac],:state(lilac))){color:${colorPaletteLilacForeground2};background-color:${colorPaletteLilacBackground2}}:host(:is([state--pink],:state(pink))){color:${colorPalettePinkForeground2};background-color:${colorPalettePinkBackground2}}:host(:is([state--magenta],:state(magenta))){color:${colorPaletteMagentaForeground2};background-color:${colorPaletteMagentaBackground2}}:host(:is([state--plum],:state(plum))){color:${colorPalettePlumForeground2};background-color:${colorPalettePlumBackground2}}:host(:is([state--beige],:state(beige))){color:${colorPaletteBeigeForeground2};background-color:${colorPaletteBeigeBackground2}}:host(:is([state--mink],:state(mink))){color:${colorPaletteMinkForeground2};background-color:${colorPaletteMinkBackground2}}:host(:is([state--platinum],:state(platinum))){color:${colorPalettePlatinumForeground2};background-color:${colorPalettePlatinumBackground2}}:host(:is([state--anchor],:state(anchor))){color:${colorPaletteAnchorForeground2};background-color:${colorPaletteAnchorBackground2}}:host([active]){transform:perspective(1px);transition-property:transform,opacity;transition-duration:${durationUltraSlow},${durationFaster};transition-delay:${animations.fastEase},${animations.nullEasing}}:host([active])::before{content:'';position:absolute;top:0;left:0;bottom:0;right:0;border-radius:inherit;transition-property:margin,opacity;transition-duration:${durationUltraSlow}),${durationSlower};transition-delay:${animations.fastEase}),${animations.nullEasing})}:host([active])::before{box-shadow:${shadow8};border-style:solid;border-color:${colorBrandBackgroundStatic}}:host([active][appearance='shadow'])::before{border-style:none;border-color:none}:host([active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThick});border-width:${strokeWidthThick}}:host([size='56'][active]:not([appearance='shadow']))::before,:host([size='64'][active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThicker});border-width:${strokeWidthThicker}}:host([size='72'][active]:not([appearance='shadow']))::before,:host([size='96'][active]:not([appearance='shadow']))::before,:host([size='120'][active]:not([appearance='shadow']))::before,:host([size='128'][active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThickest});border-width:${strokeWidthThickest}}:host([size='20'][active][appearance])::before,:host([size='24'][active][appearance])::before,:host([size='28'][active][appearance])::before{box-shadow:${shadow4}}:host([size='56'][active][appearance])::before,:host([size='64'][active][appearance])::before{box-shadow:${shadow16}}:host([size='72'][active][appearance])::before,:host([size='96'][active][appearance])::before,:host([size='120'][active][appearance])::before,:host([size='128'][active][appearance])::before{box-shadow:${shadow28}}:host([active][appearance='ring'])::before{box-shadow:none}:host([active='inactive']){opacity:0.8;transform:scale(0.875);transition-property:transform,opacity;transition-duration:${durationUltraSlow},${durationFaster};transition-delay:${animations.fastOutSlowInMin},${animations.nullEasing}}:host([active='inactive'])::before{margin:0;opacity:0;transition-property:margin,opacity;transition-duration:${durationUltraSlow},${durationSlower};transition-delay:${animations.fastOutSlowInMin},${animations.nullEasing}}@media screen and (prefers-reduced-motion:reduce){:host([active]){transition-duration:0.01ms}:host([active])::before{transition-duration:0.01ms;transition-delay:0.01ms}}`;
|
|
4648
4661
|
|
|
4649
4662
|
const defaultIconTemplate = html`<svg width="1em" height="1em" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" class="default-icon" fill="currentcolor" aria-hidden="true"><path d="M10 2a4 4 0 100 8 4 4 0 000-8zM7 6a3 3 0 116 0 3 3 0 01-6 0zm-2 5a2 2 0 00-2 2c0 1.7.83 2.97 2.13 3.8A9.14 9.14 0 0010 18c1.85 0 3.58-.39 4.87-1.2A4.35 4.35 0 0017 13a2 2 0 00-2-2H5zm-1 2a1 1 0 011-1h10a1 1 0 011 1c0 1.3-.62 2.28-1.67 2.95A8.16 8.16 0 0110 17a8.16 8.16 0 01-4.33-1.05A3.36 3.36 0 014 13z"></path></svg>`;
|
|
4650
4663
|
function avatarTemplate() {
|
|
4651
4664
|
return html`<slot>${x => x.name || x.initials ? x.generateInitials() : defaultIconTemplate}</slot><slot name="badge"></slot>`;
|
|
4652
4665
|
}
|
|
4653
|
-
const template$
|
|
4666
|
+
const template$w = avatarTemplate();
|
|
4654
4667
|
|
|
4655
|
-
const definition$
|
|
4668
|
+
const definition$w = Avatar.compose({
|
|
4656
4669
|
name: `${FluentDesignSystem.prefix}-avatar`,
|
|
4657
|
-
template: template$
|
|
4658
|
-
styles: styles$
|
|
4670
|
+
template: template$w,
|
|
4671
|
+
styles: styles$u
|
|
4659
4672
|
});
|
|
4660
4673
|
|
|
4661
|
-
definition$
|
|
4674
|
+
definition$w.define(FluentDesignSystem.registry);
|
|
4662
4675
|
|
|
4663
4676
|
const BadgeAppearance = {
|
|
4664
4677
|
filled: "filled",
|
|
@@ -5058,7 +5071,7 @@ css.partial`
|
|
|
5058
5071
|
line-height: ${lineHeightBase100};
|
|
5059
5072
|
font-weight: ${fontWeightSemibold};
|
|
5060
5073
|
`;
|
|
5061
|
-
css.partial`
|
|
5074
|
+
const typographySubtitle1Styles = css.partial`
|
|
5062
5075
|
font-family: ${fontFamilyBase};
|
|
5063
5076
|
font-size: ${fontSizeBase500};
|
|
5064
5077
|
line-height: ${lineHeightBase500};
|
|
@@ -5107,7 +5120,7 @@ css.partial`
|
|
|
5107
5120
|
font-weight: ${fontWeightSemibold};
|
|
5108
5121
|
`;
|
|
5109
5122
|
|
|
5110
|
-
const styles$
|
|
5123
|
+
const styles$t = css`
|
|
5111
5124
|
:host(${squareState}){border-radius:${borderRadiusNone}}:host(${roundedState}){border-radius:${borderRadiusMedium}}:host(${roundedState}${tinyState}),:host(${roundedState}${extraSmallState}),:host(${roundedState}${smallState}){border-radius:${borderRadiusSmall}}${badgeSizeStyles}
|
|
5112
5125
|
${badgeFilledStyles}
|
|
5113
5126
|
${badgeGhostStyles}
|
|
@@ -5120,15 +5133,15 @@ const styles$s = css`
|
|
|
5120
5133
|
function badgeTemplate(options = {}) {
|
|
5121
5134
|
return html` ${startSlotTemplate(options)}<slot>${staticallyCompose(options.defaultContent)}</slot>${endSlotTemplate(options)} `;
|
|
5122
5135
|
}
|
|
5123
|
-
const template$
|
|
5136
|
+
const template$v = badgeTemplate();
|
|
5124
5137
|
|
|
5125
|
-
const definition$
|
|
5138
|
+
const definition$v = Badge.compose({
|
|
5126
5139
|
name: `${FluentDesignSystem.prefix}-badge`,
|
|
5127
|
-
template: template$
|
|
5128
|
-
styles: styles$
|
|
5140
|
+
template: template$v,
|
|
5141
|
+
styles: styles$t
|
|
5129
5142
|
});
|
|
5130
5143
|
|
|
5131
|
-
definition$
|
|
5144
|
+
definition$v.define(FluentDesignSystem.registry);
|
|
5132
5145
|
|
|
5133
5146
|
var __defProp$o = Object.defineProperty;
|
|
5134
5147
|
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
@@ -5431,15 +5444,15 @@ applyMixins(Button, StartEnd);
|
|
|
5431
5444
|
function buttonTemplate$1(options = {}) {
|
|
5432
5445
|
return html`<template tabindex="${x => x.disabled ? -1 : 0}" @click="${(x, c) => x.clickHandler(c.event)}" @keypress="${(x, c) => x.keypressHandler(c.event)}">${startSlotTemplate(options)}<span class="content" part="content"><slot ${slotted("defaultSlottedContent")}></slot></span>${endSlotTemplate(options)}</template>`;
|
|
5433
5446
|
}
|
|
5434
|
-
const template$
|
|
5447
|
+
const template$u = buttonTemplate$1();
|
|
5435
5448
|
|
|
5436
|
-
const definition$
|
|
5449
|
+
const definition$u = Button.compose({
|
|
5437
5450
|
name: `${FluentDesignSystem.prefix}-button`,
|
|
5438
|
-
template: template$
|
|
5439
|
-
styles: styles$
|
|
5451
|
+
template: template$u,
|
|
5452
|
+
styles: styles$w
|
|
5440
5453
|
});
|
|
5441
5454
|
|
|
5442
|
-
definition$
|
|
5455
|
+
definition$u.define(FluentDesignSystem.registry);
|
|
5443
5456
|
|
|
5444
5457
|
var __defProp$n = Object.defineProperty;
|
|
5445
5458
|
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
@@ -5878,7 +5891,7 @@ __decorateClass$n([attr], Checkbox.prototype, "shape", 2);
|
|
|
5878
5891
|
__decorateClass$n([attr], Checkbox.prototype, "size", 2);
|
|
5879
5892
|
|
|
5880
5893
|
const indeterminateState = css.partial`:is([state--indeterminate], :state(indeterminate))`;
|
|
5881
|
-
const styles$
|
|
5894
|
+
const styles$s = css`
|
|
5882
5895
|
${display("inline-flex")}
|
|
5883
5896
|
|
|
5884
5897
|
:host{--size:16px;background-color:${colorNeutralBackground1};border-radius:${borderRadiusSmall};border:${strokeWidthThin} solid ${colorNeutralStrokeAccessible};box-sizing:border-box;cursor:pointer;position:relative;width:var(--size)}:host,.indeterminate-indicator,.checked-indicator{aspect-ratio:1}:host(:hover){border-color:${colorNeutralStrokeAccessibleHover}}:host(:active){border-color:${colorNeutralStrokeAccessiblePressed}}:host(${checkedState}:hover){background-color:${colorCompoundBrandBackgroundHover};border-color:${colorCompoundBrandStrokeHover}}:host(${checkedState}:active){background-color:${colorCompoundBrandBackgroundPressed};border-color:${colorCompoundBrandStrokePressed}}:host(:focus-visible){outline:none}:host(:not([slot='input']))::after{content:'';position:absolute;inset:-8px;box-sizing:border-box;outline:none;border:${strokeWidthThick} solid ${colorTransparentStroke};border-radius:${borderRadiusMedium}}:host(:not([slot='input']):focus-visible)::after{border-color:${colorStrokeFocus2}}.indeterminate-indicator,.checked-indicator{color:${colorNeutralForegroundInverted};inset:0;margin:auto;position:absolute}::slotted([slot='checked-indicator']),.checked-indicator{fill:currentColor;display:inline-flex;flex:1 0 auto;width:12px}:host(:not(${checkedState})) *:is(::slotted([slot='checked-indicator']),.checked-indicator){display:none}:host(${checkedState}),:host(${indeterminateState}){border-color:${colorCompoundBrandStroke}}:host(${checkedState}),:host(${indeterminateState}) .indeterminate-indicator{background-color:${colorCompoundBrandBackground}}:host(${indeterminateState}) .indeterminate-indicator{border-radius:${borderRadiusSmall};position:absolute;width:calc(var(--size) / 2);inset:0}:host(${largeState}){--size:20px}:host(${largeState}) ::slotted([slot='checked-indicator']),:host(${largeState}) .checked-indicator{width:16px}:host(${circularState}),:host(${circularState}) .indeterminate-indicator{border-radius:${borderRadiusCircular}}:host([disabled]),:host([disabled]${checkedState}){background-color:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled}}:host([disabled]){cursor:unset}:host([disabled]${indeterminateState}) .indeterminate-indicator{background-color:${colorNeutralStrokeDisabled}}:host([disabled]${checkedState}) .checked-indicator{color:${colorNeutralStrokeDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
@@ -5904,23 +5917,23 @@ const indeterminateIndicator = html.partial( /* html */
|
|
|
5904
5917
|
function checkboxTemplate(options = {}) {
|
|
5905
5918
|
return html`<template tabindex="${x => !x.disabled ? 0 : void 0}" @click="${(x, c) => x.clickHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @keyup="${(x, c) => x.keyupHandler(c.event)}"><slot name="checked-indicator">${staticallyCompose(options.checkedIndicator)}</slot><slot name="indeterminate-indicator">${staticallyCompose(options.indeterminateIndicator)}</slot></template>`;
|
|
5906
5919
|
}
|
|
5907
|
-
const template$
|
|
5920
|
+
const template$t = checkboxTemplate({
|
|
5908
5921
|
checkedIndicator: checkedIndicator$1,
|
|
5909
5922
|
indeterminateIndicator
|
|
5910
5923
|
});
|
|
5911
5924
|
|
|
5912
|
-
const definition$
|
|
5925
|
+
const definition$t = Checkbox.compose({
|
|
5913
5926
|
name: `${FluentDesignSystem.prefix}-checkbox`,
|
|
5914
|
-
template: template$
|
|
5915
|
-
styles: styles$
|
|
5927
|
+
template: template$t,
|
|
5928
|
+
styles: styles$s
|
|
5916
5929
|
});
|
|
5917
5930
|
|
|
5918
|
-
definition$
|
|
5931
|
+
definition$t.define(FluentDesignSystem.registry);
|
|
5919
5932
|
|
|
5920
5933
|
class CompoundButton extends Button {}
|
|
5921
5934
|
|
|
5922
|
-
const styles$
|
|
5923
|
-
${styles$
|
|
5935
|
+
const styles$r = css`
|
|
5936
|
+
${styles$w}
|
|
5924
5937
|
|
|
5925
5938
|
:host,:host(:is([size])){gap:12px;height:auto;padding-top:14px;padding-inline:12px;padding-bottom:16px;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}.content{display:flex;flex-direction:column;text-align:start}::slotted([slot='description']){color:${colorNeutralForeground2};line-height:100%;font-size:${fontSizeBase200};font-weight:${fontWeightRegular}}::slotted(svg),:host(${largeState}) ::slotted(svg){font-size:40px;height:40px;width:40px}:host(:hover) ::slotted([slot='description']){color:${colorNeutralForeground2Hover}}:host(:active) ::slotted([slot='description']){color:${colorNeutralForeground2Pressed}}:host(:is(${primaryState},${primaryState}:hover,${primaryState}:active)) ::slotted([slot='description']){color:${colorNeutralForegroundOnBrand}}:host(:is(${subtleState},${subtleState}:hover,${subtleState}:active)) ::slotted([slot='description']),:host(${transparentState}) ::slotted([slot='description']){color:${colorNeutralForeground2}}:host(${transparentState}:hover) ::slotted([slot='description']){color:${colorNeutralForeground2BrandHover}}:host(${transparentState}:active) ::slotted([slot='description']){color:${colorNeutralForeground2BrandPressed}}:host(:is(:disabled,:disabled[appearance],[disabled-focusable],[disabled-focusable][appearance]))
|
|
5926
5939
|
::slotted([slot='description']){color:${colorNeutralForegroundDisabled}}:host(${smallState}){padding:8px;padding-bottom:10px}:host(${iconOnlyState}){min-width:52px;max-width:52px;padding:${spacingHorizontalSNudge}}:host(${iconOnlyState}${smallState}){min-width:48px;max-width:48px;padding:${spacingHorizontalXS}}:host(${iconOnlyState}${largeState}){min-width:56px;max-width:56px;padding:${spacingHorizontalS}}:host(${largeState}){padding-top:18px;padding-inline:16px;padding-bottom:20px;font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host(${largeState}) ::slotted([slot='description']){font-size:${fontSizeBase300}}`;
|
|
@@ -5928,15 +5941,15 @@ const styles$q = css`
|
|
|
5928
5941
|
function buttonTemplate(options = {}) {
|
|
5929
5942
|
return html`<template ?disabled="${x => x.disabled}" tabindex="${x => x.disabled ? -1 : 0}">${startSlotTemplate(options)}<span class="content" part="content"><slot ${slotted("defaultSlottedContent")}></slot><slot name="description"></slot></span>${endSlotTemplate(options)}</template>`;
|
|
5930
5943
|
}
|
|
5931
|
-
const template$
|
|
5944
|
+
const template$s = buttonTemplate();
|
|
5932
5945
|
|
|
5933
|
-
const definition$
|
|
5946
|
+
const definition$s = CompoundButton.compose({
|
|
5934
5947
|
name: `${FluentDesignSystem.prefix}-compound-button`,
|
|
5935
|
-
template: template$
|
|
5936
|
-
styles: styles$
|
|
5948
|
+
template: template$s,
|
|
5949
|
+
styles: styles$r
|
|
5937
5950
|
});
|
|
5938
5951
|
|
|
5939
|
-
definition$
|
|
5952
|
+
definition$s.define(FluentDesignSystem.registry);
|
|
5940
5953
|
|
|
5941
5954
|
var __defProp$m = Object.defineProperty;
|
|
5942
5955
|
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
@@ -6061,7 +6074,7 @@ __decorateClass$m([attr({
|
|
|
6061
6074
|
applyMixins(CounterBadge, StartEnd);
|
|
6062
6075
|
|
|
6063
6076
|
const dotState = css.partial`:is([state--dot], :state(dot))`;
|
|
6064
|
-
const styles$
|
|
6077
|
+
const styles$q = css`
|
|
6065
6078
|
:host(${roundedState}){border-radius:${borderRadiusMedium}}:host(${roundedState}${tinyState}),:host(${roundedState}${extraSmallState}),:host(${roundedState}${smallState}){border-radius:${borderRadiusSmall}}${badgeSizeStyles}
|
|
6066
6079
|
${badgeFilledStyles}
|
|
6067
6080
|
${badgeGhostStyles}
|
|
@@ -6074,15 +6087,15 @@ function composeTemplate(options = {}) {
|
|
|
6074
6087
|
defaultContent: html`${x => x.setCount()}`
|
|
6075
6088
|
});
|
|
6076
6089
|
}
|
|
6077
|
-
const template$
|
|
6090
|
+
const template$r = composeTemplate();
|
|
6078
6091
|
|
|
6079
|
-
const definition$
|
|
6092
|
+
const definition$r = CounterBadge.compose({
|
|
6080
6093
|
name: `${FluentDesignSystem.prefix}-counter-badge`,
|
|
6081
|
-
template: template$
|
|
6082
|
-
styles: styles$
|
|
6094
|
+
template: template$r,
|
|
6095
|
+
styles: styles$q
|
|
6083
6096
|
});
|
|
6084
6097
|
|
|
6085
|
-
definition$
|
|
6098
|
+
definition$r.define(FluentDesignSystem.registry);
|
|
6086
6099
|
|
|
6087
6100
|
const DialogType = {
|
|
6088
6101
|
modal: "modal",
|
|
@@ -6172,19 +6185,19 @@ __decorateClass$l([attr({
|
|
|
6172
6185
|
})], Dialog.prototype, "ariaLabelledby", 2);
|
|
6173
6186
|
__decorateClass$l([attr], Dialog.prototype, "type", 2);
|
|
6174
6187
|
|
|
6175
|
-
const template$
|
|
6188
|
+
const template$q = html`<dialog role="${x => x.type === DialogType.alert ? "alertdialog" : "dialog"}" type="${x => x.type}" class="dialog" part="dialog" aria-modal="${x => x.type === DialogType.modal || x.type === DialogType.alert ? "true" : void 0}" aria-describedby="${x => x.ariaDescribedby}" aria-labelledby="${x => x.ariaLabelledby}" aria-label="${x => x.ariaLabel}" @click="${(x, c) => x.clickHandler(c.event)}" @cancel="${(x, c) => x.type === DialogType.alert ? c.event.preventDefault() : x.hide()}" ${ref("dialog")}><slot></slot></dialog>`;
|
|
6176
6189
|
|
|
6177
|
-
const styles$
|
|
6190
|
+
const styles$p = css`
|
|
6178
6191
|
@layer base{:host{--dialog-backdrop:${colorBackgroundOverlay};--dialog-starting-scale:0.85}::backdrop{background:var(--dialog-backdrop,rgba(0,0,0,0.4))}dialog{background:${colorNeutralBackground1};border-radius:${borderRadiusXLarge};border:none;box-shadow:${shadow64};color:${colorNeutralForeground1};max-height:calc(-48px + 100vh);padding:0;width:100%;max-width:600px}:host([type='non-modal']) dialog{inset:0;position:fixed;z-index:2;overflow:auto}}@layer animations{@media (prefers-reduced-motion:no-preference){dialog,::backdrop{transition:display allow-discrete,opacity,overlay allow-discrete,scale;transition-duration:${durationGentle};transition-timing-function:${curveDecelerateMid};opacity:0}::backdrop{transition-timing-function:${curveLinear}}[open],[open]::backdrop{opacity:1}dialog:not([open]){scale:var(--dialog-starting-scale);transition-timing-function:${curveAccelerateMid}}}@starting-style{[open],[open]::backdrop{opacity:0}dialog{scale:var(--dialog-starting-scale)}}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
6179
6192
|
@layer base{dialog{border:${strokeWidthThin} solid ${colorTransparentStroke}}}`));
|
|
6180
6193
|
|
|
6181
|
-
const definition$
|
|
6194
|
+
const definition$q = Dialog.compose({
|
|
6182
6195
|
name: `${FluentDesignSystem.prefix}-dialog`,
|
|
6183
|
-
template: template$
|
|
6184
|
-
styles: styles$
|
|
6196
|
+
template: template$q,
|
|
6197
|
+
styles: styles$p
|
|
6185
6198
|
});
|
|
6186
6199
|
|
|
6187
|
-
definition$
|
|
6200
|
+
definition$q.define(FluentDesignSystem.registry);
|
|
6188
6201
|
|
|
6189
6202
|
var __defProp$k = Object.defineProperty;
|
|
6190
6203
|
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
@@ -6219,20 +6232,20 @@ const dismissed16Regular = html.partial(`
|
|
|
6219
6232
|
fill="currentColor"
|
|
6220
6233
|
></path>
|
|
6221
6234
|
</svg>`);
|
|
6222
|
-
const template$
|
|
6235
|
+
const template$p = html`<div class="title" part="title"><slot name="title"></slot><slot name="title-action"><fluent-button ?hidden=${x => x.noTitleAction || x.parentNode?.type === DialogType.alert} tabindex="0" part="title-action" class="title-action" appearance="transparent" icon-only @click=${x => x.parentNode?.hide()} ${ref("defaultTitleAction")}>${dismissed16Regular}</fluent-button></slot></div><div class="content" part="content"><slot></slot></div><div class="actions" part="actions"><slot name="action"></slot></div>`;
|
|
6223
6236
|
|
|
6224
|
-
const styles$
|
|
6237
|
+
const styles$o = css`
|
|
6225
6238
|
${display("grid")}
|
|
6226
6239
|
|
|
6227
6240
|
:host{background:${colorNeutralBackground1};box-sizing:border-box;gap:${spacingVerticalS};padding:${spacingVerticalXXL} ${spacingHorizontalXXL};container:dialog-body / inline-size}.title{box-sizing:border-box;align-items:flex-start;background:${colorNeutralBackground1};color:${colorNeutralForeground1};column-gap:8px;display:flex;font-family:${fontFamilyBase};font-size:${fontSizeBase500};font-weight:${fontWeightSemibold};inset-block-start:0;justify-content:space-between;line-height:${lineHeightBase500};margin-block-end:calc(${spacingVerticalS} * -1);margin-block-start:calc(${spacingVerticalXXL} * -1);padding-block-end:${spacingVerticalS};padding-block-start:${spacingVerticalXXL};position:sticky;z-index:1}.content{box-sizing:border-box;color:${colorNeutralForeground1};font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};min-height:32px}.actions{box-sizing:border-box;background:${colorNeutralBackground1};display:flex;flex-direction:column;gap:${spacingVerticalS};inset-block-end:0;margin-block-end:calc(${spacingVerticalXXL} * -1);padding-block-end:${spacingVerticalXXL};padding-block-start:${spacingVerticalL};position:sticky;z-index:2}:not(:has(:is([slot='title'],[slot='title-action']))) .title:not(:has(.title-action)),:not(:has([slot='action'])) .actions{display:none}@container (min-width:480px){.actions{align-items:center;flex-direction:row;justify-content:flex-end;margin-block-start:calc(${spacingVerticalS} * -1);padding-block-start:${spacingVerticalS}}}`;
|
|
6228
6241
|
|
|
6229
|
-
const definition$
|
|
6242
|
+
const definition$p = DialogBody.compose({
|
|
6230
6243
|
name: `${FluentDesignSystem.prefix}-dialog-body`,
|
|
6231
|
-
template: template$
|
|
6232
|
-
styles: styles$
|
|
6244
|
+
template: template$p,
|
|
6245
|
+
styles: styles$o
|
|
6233
6246
|
});
|
|
6234
6247
|
|
|
6235
|
-
definition$
|
|
6248
|
+
definition$p.define(FluentDesignSystem.registry);
|
|
6236
6249
|
|
|
6237
6250
|
const DividerRole = {
|
|
6238
6251
|
/**
|
|
@@ -6351,21 +6364,21 @@ __decorateClass$j([attr({
|
|
|
6351
6364
|
function dividerTemplate() {
|
|
6352
6365
|
return html`<slot></slot>`;
|
|
6353
6366
|
}
|
|
6354
|
-
const template$
|
|
6367
|
+
const template$o = dividerTemplate();
|
|
6355
6368
|
|
|
6356
|
-
const styles$
|
|
6369
|
+
const styles$n = css`
|
|
6357
6370
|
${display("flex")}
|
|
6358
6371
|
|
|
6359
6372
|
:host{contain:content}:host::after,:host::before{align-self:center;background:${colorNeutralStroke2};box-sizing:border-box;content:'';display:flex;flex-grow:1;height:${strokeWidthThin}}:host(${insetState}){padding:0 12px}:host ::slotted(*){color:${colorNeutralForeground2};font-family:${fontFamilyBase};font-size:${fontSizeBase200};font-weight:${fontWeightRegular};margin:0;padding:0 12px}:host(${alignStartState})::before,:host(${alignEndState})::after{flex-basis:12px;flex-grow:0;flex-shrink:0}:host(${verticalState}){height:100%;min-height:84px}:host(${verticalState}):empty{min-height:20px}:host(${verticalState}){flex-direction:column;align-items:center}:host(${verticalState}${insetState})::before{margin-top:12px}:host(${verticalState}${insetState})::after{margin-bottom:12px}:host(${verticalState}):empty::before,:host(${verticalState}):empty::after{height:10px;min-height:10px;flex-grow:0}:host(${verticalState})::before,:host(${verticalState})::after{width:${strokeWidthThin};min-height:20px;height:100%}:host(${verticalState}) ::slotted(*){display:flex;flex-direction:column;padding:12px 0;line-height:20px}:host(${verticalState}${alignStartState})::before{min-height:8px}:host(${verticalState}${alignEndState})::after{min-height:8px}:host(${strongState})::before,:host(${strongState})::after{background:${colorNeutralStroke1}}:host(${strongState}) ::slotted(*){color:${colorNeutralForeground1}}:host(${brandState})::before,:host(${brandState})::after{background:${colorBrandStroke1}}:host(${brandState}) ::slotted(*){color:${colorBrandForeground1}}:host(${subtleState})::before,:host(${subtleState})::after{background:${colorNeutralStroke3}}:host(${subtleState}) ::slotted(*){color:${colorNeutralForeground3}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
6360
6373
|
:host(${strongState})::before,:host(${strongState})::after,:host(${brandState})::before,:host(${brandState})::after,:host(${subtleState})::before,:host(${subtleState})::after,:host::after,:host::before{background:WindowText;color:WindowText}`));
|
|
6361
6374
|
|
|
6362
|
-
const definition$
|
|
6375
|
+
const definition$o = Divider.compose({
|
|
6363
6376
|
name: `${FluentDesignSystem.prefix}-divider`,
|
|
6364
|
-
template: template$
|
|
6365
|
-
styles: styles$
|
|
6377
|
+
template: template$o,
|
|
6378
|
+
styles: styles$n
|
|
6366
6379
|
});
|
|
6367
6380
|
|
|
6368
|
-
definition$
|
|
6381
|
+
definition$o.define(FluentDesignSystem.registry);
|
|
6369
6382
|
|
|
6370
6383
|
const DrawerPosition = {
|
|
6371
6384
|
start: "start",
|
|
@@ -6471,7 +6484,7 @@ __decorateClass$i([attr({
|
|
|
6471
6484
|
})], Drawer.prototype, "size", 2);
|
|
6472
6485
|
__decorateClass$i([observable], Drawer.prototype, "dialog", 2);
|
|
6473
6486
|
|
|
6474
|
-
const styles$
|
|
6487
|
+
const styles$m = css`
|
|
6475
6488
|
${display("block")}
|
|
6476
6489
|
|
|
6477
6490
|
:host{--dialog-backdrop:${colorBackgroundOverlay}}:host([type='non-modal']) dialog[open]::backdrop{display:none}:host([type='non-modal']) dialog{position:fixed;top:0;bottom:0}:host([type='inline']){height:100%;width:fit-content}:host([type='inline']) dialog[open]{box-shadow:none;position:relative}:host([size='small']) dialog{width:320px;max-width:320px}:host([size='large']) dialog{width:940px;max-width:940px}:host([size='full']) dialog{width:100%;max-width:100%}:host([position='end']) dialog{margin-inline-start:auto;margin-inline-end:0}dialog{box-sizing:border-box;z-index:var(--drawer-elevation,1000);font-size:${fontSizeBase300};line-height:${lineHeightBase300};font-family:${fontFamilyBase};font-weight:${fontWeightRegular};color:${colorNeutralForeground1};max-width:var(--drawer-width,592px);max-height:100vh;height:100%;margin-inline-start:0;margin-inline-end:auto;border-inline-end-color:${colorTransparentStroke};border-inline-start-color:var(--drawer-separator,${colorTransparentStroke});outline:none;top:0;bottom:0;width:var(--drawer-width,592px);border-radius:0;padding:0;max-width:var(--drawer-width,592px);box-shadow:${shadow64};border:${strokeWidthThin} solid ${colorTransparentStroke};background:${colorNeutralBackground1}}dialog::backdrop{background:var(--dialog-backdrop)}@layer animations{@media (prefers-reduced-motion:no-preference){dialog{transition:display allow-discrete,opacity,overlay allow-discrete,transform;transition-duration:${durationGentle};transition-timing-function:${curveDecelerateMid}}:host dialog:not([open]){transform:translateX(-100%);transition-timing-function:${curveAccelerateMid}}:host([position='end']) dialog:not([open]){transform:translateX(100%);transition-timing-function:${curveAccelerateMid}}dialog[open]{transform:translateX(0)}dialog::backdrop{transition:display allow-discrete,opacity,overlay allow-discrete,scale;transition-duration:${durationGentle};transition-timing-function:${curveDecelerateMid};background:var(--dialog-backdrop,${colorBackgroundOverlay});opacity:0}dialog[open]::backdrop{opacity:1}dialog::backdrop{transition-timing-function:${curveLinear}}}@starting-style{dialog[open]{transform:translateX(-100%)}:host([position='end']) dialog[open]{transform:translateX(100%)}dialog[open]::backdrop{opacity:0}}}`;
|
|
@@ -6479,10 +6492,29 @@ const styles$l = css`
|
|
|
6479
6492
|
function drawerTemplate() {
|
|
6480
6493
|
return html`<dialog class="dialog" part="dialog" role="${x => x.type === "modal" ? "dialog" : x.role}" aria-modal="${x => x.type === "modal" ? "true" : void 0}" aria-describedby="${x => x.ariaDescribedby}" aria-labelledby="${x => x.ariaLabelledby}" aria-label="${x => x.ariaLabel}" size="${x => x.size}" position="${x => x.position}" type="${x => x.type}" @click="${(x, c) => x.clickHandler(c.event)}" @cancel="${(x, c) => x.hide()}" ${ref("dialog")}><slot></slot></dialog>`;
|
|
6481
6494
|
}
|
|
6482
|
-
const template$
|
|
6495
|
+
const template$n = drawerTemplate();
|
|
6483
6496
|
|
|
6484
|
-
const definition$
|
|
6497
|
+
const definition$n = Drawer.compose({
|
|
6485
6498
|
name: `${FluentDesignSystem.prefix}-drawer`,
|
|
6499
|
+
template: template$n,
|
|
6500
|
+
styles: styles$m
|
|
6501
|
+
});
|
|
6502
|
+
|
|
6503
|
+
definition$n.define(FluentDesignSystem.registry);
|
|
6504
|
+
|
|
6505
|
+
class DrawerBody extends FASTElement {}
|
|
6506
|
+
|
|
6507
|
+
const styles$l = css`
|
|
6508
|
+
${display("grid")}
|
|
6509
|
+
:host{box-sizing:border-box;grid-template-rows:min-content auto min-content;position:relative;height:100%;padding:${spacingHorizontalXL};max-height:100svh}.header{display:flex;justify-content:space-between;align-items:center;${typographySubtitle1Styles}}.footer{display:flex;justify-content:flex-start;gap:${spacingHorizontalM}}`;
|
|
6510
|
+
|
|
6511
|
+
function drawerBodyTemplate() {
|
|
6512
|
+
return html`<div class="header" part="header"><slot name="title"></slot><slot name="close"></slot></div><div class="content" part="content"><slot></slot></div><div class="footer" part="footer"><slot name="footer"></slot></div>`;
|
|
6513
|
+
}
|
|
6514
|
+
const template$m = drawerBodyTemplate();
|
|
6515
|
+
|
|
6516
|
+
const definition$m = DrawerBody.compose({
|
|
6517
|
+
name: `${FluentDesignSystem.prefix}-drawer-body`,
|
|
6486
6518
|
template: template$m,
|
|
6487
6519
|
styles: styles$l
|
|
6488
6520
|
});
|
|
@@ -6981,7 +7013,7 @@ const template$h = buttonTemplate$1({
|
|
|
6981
7013
|
const definition$h = MenuButton.compose({
|
|
6982
7014
|
name: `${FluentDesignSystem.prefix}-menu-button`,
|
|
6983
7015
|
template: template$h,
|
|
6984
|
-
styles: styles$
|
|
7016
|
+
styles: styles$w
|
|
6985
7017
|
});
|
|
6986
7018
|
|
|
6987
7019
|
definition$h.define(FluentDesignSystem.registry);
|
|
@@ -7014,9 +7046,16 @@ var __decorateClass$d = (decorators, target, key, kind) => {
|
|
|
7014
7046
|
if (kind && result) __defProp$d(target, key, result);
|
|
7015
7047
|
return result;
|
|
7016
7048
|
};
|
|
7049
|
+
const menuFilter = () => value => value.nodeType === 1 && value.elementInternals.role === "menu";
|
|
7017
7050
|
class MenuItem extends FASTElement {
|
|
7018
7051
|
constructor() {
|
|
7019
7052
|
super(...arguments);
|
|
7053
|
+
/**
|
|
7054
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
7055
|
+
*
|
|
7056
|
+
* @internal
|
|
7057
|
+
*/
|
|
7058
|
+
this.elementInternals = this.attachInternals();
|
|
7020
7059
|
this.role = MenuItemRole.menuitem;
|
|
7021
7060
|
this.checked = false;
|
|
7022
7061
|
/**
|
|
@@ -7040,6 +7079,7 @@ class MenuItem extends FASTElement {
|
|
|
7040
7079
|
case keyArrowLeft:
|
|
7041
7080
|
if (this.parentElement?.hasAttribute("popover")) {
|
|
7042
7081
|
this.parentElement.togglePopover(false);
|
|
7082
|
+
this.parentElement.parentElement?.focus();
|
|
7043
7083
|
}
|
|
7044
7084
|
return false;
|
|
7045
7085
|
}
|
|
@@ -7082,11 +7122,11 @@ class MenuItem extends FASTElement {
|
|
|
7082
7122
|
this.toggleHandler = e => {
|
|
7083
7123
|
if (e instanceof ToggleEvent && e.newState === "open") {
|
|
7084
7124
|
this.setAttribute("tabindex", "-1");
|
|
7085
|
-
this.
|
|
7125
|
+
this.elementInternals.ariaExpanded = "true";
|
|
7086
7126
|
this.setSubmenuPosition();
|
|
7087
7127
|
}
|
|
7088
7128
|
if (e instanceof ToggleEvent && e.newState === "closed") {
|
|
7089
|
-
this.
|
|
7129
|
+
this.elementInternals.ariaExpanded = "false";
|
|
7090
7130
|
this.setAttribute("tabindex", "0");
|
|
7091
7131
|
}
|
|
7092
7132
|
};
|
|
@@ -7137,7 +7177,32 @@ class MenuItem extends FASTElement {
|
|
|
7137
7177
|
}
|
|
7138
7178
|
};
|
|
7139
7179
|
}
|
|
7140
|
-
|
|
7180
|
+
/**
|
|
7181
|
+
* Handles changes to disabled attribute custom states and element internals
|
|
7182
|
+
* @param prev - the previous state
|
|
7183
|
+
* @param next - the next state
|
|
7184
|
+
*/
|
|
7185
|
+
disabledChanged(prev, next) {
|
|
7186
|
+
this.elementInternals.ariaDisabled = !!next ? `${next}` : null;
|
|
7187
|
+
toggleState(this.elementInternals, "disabled", next);
|
|
7188
|
+
}
|
|
7189
|
+
/**
|
|
7190
|
+
* Handles changes to role attribute element internals properties
|
|
7191
|
+
* @param prev - the previous state
|
|
7192
|
+
* @param next - the next state
|
|
7193
|
+
*/
|
|
7194
|
+
roleChanged(prev, next) {
|
|
7195
|
+
this.elementInternals.role = next ?? MenuItemRole.menuitem;
|
|
7196
|
+
}
|
|
7197
|
+
/**
|
|
7198
|
+
* Handles changes to checked attribute custom states and element internals
|
|
7199
|
+
* @param prev - the previous state
|
|
7200
|
+
* @param next - the next state
|
|
7201
|
+
*/
|
|
7202
|
+
checkedChanged(prev, next) {
|
|
7203
|
+
const checkableMenuItem = this.role !== MenuItemRole.menuitem;
|
|
7204
|
+
this.elementInternals.ariaChecked = checkableMenuItem ? `${!!next}` : null;
|
|
7205
|
+
toggleState(this.elementInternals, "checked", checkableMenuItem ? next : false);
|
|
7141
7206
|
if (this.$fastController.isConnected) {
|
|
7142
7207
|
this.$emit("change");
|
|
7143
7208
|
}
|
|
@@ -7153,8 +7218,18 @@ class MenuItem extends FASTElement {
|
|
|
7153
7218
|
this.submenu = next[0];
|
|
7154
7219
|
this.submenu.toggleAttribute("popover", true);
|
|
7155
7220
|
this.submenu.addEventListener("toggle", this.toggleHandler);
|
|
7221
|
+
this.elementInternals.ariaHasPopup = "menu";
|
|
7222
|
+
toggleState(this.elementInternals, "submenu", true);
|
|
7223
|
+
} else {
|
|
7224
|
+
this.elementInternals.ariaHasPopup = null;
|
|
7225
|
+
toggleState(this.elementInternals, "submenu", false);
|
|
7156
7226
|
}
|
|
7157
7227
|
}
|
|
7228
|
+
connectedCallback() {
|
|
7229
|
+
super.connectedCallback();
|
|
7230
|
+
this.elementInternals.role = this.role ?? MenuItemRole.menuitem;
|
|
7231
|
+
this.elementInternals.ariaChecked = this.role !== MenuItemRole.menuitem ? `${!!this.checked}` : null;
|
|
7232
|
+
}
|
|
7158
7233
|
}
|
|
7159
7234
|
__decorateClass$d([attr({
|
|
7160
7235
|
mode: "boolean"
|
|
@@ -7170,18 +7245,19 @@ __decorateClass$d([observable], MenuItem.prototype, "slottedSubmenu", 2);
|
|
|
7170
7245
|
__decorateClass$d([observable], MenuItem.prototype, "submenu", 2);
|
|
7171
7246
|
applyMixins(MenuItem, StartEnd);
|
|
7172
7247
|
|
|
7248
|
+
const submenuState = css.partial`:is([state--submenu], :state(submenu))`;
|
|
7173
7249
|
const styles$g = css`
|
|
7174
7250
|
${display("grid")}
|
|
7175
7251
|
|
|
7176
|
-
:host{--indent:0;align-items:center;background:${colorNeutralBackground1};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};contain:layout;cursor:pointer;flex-shrink:0;font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};grid-gap:4px;grid-template-columns:20px 20px auto 20px;height:32px;overflow:visible;padding:0 10px}:host(:hover){background:${colorNeutralBackground1Hover};color:${colorNeutralForeground2Hover}}:host(
|
|
7177
|
-
:host(
|
|
7252
|
+
:host{--indent:0;align-items:center;background:${colorNeutralBackground1};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};contain:layout;cursor:pointer;flex-shrink:0;font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};grid-gap:4px;grid-template-columns:20px 20px auto 20px;height:32px;overflow:visible;padding:0 10px}:host(:hover){background:${colorNeutralBackground1Hover};color:${colorNeutralForeground2Hover}}:host(:active){background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground2Pressed}}:host(:active) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Pressed}}:host(${disabledState}){background-color:${colorNeutralBackgroundDisabled};color:${colorNeutralForegroundDisabled}}:host(${disabledState}) ::slotted([slot='start']),:host(${disabledState}) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}:host(:focus-visible){border-radius:${borderRadiusMedium};outline:2px solid ${colorStrokeFocus2}}.content{white-space:nowrap;flex-grow:1;grid-column:auto / span 2;padding:0 2px}:host(:not(${checkedState})) .indicator,:host(:not(${checkedState})) ::slotted([slot='indicator']),:host(:not(${submenuState})) .submenu-glyph,:host(:not(${submenuState})) ::slotted([slot='submenu-glyph']){display:none}::slotted([slot='end']){color:${colorNeutralForeground3};font:${fontWeightRegular} ${fontSizeBase200} / ${lineHeightBase200} ${fontFamilyBase};white-space:nowrap}:host([data-indent='1']){--indent:1}:host([data-indent='2']){--indent:2;grid-template-columns:20px 20px auto auto}:host(${submenuState}){grid-template-columns:20px auto auto 20px}:host([data-indent='2']${submenuState}){grid-template-columns:20px 20px auto auto 20px}.indicator,::slotted([slot='indicator']){grid-column:1 / span 1;width:20px}::slotted([slot='start']){display:inline-flex;grid-column:calc(var(--indent)) / span 1}.content{grid-column:calc(var(--indent) + 1) / span 1}::slotted([slot='end']){grid-column:calc(var(--indent) + 2) / span 1;justify-self:end}.submenu-glyph,::slotted([slot='submenu-glyph']){grid-column:-2 / span 1;justify-self:end}@layer popover{:host{anchor-name:--menu-trigger;position:relative}::slotted([popover]){align-self:start;inset-area:inline-end span-block-end;margin:0;max-height:var(--menu-max-height,auto);position:absolute;position-anchor:--menu-trigger;position-try-options:flip-inline,inset-area(block-start);z-index:1}::slotted([popover]:not(:popover-open)){display:none}::slotted([popover]:popover-open){inset:unset}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
7253
|
+
:host(${disabledState}),:host(${disabledState}) ::slotted([slot='start']),:host(${disabledState}) ::slotted([slot='end']){color:GrayText}`));
|
|
7178
7254
|
|
|
7179
7255
|
const Checkmark16Filled = html.partial(`<svg class="indicator" fill="currentColor" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.05 3.49c.28.3.27.77-.04 1.06l-7.93 7.47A.85.85 0 014.9 12L2.22 9.28a.75.75 0 111.06-1.06l2.24 2.27 7.47-7.04a.75.75 0 011.06.04z" fill="currentColor"></path></svg>`);
|
|
7180
7256
|
const chevronRight16Filled = html.partial(`<svg class="submenu-glyph" fill="currentColor" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M5.74 3.2a.75.75 0 00-.04 1.06L9.23 8 5.7 11.74a.75.75 0 101.1 1.02l4-4.25a.75.75 0 000-1.02l-4-4.25a.75.75 0 00-1.06-.04z" fill="currentColor"></path></svg>`);
|
|
7181
7257
|
function menuItemTemplate(options = {}) {
|
|
7182
|
-
return html`<template
|
|
7258
|
+
return html`<template @keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}" @click="${(x, c) => x.handleMenuItemClick(c.event)}" @mouseover="${(x, c) => x.handleMouseOver(c.event)}" @mouseout="${(x, c) => x.handleMouseOut(c.event)}" @toggle="${(x, c) => x.toggleHandler(c.event)}"><slot name="indicator">${staticallyCompose(options.indicator)}</slot>${startSlotTemplate(options)}<div part="content" class="content"><slot></slot></div>${endSlotTemplate(options)}<slot name="submenu-glyph">${staticallyCompose(options.submenuGlyph)}</slot><slot name="submenu" ${slotted({
|
|
7183
7259
|
property: "slottedSubmenu",
|
|
7184
|
-
filter:
|
|
7260
|
+
filter: menuFilter()
|
|
7185
7261
|
})}></slot></template>`;
|
|
7186
7262
|
}
|
|
7187
7263
|
const template$g = menuItemTemplate({
|
|
@@ -7207,7 +7283,13 @@ var __decorateClass$c = (decorators, target, key, kind) => {
|
|
|
7207
7283
|
};
|
|
7208
7284
|
const _MenuList = class _MenuList extends FASTElement {
|
|
7209
7285
|
constructor() {
|
|
7210
|
-
super(
|
|
7286
|
+
super();
|
|
7287
|
+
/**
|
|
7288
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
7289
|
+
*
|
|
7290
|
+
* @internal
|
|
7291
|
+
*/
|
|
7292
|
+
this.elementInternals = this.attachInternals();
|
|
7211
7293
|
/**
|
|
7212
7294
|
* The index of the focusable element in the items array
|
|
7213
7295
|
* defaults to -1
|
|
@@ -7287,6 +7369,7 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
7287
7369
|
this.isFocusableElement = el => {
|
|
7288
7370
|
return this.isMenuItemElement(el);
|
|
7289
7371
|
};
|
|
7372
|
+
this.elementInternals.role = "menu";
|
|
7290
7373
|
}
|
|
7291
7374
|
itemsChanged(oldValue, newValue) {
|
|
7292
7375
|
if (this.$fastController.isConnected && this.menuItems !== void 0) {
|
|
@@ -7420,7 +7503,7 @@ const styles$f = css`
|
|
|
7420
7503
|
:host{flex-direction:column;height:fit-content;max-width:300px;min-width:160px;width:auto;background-color:${colorNeutralBackground1};border:1px solid ${colorTransparentStroke};border-radius:${borderRadiusMedium};box-shadow:${shadow16};padding:4px;row-gap:2px}`;
|
|
7421
7504
|
|
|
7422
7505
|
function menuTemplate$1() {
|
|
7423
|
-
return html`<template slot="${x => x.slot ? x.slot : x.isNestedMenu() ? "submenu" : void 0}"
|
|
7506
|
+
return html`<template slot="${x => x.slot ? x.slot : x.isNestedMenu() ? "submenu" : void 0}" @keydown="${(x, c) => x.handleMenuKeyDown(c.event)}" @focusout="${(x, c) => x.handleFocusOut(c.event)}"><slot ${slotted("items")}></slot></template>`;
|
|
7424
7507
|
}
|
|
7425
7508
|
const template$f = menuTemplate$1();
|
|
7426
7509
|
|
|
@@ -7721,19 +7804,19 @@ class Menu extends FASTElement {
|
|
|
7721
7804
|
}
|
|
7722
7805
|
}
|
|
7723
7806
|
}
|
|
7724
|
-
__decorateClass$b([
|
|
7807
|
+
__decorateClass$b([attr({
|
|
7725
7808
|
attribute: "open-on-hover",
|
|
7726
7809
|
mode: "boolean"
|
|
7727
7810
|
})], Menu.prototype, "openOnHover", 2);
|
|
7728
|
-
__decorateClass$b([
|
|
7811
|
+
__decorateClass$b([attr({
|
|
7729
7812
|
attribute: "open-on-context",
|
|
7730
7813
|
mode: "boolean"
|
|
7731
7814
|
})], Menu.prototype, "openOnContext", 2);
|
|
7732
|
-
__decorateClass$b([
|
|
7815
|
+
__decorateClass$b([attr({
|
|
7733
7816
|
attribute: "close-on-scroll",
|
|
7734
7817
|
mode: "boolean"
|
|
7735
7818
|
})], Menu.prototype, "closeOnScroll", 2);
|
|
7736
|
-
__decorateClass$b([
|
|
7819
|
+
__decorateClass$b([attr({
|
|
7737
7820
|
attribute: "persist-on-item-click",
|
|
7738
7821
|
mode: "boolean"
|
|
7739
7822
|
})], Menu.prototype, "persistOnItemClick", 2);
|
|
@@ -8655,372 +8738,11 @@ const definition$9 = RatingDisplay.compose({
|
|
|
8655
8738
|
|
|
8656
8739
|
definition$9.define(FluentDesignSystem.registry);
|
|
8657
8740
|
|
|
8658
|
-
Orientation;
|
|
8741
|
+
const SliderOrientation = Orientation;
|
|
8659
8742
|
const SliderMode = {
|
|
8660
8743
|
singleValue: "single-value"
|
|
8661
8744
|
};
|
|
8662
8745
|
|
|
8663
|
-
const proxySlotName = "form-associated-proxy";
|
|
8664
|
-
const ElementInternalsKey = "ElementInternals";
|
|
8665
|
-
const supportsElementInternals = ElementInternalsKey in window && "setFormValue" in window[ElementInternalsKey].prototype;
|
|
8666
|
-
const InternalsMap = /* @__PURE__ */new WeakMap();
|
|
8667
|
-
function FormAssociated(BaseCtor) {
|
|
8668
|
-
const C = class extends BaseCtor {
|
|
8669
|
-
constructor(...args) {
|
|
8670
|
-
super(...args);
|
|
8671
|
-
/**
|
|
8672
|
-
* Track whether the value has been changed from the initial value
|
|
8673
|
-
*/
|
|
8674
|
-
this.dirtyValue = false;
|
|
8675
|
-
/**
|
|
8676
|
-
* The initial value of the form. This value sets the `value` property
|
|
8677
|
-
* only when the `value` property has not been explicitly set.
|
|
8678
|
-
*
|
|
8679
|
-
* @remarks
|
|
8680
|
-
* HTML Attribute: value
|
|
8681
|
-
*/
|
|
8682
|
-
this.initialValue = "";
|
|
8683
|
-
/**
|
|
8684
|
-
* Sets the element's disabled state. A disabled element will not be included during form submission.
|
|
8685
|
-
*
|
|
8686
|
-
* @remarks
|
|
8687
|
-
* HTML Attribute: disabled
|
|
8688
|
-
*/
|
|
8689
|
-
this.disabled = false;
|
|
8690
|
-
/**
|
|
8691
|
-
* These are events that are still fired by the proxy
|
|
8692
|
-
* element based on user / programmatic interaction.
|
|
8693
|
-
*
|
|
8694
|
-
* The proxy implementation should be transparent to
|
|
8695
|
-
* the app author, so block these events from emitting.
|
|
8696
|
-
*/
|
|
8697
|
-
this.proxyEventsToBlock = ["change", "click"];
|
|
8698
|
-
this.proxyInitialized = false;
|
|
8699
|
-
this.required = false;
|
|
8700
|
-
this.initialValue = this.initialValue || "";
|
|
8701
|
-
if (!this.elementInternals) {
|
|
8702
|
-
this.formResetCallback = this.formResetCallback.bind(this);
|
|
8703
|
-
}
|
|
8704
|
-
}
|
|
8705
|
-
/**
|
|
8706
|
-
* Must evaluate to true to enable elementInternals.
|
|
8707
|
-
* Feature detects API support and resolve respectively
|
|
8708
|
-
*
|
|
8709
|
-
* @internal
|
|
8710
|
-
*/
|
|
8711
|
-
static get formAssociated() {
|
|
8712
|
-
return supportsElementInternals;
|
|
8713
|
-
}
|
|
8714
|
-
/**
|
|
8715
|
-
* Returns the validity state of the element
|
|
8716
|
-
*
|
|
8717
|
-
* @beta
|
|
8718
|
-
*/
|
|
8719
|
-
get validity() {
|
|
8720
|
-
return this.elementInternals ? this.elementInternals.validity : this.proxy.validity;
|
|
8721
|
-
}
|
|
8722
|
-
/**
|
|
8723
|
-
* Retrieve a reference to the associated form.
|
|
8724
|
-
* Returns null if not associated to any form.
|
|
8725
|
-
*
|
|
8726
|
-
* @beta
|
|
8727
|
-
*/
|
|
8728
|
-
get form() {
|
|
8729
|
-
return this.elementInternals ? this.elementInternals.form : this.proxy.form;
|
|
8730
|
-
}
|
|
8731
|
-
/**
|
|
8732
|
-
* Retrieve the localized validation message,
|
|
8733
|
-
* or custom validation message if set.
|
|
8734
|
-
*
|
|
8735
|
-
* @beta
|
|
8736
|
-
*/
|
|
8737
|
-
get validationMessage() {
|
|
8738
|
-
return this.elementInternals ? this.elementInternals.validationMessage : this.proxy.validationMessage;
|
|
8739
|
-
}
|
|
8740
|
-
/**
|
|
8741
|
-
* Whether the element will be validated when the
|
|
8742
|
-
* form is submitted
|
|
8743
|
-
*/
|
|
8744
|
-
get willValidate() {
|
|
8745
|
-
return this.elementInternals ? this.elementInternals.willValidate : this.proxy.willValidate;
|
|
8746
|
-
}
|
|
8747
|
-
/**
|
|
8748
|
-
* A reference to all associated label elements
|
|
8749
|
-
*/
|
|
8750
|
-
get labels() {
|
|
8751
|
-
if (this.elementInternals) {
|
|
8752
|
-
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
8753
|
-
} else if (this.proxy instanceof HTMLElement && this.proxy.ownerDocument && this.id) {
|
|
8754
|
-
const parentLabels = this.proxy.labels;
|
|
8755
|
-
const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
|
|
8756
|
-
const labels = parentLabels ? forLabels.concat(Array.from(parentLabels)) : forLabels;
|
|
8757
|
-
return Object.freeze(labels);
|
|
8758
|
-
} else {
|
|
8759
|
-
return emptyArray;
|
|
8760
|
-
}
|
|
8761
|
-
}
|
|
8762
|
-
/**
|
|
8763
|
-
* Invoked when the `value` property changes
|
|
8764
|
-
* @param previous - the previous value
|
|
8765
|
-
* @param next - the new value
|
|
8766
|
-
*
|
|
8767
|
-
* @remarks
|
|
8768
|
-
* If elements extending `FormAssociated` implement a `valueChanged` method
|
|
8769
|
-
* They must be sure to invoke `super.valueChanged(previous, next)` to ensure
|
|
8770
|
-
* proper functioning of `FormAssociated`
|
|
8771
|
-
*/
|
|
8772
|
-
valueChanged(previous, next) {
|
|
8773
|
-
this.dirtyValue = true;
|
|
8774
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8775
|
-
this.proxy.value = this.value;
|
|
8776
|
-
}
|
|
8777
|
-
this.currentValue = this.value;
|
|
8778
|
-
this.setFormValue(this.value);
|
|
8779
|
-
this.validate();
|
|
8780
|
-
}
|
|
8781
|
-
currentValueChanged() {
|
|
8782
|
-
this.value = this.currentValue;
|
|
8783
|
-
}
|
|
8784
|
-
/**
|
|
8785
|
-
* Invoked when the `initialValue` property changes
|
|
8786
|
-
*
|
|
8787
|
-
* @param previous - the previous value
|
|
8788
|
-
* @param next - the new value
|
|
8789
|
-
*
|
|
8790
|
-
* @remarks
|
|
8791
|
-
* If elements extending `FormAssociated` implement a `initialValueChanged` method
|
|
8792
|
-
* They must be sure to invoke `super.initialValueChanged(previous, next)` to ensure
|
|
8793
|
-
* proper functioning of `FormAssociated`
|
|
8794
|
-
*/
|
|
8795
|
-
initialValueChanged(previous, next) {
|
|
8796
|
-
if (!this.dirtyValue) {
|
|
8797
|
-
this.value = this.initialValue;
|
|
8798
|
-
this.dirtyValue = false;
|
|
8799
|
-
}
|
|
8800
|
-
}
|
|
8801
|
-
/**
|
|
8802
|
-
* Invoked when the `disabled` property changes
|
|
8803
|
-
*
|
|
8804
|
-
* @param previous - the previous value
|
|
8805
|
-
* @param next - the new value
|
|
8806
|
-
*
|
|
8807
|
-
* @remarks
|
|
8808
|
-
* If elements extending `FormAssociated` implement a `disabledChanged` method
|
|
8809
|
-
* They must be sure to invoke `super.disabledChanged(previous, next)` to ensure
|
|
8810
|
-
* proper functioning of `FormAssociated`
|
|
8811
|
-
*/
|
|
8812
|
-
disabledChanged(previous, next) {
|
|
8813
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8814
|
-
this.proxy.disabled = this.disabled;
|
|
8815
|
-
}
|
|
8816
|
-
Updates.enqueue(() => this.classList.toggle("disabled", this.disabled));
|
|
8817
|
-
}
|
|
8818
|
-
/**
|
|
8819
|
-
* Invoked when the `name` property changes
|
|
8820
|
-
*
|
|
8821
|
-
* @param previous - the previous value
|
|
8822
|
-
* @param next - the new value
|
|
8823
|
-
*
|
|
8824
|
-
* @remarks
|
|
8825
|
-
* If elements extending `FormAssociated` implement a `nameChanged` method
|
|
8826
|
-
* They must be sure to invoke `super.nameChanged(previous, next)` to ensure
|
|
8827
|
-
* proper functioning of `FormAssociated`
|
|
8828
|
-
*/
|
|
8829
|
-
nameChanged(previous, next) {
|
|
8830
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8831
|
-
this.proxy.name = this.name;
|
|
8832
|
-
}
|
|
8833
|
-
}
|
|
8834
|
-
/**
|
|
8835
|
-
* Invoked when the `required` property changes
|
|
8836
|
-
*
|
|
8837
|
-
* @param previous - the previous value
|
|
8838
|
-
* @param next - the new value
|
|
8839
|
-
*
|
|
8840
|
-
* @remarks
|
|
8841
|
-
* If elements extending `FormAssociated` implement a `requiredChanged` method
|
|
8842
|
-
* They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
|
|
8843
|
-
* proper functioning of `FormAssociated`
|
|
8844
|
-
*/
|
|
8845
|
-
requiredChanged(prev, next) {
|
|
8846
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8847
|
-
this.proxy.required = this.required;
|
|
8848
|
-
}
|
|
8849
|
-
Updates.enqueue(() => this.classList.toggle("required", this.required));
|
|
8850
|
-
this.validate();
|
|
8851
|
-
}
|
|
8852
|
-
/**
|
|
8853
|
-
* The element internals object. Will only exist
|
|
8854
|
-
* in browsers supporting the attachInternals API
|
|
8855
|
-
*/
|
|
8856
|
-
get elementInternals() {
|
|
8857
|
-
if (!supportsElementInternals) {
|
|
8858
|
-
return null;
|
|
8859
|
-
}
|
|
8860
|
-
let internals = InternalsMap.get(this);
|
|
8861
|
-
if (!internals) {
|
|
8862
|
-
internals = this.attachInternals();
|
|
8863
|
-
InternalsMap.set(this, internals);
|
|
8864
|
-
}
|
|
8865
|
-
return internals;
|
|
8866
|
-
}
|
|
8867
|
-
/**
|
|
8868
|
-
* @internal
|
|
8869
|
-
*/
|
|
8870
|
-
connectedCallback() {
|
|
8871
|
-
super.connectedCallback();
|
|
8872
|
-
this.addEventListener("keypress", this._keypressHandler);
|
|
8873
|
-
if (!this.value) {
|
|
8874
|
-
this.value = this.initialValue;
|
|
8875
|
-
this.dirtyValue = false;
|
|
8876
|
-
}
|
|
8877
|
-
if (!this.elementInternals) {
|
|
8878
|
-
this.attachProxy();
|
|
8879
|
-
if (this.form) {
|
|
8880
|
-
this.form.addEventListener("reset", this.formResetCallback);
|
|
8881
|
-
}
|
|
8882
|
-
}
|
|
8883
|
-
}
|
|
8884
|
-
/**
|
|
8885
|
-
* @internal
|
|
8886
|
-
*/
|
|
8887
|
-
disconnectedCallback() {
|
|
8888
|
-
this.proxyEventsToBlock.forEach(name => this.proxy.removeEventListener(name, this.stopPropagation));
|
|
8889
|
-
if (!this.elementInternals && this.form) {
|
|
8890
|
-
this.form.removeEventListener("reset", this.formResetCallback);
|
|
8891
|
-
}
|
|
8892
|
-
}
|
|
8893
|
-
/**
|
|
8894
|
-
* Return the current validity of the element.
|
|
8895
|
-
*/
|
|
8896
|
-
checkValidity() {
|
|
8897
|
-
return this.elementInternals ? this.elementInternals.checkValidity() : this.proxy.checkValidity();
|
|
8898
|
-
}
|
|
8899
|
-
/**
|
|
8900
|
-
* Return the current validity of the element.
|
|
8901
|
-
* If false, fires an invalid event at the element.
|
|
8902
|
-
*/
|
|
8903
|
-
reportValidity() {
|
|
8904
|
-
return this.elementInternals ? this.elementInternals.reportValidity() : this.proxy.reportValidity();
|
|
8905
|
-
}
|
|
8906
|
-
/**
|
|
8907
|
-
* Set the validity of the control. In cases when the elementInternals object is not
|
|
8908
|
-
* available (and the proxy element is used to report validity), this function will
|
|
8909
|
-
* do nothing unless a message is provided, at which point the setCustomValidity method
|
|
8910
|
-
* of the proxy element will be invoked with the provided message.
|
|
8911
|
-
* @param flags - Validity flags
|
|
8912
|
-
* @param message - Optional message to supply
|
|
8913
|
-
* @param anchor - Optional element used by UA to display an interactive validation UI
|
|
8914
|
-
*/
|
|
8915
|
-
setValidity(flags, message, anchor) {
|
|
8916
|
-
if (this.elementInternals) {
|
|
8917
|
-
this.elementInternals.setValidity(flags, message, anchor);
|
|
8918
|
-
} else if (typeof message === "string") {
|
|
8919
|
-
this.proxy.setCustomValidity(message);
|
|
8920
|
-
}
|
|
8921
|
-
}
|
|
8922
|
-
/**
|
|
8923
|
-
* Invoked when a connected component's form or fieldset has its disabled
|
|
8924
|
-
* state changed.
|
|
8925
|
-
* @param disabled - the disabled value of the form / fieldset
|
|
8926
|
-
*/
|
|
8927
|
-
formDisabledCallback(disabled) {
|
|
8928
|
-
this.disabled = disabled;
|
|
8929
|
-
}
|
|
8930
|
-
formResetCallback() {
|
|
8931
|
-
this.value = this.initialValue;
|
|
8932
|
-
this.dirtyValue = false;
|
|
8933
|
-
}
|
|
8934
|
-
/**
|
|
8935
|
-
* Attach the proxy element to the DOM
|
|
8936
|
-
*/
|
|
8937
|
-
attachProxy() {
|
|
8938
|
-
if (!this.proxyInitialized) {
|
|
8939
|
-
this.proxyInitialized = true;
|
|
8940
|
-
this.proxy.style.display = "none";
|
|
8941
|
-
this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
|
|
8942
|
-
this.proxy.disabled = this.disabled;
|
|
8943
|
-
this.proxy.required = this.required;
|
|
8944
|
-
if (typeof this.name === "string") {
|
|
8945
|
-
this.proxy.name = this.name;
|
|
8946
|
-
}
|
|
8947
|
-
if (typeof this.value === "string") {
|
|
8948
|
-
this.proxy.value = this.value;
|
|
8949
|
-
}
|
|
8950
|
-
this.proxy.setAttribute("slot", proxySlotName);
|
|
8951
|
-
this.proxySlot = document.createElement("slot");
|
|
8952
|
-
this.proxySlot.setAttribute("name", proxySlotName);
|
|
8953
|
-
}
|
|
8954
|
-
this.shadowRoot?.appendChild(this.proxySlot);
|
|
8955
|
-
this.appendChild(this.proxy);
|
|
8956
|
-
}
|
|
8957
|
-
/**
|
|
8958
|
-
* Detach the proxy element from the DOM
|
|
8959
|
-
*/
|
|
8960
|
-
detachProxy() {
|
|
8961
|
-
this.removeChild(this.proxy);
|
|
8962
|
-
this.shadowRoot?.removeChild(this.proxySlot);
|
|
8963
|
-
}
|
|
8964
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
8965
|
-
validate(anchor) {
|
|
8966
|
-
if (this.proxy instanceof HTMLElement) {
|
|
8967
|
-
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
8968
|
-
}
|
|
8969
|
-
}
|
|
8970
|
-
/**
|
|
8971
|
-
* Associates the provided value (and optional state) with the parent form.
|
|
8972
|
-
* @param value - The value to set
|
|
8973
|
-
* @param state - The state object provided to during session restores and when autofilling.
|
|
8974
|
-
*/
|
|
8975
|
-
setFormValue(value, state) {
|
|
8976
|
-
if (this.elementInternals) {
|
|
8977
|
-
this.elementInternals.setFormValue(value, state || value);
|
|
8978
|
-
}
|
|
8979
|
-
}
|
|
8980
|
-
_keypressHandler(e) {
|
|
8981
|
-
switch (e.key) {
|
|
8982
|
-
case keyEnter:
|
|
8983
|
-
if (this.form instanceof HTMLFormElement) {
|
|
8984
|
-
const defaultButton = this.form.querySelector("[type=submit]");
|
|
8985
|
-
defaultButton?.click();
|
|
8986
|
-
}
|
|
8987
|
-
break;
|
|
8988
|
-
}
|
|
8989
|
-
}
|
|
8990
|
-
/**
|
|
8991
|
-
* Used to stop propagation of proxy element events
|
|
8992
|
-
* @param e - Event object
|
|
8993
|
-
*/
|
|
8994
|
-
stopPropagation(e) {
|
|
8995
|
-
e.stopPropagation();
|
|
8996
|
-
}
|
|
8997
|
-
};
|
|
8998
|
-
attr({
|
|
8999
|
-
mode: "boolean"
|
|
9000
|
-
})(C.prototype, "disabled");
|
|
9001
|
-
attr({
|
|
9002
|
-
mode: "fromView",
|
|
9003
|
-
attribute: "value"
|
|
9004
|
-
})(C.prototype, "initialValue");
|
|
9005
|
-
attr({
|
|
9006
|
-
attribute: "current-value"
|
|
9007
|
-
})(C.prototype, "currentValue");
|
|
9008
|
-
attr(C.prototype, "name");
|
|
9009
|
-
attr({
|
|
9010
|
-
mode: "boolean"
|
|
9011
|
-
})(C.prototype, "required");
|
|
9012
|
-
observable(C.prototype, "value");
|
|
9013
|
-
return C;
|
|
9014
|
-
}
|
|
9015
|
-
|
|
9016
|
-
class _Slider extends FASTElement {}
|
|
9017
|
-
class FormAssociatedSlider extends FormAssociated(_Slider) {
|
|
9018
|
-
constructor() {
|
|
9019
|
-
super(...arguments);
|
|
9020
|
-
this.proxy = document.createElement("input");
|
|
9021
|
-
}
|
|
9022
|
-
}
|
|
9023
|
-
|
|
9024
8746
|
function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
|
|
9025
8747
|
let pct = limit(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
|
|
9026
8748
|
if (direction === Direction.rtl) {
|
|
@@ -9037,9 +8759,15 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
|
9037
8759
|
if (kind && result) __defProp$6(target, key, result);
|
|
9038
8760
|
return result;
|
|
9039
8761
|
};
|
|
9040
|
-
class Slider extends
|
|
8762
|
+
class Slider extends FASTElement {
|
|
9041
8763
|
constructor() {
|
|
9042
|
-
super(
|
|
8764
|
+
super();
|
|
8765
|
+
/**
|
|
8766
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
8767
|
+
*
|
|
8768
|
+
* @internal
|
|
8769
|
+
*/
|
|
8770
|
+
this.elementInternals = this.attachInternals();
|
|
9043
8771
|
this.direction = Direction.ltr;
|
|
9044
8772
|
this.isDragging = false;
|
|
9045
8773
|
this.trackWidth = 0;
|
|
@@ -9047,34 +8775,39 @@ class Slider extends FormAssociatedSlider {
|
|
|
9047
8775
|
this.trackHeight = 0;
|
|
9048
8776
|
this.trackLeft = 0;
|
|
9049
8777
|
this.trackMinHeight = 0;
|
|
9050
|
-
this.valueTextFormatter = () =>
|
|
9051
|
-
this.
|
|
9052
|
-
this.
|
|
9053
|
-
this.
|
|
8778
|
+
this.valueTextFormatter = () => "";
|
|
8779
|
+
this.disabled = false;
|
|
8780
|
+
this.min = "";
|
|
8781
|
+
this.max = "";
|
|
8782
|
+
this.step = "";
|
|
9054
8783
|
this.mode = SliderMode.singleValue;
|
|
9055
|
-
this.keypressHandler =
|
|
9056
|
-
if (this.
|
|
8784
|
+
this.keypressHandler = event => {
|
|
8785
|
+
if (this.disabled) {
|
|
9057
8786
|
return;
|
|
9058
8787
|
}
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
8788
|
+
switch (event.key) {
|
|
8789
|
+
case keyHome:
|
|
8790
|
+
event.preventDefault();
|
|
8791
|
+
this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.minAsNumber}` : `${this.maxAsNumber}`;
|
|
8792
|
+
break;
|
|
8793
|
+
case keyEnd:
|
|
8794
|
+
event.preventDefault();
|
|
8795
|
+
this.value = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? `${this.maxAsNumber}` : `${this.minAsNumber}`;
|
|
8796
|
+
break;
|
|
8797
|
+
case keyArrowRight:
|
|
8798
|
+
case keyArrowUp:
|
|
8799
|
+
if (!event.shiftKey) {
|
|
8800
|
+
event.preventDefault();
|
|
9070
8801
|
this.increment();
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
8802
|
+
}
|
|
8803
|
+
break;
|
|
8804
|
+
case keyArrowLeft:
|
|
8805
|
+
case keyArrowDown:
|
|
8806
|
+
if (!event.shiftKey) {
|
|
8807
|
+
event.preventDefault();
|
|
9075
8808
|
this.decrement();
|
|
9076
|
-
|
|
9077
|
-
|
|
8809
|
+
}
|
|
8810
|
+
break;
|
|
9078
8811
|
}
|
|
9079
8812
|
};
|
|
9080
8813
|
this.setupTrackConstraints = () => {
|
|
@@ -9088,80 +8821,92 @@ class Slider extends FormAssociatedSlider {
|
|
|
9088
8821
|
this.trackWidth = 1;
|
|
9089
8822
|
}
|
|
9090
8823
|
};
|
|
9091
|
-
//Remove
|
|
9092
8824
|
this.setupListeners = (remove = false) => {
|
|
9093
8825
|
this.addEventListener("keydown", this.keypressHandler);
|
|
9094
|
-
this.addEventListener("mousedown", this.handleMouseDown);
|
|
9095
8826
|
if (remove) {
|
|
9096
8827
|
this.removeEventListener("keydown", this.keypressHandler);
|
|
9097
|
-
this.removeEventListener("mousedown", this.handleMouseDown);
|
|
9098
8828
|
}
|
|
9099
8829
|
};
|
|
9100
|
-
/**
|
|
9101
|
-
* @internal
|
|
9102
|
-
*/
|
|
9103
|
-
this.initialValue = "";
|
|
9104
8830
|
/**
|
|
9105
8831
|
* Handle mouse moves during a thumb drag operation
|
|
9106
8832
|
* If the event handler is null it removes the events
|
|
9107
8833
|
*/
|
|
9108
|
-
this.
|
|
8834
|
+
this.handleThumbPointerDown = event => {
|
|
9109
8835
|
const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
|
|
9110
|
-
windowFn("
|
|
9111
|
-
windowFn("
|
|
8836
|
+
windowFn("pointerup", this.handleWindowPointerUp);
|
|
8837
|
+
windowFn("pointermove", this.handlePointerMove, {
|
|
9112
8838
|
passive: true
|
|
9113
8839
|
});
|
|
9114
|
-
windowFn("touchmove", this.
|
|
8840
|
+
windowFn("touchmove", this.handlePointerMove, {
|
|
9115
8841
|
passive: true
|
|
9116
8842
|
});
|
|
9117
|
-
windowFn("touchend", this.
|
|
8843
|
+
windowFn("touchend", this.handleWindowPointerUp);
|
|
9118
8844
|
this.isDragging = event !== null;
|
|
9119
8845
|
};
|
|
9120
8846
|
/**
|
|
9121
8847
|
* Handle mouse moves during a thumb drag operation
|
|
9122
8848
|
*/
|
|
9123
|
-
this.
|
|
9124
|
-
if (this.
|
|
8849
|
+
this.handlePointerMove = event => {
|
|
8850
|
+
if (this.disabled || event.defaultPrevented) {
|
|
9125
8851
|
return;
|
|
9126
8852
|
}
|
|
9127
|
-
const sourceEvent = window.TouchEvent &&
|
|
9128
|
-
const eventValue = this.orientation === Orientation.
|
|
8853
|
+
const sourceEvent = window.TouchEvent && event instanceof TouchEvent ? event.touches[0] : event;
|
|
8854
|
+
const eventValue = this.orientation === Orientation.vertical ? sourceEvent.pageY - document.documentElement.scrollTop : sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft;
|
|
9129
8855
|
this.value = `${this.calculateNewValue(eventValue)}`;
|
|
9130
8856
|
};
|
|
9131
8857
|
/**
|
|
9132
8858
|
* Handle a window mouse up during a drag operation
|
|
9133
8859
|
*/
|
|
9134
|
-
this.
|
|
8860
|
+
this.handleWindowPointerUp = () => {
|
|
9135
8861
|
this.stopDragging();
|
|
9136
8862
|
};
|
|
9137
8863
|
this.stopDragging = () => {
|
|
9138
8864
|
this.isDragging = false;
|
|
9139
|
-
this.
|
|
9140
|
-
this.
|
|
8865
|
+
this.handlePointerDown(null);
|
|
8866
|
+
this.handleThumbPointerDown(null);
|
|
9141
8867
|
};
|
|
9142
8868
|
/**
|
|
9143
8869
|
*
|
|
9144
|
-
* @param
|
|
8870
|
+
* @param event - PointerEvent or null. If there is no event handler it will remove the events
|
|
9145
8871
|
*/
|
|
9146
|
-
this.
|
|
9147
|
-
if (
|
|
9148
|
-
const windowFn =
|
|
9149
|
-
const documentFn =
|
|
9150
|
-
windowFn("
|
|
9151
|
-
documentFn("mouseleave", this.
|
|
9152
|
-
windowFn("
|
|
9153
|
-
if (
|
|
8872
|
+
this.handlePointerDown = event => {
|
|
8873
|
+
if (event === null || !this.disabled) {
|
|
8874
|
+
const windowFn = event !== null ? window.addEventListener : window.removeEventListener;
|
|
8875
|
+
const documentFn = event !== null ? document.addEventListener : document.removeEventListener;
|
|
8876
|
+
windowFn("pointerup", this.handleWindowPointerUp);
|
|
8877
|
+
documentFn("mouseleave", this.handleWindowPointerUp);
|
|
8878
|
+
windowFn("pointermove", this.handlePointerMove);
|
|
8879
|
+
if (event) {
|
|
9154
8880
|
this.setupTrackConstraints();
|
|
9155
|
-
const controlValue = this.orientation === Orientation.
|
|
8881
|
+
const controlValue = this.orientation === Orientation.vertical ? event.pageY - document.documentElement.scrollTop : event.pageX - document.documentElement.scrollLeft - this.trackLeft;
|
|
9156
8882
|
this.value = `${this.calculateNewValue(controlValue)}`;
|
|
9157
8883
|
}
|
|
9158
8884
|
}
|
|
9159
8885
|
};
|
|
8886
|
+
this.elementInternals.role = "slider";
|
|
8887
|
+
this.elementInternals.ariaOrientation = this.orientation ?? SliderOrientation.horizontal;
|
|
9160
8888
|
}
|
|
9161
|
-
|
|
8889
|
+
/**
|
|
8890
|
+
* A reference to all associated `<label>` elements.
|
|
8891
|
+
*
|
|
8892
|
+
* @public
|
|
8893
|
+
*/
|
|
8894
|
+
get labels() {
|
|
8895
|
+
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
8896
|
+
}
|
|
8897
|
+
sizeChanged(prev, next) {
|
|
8898
|
+
if (prev) {
|
|
8899
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
8900
|
+
}
|
|
8901
|
+
if (next) {
|
|
8902
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
8903
|
+
}
|
|
8904
|
+
}
|
|
8905
|
+
handleChange(_, propertyName) {
|
|
9162
8906
|
switch (propertyName) {
|
|
9163
8907
|
case "min":
|
|
9164
8908
|
case "max":
|
|
8909
|
+
this.setSliderPosition(this.direction);
|
|
9165
8910
|
case "step":
|
|
9166
8911
|
this.handleStepStyles();
|
|
9167
8912
|
break;
|
|
@@ -9173,74 +8918,257 @@ class Slider extends FormAssociatedSlider {
|
|
|
9173
8918
|
*/
|
|
9174
8919
|
handleStepStyles() {
|
|
9175
8920
|
if (this.step) {
|
|
9176
|
-
const totalSteps = 100 / Math.floor((this.
|
|
8921
|
+
const totalSteps = 100 / Math.floor((this.maxAsNumber - this.minAsNumber) / this.stepAsNumber);
|
|
9177
8922
|
if (this.stepStyles !== void 0) {
|
|
9178
8923
|
this.$fastController.removeStyles(this.stepStyles);
|
|
9179
8924
|
}
|
|
9180
8925
|
this.stepStyles = css`
|
|
9181
|
-
:host{--step-rate:${totalSteps}
|
|
8926
|
+
:host{--step-rate:${totalSteps}%}`;
|
|
9182
8927
|
this.$fastController.addStyles(this.stepStyles);
|
|
9183
8928
|
} else if (this.stepStyles !== void 0) {
|
|
9184
8929
|
this.$fastController.removeStyles(this.stepStyles);
|
|
9185
8930
|
}
|
|
9186
8931
|
}
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
8932
|
+
/**
|
|
8933
|
+
* Sets the value of the input when the value attribute changes.
|
|
8934
|
+
*
|
|
8935
|
+
* @param prev - The previous value
|
|
8936
|
+
* @param next - The current value
|
|
8937
|
+
* @internal
|
|
8938
|
+
*/
|
|
8939
|
+
initialValueChanged(_, next) {
|
|
8940
|
+
if (this.$fastController.isConnected) {
|
|
8941
|
+
this.value = next;
|
|
8942
|
+
} else {
|
|
8943
|
+
this._value = next;
|
|
9191
8944
|
}
|
|
9192
8945
|
}
|
|
9193
8946
|
/**
|
|
9194
|
-
* The
|
|
8947
|
+
* The element's validity state.
|
|
9195
8948
|
*
|
|
9196
8949
|
* @public
|
|
8950
|
+
* @remarks
|
|
8951
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
|
|
9197
8952
|
*/
|
|
9198
|
-
get
|
|
9199
|
-
return
|
|
8953
|
+
get validity() {
|
|
8954
|
+
return this.elementInternals.validity;
|
|
9200
8955
|
}
|
|
9201
|
-
|
|
9202
|
-
|
|
8956
|
+
/**
|
|
8957
|
+
* The element's validation message.
|
|
8958
|
+
*
|
|
8959
|
+
* @public
|
|
8960
|
+
* @remarks
|
|
8961
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/validationMessage | `ElemenentInternals.validationMessage`} property.
|
|
8962
|
+
*/
|
|
8963
|
+
get validationMessage() {
|
|
8964
|
+
return this.elementInternals.validationMessage;
|
|
8965
|
+
}
|
|
8966
|
+
/**
|
|
8967
|
+
* Whether the element is a candidate for its owning form's constraint validation.
|
|
8968
|
+
*
|
|
8969
|
+
* @public
|
|
8970
|
+
* @remarks
|
|
8971
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate | `ElemenentInternals.willValidate`} property.
|
|
8972
|
+
*/
|
|
8973
|
+
get willValidate() {
|
|
8974
|
+
return this.elementInternals.willValidate;
|
|
8975
|
+
}
|
|
8976
|
+
/**
|
|
8977
|
+
* Checks the element's validity.
|
|
8978
|
+
* @public
|
|
8979
|
+
* @remarks
|
|
8980
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/checkValidity | `ElemenentInternals.checkValidity`} method.
|
|
8981
|
+
*/
|
|
8982
|
+
checkValidity() {
|
|
8983
|
+
return this.elementInternals.checkValidity();
|
|
8984
|
+
}
|
|
8985
|
+
/**
|
|
8986
|
+
* Reports the element's validity.
|
|
8987
|
+
* @public
|
|
8988
|
+
* @remarks
|
|
8989
|
+
* Reflects the {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/reportValidity | `ElemenentInternals.reportValidity`} method.
|
|
8990
|
+
*/
|
|
8991
|
+
reportValidity() {
|
|
8992
|
+
return this.elementInternals.reportValidity();
|
|
8993
|
+
}
|
|
8994
|
+
/**
|
|
8995
|
+
* Sets a custom validity message.
|
|
8996
|
+
* @public
|
|
8997
|
+
*/
|
|
8998
|
+
setCustomValidity(message) {
|
|
8999
|
+
this.setValidity({
|
|
9000
|
+
customError: !!message
|
|
9001
|
+
}, message);
|
|
9203
9002
|
}
|
|
9204
9003
|
/**
|
|
9004
|
+
* Sets the validity of the control.
|
|
9005
|
+
*
|
|
9006
|
+
* @param flags - Validity flags to set.
|
|
9007
|
+
* @param message - Optional message to supply. If not provided, the control's `validationMessage` will be used.
|
|
9008
|
+
* @param anchor - Optional anchor to use for the validation message.
|
|
9009
|
+
*
|
|
9205
9010
|
* @internal
|
|
9206
9011
|
*/
|
|
9207
|
-
|
|
9012
|
+
setValidity(flags, message, anchor) {
|
|
9208
9013
|
if (this.$fastController.isConnected) {
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
if (value !== next) {
|
|
9212
|
-
this.value = value;
|
|
9014
|
+
if (this.disabled) {
|
|
9015
|
+
this.elementInternals.setValidity({});
|
|
9213
9016
|
return;
|
|
9214
9017
|
}
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9018
|
+
this.elementInternals.setValidity({
|
|
9019
|
+
customError: !!message,
|
|
9020
|
+
...flags
|
|
9021
|
+
}, message ?? this.validationMessage, anchor);
|
|
9022
|
+
}
|
|
9023
|
+
}
|
|
9024
|
+
/**
|
|
9025
|
+
* The current value of the input.
|
|
9026
|
+
*
|
|
9027
|
+
* @public
|
|
9028
|
+
*/
|
|
9029
|
+
get value() {
|
|
9030
|
+
Observable.track(this, "value");
|
|
9031
|
+
return this._value.toString();
|
|
9032
|
+
}
|
|
9033
|
+
set value(value) {
|
|
9034
|
+
if (!this.$fastController.isConnected) {
|
|
9035
|
+
this._value = value.toString();
|
|
9036
|
+
return;
|
|
9037
|
+
}
|
|
9038
|
+
const nextAsNumber = parseFloat(value);
|
|
9039
|
+
const newValue = limit(this.minAsNumber, this.maxAsNumber, this.convertToConstrainedValue(nextAsNumber)).toString();
|
|
9040
|
+
if (newValue !== value) {
|
|
9041
|
+
this.value = newValue;
|
|
9042
|
+
return;
|
|
9043
|
+
}
|
|
9044
|
+
this._value = value.toString();
|
|
9045
|
+
this.elementInternals.ariaValueNow = this._value;
|
|
9046
|
+
this.elementInternals.ariaValueText = this.valueTextFormatter(this._value);
|
|
9047
|
+
this.setSliderPosition(this.direction);
|
|
9048
|
+
this.$emit("change");
|
|
9049
|
+
this.setFormValue(value);
|
|
9050
|
+
Observable.notify(this, "value");
|
|
9051
|
+
}
|
|
9052
|
+
/**
|
|
9053
|
+
* Resets the form value to its initial value when the form is reset.
|
|
9054
|
+
*
|
|
9055
|
+
* @internal
|
|
9056
|
+
*/
|
|
9057
|
+
formResetCallback() {
|
|
9058
|
+
this.value = this.initialValue ?? this.midpoint;
|
|
9059
|
+
}
|
|
9060
|
+
/**
|
|
9061
|
+
* Disabled the component when its associated form is disabled.
|
|
9062
|
+
*
|
|
9063
|
+
* @internal
|
|
9064
|
+
*
|
|
9065
|
+
* @privateRemarks
|
|
9066
|
+
* DO NOT change the `disabled` property or attribute here, because if the
|
|
9067
|
+
* `disabled` attribute is present, reenabling an ancestor `<fieldset>`
|
|
9068
|
+
* element will not reenabling this component.
|
|
9069
|
+
*/
|
|
9070
|
+
formDisabledCallback(disabled) {
|
|
9071
|
+
this.setDisabledSideEffect(disabled);
|
|
9072
|
+
}
|
|
9073
|
+
/**
|
|
9074
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
9075
|
+
*
|
|
9076
|
+
* @internal
|
|
9077
|
+
*/
|
|
9078
|
+
setFormValue(value, state) {
|
|
9079
|
+
this.elementInternals.setFormValue(value, value ?? state);
|
|
9080
|
+
}
|
|
9081
|
+
/**
|
|
9082
|
+
* The value property, typed as a number.
|
|
9083
|
+
*
|
|
9084
|
+
* @public
|
|
9085
|
+
*/
|
|
9086
|
+
get valueAsNumber() {
|
|
9087
|
+
return parseFloat(this.value);
|
|
9088
|
+
}
|
|
9089
|
+
set valueAsNumber(next) {
|
|
9090
|
+
this.value = next.toString();
|
|
9091
|
+
}
|
|
9092
|
+
valueTextFormatterChanged() {
|
|
9093
|
+
if (typeof this.valueTextFormatter === "function") {
|
|
9094
|
+
this.elementInternals.ariaValueText = this.valueTextFormatter(this._value);
|
|
9095
|
+
} else {
|
|
9096
|
+
this.elementInternals.ariaValueText = "";
|
|
9218
9097
|
}
|
|
9219
9098
|
}
|
|
9220
|
-
|
|
9099
|
+
disabledChanged() {
|
|
9100
|
+
this.setDisabledSideEffect(this.disabled);
|
|
9101
|
+
}
|
|
9221
9102
|
minChanged() {
|
|
9222
|
-
|
|
9223
|
-
|
|
9103
|
+
this.elementInternals.ariaValueMin = `${this.minAsNumber}`;
|
|
9104
|
+
if (this.$fastController.isConnected && this.minAsNumber > this.valueAsNumber) {
|
|
9105
|
+
this.value = this.min;
|
|
9224
9106
|
}
|
|
9225
|
-
this.validate();
|
|
9226
9107
|
}
|
|
9227
|
-
|
|
9108
|
+
/**
|
|
9109
|
+
* Returns the min property or the default value
|
|
9110
|
+
*
|
|
9111
|
+
* @internal
|
|
9112
|
+
*/
|
|
9113
|
+
get minAsNumber() {
|
|
9114
|
+
if (this.min !== void 0) {
|
|
9115
|
+
const parsed = parseFloat(this.min);
|
|
9116
|
+
if (!Number.isNaN(parsed)) {
|
|
9117
|
+
return parsed;
|
|
9118
|
+
}
|
|
9119
|
+
}
|
|
9120
|
+
return 0;
|
|
9121
|
+
}
|
|
9228
9122
|
maxChanged() {
|
|
9229
|
-
|
|
9230
|
-
|
|
9123
|
+
this.elementInternals.ariaValueMax = `${this.maxAsNumber}`;
|
|
9124
|
+
if (this.$fastController.isConnected && this.maxAsNumber < this.valueAsNumber) {
|
|
9125
|
+
this.value = this.max;
|
|
9231
9126
|
}
|
|
9232
|
-
this.validate();
|
|
9233
9127
|
}
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9128
|
+
/**
|
|
9129
|
+
* Returns the max property or the default value
|
|
9130
|
+
*
|
|
9131
|
+
* @internal
|
|
9132
|
+
*/
|
|
9133
|
+
get maxAsNumber() {
|
|
9134
|
+
if (this.max !== void 0) {
|
|
9135
|
+
const parsed = parseFloat(this.max);
|
|
9136
|
+
if (!Number.isNaN(parsed)) {
|
|
9137
|
+
return parsed;
|
|
9138
|
+
}
|
|
9237
9139
|
}
|
|
9140
|
+
return 100;
|
|
9141
|
+
}
|
|
9142
|
+
stepChanged() {
|
|
9238
9143
|
this.updateStepMultiplier();
|
|
9239
|
-
this.
|
|
9144
|
+
if (this.$fastController.isConnected) {
|
|
9145
|
+
this.value = this._value;
|
|
9146
|
+
}
|
|
9240
9147
|
}
|
|
9241
|
-
|
|
9148
|
+
/**
|
|
9149
|
+
* Returns the step property as a number.
|
|
9150
|
+
*
|
|
9151
|
+
* @internal
|
|
9152
|
+
*/
|
|
9153
|
+
get stepAsNumber() {
|
|
9154
|
+
if (this.step !== void 0) {
|
|
9155
|
+
const parsed = parseFloat(this.step);
|
|
9156
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
9157
|
+
return parsed;
|
|
9158
|
+
}
|
|
9159
|
+
}
|
|
9160
|
+
return 1;
|
|
9161
|
+
}
|
|
9162
|
+
orientationChanged(prev, next) {
|
|
9163
|
+
this.elementInternals.ariaOrientation = next ?? Orientation.horizontal;
|
|
9164
|
+
if (prev) {
|
|
9165
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
9166
|
+
}
|
|
9167
|
+
if (next) {
|
|
9168
|
+
toggleState(this.elementInternals, `${next}`, true);
|
|
9169
|
+
}
|
|
9242
9170
|
if (this.$fastController.isConnected) {
|
|
9243
|
-
this.
|
|
9171
|
+
this.setSliderPosition(this.direction);
|
|
9244
9172
|
}
|
|
9245
9173
|
}
|
|
9246
9174
|
/**
|
|
@@ -9248,13 +9176,13 @@ class Slider extends FormAssociatedSlider {
|
|
|
9248
9176
|
*/
|
|
9249
9177
|
connectedCallback() {
|
|
9250
9178
|
super.connectedCallback();
|
|
9251
|
-
this.proxy.setAttribute("type", "range");
|
|
9252
9179
|
this.direction = getDirection(this);
|
|
9180
|
+
this.setDisabledSideEffect(this.disabled);
|
|
9253
9181
|
this.updateStepMultiplier();
|
|
9254
9182
|
this.setupTrackConstraints();
|
|
9255
9183
|
this.setupListeners();
|
|
9256
9184
|
this.setupDefaultValue();
|
|
9257
|
-
this.
|
|
9185
|
+
this.setSliderPosition(this.direction);
|
|
9258
9186
|
Observable.getNotifier(this).subscribe(this, "max");
|
|
9259
9187
|
Observable.getNotifier(this).subscribe(this, "min");
|
|
9260
9188
|
Observable.getNotifier(this).subscribe(this, "step");
|
|
@@ -9276,9 +9204,9 @@ class Slider extends FormAssociatedSlider {
|
|
|
9276
9204
|
* @public
|
|
9277
9205
|
*/
|
|
9278
9206
|
increment() {
|
|
9279
|
-
const newVal = this.direction !== Direction.rtl
|
|
9207
|
+
const newVal = this.direction !== Direction.rtl ? Number(this.value) + this.stepAsNumber : Number(this.value) - this.stepAsNumber;
|
|
9280
9208
|
const incrementedVal = this.convertToConstrainedValue(newVal);
|
|
9281
|
-
const incrementedValString = incrementedVal <
|
|
9209
|
+
const incrementedValString = incrementedVal < this.maxAsNumber ? `${incrementedVal}` : `${this.maxAsNumber}`;
|
|
9282
9210
|
this.value = incrementedValString;
|
|
9283
9211
|
}
|
|
9284
9212
|
/**
|
|
@@ -9287,56 +9215,43 @@ class Slider extends FormAssociatedSlider {
|
|
|
9287
9215
|
* @public
|
|
9288
9216
|
*/
|
|
9289
9217
|
decrement() {
|
|
9290
|
-
const newVal = this.direction !== Direction.rtl
|
|
9218
|
+
const newVal = this.direction !== Direction.rtl ? Number(this.value) - Number(this.stepAsNumber) : Number(this.value) + Number(this.stepAsNumber);
|
|
9291
9219
|
const decrementedVal = this.convertToConstrainedValue(newVal);
|
|
9292
|
-
const decrementedValString = decrementedVal >
|
|
9220
|
+
const decrementedValString = decrementedVal > this.minAsNumber ? `${decrementedVal}` : `${this.minAsNumber}`;
|
|
9293
9221
|
this.value = decrementedValString;
|
|
9294
9222
|
}
|
|
9295
|
-
/**
|
|
9296
|
-
* Gets the actual step value for the slider
|
|
9297
|
-
*
|
|
9298
|
-
*/
|
|
9299
|
-
get stepValue() {
|
|
9300
|
-
return this.step === void 0 ? 1 : this.step;
|
|
9301
|
-
}
|
|
9302
9223
|
/**
|
|
9303
9224
|
* Places the thumb based on the current value
|
|
9304
9225
|
*
|
|
9305
|
-
* @public
|
|
9306
9226
|
* @param direction - writing mode
|
|
9307
9227
|
*/
|
|
9308
|
-
|
|
9309
|
-
const newPct = convertPixelToPercent(
|
|
9228
|
+
setSliderPosition(direction) {
|
|
9229
|
+
const newPct = convertPixelToPercent(parseFloat(this.value), this.minAsNumber, this.maxAsNumber, direction);
|
|
9310
9230
|
const percentage = (1 - newPct) * 100;
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
}
|
|
9314
|
-
this.position = this.isDragging ? `top: ${percentage}%; transition: none;` : `top: ${percentage}%; transition: all 0.2s ease;`;
|
|
9315
|
-
}
|
|
9231
|
+
const thumbPosition = `calc(100% - ${percentage}%)`;
|
|
9232
|
+
const trackProgress = !(this.orientation === Orientation.vertical) && direction === Direction.rtl ? `${percentage}%` : `calc(100% - ${percentage}%)`;
|
|
9233
|
+
this.position = `--slider-thumb: ${thumbPosition}; --slider-progress: ${trackProgress}`;
|
|
9316
9234
|
}
|
|
9317
9235
|
/**
|
|
9318
9236
|
* Update the step multiplier used to ensure rounding errors from steps that
|
|
9319
9237
|
* are not whole numbers
|
|
9320
9238
|
*/
|
|
9321
9239
|
updateStepMultiplier() {
|
|
9322
|
-
const stepString = this.
|
|
9323
|
-
const decimalPlacesOfStep = !!(this.
|
|
9240
|
+
const stepString = this.stepAsNumber + "";
|
|
9241
|
+
const decimalPlacesOfStep = !!(this.stepAsNumber % 1) ? stepString.length - stepString.indexOf(".") - 1 : 0;
|
|
9324
9242
|
this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
|
|
9325
9243
|
}
|
|
9326
9244
|
get midpoint() {
|
|
9327
|
-
return `${this.convertToConstrainedValue((this.
|
|
9245
|
+
return `${this.convertToConstrainedValue((this.maxAsNumber + this.minAsNumber) / 2)}`;
|
|
9328
9246
|
}
|
|
9329
9247
|
setupDefaultValue() {
|
|
9330
|
-
if (
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
|
|
9336
|
-
this.value = this.midpoint;
|
|
9337
|
-
}
|
|
9338
|
-
}
|
|
9248
|
+
if (!this._value) {
|
|
9249
|
+
this.value = this.initialValue ?? this.midpoint;
|
|
9250
|
+
}
|
|
9251
|
+
if (!Number.isNaN(this.valueAsNumber) && (this.valueAsNumber < this.minAsNumber || this.valueAsNumber > this.maxAsNumber)) {
|
|
9252
|
+
this.value = this.midpoint;
|
|
9339
9253
|
}
|
|
9254
|
+
this.elementInternals.ariaValueNow = this.value;
|
|
9340
9255
|
}
|
|
9341
9256
|
/**
|
|
9342
9257
|
* Calculate the new value based on the given raw pixel value.
|
|
@@ -9348,26 +9263,43 @@ class Slider extends FormAssociatedSlider {
|
|
|
9348
9263
|
*/
|
|
9349
9264
|
calculateNewValue(rawValue) {
|
|
9350
9265
|
this.setupTrackConstraints();
|
|
9351
|
-
const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.
|
|
9352
|
-
const newValue = (this.
|
|
9266
|
+
const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.vertical ? this.trackMinHeight : this.trackMinWidth, this.orientation === Orientation.vertical ? this.trackHeight : this.trackWidth, this.direction);
|
|
9267
|
+
const newValue = (this.maxAsNumber - this.minAsNumber) * newPosition + this.minAsNumber;
|
|
9353
9268
|
return this.convertToConstrainedValue(newValue);
|
|
9354
9269
|
}
|
|
9355
9270
|
convertToConstrainedValue(value) {
|
|
9356
9271
|
if (isNaN(value)) {
|
|
9357
|
-
value = this.
|
|
9272
|
+
value = this.minAsNumber;
|
|
9358
9273
|
}
|
|
9359
|
-
let constrainedValue = value - this.
|
|
9360
|
-
const roundedConstrainedValue = Math.round(constrainedValue / this.
|
|
9361
|
-
const remainderValue = constrainedValue - roundedConstrainedValue * (this.stepMultiplier * this.
|
|
9362
|
-
constrainedValue = remainderValue >= Number(this.
|
|
9363
|
-
return constrainedValue + this.
|
|
9274
|
+
let constrainedValue = value - this.minAsNumber;
|
|
9275
|
+
const roundedConstrainedValue = Math.round(constrainedValue / this.stepAsNumber);
|
|
9276
|
+
const remainderValue = constrainedValue - roundedConstrainedValue * (this.stepMultiplier * this.stepAsNumber) / this.stepMultiplier;
|
|
9277
|
+
constrainedValue = remainderValue >= Number(this.stepAsNumber) / 2 ? constrainedValue - remainderValue + Number(this.stepAsNumber) : constrainedValue - remainderValue;
|
|
9278
|
+
return constrainedValue + this.minAsNumber;
|
|
9279
|
+
}
|
|
9280
|
+
/**
|
|
9281
|
+
* Makes sure the side effects of set up when the disabled state changes.
|
|
9282
|
+
*/
|
|
9283
|
+
setDisabledSideEffect(disabled) {
|
|
9284
|
+
if (!this.$fastController.isConnected) {
|
|
9285
|
+
return;
|
|
9286
|
+
}
|
|
9287
|
+
this.elementInternals.ariaDisabled = disabled.toString();
|
|
9288
|
+
this.tabIndex = disabled ? -1 : 0;
|
|
9364
9289
|
}
|
|
9365
9290
|
}
|
|
9291
|
+
/**
|
|
9292
|
+
* The form-associated flag.
|
|
9293
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
|
|
9294
|
+
*
|
|
9295
|
+
* @public
|
|
9296
|
+
*/
|
|
9297
|
+
Slider.formAssociated = true;
|
|
9366
9298
|
__decorateClass$6([attr], Slider.prototype, "size", 2);
|
|
9367
9299
|
__decorateClass$6([attr({
|
|
9368
|
-
attribute: "
|
|
9369
|
-
mode: "
|
|
9370
|
-
})], Slider.prototype, "
|
|
9300
|
+
attribute: "value",
|
|
9301
|
+
mode: "fromView"
|
|
9302
|
+
})], Slider.prototype, "initialValue", 2);
|
|
9371
9303
|
__decorateClass$6([observable], Slider.prototype, "direction", 2);
|
|
9372
9304
|
__decorateClass$6([observable], Slider.prototype, "isDragging", 2);
|
|
9373
9305
|
__decorateClass$6([observable], Slider.prototype, "position", 2);
|
|
@@ -9378,28 +9310,33 @@ __decorateClass$6([observable], Slider.prototype, "trackLeft", 2);
|
|
|
9378
9310
|
__decorateClass$6([observable], Slider.prototype, "trackMinHeight", 2);
|
|
9379
9311
|
__decorateClass$6([observable], Slider.prototype, "valueTextFormatter", 2);
|
|
9380
9312
|
__decorateClass$6([attr({
|
|
9381
|
-
|
|
9313
|
+
mode: "boolean"
|
|
9314
|
+
})], Slider.prototype, "disabled", 2);
|
|
9315
|
+
__decorateClass$6([attr({
|
|
9316
|
+
converter: numberLikeStringConverter
|
|
9382
9317
|
})], Slider.prototype, "min", 2);
|
|
9383
9318
|
__decorateClass$6([attr({
|
|
9384
|
-
converter:
|
|
9319
|
+
converter: numberLikeStringConverter
|
|
9385
9320
|
})], Slider.prototype, "max", 2);
|
|
9386
9321
|
__decorateClass$6([attr({
|
|
9387
|
-
converter:
|
|
9322
|
+
converter: numberLikeStringConverter
|
|
9388
9323
|
})], Slider.prototype, "step", 2);
|
|
9389
9324
|
__decorateClass$6([attr], Slider.prototype, "orientation", 2);
|
|
9390
9325
|
__decorateClass$6([attr], Slider.prototype, "mode", 2);
|
|
9391
9326
|
|
|
9392
9327
|
const styles$8 = css`
|
|
9393
|
-
${display("inline-grid")}
|
|
9328
|
+
${display("inline-grid")}
|
|
9329
|
+
|
|
9330
|
+
:host{--thumb-size:20px;--track-margin-inline:calc(var(--thumb-size) / 2);--track-size:4px;--track-overhang:calc(var(--track-size) / -2);--slider-direction:90deg;--border-radius:${borderRadiusMedium};--step-marker-inset:var(--track-overhang) -1px;position:relative;align-items:center;justify-content:center;box-sizing:border-box;outline:none;user-select:none;touch-action:none;min-width:120px;min-height:32px;grid-template-rows:1fr var(--thumb-size) 1fr;grid-template-columns:var(--track-margin-inline) 1fr var(--track-margin-inline)}:host(:not(:disabled)){cursor:pointer}:host(:dir(rtl)){--slider-direction:-90deg}:host(${smallState}){--thumb-size:16px;--track-overhang:-1px;--track-size:2px;--border-radius:${borderRadiusSmall}}:host(${verticalState}){--slider-direction:0deg;--step-marker-inset:-1px var(--track-overhang);min-height:120px;grid-template-rows:var(--track-margin-inline) 1fr var(--track-margin-inline);grid-template-columns:1fr var(--thumb-size) 1fr;width:unset;min-width:32px;justify-items:center}:host(:not([slot='input']):focus-visible){box-shadow:0 0 0 2pt ${colorStrokeFocus2};outline:1px solid ${colorStrokeFocus1}}.track{position:relative;background-color:${colorNeutralStrokeAccessible};border-radius:var(--border-radius);grid-row:2 / 2;grid-column:2 / 2;width:100%;height:var(--track-size);forced-color-adjust:none}:host(${verticalState}) .track{top:var(--track-overhang);bottom:var(--track-overhang);width:var(--track-size);height:100%}.track::before{content:'';position:absolute;height:100%;border-radius:inherit;inset-inline-start:0;width:var(--slider-progress)}:host(${verticalState}) .track::before{width:100%;bottom:0;height:var(--slider-progress)}:host([step]) .track::after{content:'';position:absolute;border-radius:inherit;inset:var(--step-marker-inset);background-image:repeating-linear-gradient(
|
|
9394
9331
|
var(--slider-direction),#0000 0%,#0000 calc(var(--step-rate) - 1px),${colorNeutralBackground1} calc(var(--step-rate) - 1px),${colorNeutralBackground1} var(--step-rate)
|
|
9395
|
-
)}
|
|
9396
|
-
.track:hover,.track:active,.track{background:WindowText}.thumb
|
|
9332
|
+
)}.thumb-container{position:absolute;grid-row:2 / 2;grid-column:2 / 2;transform:translateX(-50%);left:var(--slider-thumb)}:host(${verticalState}) .thumb-container{transform:translateY(50%);left:unset;bottom:var(--slider-thumb)}:host(:not(:active)) :is(.thumb-container,.track::before){transition:all 0.2s ease}.thumb{width:var(--thumb-size);height:var(--thumb-size);border-radius:${borderRadiusCircular};box-shadow:0 0 0 calc(var(--thumb-size) * 0.2) ${colorNeutralBackground1} inset;border:calc(var(--thumb-size) * 0.05) solid ${colorNeutralStroke1};box-sizing:border-box}.thumb,.track::before{background-color:${colorCompoundBrandBackground}}:host(:hover) .thumb,:host(:hover) .track::before{background-color:${colorCompoundBrandBackgroundHover}}:host(:active) .thumb,:host(:active) .track::before{background-color:${colorCompoundBrandBackgroundPressed}}:host(:disabled) .track{background-color:${colorNeutralBackgroundDisabled}}:host(:disabled) .thumb,:host(:disabled) .track::before{background-color:${colorNeutralForegroundDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
9333
|
+
.track:hover,.track:active,.track{background:WindowText}.thumb:hover,.thumb:active,.thumb{background:ButtonText}:host(:hover) .track::before,:host(:active) .track::before,.track::before{background:Highlight}`));
|
|
9397
9334
|
|
|
9398
9335
|
function sliderTemplate(options = {}) {
|
|
9399
|
-
return html`<template
|
|
9336
|
+
return html`<template tabindex="${x => x.disabled ? null : 0}" @pointerdown="${(x, c) => x.handlePointerDown(c.event)}"><div ${ref("track")} part="track-container" class="track" style="${x => x.position}"></div><div ${ref("thumb")} part="thumb-container" class="thumb-container" style="${x => x.position}" @pointerdown="${(x, c) => x.handleThumbPointerDown(c.event)}"><slot name="thumb">${staticallyCompose(options.thumb)}</slot></div></template>`;
|
|
9400
9337
|
}
|
|
9401
9338
|
const template$8 = sliderTemplate({
|
|
9402
|
-
thumb: `<div class="thumb
|
|
9339
|
+
thumb: `<div class="thumb"></div>`
|
|
9403
9340
|
});
|
|
9404
9341
|
|
|
9405
9342
|
const definition$8 = Slider.compose({
|
|
@@ -10621,7 +10558,7 @@ __decorateClass([attr({
|
|
|
10621
10558
|
})], ToggleButton.prototype, "mixed", 2);
|
|
10622
10559
|
|
|
10623
10560
|
const styles = css`
|
|
10624
|
-
${styles$
|
|
10561
|
+
${styles$w}
|
|
10625
10562
|
|
|
10626
10563
|
:host(${pressedState}){border-color:${colorNeutralStroke1};background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground1};border-width:${strokeWidthThin}}:host(${pressedState}:hover){border-color:${colorNeutralStroke1Hover};background-color:${colorNeutralBackground1Hover}}:host(${pressedState}:active){border-color:${colorNeutralStroke1Pressed};background-color:${colorNeutralBackground1Pressed}}:host(${pressedState}${primaryState}){border-color:transparent;background-color:${colorBrandBackgroundSelected};color:${colorNeutralForegroundOnBrand}}:host(${pressedState}${primaryState}:hover){background-color:${colorBrandBackgroundHover}}:host(${pressedState}${primaryState}:active){background-color:${colorBrandBackgroundPressed}}:host(${pressedState}${subtleState}){border-color:transparent;background-color:${colorSubtleBackgroundSelected};color:${colorNeutralForeground2Selected}}:host(${pressedState}${subtleState}:hover){background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover}}:host(${pressedState}${subtleState}:active){background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed}}:host(${pressedState}${outlineState}),:host(${pressedState}${transparentState}){background-color:${colorTransparentBackgroundSelected}}:host(${pressedState}${outlineState}:hover),:host(${pressedState}${transparentState}:hover){background-color:${colorTransparentBackgroundHover}}:host(${pressedState}${outlineState}:active),:host(${pressedState}${transparentState}:active){background-color:${colorTransparentBackgroundPressed}}:host(${pressedState}${transparentState}){border-color:transparent;color:${colorNeutralForeground2BrandSelected}}:host(${pressedState}${transparentState}:hover){color:${colorNeutralForeground2BrandHover}}:host(${pressedState}${transparentState}:active){color:${colorNeutralForeground2BrandPressed}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
10627
10564
|
:host(${pressedState}),:host(${pressedState}${primaryState}),:host(${pressedState}${subtleState}),:host(${pressedState}${outlineState}),:host(${pressedState}${transparentState}){background:SelectedItem;color:SelectedItemText}`));
|