@fluentui/web-components 3.0.0-beta.76 → 3.0.0-beta.78
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 +22 -2
- package/dist/dts/dropdown/define.d.ts +1 -0
- package/dist/dts/dropdown/dropdown.d.ts +492 -0
- package/dist/dts/dropdown/dropdown.definition.d.ts +9 -0
- package/dist/dts/dropdown/dropdown.options.d.ts +53 -0
- package/dist/dts/dropdown/dropdown.styles.d.ts +6 -0
- package/dist/dts/dropdown/dropdown.template.d.ts +38 -0
- package/dist/dts/dropdown/index.d.ts +5 -0
- package/dist/dts/index-rollup.d.ts +3 -0
- package/dist/dts/index.d.ts +3 -0
- package/dist/dts/listbox/define.d.ts +1 -0
- package/dist/dts/listbox/index.d.ts +5 -0
- package/dist/dts/listbox/listbox.d.ts +116 -0
- package/dist/dts/listbox/listbox.definition.d.ts +9 -0
- package/dist/dts/listbox/listbox.options.d.ts +10 -0
- package/dist/dts/listbox/listbox.styles.d.ts +6 -0
- package/dist/dts/listbox/listbox.template.d.ts +17 -0
- package/dist/dts/option/define.d.ts +1 -0
- package/dist/dts/option/index.d.ts +5 -0
- package/dist/dts/option/option.d.ts +260 -0
- package/dist/dts/option/option.definition.d.ts +9 -0
- package/dist/dts/option/option.options.d.ts +20 -0
- package/dist/dts/option/option.styles.d.ts +6 -0
- package/dist/dts/option/option.template.d.ts +16 -0
- package/dist/dts/patterns/start-end.d.ts +16 -2
- package/dist/dts/styles/states/index.d.ts +34 -0
- package/dist/dts/utils/element-internals.d.ts +3 -6
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/utils/language.d.ts +9 -0
- package/dist/dts/utils/support.d.ts +15 -0
- package/dist/dts/utils/unique-id.d.ts +9 -0
- package/dist/esm/accordion/accordion.js +2 -3
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.js +2 -4
- package/dist/esm/anchor-button/anchor-button.js.map +1 -1
- package/dist/esm/avatar/avatar.js +11 -12
- package/dist/esm/avatar/avatar.js.map +1 -1
- package/dist/esm/button/button.js +19 -23
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/button/button.template.js +1 -1
- package/dist/esm/button/button.template.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +10 -11
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/compound-button/compound-button.template.js +1 -1
- package/dist/esm/compound-button/compound-button.template.js.map +1 -1
- package/dist/esm/counter-badge/counter-badge.js +1 -2
- package/dist/esm/counter-badge/counter-badge.js.map +1 -1
- package/dist/esm/dialog-body/dialog-body.template.js +2 -2
- package/dist/esm/dialog-body/dialog-body.template.js.map +1 -1
- package/dist/esm/divider/divider.js +4 -5
- package/dist/esm/divider/divider.js.map +1 -1
- package/dist/esm/dropdown/define.js +4 -0
- package/dist/esm/dropdown/define.js.map +1 -0
- package/dist/esm/dropdown/dropdown.definition.js +20 -0
- package/dist/esm/dropdown/dropdown.definition.js.map +1 -0
- package/dist/esm/dropdown/dropdown.js +779 -0
- package/dist/esm/dropdown/dropdown.js.map +1 -0
- package/dist/esm/dropdown/dropdown.options.js +43 -0
- package/dist/esm/dropdown/dropdown.options.js.map +1 -0
- package/dist/esm/dropdown/dropdown.styles.js +213 -0
- package/dist/esm/dropdown/dropdown.styles.js.map +1 -0
- package/dist/esm/dropdown/dropdown.template.js +92 -0
- package/dist/esm/dropdown/dropdown.template.js.map +1 -0
- package/dist/esm/dropdown/index.js +6 -0
- package/dist/esm/dropdown/index.js.map +1 -0
- package/dist/esm/field/field.js +3 -4
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/form-associated/form-associated.js +3 -5
- package/dist/esm/form-associated/form-associated.js.map +1 -1
- package/dist/esm/index-rollup.js +3 -0
- package/dist/esm/index-rollup.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/listbox/define.js +4 -0
- package/dist/esm/listbox/define.js.map +1 -0
- package/dist/esm/listbox/index.js +6 -0
- package/dist/esm/listbox/index.js.map +1 -0
- package/dist/esm/listbox/listbox.definition.js +17 -0
- package/dist/esm/listbox/listbox.definition.js.map +1 -0
- package/dist/esm/listbox/listbox.js +175 -0
- package/dist/esm/listbox/listbox.js.map +1 -0
- package/dist/esm/listbox/listbox.options.js +15 -0
- package/dist/esm/listbox/listbox.options.js.map +1 -0
- package/dist/esm/listbox/listbox.styles.js +26 -0
- package/dist/esm/listbox/listbox.styles.js.map +1 -0
- package/dist/esm/listbox/listbox.template.js +33 -0
- package/dist/esm/listbox/listbox.template.js.map +1 -0
- package/dist/esm/menu/menu.js +23 -32
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/menu-item/menu-item.js +9 -14
- package/dist/esm/menu-item/menu-item.js.map +1 -1
- package/dist/esm/menu-list/menu-list.js +4 -5
- package/dist/esm/menu-list/menu-list.js.map +1 -1
- package/dist/esm/option/define.js +4 -0
- package/dist/esm/option/define.js.map +1 -0
- package/dist/esm/option/index.js +6 -0
- package/dist/esm/option/index.js.map +1 -0
- package/dist/esm/option/option.definition.js +17 -0
- package/dist/esm/option/option.definition.js.map +1 -0
- package/dist/esm/option/option.js +296 -0
- package/dist/esm/option/option.js.map +1 -0
- package/dist/esm/option/option.options.js +15 -0
- package/dist/esm/option/option.options.js.map +1 -0
- package/dist/esm/option/option.styles.js +127 -0
- package/dist/esm/option/option.styles.js.map +1 -0
- package/dist/esm/option/option.template.js +42 -0
- package/dist/esm/option/option.template.js.map +1 -0
- package/dist/esm/patterns/start-end.js +12 -0
- package/dist/esm/patterns/start-end.js.map +1 -1
- package/dist/esm/progress-bar/progress-bar.js +3 -4
- package/dist/esm/progress-bar/progress-bar.js.map +1 -1
- package/dist/esm/radio-group/radio-group.js +27 -38
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/rating-display/rating-display.js +7 -13
- package/dist/esm/rating-display/rating-display.js.map +1 -1
- package/dist/esm/slider/slider.js +13 -16
- package/dist/esm/slider/slider.js.map +1 -1
- package/dist/esm/spinner/spinner.styles.js +4 -4
- package/dist/esm/styles/states/index.js +34 -0
- package/dist/esm/styles/states/index.js.map +1 -1
- package/dist/esm/switch/switch.styles.js +4 -0
- package/dist/esm/switch/switch.styles.js.map +1 -1
- package/dist/esm/tablist/tablist.js +5 -7
- package/dist/esm/tablist/tablist.js.map +1 -1
- package/dist/esm/tabs/tabs.js +5 -8
- package/dist/esm/tabs/tabs.js.map +1 -1
- package/dist/esm/text-input/text-input.js +13 -15
- package/dist/esm/text-input/text-input.js.map +1 -1
- package/dist/esm/textarea/textarea.js +20 -29
- package/dist/esm/textarea/textarea.js.map +1 -1
- package/dist/esm/theme/set-theme.js +1 -2
- package/dist/esm/theme/set-theme.js.map +1 -1
- package/dist/esm/tooltip/tooltip.js +13 -18
- package/dist/esm/tooltip/tooltip.js.map +1 -1
- package/dist/esm/utils/direction.js +1 -2
- package/dist/esm/utils/direction.js.map +1 -1
- package/dist/esm/utils/element-internals.js +8 -11
- package/dist/esm/utils/element-internals.js.map +1 -1
- package/dist/esm/utils/get-initials.js +2 -2
- package/dist/esm/utils/get-initials.js.map +1 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/language.js +12 -0
- package/dist/esm/utils/language.js.map +1 -0
- package/dist/esm/utils/support.js +16 -0
- package/dist/esm/utils/support.js.map +1 -0
- package/dist/esm/utils/unique-id.js +14 -0
- package/dist/esm/utils/unique-id.js.map +1 -0
- package/dist/esm/utils/whitespace-filter.js +1 -1
- package/dist/esm/utils/whitespace-filter.js.map +1 -1
- package/dist/web-components.d.ts +1928 -862
- package/dist/web-components.js +1668 -448
- package/dist/web-components.min.js +344 -322
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { FASTElement } from '@microsoft/fast-element';
|
|
2
|
+
import type { BaseDropdown } from '../dropdown/dropdown.js';
|
|
3
|
+
import type { DropdownOption } from '../option/option.js';
|
|
4
|
+
/**
|
|
5
|
+
* A Listbox Custom HTML Element.
|
|
6
|
+
* Implements the {@link https://w3c.github.io/aria/#listbox | ARIA listbox } role.
|
|
7
|
+
*
|
|
8
|
+
* @slot - The default slot for the options.
|
|
9
|
+
* @emits connected - Dispatched when the element is connected to the DOM.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* The listbox component represents a list of options that can be selected.
|
|
13
|
+
* It is intended to be used in conjunction with the {@link BaseDropdown | Dropdown} component.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare class Listbox extends FASTElement {
|
|
18
|
+
/**
|
|
19
|
+
* Sets the listbox ID to a unique value if one is not provided.
|
|
20
|
+
*
|
|
21
|
+
* @override
|
|
22
|
+
* @public
|
|
23
|
+
* @remarks
|
|
24
|
+
* HTML Attribute: `id`
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
/**
|
|
28
|
+
* Indicates whether the listbox allows multiple selection.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
multiple?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Updates the multiple selection state of the listbox and its options.
|
|
35
|
+
*
|
|
36
|
+
* @param prev - the previous multiple value
|
|
37
|
+
* @param next - the current multiple value
|
|
38
|
+
*/
|
|
39
|
+
multipleChanged(prev: boolean | undefined, next: boolean | undefined): void;
|
|
40
|
+
/**
|
|
41
|
+
* The collection of all child options.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
options: DropdownOption[];
|
|
46
|
+
/**
|
|
47
|
+
* Updates the enabled options collection when properties on the child options change.
|
|
48
|
+
*
|
|
49
|
+
* @param prev - the previous options
|
|
50
|
+
* @param next - the current options
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
optionsChanged(prev: DropdownOption[] | undefined, next: DropdownOption[] | undefined): void;
|
|
55
|
+
/**
|
|
56
|
+
* The index of the first selected and enabled option.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
selectedIndex: number;
|
|
60
|
+
/**
|
|
61
|
+
* Reference to the parent dropdown element.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
dropdown?: BaseDropdown;
|
|
65
|
+
/**
|
|
66
|
+
* Handles the `beforetoggle` event on the listbox.
|
|
67
|
+
*
|
|
68
|
+
* @param e - the toggle event
|
|
69
|
+
* @returns true to allow the default popover behavior, undefined to prevent it
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
beforetoggleHandler(e: ToggleEvent): boolean | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
75
|
+
*
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
elementInternals: ElementInternals;
|
|
79
|
+
/**
|
|
80
|
+
* The collection of child options that are not disabled.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
get enabledOptions(): DropdownOption[];
|
|
85
|
+
/**
|
|
86
|
+
* The collection of child options that are selected.
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
get selectedOptions(): DropdownOption[];
|
|
91
|
+
/**
|
|
92
|
+
* Sets the `selected` state on a target option when clicked.
|
|
93
|
+
*
|
|
94
|
+
* @param e - The pointer event
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
clickHandler(e: PointerEvent): boolean | void;
|
|
98
|
+
constructor();
|
|
99
|
+
connectedCallback(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Handles observable subscriptions for the listbox.
|
|
102
|
+
*
|
|
103
|
+
* @param source - The source of the observed change
|
|
104
|
+
* @param propertyName - The name of the property that changed
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
handleChange(source: any, propertyName?: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Selects an option by index.
|
|
111
|
+
*
|
|
112
|
+
* @param index - The index of the option to select.
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
selectOption(index?: number): void;
|
|
116
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Listbox } from './listbox.js';
|
|
2
|
+
/**
|
|
3
|
+
* Predicate function that determines if the element should be considered a listbox.
|
|
4
|
+
*
|
|
5
|
+
* @param element - The element to check.
|
|
6
|
+
* @param tagName - The tag name to check.
|
|
7
|
+
* @returns true if the element is a listbox.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare function isListbox(element?: Node | null, tagName?: string): element is Listbox;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ElementViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import type { Listbox } from './listbox.js';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a template for the {@link (Dropdown:class)} component.
|
|
5
|
+
*
|
|
6
|
+
* @param options - The {@link (DropdownOptions:interface)} to use for generating the template.
|
|
7
|
+
* @returns The template object.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function listboxTemplate<T extends Listbox>(): ElementViewTemplate<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Template for the Listbox component.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare const template: ElementViewTemplate<Listbox>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { definition as DropdownOptionDefinition } from './option.definition.js';
|
|
2
|
+
export { DropdownOption } from './option.js';
|
|
3
|
+
export { isDropdownOption, type DropdownOptionOptions } from './option.options.js';
|
|
4
|
+
export { styles as DropdownOptionStyles } from './option.styles.js';
|
|
5
|
+
export { template as DropdownOptionTemplate } from './option.template.js';
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { FASTElement } from '@microsoft/fast-element';
|
|
2
|
+
import type { Start } from '../patterns/start-end.js';
|
|
3
|
+
/**
|
|
4
|
+
* A DropdownOption Custom HTML Element.
|
|
5
|
+
* Implements the {@link https://w3c.github.io/aria/#option | ARIA option } role.
|
|
6
|
+
*
|
|
7
|
+
* @slot - The default slot for the option's content.
|
|
8
|
+
* @slot checked-indicator - The checked indicator.
|
|
9
|
+
* @slot description - Optional description content.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* To support single and multiple selection modes with the {@link (BaseDropdown:class)} element, the Option element
|
|
13
|
+
* itself handles form association and value submission, rather than its parent Dropdown element. In this way, the
|
|
14
|
+
* Option element is a variation of the Checkbox element that is specifically designed for use in the Dropdown element.
|
|
15
|
+
*
|
|
16
|
+
* This class is named `DropdownOption` to avoid conflicts with the native `Option` global. Related constructs are also
|
|
17
|
+
* titled with `DropdownOption` to maintain consistency.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare class DropdownOption extends FASTElement implements Start {
|
|
22
|
+
/**
|
|
23
|
+
* Indicates that the option is active.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
active: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Changes the active state of the option when the active property changes.
|
|
30
|
+
*
|
|
31
|
+
* @param prev - the previous active state
|
|
32
|
+
* @param next - the current active state
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
protected activeChanged(prev: boolean, next: boolean): void;
|
|
36
|
+
/**
|
|
37
|
+
* The current selected state of the option.
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
currentSelected?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the selected property to match the currentSelected state.
|
|
44
|
+
*
|
|
45
|
+
* @param prev - the previous selected state
|
|
46
|
+
* @param next - the current selected state
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
currentSelectedChanged(prev: boolean | undefined, next: boolean | undefined): void;
|
|
50
|
+
/**
|
|
51
|
+
* The initial selected state of the option.
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
* @remarks
|
|
55
|
+
* HTML Attribute: `checked`
|
|
56
|
+
*/
|
|
57
|
+
defaultSelected?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Updates the selected state when the `selected` attribute is changed, unless the selected state has been changed by the user.
|
|
60
|
+
*
|
|
61
|
+
* @param prev - The previous initial selected state
|
|
62
|
+
* @param next - The current initial selected state
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
protected defaultSelectedChanged(prev: boolean | undefined, next: boolean | undefined): void;
|
|
66
|
+
/**
|
|
67
|
+
* The collection of slotted description elements.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
descriptionSlot: Node[];
|
|
72
|
+
/**
|
|
73
|
+
* Changes the description state of the option when the description slot changes.
|
|
74
|
+
*
|
|
75
|
+
* @param prev - the previous collection of description elements
|
|
76
|
+
* @param next - the current collection of description elements
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
descriptionSlotChanged(prev: Node[] | undefined, next: Node[] | undefined): void;
|
|
80
|
+
/**
|
|
81
|
+
* The current disabled state of the option.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Toggles the disabled state when the user changes the `disabled` property.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
protected disabledChanged(prev: boolean | undefined, next: boolean | undefined): void;
|
|
92
|
+
/**
|
|
93
|
+
* The initial disabled state of the option.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
* @remarks
|
|
97
|
+
* HTML Attribute: `disabled`
|
|
98
|
+
*/
|
|
99
|
+
disabledAttribute?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Sets the disabled state when the `disabled` attribute changes.
|
|
102
|
+
*
|
|
103
|
+
* @param prev - the previous value
|
|
104
|
+
* @param next - the current value
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
protected disabledAttributeChanged(prev: boolean | undefined, next: boolean | undefined): void;
|
|
108
|
+
/**
|
|
109
|
+
* The id of a form to associate the element to.
|
|
110
|
+
* @see The {@link https://developer.mozilla.org/docs/Web/HTML/Element/input#form | `form`} attribute
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
* @remarks
|
|
114
|
+
* HTML Attribute: `form`
|
|
115
|
+
*/
|
|
116
|
+
formAttribute?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Indicates that the option value should sync with the value of the dropdown's control.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
* @remarks
|
|
122
|
+
* HTML Attribute: `freeform`
|
|
123
|
+
*/
|
|
124
|
+
freeform?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* The id of the option. If not provided, a unique id will be assigned.
|
|
127
|
+
*
|
|
128
|
+
* @override
|
|
129
|
+
* @public
|
|
130
|
+
* @remarks
|
|
131
|
+
* HTML Attribute: `id`
|
|
132
|
+
*/
|
|
133
|
+
id: string;
|
|
134
|
+
/**
|
|
135
|
+
* The initial value of the option.
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
* @remarks
|
|
139
|
+
* HTML Attribute: `value`
|
|
140
|
+
*/
|
|
141
|
+
initialValue: string;
|
|
142
|
+
/**
|
|
143
|
+
* Sets the value of the option when the `value` attribute changes.
|
|
144
|
+
*
|
|
145
|
+
* @param prev - The previous initial value
|
|
146
|
+
* @param next - The current initial value
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
protected initialValueChanged(prev: string, next: string): void;
|
|
150
|
+
/**
|
|
151
|
+
* Indicates that the option is in a multiple selection mode context.
|
|
152
|
+
* @public
|
|
153
|
+
*/
|
|
154
|
+
multiple: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Updates the multiple state of the option when the multiple property changes.
|
|
157
|
+
*
|
|
158
|
+
* @param prev - the previous multiple state
|
|
159
|
+
* @param next - the current multiple state
|
|
160
|
+
*/
|
|
161
|
+
multipleChanged(prev: boolean, next: boolean): void;
|
|
162
|
+
/**
|
|
163
|
+
* The name of the option. This option's value will be surfaced during form submission under the provided name.
|
|
164
|
+
*
|
|
165
|
+
* @public
|
|
166
|
+
* @remarks
|
|
167
|
+
* HTML Attribute: `name`
|
|
168
|
+
*/
|
|
169
|
+
name: string;
|
|
170
|
+
/**
|
|
171
|
+
* Reference to the start slot element.
|
|
172
|
+
*
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
start: HTMLSlotElement;
|
|
176
|
+
/**
|
|
177
|
+
* The text to display in the dropdown control when the option is selected.
|
|
178
|
+
*
|
|
179
|
+
* @public
|
|
180
|
+
* @remarks
|
|
181
|
+
* HTML Attribute: `text`
|
|
182
|
+
*/
|
|
183
|
+
textAttribute?: string;
|
|
184
|
+
/**
|
|
185
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
186
|
+
*
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
elementInternals: ElementInternals;
|
|
190
|
+
/**
|
|
191
|
+
* The associated `<form>` element.
|
|
192
|
+
*
|
|
193
|
+
* @public
|
|
194
|
+
* @remarks
|
|
195
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/form | `ElementInternals.form`} property.
|
|
196
|
+
*/
|
|
197
|
+
get form(): HTMLFormElement | null;
|
|
198
|
+
/**
|
|
199
|
+
* The collection of slotted `output` elements, used to display the value when the option is freeform.
|
|
200
|
+
*
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
203
|
+
freeformOutputs?: HTMLOutputElement[];
|
|
204
|
+
/**
|
|
205
|
+
* The form-associated flag.
|
|
206
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
static formAssociated: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* A reference to all associated `<label>` elements.
|
|
213
|
+
*
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
216
|
+
get labels(): ReadonlyArray<HTMLLabelElement>;
|
|
217
|
+
/**
|
|
218
|
+
* The option's current selected state.
|
|
219
|
+
*
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
get selected(): boolean;
|
|
223
|
+
set selected(next: boolean);
|
|
224
|
+
/**
|
|
225
|
+
* The display text of the option.
|
|
226
|
+
*
|
|
227
|
+
* @public
|
|
228
|
+
* @remarks
|
|
229
|
+
* When the option is freeform, the text is the value of the option.
|
|
230
|
+
*/
|
|
231
|
+
get text(): string;
|
|
232
|
+
/**
|
|
233
|
+
* The internal value of the option.
|
|
234
|
+
*
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
private _value;
|
|
238
|
+
/**
|
|
239
|
+
* The current value of the option.
|
|
240
|
+
*
|
|
241
|
+
* @public
|
|
242
|
+
*/
|
|
243
|
+
get value(): string;
|
|
244
|
+
set value(value: string);
|
|
245
|
+
connectedCallback(): void;
|
|
246
|
+
constructor();
|
|
247
|
+
/**
|
|
248
|
+
* Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
|
|
249
|
+
*
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
|
|
253
|
+
/**
|
|
254
|
+
* Toggles the selected state of the control.
|
|
255
|
+
*
|
|
256
|
+
* @param force - Forces the element to be checked or unchecked
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
toggleSelected(force?: boolean): void;
|
|
260
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DropdownOption } from './option.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Fluent Option Element.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
* @remarks
|
|
7
|
+
* HTML Element: `<fluent-option>`
|
|
8
|
+
*/
|
|
9
|
+
export declare const definition: import("@microsoft/fast-element").FASTElementDefinition<typeof DropdownOption>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StartOptions } from '../patterns/start-end.js';
|
|
2
|
+
import type { StaticallyComposableHTML } from '../utils/template-helpers.js';
|
|
3
|
+
import type { DropdownOption } from './option.js';
|
|
4
|
+
/**
|
|
5
|
+
* Predicate function that determines if the element should be considered an option.
|
|
6
|
+
*
|
|
7
|
+
* @param element - The element to check.
|
|
8
|
+
* @param tagName - The tag name to check.
|
|
9
|
+
* @returns true if the element is an option.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare function isDropdownOption(value: Node | null, tagName?: string): value is DropdownOption;
|
|
13
|
+
/**
|
|
14
|
+
* The options for the {@link DropdownOption} component.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type DropdownOptionOptions = StartOptions<DropdownOption> & {
|
|
19
|
+
checkedIndicator?: StaticallyComposableHTML<DropdownOption>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ElementViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import type { DropdownOption } from './option.js';
|
|
3
|
+
import type { DropdownOptionOptions } from './option.options.js';
|
|
4
|
+
/**
|
|
5
|
+
* Generates a template for the {@link (Option:class)} component.
|
|
6
|
+
*
|
|
7
|
+
* @param options - The {@link (OptionOptions:interface)} to use for generating the template.
|
|
8
|
+
* @returns The template object.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function dropdownOptionTemplate<T extends DropdownOption>(options?: DropdownOptionOptions): ElementViewTemplate<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Template for the Option component.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare const template: ElementViewTemplate<DropdownOption>;
|
|
@@ -19,12 +19,26 @@ export type EndOptions<TSource = any, TParent = any> = {
|
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
export type StartEndOptions<TSource = any, TParent = any> = StartOptions<TSource, TParent> & EndOptions<TSource, TParent>;
|
|
22
|
+
/**
|
|
23
|
+
* A mixin class implementing start slots.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare class Start {
|
|
27
|
+
start: HTMLSlotElement;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A mixin class implementing end slots.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare class End {
|
|
34
|
+
end: HTMLSlotElement;
|
|
35
|
+
}
|
|
22
36
|
/**
|
|
23
37
|
* A mixin class implementing start and end slots.
|
|
24
38
|
* These are generally used to decorate text elements with icons or other visual indicators.
|
|
25
39
|
* @public
|
|
26
40
|
*/
|
|
27
|
-
export declare class StartEnd {
|
|
41
|
+
export declare class StartEnd implements Start, End {
|
|
28
42
|
start: HTMLSlotElement;
|
|
29
43
|
end: HTMLSlotElement;
|
|
30
44
|
}
|
|
@@ -41,4 +55,4 @@ export declare function endSlotTemplate<TSource extends StartEnd = StartEnd, TPa
|
|
|
41
55
|
*
|
|
42
56
|
* @public
|
|
43
57
|
*/
|
|
44
|
-
export declare function startSlotTemplate<TSource extends StartEnd = StartEnd, TParent = any>(options: StartOptions<TSource, TParent>): CaptureType<TSource, TParent>;
|
|
58
|
+
export declare function startSlotTemplate<TSource extends Pick<StartEnd, 'start'> = StartEnd, TParent = any>(options: StartOptions<TSource, TParent>): CaptureType<TSource, TParent>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selector for the `active` state.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare const activeState: ":state(active)" | "[state--active]";
|
|
1
6
|
/**
|
|
2
7
|
* Selector for the `align-end` state.
|
|
3
8
|
* @public
|
|
@@ -108,6 +113,10 @@ export declare const darkGreenState: ":state(dark-green)" | "[state--dark-green]
|
|
|
108
113
|
* @public
|
|
109
114
|
*/
|
|
110
115
|
export declare const darkRedState: ":state(dark-red)" | "[state--dark-red]";
|
|
116
|
+
/**
|
|
117
|
+
* Selector for the `description` state.
|
|
118
|
+
*/
|
|
119
|
+
export declare const descriptionState: ":state(description)" | "[state--description]";
|
|
111
120
|
/**
|
|
112
121
|
* Selector for the `disabled` state.
|
|
113
122
|
* @public
|
|
@@ -178,6 +187,11 @@ export declare const fitCoverState: ":state(fit-cover)" | "[state--fit-cover]";
|
|
|
178
187
|
* @public
|
|
179
188
|
*/
|
|
180
189
|
export declare const fitNoneState: ":state(fit-none)" | "[state--fit-none]";
|
|
190
|
+
/**
|
|
191
|
+
* Selector for the `flip-block` state.
|
|
192
|
+
* @public
|
|
193
|
+
*/
|
|
194
|
+
export declare const flipBlockState: ":state(flip-block)" | "[state--flip-block]";
|
|
181
195
|
/**
|
|
182
196
|
* Selector for the `focus-visible` state.
|
|
183
197
|
* @public
|
|
@@ -308,6 +322,11 @@ export declare const monospaceState: ":state(monospace)" | "[state--monospace]";
|
|
|
308
322
|
* @public
|
|
309
323
|
*/
|
|
310
324
|
export declare const multiLineState: ":state(multiline)" | "[state--multiline]";
|
|
325
|
+
/**
|
|
326
|
+
* Selector for the `multiselect` state.
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
export declare const multipleState: ":state(multiple)" | "[state--multiple]";
|
|
311
330
|
/**
|
|
312
331
|
* Selector for the `navy` state.
|
|
313
332
|
* @public
|
|
@@ -328,6 +347,11 @@ export declare const nowrapState: ":state(nowrap)" | "[state--nowrap]";
|
|
|
328
347
|
* @public
|
|
329
348
|
*/
|
|
330
349
|
export declare const numericState: ":state(numeric)" | "[state--numeric]";
|
|
350
|
+
/**
|
|
351
|
+
* Selector for the `open` state.
|
|
352
|
+
* @public
|
|
353
|
+
*/
|
|
354
|
+
export declare const openState: ":state(open)" | "[state--open]";
|
|
331
355
|
/**
|
|
332
356
|
* Selector for the `outline` state.
|
|
333
357
|
* @public
|
|
@@ -348,6 +372,11 @@ export declare const peachState: ":state(peach)" | "[state--peach]";
|
|
|
348
372
|
* @public
|
|
349
373
|
*/
|
|
350
374
|
export declare const pinkState: ":state(pink)" | "[state--pink]";
|
|
375
|
+
/**
|
|
376
|
+
* Selector for the `placeholder-shown` state.
|
|
377
|
+
* @public
|
|
378
|
+
*/
|
|
379
|
+
export declare const placeholderShownState: ":state(placeholder-shown)" | "[state--placeholder-shown]";
|
|
351
380
|
/**
|
|
352
381
|
* Selector for the `platinum` state.
|
|
353
382
|
* @public
|
|
@@ -423,6 +452,11 @@ export declare const royalBlueState: ":state(royal-blue)" | "[state--royal-blue]
|
|
|
423
452
|
* @public
|
|
424
453
|
*/
|
|
425
454
|
export declare const seafoamState: ":state(seafoam)" | "[state--seafoam]";
|
|
455
|
+
/**
|
|
456
|
+
* Selector for the `selected` state.
|
|
457
|
+
* @public
|
|
458
|
+
*/
|
|
459
|
+
export declare const selectedState: ":state(selected)" | "[state--selected]";
|
|
426
460
|
/**
|
|
427
461
|
* Selector for the `semibold` state.
|
|
428
462
|
* @public
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { CustomStatesSetSupported } from './support.js';
|
|
1
2
|
/**
|
|
2
3
|
* Inference type for a CSS custom state selector.
|
|
3
4
|
* @public
|
|
4
5
|
*/
|
|
5
6
|
export type StateSelector<S> = S extends string ? `:state(${S})` | `[state--${S}]` : never;
|
|
6
|
-
|
|
7
|
-
* Check if the browser supports Custom States.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare const CustomStatesSetSupported: boolean;
|
|
7
|
+
export { CustomStatesSetSupported };
|
|
11
8
|
/**
|
|
12
9
|
* Returns a string that represents a CSS custom state selector.
|
|
13
10
|
*
|
|
@@ -32,7 +29,7 @@ export declare function stateSelector<S extends string>(state: S): StateSelector
|
|
|
32
29
|
* @param force - force the state to be toggled on or off
|
|
33
30
|
* @internal
|
|
34
31
|
*/
|
|
35
|
-
export declare function toggleState(elementInternals: ElementInternals, state: string | undefined, force?: boolean): void;
|
|
32
|
+
export declare function toggleState(elementInternals: ElementInternals | undefined, state: string | undefined, force?: boolean): void;
|
|
36
33
|
/**
|
|
37
34
|
* Check if a given attribute value is a valid state. Attribute values are often kebab-cased, so this function converts
|
|
38
35
|
* the kebab-cased `state` to camelCase and checks if it exists in as a key in the `States` object.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the current language code of an element.
|
|
3
|
+
*
|
|
4
|
+
* @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
|
|
5
|
+
* @returns the language code of the element
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLanguage(rootNode: HTMLElement): Intl.BCP47LanguageTag;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the browser supports CSS Anchor Positioning.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare const AnchorPositioningCSSSupported: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Check if the browser supports HTML Anchor Positioning.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare const AnchorPositioningHTMLSupported: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Check if the browser supports Custom States.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const CustomStatesSetSupported: boolean;
|