@universal-material/web 3.0.74 → 3.0.76
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/button/button.d.ts +1 -1
- package/button/button.js.map +1 -1
- package/chip-field/chip-field.d.ts +18 -1
- package/chip-field/chip-field.d.ts.map +1 -1
- package/chip-field/chip-field.js +20 -7
- package/chip-field/chip-field.js.map +1 -1
- package/custom-elements.json +5117 -5038
- package/field/field-base.d.ts +18 -2
- package/field/field-base.d.ts.map +1 -1
- package/field/field-base.js +14 -8
- package/field/field-base.js.map +1 -1
- package/navigation/drawer.d.ts.map +1 -1
- package/navigation/drawer.js +5 -1
- package/navigation/drawer.js.map +1 -1
- package/navigation/drawer.styles.d.ts.map +1 -1
- package/navigation/drawer.styles.js +6 -1
- package/navigation/drawer.styles.js.map +1 -1
- package/package.json +1 -1
- package/select/option.js +2 -2
- package/select/option.js.map +1 -1
- package/select/select-navigation-controller.js +8 -8
- package/select/select-navigation-controller.js.map +1 -1
- package/select/select.d.ts +15 -7
- package/select/select.d.ts.map +1 -1
- package/select/select.js +50 -42
- package/select/select.js.map +1 -1
- package/shared/button-wrapper.js +1 -1
- package/shared/button-wrapper.js.map +1 -1
- package/shared/menu-field/menu-field-navigation-controller.js +7 -7
- package/shared/menu-field/menu-field-navigation-controller.js.map +1 -1
- package/shared/menu-field/menu-field.d.ts +2 -2
- package/shared/menu-field/menu-field.d.ts.map +1 -1
- package/shared/menu-field/menu-field.js.map +1 -1
- package/shared/text-field-base/text-field-base.d.ts +3 -0
- package/shared/text-field-base/text-field-base.d.ts.map +1 -1
- package/shared/text-field-base/text-field-base.js +3 -0
- package/shared/text-field-base/text-field-base.js.map +1 -1
- package/tab-bar/tab.js +2 -2
- package/tab-bar/tab.js.map +1 -1
- package/tab-bar/tab.styles.d.ts.map +1 -1
- package/tab-bar/tab.styles.js +6 -2
- package/tab-bar/tab.styles.js.map +1 -1
- package/typeahead/typeahead.d.ts +45 -3
- package/typeahead/typeahead.d.ts.map +1 -1
- package/typeahead/typeahead.js +37 -6
- package/typeahead/typeahead.js.map +1 -1
- package/shared/redispatch-event.d.ts +0 -2
- package/shared/redispatch-event.d.ts.map +0 -1
- package/shared/redispatch-event.js +0 -14
- package/shared/redispatch-event.js.map +0 -1
package/field/field-base.d.ts
CHANGED
|
@@ -7,12 +7,28 @@ export declare abstract class UmFieldBase extends LitElement {
|
|
|
7
7
|
static styles: CSSResultGroup;
|
|
8
8
|
private config;
|
|
9
9
|
variant: 'filled' | 'outlined' | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The floating label for the field
|
|
12
|
+
*/
|
|
10
13
|
label: string | undefined;
|
|
11
14
|
counter: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Supporting text conveys additional information about the field, such as how it will be used
|
|
17
|
+
*/
|
|
12
18
|
supportingText: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* For text fields that validate their content (such as passwords), replace supporting text with error text when applicable.
|
|
21
|
+
* If `errorText` is not an empty string, changing the property `invalid` to `true` will show the `errorText` instead of `supportingText`
|
|
22
|
+
*/
|
|
13
23
|
errorText: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the field is empty or not. This changes the behavior of the floating label when the field is not focused.
|
|
26
|
+
*/
|
|
14
27
|
empty: boolean;
|
|
15
28
|
disabled: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get or sets where or not the field is in a visually invalid state.
|
|
31
|
+
*/
|
|
16
32
|
invalid: boolean;
|
|
17
33
|
static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>>;
|
|
18
34
|
/**
|
|
@@ -36,8 +52,8 @@ export declare abstract class UmFieldBase extends LitElement {
|
|
|
36
52
|
private readonly assignedLeadingIcons;
|
|
37
53
|
private readonly assignedTrailingIcons;
|
|
38
54
|
private readonly assignedErrorTexts;
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
private _labelElement;
|
|
56
|
+
protected _container: HTMLElement;
|
|
41
57
|
private labelSizeObserver;
|
|
42
58
|
constructor();
|
|
43
59
|
protected render(): TemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-base.d.ts","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAQ,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAOhE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,8BAAsB,WAAY,SAAQ,UAAU;;IAClD,OAAgB,MAAM,EAAE,cAAc,CAAwB;IAI9D,OAAO,CAAC,MAAM,CAA8B;IAEhC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAY;
|
|
1
|
+
{"version":3,"file":"field-base.d.ts","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAQ,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAOhE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,8BAAsB,WAAY,SAAQ,UAAU;;IAClD,OAAgB,MAAM,EAAE,cAAc,CAAwB;IAI9D,OAAO,CAAC,MAAM,CAA8B;IAEhC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAY;IAElE;;OAEG;IACS,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;OAEG;IACuC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7E;;;OAGG;IACkC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnE;;OAEG;IACuC,KAAK,UAAS;IACd,QAAQ,UAAS;IAE3D;;OAEG;IACuC,OAAO,UAAS;IAE1D,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAO7H;;;;OAIG;IACsE,cAAc,UAAS;IAEhG;;;;OAIG;IACuE,eAAe,UAAS;IAElG;;;;OAIG;IACoE,YAAY,UAAS;IAG5F,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAiB;IAGtD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAiB;IAGvD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiB;IAEnC,OAAO,CAAC,aAAa,CAAe;IAChC,SAAS,CAAC,UAAU,EAAG,WAAW,CAAC;IAExD,OAAO,CAAC,iBAAiB,CAA+B;;cAOrC,MAAM,IAAI,cAAc;IAuC3C,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,cAAc;IAClD,SAAS,CAAC,kBAAkB,IAAI,cAAc;IAIrC,iBAAiB;IAOjB,oBAAoB;IAc7B,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,uBAAuB;IAe/B,SAAS,CAAC,yBAAyB,IAAI,cAAc,GAAG,OAAO,OAAO;CAGvE"}
|
package/field/field-base.js
CHANGED
|
@@ -21,8 +21,14 @@ export class UmFieldBase extends LitElement {
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
23
|
this.variant = 'filled';
|
|
24
|
+
/**
|
|
25
|
+
* Whether the field is empty or not. This changes the behavior of the floating label when the field is not focused.
|
|
26
|
+
*/
|
|
24
27
|
this.empty = false;
|
|
25
28
|
this.disabled = false;
|
|
29
|
+
/**
|
|
30
|
+
* Get or sets where or not the field is in a visually invalid state.
|
|
31
|
+
*/
|
|
26
32
|
this.invalid = false;
|
|
27
33
|
/**
|
|
28
34
|
* Whether the field has a leading icon or not
|
|
@@ -99,14 +105,14 @@ export class UmFieldBase extends LitElement {
|
|
|
99
105
|
async #attach() {
|
|
100
106
|
await this.updateComplete;
|
|
101
107
|
this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties());
|
|
102
|
-
this.labelSizeObserver.observe(this.
|
|
108
|
+
this.labelSizeObserver.observe(this._labelElement);
|
|
103
109
|
this.setLabelWidthProperties();
|
|
104
110
|
}
|
|
105
111
|
handleLeadingIconSlotChange() {
|
|
106
|
-
this.
|
|
112
|
+
this._labelElement.style.transition = 'none';
|
|
107
113
|
this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;
|
|
108
114
|
setTimeout(() => {
|
|
109
|
-
this.
|
|
115
|
+
this._labelElement.style.transition = '';
|
|
110
116
|
});
|
|
111
117
|
}
|
|
112
118
|
handleTrailingIconSlotChange() {
|
|
@@ -116,14 +122,14 @@ export class UmFieldBase extends LitElement {
|
|
|
116
122
|
this.hasErrorText = this.assignedErrorTexts.length > 0;
|
|
117
123
|
}
|
|
118
124
|
setLabelWidthProperties() {
|
|
119
|
-
const width = this.
|
|
125
|
+
const width = this._labelElement.offsetWidth;
|
|
120
126
|
this.style.setProperty('--u-field-label-width', `${width}px`);
|
|
121
127
|
this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);
|
|
122
128
|
if (!width) {
|
|
123
|
-
this.
|
|
129
|
+
this._container.classList.add('no-label');
|
|
124
130
|
return;
|
|
125
131
|
}
|
|
126
|
-
this.
|
|
132
|
+
this._container.classList.remove('no-label');
|
|
127
133
|
}
|
|
128
134
|
renderDefaultTrailingIcon() {
|
|
129
135
|
return nothing;
|
|
@@ -177,8 +183,8 @@ __decorate([
|
|
|
177
183
|
], UmFieldBase.prototype, "assignedErrorTexts", void 0);
|
|
178
184
|
__decorate([
|
|
179
185
|
query('.label')
|
|
180
|
-
], UmFieldBase.prototype, "
|
|
186
|
+
], UmFieldBase.prototype, "_labelElement", void 0);
|
|
181
187
|
__decorate([
|
|
182
188
|
query('.container')
|
|
183
|
-
], UmFieldBase.prototype, "
|
|
189
|
+
], UmFieldBase.prototype, "_container", void 0);
|
|
184
190
|
//# sourceMappingURL=field-base.js.map
|
package/field/field-base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-base.js","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAW,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,OAAgB,WAAY,SAAQ,UAAU;aAClC,WAAM,GAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,AAAvC,CAAwC;IAiB9D,MAAM,CAAC,WAAW,CAAC,WAAwB,EAAE,MAAuB;QAClE,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE;YACtC,OAAO,EAAE,oBAAoB;YAC7B,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IAqCD;QACE,KAAK,EAAE,CAAC;QAtDE,YAAO,GAAsC,QAAQ,CAAC;QAOxB,UAAK,GAAG,KAAK,CAAC;QACd,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAAG,KAAK,CAAC;QAS1D;;;;WAIG;QACsE,mBAAc,GAAG,KAAK,CAAC;QAEhG;;;;WA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C;iDAA4B;AACvB;IAApB,KAAK,CAAC,YAAY,CAAC;8CAAyB","sourcesContent":["import { consume, Context, ContextProvider } from '@lit/context';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\nimport { html, TemplateResult, LitElement, nothing } from 'lit';\nimport { property, query, queryAssignedElements, state } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './field-base.styles.js';\n\nimport { fieldDefaultsContext } from './field-defaults-context.js';\nimport { UmFieldDefaults } from './field-defaults.js';\n\nexport abstract class UmFieldBase extends LitElement {\n static override styles: CSSResultGroup = [baseStyles, styles];\n\n @consume({context: fieldDefaultsContext, subscribe: true})\n @state()\n private config: UmFieldDefaults | undefined;\n\n @property() variant: 'filled' | 'outlined' | undefined = 'filled';\n\n @property() label: string | undefined;\n @property() counter: string | undefined;\n @property({attribute: 'supporting-text'}) supportingText: string | undefined;\n @property({attribute: 'error-text'}) errorText: string | undefined;\n\n @property({type: Boolean, reflect: true}) empty = false;\n @property({type: Boolean, reflect: true}) disabled = false;\n @property({type: Boolean, reflect: true}) invalid = false;\n\n static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>> {\n return new ContextProvider(contextRoot, {\n context: fieldDefaultsContext,\n initialValue: config\n });\n }\n\n /**\n * Whether the field has a leading icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-leading-icon', reflect: true}) hasLeadingIcon = false;\n\n /**\n * Whether the field has a trailing icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-trailing-icon', reflect: true}) hasTrailingIcon = false;\n\n /**\n * Whether the field has an error text or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-error-text', reflect: true}) hasErrorText = false;\n\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly assignedLeadingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'trailing-icon', flatten: true})\n private readonly assignedTrailingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'error-text', flatten: true})\n private readonly assignedErrorTexts!: HTMLElement[];\n\n @query('.label') labelElement!: HTMLElement;\n @query('.container') container!: HTMLElement;\n\n private labelSizeObserver: ResizeObserver | null = null;\n\n constructor() {\n super();\n this.variant = undefined;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"container ${this.variant ?? this.config?.variant ?? 'filled'}\">\n <slot\n class=\"icon leading-icon\"\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\">\n </slot>\n <label class=\"label\" slot=\"label\" id=\"label\">\n <slot name=\"label\">${this.label}</slot>\n </label>\n <div class=\"input-wrapper\" part=\"wrapper\">\n ${this.renderControl()}\n </div>\n <slot\n class=\"icon trailing-icon\"\n name=\"trailing-icon\"\n @slotchange=\"${this.handleTrailingIconSlotChange}\">\n <span>${this.renderDefaultTrailingIcon()}</span>\n </slot>\n </div>\n <div class=\"supporting-text\" id=\"supporting-text\">\n <slot\n class=\"error-text\"\n name=\"error-text\"\n @slotchange=\"${this.handleErrorTextSlotChange}\">\n <div>${this.errorText}</div>\n </slot>\n <slot name=\"supporting-text\" id=\"supporting-text\">\n <div>${this.supportingText}</div>\n </slot>\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter}</div>\n </slot>\n </div>\n ${this.renderAfterContent()}\n `;\n }\n\n protected abstract renderControl(): TemplateResult;\n protected renderAfterContent(): TemplateResult {\n return html``;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.hasLeadingIcon = !!this.assignedLeadingIcons.length;\n\n this.#attach();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.labelSizeObserver!.disconnect();\n this.labelSizeObserver = null;\n }\n\n async #attach(): Promise<void> {\n await this.updateComplete;\n this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties())\n this.labelSizeObserver.observe(this.labelElement);\n this.setLabelWidthProperties();\n }\n\n private handleLeadingIconSlotChange() {\n this.labelElement.style.transition = 'none';\n this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;\n\n setTimeout(() => {\n this.labelElement.style.transition = '';\n });\n }\n\n private handleTrailingIconSlotChange() {\n this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;\n }\n\n private handleErrorTextSlotChange() {\n this.hasErrorText = this.assignedErrorTexts.length > 0;\n }\n\n private setLabelWidthProperties() {\n\n const width = this.labelElement.offsetWidth;\n\n this.style.setProperty('--u-field-label-width', `${width}px`);\n this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);\n\n if (!width) {\n this.container.classList.add('no-label');\n return;\n }\n\n this.container.classList.remove('no-label');\n }\n\n protected renderDefaultTrailingIcon(): TemplateResult | typeof nothing {\n return nothing;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"field-base.js","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAW,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,OAAgB,WAAY,SAAQ,UAAU;aAClC,WAAM,GAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,AAAvC,CAAwC;IAoC9D,MAAM,CAAC,WAAW,CAAC,WAAwB,EAAE,MAAuB;QAClE,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE;YACtC,OAAO,EAAE,oBAAoB;YAC7B,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;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,IAAI,EAAC,CAAC;yDACP;AAGrC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0DACP;AAGtC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;uDACP;AAE3B;IAAxB,KAAK,CAAC,QAAQ,CAAC;kDAAqC;AACtB;IAA9B,KAAK,CAAC,YAAY,CAAC;+CAAoC","sourcesContent":["import { consume, Context, ContextProvider } from '@lit/context';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\nimport { html, TemplateResult, LitElement, nothing } from 'lit';\nimport { property, query, queryAssignedElements, state } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './field-base.styles.js';\n\nimport { fieldDefaultsContext } from './field-defaults-context.js';\nimport { UmFieldDefaults } from './field-defaults.js';\n\nexport abstract class UmFieldBase extends LitElement {\n static override styles: CSSResultGroup = [baseStyles, styles];\n\n @consume({context: fieldDefaultsContext, subscribe: true})\n @state()\n private config: UmFieldDefaults | undefined;\n\n @property() variant: 'filled' | 'outlined' | undefined = 'filled';\n\n /**\n * The floating label for the field\n */\n @property() label: string | undefined;\n @property() counter: string | undefined;\n\n /**\n * Supporting text conveys additional information about the field, such as how it will be used\n */\n @property({attribute: 'supporting-text'}) supportingText: string | undefined;\n\n /**\n * For text fields that validate their content (such as passwords), replace supporting text with error text when applicable.\n * If `errorText` is not an empty string, changing the property `invalid` to `true` will show the `errorText` instead of `supportingText`\n */\n @property({attribute: 'error-text'}) errorText: string | undefined;\n\n /**\n * Whether the field is empty or not. This changes the behavior of the floating label when the field is not focused.\n */\n @property({type: Boolean, reflect: true}) empty = false;\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Get or sets where or not the field is in a visually invalid state.\n */\n @property({type: Boolean, reflect: true}) invalid = false;\n\n static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>> {\n return new ContextProvider(contextRoot, {\n context: fieldDefaultsContext,\n initialValue: config\n });\n }\n\n /**\n * Whether the field has a leading icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-leading-icon', reflect: true}) hasLeadingIcon = false;\n\n /**\n * Whether the field has a trailing icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-trailing-icon', reflect: true}) hasTrailingIcon = false;\n\n /**\n * Whether the field has an error text or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-error-text', reflect: true}) hasErrorText = false;\n\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly assignedLeadingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'trailing-icon', flatten: true})\n private readonly assignedTrailingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'error-text', flatten: true})\n private readonly assignedErrorTexts!: HTMLElement[];\n\n @query('.label') private _labelElement!: HTMLElement;\n @query('.container') protected _container!: HTMLElement;\n\n private labelSizeObserver: ResizeObserver | null = null;\n\n constructor() {\n super();\n this.variant = undefined;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"container ${this.variant ?? this.config?.variant ?? 'filled'}\">\n <slot\n class=\"icon leading-icon\"\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\">\n </slot>\n <label class=\"label\" slot=\"label\" id=\"label\">\n <slot name=\"label\">${this.label}</slot>\n </label>\n <div class=\"input-wrapper\" part=\"wrapper\">\n ${this.renderControl()}\n </div>\n <slot\n class=\"icon trailing-icon\"\n name=\"trailing-icon\"\n @slotchange=\"${this.handleTrailingIconSlotChange}\">\n <span>${this.renderDefaultTrailingIcon()}</span>\n </slot>\n </div>\n <div class=\"supporting-text\" id=\"supporting-text\">\n <slot\n class=\"error-text\"\n name=\"error-text\"\n @slotchange=\"${this.handleErrorTextSlotChange}\">\n <div>${this.errorText}</div>\n </slot>\n <slot name=\"supporting-text\" id=\"supporting-text\">\n <div>${this.supportingText}</div>\n </slot>\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter}</div>\n </slot>\n </div>\n ${this.renderAfterContent()}\n `;\n }\n\n protected abstract renderControl(): TemplateResult;\n protected renderAfterContent(): TemplateResult {\n return html``;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.hasLeadingIcon = !!this.assignedLeadingIcons.length;\n\n this.#attach();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.labelSizeObserver!.disconnect();\n this.labelSizeObserver = null;\n }\n\n async #attach(): Promise<void> {\n await this.updateComplete;\n this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties())\n this.labelSizeObserver.observe(this._labelElement);\n this.setLabelWidthProperties();\n }\n\n private handleLeadingIconSlotChange() {\n this._labelElement.style.transition = 'none';\n this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;\n\n setTimeout(() => {\n this._labelElement.style.transition = '';\n });\n }\n\n private handleTrailingIconSlotChange() {\n this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;\n }\n\n private handleErrorTextSlotChange() {\n this.hasErrorText = this.assignedErrorTexts.length > 0;\n }\n\n private setLabelWidthProperties() {\n\n const width = this._labelElement.offsetWidth;\n\n this.style.setProperty('--u-field-label-width', `${width}px`);\n this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);\n\n if (!width) {\n this._container.classList.add('no-label');\n return;\n }\n\n this._container.classList.remove('no-label');\n }\n\n protected renderDefaultTrailingIcon(): TemplateResult | typeof nothing {\n return nothing;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/navigation/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAM3D,qBACa,QAAS,SAAQ,UAAU;IACtC,OAAgB,MAAM,4BAGpB;cAEiB,MAAM,IAAI,kBAAkB;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/navigation/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAM3D,qBACa,QAAS,SAAQ,UAAU;IACtC,OAAgB,MAAM,4BAGpB;cAEiB,MAAM,IAAI,kBAAkB;CAOhD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,QAAQ,CAAC;KACtB;CACF"}
|
package/navigation/drawer.js
CHANGED
package/navigation/drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/navigation/drawer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;aACtB,WAAM,GAAG;QACvB,UAAU;QACV,MAAM;KACP,AAHqB,CAGpB;IAEiB,MAAM;QACvB,OAAO,IAAI,CAAA,
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/navigation/drawer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;aACtB,WAAM,GAAG;QACvB,UAAU;QACV,MAAM;KACP,AAHqB,CAGpB;IAEiB,MAAM;QACvB,OAAO,IAAI,CAAA;;;;KAIV,CAAA;IACH,CAAC;;AAZU,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CAapB","sourcesContent":["import { html, HTMLTemplateResult, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './drawer.styles.js';\n\n@customElement('u-drawer')\nexport class UmDrawer extends LitElement {\n static override styles = [\n baseStyles,\n styles\n ];\n\n protected override render(): HTMLTemplateResult {\n return html`\n <div class=\"container\">\n <slot></slot>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-drawer': UmDrawer;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.styles.d.ts","sourceRoot":"","sources":["../../src/navigation/drawer.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"drawer.styles.d.ts","sourceRoot":"","sources":["../../src/navigation/drawer.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAmBlB,CAAC"}
|
|
@@ -2,14 +2,19 @@ import { css } from 'lit';
|
|
|
2
2
|
export const styles = css `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
|
+
height: 100vh;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.container {
|
|
5
9
|
background-color: var(--u-modal-drawer-bg-color, var(--u-color-surface-container-low, rgb(247, 242, 250)));
|
|
6
10
|
color: var(--u-drawer-text-color, var(--u-color-on-secondary-container, rgb(29, 25, 43)));
|
|
7
11
|
height: 100%;
|
|
12
|
+
overflow: auto;
|
|
8
13
|
padding-inline: var(--u-drawer-padding, 28px);
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
@media (min-width: 1200px) {
|
|
12
|
-
|
|
17
|
+
.container {
|
|
13
18
|
background-color: var(--u-standard-drawer-bg-color, var(--u-color-body, var(--u-color-surface, rgb(254, 247, 255))));
|
|
14
19
|
}
|
|
15
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.styles.js","sourceRoot":"","sources":["../../src/navigation/drawer.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"drawer.styles.js","sourceRoot":"","sources":["../../src/navigation/drawer.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;CAmBzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n display: block;\n height: 100vh;\n }\n\n .container {\n background-color: var(--u-modal-drawer-bg-color, var(--u-color-surface-container-low, rgb(247, 242, 250)));\n color: var(--u-drawer-text-color, var(--u-color-on-secondary-container, rgb(29, 25, 43)));\n height: 100%;\n overflow: auto;\n padding-inline: var(--u-drawer-padding, 28px);\n }\n\n @media (min-width: 1200px) {\n .container {\n background-color: var(--u-standard-drawer-bg-color, var(--u-color-body, var(--u-color-surface, rgb(254, 247, 255))));\n }\n }\n`;\n"]}
|
package/package.json
CHANGED
package/select/option.js
CHANGED
|
@@ -35,7 +35,7 @@ let UmOption = class UmOption extends UmMenuItem {
|
|
|
35
35
|
if (!this._select) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
this._select.
|
|
38
|
+
this._select._button.setAttribute('aria-labelledby', this._listItem.id);
|
|
39
39
|
this._select.empty = !this._nativeOption.textContent?.trim();
|
|
40
40
|
}
|
|
41
41
|
renderDefaultTrailingIcon() {
|
|
@@ -115,7 +115,7 @@ let UmOption = class UmOption extends UmMenuItem {
|
|
|
115
115
|
this._select.value = this._select.value;
|
|
116
116
|
this._select.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true }));
|
|
117
117
|
this._select.dispatchEvent(new Event('change', { bubbles: true }));
|
|
118
|
-
this._select.
|
|
118
|
+
this._select._menu?.close();
|
|
119
119
|
}
|
|
120
120
|
#updateContent() {
|
|
121
121
|
this._nativeOption.textContent = this.textContent;
|
package/select/option.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../src/select/option.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD,OAAO,aAAa,CAAC;AAGd,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;aAEtB,WAAM,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,AAA9B,CAA+B;IAwB5C,iBAAiB,CAAmB;IAG7C,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IAClC,CAAC;IACD,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;IACnC,CAAC;IAGD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;IACrC,CAAC;IACD,IAAI,QAAQ,CAAC,QAAiB;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEvC,IAAI,QAAQ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,CAAC,cAAc,CAAC;QAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACjC,CAAC;;AAlID;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;qCAGzB;AAMD;IADC,KAAK,EAAE;wCAGP;AA+BD;IAFC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;IACjD,aAAa;kDAGZ;AAxEU,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CAgKpB","sourcesContent":["import { svg, TemplateResult } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { styles } from './option.styles.js';\n\nimport { UmMenuItem } from '../menu/menu-item.js';\nimport { ExtendedOption } from './extended-option.js';\nimport { UmSelect } from './select.js';\n\nimport './select.js';\n\n@customElement('u-option')\nexport class UmOption extends UmMenuItem {\n\n static override styles = [UmMenuItem.styles, styles];\n\n _nativeOption: ExtendedOption = (() => {\n const option = <ExtendedOption>document.createElement('option');\n option._parent = this;\n\n if (this.hasAttribute('selected')) {\n option.setAttribute('selected', '');\n }\n\n option.textContent = this.textContent;\n\n return option;\n })();\n\n _listItem = (() => {\n const listItem = document.createElement('div');\n listItem.role = 'option';\n\n listItem.textContent = this.textContent;\n\n return listItem;\n })();\n\n readonly #mutationObserver: MutationObserver;\n\n @property({reflect: true})\n get value(): string {\n return this._nativeOption.value;\n }\n set value(value: string) {\n this._nativeOption.value = value;\n }\n\n @state()\n get selected(): boolean {\n return this._nativeOption.selected;\n }\n set selected(selected: boolean) {\n if (this.selected === selected) {\n return;\n }\n\n this._nativeOption.selected = selected;\n\n if (selected) {\n this.classList.add('selected');\n } else {\n this.classList.remove('selected');\n }\n\n if (!this._select) {\n return;\n }\n\n this._select._button.setAttribute('aria-labelledby', this._listItem.id);\n this._select.empty = !this._nativeOption.textContent?.trim();\n }\n\n protected override renderDefaultTrailingIcon(): TemplateResult {\n return svg`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" viewBox=\"0 -960 960 960\" width=\"1em\" fill=\"currentColor\">\n <path d=\"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z\"/>\n </svg>`;\n }\n\n @property({type: Boolean, attribute: 'selected'})\n // @ts-ignore\n private get _selectedAttribute(): boolean {\n return this._nativeOption.hasAttribute('selected');\n }\n // @ts-ignore\n private set _selectedAttribute(selected: boolean) {\n if (selected) {\n this._nativeOption.setAttribute('selected', '');\n return;\n }\n\n this._nativeOption.removeAttribute('selected');\n }\n\n _select!: UmSelect | null;\n\n constructor() {\n super();\n this.#mutationObserver = new MutationObserver(() => this.#updateContent())\n this.#mutationObserver.observe(this, {characterData: true, childList: true, subtree: true});\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.#handleClick);\n this.setAttribute('tabindex', '-1');\n\n this.#attach();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.#handleClick);\n\n this._nativeOption.remove();\n\n if (!this._select) {\n return;\n }\n\n // eslint-disable-next-line no-self-assign\n this._select.value = this._select.value;\n this._select = null;\n }\n\n async #attach(): Promise<void> {\n\n this._select = this.parentElement!.constructor.name === 'UmSelect'\n ? this.parentElement as UmSelect\n : null;\n\n await this.#setNativeOption();\n }\n\n #handleClick(e: Event) {\n if (!this._select) {\n return;\n }\n\n e.stopPropagation();\n\n this.setSelectedByUser();\n }\n\n setSelectedByUser() {\n if (!this._select) {\n return;\n }\n\n this._select.selectedOptions[0]?.classList.remove('selected');\n this.selected = true;\n // eslint-disable-next-line no-self-assign\n this._select.value = this._select.value;\n this._select.dispatchEvent(new InputEvent('input', {bubbles: true, composed: true}));\n this._select.dispatchEvent(new Event('change', {bubbles: true}));\n\n this._select._menu?.close();\n }\n\n #updateContent() {\n this._nativeOption.textContent = this.textContent;\n this._listItem.textContent = this.textContent;\n }\n\n async #setNativeOption(): Promise<void> {\n\n await this.updateComplete;\n this.#updateContent();\n\n this._select?._updateOptions();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-option': UmOption;\n }\n}\n"]}
|
|
@@ -9,7 +9,7 @@ const getCleanTypeaheadStatus = () => ({
|
|
|
9
9
|
export class SelectNavigationController extends MenuFieldNavigationController {
|
|
10
10
|
#typeaheadStatus = getCleanTypeaheadStatus();
|
|
11
11
|
handleKeyDown(event) {
|
|
12
|
-
if (this.host.
|
|
12
|
+
if (this.host._menu.open) {
|
|
13
13
|
const handled = super.handleKeyDown(event);
|
|
14
14
|
return handled || this.handleType(event);
|
|
15
15
|
}
|
|
@@ -19,7 +19,7 @@ export class SelectNavigationController extends MenuFieldNavigationController {
|
|
|
19
19
|
return this.handleType(event);
|
|
20
20
|
}
|
|
21
21
|
event.preventDefault();
|
|
22
|
-
this.host.
|
|
22
|
+
this.host._menu.show();
|
|
23
23
|
if (!this.host.selectedOptions.length) {
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
@@ -29,21 +29,21 @@ export class SelectNavigationController extends MenuFieldNavigationController {
|
|
|
29
29
|
}
|
|
30
30
|
attach(element) {
|
|
31
31
|
super.attach(element);
|
|
32
|
-
this.host.
|
|
32
|
+
this.host._menu.addEventListener('menu-item-mouseenter', this.#handleMouseFocus);
|
|
33
33
|
}
|
|
34
34
|
detach() {
|
|
35
35
|
super.detach();
|
|
36
|
-
this.host.
|
|
36
|
+
this.host._menu.removeEventListener('menu-item-mouseenter', this.#handleMouseFocus);
|
|
37
37
|
}
|
|
38
38
|
#handleMouseFocus = (e) => {
|
|
39
39
|
this.blurMenu();
|
|
40
40
|
this.focusMenu(e.target, false, false);
|
|
41
41
|
};
|
|
42
42
|
afterFocus(option) {
|
|
43
|
-
this.host.
|
|
43
|
+
this.host._button.setAttribute('aria-activedescendant', option._listItem.id);
|
|
44
44
|
}
|
|
45
45
|
afterBlur() {
|
|
46
|
-
this.host.
|
|
46
|
+
this.host._button.removeAttribute('aria-activedescendant');
|
|
47
47
|
}
|
|
48
48
|
handleType(event) {
|
|
49
49
|
if (event.key.length > 1) {
|
|
@@ -64,12 +64,12 @@ export class SelectNavigationController extends MenuFieldNavigationController {
|
|
|
64
64
|
findNextElementByTerm(term, lastFocusedMenu) {
|
|
65
65
|
let nextMenu = lastFocusedMenu?.nextElementSibling;
|
|
66
66
|
if (!nextMenu || !normalizedStartsWith(nextMenu.textContent, term)) {
|
|
67
|
-
nextMenu = this.host.
|
|
67
|
+
nextMenu = this.host._options.find(o => normalizedStartsWith(o.textContent, term));
|
|
68
68
|
}
|
|
69
69
|
if (!nextMenu) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
if (this.host.
|
|
72
|
+
if (this.host._menu.open) {
|
|
73
73
|
this.blurMenu();
|
|
74
74
|
this.focusMenu(nextMenu);
|
|
75
75
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-navigation-controller.js","sourceRoot":"","sources":["../../src/select/select-navigation-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0DAA0D,CAAC;AAIzG,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,CAAC;IACrC,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,CAAC;CACb,CAAC,CAAC;AAEH,MAAM,OAAO,0BAA2B,SAAQ,6BAAiD;IAE/F,gBAAgB,GAAG,uBAAuB,EAAE,CAAC;IAE1B,aAAa,CAAC,KAAoB;QACnD,IAAI,IAAI,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"select-navigation-controller.js","sourceRoot":"","sources":["../../src/select/select-navigation-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,6BAA6B,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I,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,EAAE;YACxE,CAAC,CAAC,KAAK,CAAC,GAAG;YACX,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAElD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,qBAAqB,CAAC,IAAY,EAAE,eAAgC;QAC1E,IAAI,QAAQ,GAAyB,eAAe,EAAE,kBAAkB,CAAA;QAExE,IAAI,CAAC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;YACnE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QACrF,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACzB,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,iBAAiB,EAAE,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { normalizedStartsWith } from '../shared/compare-text.js';\nimport { MenuFieldNavigationController } from '../shared/menu-field/menu-field-navigation-controller.js';\nimport { UmOption } from './option.js';\nimport { UmSelect } from './select.js';\n\nconst getCleanTypeaheadStatus = () => ({\n typing: false,\n repeating: false,\n buffer: '',\n timeoutId: 0\n});\n\nexport class SelectNavigationController extends MenuFieldNavigationController<UmSelect, UmOption> {\n\n #typeaheadStatus = getCleanTypeaheadStatus();\n\n protected override handleKeyDown(event: KeyboardEvent): boolean {\n if (this.host._menu.open) {\n const handled = super.handleKeyDown(event);\n\n return handled || this.handleType(event);\n }\n\n const isDown = event.key === 'ArrowDown';\n const isUp = event.key === 'ArrowUp';\n\n if (!isDown && !isUp) {\n return this.handleType(event);\n }\n\n event.preventDefault();\n this.host._menu.show();\n\n if (!this.host.selectedOptions.length) {\n return true;\n }\n\n const option = this.host.selectedOptions[0];\n this.navigateTo(event, option);\n return true;\n }\n\n override attach(element: HTMLElement) {\n super.attach(element);\n this.host._menu.addEventListener('menu-item-mouseenter', this.#handleMouseFocus);\n }\n\n override detach() {\n super.detach();\n this.host._menu.removeEventListener('menu-item-mouseenter', this.#handleMouseFocus);\n }\n\n #handleMouseFocus = (e: Event) => {\n this.blurMenu();\n this.focusMenu(<UmOption>e.target, false, false);\n };\n\n protected override afterFocus(option: UmOption) {\n this.host._button.setAttribute('aria-activedescendant', option._listItem.id);\n }\n\n protected override afterBlur() {\n this.host._button.removeAttribute('aria-activedescendant');\n }\n\n private handleType(event: KeyboardEvent) {\n\n if (event.key.length > 1) {\n return false;\n }\n\n if (this.#typeaheadStatus.timeoutId) {\n clearTimeout(this.#typeaheadStatus.timeoutId);\n }\n\n const lastFocusedMenu = this.focusedMenu;\n\n this.#typeaheadStatus.buffer += event.key;\n\n this.#typeaheadStatus.timeoutId = setTimeout(() => this.#typeaheadStatus = getCleanTypeaheadStatus(), 1000);\n\n const term = this.#typeaheadStatus.buffer.replaceAll(event.key, '') === ''\n ? event.key\n : this.#typeaheadStatus.buffer;\n this.findNextElementByTerm(term, lastFocusedMenu);\n\n return true;\n }\n\n private findNextElementByTerm(term: string, lastFocusedMenu: UmOption | null): void {\n let nextMenu = <UmOption | undefined>lastFocusedMenu?.nextElementSibling\n\n if (!nextMenu || !normalizedStartsWith(nextMenu.textContent, term)) {\n nextMenu = this.host._options.find(o => normalizedStartsWith(o.textContent, term));\n }\n\n if (!nextMenu) {\n return;\n }\n\n if (this.host._menu.open) {\n this.blurMenu();\n this.focusMenu(nextMenu);\n return;\n }\n\n nextMenu.setSelectedByUser();\n }\n}\n"]}
|
package/select/select.d.ts
CHANGED
|
@@ -8,18 +8,26 @@ import { UmOption } from './option.js';
|
|
|
8
8
|
import './option.js';
|
|
9
9
|
export declare class UmSelect extends UmTextFieldBase implements UmMenuField {
|
|
10
10
|
#private;
|
|
11
|
-
currentOptionIndex: number;
|
|
12
11
|
static styles: import("lit").CSSResultGroup[];
|
|
13
|
-
|
|
12
|
+
_nativeSelect: ExtendedSelect;
|
|
13
|
+
/**
|
|
14
|
+
* The `value` of the selected option
|
|
15
|
+
*/
|
|
14
16
|
get value(): string;
|
|
15
17
|
set value(value: string);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
_menu: UmMenu;
|
|
19
|
+
_button: HTMLButtonElement;
|
|
20
|
+
_input: HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
* The index of the selected option. When there's no selected option the value is `-1`.
|
|
23
|
+
*/
|
|
19
24
|
get selectedIndex(): number;
|
|
20
25
|
set selectedIndex(index: number);
|
|
26
|
+
/**
|
|
27
|
+
* An `Array` containing the selected `UmOption` or empty if there's no selected option. Multiple selection is not supported.
|
|
28
|
+
*/
|
|
21
29
|
get selectedOptions(): UmOption[];
|
|
22
|
-
get
|
|
30
|
+
get _options(): UmOption[];
|
|
23
31
|
constructor();
|
|
24
32
|
_updateOptions(): void;
|
|
25
33
|
protected renderControl(): TemplateResult;
|
|
@@ -29,7 +37,7 @@ export declare class UmSelect extends UmTextFieldBase implements UmMenuField {
|
|
|
29
37
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
30
38
|
connectedCallback(): void;
|
|
31
39
|
disconnectedCallback(): void;
|
|
32
|
-
get
|
|
40
|
+
get _menuItems(): UmOption[];
|
|
33
41
|
}
|
|
34
42
|
declare global {
|
|
35
43
|
interface HTMLElementTagNameMap {
|
package/select/select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAMhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,aAAa,CAAC;AAErB,qBACa,QAAS,SAAQ,eAAgB,YAAW,WAAW;;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAMhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,aAAa,CAAC;AAErB,qBACa,QAAS,SAAQ,eAAgB,YAAW,WAAW;;IAElE,OAAgB,MAAM,iCAAoC;IAE1D,aAAa,EAAE,cAAc,CAMxB;IAeL;;OAEG;IACH,IACI,KAAK,IAAI,MAAM,CAElB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAQtB;IAEgB,KAAK,EAAG,MAAM,CAAC;IACd,OAAO,EAAG,iBAAiB,CAAC;IAC7B,MAAM,EAAG,WAAW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