@crowdstrike/glide-core 0.15.1 → 0.16.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/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/drawer.js +1 -1
- package/dist/drawer.styles.js +0 -2
- package/dist/dropdown.js +1 -1
- package/dist/dropdown.styles.js +1 -0
- package/dist/inline-alert.styles.js +9 -5
- package/dist/library/localize.d.ts +1 -0
- package/dist/library/localize.test.js +1 -3
- package/dist/library/ow.test.js +0 -1
- package/dist/popover.d.ts +26 -0
- package/dist/popover.js +1 -0
- package/dist/popover.styles.js +119 -0
- package/dist/radio-group.d.ts +8 -7
- package/dist/radio-group.js +7 -5
- 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/tab.group.d.ts +0 -3
- package/dist/tab.group.js +1 -1
- package/dist/tag.styles.js +9 -5
- package/dist/toasts.toast.styles.js +6 -3
- package/dist/toggle.styles.js +8 -0
- package/dist/tooltip.d.ts +1 -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.styles.js +8 -2
- package/dist/tree.js +1 -1
- package/package.json +5 -5
- 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/{radio.styles.js → radio-group.radio.styles.js} +0 -0
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/drawer.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,a){var o,s=arguments.length,n=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(n=(s<3?o(n):s>3?o(t,i,n):o(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};import{LitElement,html,nothing}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{owSlot}from"./library/ow.js";import styles from"./drawer.styles.js";let GlideCoreDrawer=class GlideCoreDrawer extends LitElement{constructor(){super(...arguments),this.label="",this.pinned=!1,this.#e=createRef(),this.#t=createRef(),this.#i=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get open(){return this.#i}set open(e){this.#i=e;const t=window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:300;this.#i?(async()=>{this.#a?.cancel(),this.#e?.value?.classList?.add("open"),this.#o=this.#e?.value?.animate({transform:["translateX(100%)","translateX(0)"]},{duration:t,fill:"forwards",easing:"cubic-bezier(0.33, 1, 0.68, 1)"}),this.#e?.value?.animate({opacity:[0,1]},{duration:t,fill:"forwards",easing:"ease-in",composite:"add"}),await(this.#o?.finished),this.#e?.value?.focus()})():(async()=>{this.#o?.cancel(),this.#a=this.#e?.value?.animate({transform:["translateX(0)","translateX(100%)"]},{duration:t,fill:"forwards",easing:"cubic-bezier(0.33, 1, 0.68, 1)"}),this.#e?.value?.animate({opacity:[1,0]},{duration:t,fill:"forwards",composite:"add"}),await(this.#a?.finished),this.#e.value?.classList?.remove("open"),this.dispatchEvent(new Event("close",{bubbles:!0}))})()}close(){this.open=!1}firstUpdated(){owSlot(this.#t.value),this.#i&&(this.#e?.value?.classList?.add("open"),this.#o=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 class="${classMap({component:!0,pinned:this.pinned})}" tabindex="-1" data-test="${this.#i?"open":"closed"}" @keydown="${this.#s}" ${ref(this.#e)} aria-label="${this.label||nothing}"><slot @slotchange="${this.#n}" ${ref(this.#t)}></slot></aside>`}show(){this.open=!0}#e;#a;#t;#i;#o;#n(){owSlot(this.#t.value)}#s(e){"Escape"===e.key&&(e.preventDefault(),this.close())}};__decorate([property()],GlideCoreDrawer.prototype,"label",void 0),__decorate([property({type:Boolean})],GlideCoreDrawer.prototype,"pinned",void 0),__decorate([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.js
CHANGED
@@ -293,4 +293,4 @@ var __decorate=this&&this.__decorate||function(e,t,i,s){var l,o=arguments.length
|
|
293
293
|
>`))}
|
294
294
|
</div>
|
295
295
|
</glide-core-private-label>
|
296
|
-
</div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#v.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#v.setValidity({customError:!1},"",this.filterable||this.isFilterable?this.#l.value:this.#m.value):this.#v.setValidity({customError:!0,valueMissing:this.#v.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}setValidity(e,t){this.validityMessage=t,this.#v.setValidity(e," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.readonly=!1,this.selectAll=!1,this.required=!1,this.ariaActivedescendant="",this.inputValue="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isCommunicateItemCountToScreenreaders=!1,this.isFilterable=!1,this.isFiltering=!1,this.isInputOverflow=!1,this.isInputTooltipOpen=!1,this.isInternalLabelOverflow=!1,this.isInternalLabelTooltipOpen=!1,this.isNoResults=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.itemCount=0,this.tagOverflowLimit=0,this.#se=createRef(),this.#w=createRef(),this.#O=createRef(),this.#k=createRef(),this.#N=createRef(),this.#l=createRef(),this.#y=createRef(),this.#le=!1,this.#e=!1,this.#oe=!1,this.#s=!1,this.#d=!1,this.#n=!1,this.#ne=!1,this.#ae=!1,this.#re=!1,this.#pe=!1,this.#u=!1,this.#M=new LocalizeController(this),this.#E=createRef(),this.#m=createRef(),this.#Y=createRef(),this.#r="large",this.#F=createRef(),this.#c=[],this.#f=()=>{this.#le?setTimeout((()=>{this.#le=!1})):this.open=!1},this.#b=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#v=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#se;#de;#w;#O;#k;#N;#l;#y;#v;#le;#e;#oe;#s;#d;#n;#ne;#ae;#re;#pe;#u;#M;#E;#he;#m;#Y;#g;#r;#F;#c;#f;#b;#t(){this.#de?.(),this.#E.value?.hidePopover(),this.ariaActivedescendant="",this.activeOption&&(this.#he=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1)}get#A(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#ee(){this.open=!1,this.dispatchEvent(new Event("add",{bubbles:!0,composed:!0}))}#te(){this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.#he=this.activeOption,this.activeOption.privateActive=!1)}#ie(){this.activeOption&&!this.#ne&&(this.#he=this.activeOption,this.activeOption.privateActive=!1)}#R(){this.#le=!0}#Z(){owSlotType(this.#O.value,[GlideCoreDropdownOption,Text]),this.isFilterable=this.#a.length>10,this.tagOverflowLimit=this.selectedOptions.length;for(const e of this.#a)e.privateSize=this.size,e.privateMultiple=this.multiple;const e=this.#ce?.find((e=>!e.disabled));!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.#he=this.lastSelectedOption,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(this.#he=e,this.ariaActivedescendant=this.open?e.id:"",e.privateActive=!0),this.#Y.value&&(this.#Y.value.selected=this.isAllSelected),this.multiple?this.#c=this.selectedOptions.filter((e=>Boolean(e.value))).map((({value:e})=>e)):this.lastSelectedOption?.value&&(this.#c=[this.lastSelectedOption.value]),this.requestUpdate(),this.updateComplete.then((()=>{!this.multiple&&this.#l.value&&this.lastSelectedOption?.value&&(this.#l.value.value=this.lastSelectedOption.label,this.inputValue=this.lastSelectedOption.label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth)}))}#C(e){this.open&&this.#he&&e.relatedTarget===this.#se.value&&(this.#he.privateActive=!0,this.#he.privateIsTooltipOpen=!this.#he.editable)}#S(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#g?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#oe&&(this.open=!1,this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}#$(e){if(this.disabled||this.readonly)return;if(("Enter"===e.key||" "===e.key)&&e.target===this.#N.value)return void(this.#le=!0);if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if(this.open&&"ArrowUp"===e.key&&this.#g?.activeElement===this.#se.value)return this.focus(),void(this.#he&&(this.#he.privateActive=!0,this.#he.privateIsEditActive=this.#he.editable,this.#he.privateIsTooltipOpen=!this.#he.privateIsEditActive));if(this.open&&"ArrowDown"===e.key&&this.#g?.activeElement===this.#se.value)return void e.preventDefault();if(this.open&&"ArrowDown"===e.key&&this.addButtonLabel&&this.activeOption===this.#ue?.at(-1)&&(!this.activeOption?.editable||this.activeOption?.privateIsEditActive))return e.preventDefault(),this.activeOption&&(this.#he=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),void this.#se.value?.focus();if("Escape"===e.key)return e.preventDefault(),this.open=!1,void(this.#g?.activeElement===this.#se.value&&this.focus());const t=e.target===this.#m.value||e.target===this.#l.value||e.target instanceof GlideCoreDropdownOption;if(!this.multiple||t){if(!this.open&&[" ","ArrowUp","ArrowDown"].includes(e.key))return e.preventDefault(),this.open=!0,void(this.activeOption&&(this.activeOption.privateIsTooltipOpen=!this.activeOption.privateIsEditActive));if(this.activeOption&&this.open){if("Enter"===e.key||" "===e.key){if(this.activeOption.privateIsEditActive)return this.activeOption.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if("Enter"===e.key&&this.#ue&&this.#ue.length>0||" "===e.key&&!this.filterable&&!this.isFilterable)return this.#pe=!0,e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#Y.value&&this.#ve(),this.#pe=!1,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0}))}const t=this.#ce?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#ce&&"number"==typeof t){e.preventDefault();const i=this.#ce.findLast(((e,i)=>!e.disabled&&i<t));return void(this.activeOption?.privateIsEditActive?(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!0):i&&0!==t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#he=i,i.privateActive=!0,i.privateIsEditActive=i.editable,i.privateIsTooltipOpen=!i.editable,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#ce&&"number"==typeof t){e.preventDefault();const i=this.#ce.find(((e,i)=>!e.disabled&&i>t));return void(this.activeOption.editable&&!this.activeOption.privateIsEditActive?(this.activeOption.privateIsEditActive=!0,this.activeOption.privateIsTooltipOpen=!1):i&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#he=i,i.privateActive=!0,i.privateIsTooltipOpen=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#ce){e.preventDefault();const t=[...this.#ce].reverse().findLast((e=>!e.disabled));return void(t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#he=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#ce){e.preventDefault();const t=[...this.#ce].findLast((e=>!e.disabled));return void(t&&this.activeOption&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#he=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}}}}#I(e){if(this.disabled||this.readonly)return;if(this.#oe)return void(this.#oe=!1);if(e.target instanceof Node&&this.#N.value?.contains(e.target))return void this.selectedOptions[0].dispatchEvent(new Event("edit",{bubbles:!0,composed:!0}));const t=this.filterable||this.isFilterable;if(this.#pe||!this.open||t&&!(e.target instanceof Element&&this.#m.value?.contains(e.target)))return 0!==e.detail?(this.open=!0,this.focus(),this.#ne=!0,void setTimeout((()=>{this.#ne=!1}))):void 0;this.open=!1}#D(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#l.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}#z(){this.open=!1}get#a(){return this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption))??[]}get#p(){const e=this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption));if(e&&this.#Y.value)return[this.#Y.value,...e]}get#ue(){return this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#ce(){const e=this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#Y.value&&!this.#Y.value.hidden&&e?[this.#Y.value,...e]:e}#_(){this.isCommunicateItemCountToScreenreaders=!1,this.isInputTooltipOpen=!1}#B(){this.#l.value?.select(),this.isInputTooltipOpen=!0}async#G(e){let t;ow(this.#l.value,ow.object.instanceOf(HTMLInputElement)),e.stopPropagation(),this.open=!0,this.isShowSingleSelectIcon=!1,this.inputValue=this.#l.value.value,this.multiple&&""!==this.#l.value.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#l.value.value&&this.#l.value.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1;try{t=await this.filter(this.#l.value.value)}catch{}if(t){for(const e of this.#a)e.hidden=!t.includes(e);const e=this.#ue?.at(0);e&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,this.#he=e,this.ariaActivedescendant=e.id,e.privateActive=!0),this.isNoResults=!this.#ue||0===this.#ue.length,this.isCommunicateItemCountToScreenreaders=!0,this.#ue&&(this.itemCount=this.#ue.length)}}#V(e){const t=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1)).at(-1);if(t&&"Backspace"===e.key&&!e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart)return this.#oe=!0,t.selected=!1,void(this.#oe=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart){this.#oe=!0;for(const e of i)e.selected=!1;this.#oe=!1}else;}#H(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t instanceof GlideCoreDropdownOption&&t.disabled)return;if(t instanceof GlideCoreDropdownOption&&t.privateIsEditActive)return t.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if(t&&!t.selected)return t.selected=!0,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0}));if(t?.selected&&!this.multiple)return void(this.open=!1)}}#K(){this.requestUpdate()}#U(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0,this.#he=e.target)}#q(e){e.stopPropagation(),e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#Y.value&&this.#ve(),this.#o(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}#J(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))):(this.filterable||this.isFilterable)&&this.#l.value?(this.#l.value.value=this.selectedOptions[0].label,this.inputValue=this.selectedOptions[0].label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth):this.requestUpdate())}#P(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#W(e){if(e.target instanceof GlideCoreDropdownOption&&this.#ce){if(e.target.disabled)return;this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),this.ariaActivedescendant=e.target.id,this.#he=e.target,e.target.privateActive=!0,e.target.privateIsEditActive=!1,this.#g?.activeElement===this.#se.value&&this.focus()}}#Q(e){e.target!==this.#Y.value&&!this.#re&&this.#Y.value&&(this.#Y.value.selected=this.isAllSelected),this.isShowSingleSelectIcon=!this.multiple&&this.selectedOptions.length>0&&Boolean(this.selectedOptions.at(0)?.value),e.target instanceof GlideCoreDropdownOption&&(this.multiple&&!this.#u?(this.#c=e.target.selected&&e.target.value&&!e.target.disabled?[...this.value,e.target.value]:this.value.filter((t=>e.target instanceof GlideCoreDropdownOption&&t!==e.target.value)),this.#l.value&&!this.#oe&&(this.isFiltering=!1,this.#l.value.value="",this.inputValue="")):this.multiple||!e.target.selected||e.target.disabled||(this.#c=e.target.value?[e.target.value]:[],this.#l.value&&(this.isFiltering=!1,this.#l.value.value=e.target.label,this.inputValue=e.target.label))),this.#l.value&&(this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth),this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))}#X(e){e.target instanceof GlideCoreDropdownOption&&this.multiple&&e.target.selected&&e.detail.new?this.#c=this.value.map((t=>t===e.detail.old?e.detail.new:t)):e.target instanceof GlideCoreDropdownOption&&this.multiple?this.#c=this.value.filter((t=>t!==e.detail.old)):e.target instanceof GlideCoreDropdownOption&&(this.#c=e.detail.new?[e.detail.new]:[])}#x(){this.isInternalLabelTooltipOpen=!0}#j(){this.isInternalLabelTooltipOpen=!1}#T(){this.#oe=!0,this.open=!1}async#L(e){this.#oe=!0;for(const t of this.#a)t.id===e&&(t.selected=!1,this.#c=this.value.filter((e=>e!==t.value)));const t=this.#F.value?.querySelectorAll("glide-core-tag");if(t&&this.selectedOptions.length>0){const i=[...t].findIndex((t=>t.dataset.id===e)),s=t[i<t.length-1?i+1:i-1];await this.updateComplete,setTimeout((()=>{s?.focus(),this.#oe=!1}))}else setTimeout((()=>{this.focus(),this.#oe=!1}));this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}#ve(){ow(this.#Y.value,ow.object.instanceOf(GlideCoreDropdownOption)),this.#re=!0;for(const e of this.#a)e.selected=this.#Y.value.selected&&!e.disabled;this.#re=!1}async#h(){if(this.#w.value){const e=this.#w.value.scrollWidth>this.#w.value.clientWidth;e&&this.tagOverflowLimit>1?(this.tagOverflowLimit=this.tagOverflowLimit-1,await this.updateComplete,this.#h()):!e&&!this.#ae&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#ae=!0,await this.updateComplete,this.#h()):this.#ae=!1}}#i(){this.#de?.(),this.#he&&(this.#he.privateActive=!0,this.ariaActivedescendant=this.#he.id),this.#k.value&&this.#E.value&&(this.#de=autoUpdate(this.#k.value,this.#E.value,(()=>{(async()=>{if(this.#k.value&&this.#E.value){const{x:e,y:t,placement:i}=await computePosition(this.#k.value,this.#E.value,{placement:"bottom-start",middleware:[offset({mainAxis:Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}),flip()]});this.#E.value.dataset.placement=i,Object.assign(this.#E.value.style,{left:`${e}px`,top:`${t}px`}),this.#E.value?.showPopover()}})()})))}#o(){if((this.filterable||this.isFilterable)&&this.#l.value){this.isFiltering=!1;for(const e of this.#a)e.hidden=!1}}};__decorate([property({attribute:"add-button-label",reflect:!0})],GlideCoreDropdown.prototype,"addButtonLabel",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"disabled",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"filterable",null),__decorate([property({attribute:"hide-label",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"name",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"open",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"placeholder",void 0),__decorate([property()],GlideCoreDropdown.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"readonly",void 0),__decorate([property({attribute:"select-all",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"selectAll",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"size",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"multiple",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"required",void 0),__decorate([property({type:Array})],GlideCoreDropdown.prototype,"value",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"variant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"ariaActivedescendant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"inputValue",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCommunicateItemCountToScreenreaders",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFilterable",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFiltering",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInputOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInputTooltipOpen",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelTooltipOpen",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isNoResults",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isShowSingleSelectIcon",void 0),__decorate([state()],GlideCoreDropdown.prototype,"itemCount",void 0),__decorate([state()],GlideCoreDropdown.prototype,"tagOverflowLimit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"validityMessage",void 0),GlideCoreDropdown=__decorate([customElement("glide-core-dropdown")],GlideCoreDropdown);export default GlideCoreDropdown;
|
296
|
+
</div>`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#v.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#v.setValidity({customError:!1},"",this.filterable||this.isFilterable?this.#l.value:this.#m.value):this.#v.setValidity({customError:!0,valueMissing:this.#v.validity.valueMissing}," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}setValidity(e,t){this.validityMessage=t,this.#v.setValidity(e," ",this.filterable||this.isFilterable?this.#l.value:this.#m.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.readonly=!1,this.selectAll=!1,this.required=!1,this.ariaActivedescendant="",this.inputValue="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isCommunicateItemCountToScreenreaders=!1,this.isFilterable=!1,this.isFiltering=!1,this.isInputOverflow=!1,this.isInputTooltipOpen=!1,this.isInternalLabelOverflow=!1,this.isInternalLabelTooltipOpen=!1,this.isNoResults=!1,this.isReportValidityOrSubmit=!1,this.isShowSingleSelectIcon=!1,this.itemCount=0,this.tagOverflowLimit=0,this.#se=createRef(),this.#w=createRef(),this.#O=createRef(),this.#k=createRef(),this.#N=createRef(),this.#l=createRef(),this.#y=createRef(),this.#le=!1,this.#e=!1,this.#oe=!1,this.#s=!1,this.#d=!1,this.#n=!1,this.#ne=!1,this.#ae=!1,this.#re=!1,this.#pe=!1,this.#u=!1,this.#M=new LocalizeController(this),this.#E=createRef(),this.#m=createRef(),this.#Y=createRef(),this.#r="large",this.#F=createRef(),this.#c=[],this.#f=()=>{this.#le?setTimeout((()=>{this.#le=!1})):this.open=!1},this.#b=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,JSON.stringify(this.value))},this.#v=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#se;#de;#w;#O;#k;#N;#l;#y;#v;#le;#e;#oe;#s;#d;#n;#ne;#ae;#re;#pe;#u;#M;#E;#he;#m;#Y;#g;#r;#F;#c;#f;#b;#t(){this.#de?.(),this.#E.value?.hidePopover(),this.ariaActivedescendant="",this.activeOption&&(this.#he=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1)}get#A(){return!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit}#ee(){this.open=!1,this.dispatchEvent(new Event("add",{bubbles:!0,composed:!0}))}#te(){this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.#he=this.activeOption,this.activeOption.privateActive=!1)}#ie(){this.activeOption&&!this.#ne&&(this.#he=this.activeOption,this.activeOption.privateActive=!1)}#R(){this.#le=!0}#Z(){owSlotType(this.#O.value,[GlideCoreDropdownOption,Text]),this.isFilterable=this.#a.length>10,this.tagOverflowLimit=this.selectedOptions.length;for(const e of this.#a)e.privateSize=this.size,e.privateMultiple=this.multiple;const e=this.#ce?.find((e=>!e.disabled));!this.activeOption&&this.lastSelectedOption?(this.lastSelectedOption.privateActive=!0,this.#he=this.lastSelectedOption,this.ariaActivedescendant=this.open?this.lastSelectedOption.id:""):!this.activeOption&&e&&(this.#he=e,this.ariaActivedescendant=this.open?e.id:"",e.privateActive=!0),this.#Y.value&&(this.#Y.value.selected=this.isAllSelected),this.multiple?this.#c=this.selectedOptions.filter((e=>Boolean(e.value))).map((({value:e})=>e)):this.lastSelectedOption?.value&&(this.#c=[this.lastSelectedOption.value]),this.requestUpdate(),this.updateComplete.then((()=>{!this.multiple&&this.#l.value&&this.lastSelectedOption?.value&&(this.#l.value.value=this.lastSelectedOption.label,this.inputValue=this.lastSelectedOption.label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth)}))}#C(e){this.open&&this.#he&&e.relatedTarget===this.#se.value&&(this.#he.privateActive=!0,this.#he.privateIsTooltipOpen=!this.#he.editable)}#S(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.#g?.contains(e.relatedTarget)&&!this.contains(e.relatedTarget))&&!this.#oe&&(this.open=!1,this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}#$(e){if(this.disabled||this.readonly)return;if(("Enter"===e.key||" "===e.key)&&e.target===this.#N.value)return void(this.#le=!0);if(!this.open&&"Enter"===e.key)return void this.form?.requestSubmit();if(this.open&&"ArrowUp"===e.key&&this.#g?.activeElement===this.#se.value)return this.focus(),void(this.#he&&(this.#he.privateActive=!0,this.#he.privateIsEditActive=this.#he.editable,this.#he.privateIsTooltipOpen=!this.#he.privateIsEditActive));if(this.open&&"ArrowDown"===e.key&&this.#g?.activeElement===this.#se.value)return void e.preventDefault();if(this.open&&"ArrowDown"===e.key&&this.addButtonLabel&&this.activeOption===this.#ue?.at(-1)&&(!this.activeOption?.editable||this.activeOption?.privateIsEditActive))return e.preventDefault(),this.activeOption&&(this.#he=this.activeOption,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),void this.#se.value?.focus();if("Escape"===e.key)return e.preventDefault(),this.open=!1,void(this.#g?.activeElement===this.#se.value&&this.focus());const t=e.target===this.#m.value||e.target===this.#l.value||e.target instanceof GlideCoreDropdownOption;if(!this.multiple||t){if(!this.open&&[" ","ArrowUp","ArrowDown"].includes(e.key))return e.preventDefault(),this.open=!0,void(this.activeOption&&(this.activeOption.privateIsTooltipOpen=!this.activeOption.privateIsEditActive));if(this.activeOption&&this.open){if("Enter"===e.key||" "===e.key){if(this.activeOption.privateIsEditActive)return this.activeOption.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if("Enter"===e.key&&this.#ue&&this.#ue.length>0||" "===e.key&&!this.filterable&&!this.isFilterable)return this.#pe=!0,e.preventDefault(),this.isFiltering=!1,this.activeOption.selected=!this.multiple||!this.activeOption.selected,this.activeOption===this.#Y.value&&this.#ve(),this.#pe=!1,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0}))}const t=this.#ce?.indexOf(this.activeOption);if("ArrowUp"===e.key&&!e.metaKey&&this.#ce&&"number"==typeof t){e.preventDefault();const i=this.#ce.findLast(((e,i)=>!e.disabled&&i<t));return void(this.activeOption?.privateIsEditActive?(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!0):i&&0!==t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#he=i,i.privateActive=!0,i.privateIsEditActive=i.editable,i.privateIsTooltipOpen=!i.editable,i.scrollIntoView({block:"center"})))}if("ArrowDown"===e.key&&!e.metaKey&&this.#ce&&"number"==typeof t){e.preventDefault();const i=this.#ce.find(((e,i)=>!e.disabled&&i>t));return void(this.activeOption.editable&&!this.activeOption.privateIsEditActive?(this.activeOption.privateIsEditActive=!0,this.activeOption.privateIsTooltipOpen=!1):i&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=i.id,this.#he=i,i.privateActive=!0,i.privateIsTooltipOpen=!0,i.scrollIntoView({block:"center"})))}if(("ArrowUp"===e.key&&e.metaKey||"Home"===e.key||"PageUp"===e.key)&&this.#ce){e.preventDefault();const t=[...this.#ce].reverse().findLast((e=>!e.disabled));return void(t&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#he=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}if(("ArrowDown"===e.key&&e.metaKey||"End"===e.key||"PageDown"===e.key)&&this.#ce){e.preventDefault();const t=[...this.#ce].findLast((e=>!e.disabled));return void(t&&this.activeOption&&(this.activeOption.privateIsEditActive=!1,this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1,this.ariaActivedescendant=t.id,this.#he=t,t.privateActive=!0,t.privateIsTooltipOpen=!0,t.scrollIntoView({block:"nearest"})))}}}}#I(e){if(this.disabled||this.readonly)return;if(this.#oe)return void(this.#oe=!1);if(e.target instanceof Node&&this.#N.value?.contains(e.target))return void this.selectedOptions[0].dispatchEvent(new Event("edit",{bubbles:!0,composed:!0}));const t=this.filterable||this.isFilterable;if(this.#pe||!this.open||t&&!(e.target instanceof Element&&this.#m.value?.contains(e.target)))return 0!==e.detail?(this.open=!0,this.focus(),this.#ne=!0,void setTimeout((()=>{this.#ne=!1}))):void 0;this.open=!1}#D(e){const t=this.filterable||this.isFilterable,i=e.target instanceof GlideCoreTag;t&&!i?e.target!==this.#l.value&&(e.preventDefault(),this.focus()):i||e.preventDefault()}#z(){this.open=!1}get#a(){return this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption))??[]}get#p(){const e=this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption));if(e&&this.#Y.value)return[this.#Y.value,...e]}get#ue(){return this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden))}get#ce(){const e=this.#O.value?.assignedElements().filter((e=>e instanceof GlideCoreDropdownOption&&!e.hidden));return this.#Y.value&&!this.#Y.value.hidden&&e?[this.#Y.value,...e]:e}#_(){this.isCommunicateItemCountToScreenreaders=!1,this.isInputTooltipOpen=!1}#B(){this.#l.value?.select(),this.isInputTooltipOpen=!0}async#G(e){let t;ow(this.#l.value,ow.object.instanceOf(HTMLInputElement)),e.stopPropagation(),this.open=!0,this.isShowSingleSelectIcon=!1,this.inputValue=this.#l.value.value,this.multiple&&""!==this.#l.value.value?this.isFiltering=!0:this.multiple?this.isFiltering=!1:""!==this.#l.value.value&&this.#l.value.value!==this.selectedOptions.at(0)?.label?this.isFiltering=!0:this.isFiltering=!1;try{t=await this.filter(this.#l.value.value)}catch{}if(t){for(const e of this.#a)e.hidden=!t.includes(e);const e=this.#ue?.at(0);e&&this.activeOption?.hidden&&(this.activeOption.privateActive=!1,this.#he=e,this.ariaActivedescendant=e.id,e.privateActive=!0),this.isNoResults=!this.#ue||0===this.#ue.length,this.isCommunicateItemCountToScreenreaders=!0,this.#ue&&(this.itemCount=this.#ue.length)}}#V(e){const t=this.selectedOptions.findLast(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&!e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart)return this.#oe=!0,t.selected=!1,void(this.#oe=!1);const i=this.selectedOptions.filter(((e,t)=>t<=this.tagOverflowLimit-1));if(t&&"Backspace"===e.key&&e.metaKey&&this.multiple&&this.#l.value&&0===this.#l.value.selectionStart){this.#oe=!0;for(const e of i)e.selected=!1;this.#oe=!1}else;}#H(e){if(e.target instanceof Element){const t=e.target.closest("glide-core-dropdown-option");if(t instanceof GlideCoreDropdownOption&&t.disabled)return;if(t instanceof GlideCoreDropdownOption&&t.privateIsEditActive)return t.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})),void(this.open=!1);if(t&&!t.selected)return t.selected=!0,this.#o(),this.multiple||(this.open=!1),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0}));if(t?.selected&&!this.multiple)return void(this.open=!1)}}#K(){this.requestUpdate()}#U(e){e.target instanceof GlideCoreDropdownOption&&(this.activeOption&&(this.activeOption.privateActive=!1),e.target.privateActive=!0,this.#he=e.target)}#q(e){e.stopPropagation(),e.target instanceof GlideCoreDropdownOption&&(e.target.selected=!e.target.selected),e.target===this.#Y.value&&this.#ve(),this.#o(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}#J(){this.selectedOptions.length>0&&(this.multiple?(this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))):(this.filterable||this.isFilterable)&&this.#l.value?(this.#l.value.value=this.selectedOptions[0].label,this.inputValue=this.selectedOptions[0].label,this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth):this.requestUpdate())}#P(e){(this.filterable||this.isFilterable)&&e.preventDefault()}#W(e){if(e.target instanceof GlideCoreDropdownOption&&this.#ce){if(e.target.disabled)return;this.activeOption&&(this.activeOption.privateIsTooltipOpen=!1,this.activeOption.privateActive=!1),this.ariaActivedescendant=e.target.id,this.#he=e.target,e.target.privateActive=!0,e.target.privateIsEditActive=!1,this.#g?.activeElement===this.#se.value&&this.focus()}}#Q(e){e.target!==this.#Y.value&&!this.#re&&this.#Y.value&&(this.#Y.value.selected=this.isAllSelected),this.isShowSingleSelectIcon=!this.multiple&&this.selectedOptions.length>0&&Boolean(this.selectedOptions.at(0)?.value),e.target instanceof GlideCoreDropdownOption&&(this.multiple&&!this.#u?(this.#c=e.target.selected&&e.target.value&&!e.target.disabled?[...this.value,e.target.value]:this.value.filter((t=>e.target instanceof GlideCoreDropdownOption&&t!==e.target.value)),this.#l.value&&!this.#oe&&(this.isFiltering=!1,this.#l.value.value="",this.inputValue="")):this.multiple||!e.target.selected||e.target.disabled||(this.#c=e.target.value?[e.target.value]:[],this.#l.value&&(this.isFiltering=!1,this.#l.value.value=e.target.label,this.inputValue=e.target.label))),this.#l.value&&(this.isInputOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth),this.requestUpdate(),this.updateComplete.then((()=>{this.#h()}))}#X(e){e.target instanceof GlideCoreDropdownOption&&this.multiple&&e.target.selected&&e.detail.new?this.#c=this.value.map((t=>t===e.detail.old?e.detail.new:t)):e.target instanceof GlideCoreDropdownOption&&this.multiple?this.#c=this.value.filter((t=>t!==e.detail.old)):e.target instanceof GlideCoreDropdownOption&&(this.#c=e.detail.new?[e.detail.new]:[])}#x(){this.isInternalLabelTooltipOpen=!0}#j(){this.isInternalLabelTooltipOpen=!1}#T(){this.#oe=!0,this.open=!1}async#L(e){this.#oe=!0;for(const t of this.#a)t.id===e&&(t.selected=!1,this.#c=this.value.filter((e=>e!==t.value)));const t=this.#F.value?.querySelectorAll("glide-core-tag");if(t&&this.selectedOptions.length>0){const i=[...t].findIndex((t=>t.dataset.id===e)),s=t[i<t.length-1?i+1:i-1];await this.updateComplete,setTimeout((()=>{s?.focus(),this.#oe=!1}))}else setTimeout((()=>{this.focus(),this.#oe=!1}));this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}#ve(){ow(this.#Y.value,ow.object.instanceOf(GlideCoreDropdownOption)),this.#re=!0;for(const e of this.#a)e.selected=this.#Y.value.selected&&!e.disabled;this.#re=!1}async#h(){if(this.#w.value){const e=this.#w.value.scrollWidth>this.#w.value.clientWidth;e&&this.tagOverflowLimit>1?(this.tagOverflowLimit=this.tagOverflowLimit-1,await this.updateComplete,this.#h()):!e&&!this.#ae&&this.tagOverflowLimit<this.selectedOptions.length?(this.tagOverflowLimit=this.tagOverflowLimit+1,this.#ae=!0,await this.updateComplete,this.#h()):this.#ae=!1}}#i(){this.#de?.(),this.#he&&(this.#he.privateActive=!0,this.ariaActivedescendant=this.#he.id),this.#k.value&&this.#E.value&&(this.#de=autoUpdate(this.#k.value,this.#E.value,(()=>{(async()=>{if(this.#k.value&&this.#E.value){const{x:e,y:t,placement:i}=await computePosition(this.#k.value,this.#E.value,{placement:"bottom-start",middleware:[offset({mainAxis:Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}),flip()]});this.#E.value.dataset.placement=i,Object.assign(this.#E.value.style,{left:`${e}px`,top:`${t}px`}),this.#E.value?.showPopover()}})()})))}#o(){if((this.filterable||this.isFilterable)&&this.#l.value){this.isFiltering=!1;for(const e of this.#a)e.hidden=!1}}};__decorate([property({attribute:"add-button-label",reflect:!0})],GlideCoreDropdown.prototype,"addButtonLabel",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"disabled",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"filterable",null),__decorate([property({attribute:"hide-label",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"name",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"open",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"placeholder",void 0),__decorate([property()],GlideCoreDropdown.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"readonly",void 0),__decorate([property({attribute:"select-all",reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"selectAll",void 0),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"size",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"multiple",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdown.prototype,"required",void 0),__decorate([property({type:Array})],GlideCoreDropdown.prototype,"value",null),__decorate([property({reflect:!0})],GlideCoreDropdown.prototype,"variant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"ariaActivedescendant",void 0),__decorate([state()],GlideCoreDropdown.prototype,"inputValue",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isCommunicateItemCountToScreenreaders",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFilterable",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isFiltering",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInputOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInputTooltipOpen",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelOverflow",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isInternalLabelTooltipOpen",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isNoResults",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"isShowSingleSelectIcon",void 0),__decorate([state()],GlideCoreDropdown.prototype,"itemCount",void 0),__decorate([state()],GlideCoreDropdown.prototype,"tagOverflowLimit",void 0),__decorate([state()],GlideCoreDropdown.prototype,"validityMessage",void 0),GlideCoreDropdown=__decorate([customElement("glide-core-dropdown")],GlideCoreDropdown);export default GlideCoreDropdown;
|
package/dist/dropdown.styles.js
CHANGED
@@ -342,6 +342,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
342
342
|
font-family: var(--glide-core-font-sans);
|
343
343
|
font-size: inherit;
|
344
344
|
min-inline-size: var(--min-inline-size);
|
345
|
+
padding-block-end: 0;
|
345
346
|
padding-inline: 0;
|
346
347
|
|
347
348
|
&:not(.quiet) {
|
@@ -33,14 +33,18 @@ import{css}from"lit";export default[css`
|
|
33
33
|
}
|
34
34
|
|
35
35
|
&.added {
|
36
|
-
|
36
|
+
@media (prefers-reduced-motion: no-preference) {
|
37
|
+
animation: fade-in var(--animation-duration) ease-in-out;
|
38
|
+
}
|
37
39
|
}
|
38
40
|
|
39
41
|
&.removed {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
@media (prefers-reduced-motion: no-preference) {
|
43
|
+
animation-duration: var(--animation-duration);
|
44
|
+
animation-fill-mode: forwards;
|
45
|
+
animation-name: fade-out;
|
46
|
+
animation-timing-function: ease-in-out;
|
47
|
+
}
|
44
48
|
}
|
45
49
|
}
|
46
50
|
|
@@ -15,6 +15,7 @@ export interface Translation extends DefaultTranslation {
|
|
15
15
|
nextTab: string;
|
16
16
|
previousTab: string;
|
17
17
|
noResults: string;
|
18
|
+
tooltip: string;
|
18
19
|
announcedCharacterCount: (current: number, maximum: number) => string;
|
19
20
|
displayedCharacterCount: (current: number, maximum: number) => string;
|
20
21
|
clearEntry: (label: string) => string;
|
@@ -24,9 +24,7 @@ GlideCoreMockComponent = __decorate([
|
|
24
24
|
customElement('mock-component')
|
25
25
|
], GlideCoreMockComponent);
|
26
26
|
it('can call any term from en translation if locale is Japanese', async () => {
|
27
|
-
const component = await fixture(
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
29
|
-
html `<mock-component></mock-component>`);
|
27
|
+
const component = await fixture(html `<mock-component></mock-component>`);
|
30
28
|
component.lang = 'ja';
|
31
29
|
expect(component.localize.lang()).to.equal('ja');
|
32
30
|
const keys = Object.keys(en);
|
package/dist/library/ow.test.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
declare global {
|
3
|
+
interface HTMLElementTagNameMap {
|
4
|
+
'glide-core-popover': GlideCorePopover;
|
5
|
+
}
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* @slot - The content of the popover.
|
9
|
+
* @slot target - The element to which the popover will anchor, which can be any focusable element.
|
10
|
+
*/
|
11
|
+
export default class GlideCorePopover extends LitElement {
|
12
|
+
#private;
|
13
|
+
static shadowRootOptions: ShadowRootInit;
|
14
|
+
static styles: import("lit").CSSResult[];
|
15
|
+
get disabled(): boolean;
|
16
|
+
set disabled(isDisabled: boolean);
|
17
|
+
get offset(): number;
|
18
|
+
set offset(offset: number);
|
19
|
+
get open(): boolean;
|
20
|
+
set open(isOpen: boolean);
|
21
|
+
placement?: 'bottom' | 'left' | 'right' | 'top';
|
22
|
+
connectedCallback(): void;
|
23
|
+
firstUpdated(): void;
|
24
|
+
render(): import("lit").TemplateResult<1>;
|
25
|
+
private effectivePlacement;
|
26
|
+
}
|
package/dist/popover.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,l){var i,r=arguments.length,a=r<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,l);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,o,a):i(t,o))||a);return r>3&&a&&Object.defineProperty(t,o,a),a};import{LitElement,html}from"lit";import{arrow,autoUpdate,computePosition,flip,limitShift,offset,shift}from"@floating-ui/dom";import{choose}from"lit/directives/choose.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 ow,{owSlot}from"./library/ow.js";import styles from"./popover.styles.js";let GlideCorePopover=class GlideCorePopover extends LitElement{constructor(){super(...arguments),this.effectivePlacement=this.placement??"bottom",this.#e=createRef(),this.#t=createRef(),this.#o=!1,this.#l=!1,this.#i=!1,this.#r=!1,this.#a=!1,this.#s=createRef(),this.#n=createRef(),this.#f=()=>{if(this.#l||this.#a||this.#o)return this.#l=!1,this.#a=!1,void(this.#o=!1);this.open=!1}}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#i}set disabled(e){this.#i=e,this.open&&!e?this.#d():this.#p()}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.#r}set open(e){this.#r=e,e&&!this.disabled?this.#d():this.#p()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#f,{capture:!0})}firstUpdated(){owSlot(this.#t.value),owSlot(this.#n.value),ow(this.#s.value,ow.object.instanceOf(HTMLElement)),this.#s.value.popover="manual",this.open&&!this.disabled&&this.#d(),this.#t.value.addEventListener("mouseup",(()=>{this.#l=!0})),this.#n.value.addEventListener("mouseup",(()=>{this.#a=!0})),this.#e.value?.addEventListener("mouseup",(()=>{this.#o=!0})),this.#n.value.addEventListener("keydown",(e=>{"Enter"!==e.key&&" "!==e.key||(this.#a=!0)}))}render(){return html`<div class="component"><slot class="target-slot" data-test="target-slot" name="target" @click="${this.#m}" @keydown="${this.#c}" @slotchange="${this.#u}" ${ref(this.#n)}></slot><div class="${classMap({popover:!0,[this.effectivePlacement]:!0})}" id="popover" data-test="popover" ${ref(this.#s)}><div class="${classMap({arrow:!0,[this.effectivePlacement]:!0})}" data-test="arrow" ${ref(this.#e)}>${choose(this.effectivePlacement,[["top",()=>arrows.top],["right",()=>arrows.right],["bottom",()=>arrows.bottom],["left",()=>arrows.left]])}</div><slot class="default-slot" @slotchange="${this.#v}" ${ref(this.#t)}></slot></div></div>`}#e;#g;#t;#o;#l;#i;#r;#a;#h;#s;#n;#f;#p(){this.#s.value?.hidePopover(),this.#_&&(this.#_.ariaExpanded="false"),this.#g?.()}#v(){owSlot(this.#t.value)}#u(){owSlot(this.#n.value)}#m(){this.open=!this.open}#c(e){"Escape"===e.key&&(this.open=!1)}get#_(){return this.#n.value?.assignedElements().at(0)}#d(){this.disabled||(this.#g?.(),this.#n.value&&this.#s.value&&(this.#g=autoUpdate(this.#n.value,this.#s.value,(()=>{(async()=>{if(this.#n.value&&this.#s.value&&this.#e.value){const e=Number.parseFloat(window.getComputedStyle(this.#s.value).padding),{x:t,y:o,placement:l,middlewareData:i}=await computePosition(this.#n.value,this.#s.value,{placement:this.placement,middleware:[offset(this.offset-e-2),flip({fallbackStrategy:"initialPlacement"}),shift({limiter:limitShift({offset:30})}),arrow({element:this.#e.value})]});Object.assign(this.#s.value.style,{left:`${t}px`,top:`${o}px`}),Object.assign(this.#e.value.style,{left:i.arrow?.x?i.arrow.x-e+"px":null,top:i.arrow?.y?i.arrow.y-e+"px":null}),this.effectivePlacement=l,this.#s.value.showPopover(),this.#_&&(this.#_.ariaExpanded="true")}})()}))))}};__decorate([property({reflect:!0,type:Boolean})],GlideCorePopover.prototype,"disabled",null),__decorate([property({reflect:!0,type:Number})],GlideCorePopover.prototype,"offset",null),__decorate([property({reflect:!0,type:Boolean})],GlideCorePopover.prototype,"open",null),__decorate([property()],GlideCorePopover.prototype,"placement",void 0),__decorate([state()],GlideCorePopover.prototype,"effectivePlacement",void 0),GlideCorePopover=__decorate([customElement("glide-core-popover")],GlideCorePopover);export default GlideCorePopover;const arrows={top:html`<svg aria-hidden="true" viewBox="0 0 16 9" fill="none"><mask id="mask0_13064_691" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0"><path d="M16 6.99382e-07V9L0 9L3.93402e-07 0L16 6.99382e-07Z" fill="#D9D9D9"/></mask><g mask="url(#mask0_13064_691)"><g filter="url(#filter0_d_13064_691)"><path d="M8.76822 5.603C8.36842 6.13234 7.63157 6.13233 7.23178 5.60299L3 0L13 9.19407e-07L8.76822 5.603Z" fill="currentColor"/></g></g><defs><filter id="filter0_d_13064_691" x="2" y="0" width="12" height="10" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="0.5"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_13064_691"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_13064_691" result="shape"/></filter></defs></svg>`,right:html`<svg aria-hidden="true" viewBox="0 0 9 16" fill="none"><mask id="mask0_13064_688" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0"><path d="M9 16H1.39876e-06L0 7.86805e-07L9 0L9 16Z" fill="#D9D9D9"/></mask><g mask="url(#mask0_13064_688)"><g filter="url(#filter0_d_13064_688)"><path d="M3.397 8.76822C2.86766 8.36843 2.86767 7.63157 3.39701 7.23178L9 3V13L3.397 8.76822Z" fill="currentColor"/></g></g><defs><filter id="filter0_d_13064_688" x="2" y="3" width="8" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="0.5"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_13064_688"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_13064_688" result="shape"/></filter></defs></svg>`,bottom:html`<svg aria-hidden="true" viewBox="0 0 16 9" fill="none"><mask id="mask0_13064_685" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0"><path d="M0 9L1.07324e-07 0L16 1.90798e-07V9H0Z" fill="#D9D9D9"/></mask><g mask="url(#mask0_13064_685)"><g filter="url(#filter0_dd_13064_685)"><path d="M7.23178 3.397C7.63157 2.86766 8.36843 2.86767 8.76822 3.39701L13 9L3 9L7.23178 3.397Z" fill="currentColor"/></g></g><defs><filter id="filter0_dd_13064_685" x="-5" y="-2" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="4"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_13064_685"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="-1"/><feGaussianBlur stdDeviation="1"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/><feBlend mode="normal" in2="effect1_dropShadow_13064_685" result="effect2_dropShadow_13064_685"/><feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_13064_685" result="shape"/></filter></defs></svg>`,left:html`<svg aria-hidden="true" viewBox="0 0 9 16" fill="none"><mask id="mask0_12969_88361" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0"><path d="M0 0H9V16H0V0Z" fill="#D9D9D9"/></mask><g mask="url(#mask0_12969_88361)"><g filter="url(#filter0_d_12969_88361)"><path d="M5.603 7.23178C6.13234 7.63157 6.13233 8.36843 5.60299 8.76822L0 13L4.82293e-07 3L5.603 7.23178Z" fill="currentColor"/></g></g><defs><filter id="filter0_d_12969_88361" x="-1" y="3" width="8" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="0.5"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_12969_88361"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_12969_88361" result="shape"/></filter></defs></svg>`};
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";export default[css`
|
2
|
+
${opacityAndScaleAnimation(".popover:popover-open")}
|
3
|
+
${focusOutline(".target:focus-visible")}
|
4
|
+
`,css`
|
5
|
+
:host {
|
6
|
+
/* https://github.com/CrowdStrike/glide-core/pull/307/files#r1718545771 */
|
7
|
+
display: inline-block;
|
8
|
+
}
|
9
|
+
|
10
|
+
.component {
|
11
|
+
/* https://github.com/CrowdStrike/glide-core/pull/119#issuecomment-2113314591 */
|
12
|
+
display: flex;
|
13
|
+
|
14
|
+
/* https://css-tricks.com/flexbox-truncated-text/#aa-the-solution-is-min-width-0-on-the-flex-child */
|
15
|
+
min-inline-size: 0;
|
16
|
+
position: relative;
|
17
|
+
}
|
18
|
+
|
19
|
+
.target-slot {
|
20
|
+
/*
|
21
|
+
Collapses additional whitespace from the slot's line height so the popover is vertically
|
22
|
+
centered against its target.
|
23
|
+
*/
|
24
|
+
display: flex;
|
25
|
+
|
26
|
+
/* Allows the consumer to style the target with an ellipsis when its text is truncated. */
|
27
|
+
inline-size: 100%;
|
28
|
+
position: relative;
|
29
|
+
|
30
|
+
::slotted svg {
|
31
|
+
display: block;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
.popover {
|
36
|
+
background-color: transparent;
|
37
|
+
border: none;
|
38
|
+
inset: unset;
|
39
|
+
padding: var(--glide-core-spacing-xs);
|
40
|
+
position: absolute;
|
41
|
+
|
42
|
+
&:popover-open {
|
43
|
+
display: flex;
|
44
|
+
|
45
|
+
/*
|
46
|
+
Elements with a "popover" attribute don't allow overflow. So the arrow can't
|
47
|
+
be positioned with "position: absolute". Relative positioning is used instead.
|
48
|
+
Flex is used to get the arrow on the correct side of the popover. Floating UI
|
49
|
+
handles the rest.
|
50
|
+
|
51
|
+
A simple "transform" could replace Floating UI for the arrow if not for a Chrome
|
52
|
+
bug with "popover" when "scale()" is animated on the popover or a container within
|
53
|
+
it. With "transform" on the arrow, the arrow is initially offset by a couple pixels
|
54
|
+
before landing in the correct position when the animation finishes. It only happens
|
55
|
+
when the popover is left or right of its target.
|
56
|
+
*/
|
57
|
+
&.top {
|
58
|
+
flex-direction: column-reverse;
|
59
|
+
}
|
60
|
+
|
61
|
+
&.right {
|
62
|
+
flex-direction: row-reverse;
|
63
|
+
}
|
64
|
+
|
65
|
+
&.bottom {
|
66
|
+
flex-direction: column;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
.arrow {
|
72
|
+
--arrow-height: 0.5625rem;
|
73
|
+
--arrow-width: 1rem;
|
74
|
+
|
75
|
+
color: var(--glide-core-surface-modal);
|
76
|
+
display: flex;
|
77
|
+
position: relative;
|
78
|
+
|
79
|
+
&.top,
|
80
|
+
&.bottom {
|
81
|
+
block-size: var(--arrow-height);
|
82
|
+
inline-size: var(--arrow-width);
|
83
|
+
}
|
84
|
+
|
85
|
+
&.right,
|
86
|
+
&.left {
|
87
|
+
block-size: var(--arrow-width);
|
88
|
+
inline-size: var(--arrow-height);
|
89
|
+
order: 2;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
.default-slot {
|
94
|
+
background-color: var(--glide-core-surface-modal);
|
95
|
+
border-radius: var(--glide-core-spacing-xs);
|
96
|
+
|
97
|
+
/*
|
98
|
+
".popover" can't overflow because the Popover API won't allow it. And
|
99
|
+
a shadow counts as overflow. So make sure to adjust the padding on
|
100
|
+
".popover" when changing this shadow so ".popover" has enough room for it.
|
101
|
+
*/
|
102
|
+
box-shadow:
|
103
|
+
0 3px 8px 0 rgba(0 0 0 / 15%),
|
104
|
+
0 3px 1px 0 rgba(0 0 0 / 6%);
|
105
|
+
box-sizing: border-box;
|
106
|
+
color: var(--glide-core-text-body-1);
|
107
|
+
display: flex;
|
108
|
+
font-family: var(--glide-core-body-md-font-family);
|
109
|
+
font-size: var(--glide-core-body-sm-font-size);
|
110
|
+
font-style: var(--glide-core-body-sm-font-style);
|
111
|
+
font-weight: var(--glide-core-body-sm-font-weight);
|
112
|
+
inset-block-start: 50%;
|
113
|
+
line-height: var(--glide-core-body-sm-line-height);
|
114
|
+
max-inline-size: 23.75rem;
|
115
|
+
min-block-size: 2rem;
|
116
|
+
min-inline-size: 5rem;
|
117
|
+
padding: var(--glide-core-spacing-sm);
|
118
|
+
}
|
119
|
+
`];
|
package/dist/radio-group.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import './label.js';
|
2
2
|
import './tooltip.js';
|
3
|
-
import { LitElement
|
3
|
+
import { LitElement } from 'lit';
|
4
4
|
declare global {
|
5
5
|
interface HTMLElementTagNameMap {
|
6
6
|
'glide-core-radio-group': GlideCoreRadioGroup;
|
@@ -21,13 +21,16 @@ export default class GlideCoreRadioGroup extends LitElement {
|
|
21
21
|
static shadowRootOptions: ShadowRootInit;
|
22
22
|
static styles: import("lit").CSSResult[];
|
23
23
|
description: string;
|
24
|
-
disabled: boolean;
|
25
|
-
|
24
|
+
get disabled(): boolean;
|
25
|
+
set disabled(isDisabled: boolean);
|
26
26
|
hideLabel: boolean;
|
27
|
+
label?: string;
|
27
28
|
name: string;
|
28
29
|
privateSplit?: 'left' | 'middle';
|
29
|
-
required: boolean;
|
30
|
-
|
30
|
+
get required(): boolean;
|
31
|
+
set required(isRequired: boolean);
|
32
|
+
get value(): string;
|
33
|
+
set value(value: string);
|
31
34
|
checkValidity(): boolean;
|
32
35
|
disconnectedCallback(): void;
|
33
36
|
firstUpdated(): void;
|
@@ -41,8 +44,6 @@ export default class GlideCoreRadioGroup extends LitElement {
|
|
41
44
|
reportValidity(): boolean;
|
42
45
|
setCustomValidity(message: string): void;
|
43
46
|
setValidity(flags?: ValidityStateFlags, message?: string): void;
|
44
|
-
updated(changedProperties: PropertyValueMap<GlideCoreRadioGroup>): void;
|
45
|
-
willUpdate(changedProperties: PropertyValueMap<GlideCoreRadioGroup>): void;
|
46
47
|
constructor();
|
47
48
|
private isBlurring;
|
48
49
|
private isCheckingValidity;
|
package/dist/radio-group.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,i,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,s){var o,a=arguments.length,r=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var d=e.length-1;d>=0;d--)(o=e[d])&&(r=(a<3?o(r):a>3?o(t,i,r):o(t,i))||r);return a>3&&r&&Object.defineProperty(t,i,r),r};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{owSlot,owSlotType}from"./library/ow.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import GlideCoreRadio from"./radio-group.radio.js";import styles from"./radio-group.styles.js";let GlideCoreRadioGroup=class GlideCoreRadioGroup extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#e}set disabled(e){this.#e=e;for(const t of this.#t)t.disabled=e}get required(){return this.#i}set required(e){this.#i=e;for(const t of this.#t)t.privateRequired=e}get value(){return this.#s}set value(e){this.#s=e;for(const t of this.#t){const i=Boolean(e&&t.value===e);t.checked=!!i,t.tabIndex=i?0:-1,t.checked&&t.disabled&&(t.disabled=!1)}}checkValidity(){this.isCheckingValidity=!0;const e=this.#o.checkValidity();return this.isCheckingValidity=!1,e}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#a)}firstUpdated(){if(owSlot(this.#r.value),owSlotType(this.#r.value,[GlideCoreRadio]),this.disabled)for(const e of this.#t)e.disabled=!0;if(this.required)for(const e of this.#t)e.privateRequired=!0;const e=this.value?this.#t.find((({value:e})=>e===this.value)):this.#t.find((({checked:e,disabled:t})=>e&&!t));if(!this.value&&e?.value&&this.setAttribute("value",e.value),e){this.value=e.value;for(const t of this.#t)t.tabIndex=t===e?0:-1;return}const t=this.#t.find((({disabled:e})=>!e));for(const e of this.#t)e.tabIndex=e===t?0:-1}focus(e){const t=this.#t.find((({checked:e,disabled:t})=>e&&!t))??this.#t.find((({tabIndex:e})=>0===e));t?.focus(e)}get form(){return this.#o.form}get validity(){const e=this.#t.some((({checked:e})=>e));return!this.required||e||this.disabled?this.required&&this.#o.validity.valueMissing&&e?(this.#o.setValidity({}),this.#o.validity):this.required&&this.disabled&&!e?(this.#o.setValidity({valueMissing:!0}," ",this.#d.value),this.#o.validity):(this.required||!this.#o.validity.valueMissing||e||this.#o.setValidity({}),this.#o.validity):(this.#o.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#d.value),this.#o.validity)}get willValidate(){return this.#o.willValidate}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#a)}formResetCallback(){this.value=this.getAttribute("value")??""}render(){return html`
|
2
2
|
<div
|
3
3
|
class="component"
|
4
4
|
@click=${this.#l}
|
@@ -20,11 +20,13 @@ var __decorate=this&&this.__decorate||function(e,i,t,s){var o,a=arguments.length
|
|
20
20
|
role="radiogroup"
|
21
21
|
slot="control"
|
22
22
|
aria-labelledby="label description"
|
23
|
-
@blur=${this.#c}
|
24
23
|
>
|
25
24
|
<slot
|
26
|
-
${ref(this.#
|
27
|
-
@
|
25
|
+
${ref(this.#r)}
|
26
|
+
@focusout=${this.#c}
|
27
|
+
@slotchange=${this.#u}
|
28
|
+
@private-checked-change=${this.#p}
|
29
|
+
@private-value-change=${this.#f}
|
28
30
|
></slot>
|
29
31
|
</div>
|
30
32
|
|
@@ -42,4 +44,4 @@ var __decorate=this&&this.__decorate||function(e,i,t,s){var o,a=arguments.length
|
|
42
44
|
</div>
|
43
45
|
</glide-core-private-label>
|
44
46
|
</div>
|
45
|
-
`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#
|
47
|
+
`}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.description="",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.#a=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,this.value)},this.#o=this.attachInternals(),this.addEventListener("invalid",(e=>{if(e.preventDefault(),!this.isCheckingValidity){if(e?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}}))}#d;#r;#o;#e;#i;#s;#a;get#h(){const e=!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit;for(const t of this.#t)t.privateInvalid=e;return e}#v(e){e.checked=!0,e.tabIndex=0,this.value=e.value,e.focus(),e.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}#l(e){if(this.disabled)return;if(e.target instanceof GlideCoreRadio&&e.target.disabled){const e=this.#t.find((({checked:e})=>e));return void e?.focus()}const t=e.target;if(t instanceof GlideCoreRadio&&t&&!t.disabled){const e=this.#t.filter((e=>e!==t));for(const t of e)t.checked=!1,t.tabIndex=-1;this.#v(t)}}#u(){owSlot(this.#r.value),owSlotType(this.#r.value,[GlideCoreRadio])}#n(e){if(!(this.disabled||e.target instanceof GlideCoreRadio&&e.target?.disabled)&&e.target instanceof GlideCoreRadio){const t=e.target;switch(e.key){case"Enter":this.form?.requestSubmit();break;case"ArrowUp":case"ArrowLeft":{e.preventDefault();const i=[...this.#t],s=[...this.#t].slice(0,i.indexOf(t)).findLast((e=>!e.disabled)),o=i.findLast((e=>!e.disabled));s&&s!==t?(this.#m(t),this.#v(s)):o&&o!==t&&(this.#m(t),this.#v(o));break}case"ArrowDown":case"ArrowRight":{e.preventDefault();const i=[...this.#t],s=i.find(((e,s)=>!e.disabled&&s>i.indexOf(t))),o=i.find((e=>!e.disabled));s&&s!==t?(this.#m(t),this.#v(s)):o&&o!==t&&(this.#m(t),this.#v(o));break}case" ":if(e.preventDefault(),!t.disabled&&!t.checked){this.#v(t);for(const e of this.#t)e!==t&&this.#m(e)}}}}#c(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.contains(e.relatedTarget))&&(this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}get#t(){return this.#r.value?this.#r.value.assignedElements().filter((e=>e instanceof GlideCoreRadio)):[]}#p(e){e.target instanceof GlideCoreRadio&&e.target.checked&&!e.detail.old&&e.detail.new&&(this.value=e.target.value)}#f(e){e.target instanceof GlideCoreRadio&&e.target.checked&&e.detail.new?this.value=e.target.value:e.target instanceof GlideCoreRadio&&e.target.checked&&(this.value="")}#m(e){e.checked=!1,e.tabIndex=-1}};__decorate([property()],GlideCoreRadioGroup.prototype,"description",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreRadioGroup.prototype,"disabled",null),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreRadioGroup.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreRadioGroup.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreRadioGroup.prototype,"name",void 0),__decorate([property()],GlideCoreRadioGroup.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreRadioGroup.prototype,"required",null),__decorate([property()],GlideCoreRadioGroup.prototype,"value",null),__decorate([state()],GlideCoreRadioGroup.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreRadioGroup.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreRadioGroup.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreRadioGroup.prototype,"validityMessage",void 0),GlideCoreRadioGroup=__decorate([customElement("glide-core-radio-group")],GlideCoreRadioGroup);export default GlideCoreRadioGroup;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
declare global {
|
3
|
+
interface HTMLElementTagNameMap {
|
4
|
+
'glide-core-radio': GlideCoreRadio;
|
5
|
+
}
|
6
|
+
}
|
7
|
+
export default class GlideCoreRadio extends LitElement {
|
8
|
+
#private;
|
9
|
+
static shadowRootOptions: ShadowRootInit;
|
10
|
+
static styles: import("lit").CSSResult[];
|
11
|
+
get checked(): boolean;
|
12
|
+
set checked(checked: boolean);
|
13
|
+
get disabled(): boolean;
|
14
|
+
set disabled(disabled: boolean);
|
15
|
+
get privateInvalid(): boolean;
|
16
|
+
set privateInvalid(invalid: boolean);
|
17
|
+
get label(): string;
|
18
|
+
set label(label: string);
|
19
|
+
get privateRequired(): boolean;
|
20
|
+
set privateRequired(required: boolean);
|
21
|
+
get value(): string;
|
22
|
+
set value(value: string);
|
23
|
+
firstUpdated(): void;
|
24
|
+
render(): import("lit").TemplateResult<1>;
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,a){var r,o=arguments.length,l=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,a);else for(var d=e.length-1;d>=0;d--)(r=e[d])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import styles from"./radio-group.radio.styles.js";let GlideCoreRadio=class GlideCoreRadio extends LitElement{static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get checked(){return this.#e}set checked(e){const t=this.#e;this.#e=e,this.ariaChecked=e.toString(),this.dispatchEvent(new CustomEvent("private-checked-change",{bubbles:!0,detail:{old:t,new:e}}))}get disabled(){return this.#t}set disabled(e){this.#t=e,this.ariaDisabled=e.toString()}get privateInvalid(){return this.#i}set privateInvalid(e){this.#i=e,this.ariaInvalid=e.toString()}get label(){return this.#a}set label(e){this.#a=e,this.ariaLabel=e.toString()}get privateRequired(){return this.#r}set privateRequired(e){this.#r=e,this.ariaRequired=e.toString()}get value(){return this.#o}set value(e){const t=this.#o;this.#o=e,this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:t,new:e}}))}firstUpdated(){this.ariaChecked=this.checked.toString(),this.ariaDisabled=this.disabled.toString(),this.ariaInvalid=this.privateInvalid.toString(),this.ariaLabel=this.label,this.ariaRequired=this.privateRequired.toString(),this.role="radio"}render(){return html`<span class="${classMap({component:!0,disabled:this.disabled})}" data-test="component"><span class="${classMap({"radio-circle":!0,checked:this.checked,animate:this.hasUpdated})}" data-test="radio"></span> ${this.#a}</span>`}#e=!1;#t=!1;#a="";#i=!1;#r=!1;#o=""};__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadio.prototype,"checked",null),__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadio.prototype,"disabled",null),__decorate([property({type:Boolean})],GlideCoreRadio.prototype,"privateInvalid",null),__decorate([property({reflect:!0})],GlideCoreRadio.prototype,"label",null),__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadio.prototype,"privateRequired",null),__decorate([property()],GlideCoreRadio.prototype,"value",null),GlideCoreRadio=__decorate([customElement("glide-core-radio")],GlideCoreRadio);export default GlideCoreRadio;
|
package/dist/tab.group.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import './icon-button.js';
|
2
2
|
import { LitElement } from 'lit';
|
3
3
|
import GlideCoreTab from './tab.js';
|
4
|
-
import GlideCoreTabPanel from './tab.panel.js';
|
5
4
|
declare global {
|
6
5
|
interface HTMLElementTagNameMap {
|
7
6
|
'glide-core-tab-group': GlideCoreTabGroup;
|
@@ -28,8 +27,6 @@ export default class GlideCoreTabGroup extends LitElement {
|
|
28
27
|
isDisableOverflowStartButton: boolean;
|
29
28
|
isDisableOverflowEndButton: boolean;
|
30
29
|
isShowOverflowButtons: boolean;
|
31
|
-
panelElements: GlideCoreTabPanel[];
|
32
|
-
tabElements: GlideCoreTab[];
|
33
30
|
disconnectedCallback(): void;
|
34
31
|
firstUpdated(): void;
|
35
32
|
render(): import("lit").TemplateResult<1>;
|
package/dist/tab.group.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,s,o){var l,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,o);else for(var r=e.length-1;r>=0;r--)(l=e[r])&&(a=(i<3?l(a):i>3?l(t,s,a):l(t,s))||a);return i>3&&a&&Object.defineProperty(t,s,a),a};import"./icon-button.js";import{LitElement,html}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,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,s,o){var l,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,o);else for(var r=e.length-1;r>=0;r--)(l=e[r])&&(a=(i<3?l(a):i>3?l(t,s,a):l(t,s))||a);return i>3&&a&&Object.defineProperty(t,s,a),a};import"./icon-button.js";import{LitElement,html}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,state}from"lit/decorators.js";import{when}from"lit/directives/when.js";import GlideCoreTab from"./tab.js";import GlideCoreTabPanel from"./tab.panel.js";import ow,{owSlotType}from"./library/ow.js";import styles from"./tab.group.styles.js";let GlideCoreTabGroup=class GlideCoreTabGroup extends LitElement{constructor(){super(...arguments),this.isAfterFirstUpdated=!1,this.isDisableOverflowStartButton=!1,this.isDisableOverflowEndButton=!1,this.isShowOverflowButtons=!1,this.#e=createRef(),this.#t=100,this.#s=createRef(),this.#o=new LocalizeController(this),this.#l=createRef(),this.#i=1,this.#a=createRef(),this.#r=createRef(),this.#n=null,this.#c=null,this.#h=null,this.#d=null,this.#b=null,this.#f=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get selectedTab(){return this.#b}set selectedTab(e){this.#n=this.#b,this.#b=e}disconnectedCallback(){this.#c?.disconnect(),this.#c=null}firstUpdated(){owSlotType(this.#l.value,[GlideCoreTab]),owSlotType(this.#s.value,[GlideCoreTabPanel]),this.#u()}render(){return html`<div class="component" @click="${this.#m}" @keydown="${this.#v}" ${ref(this.#e)}><div class="tab-container" data-test="tab-container">${when(this.isShowOverflowButtons,(()=>html`<button style="height: ${this.#f.value?.clientHeight}px" class="${classMap({overflow:!0,disabled:this.isDisableOverflowStartButton})}" @click="${this.#p}" tabindex="-1" aria-label="${this.#o.term("previousTab")}" data-test="overflow-start-button" ${ref(this.#r)} ?disabled="${this.isDisableOverflowStartButton}"><svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none"><path d="M15 6L9 12L15 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>`))}<div role="tablist" class="${classMap({"tab-group":!0,animated:this.isAfterFirstUpdated})}" ${ref(this.#f)} @scroll="${this.#w}" @focusout="${this.#T}" tabindex="-1"><slot name="nav" @slotchange="${this.#E}" ${ref(this.#l)}></slot></div>${when(this.isShowOverflowButtons,(()=>html`<button style="height: ${this.#f.value?.clientHeight}px" class="${classMap({overflow:!0,disabled:this.isDisableOverflowEndButton})}" @click="${this.#S}" tabindex="-1" aria-label="${this.#o.term("nextTab")}" data-test="overflow-end-button" ${ref(this.#a)} ?disabled="${this.isDisableOverflowEndButton}"><svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>`))}</div><slot @slotchange="${this.#R}" ${ref(this.#s)}></slot></div>`}updated(){this.#g()}#e;#t;#s;#o;#l;#i;#a;#r;#n;#c;#h;#d;#b;#f;get#O(){return[...this.querySelectorAll("glide-core-tab-panel")]}get#B(){return[...this.querySelectorAll("glide-core-tab")]}#m(e){const t=e.target.closest("glide-core-tab");t&&t instanceof GlideCoreTab&&!t.disabled&&this.#y(t)}#S(){this.#C("right")}#p(){this.#C("left")}#R(){owSlotType(this.#s.value,[GlideCoreTabPanel])}#T(){for(const[,e]of this.#B.entries())e.tabIndex=e===this.selectedTab?0:-1}#v(e){const t=e.target.closest("glide-core-tab");if(["Enter"," "].includes(e.key)&&t&&t instanceof GlideCoreTab&&!t.disabled&&(this.#y(t),e.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)){const t=this.#B.find((e=>e.matches(":focus")));if(t instanceof GlideCoreTab){let s=this.#B.indexOf(t);switch(e.key){case"Home":s=0;break;case"End":s=this.#B.length-1;break;case"ArrowLeft":s--;break;case"ArrowRight":s++}s<0&&(s=this.#B.length-1),s>this.#B.length-1&&(s=0),this.#B[s].focus({preventScroll:!1});for(const[,e]of this.#B.entries())e.tabIndex=this.#B[s]===e?0:-1;this.#L(),e.preventDefault()}}}#E(){owSlotType(this.#l.value,[GlideCoreTab]),this.#g(),this.#G(),this.#L()}#w(){this.#d&&clearTimeout(this.#d),this.#d=setTimeout((()=>{this.#L()}),this.#t)}#C(e){const t="right"===e?1:-1;ow(this.#f.value,ow.object.instanceOf(HTMLElement));const s=t*this.#f.value?.clientWidth*.5;this.#f.value?.scrollBy({left:s,top:0})}#$(){const e=this.#f.value,t=e?.getBoundingClientRect();if(ow(e,ow.object.instanceOf(HTMLElement)),t){const{width:s}=t,o=e.scrollLeft+s,l=e.scrollWidth;this.isDisableOverflowEndButton=l-o<=this.#i}}#L(){const e=this.#f.value,t=e?.getBoundingClientRect();if(e&&t){const{width:s}=t;this.isShowOverflowButtons=e.scrollWidth-s>this.#i}this.#k(),this.#$()}#G(){for(const[e,t]of this.#B.entries())this.selectedTab||0!==e?(t.selected=this.selectedTab===t,t.tabIndex=this.selectedTab===t?0:-1):(this.selectedTab=t,this.selectedTab.selected=!0,this.selectedTab.tabIndex=0);for(const e of this.#O){const t=this.selectedTab?.getAttribute("panel"),s=e.getAttribute("name");e.privateIsSelected=s===t,e.tabIndex=s===t?0:-1}if(this.selectedTab!==this.#n&&this.selectedTab&&this.#B.length>0&&this.#e.value){const e=Number.parseInt(window.getComputedStyle(this.selectedTab).getPropertyValue("padding-inline-start")),t=this.selectedTab===this.#B.at(0)?e:this.selectedTab.offsetLeft-this.#B[0].offsetLeft;this.#e.value.style.setProperty("--selected-tab-indicator-translate",`${t}px`);const s=this.selectedTab===this.#B.at(0)||this.selectedTab===this.#B.at(-1)?e:0,{width:o}=this.selectedTab.getBoundingClientRect();this.#e.value.style.setProperty("--selected-tab-indicator-width",o-s+"px"),this.isAfterFirstUpdated=!0}}#k(){ow(this.#f.value,ow.object.instanceOf(HTMLElement)),this.isDisableOverflowStartButton=this.#f.value.scrollLeft<=0}#u(){this.#c=new ResizeObserver((e=>{e?.at(0)?.target===this.#f.value&&(this.#h&&clearTimeout(this.#h),this.#h=setTimeout((()=>{this.#L()}),this.#t))})),ow(this.#f.value,ow.object.instanceOf(HTMLElement)),this.#c.observe(this.#f.value)}#g(){for(const e of this.#B){const t=this.#O.filter((t=>t.name===e.panel))?.at(0);t?.id&&(e.setAttribute("aria-controls",t.id),t.setAttribute("aria-labelledby",e.id))}}#y(e){this.selectedTab=e,this.#G(),e.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0}))}};__decorate([state()],GlideCoreTabGroup.prototype,"selectedTab",null),__decorate([state()],GlideCoreTabGroup.prototype,"isAfterFirstUpdated",void 0),__decorate([state()],GlideCoreTabGroup.prototype,"isDisableOverflowStartButton",void 0),__decorate([state()],GlideCoreTabGroup.prototype,"isDisableOverflowEndButton",void 0),__decorate([state()],GlideCoreTabGroup.prototype,"isShowOverflowButtons",void 0),GlideCoreTabGroup=__decorate([customElement("glide-core-tab-group")],GlideCoreTabGroup);export default GlideCoreTabGroup;
|
package/dist/tag.styles.js
CHANGED
@@ -34,7 +34,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
34
34
|
}
|
35
35
|
|
36
36
|
&.added {
|
37
|
-
|
37
|
+
@media (prefers-reduced-motion: no-preference) {
|
38
|
+
animation: fade-in var(--animation-duration) ease-in-out;
|
39
|
+
}
|
38
40
|
}
|
39
41
|
|
40
42
|
&.disabled {
|
@@ -42,10 +44,12 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
42
44
|
}
|
43
45
|
|
44
46
|
&.removed {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
@media (prefers-reduced-motion: no-preference) {
|
48
|
+
animation-duration: var(--animation-duration);
|
49
|
+
animation-fill-mode: forwards;
|
50
|
+
animation-name: fade-out;
|
51
|
+
animation-timing-function: ease-in-out;
|
52
|
+
}
|
49
53
|
}
|
50
54
|
}
|
51
55
|
|
@@ -13,9 +13,12 @@ import{css}from"lit";export default[css`
|
|
13
13
|
line-height: var(--glide-core-body-xs-line-height);
|
14
14
|
padding: var(--glide-core-spacing-sm);
|
15
15
|
transform: translateX(110%);
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
@media (prefers-reduced-motion: no-preference) {
|
18
|
+
transition:
|
19
|
+
transform 0.2s ease-out,
|
20
|
+
opacity 0.3s ease-out;
|
21
|
+
}
|
19
22
|
|
20
23
|
&.error {
|
21
24
|
background-color: var(--glide-core-surface-error);
|
package/dist/toggle.styles.js
CHANGED
@@ -48,6 +48,14 @@ Use the ":checked" pseudo class on the host and throughout when browsers support
|
|
48
48
|
}
|
49
49
|
}
|
50
50
|
|
51
|
+
&:has(input:checked:disabled) {
|
52
|
+
background-color: var(--glide-core-surface-primary-disabled);
|
53
|
+
|
54
|
+
&::before {
|
55
|
+
transform: translateX(0);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
51
59
|
&::before {
|
52
60
|
background: var(--glide-core-surface-page);
|
53
61
|
block-size: 0.875rem;
|
package/dist/tooltip.d.ts
CHANGED
@@ -6,7 +6,7 @@ declare global {
|
|
6
6
|
}
|
7
7
|
/**
|
8
8
|
* @slot - The primary content of the tooltip.
|
9
|
-
* @slot target - The element to which the tooltip
|
9
|
+
* @slot target - The element to which the tooltip will anchor.
|
10
10
|
*/
|
11
11
|
export default class GlideCoreTooltip extends LitElement {
|
12
12
|
#private;
|
package/dist/tooltip.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,l){var i,s=arguments.length,a=s<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,l);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{arrow,autoUpdate,computePosition,flip,limitShift,offset,shift}from"@floating-ui/dom";import{choose}from"lit/directives/choose.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{map}from"lit/directives/map.js";import ow,{owSlot}from"./library/ow.js";import styles from"./tooltip.styles.js";let GlideCoreTooltip=class GlideCoreTooltip extends LitElement{constructor(){super(...arguments),this.shortcut=[],this.effectivePlacement=this.placement??"bottom",this.#e=createRef(),this.#t=createRef(),this.#o=!1,this.#l=!1,this.#i=
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,l){var i,s=arguments.length,a=s<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,l);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{LocalizeController}from"./library/localize.js";import{arrow,autoUpdate,computePosition,flip,limitShift,offset,shift}from"@floating-ui/dom";import{choose}from"lit/directives/choose.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{map}from"lit/directives/map.js";import ow,{owSlot}from"./library/ow.js";import styles from"./tooltip.styles.js";let GlideCoreTooltip=class GlideCoreTooltip extends LitElement{constructor(){super(...arguments),this.shortcut=[],this.effectivePlacement=this.placement??"bottom",this.#e=createRef(),this.#t=createRef(),this.#o=!1,this.#l=!1,this.#i=new LocalizeController(this),this.#s=createRef(),this.#a=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get disabled(){return this.#o}set disabled(e){this.#o=e,this.open&&!e?this.#r():this.#n()}get offset(){return this.#p??Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}set offset(e){this.#p=e}get open(){return this.#l}set open(e){this.#l=e,e&&!this.disabled?this.#r():this.#n()}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.#c),clearTimeout(this.#f)}firstUpdated(){owSlot(this.#t.value),owSlot(this.#s.value),ow(this.#a.value,ow.object.instanceOf(HTMLElement)),this.#a.value.popover="manual",this.open&&!this.disabled&&this.#r()}render(){return html`<div class="component" data-test="component" @mouseover="${this.#d}" @mouseout="${this.#h}"><div aria-labelledby="${ifDefined(this.disabled?void 0:"tooltip")}" class="target-slot-container"><slot class="target-slot" data-test="target-slot" @focusin="${this.#m}" @focusout="${this.#u}" @keydown="${this.#v}" @slotchange="${this.#g}" ${ref(this.#s)} name="target"></slot></div><div class="${classMap({tooltip:!0,[this.effectivePlacement]:!0})}" id="tooltip" data-test="tooltip" data-open-delay="300" data-close-delay="200" role="${ifDefined(this.disabled?void 0:"tooltip")}" ${ref(this.#a)}><div class="${classMap({arrow:!0,[this.effectivePlacement]:!0})}" data-test="arrow" ${ref(this.#e)}>${choose(this.effectivePlacement,[["top",()=>arrows.top],["right",()=>arrows.right],["bottom",()=>arrows.bottom],["left",()=>arrows.left]])}</div><span aria-label="${ifDefined(this.disabled?void 0:this.#i.term("tooltip"))}"></span><div class="${classMap({content:!0,reversed:"left"===this.effectivePlacement})}"><slot class="default-slot" @slotchange="${this.#w}" ${ref(this.#t)}></slot><kbd class="${classMap({shortcut:!0,reversed:"left"===this.effectivePlacement,visible:this.shortcut.length>0})}" data-test="shortcut">${1===this.shortcut.length?this.shortcut.at(0):map(this.shortcut,((e,t)=>html`<kbd>${e}</kbd> ${t===this.shortcut.length-1?"":" + "}`))}</kbd></div></div></div>`}#e;#y;#c;#t;#o;#l;#i;#p;#f;#s;#a;#E(){clearTimeout(this.#c)}#n(){this.#a.value?.hidePopover(),this.#y?.()}#h(){this.#R(),clearTimeout(this.#f)}#d(){ow(this.#a.value,ow.object.instanceOf(HTMLElement)),this.#E(),this.#f=setTimeout((()=>{this.open=!0}),Number(this.#a.value.dataset.openDelay))}#w(){owSlot(this.#t.value)}#g(){owSlot(this.#s.value)}#m(){this.open=!0}#u(){this.open=!1}#v(e){"Escape"===e.key&&(this.open=!1)}#R(){ow(this.#a.value,ow.object.instanceOf(HTMLElement)),this.#c=setTimeout((()=>{this.open=!1}),Number(this.#a.value.dataset.closeDelay))}#r(){this.disabled||(this.#y?.(),this.#s.value&&this.#a.value&&(this.#y=autoUpdate(this.#s.value,this.#a.value,(()=>{(async()=>{if(this.#s.value&&this.#a.value&&this.#e.value){const{x:e,y:t,placement:o,middlewareData:l}=await computePosition(this.#s.value,this.#a.value,{placement:this.placement,middleware:[offset(this.offset),flip({fallbackStrategy:"initialPlacement"}),shift({limiter:limitShift({offset:20})}),arrow({element:this.#e.value})]});Object.assign(this.#a.value.style,{left:`${e}px`,top:`${t}px`}),Object.assign(this.#e.value.style,{left:l.arrow?.x?`${l.arrow.x}px`:null,top:l.arrow?.y?`${l.arrow.y}px`:null}),this.effectivePlacement=o,this.#a.value.showPopover()}})()}))))}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreTooltip.prototype,"disabled",null),__decorate([property({reflect:!0,type:Number})],GlideCoreTooltip.prototype,"offset",null),__decorate([property({reflect:!0,type:Boolean})],GlideCoreTooltip.prototype,"open",null),__decorate([property()],GlideCoreTooltip.prototype,"placement",void 0),__decorate([property({reflect:!0,type:Array})],GlideCoreTooltip.prototype,"shortcut",void 0),__decorate([state()],GlideCoreTooltip.prototype,"effectivePlacement",void 0),GlideCoreTooltip=__decorate([customElement("glide-core-tooltip")],GlideCoreTooltip);export default GlideCoreTooltip;const arrows={top:html`<svg aria-hidden="true" viewBox="0 0 10 6" fill="none"><path d="M4.23178 5.07814C4.63157 5.55789 5.36843 5.55789 5.76822 5.07813L10 -7.9486e-08L-2.62268e-07 3.57628e-07L4.23178 5.07814Z" fill="currentColor"/></svg>`,right:html`<svg aria-hidden="true" viewBox="0 0 6 10" fill="none"><path d="M0.921865 4.23178C0.442111 4.63157 0.442112 5.36843 0.921866 5.76822L6 10L6 -2.62268e-07L0.921865 4.23178Z" fill="currentColor"/></svg>`,bottom:html`<svg aria-hidden="true" viewBox="0 0 10 6" fill="none"><path d="M4.23178 0.921865C4.63157 0.442111 5.36843 0.442112 5.76822 0.921866L10 6L-2.62268e-07 6L4.23178 0.921865Z" fill="currentColor"/></svg>`,left:html`<svg aria-hidden="true" viewBox="0 0 6 10" fill="none"><path d="M5.07814 4.23178C5.55789 4.63157 5.55789 5.36843 5.07813 5.76822L-4.37114e-07 10L0 -2.62268e-07L5.07814 4.23178Z" fill="currentColor"/></svg>`};
|
package/dist/tooltip.styles.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";export default[css`
|
2
2
|
${opacityAndScaleAnimation(".tooltip:popover-open")}
|
3
|
-
${focusOutline(".target:focus-visible")}
|
3
|
+
${focusOutline(".target-slot:focus-visible")}
|
4
4
|
`,css`
|
5
5
|
:host {
|
6
|
+
// https://github.com/CrowdStrike/glide-core/pull/307/files#r1718545771
|
6
7
|
display: inline-block;
|
7
8
|
}
|
8
9
|
|
@@ -15,25 +16,22 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
15
16
|
position: relative;
|
16
17
|
}
|
17
18
|
|
18
|
-
.target {
|
19
|
-
|
20
|
-
|
19
|
+
.target-slot-container {
|
20
|
+
/* Allows the consumer to style the target with an ellipsis when its text is truncated. */
|
21
|
+
inline-size: 100%;
|
22
|
+
}
|
21
23
|
|
24
|
+
.target-slot {
|
22
25
|
/*
|
23
|
-
|
26
|
+
Collapses additional whitespace from the slot's line height so the tooltip is vertically
|
24
27
|
centered against its target.
|
25
28
|
*/
|
26
29
|
display: flex;
|
27
30
|
|
28
31
|
/* Allows the consumer to style the target with an ellipsis when its text is truncated. */
|
29
32
|
inline-size: 100%;
|
30
|
-
padding: 0;
|
31
33
|
position: relative;
|
32
34
|
|
33
|
-
&:focus {
|
34
|
-
outline: none;
|
35
|
-
}
|
36
|
-
|
37
35
|
::slotted svg {
|
38
36
|
display: block;
|
39
37
|
}
|
@@ -61,7 +59,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
61
59
|
before landing in the correct position when the animation finishes. It only happens
|
62
60
|
when the tooltip is left or right of its target.
|
63
61
|
*/
|
64
|
-
|
65
62
|
&.top {
|
66
63
|
flex-direction: column-reverse;
|
67
64
|
}
|
package/dist/translations/en.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
const translation={$code:"en",$name:"English",$dir:"ltr",close:"Close",dismiss:"Dismiss",open:"Open",selectAll:"Select all",moreInformation:"More information",notifications:"Notifications",nextTab:"Next tab",previousTab:"Previous tab",noResults:"No results found",announcedCharacterCount:(t,
|
1
|
+
const translation={$code:"en",$name:"English",$dir:"ltr",close:"Close",dismiss:"Dismiss",open:"Open",selectAll:"Select all",moreInformation:"More information",notifications:"Notifications",nextTab:"Next tab",previousTab:"Previous tab",noResults:"No results found",tooltip:"Tooltip:",announcedCharacterCount:(t,o)=>`Character count ${t} of ${o}`,displayedCharacterCount:(t,o)=>`${t}/${o}`,clearEntry:t=>`Clear ${t} entry`,editOption:t=>`Edit option: ${t}`,editTag:t=>`Edit tag: ${t}`,removeTag:t=>`Remove tag: ${t}`,actionsFor:t=>`Actions for ${t}`,itemCount:t=>`${t} items`,closeInlineAlert:t=>`Close ${t} alert`};export default translation;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Translation } from '../library/localize.js';
|
2
|
-
export declare const PENDING_STRINGS: readonly ["editOption", "editTag", "itemCount", "noResults", "closeInlineAlert"];
|
2
|
+
export declare const PENDING_STRINGS: readonly ["editOption", "editTag", "itemCount", "noResults", "closeInlineAlert", "tooltip"];
|
3
3
|
type PendingTranslation = (typeof PENDING_STRINGS)[number];
|
4
4
|
declare const translation: Omit<Translation, PendingTranslation>;
|
5
5
|
export default translation;
|
package/dist/translations/fr.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const PENDING_STRINGS=["editOption","editTag","itemCount","noResults","closeInlineAlert"];const translation={$code:"fr",$name:"French",$dir:"ltr",close:"Fermer",dismiss:"Congédier",open:"Ouvrir",selectAll:"Tout sélectionner",moreInformation:"Plus d’informations",notifications:"Notifications",nextTab:"Onglet suivant",previousTab:"Onglet précédent",announcedCharacterCount:(e,t)=>`Nombre de caractères ${e} de ${t}`,displayedCharacterCount:(e,t)=>`${e}/${t}`,clearEntry:e=>`Effacer l'entrée ${e}`,removeTag:e=>`Supprimer la balise : ${e}`,actionsFor:e=>`Actions pour ${e}`};export default translation;
|
1
|
+
export const PENDING_STRINGS=["editOption","editTag","itemCount","noResults","closeInlineAlert","tooltip"];const translation={$code:"fr",$name:"French",$dir:"ltr",close:"Fermer",dismiss:"Congédier",open:"Ouvrir",selectAll:"Tout sélectionner",moreInformation:"Plus d’informations",notifications:"Notifications",nextTab:"Onglet suivant",previousTab:"Onglet précédent",announcedCharacterCount:(e,t)=>`Nombre de caractères ${e} de ${t}`,displayedCharacterCount:(e,t)=>`${e}/${t}`,clearEntry:e=>`Effacer l'entrée ${e}`,removeTag:e=>`Supprimer la balise : ${e}`,actionsFor:e=>`Actions pour ${e}`};export default translation;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Translation } from '../library/localize.js';
|
2
|
-
export declare const PENDING_STRINGS: readonly ["editOption", "editTag", "itemCount", "noResults", "closeInlineAlert"];
|
2
|
+
export declare const PENDING_STRINGS: readonly ["editOption", "editTag", "itemCount", "noResults", "closeInlineAlert", "tooltip"];
|
3
3
|
type PendingTranslation = (typeof PENDING_STRINGS)[number];
|
4
4
|
declare const translation: Omit<Translation, PendingTranslation>;
|
5
5
|
export default translation;
|
package/dist/translations/ja.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const PENDING_STRINGS=["editOption","editTag","itemCount","noResults","closeInlineAlert"];const translation={$code:"ja",$name:"Japanese",$dir:"ltr",close:"閉じる",dismiss:"無視",open:"オープン",selectAll:"すべて選択",moreInformation:"詳細情報",notifications:"通知",nextTab:"Onglet suivant",previousTab:"Onglet précédent",announcedCharacterCount:(t,e)=>`${e} 文字数の${t}`,displayedCharacterCount:(t,e)=>`${t}/${e}`,clearEntry:t=>`${t}エントリのクリア`,removeTag:t=>`タグを削除: ${t}`,actionsFor:t=>`${t}のアクション`};export default translation;
|
1
|
+
export const PENDING_STRINGS=["editOption","editTag","itemCount","noResults","closeInlineAlert","tooltip"];const translation={$code:"ja",$name:"Japanese",$dir:"ltr",close:"閉じる",dismiss:"無視",open:"オープン",selectAll:"すべて選択",moreInformation:"詳細情報",notifications:"通知",nextTab:"Onglet suivant",previousTab:"Onglet précédent",announcedCharacterCount:(t,e)=>`${e} 文字数の${t}`,displayedCharacterCount:(t,e)=>`${t}/${e}`,clearEntry:t=>`${t}エントリのクリア`,removeTag:t=>`タグを削除: ${t}`,actionsFor:t=>`${t}のアクション`};export default translation;
|
package/dist/tree.d.ts
CHANGED
@@ -6,7 +6,7 @@ declare global {
|
|
6
6
|
}
|
7
7
|
}
|
8
8
|
/**
|
9
|
-
* @slot - One or more of <glide-core-tree-item
|
9
|
+
* @slot - One or more of <glide-core-tree-item>.
|
10
10
|
*/
|
11
11
|
export default class GlideCoreTree extends LitElement {
|
12
12
|
#private;
|
@@ -15,7 +15,6 @@ export default class GlideCoreTree extends LitElement {
|
|
15
15
|
selectedItem?: GlideCoreTreeItem;
|
16
16
|
focusedItem?: GlideCoreTreeItem | null;
|
17
17
|
privateTabIndex: number;
|
18
|
-
slotElements: GlideCoreTreeItem[];
|
19
18
|
disconnectedCallback(): void;
|
20
19
|
firstUpdated(): void;
|
21
20
|
render(): import("lit").TemplateResult<1>;
|
package/dist/tree.item.d.ts
CHANGED
@@ -21,8 +21,6 @@ export default class GlideCoreTreeItem extends LitElement {
|
|
21
21
|
selected: boolean;
|
22
22
|
removeIndentation: boolean;
|
23
23
|
nonCollapsible: boolean;
|
24
|
-
slotElements: GlideCoreTreeItem[];
|
25
|
-
suffixSlotAssignedElements: HTMLElement[];
|
26
24
|
focus(options?: FocusOptions): void;
|
27
25
|
get hasChildTreeItems(): boolean;
|
28
26
|
get hasExpandIcon(): boolean;
|
package/dist/tree.item.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var _a,GlideCoreTreeItem_1,__decorate=this&&this.__decorate||function(e,t,o,i){var l
|
1
|
+
var _a,GlideCoreTreeItem_1,__decorate=this&&this.__decorate||function(e,t,o,i){var r,l=arguments.length,s=l<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(s=(l<3?r(s):l>3?r(t,o,s):r(t,o))||s);return l>3&&s&&Object.defineProperty(t,o,s),s};import"./tree.item.menu.js";import{LitElement,html}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{when}from"lit/directives/when.js";import GlideCoreIconButton from"./icon-button.js";import GlideCoreTreeItemMenu from"./tree.item.menu.js";import ow,{owSlotType}from"./library/ow.js";import styles from"./tree.item.styles.js";let GlideCoreTreeItem=class GlideCoreTreeItem extends LitElement{constructor(){super(...arguments),this.expanded=!1,this.label="",this.level=1,this.selected=!1,this.removeIndentation=!1,this.nonCollapsible=!1,this.childTreeItems=[],this.hasPrefixIcon=!1,this.#e=createRef(),this.#t=createRef(),this.#o=new LocalizeController(this),this.#i=createRef(),this.#r=createRef()}static{GlideCoreTreeItem_1=this}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}focus(e){this.#t.value?.focus(e),this.#l(0)}get hasChildTreeItems(){return this.childTreeItems.length>0}get hasExpandIcon(){return this.hasChildTreeItems&&!this.nonCollapsible}render(){return html`<div class="${classMap({component:!0,expanded:this.expanded,selected:this.selected})}" role="treeitem" aria-label="${this.label}" aria-selected="${ifDefined(this.#s)}" aria-expanded="${ifDefined(this.#n)}"><div class="${classMap({"label-container":!0,"prefix-icon":this.hasPrefixIcon})}" tabindex="-1" @focusout="${this.#a}" @focusin="${this.#d}" ${ref(this.#t)}><div style="flex-shrink: 0; width:${this.#c};"></div>${when(!this.removeIndentation||this.hasExpandIcon,(()=>html`<div class="expand-icon-container">${when(this.hasExpandIcon,(()=>html`<div><svg aria-hidden="true" class="${classMap({"expand-icon":!0,"expand-icon-expanded":this.expanded})}" width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></div>`))}</div>`))}<slot name="prefix" ${ref(this.#r)} @slotchange="${this.#h}"></slot><div class="label">${this.label}</div><div class="icon-container"><slot name="menu" ${ref(this.#i)} @slotchange="${this.#m}"></slot><slot name="suffix"></slot></div></div><div class="child-items" role="group"><slot @slotchange="${this.#f}" ${ref(this.#e)}></slot></div></div>`}selectItem(e){let t;if(this.#p)for(const o of this.#p)if(e===o)o.setAttribute("selected","true"),t=o;else{o.removeAttribute("selected");const i=o.selectItem(e);i&&(t=i)}return t}toggleExpand(){this.expanded=!this.expanded}#e;#t;#o;#i;#r;get#p(){return this.#e.value?.assignedElements().filter((e=>e instanceof GlideCoreTreeItem_1))}get#n(){return this.hasChildTreeItems?this.expanded?"true":"false":void 0}get#s(){return this.hasChildTreeItems?void 0:this.selected?"true":"false"}get#c(){return 20*(this.level-1)+"px"}#u(e){return e&&e instanceof HTMLElement&&!(e instanceof GlideCoreTreeItem_1)&&this.contains(e)}#f(){this.#I()}#d(e){this.#u(e.target)&&e.stopPropagation()}#a(e){this.#u(e.relatedTarget)?e.stopPropagation():this.#l(-1)}#m(){owSlotType(this.#i.value,[GlideCoreTreeItemMenu]);for(const e of this.#i.value.assignedElements())e instanceof GlideCoreTreeItemMenu&&(e.label=this.#o.term("actionsFor",this.label))}#h(){const e=this.#r.value?.assignedNodes();this.hasPrefixIcon=Boolean(e&&e.length>0)}#l(e){ow(this.#t.value,ow.object.instanceOf(HTMLElement)),this.#t.value.tabIndex=e;for(const t of this.querySelectorAll("& > glide-core-tree-item-icon-button"))t.tabIndex=e}#I(){const e=[];if(this.#p){for(const t of this.#p)t.level=this.level+1,e.push(t);this.childTreeItems=e}}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreTreeItem.prototype,"expanded",void 0),__decorate([property({reflect:!0})],GlideCoreTreeItem.prototype,"label",void 0),__decorate([property({reflect:!0,type:Number})],GlideCoreTreeItem.prototype,"level",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreTreeItem.prototype,"selected",void 0),__decorate([property({reflect:!0,type:Boolean,attribute:"remove-indentation"})],GlideCoreTreeItem.prototype,"removeIndentation",void 0),__decorate([property({reflect:!0,type:Boolean,attribute:"non-collapsible"})],GlideCoreTreeItem.prototype,"nonCollapsible",void 0),__decorate([state()],GlideCoreTreeItem.prototype,"childTreeItems",void 0),__decorate([state()],GlideCoreTreeItem.prototype,"hasPrefixIcon",void 0),GlideCoreTreeItem=GlideCoreTreeItem_1=__decorate([customElement("glide-core-tree-item")],GlideCoreTreeItem);export default GlideCoreTreeItem;
|
package/dist/tree.item.styles.js
CHANGED
@@ -33,7 +33,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
33
33
|
display: flex;
|
34
34
|
justify-content: center;
|
35
35
|
rotate: 0deg;
|
36
|
-
|
36
|
+
|
37
|
+
@media (prefers-reduced-motion: no-preference) {
|
38
|
+
transition: 250ms rotate ease;
|
39
|
+
}
|
37
40
|
|
38
41
|
&.expand-icon-expanded {
|
39
42
|
rotate: 90deg;
|
@@ -53,7 +56,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
53
56
|
font-size: var(--glide-core-body-sm-font-size);
|
54
57
|
padding-block: var(--glide-core-spacing-xxs);
|
55
58
|
padding-inline: var(--glide-core-spacing-xs);
|
56
|
-
|
59
|
+
|
60
|
+
@media (prefers-reduced-motion: no-preference) {
|
61
|
+
transition: background-color 150ms ease-in-out;
|
62
|
+
}
|
57
63
|
|
58
64
|
&:hover {
|
59
65
|
background-color: var(--glide-core-surface-hover);
|
package/dist/tree.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,s){var r,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,s){var r,i=arguments.length,l=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,s);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(l=(i<3?r(l):i>3?r(t,o,l):r(t,o))||l);return i>3&&l&&Object.defineProperty(t,o,l),l};import{LitElement,html}from"lit";import{createRef,ref}from"lit/directives/ref.js";import{customElement,state}from"lit/decorators.js";import{owSlot,owSlotType}from"./library/ow.js";import GlideCoreTreeItem from"./tree.item.js";import styles from"./tree.styles.js";let GlideCoreTree=class GlideCoreTree extends LitElement{static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focusin",this.#e),this.removeEventListener("focusout",this.#t)}firstUpdated(){owSlot(this.#o.value),owSlotType(this.#o.value,[GlideCoreTreeItem])}render(){return html`<div class="component" role="tree" tabindex="${this.privateTabIndex}" @click="${this.#s}" @keydown="${this.#r}"><slot @slotchange="${this.#i}" ${ref(this.#o)}></slot></div>`}selectItem(e){if(this.#l){for(const t of this.#l){e===t?(t.setAttribute("selected","true"),this.selectedItem=t):t.removeAttribute("selected");const o=t.selectItem(e);o&&(this.selectedItem=o)}e.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0}))}}constructor(){super(),this.privateTabIndex=0,this.#o=createRef(),this.addEventListener("focusin",this.#e),this.addEventListener("focusout",this.#t)}#o;get#l(){return this.#o.value?.assignedElements().filter((e=>e instanceof GlideCoreTreeItem))}#n(e){e?.focus(),this.focusedItem=e}#c(){const e=new Set;return[...this.querySelectorAll("glide-core-tree-item")].filter((t=>{const o=t.parentElement?.closest("glide-core-tree-item");return!o||o.expanded&&!e.has(o)||e.add(t),!e.has(t)}))}#s(e){const t=e.target;if(t.closest("glide-core-tree-item-icon-button")??t.closest("glide-core-tree-item-menu"))return;const o=t.closest("glide-core-tree-item");o&&(o.hasChildTreeItems&&!o.nonCollapsible?o.toggleExpand():this.selectItem(o))}#i(){owSlot(this.#o.value),owSlotType(this.#o.value,[GlideCoreTreeItem])}#e(e){let t;e.target===this?t=this.selectedItem?.checkVisibility({visibilityProperty:!0})?this.selectedItem:this.#l?.[0]:e.target instanceof GlideCoreTreeItem&&(t=e.target,this.privateTabIndex=-1),this.#n(t)}#t(e){e.relatedTarget&&e.relatedTarget instanceof HTMLElement&&this.contains(e.relatedTarget)||(this.privateTabIndex=0,this.focusedItem=void 0)}#r(e){if(!["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End","Enter"].includes(e.key))return;if(e.target&&e.target instanceof HTMLElement&&(e.target.closest("glide-core-tree-item-icon-button")??e.target.closest("glide-core-tree-item-menu")))return;const t=this.#c(),{focusedItem:o}=this,s=t.findIndex((e=>e.matches(":focus")));if("ArrowRight"===e.key&&o?.hasChildTreeItems&&(o.expanded?this.#n(o.querySelector("glide-core-tree-item")):o.toggleExpand()),"ArrowLeft"===e.key)if(o?.expanded&&!o.nonCollapsible)o.toggleExpand();else{const e=o?.parentElement?.closest("glide-core-tree-item");this.#n(e)}"ArrowDown"===e.key&&-1!==s&&s<t.length-1&&this.#n(t[s+1]),"ArrowUp"===e.key&&s>0&&this.#n(t[s-1]),"Home"===e.key&&this.#n(t[0]),"End"===e.key&&this.#n(t.at(-1)),"Enter"===e.key&&o&&(o.hasChildTreeItems&&!o.nonCollapsible?o.toggleExpand():this.selectItem(o))}};__decorate([state()],GlideCoreTree.prototype,"selectedItem",void 0),__decorate([state()],GlideCoreTree.prototype,"focusedItem",void 0),__decorate([state()],GlideCoreTree.prototype,"privateTabIndex",void 0),GlideCoreTree=__decorate([customElement("glide-core-tree")],GlideCoreTree);export default GlideCoreTree;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@crowdstrike/glide-core",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.16.0",
|
4
4
|
"description": "CrowdStrike's Glide Design System components package for providing web components",
|
5
5
|
"author": "CrowdStrike UX Team",
|
6
6
|
"license": "Apache-2.0",
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"@changesets/cli": "^2.27.10",
|
49
49
|
"@crowdstrike/design-tokens": "^2.0.1",
|
50
50
|
"@eslint/eslintrc": "^3.2.0",
|
51
|
-
"@eslint/js": "^
|
51
|
+
"@eslint/js": "^9.17.0",
|
52
52
|
"@open-wc/testing": "^4.0.0",
|
53
53
|
"@rollup/plugin-commonjs": "^25.0.8",
|
54
54
|
"@storybook/addon-essentials": "^8.4.7",
|
@@ -60,7 +60,7 @@
|
|
60
60
|
"@storybook/theming": "^8.4.7",
|
61
61
|
"@storybook/web-components": "^8.4.7",
|
62
62
|
"@storybook/web-components-vite": "^8.4.7",
|
63
|
-
"@stylistic/eslint-plugin": "^
|
63
|
+
"@stylistic/eslint-plugin": "^2.12.1",
|
64
64
|
"@types/eslint": "^8.56.12",
|
65
65
|
"@types/mocha": "^10.0.10",
|
66
66
|
"@types/sinon": "^17.0.3",
|
@@ -74,13 +74,13 @@
|
|
74
74
|
"@web/test-runner-playwright": "^0.11.0",
|
75
75
|
"chalk": "^5.3.0",
|
76
76
|
"esbuild": "^0.24.0",
|
77
|
-
"eslint": "^
|
77
|
+
"eslint": "^9.17.0",
|
78
78
|
"eslint-config-prettier": "^9.1.0",
|
79
79
|
"eslint-plugin-lit": "^1.15.0",
|
80
80
|
"eslint-plugin-lit-a11y": "^4.1.4",
|
81
81
|
"eslint-plugin-sort-class-members": "^1.21.0",
|
82
82
|
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
|
83
|
-
"eslint-plugin-unicorn": "^
|
83
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
84
84
|
"globals": "^15.13.0",
|
85
85
|
"globby": "^14.0.2",
|
86
86
|
"http-server": "^14.1.1",
|
package/dist/radio.d.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { LitElement, type PropertyValueMap } from 'lit';
|
2
|
-
declare global {
|
3
|
-
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-radio': GlideCoreRadio;
|
5
|
-
}
|
6
|
-
}
|
7
|
-
export default class GlideCoreRadio extends LitElement {
|
8
|
-
#private;
|
9
|
-
static shadowRootOptions: ShadowRootInit;
|
10
|
-
static styles: import("lit").CSSResult[];
|
11
|
-
checked: boolean;
|
12
|
-
disabled: boolean;
|
13
|
-
invalid: boolean;
|
14
|
-
required: boolean;
|
15
|
-
value: string;
|
16
|
-
label?: string;
|
17
|
-
firstUpdated(): void;
|
18
|
-
render(): import("lit").TemplateResult<1>;
|
19
|
-
willUpdate(changedProperties: PropertyValueMap<GlideCoreRadio>): void;
|
20
|
-
}
|
package/dist/radio.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,r){var a,o=arguments.length,d=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(d=(o<3?a(d):o>3?a(t,i,d):a(t,i))||d);return o>3&&d&&Object.defineProperty(t,i,d),d};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import styles from"./radio.styles.js";let GlideCoreRadio=class GlideCoreRadio extends LitElement{constructor(){super(...arguments),this.checked=!1,this.disabled=!1,this.invalid=!1,this.required=!1,this.value="",this.#e=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}firstUpdated(){this.role="radio",this.ariaChecked=this.checked.toString(),this.ariaDisabled=this.disabled.toString(),this.ariaInvalid=this.invalid.toString(),this.ariaRequired=this.required.toString(),this.label&&(this.ariaLabel=this.label),this.#e=!0}render(){return html`<span class="${classMap({component:!0,disabled:this.disabled})}"><span id="radio" class="${classMap({"radio-circle":!0,checked:this.checked,animate:this.#e})}" data-test="radio" data-test-error="${this.invalid}"></span> ${this.label}</span>`}willUpdate(e){this.hasUpdated&&(e.has("checked")&&(this.ariaChecked=this.checked.toString()),e.has("disabled")&&(this.ariaDisabled=this.disabled.toString()),e.has("required")&&(this.ariaRequired=this.required.toString()),e.has("invalid")&&(this.ariaInvalid=this.invalid.toString()),e.has("label")&&this.label&&(this.ariaLabel=this.label))}#e};__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadio.prototype,"checked",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadio.prototype,"disabled",void 0),__decorate([property({type:Boolean})],GlideCoreRadio.prototype,"invalid",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadio.prototype,"required",void 0),__decorate([property()],GlideCoreRadio.prototype,"value",void 0),__decorate([property({reflect:!0})],GlideCoreRadio.prototype,"label",void 0),GlideCoreRadio=__decorate([customElement("glide-core-radio")],GlideCoreRadio);export default GlideCoreRadio;
|
File without changes
|
File without changes
|