@crowdstrike/glide-core 0.12.1 → 0.12.3
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/checkbox-group.styles.js +1 -1
- package/dist/dropdown.d.ts +5 -1
- package/dist/dropdown.js +126 -58
- package/dist/dropdown.option.d.ts +3 -0
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +81 -16
- package/dist/dropdown.option.test.basics.js +4 -33
- package/dist/dropdown.option.test.basics.multiple.js +9 -0
- package/dist/dropdown.option.test.basics.single.js +8 -0
- package/dist/dropdown.option.test.interactions.multiple.js +12 -0
- package/dist/dropdown.option.test.interactions.single.js +11 -0
- package/dist/dropdown.styles.js +127 -29
- package/dist/dropdown.test.basics.filterable.js +11 -54
- package/dist/dropdown.test.basics.js +24 -244
- package/dist/dropdown.test.basics.multiple.js +13 -60
- package/dist/dropdown.test.basics.single.js +2 -8
- package/dist/dropdown.test.events.filterable.js +12 -54
- package/dist/dropdown.test.events.js +139 -46
- package/dist/dropdown.test.events.multiple.js +17 -87
- package/dist/dropdown.test.events.single.js +99 -60
- package/dist/dropdown.test.focus.filterable.js +13 -60
- package/dist/dropdown.test.focus.js +64 -11
- package/dist/dropdown.test.focus.multiple.js +36 -46
- package/dist/dropdown.test.focus.single.js +28 -23
- package/dist/dropdown.test.form.js +22 -0
- package/dist/dropdown.test.interactions.filterable.js +86 -72
- package/dist/dropdown.test.interactions.js +361 -207
- package/dist/dropdown.test.interactions.multiple.js +152 -279
- package/dist/dropdown.test.interactions.single.js +62 -98
- package/dist/dropdown.test.validity.js +12 -49
- package/dist/icons/pencil.d.ts +2 -0
- package/dist/icons/pencil.js +1 -0
- package/dist/label.js +1 -1
- package/dist/label.styles.js +7 -3
- package/dist/library/localize.d.ts +2 -0
- package/dist/menu.js +1 -1
- package/dist/menu.options.js +1 -1
- package/dist/menu.options.test.events.d.ts +1 -0
- package/dist/menu.options.test.events.js +19 -0
- package/dist/menu.test.interactions.d.ts +1 -0
- package/dist/menu.test.interactions.js +38 -0
- package/dist/radio-group.styles.js +1 -1
- package/dist/tab.group.d.ts +8 -1
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +4 -0
- package/dist/tab.group.test.basics.js +77 -1
- package/dist/tab.panel.js +1 -1
- package/dist/tab.panel.styles.js +15 -0
- package/dist/tag.d.ts +2 -0
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +46 -5
- package/dist/tag.test.basics.js +1 -1
- package/dist/tag.test.events.js +76 -3
- package/dist/tag.test.focus.js +1 -1
- package/dist/textarea.styles.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/fr.d.ts +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/ja.d.ts +1 -1
- package/dist/translations/ja.js +1 -1
- package/package.json +1 -1
package/dist/dropdown.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import './checkbox.js';
|
2
2
|
import './dropdown.option.js';
|
3
|
+
import './icon-button.js';
|
3
4
|
import './label.js';
|
4
5
|
import './tooltip.js';
|
5
6
|
import { LitElement } from 'lit';
|
@@ -23,6 +24,7 @@ export default class GlideCoreDropdown extends LitElement {
|
|
23
24
|
static formAssociated: boolean;
|
24
25
|
static shadowRootOptions: ShadowRootInit;
|
25
26
|
static styles: import("lit").CSSResult[];
|
27
|
+
addButtonLabel?: string;
|
26
28
|
get disabled(): boolean;
|
27
29
|
set disabled(isDisabled: boolean);
|
28
30
|
get filterable(): boolean;
|
@@ -73,7 +75,9 @@ export default class GlideCoreDropdown extends LitElement {
|
|
73
75
|
private isCheckingValidity;
|
74
76
|
private isFilterable;
|
75
77
|
private isFiltering;
|
76
|
-
private
|
78
|
+
private isInternalLabelOverflow;
|
79
|
+
private isInternalLabelTooltipOpen;
|
80
|
+
private isOptionsAndFooterHidden;
|
77
81
|
private isReportValidityOrSubmit;
|
78
82
|
private isShowSingleSelectIcon;
|
79
83
|
private tagOverflowLimit;
|
package/dist/dropdown.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,
|
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
|
2
2
|
class=${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation})}
|
3
|
-
@
|
3
|
+
@mouseup=${this.#y}
|
4
4
|
${ref(this.#E)}
|
5
5
|
>
|
6
6
|
<glide-core-private-label
|
@@ -10,7 +10,6 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
10
10
|
?error=${this.#R}
|
11
11
|
?hide=${this.hideLabel}
|
12
12
|
?required=${this.required}
|
13
|
-
@blur=${this.#y}
|
14
13
|
>
|
15
14
|
<label id="label"> ${this.label} </label>
|
16
15
|
<slot name="tooltip" slot="tooltip"></slot>
|
@@ -18,43 +17,47 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
18
17
|
<div
|
19
18
|
class="dropdown-and-options"
|
20
19
|
slot="control"
|
21
|
-
@
|
22
|
-
@
|
20
|
+
@focusin=${this.#A}
|
21
|
+
@focusout=${this.#C}
|
22
|
+
@keydown=${this.#S}
|
23
23
|
>
|
24
24
|
<div
|
25
25
|
class=${classMap({dropdown:!0,quiet:"quiet"===this.variant,disabled:this.disabled,error:this.#R,readonly:this.readonly,multiple:this.multiple})}
|
26
|
-
@click=${this
|
26
|
+
@click=${this.#$}
|
27
27
|
@mousedown=${this.#D}
|
28
|
-
${ref(this
|
28
|
+
${ref(this.#k)}
|
29
29
|
>
|
30
30
|
<span class="selected-option-labels" id="selected-option-labels">
|
31
|
-
${this.selectedOptions.
|
32
|
-
|
33
|
-
|
31
|
+
${this.selectedOptions.map((({label:e})=>html`<span data-test="selected-option-label">
|
32
|
+
${e},
|
33
|
+
</span>`))}
|
34
34
|
</span>
|
35
35
|
|
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.#
|
39
|
+
${ref(this.#F)}
|
40
40
|
>
|
41
|
-
${repeat(this.selectedOptions,(({id:e})=>e),(({id:e,
|
42
|
-
class=${classMap({"tag-container":!0,hidden:
|
41
|
+
${repeat(this.selectedOptions,(({id:e})=>e),(({id:e,editable:t,label:i,value:s},o)=>html`<li
|
42
|
+
class=${classMap({"tag-container":!0,hidden:o>this.tagOverflowLimit-1})}
|
43
43
|
data-test="tag-container"
|
44
|
-
data-test-hidden=${
|
44
|
+
data-test-hidden=${o>this.tagOverflowLimit-1}
|
45
45
|
>
|
46
46
|
<glide-core-tag
|
47
47
|
data-test="tag"
|
48
48
|
data-id=${e}
|
49
|
-
label=${
|
49
|
+
label=${i}
|
50
50
|
removable
|
51
51
|
size=${this.size}
|
52
|
-
|
52
|
+
?disabled=${this.disabled||this.readonly}
|
53
|
+
?private-editable=${t}
|
54
|
+
@edit=${this.#I}
|
55
|
+
@remove=${this.#L.bind(this,e)}
|
53
56
|
>
|
54
|
-
${when(
|
57
|
+
${when(s,(()=>html`
|
55
58
|
<slot
|
56
59
|
data-test="multiselect-icon-slot"
|
57
|
-
name="icon:${
|
60
|
+
name="icon:${s}"
|
58
61
|
slot="icon"
|
59
62
|
></slot>
|
60
63
|
`))}
|
@@ -83,23 +86,36 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
83
86
|
tabindex=${this.disabled?"-1":"0"}
|
84
87
|
?disabled=${this.disabled}
|
85
88
|
?readonly=${this.readonly}
|
86
|
-
@focusin=${this.#
|
87
|
-
@input=${this.#
|
88
|
-
@keydown=${this.#
|
89
|
-
${ref(this.#
|
89
|
+
@focusin=${this.#T}
|
90
|
+
@input=${this.#B}
|
91
|
+
@keydown=${this.#_}
|
92
|
+
${ref(this.#o)}
|
90
93
|
/>`))}
|
91
|
-
|
94
|
+
|
95
|
+
<glide-core-tooltip
|
96
|
+
class=${classMap({"internal-label-tooltip":!0,visible:Boolean(this.internalLabel)})}
|
97
|
+
data-test="internal-label-tooltip"
|
98
|
+
offset=${8}
|
99
|
+
?disabled=${this.open||!this.isInternalLabelOverflow}
|
100
|
+
?open=${!this.open&&this.isInternalLabelTooltipOpen}
|
101
|
+
>
|
102
|
+
<div aria-hidden="true">${this.internalLabel}</div>
|
103
|
+
|
104
|
+
<div
|
92
105
|
class="internal-label"
|
93
106
|
data-test="internal-label"
|
107
|
+
slot="target"
|
108
|
+
${ref(this.#w)}
|
94
109
|
>
|
95
110
|
${when(this.internalLabel===this.placeholder,(()=>html`<span
|
96
111
|
class=${classMap({placeholder:!0,disabled:this.disabled,quiet:"quiet"===this.variant})}
|
97
112
|
>
|
98
113
|
${this.internalLabel}
|
99
114
|
</span>`),(()=>this.internalLabel))}
|
100
|
-
</div
|
115
|
+
</div>
|
116
|
+
</glide-core-tooltip>
|
101
117
|
|
102
|
-
<div class="tag-overflow-
|
118
|
+
<div class="tag-overflow-and-buttons">
|
103
119
|
${when(this.multiple&&this.selectedOptions.length>this.tagOverflowLimit,(()=>html`<div
|
104
120
|
aria-hidden="true"
|
105
121
|
class="tag-overflow-text"
|
@@ -112,6 +128,18 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
112
128
|
</span>
|
113
129
|
more
|
114
130
|
</div>`))}
|
131
|
+
${when(!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].editable,(()=>html`<glide-core-icon-button
|
132
|
+
class="edit-button"
|
133
|
+
data-test="edit-button"
|
134
|
+
label=${this.#G.term("editOption",this.selectedOptions[0].label)}
|
135
|
+
tabindex=${this.disabled||this.readonly?"-1":"0"}
|
136
|
+
variant="tertiary"
|
137
|
+
?disabled=${this.disabled||this.readonly}
|
138
|
+
@click=${this.#M}
|
139
|
+
${ref(this.#V)}
|
140
|
+
>
|
141
|
+
${pencilIcon}
|
142
|
+
</glide-core-icon-button>`))}
|
115
143
|
|
116
144
|
<button
|
117
145
|
aria-expanded=${this.open}
|
@@ -120,17 +148,19 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
120
148
|
aria-labelledby="selected-option-labels label"
|
121
149
|
aria-describedby="description"
|
122
150
|
aria-controls="options"
|
123
|
-
class="button"
|
124
|
-
data-test="button"
|
125
|
-
id="button"
|
151
|
+
class="primary-button"
|
152
|
+
data-test="primary-button"
|
153
|
+
id="primary-button"
|
126
154
|
tabindex=${this.filterable||this.isFilterable||this.disabled?"-1":"0"}
|
127
155
|
type="button"
|
156
|
+
@focusin=${this.#z}
|
157
|
+
@focusout=${this.#x}
|
128
158
|
${ref(this.#v)}
|
129
159
|
>
|
130
160
|
${when(this.isFiltering,(()=>html`<div data-test="magnifying-glass-icon">
|
131
161
|
${magnifyingGlassIcon}
|
132
162
|
</div>`),(()=>html`<svg
|
133
|
-
aria-label=${this.#
|
163
|
+
aria-label=${this.#G.term("open")}
|
134
164
|
width="16"
|
135
165
|
height="16"
|
136
166
|
viewBox="0 0 24 24"
|
@@ -149,36 +179,74 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
149
179
|
</div>
|
150
180
|
|
151
181
|
<div
|
152
|
-
aria-labelledby=${this.filterable||this.isFilterable?"input":"button"}
|
153
|
-
class=${classMap({options:!0,hidden:this.
|
154
|
-
|
155
|
-
id="options"
|
156
|
-
role="listbox"
|
157
|
-
@click=${this.#T}
|
158
|
-
@input=${this.#V}
|
159
|
-
@focusin=${this.#M}
|
160
|
-
@mousedown=${this.#z}
|
161
|
-
@mouseover=${this.#x}
|
162
|
-
@private-label-change=${this.#H}
|
163
|
-
@private-selected-change=${this.#N}
|
164
|
-
@private-value-change=${this.#B}
|
165
|
-
${ref(this.#w)}
|
182
|
+
aria-labelledby=${this.filterable||this.isFilterable?"input":"primary-button"}
|
183
|
+
class=${classMap({"options-and-footer":!0,hidden:this.isOptionsAndFooterHidden})}
|
184
|
+
${ref(this.#O)}
|
166
185
|
>
|
167
|
-
<
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
186
|
+
<div
|
187
|
+
aria-labelledby=${this.filterable||this.isFilterable?"input":"button"}
|
188
|
+
class=${classMap({options:!0,[this.size]:!0})}
|
189
|
+
data-test="options"
|
190
|
+
id="options"
|
191
|
+
role="listbox"
|
192
|
+
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
|
+
>
|
203
|
+
<glide-core-dropdown-option
|
204
|
+
class="select-all"
|
205
|
+
data-test="select-all"
|
206
|
+
label=${this.#G.term("selectAll")}
|
207
|
+
private-size=${this.size}
|
208
|
+
private-multiple
|
209
|
+
?hidden=${!this.selectAll||!this.multiple||this.isFiltering}
|
210
|
+
?private-indeterminate=${this.isSomeSelected&&!this.isAllSelected}
|
211
|
+
${ref(this.#Q)}
|
212
|
+
></glide-core-dropdown-option>
|
213
|
+
|
214
|
+
<slot
|
215
|
+
@slotchange=${this.#X}
|
216
|
+
${ref(this.#b)}
|
217
|
+
></slot>
|
218
|
+
</div>
|
177
219
|
|
178
|
-
<
|
179
|
-
|
180
|
-
|
181
|
-
|
220
|
+
<footer
|
221
|
+
class=${classMap({footer:!0,visible:Boolean(this.addButtonLabel)})}
|
222
|
+
>
|
223
|
+
<button
|
224
|
+
class=${classMap({"add-button":!0,[this.size]:!0})}
|
225
|
+
data-test="add-button"
|
226
|
+
type="button"
|
227
|
+
@click=${this.#Y}
|
228
|
+
@focusin=${this.#Z}
|
229
|
+
@mouseover=${this.#ee}
|
230
|
+
${ref(this.#te)}
|
231
|
+
>
|
232
|
+
<svg
|
233
|
+
aria-hidden="true"
|
234
|
+
viewBox="0 0 16 16"
|
235
|
+
fill="none"
|
236
|
+
style="height: var(--size); width: var(--size);"
|
237
|
+
>
|
238
|
+
<path
|
239
|
+
d="M7.99998 3.33337V12.6667M3.33331 8.00004H12.6666"
|
240
|
+
stroke="currentColor"
|
241
|
+
stroke-width="1.3"
|
242
|
+
stroke-linecap="round"
|
243
|
+
stroke-linejoin="round"
|
244
|
+
/>
|
245
|
+
</svg>
|
246
|
+
|
247
|
+
${this.addButtonLabel}
|
248
|
+
</button>
|
249
|
+
</footer>
|
182
250
|
</div>
|
183
251
|
</div>
|
184
252
|
|
@@ -192,4 +260,4 @@ var __decorate=this&&this.__decorate||function(e,t,i,l){var s,o=arguments.length
|
|
192
260
|
>`))}
|
193
261
|
</div>
|
194
262
|
</glide-core-private-label>
|
195
|
-
</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.#s.value:this.#v.value):this.#u.setValidity({customError:!0,valueMissing:this.#u.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#s.value:this.#v.value)}setValidity(e,t){this.validityMessage=t,this.#u.setValidity(e," ",this.filterable||this.isFilterable?this.#s.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.isOptionsHidden=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.tagOverflowLimit=0,this.#v=createRef(),this.#E=createRef(),this.#b=createRef(),this.#$=createRef(),this.#s=createRef(),this.#O=!1,this.#e=!1,this.#l=!1,this.#d=!1,this.#n=!1,this.#q=!1,this.#P=!1,this.#K=!1,this.#W=!1,this.#L=new LocalizeController(this),this.#w=createRef(),this.#j=createRef(),this.#a="large",this.#k=createRef(),this.#c=[],this.#m=()=>{this.#O?setTimeout((()=>{this.#O=!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()}))}#v;#J;#E;#b;#$;#s;#u;#O;#e;#l;#d;#n;#q;#P;#K;#W;#L;#w;#j;#f;#a;#k;#c;#m;#g;#t(){this.#J?.(),this.#w.value?.hidePopover(),this.ariaActivedescendant=""}get#R(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#y(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1}#U(){owSlotType(this.#b.value,[GlideCoreDropdownOption,Text]),this.isFilterable=this.#p.length>10,this.tagOverflowLimit=this.selectedOptions.length;for(const e of this.#p)e.privateSize=this.size,e.privateMultiple=this.multiple;const e=this.#Q?.at(0);!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(e.privateActive=!0,this.ariaActivedescendant=this.open?e.id:""),this.#j.value&&(this.#j.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.#s.value&&this.lastSelectedOption?.value&&(this.#s.value.value=this.lastSelectedOption.label)}))}#S(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#f?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#P&&(this.open=!1),this.#y()}#C(e){if(this.disabled||this.readonly)return;if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if("Escape"===e.key)return this.open=!1,void this.focus();const t=e.target===this.#v.value||e.target===this.#s.value||e.target instanceof GlideCoreDropdownOption;if(!this.multiple||t){if(!this.open&&[" ","ArrowUp","ArrowDown"].includes(e.key)&&this.activeOption)return e.preventDefault(),this.open=!0,void(this.activeOption.privateIsOpenTooltip=!0);if(this.activeOption&&this.open){if(("Enter"===e.key||" "===e.key)&&(this.#W=!0,"Enter"===e.key&&this.#X&&this.#X.length>0||" "===e.key&&!this.filterable&&!this.isFilterable))return e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#j.value&&this.#Y(),this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new Event("input",{bubbles:!0}));const t=this.#Q?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#Q&&"number"==typeof t){e.preventDefault();const i=this.#Q.at(t-1);return void(i&&0!==t&&(this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,i.privateActive=!0,i.privateIsOpenTooltip=!0,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#Q&&"number"==typeof t){e.preventDefault();const i=this.#Q.at(t+1);return void(i&&(this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,i.privateActive=!0,i.privateIsOpenTooltip=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#Q){e.preventDefault();const t=this.#Q.at(0);return void(t&&(this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,t.privateActive=!0,t.privateIsOpenTooltip=!0,t.scrollIntoView({block:"end"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#Q){e.preventDefault();const t=this.#Q.at(-1);return void(t&&this.activeOption&&(this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,t.privateActive=!0,t.privateIsOpenTooltip=!0,t.scrollIntoView()))}}}}#A(e){this.disabled||this.readonly||(this.#P?this.#P=!1:!this.#W&&this.open?this.open=!1:0!==e.detail&&(this.open=!0,this.focus()))}#D(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#s.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}get#p(){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.#j.value)return[this.#j.value,...e]}get#X(){return this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#Q(){const e=this.#b.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#j.value&&!this.#j.value.hidden&&e?[this.#j.value,...e]:e}#_(){this.#s.value?.select()}#I(e){if(ow(this.#s.value,ow.object.instanceOf(HTMLInputElement)),e.stopPropagation(),this.multiple&&""!==this.#s.value.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#s.value.value&&this.#s.value.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1,this.isShowSingleSelectIcon=!1,this.activeOption){this.ariaActivedescendant=this.activeOption.id;for(const e of this.#p)e.hidden=!e.label?.toLowerCase().includes(this.#s.value?.value.toLowerCase().trim());const e=this.#X?.at(0);e&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,e.privateActive=!0),this.open=!0,this.isOptionsHidden=!this.#X||0===this.#X.length}this.dispatchEvent(new CustomEvent("filter",{bubbles:!0,detail:this.#s.value.value}))}#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.#s.value&&0===this.#s.value.selectionStart)return void(t.selected=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#s.value&&0===this.#s.value.selectionStart)for(const e of i)e.selected=!1;else;}#T(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t&&!t.selected)return t.selected=!0,this.#o(),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)}}#M(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0)}#V(e){e.stopPropagation(),e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#j.value&&this.#Y(),this.#o(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}#H(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))):this.#s.value?this.#s.value.value=this.selectedOptions[0].label:this.requestUpdate())}#z(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#x(e){if(e.target instanceof GlideCoreDropdownOption&&this.#Q&&this.activeOption){this.activeOption.privateIsOpenTooltip=!1,this.activeOption.privateActive=!1,e.target.privateActive=!0;for(const e of this.#Q)e.privateActive&&(this.ariaActivedescendant=e.id)}}#N(e){e.target!==this.#j.value&&!this.#K&&this.#j.value&&(this.#j.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.#s.value&&(this.#s.value.value=""),this.#h()):!this.multiple&&e.target.selected&&(this.#c=e.target.value?[e.target.value]:[],this.#s.value&&(this.#s.value.value=e.target.label))),this.requestUpdate()}#B(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]:[])}async#F(e){this.#P=!0;for(const t of this.#p)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.value.length>0){const i=[...t].findIndex((t=>t.dataset.id===e));await this.updateComplete,t[i<t.length-1?i+1:i-1]?.focus()}else this.focus();this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new Event("input",{bubbles:!0}))}#Y(){ow(this.#j.value,ow.object.instanceOf(GlideCoreDropdownOption)),this.#K=!0;for(const e of this.#p)e.selected=this.#j.value.selected;this.#K=!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.#q&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#q=!0,await this.updateComplete,this.#h()):this.#q=!1}}#i(){this.#J?.(),this.#$.value&&this.#w.value&&(this.#J=autoUpdate(this.#$.value,this.#w.value,(()=>{(async()=>{if(this.#$.value&&this.#w.value){const{x:e,y:t,placement:i}=await computePosition(this.#$.value,this.#w.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.#w.value.dataset.placement=i,Object.assign(this.#w.value.style,{left:`${e}px`,top:`${t}px`}),this.#w.value?.showPopover(),this.activeOption&&(this.ariaActivedescendant=this.activeOption.id)}})()})))}#o(){if((this.filterable||this.isFilterable)&&this.#s.value){this.isFiltering=!1;for(const e of this.#p)e.hidden=!1}}};__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,"isOptionsHidden",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;
|
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;
|
@@ -13,9 +13,12 @@ export default class GlideCoreDropdownOption extends LitElement {
|
|
13
13
|
#private;
|
14
14
|
static shadowRootOptions: ShadowRootInit;
|
15
15
|
static styles: import("lit").CSSResult[];
|
16
|
+
get editable(): boolean;
|
17
|
+
set editable(isEditable: boolean);
|
16
18
|
get label(): string;
|
17
19
|
set label(label: string);
|
18
20
|
privateIndeterminate: boolean;
|
21
|
+
privateIsEditActive: boolean;
|
19
22
|
privateMultiple: boolean;
|
20
23
|
get selected(): boolean;
|
21
24
|
set selected(isSelected: boolean);
|
package/dist/dropdown.option.js
CHANGED
@@ -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 styles from"./dropdown.option.styles.js";let GlideCoreDropdownOption=class GlideCoreDropdownOption extends LitElement{constructor(){super(...arguments),this.privateIndeterminate=!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="",this.#
|
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;
|
@@ -3,6 +3,7 @@ import{css}from"lit";export default[css`
|
|
3
3
|
align-items: center;
|
4
4
|
block-size: var(--private-option-height);
|
5
5
|
border-radius: var(--glide-core-spacing-sm);
|
6
|
+
display: flex;
|
6
7
|
max-inline-size: 21.875rem;
|
7
8
|
transition: background-color 100ms ease-in-out;
|
8
9
|
user-select: none;
|
@@ -15,8 +16,9 @@ import{css}from"lit";export default[css`
|
|
15
16
|
.option {
|
16
17
|
align-items: center;
|
17
18
|
block-size: 100%;
|
18
|
-
column-gap: var(--glide-core-spacing-xs);
|
19
19
|
display: flex;
|
20
|
+
flex-grow: 1;
|
21
|
+
overflow: hidden;
|
20
22
|
user-select: none;
|
21
23
|
|
22
24
|
&.large {
|
@@ -25,7 +27,11 @@ import{css}from"lit";export default[css`
|
|
25
27
|
font-style: var(--glide-core-body-sm-font-style);
|
26
28
|
font-weight: var(--glide-core-body-sm-font-weight);
|
27
29
|
line-height: var(--glide-core-body-sm-line-height);
|
28
|
-
padding-inline: var(--glide-core-spacing-sm);
|
30
|
+
padding-inline-start: var(--glide-core-spacing-sm);
|
31
|
+
|
32
|
+
&:not(.editable) {
|
33
|
+
padding-inline-end: var(--glide-core-spacing-sm);
|
34
|
+
}
|
29
35
|
}
|
30
36
|
|
31
37
|
&.small {
|
@@ -34,20 +40,39 @@ import{css}from"lit";export default[css`
|
|
34
40
|
font-style: var(--glide-core-body-xs-font-style);
|
35
41
|
font-weight: var(--glide-core-body-xs-font-weight);
|
36
42
|
line-height: var(--glide-core-body-xs-line-height);
|
37
|
-
padding-inline: var(--glide-core-spacing-xs);
|
43
|
+
padding-inline-start: var(--glide-core-spacing-xs);
|
44
|
+
|
45
|
+
&:not(.editable) {
|
46
|
+
padding-inline-end: var(--glide-core-spacing-xs);
|
47
|
+
}
|
38
48
|
}
|
39
49
|
}
|
40
50
|
|
41
51
|
.checkbox {
|
52
|
+
flex-grow: 1;
|
53
|
+
overflow: hidden;
|
54
|
+
|
42
55
|
&.large {
|
43
56
|
&::part(private-label-and-input-and-checkbox) {
|
44
|
-
padding-inline: var(--glide-core-spacing-sm);
|
57
|
+
padding-inline-start: var(--glide-core-spacing-sm);
|
58
|
+
}
|
59
|
+
|
60
|
+
&:not(.editable) {
|
61
|
+
&::part(private-label-and-input-and-checkbox) {
|
62
|
+
padding-inline-end: var(--glide-core-spacing-sm);
|
63
|
+
}
|
45
64
|
}
|
46
65
|
}
|
47
66
|
|
48
67
|
&.small {
|
49
68
|
&::part(private-label-and-input-and-checkbox) {
|
50
|
-
padding-inline: var(--glide-core-spacing-xs);
|
69
|
+
padding-inline-start: var(--glide-core-spacing-xs);
|
70
|
+
}
|
71
|
+
|
72
|
+
&:not(.editable) {
|
73
|
+
&::part(private-label-and-input-and-checkbox) {
|
74
|
+
padding-inline-end: var(--glide-core-spacing-xs);
|
75
|
+
}
|
51
76
|
}
|
52
77
|
}
|
53
78
|
|
@@ -56,22 +81,18 @@ import{css}from"lit";export default[css`
|
|
56
81
|
}
|
57
82
|
}
|
58
83
|
|
59
|
-
.checked-icon {
|
60
|
-
display: inline-flex;
|
61
|
-
justify-content: center;
|
62
|
-
margin-inline-start: auto;
|
63
|
-
opacity: 0;
|
64
|
-
|
65
|
-
&.visible {
|
66
|
-
opacity: 1;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
84
|
.indeterminate-icon {
|
71
85
|
display: none;
|
72
86
|
}
|
73
87
|
|
74
88
|
.icon-slot {
|
89
|
+
&::slotted(*) {
|
90
|
+
display: block;
|
91
|
+
padding-inline-end: var(--glide-core-spacing-xs);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
.checkbox-icon-slot {
|
75
96
|
&::slotted(*) {
|
76
97
|
block-size: 1rem;
|
77
98
|
display: block;
|
@@ -80,6 +101,7 @@ import{css}from"lit";export default[css`
|
|
80
101
|
}
|
81
102
|
|
82
103
|
.tooltip {
|
104
|
+
margin-inline-end: auto;
|
83
105
|
overflow: hidden;
|
84
106
|
}
|
85
107
|
|
@@ -88,4 +110,47 @@ import{css}from"lit";export default[css`
|
|
88
110
|
text-overflow: ellipsis;
|
89
111
|
white-space: nowrap;
|
90
112
|
}
|
113
|
+
|
114
|
+
.checked-icon-container {
|
115
|
+
--size: 1rem;
|
116
|
+
|
117
|
+
display: contents;
|
118
|
+
|
119
|
+
> svg {
|
120
|
+
flex-shrink: 0;
|
121
|
+
padding-inline-start: var(--glide-core-spacing-xs);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
.edit-button {
|
126
|
+
align-items: center;
|
127
|
+
background-color: transparent;
|
128
|
+
block-size: 100%;
|
129
|
+
border: none;
|
130
|
+
display: flex;
|
131
|
+
padding-block: 0;
|
132
|
+
padding-inline-start: var(--glide-core-spacing-xs);
|
133
|
+
|
134
|
+
&.active {
|
135
|
+
color: var(--glide-core-text-primary-hover);
|
136
|
+
}
|
137
|
+
|
138
|
+
&.large {
|
139
|
+
padding-inline-end: var(--glide-core-spacing-sm);
|
140
|
+
}
|
141
|
+
|
142
|
+
&.small {
|
143
|
+
padding-inline-end: var(--glide-core-spacing-xs);
|
144
|
+
}
|
145
|
+
|
146
|
+
&:focus {
|
147
|
+
outline: none;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
.edit-icon {
|
152
|
+
block-size: 0.875rem;
|
153
|
+
display: block;
|
154
|
+
inline-size: 0.875rem;
|
155
|
+
}
|
91
156
|
`];
|