@crowdstrike/glide-core 0.12.3 → 0.13.0

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.
Files changed (43) hide show
  1. package/dist/accordion.d.ts +1 -1
  2. package/dist/accordion.styles.js +2 -1
  3. package/dist/button-group.js +1 -1
  4. package/dist/button-group.stories.d.ts +0 -1
  5. package/dist/button-group.test.events.js +2 -0
  6. package/dist/checkbox.styles.js +6 -3
  7. package/dist/drawer.js +1 -1
  8. package/dist/dropdown.d.ts +5 -1
  9. package/dist/dropdown.js +64 -50
  10. package/dist/dropdown.option.js +1 -1
  11. package/dist/dropdown.option.styles.js +36 -6
  12. package/dist/dropdown.styles.js +31 -21
  13. package/dist/dropdown.test.basics.filterable.js +8 -3
  14. package/dist/dropdown.test.events.filterable.js +1 -13
  15. package/dist/dropdown.test.focus.single.js +1 -17
  16. package/dist/dropdown.test.interactions.filterable.js +84 -0
  17. package/dist/dropdown.test.interactions.js +1 -1
  18. package/dist/input.d.ts +1 -1
  19. package/dist/input.js +2 -1
  20. package/dist/input.styles.js +44 -30
  21. package/dist/library/localize.d.ts +2 -0
  22. package/dist/menu.js +1 -1
  23. package/dist/menu.stories.d.ts +1 -0
  24. package/dist/menu.styles.js +1 -1
  25. package/dist/menu.test.interactions.js +1 -1
  26. package/dist/modal.d.ts +1 -1
  27. package/dist/modal.js +1 -1
  28. package/dist/radio-group.stories.d.ts +0 -1
  29. package/dist/styles/variables.css +1 -1
  30. package/dist/tab.group.d.ts +0 -1
  31. package/dist/tab.group.js +1 -1
  32. package/dist/tab.group.styles.js +5 -7
  33. package/dist/tabs.stories.d.ts +0 -1
  34. package/dist/tag.js +1 -1
  35. package/dist/tag.styles.js +5 -3
  36. package/dist/tag.test.interactions.js +8 -8
  37. package/dist/translations/en.js +1 -1
  38. package/dist/translations/fr.d.ts +1 -1
  39. package/dist/translations/fr.js +1 -1
  40. package/dist/translations/ja.d.ts +1 -1
  41. package/dist/translations/ja.js +1 -1
  42. package/dist/tree.stories.d.ts +0 -1
  43. package/package.json +18 -18
@@ -5,7 +5,7 @@ declare global {
5
5
  }
6
6
  }
