@crowdstrike/glide-core 0.9.2 → 0.9.3

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.
@@ -3,7 +3,5 @@ import './icons/storybook.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Default: StoryObj;
7
- export declare const WithPrefixIcon: StoryObj;
8
- export declare const WithSuffix: StoryObj;
9
- export declare const WithPrefixAndSuffix: StoryObj;
6
+ export declare const Accordion: StoryObj;
7
+ export declare const WithIcons: StoryObj;
@@ -4,9 +4,5 @@ import './icons/storybook.js';
4
4
  import type { Meta, StoryObj } from '@storybook/web-components';
5
5
  declare const meta: Meta;
6
6
  export default meta;
7
- export declare const Default: StoryObj;
8
- export declare const DefaultWithOrientationVertical: StoryObj;
9
- export declare const DefaultWithPrefixIcon: StoryObj;
10
- export declare const DefaultWithOrientationVerticalPrefixIcon: StoryObj;
11
- export declare const DefaultWithIconOnly: StoryObj;
12
- export declare const DefaultWithOrientationVerticalOnlyIcon: StoryObj;
7
+ export declare const ButtonGroup: StoryObj;
8
+ export declare const WithIcons: StoryObj;
package/dist/button.d.ts CHANGED
@@ -20,10 +20,20 @@ export default class GlideCoreButton extends LitElement {
20
20
  ariaExpanded: 'true' | 'false' | null;
21
21
  ariaHasPopup: 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | null;
22
22
  ariaControls: string | null;
23
+ autofocus: boolean;
23
24
  disabled: boolean;
25
+ formAction: string;
26
+ formEncType: '' | 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
27
+ formMethod: '' | 'dialog' | 'get' | 'post';
28
+ formNoValidate: boolean;
29
+ formTarget: '' | '_blank' | '_parent' | '_self' | '_top';
30
+ name: string;
31
+ popoverTarget?: string;
32
+ popoverTargetAction: '' | 'hide' | 'show' | 'toggle';
33
+ size: 'large' | 'small';
24
34
  type: 'button' | 'submit' | 'reset';
35
+ value: string;
25
36
  variant: 'primary' | 'secondary' | 'tertiary';
26
- size: 'large' | 'small';
27
37
  get form(): HTMLFormElement | null;
28
38
  click(): void;
29
39
  firstUpdated(): void;
package/dist/button.js CHANGED
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(t,e,o,i){var r,s=arguments.length,l=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(l=(s<3?r(l):s>3?r(e,o,l):r(e,o))||l);return s>3&&l&&Object.defineProperty(e,o,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{owSlot}from"./library/ow.js";import styles from"./button.styles.js";let GlideCoreButton=class GlideCoreButton extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}get form(){return this.#t.form}click(){this.#e.value?.click()}firstUpdated(){owSlot(this.#o.value)}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,primary:"primary"===this.variant,secondary:"secondary"===this.variant,tertiary:"tertiary"===this.variant,large:"large"===this.size,small:"small"===this.size,"has-prefix":this.hasPrefixSlot,"has-suffix":this.hasSuffixSlot})}" type="${this.type}" ?disabled="${this.disabled}" @click="${this.#i}" ${ref(this.#e)}><slot name="prefix" @slotchange="${this.#r}" ${ref(this.#s)}></slot><slot @slotchange="${this.#l}" ${ref(this.#o)}></slot><slot name="suffix" @slotchange="${this.#a}" ${ref(this.#n)}></slot></button>`}constructor(){super(),this.ariaExpanded=null,this.ariaHasPopup=null,this.ariaControls=null,this.disabled=!1,this.type="button",this.variant="primary",this.size="large",this.hasPrefixSlot=!1,this.hasSuffixSlot=!1,this.#e=createRef(),this.#o=createRef(),this.#s=createRef(),this.#n=createRef(),this.#t=this.attachInternals()}#e;#o;#t;#s;#n;#i(){"submit"!==this.type?"reset"!==this.type||this.form?.reset():this.form?.requestSubmit()}#l(){owSlot(this.#o.value)}#r(){const t=this.#s.value?.assignedNodes();this.hasPrefixSlot=!!(t&&t.length>0)}#a(){const t=this.#n.value?.assignedNodes();this.hasSuffixSlot=!!(t&&t.length>0)}};__decorate([property({attribute:"aria-expanded",reflect:!0})],GlideCoreButton.prototype,"ariaExpanded",void 0),__decorate([property({attribute:"aria-haspopup",reflect:!0})],GlideCoreButton.prototype,"ariaHasPopup",void 0),__decorate([property({attribute:"aria-controls",reflect:!0})],GlideCoreButton.prototype,"ariaControls",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreButton.prototype,"disabled",void 0),__decorate([property()],GlideCoreButton.prototype,"type",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"variant",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"size",void 0),__decorate([state()],GlideCoreButton.prototype,"hasPrefixSlot",void 0),__decorate([state()],GlideCoreButton.prototype,"hasSuffixSlot",void 0),GlideCoreButton=__decorate([customElement("glide-core-button")],GlideCoreButton);export default GlideCoreButton;
1
+ var __decorate=this&&this.__decorate||function(t,e,o,r){var i,a=arguments.length,l=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(l=(a<3?i(l):a>3?i(e,o,l):i(e,o))||l);return a>3&&l&&Object.defineProperty(e,o,l),l};import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{owSlot}from"./library/ow.js";import styles from"./button.styles.js";let GlideCoreButton=class GlideCoreButton extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}get form(){return this.#t.form}click(){this.#e.value?.click()}firstUpdated(){owSlot(this.#o.value)}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)}" ?autofocus="${this.autofocus}" class="${classMap({component:!0,primary:"primary"===this.variant,secondary:"secondary"===this.variant,tertiary:"tertiary"===this.variant,large:"large"===this.size,small:"small"===this.size,"has-prefix":this.hasPrefixSlot,"has-suffix":this.hasSuffixSlot})}" ?disabled="${this.disabled}" @click="${this.#r}" ${ref(this.#e)}><slot name="prefix" @slotchange="${this.#i}" ${ref(this.#a)}></slot><slot @slotchange="${this.#l}" ${ref(this.#o)}></slot><slot name="suffix" @slotchange="${this.#s}" ${ref(this.#n)}></slot></button>`}constructor(){super(),this.ariaExpanded=null,this.ariaHasPopup=null,this.ariaControls=null,this.autofocus=!1,this.disabled=!1,this.formAction="",this.formEncType="",this.formMethod="",this.formNoValidate=!1,this.formTarget="",this.name="",this.popoverTargetAction="",this.size="large",this.type="button",this.value="",this.variant="primary",this.hasPrefixSlot=!1,this.hasSuffixSlot=!1,this.#e=createRef(),this.#o=createRef(),this.#a=createRef(),this.#n=createRef(),this.#t=this.attachInternals()}#e;#o;#t;#a;#n;#r(){"submit"!==this.type?"reset"!==this.type||this.form?.reset():this.form?.requestSubmit()}#l(){owSlot(this.#o.value)}#i(){const t=this.#a.value?.assignedNodes();this.hasPrefixSlot=Boolean(t&&t.length>0)}#s(){const t=this.#n.value?.assignedNodes();this.hasSuffixSlot=Boolean(t&&t.length>0)}};__decorate([property({attribute:"aria-expanded",reflect:!0})],GlideCoreButton.prototype,"ariaExpanded",void 0),__decorate([property({attribute:"aria-haspopup",reflect:!0})],GlideCoreButton.prototype,"ariaHasPopup",void 0),__decorate([property({attribute:"aria-controls",reflect:!0})],GlideCoreButton.prototype,"ariaControls",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreButton.prototype,"autofocus",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreButton.prototype,"disabled",void 0),__decorate([property({attribute:"formaction",reflect:!0})],GlideCoreButton.prototype,"formAction",void 0),__decorate([property({attribute:"formenctype",reflect:!0})],GlideCoreButton.prototype,"formEncType",void 0),__decorate([property({attribute:"formmethod",reflect:!0})],GlideCoreButton.prototype,"formMethod",void 0),__decorate([property({attribute:"formnovalidate",type:Boolean,reflect:!0})],GlideCoreButton.prototype,"formNoValidate",void 0),__decorate([property({attribute:"formtarget",reflect:!0})],GlideCoreButton.prototype,"formTarget",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"name",void 0),__decorate([property({attribute:"popovertarget",reflect:!0})],GlideCoreButton.prototype,"popoverTarget",void 0),__decorate([property({attribute:"popovertargetaction",reflect:!0})],GlideCoreButton.prototype,"popoverTargetAction",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"size",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"type",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"value",void 0),__decorate([property({reflect:!0})],GlideCoreButton.prototype,"variant",void 0),__decorate([state()],GlideCoreButton.prototype,"hasPrefixSlot",void 0),__decorate([state()],GlideCoreButton.prototype,"hasSuffixSlot",void 0),GlideCoreButton=__decorate([customElement("glide-core-button")],GlideCoreButton);export default GlideCoreButton;
@@ -3,15 +3,5 @@ import './icons/storybook.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Primary: StoryObj;
7
- export declare const PrimaryWithPrefixIcon: StoryObj;
8
- export declare const PrimaryWithSuffixIcon: StoryObj;
9
- export declare const PrimaryWithPrefixAndSuffixIcons: StoryObj;
10
- export declare const Secondary: StoryObj;
11
- export declare const SecondaryWithPrefixIcon: StoryObj;
12
- export declare const SecondaryWithSuffixIcon: StoryObj;
13
- export declare const SecondaryWithPrefixAndSuffixIcons: StoryObj;
14
- export declare const Tertiary: StoryObj;
15
- export declare const TertiaryWithPrefixIcon: StoryObj;
16
- export declare const TertiaryWithSuffixIcon: StoryObj;
17
- export declare const TertiaryWithPrefixAndSuffixIcons: StoryObj;
6
+ export declare const Button: StoryObj;
7
+ export declare const WithIcons: StoryObj;
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-expressions */
2
2
  import './button.js';
3
3
  import { ArgumentError } from 'ow';
4
- import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
4
+ import { expect, fixture, html } from '@open-wc/testing';
5
5
  import GlideCoreButton from './button.js';
6
6
  import sinon from 'sinon';
7
7
  GlideCoreButton.shadowRootOptions.mode = 'open';
@@ -16,179 +16,45 @@ it('has defaults', async () => {
16
16
  const component = await fixture(html `
17
17
  <glide-core-button>Button</glide-core-button>
18
18
  `);
19
+ expect(component.ariaControls).to.be.null;
20
+ expect(component.ariaExpanded).to.be.null;
21
+ expect(component.ariaHasPopup).to.be.null;
22
+ expect(component.autofocus).to.be.false;
23
+ expect(component.disabled).to.be.false;
24
+ expect(component.formAction).to.be.empty.string;
25
+ expect(component.formEncType).to.be.empty.string;
26
+ expect(component.formMethod).to.be.empty.string;
27
+ expect(component.formNoValidate).to.be.false;
28
+ expect(component.name).to.be.empty.string;
29
+ expect(component.popoverTarget).to.be.undefined;
30
+ expect(component.popoverTargetAction).to.be.empty.string;
31
+ expect(component.value).to.be.empty.string;
19
32
  expect(component.type).to.equal('button');
20
- expect(component.disabled).to.equal(false);
21
- expect(component.textContent).to.equal('Button');
22
- expect(component?.ariaHasPopup).to.equal(null);
23
- expect(component?.ariaExpanded).to.equal(null);
24
- expect(component?.ariaControls).to.equal(null);
33
+ expect(component.hasAttribute('autofocus')).to.be.false;
34
+ expect(component.getAttribute('aria-controls')).to.be.null;
35
+ expect(component.getAttribute('aria-expanded')).to.be.null;
36
+ expect(component.getAttribute('aria-haspopup')).to.be.null;
37
+ expect(component.hasAttribute('disabled')).to.be.false;
38
+ expect(component.getAttribute('formaction')).to.be.empty.string;
39
+ expect(component.getAttribute('formenctype')).to.be.empty.string;
40
+ expect(component.getAttribute('formmethod')).to.be.empty.string;
41
+ expect(component.hasAttribute('formnovalidate')).to.be.false;
42
+ expect(component.getAttribute('name')).to.be.empty.string;
43
+ expect(component.getAttribute('popovertarget')).to.be.null;
44
+ expect(component.getAttribute('popovertargetaction')).to.be.empty.string;
45
+ expect(component.getAttribute('type')).to.equal('button');
46
+ expect(component.getAttribute('value')).to.be.empty.string;
25
47
  const button = component.shadowRoot?.querySelector('button');
26
- expect(button?.getAttribute('type')).to.equal('button');
27
- expect(button?.getAttribute('aria-controls')).to.equal(null);
28
- expect(button?.ariaExpanded).to.equal(null);
29
- expect(button?.ariaHasPopup).to.equal(null);
48
+ expect(button?.getAttribute('aria-controls')).to.be.null;
49
+ expect(button?.ariaExpanded).to.be.null;
50
+ expect(button?.ariaHasPopup).to.be.null;
30
51
  expect(button?.disabled).to.equal(false);
31
- expect([...button.classList]).to.deep.equal([
32
- 'component',
33
- 'primary',
34
- 'large',
35
- ]);
36
52
  });
37
53
  it('delegates focus', async () => {
38
54
  const component = await fixture(html `<glide-core-button>Button</glide-core-button>`);
39
55
  component.focus();
40
56
  expect(component.shadowRoot?.activeElement).to.equal(component.shadowRoot?.querySelector('button'));
41
57
  });
42
- it('renders a secondary variant', async () => {
43
- const component = await fixture(html `
44
- <glide-core-button variant="secondary">Button</glide-core-button>
45
- `);
46
- expect([
47
- ...component.shadowRoot.querySelector('button').classList,
48
- ]).to.deep.equal(['component', 'secondary', 'large']);
49
- });
50
- it('renders a tertiary variant', async () => {
51
- const component = await fixture(html `
52
- <glide-core-button variant="tertiary">Button</glide-core-button>
53
- `);
54
- expect([
55
- ...component.shadowRoot.querySelector('button').classList,
56
- ]).to.deep.equal(['component', 'tertiary', 'large']);
57
- });
58
- it('sets the size to "large" by default', async () => {
59
- const component = await fixture(html `
60
- <glide-core-button>Button</glide-core-button>
61
- `);
62
- expect(component.size).to.equal('large');
63
- expect([
64
- ...component.shadowRoot.querySelector('button').classList,
65
- ]).to.deep.equal(['component', 'primary', 'large']);
66
- });
67
- it('sets the size attribute to "large"', async () => {
68
- const component = await fixture(html `
69
- <glide-core-button size="large">Button</glide-core-button>
70
- `);
71
- expect(component.size).to.equal('large');
72
- expect([
73
- ...component.shadowRoot.querySelector('button').classList,
74
- ]).to.deep.equal(['component', 'primary', 'large']);
75
- });
76
- it('sets the size attribute to "small"', async () => {
77
- const component = await fixture(html `
78
- <glide-core-button size="small">Button</glide-core-button>
79
- `);
80
- expect(component.size).to.equal('small');
81
- expect([
82
- ...component.shadowRoot.querySelector('button').classList,
83
- ]).to.deep.equal(['component', 'primary', 'small']);
84
- });
85
- it('sets the disabled attribute', async () => {
86
- const component = await fixture(html `
87
- <glide-core-button disabled>Button</glide-core-button>
88
- `);
89
- expect(component.disabled).to.equal(true);
90
- expect(component.shadowRoot.querySelector('button')?.disabled).to.equal(true);
91
- });
92
- it('sets the type attribute to "submit"', async () => {
93
- const component = await fixture(html `
94
- <glide-core-button type="submit">Button</glide-core-button>
95
- `);
96
- expect(component.type).to.equal('submit');
97
- expect(component.shadowRoot.querySelector('button')?.getAttribute('type')).to.equal('submit');
98
- });
99
- it('sets the type attribute to "reset"', async () => {
100
- const component = await fixture(html `
101
- <glide-core-button type="reset">Button</glide-core-button>
102
- `);
103
- expect(component.type).to.equal('reset');
104
- expect(component.shadowRoot?.querySelector('button')?.getAttribute('type')).to.equal('reset');
105
- });
106
- it('renders with a prefix slot', async () => {
107
- const component = await fixture(html `
108
- <glide-core-button>
109
- <span slot="prefix" data-prefix>prefix</span>
110
- Button
111
- </glide-core-button>
112
- `);
113
- expect([
114
- ...component.shadowRoot.querySelector('button').classList,
115
- ]).to.deep.equal(['component', 'primary', 'large', 'has-prefix']);
116
- expect(document.querySelector('[data-prefix]')).to.be.ok;
117
- });
118
- it('renders with a suffix slot', async () => {
119
- const component = await fixture(html `
120
- <glide-core-button>
121
- Button
122
- <span slot="suffix" data-suffix>suffix</span>
123
- </glide-core-button>
124
- `);
125
- expect([
126
- ...component.shadowRoot.querySelector('button').classList,
127
- ]).to.deep.equal(['component', 'primary', 'large', 'has-suffix']);
128
- expect(document.querySelector('[data-suffix]')).to.be.ok;
129
- });
130
- it('renders with a prefix and suffix slot when both are present initially', async () => {
131
- const component = await fixture(html `
132
- <glide-core-button>
133
- <span slot="prefix" data-prefix>prefix</span>
134
- Button
135
- <span slot="suffix" data-suffix>suffix</span>
136
- </glide-core-button>
137
- `);
138
- expect([
139
- ...component.shadowRoot.querySelector('button').classList,
140
- ]).to.deep.equal([
141
- 'component',
142
- 'primary',
143
- 'large',
144
- 'has-prefix',
145
- 'has-suffix',
146
- ]);
147
- expect(document.querySelector('[data-prefix]')).to.be.ok;
148
- expect(document.querySelector('[data-suffix]')).to.be.ok;
149
- });
150
- it('renders with prefix and suffix classes when both are dynamically added', async () => {
151
- const component = await fixture(html `
152
- <glide-core-button>Button</glide-core-button>
153
- `);
154
- const prefix = document.createElement('span');
155
- prefix.setAttribute('slot', 'prefix');
156
- prefix.dataset.prefix = undefined;
157
- prefix.textContent = 'prefix';
158
- component.append(prefix);
159
- const suffix = document.createElement('span');
160
- suffix.setAttribute('slot', 'suffix');
161
- prefix.dataset.suffix = undefined;
162
- suffix.textContent = 'suffix';
163
- component.append(suffix);
164
- await elementUpdated(component);
165
- expect([
166
- ...component.shadowRoot.querySelector('button').classList,
167
- ]).to.deep.equal([
168
- 'component',
169
- 'primary',
170
- 'large',
171
- 'has-prefix',
172
- 'has-suffix',
173
- ]);
174
- expect(document.querySelector('[data-prefix]')).to.be.ok;
175
- expect(document.querySelector('[data-suffix]')).to.be.ok;
176
- });
177
- it('renders without prefix and suffix classes after both are removed', async () => {
178
- const component = await fixture(html `
179
- <glide-core-button>
180
- <span slot="prefix">prefix</span>
181
- Button
182
- <span slot="suffix">suffix</span>
183
- </glide-core-button>
184
- `);
185
- component.querySelector('[slot="prefix"]')?.remove();
186
- component.querySelector('[slot="suffix"]')?.remove();
187
- await elementUpdated(component);
188
- expect([
189
- ...component.shadowRoot.querySelector('button').classList,
190
- ]).to.deep.equal(['component', 'primary', 'large']);
191
- });
192
58
  it('throws if it does not have a default slot', async () => {
193
59
  const spy = sinon.spy();
194
60
  try {
@@ -201,3 +67,19 @@ it('throws if it does not have a default slot', async () => {
201
67
  }
202
68
  expect(spy.callCount).to.equal(1);
203
69
  });
70
+ it('`#onPrefixSlotChange` coverage', async () => {
71
+ await fixture(html `
72
+ <glide-core-button>
73
+ <span slot="prefix">Prefix</span>
74
+ Button
75
+ </glide-core-button>
76
+ `);
77
+ });
78
+ it('`#onSuffixSlotChange` coverage', async () => {
79
+ await fixture(html `
80
+ <glide-core-button>
81
+ Button
82
+ <span slot="suffix">Suffix</span>
83
+ </glide-core-button>
84
+ `);
85
+ });
@@ -2,6 +2,5 @@ import './checkbox.js';
2
2
  import type { Meta, StoryObj } from '@storybook/web-components';
3
3
  declare const meta: Meta;
4
4
  export default meta;
5
- export declare const Vertical: StoryObj;
6
- export declare const VerticalWithTooltip: StoryObj;
7
- export declare const VerticalWithError: StoryObj;
5
+ export declare const CheckboxGroup: StoryObj;
6
+ export declare const WithError: StoryObj;
@@ -1,9 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/web-components';
2
2
  declare const meta: Meta;
3
3
  export default meta;
4
- export declare const Horizontal: StoryObj;
5
- export declare const HorizontalWithTooltip: StoryObj;
6
- export declare const HorizontalWithError: StoryObj;
7
- export declare const Vertical: StoryObj;
8
- export declare const VerticalWithTooltip: StoryObj;
9
- export declare const VerticalWithError: StoryObj;
4
+ export declare const Checkbox: StoryObj;
5
+ export declare const WithError: StoryObj;
@@ -3,4 +3,4 @@ import './drawer.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Default: StoryObj;
6
+ export declare const Drawer: StoryObj;
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,i,o){var l,s=arguments.length,r=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(r=(s<3?l(r):s>3?l(t,i,r):l(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};import"./checkbox.js";import"./tooltip.js";import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{nanoid}from"nanoid";import{when}from"lit/directives/when.js";import checkedIcon from"./icons/checked.js";import styles from"./dropdown.option.styles.js";let GlideCoreDropdownOption=class GlideCoreDropdownOption extends LitElement{constructor(){super(...arguments),this.privateIndeterminate=!1,this.privateMultiple=!1,this.privateSize="large",this.privateActive=!1,this.isLabelOverflow=!1,this.#e=createRef(),this.#t=createRef(),this.#i=nanoid(),this.#o="",this.#l=createRef(),this.#s=!1,this.#r=""}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get label(){return this.#o}set label(e){this.#o=e,setTimeout((()=>{this.#a()}))}get selected(){return this.#s}set selected(e){if(this.#s=e,this.ariaSelected=e.toString(),this.isMultiple)this.#e.value&&(this.#e.value.checked=e);else for(const e of this.#c)e!==this&&this.selected&&e.selected&&(e.selected=!1);this.dispatchEvent(new Event("private-selected-change",{bubbles:!0}))}get isMultiple(){return this.privateMultiple||this.closest("glide-core-dropdown")?.multiple}click(){this.privateMultiple?this.#e.value?.click():this.#t.value?.click()}connectedCallback(){super.connectedCallback(),this.id=this.#i,this.ariaSelected=this.selected.toString(),this.role="option",this.tabIndex=-1,this.#n=new IntersectionObserver((()=>{this.checkVisibility()&&this.#a()})),this.#n.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#n?.disconnect()}firstUpdated(){this.#e.value&&(this.#e.value.checked=this.selected)}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:t}))}async privateUpdateCheckbox(){await this.updateComplete,this.#e.value&&(this.#e.value.checked=this.selected)}render(){return html`<div class="${classMap({component:!0,active:this.privateActive,[this.privateSize]:!0})}" data-test="component" ${ref(this.#t)}>${when(this.isMultiple,(()=>html`<glide-core-checkbox class="${classMap({checkbox:!0,[this.privateSize]:!0})}" data-test="checkbox" label="${this.label??""}" tabindex="-1" private-label-tooltip-offset="${12}" private-variant="minimal" value="${this.value}" internally-inert @click="${this.#p}" ?indeterminate="${this.privateIndeterminate}" ?private-show-label-tooltip="${this.privateActive}" ${ref(this.#e)}></glide-core-checkbox>`),(()=>html`<div class="${classMap({option:!0,[this.privateSize]:!0})}"><div class="${classMap({"checked-icon":!0,visible:this.selected})}">${checkedIcon}</div><slot data-test="icon-slot" name="icon"></slot><glide-core-tooltip class="tooltip" offset="${10}" ?disabled="${!this.isLabelOverflow}" ?open="${this.privateActive}"><div aria-hidden="true" data-test="tooltip">${this.label}</div><div class="label" data-test="label" slot="target" ${ref(this.#l)}>${this.label}</div></glide-core-tooltip></div>`))}</div>`}#e;#t;#i;#n;#o;#l;#s;#r;get#c(){return[...this.closest("glide-core-dropdown")?.querySelectorAll("glide-core-dropdown-option")??[]]}#p(e){e.stopPropagation()}#a(){this.#l.value&&(this.isLabelOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth)}};__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"label",null),__decorate([property({attribute:"private-indeterminate",type:Boolean})],GlideCoreDropdownOption.prototype,"privateIndeterminate",void 0),__decorate([property({attribute:"private-multiple",type:Boolean})],GlideCoreDropdownOption.prototype,"privateMultiple",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"selected",null),__decorate([property({attribute:"private-size",reflect:!0})],GlideCoreDropdownOption.prototype,"privateSize",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"privateActive",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"isMultiple",null),__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"value",null),__decorate([state()],GlideCoreDropdownOption.prototype,"isLabelOverflow",void 0),GlideCoreDropdownOption=__decorate([customElement("glide-core-dropdown-option")],GlideCoreDropdownOption);export default GlideCoreDropdownOption;
1
+ var __decorate=this&&this.__decorate||function(e,t,i,o){var l,s=arguments.length,r=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(l=e[a])&&(r=(s<3?l(r):s>3?l(t,i,r):l(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};import"./checkbox.js";import"./tooltip.js";import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{nanoid}from"nanoid";import{when}from"lit/directives/when.js";import checkedIcon from"./icons/checked.js";import styles from"./dropdown.option.styles.js";let GlideCoreDropdownOption=class GlideCoreDropdownOption extends LitElement{constructor(){super(...arguments),this.privateIndeterminate=!1,this.privateMultiple=!1,this.privateSize="large",this.privateActive=!1,this.isLabelOverflow=!1,this.#e=createRef(),this.#t=createRef(),this.#i=nanoid(),this.#o="",this.#l=createRef(),this.#s=!1,this.#r=""}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get label(){return this.#o}set label(e){this.#o=e,setTimeout((()=>{this.#a()}))}get selected(){return this.#s}set selected(e){if(this.#s=e,this.ariaSelected=e.toString(),this.isMultiple)this.#e.value&&(this.#e.value.checked=e);else for(const e of this.#c)e!==this&&this.selected&&e.selected&&(e.selected=!1);this.dispatchEvent(new Event("private-selected-change",{bubbles:!0}))}get isMultiple(){return this.privateMultiple||this.closest("glide-core-dropdown")?.multiple}click(){this.privateMultiple?this.#e.value?.click():this.#t.value?.click()}connectedCallback(){super.connectedCallback(),this.id=this.#i,this.ariaSelected=this.selected.toString(),this.role="option",this.tabIndex=-1,this.#n=new IntersectionObserver((()=>{this.checkVisibility()&&this.#a()})),this.#n.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.#n?.disconnect()}firstUpdated(){this.#e.value&&(this.#e.value.checked=this.selected)}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:t}))}async privateUpdateCheckbox(){await this.updateComplete,this.#e.value&&(this.#e.value.checked=this.selected)}render(){return html`<div class="${classMap({component:!0,active:this.privateActive,[this.privateSize]:!0})}" data-test="component" ${ref(this.#t)}>${when(this.isMultiple,(()=>html`<glide-core-checkbox class="${classMap({checkbox:!0,[this.privateSize]:!0})}" data-test="checkbox" label="${this.label??""}" tabindex="-1" private-label-tooltip-offset="${12}" private-variant="minimal" value="${this.value}" internally-inert @click="${this.#p}" ?indeterminate="${this.privateIndeterminate}" ?private-show-label-tooltip="${this.privateActive}" ${ref(this.#e)}></glide-core-checkbox>`),(()=>html`<div class="${classMap({option:!0,[this.privateSize]:!0})}"><slot data-test="icon-slot" name="icon"></slot><glide-core-tooltip class="tooltip" offset="${10}" ?disabled="${!this.isLabelOverflow}" ?open="${this.privateActive}"><div aria-hidden="true" data-test="tooltip">${this.label}</div><div class="label" data-test="label" slot="target" ${ref(this.#l)}>${this.label}</div></glide-core-tooltip><div class="${classMap({"checked-icon":!0,visible:this.selected})}">${checkedIcon}</div></div>`))}</div>`}#e;#t;#i;#n;#o;#l;#s;#r;get#c(){return[...this.closest("glide-core-dropdown")?.querySelectorAll("glide-core-dropdown-option")??[]]}#p(e){e.stopPropagation()}#a(){this.#l.value&&(this.isLabelOverflow=this.#l.value.scrollWidth>this.#l.value.clientWidth)}};__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"label",null),__decorate([property({attribute:"private-indeterminate",type:Boolean})],GlideCoreDropdownOption.prototype,"privateIndeterminate",void 0),__decorate([property({attribute:"private-multiple",type:Boolean})],GlideCoreDropdownOption.prototype,"privateMultiple",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreDropdownOption.prototype,"selected",null),__decorate([property({attribute:"private-size",reflect:!0})],GlideCoreDropdownOption.prototype,"privateSize",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"privateActive",void 0),__decorate([state()],GlideCoreDropdownOption.prototype,"isMultiple",null),__decorate([property({reflect:!0})],GlideCoreDropdownOption.prototype,"value",null),__decorate([state()],GlideCoreDropdownOption.prototype,"isLabelOverflow",void 0),GlideCoreDropdownOption=__decorate([customElement("glide-core-dropdown-option")],GlideCoreDropdownOption);export default GlideCoreDropdownOption;
@@ -55,6 +55,7 @@ import{css}from"lit";export default[css`
55
55
  .checked-icon {
56
56
  display: inline-flex;
57
57
  justify-content: center;
58
+ margin-inline-start: auto;
58
59
  opacity: 0;
59
60
 
60
61
  &.visible {
@@ -3,13 +3,7 @@ import './icons/storybook.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const SingleSelectionHorizontal: StoryObj;
7
- export declare const SingleSelectionHorizontalWithIcon: StoryObj;
8
- export declare const SingleSelectionHorizontalWithTooltip: StoryObj;
9
- export declare const SingleSelectionHorizontalWithError: StoryObj;
10
- export declare const SingleSelectionVerticalWithIcon: StoryObj;
11
- export declare const SingleSelectionVerticalWithTooltip: StoryObj;
12
- export declare const SingleSelectionVerticalWithError: StoryObj;
13
- export declare const SingleSelectionHorizontalWithFiltering: StoryObj;
14
- export declare const MultipleSelectionHorizontal: StoryObj;
15
- export declare const MultipleSelectionHorizontalWithFiltering: StoryObj;
6
+ export declare const Dropdown: StoryObj;
7
+ export declare const WithError: StoryObj;
8
+ export declare const WithIcons: StoryObj;
9
+ export declare const Filterable: StoryObj;
@@ -1,5 +1,5 @@
1
- import{css}from"lit";import menuOpeningAnimation from"./styles/menu-opening-animation.js";import visuallyHidden from"./styles/visually-hidden.js";export default[css`
2
- ${menuOpeningAnimation(".options:popover-open")}
1
+ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";import visuallyHidden from"./styles/visually-hidden.js";export default[css`
2
+ ${opacityAndScaleAnimation(".options:popover-open")}
3
3
  ${visuallyHidden(".selected-option-labels")}
4
4
  `,css`
5
5
  .component {
@@ -44,9 +44,6 @@ import{css}from"lit";import menuOpeningAnimation from"./styles/menu-opening-anim
44
44
  block-size: 1.5rem;
45
45
  border-color: transparent;
46
46
  border-radius: var(--glide-core-border-radius-round);
47
- font-size: var(--glide-core-heading-xxxs-font-size);
48
- font-style: var(--glide-core-heading-xxxs-font-style);
49
- font-weight: var(--glide-core-heading-xxxs-font-weight);
50
47
  gap: var(--glide-core-spacing-xxs);
51
48
  min-inline-size: 3.75rem;
52
49
  padding-block: 0;
@@ -7,4 +7,4 @@ import './radio.js';
7
7
  import type { Meta, StoryObj } from '@storybook/web-components';
8
8
  declare const meta: Meta;
9
9
  export default meta;
10
- export declare const SingleSelectionHorizontal: StoryObj;
10
+ export declare const FormControlsLayout: StoryObj;
@@ -17,7 +17,7 @@ export default class GlideCoreIconButton extends LitElement {
17
17
  ariaExpanded: 'true' | 'false' | null;
18
18
  ariaHasPopup: 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | null;
19
19
  disabled: boolean;
20
- /** Text read aloud for screenreaders. For accessibility, this should always be provided. */
20
+ /** For screenreaders. Required. */
21
21
  label: string;
22
22
  variant: 'primary' | 'secondary' | 'tertiary';
23
23
  firstUpdated(): void;
@@ -3,6 +3,4 @@ import './icons/storybook.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Primary: StoryObj;
7
- export declare const Secondary: StoryObj;
8
- export declare const Tertiary: StoryObj;
6
+ export declare const IconButton: StoryObj;
@@ -3,13 +3,6 @@ import './input.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Default: StoryObj;
7
- export declare const Password: StoryObj;
6
+ export declare const Input: StoryObj;
8
7
  export declare const WithError: StoryObj;
9
- export declare const Clearable: StoryObj;
10
- export declare const SuffixIcon: StoryObj;
11
- export declare const PrefixIcon: StoryObj;
12
- export declare const SearchType: StoryObj;
13
- export declare const MaxLength: StoryObj;
14
- export declare const MaxLengthAndDescription: StoryObj;
15
- export declare const Tooltip: StoryObj;
8
+ export declare const WithIcons: StoryObj;
@@ -7,4 +7,4 @@ import type { Meta, StoryObj } from '@storybook/web-components';
7
7
  declare const meta: Meta;
8
8
  export default meta;
9
9
  export declare const Menu: StoryObj;
10
- export declare const MenuWithIcon: StoryObj;
10
+ export declare const WithIcons: StoryObj;
@@ -1,5 +1,5 @@
1
- import{css}from"lit";import menuOpeningAnimation from"./styles/menu-opening-animation.js";export default[css`
2
- ${menuOpeningAnimation(".default-slot:popover-open")}
1
+ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";export default[css`
2
+ ${opacityAndScaleAnimation(".default-slot:popover-open")}
3
3
  `,css`
4
4
  :host {
5
5
  /* Contains elements with "padding", "margin", and "width". Inline by default. */
@@ -8,8 +8,6 @@ import type { Meta, StoryObj } from '@storybook/web-components';
8
8
  declare const meta: Meta;
9
9
  export default meta;
10
10
  export declare const Modal: StoryObj;
11
- export declare const WithBackButton: StoryObj;
12
- export declare const HeaderActions: StoryObj;
13
- export declare const HeaderActionsWithBackButton: StoryObj;
14
- export declare const TertiaryButton: StoryObj;
15
- export declare const TertiaryIcon: StoryObj;
11
+ export declare const WithHeaderActions: StoryObj;
12
+ export declare const WithTertiaryButton: StoryObj;
13
+ export declare const WithTertiaryIconAndButton: StoryObj;
@@ -3,6 +3,5 @@ import './radio.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Vertical: StoryObj;
7
- export declare const VerticalWithTooltip: StoryObj;
8
- export declare const VerticalWithError: StoryObj;
6
+ export declare const RadioGroup: StoryObj;
7
+ export declare const WithError: StoryObj;
@@ -7,11 +7,6 @@ import './split-link.js';
7
7
  import type { Meta, StoryObj } from '@storybook/web-components';
8
8
  declare const meta: Meta;
9
9
  export default meta;
10
- export declare const Primary: StoryObj;
11
- export declare const PrimaryWithPrefixIcon: StoryObj;
12
- export declare const PrimaryWithSizeSmall: StoryObj;
13
- export declare const PrimaryWithLink: StoryObj;
14
- export declare const Secondary: StoryObj;
15
- export declare const SecondaryWithPrefixIcon: StoryObj;
16
- export declare const SecondaryWithSizeSmall: StoryObj;
17
- export declare const SecondaryWithLink: StoryObj;
10
+ export declare const SplitButton: StoryObj;
11
+ export declare const WithIcon: StoryObj;
12
+ export declare const WithSplitLink: StoryObj;
@@ -2,16 +2,4 @@ import './status-indicator.js';
2
2
  import type { Meta, StoryObj } from '@storybook/web-components';
3
3
  declare const meta: Meta;
4
4
  export default meta;
5
- export declare const Failed: StoryObj;
6
- export declare const Idle: StoryObj;
7
- export declare const InProgress: StoryObj;
8
- export declare const Queued: StoryObj;
9
- export declare const Scheduled: StoryObj;
10
- export declare const Success: StoryObj;
11
- export declare const WarningCritical: StoryObj;
12
- export declare const WarningHigh: StoryObj;
13
- export declare const WarningInformational: StoryObj;
14
- export declare const WarningLow: StoryObj;
15
- export declare const WarningMedium: StoryObj;
16
- export declare const WarningZero: StoryObj;
17
- export declare const CustomSize: StoryObj;
5
+ export declare const StatusIndicator: StoryObj;
@@ -1,21 +1,19 @@
1
1
  import{css,unsafeCSS}from"lit";export default e=>css`
2
2
  /* stylelint-disable selector-type-case, selector-type-no-unknown */
3
- @keyframes menu-opening {
3
+ @keyframes opacity-and-scale {
4
4
  from {
5
5
  opacity: 0;
6
- transform: scaleY(0);
7
- transform-origin: 0% 0%;
6
+ transform: scale(0.95);
8
7
  }
9
8
 
10
9
  to {
11
10
  opacity: 1;
12
- transform: scaleY(1);
13
- transform-origin: 0% 0%;
11
+ transform: scale(1);
14
12
  }
15
13
  }
16
14
 
17
15
  ${unsafeCSS(e)} {
18
- animation: menu-opening 150ms cubic-bezier(0.25, 0, 0.3, 1);
16
+ animation: opacity-and-scale 250ms cubic-bezier(0.25, 0, 0.3, 1);
19
17
  }
20
18
 
21
19
  @media (prefers-reduced-motion: reduce) {
package/dist/tab.group.js CHANGED
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(t,e,i,s){var o,l=arguments.length,a=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(a=(l<3?o(a):l>3?o(e,i,a):o(e,i))||a);return l>3&&a&&Object.defineProperty(e,i,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.#t=createRef(),this.#e=null,this.#i=100,this.#s=createRef(),this.#o=new LocalizeController(this),this.#l=createRef(),this.#a=1,this.#r=createRef(),this.#n=createRef(),this.#c=null,this.#h=null,this.#b=null,this.#u=null,this.#d=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get activeTab(){return this.#e}set activeTab(t){this.#c=this.#e,this.#e=t}disconnectedCallback(){this.#h?.disconnect(),this.#h=null}firstUpdated(){owSlotType(this.#l.value,[GlideCoreTab]),owSlotType(this.#s.value,[GlideCoreTabPanel]),this.#f(),this.#v(),this.#m(),this.#p()}render(){return html`<div class="component" @click="${this.#w}" @keydown="${this.#T}" ${ref(this.#t)}><div class="tab-container">${when(this.isShowOverflowButtons,(()=>html`<button style="height: ${this.#d.value?.clientHeight}px" class="${classMap({overflow:!0,disabled:this.isDisableOverflowStartButton})}" @click="${this.#E}" tabindex="-1" aria-label="${this.#o.term("previousTab")}" data-test="overflow-start-button" ${ref(this.#n)} ?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.#d)} @scroll="${this.#R}" @focusout="${this.#g}" tabindex="-1"><slot name="nav" @slotchange="${this.#S}" ${ref(this.#l)}></slot></div>${when(this.isShowOverflowButtons,(()=>html`<button style="height: ${this.#d.value?.clientHeight}px" class="${classMap({overflow:!0,disabled:this.isDisableOverflowEndButton})}" @click="${this.#y}" tabindex="-1" aria-label="${this.#o.term("nextTab")}" data-test="overflow-end-button" ${ref(this.#r)} ?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.#O}" ${ref(this.#s)}></slot></div>`}updated(){this.#f()}#t;#e;#i;#s;#o;#l;#a;#r;#n;#c;#h;#b;#u;#d;#w(t){const e=t.target.closest("glide-core-tab");e&&e instanceof GlideCoreTab&&!e.disabled&&this.#B(e)}#y(){this.#C("right")}#E(){this.#C("left")}#O(){owSlotType(this.#s.value,[GlideCoreTabPanel])}#g(){for(const[,t]of this.tabElements.entries())t.tabIndex=t===this.activeTab?0:-1}#T(t){const e=t.target.closest("glide-core-tab");if(["Enter"," "].includes(t.key)&&e&&e instanceof GlideCoreTab&&!e.disabled&&(this.#B(e),t.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){const e=this.tabElements.find((t=>t.matches(":focus")));if("glide-core-tab"===e?.tagName.toLowerCase()){let i=this.tabElements.indexOf(e);switch(t.key){case"Home":i=0;break;case"End":i=this.tabElements.length-1;break;case"ArrowLeft":i--;break;case"ArrowRight":i++}i<0&&(i=this.tabElements.length-1),i>this.tabElements.length-1&&(i=0),this.tabElements[i].focus({preventScroll:!1});for(const[,t]of this.tabElements.entries())t.tabIndex=this.tabElements[i]===t?0:-1;this.#L(),t.preventDefault()}}}#S(){owSlotType(this.#l.value,[GlideCoreTab]),this.#L()}#R(){this.#u&&clearTimeout(this.#u),this.#u=setTimeout((()=>{this.#L()}),this.#i)}#C(t){const e="right"===t?1:-1;ow(this.#d.value,ow.object.instanceOf(HTMLElement));const i=e*this.#d.value?.clientWidth*.5;this.#d.value?.scrollBy({left:i,top:0})}#v(){for(const[t,e]of this.tabElements.entries())this.activeTab||0!==t?(e.active=this.activeTab===e,e.tabIndex=this.activeTab===e?0:-1):(this.activeTab=e,this.activeTab.active=!0,this.activeTab.tabIndex=0);for(const t of this.panelElements){const e=this.activeTab?.getAttribute("panel"),i=t.getAttribute("name");t.isActive=i===e,t.tabIndex=i===e?0:-1}if(this.activeTab!==this.#c&&this.activeTab&&this.tabElements.length>0&&this.#t.value){const t=Number.parseInt(window.getComputedStyle(this.activeTab).getPropertyValue("padding-inline-"+(this.activeTab===this.tabElements.at(0)?"start":"end"))),e=this.activeTab===this.tabElements.at(0)?t:this.activeTab.offsetLeft-this.tabElements[0].offsetLeft;this.#t.value.style.setProperty("--active-tab-indicator-translate",`${e}px`);const i=this.activeTab===this.tabElements.at(0)||this.activeTab===this.tabElements.at(-1)?t:0;this.#t.value.style.setProperty("--active-tab-indicator-width",this.activeTab.clientWidth-i+"px")}}#A(){const t=this.#d.value,e=t?.getBoundingClientRect();if(ow(t,ow.object.instanceOf(HTMLElement)),e){const{width:i}=e,s=t.scrollLeft+i,o=t.scrollWidth;this.isDisableOverflowEndButton=o-s<=this.#a}}#L(){const t=this.#d.value,e=t?.getBoundingClientRect();if(t&&e){const{width:i}=e;this.isShowOverflowButtons=t.scrollWidth-i>this.#a}this.#G(),this.#A()}#G(){ow(this.#d.value,ow.object.instanceOf(HTMLElement)),this.isDisableOverflowStartButton=this.#d.value.scrollLeft<=0}#m(){requestAnimationFrame((()=>{if(this.activeTab&&this.#t.value){const t=Number.parseInt(window.getComputedStyle(this.activeTab).getPropertyValue("padding-inline-start")),{width:e}=this.activeTab.getBoundingClientRect();this.#t.value.style.setProperty("--active-tab-indicator-width",e-t+"px"),this.#t.value.style.setProperty("--active-tab-indicator-translate",`${t}px`),setTimeout((()=>{this.isAfterFirstUpdated=!0}))}}))}#p(){this.#h=new ResizeObserver((t=>{t?.at(0)?.target===this.#d.value&&(this.#b&&clearTimeout(this.#b),this.#b=setTimeout((()=>{this.#L()}),this.#i))})),ow(this.#d.value,ow.object.instanceOf(HTMLElement)),this.#h.observe(this.#d.value)}#f(){for(const t of this.tabElements){const e=this.panelElements.filter((e=>e.name===t.panel))?.at(0);e?.getAttribute("id")&&(t.setAttribute("aria-controls",e.getAttribute("id")),e.setAttribute("aria-labelledby",t.getAttribute("id")))}}#B(t){this.activeTab=t,this.#v(),this.dispatchEvent(new CustomEvent("tab-show",{bubbles:!0,detail:{panel:t.panel}}))}};__decorate([state()],GlideCoreTabGroup.prototype,"activeTab",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(t,e,i,s){var o,l=arguments.length,a=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(a=(l<3?o(a):l>3?o(e,i,a):o(e,i))||a);return l>3&&a&&Object.defineProperty(e,i,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.#t=createRef(),this.#e=null,this.#i=100,this.#s=createRef(),this.#o=new LocalizeController(this),this.#l=createRef(),this.#a=1,this.#r=createRef(),this.#n=createRef(),this.#c=null,this.#h=null,this.#b=null,this.#u=null,this.#d=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}get activeTab(){return this.#e}set activeTab(t){this.#c=this.#e,this.#e=t}disconnectedCallback(){this.#h?.disconnect(),this.#h=null}firstUpdated(){owSlotType(this.#l.value,[GlideCoreTab]),owSlotType(this.#s.value,[GlideCoreTabPanel]),this.#f()}render(){return html`<div class="component" @click="${this.#v}" @keydown="${this.#m}" ${ref(this.#t)}><div class="tab-container">${when(this.isShowOverflowButtons,(()=>html`<button style="height: ${this.#d.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.#n)} ?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.#d)} @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.#d.value?.clientHeight}px" class="${classMap({overflow:!0,disabled:this.isDisableOverflowEndButton})}" @click="${this.#R}" tabindex="-1" aria-label="${this.#o.term("nextTab")}" data-test="overflow-end-button" ${ref(this.#r)} ?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.#g}" ${ref(this.#s)}></slot></div>`}updated(){this.#S()}#t;#e;#i;#s;#o;#l;#a;#r;#n;#c;#h;#b;#u;#d;#v(t){const e=t.target.closest("glide-core-tab");e&&e instanceof GlideCoreTab&&!e.disabled&&this.#y(e)}#R(){this.#O("right")}#p(){this.#O("left")}#g(){owSlotType(this.#s.value,[GlideCoreTabPanel])}#T(){for(const[,t]of this.tabElements.entries())t.tabIndex=t===this.activeTab?0:-1}#m(t){const e=t.target.closest("glide-core-tab");if(["Enter"," "].includes(t.key)&&e&&e instanceof GlideCoreTab&&!e.disabled&&(this.#y(e),t.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){const e=this.tabElements.find((t=>t.matches(":focus")));if("glide-core-tab"===e?.tagName.toLowerCase()){let i=this.tabElements.indexOf(e);switch(t.key){case"Home":i=0;break;case"End":i=this.tabElements.length-1;break;case"ArrowLeft":i--;break;case"ArrowRight":i++}i<0&&(i=this.tabElements.length-1),i>this.tabElements.length-1&&(i=0),this.tabElements[i].focus({preventScroll:!1});for(const[,t]of this.tabElements.entries())t.tabIndex=this.tabElements[i]===t?0:-1;this.#B(),t.preventDefault()}}}#E(){owSlotType(this.#l.value,[GlideCoreTab]),this.#S(),this.#C(),this.#L(),this.#B()}#w(){this.#u&&clearTimeout(this.#u),this.#u=setTimeout((()=>{this.#B()}),this.#i)}#O(t){const e="right"===t?1:-1;ow(this.#d.value,ow.object.instanceOf(HTMLElement));const i=e*this.#d.value?.clientWidth*.5;this.#d.value?.scrollBy({left:i,top:0})}#C(){for(const[t,e]of this.tabElements.entries())this.activeTab||0!==t?(e.active=this.activeTab===e,e.tabIndex=this.activeTab===e?0:-1):(this.activeTab=e,this.activeTab.active=!0,this.activeTab.tabIndex=0);for(const t of this.panelElements){const e=this.activeTab?.getAttribute("panel"),i=t.getAttribute("name");t.isActive=i===e,t.tabIndex=i===e?0:-1}if(this.activeTab!==this.#c&&this.activeTab&&this.tabElements.length>0&&this.#t.value){const t=Number.parseInt(window.getComputedStyle(this.activeTab).getPropertyValue("padding-inline-"+(this.activeTab===this.tabElements.at(0)?"start":"end"))),e=this.activeTab===this.tabElements.at(0)?t:this.activeTab.offsetLeft-this.tabElements[0].offsetLeft;this.#t.value.style.setProperty("--active-tab-indicator-translate",`${e}px`);const i=this.activeTab===this.tabElements.at(0)||this.activeTab===this.tabElements.at(-1)?t:0;this.#t.value.style.setProperty("--active-tab-indicator-width",this.activeTab.clientWidth-i+"px")}}#A(){const t=this.#d.value,e=t?.getBoundingClientRect();if(ow(t,ow.object.instanceOf(HTMLElement)),e){const{width:i}=e,s=t.scrollLeft+i,o=t.scrollWidth;this.isDisableOverflowEndButton=o-s<=this.#a}}#B(){const t=this.#d.value,e=t?.getBoundingClientRect();if(t&&e){const{width:i}=e;this.isShowOverflowButtons=t.scrollWidth-i>this.#a}this.#G(),this.#A()}#G(){ow(this.#d.value,ow.object.instanceOf(HTMLElement)),this.isDisableOverflowStartButton=this.#d.value.scrollLeft<=0}#L(){if(this.activeTab&&this.#t.value){const t=Number.parseInt(window.getComputedStyle(this.activeTab).getPropertyValue("padding-inline-start")),{width:e}=this.activeTab.getBoundingClientRect();this.#t.value.style.setProperty("--active-tab-indicator-width",e-t+"px"),this.#t.value.style.setProperty("--active-tab-indicator-translate",`${t}px`),this.isAfterFirstUpdated=!0}}#f(){this.#h=new ResizeObserver((t=>{t?.at(0)?.target===this.#d.value&&(this.#b&&clearTimeout(this.#b),this.#b=setTimeout((()=>{this.#B()}),this.#i))})),ow(this.#d.value,ow.object.instanceOf(HTMLElement)),this.#h.observe(this.#d.value)}#S(){for(const t of this.tabElements){const e=this.panelElements.filter((e=>e.name===t.panel))?.at(0);e?.getAttribute("id")&&(t.setAttribute("aria-controls",e.getAttribute("id")),e.setAttribute("aria-labelledby",t.getAttribute("id")))}}#y(t){this.activeTab=t,this.#C(),this.dispatchEvent(new CustomEvent("tab-show",{bubbles:!0,detail:{panel:t.panel}}))}};__decorate([state()],GlideCoreTabGroup.prototype,"activeTab",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;
@@ -5,5 +5,5 @@ import './tab.panel.js';
5
5
  import type { Meta, StoryObj } from '@storybook/web-components';
6
6
  declare const meta: Meta;
7
7
  export default meta;
8
- export declare const Primary: StoryObj;
9
- export declare const Overflow: StoryObj;
8
+ export declare const Tabs: StoryObj;
9
+ export declare const WithOverflow: StoryObj;
@@ -3,7 +3,5 @@ import './tag.js';
3
3
  import type { Meta, StoryObj } from '@storybook/web-components';
4
4
  declare const meta: Meta;
5
5
  export default meta;
6
- export declare const Default: StoryObj;
7
- export declare const DefaultWithPrefixIcon: StoryObj;
8
- export declare const Removable: StoryObj;
9
- export declare const RemovableWithIcon: StoryObj;
6
+ export declare const Tag: StoryObj;
7
+ export declare const WithIcon: StoryObj;
@@ -1,8 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/web-components';
2
2
  declare const meta: Meta;
3
3
  export default meta;
4
- export declare const Default: StoryObj;
4
+ export declare const Textarea: StoryObj;
5
5
  export declare const WithError: StoryObj;
6
- export declare const MaxLength: StoryObj;
7
- export declare const MaxLengthAndDescription: StoryObj;
8
- export declare const Tooltip: StoryObj;
@@ -4,4 +4,4 @@ import './toasts.toast.js';
4
4
  import type { Meta, StoryObj } from '@storybook/web-components';
5
5
  declare const meta: Meta;
6
6
  export default meta;
7
- export declare const Default: StoryObj;
7
+ export declare const Toasts: StoryObj;
@@ -1,7 +1,4 @@
1
1
  import type { Meta, StoryObj } from '@storybook/web-components';
2
2
  declare const meta: Meta;
3
3
  export default meta;
4
- export declare const Horizontal: StoryObj;
5
- export declare const HorizontalWithTooltip: StoryObj;
6
- export declare const Vertical: StoryObj;
7
- export declare const VerticalWithTooltip: StoryObj;
4
+ export declare const Toggle: StoryObj;
@@ -1,24 +1,7 @@
1
- import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
1
+ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";export default[css`
2
+ ${opacityAndScaleAnimation(".tooltip:popover-open")}
2
3
  ${focusOutline(".target:focus-visible")}
3
4
  `,css`
4
- @keyframes opacity-and-scale {
5
- from {
6
- opacity: 0;
7
- transform: scale(0.95);
8
- }
9
-
10
- to {
11
- opacity: 1;
12
- transform: scale(1);
13
- }
14
- }
15
-
16
- @media (prefers-reduced-motion: reduce) {
17
- .tooltip:popover-open {
18
- animation: none !important;
19
- }
20
- }
21
-
22
5
  :host {
23
6
  display: inline-block;
24
7
  }
@@ -72,7 +55,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
72
55
  }
73
56
 
74
57
  &:popover-open {
75
- animation: opacity-and-scale 250ms cubic-bezier(0.25, 0, 0.3, 1);
76
58
  display: flex;
77
59
 
78
60
  /*
@@ -8,12 +8,3 @@ import type { Meta, StoryObj } from '@storybook/web-components';
8
8
  declare const meta: Meta;
9
9
  export default meta;
10
10
  export declare const Tree: StoryObj;
11
- export declare const TreeItemDefault: StoryObj;
12
- export declare const TreeItemSelected: StoryObj;
13
- export declare const TreeItemWithChildItemsCollapsed: StoryObj;
14
- export declare const TreeItemWithChildItemsExpanded: StoryObj;
15
- export declare const TreeItemWithChildItemsNonCollapsible: StoryObj;
16
- export declare const TreeItemWithPrefixIcon: StoryObj;
17
- export declare const TreeItemWithSuffixIconButton: StoryObj;
18
- export declare const TreeItemWithMenu: StoryObj;
19
- export declare const TreeItemWithPrefixSuffixAndMenu: StoryObj;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/glide-core",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "CrowdStrike's Glide Design System components package for providing web components",
5
5
  "author": "CrowdStrike UX Team",
6
6
  "license": "Apache-2.0",
@@ -76,8 +76,6 @@
76
76
  "eslint-config-prettier": "^9.1.0",
77
77
  "eslint-plugin-lit": "^1.11.0",
78
78
  "eslint-plugin-lit-a11y": "^4.1.2",
79
- "eslint-plugin-no-only-tests": "^3.1.0",
80
- "eslint-plugin-no-skip-tests": "^1.1.0",
81
79
  "eslint-plugin-sort-class-members": "^1.20.0",
82
80
  "eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
83
81
  "eslint-plugin-unicorn": "^50.0.1",