@crowdstrike/glide-core 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/accordion.d.ts +1 -1
  2. package/dist/accordion.js +1 -1
  3. package/dist/accordion.styles.js +17 -15
  4. package/dist/button-group.d.ts +1 -2
  5. package/dist/button-group.js +1 -1
  6. package/dist/button.d.ts +0 -11
  7. package/dist/button.js +1 -1
  8. package/dist/checkbox-group.d.ts +3 -3
  9. package/dist/checkbox-group.js +1 -1
  10. package/dist/checkbox.d.ts +3 -3
  11. package/dist/checkbox.js +17 -37
  12. package/dist/checkbox.styles.js +1 -12
  13. package/dist/drawer.d.ts +2 -5
  14. package/dist/drawer.js +1 -1
  15. package/dist/drawer.styles.js +0 -2
  16. package/dist/dropdown.d.ts +4 -3
  17. package/dist/dropdown.js +29 -43
  18. package/dist/dropdown.option.js +1 -1
  19. package/dist/dropdown.styles.js +1 -0
  20. package/dist/icons/checked.js +1 -1
  21. package/dist/icons/chevron.d.ts +2 -0
  22. package/dist/icons/chevron.js +1 -0
  23. package/dist/icons/magnifying-glass.d.ts +1 -1
  24. package/dist/icons/magnifying-glass.js +1 -1
  25. package/dist/icons/pencil.js +1 -1
  26. package/dist/icons/x.d.ts +2 -0
  27. package/dist/icons/x.js +1 -0
  28. package/dist/inline-alert.d.ts +5 -5
  29. package/dist/inline-alert.js +1 -1
  30. package/dist/inline-alert.styles.js +9 -5
  31. package/dist/input.d.ts +3 -3
  32. package/dist/input.js +38 -61
  33. package/dist/label.js +1 -1
  34. package/dist/label.styles.js +5 -1
  35. package/dist/library/localize.d.ts +1 -2
  36. package/dist/library/localize.test.js +1 -3
  37. package/dist/library/mouse.d.ts +2 -0
  38. package/dist/library/mouse.js +1 -0
  39. package/dist/library/ow.test.js +0 -1
  40. package/dist/menu.d.ts +3 -1
  41. package/dist/menu.js +1 -1
  42. package/dist/menu.options.d.ts +1 -1
  43. package/dist/modal.d.ts +5 -8
  44. package/dist/modal.icon-button.d.ts +2 -7
  45. package/dist/modal.icon-button.styles.js +3 -3
  46. package/dist/modal.js +1 -1
  47. package/dist/modal.styles.js +50 -45
  48. package/dist/popover.d.ts +28 -0
  49. package/dist/popover.js +1 -0
  50. package/dist/popover.styles.js +119 -0
  51. package/dist/radio-group.d.ts +11 -11
  52. package/dist/radio-group.js +11 -9
  53. package/dist/radio-group.radio.d.ts +25 -0
  54. package/dist/radio-group.radio.js +1 -0
  55. package/dist/radio-group.radio.styles.d.ts +2 -0
  56. package/dist/{radio.styles.js → radio-group.radio.styles.js} +25 -37
  57. package/dist/radio-group.styles.js +1 -5
  58. package/dist/split-button.d.ts +2 -1
  59. package/dist/split-button.secondary-button.js +1 -1
  60. package/dist/split-button.secondary-button.styles.js +6 -9
  61. package/dist/tab.d.ts +1 -2
  62. package/dist/tab.group.d.ts +0 -3
  63. package/dist/tab.group.js +1 -1
  64. package/dist/tab.group.styles.js +61 -55
  65. package/dist/tab.panel.d.ts +4 -4
  66. package/dist/tab.panel.js +1 -1
  67. package/dist/tab.styles.js +8 -8
  68. package/dist/tag.d.ts +1 -1
  69. package/dist/tag.js +1 -1
  70. package/dist/tag.styles.js +9 -5
  71. package/dist/textarea.d.ts +3 -3
  72. package/dist/textarea.js +1 -1
  73. package/dist/toasts.toast.js +1 -1
  74. package/dist/toasts.toast.styles.js +6 -3
  75. package/dist/toggle.d.ts +2 -2
  76. package/dist/toggle.js +1 -1
  77. package/dist/toggle.styles.js +8 -10
  78. package/dist/tooltip.d.ts +3 -1
  79. package/dist/tooltip.js +1 -1
  80. package/dist/tooltip.styles.js +8 -11
  81. package/dist/translations/en.js +1 -1
  82. package/dist/translations/fr.d.ts +1 -1
  83. package/dist/translations/fr.js +1 -1
  84. package/dist/translations/ja.d.ts +1 -1
  85. package/dist/translations/ja.js +1 -1
  86. package/dist/tree.d.ts +1 -2
  87. package/dist/tree.item.d.ts +0 -2
  88. package/dist/tree.item.js +1 -1
  89. package/dist/tree.item.menu.d.ts +2 -2
  90. package/dist/tree.item.menu.js +1 -1
  91. package/dist/tree.item.styles.js +41 -48
  92. package/dist/tree.js +1 -1
  93. package/package.json +11 -10
  94. package/dist/icons/informational.d.ts +0 -2
  95. package/dist/icons/informational.js +0 -1
  96. package/dist/radio.d.ts +0 -20
  97. package/dist/radio.js +0 -1
  98. /package/dist/{radio.styles.d.ts → popover.styles.d.ts} +0 -0
