@redvars/peacock 3.8.4 → 3.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion-item.js +28 -38
- package/dist/accordion-item.js.map +1 -1
- package/dist/accordion.js +8 -0
- package/dist/accordion.js.map +1 -1
- package/dist/button.js +17 -17
- package/dist/button.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +27 -18
- package/dist/custom-elements.json +38 -38
- package/dist/pagination.js +15 -10
- package/dist/pagination.js.map +1 -1
- package/dist/src/accordion/accordion-item.d.ts +0 -6
- package/dist/src/accordion/accordion.d.ts +5 -0
- package/dist/src/button/button/button.d.ts +16 -16
- package/dist/table.js +4 -9
- package/dist/table.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/readme.md +2 -2
- package/src/accordion/accordion-item.scss +34 -12
- package/src/accordion/accordion-item.ts +27 -38
- package/src/accordion/accordion.ts +7 -0
- package/src/button/button/button.ts +17 -17
- package/src/pagination/pagination.scss +15 -10
- package/src/table/table.scss +3 -9
- package/src/table/table.ts +1 -1
package/dist/accordion-item.js
CHANGED
|
@@ -33,6 +33,7 @@ var css_248z = i`* {
|
|
|
33
33
|
.expansion-panel .header-button {
|
|
34
34
|
position: relative;
|
|
35
35
|
display: flex;
|
|
36
|
+
flex-direction: row-reverse;
|
|
36
37
|
align-items: center;
|
|
37
38
|
width: 100%;
|
|
38
39
|
min-height: 3rem;
|
|
@@ -65,6 +66,10 @@ var css_248z = i`* {
|
|
|
65
66
|
.expansion-panel .header-button:focus-visible::before {
|
|
66
67
|
opacity: 0.12;
|
|
67
68
|
}
|
|
69
|
+
.expansion-panel .header-content {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex: 1;
|
|
72
|
+
}
|
|
68
73
|
.expansion-panel .header-label {
|
|
69
74
|
flex: 1;
|
|
70
75
|
display: flex;
|
|
@@ -154,12 +159,9 @@ var css_248z = i`* {
|
|
|
154
159
|
border-color: color-mix(in srgb, var(--color-outline-variant) 38%, transparent);
|
|
155
160
|
}
|
|
156
161
|
|
|
157
|
-
:host([toggle
|
|
158
|
-
flex-direction: row
|
|
162
|
+
:host-context([leading-toggle]) .header-button {
|
|
163
|
+
flex-direction: row;
|
|
159
164
|
justify-content: flex-end;
|
|
160
|
-
}
|
|
161
|
-
:host([toggle-position=before]) .header-label {
|
|
162
|
-
flex: 1;
|
|
163
165
|
}`;
|
|
164
166
|
|
|
165
167
|
var _AccordionItem_id;
|
|
@@ -208,12 +210,6 @@ let AccordionItem = AccordionItem_1 = class AccordionItem extends i$1 {
|
|
|
208
210
|
* Whether to hide the expand/collapse toggle indicator icon.
|
|
209
211
|
*/
|
|
210
212
|
this.hideToggle = false;
|
|
211
|
-
/**
|
|
212
|
-
* Position of the toggle icon relative to the panel title.
|
|
213
|
-
* `'after'` places it at the trailing end (default, matches M3).
|
|
214
|
-
* `'before'` places it at the leading start.
|
|
215
|
-
*/
|
|
216
|
-
this.togglePosition = 'after';
|
|
217
213
|
/** True when the `description` slot contains at least one non-empty node. */
|
|
218
214
|
this._hasDescriptionSlot = false;
|
|
219
215
|
/** True when the `heading` slot contains at least one non-empty node. */
|
|
@@ -271,35 +267,32 @@ let AccordionItem = AccordionItem_1 = class AccordionItem extends i$1 {
|
|
|
271
267
|
?disabled=${this.disabled}
|
|
272
268
|
@click=${this._handleToggle}
|
|
273
269
|
>
|
|
274
|
-
${this.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
@slotchange=${(e) => AccordionItem_1._onSlotChange(e, v => {
|
|
270
|
+
${this._renderToggleIcon()}
|
|
271
|
+
<div class="header-content">
|
|
272
|
+
<span class="header-label">
|
|
273
|
+
<span part="title" class="panel-title">
|
|
274
|
+
<slot
|
|
275
|
+
name="heading"
|
|
276
|
+
@slotchange=${(e) => AccordionItem_1._onSlotChange(e, v => {
|
|
282
277
|
this._hasHeadingSlot = v;
|
|
283
278
|
})}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
279
|
+
></slot>
|
|
280
|
+
</span>
|
|
281
|
+
<span
|
|
282
|
+
part="description"
|
|
283
|
+
class="panel-description"
|
|
284
|
+
?hidden=${!this._hasDescriptionSlot}
|
|
285
|
+
>
|
|
286
|
+
<slot
|
|
287
|
+
name="description"
|
|
288
|
+
@slotchange=${(e) => AccordionItem_1._onSlotChange(e, v => {
|
|
294
289
|
this._hasDescriptionSlot = v;
|
|
295
290
|
})}
|
|
296
|
-
|
|
291
|
+
></slot>
|
|
292
|
+
</span>
|
|
297
293
|
</span>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
${this.togglePosition === 'after'
|
|
301
|
-
? this._renderToggleIcon()
|
|
302
|
-
: A}
|
|
294
|
+
<slot name="header-actions" class="header-actions"></slot>
|
|
295
|
+
</div>
|
|
303
296
|
</button>
|
|
304
297
|
<div
|
|
305
298
|
id=${`panel-content-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
@@ -327,9 +320,6 @@ __decorate([
|
|
|
327
320
|
__decorate([
|
|
328
321
|
n({ type: Boolean, reflect: true, attribute: 'hide-toggle' })
|
|
329
322
|
], AccordionItem.prototype, "hideToggle", void 0);
|
|
330
|
-
__decorate([
|
|
331
|
-
n({ type: String, reflect: true, attribute: 'toggle-position' })
|
|
332
|
-
], AccordionItem.prototype, "togglePosition", void 0);
|
|
333
323
|
__decorate([
|
|
334
324
|
r()
|
|
335
325
|
], AccordionItem.prototype, "_hasDescriptionSlot", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-item.js","sources":["../../src/accordion/accordion-item.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport styles from './accordion-item.scss';\nimport IndividualComponent from '@/IndividualComponent.js';\n\n/**\n * @label Accordion Item\n * @tag wc-accordion-item\n * @rawTag accordion-item\n * @summary An expansion panel with a header that reveals or hides associated content.\n *\n * @slot - The body content revealed when the panel is expanded.\n * @slot heading - The panel title. Renders as `body-large` text.\n * @slot description - Optional subtitle rendered below the title. Renders as `body-small` text.\n * @slot header-actions - Actions (e.g. icon buttons) placed at the trailing end of the header, before the toggle icon.\n *\n * @part header - The header `<button>` element.\n * @part title - The title text container.\n * @part description - The description text container.\n * @part content - The expandable content region wrapper.\n *\n * @fires {CustomEvent<{ open: boolean }>} accordion-item-toggle - Fired when the panel is expanded or collapsed.\n *\n * @example\n * ```html\n * <wc-accordion-item>\n * <span slot=\"heading\">Personal information</span>\n * <span slot=\"description\">Fill in your details</span>\n * <p>Content goes here.</p>\n * </wc-accordion-item>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class AccordionItem extends LitElement {\n static styles = [styles];\n\n #id = crypto.randomUUID();\n\n /**\n * Whether the user cannot interact with the panel.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n /**\n * Whether the panel is expanded.\n */\n @property({ type: Boolean, reflect: true })\n open: boolean = false;\n\n /**\n * Whether to hide the expand/collapse toggle indicator icon.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-toggle' })\n hideToggle: boolean = false;\n\n
|
|
1
|
+
{"version":3,"file":"accordion-item.js","sources":["../../src/accordion/accordion-item.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport styles from './accordion-item.scss';\nimport IndividualComponent from '@/IndividualComponent.js';\n\n/**\n * @label Accordion Item\n * @tag wc-accordion-item\n * @rawTag accordion-item\n * @summary An expansion panel with a header that reveals or hides associated content.\n *\n * @slot - The body content revealed when the panel is expanded.\n * @slot heading - The panel title. Renders as `body-large` text.\n * @slot description - Optional subtitle rendered below the title. Renders as `body-small` text.\n * @slot header-actions - Actions (e.g. icon buttons) placed at the trailing end of the header, before the toggle icon.\n *\n * @part header - The header `<button>` element.\n * @part title - The title text container.\n * @part description - The description text container.\n * @part content - The expandable content region wrapper.\n *\n * @fires {CustomEvent<{ open: boolean }>} accordion-item-toggle - Fired when the panel is expanded or collapsed.\n *\n * @example\n * ```html\n * <wc-accordion-item>\n * <span slot=\"heading\">Personal information</span>\n * <span slot=\"description\">Fill in your details</span>\n * <p>Content goes here.</p>\n * </wc-accordion-item>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class AccordionItem extends LitElement {\n static styles = [styles];\n\n #id = crypto.randomUUID();\n\n /**\n * Whether the user cannot interact with the panel.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n /**\n * Whether the panel is expanded.\n */\n @property({ type: Boolean, reflect: true })\n open: boolean = false;\n\n /**\n * Whether to hide the expand/collapse toggle indicator icon.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-toggle' })\n hideToggle: boolean = false;\n\n /** True when the `description` slot contains at least one non-empty node. */\n @state()\n private _hasDescriptionSlot = false;\n\n /** True when the `heading` slot contains at least one non-empty node. */\n @state()\n private _hasHeadingSlot = false;\n\n @query('.header-button')\n private readonly buttonElement!: HTMLElement | null;\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n private _handleToggle() {\n if (this.disabled) return;\n this.open = !this.open;\n this.dispatchEvent(\n new CustomEvent('accordion-item-toggle', {\n bubbles: true,\n composed: true,\n detail: { open: this.open },\n }),\n );\n }\n\n private static _onSlotChange(e: Event, setter: (v: boolean) => void) {\n const slot = e.target as HTMLSlotElement;\n const nodes = slot.assignedNodes({ flatten: true });\n setter(\n nodes.some(n =>\n n.nodeType === Node.TEXT_NODE\n ? (n.textContent?.trim() ?? '') !== ''\n : true,\n ),\n );\n }\n\n private _renderToggleIcon() {\n if (this.hideToggle) return nothing;\n return html`<wc-icon\n class=\"toggle-icon\"\n name=\"keyboard_arrow_down\"\n aria-hidden=\"true\"\n ></wc-icon>`;\n }\n\n render() {\n return html`\n <div\n class=${classMap({\n 'expansion-panel': true,\n open: this.open,\n disabled: this.disabled,\n })}\n >\n <button\n id=${`panel-header-${this.#id}`}\n part=\"header\"\n class=\"header-button\"\n tabindex=${this.disabled ? '-1' : '0'}\n aria-controls=${`panel-content-${this.#id}`}\n aria-disabled=${this.disabled}\n aria-expanded=${this.open}\n ?disabled=${this.disabled}\n @click=${this._handleToggle}\n >\n ${this._renderToggleIcon()}\n <div class=\"header-content\">\n <span class=\"header-label\">\n <span part=\"title\" class=\"panel-title\">\n <slot\n name=\"heading\"\n @slotchange=${(e: Event) =>\n AccordionItem._onSlotChange(e, v => {\n this._hasHeadingSlot = v;\n })}\n ></slot>\n </span>\n <span\n part=\"description\"\n class=\"panel-description\"\n ?hidden=${!this._hasDescriptionSlot}\n >\n <slot\n name=\"description\"\n @slotchange=${(e: Event) =>\n AccordionItem._onSlotChange(e, v => {\n this._hasDescriptionSlot = v;\n })}\n ></slot>\n </span>\n </span>\n <slot name=\"header-actions\" class=\"header-actions\"></slot>\n </div>\n </button>\n <div\n id=${`panel-content-${this.#id}`}\n part=\"content\"\n class=\"panel-content\"\n role=\"region\"\n aria-labelledby=${`panel-header-${this.#id}`}\n >\n <div class=\"content-inner\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n"],"names":["LitElement","nothing","html","classMap","styles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AAEI,IAAM,aAAa,GAAA,eAAA,GAAnB,MAAM,aAAc,SAAQA,GA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EAAgB,sBAAA,CAAA,IAAI,EAAA,iBAAA,EAAA,GAAA,CAAI,CAAA,CAAE;;;;;;;KAOjD;IACH;;;AAxIO,aAAA,CAAA,MAAM,GAAG,CAACC,QAAM,CAAC;AAQxB,UAAA,CAAA;IADCC,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAM1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AACpB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAMtB,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE;AACxC,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAIpB,UAAA,CAAA;AADP,IAAAC,CAAK;AAC8B,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,MAAA,CAAA;AAI5B,UAAA,CAAA;AADP,IAAAA,CAAK;AAC0B,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AAGf,UAAA,CAAA;IADhBC,CAAK,CAAC,gBAAgB;AAC6B,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAhCzC,aAAa,GAAA,eAAA,GAAA,UAAA,CAAA;IADzB;AACY,CAAA,EAAA,aAAa,CA0IzB;;;;"}
|
package/dist/accordion.js
CHANGED
|
@@ -75,6 +75,11 @@ let Accordion = class Accordion extends i$1 {
|
|
|
75
75
|
* `'flat'` renders panels without borders or background changes — suitable for use inside cards.
|
|
76
76
|
*/
|
|
77
77
|
this.variant = 'default';
|
|
78
|
+
/**
|
|
79
|
+
* When `true`, the toggle icon is placed at the leading start of the header.
|
|
80
|
+
* When `false` (default), the icon is placed at the trailing end.
|
|
81
|
+
*/
|
|
82
|
+
this.leadingToggle = false;
|
|
78
83
|
}
|
|
79
84
|
connectedCallback() {
|
|
80
85
|
super.connectedCallback();
|
|
@@ -149,6 +154,9 @@ __decorate([
|
|
|
149
154
|
__decorate([
|
|
150
155
|
n({ type: String, reflect: true })
|
|
151
156
|
], Accordion.prototype, "variant", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
n({ type: Boolean, reflect: true, attribute: 'leading-toggle' })
|
|
159
|
+
], Accordion.prototype, "leadingToggle", void 0);
|
|
152
160
|
__decorate([
|
|
153
161
|
o({ selector: 'wc-accordion-item' })
|
|
154
162
|
], Accordion.prototype, "items", void 0);
|
package/dist/accordion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","sources":["../../src/accordion/accordion.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport styles from './accordion.scss';\nimport { AccordionItem } from './accordion-item.js';\nimport IndividualComponent from '@/IndividualComponent.js';\n\n/**\n * @label Accordion\n * @tag wc-accordion\n * @rawTag accordion\n * @summary A vertically stacked set of expansion panels.\n *\n * @example\n * ```html\n * <wc-accordion>\n * <wc-accordion-item>\n * <span slot=\"heading\">Panel 1</span>\n * <span slot=\"description\">Summary text</span>\n * Content\n * </wc-accordion-item>\n * <wc-accordion-item>\n * <span slot=\"heading\">Panel 2</span>\n * Content\n * </wc-accordion-item>\n * </wc-accordion>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Accordion extends LitElement {\n static styles = [styles];\n\n /**\n * Whether multiple panels can be expanded simultaneously.\n * When `false` (default), expanding one panel collapses all others.\n */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /**\n * Variant for the accordion.\n * `'default'` renders panels with a subtle background on expand and dividers between items.\n * `'flat'` renders panels without borders or background changes — suitable for use inside cards.\n */\n @property({ type: String, reflect: true })\n variant: 'default' | 'flat' = 'default';\n\n @queryAssignedElements({ selector: 'wc-accordion-item' })\n items!: Array<AccordionItem>;\n\n connectedCallback() {\n super.connectedCallback();\n // @ts-ignore\n // eslint-disable-next-line wc/require-listener-teardown\n this.addEventListener('accordion-item-toggle', this._onItemToggle);\n this.addEventListener('keydown', this._onKeyDown);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n // @ts-ignore\n this.removeEventListener('accordion-item-toggle', this._onItemToggle);\n this.removeEventListener('keydown', this._onKeyDown);\n }\n\n private _onItemToggle(e: CustomEvent) {\n const targetItem = e.target as AccordionItem;\n\n // Ignore events from nested accordions — only handle direct children\n if (targetItem.parentElement !== this) return;\n\n if (!this.multiple && targetItem.open) {\n this.items.forEach(item => {\n if (item !== targetItem && item.open) {\n // eslint-disable-next-line no-param-reassign\n item.open = false;\n }\n });\n }\n }\n\n private _onKeyDown(e: KeyboardEvent) {\n const focusedItemIndex = this.items.findIndex(item => {\n const root = item.shadowRoot;\n return root?.activeElement?.classList.contains('header-button');\n });\n\n if (focusedItemIndex === -1) return;\n\n let nextIndex = -1;\n\n // eslint-disable-next-line default-case\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n nextIndex = (focusedItemIndex + 1) % this.items.length;\n break;\n case 'ArrowUp':\n e.preventDefault();\n nextIndex =\n (focusedItemIndex - 1 + this.items.length) % this.items.length;\n break;\n case 'Home':\n e.preventDefault();\n nextIndex = 0;\n break;\n case 'End':\n e.preventDefault();\n nextIndex = this.items.length - 1;\n break;\n }\n\n if (nextIndex !== -1) {\n const itemToFocus = this.items[nextIndex];\n const button = itemToFocus.shadowRoot?.querySelector(\n '.header-button',\n ) as HTMLElement;\n button?.focus();\n }\n }\n\n render() {\n return html`<div class=\"accordion\"><slot></slot></div>`;\n }\n\n static Item = AccordionItem;\n}\n"],"names":["LitElement","html","styles","property","queryAssignedElements"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQA,GAAU,CAAA;AAAlC,IAAA,WAAA,GAAA;;AAGL;;;AAGG;QAEH,IAAA,CAAA,QAAQ,GAAG,KAAK;AAEhB;;;;AAIG;QAEH,IAAA,CAAA,OAAO,GAAuB,SAAS;
|
|
1
|
+
{"version":3,"file":"accordion.js","sources":["../../src/accordion/accordion.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport styles from './accordion.scss';\nimport { AccordionItem } from './accordion-item.js';\nimport IndividualComponent from '@/IndividualComponent.js';\n\n/**\n * @label Accordion\n * @tag wc-accordion\n * @rawTag accordion\n * @summary A vertically stacked set of expansion panels.\n *\n * @example\n * ```html\n * <wc-accordion>\n * <wc-accordion-item>\n * <span slot=\"heading\">Panel 1</span>\n * <span slot=\"description\">Summary text</span>\n * Content\n * </wc-accordion-item>\n * <wc-accordion-item>\n * <span slot=\"heading\">Panel 2</span>\n * Content\n * </wc-accordion-item>\n * </wc-accordion>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Accordion extends LitElement {\n static styles = [styles];\n\n /**\n * Whether multiple panels can be expanded simultaneously.\n * When `false` (default), expanding one panel collapses all others.\n */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /**\n * Variant for the accordion.\n * `'default'` renders panels with a subtle background on expand and dividers between items.\n * `'flat'` renders panels without borders or background changes — suitable for use inside cards.\n */\n @property({ type: String, reflect: true })\n variant: 'default' | 'flat' = 'default';\n\n /**\n * When `true`, the toggle icon is placed at the leading start of the header.\n * When `false` (default), the icon is placed at the trailing end.\n */\n @property({ type: Boolean, reflect: true, attribute: 'leading-toggle' })\n leadingToggle = false;\n\n @queryAssignedElements({ selector: 'wc-accordion-item' })\n items!: Array<AccordionItem>;\n\n connectedCallback() {\n super.connectedCallback();\n // @ts-ignore\n // eslint-disable-next-line wc/require-listener-teardown\n this.addEventListener('accordion-item-toggle', this._onItemToggle);\n this.addEventListener('keydown', this._onKeyDown);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n // @ts-ignore\n this.removeEventListener('accordion-item-toggle', this._onItemToggle);\n this.removeEventListener('keydown', this._onKeyDown);\n }\n\n private _onItemToggle(e: CustomEvent) {\n const targetItem = e.target as AccordionItem;\n\n // Ignore events from nested accordions — only handle direct children\n if (targetItem.parentElement !== this) return;\n\n if (!this.multiple && targetItem.open) {\n this.items.forEach(item => {\n if (item !== targetItem && item.open) {\n // eslint-disable-next-line no-param-reassign\n item.open = false;\n }\n });\n }\n }\n\n private _onKeyDown(e: KeyboardEvent) {\n const focusedItemIndex = this.items.findIndex(item => {\n const root = item.shadowRoot;\n return root?.activeElement?.classList.contains('header-button');\n });\n\n if (focusedItemIndex === -1) return;\n\n let nextIndex = -1;\n\n // eslint-disable-next-line default-case\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n nextIndex = (focusedItemIndex + 1) % this.items.length;\n break;\n case 'ArrowUp':\n e.preventDefault();\n nextIndex =\n (focusedItemIndex - 1 + this.items.length) % this.items.length;\n break;\n case 'Home':\n e.preventDefault();\n nextIndex = 0;\n break;\n case 'End':\n e.preventDefault();\n nextIndex = this.items.length - 1;\n break;\n }\n\n if (nextIndex !== -1) {\n const itemToFocus = this.items[nextIndex];\n const button = itemToFocus.shadowRoot?.querySelector(\n '.header-button',\n ) as HTMLElement;\n button?.focus();\n }\n }\n\n render() {\n return html`<div class=\"accordion\"><slot></slot></div>`;\n }\n\n static Item = AccordionItem;\n}\n"],"names":["LitElement","html","styles","property","queryAssignedElements"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQA,GAAU,CAAA;AAAlC,IAAA,WAAA,GAAA;;AAGL;;;AA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C,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AACD,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAOxC,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE;AACjD,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAGtB,UAAA,CAAA;AADC,IAAAC,CAAqB,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE;AAC3B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AA1BlB,SAAS,GAAA,UAAA,CAAA;IADrB;AACY,CAAA,EAAA,SAAS,CAwGrB;;;;"}
|
package/dist/button.js
CHANGED
|
@@ -844,30 +844,30 @@ var css_248z = i`.button {
|
|
|
844
844
|
* @overview
|
|
845
845
|
* <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>
|
|
846
846
|
*
|
|
847
|
-
* @cssprop --button-container-shape
|
|
847
|
+
* @cssprop --button-container-shape - Defines the border radius of the button container shape.
|
|
848
848
|
*
|
|
849
|
-
* @cssprop --button-container-shape-start-start
|
|
850
|
-
* @cssprop --button-container-shape-start-end
|
|
851
|
-
* @cssprop --button-container-shape-end-start
|
|
852
|
-
* @cssprop --button-container-shape-end-end
|
|
849
|
+
* @cssprop --button-container-shape-start-start - Defines the start position of the button container shape.
|
|
850
|
+
* @cssprop --button-container-shape-start-end - Defines the end position of the button container shape.
|
|
851
|
+
* @cssprop --button-container-shape-end-start - Defines the start position of the button container shape.
|
|
852
|
+
* @cssprop --button-container-shape-end-end - Defines the end position of the button container shape.
|
|
853
853
|
*
|
|
854
854
|
*
|
|
855
|
-
* @cssprop --filled-button-container-color
|
|
856
|
-
* @cssprop --filled-button-label-text-color
|
|
855
|
+
* @cssprop --filled-button-container-color - Color of the filled button container.
|
|
856
|
+
* @cssprop --filled-button-label-text-color - Text color of the filled button label.
|
|
857
857
|
*
|
|
858
|
-
* @cssprop --outlined-button-container-color
|
|
859
|
-
* @cssprop --outlined-button-label-text-color
|
|
858
|
+
* @cssprop --outlined-button-container-color - Color of the outlined button container.
|
|
859
|
+
* @cssprop --outlined-button-label-text-color - Text color of the outlined button label.
|
|
860
860
|
*
|
|
861
|
-
* @cssprop --text-button-label-text-color
|
|
861
|
+
* @cssprop --text-button-label-text-color - Text color of the text button label.
|
|
862
862
|
*
|
|
863
|
-
* @cssprop --tonal-button-container-color
|
|
864
|
-
* @cssprop --tonal-button-label-text-color
|
|
863
|
+
* @cssprop --tonal-button-container-color - Color of the tonal button container.
|
|
864
|
+
* @cssprop --tonal-button-label-text-color - Text color of the tonal button label.
|
|
865
865
|
*
|
|
866
|
-
* @cssprop --elevated-button-container-color
|
|
867
|
-
* @cssprop --elevated-button-label-text-color
|
|
866
|
+
* @cssprop --elevated-button-container-color - Color of the elevated button container.
|
|
867
|
+
* @cssprop --elevated-button-label-text-color - Text color of the elevated button label.
|
|
868
868
|
*
|
|
869
|
-
* @cssprop --neo-button-container-color
|
|
870
|
-
* @cssprop --neo-button-label-text-color
|
|
869
|
+
* @cssprop --neo-button-container-color - Color of the neo button container.
|
|
870
|
+
* @cssprop --neo-button-label-text-color - Text color of the neo button label.
|
|
871
871
|
*
|
|
872
872
|
* @fires {MouseEvent} click - Dispatched when the button is clicked.
|
|
873
873
|
*
|
|
@@ -886,7 +886,7 @@ let Button = class Button extends mixinBaseButton(mixinHyperlink(mixinDelegatesA
|
|
|
886
886
|
* When `true` (default), the icon is placed after the label (trailing).
|
|
887
887
|
* When `false`, the icon is placed before the label (leading).
|
|
888
888
|
*/
|
|
889
|
-
this.trailingIcon =
|
|
889
|
+
this.trailingIcon = false;
|
|
890
890
|
/**
|
|
891
891
|
* Button size.
|
|
892
892
|
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
package/dist/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../src/button/button/button.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { when } from 'lit/directives/when.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './button.scss';\n\nimport type {\n ButtonSize,\n ButtonLevel,\n ButtonShape,\n ButtonVariant,\n ButtonColor,\n} from '@/button/ButtonTypes.js';\nimport { isLink } from '@/__internal/utils/is-link.js';\nimport { observerSlotChangesWithCallback } from '@/__internal/utils/observe-slot-change.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '@/__internal/utils/dispatch-event-utils.js';\nimport { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';\nimport { mixinDelegatesAria } from '@/__internal/aria/delegate.js';\nimport { ARIAMixinStrict } from '@/__internal/aria/aria.js';\nimport { mixinFormSubmitter } from '@/__internal/mixins/form-submitter.js';\nimport { mixinElementInternals } from '@/__internal/mixins/element-internals.js';\nimport { mixinBaseButton } from '../base-button/base-button.js';\nimport { mixinFormAssociated } from '@/__internal/mixins/form-associated.js';\nimport { mixinHyperlink } from '@/__internal/mixins/hyperlink.js';\nexport type {\n ButtonSize,\n ButtonLevel,\n ButtonShape,\n ButtonVariant,\n ButtonColor,\n} from '@/button/ButtonTypes.js';\n\n/**\n * @label Button\n * @tag wc-button\n * @rawTag button\n *\n * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.\n * @overview\n * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape: Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color: Color of the filled button container.\n * @cssprop --filled-button-label-text-color: Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color: Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color: Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color: Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color: Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color: Color of the neo button container.\n * @cssprop --neo-button-label-text-color: Text color of the neo button label.\n *\n * @fires {MouseEvent} click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-button>Button</wc-button>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Button extends mixinBaseButton(\n mixinHyperlink(\n mixinDelegatesAria(\n mixinFormSubmitter(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n ),\n ),\n) {\n // ── Static ───────────────────────────────────────────────────────────────\n\n /** @nocollapse */ // eslint-disable-next-line\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n static override styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /**\n * When `true` (default), the icon is placed after the label (trailing).\n * When `false`, the icon is placed before the label (leading).\n */\n @property({ type: Boolean, reflect: true, attribute: 'trailing-icon' })\n trailingIcon = true;\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: ButtonSize = 'sm';\n\n /**\n * Level is preset of color and variant. If Level provided it overrides the default color and variant.\n */\n @property({ type: String }) level?: ButtonLevel;\n\n /** Shape of the button container. */\n @property({ type: String, reflect: true }) shape: ButtonShape = 'square';\n\n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property({ reflect: true }) variant: ButtonVariant = 'filled';\n\n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color: ButtonColor = 'primary';\n\n /** When true, renders the button in a loading skeleton state. */\n @property({ type: Boolean, reflect: true }) skeleton: boolean = false;\n\n /** When true, the button acts as a toggle. Use with `selected`. */\n @property({ type: Boolean, reflect: true }) toggle: boolean = false;\n\n /** When true (and `toggle` is set), the button is in the selected/pressed state. */\n @property({ type: Boolean, reflect: true }) selected: boolean = false;\n\n /** Optional tooltip text displayed on hover. */\n @property() tooltip?: string;\n\n // ── Queries ───────────────────────────────────────────────────────────────\n\n @query('.button') private readonly buttonElement!: HTMLElement | null;\n\n // ── Private fields ────────────────────────────────────────────────────────\n\n /** Cleanup returned by observerSlotChangesWithCallback for the icon slot. */\n private __iconSlotCleanup: (() => void) | null = null;\n\n /** Cleanup returned by observerSlotChangesWithCallback for the label slot. */\n private __labelSlotCleanup: (() => void) | null = null;\n\n // ── Constructor ───────────────────────────────────────────────────────────\n\n constructor() {\n super();\n this.addEventListener('click', this.__dispatchClickWithThrottle);\n }\n\n // ── Lifecycle ─────────────────────────────────────────────────────────────\n\n override disconnectedCallback() {\n // disconnect slot observers first to avoid callbacks during teardown\n try {\n this.__iconSlotCleanup?.();\n } catch (e) {\n /* ignore */\n }\n try {\n this.__labelSlotCleanup?.();\n } catch (e) {\n /* ignore */\n }\n\n super.disconnectedCallback();\n }\n\n override firstUpdated(changedProperties: Map<PropertyKey, unknown>) {\n super.firstUpdated(changedProperties);\n this.__convertTypeToVariantAndColor();\n // Initialize slot presence tracking for smooth transitions when label/icon are added/removed\n const iconSlot = this.renderRoot.querySelector(\n 'slot[name=\"icon\"]',\n ) as HTMLSlotElement | null;\n const labelSlot = this.renderRoot.querySelector(\n 'slot.label',\n ) as HTMLSlotElement | null;\n\n // Use MutationObserver-based helper so we react to content/character changes\n if (iconSlot) {\n this.__iconSlotCleanup = observerSlotChangesWithCallback(\n iconSlot,\n has => {\n this.toggleAttribute('has-icon', has);\n },\n );\n }\n\n if (labelSlot) {\n this.__labelSlotCleanup = observerSlotChangesWithCallback(\n labelSlot,\n has => {\n this.toggleAttribute('has-label', has);\n },\n );\n }\n }\n\n // ── Public methods ────────────────────────────────────────────────────────\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n // ── Private methods ───────────────────────────────────────────────────────\n\n __convertTypeToVariantAndColor() {\n if (this.level === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.level === 'secondary') {\n this.color = 'surface';\n this.variant = 'tonal';\n } else if (this.level === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.level === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n // ── Render helpers ────────────────────────────────────────────────────────\n\n renderButtonElement() {\n const isElementLink = isLink(this);\n\n const cssClasses: any = {\n button: true,\n 'native-button': !isElementLink,\n 'native-link': isElementLink,\n 'trailing-icon': this.trailingIcon,\n };\n\n // Needed for closure conformance\n const { ariaLabel, ariaHasPopup, ariaExpanded } = this as ARIAMixinStrict;\n\n if (isElementLink) {\n return html`<a\n class=${classMap(cssClasses)}\n id=\"link\"\n href=${this.href}\n target=${this.target}\n tabindex=${this.disabled ? '-1' : '0'}\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\"\n aria-describedby=${ifDefined(\n this.softDisabled ? DISABLED_REASON_ID : undefined,\n )}\n ?aria-disabled=${this.softDisabled}\n >\n ${this.renderButtonContent()}\n </a>`;\n }\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\"\n aria-describedby=${ifDefined(\n this.softDisabled ? DISABLED_REASON_ID : undefined,\n )}\n ?aria-disabled=${this.softDisabled}\n ?disabled=${this.disabled}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html` <slot class=\"icon-slot\" name=\"icon\"></slot>\n <slot class=\"label\"></slot>\n <div class=\"touch\"></div>\n\n ${this.renderDisabledReason(this.softDisabled)}`;\n }\n\n renderDisabledReason(softDisabled: boolean) {\n if (softDisabled)\n return html`<div\n id=${DISABLED_REASON_ID}\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n ${this.disabledReason}\n </div>`;\n return nothing;\n }\n\n renderTooltip() {\n if (this.tooltip) {\n const buttonId = isLink(this) ? 'link' : 'button';\n return html`<wc-tooltip class=\"tooltip\" for=${buttonId}\n >${this.tooltip}</wc-tooltip\n >`;\n }\n return nothing;\n }\n\n // ── Render ────────────────────────────────────────────────────────────────\n\n override render() {\n const buttonId = isLink(this) ? 'link' : 'button';\n\n return html`\n <wc-focus-ring class=\"focus-ring\" for=${buttonId}></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n ${when(\n this.variant === 'neo',\n () => html`<div class=\"neo-background\"></div>`,\n )}\n <div class=\"background\"></div>\n ${when(\n this.variant === 'outlined' || this.variant === 'neo',\n () => html`<div class=\"outline\"></div>`,\n )}\n <wc-ripple class=\"ripple\" for=${buttonId}></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n ${this.renderButtonElement()} ${this.renderTooltip()}\n `;\n }\n}\n"],"names":["LitElement","html","classMap","nothing","ifDefined","when","styles","property","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,OAAA,EAAA,MAAA,CAAA;AAY5C,UAAA,CAAA;AAA5B,IAAAA,GAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAAoC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAKlC,UAAA,CAAA;AAA5B,IAAAA,GAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAAiC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAGhB,UAAA,CAAA;IAA3CA,GAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAA4B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IAA3CA,GAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAA0B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAGxB,UAAA,CAAA;IAA3CA,GAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAA4B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1D,UAAA,CAAA;AAAX,IAAAA,GAAQ;AAAoB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAIM,UAAA,CAAA;IAAlCC,GAAK,CAAC,SAAS;AAAsD,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAzE3D,MAAM,GAAA,UAAA,CAAA;IADlB;AACY,CAAA,EAAA,MAAM,CAiSlB;;;;"}
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../src/button/button/button.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { when } from 'lit/directives/when.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './button.scss';\n\nimport type {\n ButtonSize,\n ButtonLevel,\n ButtonShape,\n ButtonVariant,\n ButtonColor,\n} from '@/button/ButtonTypes.js';\nimport { isLink } from '@/__internal/utils/is-link.js';\nimport { observerSlotChangesWithCallback } from '@/__internal/utils/observe-slot-change.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '@/__internal/utils/dispatch-event-utils.js';\nimport { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';\nimport { mixinDelegatesAria } from '@/__internal/aria/delegate.js';\nimport { ARIAMixinStrict } from '@/__internal/aria/aria.js';\nimport { mixinFormSubmitter } from '@/__internal/mixins/form-submitter.js';\nimport { mixinElementInternals } from '@/__internal/mixins/element-internals.js';\nimport { mixinBaseButton } from '../base-button/base-button.js';\nimport { mixinFormAssociated } from '@/__internal/mixins/form-associated.js';\nimport { mixinHyperlink } from '@/__internal/mixins/hyperlink.js';\nexport type {\n ButtonSize,\n ButtonLevel,\n ButtonShape,\n ButtonVariant,\n ButtonColor,\n} from '@/button/ButtonTypes.js';\n\n/**\n * @label Button\n * @tag wc-button\n * @rawTag button\n *\n * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.\n * @overview\n * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>\n *\n * @cssprop --button-container-shape - Defines the border radius of the button container shape.\n *\n * @cssprop --button-container-shape-start-start - Defines the start position of the button container shape.\n * @cssprop --button-container-shape-start-end - Defines the end position of the button container shape.\n * @cssprop --button-container-shape-end-start - Defines the start position of the button container shape.\n * @cssprop --button-container-shape-end-end - Defines the end position of the button container shape.\n *\n *\n * @cssprop --filled-button-container-color - Color of the filled button container.\n * @cssprop --filled-button-label-text-color - Text color of the filled button label.\n *\n * @cssprop --outlined-button-container-color - Color of the outlined button container.\n * @cssprop --outlined-button-label-text-color - Text color of the outlined button label.\n *\n * @cssprop --text-button-label-text-color - Text color of the text button label.\n *\n * @cssprop --tonal-button-container-color - Color of the tonal button container.\n * @cssprop --tonal-button-label-text-color - Text color of the tonal button label.\n *\n * @cssprop --elevated-button-container-color - Color of the elevated button container.\n * @cssprop --elevated-button-label-text-color - Text color of the elevated button label.\n *\n * @cssprop --neo-button-container-color - Color of the neo button container.\n * @cssprop --neo-button-label-text-color - Text color of the neo button label.\n *\n * @fires {MouseEvent} click - Dispatched when the button is clicked.\n *\n * @example\n * ```html\n * <wc-button>Button</wc-button>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class Button extends mixinBaseButton(\n mixinHyperlink(\n mixinDelegatesAria(\n mixinFormSubmitter(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n ),\n ),\n) {\n // ── Static ───────────────────────────────────────────────────────────────\n\n /** @nocollapse */ // eslint-disable-next-line\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n static override styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /**\n * When `true` (default), the icon is placed after the label (trailing).\n * When `false`, the icon is placed before the label (leading).\n */\n @property({ type: Boolean, reflect: true, attribute: 'trailing-icon' })\n trailingIcon = false;\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: ButtonSize = 'sm';\n\n /**\n * Level is preset of color and variant. If Level provided it overrides the default color and variant.\n */\n @property({ type: String }) level?: ButtonLevel;\n\n /** Shape of the button container. */\n @property({ type: String, reflect: true }) shape: ButtonShape = 'square';\n\n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property({ reflect: true }) variant: ButtonVariant = 'filled';\n\n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color: ButtonColor = 'primary';\n\n /** When true, renders the button in a loading skeleton state. */\n @property({ type: Boolean, reflect: true }) skeleton: boolean = false;\n\n /** When true, the button acts as a toggle. Use with `selected`. */\n @property({ type: Boolean, reflect: true }) toggle: boolean = false;\n\n /** When true (and `toggle` is set), the button is in the selected/pressed state. */\n @property({ type: Boolean, reflect: true }) selected: boolean = false;\n\n /** Optional tooltip text displayed on hover. */\n @property() tooltip?: string;\n\n // ── Queries ───────────────────────────────────────────────────────────────\n\n @query('.button') private readonly buttonElement!: HTMLElement | null;\n\n // ── Private fields ────────────────────────────────────────────────────────\n\n /** Cleanup returned by observerSlotChangesWithCallback for the icon slot. */\n private __iconSlotCleanup: (() => void) | null = null;\n\n /** Cleanup returned by observerSlotChangesWithCallback for the label slot. */\n private __labelSlotCleanup: (() => void) | null = null;\n\n // ── Constructor ───────────────────────────────────────────────────────────\n\n constructor() {\n super();\n this.addEventListener('click', this.__dispatchClickWithThrottle);\n }\n\n // ── Lifecycle ─────────────────────────────────────────────────────────────\n\n override disconnectedCallback() {\n // disconnect slot observers first to avoid callbacks during teardown\n try {\n this.__iconSlotCleanup?.();\n } catch (e) {\n /* ignore */\n }\n try {\n this.__labelSlotCleanup?.();\n } catch (e) {\n /* ignore */\n }\n\n super.disconnectedCallback();\n }\n\n override firstUpdated(changedProperties: Map<PropertyKey, unknown>) {\n super.firstUpdated(changedProperties);\n this.__convertTypeToVariantAndColor();\n // Initialize slot presence tracking for smooth transitions when label/icon are added/removed\n const iconSlot = this.renderRoot.querySelector(\n 'slot[name=\"icon\"]',\n ) as HTMLSlotElement | null;\n const labelSlot = this.renderRoot.querySelector(\n 'slot.label',\n ) as HTMLSlotElement | null;\n\n // Use MutationObserver-based helper so we react to content/character changes\n if (iconSlot) {\n this.__iconSlotCleanup = observerSlotChangesWithCallback(\n iconSlot,\n has => {\n this.toggleAttribute('has-icon', has);\n },\n );\n }\n\n if (labelSlot) {\n this.__labelSlotCleanup = observerSlotChangesWithCallback(\n labelSlot,\n has => {\n this.toggleAttribute('has-label', has);\n },\n );\n }\n }\n\n // ── Public methods ────────────────────────────────────────────────────────\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n // ── Private methods ───────────────────────────────────────────────────────\n\n __convertTypeToVariantAndColor() {\n if (this.level === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.level === 'secondary') {\n this.color = 'surface';\n this.variant = 'tonal';\n } else if (this.level === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.level === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n // ── Render helpers ────────────────────────────────────────────────────────\n\n renderButtonElement() {\n const isElementLink = isLink(this);\n\n const cssClasses: any = {\n button: true,\n 'native-button': !isElementLink,\n 'native-link': isElementLink,\n 'trailing-icon': this.trailingIcon,\n };\n\n // Needed for closure conformance\n const { ariaLabel, ariaHasPopup, ariaExpanded } = this as ARIAMixinStrict;\n\n if (isElementLink) {\n return html`<a\n class=${classMap(cssClasses)}\n id=\"link\"\n href=${this.href}\n target=${this.target}\n tabindex=${this.disabled ? '-1' : '0'}\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\"\n aria-describedby=${ifDefined(\n this.softDisabled ? DISABLED_REASON_ID : undefined,\n )}\n ?aria-disabled=${this.softDisabled}\n >\n ${this.renderButtonContent()}\n </a>`;\n }\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\"\n aria-describedby=${ifDefined(\n this.softDisabled ? DISABLED_REASON_ID : undefined,\n )}\n ?aria-disabled=${this.softDisabled}\n ?disabled=${this.disabled}\n >\n ${this.renderButtonContent()}\n </button>\n ${this.renderTooltip()}`;\n }\n\n renderButtonContent() {\n return html` <slot class=\"icon-slot\" name=\"icon\"></slot>\n <slot class=\"label\"></slot>\n <div class=\"touch\"></div>\n\n ${this.renderDisabledReason(this.softDisabled)}`;\n }\n\n renderDisabledReason(softDisabled: boolean) {\n if (softDisabled)\n return html`<div\n id=${DISABLED_REASON_ID}\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n ${this.disabledReason}\n </div>`;\n return nothing;\n }\n\n renderTooltip() {\n if (this.tooltip) {\n const buttonId = isLink(this) ? 'link' : 'button';\n return html`<wc-tooltip class=\"tooltip\" for=${buttonId}\n >${this.tooltip}</wc-tooltip\n >`;\n }\n return nothing;\n }\n\n // ── Render ────────────────────────────────────────────────────────────────\n\n override render() {\n const buttonId = isLink(this) ? 'link' : 'button';\n\n return html`\n <wc-focus-ring class=\"focus-ring\" for=${buttonId}></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n ${when(\n this.variant === 'neo',\n () => html`<div class=\"neo-background\"></div>`,\n )}\n <div class=\"background\"></div>\n ${when(\n this.variant === 'outlined' || this.variant === 'neo',\n () => html`<div class=\"outline\"></div>`,\n )}\n <wc-ripple class=\"ripple\" for=${buttonId}></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n ${this.renderButtonElement()} ${this.renderTooltip()}\n `;\n }\n}\n"],"names":["LitElement","html","classMap","nothing","ifDefined","when","styles","property","query"],"mappings":";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EAAE;AAAiC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAGhB,UAAA,CAAA;IAA3CA,GAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAA4B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IAA3CA,GAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAA0B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAGxB,UAAA,CAAA;IAA3CA,GAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAA4B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1D,UAAA,CAAA;AAAX,IAAAA,GAAQ;AAAoB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAIM,UAAA,CAAA;IAAlCC,GAAK,CAAC,SAAS;AAAsD,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAzE3D,MAAM,GAAA,UAAA,CAAA;IADlB;AACY,CAAA,EAAA,MAAM,CAiSlB;;;;"}
|
|
@@ -27,6 +27,15 @@
|
|
|
27
27
|
"default": "'default'",
|
|
28
28
|
"description": "Variant for the accordion.\n`'default'` renders panels with a subtle background on expand and dividers between items.\n`'flat'` renders panels without borders or background changes — suitable for use inside cards.",
|
|
29
29
|
"fieldName": "variant"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "leading-toggle",
|
|
33
|
+
"type": {
|
|
34
|
+
"text": "boolean"
|
|
35
|
+
},
|
|
36
|
+
"default": "false",
|
|
37
|
+
"description": "When `true`, the toggle icon is placed at the leading start of the header.\nWhen `false` (default), the icon is placed at the trailing end.",
|
|
38
|
+
"fieldName": "leadingToggle"
|
|
30
39
|
}
|
|
31
40
|
],
|
|
32
41
|
"superclass": {
|
|
@@ -485,7 +494,7 @@
|
|
|
485
494
|
"rawTag": "button",
|
|
486
495
|
"summary": "Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.",
|
|
487
496
|
"overview": "<p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>",
|
|
488
|
-
"cssprop": "--neo-button-label-text-color
|
|
497
|
+
"cssprop": "--neo-button-label-text-color - Text color of the neo button label.",
|
|
489
498
|
"fires": "click - Dispatched when the button is clicked.",
|
|
490
499
|
"example": "```html\n<wc-button>Button</wc-button>\n```",
|
|
491
500
|
"tags": "display",
|
|
@@ -495,67 +504,67 @@
|
|
|
495
504
|
"cssProperties": [
|
|
496
505
|
{
|
|
497
506
|
"description": "Defines the border radius of the button container shape.",
|
|
498
|
-
"name": "--button-container-shape
|
|
507
|
+
"name": "--button-container-shape"
|
|
499
508
|
},
|
|
500
509
|
{
|
|
501
510
|
"description": "Defines the start position of the button container shape.",
|
|
502
|
-
"name": "--button-container-shape-start-start
|
|
511
|
+
"name": "--button-container-shape-start-start"
|
|
503
512
|
},
|
|
504
513
|
{
|
|
505
514
|
"description": "Defines the end position of the button container shape.",
|
|
506
|
-
"name": "--button-container-shape-start-end
|
|
515
|
+
"name": "--button-container-shape-start-end"
|
|
507
516
|
},
|
|
508
517
|
{
|
|
509
518
|
"description": "Defines the start position of the button container shape.",
|
|
510
|
-
"name": "--button-container-shape-end-start
|
|
519
|
+
"name": "--button-container-shape-end-start"
|
|
511
520
|
},
|
|
512
521
|
{
|
|
513
522
|
"description": "Defines the end position of the button container shape.",
|
|
514
|
-
"name": "--button-container-shape-end-end
|
|
523
|
+
"name": "--button-container-shape-end-end"
|
|
515
524
|
},
|
|
516
525
|
{
|
|
517
526
|
"description": "Color of the filled button container.",
|
|
518
|
-
"name": "--filled-button-container-color
|
|
527
|
+
"name": "--filled-button-container-color"
|
|
519
528
|
},
|
|
520
529
|
{
|
|
521
530
|
"description": "Text color of the filled button label.",
|
|
522
|
-
"name": "--filled-button-label-text-color
|
|
531
|
+
"name": "--filled-button-label-text-color"
|
|
523
532
|
},
|
|
524
533
|
{
|
|
525
534
|
"description": "Color of the outlined button container.",
|
|
526
|
-
"name": "--outlined-button-container-color
|
|
535
|
+
"name": "--outlined-button-container-color"
|
|
527
536
|
},
|
|
528
537
|
{
|
|
529
538
|
"description": "Text color of the outlined button label.",
|
|
530
|
-
"name": "--outlined-button-label-text-color
|
|
539
|
+
"name": "--outlined-button-label-text-color"
|
|
531
540
|
},
|
|
532
541
|
{
|
|
533
542
|
"description": "Text color of the text button label.",
|
|
534
|
-
"name": "--text-button-label-text-color
|
|
543
|
+
"name": "--text-button-label-text-color"
|
|
535
544
|
},
|
|
536
545
|
{
|
|
537
546
|
"description": "Color of the tonal button container.",
|
|
538
|
-
"name": "--tonal-button-container-color
|
|
547
|
+
"name": "--tonal-button-container-color"
|
|
539
548
|
},
|
|
540
549
|
{
|
|
541
550
|
"description": "Text color of the tonal button label.",
|
|
542
|
-
"name": "--tonal-button-label-text-color
|
|
551
|
+
"name": "--tonal-button-label-text-color"
|
|
543
552
|
},
|
|
544
553
|
{
|
|
545
554
|
"description": "Color of the elevated button container.",
|
|
546
|
-
"name": "--elevated-button-container-color
|
|
555
|
+
"name": "--elevated-button-container-color"
|
|
547
556
|
},
|
|
548
557
|
{
|
|
549
558
|
"description": "Text color of the elevated button label.",
|
|
550
|
-
"name": "--elevated-button-label-text-color
|
|
559
|
+
"name": "--elevated-button-label-text-color"
|
|
551
560
|
},
|
|
552
561
|
{
|
|
553
562
|
"description": "Color of the neo button container.",
|
|
554
|
-
"name": "--neo-button-container-color
|
|
563
|
+
"name": "--neo-button-container-color"
|
|
555
564
|
},
|
|
556
565
|
{
|
|
557
566
|
"description": "Text color of the neo button label.",
|
|
558
|
-
"name": "--neo-button-label-text-color
|
|
567
|
+
"name": "--neo-button-label-text-color"
|
|
559
568
|
}
|
|
560
569
|
],
|
|
561
570
|
"events": [
|
|
@@ -573,7 +582,7 @@
|
|
|
573
582
|
"type": {
|
|
574
583
|
"text": "boolean"
|
|
575
584
|
},
|
|
576
|
-
"default": "
|
|
585
|
+
"default": "false",
|
|
577
586
|
"description": "When `true` (default), the icon is placed after the label (trailing).\nWhen `false`, the icon is placed before the label (leading).",
|
|
578
587
|
"fieldName": "trailingIcon"
|
|
579
588
|
},
|