@spectrum-web-components/button 1.12.0-snapshot.20260422090428 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +24 -9
- package/package.json +9 -9
- package/src/Button.d.ts +37 -2
- package/src/Button.dev.js +26 -2
- package/src/Button.dev.js.map +2 -2
- package/src/Button.js +2 -2
- package/src/Button.js.map +3 -3
package/custom-elements.json
CHANGED
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"type": {
|
|
58
58
|
"text": "array"
|
|
59
59
|
},
|
|
60
|
-
"default": "[ 'accent', 'primary', 'secondary', 'negative', 'white', 'black', ]"
|
|
60
|
+
"default": "[ 'accent', 'primary', 'secondary', 'negative', 'white', 'black', ]",
|
|
61
|
+
"deprecated": "The `VALID_VARIANTS` export is deprecated and will be removed\nin a future release."
|
|
61
62
|
},
|
|
62
63
|
{
|
|
63
64
|
"kind": "variable",
|
|
@@ -65,7 +66,8 @@
|
|
|
65
66
|
"type": {
|
|
66
67
|
"text": "array"
|
|
67
68
|
},
|
|
68
|
-
"default": "['white', 'black']"
|
|
69
|
+
"default": "['white', 'black']",
|
|
70
|
+
"deprecated": "The `VALID_STATIC_COLORS` export is deprecated and will be\nremoved in a future release."
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
73
|
"kind": "class",
|
|
@@ -169,6 +171,7 @@
|
|
|
169
171
|
"privacy": "public",
|
|
170
172
|
"default": "'fill'",
|
|
171
173
|
"description": "The visual treatment to apply to this button.",
|
|
174
|
+
"deprecated": "The `treatment` property is deprecated and will be replaced by\n`fill-style` in a future release.",
|
|
172
175
|
"attribute": "treatment",
|
|
173
176
|
"reflects": true
|
|
174
177
|
},
|
|
@@ -176,7 +179,8 @@
|
|
|
176
179
|
"kind": "field",
|
|
177
180
|
"name": "quiet",
|
|
178
181
|
"privacy": "public",
|
|
179
|
-
"description": "Style this button to be less obvious",
|
|
182
|
+
"description": "Style this button to be less obvious.",
|
|
183
|
+
"deprecated": "The `quiet` property is deprecated and will be removed in a\nfuture release.",
|
|
180
184
|
"type": {
|
|
181
185
|
"text": "boolean"
|
|
182
186
|
},
|
|
@@ -185,15 +189,24 @@
|
|
|
185
189
|
{
|
|
186
190
|
"kind": "field",
|
|
187
191
|
"name": "noWrap",
|
|
192
|
+
"privacy": "public",
|
|
193
|
+
"description": "Disables text wrapping within the button component's label.\nPlease note that this option is not a part of the design specification\nand should be used carefully, with consideration of this overflow behavior\nand the readability of the button's content.",
|
|
194
|
+
"deprecated": "The `no-wrap` attribute is deprecated and will be replaced by\n`truncate` in a future release.",
|
|
188
195
|
"type": {
|
|
189
196
|
"text": "boolean"
|
|
190
197
|
},
|
|
191
|
-
"privacy": "public",
|
|
192
|
-
"default": "false",
|
|
193
|
-
"description": "Disables text wrapping within the button component's label.\nPlease note that this option is not a part of the design specification\nand should be used carefully, with consideration of this overflow behavior\nand the readability of the button's content.",
|
|
194
198
|
"attribute": "no-wrap",
|
|
195
199
|
"reflects": true
|
|
196
200
|
},
|
|
201
|
+
{
|
|
202
|
+
"kind": "field",
|
|
203
|
+
"name": "_noWrap",
|
|
204
|
+
"type": {
|
|
205
|
+
"text": "boolean"
|
|
206
|
+
},
|
|
207
|
+
"privacy": "private",
|
|
208
|
+
"default": "false"
|
|
209
|
+
},
|
|
197
210
|
{
|
|
198
211
|
"kind": "method",
|
|
199
212
|
"name": "renderButton",
|
|
@@ -498,11 +511,13 @@
|
|
|
498
511
|
},
|
|
499
512
|
"default": "'fill'",
|
|
500
513
|
"description": "The visual treatment to apply to this button.",
|
|
514
|
+
"deprecated": "The `treatment` property is deprecated and will be replaced by\n`fill-style` in a future release.",
|
|
501
515
|
"fieldName": "treatment"
|
|
502
516
|
},
|
|
503
517
|
{
|
|
504
518
|
"name": "quiet",
|
|
505
|
-
"description": "Style this button to be less obvious",
|
|
519
|
+
"description": "Style this button to be less obvious.",
|
|
520
|
+
"deprecated": "The `quiet` property is deprecated and will be removed in a\nfuture release.",
|
|
506
521
|
"type": {
|
|
507
522
|
"text": "boolean"
|
|
508
523
|
},
|
|
@@ -510,11 +525,11 @@
|
|
|
510
525
|
},
|
|
511
526
|
{
|
|
512
527
|
"name": "no-wrap",
|
|
528
|
+
"description": "Disables text wrapping within the button component's label.\nPlease note that this option is not a part of the design specification\nand should be used carefully, with consideration of this overflow behavior\nand the readability of the button's content.",
|
|
529
|
+
"deprecated": "The `no-wrap` attribute is deprecated and will be replaced by\n`truncate` in a future release.",
|
|
513
530
|
"type": {
|
|
514
531
|
"text": "boolean"
|
|
515
532
|
},
|
|
516
|
-
"default": "false",
|
|
517
|
-
"description": "Disables text wrapping within the button component's label.\nPlease note that this option is not a part of the design specification\nand should be used carefully, with consideration of this overflow behavior\nand the readability of the button's content.",
|
|
518
533
|
"fieldName": "noWrap"
|
|
519
534
|
},
|
|
520
535
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/button",
|
|
3
|
-
"version": "1.12.0
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe",
|
|
@@ -79,14 +79,14 @@
|
|
|
79
79
|
],
|
|
80
80
|
"types": "./src/index.d.ts",
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@spectrum-web-components/base": "1.12.0
|
|
83
|
-
"@spectrum-web-components/clear-button": "1.12.0
|
|
84
|
-
"@spectrum-web-components/close-button": "1.12.0
|
|
85
|
-
"@spectrum-web-components/icon": "1.12.0
|
|
86
|
-
"@spectrum-web-components/icons-ui": "1.12.0
|
|
87
|
-
"@spectrum-web-components/progress-circle": "1.12.0
|
|
88
|
-
"@spectrum-web-components/reactive-controllers": "1.12.0
|
|
89
|
-
"@spectrum-web-components/shared": "1.12.0
|
|
82
|
+
"@spectrum-web-components/base": "1.12.0",
|
|
83
|
+
"@spectrum-web-components/clear-button": "1.12.0",
|
|
84
|
+
"@spectrum-web-components/close-button": "1.12.0",
|
|
85
|
+
"@spectrum-web-components/icon": "1.12.0",
|
|
86
|
+
"@spectrum-web-components/icons-ui": "1.12.0",
|
|
87
|
+
"@spectrum-web-components/progress-circle": "1.12.0",
|
|
88
|
+
"@spectrum-web-components/reactive-controllers": "1.12.0",
|
|
89
|
+
"@spectrum-web-components/shared": "1.12.0"
|
|
90
90
|
},
|
|
91
91
|
"keywords": [
|
|
92
92
|
"design-system",
|
package/src/Button.d.ts
CHANGED
|
@@ -12,11 +12,35 @@
|
|
|
12
12
|
import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
|
|
13
13
|
import { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';
|
|
14
14
|
import { ButtonBase } from './ButtonBase.js';
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated The `DeprecatedButtonVariants` type export is deprecated and will
|
|
17
|
+
* be removed in a future release.
|
|
18
|
+
*/
|
|
15
19
|
export type DeprecatedButtonVariants = 'cta' | 'overBackground';
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated The `ButtonStaticColors` type export is deprecated and will be
|
|
22
|
+
* removed in a future release.
|
|
23
|
+
*/
|
|
16
24
|
export type ButtonStaticColors = 'white' | 'black';
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated The `ButtonVariants` type export is deprecated and will be
|
|
27
|
+
* removed in a future release.
|
|
28
|
+
*/
|
|
17
29
|
export type ButtonVariants = 'accent' | 'primary' | 'secondary' | 'negative' | ButtonStaticColors | DeprecatedButtonVariants;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated The `VALID_VARIANTS` export is deprecated and will be removed
|
|
32
|
+
* in a future release.
|
|
33
|
+
*/
|
|
18
34
|
export declare const VALID_VARIANTS: string[];
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated The `VALID_STATIC_COLORS` export is deprecated and will be
|
|
37
|
+
* removed in a future release.
|
|
38
|
+
*/
|
|
19
39
|
export declare const VALID_STATIC_COLORS: string[];
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated The `ButtonTreatments` type export is deprecated and will be
|
|
42
|
+
* removed in a future release.
|
|
43
|
+
*/
|
|
20
44
|
export type ButtonTreatments = 'fill' | 'outline';
|
|
21
45
|
declare const Button_base: typeof ButtonBase & import("@spectrum-web-components/base").Constructor<import("@spectrum-web-components/base").SizedElementInterface> & import("@spectrum-web-components/base").SizedElementConstructor;
|
|
22
46
|
/**
|
|
@@ -48,10 +72,16 @@ export declare class Button extends Button_base {
|
|
|
48
72
|
staticColor?: 'black' | 'white';
|
|
49
73
|
/**
|
|
50
74
|
* The visual treatment to apply to this button.
|
|
75
|
+
*
|
|
76
|
+
* @deprecated The `treatment` property is deprecated and will be replaced by
|
|
77
|
+
* `fill-style` in a future release.
|
|
51
78
|
*/
|
|
52
79
|
treatment: ButtonTreatments;
|
|
53
80
|
/**
|
|
54
|
-
* Style this button to be less obvious
|
|
81
|
+
* Style this button to be less obvious.
|
|
82
|
+
*
|
|
83
|
+
* @deprecated The `quiet` property is deprecated and will be removed in a
|
|
84
|
+
* future release.
|
|
55
85
|
*/
|
|
56
86
|
set quiet(quiet: boolean);
|
|
57
87
|
/**
|
|
@@ -59,8 +89,13 @@ export declare class Button extends Button_base {
|
|
|
59
89
|
* Please note that this option is not a part of the design specification
|
|
60
90
|
* and should be used carefully, with consideration of this overflow behavior
|
|
61
91
|
* and the readability of the button's content.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated The `no-wrap` attribute is deprecated and will be replaced by
|
|
94
|
+
* `truncate` in a future release.
|
|
62
95
|
*/
|
|
63
|
-
noWrap: boolean;
|
|
96
|
+
set noWrap(value: boolean);
|
|
97
|
+
get noWrap(): boolean;
|
|
98
|
+
private _noWrap;
|
|
64
99
|
get quiet(): boolean;
|
|
65
100
|
protected firstUpdated(changes: PropertyValues<this>): void;
|
|
66
101
|
protected renderButton(): TemplateResult;
|
package/src/Button.dev.js
CHANGED
|
@@ -37,7 +37,7 @@ export class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {
|
|
|
37
37
|
this.pending = false;
|
|
38
38
|
this._variant = "accent";
|
|
39
39
|
this.treatment = "fill";
|
|
40
|
-
this.
|
|
40
|
+
this._noWrap = false;
|
|
41
41
|
this.pendingStateController = new PendingStateController(this);
|
|
42
42
|
}
|
|
43
43
|
static get styles() {
|
|
@@ -118,6 +118,30 @@ export class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {
|
|
|
118
118
|
}
|
|
119
119
|
set quiet(quiet) {
|
|
120
120
|
this.treatment = quiet ? "outline" : "fill";
|
|
121
|
+
if (true) {
|
|
122
|
+
window.__swc.warn(
|
|
123
|
+
this,
|
|
124
|
+
`The "quiet" property on <${this.localName}> has been deprecated and will be removed in a future release.`,
|
|
125
|
+
"https://opensource.adobe.com/spectrum-web-components/components/button",
|
|
126
|
+
{ level: "deprecation" }
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
set noWrap(value) {
|
|
131
|
+
const oldValue = this._noWrap;
|
|
132
|
+
this._noWrap = value;
|
|
133
|
+
this.requestUpdate("noWrap", oldValue);
|
|
134
|
+
if (true) {
|
|
135
|
+
window.__swc.warn(
|
|
136
|
+
this,
|
|
137
|
+
`The "no-wrap" attribute on <${this.localName}> has been deprecated and will be replaced by "truncate" in a future release.`,
|
|
138
|
+
"https://opensource.adobe.com/spectrum-web-components/components/button",
|
|
139
|
+
{ level: "deprecation" }
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
get noWrap() {
|
|
144
|
+
return this._noWrap;
|
|
121
145
|
}
|
|
122
146
|
get quiet() {
|
|
123
147
|
return this.treatment === "outline";
|
|
@@ -157,5 +181,5 @@ __decorateClass([
|
|
|
157
181
|
], Button.prototype, "quiet", 1);
|
|
158
182
|
__decorateClass([
|
|
159
183
|
property({ type: Boolean, attribute: "no-wrap", reflect: true })
|
|
160
|
-
], Button.prototype, "noWrap",
|
|
184
|
+
], Button.prototype, "noWrap", 1);
|
|
161
185
|
//# sourceMappingURL=Button.dev.js.map
|
package/src/Button.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Button.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nimport buttonStyles from './button.css.js';\nimport { ButtonBase } from './ButtonBase.dev.js'\n\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\nexport type ButtonStaticColors = 'white' | 'black';\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStaticColors\n | DeprecatedButtonVariants;\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\nexport const VALID_STATIC_COLORS = ['white', 'black'];\n\nexport type ButtonTreatments = 'fill' | 'outline';\n\n/**\n * @element sp-button\n *\n * @slot - text label of the Button\n * @slot icon - The icon to use for Button\n */\nexport class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n @property({ type: String, attribute: 'pending-label' })\n public pendingLabel = 'Pending';\n\n // Use this property to set the button into a pending state\n @property({ type: Boolean, reflect: true, attribute: true })\n public pending = false;\n\n public pendingStateController: PendingStateController<this>;\n\n /**\n * Initializes the `PendingStateController` for the Button component.\n * The `PendingStateController` manages the pending state of the Button.\n */\n constructor() {\n super();\n this.pendingStateController = new PendingStateController(this);\n }\n\n public override click(): void {\n if (this.pending) {\n return;\n }\n super.click();\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property()\n public get variant(): ButtonVariants {\n return this._variant;\n }\n public set variant(variant: ButtonVariants) {\n if (variant === this.variant) {\n return;\n }\n\n this.requestUpdate('variant', this.variant);\n switch (variant) {\n case 'cta':\n this._variant = 'accent';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"cta\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"variant='accent'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#variants',\n { level: 'deprecation' }\n );\n }\n break;\n case 'overBackground':\n this.removeAttribute('variant');\n this.staticColor = 'white';\n this.treatment = 'outline';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"overBackground\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"staticColor='white'\" with \"treatment='outline'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n return;\n case 'white':\n this.staticColor = 'white';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"white\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case 'black':\n this.staticColor = 'black';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='black'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case null:\n return;\n default:\n if (!VALID_VARIANTS.includes(variant)) {\n this._variant = 'accent';\n } else {\n this._variant = variant;\n }\n break;\n }\n this.setAttribute('variant', this.variant);\n }\n private _variant: ButtonVariants = 'accent';\n\n /**\n * The static color variant to use for this button.\n */\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n /**\n * The visual treatment to apply to this button.\n */\n @property({ reflect: true })\n public treatment: ButtonTreatments = 'fill';\n\n /**\n * Style this button to be less obvious\n */\n @property({ type: Boolean })\n public set quiet(quiet: boolean) {\n this.treatment = quiet ? 'outline' : 'fill';\n }\n\n /**\n * Disables text wrapping within the button component's label.\n * Please note that this option is not a part of the design specification\n * and should be used carefully, with consideration of this overflow behavior\n * and the readability of the button's content.\n */\n @property({ type: Boolean, attribute: 'no-wrap', reflect: true })\n public noWrap = false;\n\n public get quiet(): boolean {\n return this.treatment === 'outline';\n }\n\n protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n // There is no Spectrum design context for an `<sp-button>` without a variant\n // apply one manually when a consumer has not applied one themselves.\n\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n if (this.pending) {\n this.pendingStateController.hostUpdated();\n }\n }\n\n protected override renderButton(): TemplateResult {\n return html`\n ${this.buttonContent} ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAWA;AAAA,EAEE;AAAA,EAEA;AAAA,OAEK;AACP,SAAS,gBAAgB;AACzB,SAAS,8BAA8B;AAEvC,OAAO,kBAAkB;AACzB,SAAS,kBAAkB;
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nimport buttonStyles from './button.css.js';\nimport { ButtonBase } from './ButtonBase.dev.js'\n\n/**\n * @deprecated The `DeprecatedButtonVariants` type export is deprecated and will\n * be removed in a future release.\n */\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\n\n/**\n * @deprecated The `ButtonStaticColors` type export is deprecated and will be\n * removed in a future release.\n */\nexport type ButtonStaticColors = 'white' | 'black';\n\n/**\n * @deprecated The `ButtonVariants` type export is deprecated and will be\n * removed in a future release.\n */\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStaticColors\n | DeprecatedButtonVariants;\n\n/**\n * @deprecated The `VALID_VARIANTS` export is deprecated and will be removed\n * in a future release.\n */\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\n\n/**\n * @deprecated The `VALID_STATIC_COLORS` export is deprecated and will be\n * removed in a future release.\n */\nexport const VALID_STATIC_COLORS = ['white', 'black'];\n\n/**\n * @deprecated The `ButtonTreatments` type export is deprecated and will be\n * removed in a future release.\n */\nexport type ButtonTreatments = 'fill' | 'outline';\n\n/**\n * @element sp-button\n *\n * @slot - text label of the Button\n * @slot icon - The icon to use for Button\n */\nexport class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n @property({ type: String, attribute: 'pending-label' })\n public pendingLabel = 'Pending';\n\n // Use this property to set the button into a pending state\n @property({ type: Boolean, reflect: true, attribute: true })\n public pending = false;\n\n public pendingStateController: PendingStateController<this>;\n\n /**\n * Initializes the `PendingStateController` for the Button component.\n * The `PendingStateController` manages the pending state of the Button.\n */\n constructor() {\n super();\n this.pendingStateController = new PendingStateController(this);\n }\n\n public override click(): void {\n if (this.pending) {\n return;\n }\n super.click();\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property()\n public get variant(): ButtonVariants {\n return this._variant;\n }\n public set variant(variant: ButtonVariants) {\n if (variant === this.variant) {\n return;\n }\n\n this.requestUpdate('variant', this.variant);\n switch (variant) {\n case 'cta':\n this._variant = 'accent';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"cta\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"variant='accent'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#variants',\n { level: 'deprecation' }\n );\n }\n break;\n case 'overBackground':\n this.removeAttribute('variant');\n this.staticColor = 'white';\n this.treatment = 'outline';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"overBackground\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"staticColor='white'\" with \"treatment='outline'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n return;\n case 'white':\n this.staticColor = 'white';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"white\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case 'black':\n this.staticColor = 'black';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='black'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case null:\n return;\n default:\n if (!VALID_VARIANTS.includes(variant)) {\n this._variant = 'accent';\n } else {\n this._variant = variant;\n }\n break;\n }\n this.setAttribute('variant', this.variant);\n }\n private _variant: ButtonVariants = 'accent';\n\n /**\n * The static color variant to use for this button.\n */\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n /**\n * The visual treatment to apply to this button.\n *\n * @deprecated The `treatment` property is deprecated and will be replaced by\n * `fill-style` in a future release.\n */\n @property({ reflect: true })\n public treatment: ButtonTreatments = 'fill';\n\n /**\n * Style this button to be less obvious.\n *\n * @deprecated The `quiet` property is deprecated and will be removed in a\n * future release.\n */\n @property({ type: Boolean })\n public set quiet(quiet: boolean) {\n this.treatment = quiet ? 'outline' : 'fill';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"quiet\" property on <${this.localName}> has been deprecated and will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n }\n\n /**\n * Disables text wrapping within the button component's label.\n * Please note that this option is not a part of the design specification\n * and should be used carefully, with consideration of this overflow behavior\n * and the readability of the button's content.\n *\n * @deprecated The `no-wrap` attribute is deprecated and will be replaced by\n * `truncate` in a future release.\n */\n @property({ type: Boolean, attribute: 'no-wrap', reflect: true })\n public set noWrap(value: boolean) {\n const oldValue = this._noWrap;\n this._noWrap = value;\n this.requestUpdate('noWrap', oldValue);\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"no-wrap\" attribute on <${this.localName}> has been deprecated and will be replaced by \"truncate\" in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n }\n\n public get noWrap(): boolean {\n return this._noWrap;\n }\n private _noWrap = false;\n\n public get quiet(): boolean {\n return this.treatment === 'outline';\n }\n\n protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n // There is no Spectrum design context for an `<sp-button>` without a variant\n // apply one manually when a consumer has not applied one themselves.\n\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n if (this.pending) {\n this.pendingStateController.hostUpdated();\n }\n }\n\n protected override renderButton(): TemplateResult {\n return html`\n ${this.buttonContent} ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Button.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var t=(o,i,e,n)=>{for(var a=n>1?void 0:n?p(i,e):i,s=o.length-1,c;s>=0;s--)(c=o[s])&&(a=(n?c(i,e,a):c(a))||a);return n&&a&&l(i,e,a),a};import{html as u,SizedMixin as d}from"@spectrum-web-components/base";import{property as r}from"@spectrum-web-components/base/src/decorators.js";import{PendingStateController as h}from"@spectrum-web-components/reactive-controllers/src/PendingState.js";import b from"./button.css.js";import{ButtonBase as w}from"./ButtonBase.js";export const VALID_VARIANTS=["accent","primary","secondary","negative","white","black"],VALID_STATIC_COLORS=["white","black"];export class Button extends d(w,{noDefaultSize:!0}){constructor(){super();this.pendingLabel="Pending";this.pending=!1;this._variant="accent";this.treatment="fill";this._noWrap=!1;this.pendingStateController=new h(this)}static get styles(){return[...super.styles,b]}click(){this.pending||super.click()}get variant(){return this._variant}set variant(e){if(e!==this.variant){switch(this.requestUpdate("variant",this.variant),e){case"cta":this._variant="accent";break;case"overBackground":this.removeAttribute("variant"),this.staticColor="white",this.treatment="outline";return;case"white":this.staticColor="white";return;case"black":this.staticColor="black";return;case null:return;default:VALID_VARIANTS.includes(e)?this._variant=e:this._variant="accent";break}this.setAttribute("variant",this.variant)}}set quiet(e){this.treatment=e?"outline":"fill"}set noWrap(e){const n=this._noWrap;this._noWrap=e,this.requestUpdate("noWrap",n)}get noWrap(){return this._noWrap}get quiet(){return this.treatment==="outline"}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("variant")||this.setAttribute("variant",this.variant),this.pending&&this.pendingStateController.hostUpdated()}renderButton(){return u`
|
|
2
2
|
${this.buttonContent} ${this.pendingStateController.renderPendingState()}
|
|
3
|
-
`}}
|
|
3
|
+
`}}t([r({type:String,attribute:"pending-label"})],Button.prototype,"pendingLabel",2),t([r({type:Boolean,reflect:!0,attribute:!0})],Button.prototype,"pending",2),t([r()],Button.prototype,"variant",1),t([r({reflect:!0,attribute:"static-color"})],Button.prototype,"staticColor",2),t([r({reflect:!0})],Button.prototype,"treatment",2),t([r({type:Boolean})],Button.prototype,"quiet",1),t([r({type:Boolean,attribute:"no-wrap",reflect:!0})],Button.prototype,"noWrap",1);
|
|
4
4
|
//# sourceMappingURL=Button.js.map
|
package/src/Button.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Button.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nimport buttonStyles from './button.css.js';\nimport { ButtonBase } from './ButtonBase.js';\n\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\nexport type ButtonStaticColors = 'white' | 'black';\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStaticColors\n | DeprecatedButtonVariants;\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\nexport const VALID_STATIC_COLORS = ['white', 'black'];\n\nexport type ButtonTreatments = 'fill' | 'outline';\n\n/**\n * @element sp-button\n *\n * @slot - text label of the Button\n * @slot icon - The icon to use for Button\n */\nexport class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n @property({ type: String, attribute: 'pending-label' })\n public pendingLabel = 'Pending';\n\n // Use this property to set the button into a pending state\n @property({ type: Boolean, reflect: true, attribute: true })\n public pending = false;\n\n public pendingStateController: PendingStateController<this>;\n\n /**\n * Initializes the `PendingStateController` for the Button component.\n * The `PendingStateController` manages the pending state of the Button.\n */\n constructor() {\n super();\n this.pendingStateController = new PendingStateController(this);\n }\n\n public override click(): void {\n if (this.pending) {\n return;\n }\n super.click();\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property()\n public get variant(): ButtonVariants {\n return this._variant;\n }\n public set variant(variant: ButtonVariants) {\n if (variant === this.variant) {\n return;\n }\n\n this.requestUpdate('variant', this.variant);\n switch (variant) {\n case 'cta':\n this._variant = 'accent';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"cta\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"variant='accent'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#variants',\n { level: 'deprecation' }\n );\n }\n break;\n case 'overBackground':\n this.removeAttribute('variant');\n this.staticColor = 'white';\n this.treatment = 'outline';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"overBackground\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"staticColor='white'\" with \"treatment='outline'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n return;\n case 'white':\n this.staticColor = 'white';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"white\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case 'black':\n this.staticColor = 'black';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='black'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case null:\n return;\n default:\n if (!VALID_VARIANTS.includes(variant)) {\n this._variant = 'accent';\n } else {\n this._variant = variant;\n }\n break;\n }\n this.setAttribute('variant', this.variant);\n }\n private _variant: ButtonVariants = 'accent';\n\n /**\n * The static color variant to use for this button.\n */\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n /**\n * The visual treatment to apply to this button.\n */\n @property({ reflect: true })\n public treatment: ButtonTreatments = 'fill';\n\n /**\n * Style this button to be less obvious\n */\n @property({ type: Boolean })\n public set quiet(quiet: boolean) {\n this.treatment = quiet ? 'outline' : 'fill';\n }\n\n /**\n * Disables text wrapping within the button component's label.\n * Please note that this option is not a part of the design specification\n * and should be used carefully, with consideration of this overflow behavior\n * and the readability of the button's content.\n */\n @property({ type: Boolean, attribute: 'no-wrap', reflect: true })\n public noWrap = false;\n\n public get quiet(): boolean {\n return this.treatment === 'outline';\n }\n\n protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n // There is no Spectrum design context for an `<sp-button>` without a variant\n // apply one manually when a consumer has not applied one themselves.\n\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n if (this.pending) {\n this.pendingStateController.hostUpdated();\n }\n }\n\n protected override renderButton(): TemplateResult {\n return html`\n ${this.buttonContent} ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAWA,OAEE,QAAAA,EAEA,cAAAC,MAEK,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,0BAAAC,MAA8B,oEAEvC,OAAOC,MAAkB,kBACzB,OAAS,cAAAC,MAAkB,
|
|
6
|
-
"names": ["html", "SizedMixin", "property", "PendingStateController", "buttonStyles", "ButtonBase", "variant", "quiet", "changes", "__decorateClass"]
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nimport buttonStyles from './button.css.js';\nimport { ButtonBase } from './ButtonBase.js';\n\n/**\n * @deprecated The `DeprecatedButtonVariants` type export is deprecated and will\n * be removed in a future release.\n */\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\n\n/**\n * @deprecated The `ButtonStaticColors` type export is deprecated and will be\n * removed in a future release.\n */\nexport type ButtonStaticColors = 'white' | 'black';\n\n/**\n * @deprecated The `ButtonVariants` type export is deprecated and will be\n * removed in a future release.\n */\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStaticColors\n | DeprecatedButtonVariants;\n\n/**\n * @deprecated The `VALID_VARIANTS` export is deprecated and will be removed\n * in a future release.\n */\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\n\n/**\n * @deprecated The `VALID_STATIC_COLORS` export is deprecated and will be\n * removed in a future release.\n */\nexport const VALID_STATIC_COLORS = ['white', 'black'];\n\n/**\n * @deprecated The `ButtonTreatments` type export is deprecated and will be\n * removed in a future release.\n */\nexport type ButtonTreatments = 'fill' | 'outline';\n\n/**\n * @element sp-button\n *\n * @slot - text label of the Button\n * @slot icon - The icon to use for Button\n */\nexport class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n @property({ type: String, attribute: 'pending-label' })\n public pendingLabel = 'Pending';\n\n // Use this property to set the button into a pending state\n @property({ type: Boolean, reflect: true, attribute: true })\n public pending = false;\n\n public pendingStateController: PendingStateController<this>;\n\n /**\n * Initializes the `PendingStateController` for the Button component.\n * The `PendingStateController` manages the pending state of the Button.\n */\n constructor() {\n super();\n this.pendingStateController = new PendingStateController(this);\n }\n\n public override click(): void {\n if (this.pending) {\n return;\n }\n super.click();\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property()\n public get variant(): ButtonVariants {\n return this._variant;\n }\n public set variant(variant: ButtonVariants) {\n if (variant === this.variant) {\n return;\n }\n\n this.requestUpdate('variant', this.variant);\n switch (variant) {\n case 'cta':\n this._variant = 'accent';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"cta\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"variant='accent'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#variants',\n { level: 'deprecation' }\n );\n }\n break;\n case 'overBackground':\n this.removeAttribute('variant');\n this.staticColor = 'white';\n this.treatment = 'outline';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"overBackground\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"staticColor='white'\" with \"treatment='outline'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n return;\n case 'white':\n this.staticColor = 'white';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"white\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case 'black':\n this.staticColor = 'black';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"static-color='black'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case null:\n return;\n default:\n if (!VALID_VARIANTS.includes(variant)) {\n this._variant = 'accent';\n } else {\n this._variant = variant;\n }\n break;\n }\n this.setAttribute('variant', this.variant);\n }\n private _variant: ButtonVariants = 'accent';\n\n /**\n * The static color variant to use for this button.\n */\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n /**\n * The visual treatment to apply to this button.\n *\n * @deprecated The `treatment` property is deprecated and will be replaced by\n * `fill-style` in a future release.\n */\n @property({ reflect: true })\n public treatment: ButtonTreatments = 'fill';\n\n /**\n * Style this button to be less obvious.\n *\n * @deprecated The `quiet` property is deprecated and will be removed in a\n * future release.\n */\n @property({ type: Boolean })\n public set quiet(quiet: boolean) {\n this.treatment = quiet ? 'outline' : 'fill';\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"quiet\" property on <${this.localName}> has been deprecated and will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n }\n\n /**\n * Disables text wrapping within the button component's label.\n * Please note that this option is not a part of the design specification\n * and should be used carefully, with consideration of this overflow behavior\n * and the readability of the button's content.\n *\n * @deprecated The `no-wrap` attribute is deprecated and will be replaced by\n * `truncate` in a future release.\n */\n @property({ type: Boolean, attribute: 'no-wrap', reflect: true })\n public set noWrap(value: boolean) {\n const oldValue = this._noWrap;\n this._noWrap = value;\n this.requestUpdate('noWrap', oldValue);\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `The \"no-wrap\" attribute on <${this.localName}> has been deprecated and will be replaced by \"truncate\" in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n }\n\n public get noWrap(): boolean {\n return this._noWrap;\n }\n private _noWrap = false;\n\n public get quiet(): boolean {\n return this.treatment === 'outline';\n }\n\n protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n // There is no Spectrum design context for an `<sp-button>` without a variant\n // apply one manually when a consumer has not applied one themselves.\n\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n if (this.pending) {\n this.pendingStateController.hostUpdated();\n }\n }\n\n protected override renderButton(): TemplateResult {\n return html`\n ${this.buttonContent} ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OAEE,QAAAA,EAEA,cAAAC,MAEK,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,0BAAAC,MAA8B,oEAEvC,OAAOC,MAAkB,kBACzB,OAAS,cAAAC,MAAkB,kBA8BpB,aAAM,eAAiB,CAC5B,SACA,UACA,YACA,WACA,QACA,OACF,EAMa,oBAAsB,CAAC,QAAS,OAAO,EAc7C,aAAM,eAAeJ,EAAWI,EAAY,CAAE,cAAe,EAAK,CAAC,CAAE,CAkB1E,aAAc,CACZ,MAAM,EAbR,KAAO,aAAe,UAItB,KAAO,QAAU,GA4FjB,KAAQ,SAA2B,SAenC,KAAO,UAA8B,OAgDrC,KAAQ,QAAU,GAjJhB,KAAK,uBAAyB,IAAIF,EAAuB,IAAI,CAC/D,CApBA,WAA2B,QAAyB,CAClD,MAAO,CAAC,GAAG,MAAM,OAAQC,CAAY,CACvC,CAoBgB,OAAc,CACxB,KAAK,SAGT,MAAM,MAAM,CACd,CAMA,IAAW,SAA0B,CACnC,OAAO,KAAK,QACd,CACA,IAAW,QAAQE,EAAyB,CAC1C,GAAIA,IAAY,KAAK,QAKrB,QADA,KAAK,cAAc,UAAW,KAAK,OAAO,EAClCA,EAAS,CACf,IAAK,MACH,KAAK,SAAW,SAShB,MACF,IAAK,iBACH,KAAK,gBAAgB,SAAS,EAC9B,KAAK,YAAc,QACnB,KAAK,UAAY,UASjB,OACF,IAAK,QACH,KAAK,YAAc,QASnB,OACF,IAAK,QACH,KAAK,YAAc,QASnB,OACF,KAAK,KACH,OACF,QACO,eAAe,SAASA,CAAO,EAGlC,KAAK,SAAWA,EAFhB,KAAK,SAAW,SAIlB,KACJ,CACA,KAAK,aAAa,UAAW,KAAK,OAAO,EAC3C,CAyBA,IAAW,MAAMC,EAAgB,CAC/B,KAAK,UAAYA,EAAQ,UAAY,MASvC,CAYA,IAAW,OAAOC,EAAgB,CAChC,MAAMC,EAAW,KAAK,QACtB,KAAK,QAAUD,EACf,KAAK,cAAc,SAAUC,CAAQ,CASvC,CAEA,IAAW,QAAkB,CAC3B,OAAO,KAAK,OACd,CAGA,IAAW,OAAiB,CAC1B,OAAO,KAAK,YAAc,SAC5B,CAEmB,aAAaC,EAAqC,CACnE,MAAM,aAAaA,CAAO,EAIrB,KAAK,aAAa,SAAS,GAC9B,KAAK,aAAa,UAAW,KAAK,OAAO,EAEvC,KAAK,SACP,KAAK,uBAAuB,YAAY,CAE5C,CAEmB,cAA+B,CAChD,OAAOV;AAAA,QACH,KAAK,aAAa,IAAI,KAAK,uBAAuB,mBAAmB,CAAC;AAAA,KAE5E,CACF,CAvLSW,EAAA,CADNT,EAAS,CAAE,KAAM,OAAQ,UAAW,eAAgB,CAAC,GAL3C,OAMJ,4BAIAS,EAAA,CADNT,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,EAAK,CAAC,GAThD,OAUJ,uBAwBIS,EAAA,CADVT,EAAS,GAjCC,OAkCA,uBA0EJS,EAAA,CADNT,EAAS,CAAE,QAAS,GAAM,UAAW,cAAe,CAAC,GA3G3C,OA4GJ,2BASAS,EAAA,CADNT,EAAS,CAAE,QAAS,EAAK,CAAC,GApHhB,OAqHJ,yBASIS,EAAA,CADVT,EAAS,CAAE,KAAM,OAAQ,CAAC,GA7HhB,OA8HA,qBAsBAS,EAAA,CADVT,EAAS,CAAE,KAAM,QAAS,UAAW,UAAW,QAAS,EAAK,CAAC,GAnJrD,OAoJA",
|
|
6
|
+
"names": ["html", "SizedMixin", "property", "PendingStateController", "buttonStyles", "ButtonBase", "variant", "quiet", "value", "oldValue", "changes", "__decorateClass"]
|
|
7
7
|
}
|