@@ -1,15 +1,15 @@
1
1
  import './label.js';
2
2
  import './tooltip.js';
3
- import { LitElement, type PropertyValueMap } from 'lit';
3
+ import { LitElement } from 'lit';
4
4
  declare global {
5
5
  interface HTMLElementTagNameMap {
6
6
  'glide-core-radio-group': GlideCoreRadioGroup;
7
7
  }
8
8
  }
9
9
  /**
10
- * @event change - `(event: Event) => void`
11
- * @event input - `(event: Event) => void`
12
- * @event invalid - `(event: Event) => void`
10
+ * @event change
11
+ * @event input
12
+ * @event invalid
13
13
  *
14
14
  * @slot - One or more of `<glide-core-radio>`.
15
15
  * @slot description - Additional information or context.
@@ -20,14 +20,16 @@ export default class GlideCoreRadioGroup extends LitElement {
20
20
  static formAssociated: boolean;
21
21
  static shadowRootOptions: ShadowRootInit;
22
22
  static styles: import("lit").CSSResult[];
23
- description: string;
24
- disabled: boolean;
25
- label: string;
23
+ get disabled(): boolean;
24
+ set disabled(isDisabled: boolean);
26
25
  hideLabel: boolean;
26
+ label?: string;
27
27
  name: string;
28
28
  privateSplit?: 'left' | 'middle';
29
- required: boolean;
30
- value: string;
29
+ get required(): boolean;
30
+ set required(isRequired: boolean);
31
+ get value(): string;
32
+ set value(value: string);
31
33
  checkValidity(): boolean;
32
34
  disconnectedCallback(): void;
33
35
  firstUpdated(): void;
@@ -41,8 +43,6 @@ export default class GlideCoreRadioGroup extends LitElement {
41
43
  reportValidity(): boolean;
42
44
  setCustomValidity(message: string): void;
43
45
  setValidity(flags?: ValidityStateFlags, message?: string): void;
44
- updated(changedProperties: PropertyValueMap<GlideCoreRadioGroup>): void;
45
- willUpdate(changedProperties: PropertyValueMap<GlideCoreRadioGroup>): void;
46
46
  constructor();
47
47
  private isBlurring;
48
48
  private isCheckingValidity;
@@ -1,4 +1,4 @@
1
- var __decorate=this&&this.__decorate||function(e,i,t,s){var o,a=arguments.length,d=a<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,t):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,i,t,s);else for(var r=e.length-1;r>=0;r--)(o=e[r])&&(d=(a<3?o(d):a>3?o(i,t,d):o(i,t))||d);return a>3&&d&&Object.defineProperty(i,t,d),d};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.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}checkValidity(){this.isCheckingValidity=!0;const e=this.#e.checkValidity();return this.isCheckingValidity=!1,e}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#i),this.#t=void 0}firstUpdated(){owSlot(this.#s.value),owSlotType(this.#s.value,[GlideCoreRadio]),this.#t=this.#o.find((e=>e.checked)),this.#a()}focus(e){let i=this.#o.find((e=>e.checked));i||(i=this.#o.find((e=>0===e.tabIndex))),i?.focus(e)}get form(){return this.#e.form}get validity(){const e=this.#o.some((({checked:e})=>e));return!this.required||e||this.value||this.disabled?this.required&&this.#e.validity.valueMissing&&(e||this.value)?(this.#e.setValidity({}),this.#e.validity):this.#e.validity:(this.#e.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#d.value),this.#e.validity)}get willValidate(){return this.#e.willValidate}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#i)}formResetCallback(){if(this.#t&&this.contains(this.#t))for(const e of this.#o)this.#r(e===this.#t,e)}render(){return html`
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.#s)}
27
- @slotchange=${this.#p}
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
 
@@ -32,14 +34,14 @@ var __decorate=this&&this.__decorate||function(e,i,t,s){var o,a=arguments.length
32
34
 
33
35
  <div id="description" slot="description">
34
36
  <slot
35
- class=${classMap({description:!0,hidden:Boolean(this.#h&&this.validityMessage)})}
37
+ class=${classMap({"description-slot":!0,hidden:Boolean(this.#h&&this.validityMessage)})}
36
38
  name="description"
37
39
  ></slot>
38
40
 
39
- ${when(this.#h&&this.validityMessage,(()=>html`<span class="validity-message" data-test="validity-message"
40
- >${unsafeHTML(this.validityMessage)}</span
41
- >`))}
41
+ ${when(this.#h&&this.validityMessage,(()=>html`<div data-test="validity-message">
42
+ ${unsafeHTML(this.validityMessage)}
43
+ </div>`))}
42
44
  </div>
43
45
  </glide-core-private-label>
44
46
  </div>
45
- `}reportValidity(){this.isReportValidityOrSubmit=!0;const e=this.#e.reportValidity();return this.requestUpdate(),e}setCustomValidity(e){this.validityMessage=e,""===e?this.#e.setValidity({customError:!1},"",this.#d.value):this.#e.setValidity({customError:!0,valueMissing:this.#e.validity.valueMissing}," ",this.#d.value)}setValidity(e,i){this.validityMessage=i,this.#e.setValidity(e," ",this.#d.value)}updated(e){this.hasUpdated&&(e.has("value")||e.has("required"))&&(this.#u(),this.#f(!this.#e.validity.valid),this.requestUpdate())}willUpdate(e){if(this.hasUpdated){if(e.has("required")&&this.#m(),e.has("disabled")){for(const e of this.#o)this.#v(this.disabled,e);!this.disabled&&this.#R()}if(e.has("value"))for(const e of this.#o)e.checked=e.value===this.value}}constructor(){super(),this.description="",this.disabled=!1,this.label="",this.hideLabel=!1,this.name="",this.required=!1,this.value="",this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.#d=createRef(),this.#s=createRef(),this.#t=void 0,this.#i=({formData:e})=>{this.name&&this.value.length>0&&!this.disabled&&e.append(this.name,this.value)},this.#e=this.attachInternals(),this.addEventListener("invalid",this.#b)}#d;#s;#t;#e;#y;#i;#a(){const e=this.#o.find((e=>e.checked));this.value=e?.value??this.#t?.value??"",this.#y=e??this.#t,this.required&&this.#m();for(const e of this.#o)this.disabled?this.#v(this.disabled,e):this.#v(e.disabled,e),e.addEventListener("blur",this.#C.bind(this));!this.disabled&&this.#R()}get#h(){const e=!this.disabled&&!this.validity.valid&&this.isReportValidityOrSubmit;return this.#f(e),e}#c(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1}#l(e){if(this.disabled)return;if(e.target instanceof GlideCoreRadio&&e.target.disabled&&this.#y&&!this.#y.disabled)return void this.#y?.focus();const i=e.target;if(i instanceof GlideCoreRadio&&i&&!i.disabled){this.#r(!0,i);for(const e of this.#o)e!==i&&this.#r(!1,e)}}#p(){owSlot(this.#s.value),owSlotType(this.#s.value,[GlideCoreRadio]),this.#a()}#b(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(e){if(!(this.disabled||e.target instanceof GlideCoreRadio&&e.target?.disabled)&&e.target instanceof GlideCoreRadio){const i=e.target;switch(e.key){case"Enter":this.form?.requestSubmit();break;case"ArrowUp":case"ArrowLeft":{e.preventDefault();let t=i.previousElementSibling;for(;(!t||t instanceof GlideCoreRadio&&t.disabled||!(t instanceof GlideCoreRadio))&&t!==i;)if(null===t){const e=this.#o.at(-1);e&&(t=e)}else t=t.previousElementSibling;t&&t instanceof GlideCoreRadio&&!t.disabled&&t!==i&&(this.#r(!1,i),this.#r(!0,t));break}case"ArrowDown":case"ArrowRight":{e.preventDefault();let t=i.nextElementSibling;for(;(!t||t instanceof GlideCoreRadio&&t.disabled||!(t instanceof GlideCoreRadio))&&t!==i;)if(null===t){const e=this.#o.at(0);e&&(t=e)}else t=t.nextElementSibling;t&&t instanceof GlideCoreRadio&&!t.disabled&&t!==i&&(this.#r(!1,i),this.#r(!0,t));break}case" ":if(e.preventDefault(),!i.disabled&&!i.checked){this.#r(!0,i);for(const e of this.#o)e!==i&&this.#r(!1,e)}}}}#C(e){const i=e.relatedTarget;i&&i instanceof GlideCoreRadio&&this.#o.includes(i)||this.#c()}#u(){const e=this.#o.find((e=>e.checked));this.required&&!e?this.#e.setValidity({valueMissing:!0}," ",this.#d.value):this.#e.setValidity({})}get#o(){return this.#s.value?.assignedElements().filter((e=>e instanceof GlideCoreRadio))??[]}#r(e,i){i.checked=e,i.tabIndex=e?0:-1,e&&(this.#y=i,this.value=i.value,i.focus(),i.dispatchEvent(new Event("change",{bubbles:!0})),i.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}#v(e,i){i.disabled=e,e&&(i.tabIndex=-1)}#f(e){for(const i of this.#o)i.invalid=e}#R(){if(this.disabled||this.#o.every((e=>e.disabled)))return;let e=null;const i=this.#o.find((e=>!e.disabled&&e.checked));if(i)e=i;else{const i=this.#o.find((e=>!e.disabled));i&&(e=i)}if(e)for(const i of this.#o)i.tabIndex=i===e?0:-1}#m(){for(const e of this.#o)e.required=this.required}};__decorate([property()],GlideCoreRadioGroup.prototype,"description",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadioGroup.prototype,"disabled",void 0),__decorate([property()],GlideCoreRadioGroup.prototype,"label",void 0),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreRadioGroup.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreRadioGroup.prototype,"name",void 0),__decorate([property()],GlideCoreRadioGroup.prototype,"privateSplit",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreRadioGroup.prototype,"required",void 0),__decorate([property({reflect:!0})],GlideCoreRadioGroup.prototype,"value",void 0),__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;
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.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,composed:!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)}}#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)}}}}#u(){owSlot(this.#r.value),owSlotType(this.#r.value,[GlideCoreRadio])}#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({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,r){var a,o=arguments.length,l=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,r);else for(var d=e.length-1;d>=0;d--)(a=e[d])&&(l=(o<3?a(l):o>3?a(t,i,l):a(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.#r}set label(e){this.#r=e,this.ariaLabel=e.toString()}get privateRequired(){return this.#a}set privateRequired(e){this.#a=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`<div class="component" data-test="component"><div class="${classMap({circle:!0,checked:this.checked,disabled:this.disabled,animate:this.hasUpdated})}" data-test="radio"></div>${this.#r}</div>`}#e=!1;#t=!1;#r="";#i=!1;#a=!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;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -1,7 +1,12 @@
1
1
  import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
2
- ${focusOutline(":host(:focus-visible) .component .radio-circle")}
2
+ ${focusOutline(":host(:focus-visible) .component .circle")}
3
3
  `,css`
4
- @keyframes animate-radio {
4
+ :host {
5
+ display: flex;
6
+ outline: none;
7
+ }
8
+
9
+ @keyframes circle {
5
10
  from {
6
11
  opacity: 0;
7
12
  transform: scale(0.5);
@@ -13,32 +18,27 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
13
18
  }
14
19
  }
15
20
 
16
- :host {
17
- display: flex;
18
- outline: none;
19
- }
20
-
21
21
  .component {
22
22
  align-items: center;
23
23
  color: var(--glide-core-text-body-1);
24
- display: inline-flex;
24
+ display: flex;
25
25
  font-weight: var(--glide-core-body-md-font-weight);
26
- line-height: 1;
27
26
 
28
- & .radio-circle {
29
- align-items: center;
30
- appearance: none;
27
+ &:hover {
28
+ .circle {
29
+ border-color: var(--glide-core-border-focus);
30
+ box-shadow: var(--glide-core-glow-sm);
31
+ }
32
+ }
33
+
34
+ .circle {
31
35
  block-size: 1rem;
32
36
  border: 1px solid var(--glide-core-border-base-dark);
33
37
  border-radius: 50%;
34
38
  box-sizing: border-box;
35
- content: ' ';
36
- display: inline-flex;
37
39
  inline-size: 1rem;
38
- margin: 0;
39
40
  margin-inline-end: 0.625rem;
40
41
  min-inline-size: 1rem;
41
- padding: 0;
42
42
  position: relative;
43
43
  transition:
44
44
  border-color 200ms ease-in-out,
@@ -48,6 +48,14 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
48
48
  background-color: var(--glide-core-color-white);
49
49
  border-color: var(--glide-core-surface-primary);
50
50
 
51
+ &.animate {
52
+ @media (prefers-reduced-motion: no-preference) {
53
+ &::after {
54
+ animation: circle 250ms cubic-bezier(0.25, 0, 0.3, 1);
55
+ }
56
+ }
57
+ }
58
+
51
59
  &::after {
52
60
  background-color: var(--glide-core-surface-primary);
53
61
  block-size: 0.5rem;
@@ -62,27 +70,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
62
70
  }
63
71
  }
64
72
 
65
- &.animate {
66
- &.checked {
67
- @media (prefers-reduced-motion: no-preference) {
68
- &::after {
69
- animation: animate-radio 250ms cubic-bezier(0.25, 0, 0.3, 1);
70
- }
71
- }
72
- }
73
- }
74
- }
75
-
76
- &:hover {
77
- & .radio-circle {
78
- border-color: var(--glide-core-border-focus);
79
- box-shadow: var(--glide-core-glow-sm);
80
- }
81
- }
82
-
83
- &.disabled,
84
- &.disabled:hover {
85
- & .radio-circle {
73
+ &.disabled {
86
74
  border-color: var(--glide-core-surface-primary-disabled);
87
75
  box-shadow: none;
88
76
  cursor: not-allowed;
@@ -34,15 +34,11 @@ import{css}from"lit";export default[css`
34
34
  align-items: flex-start;
35
35
  }
36
36
 
37
- .description {
37
+ .description-slot {
38
38
  display: block;
39
39
 
40
40
  &.hidden {
41
41
  display: none;
42
42
  }
43
43
  }
44
-
45
- .validity-message {
46
- display: block;
47
- }
48
44
  `];
@@ -5,8 +5,9 @@ declare global {
5
5
  }
6
6
  }
7
7
  /**
8
- * @slot - One of `<glide-core-split-button-primary-button>` or `<glide-core-split-button-primary-link>`.
8
+ * @event toggle
9
9
  *
10
+ * @slot - One of `<glide-core-split-button-primary-button>` or `<glide-core-split-button-primary-link>`.
10
11
  * @slot secondary-button - One of `<glide-core-split-button-secondary-button>`.
11
12
  */
