@crowdstrike/glide-core 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +2 -2
- package/dist/accordion.js +1 -1
- package/dist/button-group.button.d.ts +2 -2
- package/dist/button-group.button.js +1 -1
- package/dist/button-group.d.ts +3 -3
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/checkbox-group.d.ts +3 -3
- package/dist/checkbox-group.js +9 -9
- package/dist/checkbox.d.ts +2 -3
- package/dist/checkbox.js +3 -3
- package/dist/checkbox.styles.js +8 -16
- package/dist/drawer.d.ts +2 -2
- package/dist/drawer.js +1 -1
- package/dist/dropdown.d.ts +8 -13
- package/dist/dropdown.js +53 -55
- package/dist/dropdown.option.d.ts +2 -3
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +16 -79
- package/dist/dropdown.styles.js +10 -29
- package/dist/form-controls-layout.d.ts +3 -3
- package/dist/form-controls-layout.js +1 -1
- package/dist/icon-button.d.ts +2 -2
- package/dist/icon-button.js +1 -1
- package/dist/icon-button.styles.js +29 -0
- package/dist/inline-alert.d.ts +2 -2
- package/dist/inline-alert.js +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.js +2 -2
- package/dist/label.d.ts +2 -2
- package/dist/label.js +1 -1
- package/dist/label.styles.js +5 -1
- package/dist/library/assert-slot.d.ts +1 -1
- package/dist/library/assert-slot.test.js +22 -22
- package/dist/library/expect-window-error.js +1 -1
- package/dist/library/final.test.js +9 -9
- package/dist/library/localize.d.ts +2 -1
- package/dist/library/localize.test.js +6 -6
- package/dist/library/required.test.js +5 -5
- package/dist/library/unique-id.d.ts +2 -0
- package/dist/library/unique-id.js +1 -0
- package/dist/link.d.ts +2 -3
- package/dist/link.js +1 -1
- package/dist/link.styles.js +1 -1
- package/dist/menu.button.d.ts +2 -2
- package/dist/menu.button.js +1 -1
- package/dist/menu.d.ts +3 -9
- package/dist/menu.js +1 -1
- package/dist/menu.link.d.ts +2 -2
- package/dist/menu.link.js +1 -1
- package/dist/menu.options.d.ts +3 -4
- package/dist/menu.options.js +1 -1
- package/dist/menu.options.styles.js +6 -19
- package/dist/modal.d.ts +6 -6
- package/dist/modal.icon-button.d.ts +2 -2
- package/dist/modal.icon-button.js +1 -1
- package/dist/modal.js +1 -1
- package/dist/popover.d.ts +2 -2
- package/dist/popover.js +1 -1
- package/dist/radio-group.d.ts +3 -3
- package/dist/radio-group.js +6 -6
- package/dist/radio-group.radio.d.ts +2 -2
- package/dist/radio-group.radio.js +1 -1
- package/dist/spinner.d.ts +2 -2
- package/dist/spinner.js +1 -1
- package/dist/split-button.d.ts +4 -10
- package/dist/split-button.js +1 -1
- package/dist/split-button.primary-button.d.ts +2 -2
- package/dist/split-button.primary-button.js +1 -1
- package/dist/split-button.primary-button.styles.js +4 -14
- package/dist/split-button.primary-link.d.ts +2 -2
- package/dist/split-button.primary-link.js +1 -1
- package/dist/split-button.secondary-button.d.ts +3 -4
- package/dist/split-button.secondary-button.js +1 -1
- package/dist/split-button.secondary-button.styles.js +4 -15
- package/dist/tab.d.ts +12 -4
- package/dist/tab.group.d.ts +4 -5
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +14 -16
- package/dist/tab.js +1 -1
- package/dist/tab.panel.d.ts +12 -5
- package/dist/tab.panel.js +1 -1
- package/dist/tag.d.ts +2 -4
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +7 -52
- package/dist/textarea.d.ts +2 -2
- package/dist/textarea.js +7 -7
- package/dist/textarea.styles.js +2 -1
- package/dist/toast.d.ts +3 -3
- package/dist/toast.js +1 -1
- package/dist/toast.toasts.d.ts +9 -9
- package/dist/toast.toasts.js +17 -17
- package/dist/toggle.d.ts +2 -2
- package/dist/toggle.js +1 -1
- package/dist/tooltip.container.d.ts +2 -2
- package/dist/tooltip.container.js +1 -1
- package/dist/tooltip.d.ts +3 -3
- package/dist/tooltip.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/fr.d.ts +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/ja.d.ts +1 -1
- package/dist/translations/ja.js +1 -1
- package/package.json +4 -4
package/dist/radio-group.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length,r=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,a);else for(var d=e.length-1;d>=0;d--)(s=e[d])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};import"./label.js";import"./tooltip.js";import{html,LitElement}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{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import packageJson from"../package.json"with{type:"json"};import
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length,r=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,a);else for(var d=e.length-1;d>=0;d--)(s=e[d])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};import"./label.js";import"./tooltip.js";import{html,LitElement}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{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import packageJson from"../package.json"with{type:"json"};import RadioGroupRadio from"./radio-group.radio.js";import styles from"./radio-group.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let RadioGroup=class RadioGroup extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get disabled(){return this.#e}set disabled(e){this.#e=e;const t=this.#t.findLast((e=>e.checked));for(const i of this.#t){this.#i=!0,i.disabled=e,this.#i=!1;const a=this.#t.find((e=>!e.disabled));e?i.tabIndex=-1:i===t?i.tabIndex=0:t||i!==a||(i.tabIndex=0)}e?this.#a="":t&&(this.#a=t.value)}get required(){return this.#s}set required(e){this.#s=e;for(const t of this.#t)t.privateRequired=e}get value(){return this.#a}set value(e){if(this.#a=e,!this.#o)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.#r.checkValidity();return this.isCheckingValidity=!1,e}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#d)}firstUpdated(){for(const e of this.#t)e.privateRequired=this.required,e.tabIndex=-1,this.disabled&&(e.disabled=this.disabled);const e=this.#t.findLast((({checked:e,disabled:t})=>e&&!t));if(e)return this.#a=e.value,this.disabled||(e.tabIndex=0),this.#o=!0,this.setAttribute("value",e.value),void(this.#o=!1);if(!e&&""!==this.value){const e=this.#t.findLast((({value:e})=>e===this.value));return!this.disabled&&e?.disabled&&(e.disabled=!1),void(e&&(e.checked=!0,e.tabIndex=0))}const t=this.#t.find((({disabled:e})=>!e));t&&(t.tabIndex=0)}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.#r.form}get validity(){const e=this.#t.some((({checked:e})=>e));return!this.required||e||this.disabled?this.required&&this.#r.validity.valueMissing&&e?(this.#r.setValidity({}),this.#r.validity):this.required&&this.disabled&&!e?(this.#r.setValidity({valueMissing:!0}," ",this.#n.value),this.#r.validity):(this.required||!this.#r.validity.valueMissing||e||this.#r.setValidity({}),this.#r.validity):(this.#r.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#n.value),this.#r.validity)}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#d)}formResetCallback(){this.value=this.getAttribute("value")??""}render(){return html`
|
2
2
|
<div
|
3
3
|
class="component"
|
4
|
-
@click=${this.#
|
4
|
+
@click=${this.#l}
|
5
5
|
@keydown=${this.#h}
|
6
|
-
${ref(this.#
|
6
|
+
${ref(this.#n)}
|
7
7
|
>
|
8
8
|
<glide-core-private-label
|
9
9
|
label=${ifDefined(this.label)}
|
@@ -29,10 +29,10 @@ var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length
|
|
29
29
|
@private-disabled-change=${this.#f}
|
30
30
|
@private-value-change=${this.#m}
|
31
31
|
@slotchange=${this.#b}
|
32
|
-
${assertSlot([
|
32
|
+
${assertSlot([RadioGroupRadio])}
|
33
33
|
${ref(this.#g)}
|
34
34
|
>
|
35
|
-
<!-- @type {
|
35
|
+
<!-- @type {Radio} -->
|
36
36
|
</slot>
|
37
37
|
</div>
|
38
38
|
|
@@ -53,4 +53,4 @@ var __decorate=this&&this.__decorate||function(e,t,i,a){var s,o=arguments.length
|
|
53
53
|
</div>
|
54
54
|
</glide-core-private-label>
|
55
55
|
</div>
|
56
|
-
`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#r.reportValidity();return this.requestUpdate(),e}resetValidityFeedback(){this.isReportValidityOrSubmit=!1}setCustomValidity(e){this.validityMessage=e,""===e?this.#r.setValidity({customError:!1},"",this.#
|
56
|
+
`}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#r.reportValidity();return this.requestUpdate(),e}resetValidityFeedback(){this.isReportValidityOrSubmit=!1}setCustomValidity(e){this.validityMessage=e,""===e?this.#r.setValidity({customError:!1},"",this.#n.value):this.#r.setValidity({customError:!0,valueMissing:this.#r.validity.valueMissing}," ",this.#n.value)}setValidity(e,t){this.validityMessage=t,this.#r.setValidity(e," ",this.#n.value)}constructor(){super(),this.hideLabel=!1,this.name="",this.orientation="horizontal",this.version=packageJson.version,this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.#n=createRef(),this.#g=createRef(),this.#e=!1,this.#i=!1,this.#s=!1,this.#o=!1,this.#a="",this.#d=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,this.value)},this.#r=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()}}))}#n;#g;#r;#e;#i;#s;#o;#a;#d;get#c(){const e=!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit;for(const t of this.#t)t.privateInvalid=e;return e}#v(e){this.#t.find((({tabIndex:e})=>0===e))?.setAttribute("tabindex","-1"),this.#a=e.value,e.checked=!0,e.tabIndex=0,e.focus()}#l(e){if(!this.disabled)if(e.target instanceof RadioGroupRadio&&e.target.disabled){const e=this.#t.find((({checked:e})=>e));e?.focus()}else if(e.target instanceof RadioGroupRadio&&!e.target.disabled){const t=this.#t.filter((t=>t!==e.target));for(const e of t)e.checked=!1,e.tabIndex=-1;this.#v(e.target)}}#h(e){if(!(this.disabled||e.target instanceof RadioGroupRadio&&e.target?.disabled)&&e.target instanceof RadioGroupRadio)switch(e.key){case"Enter":this.form?.requestSubmit();break;case"ArrowUp":case"ArrowLeft":{e.preventDefault();const t=this.#t.slice(0,this.#t.indexOf(e.target)).findLast((e=>!e.disabled)),i=this.#t.findLast((e=>!e.disabled));t&&t!==e.target?(this.#R(e.target),this.#v(t)):i&&i!==e.target&&(this.#R(e.target),this.#v(i));break}case"ArrowDown":case"ArrowRight":{e.preventDefault();const t=this.#t.find(((t,i)=>!t.disabled&&e.target instanceof RadioGroupRadio&&i>this.#t.indexOf(e.target))),i=this.#t.find((e=>!e.disabled));t&&t!==e.target?(this.#R(e.target),this.#v(t)):i&&i!==e.target&&(this.#R(e.target),this.#v(i));break}case" ":if(e.preventDefault(),!e.target.disabled&&!e.target.checked){this.#v(e.target);for(const t of this.#t)t!==e.target&&this.#R(t)}}}#b(){const e=this.#t.findLast((({checked:e,disabled:t})=>e&&!t));e&&(this.#a=e.value)}#u(e){(null===e.relatedTarget||e.relatedTarget instanceof Node&&!this.contains(e.relatedTarget))&&(this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1)}get#t(){return this.#g.value?this.#g.value.assignedElements().filter((e=>e instanceof RadioGroupRadio)):[]}#p(e){if(e.target instanceof RadioGroupRadio&&e.target.checked&&!e.detail.old&&e.detail.new){const t=this.#t.find((({tabIndex:e})=>0===e));t&&t!==e.target&&this.#R(t),this.#a=e.target.value,e.target.tabIndex=e.target.disabled?-1:0}}#f(e){if(!this.#i){if(e.target instanceof RadioGroupRadio&&e.target.disabled){const t=this.#t.findLast((e=>e.checked&&!e.disabled));e.target.checked&&!t?this.#a="":t&&(this.#a=t.value);const i=this.#t.find(((t,i)=>!t.disabled&&e.target instanceof RadioGroupRadio&&i>this.#t.indexOf(e.target)));if(i&&0===e.target.tabIndex)return i.tabIndex=0,void(e.target.tabIndex=-1);const a=this.#t.find((e=>!e.disabled));if(a&&0===e.target.tabIndex)return a.tabIndex=0,void(e.target.tabIndex=-1)}if(e.target instanceof RadioGroupRadio&&!this.disabled){this.#t.some((({tabIndex:e})=>0===e))||(e.target.tabIndex=0);const t=this.#t.findLast((e=>e.checked&&!e.disabled));e.target===t&&(this.#a=e.target.value)}else;}}#m(e){const t=this.#t.findLast((e=>e.checked&&!this.disabled));e.target instanceof RadioGroupRadio&&e.target.checked&&e.detail.new&&e.target===t?this.#a=e.target.value:e.target instanceof RadioGroupRadio&&e.target.checked&&e.target===t&&(this.#a="")}#R(e){e.checked=!1,e.tabIndex=-1}};__decorate([property({reflect:!0}),required],RadioGroup.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],RadioGroup.prototype,"disabled",null),__decorate([property({attribute:"hide-label",type:Boolean})],RadioGroup.prototype,"hideLabel",void 0),__decorate([property({reflect:!0,useDefault:!0})],RadioGroup.prototype,"name",void 0),__decorate([property({reflect:!0})],RadioGroup.prototype,"orientation",void 0),__decorate([property()],RadioGroup.prototype,"privateSplit",void 0),__decorate([property({reflect:!0})],RadioGroup.prototype,"tooltip",void 0),__decorate([property({reflect:!0,type:Boolean})],RadioGroup.prototype,"required",null),__decorate([property()],RadioGroup.prototype,"value",null),__decorate([property({reflect:!0})],RadioGroup.prototype,"version",void 0),__decorate([state()],RadioGroup.prototype,"isBlurring",void 0),__decorate([state()],RadioGroup.prototype,"isCheckingValidity",void 0),__decorate([state()],RadioGroup.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],RadioGroup.prototype,"validityMessage",void 0),RadioGroup=__decorate([customElement("glide-core-radio-group"),final],RadioGroup);export default RadioGroup;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-radio-group-radio':
|
4
|
+
'glide-core-radio-group-radio': RadioGroupRadio;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -16,7 +16,7 @@ declare global {
|
|
16
16
|
* @fires {Event} change
|
17
17
|
* @fires {Event} input
|
18
18
|
*/
|
19
|
-
export default class
|
19
|
+
export default class RadioGroupRadio extends LitElement {
|
20
20
|
#private;
|
21
21
|
static shadowRootOptions: ShadowRootInit;
|
22
22
|
static styles: import("lit").CSSResult[];
|
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,a){var r,o=arguments.length,d=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(d=(o<3?r(d):o>3?r(t,i,d):r(t,i))||d);return o>3&&d&&Object.defineProperty(t,i,d),d};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property,state}from"lit/decorators.js";import packageJson from"../package.json"with{type:"json"};import styles from"./radio-group.radio.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,a){var r,o=arguments.length,d=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(d=(o<3?r(d):o>3?r(t,i,d):r(t,i))||d);return o>3&&d&&Object.defineProperty(t,i,d),d};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property,state}from"lit/decorators.js";import packageJson from"../package.json"with{type:"json"};import styles from"./radio-group.radio.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let RadioGroupRadio=class RadioGroupRadio extends LitElement{constructor(){super(...arguments),this.version=packageJson.version,this.#e=!1,this.#t=!1,this.#i=!1,this.#a=!1,this.#r=""}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get label(){return this.#o}set label(e){this.#o=e,this.ariaLabel=e.toString()}get checked(){return this.#e}set checked(e){const t=this.#e;this.#e=e,this.ariaChecked=e&&!this.disabled?"true":"false",e&&t!==e&&(this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),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(),this.ariaChecked=this.checked&&!e?"true":"false",this.dispatchEvent(new CustomEvent("private-disabled-change",{bubbles:!0}))}get privateInvalid(){return this.#i}set privateInvalid(e){this.#i=e,this.ariaInvalid=e.toString()}get privateRequired(){return this.#a}set privateRequired(e){this.#a=e,this.ariaRequired=e.toString()}get value(){return this.#r}set value(e){const t=this.#r;this.#r=e,this.dispatchEvent(new CustomEvent("private-value-change",{bubbles:!0,detail:{old:t,new:e}}))}firstUpdated(){this.ariaChecked=this.checked&&!this.disabled&&this===this.lastCheckedRadio?"true":"false",this.ariaDisabled=this.disabled.toString(),this.ariaInvalid=this.privateInvalid.toString(),this.ariaRequired=this.privateRequired.toString(),this.role="radio",this.label&&(this.ariaLabel=this.label)}get lastCheckedRadio(){const e=this.parentElement?.querySelectorAll("glide-core-radio-group-radio");if(e&&e.length>0)return[...e].findLast((e=>e.checked))}render(){return html`<div class="component" data-test="component"><div class="${classMap({circle:!0,checked:this.checked&&this===this.lastCheckedRadio&&!this.disabled,disabled:this.disabled,animate:this.hasUpdated})}" data-test="radio"></div>${this.#o}</div>`}#e;#t;#o;#i;#a;#r};__decorate([property({reflect:!0}),required],RadioGroupRadio.prototype,"label",null),__decorate([property({type:Boolean,reflect:!0})],RadioGroupRadio.prototype,"checked",null),__decorate([property({type:Boolean,reflect:!0})],RadioGroupRadio.prototype,"disabled",null),__decorate([property({type:Boolean})],RadioGroupRadio.prototype,"privateInvalid",null),__decorate([property({type:Boolean,reflect:!0})],RadioGroupRadio.prototype,"privateRequired",null),__decorate([property()],RadioGroupRadio.prototype,"value",null),__decorate([property({reflect:!0})],RadioGroupRadio.prototype,"version",void 0),__decorate([state()],RadioGroupRadio.prototype,"lastCheckedRadio",null),RadioGroupRadio=__decorate([customElement("glide-core-radio-group-radio"),final],RadioGroupRadio);export default RadioGroupRadio;
|
package/dist/spinner.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-spinner':
|
4
|
+
'glide-core-spinner': Spinner;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -11,7 +11,7 @@ declare global {
|
|
11
11
|
* @readonly
|
12
12
|
* @attr {string} [version]
|
13
13
|
*/
|
14
|
-
export default class
|
14
|
+
export default class Spinner extends LitElement {
|
15
15
|
static shadowRootOptions: ShadowRootInit;
|
16
16
|
static styles: import("lit").CSSResult[];
|
17
17
|
/**
|
package/dist/spinner.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,r,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,r,o){var i,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,o);else for(var p=e.length-1;p>=0;p--)(i=e[p])&&(n=(s<3?i(n):s>3?i(t,r,n):i(t,r))||n);return s>3&&n&&Object.defineProperty(t,r,n),n};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./spinner.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let Spinner=class Spinner extends LitElement{constructor(){super(...arguments),this.size="medium",this.version=packageJson.version}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}render(){return html`<div aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,[this.size]:!0})}" role="progressbar"></div>`}};__decorate([property({reflect:!0}),required],Spinner.prototype,"label",void 0),__decorate([property({reflect:!0,useDefault:!0})],Spinner.prototype,"size",void 0),__decorate([property({reflect:!0})],Spinner.prototype,"version",void 0),Spinner=__decorate([customElement("glide-core-spinner"),final],Spinner);export default Spinner;
|
package/dist/split-button.d.ts
CHANGED
@@ -1,28 +1,22 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-split-button':
|
4
|
+
'glide-core-split-button': SplitButton;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
8
|
-
* @attr {'large'|'small'} [size='large']
|
9
8
|
* @attr {'primary'|'secondary'} [variant='primary']
|
10
9
|
*
|
11
10
|
* @readonly
|
12
11
|
* @attr {string} [version]
|
13
12
|
*
|
14
|
-
* @slot {
|
15
|
-
* @slot {
|
13
|
+
* @slot {SplitButtonPrimaryButton | SplitButtonPrimaryLink}
|
14
|
+
* @slot {SplitButtonSecondaryButton} [secondary-button]
|
16
15
|
*/
|
17
|
-
export default class
|
16
|
+
export default class SplitButton extends LitElement {
|
18
17
|
#private;
|
19
18
|
static shadowRootOptions: ShadowRootInit;
|
20
19
|
static styles: import("lit").CSSResult[];
|
21
|
-
/**
|
22
|
-
* @default 'large'
|
23
|
-
*/
|
24
|
-
get size(): 'large' | 'small';
|
25
|
-
set size(size: 'large' | 'small');
|
26
20
|
/**
|
27
21
|
* @default 'primary'
|
28
22
|
*/
|
package/dist/split-button.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,o,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};import{html,LitElement}from"lit";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import packageJson from"../package.json"with{type:"json"};import SplitButtonPrimaryButton from"./split-button.primary-button.js";import SplitButtonPrimaryLink from"./split-button.primary-link.js";import SplitButtonSecondaryButton from"./split-button.secondary-button.js";import styles from"./split-button.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";let SplitButton=class SplitButton extends LitElement{constructor(){super(...arguments),this.version=packageJson.version,this.#t=createRef(),this.#e=createRef(),this.#o="primary"}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get variant(){return this.#o}set variant(t){this.#o=t,this.primaryButtonElement&&(this.primaryButtonElement.privateVariant=t),this.secondaryButtonElement&&(this.secondaryButtonElement.privateVariant=t)}get secondaryButtonElement(){const t=this.#e.value?.assignedElements().at(0);if(t instanceof SplitButtonSecondaryButton)return t}get primaryButtonElement(){const t=this.#t.value?.assignedElements().at(0);if(t instanceof SplitButtonPrimaryButton||t instanceof SplitButtonPrimaryLink)return t}render(){return html`<div class="component"><slot @slotchange="${this.#n}" ${assertSlot([SplitButtonPrimaryButton,SplitButtonPrimaryLink])} ${ref(this.#t)}></slot><slot name="secondary-button" @slotchange="${this.#r}" ${assertSlot([SplitButtonSecondaryButton])} ${ref(this.#e)}></slot></div>`}#t;#e;#o;#n(){this.primaryButtonElement&&(this.primaryButtonElement.privateVariant=this.variant)}#r(){this.secondaryButtonElement&&(this.secondaryButtonElement.privateVariant=this.variant)}};__decorate([property({reflect:!0})],SplitButton.prototype,"variant",null),__decorate([property({reflect:!0})],SplitButton.prototype,"version",void 0),SplitButton=__decorate([customElement("glide-core-split-button"),final],SplitButton);export default SplitButton;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-split-button-primary-button':
|
4
|
+
'glide-core-split-button-primary-button': SplitButtonPrimaryButton;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -16,7 +16,7 @@ declare global {
|
|
16
16
|
*
|
17
17
|
* @slot {Element} [icon] - An icon before the label
|
18
18
|
*/
|
19
|
-
export default class
|
19
|
+
export default class SplitButtonPrimaryButton extends LitElement {
|
20
20
|
static shadowRootOptions: ShadowRootInit;
|
21
21
|
static styles: import("lit").CSSResult[];
|
22
22
|
label?: string;
|
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,o,r){var i,a=arguments.length,p=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,o,r);else for(var
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,r){var i,a=arguments.length,p=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(p=(a<3?i(p):a>3?i(e,o,p):i(e,o))||p);return a>3&&p&&Object.defineProperty(e,o,p),p};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./split-button.primary-button.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let SplitButtonPrimaryButton=class SplitButtonPrimaryButton extends LitElement{constructor(){super(...arguments),this.ariaControls=null,this.ariaExpanded=null,this.ariaHasPopup=null,this.disabled=!1,this.privateSize="large",this.privateVariant="primary",this.version=packageJson.version}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}render(){return html`<button aria-controls="${ifDefined(this.ariaControls??void 0)}" aria-expanded="${ifDefined(this.ariaExpanded??void 0)}" aria-haspopup="${ifDefined(this.ariaHasPopup??void 0)}" class="${classMap({component:!0,disabled:this.disabled,[this.privateVariant]:!0,[this.privateSize]:!0})}" data-test="component" type="button" ?disabled="${this.disabled}"><slot name="icon"></slot>${this.label}</button>`}};__decorate([property({reflect:!0}),required],SplitButtonPrimaryButton.prototype,"label",void 0),__decorate([property({attribute:"aria-controls",reflect:!0,useDefault:!0})],SplitButtonPrimaryButton.prototype,"ariaControls",void 0),__decorate([property({attribute:"aria-expanded",reflect:!0,useDefault:!0})],SplitButtonPrimaryButton.prototype,"ariaExpanded",void 0),__decorate([property({attribute:"aria-haspopup",reflect:!0,useDefault:!0})],SplitButtonPrimaryButton.prototype,"ariaHasPopup",void 0),__decorate([property({reflect:!0,type:Boolean})],SplitButtonPrimaryButton.prototype,"disabled",void 0),__decorate([property()],SplitButtonPrimaryButton.prototype,"privateSize",void 0),__decorate([property()],SplitButtonPrimaryButton.prototype,"privateVariant",void 0),__decorate([property({reflect:!0})],SplitButtonPrimaryButton.prototype,"version",void 0),SplitButtonPrimaryButton=__decorate([customElement("glide-core-split-button-primary-button"),final],SplitButtonPrimaryButton);export default SplitButtonPrimaryButton;
|
@@ -3,16 +3,20 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
3
3
|
`,css`
|
4
4
|
.component {
|
5
5
|
align-items: center;
|
6
|
+
block-size: 2.125rem;
|
6
7
|
border-radius: var(--glide-core-rounding-base-radius-md) 0 0
|
7
8
|
var(--glide-core-rounding-base-radius-md);
|
8
9
|
border-style: solid;
|
9
10
|
border-width: 1px 0 1px 1px;
|
11
|
+
box-sizing: border-box;
|
10
12
|
cursor: pointer;
|
11
13
|
display: inline-flex;
|
12
14
|
font-family: var(--glide-core-typography-family-primary);
|
15
|
+
font-size: var(--glide-core-typography-size-body-large);
|
13
16
|
font-weight: var(--glide-core-typography-weight-bold);
|
14
17
|
gap: 0.625rem;
|
15
18
|
justify-content: center;
|
19
|
+
line-height: 1.5rem;
|
16
20
|
padding-block: var(--glide-core-spacing-base-xs);
|
17
21
|
padding-inline: var(--glide-core-spacing-base-md);
|
18
22
|
position: relative;
|
@@ -61,20 +65,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
61
65
|
}
|
62
66
|
}
|
63
67
|
|
64
|
-
&.small {
|
65
|
-
block-size: 1.75rem;
|
66
|
-
box-sizing: border-box;
|
67
|
-
font-size: var(--glide-core-typography-size-body-small);
|
68
|
-
line-height: 1rem;
|
69
|
-
}
|
70
|
-
|
71
|
-
&.large {
|
72
|
-
block-size: 2.125rem;
|
73
|
-
box-sizing: border-box;
|
74
|
-
font-size: var(--glide-core-typography-size-body-large);
|
75
|
-
line-height: 1.5rem;
|
76
|
-
}
|
77
|
-
|
78
68
|
/*
|
79
69
|
A "disabled" class is used instead of ":disabled" because these styles are
|
80
70
|
shared between Split Button Primary Button and Split Button Primary Link.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-split-button-primary-link':
|
4
|
+
'glide-core-split-button-primary-link': SplitButtonPrimaryLink;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -14,7 +14,7 @@ declare global {
|
|
14
14
|
*
|
15
15
|
* @slot {Element} [icon] - An icon before the label
|
16
16
|
*/
|
17
|
-
export default class
|
17
|
+
export default class SplitButtonPrimaryLink extends LitElement {
|
18
18
|
static shadowRootOptions: ShadowRootInit;
|
19
19
|
static styles: import("lit").CSSResult[];
|
20
20
|
label?: string;
|
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,r,i){var o,a=arguments.length,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,r,i){var o,a=arguments.length,s=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var p=t.length-1;p>=0;p--)(o=t[p])&&(s=(a<3?o(s):a>3?o(e,r,s):o(e,r))||s);return a>3&&s&&Object.defineProperty(e,r,s),s};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./split-button.primary-button.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let SplitButtonPrimaryLink=class SplitButtonPrimaryLink extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.privateSize="large",this.privateVariant="primary",this.version=packageJson.version}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}render(){return this.disabled?html`<span aria-disabled="true" class="${classMap({component:!0,disabled:!0,[this.privateVariant]:!0,[this.privateSize]:!0})}" role="link"><slot name="icon"></slot>${this.label}</span>`:html`<a class="${classMap({component:!0,[this.privateVariant]:!0,[this.privateSize]:!0})}" data-test="component" href="${ifDefined(this.href)}"><slot name="icon"></slot>${this.label}</a>`}};__decorate([property({reflect:!0}),required],SplitButtonPrimaryLink.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],SplitButtonPrimaryLink.prototype,"disabled",void 0),__decorate([property({reflect:!0})],SplitButtonPrimaryLink.prototype,"href",void 0),__decorate([property()],SplitButtonPrimaryLink.prototype,"privateSize",void 0),__decorate([property()],SplitButtonPrimaryLink.prototype,"privateVariant",void 0),__decorate([property({reflect:!0})],SplitButtonPrimaryLink.prototype,"version",void 0),SplitButtonPrimaryLink=__decorate([customElement("glide-core-split-button-primary-link"),final],SplitButtonPrimaryLink);export default SplitButtonPrimaryLink;
|
@@ -2,7 +2,7 @@ import './menu.options.js';
|
|
2
2
|
import { LitElement } from 'lit';
|
3
3
|
declare global {
|
4
4
|
interface HTMLElementTagNameMap {
|
5
|
-
'glide-core-split-button-secondary-button':
|
5
|
+
'glide-core-split-button-secondary-button': SplitButtonSecondaryButton;
|
6
6
|
}
|
7
7
|
}
|
8
8
|
/**
|
@@ -14,9 +14,9 @@ declare global {
|
|
14
14
|
* @readonly
|
15
15
|
* @attr {string} [version]
|
16
16
|
*
|
17
|
-
* @slot {
|
17
|
+
* @slot {MenuButton | MenuLink}
|
18
18
|
*/
|
19
|
-
export default class
|
19
|
+
export default class SplitButtonSecondaryButton extends LitElement {
|
20
20
|
#private;
|
21
21
|
static shadowRootOptions: ShadowRootInit;
|
22
22
|
static styles: import("lit").CSSResult[];
|
@@ -25,7 +25,6 @@ export default class GlideCoreSplitButtonSecondaryButton extends LitElement {
|
|
25
25
|
menuOpen: boolean;
|
26
26
|
menuPlacement: 'bottom-end' | 'top-end';
|
27
27
|
privateActive: boolean;
|
28
|
-
privateSize: 'large' | 'small';
|
29
28
|
privateVariant: 'primary' | 'secondary';
|
30
29
|
readonly version: string;
|
31
30
|
click(): void;
|
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,n){var r,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(i<3?r(s):i>3?r(e,o,s):r(e,o))||s);return i>3&&s&&Object.defineProperty(e,o,s),s};import"./menu.options.js";import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import Menu from"./menu.js";import MenuButton from"./menu.button.js";import MenuLink from"./menu.link.js";import chevronIcon from"./icons/chevron.js";import styles from"./split-button.secondary-button.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let SplitButtonSecondaryButton=class SplitButtonSecondaryButton extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.menuOpen=!1,this.menuPlacement="bottom-end",this.privateActive=!1,this.privateVariant="primary",this.version=packageJson.version,this.#t=createRef(),this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}click(){this.#t.value?.click()}firstUpdated(){const t=new MutationObserver((()=>{this.#e.value&&(this.menuOpen=this.#e.value.open)}));this.#e.value&&t.observe(this.#e.value,{attributes:!0,attributeFilter:["open"]})}render(){return html`<glide-core-menu placement="${this.menuPlacement}" ?open="${this.menuOpen}" ${ref(this.#e)}><button aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,active:this.menuOpen,disabled:this.disabled,[this.privateVariant]:!0})}" data-test="button" slot="target" type="button" ?disabled="${this.disabled}" ${ref(this.#t)}>${chevronIcon}</button><glide-core-menu-options><slot ${assertSlot([MenuButton,MenuLink])}></slot></glide-core-menu-options></glide-core-menu>`}#t;#e};__decorate([property({reflect:!0}),required],SplitButtonSecondaryButton.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],SplitButtonSecondaryButton.prototype,"disabled",void 0),__decorate([property({attribute:"menu-open",reflect:!0,type:Boolean})],SplitButtonSecondaryButton.prototype,"menuOpen",void 0),__decorate([property({attribute:"menu-placement",reflect:!0,useDefault:!0})],SplitButtonSecondaryButton.prototype,"menuPlacement",void 0),__decorate([property({type:Boolean})],SplitButtonSecondaryButton.prototype,"privateActive",void 0),__decorate([property()],SplitButtonSecondaryButton.prototype,"privateVariant",void 0),__decorate([property({reflect:!0})],SplitButtonSecondaryButton.prototype,"version",void 0),SplitButtonSecondaryButton=__decorate([customElement("glide-core-split-button-secondary-button"),final],SplitButtonSecondaryButton);export default SplitButtonSecondaryButton;
|
@@ -6,6 +6,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
6
6
|
background-color: var(
|
7
7
|
--glide-core-color-interactive-surface-container-active
|
8
8
|
);
|
9
|
+
block-size: 2.125rem;
|
9
10
|
border-color: var(
|
10
11
|
--glide-core-color-interactive-surface-container-active
|
11
12
|
);
|
@@ -16,12 +17,15 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
16
17
|
var(--glide-core-rounding-base-radius-md) 0;
|
17
18
|
border-style: solid;
|
18
19
|
border-width: 1px;
|
20
|
+
box-sizing: border-box;
|
19
21
|
cursor: pointer;
|
20
22
|
display: inline-flex;
|
21
23
|
font-family: var(--glide-core-typography-family-primary);
|
24
|
+
font-size: var(--glide-core-body-xxs-font-size);
|
22
25
|
font-weight: var(--glide-core-typography-weight-bold);
|
23
26
|
gap: 0.625rem;
|
24
27
|
justify-content: center;
|
28
|
+
line-height: 1.5rem;
|
25
29
|
padding-block: var(--glide-core-spacing-base-xs);
|
26
30
|
padding-inline: var(--glide-core-spacing-base-xs);
|
27
31
|
position: relative;
|
@@ -89,21 +93,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
89
93
|
}
|
90
94
|
}
|
91
95
|
|
92
|
-
&.small {
|
93
|
-
block-size: 1.75rem;
|
94
|
-
box-sizing: border-box;
|
95
|
-
font-size: var(--glide-core-typography-size-body-small);
|
96
|
-
line-height: 1rem;
|
97
|
-
min-inline-size: fit-content;
|
98
|
-
}
|
99
|
-
|
100
|
-
&.large {
|
101
|
-
block-size: 2.125rem;
|
102
|
-
box-sizing: border-box;
|
103
|
-
font-size: var(--glide-core-body-xxs-font-size);
|
104
|
-
line-height: 1.5rem;
|
105
|
-
}
|
106
|
-
|
107
96
|
&:not(:disabled):is(:active, .active) {
|
108
97
|
background-color: var(--glide-core-private-color-button-surface-active);
|
109
98
|
border-color: transparent;
|
package/dist/tab.d.ts
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
import { LitElement, type PropertyValues } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-tab':
|
4
|
+
'glide-core-tab': Tab;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
8
8
|
* @attr {string} panel
|
9
9
|
* @attr {boolean} [disabled=false]
|
10
|
+
*
|
11
|
+
* @readonly
|
12
|
+
* @attr {string} [id]
|
13
|
+
*
|
14
|
+
* @readonly
|
15
|
+
* @attr {string} [role='tab']
|
16
|
+
*
|
10
17
|
* @attr {boolean} [selected=false]
|
11
18
|
*
|
12
19
|
* @readonly
|
@@ -17,7 +24,7 @@ declare global {
|
|
17
24
|
*
|
18
25
|
* @fires {Event} selected
|
19
26
|
*/
|
20
|
-
export default class
|
27
|
+
export default class Tab extends LitElement {
|
21
28
|
#private;
|
22
29
|
static shadowRootOptions: ShadowRootInit;
|
23
30
|
static styles: import("lit").CSSResult[];
|
@@ -29,8 +36,9 @@ export default class GlideCoreTab extends LitElement {
|
|
29
36
|
get selected(): boolean;
|
30
37
|
set selected(isSelected: boolean);
|
31
38
|
readonly version: string;
|
32
|
-
|
39
|
+
readonly id: string;
|
40
|
+
readonly role = "tab";
|
33
41
|
privateSelect(): void;
|
34
42
|
render(): import("lit").TemplateResult<1>;
|
35
|
-
|
43
|
+
updated(changes: PropertyValues): void;
|
36
44
|
}
|
package/dist/tab.group.d.ts
CHANGED
@@ -2,29 +2,28 @@ import './icon-button.js';
|
|
2
2
|
import { LitElement } from 'lit';
|
3
3
|
declare global {
|
4
4
|
interface HTMLElementTagNameMap {
|
5
|
-
'glide-core-tab-group':
|
5
|
+
'glide-core-tab-group': TabGroup;
|
6
6
|
}
|
7
7
|
}
|
8
8
|
/**
|
9
9
|
* @readonly
|
10
10
|
* @attr {string} [version]
|
11
11
|
*
|
12
|
-
* @slot {
|
13
|
-
* @slot {
|
12
|
+
* @slot {TabPanel}
|
13
|
+
* @slot {Tab} [nav]
|
14
14
|
*
|
15
15
|
* @cssprop [--tabs-padding-block-end=0rem]
|
16
16
|
* @cssprop [--tabs-padding-block-start=0rem]
|
17
17
|
* @cssprop [--tabs-padding-inline-end=0rem]
|
18
18
|
* @cssprop [--tabs-padding-inline-start=0rem]
|
19
19
|
*/
|
20
|
-
export default class
|
20
|
+
export default class TabGroup extends LitElement {
|
21
21
|
#private;
|
22
22
|
static shadowRootOptions: ShadowRootInit;
|
23
23
|
static styles: import("lit").CSSResult[];
|
24
24
|
readonly version: string;
|
25
25
|
firstUpdated(): void;
|
26
26
|
render(): import("lit").TemplateResult<1>;
|
27
|
-
updated(): void;
|
28
27
|
private isDisableOverflowEndButton;
|
29
28
|
private isDisableOverflowStartButton;
|
30
29
|
private isShowOverflowButtons;
|
package/dist/tab.group.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,s,o){var i
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,s,o){var a,i=arguments.length,l=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,s,o);else for(var n=t.length-1;n>=0;n--)(a=t[n])&&(l=(i<3?a(l):i>3?a(e,s,l):a(e,s))||l);return i>3&&l&&Object.defineProperty(e,s,l),l};import"./icon-button.js";import{html,LitElement}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{when}from"lit/directives/when.js";import packageJson from"../package.json"with{type:"json"};import{LocalizeController}from"./library/localize.js";import Tab from"./tab.js";import TabPanel from"./tab.panel.js";import chevronIcon from"./icons/chevron.js";import onResize from"./library/on-resize.js";import styles from"./tab.group.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";let TabGroup=class TabGroup extends LitElement{constructor(){super(...arguments),this.version=packageJson.version,this.isDisableOverflowEndButton=!1,this.isDisableOverflowStartButton=!1,this.isShowOverflowButtons=!1,this.#t=createRef(),this.#e=new LocalizeController(this),this.#s=createRef(),this.#o=createRef(),this.#a=null,this.#i=null,this.#l=createRef(),this.#n=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}firstUpdated(){const t=this.#r.find((t=>t.selected))??this.#r[0];t&&(this.#i=t)}render(){return html`<div class="component" @click="${this.#c}" @keydown="${this.#d}" ${ref(this.#t)}><div class="tab-container" data-test="tab-container">${when(this.isShowOverflowButtons,(()=>html`<button aria-label="${this.#e.term("previousTab")}" class="${classMap({"overflow-button":!0,start:!0,disabled:this.isDisableOverflowStartButton})}" data-test="overflow-start-button" tabindex="-1" ?disabled="${this.isDisableOverflowStartButton}" @click="${this.#b.bind(this,"start")}" ${ref(this.#o)}>${chevronIcon}</button>`))}<div class="tab-group" data-test="tablist" role="tablist" tabindex="-1" @focusout="${this.#h}" @scroll="${this.#f}" ${onResize(this.#u.bind(this))} ${ref(this.#n)}><slot name="nav" @private-selected="${this.#m}" @slotchange="${this.#p}" ${assertSlot([Tab])}></slot><div class="${classMap({"selected-tab-indicator":!0,animated:this.hasUpdated})}" data-test="selected-tab-indicator" ${ref(this.#l)}></div></div>${when(this.isShowOverflowButtons,(()=>html`<button aria-label="${this.#e.term("nextTab")}" class="${classMap({"overflow-button":!0,end:!0,disabled:this.isDisableOverflowEndButton})}" data-test="overflow-end-button" tabindex="-1" @click="${this.#b.bind(this,"end")}" ?disabled="${this.isDisableOverflowEndButton}" ${ref(this.#s)}>${chevronIcon}</button>`))}</div><slot @slotchange="${this.#v}" ${assertSlot([TabPanel])}></slot></div>`}#t;#e;#s;#o;#a;#i;#l;#n;get#E(){return[...this.querySelectorAll(":scope > glide-core-tab-panel")]}get#r(){return[...this.querySelectorAll(":scope > glide-core-tab")]}#c(t){const e=t.target.closest("glide-core-tab");e&&e instanceof Tab&&!e.disabled&&this.#r.includes(e)&&(this.#i=e,this.#T(),this.#w(),e.selected=!0)}#d(t){const e=t.target instanceof HTMLElement&&t.target.closest("glide-core-tab");if(["Enter"," "].includes(t.key)&&e&&e instanceof Tab&&!e.disabled&&(this.#i=e,this.#T(),this.#w(),t.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){const e=this.#r.find((t=>t.matches(":focus")));if(e instanceof Tab){let s=this.#r.indexOf(e);switch(t.key){case"Home":s=0;break;case"End":s=this.#r.length-1;break;case"ArrowLeft":s--;break;case"ArrowRight":s++}s<0&&(s=this.#r.length-1),s>this.#r.length-1&&(s=0),this.#r[s]?.focus({preventScroll:!1});for(const[,t]of this.#r.entries())t.tabIndex=this.#r[s]===t?0:-1;this.#f(),t.preventDefault()}}}#v(){this.#R()}#p(){this.#R(),this.#T(),this.#w(),this.#f()}#b(t){const e="end"===t?1:-1;this.#n.value&&this.#n.value.scrollBy({left:e*this.#n.value.clientWidth*.5,top:0})}#h(){for(const[,t]of this.#r.entries())t.tabIndex=t===this.#i?0:-1}#u(){this.#a&&clearTimeout(this.#a),this.#w(),this.#a=setTimeout((()=>{this.#f()}))}#m(t){t.target instanceof Tab&&t.target.selected&&(this.#i=t.target,this.#T(),this.#w(),t.target.privateSelect())}#R(){for(const t of this.#r){const e=this.#E.filter((e=>e.name===t.panel))?.at(0);e?.id&&(t.setAttribute("aria-controls",e.id),e.setAttribute("aria-labelledby",t.id))}}#f(){this.#n.value&&(this.isShowOverflowButtons=this.#n.value.scrollWidth>this.#n.value.clientWidth),this.#n.value&&(this.isDisableOverflowStartButton=this.#n.value.scrollLeft<=0),this.#n.value&&(this.isDisableOverflowEndButton=this.#n.value.scrollLeft+this.#n.value.clientWidth>=this.#n.value.scrollWidth)}#T(){for(const t of this.#r)t.selected=this.#i===t,t.tabIndex=this.#i===t?0:-1;for(const t of this.#E){const e=this.#i?.getAttribute("panel"),s=t.getAttribute("name");t.privateIsSelected=s===e,t.tabIndex=s===e?0:-1}}#w(){if(this.#i&&this.#r.length>0&&this.#l.value){const t=Number.parseInt(window.getComputedStyle(this.#i).getPropertyValue("padding-inline-start")),e=this.#i===this.#r.at(0)?t:this.#i.offsetLeft-this.#r.at(0).offsetLeft;this.#l.value.style.setProperty("--private-selected-tab-indicator-translate",`${e}px`);const s=this.#i===this.#r.at(0)||this.#i===this.#r.at(-1)?t:0,{width:o}=this.#i.getBoundingClientRect();this.#l.value.style.setProperty("--private-selected-tab-indicator-width",o-s+"px")}}};__decorate([property({reflect:!0})],TabGroup.prototype,"version",void 0),__decorate([state()],TabGroup.prototype,"isDisableOverflowEndButton",void 0),__decorate([state()],TabGroup.prototype,"isDisableOverflowStartButton",void 0),__decorate([state()],TabGroup.prototype,"isShowOverflowButtons",void 0),TabGroup=__decorate([customElement("glide-core-tab-group"),final],TabGroup);export default TabGroup;
|
package/dist/tab.group.styles.js
CHANGED
@@ -37,26 +37,24 @@ import{css}from"lit";export default[css`
|
|
37
37
|
@media (prefers-reduced-motion: no-preference) {
|
38
38
|
scroll-behavior: smooth;
|
39
39
|
}
|
40
|
+
}
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
42
|
+
.selected-tab-indicator {
|
43
|
+
background: var(--glide-core-color-interactive-stroke-active);
|
44
|
+
block-size: 0.125rem;
|
45
|
+
content: '';
|
46
|
+
inline-size: var(--private-selected-tab-indicator-width);
|
47
|
+
inset-block-end: 0;
|
48
|
+
inset-inline: 0;
|
49
|
+
position: absolute;
|
50
|
+
transform-origin: left;
|
51
|
+
translate: var(--private-selected-tab-indicator-translate, 0) 0;
|
52
52
|
|
53
53
|
&.animated {
|
54
54
|
@media (prefers-reduced-motion: no-preference) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
translate 250ms;
|
59
|
-
}
|
55
|
+
transition:
|
56
|
+
inline-size 250ms,
|
57
|
+
translate 250ms;
|
60
58
|
}
|
61
59
|
}
|
62
60
|
}
|
package/dist/tab.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(a=(i<3?s(a):i>3?s(t,o,a):s(t,o))||a);return i>3&&a&&Object.defineProperty(t,o,a),a};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import packageJson from"../package.json"with{type:"json"};import styles from"./tab.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";import uniqueId from"./library/unique-id.js";let Tab=class Tab extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.version=packageJson.version,this.id=uniqueId(),this.role="tab",this.#e=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get selected(){return this.#e}set selected(e){const t=e!==this.#e;this.#e=e,e&&t&&this.dispatchEvent(new Event("private-selected",{bubbles:!0}))}privateSelect(){this.selected=!0,this.dispatchEvent(new Event("selected",{bubbles:!0,composed:!0}))}render(){return html`<div class="${classMap({component:!0,disabled:this.disabled})}" data-test="component"><div class="container"><slot name="icon"></slot><slot></slot></div></div>`}updated(e){e.has("selected")&&this.setAttribute("aria-selected",this.selected?"true":"false"),e.has("disabled")&&(this.disabled?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):this.removeAttribute("aria-disabled"))}#e};__decorate([property({reflect:!0}),required],Tab.prototype,"panel",void 0),__decorate([property({type:Boolean,reflect:!0})],Tab.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0})],Tab.prototype,"selected",null),__decorate([property({reflect:!0})],Tab.prototype,"version",void 0),__decorate([property({reflect:!0})],Tab.prototype,"id",void 0),__decorate([property({reflect:!0})],Tab.prototype,"role",void 0),Tab=__decorate([customElement("glide-core-tab"),final],Tab);export default Tab;
|