@fluentui/web-components 3.0.0-beta.119 → 3.0.0-beta.120
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 +12 -2
- package/custom-elements.json +132 -0
- package/dist/esm/dropdown/dropdown.base.d.ts +8 -13
- package/dist/esm/dropdown/dropdown.base.js +17 -18
- package/dist/esm/dropdown/dropdown.base.js.map +1 -1
- package/dist/esm/dropdown/dropdown.definition.js +0 -3
- package/dist/esm/dropdown/dropdown.definition.js.map +1 -1
- package/dist/esm/dropdown/dropdown.styles.js +12 -1
- package/dist/esm/dropdown/dropdown.styles.js.map +1 -1
- package/dist/esm/dropdown/dropdown.template.js +3 -1
- package/dist/esm/dropdown/dropdown.template.js.map +1 -1
- package/dist/esm/listbox/listbox.d.ts +8 -2
- package/dist/esm/listbox/listbox.js +16 -5
- package/dist/esm/listbox/listbox.js.map +1 -1
- package/dist/esm/listbox/listbox.template.d.ts +1 -2
- package/dist/esm/listbox/listbox.template.js +2 -9
- package/dist/esm/listbox/listbox.template.js.map +1 -1
- package/dist/esm/option/option.js +1 -0
- package/dist/esm/option/option.js.map +1 -1
- package/dist/esm/utils/request-idle-callback.d.ts +43 -0
- package/dist/esm/utils/request-idle-callback.js +73 -0
- package/dist/esm/utils/request-idle-callback.js.map +1 -0
- package/dist/web-components.d.ts +16 -16
- package/dist/web-components.js +78 -32
- package/dist/web-components.min.js +134 -134
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../../src/option/option.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;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AAS,EAAE,CAAC;gDACA;AAWV;IADf,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;0CACuB;AAU1C;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;oDACd;AAkB1B;IADN,UAAU;gDACsB;AAqB1B;IADN,IAAI;4CACgB;AAQd;IADN,UAAU;6CACoB;AAUxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;qDAChB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ponyfill for requestIdleCallback that falls back to setTimeout.
|
|
3
|
+
* Uses the native requestIdleCallback when available.
|
|
4
|
+
*
|
|
5
|
+
* @param callback - The function to call when the browser is idle.
|
|
6
|
+
* @param options - Options object that may contain a timeout property.
|
|
7
|
+
* @returns An ID that can be used to cancel the callback.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare function requestIdleCallback(callback: (args: {
|
|
11
|
+
didTimeout: boolean;
|
|
12
|
+
}) => void, options?: {
|
|
13
|
+
timeout: number;
|
|
14
|
+
}): ReturnType<typeof globalThis.requestIdleCallback | typeof setTimeout>;
|
|
15
|
+
/**
|
|
16
|
+
* A ponyfill for cancelIdleCallback that falls back to clearTimeout.
|
|
17
|
+
* Uses the native cancelIdleCallback when available.
|
|
18
|
+
*
|
|
19
|
+
* @param id - The ID of the callback to cancel.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare function cancelIdleCallback(id: ReturnType<typeof globalThis.requestIdleCallback | typeof setTimeout>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Waits for all custom element descendants of a target element to be connected.
|
|
25
|
+
*
|
|
26
|
+
* @param target - The target element to observe.
|
|
27
|
+
* @param callback - The function to call when all custom element descendants are connected.
|
|
28
|
+
* @param options - Options object that may contain a timeout property for the idle callback.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This function uses requestIdleCallback to periodically check if all custom element
|
|
32
|
+
* descendants (elements with a hyphen in their tag name) are connected to the DOM.
|
|
33
|
+
* Once all such elements are connected, the provided callback is invoked.
|
|
34
|
+
*
|
|
35
|
+
* The `timeout` option specifies the maximum time to wait for each idle callback before
|
|
36
|
+
* rechecking, defaulting to 50 milliseconds.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare function waitForConnectedDescendants(target: HTMLElement, callback: () => void, options?: {
|
|
41
|
+
shallow: boolean;
|
|
42
|
+
timeout: number;
|
|
43
|
+
}): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ponyfill for requestIdleCallback that falls back to setTimeout.
|
|
3
|
+
* Uses the native requestIdleCallback when available.
|
|
4
|
+
*
|
|
5
|
+
* @param callback - The function to call when the browser is idle.
|
|
6
|
+
* @param options - Options object that may contain a timeout property.
|
|
7
|
+
* @returns An ID that can be used to cancel the callback.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function requestIdleCallback(callback, options) {
|
|
11
|
+
if ('requestIdleCallback' in globalThis) {
|
|
12
|
+
return globalThis.requestIdleCallback(callback, options);
|
|
13
|
+
}
|
|
14
|
+
const start = Date.now();
|
|
15
|
+
return setTimeout(() => {
|
|
16
|
+
callback({
|
|
17
|
+
didTimeout: options?.timeout ? Date.now() - start >= options.timeout : false,
|
|
18
|
+
});
|
|
19
|
+
}, 1);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A ponyfill for cancelIdleCallback that falls back to clearTimeout.
|
|
23
|
+
* Uses the native cancelIdleCallback when available.
|
|
24
|
+
*
|
|
25
|
+
* @param id - The ID of the callback to cancel.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export function cancelIdleCallback(id) {
|
|
29
|
+
if ('cancelIdleCallback' in globalThis) {
|
|
30
|
+
globalThis.cancelIdleCallback(id);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
clearTimeout(id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Waits for all custom element descendants of a target element to be connected.
|
|
38
|
+
*
|
|
39
|
+
* @param target - The target element to observe.
|
|
40
|
+
* @param callback - The function to call when all custom element descendants are connected.
|
|
41
|
+
* @param options - Options object that may contain a timeout property for the idle callback.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* This function uses requestIdleCallback to periodically check if all custom element
|
|
45
|
+
* descendants (elements with a hyphen in their tag name) are connected to the DOM.
|
|
46
|
+
* Once all such elements are connected, the provided callback is invoked.
|
|
47
|
+
*
|
|
48
|
+
* The `timeout` option specifies the maximum time to wait for each idle callback before
|
|
49
|
+
* rechecking, defaulting to 50 milliseconds.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export function waitForConnectedDescendants(target, callback, options = { shallow: false, timeout: 50 }) {
|
|
54
|
+
let idleCallbackId;
|
|
55
|
+
const query = options.shallow ? ':scope > *' : '*';
|
|
56
|
+
if (!target.isConnected) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const scheduleCheck = () => {
|
|
60
|
+
if (idleCallbackId) {
|
|
61
|
+
idleCallbackId = cancelIdleCallback(idleCallbackId);
|
|
62
|
+
}
|
|
63
|
+
if (Array.from(target.querySelectorAll(query))
|
|
64
|
+
.filter(el => el.tagName.includes('-'))
|
|
65
|
+
.every(el => el.isConnected)) {
|
|
66
|
+
callback();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
idleCallbackId = requestIdleCallback(scheduleCheck, { timeout: options.timeout });
|
|
70
|
+
};
|
|
71
|
+
scheduleCheck();
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=request-idle-callback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-idle-callback.js","source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kB,CAAC,cAAc,CAAC,CAAC;QACtD,CAAC;QAED,IACE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;aACvC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;aACtC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,EAC9B,CAAC;YACD,QAAQ,EAAE,CAAC;YACX,OAAO;QACT,CAAC;QAED,cAAc,GAAG,mBAAmB,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IAEF,aAAa,EAAE,CAAC;AAClB,CAAC"}
|
package/dist/web-components.d.ts
CHANGED
|
@@ -1711,12 +1711,6 @@ export declare class BaseDropdown extends FASTElement {
|
|
|
1711
1711
|
* The listbox element is assigned to the dropdown via the default slot with manual slot assignment.
|
|
1712
1712
|
*/
|
|
1713
1713
|
listboxChanged(prev: Listbox | undefined, next: Listbox | undefined): void;
|
|
1714
|
-
/**
|
|
1715
|
-
* Reference to the listbox slot element.
|
|
1716
|
-
*
|
|
1717
|
-
* @internal
|
|
1718
|
-
*/
|
|
1719
|
-
listboxSlot: HTMLSlotElement;
|
|
1720
1714
|
/**
|
|
1721
1715
|
* Indicates whether the dropdown allows multiple options to be selected.
|
|
1722
1716
|
*
|
|
@@ -2055,20 +2049,21 @@ export declare class BaseDropdown extends FASTElement {
|
|
|
2055
2049
|
*/
|
|
2056
2050
|
setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
|
|
2057
2051
|
/**
|
|
2058
|
-
*
|
|
2052
|
+
* Handles the `slotchange` event for the dropdown.
|
|
2053
|
+
* Sets the `listbox` property when a valid listbox is assigned to the default slot.
|
|
2059
2054
|
*
|
|
2060
|
-
* @param
|
|
2055
|
+
* @param e - the slot change event
|
|
2061
2056
|
* @internal
|
|
2062
2057
|
*/
|
|
2063
|
-
|
|
2064
|
-
disconnectedCallback(): void;
|
|
2058
|
+
slotchangeHandler(e: Event): boolean | void;
|
|
2065
2059
|
/**
|
|
2066
|
-
*
|
|
2060
|
+
* Updates the freeform option with the provided value.
|
|
2067
2061
|
*
|
|
2068
|
-
* @param
|
|
2062
|
+
* @param value - the value to update the freeform option with
|
|
2069
2063
|
* @internal
|
|
2070
2064
|
*/
|
|
2071
|
-
|
|
2065
|
+
protected updateFreeformOption(value?: string): void;
|
|
2066
|
+
disconnectedCallback(): void;
|
|
2072
2067
|
/**
|
|
2073
2068
|
* When anchor positioning isn't supported, an intersection observer is used to flip the listbox when it hits the
|
|
2074
2069
|
* viewport bounds. One static observer is used for all dropdowns.
|
|
@@ -7729,7 +7724,6 @@ export declare const LinkTemplate: ElementViewTemplate<Link>;
|
|
|
7729
7724
|
* @tag fluent-listbox
|
|
7730
7725
|
*
|
|
7731
7726
|
* @slot - The default slot for the options.
|
|
7732
|
-
* @emits connected - Dispatched when the element is connected to the DOM.
|
|
7733
7727
|
*
|
|
7734
7728
|
* @remarks
|
|
7735
7729
|
* The listbox component represents a list of options that can be selected.
|
|
@@ -7819,7 +7813,6 @@ export declare class Listbox extends FASTElement {
|
|
|
7819
7813
|
*/
|
|
7820
7814
|
clickHandler(e: PointerEvent): boolean | void;
|
|
7821
7815
|
constructor();
|
|
7822
|
-
connectedCallback(): void;
|
|
7823
7816
|
/**
|
|
7824
7817
|
* Handles observable subscriptions for the listbox.
|
|
7825
7818
|
*
|
|
@@ -7836,6 +7829,14 @@ export declare class Listbox extends FASTElement {
|
|
|
7836
7829
|
* @public
|
|
7837
7830
|
*/
|
|
7838
7831
|
selectOption(index?: number): void;
|
|
7832
|
+
/**
|
|
7833
|
+
* Handles the `slotchange` event for the default slot.
|
|
7834
|
+
* Sets the `options` property to the list of slotted options.
|
|
7835
|
+
*
|
|
7836
|
+
* @param e - The slotchange event
|
|
7837
|
+
* @public
|
|
7838
|
+
*/
|
|
7839
|
+
slotchangeHandler(e: Event): void;
|
|
7839
7840
|
}
|
|
7840
7841
|
|
|
7841
7842
|
/**
|
|
@@ -7864,7 +7865,6 @@ export declare const ListboxTemplate: ElementViewTemplate<Listbox>;
|
|
|
7864
7865
|
/**
|
|
7865
7866
|
* Generates a template for the {@link (Dropdown:class)} component.
|
|
7866
7867
|
*
|
|
7867
|
-
* @param options - The {@link (DropdownOptions:interface)} to use for generating the template.
|
|
7868
7868
|
* @returns The template object.
|
|
7869
7869
|
*
|
|
7870
7870
|
* @public
|
package/dist/web-components.js
CHANGED
|
@@ -7094,6 +7094,48 @@ function uniqueId(prefix = "id-") {
|
|
|
7094
7094
|
return document.getElementById(str) ? uniqueId(prefix) : str;
|
|
7095
7095
|
}
|
|
7096
7096
|
|
|
7097
|
+
function requestIdleCallback(callback, options) {
|
|
7098
|
+
if ("requestIdleCallback" in globalThis) {
|
|
7099
|
+
return globalThis.requestIdleCallback(callback, options);
|
|
7100
|
+
}
|
|
7101
|
+
const start = Date.now();
|
|
7102
|
+
return setTimeout(() => {
|
|
7103
|
+
callback({
|
|
7104
|
+
didTimeout: options?.timeout ? Date.now() - start >= options.timeout : false
|
|
7105
|
+
});
|
|
7106
|
+
}, 1);
|
|
7107
|
+
}
|
|
7108
|
+
function cancelIdleCallback(id) {
|
|
7109
|
+
if ("cancelIdleCallback" in globalThis) {
|
|
7110
|
+
globalThis.cancelIdleCallback(id);
|
|
7111
|
+
} else {
|
|
7112
|
+
clearTimeout(id);
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
function waitForConnectedDescendants(target, callback, options = {
|
|
7116
|
+
shallow: false,
|
|
7117
|
+
timeout: 50
|
|
7118
|
+
}) {
|
|
7119
|
+
let idleCallbackId;
|
|
7120
|
+
const query = options.shallow ? ":scope > *" : "*";
|
|
7121
|
+
if (!target.isConnected) {
|
|
7122
|
+
return;
|
|
7123
|
+
}
|
|
7124
|
+
const scheduleCheck = () => {
|
|
7125
|
+
if (idleCallbackId) {
|
|
7126
|
+
idleCallbackId = cancelIdleCallback(idleCallbackId);
|
|
7127
|
+
}
|
|
7128
|
+
if (Array.from(target.querySelectorAll(query)).filter(el => el.tagName.includes("-")).every(el => el.isConnected)) {
|
|
7129
|
+
callback();
|
|
7130
|
+
return;
|
|
7131
|
+
}
|
|
7132
|
+
idleCallbackId = requestIdleCallback(scheduleCheck, {
|
|
7133
|
+
timeout: options.timeout
|
|
7134
|
+
});
|
|
7135
|
+
};
|
|
7136
|
+
scheduleCheck();
|
|
7137
|
+
}
|
|
7138
|
+
|
|
7097
7139
|
const DropdownAppearance = {
|
|
7098
7140
|
filledDarker: "filled-darker",
|
|
7099
7141
|
filledLighter: "filled-lighter",
|
|
@@ -7107,10 +7149,10 @@ const DropdownType = {
|
|
|
7107
7149
|
};
|
|
7108
7150
|
|
|
7109
7151
|
const dropdownIndicatorTemplate = html`<svg class="chevron-down-20-regular" role="button" slot="indicator" viewBox="0 0 20 20" ${ref("indicator")}><path d="M15.85 7.65a.5.5 0 0 1 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16a.5.5 0 0 1 .7 0" fill="currentColor" /></svg>`;
|
|
7110
|
-
const dropdownInputTemplate = html`<input @input="${(x, c) => x.inputHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" aria-activedescendant="${x => x.activeDescendant}" aria-controls="${x => x.listbox?.id ?? null}" aria-labelledby="${x => x.ariaLabelledBy}" aria-expanded="${x => x.open}" aria-haspopup="listbox" placeholder="${x => x.placeholder}" role="combobox" ?disabled="${x => x.disabled}" type="${x => x.type}" value="${x => x.valueAttribute}" ${ref("control")} />`;
|
|
7111
|
-
const dropdownButtonTemplate = html`<button aria-activedescendant="${x => x.activeDescendant}" aria-controls="${x => x.listbox?.id ?? null}" aria-expanded="${x => x.open}" aria-haspopup="listbox" role="combobox" ?disabled="${x => x.disabled}" type="button" ${ref("control")}>${x => x.displayValue}</button>`;
|
|
7152
|
+
const dropdownInputTemplate = html`<input @input="${(x, c) => x.inputHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" aria-activedescendant="${x => x.activeDescendant}" aria-controls="${x => x.listbox?.id ?? null}" aria-labelledby="${x => x.ariaLabelledBy}" aria-expanded="${x => x.open}" aria-haspopup="listbox" placeholder="${x => x.placeholder}" role="combobox" ?disabled="${x => x.disabled}" type="${x => x.type}" value="${x => x.valueAttribute}" slot="control" ${ref("control")} />`;
|
|
7153
|
+
const dropdownButtonTemplate = html`<button aria-activedescendant="${x => x.activeDescendant}" aria-controls="${x => x.listbox?.id ?? null}" aria-expanded="${x => x.open}" aria-haspopup="listbox" role="combobox" ?disabled="${x => x.disabled}" type="button" slot="control" ${ref("control")}>${x => x.displayValue}</button>`;
|
|
7112
7154
|
function dropdownTemplate(options = {}) {
|
|
7113
|
-
return html`<template @click="${(x, c) => x.clickHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @mousedown="${(x, c) => x.mousedownHandler(c.event)}"><div class="control"><slot name="control" ${ref("controlSlot")}></slot><slot name="indicator" ${ref("indicatorSlot")}>${staticallyCompose(options.indicator)}</slot></div><slot ${
|
|
7155
|
+
return html`<template @click="${(x, c) => x.clickHandler(c.event)}" @focusout="${(x, c) => x.focusoutHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @mousedown="${(x, c) => x.mousedownHandler(c.event)}"><div class="control"><slot name="control" ${ref("controlSlot")}></slot><slot name="indicator" ${ref("indicatorSlot")}>${staticallyCompose(options.indicator)}</slot></div><slot @slotchange="${(x, c) => x.slotchangeHandler(c.event)}"></slot></template>`;
|
|
7114
7156
|
}
|
|
7115
7157
|
const template$t = dropdownTemplate({
|
|
7116
7158
|
indicator: dropdownIndicatorTemplate
|
|
@@ -7164,7 +7206,6 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7164
7206
|
*/
|
|
7165
7207
|
this.elementInternals = this.attachInternals();
|
|
7166
7208
|
this.elementInternals.role = "presentation";
|
|
7167
|
-
this.addEventListener("connected", this.listboxConnectedHandler);
|
|
7168
7209
|
Updates.enqueue(() => {
|
|
7169
7210
|
this.insertControl();
|
|
7170
7211
|
});
|
|
@@ -7207,7 +7248,6 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7207
7248
|
controlChanged(prev, next) {
|
|
7208
7249
|
if (next) {
|
|
7209
7250
|
next.id = next.id || uniqueId("input-");
|
|
7210
|
-
this.controlSlot?.assign(next);
|
|
7211
7251
|
}
|
|
7212
7252
|
}
|
|
7213
7253
|
/**
|
|
@@ -7257,7 +7297,6 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7257
7297
|
next.dropdown = this;
|
|
7258
7298
|
next.popover = "manual";
|
|
7259
7299
|
next.tabIndex = -1;
|
|
7260
|
-
this.listboxSlot.assign(next);
|
|
7261
7300
|
const notifier = Observable.getNotifier(this);
|
|
7262
7301
|
notifier.subscribe(next);
|
|
7263
7302
|
for (const key of ["disabled", "multiple"]) {
|
|
@@ -7742,6 +7781,22 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7742
7781
|
}, message ?? this.validationMessage, anchor ?? this.control);
|
|
7743
7782
|
}
|
|
7744
7783
|
}
|
|
7784
|
+
/**
|
|
7785
|
+
* Handles the `slotchange` event for the dropdown.
|
|
7786
|
+
* Sets the `listbox` property when a valid listbox is assigned to the default slot.
|
|
7787
|
+
*
|
|
7788
|
+
* @param e - the slot change event
|
|
7789
|
+
* @internal
|
|
7790
|
+
*/
|
|
7791
|
+
slotchangeHandler(e) {
|
|
7792
|
+
const target = e.target;
|
|
7793
|
+
waitForConnectedDescendants(this, () => {
|
|
7794
|
+
const listbox = target.assignedElements().find(el => isListbox(el));
|
|
7795
|
+
if (listbox) {
|
|
7796
|
+
this.listbox = listbox;
|
|
7797
|
+
}
|
|
7798
|
+
});
|
|
7799
|
+
}
|
|
7745
7800
|
/**
|
|
7746
7801
|
* Updates the freeform option with the provided value.
|
|
7747
7802
|
*
|
|
@@ -7766,18 +7821,6 @@ const _BaseDropdown = class _BaseDropdown extends FASTElement {
|
|
|
7766
7821
|
this.debounceController?.abort();
|
|
7767
7822
|
super.disconnectedCallback();
|
|
7768
7823
|
}
|
|
7769
|
-
/**
|
|
7770
|
-
* Handles the connected event for the listbox.
|
|
7771
|
-
*
|
|
7772
|
-
* @param e - the event object
|
|
7773
|
-
* @internal
|
|
7774
|
-
*/
|
|
7775
|
-
listboxConnectedHandler(e) {
|
|
7776
|
-
const target = e.target;
|
|
7777
|
-
if (isListbox(target)) {
|
|
7778
|
-
this.listbox = target;
|
|
7779
|
-
}
|
|
7780
|
-
}
|
|
7781
7824
|
/**
|
|
7782
7825
|
* When anchor positioning isn't supported, an intersection observer is used to flip the listbox when it hits the
|
|
7783
7826
|
* viewport bounds. One static observer is used for all dropdowns.
|
|
@@ -7857,7 +7900,6 @@ __decorateClass$z([attr({
|
|
|
7857
7900
|
mode: "fromView"
|
|
7858
7901
|
})], _BaseDropdown.prototype, "initialValue", 2);
|
|
7859
7902
|
__decorateClass$z([observable], _BaseDropdown.prototype, "listbox", 2);
|
|
7860
|
-
__decorateClass$z([observable], _BaseDropdown.prototype, "listboxSlot", 2);
|
|
7861
7903
|
__decorateClass$z([attr({
|
|
7862
7904
|
mode: "boolean"
|
|
7863
7905
|
})], _BaseDropdown.prototype, "multiple", 2);
|
|
@@ -7893,15 +7935,12 @@ __decorateClass$y([attr], Dropdown.prototype, "size", 2);
|
|
|
7893
7935
|
const styles$s = css`
|
|
7894
7936
|
${display("inline-flex")}
|
|
7895
7937
|
|
|
7896
|
-
:host{anchor-name:--dropdown-trigger;box-sizing:border-box;color:${colorNeutralForeground1};cursor:pointer}:host(${placeholderShownState}){color:${colorNeutralForeground4}}.control{appearance:none;background-color:${colorNeutralBackground1};border-radius:${borderRadiusMedium};border:none;box-shadow:inset 0 0 0 ${strokeWidthThin} var(--control-border-color);box-sizing:border-box;color:inherit;column-gap:${spacingHorizontalXXS};display:inline-flex;justify-content:space-between;min-width:160px;overflow:hidden;padding:${spacingVerticalSNudge} ${spacingHorizontalMNudge};position:relative;text-align:start;width:100%;z-index:1;${typographyBody1Styles}}:host([size='small']) .control{column-gap:${spacingHorizontalXXS};padding:${spacingVerticalXS} ${spacingHorizontalSNudge};${typographyCaption1Styles}}:host([size='large']) .control{column-gap:${spacingHorizontalS};padding:${spacingVerticalS} ${spacingHorizontalM};${typographyBody2Styles}}::slotted(:is(input,button)){all:unset;flex:1 1 auto}::slotted(button){cursor:pointer}::slotted(input){cursor:text}:where(slot[name='indicator'] > *,::slotted([slot='indicator'])){all:unset;align-items:center;appearance:none;aspect-ratio:1;color:${colorNeutralForeground3};display:inline-flex;justify-content:center;width:20px}:host([size='small']) :where(slot[name='indicator'] > *,::slotted([slot='indicator'])){width:16px}:host([size='large']) :where(slot[name='indicator'] > *,::slotted([slot='indicator'])){width:24px}.control::after,.control::before{content:'' / '';inset:auto 0 0;pointer-events:none;position:absolute}.control::before{height:${strokeWidthThin}}.control::after{background-color:${colorCompoundBrandStroke};height:${strokeWidthThick};scale:0 1;transition:scale ${durationUltraFast} ${curveDecelerateMid}}:host(:where(${openState},:focus-within)) .control::after{scale:1 1;transition-duration:${durationNormal};transition-timing-function:${curveAccelerateMid}}:host(:where([appearance='outline'],[appearance='transparent'])) .control::before{background-color:${colorNeutralStrokeAccessible}}:host([appearance='transparent']) .control{--control-border-color:${colorTransparentStrokeInteractive};background-color:${colorTransparentBackground};border-radius:${borderRadiusNone}}:host([appearance='outline']) .control{--control-border-color:${colorNeutralStroke1}}:host([appearance='outline']) .control:hover{--control-border-color:${colorNeutralStroke1Hover}}:host(:where([appearance='outline'],[appearance='transparent'])) .control:hover::before{background-color:${colorNeutralStrokeAccessibleHover}}:host([appearance='outline']) .control:hover::after{background-color:${colorCompoundBrandBackgroundHover}}:host([appearance='outline']) .control:active{--control-border-color:${colorNeutralStroke1Pressed}}:host(:where([appearance='outline'],[appearance='transparent'])) .control:active::before{background-color:${colorNeutralStrokeAccessiblePressed}}:host(:where([appearance='outline'],[appearance='transparent'])) .control:active::after{background-color:${colorCompoundBrandBackgroundPressed}}:host([appearance='filled-darker']) .control{background-color:${colorNeutralBackground3}}:host(:where([appearance='filled-lighter'],[appearance='filled-darker'])) .control{--control-border-color:${colorTransparentStroke}}:host(:disabled),:host(:disabled) ::slotted(:where(button,input)){cursor:not-allowed}:host(:disabled) .control::before,:host(:disabled) .control::after{content:none}:host(:disabled) .control:is(*,:active,:hover),:host(:disabled) :where(slot[name='indicator'] > *,::slotted([slot='indicator'])){--control-border-color:${colorNeutralStrokeDisabled};background-color:${colorNeutralBackgroundDisabled};color:${colorNeutralForegroundDisabled}}::slotted([popover]:not(:popover-open)){display:none}@supports not (anchor-name:--anchor){:host{--listbox-max-height:50vh;--margin-offset:calc(${lineHeightBase300} + (${spacingVerticalSNudge} * 2) + ${strokeWidthThin})}:host([size='small']){--margin-offset:calc(${lineHeightBase200} + (${spacingVerticalXS} * 2) + ${strokeWidthThin})}:host([size='large']){--margin-offset:calc(${lineHeightBase400} + (${spacingVerticalS} * 2) + ${strokeWidthThin})}}`;
|
|
7938
|
+
:host{anchor-name:--dropdown-trigger;box-sizing:border-box;color:${colorNeutralForeground1};cursor:pointer}:host(${placeholderShownState}){color:${colorNeutralForeground4}}.control{appearance:none;background-color:${colorNeutralBackground1};border-radius:${borderRadiusMedium};border:none;box-shadow:inset 0 0 0 ${strokeWidthThin} var(--control-border-color);box-sizing:border-box;color:inherit;column-gap:${spacingHorizontalXXS};display:inline-flex;justify-content:space-between;min-width:160px;overflow:hidden;padding:${spacingVerticalSNudge} ${spacingHorizontalMNudge};position:relative;text-align:start;width:100%;z-index:1;${typographyBody1Styles}}:host([size='small']) .control{column-gap:${spacingHorizontalXXS};padding:${spacingVerticalXS} ${spacingHorizontalSNudge};${typographyCaption1Styles}}:host([size='large']) .control{column-gap:${spacingHorizontalS};padding:${spacingVerticalS} ${spacingHorizontalM};${typographyBody2Styles}}::slotted(:is(input,button)){all:unset;flex:1 1 auto}::slotted(button){cursor:pointer}::slotted(input){cursor:text}:where(slot[name='indicator'] > *,::slotted([slot='indicator'])){all:unset;align-items:center;appearance:none;aspect-ratio:1;color:${colorNeutralForeground3};display:inline-flex;justify-content:center;width:20px}:host([size='small']) :where(slot[name='indicator'] > *,::slotted([slot='indicator'])){width:16px}:host([size='large']) :where(slot[name='indicator'] > *,::slotted([slot='indicator'])){width:24px}.control::after,.control::before{content:'' / '';inset:auto 0 0;pointer-events:none;position:absolute}.control::before{height:${strokeWidthThin}}.control::after{background-color:${colorCompoundBrandStroke};height:${strokeWidthThick};scale:0 1;transition:scale ${durationUltraFast} ${curveDecelerateMid}}:host(:where(:focus-within)) .control{border-radius:${borderRadiusMedium};box-shadow:inset 0 0 0 1px ${colorStrokeFocus1};outline:${strokeWidthThick} solid ${colorStrokeFocus2}}:host(:where(${openState},:focus-within)) .control::after{scale:1 1;transition-duration:${durationNormal};transition-timing-function:${curveAccelerateMid}}:host(:where([appearance='outline'],[appearance='transparent'])) .control::before{background-color:${colorNeutralStrokeAccessible}}:host([appearance='transparent']) .control{--control-border-color:${colorTransparentStrokeInteractive};background-color:${colorTransparentBackground};border-radius:${borderRadiusNone}}:host([appearance='outline']) .control{--control-border-color:${colorNeutralStroke1}}:host([appearance='outline']) .control:hover{--control-border-color:${colorNeutralStroke1Hover}}:host(:where([appearance='outline'],[appearance='transparent'])) .control:hover::before{background-color:${colorNeutralStrokeAccessibleHover}}:host([appearance='outline']) .control:hover::after{background-color:${colorCompoundBrandBackgroundHover}}:host([appearance='outline']) .control:active{--control-border-color:${colorNeutralStroke1Pressed}}:host(:where([appearance='outline'],[appearance='transparent'])) .control:active::before{background-color:${colorNeutralStrokeAccessiblePressed}}:host(:where([appearance='outline'],[appearance='transparent'])) .control:active::after{background-color:${colorCompoundBrandBackgroundPressed}}:host([appearance='filled-darker']) .control{background-color:${colorNeutralBackground3}}:host(:where([appearance='filled-lighter'],[appearance='filled-darker'])) .control{--control-border-color:${colorTransparentStroke}}:host(:disabled),:host(:disabled) ::slotted(:where(button,input)){cursor:not-allowed}:host(:disabled) .control::before,:host(:disabled) .control::after{content:none}:host(:disabled) .control:is(*,:active,:hover),:host(:disabled) :where(slot[name='indicator'] > *,::slotted([slot='indicator'])){--control-border-color:${colorNeutralStrokeDisabled};background-color:${colorNeutralBackgroundDisabled};color:${colorNeutralForegroundDisabled}}::slotted([popover]:not(:popover-open)){display:none}@supports not (anchor-name:--anchor){:host{--listbox-max-height:50vh;--margin-offset:calc(${lineHeightBase300} + (${spacingVerticalSNudge} * 2) + ${strokeWidthThin})}:host([size='small']){--margin-offset:calc(${lineHeightBase200} + (${spacingVerticalXS} * 2) + ${strokeWidthThin})}:host([size='large']){--margin-offset:calc(${lineHeightBase400} + (${spacingVerticalS} * 2) + ${strokeWidthThin})}}`;
|
|
7897
7939
|
|
|
7898
7940
|
const definition$t = Dropdown.compose({
|
|
7899
7941
|
name: `${FluentDesignSystem.prefix}-dropdown`,
|
|
7900
7942
|
template: template$t,
|
|
7901
|
-
styles: styles$s
|
|
7902
|
-
shadowOptions: {
|
|
7903
|
-
slotAssignment: "manual"
|
|
7904
|
-
}
|
|
7943
|
+
styles: styles$s
|
|
7905
7944
|
});
|
|
7906
7945
|
|
|
7907
7946
|
definition$t.define(FluentDesignSystem.registry);
|
|
@@ -8367,10 +8406,6 @@ class Listbox extends FASTElement {
|
|
|
8367
8406
|
}
|
|
8368
8407
|
return true;
|
|
8369
8408
|
}
|
|
8370
|
-
connectedCallback() {
|
|
8371
|
-
super.connectedCallback();
|
|
8372
|
-
this.$emit("connected");
|
|
8373
|
-
}
|
|
8374
8409
|
/**
|
|
8375
8410
|
* Handles observable subscriptions for the listbox.
|
|
8376
8411
|
*
|
|
@@ -8410,6 +8445,19 @@ class Listbox extends FASTElement {
|
|
|
8410
8445
|
}
|
|
8411
8446
|
this.selectedIndex = selectedIndex;
|
|
8412
8447
|
}
|
|
8448
|
+
/**
|
|
8449
|
+
* Handles the `slotchange` event for the default slot.
|
|
8450
|
+
* Sets the `options` property to the list of slotted options.
|
|
8451
|
+
*
|
|
8452
|
+
* @param e - The slotchange event
|
|
8453
|
+
* @public
|
|
8454
|
+
*/
|
|
8455
|
+
slotchangeHandler(e) {
|
|
8456
|
+
waitForConnectedDescendants(this, () => {
|
|
8457
|
+
const options = e.target.assignedElements().filter(option => isDropdownOption(option));
|
|
8458
|
+
this.options = options;
|
|
8459
|
+
});
|
|
8460
|
+
}
|
|
8413
8461
|
}
|
|
8414
8462
|
__decorateClass$s([attr({
|
|
8415
8463
|
attribute: "id",
|
|
@@ -8426,10 +8474,7 @@ const styles$n = css`
|
|
|
8426
8474
|
:host{background-color:${colorNeutralBackground1};border-radius:${borderRadiusMedium};border:none;box-shadow:${shadow16};box-sizing:border-box;flex-direction:column;margin:0;min-width:160px;padding:${spacingHorizontalXS};row-gap:${spacingHorizontalXXS};width:auto}:host([popover]){inset:unset;overflow:auto}@supports (anchor-name:--anchor){:host([popover]){position:absolute;margin-block-start:0;max-height:var(--listbox-max-height,calc(50vh - anchor-size(self-block)));min-width:anchor-size(width);position-anchor:--dropdown;position-area:block-end span-inline-end;position-try-fallbacks:flip-inline,flip-block,--flip-block,block-start}@position-try --flip-block{bottom:anchor(top);top:unset}}@supports not (anchor-name:--anchor){:host([popover]){margin-block-start:var(--margin-offset,0);max-height:var(--listbox-max-height,50vh);position:fixed}:host([popover]${flipBlockState}){margin-block-start:revert;translate:0 -100%}}`;
|
|
8427
8475
|
|
|
8428
8476
|
function listboxTemplate() {
|
|
8429
|
-
return html`<template id="${x => x.id}" @beforetoggle="${(x, c) => x.beforetoggleHandler(c.event)}" @click="${(x, c) => x.clickHandler(c.event)}"><slot ${
|
|
8430
|
-
property: "options",
|
|
8431
|
-
filter: node => isDropdownOption(node)
|
|
8432
|
-
})}></slot></template>`;
|
|
8477
|
+
return html`<template id="${x => x.id}" @beforetoggle="${(x, c) => x.beforetoggleHandler(c.event)}" @click="${(x, c) => x.clickHandler(c.event)}"><slot @slotchange="${(x, c) => x.slotchangeHandler(c.event)}"></slot></template>`;
|
|
8433
8478
|
}
|
|
8434
8479
|
const template$o = listboxTemplate();
|
|
8435
8480
|
|
|
@@ -9422,6 +9467,7 @@ class DropdownOption extends FASTElement {
|
|
|
9422
9467
|
disabledChanged(prev, next) {
|
|
9423
9468
|
this.elementInternals.ariaDisabled = this.disabled ? "true" : "false";
|
|
9424
9469
|
toggleState(this.elementInternals, "disabled", this.disabled);
|
|
9470
|
+
this.setFormValue(!this.disabled && this.selected ? this.value : null);
|
|
9425
9471
|
}
|
|
9426
9472
|
/**
|
|
9427
9473
|
* Sets the disabled state when the `disabled` attribute changes.
|