7
7
  /**
8
- * @event toggle - `(event: "toggle", listener: (event: Event) => void) => void`.
8
+ * @event toggle - `(event: "toggle", handler: (event: Event) => void) => void`.
9
9
  *
10
10
  * @slot - The content of the accordion.
11
11
  * @slot prefix-icon - An optional icon before the label.
@@ -2,8 +2,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
2
2
  ${focusOutline(".summary:focus-visible")}
3
3
  `,css`
4
4
  .component {
5
+ border: 1px solid var(--glide-core-border-base-lighter);
5
6
  border-radius: 0.625rem;
6
- box-shadow: var(--glide-core-shadow-sm);
7
+ box-shadow: var(--glide-core-shadow-md);
7
8
  font-family: var(--glide-core-body-xs-font-family);
8
9
  }
9
10
 
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(t,e,o,n){var r,i=arguments.length,l=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(l=(i<3?r(l):i>3?r(e,o,l):r(e,o))||l);return i>3&&l&&Object.defineProperty(e,o,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import GlideCoreButtonGroupButton from"./button-group.button.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./button-group.styles.js";let GlideCoreButtonGroup=class GlideCoreButtonGroup extends LitElement{constructor(){super(...arguments),this.label="",this.#t="horizontal",this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get variant(){return this.#o}set variant(t){for(const e of this.#n)e.privateVariant=t;this.#o=t}get orientation(){return this.#t}set orientation(t){for(const e of this.#n)e.privateOrientation=t;this.#t=t}firstUpdated(){owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton])}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation})}"><div class="label" id="label" data-test="label">${this.label}</div><div aria-labelledby="label" role="radiogroup" class="${classMap({container:!0,vertical:"vertical"===this.orientation})}"><slot @click="${this.#r}" @keydown="${this.#i}" @private-selected="${this.#l}" @slotchange="${this.#s}" ${ref(this.#e)}></slot></div></div>`}#t;#e;#o;get#n(){return[...this.querySelectorAll("glide-core-button-group-button")]}#s(){ow(this.#n.length,ow.number.greaterThan(1).message("A Button Group must contain two or more Button Group Buttons.")),owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton]);if(!this.#n.find((({disabled:t,selected:e})=>!t&&e))){const t=this.#n.find((({disabled:t})=>!t));t&&(t.selected=!0)}for(const t of this.#n)t.privateVariant=this.variant,this.orientation&&(t.privateOrientation=this.orientation)}#r(t){if(t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");!e||e.disabled||e.selected||(e.selected=!0)}}#i(t){const e=this.querySelector("glide-core-button-group-button[selected]");switch(ow(e,ow.object.instanceOf(GlideCoreButtonGroupButton)),t.key){case"ArrowUp":case"ArrowLeft":{t.preventDefault();let o=e?.previousElementSibling??this.#n.at(-1);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.previousElementSibling??this.#n.at(-1);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0);break}case"ArrowDown":case"ArrowRight":{t.preventDefault();let o=e?.nextElementSibling??this.#n.at(0);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.nextElementSibling??this.#n.at(0);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0);break}case" ":if(t.preventDefault(),t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");e&&!e.disabled&&(e.selected=!0)}}}#l(t){if(t.target instanceof GlideCoreButtonGroupButton&&t.target.selected){for(const e of this.#n)e!==t.target&&(e.selected=!1);t.target.focus(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}}};__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"variant",null),__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"orientation",null),GlideCoreButtonGroup=__decorate([customElement("glide-core-button-group")],GlideCoreButtonGroup);export default GlideCoreButtonGroup;
1
+ var __decorate=this&&this.__decorate||function(t,e,o,n){var r,i=arguments.length,l=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(l=(i<3?r(l):i>3?r(e,o,l):r(e,o))||l);return i>3&&l&&Object.defineProperty(e,o,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import GlideCoreButtonGroupButton from"./button-group.button.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./button-group.styles.js";let GlideCoreButtonGroup=class GlideCoreButtonGroup extends LitElement{constructor(){super(...arguments),this.label="",this.#t="horizontal",this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get variant(){return this.#o}set variant(t){for(const e of this.#n)e.privateVariant=t;this.#o=t}get orientation(){return this.#t}set orientation(t){for(const e of this.#n)e.privateOrientation=t;this.#t=t}firstUpdated(){owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton])}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation})}"><div class="label" id="label" data-test="label">${this.label}</div><div aria-labelledby="label" role="radiogroup" class="${classMap({container:!0,vertical:"vertical"===this.orientation})}"><slot @click="${this.#r}" @keydown="${this.#i}" @private-selected="${this.#l}" @slotchange="${this.#s}" ${ref(this.#e)}></slot></div></div>`}#t;#e;#o;get#n(){return[...this.querySelectorAll("glide-core-button-group-button")]}#s(){ow(this.#n.length,ow.number.greaterThan(1).message("A Button Group must contain two or more Button Group Buttons.")),owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton]);if(!this.#n.find((({disabled:t,selected:e})=>!t&&e))){const t=this.#n.find((({disabled:t})=>!t));t&&(t.selected=!0)}for(const t of this.#n)t.privateVariant=this.variant,this.orientation&&(t.privateOrientation=this.orientation)}#r(t){if(t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");!e||e.disabled||e.selected||(e.selected=!0)}}#i(t){const e=this.querySelector("glide-core-button-group-button[selected]");switch(ow(e,ow.object.instanceOf(GlideCoreButtonGroupButton)),t.key){case"ArrowUp":case"ArrowLeft":{t.preventDefault();let o=e?.previousElementSibling??this.#n.at(-1);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.previousElementSibling??this.#n.at(-1);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0);break}case"ArrowDown":case"ArrowRight":{t.preventDefault();let o=e?.nextElementSibling??this.#n.at(0);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.nextElementSibling??this.#n.at(0);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0);break}case" ":if(t.preventDefault(),t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");e&&!e.disabled&&(e.selected=!0)}}}#l(t){if(t.target instanceof GlideCoreButtonGroupButton&&t.target.selected){for(const e of this.#n)e!==t.target&&(e.selected=!1);t.target.focus(),t.target.dispatchEvent(new Event("change",{bubbles:!0})),t.target.dispatchEvent(new Event("input",{bubbles:!0}))}}};__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"variant",null),__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"orientation",null),GlideCoreButtonGroup=__decorate([customElement("glide-core-button-group")],GlideCoreButtonGroup);export default GlideCoreButtonGroup;
@@ -1,4 +1,3 @@
1
- import './button-group.button.js';
2
1
  import './button-group.js';
3
2
  import './icons/storybook.js';
4
3
  import type { Meta, StoryObj } from '@storybook/web-components';
@@ -24,6 +24,7 @@ it('emits a "change" event when a button is clicked and not already selected', a
24
24
  const event = await oneEvent(component, 'change');
25
25
  expect(event instanceof Event).to.be.true;
26
26
  expect(event.bubbles).to.be.true;
27
+ expect(event.target).to.equal(button);
27
28
  });
28
29
  it('emits an "input" event when a button is clicked and not already selected', async () => {
29
30
  const component = await fixture(html `<glide-core-button-group>
@@ -42,6 +43,7 @@ it('emits an "input" event when a button is clicked and not already selected', a
42
43
  const event = await oneEvent(component, 'input');
43
44
  expect(event instanceof Event).to.be.true;
44
45
  expect(event.bubbles).to.be.true;
46
+ expect(event.target).to.equal(button);
45
47
  });
46
48
  it('does not emit an "change" event when clicked button is clicked and already selected', async () => {
47
49
  const component = await fixture(html `<glide-core-button-group>
@@ -63,7 +63,9 @@ when browsers support them.
63
63
  justify-content: center;
64
64
 
65
65
  @media (prefers-reduced-motion: no-preference) {
66
- transition: box-shadow 200ms ease-in-out;
66
+ transition:
67
+ border-color 200ms ease-in-out,
68
+ box-shadow 200ms ease-in-out;
67
69
  }
68
70
 
69
71
  &.error:not(.disabled) {
@@ -71,7 +73,7 @@ when browsers support them.
71
73
  }
72
74
 
73
75
  &:not(.disabled):hover {
74
- box-shadow: var(--glide-core-glow-sm);
76
+ box-shadow: var(--glide-core-shadow-checkbox);
75
77
  }
76
78
  }
77
79
 
@@ -86,7 +88,8 @@ when browsers support them.
86
88
  position: absolute;
87
89
 
88
90
  &:not(:disabled):hover ~ .checkbox {
89
- box-shadow: var(--glide-core-glow-sm);
91
+ border-color: var(--glide-core-border-focus);
92
+ box-shadow: var(--glide-core-shadow-checkbox);
90
93
  }
91
94
 
92
95
  &:checked:not(:indeterminate) ~ .checkbox .checked-icon {
package/dist/drawer.js CHANGED
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,s,o){var i,l=arguments.length,a=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,o);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(a=(l<3?i(a):l>3?i(t,s,a):i(t,s))||a);return l>3&&a&&Object.defineProperty(t,s,a),a};import{LitElement,html,nothing}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{owSlot}from"./library/ow.js";import styles from"./drawer.styles.js";let GlideCoreDrawer=class GlideCoreDrawer extends LitElement{constructor(){super(...arguments),this.label="",this.pinned=!1,this.isOpen=!1,this.state="closed",this.#e=createRef(),this.#t=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}close(){"open"===this.state&&(this.#e?.value?.addEventListener("transitionend",(()=>{this.isOpen=!1,this.#e?.value?.classList?.remove("open"),this.#e?.value?.classList?.remove("closing"),this.state="closed",this.dispatchEvent(new Event("close",{bubbles:!0}))}),{once:!0}),this.#e?.value?.classList?.add("closing"),this.state="closing")}firstUpdated(){owSlot(this.#t.value)}render(){return html`<aside class="${classMap({component:!0,pinned:this.pinned})}" tabindex="-1" data-test-state="${this.isOpen?"open":"closed"}" @keydown="${this.#s}" ${ref(this.#e)} aria-label="${this.label||nothing}"><slot @slotchange="${this.#o}" ${ref(this.#t)}></slot></aside>`}show(){"closed"===this.state&&(this.#e?.value?.addEventListener("transitionend",(()=>{this.state="open",this.#e?.value?.focus()}),{once:!0}),this.#e?.value?.classList?.add("open"),this.state="opening",this.isOpen=!0)}#e;#t;#o(){owSlot(this.#t.value)}#s(e){"Escape"===e.key&&this.close()}};__decorate([property()],GlideCoreDrawer.prototype,"label",void 0),__decorate([property({type:Boolean})],GlideCoreDrawer.prototype,"pinned",void 0),__decorate([state()],GlideCoreDrawer.prototype,"isOpen",void 0),__decorate([state()],GlideCoreDrawer.prototype,"state",void 0),GlideCoreDrawer=__decorate([customElement("glide-core-drawer")],GlideCoreDrawer);export default GlideCoreDrawer;
1
+ var __decorate=this&&this.__decorate||function(e,t,s,o){var i,l=arguments.length,a=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,o);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(a=(l<3?i(a):l>3?i(t,s,a):i(t,s))||a);return l>3&&a&&Object.defineProperty(t,s,a),a};import{LitElement,html,nothing}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{owSlot}from"./library/ow.js";import styles from"./drawer.styles.js";let GlideCoreDrawer=class GlideCoreDrawer extends LitElement{constructor(){super(...arguments),this.label="",this.pinned=!1,this.isOpen=!1,this.state="closed",this.#e=createRef(),this.#t=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}close(){"open"===this.state&&(this.#e?.value?.addEventListener("transitionend",(()=>{this.isOpen=!1,this.#e?.value?.classList?.remove("open"),this.#e?.value?.classList?.remove("closing"),this.state="closed",this.dispatchEvent(new Event("close",{bubbles:!0}))}),{once:!0}),this.#e?.value?.classList?.add("closing"),this.state="closing")}firstUpdated(){owSlot(this.#t.value)}render(){return html`<aside class="${classMap({component:!0,pinned:this.pinned})}" tabindex="-1" data-test-state="${this.isOpen?"open":"closed"}" @keydown="${this.#s}" ${ref(this.#e)} aria-label="${this.label||nothing}"><slot @slotchange="${this.#o}" ${ref(this.#t)}></slot></aside>`}show(){"closed"===this.state&&(this.#e?.value?.addEventListener("transitionend",(()=>{this.state="open",this.#e?.value?.focus()}),{once:!0}),this.#e?.value?.classList?.add("open"),this.state="opening",this.isOpen=!0)}#e;#t;#o(){owSlot(this.#t.value)}#s(e){"Escape"===e.key&&(e.preventDefault(),this.close())}};__decorate([property()],GlideCoreDrawer.prototype,"label",void 0),__decorate([property({type:Boolean})],GlideCoreDrawer.prototype,"pinned",void 0),__decorate([state()],GlideCoreDrawer.prototype,"isOpen",void 0),__decorate([state()],GlideCoreDrawer.prototype,"state",void 0),GlideCoreDrawer=__decorate([customElement("glide-core-drawer")],GlideCoreDrawer);export default GlideCoreDrawer;
@@ -4,6 +4,7 @@ import './icon-button.js';
4
4
  import './label.js';
5
5
  import './tooltip.js';
6
6
  import { LitElement } from 'lit';
7
+ import GlideCoreDropdownOption from './dropdown.option.js';
7
8
  declare global {
8
9
  interface HTMLElementTagNameMap {
9
10
  'glide-core-dropdown': GlideCoreDropdown;
@@ -58,6 +59,7 @@ export default class GlideCoreDropdown extends LitElement {
58
59
  connectedCallback(): void;
59
60
  createRenderRoot(): ShadowRoot;
60
61
  disconnectedCallback(): void;
62
+ filter(query: string): Promise<GlideCoreDropdownOption[]>;
61
63
  firstUpdated(): void;
62
64
  focus(options?: FocusOptions): void;
63
65
  get form(): HTMLFormElement | null;
@@ -73,13 +75,15 @@ export default class GlideCoreDropdown extends LitElement {
73
75
  private ariaActivedescendant;
74
76
  private isBlurring;
75
77
  private isCheckingValidity;
78
+ private isCommunicateItemCountToScreenreaders;
76
79
  private isFilterable;
77
80
  private isFiltering;
78
81
  private isInternalLabelOverflow;
79
82
  private isInternalLabelTooltipOpen;
80
- private isOptionsAndFooterHidden;
83
+ private isNoResults;
81
84
  private isReportValidityOrSubmit;
82
85
  private isShowSingleSelectIcon;
86
+ private itemCount;
83
87
  private tagOverflowLimit;
84
88
  private validityMessage?;
85
89
  }
package/dist/dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length,n=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(l<3?o(n):l>3?o(t,i,n):o(t,i))||n);return l>3&&n&&Object.defineProperty(t,i,n),n};import"./checkbox.js";import"./dropdown.option.js";import"./icon-button.js";import"./label.js";import"./tooltip.js";import{LitElement,html}from"lit";import{LocalizeController}from"./library/localize.js";import{autoUpdate,computePosition,flip,offset}from"@floating-ui/dom";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{repeat}from"lit/directives/repeat.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import GlideCoreDropdownOption from"./dropdown.option.js";import GlideCoreTag from"./tag.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import ow,{owSlotType}from"./library/ow.js";import pencilIcon from"./icons/pencil.js";import styles from"./dropdown.styles.js";let GlideCoreDropdown=class GlideCoreDropdown extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#e}set disabled(e){this.#e=e,this.open&&e?this.#t():this.open&&this.#i()}get filterable(){return this.#s}set filterable(e){this.#s!==e&&e&&!this.multiple?setTimeout((()=>{this.updateComplete.then((()=>{this.#o.value&&this.selectedOptions.length>0&&(this.#o.value.value=this.selectedOptions[0].label)}))})):this.#s!==e&&this.#l(),this.#s=e}get open(){return this.#n}set open(e){this.#n=e,!e||this.disabled?(!this.multiple&&this.#o.value&&this.selectedOptions.length>0&&(this.#o.value.value=this.selectedOptions[0].label,this.isFiltering=!1,this.isShowSingleSelectIcon=!this.multiple&&this.selectedOptions.length>0&&Boolean(this.selectedOptions.at(0)?.value)),this.#t()):this.#i()}get size(){return this.#a}set size(e){if(this.#a=e,this.#r)for(const t of this.#r)t.privateSize=e}get multiple(){return this.#p}set multiple(e){const t=this.#p&&!e,i=!this.#p&&e;this.#p=e,this.isShowSingleSelectIcon=!1;for(const i of this.#d)i.privateMultiple=e,t&&i!==this.lastSelectedOption&&(i.selected=!1);t&&this.lastSelectedOption?.value?this.value=[this.lastSelectedOption.value]:i&&this.lastSelectedOption&&(this.lastSelectedOption.privateUpdateCheckbox(),this.#h())}get value(){return this.#c}set value(e){this.#c=e,ow(this.multiple||!this.multiple&&e.length<=1,ow.boolean.true.message("Only one value is allowed when not `multiple`."));for(const t of this.#d)t.selected=e.some((e=>e&&e===t.value))}get activeOption(){return this.#r?.find((({privateActive:e})=>e))}checkValidity(){this.isCheckingValidity=!0;const e=this.#u.checkValidity();return this.isCheckingValidity=!1,e}click(){this.#o.value?(this.#o.value.click(),this.#o.value.select()):this.#v.value?.click()}get selectedOptions(){return this.#d.filter((e=>e instanceof GlideCoreDropdownOption&&e.selected))}get lastSelectedOption(){return this.#d.findLast((e=>e.selected))}get isAllSelected(){return this.#d.filter((({selected:e})=>e)).length===this.#d.length}get isSomeSelected(){return this.#d.some((({selected:e})=>e))}get internalLabel(){const e=this.filterable||this.isFilterable;return e||0!==this.selectedOptions.length?this.multiple||e||!this.selectedOptions.at(-1)?.label?"":this.selectedOptions.at(-1)?.label:this.placeholder}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#m,{capture:!0})}createRenderRoot(){return this.#f=super.createRenderRoot(),this.#f}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#g),document.removeEventListener("click",this.#m,{capture:!0})}firstUpdated(){if(owSlotType(this.#b.value,[GlideCoreDropdownOption,Text]),this.#O.value&&(this.#O.value.popover="manual"),this.open&&!this.disabled&&this.#i(),this.#E.value){new ResizeObserver((()=>{this.#h()})).observe(this.#E.value)}if(this.#w.value){new ResizeObserver((()=>{this.#w.value&&(this.isInternalLabelOverflow=this.#w.value.scrollWidth>this.#w.value.clientWidth)})).observe(this.#w.value)}}focus(e){this.filterable||this.isFilterable?this.#o.value?.focus(e):this.#v.value?.focus(e)}get form(){return this.#u.form}get validity(){return this.required&&0===this.selectedOptions.length?(this.#u.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.filterable||this.isFilterable?this.#o.value:this.#v.value),this.#u.validity):this.required&&this.#u.validity.valueMissing&&this.selectedOptions.length>0?(this.#u.setValidity({}),this.#u.validity):this.#u.validity}get willValidate(){return this.#u.willValidate}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#g)}formResetCallback(){for(const e of this.#d){e.hasAttribute("selected")||(e.selected=!1)}const e=this.#d.filter((e=>e.hasAttribute("selected"))),t=e.at(-1)?.value;this.#c=this.multiple&&e.length>0?e.map((({value:e})=>e)):!this.multiple&&t?[t]:[]}render(){return html`<div
1
+ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length,n=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(l<3?o(n):l>3?o(t,i,n):o(t,i))||n);return l>3&&n&&Object.defineProperty(t,i,n),n};import"./checkbox.js";import"./dropdown.option.js";import"./icon-button.js";import"./label.js";import"./tooltip.js";import{LitElement,html}from"lit";import{LocalizeController}from"./library/localize.js";import{autoUpdate,computePosition,flip,offset}from"@floating-ui/dom";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{repeat}from"lit/directives/repeat.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import GlideCoreDropdownOption from"./dropdown.option.js";import GlideCoreTag from"./tag.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import ow,{owSlotType}from"./library/ow.js";import pencilIcon from"./icons/pencil.js";import styles from"./dropdown.styles.js";let GlideCoreDropdown=class GlideCoreDropdown extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#e}set disabled(e){this.#e=e,this.open&&e?this.#t():this.open&&this.#i()}get filterable(){return this.#s}set filterable(e){this.#s!==e&&e&&!this.multiple?setTimeout((()=>{this.updateComplete.then((()=>{this.#o.value&&this.selectedOptions.length>0&&(this.#o.value.value=this.selectedOptions[0].label)}))})):this.#s!==e&&this.#l(),this.#s=e}get open(){return this.#n}set open(e){if(this.#n=e,!e||this.disabled){if(!this.multiple&&this.#o.value&&this.selectedOptions.length>0){this.#o.value.value=this.selectedOptions[0].label,this.isFiltering=!1,this.isNoResults=!1,this.isShowSingleSelectIcon=!this.multiple&&this.selectedOptions.length>0&&Boolean(this.selectedOptions.at(0)?.value);for(const e of this.#a)e.hidden=!1}this.#t()}else this.#i()}get size(){return this.#r}set size(e){if(this.#r=e,this.#p)for(const t of this.#p)t.privateSize=e}get multiple(){return this.#d}set multiple(e){const t=this.#d&&!e,i=!this.#d&&e;this.#d=e,this.isShowSingleSelectIcon=!1;for(const i of this.#a)i.privateMultiple=e,t&&i!==this.lastSelectedOption&&(i.selected=!1);t&&this.lastSelectedOption?.value?this.value=[this.lastSelectedOption.value]:i&&this.lastSelectedOption&&(this.lastSelectedOption.privateUpdateCheckbox(),this.#h())}get value(){return this.#c}set value(e){this.#c=e,ow(this.multiple||!this.multiple&&e.length<=1,ow.boolean.true.message("Only one value is allowed when not `multiple`."));for(const t of this.#a)t.selected=e.some((e=>e&&e===t.value))}get activeOption(){return this.#p?.find((({privateActive:e})=>e))}checkValidity(){this.isCheckingValidity=!0;const e=this.#u.checkValidity();return this.isCheckingValidity=!1,e}click(){this.#o.value?(this.#o.value.click(),this.#o.value.select()):this.#v.value?.click()}get selectedOptions(){return this.#a.filter((e=>e instanceof GlideCoreDropdownOption&&e.selected))}get lastSelectedOption(){return this.#a.findLast((e=>e.selected))}get isAllSelected(){return this.#a.filter((({selected:e})=>e)).length===this.#a.length}get isSomeSelected(){return this.#a.some((({selected:e})=>e))}get internalLabel(){const e=this.filterable||this.isFilterable;return e||0!==this.selectedOptions.length?this.multiple||e||!this.selectedOptions.at(-1)?.label?"":this.selectedOptions.at(-1)?.label:this.placeholder}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#m,{capture:!0})}createRenderRoot(){return this.#f=super.createRenderRoot(),this.#f}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#g),document.removeEventListener("click",this.#m,{capture:!0})}async filter(e){return this.#a.filter((({label:t})=>t.toLowerCase().includes(e.toLowerCase().trim())))}firstUpdated(){if(owSlotType(this.#b.value,[GlideCoreDropdownOption,Text]),this.#O.value&&(this.#O.value.popover="manual"),this.open&&!this.disabled&&this.#i(),this.#E.value){new ResizeObserver((()=>{this.#h()})).observe(this.#E.value)}if(this.#w.value){new ResizeObserver((()=>{this.#w.value&&(this.isInternalLabelOverflow=this.#w.value.scrollWidth>this.#w.value.clientWidth)})).observe(this.#w.value)}}focus(e){this.filterable||this.isFilterable?this.#o.value?.focus(e):this.#v.value?.focus(e)}get form(){return this.#u.form}get validity(){return this.required&&0===this.selectedOptions.length?(this.#u.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.filterable||this.isFilterable?this.#o.value:this.#v.value),this.#u.validity):this.required&&this.#u.validity.valueMissing&&this.selectedOptions.length>0?(this.#u.setValidity({}),this.#u.validity):this.#u.validity}get willValidate(){return this.#u.willValidate}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#g)}formResetCallback(){for(const e of this.#a){e.hasAttribute("selected")||(e.selected=!1)}const e=this.#a.filter((e=>e.hasAttribute("selected"))),t=e.at(-1)?.value;this.#c=this.multiple&&e.length>0?e.map((({value:e})=>e)):!this.multiple&&t?[t]:[]}render(){return html`<div
2
2
  class=${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation})}
3
3
  @mouseup=${this.#y}
4
4
  ${ref(this.#E)}
@@ -11,7 +11,7 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
11
11
  ?hide=${this.hideLabel}
12
12
  ?required=${this.required}
13
13
  >
14
- <label id="label"> ${this.label} </label>
14
+ <label for="primary-button" id="label"> ${this.label} </label>
15
15
  <slot name="tooltip" slot="tooltip"></slot>
16
16
 
17
17
  <div
@@ -25,7 +25,7 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
25
25
  class=${classMap({dropdown:!0,quiet:"quiet"===this.variant,disabled:this.disabled,error:this.#R,readonly:this.readonly,multiple:this.multiple})}
26
26
  @click=${this.#$}
27
27
  @mousedown=${this.#D}
28
- ${ref(this.#k)}
28
+ ${ref(this.#I)}
29
29
  >
30
30
  <span class="selected-option-labels" id="selected-option-labels">
31
31
  ${this.selectedOptions.map((({label:e})=>html`<span data-test="selected-option-label">
@@ -36,7 +36,7 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
36
36
  ${when(this.multiple&&this.selectedOptions.length>0,(()=>html`<ul
37
37
  aria-describedby="tag-overflow-text"
38
38
  class="tags"
39
- ${ref(this.#F)}
39
+ ${ref(this.#k)}
40
40
  >
41
41
  ${repeat(this.selectedOptions,(({id:e})=>e),(({id:e,editable:t,label:i,value:s},o)=>html`<li
42
42
  class=${classMap({"tag-container":!0,hidden:o>this.tagOverflowLimit-1})}
@@ -51,8 +51,8 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
51
51
  size=${this.size}
52
52
  ?disabled=${this.disabled||this.readonly}
53
53
  ?private-editable=${t}
54
- @edit=${this.#I}
55
- @remove=${this.#L.bind(this,e)}
54
+ @edit=${this.#F}
55
+ @remove=${this.#T.bind(this,e)}
56
56
  >
57
57
  ${when(s,(()=>html`
58
58
  <slot
@@ -70,27 +70,36 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
70
70
  name="icon:${this.selectedOptions.at(0)?.value}"
71
71
  ></slot>`))}
72
72
  ${when(this.filterable||this.isFilterable,(()=>html`<input
73
- aria-activedescendant=${this.ariaActivedescendant}
74
- aria-controls="options"
75
- aria-describedby="description"
76
- aria-expanded=${this.open}
77
- aria-labelledby="selected-option-labels label"
78
- autocapitalize="off"
79
- autocomplete="off"
80
- class="input"
81
- data-test="input"
82
- id="input"
83
- placeholder=${this.multiple||!this.selectedOptions.at(-1)?.label?this.placeholder??"":""}
84
- role="combobox"
85
- spellcheck="false"
86
- tabindex=${this.disabled?"-1":"0"}
87
- ?disabled=${this.disabled}
88
- ?readonly=${this.readonly}
89
- @focusin=${this.#T}
90
- @input=${this.#B}
91
- @keydown=${this.#_}
92
- ${ref(this.#o)}
93
- />`))}
73
+ aria-activedescendant=${this.ariaActivedescendant}
74
+ aria-controls="options"
75
+ aria-describedby="description"
76
+ aria-expanded=${this.open}
77
+ aria-labelledby="selected-option-labels label ${this.isCommunicateItemCountToScreenreaders?"item-count":""}"
78
+ autocapitalize="off"
79
+ autocomplete="off"
80
+ class="input"
81
+ data-test="input"
82
+ id="input"
83
+ placeholder=${this.multiple||!this.selectedOptions.at(-1)?.label?this.placeholder??"":""}
84
+ role="combobox"
85
+ spellcheck="false"
86
+ tabindex=${this.disabled?"-1":"0"}
87
+ ?disabled=${this.disabled}
88
+ ?readonly=${this.readonly}
89
+ @focusin=${this.#L}
90
+ @focusout=${this.#_}
91
+ @input=${this.#B}
92
+ @keydown=${this.#G}
93
+ ${ref(this.#o)}
94
+ />
95
+
96
+ <span
97
+ aria-label=${this.#V.term("itemCount",this.itemCount.toString())}
98
+ aria-live="assertive"
99
+ class="item-count"
100
+ data-test="item-count"
101
+ id="item-count"
102
+ ></span>`))}
94
103
 
95
104
  <glide-core-tooltip
96
105
  class=${classMap({"internal-label-tooltip":!0,visible:Boolean(this.internalLabel)})}
@@ -131,12 +140,12 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
131
140
  ${when(!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].editable,(()=>html`<glide-core-icon-button
132
141
  class="edit-button"
133
142
  data-test="edit-button"
134
- label=${this.#G.term("editOption",this.selectedOptions[0].label)}
143
+ label=${this.#V.term("editOption",this.selectedOptions[0].label)}
135
144
  tabindex=${this.disabled||this.readonly?"-1":"0"}
136
145
  variant="tertiary"
137
146
  ?disabled=${this.disabled||this.readonly}
138
147
  @click=${this.#M}
139
- ${ref(this.#V)}
148
+ ${ref(this.#z)}
140
149
  >
141
150
  ${pencilIcon}
142
151
  </glide-core-icon-button>`))}
@@ -153,14 +162,14 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
153
162
  id="primary-button"
154
163
  tabindex=${this.filterable||this.isFilterable||this.disabled?"-1":"0"}
155
164
  type="button"
156
- @focusin=${this.#z}
165
+ @focusin=${this.#N}
157
166
  @focusout=${this.#x}
158
167
  ${ref(this.#v)}
159
168
  >
160
169
  ${when(this.isFiltering,(()=>html`<div data-test="magnifying-glass-icon">
161
170
  ${magnifyingGlassIcon}
162
171
  </div>`),(()=>html`<svg
163
- aria-label=${this.#G.term("open")}
172
+ aria-label=${this.#V.term("open")}
164
173
  width="16"
165
174
  height="16"
166
175
  viewBox="0 0 24 24"
@@ -180,43 +189,48 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
180
189
 
181
190
  <div
182
191
  aria-labelledby=${this.filterable||this.isFilterable?"input":"primary-button"}
183
- class=${classMap({"options-and-footer":!0,hidden:this.isOptionsAndFooterHidden})}
192
+ class="options-and-footer"
184
193
  ${ref(this.#O)}
185
194
  >
186
195
  <div
187
196
  aria-labelledby=${this.filterable||this.isFilterable?"input":"button"}
188
- class=${classMap({options:!0,[this.size]:!0})}
197
+ class=${classMap({options:!0,hidden:this.isNoResults,[this.size]:!0})}
189
198
  data-test="options"
190
199
  id="options"
191
200
  role="listbox"
192
201
  tabindex="-1"
193
- @click=${this.#H}
194
- @input=${this.#j}
195
- @focusin=${this.#N}
196
- @mousedown=${this.#U}
197
- @mouseover=${this.#q}
198
- @private-editable-change=${this.#P}
199
- @private-label-change=${this.#K}
200
- @private-selected-change=${this.#W}
201
- @private-value-change=${this.#J}
202
+ @click=${this.#j}
203
+ @input=${this.#H}
204
+ @focusin=${this.#U}
205
+ @mousedown=${this.#q}
206
+ @mouseover=${this.#P}
207
+ @private-editable-change=${this.#K}
208
+ @private-label-change=${this.#W}
209
+ @private-selected-change=${this.#J}
210
+ @private-value-change=${this.#Q}
202
211
  >
203
212
  <glide-core-dropdown-option
204
213
  class="select-all"
205
214
  data-test="select-all"
206
- label=${this.#G.term("selectAll")}
215
+ label=${this.#V.term("selectAll")}
207
216
  private-size=${this.size}
208
217
  private-multiple
209
218
  ?hidden=${!this.selectAll||!this.multiple||this.isFiltering}
210
219
  ?private-indeterminate=${this.isSomeSelected&&!this.isAllSelected}
211
- ${ref(this.#Q)}
220
+ ${ref(this.#X)}
212
221
  ></glide-core-dropdown-option>
213
222
 
214
223
  <slot
215
- @slotchange=${this.#X}
224
+ class="options-slot"
225
+ @slotchange=${this.#Y}
216
226
  ${ref(this.#b)}
217
227
  ></slot>
218
228
  </div>
219
229
 
230
+ ${when(this.isNoResults,(()=>html`<div class="no-results">
231
+ ${this.#V.term("noResults")}
232
+ </div>`))}
233
+
220
234
  <footer
221
235
  class=${classMap({footer:!0,visible:Boolean(this.addButtonLabel)})}
222
236
  >
@@ -224,10 +238,10 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
224
238
  class=${classMap({"add-button":!0,[this.size]:!0})}
225
239
  data-test="add-button"
226
240
  type="button"
227
- @click=${this.#Y}
228
- @focusin=${this.#Z}
229
- @mouseover=${this.#ee}
230
- ${ref(this.#te)}
241
+ @click=${this.#Z}
242
+ @focusin=${this.#ee}
243
+ @mouseover=${this.#te}
244
+ ${ref(this.#ie)}
231
245
  >
232
246
  <svg
233
247
  aria-hidden="true"
@@ -260,4 +274,4 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,l=arguments.length
260
274
  >`))}
261
275
  </div>
262
276
  </glide-core-private-label>
263
- </div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#u.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#u.setValidity({customError:!1},"",this.filterable||this.isFilterable?this.#o.value:this.#v.value):this.#u.setValidity({customError:!0,valueMissing:this.#u.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#o.value:this.#v.value)}setValidity(e,t){this.validityMessage=t,this.#u.setValidity(e," ",this.filterable||this.isFilterable?this.#o.value:this.#v.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.readonly=!1,this.selectAll=!1,this.required=!1,this.ariaActivedescendant="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isFilterable=!1,this.isFiltering=!1,this.isInternalLabelOverflow=!1,this.isInternalLabelTooltipOpen=!1,this.isOptionsAndFooterHidden=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.tagOverflowLimit=0,this.#te=createRef(),this.#ie=createRef(),this.#E=createRef(),this.#b=createRef(),this.#k=createRef(),this.#V=createRef(),this.#o=createRef(),this.#w=createRef(),this.#se=!1,this.#e=!1,this.#oe=!1,this.#s=!1,this.#p=!1,this.#n=!1,this.#le=!1,this.#ne=!1,this.#ae=!1,this.#re=!1,this.#G=new LocalizeController(this),this.#O=createRef(),this.#v=createRef(),this.#Q=createRef(),this.#a="large",this.#F=createRef(),this.#c=[],this.#m=()=>{this.#se?setTimeout((()=>{this.#se=!1})):this.open=!1},this.#g=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#u=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#te;#ie;#pe;#E;#b;#k;#V;#o;#w;#u;#se;#e;#oe;#s;#p;#n;#le;#ne;#ae;#re;#G;#O;#de;#v;#Q;#f;#a;#F;#c;#m;#g;#t(){this.#pe?.(),this.#O.value?.hidePopover(),this.ariaActivedescendant="",this.activeOption&&(this.#de=this.activeOption,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1)}get#R(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#Y(){this.open=!1,this.dispatchEvent(new Event("add",{bubbles:!0,composed:!0}))}#Z(){this.activeOption&&(this.activeOption.privateIsOpenTooltip=!1,this.#de=this.activeOption,this.activeOption.privateActive=!1)}#ee(){this.activeOption&&!this.#le&&(this.#de=this.activeOption,this.activeOption.privateActive=!1)}#y(){this.#se=!0}#X(){owSlotType(this.#b.value,[GlideCoreDropdownOption,Text]),this.isFilterable=this.#d.length>10,this.tagOverflowLimit=this.selectedOptions.length;for(const e of this.#d)e.privateSize=this.size,e.privateMultiple=this.multiple;const e=this.#he?.at(0);!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.#de=this.lastSelectedOption,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(this.#de=e,this.ariaActivedescendant=this.open?e.id:"",e.privateActive=!0),this.#Q.value&&(this.#Q.value.selected=this.isAllSelected),this.multiple?this.#c=this.selectedOptions.filter((e=>Boolean(e.value))).map((({value:e})=>e)):this.lastSelectedOption?.value&&(this.#c=[this.lastSelectedOption.value]),this.requestUpdate(),this.updateComplete.then((()=>{!this.multiple&&this.#o.value&&this.lastSelectedOption?.value&&(this.#o.value.value=this.lastSelectedOption.label)}))}#A(e){this.open&&this.#de&&e.relatedTarget===this.#te.value&&(this.#de.privateActive=!0,this.#de.privateIsOpenTooltip=!this.#de.editable)}#C(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#f?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#oe&&(this.open=!1,this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}#S(e){if(this.disabled||this.readonly)return;if(("Enter"===e.key||" "===e.key)&&e.target===this.#V.value)return void(this.#se=!0);if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if(this.open&&"ArrowUp"===e.key&&this.#f?.activeElement===this.#te.value)return this.focus(),void(this.#de&&(this.#de.privateActive=!0,this.#de.privateIsEditActive=this.#de.editable,this.#de.privateIsOpenTooltip=!this.#de.privateIsEditActive));if(this.open&&"ArrowDown"===e.key&&this.#f?.activeElement===this.#te.value)return void e.preventDefault();if(this.open&&"ArrowDown"===e.key&&this.addButtonLabel&&this.activeOption===this.#ce?.at(-1)&&(!this.activeOption?.editable||this.activeOption?.privateIsEditActive))return e.preventDefault(),this.activeOption&&(this.#de=this.activeOption,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1),void this.#te.value?.focus();if("Escape"===e.key)return e.preventDefault(),this.open=!1,void(this.#f?.activeElement===this.#te.value&&this.focus());const t=e.target===this.#v.value||e.target===this.#o.value||e.target instanceof GlideCoreDropdownOption;if(!this.multiple||t){if(!this.open&&[" ","ArrowUp","ArrowDown"].includes(e.key))return e.preventDefault(),this.open=!0,void(this.activeOption&&(this.activeOption.privateIsOpenTooltip=!this.activeOption.privateIsEditActive));if(this.activeOption&&this.open){if("Enter"===e.key||" "===e.key){if(this.activeOption.privateIsEditActive)return this.activeOption.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if("Enter"===e.key&&this.#ce&&this.#ce.length>0||" "===e.key&&!this.filterable&&!this.isFilterable)return this.#re=!0,e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#Q.value&&this.#ue(),this.#re=!1,this.#l(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new Event("input",{bubbles:!0}))}const t=this.#he?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#he&&"number"==typeof t){e.preventDefault();const i=this.#he.at(t-1);return void(this.activeOption?.privateIsEditActive?(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!0):i&&0!==t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#de=i,i.privateActive=!0,i.privateIsEditActive=i.editable,i.privateIsOpenTooltip=!i.editable,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#he&&"number"==typeof t){e.preventDefault();const i=this.#he.at(t+1);return void(this.activeOption.editable&&!this.activeOption.privateIsEditActive?(this.activeOption.privateIsEditActive=!0,this.activeOption.privateIsOpenTooltip=!1):i&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#de=i,i.privateActive=!0,i.privateIsOpenTooltip=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#he){e.preventDefault();const t=this.#he.at(0);return void(t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#de=t,t.privateActive=!0,t.privateIsOpenTooltip=!0,t.scrollIntoView({block:"nearest"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#he){e.preventDefault();const t=this.#he.at(-1);return void(t&&this.activeOption&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#de=t,t.privateActive=!0,t.privateIsOpenTooltip=!0,t.scrollIntoView({block:"nearest"})))}}}}#$(e){if(!this.disabled&&!this.readonly)if(this.#oe)this.#oe=!1;else if(e.target instanceof Node&&this.#V.value?.contains(e.target))this.selectedOptions[0].dispatchEvent(new Event("edit",{bubbles:!0,composed:!0}));else{if(this.#re||!this.open)return 0!==e.detail?(this.open=!0,this.focus(),this.#le=!0,void setTimeout((()=>{this.#le=!1}))):void 0;this.open=!1}}#D(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#o.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}#M(){this.open=!1}get#d(){return this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption))??[]}get#r(){const e=this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption));if(e&&this.#Q.value)return[this.#Q.value,...e]}get#ce(){return this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#he(){const e=this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#Q.value&&!this.#Q.value.hidden&&e?[this.#Q.value,...e]:e}#T(){this.#o.value?.select()}#B(e){ow(this.#o.value,ow.object.instanceOf(HTMLInputElement)),e.stopPropagation(),this.open=!0,this.isShowSingleSelectIcon=!1,this.multiple&&""!==this.#o.value.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#o.value.value&&this.#o.value.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1;for(const e of this.#d)e.hidden=!e.label?.toLowerCase().includes(this.#o.value?.value.toLowerCase().trim());const t=this.#ce?.at(0);t&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,this.#de=t,this.ariaActivedescendant=t.id,t.privateActive=!0),this.isOptionsAndFooterHidden=!this.#ce||0===this.#ce.length,this.dispatchEvent(new CustomEvent("filter",{bubbles:!0,composed:!0,detail:this.#o.value.value}))}#_(e){const t=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1)).at(-1);if(t&&"Backspace"===e.key&&!e.metaKey&&this.multiple&&this.#o.value&&0===this.#o.value.selectionStart)return this.#oe=!0,t.selected=!1,void(this.#oe=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#o.value&&0===this.#o.value.selectionStart){this.#oe=!0;for(const e of i)e.selected=!1;this.#oe=!1}else;}#H(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t instanceof GlideCoreDropdownOption&&t.privateIsEditActive)return t.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if(t&&!t.selected)return t.selected=!0,this.#l(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new Event("input",{bubbles:!0}));if(t?.selected&&!this.multiple)return void(this.open=!1)}}#P(){this.requestUpdate()}#N(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0,this.#de=e.target)}#j(e){e.stopPropagation(),e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#Q.value&&this.#ue(),this.#l(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}#K(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))):this.#o.value?this.#o.value.value=this.selectedOptions[0].label:this.requestUpdate())}#U(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#q(e){e.target instanceof GlideCoreDropdownOption&&this.#he&&(this.activeOption&&(this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1),this.ariaActivedescendant=e.target.id,this.#de=e.target,e.target.privateActive=!0,e.target.privateIsEditActive=!1,this.#f?.activeElement===this.#te.value&&this.focus())}#W(e){e.target!==this.#Q.value&&!this.#ae&&this.#Q.value&&(this.#Q.value.selected=this.isAllSelected),this.isFiltering=!1,this.isShowSingleSelectIcon=!this.multiple&&this.selectedOptions.length>0&&Boolean(this.selectedOptions.at(0)?.value),e.target instanceof GlideCoreDropdownOption&&(this.multiple?(this.#c=e.target.selected&&e.target.value?[...this.value,e.target.value]:this.value.filter((t=>e.target instanceof GlideCoreDropdownOption&&t!==e.target.value)),this.#o.value&&!this.#oe&&(this.#o.value.value="")):!this.multiple&&e.target.selected&&(this.#c=e.target.value?[e.target.value]:[],this.#o.value&&(this.#o.value.value=e.target.label))),this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))}#J(e){e.target instanceof GlideCoreDropdownOption&&this.multiple&&e.target.selected&&e.detail.new?this.#c=this.value.map((t=>t===e.detail.old?e.detail.new:t)):e.target instanceof GlideCoreDropdownOption&&this.multiple?this.#c=this.value.filter((t=>t!==e.detail.old)):e.target instanceof GlideCoreDropdownOption&&(this.#c=e.detail.new?[e.detail.new]:[])}#z(){this.isInternalLabelTooltipOpen=!0}#x(){this.isInternalLabelTooltipOpen=!1}#I(){this.#oe=!0,this.open=!1}async#L(e){this.#oe=!0;for(const t of this.#d)t.id===e&&(t.selected=!1,this.#c=this.value.filter((e=>e!==t.value)));const t=this.#F.value?.querySelectorAll("glide-core-tag");if(t&&this.selectedOptions.length>0){const i=[...t].findIndex((t=>t.dataset.id===e)),s=t[i<t.length-1?i+1:i-1];await this.updateComplete,setTimeout((()=>{s?.focus(),this.#oe=!1}))}else setTimeout((()=>{this.focus(),this.#oe=!1}));this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}#ue(){ow(this.#Q.value,ow.object.instanceOf(GlideCoreDropdownOption)),this.#ae=!0;for(const e of this.#d)e.selected=this.#Q.value.selected;this.#ae=!1}async#h(){if(this.#E.value){const e=this.#E.value.scrollWidth>this.#E.value.clientWidth;e&&this.tagOverflowLimit>1?(this.tagOverflowLimit=this.tagOverflowLimit-1,await this.updateComplete,this.#h()):!e&&!this.#ne&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#ne=!0,await this.updateComplete,this.#h()):this.#ne=!1}}#i(){this.#pe?.(),this.#de&&(this.#de.privateActive=!0,this.ariaActivedescendant=this.#de.id),this.#k.value&&this.#O.value&&(this.#pe=autoUpdate(this.#k.value,this.#O.value,(()=>{(async()=>{if(this.#k.value&&this.#O.value){const{x:e,y:t,placement:i}=await computePosition(this.#k.value,this.#O.value,{placement:"bottom-start",middleware:[offset({mainAxis:Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}),flip()]});this.#O.value.dataset.placement=i,Object.assign(this.#O.value.style,{left:`${e}px`,top:`${t}px`}),this.#O.value?.showPopover()}})()})))}#l(){if((this.filterable||this.isFilterable)&&this.#o.value){this.isFiltering=!1;for(const e of this.#d)e.hidden=!1}}};__decorate([property({attribute:"add-button-label",reflect:!0})],GlideCoreDropdown.prototype,"addButtonLabel",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"disabled",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"filterable",null),__decorate([property({attribute:"hide-label",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"name",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"open",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"placeholder",void 0),__decorate([property()],GlideCoreDropdown.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"readonly",void 0),__decorate([property({attribute:"select-all",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"selectAll",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"size",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"multiple",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"required",void 0),__decorate([property({type:Array})],GlideCoreDropdown.prototype,"value",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"variant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"ariaActivedescendant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFilterable",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFiltering",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelTooltipOpen",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isOptionsAndFooterHidden",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isShowSingleSelectIcon",void 0),__decorate([state()],GlideCoreDropdown.prototype,"tagOverflowLimit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"validityMessage",void 0),GlideCoreDropdown=__decorate([customElement("glide-core-dropdown")],GlideCoreDropdown);export default GlideCoreDropdown;
277
+ </div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#u.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#u.setValidity({customError:!1},"",this.filterable||this.isFilterable?this.#o.value:this.#v.value):this.#u.setValidity({customError:!0,valueMissing:this.#u.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#o.value:this.#v.value)}setValidity(e,t){this.validityMessage=t,this.#u.setValidity(e," ",this.filterable||this.isFilterable?this.#o.value:this.#v.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.readonly=!1,this.selectAll=!1,this.required=!1,this.ariaActivedescendant="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isCommunicateItemCountToScreenreaders=!1,this.isFilterable=!1,this.isFiltering=!1,this.isInternalLabelOverflow=!1,this.isInternalLabelTooltipOpen=!1,this.isNoResults=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.itemCount=0,this.tagOverflowLimit=0,this.#ie=createRef(),this.#E=createRef(),this.#b=createRef(),this.#I=createRef(),this.#z=createRef(),this.#o=createRef(),this.#w=createRef(),this.#se=!1,this.#e=!1,this.#oe=!1,this.#s=!1,this.#d=!1,this.#n=!1,this.#le=!1,this.#ne=!1,this.#ae=!1,this.#re=!1,this.#V=new LocalizeController(this),this.#O=createRef(),this.#v=createRef(),this.#X=createRef(),this.#r="large",this.#k=createRef(),this.#c=[],this.#m=()=>{this.#se?setTimeout((()=>{this.#se=!1})):this.open=!1},this.#g=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#u=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#ie;#pe;#E;#b;#I;#z;#o;#w;#u;#se;#e;#oe;#s;#d;#n;#le;#ne;#ae;#re;#V;#O;#de;#v;#X;#f;#r;#k;#c;#m;#g;#t(){this.#pe?.(),this.#O.value?.hidePopover(),this.ariaActivedescendant="",this.activeOption&&(this.#de=this.activeOption,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1)}get#R(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#Z(){this.open=!1,this.dispatchEvent(new Event("add",{bubbles:!0,composed:!0}))}#ee(){this.activeOption&&(this.activeOption.privateIsOpenTooltip=!1,this.#de=this.activeOption,this.activeOption.privateActive=!1)}#te(){this.activeOption&&!this.#le&&(this.#de=this.activeOption,this.activeOption.privateActive=!1)}#y(){this.#se=!0}#Y(){owSlotType(this.#b.value,[GlideCoreDropdownOption,Text]),this.isFilterable=this.#a.length>10,this.tagOverflowLimit=this.selectedOptions.length;for(const e of this.#a)e.privateSize=this.size,e.privateMultiple=this.multiple;const e=this.#he?.at(0);!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.#de=this.lastSelectedOption,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(this.#de=e,this.ariaActivedescendant=this.open?e.id:"",e.privateActive=!0),this.#X.value&&(this.#X.value.selected=this.isAllSelected),this.multiple?this.#c=this.selectedOptions.filter((e=>Boolean(e.value))).map((({value:e})=>e)):this.lastSelectedOption?.value&&(this.#c=[this.lastSelectedOption.value]),this.requestUpdate(),this.updateComplete.then((()=>{!this.multiple&&this.#o.value&&this.lastSelectedOption?.value&&(this.#o.value.value=this.lastSelectedOption.label)}))}#A(e){this.open&&this.#de&&e.relatedTarget===this.#ie.value&&(this.#de.privateActive=!0,this.#de.privateIsOpenTooltip=!this.#de.editable)}#C(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#f?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#oe&&(this.open=!1,this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}#S(e){if(this.disabled||this.readonly)return;if(("Enter"===e.key||" "===e.key)&&e.target===this.#z.value)return void(this.#se=!0);if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if(this.open&&"ArrowUp"===e.key&&this.#f?.activeElement===this.#ie.value)return this.focus(),void(this.#de&&(this.#de.privateActive=!0,this.#de.privateIsEditActive=this.#de.editable,this.#de.privateIsOpenTooltip=!this.#de.privateIsEditActive));if(this.open&&"ArrowDown"===e.key&&this.#f?.activeElement===this.#ie.value)return void e.preventDefault();if(this.open&&"ArrowDown"===e.key&&this.addButtonLabel&&this.activeOption===this.#ce?.at(-1)&&(!this.activeOption?.editable||this.activeOption?.privateIsEditActive))return e.preventDefault(),this.activeOption&&(this.#de=this.activeOption,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1),void this.#ie.value?.focus();if("Escape"===e.key)return e.preventDefault(),this.open=!1,void(this.#f?.activeElement===this.#ie.value&&this.focus());const t=e.target===this.#v.value||e.target===this.#o.value||e.target instanceof GlideCoreDropdownOption;if(!this.multiple||t){if(!this.open&&[" ","ArrowUp","ArrowDown"].includes(e.key))return e.preventDefault(),this.open=!0,void(this.activeOption&&(this.activeOption.privateIsOpenTooltip=!this.activeOption.privateIsEditActive));if(this.activeOption&&this.open){if("Enter"===e.key||" "===e.key){if(this.activeOption.privateIsEditActive)return this.activeOption.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if("Enter"===e.key&&this.#ce&&this.#ce.length>0||" "===e.key&&!this.filterable&&!this.isFilterable)return this.#re=!0,e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#X.value&&this.#ue(),this.#re=!1,this.#l(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new Event("input",{bubbles:!0}))}const t=this.#he?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#he&&"number"==typeof t){e.preventDefault();const i=this.#he.at(t-1);return void(this.activeOption?.privateIsEditActive?(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!0):i&&0!==t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#de=i,i.privateActive=!0,i.privateIsEditActive=i.editable,i.privateIsOpenTooltip=!i.editable,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#he&&"number"==typeof t){e.preventDefault();const i=this.#he.at(t+1);return void(this.activeOption.editable&&!this.activeOption.privateIsEditActive?(this.activeOption.privateIsEditActive=!0,this.activeOption.privateIsOpenTooltip=!1):i&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#de=i,i.privateActive=!0,i.privateIsOpenTooltip=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#he){e.preventDefault();const t=this.#he.at(0);return void(t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#de=t,t.privateActive=!0,t.privateIsOpenTooltip=!0,t.scrollIntoView({block:"nearest"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#he){e.preventDefault();const t=this.#he.at(-1);return void(t&&this.activeOption&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#de=t,t.privateActive=!0,t.privateIsOpenTooltip=!0,t.scrollIntoView({block:"nearest"})))}}}}#$(e){if(!this.disabled&&!this.readonly)if(this.#oe)this.#oe=!1;else if(e.target instanceof Node&&this.#z.value?.contains(e.target))this.selectedOptions[0].dispatchEvent(new Event("edit",{bubbles:!0,composed:!0}));else{if(this.#re||!this.open)return 0!==e.detail?(this.open=!0,this.focus(),this.#le=!0,void setTimeout((()=>{this.#le=!1}))):void 0;this.open=!1}}#D(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#o.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}#M(){this.open=!1}get#a(){return this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption))??[]}get#p(){const e=this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption));if(e&&this.#X.value)return[this.#X.value,...e]}get#ce(){return this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#he(){const e=this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#X.value&&!this.#X.value.hidden&&e?[this.#X.value,...e]:e}#L(){this.#o.value?.select()}#_(){this.isCommunicateItemCountToScreenreaders=!1}async#B(e){let t;ow(this.#o.value,ow.object.instanceOf(HTMLInputElement)),e.stopPropagation(),this.open=!0,this.isShowSingleSelectIcon=!1,this.multiple&&""!==this.#o.value.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#o.value.value&&this.#o.value.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1;try{t=await this.filter(this.#o.value.value)}catch{}if(t){for(const e of this.#a)e.hidden=!t.includes(e);const e=this.#ce?.at(0);e&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,this.#de=e,this.ariaActivedescendant=e.id,e.privateActive=!0),this.isNoResults=!this.#ce||0===this.#ce.length,this.isCommunicateItemCountToScreenreaders=!0,this.#ce&&(this.itemCount=this.#ce.length)}}#G(e){const t=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1)).at(-1);if(t&&"Backspace"===e.key&&!e.metaKey&&this.multiple&&this.#o.value&&0===this.#o.value.selectionStart)return this.#oe=!0,t.selected=!1,void(this.#oe=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#o.value&&0===this.#o.value.selectionStart){this.#oe=!0;for(const e of i)e.selected=!1;this.#oe=!1}else;}#j(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t instanceof GlideCoreDropdownOption&&t.privateIsEditActive)return t.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if(t&&!t.selected)return t.selected=!0,this.#l(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new Event("input",{bubbles:!0}));if(t?.selected&&!this.multiple)return void(this.open=!1)}}#K(){this.requestUpdate()}#U(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0,this.#de=e.target)}#H(e){e.stopPropagation(),e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#X.value&&this.#ue(),this.#l(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}#W(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))):this.#o.value?this.#o.value.value=this.selectedOptions[0].label:this.requestUpdate())}#q(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#P(e){e.target instanceof GlideCoreDropdownOption&&this.#he&&(this.activeOption&&(this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1),this.ariaActivedescendant=e.target.id,this.#de=e.target,e.target.privateActive=!0,e.target.privateIsEditActive=!1,this.#f?.activeElement===this.#ie.value&&this.focus())}#J(e){e.target!==this.#X.value&&!this.#ae&&this.#X.value&&(this.#X.value.selected=this.isAllSelected),this.isFiltering=!1,this.isShowSingleSelectIcon=!this.multiple&&this.selectedOptions.length>0&&Boolean(this.selectedOptions.at(0)?.value),e.target instanceof GlideCoreDropdownOption&&(this.multiple?(this.#c=e.target.selected&&e.target.value?[...this.value,e.target.value]:this.value.filter((t=>e.target instanceof GlideCoreDropdownOption&&t!==e.target.value)),this.#o.value&&!this.#oe&&(this.#o.value.value="")):!this.multiple&&e.target.selected&&(this.#c=e.target.value?[e.target.value]:[],this.#o.value&&(this.#o.value.value=e.target.label))),this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))}#Q(e){e.target instanceof GlideCoreDropdownOption&&this.multiple&&e.target.selected&&e.detail.new?this.#c=this.value.map((t=>t===e.detail.old?e.detail.new:t)):e.target instanceof GlideCoreDropdownOption&&this.multiple?this.#c=this.value.filter((t=>t!==e.detail.old)):e.target instanceof GlideCoreDropdownOption&&(this.#c=e.detail.new?[e.detail.new]:[])}#N(){this.isInternalLabelTooltipOpen=!0}#x(){this.isInternalLabelTooltipOpen=!1}#F(){this.#oe=!0,this.open=!1}async#T(e){this.#oe=!0;for(const t of this.#a)t.id===e&&(t.selected=!1,this.#c=this.value.filter((e=>e!==t.value)));const t=this.#k.value?.querySelectorAll("glide-core-tag");if(t&&this.selectedOptions.length>0){const i=[...t].findIndex((t=>t.dataset.id===e)),s=t[i<t.length-1?i+1:i-1];await this.updateComplete,setTimeout((()=>{s?.focus(),this.#oe=!1}))}else setTimeout((()=>{this.focus(),this.#oe=!1}));this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}#ue(){ow(this.#X.value,ow.object.instanceOf(GlideCoreDropdownOption)),this.#ae=!0;for(const e of this.#a)e.selected=this.#X.value.selected;this.#ae=!1}async#h(){if(this.#E.value){const e=this.#E.value.scrollWidth>this.#E.value.clientWidth;e&&this.tagOverflowLimit>1?(this.tagOverflowLimit=this.tagOverflowLimit-1,await this.updateComplete,this.#h()):!e&&!this.#ne&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#ne=!0,await this.updateComplete,this.#h()):this.#ne=!1}}#i(){this.#pe?.(),this.#de&&(this.#de.privateActive=!0,this.ariaActivedescendant=this.#de.id),this.#I.value&&this.#O.value&&(this.#pe=autoUpdate(this.#I.value,this.#O.value,(()=>{(async()=>{if(this.#I.value&&this.#O.value){const{x:e,y:t,placement:i}=await computePosition(this.#I.value,this.#O.value,{placement:"bottom-start",middleware:[offset({mainAxis:Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}),flip()]});this.#O.value.dataset.placement=i,Object.assign(this.#O.value.style,{left:`${e}px`,top:`${t}px`}),this.#O.value?.showPopover()}})()})))}#l(){if((this.filterable||this.isFilterable)&&this.#o.value){this.isFiltering=!1;for(const e of this.#a)e.hidden=!1}}};__decorate([property({attribute:"add-button-label",reflect:!0})],GlideCoreDropdown.prototype,"addButtonLabel",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"disabled",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"filterable",null),__decorate([property({attribute:"hide-label",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"name",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"open",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"placeholder",void 0),__decorate([property()],GlideCoreDropdown.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"readonly",void 0),__decorate([property({attribute:"select-all",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"selectAll",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"size",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"multiple",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"required",void 0),__decorate([property({type:Array})],GlideCoreDropdown.prototype,"value",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"variant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"ariaActivedescendant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCommunicateItemCountToScreenreaders",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFilterable",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFiltering",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelTooltipOpen",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isNoResults",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isShowSingleSelectIcon",void 0),__decorate([state()],GlideCoreDropdown.prototype,"itemCount",void 0),__decorate([state()],GlideCoreDropdown.prototype,"tagOverflowLimit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"validityMessage",void 0),GlideCoreDropdown=__decorate([customElement("glide-core-dropdown")],GlideCoreDropdown);export default GlideCoreDropdown;
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,i,o){var l,s=arguments.length,r=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(r=(s<3?l(r):s>3?l(t,i,r):l(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};import"./checkbox.js";import"./tooltip.js";import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{nanoid}from"nanoid";import{when}from"lit/directives/when.js";import checkedIcon from"./icons/checked.js";import pencilIcon from"./icons/pencil.js";import styles from"./dropdown.option.styles.js";let GlideCoreDropdownOption=class GlideCoreDropdownOption extends LitElement{constructor(){super(...arguments),this.privateIndeterminate=!1,this.privateIsEditActive=!1,this.privateMultiple=!1,this.privateSize="large",this.privateActive=!1,this.privateIsOpenTooltip=!1,this.isLabelOverflow=!1,this.#e=createRef(),this.#t=createRef(),this.#i=nanoid(),this.#o=!1,this.#l="",this.#s=createRef(),this.#r=!1,this.#a=""}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get editable(){return this.#o}set editable(e){this.#o=e,this.dispatchEvent(new Event("private-editable-change",{bubbles:!0}))}get label(){return this.#l}set label(e){this.#l=e,setTimeout((()=>{this.#n()})),this.dispatchEvent(new Event("private-label-change",{bubbles:!0}))}get selected(){return this.#r}set selected(e){if(this.#r=e,this.ariaSelected=e.toString(),this.isMultiple)this.#e.value&&(this.#e.value.checked=e);else for(const e of this.#c)e!==this&&this.selected&&e.selected&&(e.selected=!1);this.dispatchEvent(new Event("private-selected-change",{bubbles:!0}))}get isMultiple(){return this.privateMultiple||this.closest("glide-core-dropdown")?.multiple}click(){this.privateMultiple?this.#e.value?.click():this.#t.value?.click()}connectedCallback(){super.connectedCallback(),this.id=this.#i,this.ariaSelected=this.selected.toString(),this.role="option",this.tabIndex=-1,this.#p=new IntersectionObserver((()=>{this.checkVisibility()&&this.#n()})),this.#p.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#p?.disconnect()}firstUpdated(){this.#e.value&&(this.#e.value.checked=this.selected)}get value(){return this.#a}set value(e){this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:this.value,new:e}})),this.#a=e}async privateUpdateCheckbox(){await this.updateComplete,this.#e.value&&(this.#e.value.checked=this.selected)}render(){return html`<div class="${classMap({component:!0,active:this.privateActive,[this.privateSize]:!0})}" data-test="component" ${ref(this.#t)}>${when(this.isMultiple,(()=>html`<glide-core-checkbox class="${classMap({checkbox:!0,editable:this.editable,[this.privateSize]:!0})}" data-test="checkbox" label="${this.label??""}" tabindex="-1" private-label-tooltip-offset="${12}" private-size="${this.privateSize}" private-variant="minimal" value="${this.value}" internally-inert @click="${this.#d}" ?indeterminate="${this.privateIndeterminate}" ?private-show-label-tooltip="${this.privateIsOpenTooltip}" ${ref(this.#e)}><slot class="checkbox-icon-slot" name="icon" slot="private-icon"></slot></glide-core-checkbox>${when(this.editable,(()=>html`<button class="${classMap({"edit-button":!0,active:this.privateIsEditActive,multiple:Boolean(this.isMultiple),[this.privateSize]:!0})}" data-test="edit-button" type="button" @mouseover="${this.#h}" @mouseout="${this.#v}">${pencilIcon}</button>`))}`),(()=>html`<div class="${classMap({option:!0,editable:this.editable,[this.privateSize]:!0})}"><slot class="icon-slot" name="icon"></slot><glide-core-tooltip class="tooltip" offset="${10}" ?disabled="${!this.isLabelOverflow}" ?open="${this.privateIsOpenTooltip}"><div aria-hidden="true" data-test="tooltip">${this.label}</div><div class="label" data-test="label" slot="target" ${ref(this.#s)}>${this.label}</div></glide-core-tooltip>${when(this.selected,(()=>html`<div class="checked-icon-container" data-test="checked-icon-container">${checkedIcon}</div>`))} ${when(this.editable,(()=>html`<button class="${classMap({"edit-button":!0,active:this.privateActive&&this.privateIsEditActive,[this.privateSize]:!0})}" data-test="edit-button" type="button" @mouseover="${this.#h}" @mouseout="${this.#v}">${pencilIcon}</button>`))}</div>`))}</div>`}#e;#t;#i;#p;#o;#l;#s;#r;#a;get#c(){return[...this.closest("glide-core-dropdown")?.querySelectorAll("glide-core-dropdown-option")??[]]}#d(e){e.stopPropagation()}#v(){this.privateIsEditActive=!1}#h(){this.privateIsEditActive=!0}#n(){this.#s.value&&(this.isLabelOverflow=this.#s.value.scrollWidth>this.#s.value.clientWidth)}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"editable",null),__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"label",null),__decorate([property({attribute:"private-indeterminate",type:Boolean})],GlideCoreDropdownOption.prototype,"privateIndeterminate",void 0),__decorate([property({type:Boolean})],GlideCoreDropdownOption.prototype,"privateIsEditActive",void 0),__decorate([property({attribute:"private-multiple",type:Boolean})],GlideCoreDropdownOption.prototype,"privateMultiple",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"selected",null),__decorate([property({attribute:"private-size",reflect:!0})],GlideCoreDropdownOption.prototype,"privateSize",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"privateActive",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"isMultiple",null),__decorate([state()],GlideCoreDropdownOption.prototype,"privateIsOpenTooltip",void 0),__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"value",null),__decorate([state()],GlideCoreDropdownOption.prototype,"isLabelOverflow",void 0),GlideCoreDropdownOption=__decorate([customElement("glide-core-dropdown-option")],GlideCoreDropdownOption);export default GlideCoreDropdownOption;
1
+ var __decorate=this&&this.__decorate||function(e,t,i,o){var l,s=arguments.length,r=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(r=(s<3?l(r):s>3?l(t,i,r):l(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};import"./checkbox.js";import"./tooltip.js";import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{nanoid}from"nanoid";import{when}from"lit/directives/when.js";import checkedIcon from"./icons/checked.js";import pencilIcon from"./icons/pencil.js";import styles from"./dropdown.option.styles.js";let GlideCoreDropdownOption=class GlideCoreDropdownOption extends LitElement{constructor(){super(...arguments),this.privateIndeterminate=!1,this.privateIsEditActive=!1,this.privateMultiple=!1,this.privateSize="large",this.privateActive=!1,this.privateIsOpenTooltip=!1,this.isLabelOverflow=!1,this.#e=createRef(),this.#t=createRef(),this.#i=nanoid(),this.#o=!1,this.#l="",this.#s=createRef(),this.#r=!1,this.#a=""}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get editable(){return this.#o}set editable(e){this.#o=e,this.dispatchEvent(new Event("private-editable-change",{bubbles:!0}))}get label(){return this.#l}set label(e){this.#l=e,setTimeout((()=>{this.#n()})),this.dispatchEvent(new Event("private-label-change",{bubbles:!0}))}get selected(){return this.#r}set selected(e){if(this.#r=e,this.ariaSelected=e.toString(),this.isMultiple)this.#e.value&&(this.#e.value.checked=e);else for(const e of this.#c)e!==this&&this.selected&&e.selected&&(e.selected=!1);this.dispatchEvent(new Event("private-selected-change",{bubbles:!0}))}get isMultiple(){return this.privateMultiple||this.closest("glide-core-dropdown")?.multiple}click(){this.privateMultiple?this.#e.value?.click():this.#t.value?.click()}connectedCallback(){super.connectedCallback(),this.id=this.#i,this.ariaSelected=this.selected.toString(),this.role="option",this.tabIndex=-1,this.#p=new IntersectionObserver((()=>{this.checkVisibility()&&this.#n()})),this.#p.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#p?.disconnect()}firstUpdated(){this.#e.value&&(this.#e.value.checked=this.selected)}get value(){return this.#a}set value(e){this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:this.value,new:e}})),this.#a=e}async privateUpdateCheckbox(){await this.updateComplete,this.#e.value&&(this.#e.value.checked=this.selected)}render(){return html`<div class="${classMap({component:!0,active:this.privateActive,[this.privateSize]:!0})}" data-test="component" ${ref(this.#t)}>${when(this.isMultiple,(()=>html`<glide-core-checkbox class="${classMap({checkbox:!0,editable:this.editable,[this.privateSize]:!0})}" data-test="checkbox" label="${this.label??""}" tabindex="-1" private-label-tooltip-offset="${12}" private-size="${this.privateSize}" private-variant="minimal" value="${this.value}" internally-inert @click="${this.#d}" ?indeterminate="${this.privateIndeterminate}" ?private-show-label-tooltip="${this.privateIsOpenTooltip}" ${ref(this.#e)}><slot class="${classMap({"checkbox-icon-slot":!0,[this.privateSize]:!0})}" name="icon" slot="private-icon"></slot></glide-core-checkbox>${when(this.editable,(()=>html`<button class="${classMap({"edit-button":!0,active:this.privateIsEditActive,multiple:Boolean(this.isMultiple),[this.privateSize]:!0})}" data-test="edit-button" type="button" @mouseover="${this.#h}" @mouseout="${this.#v}">${pencilIcon}</button>`))}`),(()=>html`<div class="${classMap({option:!0,editable:this.editable,[this.privateSize]:!0})}"><slot class="${classMap({"icon-slot":!0,[this.privateSize]:!0})}" name="icon"></slot><glide-core-tooltip class="tooltip" offset="${10}" ?disabled="${!this.isLabelOverflow}" ?open="${this.privateIsOpenTooltip}"><div aria-hidden="true" data-test="tooltip">${this.label}</div><div class="label" data-test="label" slot="target" ${ref(this.#s)}>${this.label}</div></glide-core-tooltip>${when(this.selected,(()=>html`<div class="checked-icon-container" data-test="checked-icon-container">${checkedIcon}</div>`))} ${when(this.editable,(()=>html`<button class="${classMap({"edit-button":!0,active:this.privateActive&&this.privateIsEditActive,[this.privateSize]:!0})}" data-test="edit-button" type="button" @mouseover="${this.#h}" @mouseout="${this.#v}">${pencilIcon}</button>`))}</div>`))}</div>`}#e;#t;#i;#p;#o;#l;#s;#r;#a;get#c(){return[...this.closest("glide-core-dropdown")?.querySelectorAll("glide-core-dropdown-option")??[]]}#d(e){e.stopPropagation()}#v(){this.privateIsEditActive=!1}#h(){this.privateIsEditActive=!0}#n(){this.#s.value&&(this.isLabelOverflow=this.#s.value.scrollWidth>this.#s.value.clientWidth)}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"editable",null),__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"label",null),__decorate([property({attribute:"private-indeterminate",type:Boolean})],GlideCoreDropdownOption.prototype,"privateIndeterminate",void 0),__decorate([property({type:Boolean})],GlideCoreDropdownOption.prototype,"privateIsEditActive",void 0),__decorate([property({attribute:"private-multiple",type:Boolean})],GlideCoreDropdownOption.prototype,"privateMultiple",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"selected",null),__decorate([property({attribute:"private-size",reflect:!0})],GlideCoreDropdownOption.prototype,"privateSize",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"privateActive",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"isMultiple",null),__decorate([state()],GlideCoreDropdownOption.prototype,"privateIsOpenTooltip",void 0),__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"value",null),__decorate([state()],GlideCoreDropdownOption.prototype,"isLabelOverflow",void 0),GlideCoreDropdownOption=__decorate([customElement("glide-core-dropdown-option")],GlideCoreDropdownOption);export default GlideCoreDropdownOption;
@@ -27,7 +27,7 @@ import{css}from"lit";export default[css`
27
27
  font-style: var(--glide-core-body-sm-font-style);
28
28
  font-weight: var(--glide-core-body-sm-font-weight);
29
29
  line-height: var(--glide-core-body-sm-line-height);
30
- padding-inline-start: var(--glide-core-spacing-sm);
30
+ padding-inline-start: 0.625rem;
31
31
 
32
32
  &:not(.editable) {
33
33
  padding-inline-end: var(--glide-core-spacing-sm);
@@ -40,7 +40,7 @@ import{css}from"lit";export default[css`
40
40
  font-style: var(--glide-core-body-xs-font-style);
41
41
  font-weight: var(--glide-core-body-xs-font-weight);
42
42
  line-height: var(--glide-core-body-xs-line-height);
43
- padding-inline-start: var(--glide-core-spacing-xs);
43
+ padding-inline-start: var(--glide-core-spacing-sm);
44
44
 
45
45
  &:not(.editable) {
46
46
  padding-inline-end: var(--glide-core-spacing-xs);
@@ -86,17 +86,47 @@ import{css}from"lit";export default[css`
86
86
  }
87
87
 
88
88
  .icon-slot {
89
+ &.large {
90
+ &::slotted(*) {
91
+ block-size: 1rem;
92
+ inline-size: 1rem;
93
+ }
94
+ }
95
+
96
+ &.small {
97
+ &::slotted(*) {
98
+ block-size: 0.75rem;
99
+ inline-size: 0.75rem;
100
+ }
101
+ }
102
+
89
103
  &::slotted(*) {
90
- display: block;
104
+ align-items: center;
105
+ display: flex;
91
106
  padding-inline-end: var(--glide-core-spacing-xs);
92
107
  }
93
108
  }
94
109
 
95
110
  .checkbox-icon-slot {
111
+ &.large {
112
+ &::slotted(*) {
113
+ block-size: 1rem;
114
+ inline-size: 1rem;
115
+ }
116
+ }
117
+
118
+ &.small {
119
+ &::slotted(*) {
120
+ block-size: 0.75rem;
121
+ inline-size: 0.75rem;
122
+ }
123
+ }
124
+
96
125
  &::slotted(*) {
97
- block-size: 1rem;
98
- display: block;
99
- inline-size: 1rem;
126
+ align-items: center;
127
+ block-size: 0.75rem;
128
+ display: flex;
129
+ inline-size: 0.75rem;
100
130
  }
101
131
  }
102
132