@crowdstrike/glide-core 0.15.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +1 -1
- package/dist/accordion.js +1 -1
- package/dist/accordion.styles.js +17 -15
- package/dist/button-group.d.ts +1 -2
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +0 -11
- package/dist/button.js +1 -1
- package/dist/checkbox-group.d.ts +3 -3
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.d.ts +3 -3
- package/dist/checkbox.js +17 -37
- package/dist/checkbox.styles.js +1 -12
- package/dist/drawer.d.ts +2 -5
- package/dist/drawer.js +1 -1
- package/dist/drawer.styles.js +0 -2
- package/dist/dropdown.d.ts +4 -3
- package/dist/dropdown.js +29 -43
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.styles.js +1 -0
- package/dist/icons/checked.js +1 -1
- package/dist/icons/chevron.d.ts +2 -0
- package/dist/icons/chevron.js +1 -0
- package/dist/icons/magnifying-glass.d.ts +1 -1
- package/dist/icons/magnifying-glass.js +1 -1
- package/dist/icons/pencil.js +1 -1
- package/dist/icons/x.d.ts +2 -0
- package/dist/icons/x.js +1 -0
- package/dist/inline-alert.d.ts +5 -5
- package/dist/inline-alert.js +1 -1
- package/dist/inline-alert.styles.js +9 -5
- package/dist/input.d.ts +3 -3
- package/dist/input.js +38 -61
- package/dist/label.js +1 -1
- package/dist/label.styles.js +5 -1
- package/dist/library/localize.d.ts +1 -2
- package/dist/library/localize.test.js +1 -3
- package/dist/library/mouse.d.ts +2 -0
- package/dist/library/mouse.js +1 -0
- package/dist/library/ow.test.js +0 -1
- package/dist/menu.d.ts +3 -1
- package/dist/menu.js +1 -1
- package/dist/menu.options.d.ts +1 -1
- package/dist/modal.d.ts +5 -8
- package/dist/modal.icon-button.d.ts +2 -7
- package/dist/modal.icon-button.styles.js +3 -3
- package/dist/modal.js +1 -1
- package/dist/modal.styles.js +50 -45
- package/dist/popover.d.ts +28 -0
- package/dist/popover.js +1 -0
- package/dist/popover.styles.js +119 -0
- package/dist/radio-group.d.ts +11 -11
- package/dist/radio-group.js +11 -9
- package/dist/radio-group.radio.d.ts +25 -0
- package/dist/radio-group.radio.js +1 -0
- package/dist/radio-group.radio.styles.d.ts +2 -0
- package/dist/{radio.styles.js → radio-group.radio.styles.js} +25 -37
- package/dist/radio-group.styles.js +1 -5
- package/dist/split-button.d.ts +2 -1
- package/dist/split-button.secondary-button.js +1 -1
- package/dist/split-button.secondary-button.styles.js +6 -9
- package/dist/tab.d.ts +1 -2
- package/dist/tab.group.d.ts +0 -3
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +61 -55
- package/dist/tab.panel.d.ts +4 -4
- package/dist/tab.panel.js +1 -1
- package/dist/tab.styles.js +8 -8
- package/dist/tag.d.ts +1 -1
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +9 -5
- package/dist/textarea.d.ts +3 -3
- package/dist/textarea.js +1 -1
- package/dist/toasts.toast.js +1 -1
- package/dist/toasts.toast.styles.js +6 -3
- package/dist/toggle.d.ts +2 -2
- package/dist/toggle.js +1 -1
- package/dist/toggle.styles.js +8 -10
- package/dist/tooltip.d.ts +3 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.styles.js +8 -11
- 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.d.ts +1 -2
- package/dist/tree.item.d.ts +0 -2
- package/dist/tree.item.js +1 -1
- package/dist/tree.item.menu.d.ts +2 -2
- package/dist/tree.item.menu.js +1 -1
- package/dist/tree.item.styles.js +41 -48
- package/dist/tree.js +1 -1
- package/package.json +11 -10
- package/dist/icons/informational.d.ts +0 -2
- package/dist/icons/informational.js +0 -1
- package/dist/radio.d.ts +0 -20
- package/dist/radio.js +0 -1
- /package/dist/{radio.styles.d.ts → popover.styles.d.ts} +0 -0
package/dist/accordion.d.ts
CHANGED
package/dist/accordion.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,s){var l,i=arguments.length,n=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,s);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(n=(i<3?l(n):i>3?l(t,o,n):l(t,o))||n);return i>3&&n&&Object.defineProperty(t,o,n),n};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{owSlot}from"./library/ow.js";import styles from"./accordion.styles.js";let GlideCoreAccordion=class GlideCoreAccordion extends LitElement{constructor(){super(...arguments),this.hasPrefixIcon=!1,this.hasSuffixIcons=!1,this.isClosing=!1,this.#e=createRef(),this.#t=createRef(),this.#o=!1,this.#s=createRef(),this.#l=createRef(),this.#i=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}get open(){return this.#o}set open(e){this.#o=e;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&this.#t.value)return this.#t.value.open=e,void this.dispatchEvent(new Event("toggle",{bubbles:!0}));if(e)this.updateComplete.then((()=>{if(this.#t.value&&this.#e.value){const e=Number.parseFloat(getComputedStyle(this.#e.value)?.paddingBottom);this.#t.value.open=!0,this.#e.value.animate({height:["0px",this.#e.value.offsetHeight-e+"px"],opacity:[0,1]},{duration:150,easing:"ease-in"}).addEventListener("finish",(()=>{this.#t.value&&this.dispatchEvent(new Event("toggle",{bubbles:!0}))}))}}));else if(this.isClosing=!0,this.#e.value){const e=Number.parseFloat(getComputedStyle(this.#e.value)?.paddingBottom);this.#e.value.animate({height:[this.#e.value.offsetHeight-e+"px","0px"],opacity:[1,0]},{duration:100,easing:"ease-out"}).addEventListener("finish",(()=>{this.#t.value&&(this.#t.value.open=!1,this.isClosing=!1,this.dispatchEvent(new Event("toggle",{bubbles:!0})))}))}}click(){this.#i.value?.click()}firstUpdated(){owSlot(this.#e.value)}render(){return html`<details class="component" ${ref(this.#t)}><summary class="${classMap({summary:!0,active:this.open||this.isClosing})}" data-test="summary" @click="${this.#n}" ${ref(this.#i)}
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,s){var l,i=arguments.length,n=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,s);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(n=(i<3?l(n):i>3?l(t,o,n):l(t,o))||n);return i>3&&n&&Object.defineProperty(t,o,n),n};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{owSlot}from"./library/ow.js";import chevronIcon from"./icons/chevron.js";import styles from"./accordion.styles.js";let GlideCoreAccordion=class GlideCoreAccordion extends LitElement{constructor(){super(...arguments),this.hasPrefixIcon=!1,this.hasSuffixIcons=!1,this.isClosing=!1,this.#e=createRef(),this.#t=createRef(),this.#o=!1,this.#s=createRef(),this.#l=createRef(),this.#i=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}get open(){return this.#o}set open(e){const t=e!==this.#o;this.#o=e;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&t&&this.#t.value)return this.#t.value.open=e,void this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}));if(e&&t)this.updateComplete.then((()=>{if(this.#t.value&&this.#e.value){const e=Number.parseFloat(getComputedStyle(this.#e.value)?.paddingBottom);this.#t.value.open=!0,this.#e.value.animate({height:["0px",this.#e.value.offsetHeight-e+"px"],opacity:[0,1]},{duration:150,easing:"ease-in"}).addEventListener("finish",(()=>{this.#t.value&&this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}))}))}}));else if(t&&(this.isClosing=!0,this.#e.value)){const e=Number.parseFloat(getComputedStyle(this.#e.value)?.paddingBottom);this.#e.value.animate({height:[this.#e.value.offsetHeight-e+"px","0px"],opacity:[1,0]},{duration:100,easing:"ease-out"}).addEventListener("finish",(()=>{this.#t.value&&(this.#t.value.open=!1,this.isClosing=!1,this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0})))}))}}click(){this.#i.value?.click()}firstUpdated(){owSlot(this.#e.value)}render(){return html`<details class="component" ${ref(this.#t)}><summary class="${classMap({summary:!0,active:this.open||this.isClosing,open:this.open})}" data-test="summary" @click="${this.#n}" ${ref(this.#i)}>${chevronIcon}<div class="label-container"><slot class="prefix-icon-slot" name="prefix-icon" @slotchange="${this.#a}" ${ref(this.#s)}></slot><span class="label">${this.label}</span></div><slot class="${classMap({"suffix-icons-slot":!0,icons:this.hasSuffixIcons})}" name="suffix-icons" @slotchange="${this.#r}" ${ref(this.#l)}></slot></summary><slot class="${classMap({"default-slot":!0,indented:this.hasPrefixIcon})}" data-test="default-slot" @slotchange="${this.#c}" ${ref(this.#e)}></slot></details>`}#e;#t;#o;#s;#l;#i;#c(){owSlot(this.#e.value)}#a(){const e=this.#s.value?.assignedNodes();this.hasPrefixIcon=Boolean(e&&e.length>0)}#r(){const e=this.#l.value?.assignedNodes();this.hasSuffixIcons=Boolean(e&&e.length>0)}#n(e){e.preventDefault(),this.open=!this.open}};__decorate([property({reflect:!0})],GlideCoreAccordion.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreAccordion.prototype,"open",null),__decorate([state()],GlideCoreAccordion.prototype,"hasPrefixIcon",void 0),__decorate([state()],GlideCoreAccordion.prototype,"hasSuffixIcons",void 0),__decorate([state()],GlideCoreAccordion.prototype,"isClosing",void 0),GlideCoreAccordion=__decorate([customElement("glide-core-accordion")],GlideCoreAccordion);export default GlideCoreAccordion;
|
package/dist/accordion.styles.js
CHANGED
@@ -35,6 +35,23 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
35
35
|
&.active {
|
36
36
|
padding-block-end: var(--glide-core-spacing-xxs);
|
37
37
|
}
|
38
|
+
|
39
|
+
&.open {
|
40
|
+
svg {
|
41
|
+
rotate: 0deg;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
svg {
|
46
|
+
align-items: center;
|
47
|
+
display: flex;
|
48
|
+
margin-inline-end: var(--glide-core-spacing-xxs);
|
49
|
+
rotate: -90deg;
|
50
|
+
|
51
|
+
@media (prefers-reduced-motion: no-preference) {
|
52
|
+
transition: 250ms rotate ease;
|
53
|
+
}
|
54
|
+
}
|
38
55
|
}
|
39
56
|
|
40
57
|
.label-container {
|
@@ -52,21 +69,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
52
69
|
text-overflow: ellipsis;
|
53
70
|
}
|
54
71
|
|
55
|
-
.chevron {
|
56
|
-
align-items: center;
|
57
|
-
display: flex;
|
58
|
-
margin-inline-end: var(--glide-core-spacing-xxs);
|
59
|
-
rotate: -90deg;
|
60
|
-
|
61
|
-
&.unrotated {
|
62
|
-
rotate: 0deg;
|
63
|
-
}
|
64
|
-
|
65
|
-
@media (prefers-reduced-motion: no-preference) {
|
66
|
-
transition: 250ms rotate ease;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
72
|
.default-slot {
|
71
73
|
color: var(--glide-core-text-body-1);
|
72
74
|
display: block;
|
package/dist/button-group.d.ts
CHANGED
package/dist/button-group.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,o,n){var r,i=arguments.length,l=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(l=(i<3?r(l):i>3?r(e,o,l):r(e,o))||l);return i>3&&l&&Object.defineProperty(e,o,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import GlideCoreButtonGroupButton from"./button-group.button.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./button-group.styles.js";let GlideCoreButtonGroup=class GlideCoreButtonGroup extends LitElement{constructor(){super(...arguments),this.label="",this.#t="horizontal",this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get variant(){return this.#o}set variant(t){for(const e of this.#n)e.privateVariant=t;this.#o=t}get orientation(){return this.#t}set orientation(t){for(const e of this.#n)e.privateOrientation=t;this.#t=t}firstUpdated(){owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton])}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation})}"><div class="label" id="label" data-test="label">${this.label}</div><div aria-labelledby="label" role="radiogroup" class="${classMap({container:!0,vertical:"vertical"===this.orientation})}"><slot @click="${this.#r}" @keydown="${this.#i}" @private-selected="${this.#l}" @slotchange="${this.#s}" ${ref(this.#e)}></slot></div></div>`}#t;#e;#o;get#n(){return[...this.querySelectorAll("glide-core-button-group-button")]}#s(){ow(this.#n.length,ow.number.greaterThan(1).message("A Button Group must contain two or more Button Group Buttons.")),owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton]);if(!this.#n.find((({disabled:t,selected:e})=>!t&&e))){const t=this.#n.find((({disabled:t})=>!t));t&&(t.selected=!0)}for(const t of this.#n)t.privateVariant=this.variant,this.orientation&&(t.privateOrientation=this.orientation)}#r(t){if(t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");!e||e.disabled||e.selected||(e.selected=!0)}}#i(t){const e=this.querySelector("glide-core-button-group-button[selected]");switch(ow(e,ow.object.instanceOf(GlideCoreButtonGroupButton)),t.key){case"ArrowUp":case"ArrowLeft":{t.preventDefault();let o=e?.previousElementSibling??this.#n.at(-1);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.previousElementSibling??this.#n.at(-1);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0);break}case"ArrowDown":case"ArrowRight":{t.preventDefault();let o=e?.nextElementSibling??this.#n.at(0);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.nextElementSibling??this.#n.at(0);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0);break}case" ":if(t.preventDefault(),t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button")
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,n){var r,i=arguments.length,l=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(l=(i<3?r(l):i>3?r(e,o,l):r(e,o))||l);return i>3&&l&&Object.defineProperty(e,o,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import GlideCoreButtonGroupButton from"./button-group.button.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./button-group.styles.js";let GlideCoreButtonGroup=class GlideCoreButtonGroup extends LitElement{constructor(){super(...arguments),this.label="",this.#t="horizontal",this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get variant(){return this.#o}set variant(t){for(const e of this.#n)e.privateVariant=t;this.#o=t}get orientation(){return this.#t}set orientation(t){for(const e of this.#n)e.privateOrientation=t;this.#t=t}firstUpdated(){owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton])}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation})}"><div class="label" id="label" data-test="label">${this.label}</div><div aria-labelledby="label" role="radiogroup" class="${classMap({container:!0,vertical:"vertical"===this.orientation})}"><slot @click="${this.#r}" @keydown="${this.#i}" @private-selected="${this.#l}" @slotchange="${this.#s}" ${ref(this.#e)}></slot></div></div>`}#t;#e;#o;get#n(){return[...this.querySelectorAll("glide-core-button-group-button")]}#s(){ow(this.#n.length,ow.number.greaterThan(1).message("A Button Group must contain two or more Button Group Buttons.")),owSlot(this.#e.value),owSlotType(this.#e.value,[GlideCoreButtonGroupButton]);if(!this.#n.find((({disabled:t,selected:e})=>!t&&e))){const t=this.#n.find((({disabled:t})=>!t));t&&(t.selected=!0)}for(const t of this.#n)t.privateVariant=this.variant,this.orientation&&(t.privateOrientation=this.orientation)}#r(t){if(t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");!e||e.disabled||e.selected||(e.selected=!0,e.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0})))}}#i(t){const e=this.querySelector("glide-core-button-group-button[selected]");switch(ow(e,ow.object.instanceOf(GlideCoreButtonGroupButton)),t.key){case"ArrowUp":case"ArrowLeft":{t.preventDefault();let o=e?.previousElementSibling??this.#n.at(-1);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.previousElementSibling??this.#n.at(-1);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0,o.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0})));break}case"ArrowDown":case"ArrowRight":{t.preventDefault();let o=e?.nextElementSibling??this.#n.at(0);for(;o instanceof GlideCoreButtonGroupButton&&o.disabled;)o=o.nextElementSibling??this.#n.at(0);o instanceof GlideCoreButtonGroupButton&&(o.selected=!0,o.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0})));break}case" ":if(t.preventDefault(),t.target instanceof HTMLElement){const e=t.target.closest("glide-core-button-group-button");!e||e.disabled||e.selected||(e.selected=!0,e.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0})))}}}#l(t){if(t.target instanceof GlideCoreButtonGroupButton&&t.target.selected){for(const e of this.#n)e!==t.target&&(e.selected=!1);t.target.focus()}}};__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"variant",null),__decorate([property({reflect:!0})],GlideCoreButtonGroup.prototype,"orientation",null),GlideCoreButtonGroup=__decorate([customElement("glide-core-button-group")],GlideCoreButtonGroup);export default GlideCoreButtonGroup;
|
package/dist/button.d.ts
CHANGED
@@ -14,20 +14,9 @@ export default class GlideCoreButton extends LitElement {
|
|
14
14
|
static formAssociated: boolean;
|
15
15
|
static shadowRootOptions: ShadowRootInit;
|
16
16
|
static styles: import("lit").CSSResult[];
|
17
|
-
ariaControls: string | null;
|
18
|
-
ariaExpanded: 'true' | 'false' | null;
|
19
|
-
ariaHasPopup: 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | null;
|
20
|
-
autofocus: boolean;
|
21
17
|
disabled: boolean;
|
22
|
-
formAction: string;
|
23
|
-
formEncType: '' | 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
|
24
|
-
formMethod: '' | 'dialog' | 'get' | 'post';
|
25
|
-
formNoValidate: boolean;
|
26
|
-
formTarget: '' | '_blank' | '_parent' | '_self' | '_top';
|
27
18
|
label?: string;
|
28
19
|
name: string;
|
29
|
-
popoverTarget?: string;
|
30
|
-
popoverTargetAction: '' | 'hide' | 'show' | 'toggle';
|
31
20
|
size: 'large' | 'small';
|
32
21
|
type: 'button' | 'submit' | 'reset';
|
33
22
|
value: string;
|
package/dist/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 r,s=arguments.length,n=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(n=(s<3?r(n):s>3?r(t,o,n):r(t,o))||n);return s>3&&n&&Object.defineProperty(t,o,n),n};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 styles from"./button.styles.js";let GlideCoreButton=class GlideCoreButton extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}get form(){return this.#e.form}click(){this.#t.value?.click()}render(){return html`<button class="${classMap({component:!0,primary:"primary"===this.variant,secondary:"secondary"===this.variant,tertiary:"tertiary"===this.variant,large:"large"===this.size,small:"small"===this.size,"prefix-icon":this.hasPrefixIcon,"suffix-icon":this.hasSuffixIcon})}" ?disabled="${this.disabled}" @click="${this.#o}" ${ref(this.#t)}><slot name="prefix-icon" @slotchange="${this.#i}" ${ref(this.#r)}></slot>${this.label}<slot name="suffix-icon" @slotchange="${this.#s}" ${ref(this.#n)}></slot></button>`}constructor(){super(),this.disabled=!1,this.name="",this.size="large",this.type="button",this.value="",this.variant="primary",this.hasPrefixIcon=!1,this.hasSuffixIcon=!1,this.#t=createRef(),this.#r=createRef(),this.#n=createRef(),this.#e=this.attachInternals()}#t;#e;#r;#n;#o(){"submit"!==this.type?"reset"!==this.type||this.form?.reset():this.form?.requestSubmit()}#i(){const e=this.#r.value?.assignedNodes();this.hasPrefixIcon=Boolean(e&&e.length>0)}#s(){const e=this.#n.value?.assignedNodes();this.hasSuffixIcon=Boolean(e&&e.length>0)}};__decorate([property({type:Boolean,reflect:!0})],GlideCoreButton.prototype,"disabled",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"name",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"size",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"type",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"value",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"variant",void 0),__decorate([state()],GlideCoreButton.prototype,"hasPrefixIcon",void 0),__decorate([state()],GlideCoreButton.prototype,"hasSuffixIcon",void 0),GlideCoreButton=__decorate([customElement("glide-core-button")],GlideCoreButton);export default GlideCoreButton;
|
package/dist/checkbox-group.d.ts
CHANGED
@@ -6,9 +6,9 @@ declare global {
|
|
6
6
|
}
|
7
7
|
}
|
8
8
|
/**
|
9
|
-
* @event change
|
10
|
-
* @event input
|
11
|
-
* @event invalid
|
9
|
+
* @event change
|
10
|
+
* @event input
|
11
|
+
* @event invalid
|
12
12
|
*
|
13
13
|
* @slot - One or more of `<glide-core-checkbox>`.
|
14
14
|
* @slot description - Additional information or context.
|
package/dist/checkbox-group.js
CHANGED
@@ -40,4 +40,4 @@ var __decorate=this&&this.__decorate||function(e,t,i,o){var s,l=arguments.length
|
|
40
40
|
>`))}
|
41
41
|
</div>
|
42
42
|
</glide-core-private-label>
|
43
|
-
</div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#o.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#o.setValidity({customError:!1},"",this.#d.value):this.#o.setValidity({customError:!0,valueMissing:this.#o.validity.valueMissing}," ",this.#d.value)}setValidity(e,t){this.validityMessage=t,this.#o.setValidity(e," ",this.#d.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.#d=createRef(),this.#r=createRef(),this.#e=!1,this.#i=!1,this.#s=[],this.#l=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#o=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#d;#r;#o;#e;#i;#s;get#t(){return this.#r.value?this.#r.value.assignedElements().filter((e=>e instanceof GlideCoreCheckbox)):[]}#l;get#n(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#u(){for(const e of this.#t)e.privateIsReportValidityOrSubmit=!0}#a(e){const t=e.relatedTarget;t&&t instanceof GlideCoreCheckbox&&this.#t.includes(t)||this.#u()}#c(){this.value=this
|
43
|
+
</div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#o.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#o.setValidity({customError:!1},"",this.#d.value):this.#o.setValidity({customError:!0,valueMissing:this.#o.validity.valueMissing}," ",this.#d.value)}setValidity(e,t){this.validityMessage=t,this.#o.setValidity(e," ",this.#d.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.#d=createRef(),this.#r=createRef(),this.#e=!1,this.#i=!1,this.#s=[],this.#l=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#o=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#d;#r;#o;#e;#i;#s;get#t(){return this.#r.value?this.#r.value.assignedElements().filter((e=>e instanceof GlideCoreCheckbox)):[]}#l;get#n(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#u(){for(const e of this.#t)e.privateIsReportValidityOrSubmit=!0}#a(e){const t=e.relatedTarget;t&&t instanceof GlideCoreCheckbox&&this.#t.includes(t)||this.#u()}#c(e){e.target instanceof GlideCoreCheckbox&&e.target.checked&&e.target.value?this.value=[...this.value,e.target.value]:e.target instanceof GlideCoreCheckbox&&!e.target.checked&&(this.value=this.value.filter((t=>e.target instanceof GlideCoreCheckbox&&t!==e.target.value)))}#h(e){e.target instanceof GlideCoreCheckbox&&e.target.checked&&e.detail.new?this.value=this.#s.map((t=>t===e.detail.old?e.detail.new:t)):e.target instanceof GlideCoreCheckbox&&e.target.checked&&(this.value=this.#s.filter((t=>t!==e.detail.old)))}#p(){owSlot(this.#r.value),owSlotType(this.#r.value,[GlideCoreCheckbox])}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreCheckboxGroup.prototype,"disabled",null),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreCheckboxGroup.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreCheckboxGroup.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreCheckboxGroup.prototype,"name",void 0),__decorate([property()],GlideCoreCheckboxGroup.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreCheckboxGroup.prototype,"required",null),__decorate([property({reflect:!0})],GlideCoreCheckboxGroup.prototype,"summary",void 0),__decorate([property({reflect:!0,type:Array})],GlideCoreCheckboxGroup.prototype,"value",null),__decorate([state()],GlideCoreCheckboxGroup.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreCheckboxGroup.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreCheckboxGroup.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreCheckboxGroup.prototype,"validityMessage",void 0),GlideCoreCheckboxGroup=__decorate([customElement("glide-core-checkbox-group")],GlideCoreCheckboxGroup);export default GlideCoreCheckboxGroup;
|
package/dist/checkbox.d.ts
CHANGED
@@ -7,9 +7,9 @@ declare global {
|
|
7
7
|
}
|
8
8
|
}
|
9
9
|
/**
|
10
|
-
* @event change
|
11
|
-
* @event input
|
12
|
-
* @event invalid
|
10
|
+
* @event change
|
11
|
+
* @event input
|
12
|
+
* @event invalid
|
13
13
|
*
|
14
14
|
* @slot description - Additional information or context.
|
15
15
|
* @slot tooltip - Content for the tooltip.
|
package/dist/checkbox.js
CHANGED
@@ -1,18 +1,4 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,a){var s,
|
2
|
-
<svg
|
3
|
-
width="14"
|
4
|
-
height="14"
|
5
|
-
viewBox="0 0 14 14"
|
6
|
-
fill="none"
|
7
|
-
class="indeterminate-icon"
|
8
|
-
>
|
9
|
-
<rect x="0.5" y="0.5" width="13" height="13" rx="3.5" />
|
10
|
-
<path
|
11
|
-
d="M3 5C3 3.89543 3.89543 3 5 3H9.79289C10.2383 3 10.4614 3.53857 10.1464 3.85355L3.85355 10.1464C3.53857 10.4614 3 10.2383 3 9.79289V5Z"
|
12
|
-
fill="currentColor"
|
13
|
-
/>
|
14
|
-
</svg>
|
15
|
-
`;let GlideCoreCheckbox=class GlideCoreCheckbox extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get label(){return this.#e}set label(e){this.#e=e,setTimeout((()=>{this.#t()}))}get value(){return this.#i}set value(e){const t=this.#i;this.#i=e,this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:t,new:e}}))}get form(){return this.#a.form}blur(){this.#s.value?.blur()}checkValidity(){this.isCheckingValidity=!0;const e=this.#a.checkValidity();return this.isCheckingValidity=!1,e}click(){this.#s.value?.click()}connectedCallback(){super.connectedCallback(),this.#o=new IntersectionObserver((()=>{this.checkVisibility()&&this.#t()})),this.#o.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#r),this.#o?.disconnect()}get validity(){return"minimal"===this.privateVariant?this.#a.validity:this.required&&!this.checked?(this.#a.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#s.value),this.#a.validity):this.required&&this.#a.validity.valueMissing&&this.checked?(this.#a.setValidity({}),this.#a.validity):(this.required||!this.#a.validity.valueMissing||this.checked||this.#a.setValidity({}),this.#a.validity)}focus(e){this.#s.value?.focus(e)}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#r)}formResetCallback(){this.checked=""===this.getAttribute("checked"),this.indeterminate=""===this.getAttribute("indeterminate")}render(){return html`<div class="component" data-test="component">
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,a){var s,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};import"./label.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{ifDefined}from"lit/directives/if-defined.js";import{styleMap}from"lit/directives/style-map.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import checkedIcon from"./icons/checked.js";import styles from"./checkbox.styles.js";let GlideCoreCheckbox=class GlideCoreCheckbox extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get label(){return this.#e}set label(e){this.#e=e,setTimeout((()=>{this.#t()}))}get value(){return this.#i}set value(e){const t=this.#i;this.#i=e,this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:t,new:e}}))}get form(){return this.#a.form}blur(){this.#s.value?.blur()}checkValidity(){this.isCheckingValidity=!0;const e=this.#a.checkValidity();return this.isCheckingValidity=!1,e}click(){this.#s.value?.click()}connectedCallback(){super.connectedCallback(),this.#r=new IntersectionObserver((()=>{this.checkVisibility()&&this.#t()})),this.#r.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#o),this.#r?.disconnect()}get validity(){return"minimal"===this.privateVariant?this.#a.validity:this.required&&!this.checked?(this.#a.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#s.value),this.#a.validity):this.required&&this.#a.validity.valueMissing&&this.checked?(this.#a.setValidity({}),this.#a.validity):(this.required||!this.#a.validity.valueMissing||this.checked||this.#a.setValidity({}),this.#a.validity)}focus(e){this.#s.value?.focus(e)}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#o)}formResetCallback(){this.checked=""===this.getAttribute("checked"),this.indeterminate=""===this.getAttribute("indeterminate")}render(){return html`<div class="component" data-test="component">
|
16
2
|
${when("minimal"===this.privateVariant,(()=>html`
|
17
3
|
<label
|
18
4
|
class=${classMap({"label-and-input-and-checkbox":!0,[this.privateSize]:!0})}
|
@@ -38,7 +24,7 @@ var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length
|
|
38
24
|
class=${classMap({checkbox:!0,disabled:this.disabled})}
|
39
25
|
>
|
40
26
|
<div class="checked-icon">${checkedIcon}</div>
|
41
|
-
${
|
27
|
+
${icons.indeterminate}
|
42
28
|
</div>
|
43
29
|
</div>
|
44
30
|
|
@@ -78,25 +64,6 @@ var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length
|
|
78
64
|
The input is described by the summary and description but not the tooltip.
|
79
65
|
Screenreaders will come across the tooltip naturally as focus moves toward
|
80
66
|
the Checkbox.
|
81
|
-
|
82
|
-
—
|
83
|
-
|
84
|
-
A native input isn't necessary given the component itself is form associated.
|
85
|
-
A button, for example, could also be made to work. But an input gives us a
|
86
|
-
few things that together make using one worthwhile:
|
87
|
-
|
88
|
-
- "change" and "input" events.
|
89
|
-
- Toggling checked using the spacebar.
|
90
|
-
- ":checked" and ":indeterminate" pseudo classes, which browsers don't support
|
91
|
-
on hosts even when a component is form-associated.
|
92
|
-
|
93
|
-
-
|
94
|
-
|
95
|
-
aria-invalid is set based on whether the validation feedback is displayed. This
|
96
|
-
is to handle an odd behavior with checkboxes where "Invalid Data" is announced
|
97
|
-
on required unchecked inputs. While this is technically correct, it's
|
98
|
-
inconsistent with how other form controls behave as their validity isn’t announced
|
99
|
-
on screen readers by default before validation.
|
100
67
|
-->
|
101
68
|
<div class="input-and-checkbox" slot="control">
|
102
69
|
<input
|
@@ -120,7 +87,7 @@ var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length
|
|
120
87
|
class=${classMap({checkbox:!0,disabled:this.disabled,error:this.#l})}
|
121
88
|
>
|
122
89
|
<div class="checked-icon">${checkedIcon}</div>
|
123
|
-
${
|
90
|
+
${icons.indeterminate}
|
124
91
|
</div>
|
125
92
|
</div>
|
126
93
|
|
@@ -138,4 +105,17 @@ var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length
|
|
138
105
|
>`))}
|
139
106
|
</div>
|
140
107
|
</glide-core-private-label>`))}
|
141
|
-
</div>`}reportValidity(){this.privateIsReportValidityOrSubmit=!0;const e=this.#a.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#a.setValidity({customError:!1},"",this.#s.value):this.#a.setValidity({customError:!0,valueMissing:this.#a.validity.valueMissing}," ",this.#s.value)}setValidity(e,t){this.validityMessage=t,this.#a.setValidity(e," ",this.#s.value)}get willValidate(){return this.#a.willValidate}updated(){this.#s.value&&(this.#s.value.indeterminate=this.indeterminate)}constructor(){super(),this.checked=!1,this.internallyInert=!1,this.disabled=!1,this.hideLabel=!1,this.indeterminate=!1,this.orientation="horizontal",this.name="",this.privateLabelTooltipOffset=4,this.privateShowLabelTooltip=!1,this.privateDisableLabelTooltip=!1,this.privateSize="large",this.required=!1,this.privateIsReportValidityOrSubmit=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isLabelOverflow=!1,this.#s=createRef(),this.#e="",this.#h=createRef(),this.#i="",this.#
|
108
|
+
</div>`}reportValidity(){this.privateIsReportValidityOrSubmit=!0;const e=this.#a.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#a.setValidity({customError:!1},"",this.#s.value):this.#a.setValidity({customError:!0,valueMissing:this.#a.validity.valueMissing}," ",this.#s.value)}setValidity(e,t){this.validityMessage=t,this.#a.setValidity(e," ",this.#s.value)}get willValidate(){return this.#a.willValidate}updated(){this.#s.value&&(this.#s.value.indeterminate=this.indeterminate)}constructor(){super(),this.checked=!1,this.internallyInert=!1,this.disabled=!1,this.hideLabel=!1,this.indeterminate=!1,this.orientation="horizontal",this.name="",this.privateLabelTooltipOffset=4,this.privateShowLabelTooltip=!1,this.privateDisableLabelTooltip=!1,this.privateSize="large",this.required=!1,this.privateIsReportValidityOrSubmit=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isLabelOverflow=!1,this.#s=createRef(),this.#e="",this.#h=createRef(),this.#i="",this.#o=({formData:e})=>{this.checked&&this.name&&this.value&&!this.disabled&&e.append(this.name,this.value)},this.#a=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.privateIsReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#s;#a;#r;#e;#h;#i;#o;get#l(){return"minimal"===this.privateVariant?!this.validity.valid&&this.privateIsReportValidityOrSubmit:!this.disabled&&!this.validity.valid&&this.privateIsReportValidityOrSubmit}#c(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1}#n(e){e.target instanceof HTMLInputElement&&(this.checked=e.target.checked),this.indeterminate=!1,"change"===e.type&&this.dispatchEvent(new Event(e.type,{bubbles:!0,composed:!0}))}#d(e){"Enter"===e.key&&this.form?.requestSubmit()}#t(){this.#h.value&&(this.isLabelOverflow=this.#h.value.scrollWidth>this.#h.value.clientWidth)}};__decorate([property({type:Boolean})],GlideCoreCheckbox.prototype,"checked",void 0),__decorate([property({attribute:"internally-inert",type:Boolean})],GlideCoreCheckbox.prototype,"internallyInert",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreCheckbox.prototype,"disabled",void 0),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreCheckbox.prototype,"hideLabel",void 0),__decorate([property({type:Boolean})],GlideCoreCheckbox.prototype,"indeterminate",void 0),__decorate([property({reflect:!0})],GlideCoreCheckbox.prototype,"label",null),__decorate([property({reflect:!0})],GlideCoreCheckbox.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreCheckbox.prototype,"name",void 0),__decorate([property({attribute:"private-label-tooltip-offset",reflect:!0,type:Number})],GlideCoreCheckbox.prototype,"privateLabelTooltipOffset",void 0),__decorate([property({attribute:"private-show-label-tooltip",reflect:!0,type:Boolean})],GlideCoreCheckbox.prototype,"privateShowLabelTooltip",void 0),__decorate([property({attribute:"private-disable-label-tooltip",reflect:!0,type:Boolean})],GlideCoreCheckbox.prototype,"privateDisableLabelTooltip",void 0),__decorate([property({attribute:"private-size"})],GlideCoreCheckbox.prototype,"privateSize",void 0),__decorate([property()],GlideCoreCheckbox.prototype,"privateSplit",void 0),__decorate([property({attribute:"private-variant"})],GlideCoreCheckbox.prototype,"privateVariant",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreCheckbox.prototype,"required",void 0),__decorate([property({reflect:!0})],GlideCoreCheckbox.prototype,"summary",void 0),__decorate([property({reflect:!0})],GlideCoreCheckbox.prototype,"value",null),__decorate([state()],GlideCoreCheckbox.prototype,"privateIsReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreCheckbox.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreCheckbox.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreCheckbox.prototype,"isLabelOverflow",void 0),__decorate([state()],GlideCoreCheckbox.prototype,"validityMessage",void 0),GlideCoreCheckbox=__decorate([customElement("glide-core-checkbox")],GlideCoreCheckbox);export default GlideCoreCheckbox;const icons={indeterminate:html`
|
109
|
+
<svg
|
110
|
+
style=${styleMap({height:"0.875rem",width:"0.875rem"})}
|
111
|
+
viewBox="0 0 14 14"
|
112
|
+
fill="none"
|
113
|
+
class="indeterminate-icon"
|
114
|
+
>
|
115
|
+
<rect x="0.5" y="0.5" width="0.8125rem" height="0.8125rem" rx="3.5" />
|
116
|
+
<path
|
117
|
+
d="M3 5C3 3.89543 3.89543 3 5 3H9.79289C10.2383 3 10.4614 3.53857 10.1464 3.85355L3.85355 10.1464C3.53857 10.4614 3 10.2383 3 9.79289V5Z"
|
118
|
+
fill="currentColor"
|
119
|
+
/>
|
120
|
+
</svg>
|
121
|
+
`};
|
package/dist/checkbox.styles.js
CHANGED
@@ -2,17 +2,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
2
2
|
${focusOutline(".input:focus-visible ~ .checkbox")}
|
3
3
|
${focusOutline(".input:focus ~ .checkbox.error")}
|
4
4
|
`,css`
|
5
|
-
/*
|
6
|
-
Most states are handled on the host. But ":checked" and ":indeterminate" are
|
7
|
-
handled on the input because browsers don't support those classes on the host.
|
8
|
-
And using attribute selectors won't work because those attributes, same as
|
9
|
-
native, don't change when their properties do.
|
10
|
-
|
11
|
-
TODO
|
12
|
-
Use the ":checked" and ":indeterminate" pseudo classes on the host and throughout
|
13
|
-
when browsers support them.
|
14
|
-
*/
|
15
|
-
|
16
5
|
.label-and-input-and-checkbox {
|
17
6
|
align-items: center;
|
18
7
|
display: flex;
|
@@ -45,7 +34,7 @@ when browsers support them.
|
|
45
34
|
.input-and-checkbox {
|
46
35
|
block-size: 0.875rem;
|
47
36
|
|
48
|
-
/*
|
37
|
+
/* Don't shrink when the summary wraps. */
|
49
38
|
flex-shrink: 0;
|
50
39
|
inline-size: 0.875rem;
|
51
40
|
position: relative;
|
package/dist/drawer.d.ts
CHANGED
@@ -5,23 +5,20 @@ declare global {
|
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
8
|
+
* @event toggle
|
8
9
|
*
|
9
10
|
* @cssprop [--width] - The width the drawer.
|
10
11
|
*
|
11
|
-
* @event close
|
12
|
-
*
|
13
12
|
* @slot - The content of the Drawer.
|
14
13
|
*/
|
15
14
|
export default class GlideCoreDrawer extends LitElement {
|
16
15
|
#private;
|
17
16
|
static shadowRootOptions: ShadowRootInit;
|
18
17
|
static styles: import("lit").CSSResult[];
|
19
|
-
label
|
18
|
+
label?: string;
|
20
19
|
pinned: boolean;
|
21
20
|
get open(): boolean;
|
22
21
|
set open(isOpen: boolean);
|
23
|
-
close(): void;
|
24
22
|
firstUpdated(): void;
|
25
23
|
render(): import("lit").TemplateResult<1>;
|
26
|
-
show(): void;
|
27
24
|
}
|
package/dist/drawer.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,n){var i,s=arguments.length,a=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,n);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(a=(s<3?i(a):s>3?i(t,o,a):i(t,o))||a);return s>3&&a&&Object.defineProperty(t,o,a),a};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{owSlot}from"./library/ow.js";import styles from"./drawer.styles.js";let GlideCoreDrawer=class GlideCoreDrawer extends LitElement{constructor(){super(...arguments),this.pinned=!1,this.#e=createRef(),this.#t=createRef(),this.#o=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get open(){return this.#o}set open(e){const t=e!==this.#o;this.#o=e;const o=window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:300;this.#o&&t?(this.#n?.cancel(),this.#e?.value?.classList?.add("open"),this.#i=this.#e?.value?.animate({transform:["translateX(100%)","translateX(0)"]},{duration:o,fill:"forwards",easing:"cubic-bezier(0.33, 1, 0.68, 1)"}),this.#e?.value?.animate({opacity:[0,1]},{duration:o,fill:"forwards",easing:"ease-in",composite:"add"}),this.#i?.finished.then((()=>{this.#e?.value?.focus(),this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}))}))):t&&(this.#i?.cancel(),this.#n=this.#e?.value?.animate({transform:["translateX(0)","translateX(100%)"]},{duration:o,fill:"forwards",easing:"cubic-bezier(0.33, 1, 0.68, 1)"}),this.#e?.value?.animate({opacity:[1,0]},{duration:o,fill:"forwards",composite:"add"}),this.#n?.finished.then((()=>{this.#e.value?.classList?.remove("open"),this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}))})))}firstUpdated(){owSlot(this.#t.value),this.#o&&(this.#e?.value?.classList?.add("open"),this.#i=this.#e?.value?.animate({transform:"translateX(0)"},{duration:0,fill:"forwards"}),this.#e?.value?.animate({opacity:1},{duration:0,fill:"forwards",composite:"add"}))}render(){return html`<aside aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,pinned:this.pinned})}" data-test="component" tabindex="-1" @keydown="${this.#s}" ${ref(this.#e)}><slot @slotchange="${this.#a}" ${ref(this.#t)}></slot></aside>`}#n;#e;#t;#o;#i;#s(e){"Escape"===e.key&&(e.preventDefault(),this.open=!1)}#a(){owSlot(this.#t.value)}};__decorate([property({reflect:!0})],GlideCoreDrawer.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDrawer.prototype,"pinned",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDrawer.prototype,"open",null),GlideCoreDrawer=__decorate([customElement("glide-core-drawer")],GlideCoreDrawer);export default GlideCoreDrawer;
|
package/dist/drawer.styles.js
CHANGED
package/dist/dropdown.d.ts
CHANGED
@@ -11,9 +11,10 @@ declare global {
|
|
11
11
|
}
|
12
12
|
}
|
13
13
|
/**
|
14
|
-
* @event change
|
15
|
-
* @event input
|
16
|
-
* @event invalid
|
14
|
+
* @event change
|
15
|
+
* @event input
|
16
|
+
* @event invalid
|
17
|
+
* @event toggle
|
17
18
|
*
|
18
19
|
* @slot - One or more of `<glide-core-dropdown-option>`.
|
19
20
|
* @slot description - Additional information or context.
|