@universal-material/web 3.0.119 → 3.0.121

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.
@@ -3,7 +3,6 @@ import { CSSResultGroup } from '@lit/reactive-element/css-tag';
3
3
  import { LitElement, nothing, TemplateResult } from 'lit';
4
4
  import { UmFieldDefaults } from './field-defaults.js';
5
5
  export declare abstract class UmFieldBase extends LitElement {
6
- #private;
7
6
  static styles: CSSResultGroup;
8
7
  private config;
9
8
  variant: 'filled' | 'outlined' | undefined;
@@ -56,17 +55,14 @@ export declare abstract class UmFieldBase extends LitElement {
56
55
  private readonly assignedErrorTexts;
57
56
  private _labelElement;
58
57
  protected _container: HTMLElement;
59
- private labelSizeObserver;
60
58
  constructor();
61
59
  protected render(): TemplateResult;
62
60
  protected abstract renderControl(): TemplateResult;
63
61
  protected renderAfterContent(): TemplateResult;
64
62
  connectedCallback(): void;
65
- disconnectedCallback(): void;
66
63
  private handleLeadingIconSlotChange;
67
64
  private handleTrailingIconSlotChange;
68
65
  private handleErrorTextSlotChange;
69
- private setLabelWidthProperties;
70
66
  protected renderDefaultTrailingIcon(): TemplateResult | typeof nothing;
71
67
  }
72
68
  //# sourceMappingURL=field-base.d.ts.map
@@ -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,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAahE,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,GAA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,SAAS,CAAC,UAAU,EAAG,WAAW,CAAC;;cAO3C,MAAM,IAAI,cAAc;IA+C3C,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,cAAc;IAClD,SAAS,CAAC,kBAAkB,IAAI,cAAc;IAIrC,iBAAiB;IAK1B,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,yBAAyB;IAIjC,SAAS,CAAC,yBAAyB,IAAI,cAAc,GAAG,OAAO,OAAO;CAGvE"}
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { consume, ContextProvider } from '@lit/context';
8
8
  import { html, LitElement, nothing } from 'lit';
9
- import { property, query, queryAssignedElements, state, } from 'lit/decorators.js';
9
+ import { property, query, queryAssignedElements, state } from 'lit/decorators.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
11
  import { styles as baseStyles } from '../shared/base.styles.js';
12
12
  import { styles } from './field-base.styles.js';
@@ -50,40 +50,40 @@ export class UmFieldBase extends LitElement {
50
50
  * _Note:_ Readonly
51
51
  */
52
52
  this.hasErrorText = false;
53
- this.labelSizeObserver = null;
54
53
  this.variant = undefined;
55
54
  }
56
55
  render() {
56
+ const variant = this.variant ?? this.config?.variant ?? 'filled';
57
57
  const classes = {
58
- [this.variant ?? this.config?.variant ?? 'filled']: true,
58
+ [variant]: true,
59
+ 'no-label': !this.label,
59
60
  };
60
61
  const counter = html `
61
62
  <slot class="counter" name="counter">
62
63
  <div>${this.counter ?? this._innerCounter}</div>
63
64
  </slot>
65
+ `;
66
+ const outline = html `
67
+ <div class="outline">
68
+ <div class="outline-start"></div>
69
+ <div class="outline-notch">
70
+ <div class="outline-notch-label">${this.label}</div>
71
+ </div>
72
+ <div class="outline-end"></div>
73
+ </div>
64
74
  `;
65
75
  return html `
66
76
  <div class="container ${classMap(classes)}">
67
- <slot
68
- class="icon leading-icon"
69
- name="leading-icon"
70
- @slotchange="${this.handleLeadingIconSlotChange}"></slot>
71
- <label class="label" slot="label" id="label">
72
- <slot name="label">${this.label}</slot>
73
- </label>
77
+ ${variant === 'outlined' ? outline : nothing}
78
+ <slot class="icon leading-icon" name="leading-icon" @slotchange="${this.handleLeadingIconSlotChange}"></slot>
79
+ <label class="label" id="label">${this.label}</label>
74
80
  <div class="input-wrapper" part="wrapper">${this.renderControl()}</div>
75
- <slot
76
- class="icon trailing-icon"
77
- name="trailing-icon"
78
- @slotchange="${this.handleTrailingIconSlotChange}">
81
+ <slot class="icon trailing-icon" name="trailing-icon" @slotchange="${this.handleTrailingIconSlotChange}">
79
82
  <span>${this.renderDefaultTrailingIcon()}</span>
80
83
  </slot>
81
84
  </div>
82
85
  <div class="supporting-text" id="supporting-text">
83
- <slot
84
- class="error-text"
85
- name="error-text"
86
- @slotchange="${this.handleErrorTextSlotChange}">
86
+ <slot class="error-text" name="error-text" @slotchange="${this.handleErrorTextSlotChange}">
87
87
  <div>${this.errorText}</div>
88
88
  </slot>
89
89
  <slot name="supporting-text" id="supporting-text">
@@ -100,18 +100,6 @@ export class UmFieldBase extends LitElement {
100
100
  connectedCallback() {
101
101
  super.connectedCallback();
102
102
  this.hasLeadingIcon = !!this.assignedLeadingIcons.length;
103
- this.#attach();
104
- }
105
- disconnectedCallback() {
106
- super.disconnectedCallback();
107
- this.labelSizeObserver?.disconnect();
108
- this.labelSizeObserver = null;
109
- }
110
- async #attach() {
111
- await this.updateComplete;
112
- this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties());
113
- this.labelSizeObserver.observe(this._labelElement);
114
- this.setLabelWidthProperties();
115
103
  }
116
104
  handleLeadingIconSlotChange() {
117
105
  this._labelElement.style.transition = 'none';
@@ -126,16 +114,6 @@ export class UmFieldBase extends LitElement {
126
114
  handleErrorTextSlotChange() {
127
115
  this.hasErrorText = this.assignedErrorTexts.length > 0;
128
116
  }
129
- setLabelWidthProperties() {
130
- const width = this._labelElement.offsetWidth;
131
- this.style.setProperty('--u-field-label-width', `${width}px`);
132
- this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);
133
- if (!width) {
134
- this._container.classList.add('no-label');
135
- return;
136
- }
137
- this._container.classList.remove('no-label');
138
- }
139
117
  renderDefaultTrailingIcon() {
140
118
  return nothing;
141
119
  }
@@ -193,9 +171,9 @@ __decorate([
193
171
  queryAssignedElements({ slot: 'error-text', flatten: true })
194
172
  ], UmFieldBase.prototype, "assignedErrorTexts", void 0);
195
173
  __decorate([
196
- query('.label')
174
+ query('.label', true)
197
175
  ], UmFieldBase.prototype, "_labelElement", void 0);
198
176
  __decorate([
199
- query('.container')
177
+ query('.container', true)
200
178
  ], UmFieldBase.prototype, "_container", void 0);
201
179
  //# sourceMappingURL=field-base.js.map
@@ -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,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,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;IA0C9D,MAAM,CAAC,WAAW,CAChB,WAAwB,EACxB,MAAuB;QAEvB,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE;YACtC,OAAO,EAAE,oBAAoB;YAC7B,YAAY,EAAE,MAA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,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACnD;AAQvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACnD;AAQxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACnD;AAGJ;IADhB,qBAAqB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDACT;AAGrC;IADhB,qBAAqB,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0DACT;AAGtC;IADhB,qBAAqB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDACT;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, LitElement, nothing, TemplateResult } from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.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\n @state() protected _innerCounter: string | undefined;\n @property() counter: string | undefined;\n\n @property({ type: Boolean, attribute: 'hide-counter' }) hideCounter = false;\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:\n | string\n | 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(\n contextRoot: HTMLElement,\n config: UmFieldDefaults,\n ): 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 })\n 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 })\n 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 })\n 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 const classes = {\n [this.variant ?? this.config?.variant ?? 'filled']: true,\n };\n\n const counter = html`\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter ?? this._innerCounter}</div>\n </slot>\n `;\n\n return html`\n <div class=\"container ${classMap(classes)}\">\n <slot\n class=\"icon leading-icon\"\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\"></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\">${this.renderControl()}</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 ${this.hideCounter ? nothing : counter}\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(() =>\n this.setLabelWidthProperties(),\n );\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 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,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,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;IAyC9D,MAAM,CAAC,WAAW,CAChB,WAAwB,EACxB,MAAuB;QAEvB,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE;YACtC,OAAO,EAAE,oBAAoB;YAC7B,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IAsCD;QACE,KAAK,EAAE,CAAC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AAC;mDAAoC;AAMxC;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAA+B;AAKzB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AACd;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAkB;AAKjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAiB;AAkB5D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACnD;AAQvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACnD;AAQxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACnD;AAGJ;IADhB,qBAAqB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDACT;AAGrC;IADhB,qBAAqB,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0DACT;AAGtC;IADhB,qBAAqB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDACT;AAErB;IAA9B,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;kDAAqC;AACtB;IAApC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC;+CAAoC","sourcesContent":["import { consume, Context, ContextProvider } from '@lit/context';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\nimport { html, LitElement, nothing, TemplateResult } from 'lit';\nimport { property, query, queryAssignedElements, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.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()\n label: string | undefined;\n\n @state() protected _innerCounter: string | undefined;\n @property() counter: string | undefined;\n\n @property({ type: Boolean, attribute: 'hide-counter' }) hideCounter = false;\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(\n contextRoot: HTMLElement,\n config: UmFieldDefaults,\n ): 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 })\n 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 })\n 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 })\n 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', true) private _labelElement!: HTMLElement;\n @query('.container', true) protected _container!: HTMLElement;\n\n constructor() {\n super();\n this.variant = undefined;\n }\n\n protected override render(): TemplateResult {\n const variant = this.variant ?? this.config?.variant ?? 'filled';\n\n const classes = {\n [variant]: true,\n 'no-label': !this.label,\n };\n\n const counter = html`\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter ?? this._innerCounter}</div>\n </slot>\n `;\n\n const outline = html`\n <div class=\"outline\">\n <div class=\"outline-start\"></div>\n <div class=\"outline-notch\">\n <div class=\"outline-notch-label\">${this.label}</div>\n </div>\n <div class=\"outline-end\"></div>\n </div>\n `;\n\n return html`\n <div class=\"container ${classMap(classes)}\">\n ${variant === 'outlined' ? outline : nothing}\n <slot class=\"icon leading-icon\" name=\"leading-icon\" @slotchange=\"${this.handleLeadingIconSlotChange}\"></slot>\n <label class=\"label\" id=\"label\">${this.label}</label>\n <div class=\"input-wrapper\" part=\"wrapper\">${this.renderControl()}</div>\n <slot class=\"icon trailing-icon\" name=\"trailing-icon\" @slotchange=\"${this.handleTrailingIconSlotChange}\">\n <span>${this.renderDefaultTrailingIcon()}</span>\n </slot>\n </div>\n <div class=\"supporting-text\" id=\"supporting-text\">\n <slot class=\"error-text\" name=\"error-text\" @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 ${this.hideCounter ? nothing : counter}\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\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 protected renderDefaultTrailingIcon(): TemplateResult | typeof nothing {\n return nothing;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"field-base.styles.d.ts","sourceRoot":"","sources":["../../src/field/field-base.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA6TlB,CAAC"}
1
+ {"version":3,"file":"field-base.styles.d.ts","sourceRoot":"","sources":["../../src/field/field-base.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgXlB,CAAC"}
@@ -18,7 +18,8 @@ export const styles = css `
18
18
  --_icon-size: var(--u-field-icon-size, 1.5rem);
19
19
  --_icon-padding: var(--u-field-icon-padding, 12px);
20
20
  --_icon-color: var(--u-icon-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
21
- --_focus-border-width: var(--u-text-field-focus-border-width, 2px);
21
+ --_border-width: var(--u-field-border-width, 1px);
22
+ --_border-color: var(--u-field-border-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
22
23
  --_field-control-leading-padding: var(--_field-control-inline-padding);
23
24
  --_outlined-label-margin: var(--u-outlined-field-label-margin, 12px);
24
25
  --_outlined-label-padding: var(--u-outlined-field-label-padding, 4px);
@@ -50,16 +51,16 @@ export const styles = css `
50
51
  opacity: 0;
51
52
  }
52
53
  .container::after {
53
- border-width: var(--u-field-border-width, 1px);
54
- border-color: var(--u-field-border-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
54
+ border-width: var(--_border-width);
55
+ border-color: var(--_border-color);
55
56
  }
56
57
 
57
58
  @media (hover: hover) {
58
59
  :host(:not([disabled]):not([invalid]):hover) .container.filled::before {
59
60
  opacity: var(--u-state-hover-opacity, 0.08);
60
61
  }
61
- :host(:not([disabled]):not([invalid]):not(:focus-within):hover) .container::after {
62
- border-color: var(--u-field-hover-border-color, var(--u-color-on-surface, rgb(29, 27, 32)));
62
+ :host(:not([disabled]):not([invalid]):not(:focus-within):hover) {
63
+ --_border-color: var(--u-field-hover-border-color, var(--u-color-on-surface, rgb(29, 27, 32)));
63
64
  }
64
65
  }
65
66
  .icon {
@@ -84,6 +85,7 @@ export const styles = css `
84
85
  margin-inline-end: var(--_icon-padding);
85
86
  }
86
87
 
88
+ .outline-notch-label,
87
89
  .label {
88
90
  font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"));
89
91
  line-height: var(--u-field-label-line-height, var(--u-body-l-line-height, 1.5rem));
@@ -91,6 +93,9 @@ export const styles = css `
91
93
  letter-spacing: var(--u-field-label-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));
92
94
  font-weight: var(--u-field-label-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));
93
95
  font-size: var(--u-field-label-font-size, var(--u-body-s-font-size, 0.75rem));
96
+ }
97
+
98
+ .label {
94
99
  display: block;
95
100
  position: absolute;
96
101
  inset-inline-start: var(--_field-control-leading-padding);
@@ -193,17 +198,15 @@ export const styles = css `
193
198
  }
194
199
 
195
200
  :host(:focus-within) {
196
- --u-field-border-width: var(--_focus-border-width);
197
- }
198
- :host(:focus-within) .container::after {
199
- border-color: var(--u-field-focused-border-color, var(--_color-primary));
201
+ --_border-width: var(--u-text-field-focus-border-width, 2px);
202
+ --_border-color: var(--u-field-focused-border-color, var(--_color-primary));
200
203
  }
201
204
  :host(:focus-within) .label {
202
205
  color: var(--u-field-label-focused-color, var(--_color-primary));
203
206
  }
204
207
 
205
- :host([invalid]) .container::after {
206
- border-color: var(--u-field-error-border-color, var(--_color-error));
208
+ :host([invalid]) {
209
+ --_border-color: var(--u-field-error-border-color, var(--_color-error));
207
210
  }
208
211
  :host([invalid]) .label {
209
212
  color: var(--u-field-label-error-color, var(--_color-error));
@@ -244,22 +247,10 @@ export const styles = css `
244
247
  .container.filled .input ::slotted(:is(input, textarea, select, button)) {
245
248
  display: block;
246
249
  }
247
- .container.outlined::after {
248
- --_mid-point: calc(var(--u-field-label-half-width) + var(--_outlined-label-margin) + var(--_outlined-label-padding));
249
- border-radius: var(--u-outlined-field-shape-corder, var(--u-shape-corner-small, 8px));
250
- border-style: solid;
251
- clip-path: polygon(0 0, var(--_mid-point) 0, var(--_mid-point) var(--_focus-border-width), var(--_mid-point) var(--_focus-border-width), var(--_mid-point) 0, 100% 0, 100% 100%, 0 100%);
252
- transition: clip-path 100ms;
253
- }
254
250
  .container.outlined .label {
255
251
  top: calc(var(--_label-line-height) / -2);
256
252
  }
257
253
 
258
- .container.outlined:focus-within::after,
259
- :host(:not([empty])) .container.outlined::after {
260
- --_end-point: calc(var(--u-field-label-width) + var(--_outlined-label-margin) + (var(--_outlined-label-padding) * 2));
261
- clip-path: polygon(0 0, var(--_outlined-label-margin) 0, var(--_outlined-label-margin) var(--_focus-border-width), var(--_end-point) var(--_focus-border-width), var(--_end-point) 0, 100% 0, 100% 100%, 0 100%);
262
- }
263
254
  .container.outlined:focus-within .label,
264
255
  :host(:not([empty])) .container.outlined .label {
265
256
  inset-inline-start: calc(var(--_outlined-label-margin) + var(--_outlined-label-padding));
@@ -284,16 +275,12 @@ export const styles = css `
284
275
  transition: color 150ms;
285
276
  }
286
277
 
287
- .container.no-label::after {
288
- clip-path: none !important;
278
+ :host([disabled]) {
279
+ --_border-color: var(--u-field-disabled-border-color, var(--_disabled-color));
289
280
  }
290
-
291
281
  :host([disabled]) .container .filled {
292
282
  background-color: var(--u-filled-field-disabled-bg-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-filled-field-background-disabled-opacity, 0.04)));
293
283
  }
294
- :host([disabled]) .container::after {
295
- border-color: var(--u-field-disabled-border-color, var(--_disabled-color));
296
- }
297
284
  :host([disabled]) .supporting-text {
298
285
  color: var(--u-field-supporting-text-disabled-color, var(--_disabled-color));
299
286
  }
@@ -316,5 +303,69 @@ export const styles = css `
316
303
  :host([disabled]) .leading-icon {
317
304
  color: var(--u-field-leading-icon-disabled-color, var(--_disabled-color));
318
305
  }
306
+
307
+ .outline {
308
+ position: absolute;
309
+ inset: 0;
310
+ display: flex;
311
+ border-radius: var(--u-outlined-field-shape-corder, var(--u-shape-corner-small, 8px));
312
+ pointer-events: none;
313
+ }
314
+
315
+ .outline-start,
316
+ .outline-end {
317
+ border: var(--_border-width) solid var(--_border-color);
318
+ border-radius: inherit;
319
+ flex-basis: var(--_outlined-label-margin);
320
+ }
321
+
322
+ .outline-start {
323
+ border-start-end-radius: 0;
324
+ border-end-end-radius: 0;
325
+ border-inline-end: none;
326
+ }
327
+
328
+ .outline-end {
329
+ flex: 1;
330
+ border-start-start-radius: 0;
331
+ border-end-start-radius: 0;
332
+ border-inline-start: none;
333
+ }
334
+
335
+ .outline-notch {
336
+ min-width: 0;
337
+ border-bottom: var(--_border-width) solid var(--_border-color);
338
+ }
339
+
340
+ .outline-notch-label {
341
+ position: relative;
342
+ color: transparent;
343
+ padding-inline: var(--_outlined-label-padding);
344
+ user-select: none;
345
+ }
346
+
347
+ .outline-notch-label::before,
348
+ .outline-notch-label::after {
349
+ content: "";
350
+ position: absolute;
351
+ border-top: var(--_border-width) solid var(--_border-color);
352
+ width: 50%;
353
+ transition: width 100ms;
354
+ }
355
+
356
+ .outline-notch-label::before {
357
+ left: 0;
358
+ }
359
+
360
+ .outline-notch-label::after {
361
+ right: 0;
362
+ }
363
+
364
+ .container:not(.no-label):focus-within .outline-notch-label::before,
365
+ .container:not(.no-label):focus-within .outline-notch-label::after,
366
+ :host(:not([empty])) .container:not(.no-label) .outline-notch-label::before,
367
+ :host(:not([empty])) .container:not(.no-label) .outline-notch-label::after {
368
+ width: 0;
369
+ }
319
370
  `;
320
371
  //# sourceMappingURL=field-base.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-base.styles.js","sourceRoot":"","sources":["../../src/field/field-base.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6TzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_control-line-height: var(--u-field-control-line-height, 1.5rem);\n --_label-line-height: var(--u-field-label-line-height, 1rem);\n --_field-icon-size: var(--u-field-icon-size, 1.5rem);\n --_field-control-padding: var(--u-field-control-padding, 16px);\n --_field-control-inline-padding: var(--u-field-control-inline-padding, var(--_field-control-padding));\n --_field-control-block-padding: var(--u-field-control-block-padding, var(--_field-control-padding));\n --_field-min-height: var(--u-field-min-height, 56px);\n --_field-placeholder-color: var(--u-field-placeholder-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_disabled-color: var(--u-field-disabled-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-field-disabled-opacity, .38)));\n --_disabled-bg-color: var(--u-filled-field-disabled-bg-color, rgba(var(--u-color-on-surface-rgb, ), var(--u-filled-field-background-disabled-opacity, .12)));\n --_color-primary: var(--u-color-primary, rgb(103, 80, 164));\n --_color-error: var(--u-field-error-color, var(--u-color-error, rgb(179, 38, 30)));\n --_active-indicator-opacity: 1;\n --_vertical-padding: var(--u-field-vertical-padding, 8px);\n --_icon-size: var(--u-field-icon-size, 1.5rem);\n --_icon-padding: var(--u-field-icon-padding, 12px);\n --_icon-color: var(--u-icon-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_focus-border-width: var(--u-text-field-focus-border-width, 2px);\n --_field-control-leading-padding: var(--_field-control-inline-padding);\n --_outlined-label-margin: var(--u-outlined-field-label-margin, 12px);\n --_outlined-label-padding: var(--u-outlined-field-label-padding, 4px);\n --u-label-input-start: auto;\n --u-label-input-span-leading-offset: 0;\n --u-label-input-span-trailing-offset: 0;\n --u-text-field-horizontal-padding: 12px;\n display: block;\n }\n\n .container {\n display: flex;\n align-items: center;\n position: relative;\n }\n .container::before, .container::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n pointer-events: none;\n }\n .container::before {\n background: var(--u-color-on-surface, rgb(29, 27, 32));\n transition: opacity 150ms;\n opacity: 0;\n }\n .container::after {\n border-width: var(--u-field-border-width, 1px);\n border-color: var(--u-field-border-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n }\n\n @media (hover: hover) {\n :host(:not([disabled]):not([invalid]):hover) .container.filled::before {\n opacity: var(--u-state-hover-opacity, 0.08);\n }\n :host(:not([disabled]):not([invalid]):not(:focus-within):hover) .container::after {\n border-color: var(--u-field-hover-border-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n }\n }\n .icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--_icon-size);\n color: var(--_icon-color);\n font-size: var(--_icon-size);\n line-height: var(--_icon-size);\n }\n .icon::slotted(*) {\n flex-shrink: 0;\n }\n\n .leading-icon {\n margin-inline-start: var(--_icon-padding);\n }\n\n .trailing-icon {\n margin-inline-end: var(--_icon-padding);\n }\n\n .label {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-label-line-height, var(--u-body-l-line-height, 1.5rem));\n font-size: var(--u-field-label-font-size, var(--u-body-l-font-size, 1rem));\n letter-spacing: var(--u-field-label-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));\n font-weight: var(--u-field-label-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));\n font-size: var(--u-field-label-font-size, var(--u-body-s-font-size, 0.75rem));\n display: block;\n position: absolute;\n inset-inline-start: var(--_field-control-leading-padding);\n margin-bottom: 0;\n line-height: var(--_label-line-height);\n color: var(--u-field-label-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n transition: inset 200ms, font-size 200ms;\n }\n\n .input-wrapper {\n display: flex;\n align-items: center;\n flex: 1;\n padding-block: var(--_vertical-padding);\n padding-inline: var(--_field-control-inline-padding);\n min-height: var(--_field-min-height);\n transition: opacity 150ms;\n }\n\n .input {\n color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n flex: 1;\n }\n .input:focus {\n outline: 0;\n }\n .input textarea,\n .input select,\n .input input,\n .input ::slotted(*) {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-control-line-height, var(--u-body-l-line-height, 1.5rem));\n font-size: var(--u-field-control-font-size, var(--u-body-l-font-size, 1rem));\n letter-spacing: var(--u-field-control-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));\n font-weight: var(--u-field-control-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));\n display: block;\n width: 100%;\n color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n min-height: var(--_control-line-height);\n line-height: var(--_control-line-height);\n padding: 0;\n margin: 0;\n appearance: none;\n background: transparent;\n border: none;\n outline: 0 !important;\n caret-color: var(--_color-primary);\n }\n .input,\n .input textarea::placeholder,\n .input input::placeholder,\n .input ::slotted(select),\n .input ::slotted(:is(input, textarea))::placeholder {\n transition: color 150ms 100ms;\n }\n .input textarea::placeholder,\n .input input::placeholder,\n .input ::slotted(:is(input, textarea))::placeholder {\n color: var(--_field-placeholder-color);\n }\n\n .supporting-text {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-supporting-text-line-height, var(--u-body-s-line-height, 1rem));\n font-size: var(--u-field-supporting-text-font-size, var(--u-body-s-font-size, 0.75rem));\n letter-spacing: var(--u-field-supporting-text-letter-spacing, var(--u-body-s-letter-spacing, 0.0333333333rem));\n font-weight: var(--u-field-supporting-text-font-weight, var(--u-body-s-font-weight, var(--u-font-weight-regular, 400)));\n display: flex;\n color: var(--u-field-supporting-text, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n padding-inline: 16px;\n gap: 16px;\n }\n .supporting-text div:empty {\n display: none;\n }\n .supporting-text div,\n .supporting-text ::slotted(*) {\n display: inline-block;\n margin-top: 4px;\n }\n\n .error-text {\n display: none;\n }\n\n .counter div, .counter::slotted(*) {\n margin-inline-start: auto;\n }\n\n :host([has-leading-icon]) {\n --_field-control-leading-padding: calc(var(--_icon-padding) + var(--_icon-size) + var(--_field-control-inline-padding)) ;\n }\n\n :host(:not([has-leading-icon])) .leading-icon {\n display: none;\n }\n\n :host(:not([has-trailing-icon])) .container:has(slot[name=trailing-icon] span:empty) .trailing-icon {\n display: none;\n }\n\n :host(:focus-within) {\n --u-field-border-width: var(--_focus-border-width);\n }\n :host(:focus-within) .container::after {\n border-color: var(--u-field-focused-border-color, var(--_color-primary));\n }\n :host(:focus-within) .label {\n color: var(--u-field-label-focused-color, var(--_color-primary));\n }\n\n :host([invalid]) .container::after {\n border-color: var(--u-field-error-border-color, var(--_color-error));\n }\n :host([invalid]) .label {\n color: var(--u-field-label-error-color, var(--_color-error));\n }\n :host([invalid]) .supporting-text {\n color: var(--u-field-supporting-text-error-color, var(--_color-error));\n }\n :host([invalid]) .trailing-icon {\n color: var(--u-field-trailing-icon-error-color, var(--_color-error));\n }\n :host([invalid]) .leading-icon {\n color: var(--u-field-leading-icon-error-color, var(--_icon-color));\n }\n\n :host([invalid]) .supporting-text:has(.error-text div:not(:empty)) .error-text,\n :host([invalid][has-error-text]) .error-text {\n display: contents;\n }\n :host([invalid]) .supporting-text:has(.error-text div:not(:empty)) slot[name=supporting-text],\n :host([invalid][has-error-text]) slot[name=supporting-text] {\n display: none;\n }\n\n .container.filled {\n border-radius: var(--u-field-filled-border-radius, 4px 4px 0 0);\n background-color: var(--u-color-surface-container-highest, rgb(230, 224, 233));\n }\n .container.filled::after {\n border-bottom-style: solid;\n }\n .container.filled:not(.no-label) .input-wrapper {\n padding-top: calc(var(--_vertical-padding) + var(--_label-line-height));\n padding-bottom: var(--_vertical-padding);\n }\n .container.filled .label {\n top: var(--_vertical-padding);\n }\n .container.filled .input ::slotted(:is(input, textarea, select, button)) {\n display: block;\n }\n .container.outlined::after {\n --_mid-point: calc(var(--u-field-label-half-width) + var(--_outlined-label-margin) + var(--_outlined-label-padding));\n border-radius: var(--u-outlined-field-shape-corder, var(--u-shape-corner-small, 8px));\n border-style: solid;\n clip-path: polygon(0 0, var(--_mid-point) 0, var(--_mid-point) var(--_focus-border-width), var(--_mid-point) var(--_focus-border-width), var(--_mid-point) 0, 100% 0, 100% 100%, 0 100%);\n transition: clip-path 100ms;\n }\n .container.outlined .label {\n top: calc(var(--_label-line-height) / -2);\n }\n\n .container.outlined:focus-within::after,\n :host(:not([empty])) .container.outlined::after {\n --_end-point: calc(var(--u-field-label-width) + var(--_outlined-label-margin) + (var(--_outlined-label-padding) * 2));\n clip-path: polygon(0 0, var(--_outlined-label-margin) 0, var(--_outlined-label-margin) var(--_focus-border-width), var(--_end-point) var(--_focus-border-width), var(--_end-point) 0, 100% 0, 100% 100%, 0 100%);\n }\n .container.outlined:focus-within .label,\n :host(:not([empty])) .container.outlined .label {\n inset-inline-start: calc(var(--_outlined-label-margin) + var(--_outlined-label-padding));\n }\n\n :host([empty]) ::slotted(select) {\n color: var(--_field-placeholder-color);\n }\n\n :host([empty]:not(:focus-within)) .label {\n font-size: var(--u-field-label-font-size, var(--u-body-l-font-size, 1rem));\n pointer-events: none;\n top: calc(var(--_field-min-height) / 2 - var(--_label-line-height) / 2);\n }\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input-wrapper,\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input,\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input input::placeholder,\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input textarea::placeholder,\n :host([empty]:not(:focus-within)) .container:not(.no-label) ::slotted(:is(input, textarea))::placeholder,\n :host([empty]:not(:focus-within)) .container:not(.no-label) ::slotted(select) {\n color: transparent;\n transition: color 150ms;\n }\n\n .container.no-label::after {\n clip-path: none !important;\n }\n\n :host([disabled]) .container .filled {\n background-color: var(--u-filled-field-disabled-bg-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-filled-field-background-disabled-opacity, 0.04)));\n }\n :host([disabled]) .container::after {\n border-color: var(--u-field-disabled-border-color, var(--_disabled-color));\n }\n :host([disabled]) .supporting-text {\n color: var(--u-field-supporting-text-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .label {\n color: var(--u-field-label-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .input select,\n :host([disabled]) .input select::placeholder,\n :host([disabled]) .input textarea,\n :host([disabled]) .input textarea::placeholder,\n :host([disabled]) .input input,\n :host([disabled]) .input input::placeholder,\n :host([disabled]) .input ::slotted(*),\n :host([disabled]) .input ::slotted(:is(input, textarea))::placeholder {\n color: var(--u-field-input-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .trailing-icon {\n color: var(--u-field-trailing-icon-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .leading-icon {\n color: var(--u-field-leading-icon-disabled-color, var(--_disabled-color));\n }\n`;\n"]}
1
+ {"version":3,"file":"field-base.styles.js","sourceRoot":"","sources":["../../src/field/field-base.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgXzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_control-line-height: var(--u-field-control-line-height, 1.5rem);\n --_label-line-height: var(--u-field-label-line-height, 1rem);\n --_field-icon-size: var(--u-field-icon-size, 1.5rem);\n --_field-control-padding: var(--u-field-control-padding, 16px);\n --_field-control-inline-padding: var(--u-field-control-inline-padding, var(--_field-control-padding));\n --_field-control-block-padding: var(--u-field-control-block-padding, var(--_field-control-padding));\n --_field-min-height: var(--u-field-min-height, 56px);\n --_field-placeholder-color: var(--u-field-placeholder-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_disabled-color: var(--u-field-disabled-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-field-disabled-opacity, .38)));\n --_disabled-bg-color: var(--u-filled-field-disabled-bg-color, rgba(var(--u-color-on-surface-rgb, ), var(--u-filled-field-background-disabled-opacity, .12)));\n --_color-primary: var(--u-color-primary, rgb(103, 80, 164));\n --_color-error: var(--u-field-error-color, var(--u-color-error, rgb(179, 38, 30)));\n --_active-indicator-opacity: 1;\n --_vertical-padding: var(--u-field-vertical-padding, 8px);\n --_icon-size: var(--u-field-icon-size, 1.5rem);\n --_icon-padding: var(--u-field-icon-padding, 12px);\n --_icon-color: var(--u-icon-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_border-width: var(--u-field-border-width, 1px);\n --_border-color: var(--u-field-border-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n --_field-control-leading-padding: var(--_field-control-inline-padding);\n --_outlined-label-margin: var(--u-outlined-field-label-margin, 12px);\n --_outlined-label-padding: var(--u-outlined-field-label-padding, 4px);\n --u-label-input-start: auto;\n --u-label-input-span-leading-offset: 0;\n --u-label-input-span-trailing-offset: 0;\n --u-text-field-horizontal-padding: 12px;\n display: block;\n }\n\n .container {\n display: flex;\n align-items: center;\n position: relative;\n }\n .container::before, .container::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n pointer-events: none;\n }\n .container::before {\n background: var(--u-color-on-surface, rgb(29, 27, 32));\n transition: opacity 150ms;\n opacity: 0;\n }\n .container::after {\n border-width: var(--_border-width);\n border-color: var(--_border-color);\n }\n\n @media (hover: hover) {\n :host(:not([disabled]):not([invalid]):hover) .container.filled::before {\n opacity: var(--u-state-hover-opacity, 0.08);\n }\n :host(:not([disabled]):not([invalid]):not(:focus-within):hover) {\n --_border-color: var(--u-field-hover-border-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n }\n }\n .icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--_icon-size);\n color: var(--_icon-color);\n font-size: var(--_icon-size);\n line-height: var(--_icon-size);\n }\n .icon::slotted(*) {\n flex-shrink: 0;\n }\n\n .leading-icon {\n margin-inline-start: var(--_icon-padding);\n }\n\n .trailing-icon {\n margin-inline-end: var(--_icon-padding);\n }\n\n .outline-notch-label,\n .label {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-label-line-height, var(--u-body-l-line-height, 1.5rem));\n font-size: var(--u-field-label-font-size, var(--u-body-l-font-size, 1rem));\n letter-spacing: var(--u-field-label-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));\n font-weight: var(--u-field-label-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));\n font-size: var(--u-field-label-font-size, var(--u-body-s-font-size, 0.75rem));\n }\n\n .label {\n display: block;\n position: absolute;\n inset-inline-start: var(--_field-control-leading-padding);\n margin-bottom: 0;\n line-height: var(--_label-line-height);\n color: var(--u-field-label-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n transition: inset 200ms, font-size 200ms;\n }\n\n .input-wrapper {\n display: flex;\n align-items: center;\n flex: 1;\n padding-block: var(--_vertical-padding);\n padding-inline: var(--_field-control-inline-padding);\n min-height: var(--_field-min-height);\n transition: opacity 150ms;\n }\n\n .input {\n color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n flex: 1;\n }\n .input:focus {\n outline: 0;\n }\n .input textarea,\n .input select,\n .input input,\n .input ::slotted(*) {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-control-line-height, var(--u-body-l-line-height, 1.5rem));\n font-size: var(--u-field-control-font-size, var(--u-body-l-font-size, 1rem));\n letter-spacing: var(--u-field-control-letter-spacing, var(--u-body-l-letter-spacing, 0.03125rem));\n font-weight: var(--u-field-control-font-weight, var(--u-body-l-font-weight, var(--u-font-weight-regular, 400)));\n display: block;\n width: 100%;\n color: var(--u-field-input-text-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n min-height: var(--_control-line-height);\n line-height: var(--_control-line-height);\n padding: 0;\n margin: 0;\n appearance: none;\n background: transparent;\n border: none;\n outline: 0 !important;\n caret-color: var(--_color-primary);\n }\n .input,\n .input textarea::placeholder,\n .input input::placeholder,\n .input ::slotted(select),\n .input ::slotted(:is(input, textarea))::placeholder {\n transition: color 150ms 100ms;\n }\n .input textarea::placeholder,\n .input input::placeholder,\n .input ::slotted(:is(input, textarea))::placeholder {\n color: var(--_field-placeholder-color);\n }\n\n .supporting-text {\n font-family: var(--u-font-family, var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"));\n line-height: var(--u-field-supporting-text-line-height, var(--u-body-s-line-height, 1rem));\n font-size: var(--u-field-supporting-text-font-size, var(--u-body-s-font-size, 0.75rem));\n letter-spacing: var(--u-field-supporting-text-letter-spacing, var(--u-body-s-letter-spacing, 0.0333333333rem));\n font-weight: var(--u-field-supporting-text-font-weight, var(--u-body-s-font-weight, var(--u-font-weight-regular, 400)));\n display: flex;\n color: var(--u-field-supporting-text, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n padding-inline: 16px;\n gap: 16px;\n }\n .supporting-text div:empty {\n display: none;\n }\n .supporting-text div,\n .supporting-text ::slotted(*) {\n display: inline-block;\n margin-top: 4px;\n }\n\n .error-text {\n display: none;\n }\n\n .counter div, .counter::slotted(*) {\n margin-inline-start: auto;\n }\n\n :host([has-leading-icon]) {\n --_field-control-leading-padding: calc(var(--_icon-padding) + var(--_icon-size) + var(--_field-control-inline-padding)) ;\n }\n\n :host(:not([has-leading-icon])) .leading-icon {\n display: none;\n }\n\n :host(:not([has-trailing-icon])) .container:has(slot[name=trailing-icon] span:empty) .trailing-icon {\n display: none;\n }\n\n :host(:focus-within) {\n --_border-width: var(--u-text-field-focus-border-width, 2px);\n --_border-color: var(--u-field-focused-border-color, var(--_color-primary));\n }\n :host(:focus-within) .label {\n color: var(--u-field-label-focused-color, var(--_color-primary));\n }\n\n :host([invalid]) {\n --_border-color: var(--u-field-error-border-color, var(--_color-error));\n }\n :host([invalid]) .label {\n color: var(--u-field-label-error-color, var(--_color-error));\n }\n :host([invalid]) .supporting-text {\n color: var(--u-field-supporting-text-error-color, var(--_color-error));\n }\n :host([invalid]) .trailing-icon {\n color: var(--u-field-trailing-icon-error-color, var(--_color-error));\n }\n :host([invalid]) .leading-icon {\n color: var(--u-field-leading-icon-error-color, var(--_icon-color));\n }\n\n :host([invalid]) .supporting-text:has(.error-text div:not(:empty)) .error-text,\n :host([invalid][has-error-text]) .error-text {\n display: contents;\n }\n :host([invalid]) .supporting-text:has(.error-text div:not(:empty)) slot[name=supporting-text],\n :host([invalid][has-error-text]) slot[name=supporting-text] {\n display: none;\n }\n\n .container.filled {\n border-radius: var(--u-field-filled-border-radius, 4px 4px 0 0);\n background-color: var(--u-color-surface-container-highest, rgb(230, 224, 233));\n }\n .container.filled::after {\n border-bottom-style: solid;\n }\n .container.filled:not(.no-label) .input-wrapper {\n padding-top: calc(var(--_vertical-padding) + var(--_label-line-height));\n padding-bottom: var(--_vertical-padding);\n }\n .container.filled .label {\n top: var(--_vertical-padding);\n }\n .container.filled .input ::slotted(:is(input, textarea, select, button)) {\n display: block;\n }\n .container.outlined .label {\n top: calc(var(--_label-line-height) / -2);\n }\n\n .container.outlined:focus-within .label,\n :host(:not([empty])) .container.outlined .label {\n inset-inline-start: calc(var(--_outlined-label-margin) + var(--_outlined-label-padding));\n }\n\n :host([empty]) ::slotted(select) {\n color: var(--_field-placeholder-color);\n }\n\n :host([empty]:not(:focus-within)) .label {\n font-size: var(--u-field-label-font-size, var(--u-body-l-font-size, 1rem));\n pointer-events: none;\n top: calc(var(--_field-min-height) / 2 - var(--_label-line-height) / 2);\n }\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input-wrapper,\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input,\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input input::placeholder,\n :host([empty]:not(:focus-within)) .container:not(.no-label) .input textarea::placeholder,\n :host([empty]:not(:focus-within)) .container:not(.no-label) ::slotted(:is(input, textarea))::placeholder,\n :host([empty]:not(:focus-within)) .container:not(.no-label) ::slotted(select) {\n color: transparent;\n transition: color 150ms;\n }\n\n :host([disabled]) {\n --_border-color: var(--u-field-disabled-border-color, var(--_disabled-color));\n }\n :host([disabled]) .container .filled {\n background-color: var(--u-filled-field-disabled-bg-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-filled-field-background-disabled-opacity, 0.04)));\n }\n :host([disabled]) .supporting-text {\n color: var(--u-field-supporting-text-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .label {\n color: var(--u-field-label-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .input select,\n :host([disabled]) .input select::placeholder,\n :host([disabled]) .input textarea,\n :host([disabled]) .input textarea::placeholder,\n :host([disabled]) .input input,\n :host([disabled]) .input input::placeholder,\n :host([disabled]) .input ::slotted(*),\n :host([disabled]) .input ::slotted(:is(input, textarea))::placeholder {\n color: var(--u-field-input-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .trailing-icon {\n color: var(--u-field-trailing-icon-disabled-color, var(--_disabled-color));\n }\n :host([disabled]) .leading-icon {\n color: var(--u-field-leading-icon-disabled-color, var(--_disabled-color));\n }\n\n .outline {\n position: absolute;\n inset: 0;\n display: flex;\n border-radius: var(--u-outlined-field-shape-corder, var(--u-shape-corner-small, 8px));\n pointer-events: none;\n }\n\n .outline-start,\n .outline-end {\n border: var(--_border-width) solid var(--_border-color);\n border-radius: inherit;\n flex-basis: var(--_outlined-label-margin);\n }\n\n .outline-start {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n border-inline-end: none;\n }\n\n .outline-end {\n flex: 1;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n border-inline-start: none;\n }\n\n .outline-notch {\n min-width: 0;\n border-bottom: var(--_border-width) solid var(--_border-color);\n }\n\n .outline-notch-label {\n position: relative;\n color: transparent;\n padding-inline: var(--_outlined-label-padding);\n user-select: none;\n }\n\n .outline-notch-label::before,\n .outline-notch-label::after {\n content: \"\";\n position: absolute;\n border-top: var(--_border-width) solid var(--_border-color);\n width: 50%;\n transition: width 100ms;\n }\n\n .outline-notch-label::before {\n left: 0;\n }\n\n .outline-notch-label::after {\n right: 0;\n }\n\n .container:not(.no-label):focus-within .outline-notch-label::before,\n .container:not(.no-label):focus-within .outline-notch-label::after,\n :host(:not([empty])) .container:not(.no-label) .outline-notch-label::before,\n :host(:not([empty])) .container:not(.no-label) .outline-notch-label::after {\n width: 0;\n }\n`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/menu/menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM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IAI9C;;OAEG;IACH,IACI,IAAI,IAAI,OAAO,CAElB;IACD,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,EA8CrB;IAE4B,WAAW,EAAE,UAAU,GAAG,OAAO,CAAc;IAE/C,WAAW,UAAS;IAEjD;;;OAGG;IAEH,YAAY,EAAE,YAAY,GAAG,UAAU,GAAG,aAAa,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAe;IAE9G;;;;;OAKG;IAC0B,SAAS,EAAE,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAc;IAEvG;;OAEG;IACsE,aAAa,UAAS;IAE/E,IAAI,EAAG,WAAW,CAAC;IACpB,GAAG,EAAG,WAAW,CAAC;IAEjC,IAAI,eAAe,IAAI,WAAW,CAEjC;IAID,IAAI,aAAa,IAAI,WAAW,GAAG,IAAI,GAAG,SAAS,CAElD;IACD,IAAI,aAAa,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EAE9D;cAEkB,MAAM,IAAI,kBAAkB;IAYtC,iBAAiB;IAO1B,MAAM,aAOJ;IAEF,IAAI,IAAI,IAAI;IAMZ,KAAK,aAIH;IAEF,OAAO,CAAC,uBAAuB;IA0I/B,OAAO,CAAC,eAAe;IAqDvB,OAAO,CAAC,WAAW;CAWpB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,QAAQ,EAAE,MAAM,CAAC;KAClB;CACF"}
package/menu/menu.js CHANGED
@@ -59,7 +59,13 @@ let UmMenu = class UmMenu extends LitElement {
59
59
  return;
60
60
  }
61
61
  this.#open = open;
62
- this.menu?.addEventListener('transitionend', () => this.dispatchEvent(new Event('closed')), { capture: true, once: true });
62
+ this.menu?.addEventListener('transitionend', () => {
63
+ this.menu.style.display = 'none';
64
+ return this.dispatchEvent(new Event('closed'));
65
+ }, {
66
+ capture: true,
67
+ once: true,
68
+ });
63
69
  document.removeEventListener('click', this.close);
64
70
  return;
65
71
  }
@@ -68,8 +74,12 @@ let UmMenu = class UmMenu extends LitElement {
68
74
  return;
69
75
  }
70
76
  this.calcDropdownPositioning();
77
+ this.menu.style.display = '';
71
78
  this.#open = open;
72
- this.menu?.addEventListener('transitionend', () => this.dispatchEvent(new Event('opened')), { capture: true, once: true });
79
+ this.menu?.addEventListener('animationend', () => this.dispatchEvent(new Event('opened')), {
80
+ capture: true,
81
+ once: true,
82
+ });
73
83
  setTimeout(() => document.addEventListener('click', this.close));
74
84
  if (this.manualFocus) {
75
85
  return;
@@ -89,7 +99,7 @@ let UmMenu = class UmMenu extends LitElement {
89
99
  render() {
90
100
  return html `
91
101
  <div class="ref"></div>
92
- <div class="menu" part="menu" ?inert=${!this.open}>
102
+ <div class="menu" part="menu" style="display: none" ?inert=${!this.open}>
93
103
  <u-elevation></u-elevation>
94
104
  <div role="menu" class="content" part="content">
95
105
  <slot></slot>
@@ -99,7 +109,7 @@ let UmMenu = class UmMenu extends LitElement {
99
109
  }
100
110
  connectedCallback() {
101
111
  super.connectedCallback();
102
- this.role = "listbox";
112
+ this.role = 'listbox';
103
113
  // eslint-disable-next-line no-self-assign
104
114
  this.open = this.open;
105
115
  }
@@ -131,9 +141,7 @@ let UmMenu = class UmMenu extends LitElement {
131
141
  this.#openBlockAuto(menuPosition, menuSize);
132
142
  return;
133
143
  }
134
- const side = this.anchorCorner.startsWith('start-')
135
- ? menuPosition.bounds.top
136
- : menuPosition.bounds.bottom;
144
+ const side = this.anchorCorner.startsWith('start-') ? menuPosition.bounds.top : menuPosition.bounds.bottom;
137
145
  if (this.direction.startsWith('up-')) {
138
146
  this.#tryOpenUp(side, menuSize);
139
147
  return;
@@ -173,15 +181,9 @@ let UmMenu = class UmMenu extends LitElement {
173
181
  this.#openDown(side);
174
182
  }
175
183
  #setToOpenToStartOrEnd(menuPosition, menuSize) {
176
- const openStart = menuPosition.isRtl
177
- ? this.#tryOpenRight.bind(this)
178
- : this.#tryOpenLeft.bind(this);
179
- const openEnd = menuPosition.isRtl
180
- ? this.#tryOpenLeft.bind(this)
181
- : this.#tryOpenRight.bind(this);
182
- const side = this.anchorCorner.endsWith('-start')
183
- ? menuPosition.bounds.start
184
- : menuPosition.bounds.end;
184
+ const openStart = menuPosition.isRtl ? this.#tryOpenRight.bind(this) : this.#tryOpenLeft.bind(this);
185
+ const openEnd = menuPosition.isRtl ? this.#tryOpenLeft.bind(this) : this.#tryOpenRight.bind(this);
186
+ const side = this.anchorCorner.endsWith('-start') ? menuPosition.bounds.start : menuPosition.bounds.end;
185
187
  if (this.direction.endsWith('-start')) {
186
188
  openStart(side, menuSize);
187
189
  return;
@@ -214,16 +216,12 @@ let UmMenu = class UmMenu extends LitElement {
214
216
  const viewPortHeight = window.innerHeight;
215
217
  this.menu.style.bottom = `${side.relativeY * -1}px`;
216
218
  this.menu.classList.add('up');
217
- this.menu.style.maxHeight = this.allowOverflow
218
- ? ''
219
- : `${viewPortHeight - side.bottom}px`;
219
+ this.menu.style.maxHeight = this.allowOverflow ? '' : `${viewPortHeight - side.bottom}px`;
220
220
  }
221
221
  #openDown(side) {
222
222
  const viewPortHeight = window.innerHeight;
223
223
  this.menu.style.top = `${side.relativeY}px`;
224
- this.menu.style.maxHeight = this.allowOverflow
225
- ? ''
226
- : `${viewPortHeight - side.top}px`;
224
+ this.menu.style.maxHeight = this.allowOverflow ? '' : `${viewPortHeight - side.top}px`;
227
225
  }
228
226
  getMenuPosition() {
229
227
  const viewPortWidth = window.innerWidth;
@@ -240,33 +238,33 @@ let UmMenu = class UmMenu extends LitElement {
240
238
  const leftPoint = {
241
239
  left: anchorRect.left,
242
240
  right: viewPortWidth - anchorRect.left,
243
- relativeX: anchorRect.left - rectX
241
+ relativeX: anchorRect.left - rectX,
244
242
  };
245
243
  const rightPoint = {
246
244
  left: anchorRect.right,
247
245
  right: viewPortWidth - anchorRect.right,
248
- relativeX: leftPoint.relativeX + width
246
+ relativeX: leftPoint.relativeX + width,
249
247
  };
250
248
  const topPoint = {
251
249
  top: anchorRect.top,
252
250
  relativeY: anchorRect.top - rectY,
253
- bottom: viewPortHeight - anchorRect.top
251
+ bottom: viewPortHeight - anchorRect.top,
254
252
  };
255
253
  const anchorBounds = {
256
254
  top: topPoint,
257
255
  bottom: {
258
256
  top: anchorRect.bottom,
259
257
  relativeY: topPoint.relativeY + height,
260
- bottom: viewPortHeight - anchorRect.bottom
258
+ bottom: viewPortHeight - anchorRect.bottom,
261
259
  },
262
260
  start: isRtl ? rightPoint : leftPoint,
263
261
  end: isRtl ? leftPoint : rightPoint,
264
262
  width,
265
- height
263
+ height,
266
264
  };
267
265
  return {
268
266
  isRtl: isRtl,
269
- bounds: anchorBounds
267
+ bounds: anchorBounds,
270
268
  };
271
269
  }
272
270
  getMenuSize() {
@@ -276,7 +274,7 @@ let UmMenu = class UmMenu extends LitElement {
276
274
  const height = parseInt(styles.height, 10);
277
275
  return {
278
276
  width: width,
279
- height: height
277
+ height: height,
280
278
  };
281
279
  }
282
280
  };