12
13
  export default class GlideCoreSplitButton extends LitElement {
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,i){var n,r=arguments.length,l=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(l=(r<3?n(l):r>3?n(t,o,l):n(t,o))||l);return r>3&&l&&Object.defineProperty(t,o,l),l};import"./menu.options.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 GlideCoreMenu from"./menu.js";import GlideCoreMenuButton from"./menu.button.js";import GlideCoreMenuLink from"./menu.link.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./split-button.secondary-button.styles.js";let GlideCoreSplitButtonSecondaryButton=class GlideCoreSplitButtonSecondaryButton extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.menuOpen=!1,this.menuPlacement="bottom-end",this.privateActive=!1,this.privateSize="large",this.privateVariant="primary",this.#e=createRef(),this.#t=createRef(),this.#o=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}click(){this.#e.value?.click()}firstUpdated(){owSlot(this.#t.value),owSlotType(this.#t.value,[GlideCoreMenuButton,GlideCoreMenuLink]);const e=new MutationObserver((()=>{this.#o.value&&(this.menuOpen=this.#o.value.open)}));ow(this.#o.value,ow.object.instanceOf(GlideCoreMenu)),e.observe(this.#o.value,{attributes:!0,attributeFilter:["open"]})}render(){return html`<glide-core-menu placement="${this.menuPlacement}" size="${this.privateSize}" ?open="${this.menuOpen}" ${ref(this.#o)}><button aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,active:this.menuOpen,[this.privateVariant]:!0,[this.privateSize]:!0})}" data-test="button" slot="target" type="button" ?disabled="${this.disabled}" ${ref(this.#e)}><svg aria-hidden="true" class="${classMap({chevron:!0,disabled:this.disabled})}" width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M6 9L12 15L18 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button><glide-core-menu-options><slot @slotchange="${this.#i}" ${ref(this.#t)}></slot></glide-core-menu-options></glide-core-menu>`}#e;#t;#o;#i(){owSlot(this.#t.value),owSlotType(this.#t.value,[GlideCoreMenuButton,GlideCoreMenuLink])}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreSplitButtonSecondaryButton.prototype,"disabled",void 0),__decorate([property({reflect:!0})],GlideCoreSplitButtonSecondaryButton.prototype,"label",void 0),__decorate([property({attribute:"menu-open",reflect:!0,type:Boolean})],GlideCoreSplitButtonSecondaryButton.prototype,"menuOpen",void 0),__decorate([property({attribute:"menu-placement",reflect:!0})],GlideCoreSplitButtonSecondaryButton.prototype,"menuPlacement",void 0),__decorate([state()],GlideCoreSplitButtonSecondaryButton.prototype,"privateActive",void 0),__decorate([state()],GlideCoreSplitButtonSecondaryButton.prototype,"privateSize",void 0),__decorate([state()],GlideCoreSplitButtonSecondaryButton.prototype,"privateVariant",void 0),GlideCoreSplitButtonSecondaryButton=__decorate([customElement("glide-core-split-button-secondary-button")],GlideCoreSplitButtonSecondaryButton);export default GlideCoreSplitButtonSecondaryButton;
1
+ var __decorate=this&&this.__decorate||function(e,t,o,n){var i,r=arguments.length,l=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(l=(r<3?i(l):r>3?i(t,o,l):i(t,o))||l);return r>3&&l&&Object.defineProperty(t,o,l),l};import"./menu.options.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 GlideCoreMenu from"./menu.js";import GlideCoreMenuButton from"./menu.button.js";import GlideCoreMenuLink from"./menu.link.js";import chevronIcon from"./icons/chevron.js";import ow,{owSlot,owSlotType}from"./library/ow.js";import styles from"./split-button.secondary-button.styles.js";let GlideCoreSplitButtonSecondaryButton=class GlideCoreSplitButtonSecondaryButton extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.menuOpen=!1,this.menuPlacement="bottom-end",this.privateActive=!1,this.privateSize="large",this.privateVariant="primary",this.#e=createRef(),this.#t=createRef(),this.#o=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}click(){this.#e.value?.click()}firstUpdated(){owSlot(this.#t.value),owSlotType(this.#t.value,[GlideCoreMenuButton,GlideCoreMenuLink]);const e=new MutationObserver((()=>{this.#o.value&&(this.menuOpen=this.#o.value.open)}));ow(this.#o.value,ow.object.instanceOf(GlideCoreMenu)),e.observe(this.#o.value,{attributes:!0,attributeFilter:["open"]})}render(){return html`<glide-core-menu placement="${this.menuPlacement}" size="${this.privateSize}" ?open="${this.menuOpen}" ${ref(this.#o)}><button aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,active:this.menuOpen,disabled:this.disabled,[this.privateVariant]:!0,[this.privateSize]:!0})}" data-test="button" slot="target" type="button" ?disabled="${this.disabled}" ${ref(this.#e)}>${chevronIcon}</button><glide-core-menu-options><slot @slotchange="${this.#n}" ${ref(this.#t)}></slot></glide-core-menu-options></glide-core-menu>`}#e;#t;#o;#n(){owSlot(this.#t.value),owSlotType(this.#t.value,[GlideCoreMenuButton,GlideCoreMenuLink])}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreSplitButtonSecondaryButton.prototype,"disabled",void 0),__decorate([property({reflect:!0})],GlideCoreSplitButtonSecondaryButton.prototype,"label",void 0),__decorate([property({attribute:"menu-open",reflect:!0,type:Boolean})],GlideCoreSplitButtonSecondaryButton.prototype,"menuOpen",void 0),__decorate([property({attribute:"menu-placement",reflect:!0})],GlideCoreSplitButtonSecondaryButton.prototype,"menuPlacement",void 0),__decorate([state()],GlideCoreSplitButtonSecondaryButton.prototype,"privateActive",void 0),__decorate([state()],GlideCoreSplitButtonSecondaryButton.prototype,"privateSize",void 0),__decorate([state()],GlideCoreSplitButtonSecondaryButton.prototype,"privateVariant",void 0),GlideCoreSplitButtonSecondaryButton=__decorate([customElement("glide-core-split-button-secondary-button")],GlideCoreSplitButtonSecondaryButton);export default GlideCoreSplitButtonSecondaryButton;
@@ -29,8 +29,11 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
29
29
  border-block-color: transparent;
30
30
  border-inline-end-color: transparent;
31
31
  border-inline-start-color: var(--glide-core-border-base-light);
32
- color: var(--glide-core-text-tertiary-disabled);
33
32
  cursor: not-allowed;
33
+
34
+ svg {
35
+ color: var(--glide-core-text-tertiary-disabled);
36
+ }
34
37
  }
35
38
 
36
39
  &:focus {
@@ -72,7 +75,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
72
75
  border-color: transparent;
73
76
  color: var(--glide-core-text-selected);
74
77
 
75
- .chevron {
78
+ svg {
76
79
  color: var(--glide-core-icon-selected);
77
80
  }
78
81
  }
@@ -89,14 +92,8 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
89
92
  /* So the box shadow isn't covered up by the primary button. */
90
93
  z-index: 1;
91
94
  }
92
- }
93
-
94
- .chevron {
95
- &.disabled {
96
- color: var(--glide-core-icon-tertiary-disabled);
97
- }
98
95
 
99
- &:not(.disabled) {
96
+ svg {
100
97
  color: var(--glide-core-icon-primary);
101
98
  }
102
99
  }
package/dist/tab.d.ts CHANGED
@@ -5,8 +5,7 @@ declare global {
5
5
  }
6
6
  }
7
7
  /**
8
- *
9
- * @event selected - `(event: "selected", handler: (event: Event) => void) => void`.
8
+ * @event selected
10
9
  *
11
10
  * @slot - A label.
12
11
  * @slot icon - An optional icon.
@@ -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,queryAssignedElements,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.#d=null,this.#h=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;#d;#h;#b;#f;#m(e){const t=e.target.closest("glide-core-tab");t&&t instanceof GlideCoreTab&&!t.disabled&&this.#O(t)}#S(){this.#y("right")}#p(){this.#y("left")}#R(){owSlotType(this.#s.value,[GlideCoreTabPanel])}#T(){for(const[,e]of this.tabElements.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.#O(t),e.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)){const t=this.tabElements.find((e=>e.matches(":focus")));if(t instanceof GlideCoreTab){let s=this.tabElements.indexOf(t);switch(e.key){case"Home":s=0;break;case"End":s=this.tabElements.length-1;break;case"ArrowLeft":s--;break;case"ArrowRight":s++}s<0&&(s=this.tabElements.length-1),s>this.tabElements.length-1&&(s=0),this.tabElements[s].focus({preventScroll:!1});for(const[,e]of this.tabElements.entries())e.tabIndex=this.tabElements[s]===e?0:-1;this.#B(),e.preventDefault()}}}#E(){owSlotType(this.#l.value,[GlideCoreTab]),this.#g(),this.#C(),this.#B()}#w(){this.#h&&clearTimeout(this.#h),this.#h=setTimeout((()=>{this.#B()}),this.#t)}#y(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})}#L(){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}}#B(){const e=this.#f.value,t=e?.getBoundingClientRect();if(e&&t){const{width:s}=t;this.isShowOverflowButtons=e.scrollWidth-s>this.#i}this.#G(),this.#L()}#C(){for(const[e,t]of this.tabElements.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.panelElements){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.tabElements.length>0&&this.#e.value){const e=Number.parseInt(window.getComputedStyle(this.selectedTab).getPropertyValue("padding-inline-start")),t=this.selectedTab===this.tabElements.at(0)?e:this.selectedTab.offsetLeft-this.tabElements[0].offsetLeft;this.#e.value.style.setProperty("--selected-tab-indicator-translate",`${t}px`);const s=this.selectedTab===this.tabElements.at(0)||this.selectedTab===this.tabElements.at(-1)?e:0,{width:o}=this.selectedTab.getBoundingClientRect();this.#e.value.style.setProperty("--selected-tab-indicator-width",o-s+"px"),this.isAfterFirstUpdated=!0}}#G(){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.#d&&clearTimeout(this.#d),this.#d=setTimeout((()=>{this.#B()}),this.#t))})),ow(this.#f.value,ow.object.instanceOf(HTMLElement)),this.#c.observe(this.#f.value)}#g(){for(const e of this.tabElements){const t=this.panelElements.filter((t=>t.name===e.panel))?.at(0);t?.getAttribute("id")&&(e.setAttribute("aria-controls",t.getAttribute("id")),t.setAttribute("aria-labelledby",e.getAttribute("id")))}}#O(e){this.selectedTab=e,this.#C(),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),__decorate([queryAssignedElements()],GlideCoreTabGroup.prototype,"panelElements",void 0),__decorate([queryAssignedElements({slot:"nav"})],GlideCoreTabGroup.prototype,"tabElements",void 0),GlideCoreTabGroup=__decorate([customElement("glide-core-tab-group")],GlideCoreTabGroup);export default GlideCoreTabGroup;
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 n=e.length-1;n>=0;n--)(l=e[n])&&(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 chevronIcon from"./icons/chevron.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.#n=createRef(),this.#r=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.#r=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-button":!0,start:!0,disabled:this.isDisableOverflowStartButton})}" @click="${this.#p}" tabindex="-1" aria-label="${this.#o.term("previousTab")}" data-test="overflow-start-button" ${ref(this.#n)} ?disabled="${this.isDisableOverflowStartButton}">${chevronIcon}</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-button":!0,end:!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}">${chevronIcon}</button>`))}</div><slot @slotchange="${this.#R}" ${ref(this.#s)}></slot></div>`}updated(){this.#O()}#e;#t;#s;#o;#l;#i;#a;#n;#r;#c;#h;#d;#b;#f;get#g(){return[...this.querySelectorAll("glide-core-tab-panel")]}get#y(){return[...this.querySelectorAll("glide-core-tab")]}#m(e){const t=e.target.closest("glide-core-tab");t&&t instanceof GlideCoreTab&&!t.disabled&&this.#B(t)}#S(){this.#C("right")}#p(){this.#C("left")}#R(){owSlotType(this.#s.value,[GlideCoreTabPanel])}#T(){for(const[,e]of this.#y.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.#B(t),e.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)){const t=this.#y.find((e=>e.matches(":focus")));if(t instanceof GlideCoreTab){let s=this.#y.indexOf(t);switch(e.key){case"Home":s=0;break;case"End":s=this.#y.length-1;break;case"ArrowLeft":s--;break;case"ArrowRight":s++}s<0&&(s=this.#y.length-1),s>this.#y.length-1&&(s=0),this.#y[s].focus({preventScroll:!1});for(const[,e]of this.#y.entries())e.tabIndex=this.#y[s]===e?0:-1;this.#L(),e.preventDefault()}}}#E(){owSlotType(this.#l.value,[GlideCoreTab]),this.#O(),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.#D(),this.#$()}#G(){for(const[e,t]of this.#y.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.#g){const t=this.selectedTab?.getAttribute("panel"),s=e.getAttribute("name");e.privateIsSelected=s===t,e.tabIndex=s===t?0:-1}if(this.selectedTab!==this.#r&&this.selectedTab&&this.#y.length>0&&this.#e.value){const e=Number.parseInt(window.getComputedStyle(this.selectedTab).getPropertyValue("padding-inline-start")),t=this.selectedTab===this.#y.at(0)?e:this.selectedTab.offsetLeft-this.#y[0].offsetLeft;this.#e.value.style.setProperty("--selected-tab-indicator-translate",`${t}px`);const s=this.selectedTab===this.#y.at(0)||this.selectedTab===this.#y.at(-1)?e:0,{width:o}=this.selectedTab.getBoundingClientRect();this.#e.value.style.setProperty("--selected-tab-indicator-width",o-s+"px"),this.isAfterFirstUpdated=!0}}#D(){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)}#O(){for(const e of this.#y){const t=this.#g.filter((t=>t.name===e.panel))?.at(0);t?.id&&(e.setAttribute("aria-controls",t.id),t.setAttribute("aria-labelledby",e.id))}}#B(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;
@@ -8,73 +8,79 @@ import{css}from"lit";export default[css`
8
8
 
9
9
  .component {
10
10
  display: contents;
11
+ }
12
+
13
+ .tab-container {
14
+ border-block-end: 1px solid var(--glide-core-border-base-lighter);
15
+ box-sizing: border-box;
16
+ display: flex;
17
+ padding-block-end: var(--tabs-padding-block-end);
18
+ padding-block-start: var(--tabs-padding-block-start);
19
+ padding-inline-end: var(--tabs-padding-inline-end);
20
+ padding-inline-start: var(--tabs-padding-inline-start);
21
+ }
22
+
23
+ .tab-group {
24
+ display: flex;
25
+ gap: var(--glide-core-spacing-xl);
26
+ overflow: auto hidden;
27
+ position: relative;
28
+ scrollbar-width: none;
29
+ white-space: nowrap;
11
30
 
12
- & .tab-container {
13
- border-block-end: 1px solid var(--glide-core-border-base-lighter);
14
- box-sizing: border-box;
15
- display: flex;
16
- padding-block-end: var(--tabs-padding-block-end);
17
- padding-block-start: var(--tabs-padding-block-start);
18
- padding-inline-end: var(--tabs-padding-inline-end);
19
- padding-inline-start: var(--tabs-padding-inline-start);
31
+ @media (prefers-reduced-motion: no-preference) {
32
+ scroll-behavior: smooth;
20
33
  }
21
34
 
22
- & .tab-group {
23
- display: flex;
24
- gap: var(--glide-core-spacing-xl);
25
- overflow: auto hidden;
26
- position: relative;
27
- scrollbar-width: none;
28
- white-space: nowrap;
35
+ &::after {
36
+ background: var(--glide-core-border-focus);
37
+ block-size: 0.125rem;
38
+ content: '';
39
+ inline-size: var(--selected-tab-indicator-width);
40
+ inset-block-end: 0;
41
+ inset-inline: 0;
42
+ position: absolute;
43
+ transform-origin: left;
44
+ translate: var(--selected-tab-indicator-translate, 0) 0;
45
+ }
29
46
 
47
+ &.animated {
30
48
  @media (prefers-reduced-motion: no-preference) {
31
- scroll-behavior: smooth;
49
+ &::after {
50
+ transition:
51
+ inline-size 250ms,
52
+ translate 250ms;
53
+ }
32
54
  }
55
+ }
56
+ }
33
57
 
34
- /* "-webkit-scrollbar" is needed for Safari */
35
-
36
- &::-webkit-scrollbar {
37
- block-size: 0;
38
- inline-size: 0;
39
- }
58
+ .overflow-button {
59
+ --size: 1.125rem;
40
60
 
41
- &::after {
42
- background: var(--glide-core-border-focus);
43
- block-size: 0.125rem;
44
- content: '';
45
- inline-size: var(--selected-tab-indicator-width);
46
- inset-block-end: 0;
47
- inset-inline: 0;
48
- position: absolute;
49
- transform-origin: left;
50
- translate: var(--selected-tab-indicator-translate, 0) 0;
51
- }
61
+ align-items: center;
62
+ background-color: transparent;
63
+ border: none;
64
+ color: var(--glide-core-icon-default);
65
+ cursor: pointer;
66
+ display: flex;
67
+ flex-shrink: 0;
68
+ inline-size: 1.875rem;
69
+ justify-content: center;
70
+ margin: 0;
71
+ outline: none;
72
+ padding: 0;
52
73
 
53
- &.animated {
54
- @media (prefers-reduced-motion: no-preference) {
55
- &::after {
56
- transition:
57
- inline-size 250ms,
58
- translate 250ms;
59
- }
60
- }
61
- }
74
+ &.disabled {
75
+ color: var(--glide-core-icon-tertiary-disabled);
62
76
  }
63
77
 
64
- & .overflow {
65
- background-color: transparent;
66
- border: none;
67
- color: var(--glide-core-icon-default);
68
- cursor: pointer;
69
- flex-shrink: 0;
70
- inline-size: 1.875rem;
71
- margin: 0;
72
- outline: none;
73
- padding: 0;
78
+ &.start {
79
+ transform: rotate(90deg);
80
+ }
74
81
 
75
- &.disabled {
76
- color: var(--glide-core-icon-tertiary-disabled);
77
- }
82
+ &.end {
83
+ transform: rotate(-90deg);
78
84
  }
79
85
  }
80
86
 
@@ -1,11 +1,11 @@
1
- import { LitElement, type PropertyValues } from 'lit';
1
+ import { LitElement } from 'lit';
2
2
  declare global {
3
3
  interface HTMLElementTagNameMap {
4
4
  'glide-core-tab-panel': GlideCoreTabPanel;
5
5
  }
6
6
  }
7
7
  /**
8
- * @slot - Main content for the tab panel
8
+ * @slot - The content of the panel.
9
9
  */
10
10
  export default class GlideCoreTabPanel extends LitElement {
11
11
  #private;
@@ -17,8 +17,8 @@ export default class GlideCoreTabPanel extends LitElement {
17
17
  * The corresponding <glide-core-tab> will have a `panel` attribute with this name
18
18
  */
19
19
  name: string;
20
- privateIsSelected: boolean;
20
+ get privateIsSelected(): boolean;
21
+ set privateIsSelected(isSelected: boolean);
21
22
  protected firstUpdated(): void;
22
23
  render(): import("lit").TemplateResult<1>;
23
- protected updated(changes: PropertyValues): void;
24
24
  }
package/dist/tab.panel.js CHANGED
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,i){var r,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(a=(s<3?r(a):s>3?r(t,o,a):r(t,o))||a);return s>3&&a&&Object.defineProperty(t,o,a),a};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import{nanoid}from"nanoid";import styles from"./tab.panel.styles.js";let GlideCoreTabPanel=class GlideCoreTabPanel extends LitElement{constructor(){super(...arguments),this.name="",this.privateIsSelected=!0,this.#e=nanoid()}static{this.instanceCount=0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}firstUpdated(){this.setAttribute("role","tabpanel"),this.id=this.#e}render(){return html`<div class="${classMap({component:!0,hidden:!this.privateIsSelected,selected:this.privateIsSelected})}" data-test="tab-panel"><slot></slot></div>`}updated(e){super.updated(e),e.has("privateIsSelected")&&this.setAttribute("aria-hidden",this.privateIsSelected?"false":"true")}#e};__decorate([property({reflect:!0})],GlideCoreTabPanel.prototype,"name",void 0),__decorate([property({type:Boolean})],GlideCoreTabPanel.prototype,"privateIsSelected",void 0),GlideCoreTabPanel=__decorate([customElement("glide-core-tab-panel")],GlideCoreTabPanel);export default GlideCoreTabPanel;
1
+ var __decorate=this&&this.__decorate||function(e,t,i,s){var o,r=arguments.length,l=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(l=(r<3?o(l):r>3?o(t,i,l):o(t,i))||l);return r>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{nanoid}from"nanoid";import styles from"./tab.panel.styles.js";let GlideCoreTabPanel=class GlideCoreTabPanel extends LitElement{constructor(){super(...arguments),this.name="",this.#e=nanoid(),this.#t=!1}static{this.instanceCount=0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get privateIsSelected(){return this.#t}set privateIsSelected(e){this.setAttribute("aria-hidden",e?"false":"true"),this.#t=e}firstUpdated(){this.setAttribute("role","tabpanel"),this.id=this.#e}render(){return html`<div class="${classMap({component:!0,hidden:!this.privateIsSelected,selected:this.privateIsSelected})}" data-test="tab-panel"><slot></slot></div>`}#e;#t};__decorate([property({reflect:!0})],GlideCoreTabPanel.prototype,"name",void 0),__decorate([property({type:Boolean})],GlideCoreTabPanel.prototype,"privateIsSelected",null),GlideCoreTabPanel=__decorate([customElement("glide-core-tab-panel")],GlideCoreTabPanel);export default GlideCoreTabPanel;
@@ -27,14 +27,14 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
27
27
  color: var(--glide-core-text-tertiary-disabled);
28
28
  pointer-events: none;
29
29
  }
30
+ }
30
31
 
31
- & .container {
32
- align-items: center;
33
- border-radius: 0.0625rem;
34
- display: flex;
35
- flex-shrink: 0;
36
- gap: var(--glide-core-spacing-xs);
37
- white-space: nowrap;
38
- }
32
+ .container {
33
+ align-items: center;
34
+ border-radius: 0.0625rem;
35
+ display: flex;
36
+ flex-shrink: 0;
37
+ gap: var(--glide-core-spacing-xs);
38
+ white-space: nowrap;
39
39
  }
40
40
  `];
package/dist/tag.d.ts CHANGED
@@ -5,7 +5,7 @@ declare global {
5
5
  }
6
6
  }
7
7
  /**
8
- * @event remove - `(event: Event) => void`
8
+ * @event remove
9
9
  *
10
10
  * @slot icon
11
11
  */