@crowdstrike/glide-core 0.23.0 → 0.24.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.
- package/dist/accordion.styles.js +22 -21
- package/dist/button-group.button.styles.js +46 -22
- package/dist/button-group.styles.js +7 -7
- package/dist/button.d.ts +3 -0
- package/dist/button.js +1 -1
- package/dist/button.styles.js +62 -42
- package/dist/checkbox-group.styles.js +5 -5
- package/dist/checkbox.js +9 -3
- package/dist/checkbox.styles.js +46 -28
- package/dist/drawer.styles.js +6 -4
- package/dist/dropdown.js +1 -1
- package/dist/dropdown.option.styles.js +26 -28
- package/dist/dropdown.styles.js +64 -58
- package/dist/icon-button.styles.js +44 -23
- package/dist/inline-alert.js +1 -1
- package/dist/inline-alert.styles.js +24 -21
- package/dist/input.styles.js +33 -25
- package/dist/label.styles.js +22 -27
- package/dist/menu.button.styles.js +6 -4
- package/dist/menu.js +1 -1
- package/dist/menu.link.styles.js +6 -4
- package/dist/menu.options.styles.js +12 -16
- package/dist/menu.styles.js +9 -6
- package/dist/modal.styles.js +16 -13
- package/dist/popover.js +1 -1
- package/dist/popover.styles.js +14 -14
- package/dist/radio-group.radio.styles.js +31 -11
- package/dist/radio-group.styles.js +8 -10
- package/dist/split-button.primary-button.styles.js +41 -26
- package/dist/split-button.secondary-button.styles.js +61 -21
- package/dist/styles/focus-outline.js +1 -1
- package/dist/styles/variables.css +1 -1
- package/dist/tab.group.styles.js +6 -5
- package/dist/tab.panel.styles.js +1 -1
- package/dist/tab.styles.js +7 -7
- package/dist/tag.styles.js +27 -26
- package/dist/textarea.styles.js +22 -18
- package/dist/toasts.styles.js +2 -2
- package/dist/toasts.toast.styles.js +20 -20
- package/dist/toggle.styles.js +15 -7
- package/dist/tooltip.container.styles.js +14 -13
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.styles.js +1 -1
- package/package.json +8 -9
- package/dist/library/get-parent-class-name.d.ts +0 -3
- package/dist/library/get-parent-class-name.js +0 -1
package/dist/checkbox.styles.js
CHANGED
@@ -8,27 +8,23 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
8
8
|
line-height: 100%;
|
9
9
|
|
10
10
|
&.large {
|
11
|
-
column-gap: var(--glide-core-spacing-sm);
|
12
|
-
font-family: var(--glide-core-
|
13
|
-
font-size: var(--glide-core-
|
14
|
-
font-
|
15
|
-
font-variant: var(--glide-core-body-sm-font-variant);
|
16
|
-
font-weight: var(--glide-core-body-sm-font-weight);
|
11
|
+
column-gap: var(--glide-core-spacing-base-sm);
|
12
|
+
font-family: var(--glide-core-typography-family-primary);
|
13
|
+
font-size: var(--glide-core-typography-size-body-default);
|
14
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
17
15
|
}
|
18
16
|
|
19
17
|
&.small {
|
20
|
-
column-gap: var(--glide-core-spacing-xs);
|
21
|
-
font-family: var(--glide-core-
|
22
|
-
font-size: var(--glide-core-
|
23
|
-
font-
|
24
|
-
font-variant: var(--glide-core-body-xs-font-variant);
|
25
|
-
font-weight: var(--glide-core-body-xs-font-weight);
|
18
|
+
column-gap: var(--glide-core-spacing-base-xs);
|
19
|
+
font-family: var(--glide-core-typography-family-primary);
|
20
|
+
font-size: var(--glide-core-typography-size-body-small);
|
21
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
26
22
|
}
|
27
23
|
}
|
28
24
|
|
29
25
|
.input-and-checkbox-and-summary {
|
30
26
|
display: flex;
|
31
|
-
gap: var(--glide-core-spacing-sm);
|
27
|
+
gap: var(--glide-core-spacing-base-sm);
|
32
28
|
}
|
33
29
|
|
34
30
|
.input-and-checkbox {
|
@@ -46,11 +42,16 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
46
42
|
|
47
43
|
.checkbox {
|
48
44
|
align-items: center;
|
45
|
+
background-color: var(
|
46
|
+
--glide-core-private-color-checkbox-surface-background-idle
|
47
|
+
);
|
49
48
|
block-size: 100%;
|
50
|
-
border: 1px solid var(--glide-core-
|
51
|
-
border-radius:
|
49
|
+
border: 1px solid var(--glide-core-color-interactive-stroke-contrast);
|
50
|
+
border-radius: var(--glide-core-rounding-base-radius-xs);
|
52
51
|
box-sizing: border-box;
|
53
|
-
color: var(
|
52
|
+
color: var(
|
53
|
+
--glide-core-private-color-checkbox-surface-background-selected--default
|
54
|
+
);
|
54
55
|
display: flex;
|
55
56
|
flex-shrink: 0; /* Don't shrink when the summary wraps. */
|
56
57
|
inline-size: 100%;
|
@@ -63,11 +64,11 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
63
64
|
}
|
64
65
|
|
65
66
|
&.error:not(.disabled) {
|
66
|
-
border-color: var(--glide-core-
|
67
|
+
border-color: var(--glide-core-color-error-stroke-primary);
|
67
68
|
}
|
68
69
|
|
69
70
|
&:not(.disabled):hover {
|
70
|
-
box-shadow: var(--glide-core-
|
71
|
+
box-shadow: var(--glide-core-effect-hovered);
|
71
72
|
}
|
72
73
|
}
|
73
74
|
|
@@ -82,8 +83,8 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
82
83
|
position: absolute;
|
83
84
|
|
84
85
|
&:not(:disabled):hover ~ .checkbox {
|
85
|
-
border-color: var(--glide-core-
|
86
|
-
box-shadow: var(--glide-core-
|
86
|
+
border-color: var(--glide-core-color-interactive-stroke-focus);
|
87
|
+
box-shadow: var(--glide-core-effect-hovered);
|
87
88
|
}
|
88
89
|
|
89
90
|
&:checked:not(:indeterminate) ~ .checkbox .checked-icon {
|
@@ -95,18 +96,31 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
95
96
|
}
|
96
97
|
|
97
98
|
&:disabled:not(:is(:checked, :indeterminate)) ~ .checkbox {
|
98
|
-
background-color: var(
|
99
|
-
|
99
|
+
background-color: var(
|
100
|
+
--glide-core-private-color-checkbox-surface-background-idle
|
101
|
+
);
|
102
|
+
border-color: var(
|
103
|
+
--glide-core-private-color-checkbox-icon-default--disabled
|
104
|
+
);
|
100
105
|
}
|
101
106
|
|
102
107
|
&:is(:checked, :indeterminate):not(:disabled) ~ .checkbox {
|
103
|
-
background-color: var(--glide-core-
|
108
|
+
background-color: var(--glide-core-color-interactive-icon-active);
|
104
109
|
border-color: transparent;
|
105
110
|
}
|
106
111
|
|
107
112
|
&:is(:checked, :indeterminate):disabled ~ .checkbox {
|
108
|
-
background-color: var(
|
113
|
+
background-color: var(
|
114
|
+
--glide-core-private-color-checkbox-icon-default--disabled
|
115
|
+
);
|
109
116
|
border-color: transparent;
|
117
|
+
|
118
|
+
.indeterminate-icon {
|
119
|
+
fill: var(--glide-core-private-color-checkbox-icon-default--disabled);
|
120
|
+
stroke: var(
|
121
|
+
--glide-core-private-color-checkbox-icon-default--disabled
|
122
|
+
);
|
123
|
+
}
|
110
124
|
}
|
111
125
|
|
112
126
|
&:checked ~ .checkbox > .checked-icon {
|
@@ -162,13 +176,13 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
162
176
|
|
163
177
|
.indeterminate-icon {
|
164
178
|
display: none;
|
165
|
-
fill: var(--glide-core-icon-active);
|
166
|
-
stroke: var(--glide-core-icon-active);
|
179
|
+
fill: var(--glide-core-color-interactive-icon-active);
|
180
|
+
stroke: var(--glide-core-color-interactive-icon-active);
|
167
181
|
}
|
168
182
|
|
169
183
|
.icon-and-label {
|
170
184
|
align-items: center;
|
171
|
-
column-gap: var(--glide-core-spacing-xs);
|
185
|
+
column-gap: var(--glide-core-spacing-base-xs);
|
172
186
|
display: flex;
|
173
187
|
overflow: hidden;
|
174
188
|
}
|
@@ -183,7 +197,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
183
197
|
white-space: nowrap;
|
184
198
|
|
185
199
|
&.disabled {
|
186
|
-
color: var(--glide-core-icon-
|
200
|
+
color: var(--glide-core-color-interactive-icon-default--disabled);
|
187
201
|
}
|
188
202
|
}
|
189
203
|
|
@@ -195,6 +209,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
195
209
|
}
|
196
210
|
}
|
197
211
|
|
212
|
+
.summary.disabled {
|
213
|
+
color: var(--glide-core-color-interactive-text-default--disabled);
|
214
|
+
}
|
215
|
+
|
198
216
|
.validity-message {
|
199
217
|
display: block;
|
200
218
|
}
|
package/dist/drawer.styles.js
CHANGED
@@ -5,12 +5,15 @@ import{css}from"lit";export default[css`
|
|
5
5
|
}
|
6
6
|
|
7
7
|
.component {
|
8
|
-
background-color: var(
|
8
|
+
background-color: var(
|
9
|
+
--glide-core-private-color-template-surface-container-detail
|
10
|
+
);
|
9
11
|
block-size: 0;
|
10
12
|
border-end-start-radius: 0.625rem;
|
11
13
|
border-start-start-radius: 0.625rem;
|
12
|
-
box-shadow:
|
13
|
-
|
14
|
+
box-shadow: 0 4px 60px 0
|
15
|
+
var(--glide-core-color-effect-color-elevation-detail-panel);
|
16
|
+
font-family: var(--glide-core-typography-family-primary);
|
14
17
|
inline-size: 0;
|
15
18
|
inset: 0;
|
16
19
|
max-inline-size: 100%;
|
@@ -20,7 +23,6 @@ import{css}from"lit";export default[css`
|
|
20
23
|
visibility: hidden;
|
21
24
|
|
22
25
|
&.pinned {
|
23
|
-
background-color: var(--glide-core-surface-base-xlightest);
|
24
26
|
box-shadow: none;
|
25
27
|
}
|
26
28
|
|
package/dist/dropdown.js
CHANGED
@@ -297,7 +297,7 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var l,o=arguments.length
|
|
297
297
|
>`))}
|
298
298
|
</div>
|
299
299
|
</glide-core-private-label>
|
300
|
-
</div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#v.reportValidity();return this.requestUpdate(),e}resetValidityFeedback(){this.isReportValidityOrSubmit=!1}setCustomValidity(e){this.validityMessage=e,""===e?this.#v.setValidity({customError:!1},"",this.filterable||this.isFilterable?this.#l.value:this.#m.value):this.#v.setValidity({customError:!0,valueMissing:this.#v.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}setValidity(e,t){this.validityMessage=t,this.#v.setValidity(e," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.readonly=!1,this.selectAll=!1,this.required=!1,this.version=packageJson.version,this.ariaActivedescendant="",this.inputValue="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isCommunicateItemCountToScreenreaders=!1,this.isFilterable=!1,this.isFiltering=!1,this.isInputOverflow=!1,this.isInputTooltipOpen=!1,this.isInternalLabelOverflow=!1,this.isInternalLabelTooltipOpen=!1,this.isNoResults=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.itemCount=0,this.tagOverflowLimit=0,this.#ae=createRef(),this.#y=createRef(),this.#se=createRef(),this.#D=createRef(),this.#q=createRef(),this.#l=createRef(),this.#N=createRef(),this.#re=!1,this.#e=!1,this.#pe=!1,this.#s=!1,this.#r=!1,this.#n=!1,this.#de=!1,this.#he=!1,this.#ce=!1,this.#ue=!1,this.#u=!1,this.#M=new LocalizeController(this),this.#O=createRef(),this.#m=createRef(),this.#te=createRef(),this.#d="large",this.#I=createRef(),this.#c=[],this.#f=()=>{this.#re?setTimeout((()=>{this.#re=!1})):this.open=!1},this.#b=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#v=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#ae;#ve;#y;#se;#D;#q;#l;#N;#v;#re;#e;#pe;#s;#r;#n;#de;#he;#ce;#ue;#u;#M;#O;#me;#m;#te;#g;#d;#I;#c;#f;#b;#t(){this.#ve?.(),this.#O.value?.hidePopover(),this.ariaActivedescendant="",this.activeOption&&(this.#me=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1)}get#w(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#le(){this.open=!1,this.dispatchEvent(new Event("add",{bubbles:!0,composed:!0}))}#oe(){this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.#me=this.activeOption,this.activeOption.privateActive=!1)}#ne(){this.activeOption&&!this.#de&&(this.#me=this.activeOption,this.activeOption.privateActive=!1)}#E(){this.#re=!0}async#ie(){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.#fe?.find((e=>!e.disabled));!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.#me=this.lastSelectedOption,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(this.#me=e,this.ariaActivedescendant=this.open?e.id:"",e.privateActive=!0),this.#te.value&&(this.#te.value.selected=this.isAllSelected),this.multiple?this.#c=this.selectedOptions.filter((e=>Boolean(e.value)&&!e.disabled)).map((({value:e})=>e)):this.lastSelectedOption?.value&&!this.lastSelectedOption.disabled&&(this.#c=[this.lastSelectedOption.value]),this.requestUpdate(),await this.updateComplete,!this.multiple&&this.#l.value&&this.lastSelectedOption?.label?(this.#l.value.value=this.lastSelectedOption.label,this.inputValue=this.lastSelectedOption.label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth):!this.multiple&&this.#l.value&&(this.#l.value.value="",this.inputValue="",this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth)}#R(e){this.open&&this.#me&&e.relatedTarget===this.#ae.value&&(this.#me.privateActive=!0,this.#me.privateIsTooltipOpen=!this.#me.editable)}#A(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#g?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#pe&&(this.open=!1,this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}#C(e){if(this.disabled||this.readonly)return;if(("Enter"===e.key||" "===e.key)&&e.target===this.#q.value)return void(this.#re=!0);if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if(this.open&&"ArrowUp"===e.key&&this.#g?.activeElement===this.#ae.value)return this.focus(),void(this.#me&&(this.#me.privateActive=!0,this.#me.privateIsEditActive=this.#me.editable,this.#me.privateIsTooltipOpen=!this.#me.privateIsEditActive));if(this.open&&"ArrowDown"===e.key&&this.#g?.activeElement===this.#ae.value)return void e.preventDefault();if(this.open&&"ArrowDown"===e.key&&this.addButtonLabel&&this.activeOption===this.#ge?.at(-1)&&(!this.activeOption?.editable||this.activeOption?.privateIsEditActive))return e.preventDefault(),this.activeOption&&(this.#me=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),void this.#ae.value?.focus();if("Escape"===e.key)return e.preventDefault(),this.open=!1,void(this.#g?.activeElement===this.#ae.value&&this.focus());const t=e.target===this.#m.value||e.target===this.#l.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.privateIsTooltipOpen=!this.activeOption.privateIsEditActive));if(this.activeOption&&this.open){if("Enter"===e.key||" "===e.key){if(this.activeOption.privateIsEditActive)return this.activeOption.privateEdit(),void(this.open=!1);if("Enter"===e.key&&this.#ge&&this.#ge.length>0||" "===e.key&&!this.filterable&&!this.isFilterable)return this.#ue=!0,e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#te.value&&this.#be(),this.#ue=!1,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}const t=this.#fe?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#fe&&"number"==typeof t){e.preventDefault();const i=this.#fe.findLast(((e,i)=>!e.disabled&&i<t));return void(this.activeOption?.privateIsEditActive?(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!0):i&&0!==t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#me=i,i.privateActive=!0,i.privateIsEditActive=i.editable,i.privateIsTooltipOpen=!i.editable,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#fe&&"number"==typeof t){e.preventDefault();const i=this.#fe.find(((e,i)=>!e.disabled&&i>t));return void(this.activeOption.editable&&!this.activeOption.privateIsEditActive?(this.activeOption.privateIsEditActive=!0,this.activeOption.privateIsTooltipOpen=!1):i&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#me=i,i.privateActive=!0,i.privateIsTooltipOpen=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#fe){e.preventDefault();const t=[...this.#fe].reverse().findLast((e=>!e.disabled));return void(t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#me=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#fe){e.preventDefault();const t=[...this.#fe].findLast((e=>!e.disabled));return void(t&&this.activeOption&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#me=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}}}}#S(e){if(this.disabled||this.readonly)return;if(this.#pe)return void(this.#pe=!1);if(e.target instanceof Node&&this.#q.value?.contains(e.target))return void this.selectedOptions[0]?.privateEdit();const t=this.filterable||this.isFilterable;if(this.#ue||!this.open||t&&!(e.target instanceof Element&&this.#m.value?.contains(e.target)))return 0!==e.detail?(this.open=!0,this.focus(),this.#de=!0,void setTimeout((()=>{this.#de=!1}))):void 0;this.open=!1}#$(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#l.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}#j(){this.open=!1}#_(){this.isCommunicateItemCountToScreenreaders=!1,this.isInputTooltipOpen=!1}#L(){this.#l.value?.select(),this.isInputTooltipOpen=!0}async#G(e){let t;if(e.stopPropagation(),this.open=!0,this.isShowSingleSelectIcon=!1,this.#l.value?.value&&(this.inputValue=this.#l.value.value),this.multiple&&""!==this.#l.value?.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#l.value?.value&&this.#l.value?.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1,this.#l.value)try{t=await this.filter(this.#l.value.value)}catch{}if(t){for(const e of this.#a)e.hidden=!t.includes(e);const e=this.#ge?.at(0);e&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,this.#me=e,this.ariaActivedescendant=e.id,e.privateActive=!0),this.isNoResults=!this.#ge||0===this.#ge.length,this.isCommunicateItemCountToScreenreaders=!0,this.#ge&&(this.itemCount=this.#ge.length)}}#B(e){const t=this.selectedOptions.findLast(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&!e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart)return this.#pe=!0,t.selected=!1,void(this.#pe=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart){this.#pe=!0;for(const e of i)e.selected=!1;this.#pe=!1}else;}#V(){this.#l.value&&(this.isInputOverflow=this.#l.value.scrollWidth-1>this.#l.value.clientWidth)}#z(){this.#N.value&&(this.isInternalLabelOverflow=this.#N.value.scrollWidth>this.#N.value.clientWidth)}get#a(){return this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption))??[]}get#h(){const e=this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption));if(e&&this.#te.value)return[this.#te.value,...e]}get#ge(){return this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#fe(){const e=this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#te.value&&!this.#te.value.hidden&&e?[this.#te.value,...e]:e}#U(e){e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#te.value&&this.#be(),this.#o()}#P(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t instanceof GlideCoreDropdownOption&&t.disabled)return;if(t instanceof GlideCoreDropdownOption&&t.privateIsEditActive)return t.privateEdit(),void(this.open=!1);if(t&&!t.selected)return t.selected=!0,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));if(t?.selected&&!this.multiple)return void(this.open=!1)}}#Q(e){if(e.target instanceof GlideCoreDropdownOption&&e.target.disabled&&e.target.selected){const t=this.#c.lastIndexOf(e.target.value);this.#c.splice(t,t+1)}else this.multiple&&e.target instanceof GlideCoreDropdownOption&&e.target.selected&&e.target.value?this.#c.push(e.target.value):e.target instanceof GlideCoreDropdownOption&&e.target.selected&&e.target.value&&e.target===this.lastSelectedOption&&(this.#c=[e.target.value]);this.requestUpdate()}#X(){this.requestUpdate()}#W(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0,this.#me=e.target)}#Y(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#p()}))):(this.filterable||this.isFilterable)&&this.#l.value&&this.selectedOptions[0]?.label?(this.#l.value.value=this.selectedOptions[0].label,this.inputValue=this.selectedOptions[0].label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth):this.requestUpdate())}#K(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#J(e){if(e.target instanceof GlideCoreDropdownOption&&this.#fe){if(e.target.disabled)return;this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),this.ariaActivedescendant=e.target.id,this.#me=e.target,e.target.privateActive=!0,e.target.privateIsEditActive=!1,this.#g?.activeElement===this.#ae.value&&this.focus()}}#Z(e){if(!this.multiple)for(const t of this.#a)t!==e.target&&e.target instanceof GlideCoreDropdownOption&&e.target.selected&&t.selected&&e.target!==this.#te.value&&(t.selected=!1);e.target!==this.#te.value&&!this.#ce&&this.#te.value&&(this.#te.value.selected=this.isAllSelected),this.isShowSingleSelectIcon=!this.multiple&&Boolean(this.selectedOptions.at(0)?.value),e.target instanceof GlideCoreDropdownOption&&(this.multiple&&!this.#u?(this.#c=e.target.selected&&e.target.value&&!e.target.disabled?[...this.value,e.target.value]:this.value.filter((t=>e.target instanceof GlideCoreDropdownOption&&t!==e.target.value)),this.#l.value&&!this.#pe&&(this.isFiltering=!1,this.#l.value.value="",this.inputValue="")):this.multiple||!e.target.selected||e.target.disabled||(this.#c=e.target.value?[e.target.value]:[],this.#l.value&&e.target.label&&(this.isFiltering=!1,this.#l.value.value=e.target.label,this.inputValue=e.target.label))),this.#l.value&&(this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth),this.requestUpdate(),this.updateComplete.then((()=>{this.#p()}))}#ee(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]:[])}#x(){this.isInternalLabelTooltipOpen=!0}#H(){this.isInternalLabelTooltipOpen=!1}#k(){this.#pe=!0,this.open=!1}async#F(e){this.#pe=!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.#I.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.#pe=!1}))}else setTimeout((()=>{this.focus(),this.#pe=!1}));this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}#T(e){e.stopPropagation()}#be(){this.#ce=!0;for(const e of this.#a)!this.#te.value?.selected||e.selected||e.disabled?!this.#te.value?.selected&&e.selected&&(e.selected=!1):e.selected=!0;this.#ce=!1}async#p(){if(this.#y.value){const e=this.#y.value.scrollWidth>this.#y.value.clientWidth;e&&this.tagOverflowLimit>1?(this.tagOverflowLimit=this.tagOverflowLimit-1,await this.updateComplete,this.#p()):!e&&!this.#he&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#he=!0,await this.updateComplete,this.#p()):this.#he=!1}}#i(){this.#a.length>0&&(this.#ve?.(),this.#me&&(this.#me.privateActive=!0,this.ariaActivedescendant=this.#me.id),this.#D.value&&this.#O.value&&(this.#ve=autoUpdate(this.#D.value,this.#O.value,(()=>{(async()=>{if(this.#D.value&&this.#O.value){const{x:e,y:t,placement:i}=await computePosition(this.#D.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()}})()}))))}#o(){if((this.filterable||this.isFilterable)&&this.#l.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}),required],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,type:Boolean})],GlideCoreDropdown.prototype,"required",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"multiple",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"size",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"tooltip",void 0),__decorate([property({type:Array})],GlideCoreDropdown.prototype,"value",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"variant",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"version",void 0),__decorate([state()],GlideCoreDropdown.prototype,"ariaActivedescendant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"inputValue",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,"isInputOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInputTooltipOpen",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"),final],GlideCoreDropdown);export default GlideCoreDropdown;const icons={plus:html`
|
300
|
+
</div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#v.reportValidity();return this.requestUpdate(),e}resetValidityFeedback(){this.isReportValidityOrSubmit=!1}setCustomValidity(e){this.validityMessage=e,""===e?this.#v.setValidity({customError:!1},"",this.filterable||this.isFilterable?this.#l.value:this.#m.value):this.#v.setValidity({customError:!0,valueMissing:this.#v.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}setValidity(e,t){this.validityMessage=t,this.#v.setValidity(e," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.readonly=!1,this.selectAll=!1,this.required=!1,this.version=packageJson.version,this.ariaActivedescendant="",this.inputValue="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isCommunicateItemCountToScreenreaders=!1,this.isFilterable=!1,this.isFiltering=!1,this.isInputOverflow=!1,this.isInputTooltipOpen=!1,this.isInternalLabelOverflow=!1,this.isInternalLabelTooltipOpen=!1,this.isNoResults=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.itemCount=0,this.tagOverflowLimit=0,this.#ae=createRef(),this.#y=createRef(),this.#se=createRef(),this.#D=createRef(),this.#q=createRef(),this.#l=createRef(),this.#N=createRef(),this.#re=!1,this.#e=!1,this.#pe=!1,this.#s=!1,this.#r=!1,this.#n=!1,this.#de=!1,this.#he=!1,this.#ce=!1,this.#ue=!1,this.#u=!1,this.#M=new LocalizeController(this),this.#O=createRef(),this.#m=createRef(),this.#te=createRef(),this.#d="large",this.#I=createRef(),this.#c=[],this.#f=()=>{this.#re?setTimeout((()=>{this.#re=!1})):this.open=!1},this.#b=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#v=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#ae;#ve;#y;#se;#D;#q;#l;#N;#v;#re;#e;#pe;#s;#r;#n;#de;#he;#ce;#ue;#u;#M;#O;#me;#m;#te;#g;#d;#I;#c;#f;#b;#t(){this.#ve?.(),this.#O.value?.hidePopover(),this.ariaActivedescendant="",this.activeOption&&(this.#me=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1)}get#w(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#le(){this.open=!1,this.dispatchEvent(new Event("add",{bubbles:!0,composed:!0}))}#oe(){this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.#me=this.activeOption,this.activeOption.privateActive=!1)}#ne(){this.activeOption&&!this.#de&&(this.#me=this.activeOption,this.activeOption.privateActive=!1)}#E(){this.#re=!0}async#ie(){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.#fe?.find((e=>!e.disabled));!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.#me=this.lastSelectedOption,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(this.#me=e,this.ariaActivedescendant=this.open?e.id:"",e.privateActive=!0),this.#te.value&&(this.#te.value.selected=this.isAllSelected),this.multiple?this.#c=this.selectedOptions.filter((e=>Boolean(e.value)&&!e.disabled)).map((({value:e})=>e)):this.lastSelectedOption?.value&&!this.lastSelectedOption.disabled&&(this.#c=[this.lastSelectedOption.value]),this.requestUpdate(),await this.updateComplete,!this.multiple&&this.#l.value&&this.lastSelectedOption?.label?(this.#l.value.value=this.lastSelectedOption.label,this.inputValue=this.lastSelectedOption.label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth):!this.multiple&&this.#l.value&&(this.#l.value.value="",this.inputValue="",this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth)}#R(e){this.open&&this.#me&&e.relatedTarget===this.#ae.value&&(this.#me.privateActive=!0,this.#me.privateIsTooltipOpen=!this.#me.editable)}#A(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#g?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#pe&&(this.open=!1,this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}#C(e){if(this.disabled||this.readonly)return;if(("Enter"===e.key||" "===e.key)&&e.target===this.#q.value)return void(this.#re=!0);if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if(this.open&&"ArrowUp"===e.key&&this.#g?.activeElement===this.#ae.value)return this.focus(),void(this.#me&&(this.#me.privateActive=!0,this.#me.privateIsEditActive=this.#me.editable,this.#me.privateIsTooltipOpen=!this.#me.privateIsEditActive));if(this.open&&"ArrowDown"===e.key&&this.#g?.activeElement===this.#ae.value)return void e.preventDefault();if(this.open&&"ArrowDown"===e.key&&this.addButtonLabel&&this.activeOption===this.#ge?.at(-1)&&(!this.activeOption?.editable||this.activeOption?.privateIsEditActive))return e.preventDefault(),this.activeOption&&(this.#me=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),void this.#ae.value?.focus();if("Escape"===e.key)return e.preventDefault(),this.open=!1,void(this.#g?.activeElement===this.#ae.value&&this.focus());const t=e.target===this.#m.value||e.target===this.#l.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.privateIsTooltipOpen=!this.activeOption.privateIsEditActive));if(this.activeOption&&this.open){if("Enter"===e.key||" "===e.key){if(this.activeOption.privateIsEditActive)return this.activeOption.privateEdit(),void(this.open=!1);if("Enter"===e.key&&this.#ge&&this.#ge.length>0||" "===e.key&&!this.filterable&&!this.isFilterable)return this.#ue=!0,e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#te.value&&this.#be(),this.#ue=!1,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}const t=this.#fe?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#fe&&"number"==typeof t){e.preventDefault();const i=this.#fe.findLast(((e,i)=>!e.disabled&&i<t));return void(this.activeOption?.privateIsEditActive?(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!0):i&&0!==t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#me=i,i.privateActive=!0,i.privateIsEditActive=i.editable,i.privateIsTooltipOpen=!i.editable,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#fe&&"number"==typeof t){e.preventDefault();const i=this.#fe.find(((e,i)=>!e.disabled&&i>t));return void(this.activeOption.editable&&!this.activeOption.privateIsEditActive?(this.activeOption.privateIsEditActive=!0,this.activeOption.privateIsTooltipOpen=!1):i&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#me=i,i.privateActive=!0,i.privateIsTooltipOpen=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#fe){e.preventDefault();const t=[...this.#fe].reverse().findLast((e=>!e.disabled));return void(t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#me=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#fe){e.preventDefault();const t=[...this.#fe].findLast((e=>!e.disabled));return void(t&&this.activeOption&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#me=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}}}}#S(e){if(this.disabled||this.readonly)return;if(this.#pe)return void(this.#pe=!1);if(e.target instanceof Node&&this.#q.value?.contains(e.target))return void this.selectedOptions[0]?.privateEdit();const t=this.filterable||this.isFilterable;if(this.#ue||!this.open||t&&!(e.target instanceof Element&&this.#m.value?.contains(e.target)))return 0!==e.detail?(this.open=!0,this.focus(),this.#de=!0,void setTimeout((()=>{this.#de=!1}))):void 0;this.open=!1}#$(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#l.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}#j(){this.open=!1}#_(){this.isCommunicateItemCountToScreenreaders=!1,this.isInputTooltipOpen=!1}#L(){this.#l.value?.select(),this.isInputTooltipOpen=!0}async#G(e){let t;if(e.stopPropagation(),this.open=!0,this.isShowSingleSelectIcon=!1,this.#l.value?.value&&(this.inputValue=this.#l.value.value),this.multiple&&""!==this.#l.value?.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#l.value?.value&&this.#l.value?.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1,this.#l.value)try{t=await this.filter(this.#l.value.value)}catch{}if(t){for(const e of this.#a)e.hidden=!t.includes(e);const e=this.#ge?.at(0);e&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,this.#me=e,this.ariaActivedescendant=e.id,e.privateActive=!0),this.isNoResults=!this.#ge||0===this.#ge.length,this.isCommunicateItemCountToScreenreaders=!0,this.#ge&&(this.itemCount=this.#ge.length)}}#B(e){const t=this.selectedOptions.findLast(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&!e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart)return this.#pe=!0,t.selected=!1,void(this.#pe=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart){this.#pe=!0;for(const e of i)e.selected=!1;this.#pe=!1}else;}#V(){this.#l.value&&(this.isInputOverflow=this.#l.value.scrollWidth-1>this.#l.value.clientWidth)}#z(){this.#N.value&&(this.isInternalLabelOverflow=this.#N.value.scrollWidth>this.#N.value.clientWidth)}get#a(){return this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption))??[]}get#h(){const e=this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption));if(e&&this.#te.value)return[this.#te.value,...e]}get#ge(){return this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#fe(){const e=this.#se.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#te.value&&!this.#te.value.hidden&&e?[this.#te.value,...e]:e}#U(e){e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#te.value&&this.#be(),this.#o()}#P(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t instanceof GlideCoreDropdownOption&&t.disabled)return;if(t instanceof GlideCoreDropdownOption&&t.privateIsEditActive)return t.privateEdit(),void(this.open=!1);if(t&&!t.selected)return t.selected=!0,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));if(t?.selected&&!this.multiple)return void(this.open=!1)}}#Q(e){if(e.target instanceof GlideCoreDropdownOption&&e.target.disabled&&e.target.selected){const t=this.#c.lastIndexOf(e.target.value);this.#c.splice(t,t+1)}else this.multiple&&e.target instanceof GlideCoreDropdownOption&&e.target.selected&&e.target.value?this.#c.push(e.target.value):e.target instanceof GlideCoreDropdownOption&&e.target.selected&&e.target.value&&e.target===this.lastSelectedOption&&(this.#c=[e.target.value]);this.requestUpdate()}#X(){this.requestUpdate()}#W(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0,this.#me=e.target)}#Y(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#p()}))):(this.filterable||this.isFilterable)&&this.#l.value&&this.selectedOptions[0]?.label?(this.#l.value.value=this.selectedOptions[0].label,this.inputValue=this.selectedOptions[0].label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth):this.requestUpdate())}#K(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#J(e){if(e.target instanceof GlideCoreDropdownOption&&this.#fe){if(e.target.disabled)return;this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),this.ariaActivedescendant=e.target.id,this.#me=e.target,e.target.privateActive=!0,e.target.privateIsEditActive=!1,this.#g?.activeElement===this.#ae.value&&this.focus()}}#Z(e){if(!this.multiple)for(const t of this.#a)t!==e.target&&e.target instanceof GlideCoreDropdownOption&&e.target.selected&&t.selected&&e.target!==this.#te.value&&(t.selected=!1);e.target!==this.#te.value&&!this.#ce&&this.#te.value&&(this.#te.value.selected=this.isAllSelected),this.isShowSingleSelectIcon=!this.multiple&&Boolean(this.selectedOptions.at(0)?.value),e.target instanceof GlideCoreDropdownOption&&(this.multiple&&!this.#u?(this.#c=e.target.selected&&e.target.value&&!e.target.disabled?[...this.value,e.target.value]:this.value.filter((t=>e.target instanceof GlideCoreDropdownOption&&t!==e.target.value)),this.#l.value&&!this.#pe&&(this.isFiltering=!1,this.#l.value.value="",this.inputValue="")):this.multiple||!e.target.selected||e.target.disabled||(this.#c=e.target.value?[e.target.value]:[],this.#l.value&&e.target.label&&(this.isFiltering=!1,this.#l.value.value=e.target.label,this.inputValue=e.target.label))),this.#l.value&&(this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth),this.requestUpdate(),this.updateComplete.then((()=>{this.#p()}))}#ee(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]:[])}#x(){this.isInternalLabelTooltipOpen=!0}#H(){this.isInternalLabelTooltipOpen=!1}#k(){this.#pe=!0,this.open=!1}async#F(e){this.#pe=!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.#I.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.#pe=!1}))}else setTimeout((()=>{this.focus(),this.#pe=!1}));this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}#T(e){e.stopPropagation()}#be(){this.#ce=!0;for(const e of this.#a)!this.#te.value?.selected||e.selected||e.disabled?!this.#te.value?.selected&&e.selected&&(e.selected=!1):e.selected=!0;this.#ce=!1}async#p(){if(this.#y.value){const e=this.#y.value.scrollWidth>this.#y.value.clientWidth;e&&this.tagOverflowLimit>1?(this.tagOverflowLimit=this.tagOverflowLimit-1,await this.updateComplete,this.#p()):!e&&!this.#he&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#he=!0,await this.updateComplete,this.#p()):this.#he=!1}}#i(){this.#a.length>0&&(this.#ve?.(),this.#me&&(this.#me.privateActive=!0,this.ariaActivedescendant=this.#me.id),this.#D.value&&this.#O.value&&(this.#ve=autoUpdate(this.#D.value,this.#O.value,(()=>{(async()=>{if(this.#D.value&&this.#O.value){const{x:e,y:t,placement:i}=await computePosition(this.#D.value,this.#O.value,{placement:"bottom-start",middleware:[offset({mainAxis:Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-base-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()}})()}))))}#o(){if((this.filterable||this.isFilterable)&&this.#l.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}),required],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,type:Boolean})],GlideCoreDropdown.prototype,"required",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"multiple",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"size",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"tooltip",void 0),__decorate([property({type:Array})],GlideCoreDropdown.prototype,"value",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"variant",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"version",void 0),__decorate([state()],GlideCoreDropdown.prototype,"ariaActivedescendant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"inputValue",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,"isInputOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInputTooltipOpen",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"),final],GlideCoreDropdown);export default GlideCoreDropdown;const icons={plus:html`
|
301
301
|
<svg
|
302
302
|
aria-hidden="true"
|
303
303
|
viewBox="0 0 16 16"
|
@@ -2,7 +2,7 @@ import{css}from"lit";export default[css`
|
|
2
2
|
.component {
|
3
3
|
align-items: center;
|
4
4
|
block-size: var(--private-option-height);
|
5
|
-
border-radius: var(--glide-core-spacing-sm);
|
5
|
+
border-radius: var(--glide-core-spacing-base-sm);
|
6
6
|
display: flex;
|
7
7
|
max-inline-size: 21.875rem;
|
8
8
|
transition: background-color 100ms ease-in-out;
|
@@ -10,7 +10,9 @@ import{css}from"lit";export default[css`
|
|
10
10
|
|
11
11
|
&.active {
|
12
12
|
&:not(.disabled) {
|
13
|
-
background-color: var(
|
13
|
+
background-color: var(
|
14
|
+
--glide-core-color-interactive-surface-container--hover
|
15
|
+
);
|
14
16
|
}
|
15
17
|
}
|
16
18
|
}
|
@@ -18,40 +20,36 @@ import{css}from"lit";export default[css`
|
|
18
20
|
.option {
|
19
21
|
align-items: center;
|
20
22
|
block-size: 100%;
|
21
|
-
color: var(--glide-core-text-
|
23
|
+
color: var(--glide-core-color-static-text-default);
|
22
24
|
display: flex;
|
23
25
|
flex-grow: 1;
|
24
26
|
overflow: hidden;
|
25
27
|
user-select: none;
|
26
28
|
|
27
29
|
&.large {
|
28
|
-
font-family: var(--glide-core-
|
29
|
-
font-size: var(--glide-core-
|
30
|
-
font-
|
31
|
-
font-weight: var(--glide-core-body-sm-font-weight);
|
32
|
-
line-height: var(--glide-core-body-sm-line-height);
|
30
|
+
font-family: var(--glide-core-typography-family-primary);
|
31
|
+
font-size: var(--glide-core-typography-size-body-default);
|
32
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
33
33
|
padding-inline-start: 0.625rem;
|
34
34
|
|
35
35
|
&:not(.editable) {
|
36
|
-
padding-inline-end: var(--glide-core-spacing-sm);
|
36
|
+
padding-inline-end: var(--glide-core-spacing-base-sm);
|
37
37
|
}
|
38
38
|
}
|
39
39
|
|
40
40
|
&.small {
|
41
|
-
font-family: var(--glide-core-
|
42
|
-
font-size: var(--glide-core-
|
43
|
-
font-
|
44
|
-
|
45
|
-
line-height: var(--glide-core-body-xs-line-height);
|
46
|
-
padding-inline-start: var(--glide-core-spacing-sm);
|
41
|
+
font-family: var(--glide-core-typography-family-primary);
|
42
|
+
font-size: var(--glide-core-typography-size-body-small);
|
43
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
44
|
+
padding-inline-start: var(--glide-core-spacing-base-sm);
|
47
45
|
|
48
46
|
&:not(.editable) {
|
49
|
-
padding-inline-end: var(--glide-core-spacing-xs);
|
47
|
+
padding-inline-end: var(--glide-core-spacing-base-xs);
|
50
48
|
}
|
51
49
|
}
|
52
50
|
|
53
51
|
&.disabled {
|
54
|
-
color: var(--glide-core-icon-
|
52
|
+
color: var(--glide-core-color-interactive-icon-default--disabled);
|
55
53
|
}
|
56
54
|
}
|
57
55
|
|
@@ -61,24 +59,24 @@ import{css}from"lit";export default[css`
|
|
61
59
|
|
62
60
|
&.large {
|
63
61
|
&::part(private-label-and-input-and-checkbox) {
|
64
|
-
padding-inline-start: var(--glide-core-spacing-sm);
|
62
|
+
padding-inline-start: var(--glide-core-spacing-base-sm);
|
65
63
|
}
|
66
64
|
|
67
65
|
&:not(.editable) {
|
68
66
|
&::part(private-label-and-input-and-checkbox) {
|
69
|
-
padding-inline-end: var(--glide-core-spacing-sm);
|
67
|
+
padding-inline-end: var(--glide-core-spacing-base-sm);
|
70
68
|
}
|
71
69
|
}
|
72
70
|
}
|
73
71
|
|
74
72
|
&.small {
|
75
73
|
&::part(private-label-and-input-and-checkbox) {
|
76
|
-
padding-inline-start: var(--glide-core-spacing-xs);
|
74
|
+
padding-inline-start: var(--glide-core-spacing-base-xs);
|
77
75
|
}
|
78
76
|
|
79
77
|
&:not(.editable) {
|
80
78
|
&::part(private-label-and-input-and-checkbox) {
|
81
|
-
padding-inline-end: var(--glide-core-spacing-xs);
|
79
|
+
padding-inline-end: var(--glide-core-spacing-base-xs);
|
82
80
|
}
|
83
81
|
}
|
84
82
|
}
|
@@ -110,7 +108,7 @@ import{css}from"lit";export default[css`
|
|
110
108
|
&::slotted(*) {
|
111
109
|
align-items: center;
|
112
110
|
display: flex;
|
113
|
-
padding-inline-end: var(--glide-core-spacing-xs);
|
111
|
+
padding-inline-end: var(--glide-core-spacing-base-xs);
|
114
112
|
}
|
115
113
|
}
|
116
114
|
|
@@ -155,7 +153,7 @@ import{css}from"lit";export default[css`
|
|
155
153
|
|
156
154
|
> svg {
|
157
155
|
flex-shrink: 0;
|
158
|
-
padding-inline-start: var(--glide-core-spacing-xs);
|
156
|
+
padding-inline-start: var(--glide-core-spacing-base-xs);
|
159
157
|
}
|
160
158
|
}
|
161
159
|
|
@@ -166,24 +164,24 @@ import{css}from"lit";export default[css`
|
|
166
164
|
border: none;
|
167
165
|
display: flex;
|
168
166
|
padding-block: 0;
|
169
|
-
padding-inline-start: var(--glide-core-spacing-xs);
|
167
|
+
padding-inline-start: var(--glide-core-spacing-base-xs);
|
170
168
|
|
171
169
|
&.active {
|
172
170
|
&:not(.disabled) {
|
173
|
-
color: var(--glide-core-text-
|
171
|
+
color: var(--glide-core-color-interactive-text-link--hover);
|
174
172
|
}
|
175
173
|
}
|
176
174
|
|
177
175
|
&.disabled {
|
178
|
-
color: var(--glide-core-icon-
|
176
|
+
color: var(--glide-core-color-interactive-icon-default--disabled);
|
179
177
|
}
|
180
178
|
|
181
179
|
&.large {
|
182
|
-
padding-inline-end: var(--glide-core-spacing-sm);
|
180
|
+
padding-inline-end: var(--glide-core-spacing-base-sm);
|
183
181
|
}
|
184
182
|
|
185
183
|
&.small {
|
186
|
-
padding-inline-end: var(--glide-core-spacing-xs);
|
184
|
+
padding-inline-end: var(--glide-core-spacing-base-xs);
|
187
185
|
}
|
188
186
|
|
189
187
|
&:focus {
|