@crowdstrike/glide-core 0.14.1 → 0.15.1
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/button-group.d.ts +2 -2
- package/dist/button-group.js +1 -1
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.d.ts +2 -1
- package/dist/checkbox.js +13 -7
- package/dist/checkbox.styles.js +7 -2
- package/dist/drawer.styles.js +1 -0
- package/dist/dropdown.d.ts +4 -1
- package/dist/dropdown.js +69 -50
- package/dist/dropdown.option.d.ts +2 -0
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +15 -2
- package/dist/dropdown.styles.js +32 -5
- package/dist/form-controls-layout.d.ts +1 -1
- package/dist/icons/informational.d.ts +2 -0
- package/dist/icons/informational.js +1 -0
- package/dist/icons/magnifying-glass.js +1 -1
- package/dist/inline-alert.d.ts +29 -0
- package/dist/inline-alert.js +1 -0
- package/dist/inline-alert.styles.d.ts +2 -0
- package/dist/inline-alert.styles.js +100 -0
- package/dist/input.d.ts +0 -2
- package/dist/input.js +11 -11
- package/dist/library/localize.d.ts +1 -0
- package/dist/menu.button.d.ts +3 -0
- package/dist/menu.button.js +1 -1
- package/dist/menu.button.styles.js +9 -1
- package/dist/menu.d.ts +1 -1
- package/dist/menu.js +1 -1
- package/dist/menu.link.d.ts +2 -0
- package/dist/menu.link.js +1 -1
- package/dist/menu.link.styles.js +10 -1
- package/dist/radio-group.js +1 -1
- package/dist/split-button.d.ts +2 -2
- package/dist/styles/variables.css +1 -1
- package/dist/tab.d.ts +4 -1
- package/dist/tab.group.d.ts +2 -2
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +3 -2
- package/dist/tab.js +1 -1
- package/dist/tab.panel.d.ts +1 -1
- package/dist/tab.panel.js +1 -1
- package/dist/tab.panel.styles.js +14 -0
- package/dist/tag.styles.js +1 -0
- 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/dist/tree.js +1 -1
- package/package.json +48 -48
package/dist/dropdown.option.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,o){var l,s=arguments.length,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var l,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var r=e.length-1;r>=0;r--)(l=e[r])&&(a=(s<3?l(a):s>3?l(t,i,a):l(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};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.privateIsTooltipOpen=!1,this.isLabelOverflow=!1,this.#e=createRef(),this.#t=createRef(),this.#i=nanoid(),this.#o=!1,this.#l=!1,this.#s="",this.#a=createRef(),this.#r=!1,this.#n=""}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#o}set disabled(e){this.role=e?"none":"option",this.#o=e}get editable(){return this.#l}set editable(e){this.#l=e,this.dispatchEvent(new Event("private-editable-change",{bubbles:!0}))}get label(){return this.#s}set label(e){this.#s=e,setTimeout((()=>{this.#d()})),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.#p)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=this.disabled?"none":"option",this.tabIndex=-1,this.#c=new IntersectionObserver((()=>{this.checkVisibility()&&this.#d()})),this.#c.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#c?.disconnect()}firstUpdated(){this.#e.value&&(this.#e.value.checked=this.selected)}get value(){return this.#n}set value(e){this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:this.value,new:e}})),this.#n=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,disabled:this.disabled,[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.#h}" ?disabled="${this.disabled}" ?indeterminate="${this.privateIndeterminate}" ?private-show-label-tooltip="${this.privateIsTooltipOpen}" ?private-disable-label-tooltip="${this.disabled}" ${ref(this.#e)}><slot class="${classMap({"checkbox-icon-slot":!0,[this.privateSize]:!0})}" name="icon" slot="private-icon"></slot></glide-core-checkbox>${when(this.editable,(()=>html`<button class="${classMap({"edit-button":!0,active:this.privateIsEditActive,disabled:this.disabled,multiple:Boolean(this.isMultiple),[this.privateSize]:!0})}" data-test="edit-button" type="button" @mouseover="${this.#v}" @mouseout="${this.#b}">${pencilIcon}</button>`))}`),(()=>html`<div class="${classMap({option:!0,disabled:this.disabled,editable:this.editable,[this.privateSize]:!0})}"><slot class="${classMap({"icon-slot":!0,[this.privateSize]:!0})}" name="icon"></slot><glide-core-tooltip class="tooltip" offset="${10}" ?disabled="${!this.isLabelOverflow||this.disabled}" ?open="${this.privateIsTooltipOpen}"><div aria-hidden="true" data-test="tooltip">${this.label}</div><div class="label" data-test="label" slot="target" ${ref(this.#a)}>${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,disabled:this.disabled,[this.privateSize]:!0})}" data-test="edit-button" type="button" @mouseover="${this.#v}" @mouseout="${this.#b}">${pencilIcon}</button>`))}</div>`))}</div>`}#e;#t;#i;#c;#o;#l;#s;#a;#r;#n;get#p(){return[...this.closest("glide-core-dropdown")?.querySelectorAll("glide-core-dropdown-option")??[]]}#h(e){e.stopPropagation()}#b(){this.privateIsEditActive=!1}#v(){this.privateIsEditActive=!0}#d(){this.#a.value&&(this.isLabelOverflow=this.#a.value.scrollWidth>this.#a.value.clientWidth)}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"disabled",null),__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,"privateIsTooltipOpen",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;
|
@@ -9,13 +9,16 @@ import{css}from"lit";export default[css`
|
|
9
9
|
user-select: none;
|
10
10
|
|
11
11
|
&.active {
|
12
|
-
|
12
|
+
&:not(.disabled) {
|
13
|
+
background-color: var(--glide-core-surface-hover);
|
14
|
+
}
|
13
15
|
}
|
14
16
|
}
|
15
17
|
|
16
18
|
.option {
|
17
19
|
align-items: center;
|
18
20
|
block-size: 100%;
|
21
|
+
color: var(--glide-core-text-body-1);
|
19
22
|
display: flex;
|
20
23
|
flex-grow: 1;
|
21
24
|
overflow: hidden;
|
@@ -46,6 +49,10 @@ import{css}from"lit";export default[css`
|
|
46
49
|
padding-inline-end: var(--glide-core-spacing-xs);
|
47
50
|
}
|
48
51
|
}
|
52
|
+
|
53
|
+
&.disabled {
|
54
|
+
color: var(--glide-core-icon-tertiary-disabled);
|
55
|
+
}
|
49
56
|
}
|
50
57
|
|
51
58
|
.checkbox {
|
@@ -162,7 +169,13 @@ import{css}from"lit";export default[css`
|
|
162
169
|
padding-inline-start: var(--glide-core-spacing-xs);
|
163
170
|
|
164
171
|
&.active {
|
165
|
-
|
172
|
+
&:not(.disabled) {
|
173
|
+
color: var(--glide-core-text-primary-hover);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
&.disabled {
|
178
|
+
color: var(--glide-core-icon-tertiary-disabled);
|
166
179
|
}
|
167
180
|
|
168
181
|
&.large {
|
package/dist/dropdown.styles.js
CHANGED
@@ -292,7 +292,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
292
292
|
overflow: hidden;
|
293
293
|
|
294
294
|
/*
|
295
|
-
|
295
|
+
0.125rem so the label is vertically aligned. "vertical-align: middle" has no
|
296
296
|
effect on flex children.
|
297
297
|
*/
|
298
298
|
padding-block-start: 0.125rem;
|
@@ -319,6 +319,20 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
319
319
|
margin-inline-end: var(--glide-core-spacing-xxs);
|
320
320
|
}
|
321
321
|
|
322
|
+
.input-tooltip {
|
323
|
+
display: none;
|
324
|
+
flex-grow: 1;
|
325
|
+
|
326
|
+
&.visible {
|
327
|
+
display: block;
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
.input-container {
|
332
|
+
display: flex;
|
333
|
+
flex-grow: 1;
|
334
|
+
}
|
335
|
+
|
322
336
|
.input {
|
323
337
|
background-color: transparent;
|
324
338
|
block-size: var(--button-and-input-height);
|
@@ -332,10 +346,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
332
346
|
|
333
347
|
&:not(.quiet) {
|
334
348
|
/*
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
padding-block: 0.125rem
|
349
|
+
0.125rem so the value is vertically aligned. "vertical-align: middle" has no
|
350
|
+
effect flex children.
|
351
|
+
*/
|
352
|
+
padding-block-start: 0.125rem;
|
339
353
|
}
|
340
354
|
|
341
355
|
&:focus {
|
@@ -348,6 +362,19 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
348
362
|
}
|
349
363
|
}
|
350
364
|
|
365
|
+
.ellipsis {
|
366
|
+
background-color: var(--glide-core-surface-page);
|
367
|
+
inset-block-end: 0;
|
368
|
+
inset-inline-end: 0;
|
369
|
+
|
370
|
+
/*
|
371
|
+
0.125rem so the value is vertically aligned with the value of ".input", which
|
372
|
+
has the same padding so it's centered vertically.
|
373
|
+
*/
|
374
|
+
padding-block-start: 0.125rem;
|
375
|
+
position: absolute;
|
376
|
+
}
|
377
|
+
|
351
378
|
.description {
|
352
379
|
display: block;
|
353
380
|
|
@@ -14,7 +14,7 @@ export default class GlideCoreFormControlsLayout extends LitElement {
|
|
14
14
|
#private;
|
15
15
|
static shadowRootOptions: ShadowRootInit;
|
16
16
|
static styles: import("lit").CSSResult[];
|
17
|
-
get split():
|
17
|
+
get split(): "left" | "middle";
|
18
18
|
set split(split: 'left' | 'middle');
|
19
19
|
firstUpdated(): void;
|
20
20
|
render(): import("lit").TemplateResult<1>;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{svg}from"lit/static-html.js";export default svg`<svg aria-hidden="true" viewBox="0 0 16 16" fill="none" style="height: var(--size, 1rem); width: var(--size, 1rem);"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.99996 0.666672C3.94987 0.666672 0.666626 3.94992 0.666626 8C0.666626 12.0501 3.94987 15.3333 7.99996 15.3333C12.05 15.3333 15.3333 12.0501 15.3333 8C15.3333 3.94992 12.05 0.666672 7.99996 0.666672ZM8.66663 5.33334C8.66663 4.96515 8.36815 4.66667 7.99996 4.66667C7.63177 4.66667 7.33329 4.96515 7.33329 5.33334V8C7.33329 8.36819 7.63177 8.66667 7.99996 8.66667C8.36815 8.66667 8.66663 8.36819 8.66663 8V5.33334ZM7.99996 10C7.63177 10 7.33329 10.2985 7.33329 10.6667C7.33329 11.0349 7.63177 11.3333 7.99996 11.3333H8.00663C8.37482 11.3333 8.67329 11.0349 8.67329 10.6667C8.67329 10.2985 8.37482 10 8.00663 10H7.99996Z" fill="currentColor"/></svg>`;
|
@@ -1 +1 @@
|
|
1
|
-
import{svg}from"lit/static-html.js";export default svg`<svg class="search-icon" data-test="search-icon" fill="none" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/></svg>`;
|
1
|
+
import{svg}from"lit/static-html.js";export default svg`<svg class="search-icon" data-test="search-icon" fill="none" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="display: block;"><path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/></svg>`;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import './icon-button.js';
|
2
|
+
import { LitElement } from 'lit';
|
3
|
+
declare global {
|
4
|
+
interface HTMLElementTagNameMap {
|
5
|
+
'glide-core-inline-alert': GlideCoreInlineAlert;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* @event remove - `(event: Event) => void`
|
10
|
+
*
|
11
|
+
* @slot - The content of the Inline Alert.
|
12
|
+
*/
|
13
|
+
export default class GlideCoreInlineAlert extends LitElement {
|
14
|
+
#private;
|
15
|
+
static shadowRootOptions: ShadowRootInit;
|
16
|
+
static styles: import("lit").CSSResult[];
|
17
|
+
variant: keyof typeof icons;
|
18
|
+
removable?: boolean | undefined;
|
19
|
+
firstUpdated(): void;
|
20
|
+
focus(): void;
|
21
|
+
render(): import("lit").TemplateResult<1>;
|
22
|
+
}
|
23
|
+
declare const icons: {
|
24
|
+
informational: import("lit").TemplateResult;
|
25
|
+
medium: import("lit").TemplateResult<2>;
|
26
|
+
high: import("lit").TemplateResult<2>;
|
27
|
+
critical: import("lit").TemplateResult<2>;
|
28
|
+
};
|
29
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,i){var l,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(r=(n<3?l(r):n>3?l(t,o,r):l(t,o))||r);return n>3&&r&&Object.defineProperty(t,o,r),r};import"./icon-button.js";import{LitElement,html,svg}from"lit";import{LocalizeController}from"./library/localize.js";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{owSlot}from"./library/ow.js";import{when}from"lit/directives/when.js";import informationalIcon from"./icons/informational.js";import styles from"./inline-alert.styles.js";let GlideCoreInlineAlert=class GlideCoreInlineAlert extends LitElement{constructor(){super(...arguments),this.variant="informational",this.removable=!1,this.#e=100,this.#t=createRef(),this.#o=createRef(),this.#i=!1,this.#l=new LocalizeController(this),this.#n=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}firstUpdated(){owSlot(this.#o.value),this.#t.value?.addEventListener("animationend",(()=>{this.#t.value?.classList.remove("added")}),{once:!0})}focus(){this.#n.value?.focus()}render(){return html`<div class="${classMap({component:!0,added:!0,[this.variant]:!0})}" role="alert" aria-labelledby="label" data-test="component" data-animation-duration="${this.#e}" style="--animation-duration: ${this.#e}ms" ${ref(this.#t)}><div aria-hidden="true" class="${classMap({"icon-container":!0,[this.variant]:!0})}">${icons[this.variant]}</div><div id="label" class="content"><slot @slotchange="${this.#r}" ${ref(this.#o)}></slot></div>${when(this.removable,(()=>html`<glide-core-icon-button label="${this.#l.term("closeInlineAlert",this.variant)}" variant="tertiary" class="removal-button" data-test="removal-button" @click="${this.#a}" @keydown="${this.#s}" ${ref(this.#n)}><svg width="16" height="16" viewBox="0 0 14 14" fill="none"><path d="M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg></glide-core-icon-button>`))}</div>`}#e;#t;#o;#i;#l;#n;#r(){owSlot(this.#o.value)}#a(){this.#i?this.#i=!1:(setTimeout((()=>{this.remove()}),this.#e),this.#t.value?.classList.add("removed"),this.dispatchEvent(new Event("remove",{bubbles:!0,composed:!0})))}#s(e){["Enter"," "].includes(e.key)&&(this.#i=!0,setTimeout((()=>{this.remove()}),this.#e),this.#t.value?.classList.add("removed"),this.dispatchEvent(new Event("remove",{bubbles:!0,composed:!0})))}};__decorate([property({reflect:!0})],GlideCoreInlineAlert.prototype,"variant",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreInlineAlert.prototype,"removable",void 0),GlideCoreInlineAlert=__decorate([customElement("glide-core-inline-alert")],GlideCoreInlineAlert);export default GlideCoreInlineAlert;const icons={informational:informationalIcon,medium:svg`<svg aria-hidden="true" viewBox="0 0 16 16" fill="none" style="height: var(--size, 1rem); width: var(--size, 1rem);"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.54175 1.44697C8.19688 1.29362 7.80317 1.29362 7.45829 1.44697C7.19194 1.5654 7.01892 1.77402 6.89852 1.944C6.78014 2.11113 6.6534 2.33007 6.51402 2.57087L1.00258 12.0906C0.862641 12.3323 0.735472 12.5519 0.649245 12.7383C0.561611 12.9277 0.466542 13.1824 0.496841 13.473C0.536048 13.849 0.733076 14.1908 1.03889 14.4131C1.27522 14.585 1.54321 14.6303 1.75105 14.6493C1.95555 14.6681 2.20932 14.6681 2.48858 14.668H13.5114C13.7907 14.6681 14.0445 14.6681 14.249 14.6493C14.4568 14.6303 14.7248 14.585 14.9612 14.4131C15.267 14.1908 15.464 13.849 15.5032 13.473C15.5335 13.1824 15.4384 12.9277 15.3508 12.7383C15.2646 12.5519 15.1374 12.3323 14.9975 12.0907L9.48601 2.57085C9.34664 2.33006 9.2199 2.11112 9.10153 1.944C8.98113 1.77401 8.80811 1.5654 8.54175 1.44697ZM8.66671 6.33472C8.66671 5.96653 8.36823 5.66806 8.00004 5.66806C7.63185 5.66806 7.33337 5.96653 7.33337 6.33472V9.00139C7.33337 9.36958 7.63185 9.66805 8.00004 9.66805C8.36823 9.66805 8.66671 9.36958 8.66671 9.00139V6.33472ZM8.00004 11.0014C7.63185 11.0014 7.33337 11.2999 7.33337 11.6681C7.33337 12.0362 7.63185 12.3347 8.00004 12.3347H8.00671C8.3749 12.3347 8.67337 12.0362 8.67337 11.6681C8.67337 11.2999 8.3749 11.0014 8.00671 11.0014H8.00004Z" fill="currentColor"/></svg>`,high:svg`<svg aria-hidden="true" viewBox="0 0 16 16" fill="none" style="height: var(--size, 1rem); width: var(--size, 1rem);"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.8924 1.33334H4.10768C3.75626 1.33333 3.45307 1.33332 3.20336 1.35372C2.93979 1.37525 2.67765 1.4228 2.42539 1.55132C2.04907 1.74307 1.74311 2.04903 1.55136 2.42536C1.42283 2.67761 1.37529 2.93976 1.35376 3.20332C1.33335 3.45303 1.33336 3.75619 1.33337 4.10762V11.8924C1.33336 12.2438 1.33335 12.547 1.35376 12.7967C1.37529 13.0603 1.42283 13.3224 1.55136 13.5747C1.74311 13.951 2.04907 14.2569 2.42539 14.4487C2.67765 14.5772 2.93979 14.6248 3.20336 14.6463C3.45307 14.6667 3.75624 14.6667 4.10766 14.6667H11.8924C12.2438 14.6667 12.547 14.6667 12.7967 14.6463C13.0603 14.6248 13.3224 14.5772 13.5747 14.4487C13.951 14.2569 14.257 13.951 14.4487 13.5747C14.5773 13.3224 14.6248 13.0603 14.6463 12.7967C14.6667 12.547 14.6667 12.2438 14.6667 11.8924V4.10763C14.6667 3.7562 14.6667 3.45303 14.6463 3.20332C14.6248 2.93976 14.5773 2.67761 14.4487 2.42536C14.257 2.04903 13.951 1.74307 13.5747 1.55132C13.3224 1.4228 13.0603 1.37525 12.7967 1.35372C12.547 1.33332 12.2438 1.33333 11.8924 1.33334ZM8.66671 5.33334C8.66671 4.96515 8.36823 4.66667 8.00004 4.66667C7.63185 4.66667 7.33337 4.96515 7.33337 5.33334V8C7.33337 8.36819 7.63185 8.66667 8.00004 8.66667C8.36823 8.66667 8.66671 8.36819 8.66671 8V5.33334ZM8.00004 10C7.63185 10 7.33337 10.2985 7.33337 10.6667C7.33337 11.0349 7.63185 11.3333 8.00004 11.3333H8.00671C8.3749 11.3333 8.67338 11.0349 8.67338 10.6667C8.67338 10.2985 8.3749 10 8.00671 10H8.00004Z" fill="currentColor"/></svg>`,critical:svg`<svg aria-hidden="true" viewBox="0 0 16 16" fill="none" style="height: var(--size, 1rem); width: var(--size, 1rem);"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.26864 0.790031C8.09143 0.753584 7.90865 0.753584 7.73144 0.790031C7.52659 0.832161 7.3435 0.934713 7.19794 1.01624L7.15826 1.03841L2.22493 3.77915L2.18284 3.8024C2.02875 3.88727 1.835 3.99398 1.68622 4.15543C1.55759 4.29502 1.46024 4.46046 1.40069 4.6407C1.33181 4.84916 1.33262 5.07035 1.33326 5.24627L1.33338 5.29435V10.7058L1.33326 10.7538C1.33262 10.9298 1.33181 11.1509 1.40069 11.3594C1.46024 11.5397 1.55759 11.7051 1.68622 11.8447C1.835 12.0061 2.02873 12.1128 2.18281 12.1977L2.22493 12.221L7.15826 14.9617L7.19793 14.9839C7.34349 15.0654 7.52659 15.1679 7.73144 15.2101C7.90865 15.2465 8.09143 15.2465 8.26864 15.2101C8.4735 15.1679 8.65659 15.0654 8.80215 14.9839L8.84182 14.9617L13.7752 12.221L13.8172 12.1977C13.9713 12.1128 14.1651 12.0061 14.3139 11.8447C14.4425 11.7051 14.5398 11.5397 14.5994 11.3594C14.6683 11.1509 14.6675 10.9298 14.6668 10.7538L14.6667 10.7058V5.29435L14.6668 5.24627C14.6675 5.07035 14.6683 4.84916 14.5994 4.6407C14.5398 4.46046 14.4425 4.29502 14.3139 4.15543C14.1651 3.99398 13.9713 3.88727 13.8172 3.8024L13.7752 3.77915L8.84182 1.03841L8.80215 1.01624C8.65659 0.934713 8.47349 0.832161 8.26864 0.790031ZM8.66671 5.33333C8.66671 4.96514 8.36823 4.66667 8.00004 4.66667C7.63185 4.66667 7.33337 4.96514 7.33337 5.33333V8C7.33337 8.36819 7.63185 8.66667 8.00004 8.66667C8.36823 8.66667 8.66671 8.36819 8.66671 8V5.33333ZM8.00004 10C7.63185 10 7.33337 10.2985 7.33337 10.6667C7.33337 11.0349 7.63185 11.3333 8.00004 11.3333H8.00671C8.3749 11.3333 8.67337 11.0349 8.67337 10.6667C8.67337 10.2985 8.3749 10 8.00671 10H8.00004Z" fill="currentColor"/></svg>`};
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import{css}from"lit";export default[css`
|
2
|
+
.component {
|
3
|
+
align-items: flex-start;
|
4
|
+
border: 1px solid;
|
5
|
+
border-radius: var(--glide-core-spacing-sm);
|
6
|
+
color: var(--glide-core-text-body-2);
|
7
|
+
display: flex;
|
8
|
+
font-family: var(--glide-core-body-sm-font-family);
|
9
|
+
font-size: var(--glide-core-body-sm-font-size);
|
10
|
+
font-weight: var(--glide-core-body-sm-font-weight);
|
11
|
+
gap: var(--glide-core-spacing-xs);
|
12
|
+
line-height: var(--glide-core-body-sm-line-height);
|
13
|
+
padding: var(--glide-core-spacing-sm);
|
14
|
+
|
15
|
+
&.informational {
|
16
|
+
background-color: var(--glide-core-surface-informational);
|
17
|
+
border-color: var(--glide-core-border-informational);
|
18
|
+
}
|
19
|
+
|
20
|
+
&.medium {
|
21
|
+
background-color: var(--glide-core-surface-warning);
|
22
|
+
border-color: var(--glide-core-border-attention);
|
23
|
+
}
|
24
|
+
|
25
|
+
&.high {
|
26
|
+
background-color: var(--glide-core-surface-warning);
|
27
|
+
border-color: var(--glide-core-border-warning);
|
28
|
+
}
|
29
|
+
|
30
|
+
&.critical {
|
31
|
+
background-color: var(--glide-core-surface-error);
|
32
|
+
border-color: var(--glide-core-border-error);
|
33
|
+
}
|
34
|
+
|
35
|
+
&.added {
|
36
|
+
animation: fade-in var(--animation-duration) ease-in-out;
|
37
|
+
}
|
38
|
+
|
39
|
+
&.removed {
|
40
|
+
animation-duration: var(--animation-duration);
|
41
|
+
animation-fill-mode: forwards;
|
42
|
+
animation-name: fade-out;
|
43
|
+
animation-timing-function: ease-in-out;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
@keyframes fade-in {
|
48
|
+
0% {
|
49
|
+
opacity: 0;
|
50
|
+
}
|
51
|
+
|
52
|
+
100% {
|
53
|
+
opacity: 1;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
@keyframes fade-out {
|
58
|
+
0% {
|
59
|
+
opacity: 1;
|
60
|
+
}
|
61
|
+
|
62
|
+
100% {
|
63
|
+
opacity: 0;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
.icon-container {
|
68
|
+
block-size: 1rem;
|
69
|
+
inline-size: 1rem;
|
70
|
+
|
71
|
+
&.informational {
|
72
|
+
color: var(--glide-core-status-warning-informational);
|
73
|
+
}
|
74
|
+
|
75
|
+
&.medium {
|
76
|
+
color: var(--glide-core-status-warning-medium);
|
77
|
+
}
|
78
|
+
|
79
|
+
&.high {
|
80
|
+
color: var(--glide-core-status-warning-high);
|
81
|
+
}
|
82
|
+
|
83
|
+
&.critical {
|
84
|
+
color: var(--glide-core-status-warning-critical);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
.content {
|
89
|
+
display: flex;
|
90
|
+
flex-grow: 1;
|
91
|
+
overflow-wrap: anywhere;
|
92
|
+
}
|
93
|
+
|
94
|
+
.removal-button {
|
95
|
+
--icon-color: var(--glide-core-icon-default2);
|
96
|
+
|
97
|
+
align-self: flex-start;
|
98
|
+
transition: color 200ms ease-in-out;
|
99
|
+
}
|
100
|
+
`];
|
package/dist/input.d.ts
CHANGED
@@ -50,8 +50,6 @@ export default class GlideCoreInput extends LitElement {
|
|
50
50
|
disconnectedCallback(): void;
|
51
51
|
formAssociatedCallback(): void;
|
52
52
|
formResetCallback(): void;
|
53
|
-
get hasClearIcon(): boolean;
|
54
|
-
get isClearIconVisible(): boolean;
|
55
53
|
render(): import("lit").TemplateResult<1>;
|
56
54
|
reportValidity(): boolean;
|
57
55
|
setCustomValidity(message: string): void;
|
package/dist/input.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,i,s){var a,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,s){var a,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(r=(o<3?a(r):o>3?a(e,i,r):a(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};import"./icon-button.js";import"./label.js";import{LitElement,html,nothing}from"lit";import{LocalizeController}from"./library/localize.js";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{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import ow from"./library/ow.js";import styles from"./input.styles.js";export const SUPPORTED_TYPES=["date","email","number","password","search","tel","text","url"];let GlideCoreInput=class GlideCoreInput extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed",delegatesFocus:!0}}static{this.styles=styles}get form(){return this.#t.form}get validity(){return this.pattern?(this.#t.setValidity({customError:Boolean(this.validityMessage),patternMismatch:!new RegExp(this.pattern).test(this.value),valueMissing:Boolean(this.required&&!this.value)}," ",this.#e.value),this.#t.validity):!this.pattern&&this.#t.validity.patternMismatch?(this.#t.setValidity({}),this.#t.validity):!this.required||this.value||this.disabled?this.required&&this.#t.validity.valueMissing&&this.value?(this.#t.setValidity({}),this.#t.validity):(this.required||!this.#t.validity.valueMissing||this.value||this.#t.setValidity({}),this.#t.validity):(this.#t.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#e.value),this.#t.validity)}get willValidate(){return this.#t.willValidate}blur(){this.#e.value?.blur()}checkValidity(){this.isCheckingValidity=!0;const t=this.#t.checkValidity();return this.isCheckingValidity=!1,t}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#i)}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#i)}formResetCallback(){this.value=this.getAttribute("value")??""}render(){return html`
|
2
2
|
<glide-core-private-label
|
3
3
|
class=${classMap({left:"left"===this.privateSplit,middle:"middle"===this.privateSplit})}
|
4
4
|
orientation=${this.orientation}
|
@@ -31,21 +31,21 @@ var __decorate=this&&this.__decorate||function(t,e,i,s){var a,r=arguments.length
|
|
31
31
|
?required=${this.required}
|
32
32
|
?readonly=${this.readonly}
|
33
33
|
?disabled=${this.disabled}
|
34
|
-
@focus=${this.#
|
35
|
-
@blur=${this.#
|
34
|
+
@focus=${this.#o}
|
35
|
+
@blur=${this.#r}
|
36
36
|
@change=${this.#l}
|
37
37
|
@input=${this.#n}
|
38
38
|
@keydown=${this.#d}
|
39
39
|
${ref(this.#e)}
|
40
40
|
/>
|
41
41
|
|
42
|
-
${this
|
42
|
+
${this.#h?html`
|
43
43
|
<glide-core-icon-button
|
44
44
|
variant="tertiary"
|
45
|
-
class=${classMap({"clear-icon-button":!0,"clear-icon-button--visible":this
|
45
|
+
class=${classMap({"clear-icon-button":!0,"clear-icon-button--visible":this.#p})}
|
46
46
|
data-test="clear-button"
|
47
|
-
label=${this.#
|
48
|
-
@click=${this.#
|
47
|
+
label=${this.#c.term("clearEntry",this.label)}
|
48
|
+
@click=${this.#u}
|
49
49
|
>
|
50
50
|
<!-- X icon -->
|
51
51
|
<svg
|
@@ -79,7 +79,7 @@ var __decorate=this&&this.__decorate||function(t,e,i,s){var a,r=arguments.length
|
|
79
79
|
label=${this.passwordVisible?"Hide password":"Show password"}
|
80
80
|
aria-controls="input"
|
81
81
|
aria-expanded=${this.passwordVisible?"true":"false"}
|
82
|
-
@click=${this.#
|
82
|
+
@click=${this.#v}
|
83
83
|
>
|
84
84
|
${this.passwordVisible?html`<svg
|
85
85
|
aria-hidden="true"
|
@@ -143,14 +143,14 @@ var __decorate=this&&this.__decorate||function(t,e,i,s){var a,r=arguments.length
|
|
143
143
|
more accesible, verbose description below.
|
144
144
|
-->
|
145
145
|
<span aria-hidden="true" data-test="character-count-text">
|
146
|
-
${this.#
|
146
|
+
${this.#c.term("displayedCharacterCount",this.#y,this.maxlength)}
|
147
147
|
</span>
|
148
148
|
|
149
149
|
<span class="hidden" data-test="character-count-announcement"
|
150
|
-
>${this.#
|
150
|
+
>${this.#c.term("announcedCharacterCount",this.#y,this.maxlength)}</span
|
151
151
|
>
|
152
152
|
</div>
|
153
153
|
`:nothing}
|
154
154
|
</div>
|
155
155
|
</glide-core-private-label>
|
156
|
-
`}reportValidity(){this.isReportValidityOrSubmit=!0;const t=this.#t.reportValidity();return this.requestUpdate(),t}setCustomValidity(t){this.validityMessage=t,""===t?this.#t.setValidity({customError:!1},"",this.#e.value):this.#t.setValidity({customError:!0,patternMismatch:this.#t.validity.patternMismatch,valueMissing:this.#t.validity.valueMissing}," ",this.#e.value)}setValidity(t,e){this.validityMessage=e,this.#t.setValidity(t," ",this.#e.value)}constructor(){super(),this.type="text",this.name="",this.value="",this.hideLabel=!1,this.orientation="horizontal",this.clearable=!1,this.spellcheck=!1,this.autocapitalize="on",this.autocomplete="on",this.passwordToggle=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.hasFocus=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.passwordVisible=!1,this.#e=createRef(),this.#
|
156
|
+
`}reportValidity(){this.isReportValidityOrSubmit=!0;const t=this.#t.reportValidity();return this.requestUpdate(),t}setCustomValidity(t){this.validityMessage=t,""===t?this.#t.setValidity({customError:!1},"",this.#e.value):this.#t.setValidity({customError:!0,patternMismatch:this.#t.validity.patternMismatch,valueMissing:this.#t.validity.valueMissing}," ",this.#e.value)}setValidity(t,e){this.validityMessage=e,this.#t.setValidity(t," ",this.#e.value)}constructor(){super(),this.type="text",this.name="",this.value="",this.hideLabel=!1,this.orientation="horizontal",this.clearable=!1,this.spellcheck=!1,this.autocapitalize="on",this.autocomplete="on",this.passwordToggle=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.hasFocus=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.passwordVisible=!1,this.#e=createRef(),this.#c=new LocalizeController(this),this.#i=({formData:t})=>{this.name&&this.value&&!this.disabled&&t.append(this.name,this.value)},this.#t=this.attachInternals(),this.addEventListener("invalid",(t=>{if(t?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#e;#t;#c;get#h(){return this.clearable&&!this.disabled&&!this.readonly}get#p(){return this.#h&&this.value.length>0}get#y(){return this.value.length}#i;get#a(){return Boolean(!this.disabled&&!this.readonly&&this.maxlength&&this.#y>this.maxlength)}get#s(){return!this.disabled&&!this.validity?.valid&&this.isReportValidityOrSubmit}#r(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1,this.hasFocus=!1}#l(t){ow(this.#e.value,ow.object.instanceOf(HTMLInputElement)),this.value=this.#e.value?.value,this.dispatchEvent(new Event(t.type,t))}#u(t){this.value="",this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.#e.value?.focus(),t.stopPropagation()}#o(){this.hasFocus=!0}#n(){ow(this.#e.value,ow.object.instanceOf(HTMLInputElement)),this.value=this.#e.value.value}#d(t){"Enter"===t.key&&this.form?.requestSubmit()}#v(){this.passwordVisible=!this.passwordVisible}};__decorate([property()],GlideCoreInput.prototype,"type",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"name",void 0),__decorate([property()],GlideCoreInput.prototype,"value",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"label",void 0),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreInput.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"pattern",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"clearable",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreInput.prototype,"spellcheck",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"autocapitalize",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"password-toggle",type:Boolean})],GlideCoreInput.prototype,"passwordToggle",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreInput.prototype,"required",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"readonly",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreInput.prototype,"disabled",void 0),__decorate([property()],GlideCoreInput.prototype,"privateSplit",void 0),__decorate([property({type:Number,converter:t=>t&&Number.parseInt(t,10),reflect:!0})],GlideCoreInput.prototype,"maxlength",void 0),__decorate([state()],GlideCoreInput.prototype,"hasFocus",void 0),__decorate([state()],GlideCoreInput.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreInput.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreInput.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreInput.prototype,"passwordVisible",void 0),__decorate([state()],GlideCoreInput.prototype,"validityMessage",void 0),GlideCoreInput=__decorate([customElement("glide-core-input")],GlideCoreInput);export default GlideCoreInput;
|
package/dist/menu.button.d.ts
CHANGED
@@ -11,8 +11,11 @@ export default class GlideCoreMenuButton extends LitElement {
|
|
11
11
|
#private;
|
12
12
|
static shadowRootOptions: ShadowRootInit;
|
13
13
|
static styles: import("lit").CSSResult[];
|
14
|
+
get disabled(): boolean;
|
15
|
+
set disabled(isDisabled: boolean);
|
14
16
|
label?: string;
|
15
17
|
privateActive: boolean;
|
18
|
+
click(): void;
|
16
19
|
connectedCallback(): void;
|
17
20
|
render(): import("lit").TemplateResult<1>;
|
18
21
|
}
|
package/dist/menu.button.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,i){var s,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(r=(n<3?s(r):n>3?s(t,o,r):s(t,o))||r);return n>3&&r&&Object.defineProperty(t,o,r),r};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{nanoid}from"nanoid";import styles from"./menu.button.styles.js";let GlideCoreMenuButton=class GlideCoreMenuButton extends LitElement{constructor(){super(...arguments),this.privateActive=!1,this.#e=createRef(),this.#t=nanoid(),this.#o=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#o}set disabled(e){this.#o=e,e&&this.privateActive&&this.dispatchEvent(new Event("private-disabled",{bubbles:!0}))}click(){this.#e.value?.click()}connectedCallback(){super.connectedCallback(),this.id=this.#t,this.role="menuitem",this.tabIndex=-1}render(){return html`<button class="${classMap({component:!0,active:this.privateActive,disabled:this.disabled})}" ?disabled="${this.disabled}" data-test="component" type="button" ${ref(this.#e)}><slot name="icon"></slot>${this.label}</button>`}#e;#t;#o};__decorate([property({reflect:!0,type:Boolean})],GlideCoreMenuButton.prototype,"disabled",null),__decorate([property({reflect:!0})],GlideCoreMenuButton.prototype,"label",void 0),__decorate([property({type:Boolean})],GlideCoreMenuButton.prototype,"privateActive",void 0),GlideCoreMenuButton=__decorate([customElement("glide-core-menu-button")],GlideCoreMenuButton);export default GlideCoreMenuButton;
|
@@ -4,7 +4,6 @@ import{css}from"lit";export default[css`
|
|
4
4
|
background-color: transparent;
|
5
5
|
border: none;
|
6
6
|
border-radius: var(--glide-core-spacing-sm);
|
7
|
-
cursor: pointer;
|
8
7
|
display: flex;
|
9
8
|
font: inherit;
|
10
9
|
gap: var(--gap);
|
@@ -17,5 +16,14 @@ import{css}from"lit";export default[css`
|
|
17
16
|
&.active {
|
18
17
|
background-color: var(--glide-core-surface-hover);
|
19
18
|
}
|
19
|
+
|
20
|
+
&.disabled {
|
21
|
+
color: var(--glide-core-icon-tertiary-disabled);
|
22
|
+
}
|
23
|
+
|
24
|
+
&:not(.disabled) {
|
25
|
+
color: var(--glide-core-text-body-1);
|
26
|
+
cursor: pointer;
|
27
|
+
}
|
20
28
|
}
|
21
29
|
`];
|
package/dist/menu.d.ts
CHANGED
@@ -18,7 +18,7 @@ export default class GlideCoreMenu extends LitElement {
|
|
18
18
|
get open(): boolean;
|
19
19
|
set open(isOpen: boolean);
|
20
20
|
placement: Placement;
|
21
|
-
get size():
|
21
|
+
get size(): "small" | "large";
|
22
22
|
set size(size: 'small' | 'large');
|
23
23
|
connectedCallback(): void;
|
24
24
|
createRenderRoot(): ShadowRoot;
|
package/dist/menu.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,o){var n,s=arguments.length,l=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(l=(s<3?n(l):s>3?n(t,i,l):n(t,i))||l);return s>3&&l&&Object.defineProperty(t,i,l),l};import{LitElement,html}from"lit";import{autoUpdate,computePosition,flip,offset}from"@floating-ui/dom";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{nanoid}from"nanoid";import GlideCoreMenuButton from"./menu.button.js";import GlideCoreMenuLink from"./menu.link.js";import GlideCoreMenuOptions from"./menu.options.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./menu.styles.js";let GlideCoreMenu=class GlideCoreMenu extends LitElement{constructor(){super(...arguments),this.placement="bottom-start",this.#e=createRef(),this.#t=createRef(),this.#i=!1,this.#o=!1,this.#n=!1,this.#s="large",this.#
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var n,s=arguments.length,l=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(l=(s<3?n(l):s>3?n(t,i,l):n(t,i))||l);return s>3&&l&&Object.defineProperty(t,i,l),l};import{LitElement,html}from"lit";import{autoUpdate,computePosition,flip,offset}from"@floating-ui/dom";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{nanoid}from"nanoid";import GlideCoreMenuButton from"./menu.button.js";import GlideCoreMenuLink from"./menu.link.js";import GlideCoreMenuOptions from"./menu.options.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./menu.styles.js";let GlideCoreMenu=class GlideCoreMenu extends LitElement{constructor(){super(...arguments),this.placement="bottom-start",this.#e=createRef(),this.#t=createRef(),this.#i=!1,this.#o=!1,this.#n=!1,this.#s=!1,this.#l=!1,this.#a="large",this.#r=createRef(),this.#c=()=>{this.#o?this.#o=!1:this.#n?this.#n=!1:this.#l?this.#l=!1:(this.open=!1,this.#d&&(this.#d.ariaActivedescendant=""))}}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get offset(){return this.#h??Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}set offset(e){this.#h=e}get open(){return this.#s}set open(e){this.#s=e,e&&!this.isTargetDisabled?this.#p():this.#f()}get size(){return this.#a}set size(e){this.#a=e,this.#d&&(this.#d.privateSize=e)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#c,{capture:!0})}createRenderRoot(){return this.#u=super.createRenderRoot(),this.#u}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.#c,{capture:!0})}firstUpdated(){ow(this.#d,ow.object.instanceOf(GlideCoreMenuOptions)),owSlot(this.#t.value),owSlot(this.#r.value),owSlotType(this.#t.value,[GlideCoreMenuOptions]),this.#t.value.popover="manual",this.open&&!this.isTargetDisabled&&this.#p(),this.#r.value.addEventListener("mouseup",(()=>{this.#l=!0})),this.#t.value.addEventListener("mousedown",(e=>{e.target===this.#t.value&&e.preventDefault()})),this.#t.value.addEventListener("mouseup",(e=>{if(e.target!==this.#t.value){if(e.target instanceof Element){const t=e.target?.closest("glide-core-menu-link");t?.disabled&&(this.#n=!0)}}else this.#o=!0}))}get isTargetDisabled(){const e=this.#m&&"disabled"in this.#m&&this.#m.disabled,t=this.#m&&"true"===this.#m.ariaDisabled;return Boolean(e)||Boolean(t)}render(){return html`<div class="component" @focusout="${this.#E}" ${ref(this.#e)}><slot class="target-slot" name="target" @click="${this.#v}" @keydown="${this.#g}" @slotchange="${this.#S}" ${ref(this.#r)}></slot><slot class="default-slot" @click="${this.#C}" @focusin="${this.#w}" @keydown="${this.#g}" @mouseover="${this.#k}" @private-disabled="${this.#b}" @private-slot-change="${this.#y}" @slotchange="${this.#O}" ${ref(this.#t)}></slot></div>`}#R;#e;#t;#i;#o;#n;#s;#l;#h;#u;#a;#r;get#D(){return this.#M?.find((({privateActive:e})=>e))}#c;#A(e){this.#m&&"focus"in this.#m&&this.#m?.focus(e)}#f(){this.#R?.(),this.#d&&(this.#d.ariaActivedescendant=""),this.#m&&(this.#m.ariaExpanded="false"),this.#t.value?.hidePopover()}get#d(){const e=this.#t.value?.assignedElements().at(0);return e instanceof GlideCoreMenuOptions?e:null}#O(){ow(this.#d,ow.object.instanceOf(GlideCoreMenuOptions)),owSlot(this.#t.value),owSlotType(this.#t.value,[GlideCoreMenuOptions]),this.#d.privateSize=this.size}#C(e){e.target!==this.#t.value&&(this.open=!1)}#w(e){(e.target instanceof GlideCoreMenuButton||e.target instanceof GlideCoreMenuLink)&&this.#D&&this.#d&&!e.target.disabled&&(this.#D.privateActive=!1,e.target.privateActive=!0,this.#d.ariaActivedescendant=e.target.id)}#k(e){if((e.target instanceof GlideCoreMenuLink||e.target instanceof GlideCoreMenuButton)&&!e.target.disabled){if(this.#M)for(const t of this.#M)t.privateActive=t===e.target;this.#d&&(this.#d.ariaActivedescendant=e.target.id)}}#E(e){const t=e.relatedTarget instanceof HTMLElement&&this.#u?.contains(e.relatedTarget),i=e.relatedTarget instanceof GlideCoreMenuOptions,o=e.relatedTarget instanceof GlideCoreMenuButton||e.relatedTarget instanceof GlideCoreMenuLink;t||i||o||(this.open=!1)}#b(){if(this.#M&&this.#D){const e=this.#M.indexOf(this.#D);this.#D.privateActive=!1;const t=this.#M?.find(((t,i)=>!t.disabled&&i>e));if(t)return void(t.privateActive=!0);const i=this.#M.findLast(((t,i)=>!t.disabled&&i<e));i&&(i.privateActive=!0)}}#y(){const e=this.#M?.find((e=>!e.disabled));!this.#D&&e&&(e.privateActive=!0)}#g(e){ow(this.#d,ow.object.instanceOf(GlideCoreMenuOptions));const t=this.#m instanceof HTMLSpanElement||this.#m instanceof HTMLDivElement;if([" ","Enter"].includes(e.key)&&this.open)return" "===e.key&&t&&e.preventDefault(),this.open=!1,this.#A(),this.#D?.click(),void(this.#i=!0);if([" ","Enter"].includes(e.key)&&t)return e.preventDefault(),void(this.open=!0);if(["Escape"].includes(e.key)&&this.open)return e.preventDefault(),this.open=!1,void this.#A();if(["ArrowUp","ArrowDown"].includes(e.key)&&!this.open&&this.#D)return e.preventDefault(),this.open=!0,void(this.#d.ariaActivedescendant=this.#D.id);if(this.open){ow(this.#M,ow.array),ow(this.#d,ow.object.instanceOf(GlideCoreMenuOptions)),ow(this.#D,ow.object.is((e=>e instanceof GlideCoreMenuButton||e instanceof GlideCoreMenuLink)));const t=this.#M.indexOf(this.#D);if("ArrowUp"===e.key&&!e.metaKey){e.preventDefault();const i=this.#M.findLast(((e,i)=>!e.disabled&&i<t));return void(i&&(this.#D.privateActive=!1,this.#d.ariaActivedescendant=i.id,i.privateActive=!0))}if("ArrowDown"===e.key&&!e.metaKey){e.preventDefault();const i=this.#M.find(((e,i)=>!e.disabled&&i>t));return void(i&&(this.#D.privateActive=!1,this.#d.ariaActivedescendant=i.id,i.privateActive=!0))}if("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key){e.preventDefault();const t=[...this.#M].reverse().findLast((e=>!e.disabled));return void(t&&(this.#D.privateActive=!1,this.#d.ariaActivedescendant=t.id,t.privateActive=!0))}if("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key){e.preventDefault();const t=[...this.#M].findLast((e=>!e.disabled));return void(t&&(this.#D.privateActive=!1,this.#d.ariaActivedescendant=t.id,t.privateActive=!0))}}}#S(){owSlot(this.#r.value),ow(this.#m,ow.object.instanceOf(Element)),ow(this.#d,ow.object.instanceOf(GlideCoreMenuOptions));new MutationObserver((()=>{this.open&&!this.isTargetDisabled?this.#p():this.#f()})).observe(this.#m,{attributes:!0,attributeFilter:["aria-disabled","disabled"]}),this.#m.ariaHasPopup="true",this.#m.id=nanoid(),this.#m.setAttribute("aria-controls",this.#d.id),this.#d.ariaLabelledby=this.#m.id;(this.#m instanceof HTMLSpanElement||this.#m instanceof HTMLDivElement)&&this.#m instanceof HTMLElement&&(this.#m.tabIndex=0),this.open&&!this.isTargetDisabled?this.#p():this.#f()}#v(){this.isTargetDisabled?this.#f():this.#i?this.#i=!1:this.#M&&this.#M.length>0&&(this.open=!this.open)}get#M(){let e=this.#t.value?.assignedElements()?.at(0)?.children;const t=e?.[0];if(t instanceof HTMLSlotElement&&(e=t.assignedElements()),e)return[...e].filter((e=>e instanceof GlideCoreMenuLink||e instanceof GlideCoreMenuButton))}#p(){this.#R?.(),this.#m&&this.#t.value&&(this.#R=autoUpdate(this.#m,this.#t.value,(()=>{(async()=>{if(this.#m&&this.#t.value){const{x:e,y:t,placement:i}=await computePosition(this.#m,this.#t.value,{placement:this.placement,middleware:[offset(this.offset),flip()]});this.#t.value.dataset.placement=i,Object.assign(this.#t.value.style,{left:`${e}px`,top:`${t}px`})}this.#t.value?.showPopover(),this.#d&&this.#D?.id&&(this.#d.ariaActivedescendant=this.#D.id),this.#m&&(this.#m.ariaExpanded="true")})()})))}get#m(){return this.#r.value?.assignedElements().at(0)}};__decorate([property({reflect:!0,type:Number})],GlideCoreMenu.prototype,"offset",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreMenu.prototype,"open",null),__decorate([property({reflect:!0})],GlideCoreMenu.prototype,"placement",void 0),__decorate([property({reflect:!0})],GlideCoreMenu.prototype,"size",null),GlideCoreMenu=__decorate([customElement("glide-core-menu")],GlideCoreMenu);export default GlideCoreMenu;
|
package/dist/menu.link.d.ts
CHANGED
@@ -11,6 +11,8 @@ export default class GlideCoreMenuLink extends LitElement {
|
|
11
11
|
#private;
|
12
12
|
static shadowRootOptions: ShadowRootInit;
|
13
13
|
static styles: import("lit").CSSResult[];
|
14
|
+
get disabled(): boolean;
|
15
|
+
set disabled(isDisabled: boolean);
|
14
16
|
label?: string;
|
15
17
|
url?: string;
|
16
18
|
privateActive: boolean;
|
package/dist/menu.link.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,s=arguments.length,l=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(l=(s<3?r(l):s>3?r(t,i,l):r(t,i))||l);return s>3&&l&&Object.defineProperty(t,i,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{nanoid}from"nanoid";import styles from"./menu.link.styles.js";let GlideCoreMenuLink=class GlideCoreMenuLink extends LitElement{constructor(){super(...arguments),this.privateActive=!1,this.#e=createRef(),this.#t=nanoid(),this.#i=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#i}set disabled(e){this.#i=e,e&&this.privateActive&&this.dispatchEvent(new Event("private-disabled",{bubbles:!0}))}click(){this.disabled||this.#e.value?.click()}connectedCallback(){super.connectedCallback(),this.id=this.#t,this.role="menuitem",this.tabIndex=-1}render(){return html`<a class="${classMap({component:!0,active:this.privateActive,disabled:this.disabled})}" data-test="component" href="${ifDefined(this.url)}" @click="${this.#o}" ${ref(this.#e)}><slot name="icon"></slot>${this.label}</a>`}#e;#t;#i;#o(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreMenuLink.prototype,"disabled",null),__decorate([property({reflect:!0})],GlideCoreMenuLink.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreMenuLink.prototype,"url",void 0),__decorate([property({type:Boolean})],GlideCoreMenuLink.prototype,"privateActive",void 0),GlideCoreMenuLink=__decorate([customElement("glide-core-menu-link")],GlideCoreMenuLink);export default GlideCoreMenuLink;
|
package/dist/menu.link.styles.js
CHANGED
@@ -5,7 +5,6 @@ import{css}from"lit";export default[css`
|
|
5
5
|
border: none;
|
6
6
|
border-radius: var(--glide-core-spacing-sm);
|
7
7
|
box-sizing: border-box;
|
8
|
-
color: inherit;
|
9
8
|
display: flex;
|
10
9
|
font: inherit;
|
11
10
|
gap: var(--gap);
|
@@ -19,5 +18,15 @@ import{css}from"lit";export default[css`
|
|
19
18
|
&.active {
|
20
19
|
background-color: var(--glide-core-surface-hover);
|
21
20
|
}
|
21
|
+
|
22
|
+
&.disabled {
|
23
|
+
color: var(--glide-core-icon-tertiary-disabled);
|
24
|
+
cursor: default;
|
25
|
+
}
|
26
|
+
|
27
|
+
&:not(.disabled) {
|
28
|
+
color: var(--glide-core-text-body-1);
|
29
|
+
cursor: pointer;
|
30
|
+
}
|
22
31
|
}
|
23
32
|
`];
|