@fluentui/web-components 3.0.0-beta.24 → 3.0.0-beta.26
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 +23 -2
- package/dist/dts/checkbox/checkbox.d.ts +258 -32
- package/dist/dts/checkbox/checkbox.options.d.ts +13 -10
- package/dist/dts/checkbox/checkbox.template.d.ts +3 -2
- package/dist/dts/checkbox/index.d.ts +2 -2
- package/dist/dts/field/define.d.ts +1 -0
- package/dist/dts/field/field.bench.d.ts +3 -0
- package/dist/dts/field/field.d.ts +99 -0
- package/dist/dts/field/field.definition.d.ts +9 -0
- package/dist/dts/field/field.options.d.ts +41 -0
- package/dist/dts/field/field.styles.d.ts +6 -0
- package/dist/dts/field/field.template.d.ts +6 -0
- package/dist/dts/field/index.d.ts +6 -0
- package/dist/dts/index-rollup.d.ts +1 -0
- package/dist/dts/index.d.ts +2 -0
- package/dist/dts/switch/switch.d.ts +2 -39
- package/dist/dts/text-input/text-input.d.ts +50 -8
- package/dist/dts/utils/element-internals.d.ts +20 -0
- package/dist/esm/checkbox/checkbox.definition.js +1 -1
- package/dist/esm/checkbox/checkbox.definition.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +346 -41
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/checkbox/checkbox.options.js +0 -8
- package/dist/esm/checkbox/checkbox.options.js.map +1 -1
- package/dist/esm/checkbox/checkbox.styles.js +145 -123
- package/dist/esm/checkbox/checkbox.styles.js.map +1 -1
- package/dist/esm/checkbox/checkbox.template.js +23 -34
- package/dist/esm/checkbox/checkbox.template.js.map +1 -1
- package/dist/esm/checkbox/index.js +1 -1
- package/dist/esm/checkbox/index.js.map +1 -1
- package/dist/esm/dialog/dialog.styles.js +9 -2
- package/dist/esm/dialog/dialog.styles.js.map +1 -1
- package/dist/esm/field/define.js +4 -0
- package/dist/esm/field/define.js.map +1 -0
- package/dist/esm/field/field.bench.js +10 -0
- package/dist/esm/field/field.bench.js.map +1 -0
- package/dist/esm/field/field.definition.js +20 -0
- package/dist/esm/field/field.definition.js.map +1 -0
- package/dist/esm/field/field.js +139 -0
- package/dist/esm/field/field.js.map +1 -0
- package/dist/esm/field/field.options.js +27 -0
- package/dist/esm/field/field.options.js.map +1 -0
- package/dist/esm/field/field.styles.js +186 -0
- package/dist/esm/field/field.styles.js.map +1 -0
- package/dist/esm/field/field.template.js +26 -0
- package/dist/esm/field/field.template.js.map +1 -0
- package/dist/esm/field/index.js +6 -0
- package/dist/esm/field/index.js.map +1 -0
- 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.styles.js +12 -5
- package/dist/esm/label/label.styles.js.map +1 -1
- package/dist/esm/switch/switch.js +2 -52
- package/dist/esm/switch/switch.js.map +1 -1
- package/dist/esm/switch/switch.styles.js +34 -55
- package/dist/esm/switch/switch.styles.js.map +1 -1
- package/dist/esm/switch/switch.template.js +6 -16
- package/dist/esm/switch/switch.template.js.map +1 -1
- package/dist/esm/text/text.styles.js +48 -24
- package/dist/esm/text/text.styles.js.map +1 -1
- package/dist/esm/text-input/text-input.definition.js +3 -0
- package/dist/esm/text-input/text-input.definition.js.map +1 -1
- package/dist/esm/text-input/text-input.js +78 -20
- package/dist/esm/text-input/text-input.js.map +1 -1
- package/dist/esm/text-input/text-input.styles.js +14 -9
- package/dist/esm/text-input/text-input.styles.js.map +1 -1
- package/dist/esm/text-input/text-input.template.js +39 -33
- package/dist/esm/text-input/text-input.template.js.map +1 -1
- package/dist/esm/theme/set-theme.js +10 -5
- package/dist/esm/theme/set-theme.js.map +1 -1
- package/dist/esm/utils/element-internals.js +32 -0
- package/dist/esm/utils/element-internals.js.map +1 -0
- package/dist/web-components.d.ts +506 -138
- package/dist/web-components.js +2264 -1692
- package/dist/web-components.min.js +243 -238
- package/package.json +1 -1
- package/dist/dts/checkbox/checkbox.form-associated.d.ts +0 -14
- package/dist/esm/checkbox/checkbox.form-associated.js +0 -14
- package/dist/esm/checkbox/checkbox.form-associated.js.map +0 -1
package/dist/web-components.js
CHANGED
|
@@ -2368,6 +2368,74 @@ function slotted(propertyOrOptions) {
|
|
|
2368
2368
|
return new SlottedDirective(propertyOrOptions);
|
|
2369
2369
|
}
|
|
2370
2370
|
|
|
2371
|
+
/**
|
|
2372
|
+
* The runtime behavior for child node observation.
|
|
2373
|
+
* @public
|
|
2374
|
+
*/
|
|
2375
|
+
class ChildrenDirective extends NodeObservationDirective {
|
|
2376
|
+
/**
|
|
2377
|
+
* Creates an instance of ChildrenDirective.
|
|
2378
|
+
* @param options - The options to use in configuring the child observation behavior.
|
|
2379
|
+
*/
|
|
2380
|
+
constructor(options) {
|
|
2381
|
+
super(options);
|
|
2382
|
+
this.observerProperty = Symbol();
|
|
2383
|
+
this.handleEvent = (mutations, observer) => {
|
|
2384
|
+
const target = observer.target;
|
|
2385
|
+
this.updateTarget(this.getSource(target), this.computeNodes(target));
|
|
2386
|
+
};
|
|
2387
|
+
options.childList = true;
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* Begins observation of the nodes.
|
|
2391
|
+
* @param target - The target to observe.
|
|
2392
|
+
*/
|
|
2393
|
+
observe(target) {
|
|
2394
|
+
let observer = target[this.observerProperty];
|
|
2395
|
+
if (!observer) {
|
|
2396
|
+
observer = new MutationObserver(this.handleEvent);
|
|
2397
|
+
observer.toJSON = noop;
|
|
2398
|
+
target[this.observerProperty] = observer;
|
|
2399
|
+
}
|
|
2400
|
+
observer.target = target;
|
|
2401
|
+
observer.observe(target, this.options);
|
|
2402
|
+
}
|
|
2403
|
+
/**
|
|
2404
|
+
* Disconnects observation of the nodes.
|
|
2405
|
+
* @param target - The target to unobserve.
|
|
2406
|
+
*/
|
|
2407
|
+
disconnect(target) {
|
|
2408
|
+
const observer = target[this.observerProperty];
|
|
2409
|
+
observer.target = null;
|
|
2410
|
+
observer.disconnect();
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Retrieves the raw nodes that should be assigned to the source property.
|
|
2414
|
+
* @param target - The target to get the node to.
|
|
2415
|
+
*/
|
|
2416
|
+
getNodes(target) {
|
|
2417
|
+
if ("selector" in this.options) {
|
|
2418
|
+
return Array.from(target.querySelectorAll(this.options.selector));
|
|
2419
|
+
}
|
|
2420
|
+
return Array.from(target.childNodes);
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
HTMLDirective.define(ChildrenDirective);
|
|
2424
|
+
/**
|
|
2425
|
+
* A directive that observes the `childNodes` of an element and updates a property
|
|
2426
|
+
* whenever they change.
|
|
2427
|
+
* @param propertyOrOptions - The options used to configure child node observation.
|
|
2428
|
+
* @public
|
|
2429
|
+
*/
|
|
2430
|
+
function children(propertyOrOptions) {
|
|
2431
|
+
if (isString(propertyOrOptions)) {
|
|
2432
|
+
propertyOrOptions = {
|
|
2433
|
+
property: propertyOrOptions
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
return new ChildrenDirective(propertyOrOptions);
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2371
2439
|
const booleanMode = "boolean";
|
|
2372
2440
|
const reflectMode = "reflect";
|
|
2373
2441
|
/**
|
|
@@ -3675,6 +3743,7 @@ const colorPaletteRedBackground1 = "var(--colorPaletteRedBackground1)";
|
|
|
3675
3743
|
const colorPaletteRedBackground2 = "var(--colorPaletteRedBackground2)";
|
|
3676
3744
|
const colorPaletteRedBackground3 = "var(--colorPaletteRedBackground3)";
|
|
3677
3745
|
const colorPaletteRedBorder1 = "var(--colorPaletteRedBorder1)";
|
|
3746
|
+
const colorPaletteRedBorder2 = "var(--colorPaletteRedBorder2)";
|
|
3678
3747
|
const colorPaletteRedForeground1 = "var(--colorPaletteRedForeground1)";
|
|
3679
3748
|
const colorPaletteRedForeground2 = "var(--colorPaletteRedForeground2)";
|
|
3680
3749
|
const colorPaletteRedForeground3 = "var(--colorPaletteRedForeground3)";
|
|
@@ -3828,7 +3897,7 @@ const curveEasyEaseMax = "var(--curveEasyEaseMax)";
|
|
|
3828
3897
|
const curveEasyEase = "var(--curveEasyEase)";
|
|
3829
3898
|
const curveLinear = "var(--curveLinear)";
|
|
3830
3899
|
|
|
3831
|
-
const styles$
|
|
3900
|
+
const styles$t = css`
|
|
3832
3901
|
${display("block")}
|
|
3833
3902
|
|
|
3834
3903
|
:host{max-width:fit-content;contain:content}.heading{height:44px;display:grid;position:relative;vertical-align:middle;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}.heading-content{height:100%;display:flex;align-items:center}.button{box-sizing:border-box;appearance:none;border:none;outline:none;text-align:start;cursor:pointer;font-family:inherit;height:44px;color:${colorNeutralForeground1};background:${colorTransparentBackground};line-height:${lineHeightBase300};height:auto;padding:0;font-size:inherit;grid-column:auto / span 2;grid-row:1}.button::before{content:'';position:absolute;inset:0px;cursor:pointer;border-radius:${borderRadiusSmall}}.icon{display:flex;align-items:center;justify-content:center;pointer-events:none;position:relative;height:100%;padding-right:${spacingHorizontalS};grid-column:1 / span 1;grid-row:1}.region{margin:0 ${spacingHorizontalM}}::slotted([slot='start']),::slotted([slot='end']){justify-content:center;align-items:center;padding-right:${spacingHorizontalS};grid-column:2 / span 1;grid-row:1 / span 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([disabled]) .button{color:${colorNeutralForegroundDisabled}}:host([disabled]) svg{filter:invert(89%) sepia(0%) saturate(569%) hue-rotate(155deg) brightness(88%) contrast(87%)}:host([expanded]) .region{display:block}:host([expanded]) .default-collapsed-icon,:host([expanded]) ::slotted([slot='collapsed-icon']),:host(:not([expanded])) .default-expanded-icon,:host(:not([expanded])) ::slotted([slot='expanded-icon']),:host([expanded]) ::slotted([slot='end']),::slotted([slot='start']),.region{display:none}:host([expanded]) ::slotted([slot='start']),:host([expanded]) ::slotted([slot='expanded-icon']),:host(:not([expanded])) ::slotted([slot='collapsed-icon']),::slotted([slot='end']){display:flex}.heading{font-size:${fontSizeBase300};line-height:${lineHeightBase300}}:host([size='small']) .heading{font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']) .heading{font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='extra-large']) .heading{font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host([expand-icon-position='end']) :slotted(span[slot='start']),:host([expand-icon-position='end']) ::slotted(span[slot='end']){grid-column:1 / span 1;grid-row:1}:host([expand-icon-position='end']) ::slotted(span[slot='start']),:host([expand-icon-position='end']) ::slotted(span[slot='end']){grid-column:1 / span 1;grid-row:1}:host([expand-icon-position='end']) .icon{grid-column:4 / span 1;grid-row:1;display:flex;padding-left:10px;padding-right:0}:host([expand-icon-position='end']) .button{grid-column:2 / span 3;grid-row:1}:host([block]){max-width:100%}:host([expand-icon-position='end']) .heading{grid-template-columns:auto auto 28px}:host([expand-icon-position='end']) .icon{grid-column:5 / span 1}:host([block][expand-icon-position='end']) .heading{grid-template-columns:auto 1fr}:host([block][expand-icon-position='end']) .icon{grid-column:5 / span 1}`;
|
|
@@ -3862,18 +3931,18 @@ const chevronDown20Filled = html.partial(`<svg
|
|
|
3862
3931
|
function accordionItemTemplate(options = {}) {
|
|
3863
3932
|
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}" @click="${(x, c) => x.clickHandler(c.event)}"><span class="heading-content" part="heading-content"><slot name="heading"></slot></span></button>${startSlotTemplate(options)} ${endSlotTemplate(options)}<span class="icon" part="icon" aria-hidden="true"><slot name="expanded-icon">${staticallyCompose(options.expandedIcon)}</slot><slot name="collapsed-icon">${staticallyCompose(options.collapsedIcon)}</slot><span></div><div class="region" part="region" id="${x => x.id}-panel" role="region" aria-labelledby="${x => x.id}"><slot></slot></div>`;
|
|
3864
3933
|
}
|
|
3865
|
-
const template$
|
|
3934
|
+
const template$u = accordionItemTemplate({
|
|
3866
3935
|
collapsedIcon: chevronRight20Filled,
|
|
3867
3936
|
expandedIcon: chevronDown20Filled
|
|
3868
3937
|
});
|
|
3869
3938
|
|
|
3870
|
-
const definition$
|
|
3939
|
+
const definition$u = AccordionItem.compose({
|
|
3871
3940
|
name: `${FluentDesignSystem.prefix}-accordion-item`,
|
|
3872
|
-
template: template$
|
|
3873
|
-
styles: styles$
|
|
3941
|
+
template: template$u,
|
|
3942
|
+
styles: styles$t
|
|
3874
3943
|
});
|
|
3875
3944
|
|
|
3876
|
-
definition$
|
|
3945
|
+
definition$u.define(FluentDesignSystem.registry);
|
|
3877
3946
|
|
|
3878
3947
|
const AccordionExpandMode = {
|
|
3879
3948
|
single: "single",
|
|
@@ -4068,7 +4137,7 @@ __decorateClass$q([attr({
|
|
|
4068
4137
|
})], Accordion.prototype, "expandmode", 2);
|
|
4069
4138
|
__decorateClass$q([observable], Accordion.prototype, "slottedAccordionItems", 2);
|
|
4070
4139
|
|
|
4071
|
-
const styles$
|
|
4140
|
+
const styles$s = css`
|
|
4072
4141
|
${display("flex")}
|
|
4073
4142
|
|
|
4074
4143
|
:host{flex-direction:column;width:100%;contain:content}`;
|
|
@@ -4079,15 +4148,15 @@ function accordionTemplate() {
|
|
|
4079
4148
|
filter: elements()
|
|
4080
4149
|
})}></slot></template>`;
|
|
4081
4150
|
}
|
|
4082
|
-
const template$
|
|
4151
|
+
const template$t = accordionTemplate();
|
|
4083
4152
|
|
|
4084
|
-
const definition$
|
|
4153
|
+
const definition$t = Accordion.compose({
|
|
4085
4154
|
name: `${FluentDesignSystem.prefix}-accordion`,
|
|
4086
|
-
template: template$
|
|
4087
|
-
styles: styles$
|
|
4155
|
+
template: template$t,
|
|
4156
|
+
styles: styles$s
|
|
4088
4157
|
});
|
|
4089
4158
|
|
|
4090
|
-
definition$
|
|
4159
|
+
definition$t.define(FluentDesignSystem.registry);
|
|
4091
4160
|
|
|
4092
4161
|
var __defProp$p = Object.defineProperty;
|
|
4093
4162
|
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
@@ -4171,7 +4240,7 @@ __decorateClass$p([attr({
|
|
|
4171
4240
|
applyMixins(DelegatesARIALink, ARIAGlobalStatesAndProperties);
|
|
4172
4241
|
applyMixins(AnchorButton, StartEnd, DelegatesARIALink);
|
|
4173
4242
|
|
|
4174
|
-
const styles$
|
|
4243
|
+
const styles$r = css`
|
|
4175
4244
|
${display("inline-flex")}
|
|
4176
4245
|
|
|
4177
4246
|
:host{--icon-spacing:${spacingHorizontalSNudge};contain:layout style;vertical-align:middle}:host .control{display:inline-flex;align-items:center;box-sizing:border-box;justify-content: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}.content{display:inherit;text-align:center}:host(:hover) .control{background-color:${colorNeutralBackground1Hover};color:${colorNeutralForeground1Hover};border-color:${colorNeutralStroke1Hover}}:host(:hover:active) .control{background-color:${colorNeutralBackground1Pressed};border-color:${colorNeutralStroke1Pressed};color:${colorNeutralForeground1Pressed};outline-style:none}:host .control: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}[slot='start'],::slotted([slot='start']){margin-inline-end:var(--icon-spacing)}[slot='end'],::slotted([slot='end']){margin-inline-start:var(--icon-spacing)}:host([icon-only]) .control{min-width:32px;max-width:32px}:host([size='small']){--icon-spacing:${spacingHorizontalXS}}:host([size='small']) .control{min-height:24px;min-width:64px;padding:0 ${spacingHorizontalS};border-radius:${borderRadiusSmall};font-size:${fontSizeBase200};line-height:${lineHeightBase200};font-weight:${fontWeightRegular}}:host([size='small'][icon-only]) .control{min-width:24px;max-width:24px}:host([size='large']) .control{min-height:40px;border-radius:${borderRadiusLarge};padding:0 ${spacingHorizontalL};font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large'][icon-only]) .control{min-width:40px;max-width:40px}:host([size='large']) ::slotted(svg){font-size:24px;height:24px;width:24px}:host([shape='circular']) .control,:host([shape='circular']) .control:focus-visible{border-radius:${borderRadiusCircular}}:host([shape='square']) .control,:host([shape='square']) .control:focus-visible{border-radius:${borderRadiusNone}}:host([appearance='primary']) .control{background-color:${colorBrandBackground};color:${colorNeutralForegroundOnBrand};border-color:transparent}:host([appearance='primary']:hover) .control{background-color:${colorBrandBackgroundHover}}:host([appearance='primary']:hover) .control,:host([appearance='primary']:hover:active) .control{border-color:transparent;color:${colorNeutralForegroundOnBrand}}:host([appearance='primary']:hover:active) .control{background-color:${colorBrandBackgroundPressed}}:host([appearance='primary']) .control:focus-visible{border-color:${colorNeutralForegroundOnBrand};box-shadow:${shadow2},0 0 0 2px ${colorStrokeFocus2}}:host(:is([disabled][appearance='primary'],[disabled-focusabale][appearance='primary'])) .control,:host(:is([disabled][appearance='primary'],[disabled-focusabale][appearance='primary']):hover) .control,:host(:is([disabled][appearance='primary'],[disabled-focusabale][appearance='primary']):hover:active) .control{border-color:transparent}:host([appearance='outline']) .control{background-color:${colorTransparentBackground}}:host([appearance='outline']:hover) .control{background-color:${colorTransparentBackgroundHover}}:host([appearance='outline']:hover:active) .control{background-color:${colorTransparentBackgroundPressed}}:host(:is([disabled][appearance='outline'],[disabled-focusabale][appearance='outline'])) .control,:host(:is([disabled][appearance='outline'],[disabled-focusabale][appearance='outline']):hover) .control,:host(:is([disabled][appearance='outline'],[disabled-focusabale][appearance='outline']):hover:active) .control{background-color:${colorTransparentBackground}}:host([appearance='subtle']) .control{background-color:${colorSubtleBackground};color:${colorNeutralForeground2};border-color:transparent}:host([appearance='subtle']:hover) .control{background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover};border-color:transparent}:host([appearance='subtle']:hover:active) .control{background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed};border-color:transparent}:host(:is([disabled][appearance='subtle'],[disabled-focusabale][appearance='subtle'])) .control,:host(:is([disabled][appearance='subtle'],[disabled-focusabale][appearance='subtle']):hover) .control,:host(:is([disabled][appearance='subtle'],[disabled-focusabale][appearance='subtle']):hover:active) .control{background-color:${colorTransparentBackground};border-color:transparent}:host([appearance='subtle']:hover) ::slotted(svg){fill:${colorNeutralForeground2BrandHover}}:host([appearance='subtle']:hover:active) ::slotted(svg){fill:${colorNeutralForeground2BrandPressed}}:host([appearance='transparent']) .control{background-color:${colorTransparentBackground};color:${colorNeutralForeground2}}:host([appearance='transparent']:hover) .control{background-color:${colorTransparentBackgroundHover};color:${colorNeutralForeground2BrandHover}}:host([appearance='transparent']:hover:active) .control{background-color:${colorTransparentBackgroundPressed};color:${colorNeutralForeground2BrandPressed}}:host([appearance='transparent']) .control,:host([appearance='transparent']:hover) .control,:host([appearance='transparent']:hover:active) .control{border-color:transparent}:host(:is([disabled][appearance='transparent'],[disabled-focusabale][appearance='transparent'])) .control,:host(:is([disabled][appearance='transparent'],[disabled-focusabale][appearance='transparent']):hover) .control,:host(:is([disabled][appearance='transparent'],[disabled-focusabale][appearance='transparent']):hover:active)
|
|
@@ -4182,18 +4251,18 @@ const styles$q = css`
|
|
|
4182
4251
|
function anchorTemplate(options = {}) {
|
|
4183
4252
|
return html`<a class="control" part="control" download="${x => x.download}" href="${x => x.href}" hreflang="${x => x.hreflang}" ping="${x => x.ping}" referrerpolicy="${x => x.referrerpolicy}" rel="${x => x.rel}" target="${x => x.target}" type="${x => x.type}" aria-atomic="${x => x.ariaAtomic}" aria-busy="${x => x.ariaBusy}" aria-controls="${x => x.ariaControls}" aria-current="${x => x.ariaCurrent}" aria-describedby="${x => x.ariaDescribedby}" aria-details="${x => x.ariaDetails}" aria-disabled="${x => x.ariaDisabled}" aria-errormessage="${x => x.ariaErrormessage}" aria-expanded="${x => x.ariaExpanded}" aria-flowto="${x => x.ariaFlowto}" aria-haspopup="${x => x.ariaHaspopup}" aria-hidden="${x => x.ariaHidden}" aria-invalid="${x => x.ariaInvalid}" aria-keyshortcuts="${x => x.ariaKeyshortcuts}" aria-label="${x => x.ariaLabel}" aria-labelledby="${x => x.ariaLabelledby}" aria-live="${x => x.ariaLive}" aria-owns="${x => x.ariaOwns}" aria-relevant="${x => x.ariaRelevant}" aria-roledescription="${x => x.ariaRoledescription}" ${ref("control")}>${startSlotTemplate(options)}<span class="content" part="content"><slot ${slotted("defaultSlottedContent")}></slot></span>${endSlotTemplate(options)}</a>`;
|
|
4184
4253
|
}
|
|
4185
|
-
const template$
|
|
4254
|
+
const template$s = anchorTemplate();
|
|
4186
4255
|
|
|
4187
|
-
const definition$
|
|
4256
|
+
const definition$s = AnchorButton.compose({
|
|
4188
4257
|
name: `${FluentDesignSystem.prefix}-anchor-button`,
|
|
4189
|
-
template: template$
|
|
4190
|
-
styles: styles$
|
|
4258
|
+
template: template$s,
|
|
4259
|
+
styles: styles$r,
|
|
4191
4260
|
shadowOptions: {
|
|
4192
4261
|
delegatesFocus: true
|
|
4193
4262
|
}
|
|
4194
4263
|
});
|
|
4195
4264
|
|
|
4196
|
-
definition$
|
|
4265
|
+
definition$s.define(FluentDesignSystem.registry);
|
|
4197
4266
|
|
|
4198
4267
|
const UNWANTED_ENCLOSURES_REGEX = /[\(\[\{][^\)\]\}]*[\)\]\}]/g;
|
|
4199
4268
|
const UNWANTED_CHARS_REGEX = /[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g;
|
|
@@ -4350,22 +4419,22 @@ const animations = {
|
|
|
4350
4419
|
normalEase: curveEasyEase,
|
|
4351
4420
|
nullEasing: curveLinear
|
|
4352
4421
|
};
|
|
4353
|
-
const styles$
|
|
4422
|
+
const styles$q = css`
|
|
4354
4423
|
${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([data-color='brand']){color:${colorNeutralForegroundStaticInverted};background-color:${colorBrandBackgroundStatic}}:host([data-color='dark-red']){color:${colorPaletteDarkRedForeground2};background-color:${colorPaletteDarkRedBackground2}}:host([data-color='cranberry']){color:${colorPaletteCranberryForeground2};background-color:${colorPaletteCranberryBackground2}}:host([data-color='red']){color:${colorPaletteRedForeground2};background-color:${colorPaletteRedBackground2}}:host([data-color='pumpkin']){color:${colorPalettePumpkinForeground2};background-color:${colorPalettePumpkinBackground2}}:host([data-color='peach']){color:${colorPalettePeachForeground2};background-color:${colorPalettePeachBackground2}}:host([data-color='marigold']){color:${colorPaletteMarigoldForeground2};background-color:${colorPaletteMarigoldBackground2}}:host([data-color='gold']){color:${colorPaletteGoldForeground2};background-color:${colorPaletteGoldBackground2}}:host([data-color='brass']){color:${colorPaletteBrassForeground2};background-color:${colorPaletteBrassBackground2}}:host([data-color='brown']){color:${colorPaletteBrownForeground2};background-color:${colorPaletteBrownBackground2}}:host([data-color='forest']){color:${colorPaletteForestForeground2};background-color:${colorPaletteForestBackground2}}:host([data-color='seafoam']){color:${colorPaletteSeafoamForeground2};background-color:${colorPaletteSeafoamBackground2}}:host([data-color='dark-green']){color:${colorPaletteDarkGreenForeground2};background-color:${colorPaletteDarkGreenBackground2}}:host([data-color='light-teal']){color:${colorPaletteLightTealForeground2};background-color:${colorPaletteLightTealBackground2}}:host([data-color='teal']){color:${colorPaletteTealForeground2};background-color:${colorPaletteTealBackground2}}:host([data-color='steel']){color:${colorPaletteSteelForeground2};background-color:${colorPaletteSteelBackground2}}:host([data-color='blue']){color:${colorPaletteBlueForeground2};background-color:${colorPaletteBlueBackground2}}:host([data-color='royal-blue']){color:${colorPaletteRoyalBlueForeground2};background-color:${colorPaletteRoyalBlueBackground2}}:host([data-color='cornflower']){color:${colorPaletteCornflowerForeground2};background-color:${colorPaletteCornflowerBackground2}}:host([data-color='navy']){color:${colorPaletteNavyForeground2};background-color:${colorPaletteNavyBackground2}}:host([data-color='lavender']){color:${colorPaletteLavenderForeground2};background-color:${colorPaletteLavenderBackground2}}:host([data-color='purple']){color:${colorPalettePurpleForeground2};background-color:${colorPalettePurpleBackground2}}:host([data-color='grape']){color:${colorPaletteGrapeForeground2};background-color:${colorPaletteGrapeBackground2}}:host([data-color='lilac']){color:${colorPaletteLilacForeground2};background-color:${colorPaletteLilacBackground2}}:host([data-color='pink']){color:${colorPalettePinkForeground2};background-color:${colorPalettePinkBackground2}}:host([data-color='magenta']){color:${colorPaletteMagentaForeground2};background-color:${colorPaletteMagentaBackground2}}:host([data-color='plum']){color:${colorPalettePlumForeground2};background-color:${colorPalettePlumBackground2}}:host([data-color='beige']){color:${colorPaletteBeigeForeground2};background-color:${colorPaletteBeigeBackground2}}:host([data-color='mink']){color:${colorPaletteMinkForeground2};background-color:${colorPaletteMinkBackground2}}:host([data-color='platinum']){color:${colorPalettePlatinumForeground2};background-color:${colorPalettePlatinumBackground2}}:host([data-color='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}}`;
|
|
4355
4424
|
|
|
4356
4425
|
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>`;
|
|
4357
4426
|
function avatarTemplate() {
|
|
4358
4427
|
return html`<template role="img" data-color=${x => x.generateColor()}><slot>${x => x.name || x.initials ? x.generateInitials() : defaultIconTemplate}</slot><slot name="badge"></slot></template>`;
|
|
4359
4428
|
}
|
|
4360
|
-
const template$
|
|
4429
|
+
const template$r = avatarTemplate();
|
|
4361
4430
|
|
|
4362
|
-
const definition$
|
|
4431
|
+
const definition$r = Avatar.compose({
|
|
4363
4432
|
name: `${FluentDesignSystem.prefix}-avatar`,
|
|
4364
|
-
template: template$
|
|
4365
|
-
styles: styles$
|
|
4433
|
+
template: template$r,
|
|
4434
|
+
styles: styles$q
|
|
4366
4435
|
});
|
|
4367
4436
|
|
|
4368
|
-
definition$
|
|
4437
|
+
definition$r.define(FluentDesignSystem.registry);
|
|
4369
4438
|
|
|
4370
4439
|
const BadgeAppearance = {
|
|
4371
4440
|
filled: "filled",
|
|
@@ -4757,7 +4826,7 @@ css.partial`
|
|
|
4757
4826
|
font-weight: ${fontWeightSemibold};
|
|
4758
4827
|
`;
|
|
4759
4828
|
|
|
4760
|
-
const styles$
|
|
4829
|
+
const styles$p = css`
|
|
4761
4830
|
:host([shape='square']){border-radius:${borderRadiusNone}}:host([shape='rounded']){border-radius:${borderRadiusMedium}}:host([shape='rounded'][size='tiny']),:host([shape='rounded'][size='extra-small']),:host([shape='rounded'][size='small']){border-radius:${borderRadiusSmall}}${badgeSizeStyles}
|
|
4762
4831
|
${badgeFilledStyles}
|
|
4763
4832
|
${badgeGhostStyles}
|
|
@@ -4770,15 +4839,15 @@ const styles$o = css`
|
|
|
4770
4839
|
function badgeTemplate(options = {}) {
|
|
4771
4840
|
return html` ${startSlotTemplate(options)}<slot>${staticallyCompose(options.defaultContent)}</slot>${endSlotTemplate(options)} `;
|
|
4772
4841
|
}
|
|
4773
|
-
const template$
|
|
4842
|
+
const template$q = badgeTemplate();
|
|
4774
4843
|
|
|
4775
|
-
const definition$
|
|
4844
|
+
const definition$q = Badge.compose({
|
|
4776
4845
|
name: `${FluentDesignSystem.prefix}-badge`,
|
|
4777
|
-
template: template$
|
|
4778
|
-
styles: styles$
|
|
4846
|
+
template: template$q,
|
|
4847
|
+
styles: styles$p
|
|
4779
4848
|
});
|
|
4780
4849
|
|
|
4781
|
-
definition$
|
|
4850
|
+
definition$q.define(FluentDesignSystem.registry);
|
|
4782
4851
|
|
|
4783
4852
|
const ButtonType = {
|
|
4784
4853
|
submit: "submit",
|
|
@@ -5037,7 +5106,7 @@ __decorateClass$m([attr], Button.prototype, "type", 2);
|
|
|
5037
5106
|
__decorateClass$m([attr], Button.prototype, "value", 2);
|
|
5038
5107
|
applyMixins(Button, StartEnd);
|
|
5039
5108
|
|
|
5040
|
-
const styles$
|
|
5109
|
+
const styles$o = css`
|
|
5041
5110
|
${display("inline-flex")}
|
|
5042
5111
|
|
|
5043
5112
|
:host{--icon-spacing:${spacingHorizontalSNudge};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}[slot='start'],::slotted([slot='start']){margin-inline-end:var(--icon-spacing)}[slot='end'],::slotted([slot='end']){margin-inline-start:var(--icon-spacing)}:host([icon-only]){min-width:32px;max-width:32px}:host([size='small']){--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([size='small'][icon-only]){min-width:24px;max-width:24px}:host([size='large']){min-height:40px;border-radius:${borderRadiusLarge};padding:0 ${spacingHorizontalL};font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large'][icon-only]){min-width:40px;max-width:40px}:host([size='large']) ::slotted(svg){font-size:24px;height:24px;width:24px}:host([shape='circular']),:host([shape='circular']:focus-visible){border-radius:${borderRadiusCircular}}:host([shape='square']),:host([shape='square']:focus-visible){border-radius:${borderRadiusNone}}:host([appearance='primary']){background-color:${colorBrandBackground};color:${colorNeutralForegroundOnBrand};border-color:transparent}:host([appearance='primary']:hover){background-color:${colorBrandBackgroundHover}}:host([appearance='primary']:hover),:host([appearance='primary']:hover:active){border-color:transparent;color:${colorNeutralForegroundOnBrand}}:host([appearance='primary']:hover:active){background-color:${colorBrandBackgroundPressed}}:host([appearance='primary']:focus-visible){border-color:${colorNeutralForegroundOnBrand};box-shadow:${shadow2},0 0 0 2px ${colorStrokeFocus2}}:host([appearance='outline']){background-color:${colorTransparentBackground}}:host([appearance='outline']:hover){background-color:${colorTransparentBackgroundHover}}:host([appearance='outline']:hover:active){background-color:${colorTransparentBackgroundPressed}}:host([appearance='subtle']){background-color:${colorSubtleBackground};color:${colorNeutralForeground2};border-color:transparent}:host([appearance='subtle']:hover){background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover};border-color:transparent}:host([appearance='subtle']:hover:active){background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed};border-color:transparent}:host([appearance='subtle']:hover) ::slotted(svg){fill:${colorNeutralForeground2BrandHover}}:host([appearance='subtle']:hover:active) ::slotted(svg){fill:${colorNeutralForeground2BrandPressed}}:host([appearance='transparent']){background-color:${colorTransparentBackground};color:${colorNeutralForeground2}}:host([appearance='transparent']:hover){background-color:${colorTransparentBackgroundHover};color:${colorNeutralForeground2BrandHover}}:host([appearance='transparent']:hover:active){background-color:${colorTransparentBackgroundPressed};color:${colorNeutralForeground2BrandPressed}}:host([appearance='transparent']),:host([appearance='transparent']:hover),:host([appearance='transparent']:hover:active){border-color:transparent}: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(:is([disabled][appearance='primary'],[disabled-focusable][appearance='primary'])),:host(:is([disabled][appearance='primary'],[disabled-focusable][appearance='primary']):hover),:host(:is([disabled][appearance='primary'],[disabled-focusable][appearance='primary']):hover:active){border-color:transparent}:host(:is([disabled][appearance='outline'],[disabled-focusable][appearance='outline'])),:host(:is([disabled][appearance='outline'],[disabled-focusable][appearance='outline']):hover),:host(:is([disabled][appearance='outline'],[disabled-focusable][appearance='outline']):hover:active){background-color:${colorTransparentBackground}}:host(:is([disabled][appearance='subtle'],[disabled-focusable][appearance='subtle'])),:host(:is([disabled][appearance='subtle'],[disabled-focusable][appearance='subtle']):hover),:host(:is([disabled][appearance='subtle'],[disabled-focusable][appearance='subtle']):hover:active){background-color:${colorTransparentBackground};border-color:transparent}:host(:is([disabled][appearance='transparent'],[disabled-focusable][appearance='transparent'])),:host(:is([disabled][appearance='transparent'],[disabled-focusable][appearance='transparent']):hover),:host(:is([disabled][appearance='transparent'],[disabled-focusable][appearance='transparent']):hover:active){border-color:transparent;background-color:${colorTransparentBackground}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
@@ -5046,557 +5115,433 @@ const styles$n = css`
|
|
|
5046
5115
|
function buttonTemplate$1(options = {}) {
|
|
5047
5116
|
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>`;
|
|
5048
5117
|
}
|
|
5049
|
-
const template$
|
|
5118
|
+
const template$p = buttonTemplate$1();
|
|
5050
5119
|
|
|
5051
|
-
const definition$
|
|
5120
|
+
const definition$p = Button.compose({
|
|
5052
5121
|
name: `${FluentDesignSystem.prefix}-button`,
|
|
5053
|
-
template: template$
|
|
5054
|
-
styles: styles$
|
|
5122
|
+
template: template$p,
|
|
5123
|
+
styles: styles$o
|
|
5055
5124
|
});
|
|
5056
5125
|
|
|
5057
|
-
definition$
|
|
5126
|
+
definition$p.define(FluentDesignSystem.registry);
|
|
5058
5127
|
|
|
5059
|
-
const
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
/**
|
|
5087
|
-
* These are events that are still fired by the proxy
|
|
5088
|
-
* element based on user / programmatic interaction.
|
|
5089
|
-
*
|
|
5090
|
-
* The proxy implementation should be transparent to
|
|
5091
|
-
* the app author, so block these events from emitting.
|
|
5092
|
-
*/
|
|
5093
|
-
this.proxyEventsToBlock = ["change", "click"];
|
|
5094
|
-
this.proxyInitialized = false;
|
|
5095
|
-
this.required = false;
|
|
5096
|
-
this.initialValue = this.initialValue || "";
|
|
5097
|
-
if (!this.elementInternals) {
|
|
5098
|
-
this.formResetCallback = this.formResetCallback.bind(this);
|
|
5099
|
-
}
|
|
5100
|
-
}
|
|
5128
|
+
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
5129
|
+
function toggleState(elementInternals, state, force) {
|
|
5130
|
+
if (!CustomStatesSetSupported) {
|
|
5131
|
+
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
5132
|
+
return;
|
|
5133
|
+
}
|
|
5134
|
+
force = force ?? !elementInternals.states.has(state);
|
|
5135
|
+
if (force) {
|
|
5136
|
+
elementInternals.states.add(state);
|
|
5137
|
+
return;
|
|
5138
|
+
}
|
|
5139
|
+
elementInternals.states.delete(state);
|
|
5140
|
+
}
|
|
5141
|
+
|
|
5142
|
+
var __defProp$l = Object.defineProperty;
|
|
5143
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
5144
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
5145
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
5146
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5147
|
+
if (kind && result) __defProp$l(target, key, result);
|
|
5148
|
+
return result;
|
|
5149
|
+
};
|
|
5150
|
+
class BaseCheckbox extends FASTElement {
|
|
5151
|
+
constructor() {
|
|
5152
|
+
super();
|
|
5153
|
+
this.disabled = false;
|
|
5154
|
+
this.initialValue = "on";
|
|
5101
5155
|
/**
|
|
5102
|
-
*
|
|
5103
|
-
* Feature detects API support and resolve respectively
|
|
5156
|
+
* The internal checked state of the control.
|
|
5104
5157
|
*
|
|
5105
5158
|
* @internal
|
|
5106
5159
|
*/
|
|
5107
|
-
|
|
5108
|
-
return supportsElementInternals;
|
|
5109
|
-
}
|
|
5160
|
+
this._checked = this.initialChecked ?? false;
|
|
5110
5161
|
/**
|
|
5111
|
-
*
|
|
5162
|
+
* Indicates that the checked state has been changed by the user.
|
|
5112
5163
|
*
|
|
5113
|
-
* @
|
|
5164
|
+
* @internal
|
|
5114
5165
|
*/
|
|
5115
|
-
|
|
5116
|
-
return this.elementInternals ? this.elementInternals.validity : this.proxy.validity;
|
|
5117
|
-
}
|
|
5166
|
+
this.dirtyChecked = false;
|
|
5118
5167
|
/**
|
|
5119
|
-
*
|
|
5120
|
-
* Returns null if not associated to any form.
|
|
5168
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
5121
5169
|
*
|
|
5122
|
-
* @
|
|
5170
|
+
* @internal
|
|
5123
5171
|
*/
|
|
5124
|
-
|
|
5125
|
-
return this.elementInternals ? this.elementInternals.form : this.proxy.form;
|
|
5126
|
-
}
|
|
5172
|
+
this.elementInternals = this.attachInternals();
|
|
5127
5173
|
/**
|
|
5128
|
-
*
|
|
5129
|
-
* or custom validation message if set.
|
|
5174
|
+
* The fallback validation message, taken from a native checkbox `<input>` element.
|
|
5130
5175
|
*
|
|
5131
|
-
* @
|
|
5132
|
-
*/
|
|
5133
|
-
get validationMessage() {
|
|
5134
|
-
return this.elementInternals ? this.elementInternals.validationMessage : this.proxy.validationMessage;
|
|
5135
|
-
}
|
|
5136
|
-
/**
|
|
5137
|
-
* Whether the element will be validated when the
|
|
5138
|
-
* form is submitted
|
|
5139
|
-
*/
|
|
5140
|
-
get willValidate() {
|
|
5141
|
-
return this.elementInternals ? this.elementInternals.willValidate : this.proxy.willValidate;
|
|
5142
|
-
}
|
|
5143
|
-
/**
|
|
5144
|
-
* A reference to all associated label elements
|
|
5176
|
+
* @internal
|
|
5145
5177
|
*/
|
|
5146
|
-
|
|
5147
|
-
if (this.elementInternals) {
|
|
5148
|
-
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
5149
|
-
} else if (this.proxy instanceof HTMLElement && this.proxy.ownerDocument && this.id) {
|
|
5150
|
-
const parentLabels = this.proxy.labels;
|
|
5151
|
-
const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
|
|
5152
|
-
const labels = parentLabels ? forLabels.concat(Array.from(parentLabels)) : forLabels;
|
|
5153
|
-
return Object.freeze(labels);
|
|
5154
|
-
} else {
|
|
5155
|
-
return emptyArray;
|
|
5156
|
-
}
|
|
5157
|
-
}
|
|
5178
|
+
this._validationFallbackMessage = "";
|
|
5158
5179
|
/**
|
|
5159
|
-
*
|
|
5160
|
-
* @param previous - the previous value
|
|
5161
|
-
* @param next - the new value
|
|
5180
|
+
* The internal value of the input.
|
|
5162
5181
|
*
|
|
5163
|
-
* @
|
|
5164
|
-
* If elements extending `FormAssociated` implement a `valueChanged` method
|
|
5165
|
-
* They must be sure to invoke `super.valueChanged(previous, next)` to ensure
|
|
5166
|
-
* proper functioning of `FormAssociated`
|
|
5182
|
+
* @internal
|
|
5167
5183
|
*/
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5184
|
+
this._value = this.initialValue;
|
|
5185
|
+
this.elementInternals.role = "checkbox";
|
|
5186
|
+
}
|
|
5187
|
+
/**
|
|
5188
|
+
* The element's current checked state.
|
|
5189
|
+
*
|
|
5190
|
+
* @public
|
|
5191
|
+
*/
|
|
5192
|
+
get checked() {
|
|
5193
|
+
Observable.track(this, "checked");
|
|
5194
|
+
return this._checked;
|
|
5195
|
+
}
|
|
5196
|
+
set checked(state) {
|
|
5197
|
+
this._checked = state;
|
|
5198
|
+
this.setFormValue(state ? this.value : null);
|
|
5199
|
+
this.setValidity();
|
|
5200
|
+
this.setAriaChecked();
|
|
5201
|
+
toggleState(this.elementInternals, "checked", state);
|
|
5202
|
+
Observable.notify(this, "checked");
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5205
|
+
* Synchronizes the element's indeterminate state with the internal ElementInternals state.
|
|
5206
|
+
*
|
|
5207
|
+
* @internal
|
|
5208
|
+
*/
|
|
5209
|
+
indeterminateChanged(prev, next) {
|
|
5210
|
+
this.setAriaChecked();
|
|
5211
|
+
toggleState(this.elementInternals, "indeterminate", next);
|
|
5212
|
+
}
|
|
5213
|
+
/**
|
|
5214
|
+
* Updates the form value when the checked state changes.
|
|
5215
|
+
*
|
|
5216
|
+
* @internal
|
|
5217
|
+
*/
|
|
5218
|
+
initialCheckedChanged(prev, next) {
|
|
5219
|
+
if (!this.dirtyChecked) {
|
|
5220
|
+
this.checked = next;
|
|
5179
5221
|
}
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5222
|
+
}
|
|
5223
|
+
/**
|
|
5224
|
+
* Sets the value of the input when the value attribute changes.
|
|
5225
|
+
*
|
|
5226
|
+
* @param prev - The previous value
|
|
5227
|
+
* @param next - The current value
|
|
5228
|
+
* @internal
|
|
5229
|
+
*/
|
|
5230
|
+
initialValueChanged(prev, next) {
|
|
5231
|
+
this._value = next;
|
|
5232
|
+
}
|
|
5233
|
+
/**
|
|
5234
|
+
* Sets the validity of the control when the required state changes.
|
|
5235
|
+
*
|
|
5236
|
+
* @param prev - The previous required state
|
|
5237
|
+
* @param next - The current required state
|
|
5238
|
+
* @internal
|
|
5239
|
+
*/
|
|
5240
|
+
requiredChanged(prev, next) {
|
|
5241
|
+
if (this.$fastController.isConnected) {
|
|
5242
|
+
this.setValidity();
|
|
5243
|
+
this.elementInternals.ariaRequired = `${!!next}`;
|
|
5196
5244
|
}
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
this.proxy.name = this.name;
|
|
5228
|
-
}
|
|
5229
|
-
}
|
|
5230
|
-
/**
|
|
5231
|
-
* Invoked when the `required` property changes
|
|
5232
|
-
*
|
|
5233
|
-
* @param previous - the previous value
|
|
5234
|
-
* @param next - the new value
|
|
5235
|
-
*
|
|
5236
|
-
* @remarks
|
|
5237
|
-
* If elements extending `FormAssociated` implement a `requiredChanged` method
|
|
5238
|
-
* They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
|
|
5239
|
-
* proper functioning of `FormAssociated`
|
|
5240
|
-
*/
|
|
5241
|
-
requiredChanged(prev, next) {
|
|
5242
|
-
if (this.proxy instanceof HTMLElement) {
|
|
5243
|
-
this.proxy.required = this.required;
|
|
5244
|
-
}
|
|
5245
|
-
Updates.enqueue(() => this.classList.toggle("required", this.required));
|
|
5246
|
-
this.validate();
|
|
5245
|
+
}
|
|
5246
|
+
/**
|
|
5247
|
+
* The associated `<form>` element.
|
|
5248
|
+
*
|
|
5249
|
+
* @public
|
|
5250
|
+
* @remarks
|
|
5251
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/form | `ElementInternals.form`} property.
|
|
5252
|
+
*/
|
|
5253
|
+
get form() {
|
|
5254
|
+
return this.elementInternals.form;
|
|
5255
|
+
}
|
|
5256
|
+
/**
|
|
5257
|
+
* A reference to all associated `<label>` elements.
|
|
5258
|
+
*
|
|
5259
|
+
* @public
|
|
5260
|
+
*/
|
|
5261
|
+
get labels() {
|
|
5262
|
+
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
5263
|
+
}
|
|
5264
|
+
/**
|
|
5265
|
+
* The validation message. Uses the browser's default validation message for native checkboxes if not otherwise
|
|
5266
|
+
* specified (e.g., via `setCustomValidity`).
|
|
5267
|
+
*
|
|
5268
|
+
* @public
|
|
5269
|
+
* @remarks
|
|
5270
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validationMessage | `ElementInternals.validationMessage`} property.
|
|
5271
|
+
*/
|
|
5272
|
+
get validationMessage() {
|
|
5273
|
+
if (this.elementInternals.validationMessage) {
|
|
5274
|
+
return this.elementInternals.validationMessage;
|
|
5247
5275
|
}
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
return null;
|
|
5255
|
-
}
|
|
5256
|
-
let internals = InternalsMap.get(this);
|
|
5257
|
-
if (!internals) {
|
|
5258
|
-
internals = this.attachInternals();
|
|
5259
|
-
InternalsMap.set(this, internals);
|
|
5260
|
-
}
|
|
5261
|
-
return internals;
|
|
5276
|
+
if (!this._validationFallbackMessage) {
|
|
5277
|
+
const validationMessageFallbackControl = document.createElement("input");
|
|
5278
|
+
validationMessageFallbackControl.type = "checkbox";
|
|
5279
|
+
validationMessageFallbackControl.required = true;
|
|
5280
|
+
validationMessageFallbackControl.checked = false;
|
|
5281
|
+
this._validationFallbackMessage = validationMessageFallbackControl.validationMessage;
|
|
5262
5282
|
}
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5283
|
+
return this._validationFallbackMessage;
|
|
5284
|
+
}
|
|
5285
|
+
/**
|
|
5286
|
+
* The element's validity state.
|
|
5287
|
+
*
|
|
5288
|
+
* @public
|
|
5289
|
+
* @remarks
|
|
5290
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
|
|
5291
|
+
*/
|
|
5292
|
+
get validity() {
|
|
5293
|
+
return this.elementInternals.validity;
|
|
5294
|
+
}
|
|
5295
|
+
/**
|
|
5296
|
+
* The current value of the input.
|
|
5297
|
+
*
|
|
5298
|
+
* @public
|
|
5299
|
+
*/
|
|
5300
|
+
get value() {
|
|
5301
|
+
Observable.track(this, "value");
|
|
5302
|
+
return this._value;
|
|
5303
|
+
}
|
|
5304
|
+
set value(value) {
|
|
5305
|
+
this._value = value;
|
|
5306
|
+
if (this.$fastController.isConnected) {
|
|
5307
|
+
this.setFormValue(value);
|
|
5308
|
+
this.setValidity();
|
|
5309
|
+
Observable.notify(this, "value");
|
|
5279
5310
|
}
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5311
|
+
}
|
|
5312
|
+
/**
|
|
5313
|
+
* Determines if the control can be submitted for constraint validation.
|
|
5314
|
+
*
|
|
5315
|
+
* @public
|
|
5316
|
+
* @remarks
|
|
5317
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/willValidate | `ElementInternals.willValidate`} property.
|
|
5318
|
+
*/
|
|
5319
|
+
get willValidate() {
|
|
5320
|
+
return this.elementInternals.willValidate;
|
|
5321
|
+
}
|
|
5322
|
+
/**
|
|
5323
|
+
* Sets the `elementInternals.ariaChecked` value based on the checked state.
|
|
5324
|
+
*
|
|
5325
|
+
* @internal
|
|
5326
|
+
*/
|
|
5327
|
+
setAriaChecked() {
|
|
5328
|
+
this.elementInternals.ariaChecked = this.indeterminate ? "mixed" : `${this.checked}`;
|
|
5329
|
+
}
|
|
5330
|
+
/**
|
|
5331
|
+
* Checks the validity of the element and returns the result.
|
|
5332
|
+
*
|
|
5333
|
+
* @public
|
|
5334
|
+
* @remarks
|
|
5335
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity | `HTMLInputElement.checkValidity()`} method.
|
|
5336
|
+
*/
|
|
5337
|
+
checkValidity() {
|
|
5338
|
+
return this.elementInternals.checkValidity();
|
|
5339
|
+
}
|
|
5340
|
+
/**
|
|
5341
|
+
* Toggles the checked state when the user clicks the element.
|
|
5342
|
+
*
|
|
5343
|
+
* @param e - the event object
|
|
5344
|
+
* @internal
|
|
5345
|
+
*/
|
|
5346
|
+
clickHandler(e) {
|
|
5347
|
+
if (this.disabled) {
|
|
5348
|
+
return;
|
|
5288
5349
|
}
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5350
|
+
this.dirtyChecked = true;
|
|
5351
|
+
this.toggleChecked();
|
|
5352
|
+
this.$emit("change");
|
|
5353
|
+
this.$emit("input");
|
|
5354
|
+
return true;
|
|
5355
|
+
}
|
|
5356
|
+
connectedCallback() {
|
|
5357
|
+
super.connectedCallback();
|
|
5358
|
+
this.setFormValue(this.checked ? this.value : null);
|
|
5359
|
+
this.setAriaChecked();
|
|
5360
|
+
this.setValidity();
|
|
5361
|
+
}
|
|
5362
|
+
/**
|
|
5363
|
+
* Updates the form value when a user changes the `checked` state.
|
|
5364
|
+
*
|
|
5365
|
+
* @param e - the event object
|
|
5366
|
+
* @internal
|
|
5367
|
+
*/
|
|
5368
|
+
inputHandler(e) {
|
|
5369
|
+
this.elementInternals.setFormValue(this.value);
|
|
5370
|
+
this.setValidity();
|
|
5371
|
+
return true;
|
|
5372
|
+
}
|
|
5373
|
+
/**
|
|
5374
|
+
* Prevents scrolling when the user presses the space key.
|
|
5375
|
+
*
|
|
5376
|
+
* @param e - the event object
|
|
5377
|
+
* @internal
|
|
5378
|
+
*/
|
|
5379
|
+
keydownHandler(e) {
|
|
5380
|
+
if (e.key !== " ") {
|
|
5381
|
+
return true;
|
|
5294
5382
|
}
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5383
|
+
}
|
|
5384
|
+
/**
|
|
5385
|
+
* Toggles the checked state when the user releases the space key.
|
|
5386
|
+
*
|
|
5387
|
+
* @param e - the event object
|
|
5388
|
+
* @internal
|
|
5389
|
+
*/
|
|
5390
|
+
keyupHandler(e) {
|
|
5391
|
+
if (e.key !== " ") {
|
|
5392
|
+
return true;
|
|
5301
5393
|
}
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5394
|
+
this.click();
|
|
5395
|
+
}
|
|
5396
|
+
/**
|
|
5397
|
+
* Resets the form value to its initial value when the form is reset.
|
|
5398
|
+
*
|
|
5399
|
+
* @internal
|
|
5400
|
+
*/
|
|
5401
|
+
formResetCallback() {
|
|
5402
|
+
this.checked = this.initialChecked ?? false;
|
|
5403
|
+
this.dirtyChecked = false;
|
|
5404
|
+
this.indeterminate = false;
|
|
5405
|
+
this.setValidity();
|
|
5406
|
+
}
|
|
5407
|
+
/**
|
|
5408
|
+
* Reports the validity of the element.
|
|
5409
|
+
*
|
|
5410
|
+
* @public
|
|
5411
|
+
* @remarks
|
|
5412
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity | `HTMLInputElement.reportValidity()`} method.
|
|
5413
|
+
*/
|
|
5414
|
+
reportValidity() {
|
|
5415
|
+
return this.elementInternals.reportValidity();
|
|
5416
|
+
}
|
|
5417
|
+
/**
|
|
5418
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
5419
|
+
*
|
|
5420
|
+
* @internal
|
|
5421
|
+
*/
|
|
5422
|
+
setFormValue(value, state) {
|
|
5423
|
+
this.elementInternals.setFormValue(value, value ?? state);
|
|
5424
|
+
}
|
|
5425
|
+
/**
|
|
5426
|
+
* Sets a custom validity message.
|
|
5427
|
+
*
|
|
5428
|
+
* @param message - The message to set
|
|
5429
|
+
* @public
|
|
5430
|
+
*/
|
|
5431
|
+
setCustomValidity(message) {
|
|
5432
|
+
this.elementInternals.setValidity({
|
|
5433
|
+
customError: true
|
|
5434
|
+
}, message);
|
|
5435
|
+
this.setValidity();
|
|
5436
|
+
}
|
|
5437
|
+
/**
|
|
5438
|
+
* Sets the validity of the control.
|
|
5439
|
+
*
|
|
5440
|
+
* @param flags - Validity flags to set.
|
|
5441
|
+
* @param message - Optional message to supply. If not provided, the control's `validationMessage` will be used.
|
|
5442
|
+
* @param anchor - Optional anchor to use for the validation message.
|
|
5443
|
+
*
|
|
5444
|
+
* @internal
|
|
5445
|
+
*/
|
|
5446
|
+
setValidity(flags = {
|
|
5447
|
+
valueMissing: !!this.required && !this.checked
|
|
5448
|
+
}, message = this.validationMessage, anchor) {
|
|
5449
|
+
if (this.$fastController.isConnected) {
|
|
5450
|
+
if (this.disabled) {
|
|
5451
|
+
this.elementInternals.setValidity({});
|
|
5452
|
+
return;
|
|
5316
5453
|
}
|
|
5454
|
+
this.elementInternals.setValidity(flags, message, anchor);
|
|
5317
5455
|
}
|
|
5318
|
-
/**
|
|
5319
|
-
* Invoked when a connected component's form or fieldset has its disabled
|
|
5320
|
-
* state changed.
|
|
5321
|
-
* @param disabled - the disabled value of the form / fieldset
|
|
5322
|
-
*/
|
|
5323
|
-
formDisabledCallback(disabled) {
|
|
5324
|
-
this.disabled = disabled;
|
|
5325
|
-
}
|
|
5326
|
-
formResetCallback() {
|
|
5327
|
-
this.value = this.initialValue;
|
|
5328
|
-
this.dirtyValue = false;
|
|
5329
|
-
}
|
|
5330
|
-
/**
|
|
5331
|
-
* Attach the proxy element to the DOM
|
|
5332
|
-
*/
|
|
5333
|
-
attachProxy() {
|
|
5334
|
-
if (!this.proxyInitialized) {
|
|
5335
|
-
this.proxyInitialized = true;
|
|
5336
|
-
this.proxy.style.display = "none";
|
|
5337
|
-
this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
|
|
5338
|
-
this.proxy.disabled = this.disabled;
|
|
5339
|
-
this.proxy.required = this.required;
|
|
5340
|
-
if (typeof this.name === "string") {
|
|
5341
|
-
this.proxy.name = this.name;
|
|
5342
|
-
}
|
|
5343
|
-
if (typeof this.value === "string") {
|
|
5344
|
-
this.proxy.value = this.value;
|
|
5345
|
-
}
|
|
5346
|
-
this.proxy.setAttribute("slot", proxySlotName);
|
|
5347
|
-
this.proxySlot = document.createElement("slot");
|
|
5348
|
-
this.proxySlot.setAttribute("name", proxySlotName);
|
|
5349
|
-
}
|
|
5350
|
-
this.shadowRoot?.appendChild(this.proxySlot);
|
|
5351
|
-
this.appendChild(this.proxy);
|
|
5352
|
-
}
|
|
5353
|
-
/**
|
|
5354
|
-
* Detach the proxy element from the DOM
|
|
5355
|
-
*/
|
|
5356
|
-
detachProxy() {
|
|
5357
|
-
this.removeChild(this.proxy);
|
|
5358
|
-
this.shadowRoot?.removeChild(this.proxySlot);
|
|
5359
|
-
}
|
|
5360
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
5361
|
-
validate(anchor) {
|
|
5362
|
-
if (this.proxy instanceof HTMLElement) {
|
|
5363
|
-
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
5364
|
-
}
|
|
5365
|
-
}
|
|
5366
|
-
/**
|
|
5367
|
-
* Associates the provided value (and optional state) with the parent form.
|
|
5368
|
-
* @param value - The value to set
|
|
5369
|
-
* @param state - The state object provided to during session restores and when autofilling.
|
|
5370
|
-
*/
|
|
5371
|
-
setFormValue(value, state) {
|
|
5372
|
-
if (this.elementInternals) {
|
|
5373
|
-
this.elementInternals.setFormValue(value, state || value);
|
|
5374
|
-
}
|
|
5375
|
-
}
|
|
5376
|
-
_keypressHandler(e) {
|
|
5377
|
-
switch (e.key) {
|
|
5378
|
-
case keyEnter:
|
|
5379
|
-
if (this.form instanceof HTMLFormElement) {
|
|
5380
|
-
const defaultButton = this.form.querySelector("[type=submit]");
|
|
5381
|
-
defaultButton?.click();
|
|
5382
|
-
}
|
|
5383
|
-
break;
|
|
5384
|
-
}
|
|
5385
|
-
}
|
|
5386
|
-
/**
|
|
5387
|
-
* Used to stop propagation of proxy element events
|
|
5388
|
-
* @param e - Event object
|
|
5389
|
-
*/
|
|
5390
|
-
stopPropagation(e) {
|
|
5391
|
-
e.stopPropagation();
|
|
5392
|
-
}
|
|
5393
|
-
};
|
|
5394
|
-
attr({
|
|
5395
|
-
mode: "boolean"
|
|
5396
|
-
})(C.prototype, "disabled");
|
|
5397
|
-
attr({
|
|
5398
|
-
mode: "fromView",
|
|
5399
|
-
attribute: "value"
|
|
5400
|
-
})(C.prototype, "initialValue");
|
|
5401
|
-
attr({
|
|
5402
|
-
attribute: "current-value"
|
|
5403
|
-
})(C.prototype, "currentValue");
|
|
5404
|
-
attr(C.prototype, "name");
|
|
5405
|
-
attr({
|
|
5406
|
-
mode: "boolean"
|
|
5407
|
-
})(C.prototype, "required");
|
|
5408
|
-
observable(C.prototype, "value");
|
|
5409
|
-
return C;
|
|
5410
|
-
}
|
|
5411
|
-
function CheckableFormAssociated(BaseCtor) {
|
|
5412
|
-
class C extends FormAssociated(BaseCtor) {}
|
|
5413
|
-
class D extends C {
|
|
5414
|
-
constructor(...args) {
|
|
5415
|
-
super(args);
|
|
5416
|
-
/**
|
|
5417
|
-
* Tracks whether the "checked" property has been changed.
|
|
5418
|
-
* This is necessary to provide consistent behavior with
|
|
5419
|
-
* normal input checkboxes
|
|
5420
|
-
*/
|
|
5421
|
-
this.dirtyChecked = false;
|
|
5422
|
-
/**
|
|
5423
|
-
* Provides the default checkedness of the input element
|
|
5424
|
-
* Passed down to proxy
|
|
5425
|
-
*
|
|
5426
|
-
* @public
|
|
5427
|
-
* @remarks
|
|
5428
|
-
* HTML Attribute: checked
|
|
5429
|
-
*/
|
|
5430
|
-
this.checkedAttribute = false;
|
|
5431
|
-
/**
|
|
5432
|
-
* The checked state of the control.
|
|
5433
|
-
*
|
|
5434
|
-
* @public
|
|
5435
|
-
*/
|
|
5436
|
-
this.checked = false;
|
|
5437
|
-
this.dirtyChecked = false;
|
|
5438
|
-
}
|
|
5439
|
-
checkedAttributeChanged() {
|
|
5440
|
-
this.defaultChecked = this.checkedAttribute;
|
|
5441
|
-
}
|
|
5442
|
-
/**
|
|
5443
|
-
* @internal
|
|
5444
|
-
*/
|
|
5445
|
-
defaultCheckedChanged() {
|
|
5446
|
-
if (!this.dirtyChecked) {
|
|
5447
|
-
this.checked = this.defaultChecked;
|
|
5448
|
-
this.dirtyChecked = false;
|
|
5449
|
-
}
|
|
5450
|
-
}
|
|
5451
|
-
checkedChanged(prev, next) {
|
|
5452
|
-
if (!this.dirtyChecked) {
|
|
5453
|
-
this.dirtyChecked = true;
|
|
5454
|
-
}
|
|
5455
|
-
this.currentChecked = this.checked;
|
|
5456
|
-
this.updateForm();
|
|
5457
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
5458
|
-
this.proxy.checked = this.checked;
|
|
5459
|
-
}
|
|
5460
|
-
if (prev !== void 0) {
|
|
5461
|
-
this.$emit("change");
|
|
5462
|
-
}
|
|
5463
|
-
this.validate();
|
|
5464
|
-
}
|
|
5465
|
-
currentCheckedChanged(prev, next) {
|
|
5466
|
-
this.checked = this.currentChecked;
|
|
5467
|
-
}
|
|
5468
|
-
updateForm() {
|
|
5469
|
-
const value = this.checked ? this.value : null;
|
|
5470
|
-
this.setFormValue(value, value);
|
|
5471
|
-
}
|
|
5472
|
-
connectedCallback() {
|
|
5473
|
-
super.connectedCallback();
|
|
5474
|
-
this.updateForm();
|
|
5475
|
-
}
|
|
5476
|
-
formResetCallback() {
|
|
5477
|
-
super.formResetCallback();
|
|
5478
|
-
this.checked = !!this.checkedAttribute;
|
|
5479
|
-
this.dirtyChecked = false;
|
|
5480
|
-
}
|
|
5481
|
-
}
|
|
5482
|
-
attr({
|
|
5483
|
-
attribute: "checked",
|
|
5484
|
-
mode: "boolean"
|
|
5485
|
-
})(D.prototype, "checkedAttribute");
|
|
5486
|
-
attr({
|
|
5487
|
-
attribute: "current-checked",
|
|
5488
|
-
converter: booleanConverter
|
|
5489
|
-
})(D.prototype, "currentChecked");
|
|
5490
|
-
observable(D.prototype, "defaultChecked");
|
|
5491
|
-
observable(D.prototype, "checked");
|
|
5492
|
-
return D;
|
|
5493
|
-
}
|
|
5494
|
-
|
|
5495
|
-
class _Checkbox extends FASTElement {}
|
|
5496
|
-
class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
5497
|
-
constructor() {
|
|
5498
|
-
super(...arguments);
|
|
5499
|
-
this.proxy = document.createElement("input");
|
|
5500
5456
|
}
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5508
|
-
if (kind && result) __defProp$l(target, key, result);
|
|
5509
|
-
return result;
|
|
5510
|
-
};
|
|
5511
|
-
class Checkbox extends FormAssociatedCheckbox {
|
|
5512
|
-
constructor() {
|
|
5513
|
-
super();
|
|
5514
|
-
/**
|
|
5515
|
-
* The element's value to be included in form submission when checked.
|
|
5516
|
-
* Default to "on" to reach parity with input[type="checkbox"]
|
|
5517
|
-
*
|
|
5518
|
-
* @internal
|
|
5519
|
-
*/
|
|
5520
|
-
this.initialValue = "on";
|
|
5457
|
+
/**
|
|
5458
|
+
* Toggles the checked state of the control.
|
|
5459
|
+
*
|
|
5460
|
+
* @public
|
|
5461
|
+
*/
|
|
5462
|
+
toggleChecked(force = !this.checked) {
|
|
5521
5463
|
this.indeterminate = false;
|
|
5522
|
-
|
|
5523
|
-
* @internal
|
|
5524
|
-
*/
|
|
5525
|
-
this.keypressHandler = e => {
|
|
5526
|
-
if (this.disabled) {
|
|
5527
|
-
return;
|
|
5528
|
-
}
|
|
5529
|
-
switch (e.key) {
|
|
5530
|
-
case keySpace:
|
|
5531
|
-
this.toggleChecked();
|
|
5532
|
-
break;
|
|
5533
|
-
}
|
|
5534
|
-
};
|
|
5535
|
-
/**
|
|
5536
|
-
* @internal
|
|
5537
|
-
*/
|
|
5538
|
-
this.clickHandler = e => {
|
|
5539
|
-
if (!this.disabled) {
|
|
5540
|
-
this.toggleChecked();
|
|
5541
|
-
}
|
|
5542
|
-
};
|
|
5543
|
-
this.proxy.setAttribute("type", "checkbox");
|
|
5544
|
-
}
|
|
5545
|
-
toggleChecked() {
|
|
5546
|
-
if (this.indeterminate) {
|
|
5547
|
-
this.indeterminate = false;
|
|
5548
|
-
}
|
|
5549
|
-
this.checked = !this.checked;
|
|
5464
|
+
this.checked = force;
|
|
5550
5465
|
}
|
|
5551
5466
|
}
|
|
5467
|
+
/**
|
|
5468
|
+
* The form-associated flag.
|
|
5469
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
|
|
5470
|
+
*
|
|
5471
|
+
* @public
|
|
5472
|
+
*/
|
|
5473
|
+
BaseCheckbox.formAssociated = true;
|
|
5474
|
+
__decorateClass$l([attr({
|
|
5475
|
+
mode: "boolean"
|
|
5476
|
+
})], BaseCheckbox.prototype, "autofocus", 2);
|
|
5477
|
+
__decorateClass$l([attr({
|
|
5478
|
+
mode: "boolean"
|
|
5479
|
+
})], BaseCheckbox.prototype, "disabled", 2);
|
|
5480
|
+
__decorateClass$l([attr({
|
|
5481
|
+
attribute: "form"
|
|
5482
|
+
})], BaseCheckbox.prototype, "formAttribute", 2);
|
|
5483
|
+
__decorateClass$l([observable], BaseCheckbox.prototype, "indeterminate", 2);
|
|
5484
|
+
__decorateClass$l([attr({
|
|
5485
|
+
attribute: "checked",
|
|
5486
|
+
mode: "boolean"
|
|
5487
|
+
})], BaseCheckbox.prototype, "initialChecked", 2);
|
|
5488
|
+
__decorateClass$l([attr({
|
|
5489
|
+
attribute: "value",
|
|
5490
|
+
mode: "fromView"
|
|
5491
|
+
})], BaseCheckbox.prototype, "initialValue", 2);
|
|
5492
|
+
__decorateClass$l([attr], BaseCheckbox.prototype, "name", 2);
|
|
5493
|
+
__decorateClass$l([attr({
|
|
5494
|
+
mode: "boolean"
|
|
5495
|
+
})], BaseCheckbox.prototype, "required", 2);
|
|
5496
|
+
class Checkbox extends BaseCheckbox {}
|
|
5552
5497
|
__decorateClass$l([attr], Checkbox.prototype, "shape", 2);
|
|
5553
5498
|
__decorateClass$l([attr], Checkbox.prototype, "size", 2);
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5499
|
+
|
|
5500
|
+
const checkedState$1 = css.partial`:is([state--checked], :state(checked))`;
|
|
5501
|
+
const indeterminateState = css.partial`:is([state--indeterminate], :state(indeterminate))`;
|
|
5502
|
+
const styles$n = css`
|
|
5503
|
+
${display("inline-flex")}
|
|
5504
|
+
|
|
5505
|
+
: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$1}:hover){background-color:${colorCompoundBrandBackgroundHover};border-color:${colorCompoundBrandStrokeHover}}:host(${checkedState$1}: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$1})) *:is(::slotted([slot='checked-indicator']),.checked-indicator){display:none}:host(${checkedState$1}),:host(${indeterminateState}){border-color:${colorCompoundBrandStroke}}:host(${checkedState$1}),:host(${indeterminateState}) .indeterminate-indicator{background-color:${colorCompoundBrandBackground}}:host(${indeterminateState}) .indeterminate-indicator{border-radius:${borderRadiusSmall};position:absolute;width:calc(var(--size) / 2);inset:0}:host([size='large']){--size:20px}:host([size='large']) ::slotted([slot='checked-indicator']),:host([size='large']) .checked-indicator{width:16px}:host([shape='circular']),:host([shape='circular']) .indeterminate-indicator{border-radius:${borderRadiusCircular}}:host([disabled]),:host([disabled]${checkedState$1}){background-color:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled}}:host([disabled]){cursor:unset}:host([disabled]${indeterminateState}) .indeterminate-indicator{background-color:${colorNeutralStrokeDisabled}}:host([disabled]${checkedState$1}) .checked-indicator{color:${colorNeutralStrokeDisabled}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
5506
|
+
:host{border-color:FieldText}:host(:not([slot='input']:focus-visible))::after{border-color:Canvas}:host(:not([disabled]):hover),:host(${checkedState$1}:not([disabled]):hover),:host(:not([slot='input']):focus-visible)::after{border-color:Highlight}.indeterminate-indicator,.checked-indicator{color:HighlightText}:host(${checkedState$1}),:host(${indeterminateState}) .indeterminate-indicator{background-color:FieldText}:host(${checkedState$1}:not([disabled]):hover),:host(${indeterminateState}:not([disabled]):hover) .indeterminate-indicator{background-color:Highlight}:host([disabled]){border-color:GrayText}:host([disabled]${indeterminateState}) .indeterminate-indicator{background-color:GrayText}:host([disabled]),:host([disabled]${checkedState$1}) .checked-indicator{color:GrayText}`));
|
|
5507
|
+
|
|
5508
|
+
const checkedIndicator = html.partial( /* html */
|
|
5509
|
+
`
|
|
5510
|
+
<svg
|
|
5511
|
+
fill="currentColor"
|
|
5512
|
+
aria-hidden="true"
|
|
5513
|
+
class="checked-indicator"
|
|
5514
|
+
width="1em"
|
|
5515
|
+
height="1em"
|
|
5516
|
+
viewBox="0 0 12 12"
|
|
5517
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
5518
|
+
<path d="M9.76 3.2c.3.29.32.76.04 1.06l-4.25 4.5a.75.75 0 0 1-1.08.02L2.22 6.53a.75.75 0 0 1 1.06-1.06l1.7 1.7L8.7 3.24a.75.75 0 0 1 1.06-.04Z" fill="currentColor"></path>
|
|
5519
|
+
</svg>
|
|
5572
5520
|
`);
|
|
5573
|
-
const indeterminateIndicator = html.partial(
|
|
5574
|
-
|
|
5521
|
+
const indeterminateIndicator = html.partial( /* html */
|
|
5522
|
+
`
|
|
5523
|
+
<span class="indeterminate-indicator"></span>
|
|
5575
5524
|
`);
|
|
5576
5525
|
function checkboxTemplate(options = {}) {
|
|
5577
|
-
return html`<template
|
|
5526
|
+
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>`;
|
|
5578
5527
|
}
|
|
5579
|
-
const template$
|
|
5528
|
+
const template$o = checkboxTemplate({
|
|
5580
5529
|
checkedIndicator,
|
|
5581
5530
|
indeterminateIndicator
|
|
5582
5531
|
});
|
|
5583
5532
|
|
|
5584
|
-
const
|
|
5585
|
-
${display("inline-flex")}
|
|
5586
|
-
:host{align-items:center;outline:none;user-select:none;vertical-align:middle;cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};line-height:${lineHeightBase300};color:${colorNeutralForeground3};position:relative}:host(:focus-visible)::after{content:'';position:absolute;inset:0px;cursor:pointer;border-radius:${borderRadiusMedium};outline:none;border:2px solid ${colorStrokeFocus1};box-shadow:inset 0 0 0 1px ${colorStrokeFocus2}}.control{position:relative;box-sizing:border-box;display:flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;margin:${spacingVerticalS} ${spacingHorizontalS};fill:currentcolor;height:16px;width:16px;border:${strokeWidthThin} solid ${colorNeutralStrokeAccessible};border-radius:${borderRadiusSmall};outline:none}.label{align-self:center;cursor:inherit;padding-inline:${spacingHorizontalS};padding-bottom:${spacingVerticalS};padding-top:${spacingVerticalS}}.label__hidden{display:none;visibility:hidden}.checked-indicator{display:flex;align-items:center;justify-content:center;color:${colorNeutralForegroundInverted};font-size:12px;margin:auto;opacity:0}.indeterminate-indicator{position:absolute;width:8px;height:8px;border-radius:${borderRadiusSmall};background-color:${colorCompoundBrandForeground1};opacity:0}:host(:hover){color:${colorNeutralForeground2}}:host(:hover) .control{border-color:${colorNeutralStrokeAccessibleHover}}:host(:hover) .indeterminate-indicator{background-color:${colorCompoundBrandForeground1Hover}}:host(:active) .control{border-color:${colorNeutralStrokeAccessiblePressed}}:host(:active) .indeterminate-indicator{background-color:${colorCompoundBrandForeground1Pressed}}:host([aria-checked='true']),:host([aria-checked='mixed']),:host(:active){color:${colorNeutralForeground1}}:host([aria-checked='true']) .control{background-color:${colorCompoundBrandBackground}}:host([aria-checked='true']:hover) .control{border-color:${colorCompoundBrandStrokeHover};background-color:${colorCompoundBrandBackgroundHover}}:host([aria-checked='true']:active) .control{background-color:${colorCompoundBrandBackgroundPressed}}:host([aria-checked='mixed']:hover) .control{border-color:${colorCompoundBrandStrokeHover}}:host([aria-checked='true']) .checked-indicator,:host([aria-checked='mixed']) .indeterminate-indicator{opacity:1}:host([aria-checked='true']) .control,:host([aria-checked='mixed']) .control{border-color:${colorCompoundBrandStroke}}:host([aria-checked='mixed']:active) .control,:host([aria-checked='true']:active) .control{border-color:${colorCompoundBrandStrokePressed}}:host([label-position='before']){flex-direction:row-reverse}:host([label-position='before']) .label{padding-inline:${spacingHorizontalS} ${spacingHorizontalXS};padding-top:${spacingVerticalS};padding-bottom:${spacingVerticalS}}:host([size='large']) .control{width:20px;height:20px}:host([size='large']) .checked-indicator{font-size:16px;height:20px}:host([aria-checked='mixed'][size='large']) .indeterminate-indicator{height:10px;width:10px}:host([shape='circular']) .control,:host([shape='circular']) .indeterminate-indicator{border-radius:${borderRadiusCircular}}:host([disabled]) .control,:host([aria-checked='mixed'][disabled]) .control,:host([aria-checked='true'][disabled]) .control{background-color:${colorTransparentBackgroundHover};border-color:${colorNeutralStrokeDisabled}}:host([aria-checked='true'][disabled]) .checked-indicator,:host([disabled]) ::slotted([slot='start']),:host([disabled]) .label,:host([aria-checked='mixed'][disabled]) .label,:host([aria-checked='true'][disabled]) .label{color:${colorNeutralForegroundDisabled}}:host([disabled]) .indeterminate-indicator{background-color:${colorNeutralForegroundDisabled}}`;
|
|
5587
|
-
|
|
5588
|
-
const definition$n = Checkbox.compose({
|
|
5533
|
+
const definition$o = Checkbox.compose({
|
|
5589
5534
|
name: `${FluentDesignSystem.prefix}-checkbox`,
|
|
5590
|
-
template: template$
|
|
5591
|
-
styles: styles$
|
|
5535
|
+
template: template$o,
|
|
5536
|
+
styles: styles$n
|
|
5592
5537
|
});
|
|
5593
5538
|
|
|
5594
|
-
definition$
|
|
5539
|
+
definition$o.define(FluentDesignSystem.registry);
|
|
5595
5540
|
|
|
5596
5541
|
class CompoundButton extends Button {}
|
|
5597
5542
|
|
|
5598
|
-
const styles$
|
|
5599
|
-
${styles$
|
|
5543
|
+
const styles$m = css`
|
|
5544
|
+
${styles$o}
|
|
5600
5545
|
|
|
5601
5546
|
: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([size='large']) ::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([appearance='primary'],[appearance='primary']:hover,[appearance='primary']:active))
|
|
5602
5547
|
::slotted([slot='description']){color:${colorNeutralForegroundOnBrand}}:host(:is([appearance='subtle'],[appearance='subtle']:hover,[appearance='subtle']:active))
|
|
@@ -5606,15 +5551,15 @@ const styles$l = css`
|
|
|
5606
5551
|
function buttonTemplate(options = {}) {
|
|
5607
5552
|
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>`;
|
|
5608
5553
|
}
|
|
5609
|
-
const template$
|
|
5554
|
+
const template$n = buttonTemplate();
|
|
5610
5555
|
|
|
5611
|
-
const definition$
|
|
5556
|
+
const definition$n = CompoundButton.compose({
|
|
5612
5557
|
name: `${FluentDesignSystem.prefix}-compound-button`,
|
|
5613
|
-
template: template$
|
|
5614
|
-
styles: styles$
|
|
5558
|
+
template: template$n,
|
|
5559
|
+
styles: styles$m
|
|
5615
5560
|
});
|
|
5616
5561
|
|
|
5617
|
-
definition$
|
|
5562
|
+
definition$n.define(FluentDesignSystem.registry);
|
|
5618
5563
|
|
|
5619
5564
|
var __defProp$k = Object.defineProperty;
|
|
5620
5565
|
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
@@ -5672,7 +5617,7 @@ __decorateClass$k([attr({
|
|
|
5672
5617
|
})], CounterBadge.prototype, "dot", 2);
|
|
5673
5618
|
applyMixins(CounterBadge, StartEnd);
|
|
5674
5619
|
|
|
5675
|
-
const styles$
|
|
5620
|
+
const styles$l = css`
|
|
5676
5621
|
:host([shape='rounded']){border-radius:${borderRadiusMedium}}:host([shape='rounded'][size='tiny']),:host([shape='rounded'][size='extra-small']),:host([shape='rounded'][size='small']){border-radius:${borderRadiusSmall}}${badgeSizeStyles}
|
|
5677
5622
|
${badgeFilledStyles}
|
|
5678
5623
|
${badgeGhostStyles}
|
|
@@ -5685,15 +5630,15 @@ function composeTemplate(options = {}) {
|
|
|
5685
5630
|
defaultContent: html`${x => x.setCount()}`
|
|
5686
5631
|
});
|
|
5687
5632
|
}
|
|
5688
|
-
const template$
|
|
5633
|
+
const template$m = composeTemplate();
|
|
5689
5634
|
|
|
5690
|
-
const definition$
|
|
5635
|
+
const definition$m = CounterBadge.compose({
|
|
5691
5636
|
name: `${FluentDesignSystem.prefix}-counter-badge`,
|
|
5692
|
-
template: template$
|
|
5693
|
-
styles: styles$
|
|
5637
|
+
template: template$m,
|
|
5638
|
+
styles: styles$l
|
|
5694
5639
|
});
|
|
5695
5640
|
|
|
5696
|
-
definition$
|
|
5641
|
+
definition$m.define(FluentDesignSystem.registry);
|
|
5697
5642
|
|
|
5698
5643
|
const DialogType = {
|
|
5699
5644
|
modal: "modal",
|
|
@@ -5783,18 +5728,19 @@ __decorateClass$j([attr({
|
|
|
5783
5728
|
})], Dialog.prototype, "ariaLabelledby", 2);
|
|
5784
5729
|
__decorateClass$j([attr], Dialog.prototype, "type", 2);
|
|
5785
5730
|
|
|
5786
|
-
const template$
|
|
5731
|
+
const template$l = 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>`;
|
|
5787
5732
|
|
|
5788
|
-
const styles$
|
|
5789
|
-
@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
|
|
5733
|
+
const styles$k = css`
|
|
5734
|
+
@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`
|
|
5735
|
+
@layer base{dialog{border:${strokeWidthThin} solid ${colorTransparentStroke}}}`));
|
|
5790
5736
|
|
|
5791
|
-
const definition$
|
|
5737
|
+
const definition$l = Dialog.compose({
|
|
5792
5738
|
name: `${FluentDesignSystem.prefix}-dialog`,
|
|
5793
|
-
template: template$
|
|
5794
|
-
styles: styles$
|
|
5739
|
+
template: template$l,
|
|
5740
|
+
styles: styles$k
|
|
5795
5741
|
});
|
|
5796
5742
|
|
|
5797
|
-
definition$
|
|
5743
|
+
definition$l.define(FluentDesignSystem.registry);
|
|
5798
5744
|
|
|
5799
5745
|
var __defProp$i = Object.defineProperty;
|
|
5800
5746
|
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
@@ -5829,20 +5775,20 @@ const dismissed16Regular = html.partial(`
|
|
|
5829
5775
|
fill="currentColor"
|
|
5830
5776
|
></path>
|
|
5831
5777
|
</svg>`);
|
|
5832
|
-
const template$
|
|
5778
|
+
const template$k = html`<div class="title" part="title"><slot name="title"></slot><slot name="title-action"><fluent-button ?hidden=${x => x.noTitleAction || x.parentNode?.type !== DialogType.nonModal} 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>`;
|
|
5833
5779
|
|
|
5834
|
-
const styles$
|
|
5780
|
+
const styles$j = css`
|
|
5835
5781
|
${display("grid")}
|
|
5836
5782
|
|
|
5837
5783
|
: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}}}`;
|
|
5838
5784
|
|
|
5839
|
-
const definition$
|
|
5785
|
+
const definition$k = DialogBody.compose({
|
|
5840
5786
|
name: `${FluentDesignSystem.prefix}-dialog-body`,
|
|
5841
|
-
template: template$
|
|
5842
|
-
styles: styles$
|
|
5787
|
+
template: template$k,
|
|
5788
|
+
styles: styles$j
|
|
5843
5789
|
});
|
|
5844
5790
|
|
|
5845
|
-
definition$
|
|
5791
|
+
definition$k.define(FluentDesignSystem.registry);
|
|
5846
5792
|
|
|
5847
5793
|
const DividerRole = {
|
|
5848
5794
|
/**
|
|
@@ -5884,21 +5830,40 @@ __decorateClass$h([attr({
|
|
|
5884
5830
|
function dividerTemplate() {
|
|
5885
5831
|
return html`<template role="${x => x.role}" aria-orientation="${x => x.role !== DividerRole.presentation ? x.orientation : void 0}"><slot></slot></template>`;
|
|
5886
5832
|
}
|
|
5887
|
-
const template$
|
|
5833
|
+
const template$j = dividerTemplate();
|
|
5888
5834
|
|
|
5889
|
-
const styles$
|
|
5835
|
+
const styles$i = css`
|
|
5890
5836
|
${display("flex")}
|
|
5891
5837
|
|
|
5892
5838
|
: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([inset]){padding:0 12px}:host ::slotted(*){color:${colorNeutralForeground2};font-family:${fontFamilyBase};font-size:${fontSizeBase200};font-weight:${fontWeightRegular};margin:0;padding:0 12px}:host([align-content='start'])::before,:host([align-content='end'])::after{flex-basis:12px;flex-grow:0;flex-shrink:0}:host([orientation='vertical']){height:100%;min-height:84px}:host([orientation='vertical']):empty{min-height:20px}:host([orientation='vertical']){flex-direction:column;align-items:center}:host([orientation='vertical'][inset])::before{margin-top:12px}:host([orientation='vertical'][inset])::after{margin-bottom:12px}:host([orientation='vertical']):empty::before,:host([orientation='vertical']):empty::after{height:10px;min-height:10px;flex-grow:0}:host([orientation='vertical'])::before,:host([orientation='vertical'])::after{width:${strokeWidthThin};min-height:20px;height:100%}:host([orientation='vertical']) ::slotted(*){display:flex;flex-direction:column;padding:12px 0;line-height:20px}:host([orientation='vertical'][align-content='start'])::before{min-height:8px}:host([orientation='vertical'][align-content='end'])::after{min-height:8px}:host([appearance='strong'])::before,:host([appearance='strong'])::after{background:${colorNeutralStroke1}}:host([appearance='strong']) ::slotted(*){color:${colorNeutralForeground1}}:host([appearance='brand'])::before,:host([appearance='brand'])::after{background:${colorBrandStroke1}}:host([appearance='brand']) ::slotted(*){color:${colorBrandForeground1}}:host([appearance='subtle'])::before,:host([appearance='subtle'])::after{background:${colorNeutralStroke3}}:host([appearance='subtle']) ::slotted(*){color:${colorNeutralForeground3}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
5893
5839
|
:host([appearance='strong'])::before,:host([appearance='strong'])::after,:host([appearance='brand'])::before,:host([appearance='brand'])::after,:host([appearance='subtle'])::before,:host([appearance='subtle'])::after,:host::after,:host::before{background:WindowText;color:WindowText}`));
|
|
5894
5840
|
|
|
5895
|
-
const definition$
|
|
5841
|
+
const definition$j = Divider.compose({
|
|
5896
5842
|
name: `${FluentDesignSystem.prefix}-divider`,
|
|
5897
|
-
template: template$
|
|
5898
|
-
styles: styles$
|
|
5843
|
+
template: template$j,
|
|
5844
|
+
styles: styles$i
|
|
5899
5845
|
});
|
|
5900
5846
|
|
|
5901
|
-
definition$
|
|
5847
|
+
definition$j.define(FluentDesignSystem.registry);
|
|
5848
|
+
|
|
5849
|
+
const LabelPosition = {
|
|
5850
|
+
above: "above",
|
|
5851
|
+
after: "after",
|
|
5852
|
+
before: "before"
|
|
5853
|
+
};
|
|
5854
|
+
const ValidationFlags = {
|
|
5855
|
+
badInput: "bad-input",
|
|
5856
|
+
customError: "custom-error",
|
|
5857
|
+
patternMismatch: "pattern-mismatch",
|
|
5858
|
+
rangeOverflow: "range-overflow",
|
|
5859
|
+
rangeUnderflow: "range-underflow",
|
|
5860
|
+
stepMismatch: "step-mismatch",
|
|
5861
|
+
tooLong: "too-long",
|
|
5862
|
+
tooShort: "too-short",
|
|
5863
|
+
typeMismatch: "type-mismatch",
|
|
5864
|
+
valueMissing: "value-missing",
|
|
5865
|
+
valid: "valid"
|
|
5866
|
+
};
|
|
5902
5867
|
|
|
5903
5868
|
var __defProp$g = Object.defineProperty;
|
|
5904
5869
|
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
@@ -5908,18 +5873,190 @@ var __decorateClass$g = (decorators, target, key, kind) => {
|
|
|
5908
5873
|
if (kind && result) __defProp$g(target, key, result);
|
|
5909
5874
|
return result;
|
|
5910
5875
|
};
|
|
5911
|
-
class
|
|
5876
|
+
class Field extends FASTElement {
|
|
5877
|
+
constructor() {
|
|
5878
|
+
super(...arguments);
|
|
5879
|
+
this.labelPosition = LabelPosition.above;
|
|
5880
|
+
/**
|
|
5881
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
5882
|
+
*
|
|
5883
|
+
* @internal
|
|
5884
|
+
*/
|
|
5885
|
+
this.elementInternals = this.attachInternals();
|
|
5886
|
+
}
|
|
5887
|
+
/**
|
|
5888
|
+
* Adds or removes the `invalid` event listener based on the presence of slotted message elements.
|
|
5889
|
+
*
|
|
5890
|
+
* @param prev - the previous list of slotted message elements
|
|
5891
|
+
* @param next - the current list of slotted message elements
|
|
5892
|
+
* @internal
|
|
5893
|
+
*/
|
|
5894
|
+
messageSlotChanged(prev, next) {
|
|
5895
|
+
if (!next.length) {
|
|
5896
|
+
this.removeEventListener("invalid", this.invalidHandler, {
|
|
5897
|
+
capture: true
|
|
5898
|
+
});
|
|
5899
|
+
return;
|
|
5900
|
+
}
|
|
5901
|
+
this.addEventListener("invalid", this.invalidHandler, {
|
|
5902
|
+
capture: true
|
|
5903
|
+
});
|
|
5904
|
+
}
|
|
5905
|
+
/**
|
|
5906
|
+
* Sets the `input` property to the first slotted input.
|
|
5907
|
+
*
|
|
5908
|
+
* @param prev - The previous collection of inputs.
|
|
5909
|
+
* @param next - The current collection of inputs.
|
|
5910
|
+
* @internal
|
|
5911
|
+
*/
|
|
5912
|
+
slottedInputsChanged(prev, next) {
|
|
5913
|
+
this.input = next?.[0];
|
|
5914
|
+
if (this.input) {
|
|
5915
|
+
this.setStates();
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5918
|
+
/**
|
|
5919
|
+
* Calls the `setStates` method when a `change` event is emitted from the slotted input.
|
|
5920
|
+
*
|
|
5921
|
+
* @param e - the event object
|
|
5922
|
+
* @internal
|
|
5923
|
+
*/
|
|
5924
|
+
changeHandler(e) {
|
|
5925
|
+
this.setStates();
|
|
5926
|
+
}
|
|
5927
|
+
/**
|
|
5928
|
+
* Redirects `click` events to the slotted input.
|
|
5929
|
+
*
|
|
5930
|
+
* @internal
|
|
5931
|
+
*/
|
|
5932
|
+
clickHandler(e) {
|
|
5933
|
+
if (this.isSameNode(e.target)) {
|
|
5934
|
+
this.input.focus();
|
|
5935
|
+
this.input.click();
|
|
5936
|
+
return;
|
|
5937
|
+
}
|
|
5938
|
+
return true;
|
|
5939
|
+
}
|
|
5940
|
+
/**
|
|
5941
|
+
* Applies the `focus-visible` state to the element when the slotted input receives visible focus.
|
|
5942
|
+
*
|
|
5943
|
+
* @param e - the focus event
|
|
5944
|
+
* @internal
|
|
5945
|
+
*/
|
|
5946
|
+
focusinHandler(e) {
|
|
5947
|
+
if (e.target.matches(":focus-visible")) {
|
|
5948
|
+
toggleState(this.elementInternals, "focus-visible", true);
|
|
5949
|
+
}
|
|
5950
|
+
return true;
|
|
5951
|
+
}
|
|
5952
|
+
/**
|
|
5953
|
+
* Removes the `focus-visible` state from the field when a slotted input loses focus.
|
|
5954
|
+
*
|
|
5955
|
+
* @param e - the focus event
|
|
5956
|
+
* @internal
|
|
5957
|
+
*/
|
|
5958
|
+
focusoutHandler(e) {
|
|
5959
|
+
toggleState(this.elementInternals, "focus-visible", false);
|
|
5960
|
+
return true;
|
|
5961
|
+
}
|
|
5962
|
+
/**
|
|
5963
|
+
* Toggles validity state flags on the element when the slotted input emits an `invalid` event (if slotted validation messages are present).
|
|
5964
|
+
*
|
|
5965
|
+
* @param e - the event object
|
|
5966
|
+
* @internal
|
|
5967
|
+
*/
|
|
5968
|
+
invalidHandler(e) {
|
|
5969
|
+
if (this.messageSlot.length) {
|
|
5970
|
+
e.preventDefault();
|
|
5971
|
+
}
|
|
5972
|
+
this.setStates();
|
|
5973
|
+
}
|
|
5974
|
+
/**
|
|
5975
|
+
* Toggles the field's states based on the slotted input.
|
|
5976
|
+
*
|
|
5977
|
+
* @internal
|
|
5978
|
+
*/
|
|
5979
|
+
setStates() {
|
|
5980
|
+
if (this.$fastController.isConnected) {
|
|
5981
|
+
toggleState(this.elementInternals, "disabled", !!this.input.disabled);
|
|
5982
|
+
toggleState(this.elementInternals, "readonly", !!this.input.readOnly);
|
|
5983
|
+
toggleState(this.elementInternals, "required", !!this.input.required);
|
|
5984
|
+
if (!this.input.validity) {
|
|
5985
|
+
return;
|
|
5986
|
+
}
|
|
5987
|
+
for (const [flag, value] of Object.entries(ValidationFlags)) {
|
|
5988
|
+
toggleState(this.elementInternals, value, !!this.input.validity[flag]);
|
|
5989
|
+
}
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5912
5993
|
__decorateClass$g([attr({
|
|
5994
|
+
attribute: "label-position"
|
|
5995
|
+
})], Field.prototype, "labelPosition", 2);
|
|
5996
|
+
__decorateClass$g([observable], Field.prototype, "messageSlot", 2);
|
|
5997
|
+
__decorateClass$g([observable], Field.prototype, "slottedInputs", 2);
|
|
5998
|
+
|
|
5999
|
+
const disabledState = css.partial`:is([state--disabled], :state(disabled))`;
|
|
6000
|
+
const focusVisibleState = css.partial`:is([state--focus-visible], :state(focus-visible))`;
|
|
6001
|
+
const badInputState = css.partial`:is([state--${ValidationFlags.badInput}], :state(${ValidationFlags.badInput}))`;
|
|
6002
|
+
const customErrorState = css.partial`:is([state--${ValidationFlags.customError}], :state(${ValidationFlags.customError}))`;
|
|
6003
|
+
const patternMismatchState = css.partial`:is([state--${ValidationFlags.patternMismatch}], :state(${ValidationFlags.patternMismatch}))`;
|
|
6004
|
+
const rangeOverflowState = css.partial`:is([state--${ValidationFlags.rangeOverflow}], :state(${ValidationFlags.rangeOverflow}))`;
|
|
6005
|
+
const rangeUnderflowState = css.partial`:is([state--${ValidationFlags.rangeUnderflow}], :state(${ValidationFlags.rangeUnderflow}))`;
|
|
6006
|
+
const stepMismatchState = css.partial`:is([state--${ValidationFlags.stepMismatch}], :state(${ValidationFlags.stepMismatch}))`;
|
|
6007
|
+
const tooLongState = css.partial`:is([state--${ValidationFlags.tooLong}], :state(${ValidationFlags.tooLong}))`;
|
|
6008
|
+
const tooShortState = css.partial`:is([state--${ValidationFlags.tooShort}], :state(${ValidationFlags.tooShort}))`;
|
|
6009
|
+
const typeMismatchState = css.partial`:is([state--${ValidationFlags.typeMismatch}], :state(${ValidationFlags.typeMismatch}))`;
|
|
6010
|
+
const validState = css.partial`:is([state-${ValidationFlags.valid}], :state(${ValidationFlags.valid}))`;
|
|
6011
|
+
const valueMissingState = css.partial`:is([state--${ValidationFlags.valueMissing}], :state(${ValidationFlags.valueMissing}))`;
|
|
6012
|
+
const styles$h = css`
|
|
6013
|
+
${display("inline-grid")}
|
|
6014
|
+
|
|
6015
|
+
:host{align-items:center;cursor:pointer;gap:0 ${spacingHorizontalM};justify-items:start;padding:${spacingVerticalS}}:has([slot='message']){color:${colorNeutralForeground1};row-gap:${spacingVerticalS}}:not(::slotted([slot='label'])){gap:0}:host([label-position='before']){grid-template-areas:'label input' 'label message'}:host([label-position='after']){gap:0;grid-template-areas:'input label' 'message message';grid-template-columns:auto 1fr}:host([label-position='after']) ::slotted([slot='input']){margin-inline-end:${spacingHorizontalM}}:host([label-position='above']){grid-template-areas:'label' 'input' 'message';row-gap:${spacingVerticalXXS}}:host([label-position='below']){grid-template-areas:'input' 'label' 'message'}::slotted([slot='label']){cursor:pointer;grid-area:label}::slotted([slot='input']){grid-area:input}::slotted([slot='message']){margin-block-start:${spacingVerticalXXS};grid-area:message}:host(${focusVisibleState}:focus-within){border-radius:${borderRadiusMedium};outline:${strokeWidthThick} solid ${colorStrokeFocus2}}::slotted(label){display:inline-flex;color:${colorNeutralForeground1};cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};user-select:none}:host([size='small']) ::slotted(label){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']) ::slotted(label){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large']) ::slotted(label),:host([weight='semibold']) ::slotted(label){font-weight:${fontWeightSemibold}}:host(${disabledState}) ::slotted(label){color:${colorNeutralForeground1};cursor:default}::slotted([flag]){display:none}:host(${badInputState}) ::slotted([flag='${ValidationFlags.badInput}']),:host(${customErrorState}) ::slotted([flag='${ValidationFlags.customError}']),:host(${patternMismatchState}) ::slotted([flag='${ValidationFlags.patternMismatch}']),:host(${rangeOverflowState}) ::slotted([flag='${ValidationFlags.rangeOverflow}']),:host(${rangeUnderflowState}) ::slotted([flag='${ValidationFlags.rangeUnderflow}']),:host(${stepMismatchState}) ::slotted([flag='${ValidationFlags.stepMismatch}']),:host(${tooLongState}) ::slotted([flag='${ValidationFlags.tooLong}']),:host(${tooShortState}) ::slotted([flag='${ValidationFlags.tooShort}']),:host(${typeMismatchState}) ::slotted([flag='${ValidationFlags.typeMismatch}']),:host(${valueMissingState}) ::slotted([flag='${ValidationFlags.valueMissing}']),:host(${validState}) ::slotted([flag='${ValidationFlags.valid}']){display:block}`;
|
|
6016
|
+
|
|
6017
|
+
const template$i = html`<template @click="${(x, c) => x.clickHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" ${children({
|
|
6018
|
+
property: "slottedInputs",
|
|
6019
|
+
attributes: true,
|
|
6020
|
+
attributeFilter: ["disabled", "required", "readonly"],
|
|
6021
|
+
subtree: true,
|
|
6022
|
+
selector: '[slot="input"]',
|
|
6023
|
+
filter: elements()
|
|
6024
|
+
})}><slot name="label" part="label"></slot><slot name="input" part="input"></slot><slot name="message" part="message" ${slotted({
|
|
6025
|
+
property: "messageSlot",
|
|
6026
|
+
filter: elements("[flag]")
|
|
6027
|
+
})}></slot></template>`;
|
|
6028
|
+
|
|
6029
|
+
const definition$i = Field.compose({
|
|
6030
|
+
name: `${FluentDesignSystem.prefix}-field`,
|
|
6031
|
+
template: template$i,
|
|
6032
|
+
styles: styles$h,
|
|
6033
|
+
shadowOptions: {
|
|
6034
|
+
delegatesFocus: true
|
|
6035
|
+
}
|
|
6036
|
+
});
|
|
6037
|
+
|
|
6038
|
+
definition$i.define(FluentDesignSystem.registry);
|
|
6039
|
+
|
|
6040
|
+
var __defProp$f = Object.defineProperty;
|
|
6041
|
+
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
6042
|
+
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
6043
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
|
|
6044
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6045
|
+
if (kind && result) __defProp$f(target, key, result);
|
|
6046
|
+
return result;
|
|
6047
|
+
};
|
|
6048
|
+
class Image extends FASTElement {}
|
|
6049
|
+
__decorateClass$f([attr({
|
|
5913
6050
|
mode: "boolean"
|
|
5914
6051
|
})], Image.prototype, "block", 2);
|
|
5915
|
-
__decorateClass$
|
|
6052
|
+
__decorateClass$f([attr({
|
|
5916
6053
|
mode: "boolean"
|
|
5917
6054
|
})], Image.prototype, "bordered", 2);
|
|
5918
|
-
__decorateClass$
|
|
6055
|
+
__decorateClass$f([attr({
|
|
5919
6056
|
mode: "boolean"
|
|
5920
6057
|
})], Image.prototype, "shadow", 2);
|
|
5921
|
-
__decorateClass$
|
|
5922
|
-
__decorateClass$
|
|
6058
|
+
__decorateClass$f([attr], Image.prototype, "fit", 2);
|
|
6059
|
+
__decorateClass$f([attr], Image.prototype, "shape", 2);
|
|
5923
6060
|
|
|
5924
6061
|
const template$h = html`<slot></slot>`;
|
|
5925
6062
|
|
|
@@ -5934,12 +6071,12 @@ const definition$h = Image.compose({
|
|
|
5934
6071
|
|
|
5935
6072
|
definition$h.define(FluentDesignSystem.registry);
|
|
5936
6073
|
|
|
5937
|
-
var __defProp$
|
|
5938
|
-
var __getOwnPropDesc$
|
|
5939
|
-
var __decorateClass$
|
|
5940
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6074
|
+
var __defProp$e = Object.defineProperty;
|
|
6075
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
6076
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
6077
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
5941
6078
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5942
|
-
if (kind && result) __defProp$
|
|
6079
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
5943
6080
|
return result;
|
|
5944
6081
|
};
|
|
5945
6082
|
class Label extends FASTElement {
|
|
@@ -5949,19 +6086,19 @@ class Label extends FASTElement {
|
|
|
5949
6086
|
this.required = false;
|
|
5950
6087
|
}
|
|
5951
6088
|
}
|
|
5952
|
-
__decorateClass$
|
|
5953
|
-
__decorateClass$
|
|
5954
|
-
__decorateClass$
|
|
6089
|
+
__decorateClass$e([attr], Label.prototype, "size", 2);
|
|
6090
|
+
__decorateClass$e([attr], Label.prototype, "weight", 2);
|
|
6091
|
+
__decorateClass$e([attr({
|
|
5955
6092
|
mode: "boolean"
|
|
5956
6093
|
})], Label.prototype, "disabled", 2);
|
|
5957
|
-
__decorateClass$
|
|
6094
|
+
__decorateClass$e([attr({
|
|
5958
6095
|
mode: "boolean"
|
|
5959
6096
|
})], Label.prototype, "required", 2);
|
|
5960
6097
|
|
|
5961
6098
|
const styles$f = css`
|
|
5962
|
-
${display("flex")}
|
|
6099
|
+
${display("inline-flex")}
|
|
5963
6100
|
|
|
5964
|
-
:host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};
|
|
6101
|
+
:host{color:${colorNeutralForeground1};cursor:pointer;font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};user-select:none}.asterisk{color:${colorPaletteRedForeground1};margin-inline-start:${spacingHorizontalXS}}:host([size='small']){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='large']){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='large']),:host([weight='semibold']){font-weight:${fontWeightSemibold}}:host([disabled]),:host([disabled]) .asterisk{color:${colorNeutralForegroundDisabled}}`;
|
|
5965
6102
|
|
|
5966
6103
|
function labelTemplate() {
|
|
5967
6104
|
return html`<slot></slot><span part="asterisk" class="asterisk" ?hidden="${x => !x.required}">*</span>`;
|
|
@@ -5990,7 +6127,7 @@ const template$f = buttonTemplate$1({
|
|
|
5990
6127
|
const definition$f = MenuButton.compose({
|
|
5991
6128
|
name: `${FluentDesignSystem.prefix}-menu-button`,
|
|
5992
6129
|
template: template$f,
|
|
5993
|
-
styles: styles$
|
|
6130
|
+
styles: styles$o
|
|
5994
6131
|
});
|
|
5995
6132
|
|
|
5996
6133
|
definition$f.define(FluentDesignSystem.registry);
|
|
@@ -6821,1124 +6958,1560 @@ const O = {
|
|
|
6821
6958
|
x: 0,
|
|
6822
6959
|
y: 0
|
|
6823
6960
|
};
|
|
6824
|
-
if ((i || !i && "fixed" !== o) && (("body" !== s(n) || g(r)) && (l = T(n)), a(n))) {
|
|
6825
|
-
const t = E(n);
|
|
6826
|
-
c = L(n), f.x = t.x + n.clientLeft, f.y = t.y + n.clientTop;
|
|
6827
|
-
}
|
|
6828
|
-
return {
|
|
6829
|
-
width: e.width * c.x,
|
|
6830
|
-
height: e.height * c.y,
|
|
6831
|
-
x: e.x * c.x - l.scrollLeft * c.x + f.x,
|
|
6832
|
-
y: e.y * c.y - l.scrollTop * c.y + f.y
|
|
6961
|
+
if ((i || !i && "fixed" !== o) && (("body" !== s(n) || g(r)) && (l = T(n)), a(n))) {
|
|
6962
|
+
const t = E(n);
|
|
6963
|
+
c = L(n), f.x = t.x + n.clientLeft, f.y = t.y + n.clientTop;
|
|
6964
|
+
}
|
|
6965
|
+
return {
|
|
6966
|
+
width: e.width * c.x,
|
|
6967
|
+
height: e.height * c.y,
|
|
6968
|
+
x: e.x * c.x - l.scrollLeft * c.x + f.x,
|
|
6969
|
+
y: e.y * c.y - l.scrollTop * c.y + f.y
|
|
6970
|
+
};
|
|
6971
|
+
},
|
|
6972
|
+
isElement: d,
|
|
6973
|
+
getDimensions: function (t) {
|
|
6974
|
+
return a(t) ? c(t) : t.getBoundingClientRect();
|
|
6975
|
+
},
|
|
6976
|
+
getOffsetParent: H,
|
|
6977
|
+
getDocumentElement: R,
|
|
6978
|
+
getScale: L,
|
|
6979
|
+
async getElementRects(t) {
|
|
6980
|
+
let {
|
|
6981
|
+
reference: e,
|
|
6982
|
+
floating: n,
|
|
6983
|
+
strategy: o
|
|
6984
|
+
} = t;
|
|
6985
|
+
const i = this.getOffsetParent || H,
|
|
6986
|
+
r = this.getDimensions;
|
|
6987
|
+
return {
|
|
6988
|
+
reference: V(e, await i(n), o),
|
|
6989
|
+
floating: {
|
|
6990
|
+
x: 0,
|
|
6991
|
+
y: 0,
|
|
6992
|
+
...(await r(n))
|
|
6993
|
+
}
|
|
6994
|
+
};
|
|
6995
|
+
},
|
|
6996
|
+
getClientRects: t => Array.from(t.getClientRects()),
|
|
6997
|
+
isRTL: t => "rtl" === o(t).direction
|
|
6998
|
+
};
|
|
6999
|
+
function P(t, e, n, o) {
|
|
7000
|
+
void 0 === o && (o = {});
|
|
7001
|
+
const {
|
|
7002
|
+
ancestorScroll: i = !0,
|
|
7003
|
+
ancestorResize: r = !0,
|
|
7004
|
+
elementResize: l = !0,
|
|
7005
|
+
animationFrame: c = !1
|
|
7006
|
+
} = o,
|
|
7007
|
+
s = i && !c,
|
|
7008
|
+
f = s || r ? [...(d(t) ? D(t) : t.contextElement ? D(t.contextElement) : []), ...D(e)] : [];
|
|
7009
|
+
f.forEach(t => {
|
|
7010
|
+
s && t.addEventListener("scroll", n, {
|
|
7011
|
+
passive: !0
|
|
7012
|
+
}), r && t.addEventListener("resize", n);
|
|
7013
|
+
});
|
|
7014
|
+
let u,
|
|
7015
|
+
a = null;
|
|
7016
|
+
if (l) {
|
|
7017
|
+
let o = !0;
|
|
7018
|
+
a = new ResizeObserver(() => {
|
|
7019
|
+
o || n(), o = !1;
|
|
7020
|
+
}), d(t) && !c && a.observe(t), d(t) || !t.contextElement || c || a.observe(t.contextElement), a.observe(e);
|
|
7021
|
+
}
|
|
7022
|
+
let h = c ? E(t) : null;
|
|
7023
|
+
return c && function e() {
|
|
7024
|
+
const o = E(t);
|
|
7025
|
+
!h || o.x === h.x && o.y === h.y && o.width === h.width && o.height === h.height || n();
|
|
7026
|
+
h = o, u = requestAnimationFrame(e);
|
|
7027
|
+
}(), n(), () => {
|
|
7028
|
+
var t;
|
|
7029
|
+
f.forEach(t => {
|
|
7030
|
+
s && t.removeEventListener("scroll", n), r && t.removeEventListener("resize", n);
|
|
7031
|
+
}), null == (t = a) || t.disconnect(), a = null, c && cancelAnimationFrame(u);
|
|
7032
|
+
};
|
|
7033
|
+
}
|
|
7034
|
+
const z = (t, n, o) => {
|
|
7035
|
+
const i = new Map(),
|
|
7036
|
+
r = {
|
|
7037
|
+
platform: O,
|
|
7038
|
+
...o
|
|
7039
|
+
},
|
|
7040
|
+
l = {
|
|
7041
|
+
...r.platform,
|
|
7042
|
+
_c: i
|
|
7043
|
+
};
|
|
7044
|
+
return i$1(t, n, {
|
|
7045
|
+
...r,
|
|
7046
|
+
platform: l
|
|
7047
|
+
});
|
|
7048
|
+
};
|
|
7049
|
+
|
|
7050
|
+
const MenuItemRole = {
|
|
7051
|
+
/**
|
|
7052
|
+
* The menu item has a "menuitem" role
|
|
7053
|
+
*/
|
|
7054
|
+
menuitem: "menuitem",
|
|
7055
|
+
/**
|
|
7056
|
+
* The menu item has a "menuitemcheckbox" role
|
|
7057
|
+
*/
|
|
7058
|
+
menuitemcheckbox: "menuitemcheckbox",
|
|
7059
|
+
/**
|
|
7060
|
+
* The menu item has a "menuitemradio" role
|
|
7061
|
+
*/
|
|
7062
|
+
menuitemradio: "menuitemradio"
|
|
7063
|
+
};
|
|
7064
|
+
({
|
|
7065
|
+
[MenuItemRole.menuitem]: "menuitem",
|
|
7066
|
+
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
7067
|
+
[MenuItemRole.menuitemradio]: "menuitemradio"
|
|
7068
|
+
});
|
|
7069
|
+
|
|
7070
|
+
var __defProp$d = Object.defineProperty;
|
|
7071
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
7072
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
7073
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
7074
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7075
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
7076
|
+
return result;
|
|
7077
|
+
};
|
|
7078
|
+
class MenuItem extends FASTElement {
|
|
7079
|
+
constructor() {
|
|
7080
|
+
super(...arguments);
|
|
7081
|
+
this.role = MenuItemRole.menuitem;
|
|
7082
|
+
this.checked = false;
|
|
7083
|
+
this.focusSubmenuOnLoad = false;
|
|
7084
|
+
/**
|
|
7085
|
+
* @internal
|
|
7086
|
+
*/
|
|
7087
|
+
this.handleMenuItemKeyDown = e => {
|
|
7088
|
+
if (e.defaultPrevented) {
|
|
7089
|
+
return false;
|
|
7090
|
+
}
|
|
7091
|
+
switch (e.key) {
|
|
7092
|
+
case keyEnter:
|
|
7093
|
+
case keySpace:
|
|
7094
|
+
this.invoke();
|
|
7095
|
+
return false;
|
|
7096
|
+
case keyArrowRight:
|
|
7097
|
+
this.expanded && this.submenu ? this.submenu.focus() : this.expandAndFocus();
|
|
7098
|
+
return false;
|
|
7099
|
+
case keyEscape:
|
|
7100
|
+
if (this.expanded) {
|
|
7101
|
+
this.closeSubMenu();
|
|
7102
|
+
return false;
|
|
7103
|
+
}
|
|
7104
|
+
break;
|
|
7105
|
+
case keyArrowLeft:
|
|
7106
|
+
if (this.expanded) {
|
|
7107
|
+
this.closeSubMenu();
|
|
7108
|
+
return false;
|
|
7109
|
+
}
|
|
7110
|
+
}
|
|
7111
|
+
return true;
|
|
7112
|
+
};
|
|
7113
|
+
/**
|
|
7114
|
+
* @internal
|
|
7115
|
+
*/
|
|
7116
|
+
this.handleMenuItemClick = e => {
|
|
7117
|
+
if (e.defaultPrevented || this.disabled) {
|
|
7118
|
+
return false;
|
|
7119
|
+
}
|
|
7120
|
+
this.invoke();
|
|
7121
|
+
return false;
|
|
7122
|
+
};
|
|
7123
|
+
/**
|
|
7124
|
+
* @internal
|
|
7125
|
+
*/
|
|
7126
|
+
this.submenuLoaded = () => {
|
|
7127
|
+
if (!this.focusSubmenuOnLoad) {
|
|
7128
|
+
return;
|
|
7129
|
+
}
|
|
7130
|
+
this.focusSubmenuOnLoad = false;
|
|
7131
|
+
if (this.submenu) {
|
|
7132
|
+
this.submenu.focus();
|
|
7133
|
+
this.setAttribute("tabindex", "-1");
|
|
7134
|
+
}
|
|
7135
|
+
};
|
|
7136
|
+
/**
|
|
7137
|
+
* @internal
|
|
7138
|
+
*/
|
|
7139
|
+
this.handleMouseOver = e => {
|
|
7140
|
+
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
7141
|
+
return false;
|
|
7142
|
+
}
|
|
7143
|
+
this.expanded = true;
|
|
7144
|
+
return false;
|
|
7145
|
+
};
|
|
7146
|
+
/**
|
|
7147
|
+
* @internal
|
|
7148
|
+
*/
|
|
7149
|
+
this.handleMouseOut = e => {
|
|
7150
|
+
if (!this.expanded || this.contains(document.activeElement)) {
|
|
7151
|
+
return false;
|
|
7152
|
+
}
|
|
7153
|
+
this.expanded = false;
|
|
7154
|
+
return false;
|
|
7155
|
+
};
|
|
7156
|
+
/**
|
|
7157
|
+
* @internal
|
|
7158
|
+
*/
|
|
7159
|
+
this.closeSubMenu = () => {
|
|
7160
|
+
this.expanded = false;
|
|
7161
|
+
this.focus();
|
|
7162
|
+
};
|
|
7163
|
+
/**
|
|
7164
|
+
* @internal
|
|
7165
|
+
*/
|
|
7166
|
+
this.expandAndFocus = () => {
|
|
7167
|
+
if (!this.hasSubmenu) {
|
|
7168
|
+
return;
|
|
7169
|
+
}
|
|
7170
|
+
this.focusSubmenuOnLoad = true;
|
|
7171
|
+
this.expanded = true;
|
|
7172
|
+
};
|
|
7173
|
+
/**
|
|
7174
|
+
* @internal
|
|
7175
|
+
*/
|
|
7176
|
+
this.invoke = () => {
|
|
7177
|
+
if (this.disabled) {
|
|
7178
|
+
return;
|
|
7179
|
+
}
|
|
7180
|
+
switch (this.role) {
|
|
7181
|
+
case MenuItemRole.menuitemcheckbox:
|
|
7182
|
+
this.checked = !this.checked;
|
|
7183
|
+
break;
|
|
7184
|
+
case MenuItemRole.menuitem:
|
|
7185
|
+
if (this.hasSubmenu) {
|
|
7186
|
+
this.expandAndFocus();
|
|
7187
|
+
break;
|
|
7188
|
+
}
|
|
7189
|
+
this.$emit("change");
|
|
7190
|
+
break;
|
|
7191
|
+
case MenuItemRole.menuitemradio:
|
|
7192
|
+
if (!this.checked) {
|
|
7193
|
+
this.checked = true;
|
|
7194
|
+
}
|
|
7195
|
+
break;
|
|
7196
|
+
}
|
|
7197
|
+
};
|
|
7198
|
+
}
|
|
7199
|
+
expandedChanged(prev, next) {
|
|
7200
|
+
if (this.$fastController.isConnected) {
|
|
7201
|
+
if (next && this.submenu) {
|
|
7202
|
+
this.updateSubmenu();
|
|
7203
|
+
}
|
|
7204
|
+
this.$emit("expanded-change", this, {
|
|
7205
|
+
bubbles: false
|
|
7206
|
+
});
|
|
7207
|
+
}
|
|
7208
|
+
}
|
|
7209
|
+
checkedChanged(oldValue, newValue) {
|
|
7210
|
+
if (this.$fastController.isConnected) {
|
|
7211
|
+
this.$emit("change");
|
|
7212
|
+
}
|
|
7213
|
+
}
|
|
7214
|
+
/**
|
|
7215
|
+
* @internal
|
|
7216
|
+
*/
|
|
7217
|
+
get hasSubmenu() {
|
|
7218
|
+
return !!this.submenu;
|
|
7219
|
+
}
|
|
7220
|
+
/**
|
|
7221
|
+
* Sets the submenu and updates its position.
|
|
7222
|
+
*
|
|
7223
|
+
* @internal
|
|
7224
|
+
*/
|
|
7225
|
+
slottedSubmenuChanged(prev, next) {
|
|
7226
|
+
if (next.length) {
|
|
7227
|
+
this.submenu = next[0];
|
|
7228
|
+
this.updateSubmenu();
|
|
7229
|
+
}
|
|
7230
|
+
}
|
|
7231
|
+
/**
|
|
7232
|
+
* @internal
|
|
7233
|
+
*/
|
|
7234
|
+
disconnectedCallback() {
|
|
7235
|
+
this.cleanup?.();
|
|
7236
|
+
super.disconnectedCallback();
|
|
7237
|
+
}
|
|
7238
|
+
/**
|
|
7239
|
+
* Calculate and apply submenu positioning.
|
|
7240
|
+
*
|
|
7241
|
+
* @public
|
|
7242
|
+
*/
|
|
7243
|
+
updateSubmenu() {
|
|
7244
|
+
this.cleanup?.();
|
|
7245
|
+
if (!this.submenu || !this.expanded) {
|
|
7246
|
+
return;
|
|
7247
|
+
}
|
|
7248
|
+
Updates.enqueue(() => {
|
|
7249
|
+
this.cleanup = P(this, this.submenuContainer, async () => {
|
|
7250
|
+
const fallbackPlacements = ["left-start", "right-start"];
|
|
7251
|
+
const {
|
|
7252
|
+
x,
|
|
7253
|
+
y
|
|
7254
|
+
} = await z(this, this.submenuContainer, {
|
|
7255
|
+
middleware: [E$1(), k({
|
|
7256
|
+
apply: ({
|
|
7257
|
+
availableWidth,
|
|
7258
|
+
rects
|
|
7259
|
+
}) => {
|
|
7260
|
+
if (availableWidth < rects.floating.width) {
|
|
7261
|
+
fallbackPlacements.push("bottom-end", "top-end");
|
|
7262
|
+
}
|
|
7263
|
+
}
|
|
7264
|
+
}), b$1({
|
|
7265
|
+
fallbackPlacements
|
|
7266
|
+
})],
|
|
7267
|
+
placement: "right-start",
|
|
7268
|
+
strategy: "fixed"
|
|
7269
|
+
});
|
|
7270
|
+
Object.assign(this.submenuContainer.style, {
|
|
7271
|
+
left: `${x}px`,
|
|
7272
|
+
position: "fixed",
|
|
7273
|
+
top: `${y}px`
|
|
7274
|
+
});
|
|
7275
|
+
this.submenuLoaded();
|
|
7276
|
+
});
|
|
7277
|
+
});
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
__decorateClass$d([attr({
|
|
7281
|
+
mode: "boolean"
|
|
7282
|
+
})], MenuItem.prototype, "disabled", 2);
|
|
7283
|
+
__decorateClass$d([attr({
|
|
7284
|
+
mode: "boolean"
|
|
7285
|
+
})], MenuItem.prototype, "expanded", 2);
|
|
7286
|
+
__decorateClass$d([attr], MenuItem.prototype, "role", 2);
|
|
7287
|
+
__decorateClass$d([attr({
|
|
7288
|
+
mode: "boolean"
|
|
7289
|
+
})], MenuItem.prototype, "checked", 2);
|
|
7290
|
+
__decorateClass$d([attr({
|
|
7291
|
+
mode: "boolean"
|
|
7292
|
+
})], MenuItem.prototype, "hidden", 2);
|
|
7293
|
+
__decorateClass$d([observable], MenuItem.prototype, "slottedSubmenu", 2);
|
|
7294
|
+
__decorateClass$d([observable], MenuItem.prototype, "submenu", 2);
|
|
7295
|
+
applyMixins(MenuItem, StartEnd);
|
|
7296
|
+
|
|
7297
|
+
const styles$e = css`
|
|
7298
|
+
${display("grid")}
|
|
7299
|
+
|
|
7300
|
+
:host{grid-template-columns:20px 20px auto 20px;align-items:center;grid-gap:4px;height:32px;background:${colorNeutralBackground1};font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};padding:0 10px;cursor:pointer;overflow:visible;contain:layout}:host(:hover){background:${colorNeutralBackground1Hover}}.content{white-space:nowrap;flex-grow:1;grid-column:auto / span 2;padding:0 2px}.checkbox,.radio{display:none}.input-container,.expand-collapse-glyph-container,::slotted([slot='start']),::slotted([slot='end']),:host([checked]) .checkbox,:host([checked]) .radio{display:inline-flex;justify-content:center;align-items:center;color:${colorNeutralForeground2}}.expand-collapse-glyph-container,::slotted([slot='start']),::slotted([slot='end']){height:32px;font-size:${fontSizeBase500};width:fit-content}.input-container{width:20px}::slotted([slot='end']){color:${colorNeutralForeground3};font:${fontWeightRegular} ${fontSizeBase200} / ${lineHeightBase200} ${fontFamilyBase};white-space:nowrap;grid-column:4 / span 1;justify-self:flex-end}.expand-collapse-glyph-container{grid-column:4 / span 1;justify-self:flex-end}:host(:hover) .input-container,:host(:hover) .expand-collapse-glyph-container,:host(:hover) .content{color:${colorNeutralForeground2Hover}}:host([icon]:hover) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Hover}}:host(:active){background-color:${colorNeutralBackground1Selected}}:host(:active) .input-container,:host(:active) .expand-collapse-glyph-container,:host(:active) .content{color:${colorNeutralForeground2Pressed}}:host(:active) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Pressed}}:host([disabled]){background-color:${colorNeutralBackgroundDisabled}}:host([disabled]) .content,:host([disabled]) .expand-collapse-glyph-container,:host([disabled]) ::slotted([slot='end']),:host([disabled]) ::slotted([slot='start']){color:${colorNeutralForegroundDisabled}}:host([data-indent]){display:grid}:host([data-indent='1']) .content{grid-column:2 / span 1}:host([data-indent='1'][role='menuitemcheckbox']){display:grid}:host([data-indent='2'][aria-haspopup='menu']) ::slotted([slot='end']){grid-column:4 / span 1}:host([data-indent='2'][aria-haspopup='menu']) .expand-collapse-glyph-container{grid-column:5 / span 1}:host([data-indent='1']) .content{grid-column:2 / span 1}:host([data-indent='1'][role='menuitemcheckbox']) .content,:host([data-indent='1'][role='menuitemradio']) .content{grid-column:auto / span 1}:host([icon]) ::slotted([slot='end']),:host([data-indent='1']) ::slotted([slot='end']){grid-column:4 / span 1;justify-self:flex-end}:host([data-indent='2']){display:grid;grid-template-columns:20px 20px auto auto}:host([data-indent='2']) .content{grid-column:3 / span 1}:host([data-indent='2']) .input-container{grid-column:1 / span 1}:host([data-indent='2']) ::slotted([slot='start']){grid-column:2 / span 1}:host([aria-haspopup='menu']){grid-template-columns:20px auto auto 20px}:host([data-indent='2'][aria-haspopup='menu']){grid-template-columns:20px 20px auto auto 20px}:host([aria-haspopup='menu']) ::slotted([slot='end']){grid-column:3 / span 1;justify-self:flex-end}:host([data-indent='2'][aria-haspopup='menu']) ::slotted([slot='end']){grid-column:4 / span 1;justify-self:flex-end}`;
|
|
7301
|
+
|
|
7302
|
+
const Checkmark16Filled = html.partial(`<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" 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>`);
|
|
7303
|
+
const chevronRight16Filled = html.partial(`<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" 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>`);
|
|
7304
|
+
function menuItemTemplate(options = {}) {
|
|
7305
|
+
return html`<template aria-haspopup="${x => x.hasSubmenu ? "menu" : void 0}" aria-checked="${x => x.role !== MenuItemRole.menuitem ? x.checked : void 0}" aria-disabled="${x => x.disabled}" aria-expanded="${x => x.expanded}" @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)}">${when(x => x.role === MenuItemRole.menuitemcheckbox, html`<div part="input-container" class="input-container"><span part="checkbox" class="checkbox"><slot name="checkbox-indicator">${staticallyCompose(options.checkboxIndicator)}</slot></span></div>`)} ${when(x => x.role === MenuItemRole.menuitemradio, html`<div part="input-container" class="input-container"><span part="radio" class="radio"><slot name="radio-indicator">${staticallyCompose(options.radioIndicator)}</slot></span></div>`)}</div>${startSlotTemplate(options)}<span class="content" part="content"><slot></slot></span>${endSlotTemplate(options)} ${when(x => x.hasSubmenu, html`<div part="expand-collapse-glyph-container" class="expand-collapse-glyph-container"><span part="expand-collapse" class="expand-collapse"><slot name="expand-collapse-indicator">${staticallyCompose(options.expandCollapseGlyph)}</slot></span></div>`)}<span ?hidden="${x => !x.expanded}" class="submenu-container" part="submenu-container" ${ref("submenuContainer")}><slot name="submenu" ${slotted({
|
|
7306
|
+
property: "slottedSubmenu",
|
|
7307
|
+
filter: elements("[role='menu']")
|
|
7308
|
+
})}></slot></span></template>`;
|
|
7309
|
+
}
|
|
7310
|
+
const template$e = menuItemTemplate({
|
|
7311
|
+
checkboxIndicator: Checkmark16Filled,
|
|
7312
|
+
expandCollapseGlyph: chevronRight16Filled,
|
|
7313
|
+
radioIndicator: Checkmark16Filled
|
|
7314
|
+
});
|
|
7315
|
+
|
|
7316
|
+
const definition$e = MenuItem.compose({
|
|
7317
|
+
name: `${FluentDesignSystem.prefix}-menu-item`,
|
|
7318
|
+
template: template$e,
|
|
7319
|
+
styles: styles$e
|
|
7320
|
+
});
|
|
7321
|
+
|
|
7322
|
+
definition$e.define(FluentDesignSystem.registry);
|
|
7323
|
+
|
|
7324
|
+
var __defProp$c = Object.defineProperty;
|
|
7325
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
7326
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
7327
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
7328
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7329
|
+
if (kind && result) __defProp$c(target, key, result);
|
|
7330
|
+
return result;
|
|
7331
|
+
};
|
|
7332
|
+
const _MenuList = class _MenuList extends FASTElement {
|
|
7333
|
+
constructor() {
|
|
7334
|
+
super(...arguments);
|
|
7335
|
+
this.expandedItem = null;
|
|
7336
|
+
/**
|
|
7337
|
+
* The index of the focusable element in the items array
|
|
7338
|
+
* defaults to -1
|
|
7339
|
+
*/
|
|
7340
|
+
this.focusIndex = -1;
|
|
7341
|
+
/**
|
|
7342
|
+
* @internal
|
|
7343
|
+
*/
|
|
7344
|
+
this.isNestedMenu = () => {
|
|
7345
|
+
return this.parentElement !== null && isHTMLElement(this.parentElement) && this.parentElement.getAttribute("role") === "menuitem";
|
|
7346
|
+
};
|
|
7347
|
+
/**
|
|
7348
|
+
* if focus is moving out of the menu, reset to a stable initial state
|
|
7349
|
+
* @internal
|
|
7350
|
+
*/
|
|
7351
|
+
this.handleFocusOut = e => {
|
|
7352
|
+
if (!this.contains(e.relatedTarget) && this.menuItems !== void 0) {
|
|
7353
|
+
this.collapseExpandedItem();
|
|
7354
|
+
const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
|
|
7355
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7356
|
+
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
7357
|
+
this.focusIndex = focusIndex;
|
|
7358
|
+
}
|
|
7359
|
+
};
|
|
7360
|
+
this.handleItemFocus = e => {
|
|
7361
|
+
const targetItem = e.target;
|
|
7362
|
+
if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
|
|
7363
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7364
|
+
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
7365
|
+
targetItem.setAttribute("tabindex", "0");
|
|
7366
|
+
}
|
|
7367
|
+
};
|
|
7368
|
+
this.handleExpandedChanged = e => {
|
|
7369
|
+
if (e.defaultPrevented || e.target === null || this.menuItems === void 0 || this.menuItems.indexOf(e.target) < 0) {
|
|
7370
|
+
return;
|
|
7371
|
+
}
|
|
7372
|
+
e.preventDefault();
|
|
7373
|
+
const changedItem = e.target;
|
|
7374
|
+
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
|
|
7375
|
+
this.expandedItem = null;
|
|
7376
|
+
return;
|
|
7377
|
+
}
|
|
7378
|
+
if (changedItem.expanded) {
|
|
7379
|
+
if (this.expandedItem !== null && this.expandedItem !== changedItem) {
|
|
7380
|
+
this.expandedItem.expanded = false;
|
|
7381
|
+
}
|
|
7382
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7383
|
+
this.expandedItem = changedItem;
|
|
7384
|
+
this.focusIndex = this.menuItems.indexOf(changedItem);
|
|
7385
|
+
changedItem.setAttribute("tabindex", "0");
|
|
7386
|
+
}
|
|
7387
|
+
};
|
|
7388
|
+
/**
|
|
7389
|
+
* handle change from child element
|
|
7390
|
+
*/
|
|
7391
|
+
this.changeHandler = e => {
|
|
7392
|
+
if (this.menuItems === void 0) {
|
|
7393
|
+
return;
|
|
7394
|
+
}
|
|
7395
|
+
const changedMenuItem = e.target;
|
|
7396
|
+
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
7397
|
+
if (changeItemIndex === -1) {
|
|
7398
|
+
return;
|
|
7399
|
+
}
|
|
7400
|
+
if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked === true) {
|
|
7401
|
+
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
7402
|
+
const item = this.menuItems[i];
|
|
7403
|
+
const role = item.getAttribute("role");
|
|
7404
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
7405
|
+
item.checked = false;
|
|
7406
|
+
}
|
|
7407
|
+
if (role === "separator") {
|
|
7408
|
+
break;
|
|
7409
|
+
}
|
|
7410
|
+
}
|
|
7411
|
+
const maxIndex = this.menuItems.length - 1;
|
|
7412
|
+
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
7413
|
+
const item = this.menuItems[i];
|
|
7414
|
+
const role = item.getAttribute("role");
|
|
7415
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
7416
|
+
item.checked = false;
|
|
7417
|
+
}
|
|
7418
|
+
if (role === "separator") {
|
|
7419
|
+
break;
|
|
7420
|
+
}
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
};
|
|
7424
|
+
/**
|
|
7425
|
+
* check if the item is a menu item
|
|
7426
|
+
*/
|
|
7427
|
+
this.isMenuItemElement = el => {
|
|
7428
|
+
return el instanceof MenuItem || isHTMLElement(el) && el.getAttribute("role") in _MenuList.focusableElementRoles;
|
|
6833
7429
|
};
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
getOffsetParent: H,
|
|
6840
|
-
getDocumentElement: R,
|
|
6841
|
-
getScale: L,
|
|
6842
|
-
async getElementRects(t) {
|
|
6843
|
-
let {
|
|
6844
|
-
reference: e,
|
|
6845
|
-
floating: n,
|
|
6846
|
-
strategy: o
|
|
6847
|
-
} = t;
|
|
6848
|
-
const i = this.getOffsetParent || H,
|
|
6849
|
-
r = this.getDimensions;
|
|
6850
|
-
return {
|
|
6851
|
-
reference: V(e, await i(n), o),
|
|
6852
|
-
floating: {
|
|
6853
|
-
x: 0,
|
|
6854
|
-
y: 0,
|
|
6855
|
-
...(await r(n))
|
|
6856
|
-
}
|
|
7430
|
+
/**
|
|
7431
|
+
* check if the item is focusable
|
|
7432
|
+
*/
|
|
7433
|
+
this.isFocusableElement = el => {
|
|
7434
|
+
return this.isMenuItemElement(el);
|
|
6857
7435
|
};
|
|
6858
|
-
},
|
|
6859
|
-
getClientRects: t => Array.from(t.getClientRects()),
|
|
6860
|
-
isRTL: t => "rtl" === o(t).direction
|
|
6861
|
-
};
|
|
6862
|
-
function P(t, e, n, o) {
|
|
6863
|
-
void 0 === o && (o = {});
|
|
6864
|
-
const {
|
|
6865
|
-
ancestorScroll: i = !0,
|
|
6866
|
-
ancestorResize: r = !0,
|
|
6867
|
-
elementResize: l = !0,
|
|
6868
|
-
animationFrame: c = !1
|
|
6869
|
-
} = o,
|
|
6870
|
-
s = i && !c,
|
|
6871
|
-
f = s || r ? [...(d(t) ? D(t) : t.contextElement ? D(t.contextElement) : []), ...D(e)] : [];
|
|
6872
|
-
f.forEach(t => {
|
|
6873
|
-
s && t.addEventListener("scroll", n, {
|
|
6874
|
-
passive: !0
|
|
6875
|
-
}), r && t.addEventListener("resize", n);
|
|
6876
|
-
});
|
|
6877
|
-
let u,
|
|
6878
|
-
a = null;
|
|
6879
|
-
if (l) {
|
|
6880
|
-
let o = !0;
|
|
6881
|
-
a = new ResizeObserver(() => {
|
|
6882
|
-
o || n(), o = !1;
|
|
6883
|
-
}), d(t) && !c && a.observe(t), d(t) || !t.contextElement || c || a.observe(t.contextElement), a.observe(e);
|
|
6884
7436
|
}
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
}(), n(), () => {
|
|
6891
|
-
var t;
|
|
6892
|
-
f.forEach(t => {
|
|
6893
|
-
s && t.removeEventListener("scroll", n), r && t.removeEventListener("resize", n);
|
|
6894
|
-
}), null == (t = a) || t.disconnect(), a = null, c && cancelAnimationFrame(u);
|
|
6895
|
-
};
|
|
6896
|
-
}
|
|
6897
|
-
const z = (t, n, o) => {
|
|
6898
|
-
const i = new Map(),
|
|
6899
|
-
r = {
|
|
6900
|
-
platform: O,
|
|
6901
|
-
...o
|
|
6902
|
-
},
|
|
6903
|
-
l = {
|
|
6904
|
-
...r.platform,
|
|
6905
|
-
_c: i
|
|
6906
|
-
};
|
|
6907
|
-
return i$1(t, n, {
|
|
6908
|
-
...r,
|
|
6909
|
-
platform: l
|
|
6910
|
-
});
|
|
6911
|
-
};
|
|
6912
|
-
|
|
6913
|
-
const MenuItemRole = {
|
|
7437
|
+
itemsChanged(oldValue, newValue) {
|
|
7438
|
+
if (this.$fastController.isConnected && this.menuItems !== void 0) {
|
|
7439
|
+
this.setItems();
|
|
7440
|
+
}
|
|
7441
|
+
}
|
|
6914
7442
|
/**
|
|
6915
|
-
*
|
|
7443
|
+
* @internal
|
|
6916
7444
|
*/
|
|
6917
|
-
|
|
7445
|
+
connectedCallback() {
|
|
7446
|
+
super.connectedCallback();
|
|
7447
|
+
Updates.enqueue(() => {
|
|
7448
|
+
this.setItems();
|
|
7449
|
+
});
|
|
7450
|
+
this.addEventListener("change", this.changeHandler);
|
|
7451
|
+
}
|
|
6918
7452
|
/**
|
|
6919
|
-
*
|
|
7453
|
+
* @internal
|
|
6920
7454
|
*/
|
|
6921
|
-
|
|
7455
|
+
disconnectedCallback() {
|
|
7456
|
+
super.disconnectedCallback();
|
|
7457
|
+
this.removeItemListeners();
|
|
7458
|
+
this.menuItems = void 0;
|
|
7459
|
+
this.removeEventListener("change", this.changeHandler);
|
|
7460
|
+
}
|
|
6922
7461
|
/**
|
|
6923
|
-
*
|
|
7462
|
+
* Focuses the first item in the menu.
|
|
7463
|
+
*
|
|
7464
|
+
* @public
|
|
6924
7465
|
*/
|
|
6925
|
-
|
|
7466
|
+
focus() {
|
|
7467
|
+
this.setFocus(0, 1);
|
|
7468
|
+
}
|
|
7469
|
+
/**
|
|
7470
|
+
* Collapses any expanded menu items.
|
|
7471
|
+
*
|
|
7472
|
+
* @public
|
|
7473
|
+
*/
|
|
7474
|
+
collapseExpandedItem() {
|
|
7475
|
+
if (this.expandedItem !== null) {
|
|
7476
|
+
this.expandedItem.expanded = false;
|
|
7477
|
+
this.expandedItem = null;
|
|
7478
|
+
}
|
|
7479
|
+
}
|
|
7480
|
+
/**
|
|
7481
|
+
* @internal
|
|
7482
|
+
*/
|
|
7483
|
+
handleMenuKeyDown(e) {
|
|
7484
|
+
if (e.defaultPrevented || this.menuItems === void 0) {
|
|
7485
|
+
return;
|
|
7486
|
+
}
|
|
7487
|
+
switch (e.key) {
|
|
7488
|
+
case keyArrowDown:
|
|
7489
|
+
this.setFocus(this.focusIndex + 1, 1);
|
|
7490
|
+
return;
|
|
7491
|
+
case keyArrowUp:
|
|
7492
|
+
this.setFocus(this.focusIndex - 1, -1);
|
|
7493
|
+
return;
|
|
7494
|
+
case keyEnd:
|
|
7495
|
+
this.setFocus(this.menuItems.length - 1, -1);
|
|
7496
|
+
return;
|
|
7497
|
+
case keyHome:
|
|
7498
|
+
this.setFocus(0, 1);
|
|
7499
|
+
return;
|
|
7500
|
+
default:
|
|
7501
|
+
return true;
|
|
7502
|
+
}
|
|
7503
|
+
}
|
|
7504
|
+
removeItemListeners(items = this.items) {
|
|
7505
|
+
items.forEach(item => {
|
|
7506
|
+
item.removeEventListener("focus", this.handleItemFocus);
|
|
7507
|
+
item.removeEventListener("expanded-changed", this.handleExpandedChanged);
|
|
7508
|
+
Observable.getNotifier(item).unsubscribe(this, "hidden");
|
|
7509
|
+
});
|
|
7510
|
+
}
|
|
7511
|
+
static elementIndent(el) {
|
|
7512
|
+
const role = el.getAttribute("role");
|
|
7513
|
+
const startSlot = el.querySelector("[slot=start]");
|
|
7514
|
+
if (role && role !== MenuItemRole.menuitem) {
|
|
7515
|
+
return startSlot ? 2 : 1;
|
|
7516
|
+
}
|
|
7517
|
+
return startSlot ? 1 : 0;
|
|
7518
|
+
}
|
|
7519
|
+
setItems() {
|
|
7520
|
+
const children = Array.from(this.children);
|
|
7521
|
+
this.removeItemListeners(children);
|
|
7522
|
+
children.forEach(child => Observable.getNotifier(child).subscribe(this, "hidden"));
|
|
7523
|
+
const newItems = children.filter(child => !child.hasAttribute("hidden"));
|
|
7524
|
+
this.menuItems = newItems;
|
|
7525
|
+
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
7526
|
+
if (menuItems.length) {
|
|
7527
|
+
this.focusIndex = 0;
|
|
7528
|
+
}
|
|
7529
|
+
menuItems.forEach((item, index) => {
|
|
7530
|
+
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
7531
|
+
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
7532
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
7533
|
+
});
|
|
7534
|
+
const filteredMenuListItems = this.menuItems?.filter(this.isMenuItemElement);
|
|
7535
|
+
filteredMenuListItems?.forEach((item, index) => {
|
|
7536
|
+
const indent = filteredMenuListItems?.reduce((accum, current) => {
|
|
7537
|
+
const elementValue = _MenuList.elementIndent(current);
|
|
7538
|
+
return Math.max(accum, elementValue);
|
|
7539
|
+
}, 0);
|
|
7540
|
+
if (item instanceof MenuItem) {
|
|
7541
|
+
item.setAttribute("data-indent", `${indent}`);
|
|
7542
|
+
}
|
|
7543
|
+
});
|
|
7544
|
+
}
|
|
7545
|
+
handleChange(source, propertyName) {
|
|
7546
|
+
if (propertyName === "hidden") {
|
|
7547
|
+
this.setItems();
|
|
7548
|
+
}
|
|
7549
|
+
}
|
|
7550
|
+
setFocus(focusIndex, adjustment) {
|
|
7551
|
+
if (this.menuItems === void 0) {
|
|
7552
|
+
return;
|
|
7553
|
+
}
|
|
7554
|
+
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
7555
|
+
const child = this.menuItems[focusIndex];
|
|
7556
|
+
if (this.isFocusableElement(child)) {
|
|
7557
|
+
if (this.focusIndex > -1 && this.menuItems.length >= this.focusIndex - 1) {
|
|
7558
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7559
|
+
}
|
|
7560
|
+
this.focusIndex = focusIndex;
|
|
7561
|
+
child.setAttribute("tabindex", "0");
|
|
7562
|
+
child.focus();
|
|
7563
|
+
break;
|
|
7564
|
+
}
|
|
7565
|
+
focusIndex += adjustment;
|
|
7566
|
+
}
|
|
7567
|
+
}
|
|
6926
7568
|
};
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
7569
|
+
_MenuList.focusableElementRoles = MenuItemRole;
|
|
7570
|
+
__decorateClass$c([observable], _MenuList.prototype, "items", 2);
|
|
7571
|
+
let MenuList = _MenuList;
|
|
7572
|
+
|
|
7573
|
+
const styles$d = css`
|
|
7574
|
+
${display("flex")}
|
|
7575
|
+
|
|
7576
|
+
: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}`;
|
|
7577
|
+
|
|
7578
|
+
function menuTemplate$1() {
|
|
7579
|
+
return html`<template slot="${x => x.slot ? x.slot : x.isNestedMenu() ? "submenu" : void 0}" role="menu" @keydown="${(x, c) => x.handleMenuKeyDown(c.event)}" @focusout="${(x, c) => x.handleFocusOut(c.event)}"><slot ${slotted("items")}></slot></template>`;
|
|
7580
|
+
}
|
|
7581
|
+
const template$d = menuTemplate$1();
|
|
7582
|
+
|
|
7583
|
+
const definition$d = MenuList.compose({
|
|
7584
|
+
name: `${FluentDesignSystem.prefix}-menu-list`,
|
|
7585
|
+
template: template$d,
|
|
7586
|
+
styles: styles$d
|
|
6931
7587
|
});
|
|
6932
7588
|
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
var
|
|
6936
|
-
|
|
7589
|
+
definition$d.define(FluentDesignSystem.registry);
|
|
7590
|
+
|
|
7591
|
+
var __defProp$b = Object.defineProperty;
|
|
7592
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
7593
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
7594
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
6937
7595
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6938
|
-
if (kind && result) __defProp$
|
|
7596
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
6939
7597
|
return result;
|
|
6940
7598
|
};
|
|
6941
|
-
class
|
|
7599
|
+
class Menu extends FASTElement {
|
|
6942
7600
|
constructor() {
|
|
6943
7601
|
super(...arguments);
|
|
6944
|
-
this.
|
|
6945
|
-
this.
|
|
6946
|
-
this.
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
this.
|
|
6951
|
-
if (e.defaultPrevented) {
|
|
6952
|
-
return false;
|
|
6953
|
-
}
|
|
6954
|
-
switch (e.key) {
|
|
6955
|
-
case keyEnter:
|
|
6956
|
-
case keySpace:
|
|
6957
|
-
this.invoke();
|
|
6958
|
-
return false;
|
|
6959
|
-
case keyArrowRight:
|
|
6960
|
-
this.expanded && this.submenu ? this.submenu.focus() : this.expandAndFocus();
|
|
6961
|
-
return false;
|
|
6962
|
-
case keyEscape:
|
|
6963
|
-
if (this.expanded) {
|
|
6964
|
-
this.closeSubMenu();
|
|
6965
|
-
return false;
|
|
6966
|
-
}
|
|
6967
|
-
break;
|
|
6968
|
-
case keyArrowLeft:
|
|
6969
|
-
if (this.expanded) {
|
|
6970
|
-
this.closeSubMenu();
|
|
6971
|
-
return false;
|
|
6972
|
-
}
|
|
6973
|
-
}
|
|
6974
|
-
return true;
|
|
6975
|
-
};
|
|
7602
|
+
this.openOnHover = false;
|
|
7603
|
+
this.openOnContext = false;
|
|
7604
|
+
this.closeOnScroll = false;
|
|
7605
|
+
this.persistOnItemClick = false;
|
|
7606
|
+
this.open = false;
|
|
7607
|
+
this.slottedMenuList = [];
|
|
7608
|
+
this.slottedTriggers = [];
|
|
6976
7609
|
/**
|
|
6977
|
-
*
|
|
7610
|
+
* Toggles the open state of the menu.
|
|
7611
|
+
* @public
|
|
6978
7612
|
*/
|
|
6979
|
-
this.
|
|
6980
|
-
if (
|
|
6981
|
-
|
|
7613
|
+
this.toggleMenu = () => {
|
|
7614
|
+
if (this.open) {
|
|
7615
|
+
this.closeMenu();
|
|
7616
|
+
} else {
|
|
7617
|
+
this.openMenu();
|
|
6982
7618
|
}
|
|
6983
|
-
this.invoke();
|
|
6984
|
-
return false;
|
|
6985
7619
|
};
|
|
6986
7620
|
/**
|
|
6987
|
-
*
|
|
7621
|
+
* Closes the menu.
|
|
7622
|
+
* @public
|
|
6988
7623
|
*/
|
|
6989
|
-
this.
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
this.focusSubmenuOnLoad = false;
|
|
6994
|
-
if (this.submenu) {
|
|
6995
|
-
this.submenu.focus();
|
|
6996
|
-
this.setAttribute("tabindex", "-1");
|
|
7624
|
+
this.closeMenu = () => {
|
|
7625
|
+
this.open = false;
|
|
7626
|
+
if (this.closeOnScroll) {
|
|
7627
|
+
document.removeEventListener("scroll", this.closeMenu);
|
|
6997
7628
|
}
|
|
6998
7629
|
};
|
|
6999
7630
|
/**
|
|
7000
|
-
*
|
|
7631
|
+
* Opens the menu.
|
|
7632
|
+
* @public
|
|
7001
7633
|
*/
|
|
7002
|
-
this.
|
|
7003
|
-
|
|
7004
|
-
|
|
7634
|
+
this.openMenu = e => {
|
|
7635
|
+
this.open = true;
|
|
7636
|
+
if (e && this.openOnContext) {
|
|
7637
|
+
e.preventDefault();
|
|
7005
7638
|
}
|
|
7006
|
-
this.
|
|
7007
|
-
|
|
7008
|
-
};
|
|
7009
|
-
/**
|
|
7010
|
-
* @internal
|
|
7011
|
-
*/
|
|
7012
|
-
this.handleMouseOut = e => {
|
|
7013
|
-
if (!this.expanded || this.contains(document.activeElement)) {
|
|
7014
|
-
return false;
|
|
7639
|
+
if (this.closeOnScroll) {
|
|
7640
|
+
document.addEventListener("scroll", this.closeMenu);
|
|
7015
7641
|
}
|
|
7016
|
-
this.expanded = false;
|
|
7017
|
-
return false;
|
|
7018
7642
|
};
|
|
7019
7643
|
/**
|
|
7644
|
+
* The task to set the positioning of the menu.
|
|
7020
7645
|
* @internal
|
|
7021
7646
|
*/
|
|
7022
|
-
this.
|
|
7023
|
-
this.
|
|
7024
|
-
this.focus();
|
|
7647
|
+
this.setPositioningTask = () => {
|
|
7648
|
+
this.setPositioning();
|
|
7025
7649
|
};
|
|
7026
7650
|
/**
|
|
7027
|
-
*
|
|
7651
|
+
* Handles keyboard interaction for the trigger. Toggles the menu when the Space or Enter key is pressed. If the menu
|
|
7652
|
+
* is open, focuses on the menu list.
|
|
7653
|
+
*
|
|
7654
|
+
* @param e - the keyboard event
|
|
7655
|
+
* @public
|
|
7028
7656
|
*/
|
|
7029
|
-
this.
|
|
7030
|
-
if (
|
|
7657
|
+
this.handleTriggerKeydown = e => {
|
|
7658
|
+
if (e.defaultPrevented) {
|
|
7031
7659
|
return;
|
|
7032
7660
|
}
|
|
7033
|
-
|
|
7034
|
-
|
|
7661
|
+
const key = e.key;
|
|
7662
|
+
switch (key) {
|
|
7663
|
+
case keySpace:
|
|
7664
|
+
case keyEnter:
|
|
7665
|
+
e.preventDefault();
|
|
7666
|
+
this.toggleMenu();
|
|
7667
|
+
if (this.open) {
|
|
7668
|
+
this.focusMenuList();
|
|
7669
|
+
}
|
|
7670
|
+
break;
|
|
7671
|
+
default:
|
|
7672
|
+
return true;
|
|
7673
|
+
}
|
|
7035
7674
|
};
|
|
7036
7675
|
/**
|
|
7676
|
+
* Handles document click events to close the menu when a click occurs outside of the menu or the trigger.
|
|
7037
7677
|
* @internal
|
|
7678
|
+
* @param e - The event triggered on document click.
|
|
7038
7679
|
*/
|
|
7039
|
-
this.
|
|
7040
|
-
if (this.
|
|
7041
|
-
|
|
7042
|
-
}
|
|
7043
|
-
switch (this.role) {
|
|
7044
|
-
case MenuItemRole.menuitemcheckbox:
|
|
7045
|
-
this.checked = !this.checked;
|
|
7046
|
-
break;
|
|
7047
|
-
case MenuItemRole.menuitem:
|
|
7048
|
-
if (this.hasSubmenu) {
|
|
7049
|
-
this.expandAndFocus();
|
|
7050
|
-
break;
|
|
7051
|
-
}
|
|
7052
|
-
this.$emit("change");
|
|
7053
|
-
break;
|
|
7054
|
-
case MenuItemRole.menuitemradio:
|
|
7055
|
-
if (!this.checked) {
|
|
7056
|
-
this.checked = true;
|
|
7057
|
-
}
|
|
7058
|
-
break;
|
|
7680
|
+
this.handleDocumentClick = e => {
|
|
7681
|
+
if (e && !e.composedPath().includes(this._menuList) && !e.composedPath().includes(this._trigger)) {
|
|
7682
|
+
this.closeMenu();
|
|
7059
7683
|
}
|
|
7060
7684
|
};
|
|
7061
7685
|
}
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7686
|
+
/**
|
|
7687
|
+
* Called when the element is connected to the DOM.
|
|
7688
|
+
* Sets up the component.
|
|
7689
|
+
* @public
|
|
7690
|
+
*/
|
|
7691
|
+
connectedCallback() {
|
|
7692
|
+
super.connectedCallback();
|
|
7693
|
+
Updates.enqueue(() => this.setComponent());
|
|
7694
|
+
}
|
|
7695
|
+
/**
|
|
7696
|
+
* Called when the element is disconnected from the DOM.
|
|
7697
|
+
* Removes event listeners.
|
|
7698
|
+
* @public
|
|
7699
|
+
*/
|
|
7700
|
+
disconnectedCallback() {
|
|
7701
|
+
super.disconnectedCallback();
|
|
7702
|
+
this.cleanup?.();
|
|
7703
|
+
this.removeListeners();
|
|
7704
|
+
}
|
|
7705
|
+
/**
|
|
7706
|
+
* Sets the component.
|
|
7707
|
+
* Sets the trigger and menu list elements and adds event listeners.
|
|
7708
|
+
* @public
|
|
7709
|
+
*/
|
|
7710
|
+
setComponent() {
|
|
7711
|
+
if (this.$fastController.isConnected && this.slottedMenuList.length && this.slottedTriggers.length) {
|
|
7712
|
+
this._trigger = this.slottedTriggers[0];
|
|
7713
|
+
this._menuList = this.slottedMenuList[0];
|
|
7714
|
+
this._trigger.setAttribute("aria-haspopup", "true");
|
|
7715
|
+
this._trigger.setAttribute("aria-expanded", `${this.open}`);
|
|
7716
|
+
this.addListeners();
|
|
7717
|
+
}
|
|
7718
|
+
}
|
|
7719
|
+
/**
|
|
7720
|
+
* Focuses on the menu list.
|
|
7721
|
+
* @public
|
|
7722
|
+
*/
|
|
7723
|
+
focusMenuList() {
|
|
7724
|
+
if (this.open && this._menuList) {
|
|
7725
|
+
Updates.enqueue(() => {
|
|
7726
|
+
this._menuList.focus();
|
|
7069
7727
|
});
|
|
7070
7728
|
}
|
|
7071
7729
|
}
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7730
|
+
/**
|
|
7731
|
+
* Focuses on the menu trigger.
|
|
7732
|
+
* @public
|
|
7733
|
+
*/
|
|
7734
|
+
focusTrigger() {
|
|
7735
|
+
if (!this.open && this._trigger) {
|
|
7736
|
+
Updates.enqueue(() => {
|
|
7737
|
+
this._trigger.focus();
|
|
7738
|
+
});
|
|
7075
7739
|
}
|
|
7076
7740
|
}
|
|
7077
7741
|
/**
|
|
7078
|
-
*
|
|
7742
|
+
* Called whenever the open state changes.
|
|
7743
|
+
* Updates the 'aria-expanded' attribute and sets the positioning of the menu.
|
|
7744
|
+
* Sets menu list position
|
|
7745
|
+
* emits openChanged event
|
|
7746
|
+
*
|
|
7747
|
+
* @param oldValue - The previous value of 'open'.
|
|
7748
|
+
* @param newValue - The new value of 'open'.
|
|
7749
|
+
* @public
|
|
7079
7750
|
*/
|
|
7080
|
-
|
|
7081
|
-
|
|
7751
|
+
openChanged(oldValue, newValue) {
|
|
7752
|
+
if (this.$fastController.isConnected && this._trigger instanceof HTMLElement) {
|
|
7753
|
+
this._trigger.setAttribute("aria-expanded", `${this.open}`);
|
|
7754
|
+
if (this._menuList && this.open) {
|
|
7755
|
+
Updates.enqueue(this.setPositioningTask);
|
|
7756
|
+
}
|
|
7757
|
+
}
|
|
7758
|
+
this.cleanup?.();
|
|
7759
|
+
this.$emit("onOpenChange", {
|
|
7760
|
+
open: newValue
|
|
7761
|
+
});
|
|
7762
|
+
}
|
|
7763
|
+
/**
|
|
7764
|
+
* Called whenever the 'openOnHover' property changes.
|
|
7765
|
+
* Adds or removes a 'mouseover' event listener to the trigger based on the new value.
|
|
7766
|
+
*
|
|
7767
|
+
* @param oldValue - The previous value of 'openOnHover'.
|
|
7768
|
+
* @param newValue - The new value of 'openOnHover'.
|
|
7769
|
+
* @public
|
|
7770
|
+
*/
|
|
7771
|
+
openOnHoverChanged(oldValue, newValue) {
|
|
7772
|
+
if (newValue) {
|
|
7773
|
+
this._trigger?.addEventListener("mouseover", this.openMenu);
|
|
7774
|
+
} else {
|
|
7775
|
+
this._trigger?.removeEventListener("mouseover", this.openMenu);
|
|
7776
|
+
}
|
|
7082
7777
|
}
|
|
7083
7778
|
/**
|
|
7084
|
-
*
|
|
7085
|
-
*
|
|
7086
|
-
* @
|
|
7779
|
+
* Called whenever the 'persistOnItemClick' property changes.
|
|
7780
|
+
* Adds or removes a 'click' event listener to the menu list based on the new value.
|
|
7781
|
+
* @public
|
|
7782
|
+
* @param oldValue - The previous value of 'persistOnItemClick'.
|
|
7783
|
+
* @param newValue - The new value of 'persistOnItemClick'.
|
|
7087
7784
|
*/
|
|
7088
|
-
|
|
7089
|
-
if (
|
|
7090
|
-
this.
|
|
7091
|
-
|
|
7785
|
+
persistOnItemClickChanged(oldValue, newValue) {
|
|
7786
|
+
if (!newValue) {
|
|
7787
|
+
this._menuList?.addEventListener("click", this.closeMenu);
|
|
7788
|
+
} else {
|
|
7789
|
+
this._menuList?.removeEventListener("click", this.closeMenu);
|
|
7092
7790
|
}
|
|
7093
7791
|
}
|
|
7094
7792
|
/**
|
|
7095
|
-
*
|
|
7793
|
+
* Called whenever the 'openOnContext' property changes.
|
|
7794
|
+
* Adds or removes a 'contextmenu' event listener to the trigger based on the new value.
|
|
7795
|
+
* @public
|
|
7796
|
+
* @param oldValue - The previous value of 'openOnContext'.
|
|
7797
|
+
* @param newValue - The new value of 'openOnContext'.
|
|
7096
7798
|
*/
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7799
|
+
openOnContextChanged(oldValue, newValue) {
|
|
7800
|
+
if (newValue) {
|
|
7801
|
+
this._trigger?.addEventListener("contextmenu", this.openMenu);
|
|
7802
|
+
} else {
|
|
7803
|
+
this._trigger?.removeEventListener("contextmenu", this.openMenu);
|
|
7804
|
+
}
|
|
7100
7805
|
}
|
|
7101
7806
|
/**
|
|
7102
|
-
*
|
|
7103
|
-
*
|
|
7807
|
+
* Called whenever the 'closeOnScroll' property changes.
|
|
7808
|
+
* Adds or removes a 'closeOnScroll' event listener to the trigger based on the new value.
|
|
7104
7809
|
* @public
|
|
7810
|
+
* @param oldValue - The previous value of 'closeOnScroll'.
|
|
7811
|
+
* @param newValue - The new value of 'closeOnScroll'.
|
|
7105
7812
|
*/
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7813
|
+
closeOnScrollChanged(oldValue, newValue) {
|
|
7814
|
+
if (newValue) {
|
|
7815
|
+
document.addEventListener("scroll", this.closeMenu);
|
|
7816
|
+
} else {
|
|
7817
|
+
document.removeEventListener("scroll", this.closeMenu);
|
|
7110
7818
|
}
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7819
|
+
}
|
|
7820
|
+
/**
|
|
7821
|
+
* Sets the positioning of the menu.
|
|
7822
|
+
* @internal
|
|
7823
|
+
*/
|
|
7824
|
+
setPositioning() {
|
|
7825
|
+
if (this.$fastController.isConnected && this._menuList && this.open && this._trigger) {
|
|
7826
|
+
this.cleanup = P(this, this.positioningContainer, async () => {
|
|
7114
7827
|
const {
|
|
7828
|
+
middlewareData,
|
|
7115
7829
|
x,
|
|
7116
7830
|
y
|
|
7117
|
-
} = await z(this, this.
|
|
7118
|
-
|
|
7831
|
+
} = await z(this._trigger, this.positioningContainer, {
|
|
7832
|
+
placement: "bottom",
|
|
7833
|
+
strategy: "fixed",
|
|
7834
|
+
middleware: [b$1(), k({
|
|
7119
7835
|
apply: ({
|
|
7120
|
-
|
|
7836
|
+
availableHeight,
|
|
7121
7837
|
rects
|
|
7122
7838
|
}) => {
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7839
|
+
this.positioningContainer?.style && Object.assign(this.positioningContainer.style, {
|
|
7840
|
+
maxHeight: `${availableHeight}px`,
|
|
7841
|
+
width: `${rects.reference.width}px`
|
|
7842
|
+
});
|
|
7126
7843
|
}
|
|
7127
|
-
}),
|
|
7128
|
-
fallbackPlacements
|
|
7129
|
-
})],
|
|
7130
|
-
placement: "right-start",
|
|
7131
|
-
strategy: "fixed"
|
|
7132
|
-
});
|
|
7133
|
-
Object.assign(this.submenuContainer.style, {
|
|
7134
|
-
left: `${x}px`,
|
|
7135
|
-
position: "fixed",
|
|
7136
|
-
top: `${y}px`
|
|
7844
|
+
}), P$1()]
|
|
7137
7845
|
});
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
}
|
|
7142
|
-
}
|
|
7143
|
-
__decorateClass$e([attr({
|
|
7144
|
-
mode: "boolean"
|
|
7145
|
-
})], MenuItem.prototype, "disabled", 2);
|
|
7146
|
-
__decorateClass$e([attr({
|
|
7147
|
-
mode: "boolean"
|
|
7148
|
-
})], MenuItem.prototype, "expanded", 2);
|
|
7149
|
-
__decorateClass$e([attr], MenuItem.prototype, "role", 2);
|
|
7150
|
-
__decorateClass$e([attr({
|
|
7151
|
-
mode: "boolean"
|
|
7152
|
-
})], MenuItem.prototype, "checked", 2);
|
|
7153
|
-
__decorateClass$e([attr({
|
|
7154
|
-
mode: "boolean"
|
|
7155
|
-
})], MenuItem.prototype, "hidden", 2);
|
|
7156
|
-
__decorateClass$e([observable], MenuItem.prototype, "slottedSubmenu", 2);
|
|
7157
|
-
__decorateClass$e([observable], MenuItem.prototype, "submenu", 2);
|
|
7158
|
-
applyMixins(MenuItem, StartEnd);
|
|
7159
|
-
|
|
7160
|
-
const styles$e = css`
|
|
7161
|
-
${display("grid")}
|
|
7162
|
-
|
|
7163
|
-
:host{grid-template-columns:20px 20px auto 20px;align-items:center;grid-gap:4px;height:32px;background:${colorNeutralBackground1};font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};padding:0 10px;cursor:pointer;overflow:visible;contain:layout}:host(:hover){background:${colorNeutralBackground1Hover}}.content{white-space:nowrap;flex-grow:1;grid-column:auto / span 2;padding:0 2px}.checkbox,.radio{display:none}.input-container,.expand-collapse-glyph-container,::slotted([slot='start']),::slotted([slot='end']),:host([checked]) .checkbox,:host([checked]) .radio{display:inline-flex;justify-content:center;align-items:center;color:${colorNeutralForeground2}}.expand-collapse-glyph-container,::slotted([slot='start']),::slotted([slot='end']){height:32px;font-size:${fontSizeBase500};width:fit-content}.input-container{width:20px}::slotted([slot='end']){color:${colorNeutralForeground3};font:${fontWeightRegular} ${fontSizeBase200} / ${lineHeightBase200} ${fontFamilyBase};white-space:nowrap;grid-column:4 / span 1;justify-self:flex-end}.expand-collapse-glyph-container{grid-column:4 / span 1;justify-self:flex-end}:host(:hover) .input-container,:host(:hover) .expand-collapse-glyph-container,:host(:hover) .content{color:${colorNeutralForeground2Hover}}:host([icon]:hover) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Hover}}:host(:active){background-color:${colorNeutralBackground1Selected}}:host(:active) .input-container,:host(:active) .expand-collapse-glyph-container,:host(:active) .content{color:${colorNeutralForeground2Pressed}}:host(:active) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Pressed}}:host([disabled]){background-color:${colorNeutralBackgroundDisabled}}:host([disabled]) .content,:host([disabled]) .expand-collapse-glyph-container,:host([disabled]) ::slotted([slot='end']),:host([disabled]) ::slotted([slot='start']){color:${colorNeutralForegroundDisabled}}:host([data-indent]){display:grid}:host([data-indent='1']) .content{grid-column:2 / span 1}:host([data-indent='1'][role='menuitemcheckbox']){display:grid}:host([data-indent='2'][aria-haspopup='menu']) ::slotted([slot='end']){grid-column:4 / span 1}:host([data-indent='2'][aria-haspopup='menu']) .expand-collapse-glyph-container{grid-column:5 / span 1}:host([data-indent='1']) .content{grid-column:2 / span 1}:host([data-indent='1'][role='menuitemcheckbox']) .content,:host([data-indent='1'][role='menuitemradio']) .content{grid-column:auto / span 1}:host([icon]) ::slotted([slot='end']),:host([data-indent='1']) ::slotted([slot='end']){grid-column:4 / span 1;justify-self:flex-end}:host([data-indent='2']){display:grid;grid-template-columns:20px 20px auto auto}:host([data-indent='2']) .content{grid-column:3 / span 1}:host([data-indent='2']) .input-container{grid-column:1 / span 1}:host([data-indent='2']) ::slotted([slot='start']){grid-column:2 / span 1}:host([aria-haspopup='menu']){grid-template-columns:20px auto auto 20px}:host([data-indent='2'][aria-haspopup='menu']){grid-template-columns:20px 20px auto auto 20px}:host([aria-haspopup='menu']) ::slotted([slot='end']){grid-column:3 / span 1;justify-self:flex-end}:host([data-indent='2'][aria-haspopup='menu']) ::slotted([slot='end']){grid-column:4 / span 1;justify-self:flex-end}`;
|
|
7164
|
-
|
|
7165
|
-
const Checkmark16Filled = html.partial(`<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" 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>`);
|
|
7166
|
-
const chevronRight16Filled = html.partial(`<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" 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>`);
|
|
7167
|
-
function menuItemTemplate(options = {}) {
|
|
7168
|
-
return html`<template aria-haspopup="${x => x.hasSubmenu ? "menu" : void 0}" aria-checked="${x => x.role !== MenuItemRole.menuitem ? x.checked : void 0}" aria-disabled="${x => x.disabled}" aria-expanded="${x => x.expanded}" @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)}">${when(x => x.role === MenuItemRole.menuitemcheckbox, html`<div part="input-container" class="input-container"><span part="checkbox" class="checkbox"><slot name="checkbox-indicator">${staticallyCompose(options.checkboxIndicator)}</slot></span></div>`)} ${when(x => x.role === MenuItemRole.menuitemradio, html`<div part="input-container" class="input-container"><span part="radio" class="radio"><slot name="radio-indicator">${staticallyCompose(options.radioIndicator)}</slot></span></div>`)}</div>${startSlotTemplate(options)}<span class="content" part="content"><slot></slot></span>${endSlotTemplate(options)} ${when(x => x.hasSubmenu, html`<div part="expand-collapse-glyph-container" class="expand-collapse-glyph-container"><span part="expand-collapse" class="expand-collapse"><slot name="expand-collapse-indicator">${staticallyCompose(options.expandCollapseGlyph)}</slot></span></div>`)}<span ?hidden="${x => !x.expanded}" class="submenu-container" part="submenu-container" ${ref("submenuContainer")}><slot name="submenu" ${slotted({
|
|
7169
|
-
property: "slottedSubmenu",
|
|
7170
|
-
filter: elements("[role='menu']")
|
|
7171
|
-
})}></slot></span></template>`;
|
|
7172
|
-
}
|
|
7173
|
-
const template$e = menuItemTemplate({
|
|
7174
|
-
checkboxIndicator: Checkmark16Filled,
|
|
7175
|
-
expandCollapseGlyph: chevronRight16Filled,
|
|
7176
|
-
radioIndicator: Checkmark16Filled
|
|
7177
|
-
});
|
|
7178
|
-
|
|
7179
|
-
const definition$e = MenuItem.compose({
|
|
7180
|
-
name: `${FluentDesignSystem.prefix}-menu-item`,
|
|
7181
|
-
template: template$e,
|
|
7182
|
-
styles: styles$e
|
|
7183
|
-
});
|
|
7184
|
-
|
|
7185
|
-
definition$e.define(FluentDesignSystem.registry);
|
|
7186
|
-
|
|
7187
|
-
var __defProp$d = Object.defineProperty;
|
|
7188
|
-
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
7189
|
-
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
7190
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
7191
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7192
|
-
if (kind && result) __defProp$d(target, key, result);
|
|
7193
|
-
return result;
|
|
7194
|
-
};
|
|
7195
|
-
const _MenuList = class _MenuList extends FASTElement {
|
|
7196
|
-
constructor() {
|
|
7197
|
-
super(...arguments);
|
|
7198
|
-
this.expandedItem = null;
|
|
7199
|
-
/**
|
|
7200
|
-
* The index of the focusable element in the items array
|
|
7201
|
-
* defaults to -1
|
|
7202
|
-
*/
|
|
7203
|
-
this.focusIndex = -1;
|
|
7204
|
-
/**
|
|
7205
|
-
* @internal
|
|
7206
|
-
*/
|
|
7207
|
-
this.isNestedMenu = () => {
|
|
7208
|
-
return this.parentElement !== null && isHTMLElement(this.parentElement) && this.parentElement.getAttribute("role") === "menuitem";
|
|
7209
|
-
};
|
|
7210
|
-
/**
|
|
7211
|
-
* if focus is moving out of the menu, reset to a stable initial state
|
|
7212
|
-
* @internal
|
|
7213
|
-
*/
|
|
7214
|
-
this.handleFocusOut = e => {
|
|
7215
|
-
if (!this.contains(e.relatedTarget) && this.menuItems !== void 0) {
|
|
7216
|
-
this.collapseExpandedItem();
|
|
7217
|
-
const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
|
|
7218
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7219
|
-
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
7220
|
-
this.focusIndex = focusIndex;
|
|
7221
|
-
}
|
|
7222
|
-
};
|
|
7223
|
-
this.handleItemFocus = e => {
|
|
7224
|
-
const targetItem = e.target;
|
|
7225
|
-
if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
|
|
7226
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7227
|
-
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
7228
|
-
targetItem.setAttribute("tabindex", "0");
|
|
7229
|
-
}
|
|
7230
|
-
};
|
|
7231
|
-
this.handleExpandedChanged = e => {
|
|
7232
|
-
if (e.defaultPrevented || e.target === null || this.menuItems === void 0 || this.menuItems.indexOf(e.target) < 0) {
|
|
7233
|
-
return;
|
|
7234
|
-
}
|
|
7235
|
-
e.preventDefault();
|
|
7236
|
-
const changedItem = e.target;
|
|
7237
|
-
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
|
|
7238
|
-
this.expandedItem = null;
|
|
7239
|
-
return;
|
|
7240
|
-
}
|
|
7241
|
-
if (changedItem.expanded) {
|
|
7242
|
-
if (this.expandedItem !== null && this.expandedItem !== changedItem) {
|
|
7243
|
-
this.expandedItem.expanded = false;
|
|
7244
|
-
}
|
|
7245
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7246
|
-
this.expandedItem = changedItem;
|
|
7247
|
-
this.focusIndex = this.menuItems.indexOf(changedItem);
|
|
7248
|
-
changedItem.setAttribute("tabindex", "0");
|
|
7249
|
-
}
|
|
7250
|
-
};
|
|
7251
|
-
/**
|
|
7252
|
-
* handle change from child element
|
|
7253
|
-
*/
|
|
7254
|
-
this.changeHandler = e => {
|
|
7255
|
-
if (this.menuItems === void 0) {
|
|
7256
|
-
return;
|
|
7257
|
-
}
|
|
7258
|
-
const changedMenuItem = e.target;
|
|
7259
|
-
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
7260
|
-
if (changeItemIndex === -1) {
|
|
7261
|
-
return;
|
|
7262
|
-
}
|
|
7263
|
-
if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked === true) {
|
|
7264
|
-
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
7265
|
-
const item = this.menuItems[i];
|
|
7266
|
-
const role = item.getAttribute("role");
|
|
7267
|
-
if (role === MenuItemRole.menuitemradio) {
|
|
7268
|
-
item.checked = false;
|
|
7269
|
-
}
|
|
7270
|
-
if (role === "separator") {
|
|
7271
|
-
break;
|
|
7272
|
-
}
|
|
7273
|
-
}
|
|
7274
|
-
const maxIndex = this.menuItems.length - 1;
|
|
7275
|
-
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
7276
|
-
const item = this.menuItems[i];
|
|
7277
|
-
const role = item.getAttribute("role");
|
|
7278
|
-
if (role === MenuItemRole.menuitemradio) {
|
|
7279
|
-
item.checked = false;
|
|
7280
|
-
}
|
|
7281
|
-
if (role === "separator") {
|
|
7282
|
-
break;
|
|
7283
|
-
}
|
|
7846
|
+
if (middlewareData.hide?.referenceHidden) {
|
|
7847
|
+
this.open = false;
|
|
7848
|
+
return;
|
|
7284
7849
|
}
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
};
|
|
7293
|
-
/**
|
|
7294
|
-
* check if the item is focusable
|
|
7295
|
-
*/
|
|
7296
|
-
this.isFocusableElement = el => {
|
|
7297
|
-
return this.isMenuItemElement(el);
|
|
7298
|
-
};
|
|
7299
|
-
}
|
|
7300
|
-
itemsChanged(oldValue, newValue) {
|
|
7301
|
-
if (this.$fastController.isConnected && this.menuItems !== void 0) {
|
|
7302
|
-
this.setItems();
|
|
7850
|
+
this.positioningContainer?.style && Object.assign(this.positioningContainer.style, {
|
|
7851
|
+
position: "fixed",
|
|
7852
|
+
top: "0",
|
|
7853
|
+
left: "0",
|
|
7854
|
+
transform: `translate(${x}px, ${y}px)`
|
|
7855
|
+
});
|
|
7856
|
+
});
|
|
7303
7857
|
}
|
|
7304
7858
|
}
|
|
7305
7859
|
/**
|
|
7306
|
-
*
|
|
7860
|
+
* Adds event listeners.
|
|
7861
|
+
* Adds click and keydown event listeners to the trigger and a click event listener to the document.
|
|
7862
|
+
* If 'openOnHover' is true, adds a 'mouseover' event listener to the trigger.
|
|
7863
|
+
* @public
|
|
7307
7864
|
*/
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7865
|
+
addListeners() {
|
|
7866
|
+
document.addEventListener("click", this.handleDocumentClick);
|
|
7867
|
+
this._trigger?.addEventListener("keydown", this.handleTriggerKeydown);
|
|
7868
|
+
if (!this.persistOnItemClick) {
|
|
7869
|
+
this._menuList?.addEventListener("click", this.closeMenu);
|
|
7870
|
+
}
|
|
7871
|
+
if (this.openOnHover) {
|
|
7872
|
+
this._trigger?.addEventListener("mouseover", this.openMenu);
|
|
7873
|
+
} else if (this.openOnContext) {
|
|
7874
|
+
this._trigger?.addEventListener("contextmenu", this.openMenu);
|
|
7875
|
+
} else {
|
|
7876
|
+
this._trigger?.addEventListener("click", this.toggleMenu);
|
|
7877
|
+
}
|
|
7314
7878
|
}
|
|
7315
7879
|
/**
|
|
7880
|
+
* Removes event listeners.
|
|
7881
|
+
* Removes click and keydown event listeners from the trigger and a click event listener from the document.
|
|
7882
|
+
* Also removes 'mouseover' event listeners from the trigger.
|
|
7316
7883
|
* @internal
|
|
7317
7884
|
*/
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
this.
|
|
7321
|
-
this.
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7885
|
+
removeListeners() {
|
|
7886
|
+
document.removeEventListener("click", this.handleDocumentClick);
|
|
7887
|
+
this._trigger?.removeEventListener("keydown", this.handleTriggerKeydown);
|
|
7888
|
+
if (!this.persistOnItemClick) {
|
|
7889
|
+
this._menuList?.removeEventListener("click", this.closeMenu);
|
|
7890
|
+
}
|
|
7891
|
+
if (this.openOnHover) {
|
|
7892
|
+
this._trigger?.removeEventListener("mouseover", this.openMenu);
|
|
7893
|
+
}
|
|
7894
|
+
if (this.openOnContext) {
|
|
7895
|
+
this._trigger?.removeEventListener("contextmenu", this.openMenu);
|
|
7896
|
+
} else {
|
|
7897
|
+
this._trigger?.removeEventListener("click", this.toggleMenu);
|
|
7898
|
+
}
|
|
7331
7899
|
}
|
|
7332
7900
|
/**
|
|
7333
|
-
*
|
|
7901
|
+
* Handles keyboard interaction for the menu. Closes the menu and focuses on the trigger when the Escape key is
|
|
7902
|
+
* pressed. Closes the menu when the Tab key is pressed.
|
|
7334
7903
|
*
|
|
7904
|
+
* @param e - the keyboard event
|
|
7335
7905
|
* @public
|
|
7336
7906
|
*/
|
|
7337
|
-
|
|
7338
|
-
if (
|
|
7339
|
-
this.expandedItem.expanded = false;
|
|
7340
|
-
this.expandedItem = null;
|
|
7341
|
-
}
|
|
7342
|
-
}
|
|
7343
|
-
/**
|
|
7344
|
-
* @internal
|
|
7345
|
-
*/
|
|
7346
|
-
handleMenuKeyDown(e) {
|
|
7347
|
-
if (e.defaultPrevented || this.menuItems === void 0) {
|
|
7907
|
+
handleMenuKeydown(e) {
|
|
7908
|
+
if (e.defaultPrevented) {
|
|
7348
7909
|
return;
|
|
7349
7910
|
}
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7911
|
+
const key = e.key;
|
|
7912
|
+
switch (key) {
|
|
7913
|
+
case keyEscape:
|
|
7914
|
+
e.preventDefault();
|
|
7915
|
+
if (this.open) {
|
|
7916
|
+
this.closeMenu();
|
|
7917
|
+
this.focusTrigger();
|
|
7918
|
+
}
|
|
7919
|
+
break;
|
|
7920
|
+
case keyTab:
|
|
7921
|
+
if (this.open) {
|
|
7922
|
+
this.closeMenu();
|
|
7923
|
+
}
|
|
7924
|
+
if (e.shiftKey) {
|
|
7925
|
+
this.focusTrigger();
|
|
7926
|
+
}
|
|
7363
7927
|
default:
|
|
7364
7928
|
return true;
|
|
7365
7929
|
}
|
|
7366
7930
|
}
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7931
|
+
}
|
|
7932
|
+
__decorateClass$b([observable, attr({
|
|
7933
|
+
attribute: "open-on-hover",
|
|
7934
|
+
mode: "boolean"
|
|
7935
|
+
})], Menu.prototype, "openOnHover", 2);
|
|
7936
|
+
__decorateClass$b([observable, attr({
|
|
7937
|
+
attribute: "open-on-context",
|
|
7938
|
+
mode: "boolean"
|
|
7939
|
+
})], Menu.prototype, "openOnContext", 2);
|
|
7940
|
+
__decorateClass$b([observable, attr({
|
|
7941
|
+
attribute: "close-on-scroll",
|
|
7942
|
+
mode: "boolean"
|
|
7943
|
+
})], Menu.prototype, "closeOnScroll", 2);
|
|
7944
|
+
__decorateClass$b([observable, attr({
|
|
7945
|
+
attribute: "persist-on-item-click",
|
|
7946
|
+
mode: "boolean"
|
|
7947
|
+
})], Menu.prototype, "persistOnItemClick", 2);
|
|
7948
|
+
__decorateClass$b([observable, attr({
|
|
7949
|
+
mode: "boolean"
|
|
7950
|
+
})], Menu.prototype, "open", 2);
|
|
7951
|
+
__decorateClass$b([observable], Menu.prototype, "slottedMenuList", 2);
|
|
7952
|
+
__decorateClass$b([observable], Menu.prototype, "slottedTriggers", 2);
|
|
7953
|
+
|
|
7954
|
+
const styles$c = css`
|
|
7955
|
+
:host{position:relative;z-index:var(--z-index-menu,1)}.positioning-container{position:fixed;top:0;left:0;transform:translate(0,0)}`;
|
|
7956
|
+
|
|
7957
|
+
function menuTemplate() {
|
|
7958
|
+
return html`<template ?open-on-hover="${x => x.openOnHover}" ?open-on-context="${x => x.openOnContext}" ?close-on-scroll="${x => x.closeOnScroll}" ?persist-on-item-click="${x => x.persistOnItemClick}" @keydown="${(x, c) => x.handleMenuKeydown(c.event)}"><slot name="trigger" ${slotted({
|
|
7959
|
+
property: "slottedTriggers",
|
|
7960
|
+
filter: elements()
|
|
7961
|
+
})}></slot><span ${ref("positioningContainer")} part="positioning-container" class="positioning-container" ?hidden="${x => !x.open}"><slot ${slotted({
|
|
7962
|
+
property: "slottedMenuList",
|
|
7963
|
+
filter: elements()
|
|
7964
|
+
})}></slot></span></template>`;
|
|
7965
|
+
}
|
|
7966
|
+
const template$c = menuTemplate();
|
|
7967
|
+
|
|
7968
|
+
const definition$c = Menu.compose({
|
|
7969
|
+
name: `${FluentDesignSystem.prefix}-menu`,
|
|
7970
|
+
template: template$c,
|
|
7971
|
+
styles: styles$c
|
|
7972
|
+
});
|
|
7973
|
+
|
|
7974
|
+
definition$c.define(FluentDesignSystem.registry);
|
|
7975
|
+
|
|
7976
|
+
var __defProp$a = Object.defineProperty;
|
|
7977
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
7978
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
7979
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
7980
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7981
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
7982
|
+
return result;
|
|
7983
|
+
};
|
|
7984
|
+
class BaseProgress extends FASTElement {
|
|
7985
|
+
constructor() {
|
|
7986
|
+
super(...arguments);
|
|
7987
|
+
this.percentComplete = 0;
|
|
7373
7988
|
}
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
const startSlot = el.querySelector("[slot=start]");
|
|
7377
|
-
if (role && role !== MenuItemRole.menuitem) {
|
|
7378
|
-
return startSlot ? 2 : 1;
|
|
7379
|
-
}
|
|
7380
|
-
return startSlot ? 1 : 0;
|
|
7989
|
+
valueChanged() {
|
|
7990
|
+
this.updatePercentComplete();
|
|
7381
7991
|
}
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
children.forEach(child => Observable.getNotifier(child).subscribe(this, "hidden"));
|
|
7386
|
-
const newItems = children.filter(child => !child.hasAttribute("hidden"));
|
|
7387
|
-
this.menuItems = newItems;
|
|
7388
|
-
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
7389
|
-
if (menuItems.length) {
|
|
7390
|
-
this.focusIndex = 0;
|
|
7992
|
+
minChanged() {
|
|
7993
|
+
if (this.$fastController.isConnected) {
|
|
7994
|
+
this.updatePercentComplete();
|
|
7391
7995
|
}
|
|
7392
|
-
menuItems.forEach((item, index) => {
|
|
7393
|
-
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
7394
|
-
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
7395
|
-
item.addEventListener("focus", this.handleItemFocus);
|
|
7396
|
-
});
|
|
7397
|
-
const filteredMenuListItems = this.menuItems?.filter(this.isMenuItemElement);
|
|
7398
|
-
filteredMenuListItems?.forEach((item, index) => {
|
|
7399
|
-
const indent = filteredMenuListItems?.reduce((accum, current) => {
|
|
7400
|
-
const elementValue = _MenuList.elementIndent(current);
|
|
7401
|
-
return Math.max(accum, elementValue);
|
|
7402
|
-
}, 0);
|
|
7403
|
-
if (item instanceof MenuItem) {
|
|
7404
|
-
item.setAttribute("data-indent", `${indent}`);
|
|
7405
|
-
}
|
|
7406
|
-
});
|
|
7407
7996
|
}
|
|
7408
|
-
|
|
7409
|
-
if (
|
|
7410
|
-
this.
|
|
7997
|
+
maxChanged() {
|
|
7998
|
+
if (this.$fastController.isConnected) {
|
|
7999
|
+
this.updatePercentComplete();
|
|
7411
8000
|
}
|
|
7412
8001
|
}
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
break;
|
|
7427
|
-
}
|
|
7428
|
-
focusIndex += adjustment;
|
|
7429
|
-
}
|
|
8002
|
+
/**
|
|
8003
|
+
* @internal
|
|
8004
|
+
*/
|
|
8005
|
+
connectedCallback() {
|
|
8006
|
+
super.connectedCallback();
|
|
8007
|
+
this.updatePercentComplete();
|
|
8008
|
+
}
|
|
8009
|
+
updatePercentComplete() {
|
|
8010
|
+
const min = typeof this.min === "number" ? this.min : 0;
|
|
8011
|
+
const max = typeof this.max === "number" ? this.max : 100;
|
|
8012
|
+
const value = typeof this.value === "number" ? this.value : 0;
|
|
8013
|
+
const range = max - min;
|
|
8014
|
+
this.percentComplete = range === 0 ? 0 : Math.fround((value - min) / range * 100);
|
|
7430
8015
|
}
|
|
8016
|
+
}
|
|
8017
|
+
__decorateClass$a([attr({
|
|
8018
|
+
converter: nullableNumberConverter
|
|
8019
|
+
})], BaseProgress.prototype, "value", 2);
|
|
8020
|
+
__decorateClass$a([attr({
|
|
8021
|
+
converter: nullableNumberConverter
|
|
8022
|
+
})], BaseProgress.prototype, "min", 2);
|
|
8023
|
+
__decorateClass$a([attr({
|
|
8024
|
+
converter: nullableNumberConverter
|
|
8025
|
+
})], BaseProgress.prototype, "max", 2);
|
|
8026
|
+
__decorateClass$a([observable], BaseProgress.prototype, "percentComplete", 2);
|
|
8027
|
+
|
|
8028
|
+
var __defProp$9 = Object.defineProperty;
|
|
8029
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
8030
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
8031
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
8032
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8033
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
8034
|
+
return result;
|
|
7431
8035
|
};
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
8036
|
+
class ProgressBar extends BaseProgress {
|
|
8037
|
+
constructor() {
|
|
8038
|
+
super(...arguments);
|
|
8039
|
+
this.validationState = null;
|
|
8040
|
+
}
|
|
8041
|
+
}
|
|
8042
|
+
__decorateClass$9([attr], ProgressBar.prototype, "thickness", 2);
|
|
8043
|
+
__decorateClass$9([attr], ProgressBar.prototype, "shape", 2);
|
|
8044
|
+
__decorateClass$9([attr({
|
|
8045
|
+
attribute: "validation-state"
|
|
8046
|
+
})], ProgressBar.prototype, "validationState", 2);
|
|
7435
8047
|
|
|
7436
|
-
const styles$
|
|
8048
|
+
const styles$b = css`
|
|
7437
8049
|
${display("flex")}
|
|
7438
8050
|
|
|
7439
|
-
:host{
|
|
8051
|
+
:host{align-items:center;height:2px;overflow-x:hidden;border-radius:${borderRadiusMedium};contain:content}:host([thickness='large']),:host([thickness='large']) .progress,:host([thickness='large']) .determinate{height:4px}:host([shape='square']),:host([shape='square']) .progress,:host([shape='square']) .determinate{border-radius:0}:host([validation-state='error']) .determinate{background-color:${colorPaletteRedBackground3}}:host([validation-state='error']) .indeterminate-indicator-1,:host([validation-state='error']) .indeterminate-indicator-2{background:linear-gradient(
|
|
8052
|
+
to right,${colorPaletteRedBackground2} 0%,${colorPaletteRedBackground3} 50%,${colorPaletteRedBackground2}
|
|
8053
|
+
)}:host([validation-state='warning']) .determinate{background-color:${colorPaletteDarkOrangeBackground3}}:host([validation-state='warning']) .indeterminate-indicator-1,:host([validation-state='warning']) .indeterminate-indicator-2{background:linear-gradient(
|
|
8054
|
+
to right,${colorPaletteDarkOrangeBackground2} 0%,${colorPaletteDarkOrangeBackground3} 50%,${colorPaletteDarkOrangeBackground2}
|
|
8055
|
+
)}:host([validation-state='success']) .determinate{background-color:${colorPaletteGreenBackground3}}:host([validation-state='success']) .indeterminate-indicator-1,:host([validation-state='success']) .indeterminate-indicator-2{background:linear-gradient(
|
|
8056
|
+
to right,${colorPaletteGreenBackground2} 0%,${colorPaletteGreenBackground3} 50%,${colorPaletteGreenBackground2}
|
|
8057
|
+
)}.progress{background-color:${colorNeutralBackground6};border-radius:${borderRadiusMedium};width:100%;height:2px;display:flex;align-items:center;position:relative}.determinate{background-color:${colorCompoundBrandBackground};border-radius:${borderRadiusMedium};height:2px;transition:all 0.2s ease-in-out;display:flex}.indeterminate-indicator-1{position:absolute;opacity:0;height:100%;background:linear-gradient(
|
|
8058
|
+
to right,${colorBrandBackground2} 0%,${colorCompoundBrandBackground} 50%,${colorBrandBackground2}
|
|
8059
|
+
);border-radius:${borderRadiusMedium};animation-timing-function:cubic-bezier(0.4,0,0.6,1);width:40%;animation:indeterminate-1 3s infinite}.indeterminate-indicator-2{position:absolute;opacity:0;height:100%;background:linear-gradient(
|
|
8060
|
+
to right,${colorBrandBackground2} 0%,${colorCompoundBrandBackground} 50%,${colorBrandBackground2}
|
|
8061
|
+
);border-radius:${borderRadiusMedium};animation-timing-function:cubic-bezier(0.4,0,0.6,1);width:60%;animation:indeterminate-2 3s infinite}@keyframes indeterminate-1{0%{opacity:1;transform:translateX(-100%)}70%{opacity:1;transform:translateX(300%)}70.01%{opacity:0}100%{opacity:0;transform:translateX(300%)}}@keyframes indeterminate-2{0%{opacity:0;transform:translateX(-150%)}29.99%{opacity:0}30%{opacity:1;transform:translateX(-150%)}100%{transform:translateX(166.66%);opacity:1}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
8062
|
+
.progress{background-color:HighlightText}.determinate,:host([validation-state='success']) .determinate,:host([validation-state='warning']) .determinate,:host([validation-state='error']) .determinate,:host([validation-state='success']) ..indeterminate-indicator-1,:host([validation-state='success']) ..indeterminate-indicator-2,:host([validation-state='warning']) .indeterminate-indicator-1,:host([validation-state='warning']) .indeterminate-indicator-2,:host([validation-state='error']) .indeterminate-indicator-1,:host([validation-state='error']) .indeterminate-indicator-2{background-color:Highlight}`));
|
|
7440
8063
|
|
|
7441
|
-
function
|
|
7442
|
-
return html`<template
|
|
8064
|
+
function progressTemplate(options = {}) {
|
|
8065
|
+
return html`<template role="progressbar" aria-valuenow="${x => x.value}" aria-valuemin="${x => x.min}" aria-valuemax="${x => x.max}">${when(x => typeof x.value === "number", html`<div class="progress" part="progress" slot="determinate"><div class="determinate" part="determinate" style="width: ${x => x.percentComplete}%"></div></div>`, html`<div class="progress" part="progress" slot="indeterminate"><slot name="indeterminate">${staticallyCompose(options.indeterminateIndicator1)} ${staticallyCompose(options.indeterminateIndicator2)}</slot></div>`)}</template>`;
|
|
7443
8066
|
}
|
|
7444
|
-
const template$
|
|
8067
|
+
const template$b = progressTemplate({
|
|
8068
|
+
indeterminateIndicator1: `<span class="indeterminate-indicator-1" part="indeterminate-indicator-1></span>`,
|
|
8069
|
+
indeterminateIndicator2: `<span class="indeterminate-indicator-2" part="indeterminate-indicator-2"></span>`
|
|
8070
|
+
});
|
|
7445
8071
|
|
|
7446
|
-
const definition$
|
|
7447
|
-
name: `${FluentDesignSystem.prefix}-
|
|
7448
|
-
template: template$
|
|
7449
|
-
styles: styles$
|
|
8072
|
+
const definition$b = ProgressBar.compose({
|
|
8073
|
+
name: `${FluentDesignSystem.prefix}-progress-bar`,
|
|
8074
|
+
template: template$b,
|
|
8075
|
+
styles: styles$b
|
|
7450
8076
|
});
|
|
7451
8077
|
|
|
7452
|
-
definition$
|
|
8078
|
+
definition$b.define(FluentDesignSystem.registry);
|
|
7453
8079
|
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
8080
|
+
const proxySlotName = "form-associated-proxy";
|
|
8081
|
+
const ElementInternalsKey = "ElementInternals";
|
|
8082
|
+
const supportsElementInternals = ElementInternalsKey in window && "setFormValue" in window[ElementInternalsKey].prototype;
|
|
8083
|
+
const InternalsMap = /* @__PURE__ */new WeakMap();
|
|
8084
|
+
function FormAssociated(BaseCtor) {
|
|
8085
|
+
const C = class extends BaseCtor {
|
|
8086
|
+
constructor(...args) {
|
|
8087
|
+
super(...args);
|
|
8088
|
+
/**
|
|
8089
|
+
* Track whether the value has been changed from the initial value
|
|
8090
|
+
*/
|
|
8091
|
+
this.dirtyValue = false;
|
|
8092
|
+
/**
|
|
8093
|
+
* The initial value of the form. This value sets the `value` property
|
|
8094
|
+
* only when the `value` property has not been explicitly set.
|
|
8095
|
+
*
|
|
8096
|
+
* @remarks
|
|
8097
|
+
* HTML Attribute: value
|
|
8098
|
+
*/
|
|
8099
|
+
this.initialValue = "";
|
|
8100
|
+
/**
|
|
8101
|
+
* Sets the element's disabled state. A disabled element will not be included during form submission.
|
|
8102
|
+
*
|
|
8103
|
+
* @remarks
|
|
8104
|
+
* HTML Attribute: disabled
|
|
8105
|
+
*/
|
|
8106
|
+
this.disabled = false;
|
|
8107
|
+
/**
|
|
8108
|
+
* These are events that are still fired by the proxy
|
|
8109
|
+
* element based on user / programmatic interaction.
|
|
8110
|
+
*
|
|
8111
|
+
* The proxy implementation should be transparent to
|
|
8112
|
+
* the app author, so block these events from emitting.
|
|
8113
|
+
*/
|
|
8114
|
+
this.proxyEventsToBlock = ["change", "click"];
|
|
8115
|
+
this.proxyInitialized = false;
|
|
8116
|
+
this.required = false;
|
|
8117
|
+
this.initialValue = this.initialValue || "";
|
|
8118
|
+
if (!this.elementInternals) {
|
|
8119
|
+
this.formResetCallback = this.formResetCallback.bind(this);
|
|
8120
|
+
}
|
|
8121
|
+
}
|
|
7472
8122
|
/**
|
|
7473
|
-
*
|
|
7474
|
-
*
|
|
8123
|
+
* Must evaluate to true to enable elementInternals.
|
|
8124
|
+
* Feature detects API support and resolve respectively
|
|
8125
|
+
*
|
|
8126
|
+
* @internal
|
|
7475
8127
|
*/
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
8128
|
+
static get formAssociated() {
|
|
8129
|
+
return supportsElementInternals;
|
|
8130
|
+
}
|
|
8131
|
+
/**
|
|
8132
|
+
* Returns the validity state of the element
|
|
8133
|
+
*
|
|
8134
|
+
* @beta
|
|
8135
|
+
*/
|
|
8136
|
+
get validity() {
|
|
8137
|
+
return this.elementInternals ? this.elementInternals.validity : this.proxy.validity;
|
|
8138
|
+
}
|
|
8139
|
+
/**
|
|
8140
|
+
* Retrieve a reference to the associated form.
|
|
8141
|
+
* Returns null if not associated to any form.
|
|
8142
|
+
*
|
|
8143
|
+
* @beta
|
|
8144
|
+
*/
|
|
8145
|
+
get form() {
|
|
8146
|
+
return this.elementInternals ? this.elementInternals.form : this.proxy.form;
|
|
8147
|
+
}
|
|
8148
|
+
/**
|
|
8149
|
+
* Retrieve the localized validation message,
|
|
8150
|
+
* or custom validation message if set.
|
|
8151
|
+
*
|
|
8152
|
+
* @beta
|
|
8153
|
+
*/
|
|
8154
|
+
get validationMessage() {
|
|
8155
|
+
return this.elementInternals ? this.elementInternals.validationMessage : this.proxy.validationMessage;
|
|
8156
|
+
}
|
|
8157
|
+
/**
|
|
8158
|
+
* Whether the element will be validated when the
|
|
8159
|
+
* form is submitted
|
|
8160
|
+
*/
|
|
8161
|
+
get willValidate() {
|
|
8162
|
+
return this.elementInternals ? this.elementInternals.willValidate : this.proxy.willValidate;
|
|
8163
|
+
}
|
|
8164
|
+
/**
|
|
8165
|
+
* A reference to all associated label elements
|
|
8166
|
+
*/
|
|
8167
|
+
get labels() {
|
|
8168
|
+
if (this.elementInternals) {
|
|
8169
|
+
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
8170
|
+
} else if (this.proxy instanceof HTMLElement && this.proxy.ownerDocument && this.id) {
|
|
8171
|
+
const parentLabels = this.proxy.labels;
|
|
8172
|
+
const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
|
|
8173
|
+
const labels = parentLabels ? forLabels.concat(Array.from(parentLabels)) : forLabels;
|
|
8174
|
+
return Object.freeze(labels);
|
|
7479
8175
|
} else {
|
|
7480
|
-
|
|
8176
|
+
return emptyArray;
|
|
7481
8177
|
}
|
|
7482
|
-
}
|
|
8178
|
+
}
|
|
7483
8179
|
/**
|
|
7484
|
-
*
|
|
7485
|
-
* @
|
|
8180
|
+
* Invoked when the `value` property changes
|
|
8181
|
+
* @param previous - the previous value
|
|
8182
|
+
* @param next - the new value
|
|
8183
|
+
*
|
|
8184
|
+
* @remarks
|
|
8185
|
+
* If elements extending `FormAssociated` implement a `valueChanged` method
|
|
8186
|
+
* They must be sure to invoke `super.valueChanged(previous, next)` to ensure
|
|
8187
|
+
* proper functioning of `FormAssociated`
|
|
7486
8188
|
*/
|
|
7487
|
-
|
|
7488
|
-
this.
|
|
7489
|
-
if (this.
|
|
7490
|
-
|
|
8189
|
+
valueChanged(previous, next) {
|
|
8190
|
+
this.dirtyValue = true;
|
|
8191
|
+
if (this.proxy instanceof HTMLElement) {
|
|
8192
|
+
this.proxy.value = this.value;
|
|
7491
8193
|
}
|
|
7492
|
-
|
|
8194
|
+
this.currentValue = this.value;
|
|
8195
|
+
this.setFormValue(this.value);
|
|
8196
|
+
this.validate();
|
|
8197
|
+
}
|
|
8198
|
+
currentValueChanged() {
|
|
8199
|
+
this.value = this.currentValue;
|
|
8200
|
+
}
|
|
7493
8201
|
/**
|
|
7494
|
-
*
|
|
7495
|
-
*
|
|
8202
|
+
* Invoked when the `initialValue` property changes
|
|
8203
|
+
*
|
|
8204
|
+
* @param previous - the previous value
|
|
8205
|
+
* @param next - the new value
|
|
8206
|
+
*
|
|
8207
|
+
* @remarks
|
|
8208
|
+
* If elements extending `FormAssociated` implement a `initialValueChanged` method
|
|
8209
|
+
* They must be sure to invoke `super.initialValueChanged(previous, next)` to ensure
|
|
8210
|
+
* proper functioning of `FormAssociated`
|
|
7496
8211
|
*/
|
|
7497
|
-
|
|
7498
|
-
this.
|
|
7499
|
-
|
|
7500
|
-
|
|
8212
|
+
initialValueChanged(previous, next) {
|
|
8213
|
+
if (!this.dirtyValue) {
|
|
8214
|
+
this.value = this.initialValue;
|
|
8215
|
+
this.dirtyValue = false;
|
|
8216
|
+
}
|
|
8217
|
+
}
|
|
8218
|
+
/**
|
|
8219
|
+
* Invoked when the `disabled` property changes
|
|
8220
|
+
*
|
|
8221
|
+
* @param previous - the previous value
|
|
8222
|
+
* @param next - the new value
|
|
8223
|
+
*
|
|
8224
|
+
* @remarks
|
|
8225
|
+
* If elements extending `FormAssociated` implement a `disabledChanged` method
|
|
8226
|
+
* They must be sure to invoke `super.disabledChanged(previous, next)` to ensure
|
|
8227
|
+
* proper functioning of `FormAssociated`
|
|
8228
|
+
*/
|
|
8229
|
+
disabledChanged(previous, next) {
|
|
8230
|
+
if (this.proxy instanceof HTMLElement) {
|
|
8231
|
+
this.proxy.disabled = this.disabled;
|
|
8232
|
+
}
|
|
8233
|
+
Updates.enqueue(() => this.classList.toggle("disabled", this.disabled));
|
|
8234
|
+
}
|
|
8235
|
+
/**
|
|
8236
|
+
* Invoked when the `name` property changes
|
|
8237
|
+
*
|
|
8238
|
+
* @param previous - the previous value
|
|
8239
|
+
* @param next - the new value
|
|
8240
|
+
*
|
|
8241
|
+
* @remarks
|
|
8242
|
+
* If elements extending `FormAssociated` implement a `nameChanged` method
|
|
8243
|
+
* They must be sure to invoke `super.nameChanged(previous, next)` to ensure
|
|
8244
|
+
* proper functioning of `FormAssociated`
|
|
8245
|
+
*/
|
|
8246
|
+
nameChanged(previous, next) {
|
|
8247
|
+
if (this.proxy instanceof HTMLElement) {
|
|
8248
|
+
this.proxy.name = this.name;
|
|
8249
|
+
}
|
|
8250
|
+
}
|
|
8251
|
+
/**
|
|
8252
|
+
* Invoked when the `required` property changes
|
|
8253
|
+
*
|
|
8254
|
+
* @param previous - the previous value
|
|
8255
|
+
* @param next - the new value
|
|
8256
|
+
*
|
|
8257
|
+
* @remarks
|
|
8258
|
+
* If elements extending `FormAssociated` implement a `requiredChanged` method
|
|
8259
|
+
* They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
|
|
8260
|
+
* proper functioning of `FormAssociated`
|
|
8261
|
+
*/
|
|
8262
|
+
requiredChanged(prev, next) {
|
|
8263
|
+
if (this.proxy instanceof HTMLElement) {
|
|
8264
|
+
this.proxy.required = this.required;
|
|
8265
|
+
}
|
|
8266
|
+
Updates.enqueue(() => this.classList.toggle("required", this.required));
|
|
8267
|
+
this.validate();
|
|
8268
|
+
}
|
|
8269
|
+
/**
|
|
8270
|
+
* The element internals object. Will only exist
|
|
8271
|
+
* in browsers supporting the attachInternals API
|
|
8272
|
+
*/
|
|
8273
|
+
get elementInternals() {
|
|
8274
|
+
if (!supportsElementInternals) {
|
|
8275
|
+
return null;
|
|
7501
8276
|
}
|
|
7502
|
-
|
|
7503
|
-
|
|
8277
|
+
let internals = InternalsMap.get(this);
|
|
8278
|
+
if (!internals) {
|
|
8279
|
+
internals = this.attachInternals();
|
|
8280
|
+
InternalsMap.set(this, internals);
|
|
7504
8281
|
}
|
|
7505
|
-
|
|
8282
|
+
return internals;
|
|
8283
|
+
}
|
|
7506
8284
|
/**
|
|
7507
|
-
* The task to set the positioning of the menu.
|
|
7508
8285
|
* @internal
|
|
7509
8286
|
*/
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
*
|
|
7517
|
-
* @param e - the keyboard event
|
|
7518
|
-
* @public
|
|
7519
|
-
*/
|
|
7520
|
-
this.handleTriggerKeydown = e => {
|
|
7521
|
-
if (e.defaultPrevented) {
|
|
7522
|
-
return;
|
|
8287
|
+
connectedCallback() {
|
|
8288
|
+
super.connectedCallback();
|
|
8289
|
+
this.addEventListener("keypress", this._keypressHandler);
|
|
8290
|
+
if (!this.value) {
|
|
8291
|
+
this.value = this.initialValue;
|
|
8292
|
+
this.dirtyValue = false;
|
|
7523
8293
|
}
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
this.toggleMenu();
|
|
7530
|
-
if (this.open) {
|
|
7531
|
-
this.focusMenuList();
|
|
7532
|
-
}
|
|
7533
|
-
break;
|
|
7534
|
-
default:
|
|
7535
|
-
return true;
|
|
8294
|
+
if (!this.elementInternals) {
|
|
8295
|
+
this.attachProxy();
|
|
8296
|
+
if (this.form) {
|
|
8297
|
+
this.form.addEventListener("reset", this.formResetCallback);
|
|
8298
|
+
}
|
|
7536
8299
|
}
|
|
7537
|
-
}
|
|
8300
|
+
}
|
|
7538
8301
|
/**
|
|
7539
|
-
* Handles document click events to close the menu when a click occurs outside of the menu or the trigger.
|
|
7540
8302
|
* @internal
|
|
7541
|
-
* @param e - The event triggered on document click.
|
|
7542
8303
|
*/
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
};
|
|
7548
|
-
}
|
|
7549
|
-
/**
|
|
7550
|
-
* Called when the element is connected to the DOM.
|
|
7551
|
-
* Sets up the component.
|
|
7552
|
-
* @public
|
|
7553
|
-
*/
|
|
7554
|
-
connectedCallback() {
|
|
7555
|
-
super.connectedCallback();
|
|
7556
|
-
Updates.enqueue(() => this.setComponent());
|
|
7557
|
-
}
|
|
7558
|
-
/**
|
|
7559
|
-
* Called when the element is disconnected from the DOM.
|
|
7560
|
-
* Removes event listeners.
|
|
7561
|
-
* @public
|
|
7562
|
-
*/
|
|
7563
|
-
disconnectedCallback() {
|
|
7564
|
-
super.disconnectedCallback();
|
|
7565
|
-
this.cleanup?.();
|
|
7566
|
-
this.removeListeners();
|
|
7567
|
-
}
|
|
7568
|
-
/**
|
|
7569
|
-
* Sets the component.
|
|
7570
|
-
* Sets the trigger and menu list elements and adds event listeners.
|
|
7571
|
-
* @public
|
|
7572
|
-
*/
|
|
7573
|
-
setComponent() {
|
|
7574
|
-
if (this.$fastController.isConnected && this.slottedMenuList.length && this.slottedTriggers.length) {
|
|
7575
|
-
this._trigger = this.slottedTriggers[0];
|
|
7576
|
-
this._menuList = this.slottedMenuList[0];
|
|
7577
|
-
this._trigger.setAttribute("aria-haspopup", "true");
|
|
7578
|
-
this._trigger.setAttribute("aria-expanded", `${this.open}`);
|
|
7579
|
-
this.addListeners();
|
|
7580
|
-
}
|
|
7581
|
-
}
|
|
7582
|
-
/**
|
|
7583
|
-
* Focuses on the menu list.
|
|
7584
|
-
* @public
|
|
7585
|
-
*/
|
|
7586
|
-
focusMenuList() {
|
|
7587
|
-
if (this.open && this._menuList) {
|
|
7588
|
-
Updates.enqueue(() => {
|
|
7589
|
-
this._menuList.focus();
|
|
7590
|
-
});
|
|
7591
|
-
}
|
|
7592
|
-
}
|
|
7593
|
-
/**
|
|
7594
|
-
* Focuses on the menu trigger.
|
|
7595
|
-
* @public
|
|
7596
|
-
*/
|
|
7597
|
-
focusTrigger() {
|
|
7598
|
-
if (!this.open && this._trigger) {
|
|
7599
|
-
Updates.enqueue(() => {
|
|
7600
|
-
this._trigger.focus();
|
|
7601
|
-
});
|
|
7602
|
-
}
|
|
7603
|
-
}
|
|
7604
|
-
/**
|
|
7605
|
-
* Called whenever the open state changes.
|
|
7606
|
-
* Updates the 'aria-expanded' attribute and sets the positioning of the menu.
|
|
7607
|
-
* Sets menu list position
|
|
7608
|
-
* emits openChanged event
|
|
7609
|
-
*
|
|
7610
|
-
* @param oldValue - The previous value of 'open'.
|
|
7611
|
-
* @param newValue - The new value of 'open'.
|
|
7612
|
-
* @public
|
|
7613
|
-
*/
|
|
7614
|
-
openChanged(oldValue, newValue) {
|
|
7615
|
-
if (this.$fastController.isConnected && this._trigger instanceof HTMLElement) {
|
|
7616
|
-
this._trigger.setAttribute("aria-expanded", `${this.open}`);
|
|
7617
|
-
if (this._menuList && this.open) {
|
|
7618
|
-
Updates.enqueue(this.setPositioningTask);
|
|
8304
|
+
disconnectedCallback() {
|
|
8305
|
+
this.proxyEventsToBlock.forEach(name => this.proxy.removeEventListener(name, this.stopPropagation));
|
|
8306
|
+
if (!this.elementInternals && this.form) {
|
|
8307
|
+
this.form.removeEventListener("reset", this.formResetCallback);
|
|
7619
8308
|
}
|
|
7620
8309
|
}
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
/**
|
|
7627
|
-
* Called whenever the 'openOnHover' property changes.
|
|
7628
|
-
* Adds or removes a 'mouseover' event listener to the trigger based on the new value.
|
|
7629
|
-
*
|
|
7630
|
-
* @param oldValue - The previous value of 'openOnHover'.
|
|
7631
|
-
* @param newValue - The new value of 'openOnHover'.
|
|
7632
|
-
* @public
|
|
7633
|
-
*/
|
|
7634
|
-
openOnHoverChanged(oldValue, newValue) {
|
|
7635
|
-
if (newValue) {
|
|
7636
|
-
this._trigger?.addEventListener("mouseover", this.openMenu);
|
|
7637
|
-
} else {
|
|
7638
|
-
this._trigger?.removeEventListener("mouseover", this.openMenu);
|
|
7639
|
-
}
|
|
7640
|
-
}
|
|
7641
|
-
/**
|
|
7642
|
-
* Called whenever the 'persistOnItemClick' property changes.
|
|
7643
|
-
* Adds or removes a 'click' event listener to the menu list based on the new value.
|
|
7644
|
-
* @public
|
|
7645
|
-
* @param oldValue - The previous value of 'persistOnItemClick'.
|
|
7646
|
-
* @param newValue - The new value of 'persistOnItemClick'.
|
|
7647
|
-
*/
|
|
7648
|
-
persistOnItemClickChanged(oldValue, newValue) {
|
|
7649
|
-
if (!newValue) {
|
|
7650
|
-
this._menuList?.addEventListener("click", this.closeMenu);
|
|
7651
|
-
} else {
|
|
7652
|
-
this._menuList?.removeEventListener("click", this.closeMenu);
|
|
7653
|
-
}
|
|
7654
|
-
}
|
|
7655
|
-
/**
|
|
7656
|
-
* Called whenever the 'openOnContext' property changes.
|
|
7657
|
-
* Adds or removes a 'contextmenu' event listener to the trigger based on the new value.
|
|
7658
|
-
* @public
|
|
7659
|
-
* @param oldValue - The previous value of 'openOnContext'.
|
|
7660
|
-
* @param newValue - The new value of 'openOnContext'.
|
|
7661
|
-
*/
|
|
7662
|
-
openOnContextChanged(oldValue, newValue) {
|
|
7663
|
-
if (newValue) {
|
|
7664
|
-
this._trigger?.addEventListener("contextmenu", this.openMenu);
|
|
7665
|
-
} else {
|
|
7666
|
-
this._trigger?.removeEventListener("contextmenu", this.openMenu);
|
|
8310
|
+
/**
|
|
8311
|
+
* Return the current validity of the element.
|
|
8312
|
+
*/
|
|
8313
|
+
checkValidity() {
|
|
8314
|
+
return this.elementInternals ? this.elementInternals.checkValidity() : this.proxy.checkValidity();
|
|
7667
8315
|
}
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
* @param newValue - The new value of 'closeOnScroll'.
|
|
7675
|
-
*/
|
|
7676
|
-
closeOnScrollChanged(oldValue, newValue) {
|
|
7677
|
-
if (newValue) {
|
|
7678
|
-
document.addEventListener("scroll", this.closeMenu);
|
|
7679
|
-
} else {
|
|
7680
|
-
document.removeEventListener("scroll", this.closeMenu);
|
|
8316
|
+
/**
|
|
8317
|
+
* Return the current validity of the element.
|
|
8318
|
+
* If false, fires an invalid event at the element.
|
|
8319
|
+
*/
|
|
8320
|
+
reportValidity() {
|
|
8321
|
+
return this.elementInternals ? this.elementInternals.reportValidity() : this.proxy.reportValidity();
|
|
7681
8322
|
}
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
middleware: [b$1(), k({
|
|
7698
|
-
apply: ({
|
|
7699
|
-
availableHeight,
|
|
7700
|
-
rects
|
|
7701
|
-
}) => {
|
|
7702
|
-
this.positioningContainer?.style && Object.assign(this.positioningContainer.style, {
|
|
7703
|
-
maxHeight: `${availableHeight}px`,
|
|
7704
|
-
width: `${rects.reference.width}px`
|
|
7705
|
-
});
|
|
7706
|
-
}
|
|
7707
|
-
}), P$1()]
|
|
7708
|
-
});
|
|
7709
|
-
if (middlewareData.hide?.referenceHidden) {
|
|
7710
|
-
this.open = false;
|
|
7711
|
-
return;
|
|
7712
|
-
}
|
|
7713
|
-
this.positioningContainer?.style && Object.assign(this.positioningContainer.style, {
|
|
7714
|
-
position: "fixed",
|
|
7715
|
-
top: "0",
|
|
7716
|
-
left: "0",
|
|
7717
|
-
transform: `translate(${x}px, ${y}px)`
|
|
7718
|
-
});
|
|
7719
|
-
});
|
|
8323
|
+
/**
|
|
8324
|
+
* Set the validity of the control. In cases when the elementInternals object is not
|
|
8325
|
+
* available (and the proxy element is used to report validity), this function will
|
|
8326
|
+
* do nothing unless a message is provided, at which point the setCustomValidity method
|
|
8327
|
+
* of the proxy element will be invoked with the provided message.
|
|
8328
|
+
* @param flags - Validity flags
|
|
8329
|
+
* @param message - Optional message to supply
|
|
8330
|
+
* @param anchor - Optional element used by UA to display an interactive validation UI
|
|
8331
|
+
*/
|
|
8332
|
+
setValidity(flags, message, anchor) {
|
|
8333
|
+
if (this.elementInternals) {
|
|
8334
|
+
this.elementInternals.setValidity(flags, message, anchor);
|
|
8335
|
+
} else if (typeof message === "string") {
|
|
8336
|
+
this.proxy.setCustomValidity(message);
|
|
8337
|
+
}
|
|
7720
8338
|
}
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
addListeners() {
|
|
7729
|
-
document.addEventListener("click", this.handleDocumentClick);
|
|
7730
|
-
this._trigger?.addEventListener("keydown", this.handleTriggerKeydown);
|
|
7731
|
-
if (!this.persistOnItemClick) {
|
|
7732
|
-
this._menuList?.addEventListener("click", this.closeMenu);
|
|
8339
|
+
/**
|
|
8340
|
+
* Invoked when a connected component's form or fieldset has its disabled
|
|
8341
|
+
* state changed.
|
|
8342
|
+
* @param disabled - the disabled value of the form / fieldset
|
|
8343
|
+
*/
|
|
8344
|
+
formDisabledCallback(disabled) {
|
|
8345
|
+
this.disabled = disabled;
|
|
7733
8346
|
}
|
|
7734
|
-
|
|
7735
|
-
this.
|
|
7736
|
-
|
|
7737
|
-
this._trigger?.addEventListener("contextmenu", this.openMenu);
|
|
7738
|
-
} else {
|
|
7739
|
-
this._trigger?.addEventListener("click", this.toggleMenu);
|
|
8347
|
+
formResetCallback() {
|
|
8348
|
+
this.value = this.initialValue;
|
|
8349
|
+
this.dirtyValue = false;
|
|
7740
8350
|
}
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
8351
|
+
/**
|
|
8352
|
+
* Attach the proxy element to the DOM
|
|
8353
|
+
*/
|
|
8354
|
+
attachProxy() {
|
|
8355
|
+
if (!this.proxyInitialized) {
|
|
8356
|
+
this.proxyInitialized = true;
|
|
8357
|
+
this.proxy.style.display = "none";
|
|
8358
|
+
this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
|
|
8359
|
+
this.proxy.disabled = this.disabled;
|
|
8360
|
+
this.proxy.required = this.required;
|
|
8361
|
+
if (typeof this.name === "string") {
|
|
8362
|
+
this.proxy.name = this.name;
|
|
8363
|
+
}
|
|
8364
|
+
if (typeof this.value === "string") {
|
|
8365
|
+
this.proxy.value = this.value;
|
|
8366
|
+
}
|
|
8367
|
+
this.proxy.setAttribute("slot", proxySlotName);
|
|
8368
|
+
this.proxySlot = document.createElement("slot");
|
|
8369
|
+
this.proxySlot.setAttribute("name", proxySlotName);
|
|
8370
|
+
}
|
|
8371
|
+
this.shadowRoot?.appendChild(this.proxySlot);
|
|
8372
|
+
this.appendChild(this.proxy);
|
|
7753
8373
|
}
|
|
7754
|
-
|
|
7755
|
-
|
|
8374
|
+
/**
|
|
8375
|
+
* Detach the proxy element from the DOM
|
|
8376
|
+
*/
|
|
8377
|
+
detachProxy() {
|
|
8378
|
+
this.removeChild(this.proxy);
|
|
8379
|
+
this.shadowRoot?.removeChild(this.proxySlot);
|
|
7756
8380
|
}
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
8381
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
8382
|
+
validate(anchor) {
|
|
8383
|
+
if (this.proxy instanceof HTMLElement) {
|
|
8384
|
+
this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
|
|
8385
|
+
}
|
|
7761
8386
|
}
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
if (e.defaultPrevented) {
|
|
7772
|
-
return;
|
|
8387
|
+
/**
|
|
8388
|
+
* Associates the provided value (and optional state) with the parent form.
|
|
8389
|
+
* @param value - The value to set
|
|
8390
|
+
* @param state - The state object provided to during session restores and when autofilling.
|
|
8391
|
+
*/
|
|
8392
|
+
setFormValue(value, state) {
|
|
8393
|
+
if (this.elementInternals) {
|
|
8394
|
+
this.elementInternals.setFormValue(value, state || value);
|
|
8395
|
+
}
|
|
7773
8396
|
}
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
case keyTab:
|
|
7784
|
-
if (this.open) {
|
|
7785
|
-
this.closeMenu();
|
|
7786
|
-
}
|
|
7787
|
-
if (e.shiftKey) {
|
|
7788
|
-
this.focusTrigger();
|
|
7789
|
-
}
|
|
7790
|
-
default:
|
|
7791
|
-
return true;
|
|
8397
|
+
_keypressHandler(e) {
|
|
8398
|
+
switch (e.key) {
|
|
8399
|
+
case keyEnter:
|
|
8400
|
+
if (this.form instanceof HTMLFormElement) {
|
|
8401
|
+
const defaultButton = this.form.querySelector("[type=submit]");
|
|
8402
|
+
defaultButton?.click();
|
|
8403
|
+
}
|
|
8404
|
+
break;
|
|
8405
|
+
}
|
|
7792
8406
|
}
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
})
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
const styles$c = css`
|
|
7818
|
-
:host{position:relative;z-index:var(--z-index-menu,1)}.positioning-container{position:fixed;top:0;left:0;transform:translate(0,0)}`;
|
|
7819
|
-
|
|
7820
|
-
function menuTemplate() {
|
|
7821
|
-
return html`<template ?open-on-hover="${x => x.openOnHover}" ?open-on-context="${x => x.openOnContext}" ?close-on-scroll="${x => x.closeOnScroll}" ?persist-on-item-click="${x => x.persistOnItemClick}" @keydown="${(x, c) => x.handleMenuKeydown(c.event)}"><slot name="trigger" ${slotted({
|
|
7822
|
-
property: "slottedTriggers",
|
|
7823
|
-
filter: elements()
|
|
7824
|
-
})}></slot><span ${ref("positioningContainer")} part="positioning-container" class="positioning-container" ?hidden="${x => !x.open}"><slot ${slotted({
|
|
7825
|
-
property: "slottedMenuList",
|
|
7826
|
-
filter: elements()
|
|
7827
|
-
})}></slot></span></template>`;
|
|
8407
|
+
/**
|
|
8408
|
+
* Used to stop propagation of proxy element events
|
|
8409
|
+
* @param e - Event object
|
|
8410
|
+
*/
|
|
8411
|
+
stopPropagation(e) {
|
|
8412
|
+
e.stopPropagation();
|
|
8413
|
+
}
|
|
8414
|
+
};
|
|
8415
|
+
attr({
|
|
8416
|
+
mode: "boolean"
|
|
8417
|
+
})(C.prototype, "disabled");
|
|
8418
|
+
attr({
|
|
8419
|
+
mode: "fromView",
|
|
8420
|
+
attribute: "value"
|
|
8421
|
+
})(C.prototype, "initialValue");
|
|
8422
|
+
attr({
|
|
8423
|
+
attribute: "current-value"
|
|
8424
|
+
})(C.prototype, "currentValue");
|
|
8425
|
+
attr(C.prototype, "name");
|
|
8426
|
+
attr({
|
|
8427
|
+
mode: "boolean"
|
|
8428
|
+
})(C.prototype, "required");
|
|
8429
|
+
observable(C.prototype, "value");
|
|
8430
|
+
return C;
|
|
7828
8431
|
}
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
8432
|
+
function CheckableFormAssociated(BaseCtor) {
|
|
8433
|
+
class C extends FormAssociated(BaseCtor) {}
|
|
8434
|
+
class D extends C {
|
|
8435
|
+
constructor(...args) {
|
|
8436
|
+
super(args);
|
|
8437
|
+
/**
|
|
8438
|
+
* Tracks whether the "checked" property has been changed.
|
|
8439
|
+
* This is necessary to provide consistent behavior with
|
|
8440
|
+
* normal input checkboxes
|
|
8441
|
+
*/
|
|
8442
|
+
this.dirtyChecked = false;
|
|
8443
|
+
/**
|
|
8444
|
+
* Provides the default checkedness of the input element
|
|
8445
|
+
* Passed down to proxy
|
|
8446
|
+
*
|
|
8447
|
+
* @public
|
|
8448
|
+
* @remarks
|
|
8449
|
+
* HTML Attribute: checked
|
|
8450
|
+
*/
|
|
8451
|
+
this.checkedAttribute = false;
|
|
8452
|
+
/**
|
|
8453
|
+
* The checked state of the control.
|
|
8454
|
+
*
|
|
8455
|
+
* @public
|
|
8456
|
+
*/
|
|
8457
|
+
this.checked = false;
|
|
8458
|
+
this.dirtyChecked = false;
|
|
8459
|
+
}
|
|
8460
|
+
checkedAttributeChanged() {
|
|
8461
|
+
this.defaultChecked = this.checkedAttribute;
|
|
8462
|
+
}
|
|
8463
|
+
/**
|
|
8464
|
+
* @internal
|
|
8465
|
+
*/
|
|
8466
|
+
defaultCheckedChanged() {
|
|
8467
|
+
if (!this.dirtyChecked) {
|
|
8468
|
+
this.checked = this.defaultChecked;
|
|
8469
|
+
this.dirtyChecked = false;
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
checkedChanged(prev, next) {
|
|
8473
|
+
if (!this.dirtyChecked) {
|
|
8474
|
+
this.dirtyChecked = true;
|
|
8475
|
+
}
|
|
8476
|
+
this.currentChecked = this.checked;
|
|
8477
|
+
this.updateForm();
|
|
8478
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
8479
|
+
this.proxy.checked = this.checked;
|
|
8480
|
+
}
|
|
8481
|
+
if (prev !== void 0) {
|
|
8482
|
+
this.$emit("change");
|
|
8483
|
+
}
|
|
8484
|
+
this.validate();
|
|
7858
8485
|
}
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
8486
|
+
currentCheckedChanged(prev, next) {
|
|
8487
|
+
this.checked = this.currentChecked;
|
|
8488
|
+
}
|
|
8489
|
+
updateForm() {
|
|
8490
|
+
const value = this.checked ? this.value : null;
|
|
8491
|
+
this.setFormValue(value, value);
|
|
8492
|
+
}
|
|
8493
|
+
connectedCallback() {
|
|
8494
|
+
super.connectedCallback();
|
|
8495
|
+
this.updateForm();
|
|
8496
|
+
}
|
|
8497
|
+
formResetCallback() {
|
|
8498
|
+
super.formResetCallback();
|
|
8499
|
+
this.checked = !!this.checkedAttribute;
|
|
8500
|
+
this.dirtyChecked = false;
|
|
7863
8501
|
}
|
|
7864
8502
|
}
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
const range = max - min;
|
|
7877
|
-
this.percentComplete = range === 0 ? 0 : Math.fround((value - min) / range * 100);
|
|
7878
|
-
}
|
|
7879
|
-
}
|
|
7880
|
-
__decorateClass$b([attr({
|
|
7881
|
-
converter: nullableNumberConverter
|
|
7882
|
-
})], BaseProgress.prototype, "value", 2);
|
|
7883
|
-
__decorateClass$b([attr({
|
|
7884
|
-
converter: nullableNumberConverter
|
|
7885
|
-
})], BaseProgress.prototype, "min", 2);
|
|
7886
|
-
__decorateClass$b([attr({
|
|
7887
|
-
converter: nullableNumberConverter
|
|
7888
|
-
})], BaseProgress.prototype, "max", 2);
|
|
7889
|
-
__decorateClass$b([observable], BaseProgress.prototype, "percentComplete", 2);
|
|
7890
|
-
|
|
7891
|
-
var __defProp$a = Object.defineProperty;
|
|
7892
|
-
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
7893
|
-
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
7894
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
7895
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7896
|
-
if (kind && result) __defProp$a(target, key, result);
|
|
7897
|
-
return result;
|
|
7898
|
-
};
|
|
7899
|
-
class ProgressBar extends BaseProgress {
|
|
7900
|
-
constructor() {
|
|
7901
|
-
super(...arguments);
|
|
7902
|
-
this.validationState = null;
|
|
7903
|
-
}
|
|
7904
|
-
}
|
|
7905
|
-
__decorateClass$a([attr], ProgressBar.prototype, "thickness", 2);
|
|
7906
|
-
__decorateClass$a([attr], ProgressBar.prototype, "shape", 2);
|
|
7907
|
-
__decorateClass$a([attr({
|
|
7908
|
-
attribute: "validation-state"
|
|
7909
|
-
})], ProgressBar.prototype, "validationState", 2);
|
|
7910
|
-
|
|
7911
|
-
const styles$b = css`
|
|
7912
|
-
${display("flex")}
|
|
7913
|
-
|
|
7914
|
-
:host{align-items:center;height:2px;overflow-x:hidden;border-radius:${borderRadiusMedium};contain:content}:host([thickness='large']),:host([thickness='large']) .progress,:host([thickness='large']) .determinate{height:4px}:host([shape='square']),:host([shape='square']) .progress,:host([shape='square']) .determinate{border-radius:0}:host([validation-state='error']) .determinate{background-color:${colorPaletteRedBackground3}}:host([validation-state='error']) .indeterminate-indicator-1,:host([validation-state='error']) .indeterminate-indicator-2{background:linear-gradient(
|
|
7915
|
-
to right,${colorPaletteRedBackground2} 0%,${colorPaletteRedBackground3} 50%,${colorPaletteRedBackground2}
|
|
7916
|
-
)}:host([validation-state='warning']) .determinate{background-color:${colorPaletteDarkOrangeBackground3}}:host([validation-state='warning']) .indeterminate-indicator-1,:host([validation-state='warning']) .indeterminate-indicator-2{background:linear-gradient(
|
|
7917
|
-
to right,${colorPaletteDarkOrangeBackground2} 0%,${colorPaletteDarkOrangeBackground3} 50%,${colorPaletteDarkOrangeBackground2}
|
|
7918
|
-
)}:host([validation-state='success']) .determinate{background-color:${colorPaletteGreenBackground3}}:host([validation-state='success']) .indeterminate-indicator-1,:host([validation-state='success']) .indeterminate-indicator-2{background:linear-gradient(
|
|
7919
|
-
to right,${colorPaletteGreenBackground2} 0%,${colorPaletteGreenBackground3} 50%,${colorPaletteGreenBackground2}
|
|
7920
|
-
)}.progress{background-color:${colorNeutralBackground6};border-radius:${borderRadiusMedium};width:100%;height:2px;display:flex;align-items:center;position:relative}.determinate{background-color:${colorCompoundBrandBackground};border-radius:${borderRadiusMedium};height:2px;transition:all 0.2s ease-in-out;display:flex}.indeterminate-indicator-1{position:absolute;opacity:0;height:100%;background:linear-gradient(
|
|
7921
|
-
to right,${colorBrandBackground2} 0%,${colorCompoundBrandBackground} 50%,${colorBrandBackground2}
|
|
7922
|
-
);border-radius:${borderRadiusMedium};animation-timing-function:cubic-bezier(0.4,0,0.6,1);width:40%;animation:indeterminate-1 3s infinite}.indeterminate-indicator-2{position:absolute;opacity:0;height:100%;background:linear-gradient(
|
|
7923
|
-
to right,${colorBrandBackground2} 0%,${colorCompoundBrandBackground} 50%,${colorBrandBackground2}
|
|
7924
|
-
);border-radius:${borderRadiusMedium};animation-timing-function:cubic-bezier(0.4,0,0.6,1);width:60%;animation:indeterminate-2 3s infinite}@keyframes indeterminate-1{0%{opacity:1;transform:translateX(-100%)}70%{opacity:1;transform:translateX(300%)}70.01%{opacity:0}100%{opacity:0;transform:translateX(300%)}}@keyframes indeterminate-2{0%{opacity:0;transform:translateX(-150%)}29.99%{opacity:0}30%{opacity:1;transform:translateX(-150%)}100%{transform:translateX(166.66%);opacity:1}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
7925
|
-
.progress{background-color:HighlightText}.determinate,:host([validation-state='success']) .determinate,:host([validation-state='warning']) .determinate,:host([validation-state='error']) .determinate,:host([validation-state='success']) ..indeterminate-indicator-1,:host([validation-state='success']) ..indeterminate-indicator-2,:host([validation-state='warning']) .indeterminate-indicator-1,:host([validation-state='warning']) .indeterminate-indicator-2,:host([validation-state='error']) .indeterminate-indicator-1,:host([validation-state='error']) .indeterminate-indicator-2{background-color:Highlight}`));
|
|
7926
|
-
|
|
7927
|
-
function progressTemplate(options = {}) {
|
|
7928
|
-
return html`<template role="progressbar" aria-valuenow="${x => x.value}" aria-valuemin="${x => x.min}" aria-valuemax="${x => x.max}">${when(x => typeof x.value === "number", html`<div class="progress" part="progress" slot="determinate"><div class="determinate" part="determinate" style="width: ${x => x.percentComplete}%"></div></div>`, html`<div class="progress" part="progress" slot="indeterminate"><slot name="indeterminate">${staticallyCompose(options.indeterminateIndicator1)} ${staticallyCompose(options.indeterminateIndicator2)}</slot></div>`)}</template>`;
|
|
8503
|
+
attr({
|
|
8504
|
+
attribute: "checked",
|
|
8505
|
+
mode: "boolean"
|
|
8506
|
+
})(D.prototype, "checkedAttribute");
|
|
8507
|
+
attr({
|
|
8508
|
+
attribute: "current-checked",
|
|
8509
|
+
converter: booleanConverter
|
|
8510
|
+
})(D.prototype, "currentChecked");
|
|
8511
|
+
observable(D.prototype, "defaultChecked");
|
|
8512
|
+
observable(D.prototype, "checked");
|
|
8513
|
+
return D;
|
|
7929
8514
|
}
|
|
7930
|
-
const template$b = progressTemplate({
|
|
7931
|
-
indeterminateIndicator1: `<span class="indeterminate-indicator-1" part="indeterminate-indicator-1></span>`,
|
|
7932
|
-
indeterminateIndicator2: `<span class="indeterminate-indicator-2" part="indeterminate-indicator-2"></span>`
|
|
7933
|
-
});
|
|
7934
|
-
|
|
7935
|
-
const definition$b = ProgressBar.compose({
|
|
7936
|
-
name: `${FluentDesignSystem.prefix}-progress-bar`,
|
|
7937
|
-
template: template$b,
|
|
7938
|
-
styles: styles$b
|
|
7939
|
-
});
|
|
7940
|
-
|
|
7941
|
-
definition$b.define(FluentDesignSystem.registry);
|
|
7942
8515
|
|
|
7943
8516
|
class _Radio extends FASTElement {}
|
|
7944
8517
|
class FormAssociatedRadio extends CheckableFormAssociated(_Radio) {
|
|
@@ -7948,12 +8521,12 @@ class FormAssociatedRadio extends CheckableFormAssociated(_Radio) {
|
|
|
7948
8521
|
}
|
|
7949
8522
|
}
|
|
7950
8523
|
|
|
7951
|
-
var __defProp$
|
|
7952
|
-
var __getOwnPropDesc$
|
|
7953
|
-
var __decorateClass$
|
|
7954
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8524
|
+
var __defProp$8 = Object.defineProperty;
|
|
8525
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
8526
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
8527
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
7955
8528
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7956
|
-
if (kind && result) __defProp$
|
|
8529
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
7957
8530
|
return result;
|
|
7958
8531
|
};
|
|
7959
8532
|
class Radio extends FormAssociatedRadio {
|
|
@@ -8020,17 +8593,17 @@ class Radio extends FormAssociatedRadio {
|
|
|
8020
8593
|
return true;
|
|
8021
8594
|
}
|
|
8022
8595
|
}
|
|
8023
|
-
__decorateClass$
|
|
8024
|
-
__decorateClass$
|
|
8596
|
+
__decorateClass$8([observable], Radio.prototype, "name", 2);
|
|
8597
|
+
__decorateClass$8([observable], Radio.prototype, "defaultSlottedNodes", 2);
|
|
8025
8598
|
|
|
8026
8599
|
const RadioGroupOrientation = Orientation;
|
|
8027
8600
|
|
|
8028
|
-
var __defProp$
|
|
8029
|
-
var __getOwnPropDesc$
|
|
8030
|
-
var __decorateClass$
|
|
8031
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8601
|
+
var __defProp$7 = Object.defineProperty;
|
|
8602
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
8603
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
8604
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
8032
8605
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8033
|
-
if (kind && result) __defProp$
|
|
8606
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
8034
8607
|
return result;
|
|
8035
8608
|
};
|
|
8036
8609
|
class RadioGroup extends FASTElement {
|
|
@@ -8333,22 +8906,22 @@ class RadioGroup extends FASTElement {
|
|
|
8333
8906
|
}
|
|
8334
8907
|
}
|
|
8335
8908
|
}
|
|
8336
|
-
__decorateClass$
|
|
8909
|
+
__decorateClass$7([attr({
|
|
8337
8910
|
mode: "boolean"
|
|
8338
8911
|
})], RadioGroup.prototype, "stacked", 2);
|
|
8339
|
-
__decorateClass$
|
|
8912
|
+
__decorateClass$7([attr({
|
|
8340
8913
|
attribute: "readonly",
|
|
8341
8914
|
mode: "boolean"
|
|
8342
8915
|
})], RadioGroup.prototype, "readOnly", 2);
|
|
8343
|
-
__decorateClass$
|
|
8916
|
+
__decorateClass$7([attr({
|
|
8344
8917
|
attribute: "disabled",
|
|
8345
8918
|
mode: "boolean"
|
|
8346
8919
|
})], RadioGroup.prototype, "disabled", 2);
|
|
8347
|
-
__decorateClass$
|
|
8348
|
-
__decorateClass$
|
|
8349
|
-
__decorateClass$
|
|
8350
|
-
__decorateClass$
|
|
8351
|
-
__decorateClass$
|
|
8920
|
+
__decorateClass$7([attr], RadioGroup.prototype, "name", 2);
|
|
8921
|
+
__decorateClass$7([attr], RadioGroup.prototype, "value", 2);
|
|
8922
|
+
__decorateClass$7([attr], RadioGroup.prototype, "orientation", 2);
|
|
8923
|
+
__decorateClass$7([observable], RadioGroup.prototype, "childItems", 2);
|
|
8924
|
+
__decorateClass$7([observable], RadioGroup.prototype, "slottedRadioButtons", 2);
|
|
8352
8925
|
|
|
8353
8926
|
const styles$a = css`
|
|
8354
8927
|
${display("flex")}
|
|
@@ -8416,12 +8989,12 @@ function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
|
|
|
8416
8989
|
return pct;
|
|
8417
8990
|
}
|
|
8418
8991
|
|
|
8419
|
-
var __defProp$
|
|
8420
|
-
var __getOwnPropDesc$
|
|
8421
|
-
var __decorateClass$
|
|
8422
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8992
|
+
var __defProp$6 = Object.defineProperty;
|
|
8993
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
8994
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
8995
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
8423
8996
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8424
|
-
if (kind && result) __defProp$
|
|
8997
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
8425
8998
|
return result;
|
|
8426
8999
|
};
|
|
8427
9000
|
class Slider extends FormAssociatedSlider {
|
|
@@ -8750,31 +9323,31 @@ class Slider extends FormAssociatedSlider {
|
|
|
8750
9323
|
return constrainedValue + this.min;
|
|
8751
9324
|
}
|
|
8752
9325
|
}
|
|
8753
|
-
__decorateClass$
|
|
8754
|
-
__decorateClass$
|
|
9326
|
+
__decorateClass$6([attr], Slider.prototype, "size", 2);
|
|
9327
|
+
__decorateClass$6([attr({
|
|
8755
9328
|
attribute: "readonly",
|
|
8756
9329
|
mode: "boolean"
|
|
8757
9330
|
})], Slider.prototype, "readOnly", 2);
|
|
8758
|
-
__decorateClass$
|
|
8759
|
-
__decorateClass$
|
|
8760
|
-
__decorateClass$
|
|
8761
|
-
__decorateClass$
|
|
8762
|
-
__decorateClass$
|
|
8763
|
-
__decorateClass$
|
|
8764
|
-
__decorateClass$
|
|
8765
|
-
__decorateClass$
|
|
8766
|
-
__decorateClass$
|
|
8767
|
-
__decorateClass$
|
|
9331
|
+
__decorateClass$6([observable], Slider.prototype, "direction", 2);
|
|
9332
|
+
__decorateClass$6([observable], Slider.prototype, "isDragging", 2);
|
|
9333
|
+
__decorateClass$6([observable], Slider.prototype, "position", 2);
|
|
9334
|
+
__decorateClass$6([observable], Slider.prototype, "trackWidth", 2);
|
|
9335
|
+
__decorateClass$6([observable], Slider.prototype, "trackMinWidth", 2);
|
|
9336
|
+
__decorateClass$6([observable], Slider.prototype, "trackHeight", 2);
|
|
9337
|
+
__decorateClass$6([observable], Slider.prototype, "trackLeft", 2);
|
|
9338
|
+
__decorateClass$6([observable], Slider.prototype, "trackMinHeight", 2);
|
|
9339
|
+
__decorateClass$6([observable], Slider.prototype, "valueTextFormatter", 2);
|
|
9340
|
+
__decorateClass$6([attr({
|
|
8768
9341
|
converter: nullableNumberConverter
|
|
8769
9342
|
})], Slider.prototype, "min", 2);
|
|
8770
|
-
__decorateClass$
|
|
9343
|
+
__decorateClass$6([attr({
|
|
8771
9344
|
converter: nullableNumberConverter
|
|
8772
9345
|
})], Slider.prototype, "max", 2);
|
|
8773
|
-
__decorateClass$
|
|
9346
|
+
__decorateClass$6([attr({
|
|
8774
9347
|
converter: nullableNumberConverter
|
|
8775
9348
|
})], Slider.prototype, "step", 2);
|
|
8776
|
-
__decorateClass$
|
|
8777
|
-
__decorateClass$
|
|
9349
|
+
__decorateClass$6([attr], Slider.prototype, "orientation", 2);
|
|
9350
|
+
__decorateClass$6([attr], Slider.prototype, "mode", 2);
|
|
8778
9351
|
|
|
8779
9352
|
const styles$8 = css`
|
|
8780
9353
|
${display("inline-grid")} :host{--thumb-size:18px;--thumb-padding:3px;--thumb-translate:calc(var(--thumb-size) * -0.5 + var(--track-width) / 2);--track-overhang:-2px;--track-width:4px;--fast-slider-height:calc(var(--thumb-size) * 10);--slider-direction:90deg;align-items:center;box-sizing:border-box;outline:none;cursor:pointer;user-select:none;border-radius:${borderRadiusSmall};touch-action:pan-y;min-width:calc(var(--thumb-size) * 1px);width:100%}:host([size='small']){--thumb-size:14px;--track-width:2px;--thumb-padding:3px}:host([orientation='vertical']){--slider-direction:0deg;height:160px;min-height:var(--thumb-size);touch-action:pan-x;padding:8px 0;width:auto;min-width:auto}:host([disabled]:hover){cursor:initial}:host(:focus-visible){box-shadow:0 0 0 2pt ${colorStrokeFocus2};outline:1px solid ${colorStrokeFocus1}}.thumb-cursor:focus{outline:0}.thumb-container{position:absolute;height:var(--thumb-size);width:var(--thumb-size);transition:all 0.2s ease}.thumb-container{transform:translateX(calc(var(--thumb-size) * 0.5)) translateY(calc(var(--thumb-translate) * -1.5))}:host([size='small']) .thumb-container{transform:translateX(calc(var(--thumb-size) * 0.5)) translateY(calc(var(--thumb-translate) * -1.35))}:host([orientation='vertical']) .thumb-container{transform:translateX(calc(var(--thumb-translate) * -1.5)) translateY(calc(var(--thumb-size) * -0.5))}:host([orientation='vertical'][size='small']) .thumb-container{transform:translateX(calc(var(--thumb-translate) * -1.35)) translateY(calc(var(--thumb-size) * -0.5))}.thumb-cursor{height:var(--thumb-size);width:var(--thumb-size);background-color:${colorBrandBackground};border-radius:${borderRadiusCircular};box-shadow:inset 0 0 0 var(--thumb-padding) ${colorNeutralBackground1},0 0 0 1px ${colorNeutralStroke1}}.thumb-cursor:hover{background-color:${colorCompoundBrandBackgroundHover}}.thumb-cursor:active{background-color:${colorCompoundBrandBackgroundPressed}}:host([disabled]) .thumb-cursor{background-color:${colorNeutralForegroundDisabled};box-shadow:inset 0 0 0 var(--thumb-padding) ${colorNeutralBackground1},0 0 0 1px ${colorNeutralStrokeDisabled}}.positioning-region{position:relative;display:grid}:host([orientation='horizontal']) .positioning-region{margin:0 8px;grid-template-rows:var(--thumb-size) var(--thumb-size)}:host([orientation='vertical']) .positioning-region{margin:8px 0;height:100%;grid-template-columns:var(--thumb-size) var(--thumb-size)}.track{align-self:start;position:absolute;background-color:${colorNeutralStrokeAccessible};border-radius:${borderRadiusMedium};overflow:hidden}:host([step]) .track::after{content:'';position:absolute;border-radius:${borderRadiusMedium};width:100%;inset:0 2px;background-image:repeating-linear-gradient(
|
|
@@ -8797,12 +9370,12 @@ const definition$8 = Slider.compose({
|
|
|
8797
9370
|
|
|
8798
9371
|
definition$8.define(FluentDesignSystem.registry);
|
|
8799
9372
|
|
|
8800
|
-
var __defProp$
|
|
8801
|
-
var __getOwnPropDesc$
|
|
8802
|
-
var __decorateClass$
|
|
8803
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
9373
|
+
var __defProp$5 = Object.defineProperty;
|
|
9374
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
9375
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
9376
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
8804
9377
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8805
|
-
if (kind && result) __defProp$
|
|
9378
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
8806
9379
|
return result;
|
|
8807
9380
|
};
|
|
8808
9381
|
class Spinner extends FASTElement {
|
|
@@ -8817,8 +9390,8 @@ class Spinner extends FASTElement {
|
|
|
8817
9390
|
this.elementInternals.role = "progressbar";
|
|
8818
9391
|
}
|
|
8819
9392
|
}
|
|
8820
|
-
__decorateClass$
|
|
8821
|
-
__decorateClass$
|
|
9393
|
+
__decorateClass$5([attr], Spinner.prototype, "size", 2);
|
|
9394
|
+
__decorateClass$5([attr], Spinner.prototype, "appearance", 2);
|
|
8822
9395
|
|
|
8823
9396
|
const styles$7 = css`
|
|
8824
9397
|
${display("flex")}
|
|
@@ -8835,84 +9408,21 @@ const definition$7 = Spinner.compose({
|
|
|
8835
9408
|
|
|
8836
9409
|
definition$7.define(FluentDesignSystem.registry);
|
|
8837
9410
|
|
|
8838
|
-
class
|
|
8839
|
-
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
8840
|
-
constructor() {
|
|
8841
|
-
super(...arguments);
|
|
8842
|
-
this.proxy = document.createElement("input");
|
|
8843
|
-
}
|
|
8844
|
-
}
|
|
8845
|
-
|
|
8846
|
-
var __defProp$5 = Object.defineProperty;
|
|
8847
|
-
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
8848
|
-
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
8849
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
8850
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8851
|
-
if (kind && result) __defProp$5(target, key, result);
|
|
8852
|
-
return result;
|
|
8853
|
-
};
|
|
8854
|
-
class Switch extends FormAssociatedSwitch {
|
|
8855
|
-
constructor() {
|
|
8856
|
-
super();
|
|
8857
|
-
/**
|
|
8858
|
-
* The element's value to be included in form submission when checked.
|
|
8859
|
-
* Default to "on" to reach parity with input[type="checkbox"]
|
|
8860
|
-
*
|
|
8861
|
-
* @internal
|
|
8862
|
-
*/
|
|
8863
|
-
this.initialValue = "on";
|
|
8864
|
-
/**
|
|
8865
|
-
* @internal
|
|
8866
|
-
*/
|
|
8867
|
-
this.keypressHandler = e => {
|
|
8868
|
-
if (this.readOnly) {
|
|
8869
|
-
return;
|
|
8870
|
-
}
|
|
8871
|
-
switch (e.key) {
|
|
8872
|
-
case keyEnter:
|
|
8873
|
-
case keySpace:
|
|
8874
|
-
this.checked = !this.checked;
|
|
8875
|
-
break;
|
|
8876
|
-
}
|
|
8877
|
-
};
|
|
8878
|
-
/**
|
|
8879
|
-
* @internal
|
|
8880
|
-
*/
|
|
8881
|
-
this.clickHandler = e => {
|
|
8882
|
-
if (!this.disabled && !this.readOnly) {
|
|
8883
|
-
this.checked = !this.checked;
|
|
8884
|
-
}
|
|
8885
|
-
};
|
|
8886
|
-
this.proxy.setAttribute("type", "checkbox");
|
|
8887
|
-
}
|
|
8888
|
-
// Map to proxy element
|
|
8889
|
-
readOnlyChanged() {
|
|
8890
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
8891
|
-
this.proxy.readOnly = this.readOnly;
|
|
8892
|
-
}
|
|
8893
|
-
}
|
|
8894
|
-
}
|
|
8895
|
-
__decorateClass$5([attr({
|
|
8896
|
-
attribute: "label-position"
|
|
8897
|
-
})], Switch.prototype, "labelPosition", 2);
|
|
8898
|
-
__decorateClass$5([attr({
|
|
8899
|
-
attribute: "readonly",
|
|
8900
|
-
mode: "boolean"
|
|
8901
|
-
})], Switch.prototype, "readOnly", 2);
|
|
8902
|
-
__decorateClass$5([observable], Switch.prototype, "defaultSlottedNodes", 2);
|
|
9411
|
+
class Switch extends BaseCheckbox {}
|
|
8903
9412
|
|
|
8904
9413
|
function switchTemplate(options = {}) {
|
|
8905
|
-
return html`<template
|
|
9414
|
+
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="switch">${staticallyCompose(options.switch)}</slot></template>`;
|
|
8906
9415
|
}
|
|
8907
9416
|
const template$6 = switchTemplate({
|
|
8908
9417
|
switch: `<span class="checked-indicator" part="checked-indicator"></span>`
|
|
8909
9418
|
});
|
|
8910
9419
|
|
|
9420
|
+
const checkedState = css.partial`:is([state--checked], :state(checked))`;
|
|
8911
9421
|
const styles$6 = css`
|
|
8912
9422
|
${display("inline-flex")}
|
|
8913
9423
|
|
|
8914
|
-
:host{align-items:center;flex-direction:row
|
|
8915
|
-
|
|
9424
|
+
:host{box-sizing:border-box;align-items:center;flex-direction:row;outline:none;user-select:none;contain:content;padding:0 ${spacingHorizontalXXS};width:40px;height:20px;background-color:${colorTransparentBackground};border:1px solid ${colorNeutralStrokeAccessible};border-radius:${borderRadiusCircular};cursor:pointer}:host(:hover){background:none;border-color:${colorNeutralStrokeAccessibleHover}}:host(:active){border-color:${colorNeutralStrokeAccessiblePressed}}:host(:disabled),:host([readonly]){border:1px solid ${colorNeutralStrokeDisabled};background-color:none;pointer:default}:host(${checkedState}){background:${colorCompoundBrandBackground};border-color:${colorCompoundBrandBackground}}:host(${checkedState}:hover){background:${colorCompoundBrandBackgroundHover};border-color:${colorCompoundBrandBackgroundHover}}:host(${checkedState}:active){background:${colorCompoundBrandBackgroundPressed};border-color:${colorCompoundBrandBackgroundPressed}}:host(${checkedState}:disabled){background:${colorNeutralBackgroundDisabled};border-color:${colorNeutralStrokeDisabled}}.checked-indicator{height:14px;width:14px;border-radius:50%;margin-inline-start:0;background-color:${colorNeutralForeground3};transition-duration:${durationNormal};transition-timing-function:${curveEasyEase};transition-property:margin-inline-start}:host(${checkedState}) .checked-indicator{background-color:${colorNeutralForegroundInverted};margin-inline-start:calc(100% - 14px)}:host(${checkedState}:hover) .checked-indicator{background:${colorNeutralForegroundInvertedHover}}:host(${checkedState}:active) .checked-indicator{background:${colorNeutralForegroundInvertedPressed}}:host(:hover) .checked-indicator{background-color:${colorNeutralForeground3Hover}}:host(:active) .checked-indicator{background-color:${colorNeutralForeground3Pressed}}:host(:disabled) .checked-indicator,:host([readonly]) .checked-indicator{background:${colorNeutralForegroundDisabled}}:host(${checkedState}:disabled) .checked-indicator{background:${colorNeutralForegroundDisabled}}:host(:focus-visible){outline:none}:host(:not([slot='input']):focus-visible){border-color:${colorTransparentStroke};outline:${strokeWidthThick} solid ${colorTransparentStroke};box-shadow:${shadow4},0 0 0 2px ${colorStrokeFocus2}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
9425
|
+
:host{border-color:InactiveBorder}:host(${checkedState}),:host(${checkedState}:active),:host(${checkedState}:hover){background:Highlight;border-color:Highlight}.checked-indicator,:host(:hover) .checked-indicator,:host(:active) .checked-indicator{background-color:ActiveCaption}:host(${checkedState}) .checked-indicator,:host(${checkedState}:hover) .checked-indicator,:host(${checkedState}:active) .checked-indicator{background-color:ButtonFace}`));
|
|
8916
9426
|
|
|
8917
9427
|
const definition$6 = Switch.compose({
|
|
8918
9428
|
name: `${FluentDesignSystem.prefix}-switch`,
|
|
@@ -9465,9 +9975,9 @@ class TextInput extends FASTElement {
|
|
|
9465
9975
|
*
|
|
9466
9976
|
* @internal
|
|
9467
9977
|
*/
|
|
9468
|
-
|
|
9978
|
+
readOnlyChanged() {
|
|
9469
9979
|
if (this.$fastController.isConnected) {
|
|
9470
|
-
this.elementInternals.ariaReadOnly = `${!!this.
|
|
9980
|
+
this.elementInternals.ariaReadOnly = `${!!this.readOnly}`;
|
|
9471
9981
|
}
|
|
9472
9982
|
}
|
|
9473
9983
|
/**
|
|
@@ -9501,7 +10011,7 @@ class TextInput extends FASTElement {
|
|
|
9501
10011
|
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validationMessage | `ElementInternals.validationMessage`} property.
|
|
9502
10012
|
*/
|
|
9503
10013
|
get validationMessage() {
|
|
9504
|
-
return this.elementInternals.validationMessage;
|
|
10014
|
+
return this.elementInternals.validationMessage || this.control.validationMessage;
|
|
9505
10015
|
}
|
|
9506
10016
|
/**
|
|
9507
10017
|
* The current value of the input.
|
|
@@ -9540,6 +10050,17 @@ class TextInput extends FASTElement {
|
|
|
9540
10050
|
get form() {
|
|
9541
10051
|
return this.elementInternals.form;
|
|
9542
10052
|
}
|
|
10053
|
+
/**
|
|
10054
|
+
* Handles the internal control's `keypress` event.
|
|
10055
|
+
*
|
|
10056
|
+
* @internal
|
|
10057
|
+
*/
|
|
10058
|
+
beforeinputHandler(e) {
|
|
10059
|
+
if (e.inputType === "insertLineBreak") {
|
|
10060
|
+
this.implicitSubmit();
|
|
10061
|
+
}
|
|
10062
|
+
return true;
|
|
10063
|
+
}
|
|
9543
10064
|
/**
|
|
9544
10065
|
* Change event handler for inner control.
|
|
9545
10066
|
*
|
|
@@ -9549,23 +10070,46 @@ class TextInput extends FASTElement {
|
|
|
9549
10070
|
* proxies the change event, emitting a `change` event whenever the internal control emits a `change` event.
|
|
9550
10071
|
*/
|
|
9551
10072
|
changeHandler(e) {
|
|
9552
|
-
e.preventDefault();
|
|
9553
10073
|
this.setValidity();
|
|
9554
10074
|
this.$emit("change", e, {
|
|
9555
10075
|
bubbles: true,
|
|
9556
|
-
|
|
9557
|
-
composed: false
|
|
10076
|
+
composed: true
|
|
9558
10077
|
});
|
|
10078
|
+
return true;
|
|
10079
|
+
}
|
|
10080
|
+
/**
|
|
10081
|
+
* Checks the validity of the element and returns the result.
|
|
10082
|
+
*
|
|
10083
|
+
* @public
|
|
10084
|
+
* @remarks
|
|
10085
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity | `HTMLInputElement.checkValidity()`} method.
|
|
10086
|
+
*/
|
|
10087
|
+
checkValidity() {
|
|
10088
|
+
return this.elementInternals.checkValidity();
|
|
10089
|
+
}
|
|
10090
|
+
/**
|
|
10091
|
+
* Clicks the inner control when the component is clicked.
|
|
10092
|
+
*
|
|
10093
|
+
* @param e - the event object
|
|
10094
|
+
*/
|
|
10095
|
+
clickHandler(e) {
|
|
10096
|
+
if (this.isSameNode(e.target)) {
|
|
10097
|
+
this.control?.click();
|
|
10098
|
+
}
|
|
9559
10099
|
}
|
|
9560
10100
|
connectedCallback() {
|
|
9561
10101
|
super.connectedCallback();
|
|
9562
|
-
this.addEventListener("keypress", this.keypressHandler);
|
|
9563
10102
|
this.setFormValue(this.value);
|
|
9564
10103
|
this.setValidity();
|
|
9565
10104
|
}
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
10105
|
+
/**
|
|
10106
|
+
* Focuses the inner control when the component is focused.
|
|
10107
|
+
*
|
|
10108
|
+
* @param e - the event object
|
|
10109
|
+
* @public
|
|
10110
|
+
*/
|
|
10111
|
+
focusinHandler(e) {
|
|
10112
|
+
this.control?.focus();
|
|
9569
10113
|
}
|
|
9570
10114
|
/**
|
|
9571
10115
|
* Resets the value to its initial value when the form is reset.
|
|
@@ -9612,12 +10156,13 @@ class TextInput extends FASTElement {
|
|
|
9612
10156
|
return true;
|
|
9613
10157
|
}
|
|
9614
10158
|
/**
|
|
9615
|
-
* Handles the internal control's `
|
|
10159
|
+
* Handles the internal control's `keydown` event.
|
|
9616
10160
|
*
|
|
10161
|
+
* @param e - the event object
|
|
9617
10162
|
* @internal
|
|
9618
10163
|
*/
|
|
9619
|
-
|
|
9620
|
-
if (e.key ===
|
|
10164
|
+
keydownHandler(e) {
|
|
10165
|
+
if (e.key === "Enter") {
|
|
9621
10166
|
this.implicitSubmit();
|
|
9622
10167
|
}
|
|
9623
10168
|
return true;
|
|
@@ -9635,6 +10180,28 @@ class TextInput extends FASTElement {
|
|
|
9635
10180
|
this.control.select();
|
|
9636
10181
|
this.$emit("select");
|
|
9637
10182
|
}
|
|
10183
|
+
/**
|
|
10184
|
+
* Sets the custom validity message.
|
|
10185
|
+
* @param message - The message to set
|
|
10186
|
+
*
|
|
10187
|
+
* @public
|
|
10188
|
+
*/
|
|
10189
|
+
setCustomValidity(message) {
|
|
10190
|
+
this.elementInternals.setValidity({
|
|
10191
|
+
customError: true
|
|
10192
|
+
}, message);
|
|
10193
|
+
this.reportValidity();
|
|
10194
|
+
}
|
|
10195
|
+
/**
|
|
10196
|
+
* Reports the validity of the element.
|
|
10197
|
+
*
|
|
10198
|
+
* @public
|
|
10199
|
+
* @remarks
|
|
10200
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity | `HTMLInputElement.reportValidity()`} method.
|
|
10201
|
+
*/
|
|
10202
|
+
reportValidity() {
|
|
10203
|
+
return this.elementInternals.reportValidity();
|
|
10204
|
+
}
|
|
9638
10205
|
/**
|
|
9639
10206
|
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
9640
10207
|
*
|
|
@@ -9652,12 +10219,14 @@ class TextInput extends FASTElement {
|
|
|
9652
10219
|
*
|
|
9653
10220
|
* @internal
|
|
9654
10221
|
*/
|
|
9655
|
-
setValidity(flags = this.control.validity, message = this.
|
|
9656
|
-
if (this.
|
|
9657
|
-
this.
|
|
9658
|
-
|
|
10222
|
+
setValidity(flags = this.control.validity, message = this.validationMessage, anchor = this.control) {
|
|
10223
|
+
if (this.$fastController.isConnected) {
|
|
10224
|
+
if (this.disabled) {
|
|
10225
|
+
this.elementInternals.setValidity({});
|
|
10226
|
+
return;
|
|
10227
|
+
}
|
|
10228
|
+
this.elementInternals.setValidity(flags, message, anchor);
|
|
9659
10229
|
}
|
|
9660
|
-
this.elementInternals.setValidity(flags, message ?? "", anchor);
|
|
9661
10230
|
}
|
|
9662
10231
|
}
|
|
9663
10232
|
/**
|
|
@@ -9703,7 +10272,7 @@ __decorateClass$2([attr], TextInput.prototype, "placeholder", 2);
|
|
|
9703
10272
|
__decorateClass$2([attr({
|
|
9704
10273
|
attribute: "readonly",
|
|
9705
10274
|
mode: "boolean"
|
|
9706
|
-
})], TextInput.prototype, "
|
|
10275
|
+
})], TextInput.prototype, "readOnly", 2);
|
|
9707
10276
|
__decorateClass$2([attr({
|
|
9708
10277
|
mode: "boolean"
|
|
9709
10278
|
})], TextInput.prototype, "required", 2);
|
|
@@ -9723,20 +10292,23 @@ applyMixins(TextInput, StartEnd);
|
|
|
9723
10292
|
const styles$2 = css`
|
|
9724
10293
|
${display("block")}
|
|
9725
10294
|
|
|
9726
|
-
:host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};max-width:400px}.label{display:flex;color:${colorNeutralForeground1};padding-bottom:${spacingVerticalXS};flex-shrink:0;padding-inline-end:${spacingHorizontalXS}}.label[hidden],:host(:empty) .label{display:none}.root{
|
|
10295
|
+
:host{font-family:${fontFamilyBase};font-size:${fontSizeBase300};font-weight:${fontWeightRegular};line-height:${lineHeightBase300};max-width:400px}.label{display:flex;color:${colorNeutralForeground1};padding-bottom:${spacingVerticalXS};flex-shrink:0;padding-inline-end:${spacingHorizontalXS}}.label[hidden],:host(:empty) .label{display:none}.root{align-items:center;background-color:${colorNeutralBackground1};border:${strokeWidthThin} solid ${colorNeutralStroke1};border-bottom-color:${colorNeutralStrokeAccessible};border-radius:${borderRadiusMedium};box-sizing:border-box;height:32px;display:inline-flex;flex-direction:row;gap:${spacingHorizontalXXS};padding:0 ${spacingHorizontalMNudge};position:relative;width:100%}:has(.control:user-invalid){border-color:${colorPaletteRedBorder2}}.root::after{box-sizing:border-box;content:'';position:absolute;left:-1px;bottom:0px;right:-1px;height:max(2px,${borderRadiusMedium});border-radius:0 0 ${borderRadiusMedium} ${borderRadiusMedium};border-bottom:2px solid ${colorCompoundBrandStroke};clip-path:inset(calc(100% - 2px) 1px 0px);transform:scaleX(0);transition-property:transform;transition-duration:${durationUltraFast};transition-delay:${curveAccelerateMid}}.control{width:100%;height:100%;box-sizing:border-box;color:${colorNeutralForeground1};border-radius:${borderRadiusMedium};background:${colorTransparentBackground};font-family:${fontFamilyBase};font-weight:${fontWeightRegular};font-size:${fontSizeBase300};border:none;vertical-align:center}.control:focus-visible{outline:0;border:0}.control::placeholder{color:${colorNeutralForeground4}}:host ::slotted([slot='start']),:host ::slotted([slot='end']){display:flex;align-items:center;justify-content:center;color:${colorNeutralForeground3};font-size:${fontSizeBase500}}:host ::slotted([slot='start']){padding-right:${spacingHorizontalXXS}}:host ::slotted([slot='end']){padding-left:${spacingHorizontalXXS};gap:${spacingHorizontalXS}}:host(:hover) .root{border-color:${colorNeutralStroke1Hover};border-bottom-color:${colorNeutralStrokeAccessibleHover}}:host(:active) .root{border-color:${colorNeutralStroke1Pressed}}:host(:focus-within) .root{outline:transparent solid 2px;border-bottom:0}:host(:focus-within) .root::after{transform:scaleX(1);transition-property:transform;transition-duration:${durationNormal};transition-delay:${curveDecelerateMid}}:host(:focus-within:active) .root:after{border-bottom-color:${colorCompoundBrandStrokePressed}}:host([appearance='outline']:focus-within) .root{border:${strokeWidthThin} solid ${colorNeutralStroke1}}:host(:focus-within) .control{color:${colorNeutralForeground1}}:host([disabled]) .root{background:${colorTransparentBackground};border:${strokeWidthThin} solid ${colorNeutralStrokeDisabled}}:host([disabled]) .control::placeholder,:host([disabled]) ::slotted([slot='start']),:host([disabled]) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}::selection{color:${colorNeutralForegroundInverted};background-color:${colorNeutralBackgroundInverted}}:host([control-size='small']) .control{font-size:${fontSizeBase200};font-weight:${fontWeightRegular};line-height:${lineHeightBase200}}:host([control-size='small']) .root{height:24px;gap:${spacingHorizontalXXS};padding:0 ${spacingHorizontalSNudge}}:host([control-size='small']) ::slotted([slot='start']),:host([control-size='small']) ::slotted([slot='end']){font-size:${fontSizeBase400}}:host([control-size='large']) .control{font-size:${fontSizeBase400};font-weight:${fontWeightRegular};line-height:${lineHeightBase400}}:host([control-size='large']) .root{height:40px;gap:${spacingHorizontalS};padding:0 ${spacingHorizontalM}}:host([control-size='large']) ::slotted([slot='start']),:host([control-size='large']) ::slotted([slot='end']){font-size:${fontSizeBase600}}:host([appearance='underline']) .root{background:${colorTransparentBackground};border:0;border-radius:0;border-bottom:${strokeWidthThin} solid ${colorNeutralStrokeAccessible}}:host([appearance='underline']:hover) .root{border-bottom-color:${colorNeutralStrokeAccessibleHover}}:host([appearance='underline']:active) .root{border-bottom-color:${colorNeutralStrokeAccessiblePressed}}:host([appearance='underline']:focus-within) .root{border:0;border-bottom-color:${colorNeutralStrokeAccessiblePressed}}:host([appearance='underline'][disabled]) .root{border-bottom-color:${colorNeutralStrokeDisabled}}:host([appearance='filled-lighter']) .root,:host([appearance='filled-darker']) .root{border:${strokeWidthThin} solid ${colorTransparentStroke};box-shadow:${shadow2}}:host([appearance='filled-lighter']) .root{background:${colorNeutralBackground1}}:host([appearance='filled-darker']) .root{background:${colorNeutralBackground3}}:host([appearance='filled-lighter']:hover) .root,:host([appearance='filled-darker']:hover) .root{border-color:${colorTransparentStrokeInteractive}}:host([appearance='filled-lighter']:active) .root,:host([appearance='filled-darker']:active) .root{border-color:${colorTransparentStrokeInteractive};background:${colorNeutralBackground3}}`;
|
|
9727
10296
|
|
|
9728
10297
|
function textInputTemplate(options = {}) {
|
|
9729
|
-
return html`<label part="label" for="control" class="label" ${ref("controlLabel")}><slot ${slotted({
|
|
10298
|
+
return html`<template @beforeinput="${(x, c) => x.beforeinputHandler(c.event)}" @focusin="${(x, c) => x.focusinHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}"><label part="label" for="control" class="label" ${ref("controlLabel")}><slot ${slotted({
|
|
9730
10299
|
property: "defaultSlottedNodes",
|
|
9731
10300
|
filter: whitespaceFilter
|
|
9732
|
-
})}></slot></label><div class="root" part="root">${startSlotTemplate(options)}<input class="control" part="control" id="control" @change="${(x, c) => x.changeHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" ?autofocus="${x => x.autofocus}" autocomplete="${x => x.autocomplete}" ?disabled="${x => x.disabled}" list="${x => x.list}" maxlength="${x => x.maxlength}" minlength="${x => x.minlength}" ?multiple="${x => x.multiple}" name="${x => x.name}" pattern="${x => x.pattern}" placeholder="${x => x.placeholder}" ?readonly="${x => x.
|
|
10301
|
+
})}></slot></label><div class="root" part="root">${startSlotTemplate(options)}<input class="control" part="control" id="control" @change="${(x, c) => x.changeHandler(c.event)}" @input="${(x, c) => x.inputHandler(c.event)}" ?autofocus="${x => x.autofocus}" autocomplete="${x => x.autocomplete}" ?disabled="${x => x.disabled}" list="${x => x.list}" maxlength="${x => x.maxlength}" minlength="${x => x.minlength}" ?multiple="${x => x.multiple}" name="${x => x.name}" pattern="${x => x.pattern}" placeholder="${x => x.placeholder}" ?readonly="${x => x.readOnly}" ?required="${x => x.required}" size="${x => x.size}" spellcheck="${x => x.spellcheck}" type="${x => x.type}" value="${x => x.initialValue}" ${ref("control")} />${endSlotTemplate(options)}</div></template>`;
|
|
9733
10302
|
}
|
|
9734
10303
|
const template$2 = textInputTemplate();
|
|
9735
10304
|
|
|
9736
10305
|
const definition$2 = TextInput.compose({
|
|
9737
10306
|
name: `${FluentDesignSystem.prefix}-text-input`,
|
|
9738
10307
|
template: template$2,
|
|
9739
|
-
styles: styles$2
|
|
10308
|
+
styles: styles$2,
|
|
10309
|
+
shadowOptions: {
|
|
10310
|
+
delegatesFocus: true
|
|
10311
|
+
}
|
|
9740
10312
|
});
|
|
9741
10313
|
|
|
9742
10314
|
definition$2.define(FluentDesignSystem.registry);
|
|
@@ -9786,7 +10358,7 @@ __decorateClass$1([attr], Text.prototype, "align", 2);
|
|
|
9786
10358
|
const styles$1 = css`
|
|
9787
10359
|
${display("inline")}
|
|
9788
10360
|
|
|
9789
|
-
:host{contain:content}::slotted(*){font-family:${fontFamilyBase};font-size:${fontSizeBase300};line-height:${lineHeightBase300};font-weight:${fontWeightRegular};text-align:start;white-space:normal;overflow:visible;text-overflow:clip;margin:0;display:inline}:host([nowrap]) ::slotted(*){white-space:nowrap;overflow:hidden}:host([truncate]) ::slotted(*){text-overflow:ellipsis}:host([block]),:host([block]) ::slotted(*){display:block}:host([italic]) ::slotted(*){font-style:italic}:host([underline]) ::slotted(*){text-decoration-line:underline}:host([strikethrough]) ::slotted(*){text-decoration-line:line-through}:host([underline][strikethrough]) ::slotted(*){text-decoration-line:line-through underline}:host([size='100']) ::slotted(*){font-size:${fontSizeBase100};line-height:${lineHeightBase100}}:host([size='200']) ::slotted(*){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='400']) ::slotted(*){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='500']) ::slotted(*){font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host([size='600']) ::slotted(*){font-size:${fontSizeBase600};line-height:${lineHeightBase600}}:host([size='700']) ::slotted(*){font-size:${fontSizeHero700};line-height:${lineHeightHero700}}:host([size='800']) ::slotted(*){font-size:${fontSizeHero800};line-height:${lineHeightHero800}}:host([size='900']) ::slotted(*){font-size:${fontSizeHero900};line-height:${lineHeightHero900}}:host([size='1000']) ::slotted(*){font-size:${fontSizeHero1000};line-height:${lineHeightHero1000}}:host([font='monospace']) ::slotted(*){font-family:${fontFamilyMonospace}}:host([font='numeric']) ::slotted(*){font-family:${fontFamilyNumeric}}:host([weight='medium']) ::slotted(*){font-weight:${fontWeightMedium}}:host([weight='semibold']) ::slotted(*){font-weight:${fontWeightSemibold}}:host([weight='bold']) ::slotted(*){font-weight:${fontWeightBold}}:host([align='center']) ::slotted(*){text-align:center}:host([align='end']) ::slotted(*){text-align:end}:host([align='justify']) ::slotted(*){text-align:justify}`;
|
|
10361
|
+
:host{contain:content}::slotted(*){font-family:${fontFamilyBase};font-size:${fontSizeBase300};line-height:${lineHeightBase300};font-weight:${fontWeightRegular};text-align:start;white-space:normal;overflow:visible;text-overflow:clip;margin:0;display:inline}:host([nowrap]) ::slotted(*),:host([nowrap]){white-space:nowrap;overflow:hidden}:host([truncate]) ::slotted(*),:host([truncate]){text-overflow:ellipsis}:host([block]),:host([block]) ::slotted(*),:host([block]){display:block}:host([italic]) ::slotted(*),:host([italic]){font-style:italic}:host([underline]) ::slotted(*),:host([underline]){text-decoration-line:underline}:host([strikethrough]) ::slotted(*),:host([strikethrough]){text-decoration-line:line-through}:host([underline][strikethrough]) ::slotted(*),:host([underline][strikethrough]){text-decoration-line:line-through underline}:host([size='100']) ::slotted(*),:host([size='100']){font-size:${fontSizeBase100};line-height:${lineHeightBase100}}:host([size='200']) ::slotted(*),:host([size='200']){font-size:${fontSizeBase200};line-height:${lineHeightBase200}}:host([size='400']) ::slotted(*),:host([size='400']){font-size:${fontSizeBase400};line-height:${lineHeightBase400}}:host([size='500']) ::slotted(*),:host([size='500']){font-size:${fontSizeBase500};line-height:${lineHeightBase500}}:host([size='600']) ::slotted(*),:host([size='600']){font-size:${fontSizeBase600};line-height:${lineHeightBase600}}:host([size='700']) ::slotted(*),:host([size='700']){font-size:${fontSizeHero700};line-height:${lineHeightHero700}}:host([size='800']) ::slotted(*),:host([size='800']){font-size:${fontSizeHero800};line-height:${lineHeightHero800}}:host([size='900']) ::slotted(*),:host([size='900']){font-size:${fontSizeHero900};line-height:${lineHeightHero900}}:host([size='1000']) ::slotted(*),:host([size='1000']){font-size:${fontSizeHero1000};line-height:${lineHeightHero1000}}:host([font='monospace']) ::slotted(*),:host([font='monospace']){font-family:${fontFamilyMonospace}}:host([font='numeric']) ::slotted(*),:host([font='numeric']){font-family:${fontFamilyNumeric}}:host([weight='medium']) ::slotted(*),:host([weight='medium']){font-weight:${fontWeightMedium}}:host([weight='semibold']) ::slotted(*),:host([weight='semibold']){font-weight:${fontWeightSemibold}}:host([weight='bold']) ::slotted(*),:host([weight='bold']){font-weight:${fontWeightBold}}:host([align='center']) ::slotted(*),:host([align='center']){text-align:center}:host([align='end']) ::slotted(*),:host([align='end']){text-align:end}:host([align='justify']) ::slotted(*),:host([align='justify']){text-align:justify}`;
|
|
9790
10362
|
|
|
9791
10363
|
const template$1 = html`<slot></slot>`;
|
|
9792
10364
|
|
|
@@ -9858,7 +10430,7 @@ __decorateClass([attr({
|
|
|
9858
10430
|
})], ToggleButton.prototype, "mixed", 2);
|
|
9859
10431
|
|
|
9860
10432
|
const styles = css`
|
|
9861
|
-
${styles$
|
|
10433
|
+
${styles$o}
|
|
9862
10434
|
|
|
9863
10435
|
:host([aria-pressed='true']){border-color:${colorNeutralStroke1};background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground1};border-width:${strokeWidthThin}}:host([aria-pressed='true']:hover){border-color:${colorNeutralStroke1Hover};background-color:${colorNeutralBackground1Hover}}:host([aria-pressed='true']:active){border-color:${colorNeutralStroke1Pressed};background-color:${colorNeutralBackground1Pressed}}:host([aria-pressed='true'][appearance='primary']){border-color:transparent;background-color:${colorBrandBackgroundSelected};color:${colorNeutralForegroundOnBrand}}:host([aria-pressed='true'][appearance='primary']:hover){background-color:${colorBrandBackgroundHover}}:host([aria-pressed='true'][appearance='primary']:active){background-color:${colorBrandBackgroundPressed}}:host([aria-pressed='true'][appearance='subtle']){border-color:transparent;background-color:${colorSubtleBackgroundSelected};color:${colorNeutralForeground2Selected}}:host([aria-pressed='true'][appearance='subtle']:hover){background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover}}:host([aria-pressed='true'][appearance='subtle']:active){background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed}}:host([aria-pressed='true'][appearance='outline']),:host([aria-pressed='true'][appearance='transparent']){background-color:${colorTransparentBackgroundSelected}}:host([aria-pressed='true'][appearance='outline']:hover),:host([aria-pressed='true'][appearance='transparent']:hover){background-color:${colorTransparentBackgroundHover}}:host([aria-pressed='true'][appearance='outline']:active),:host([aria-pressed='true'][appearance='transparent']:active){background-color:${colorTransparentBackgroundPressed}}:host([aria-pressed='true'][appearance='transparent']){border-color:transparent;color:${colorNeutralForeground2BrandSelected}}:host([aria-pressed='true'][appearance='transparent']:hover){color:${colorNeutralForeground2BrandHover}}:host([aria-pressed='true'][appearance='transparent']:active){color:${colorNeutralForeground2BrandPressed}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
9864
10436
|
:host([aria-pressed='true']),:host([aria-pressed='true'][appearance='primary']),:host([aria-pressed='true'][appearance='subtle']),:host([aria-pressed='true'][appearance='outline']),:host([aria-pressed='true'][appearance='transparent']){background:SelectedItem;color:SelectedItemText}`));
|