@spectrum-web-components/button 1.0.0 → 1.0.1-typings
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/README.md +1 -1
- package/package.json +10 -10
- package/src/Button.dev.js.map +1 -1
- package/src/Button.js +1 -1
- package/src/Button.js.map +1 -1
- package/src/ButtonBase.d.ts +7 -1
- package/src/ButtonBase.dev.js +3 -11
- package/src/ButtonBase.dev.js.map +2 -2
- package/src/ButtonBase.js +3 -3
- package/src/ButtonBase.js.map +2 -2
- package/src/ClearButton.dev.js +1 -7
- package/src/ClearButton.dev.js.map +2 -2
- package/src/ClearButton.js +3 -3
- package/src/ClearButton.js.map +3 -3
- package/src/CloseButton.dev.js +1 -7
- package/src/CloseButton.dev.js.map +2 -2
- package/src/CloseButton.js +2 -2
- package/src/CloseButton.js.map +3 -3
- package/src/button-overrides.css.dev.js +1 -1
- package/src/button-overrides.css.dev.js.map +1 -1
- package/src/button-overrides.css.js +3 -3
- package/src/button-overrides.css.js.map +1 -1
- package/src/button.css.dev.js +1 -1
- package/src/button.css.dev.js.map +1 -1
- package/src/button.css.js +3 -3
- package/src/button.css.js.map +1 -1
- package/src/spectrum-button.css.dev.js +1 -1
- package/src/spectrum-button.css.dev.js.map +1 -1
- package/src/spectrum-button.css.js +1 -1
- package/src/spectrum-button.css.js.map +1 -1
- package/LICENSE +0 -201
- package/custom-elements.json +0 -1863
- package/stories/button-accent-fill-pending.stories.js +0 -34
- package/stories/button-accent-fill-pending.stories.js.map +0 -7
- package/stories/button-accent-fill-sizes.stories.js +0 -32
- package/stories/button-accent-fill-sizes.stories.js.map +0 -7
- package/stories/button-accent-fill.stories.js +0 -33
- package/stories/button-accent-fill.stories.js.map +0 -7
- package/stories/button-accent-outline-pending.stories.js +0 -34
- package/stories/button-accent-outline-pending.stories.js.map +0 -7
- package/stories/button-accent-outline-sizes.stories.js +0 -32
- package/stories/button-accent-outline-sizes.stories.js.map +0 -7
- package/stories/button-accent-outline.stories.js +0 -33
- package/stories/button-accent-outline.stories.js.map +0 -7
- package/stories/button-black-fill-pending.stories.js +0 -34
- package/stories/button-black-fill-pending.stories.js.map +0 -7
- package/stories/button-black-fill-sizes.stories.js +0 -33
- package/stories/button-black-fill-sizes.stories.js.map +0 -7
- package/stories/button-black-fill.stories.js +0 -35
- package/stories/button-black-fill.stories.js.map +0 -7
- package/stories/button-black-outline-pending.stories.js +0 -34
- package/stories/button-black-outline-pending.stories.js.map +0 -7
- package/stories/button-black-outline-sizes.stories.js +0 -33
- package/stories/button-black-outline-sizes.stories.js.map +0 -7
- package/stories/button-black-outline.stories.js +0 -35
- package/stories/button-black-outline.stories.js.map +0 -7
- package/stories/button-negative-fill-pending.stories.js +0 -34
- package/stories/button-negative-fill-pending.stories.js.map +0 -7
- package/stories/button-negative-fill-sizes.stories.js +0 -32
- package/stories/button-negative-fill-sizes.stories.js.map +0 -7
- package/stories/button-negative-fill.stories.js +0 -33
- package/stories/button-negative-fill.stories.js.map +0 -7
- package/stories/button-negative-outline-pending.stories.js +0 -34
- package/stories/button-negative-outline-pending.stories.js.map +0 -7
- package/stories/button-negative-outline-sizes.stories.js +0 -32
- package/stories/button-negative-outline-sizes.stories.js.map +0 -7
- package/stories/button-negative-outline.stories.js +0 -33
- package/stories/button-negative-outline.stories.js.map +0 -7
- package/stories/button-primary-fill-pending.stories.js +0 -34
- package/stories/button-primary-fill-pending.stories.js.map +0 -7
- package/stories/button-primary-fill-sizes.stories.js +0 -32
- package/stories/button-primary-fill-sizes.stories.js.map +0 -7
- package/stories/button-primary-fill.stories.js +0 -46
- package/stories/button-primary-fill.stories.js.map +0 -7
- package/stories/button-primary-outline-pending.stories.js +0 -34
- package/stories/button-primary-outline-pending.stories.js.map +0 -7
- package/stories/button-primary-outline-sizes.stories.js +0 -32
- package/stories/button-primary-outline-sizes.stories.js.map +0 -7
- package/stories/button-primary-outline.stories.js +0 -33
- package/stories/button-primary-outline.stories.js.map +0 -7
- package/stories/button-secondary-fill-pending.stories.js +0 -34
- package/stories/button-secondary-fill-pending.stories.js.map +0 -7
- package/stories/button-secondary-fill-sizes.stories.js +0 -32
- package/stories/button-secondary-fill-sizes.stories.js.map +0 -7
- package/stories/button-secondary-fill.stories.js +0 -33
- package/stories/button-secondary-fill.stories.js.map +0 -7
- package/stories/button-secondary-outline-pending.stories.js +0 -34
- package/stories/button-secondary-outline-pending.stories.js.map +0 -7
- package/stories/button-secondary-outline-sizes.stories.js +0 -32
- package/stories/button-secondary-outline-sizes.stories.js.map +0 -7
- package/stories/button-secondary-outline.stories.js +0 -33
- package/stories/button-secondary-outline.stories.js.map +0 -7
- package/stories/button-white-fill-pending.stories.js +0 -34
- package/stories/button-white-fill-pending.stories.js.map +0 -7
- package/stories/button-white-fill-sizes.stories.js +0 -33
- package/stories/button-white-fill-sizes.stories.js.map +0 -7
- package/stories/button-white-fill.stories.js +0 -35
- package/stories/button-white-fill.stories.js.map +0 -7
- package/stories/button-white-outline-pending.stories.js +0 -34
- package/stories/button-white-outline-pending.stories.js.map +0 -7
- package/stories/button-white-outline-sizes.stories.js +0 -33
- package/stories/button-white-outline-sizes.stories.js.map +0 -7
- package/stories/button-white-outline.stories.js +0 -35
- package/stories/button-white-outline.stories.js.map +0 -7
- package/stories/index.js +0 -198
- package/stories/index.js.map +0 -7
- package/stories/template.js +0 -21
- package/stories/template.js.map +0 -7
- package/test/benchmark/test-basic.js +0 -14
- package/test/benchmark/test-basic.js.map +0 -7
- package/test/button-accent-fill-pending.test-vrt.js +0 -5
- package/test/button-accent-fill-pending.test-vrt.js.map +0 -7
- package/test/button-accent-fill-sizes.test-vrt.js +0 -5
- package/test/button-accent-fill-sizes.test-vrt.js.map +0 -7
- package/test/button-accent-fill.test-vrt.js +0 -5
- package/test/button-accent-fill.test-vrt.js.map +0 -7
- package/test/button-accent-outline-pending.test-vrt.js +0 -5
- package/test/button-accent-outline-pending.test-vrt.js.map +0 -7
- package/test/button-accent-outline-sizes.test-vrt.js +0 -5
- package/test/button-accent-outline-sizes.test-vrt.js.map +0 -7
- package/test/button-accent-outline.test-vrt.js +0 -5
- package/test/button-accent-outline.test-vrt.js.map +0 -7
- package/test/button-black-fill-pending.test-vrt.js +0 -5
- package/test/button-black-fill-pending.test-vrt.js.map +0 -7
- package/test/button-black-fill-sizes.test-vrt.js +0 -5
- package/test/button-black-fill-sizes.test-vrt.js.map +0 -7
- package/test/button-black-fill.test-vrt.js +0 -5
- package/test/button-black-fill.test-vrt.js.map +0 -7
- package/test/button-black-outline-pending.test-vrt.js +0 -5
- package/test/button-black-outline-pending.test-vrt.js.map +0 -7
- package/test/button-black-outline-sizes.test-vrt.js +0 -5
- package/test/button-black-outline-sizes.test-vrt.js.map +0 -7
- package/test/button-black-outline.test-vrt.js +0 -5
- package/test/button-black-outline.test-vrt.js.map +0 -7
- package/test/button-memory.test.js +0 -5
- package/test/button-memory.test.js.map +0 -7
- package/test/button-negative-fill-pending.test-vrt.js +0 -5
- package/test/button-negative-fill-pending.test-vrt.js.map +0 -7
- package/test/button-negative-fill-sizes.test-vrt.js +0 -5
- package/test/button-negative-fill-sizes.test-vrt.js.map +0 -7
- package/test/button-negative-fill.test-vrt.js +0 -5
- package/test/button-negative-fill.test-vrt.js.map +0 -7
- package/test/button-negative-outline-pending.test-vrt.js +0 -5
- package/test/button-negative-outline-pending.test-vrt.js.map +0 -7
- package/test/button-negative-outline-sizes.test-vrt.js +0 -5
- package/test/button-negative-outline-sizes.test-vrt.js.map +0 -7
- package/test/button-negative-outline.test-vrt.js +0 -5
- package/test/button-negative-outline.test-vrt.js.map +0 -7
- package/test/button-primary-fill-pending.test-vrt.js +0 -5
- package/test/button-primary-fill-pending.test-vrt.js.map +0 -7
- package/test/button-primary-fill-sizes.test-vrt.js +0 -5
- package/test/button-primary-fill-sizes.test-vrt.js.map +0 -7
- package/test/button-primary-fill.test-vrt.js +0 -5
- package/test/button-primary-fill.test-vrt.js.map +0 -7
- package/test/button-primary-outline-pending.test-vrt.js +0 -5
- package/test/button-primary-outline-pending.test-vrt.js.map +0 -7
- package/test/button-primary-outline-sizes.test-vrt.js +0 -5
- package/test/button-primary-outline-sizes.test-vrt.js.map +0 -7
- package/test/button-primary-outline.test-vrt.js +0 -5
- package/test/button-primary-outline.test-vrt.js.map +0 -7
- package/test/button-secondary-fill-pending.test-vrt.js +0 -5
- package/test/button-secondary-fill-pending.test-vrt.js.map +0 -7
- package/test/button-secondary-fill-sizes.test-vrt.js +0 -5
- package/test/button-secondary-fill-sizes.test-vrt.js.map +0 -7
- package/test/button-secondary-fill.test-vrt.js +0 -5
- package/test/button-secondary-fill.test-vrt.js.map +0 -7
- package/test/button-secondary-outline-pending.test-vrt.js +0 -5
- package/test/button-secondary-outline-pending.test-vrt.js.map +0 -7
- package/test/button-secondary-outline-sizes.test-vrt.js +0 -5
- package/test/button-secondary-outline-sizes.test-vrt.js.map +0 -7
- package/test/button-secondary-outline.test-vrt.js +0 -5
- package/test/button-secondary-outline.test-vrt.js.map +0 -7
- package/test/button-white-fill-pending.test-vrt.js +0 -5
- package/test/button-white-fill-pending.test-vrt.js.map +0 -7
- package/test/button-white-fill-sizes.test-vrt.js +0 -5
- package/test/button-white-fill-sizes.test-vrt.js.map +0 -7
- package/test/button-white-fill.test-vrt.js +0 -5
- package/test/button-white-fill.test-vrt.js.map +0 -7
- package/test/button-white-outline-pending.test-vrt.js +0 -5
- package/test/button-white-outline-pending.test-vrt.js.map +0 -7
- package/test/button-white-outline-sizes.test-vrt.js +0 -5
- package/test/button-white-outline-sizes.test-vrt.js.map +0 -7
- package/test/button-white-outline.test-vrt.js +0 -5
- package/test/button-white-outline.test-vrt.js.map +0 -7
- package/test/button.test.js +0 -632
- package/test/button.test.js.map +0 -7
- package/test/clear-button.test.js +0 -27
- package/test/clear-button.test.js.map +0 -7
- package/test/close-button.test.js +0 -27
- package/test/close-button.test.js.map +0 -7
package/README.md
CHANGED
|
@@ -332,7 +332,7 @@ Events handlers for clicks and other user actions can be registered on a
|
|
|
332
332
|
<sp-button onclick="spAlert(this, '<sp-button> clicked!')">Click me</sp-button>
|
|
333
333
|
```
|
|
334
334
|
|
|
335
|
-
In addition to handling events like a native `<button>` HTML element, one can also use a `<sp-button>` in place of the `<a>` element by using the `href` and optional `target` attribute.
|
|
335
|
+
In addition to handling events like a native `<button>` HTML element, one can also use a `<sp-button>` in place of the `<a>` HTML element by using the `href` and optional `target` attribute.
|
|
336
336
|
|
|
337
337
|
```html
|
|
338
338
|
<sp-button
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/button",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-typings",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -83,13 +83,14 @@
|
|
|
83
83
|
"lit-html"
|
|
84
84
|
],
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@spectrum-web-components/base": "^1.0.
|
|
87
|
-
"@spectrum-web-components/clear-button": "^1.0.
|
|
88
|
-
"@spectrum-web-components/close-button": "^1.0.
|
|
89
|
-
"@spectrum-web-components/icon": "^1.0.
|
|
90
|
-
"@spectrum-web-components/icons-ui": "^1.0.
|
|
91
|
-
"@spectrum-web-components/progress-circle": "^1.0.
|
|
92
|
-
"@spectrum-web-components/shared": "^1.0.
|
|
86
|
+
"@spectrum-web-components/base": "^1.0.1",
|
|
87
|
+
"@spectrum-web-components/clear-button": "^1.0.1",
|
|
88
|
+
"@spectrum-web-components/close-button": "^1.0.1",
|
|
89
|
+
"@spectrum-web-components/icon": "^1.0.1",
|
|
90
|
+
"@spectrum-web-components/icons-ui": "^1.0.1",
|
|
91
|
+
"@spectrum-web-components/progress-circle": "^1.0.1",
|
|
92
|
+
"@spectrum-web-components/shared": "^1.0.1",
|
|
93
|
+
"@spectrum-web-components/reactive-controllers": "^1.0.1"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|
|
95
96
|
"@spectrum-css/button": "^14.0.0-s2-foundations.18"
|
|
@@ -99,6 +100,5 @@
|
|
|
99
100
|
"sideEffects": [
|
|
100
101
|
"./sp-*.js",
|
|
101
102
|
"./**/*.dev.js"
|
|
102
|
-
]
|
|
103
|
-
"gitHead": "5cf5d34645bf9494ebd20f64c42d1619523d2d84"
|
|
103
|
+
]
|
|
104
104
|
}
|
package/src/Button.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Button.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning 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 { ButtonBase } from './ButtonBase.dev.js'\nimport buttonStyles from './button.css.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.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) return;\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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" 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}\n ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning 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 { ButtonBase } from './ButtonBase.dev.js'\nimport buttonStyles from './button.css.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.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) return;\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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" 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}\n ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n\n/**\n * Export typings object of the button component\n */\nexport type ButtonTypes = {\n children: string;\n variant: ['accent', 'primary', 'secondary', 'negative', 'white', 'black'];\n staticColor: ['white', 'black'];\n treatment: ['fill', 'outline'];\n quiet: boolean;\n noWrap: boolean;\n pending: boolean;\n pendingLabel: string;\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,OAAO,kBAAkB;AACzB,SAAS,8BAA8B;AAWhC,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACO,aAAM,sBAAsB,CAAC,SAAS,OAAO;AAU7C,aAAM,eAAe,WAAW,YAAY,EAAE,eAAe,KAAK,CAAC,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBxE,cAAc;AACV,UAAM;AAbV,SAAO,eAAe;AAItB,SAAO,UAAU;AA4FjB,SAAQ,WAA2B;AAYnC,SAAO,YAA8B;AA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;AAAA,GAlIvD,OAmIF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Button.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var e=(o,i,t,n)=>{for(var r=n>1?void 0:n?u(i,t):i,s=o.length-1,l;s>=0;s--)(l=o[s])&&(r=(n?l(i,t,r):l(r))||r);return n&&r&&c(i,t,r),r};import{html as p,SizedMixin as d}from"@spectrum-web-components/base";import{property as a}from"@spectrum-web-components/base/src/decorators.js";import{ButtonBase as h}from"./ButtonBase.js";import b from"./button.css.js";import{PendingStateController as w}from"@spectrum-web-components/reactive-controllers/src/PendingState.js";export const VALID_VARIANTS=["accent","primary","secondary","negative","white","black"],VALID_STATIC_COLORS=["white","black"];export class Button extends d(h,{noDefaultSize:!0}){constructor(){super();this.pendingLabel="Pending";this.pending=!1;this._variant="accent";this.treatment="fill";this.noWrap=!1;this.pendingStateController=new w(this)}static get styles(){return[...super.styles,b]}click(){this.pending||super.click()}get variant(){return this._variant}set variant(t){if(t!==this.variant){switch(this.requestUpdate("variant",this.variant),t){case"cta":this._variant="accent";break;case"overBackground":this.removeAttribute("variant"),this.staticColor="white",this.treatment="outline";return;case"white":this.staticColor=t,this.removeAttribute("variant");return;case"black":this.staticColor=t,this.removeAttribute("variant");return;case null:return;default:VALID_VARIANTS.includes(t)?this._variant=t:this._variant="accent";break}this.setAttribute("variant",this.variant)}}set quiet(t){this.treatment=t?"outline":"fill"}get quiet(){return this.treatment==="outline"}firstUpdated(t){super.firstUpdated(t),this.hasAttribute("variant")||this.setAttribute("variant",this.variant),this.pending&&this.pendingStateController.hostUpdated()}renderButton(){return p`
|
|
2
2
|
${this.buttonContent}
|
|
3
3
|
${this.pendingStateController.renderPendingState()}
|
|
4
4
|
`}}e([a({type:String,attribute:"pending-label"})],Button.prototype,"pendingLabel",2),e([a({type:Boolean,reflect:!0,attribute:!0})],Button.prototype,"pending",2),e([a()],Button.prototype,"variant",1),e([a({reflect:!0,attribute:"static-color"})],Button.prototype,"staticColor",2),e([a({reflect:!0})],Button.prototype,"treatment",2),e([a({type:Boolean})],Button.prototype,"quiet",1),e([a({type:Boolean,attribute:"no-wrap",reflect:!0})],Button.prototype,"noWrap",2);
|
package/src/Button.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Button.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning 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 { ButtonBase } from './ButtonBase.js';\nimport buttonStyles from './button.css.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.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) return;\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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" 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}\n ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning 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 { ButtonBase } from './ButtonBase.js';\nimport buttonStyles from './button.css.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.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) return;\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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"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 = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" 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}\n ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n\n/**\n * Export typings object of the button component\n */\nexport type ButtonTypes = {\n children: string;\n variant: ['accent', 'primary', 'secondary', 'negative', 'white', 'black'];\n staticColor: ['white', 'black'];\n treatment: ['fill', 'outline'];\n quiet: boolean;\n noWrap: boolean;\n pending: boolean;\n pendingLabel: string;\n};\n"],
|
|
5
5
|
"mappings": "qNAWA,OAEI,QAAAA,EAEA,cAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,cAAAC,MAAkB,kBAC3B,OAAOC,MAAkB,kBACzB,OAAS,0BAAAC,MAA8B,oEAWhC,aAAM,eAAiB,CAC1B,SACA,UACA,YACA,WACA,QACA,OACJ,EACa,oBAAsB,CAAC,QAAS,OAAO,EAU7C,aAAM,eAAeJ,EAAWE,EAAY,CAAE,cAAe,EAAK,CAAC,CAAE,CAkBxE,aAAc,CACV,MAAM,EAbV,KAAO,aAAe,UAItB,KAAO,QAAU,GA4FjB,KAAQ,SAA2B,SAYnC,KAAO,UAA8B,OAiBrC,KAAO,OAAS,GA/GZ,KAAK,uBAAyB,IAAIE,EAAuB,IAAI,CACjE,CApBA,WAA2B,QAAyB,CAChD,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,CADNP,EAAS,CAAE,QAAS,GAAM,UAAW,cAAe,CAAC,GA3G7C,OA4GF,2BAMAO,EAAA,CADNP,EAAS,CAAE,QAAS,EAAK,CAAC,GAjHlB,OAkHF,yBAMIO,EAAA,CADVP,EAAS,CAAE,KAAM,OAAQ,CAAC,GAvHlB,OAwHE,qBAWJO,EAAA,CADNP,EAAS,CAAE,KAAM,QAAS,UAAW,UAAW,QAAS,EAAK,CAAC,GAlIvD,OAmIF",
|
|
6
6
|
"names": ["html", "SizedMixin", "property", "ButtonBase", "buttonStyles", "PendingStateController", "variant", "quiet", "changes", "__decorateClass"]
|
|
7
7
|
}
|
package/src/ButtonBase.d.ts
CHANGED
|
@@ -14,13 +14,19 @@ declare const ButtonBase_base: typeof Focusable & {
|
|
|
14
14
|
export declare class ButtonBase extends ButtonBase_base {
|
|
15
15
|
static get styles(): CSSResultArray;
|
|
16
16
|
active: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The default behavior of the button.
|
|
19
|
+
* Possible values are: `button` (default), `submit`, and `reset`.
|
|
20
|
+
*/
|
|
17
21
|
type: 'button' | 'submit' | 'reset';
|
|
22
|
+
/**
|
|
23
|
+
* HTML anchor element that component clicks by proxy
|
|
24
|
+
*/
|
|
18
25
|
private anchorElement;
|
|
19
26
|
get focusElement(): HTMLElement;
|
|
20
27
|
protected get hasLabel(): boolean;
|
|
21
28
|
protected get buttonContent(): TemplateResult[];
|
|
22
29
|
constructor();
|
|
23
|
-
click(): void;
|
|
24
30
|
private handleClickCapture;
|
|
25
31
|
private proxyFocus;
|
|
26
32
|
private shouldProxyClick;
|
package/src/ButtonBase.dev.js
CHANGED
|
@@ -54,15 +54,6 @@ export class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), "", [
|
|
|
54
54
|
];
|
|
55
55
|
return content;
|
|
56
56
|
}
|
|
57
|
-
click() {
|
|
58
|
-
if (this.disabled) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (this.shouldProxyClick()) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
super.click();
|
|
65
|
-
}
|
|
66
57
|
handleClickCapture(event) {
|
|
67
58
|
if (this.disabled) {
|
|
68
59
|
event.preventDefault();
|
|
@@ -70,6 +61,9 @@ export class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), "", [
|
|
|
70
61
|
event.stopPropagation();
|
|
71
62
|
return false;
|
|
72
63
|
}
|
|
64
|
+
if (this.shouldProxyClick()) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
73
67
|
}
|
|
74
68
|
proxyFocus() {
|
|
75
69
|
this.focus();
|
|
@@ -149,12 +143,10 @@ export class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), "", [
|
|
|
149
143
|
if (!this.hasAttribute("role") || this.getAttribute("role") === "button") {
|
|
150
144
|
this.setAttribute("role", "link");
|
|
151
145
|
}
|
|
152
|
-
this.removeEventListener("click", this.shouldProxyClick);
|
|
153
146
|
} else {
|
|
154
147
|
if (!this.hasAttribute("role") || this.getAttribute("role") === "link") {
|
|
155
148
|
this.setAttribute("role", "button");
|
|
156
149
|
}
|
|
157
|
-
this.addEventListener("click", this.shouldProxyClick);
|
|
158
150
|
}
|
|
159
151
|
}
|
|
160
152
|
firstUpdated(changed) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ButtonBase.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport buttonStyles from './button-base.css.js';\n\n/**\n * @slot - text content to be displayed in the Button element\n * @slot icon - icon element(s) to display at the start of the button\n */\nexport class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), '', [\n 'sp-overlay,sp-tooltip',\n]) {\n public static override get styles(): CSSResultArray {\n return [buttonStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: String })\n public type: 'button' | 'submit' | 'reset' = 'button';\n\n @query('.anchor')\n private anchorElement!:
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,OAAO,kBAAkB;AAMlB,aAAM,mBAAmB,gBAAgB,WAAW,SAAS,GAAG,IAAI;AAAA,EACvE;AACJ,CAAC,EAAE;AAAA,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport buttonStyles from './button-base.css.js';\n\n/**\n * @slot - text content to be displayed in the Button element\n * @slot icon - icon element(s) to display at the start of the button\n */\nexport class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), '', [\n 'sp-overlay,sp-tooltip',\n]) {\n public static override get styles(): CSSResultArray {\n return [buttonStyles];\n }\n\n // TODO we need to document this property for consumers,\n // as it's not a 1:1 equivalent to active\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * The default behavior of the button.\n * Possible values are: `button` (default), `submit`, and `reset`.\n */\n @property({ type: String })\n public type: 'button' | 'submit' | 'reset' = 'button';\n\n /**\n * HTML anchor element that component clicks by proxy\n */\n @query('.anchor')\n private anchorElement!: HTMLAnchorElement;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected get buttonContent(): TemplateResult[] {\n const content = [\n html`\n <slot name=\"icon\" ?icon-only=${!this.hasLabel}></slot>\n `,\n html`\n <span id=\"label\">\n <slot @slotchange=${this.manageTextObservedSlot}></slot>\n </span>\n `,\n ];\n return content;\n }\n\n constructor() {\n super();\n this.proxyFocus = this.proxyFocus.bind(this);\n\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n }\n\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n // click HTML anchor element by proxy\n this.anchorElement.click();\n handled = true;\n // if the button type is `submit` or `reset`\n } else if (this.type !== 'button') {\n // create an HTML Button Element by proxy, click it, and remove it\n const proxy = document.createElement('button');\n proxy.type = this.type;\n this.insertAdjacentElement('afterend', proxy);\n proxy.click();\n proxy.remove();\n handled = true;\n }\n return handled;\n }\n\n public override renderAnchor(): TemplateResult {\n return html`\n ${this.buttonContent}\n ${super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })}\n `;\n }\n\n protected renderButton(): TemplateResult {\n return html`\n ${this.buttonContent}\n `;\n }\n\n protected override render(): TemplateResult {\n return this.href && this.href.length > 0\n ? this.renderAnchor()\n : this.renderButton();\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n // allows button to activate when `Space` is pressed\n if (typeof this.href === 'undefined') {\n this.addEventListener('keyup', this.handleKeyup);\n this.active = true;\n }\n break;\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n // allows button or link to be activated with `Enter` and `NumpadEnter`\n this.click();\n break;\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.active = false;\n this.click();\n break;\n default:\n break;\n }\n }\n\n private manageAnchor(): void {\n // for a link\n if (this.href && this.href.length > 0) {\n // if the role is set to button\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'button'\n ) {\n // change role to link\n this.setAttribute('role', 'link');\n }\n // else for a button\n } else {\n // if the role is set to link\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'link'\n ) {\n // change role to button\n this.setAttribute('role', 'button');\n }\n }\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n if (changed.has('label')) {\n if (this.label) {\n this.setAttribute('aria-label', this.label);\n } else {\n this.removeAttribute('aria-label');\n }\n }\n this.manageAnchor();\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has('href')) {\n this.manageAnchor();\n }\n\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n }\n protected override update(changes: PropertyValues): void {\n super.update(changes);\n if (changes.has('label')) {\n if (this.label) {\n this.setAttribute('aria-label', this.label);\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,OAGG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,OAAO,kBAAkB;AAMlB,aAAM,mBAAmB,gBAAgB,WAAW,SAAS,GAAG,IAAI;AAAA,EACvE;AACJ,CAAC,EAAE;AAAA,EA6CC,cAAc;AACV,UAAM;AAtCV,SAAO,SAAS;AAOhB,SAAO,OAAsC;AAgCzC,SAAK,aAAa,KAAK,WAAW,KAAK,IAAI;AAE3C,SAAK,iBAAiB,SAAS,KAAK,oBAAoB;AAAA,MACpD,SAAS;AAAA,IACb,CAAC;AAAA,EACL;AAAA,EAnDA,WAA2B,SAAyB;AAChD,WAAO,CAAC,YAAY;AAAA,EACxB;AAAA,EAoBA,IAAoB,eAA4B;AAC5C,WAAO;AAAA,EACX;AAAA,EAEA,IAAc,WAAoB;AAC9B,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAc,gBAAkC;AAC5C,UAAM,UAAU;AAAA,MACZ;AAAA,+CACmC,CAAC,KAAK,QAAQ;AAAA;AAAA,MAEjD;AAAA;AAAA,wCAE4B,KAAK,sBAAsB;AAAA;AAAA;AAAA,IAG3D;AACA,WAAO;AAAA,EACX;AAAA,EAWQ,mBAAmB,OAA8B;AACrD,QAAI,KAAK,UAAU;AACf,YAAM,eAAe;AACrB,YAAM,yBAAyB;AAC/B,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,EACmB,OAAO,SAA+B;AACrD,UAAM,OAAO,OAAO;AACpB,QAAI,QAAQ,IAAI,OAAO,GAAG;AACtB,UAAI,KAAK,OAAO;AACZ,aAAK,aAAa,cAAc,KAAK,KAAK;AAAA,MAC9C,OAAO;AACH,aAAK,gBAAgB,YAAY;AAAA,MACrC;AAAA,IACJ;AAAA,EACJ;AACJ;AAjNW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GATjC,WAUF;AAOA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAhBjB,WAiBF;AAMC;AAAA,EADP,MAAM,SAAS;AAAA,GAtBP,WAuBD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ButtonBase.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var s=(a,i,e,t)=>{for(var r=t>1?void 0:t?u(i,e):i,n=a.length-1,l;n>=0;n--)(l=a[n])&&(r=(t?l(i,e,r):l(r))||r);return t&&r&&d(i,e,r),r};import{html as o}from"@spectrum-web-components/base";import{property as h,query as
|
|
1
|
+
"use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var s=(a,i,e,t)=>{for(var r=t>1?void 0:t?u(i,e):i,n=a.length-1,l;n>=0;n--)(l=a[n])&&(r=(t?l(i,e,r):l(r))||r);return t&&r&&d(i,e,r),r};import{html as o}from"@spectrum-web-components/base";import{property as h,query as p}from"@spectrum-web-components/base/src/decorators.js";import{LikeAnchor as c}from"@spectrum-web-components/shared/src/like-anchor.js";import{Focusable as b}from"@spectrum-web-components/shared/src/focusable.js";import{ObserveSlotText as f}from"@spectrum-web-components/shared/src/observe-slot-text.js";import m from"./button-base.css.js";export class ButtonBase extends f(c(b),"",["sp-overlay,sp-tooltip"]){constructor(){super();this.active=!1;this.type="button";this.proxyFocus=this.proxyFocus.bind(this),this.addEventListener("click",this.handleClickCapture,{capture:!0})}static get styles(){return[m]}get focusElement(){return this}get hasLabel(){return this.slotHasContent}get buttonContent(){return[o`
|
|
2
2
|
<slot name="icon" ?icon-only=${!this.hasLabel}></slot>
|
|
3
3
|
`,o`
|
|
4
4
|
<span id="label">
|
|
5
5
|
<slot @slotchange=${this.manageTextObservedSlot}></slot>
|
|
6
6
|
</span>
|
|
7
|
-
`]}
|
|
7
|
+
`]}handleClickCapture(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),!1;this.shouldProxyClick()}proxyFocus(){this.focus()}shouldProxyClick(){let e=!1;if(this.anchorElement)this.anchorElement.click(),e=!0;else if(this.type!=="button"){const t=document.createElement("button");t.type=this.type,this.insertAdjacentElement("afterend",t),t.click(),t.remove(),e=!0}return e}renderAnchor(){return o`
|
|
8
8
|
${this.buttonContent}
|
|
9
9
|
${super.renderAnchor({id:"button",ariaHidden:!0,className:"button anchor hidden"})}
|
|
10
10
|
`}renderButton(){return o`
|
|
11
11
|
${this.buttonContent}
|
|
12
|
-
`}render(){return this.href&&this.href.length>0?this.renderAnchor():this.renderButton()}handleKeydown(e){const{code:t}=e;switch(t){case"Space":e.preventDefault(),typeof this.href=="undefined"&&(this.addEventListener("keyup",this.handleKeyup),this.active=!0);break;default:break}}handleKeypress(e){const{code:t}=e;switch(t){case"Enter":case"NumpadEnter":this.click();break;default:break}}handleKeyup(e){const{code:t}=e;switch(t){case"Space":this.removeEventListener("keyup",this.handleKeyup),this.active=!1,this.click();break;default:break}}manageAnchor(){this.href&&this.href.length>0?(
|
|
12
|
+
`}render(){return this.href&&this.href.length>0?this.renderAnchor():this.renderButton()}handleKeydown(e){const{code:t}=e;switch(t){case"Space":e.preventDefault(),typeof this.href=="undefined"&&(this.addEventListener("keyup",this.handleKeyup),this.active=!0);break;default:break}}handleKeypress(e){const{code:t}=e;switch(t){case"Enter":case"NumpadEnter":this.click();break;default:break}}handleKeyup(e){const{code:t}=e;switch(t){case"Space":this.removeEventListener("keyup",this.handleKeyup),this.active=!1,this.click();break;default:break}}manageAnchor(){this.href&&this.href.length>0?(!this.hasAttribute("role")||this.getAttribute("role")==="button")&&this.setAttribute("role","link"):(!this.hasAttribute("role")||this.getAttribute("role")==="link")&&this.setAttribute("role","button")}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),e.has("label")&&(this.label?this.setAttribute("aria-label",this.label):this.removeAttribute("aria-label")),this.manageAnchor(),this.addEventListener("keydown",this.handleKeydown),this.addEventListener("keypress",this.handleKeypress)}updated(e){super.updated(e),e.has("href")&&this.manageAnchor(),this.anchorElement&&(this.anchorElement.addEventListener("focus",this.proxyFocus),this.anchorElement.tabIndex=-1)}update(e){super.update(e),e.has("label")&&(this.label?this.setAttribute("aria-label",this.label):this.removeAttribute("aria-label"))}}s([h({type:Boolean,reflect:!0})],ButtonBase.prototype,"active",2),s([h({type:String})],ButtonBase.prototype,"type",2),s([p(".anchor")],ButtonBase.prototype,"anchorElement",2);
|
|
13
13
|
//# sourceMappingURL=ButtonBase.js.map
|
package/src/ButtonBase.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ButtonBase.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport buttonStyles from './button-base.css.js';\n\n/**\n * @slot - text content to be displayed in the Button element\n * @slot icon - icon element(s) to display at the start of the button\n */\nexport class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), '', [\n 'sp-overlay,sp-tooltip',\n]) {\n public static override get styles(): CSSResultArray {\n return [buttonStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: String })\n public type: 'button' | 'submit' | 'reset' = 'button';\n\n @query('.anchor')\n private anchorElement!:
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,cAAAC,MAAkB,qDAC3B,OAAS,aAAAC,MAAiB,mDAC1B,OAAS,mBAAAC,MAAuB,2DAChC,OAAOC,MAAkB,uBAMlB,aAAM,mBAAmBD,EAAgBF,EAAWC,CAAS,EAAG,GAAI,CACvE,uBACJ,CAAC,CAAE,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport buttonStyles from './button-base.css.js';\n\n/**\n * @slot - text content to be displayed in the Button element\n * @slot icon - icon element(s) to display at the start of the button\n */\nexport class ButtonBase extends ObserveSlotText(LikeAnchor(Focusable), '', [\n 'sp-overlay,sp-tooltip',\n]) {\n public static override get styles(): CSSResultArray {\n return [buttonStyles];\n }\n\n // TODO we need to document this property for consumers,\n // as it's not a 1:1 equivalent to active\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n /**\n * The default behavior of the button.\n * Possible values are: `button` (default), `submit`, and `reset`.\n */\n @property({ type: String })\n public type: 'button' | 'submit' | 'reset' = 'button';\n\n /**\n * HTML anchor element that component clicks by proxy\n */\n @query('.anchor')\n private anchorElement!: HTMLAnchorElement;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n protected get buttonContent(): TemplateResult[] {\n const content = [\n html`\n <slot name=\"icon\" ?icon-only=${!this.hasLabel}></slot>\n `,\n html`\n <span id=\"label\">\n <slot @slotchange=${this.manageTextObservedSlot}></slot>\n </span>\n `,\n ];\n return content;\n }\n\n constructor() {\n super();\n this.proxyFocus = this.proxyFocus.bind(this);\n\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n }\n\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n // click HTML anchor element by proxy\n this.anchorElement.click();\n handled = true;\n // if the button type is `submit` or `reset`\n } else if (this.type !== 'button') {\n // create an HTML Button Element by proxy, click it, and remove it\n const proxy = document.createElement('button');\n proxy.type = this.type;\n this.insertAdjacentElement('afterend', proxy);\n proxy.click();\n proxy.remove();\n handled = true;\n }\n return handled;\n }\n\n public override renderAnchor(): TemplateResult {\n return html`\n ${this.buttonContent}\n ${super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })}\n `;\n }\n\n protected renderButton(): TemplateResult {\n return html`\n ${this.buttonContent}\n `;\n }\n\n protected override render(): TemplateResult {\n return this.href && this.href.length > 0\n ? this.renderAnchor()\n : this.renderButton();\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n // allows button to activate when `Space` is pressed\n if (typeof this.href === 'undefined') {\n this.addEventListener('keyup', this.handleKeyup);\n this.active = true;\n }\n break;\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n // allows button or link to be activated with `Enter` and `NumpadEnter`\n this.click();\n break;\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.active = false;\n this.click();\n break;\n default:\n break;\n }\n }\n\n private manageAnchor(): void {\n // for a link\n if (this.href && this.href.length > 0) {\n // if the role is set to button\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'button'\n ) {\n // change role to link\n this.setAttribute('role', 'link');\n }\n // else for a button\n } else {\n // if the role is set to link\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'link'\n ) {\n // change role to button\n this.setAttribute('role', 'button');\n }\n }\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n if (changed.has('label')) {\n if (this.label) {\n this.setAttribute('aria-label', this.label);\n } else {\n this.removeAttribute('aria-label');\n }\n }\n this.manageAnchor();\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has('href')) {\n this.manageAnchor();\n }\n\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n }\n protected override update(changes: PropertyValues): void {\n super.update(changes);\n if (changes.has('label')) {\n if (this.label) {\n this.setAttribute('aria-label', this.label);\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,MAGG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,cAAAC,MAAkB,qDAC3B,OAAS,aAAAC,MAAiB,mDAC1B,OAAS,mBAAAC,MAAuB,2DAChC,OAAOC,MAAkB,uBAMlB,aAAM,mBAAmBD,EAAgBF,EAAWC,CAAS,EAAG,GAAI,CACvE,uBACJ,CAAC,CAAE,CA6CC,aAAc,CACV,MAAM,EAtCV,KAAO,OAAS,GAOhB,KAAO,KAAsC,SAgCzC,KAAK,WAAa,KAAK,WAAW,KAAK,IAAI,EAE3C,KAAK,iBAAiB,QAAS,KAAK,mBAAoB,CACpD,QAAS,EACb,CAAC,CACL,CAnDA,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAY,CACxB,CAoBA,IAAoB,cAA4B,CAC5C,OAAO,IACX,CAEA,IAAc,UAAoB,CAC9B,OAAO,KAAK,cAChB,CAEA,IAAc,eAAkC,CAW5C,MAVgB,CACZN;AAAA,+CACmC,CAAC,KAAK,QAAQ;AAAA,cAEjDA;AAAA;AAAA,wCAE4B,KAAK,sBAAsB;AAAA;AAAA,aAG3D,CAEJ,CAWQ,mBAAmBO,EAA8B,CACrD,GAAI,KAAK,SACL,OAAAA,EAAM,eAAe,EACrBA,EAAM,yBAAyB,EAC/BA,EAAM,gBAAgB,EACf,GAGP,KAAK,iBAAiB,CAG9B,CAEQ,YAAmB,CACvB,KAAK,MAAM,CACf,CAEQ,kBAA4B,CAChC,IAAIC,EAAU,GACd,GAAI,KAAK,cAEL,KAAK,cAAc,MAAM,EACzBA,EAAU,WAEH,KAAK,OAAS,SAAU,CAE/B,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AG9B,KAAK,aAAa,OAAQ,QAAQ,CAG9C,CAEmB,aAAaC,EAA+B,CAC3D,MAAM,aAAaA,CAAO,EACrB,KAAK,aAAa,UAAU,GAC7B,KAAK,aAAa,WAAY,GAAG,EAEjCA,EAAQ,IAAI,OAAO,IACf,KAAK,MACL,KAAK,aAAa,aAAc,KAAK,KAAK,EAE1C,KAAK,gBAAgB,YAAY,GAGzC,KAAK,aAAa,EAClB,KAAK,iBAAiB,UAAW,KAAK,aAAa,EACnD,KAAK,iBAAiB,WAAY,KAAK,cAAc,CACzD,CAEmB,QAAQA,EAA+B,CACtD,MAAM,QAAQA,CAAO,EACjBA,EAAQ,IAAI,MAAM,GAClB,KAAK,aAAa,EAGlB,KAAK,gBACL,KAAK,cAAc,iBAAiB,QAAS,KAAK,UAAU,EAC5D,KAAK,cAAc,SAAW,GAEtC,CACmB,OAAOC,EAA+B,CACrD,MAAM,OAAOA,CAAO,EAChBA,EAAQ,IAAI,OAAO,IACf,KAAK,MACL,KAAK,aAAa,aAAc,KAAK,KAAK,EAE1C,KAAK,gBAAgB,YAAY,EAG7C,CACJ,CAjNWC,EAAA,CADNZ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GATjC,WAUF,sBAOAY,EAAA,CADNZ,EAAS,CAAE,KAAM,MAAO,CAAC,GAhBjB,WAiBF,oBAMCY,EAAA,CADPX,EAAM,SAAS,GAtBP,WAuBD",
|
|
6
6
|
"names": ["html", "property", "query", "LikeAnchor", "Focusable", "ObserveSlotText", "buttonStyles", "event", "handled", "proxy", "code", "changed", "changes", "__decorateClass"]
|
|
7
7
|
}
|
package/src/ClearButton.dev.js
CHANGED
|
@@ -21,7 +21,6 @@ import "@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js";
|
|
|
21
21
|
import "@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js";
|
|
22
22
|
import "@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js";
|
|
23
23
|
import crossMediumStyles from "@spectrum-web-components/icon/src/spectrum-icon-cross.css.js";
|
|
24
|
-
import crossMediumOverrides from "@spectrum-web-components/icon/src/icon-cross-overrides.css.js";
|
|
25
24
|
const crossIcon = {
|
|
26
25
|
s: () => html`
|
|
27
26
|
<sp-icon-cross75
|
|
@@ -56,12 +55,7 @@ export class ClearButton extends SizedMixin(StyledButton, {
|
|
|
56
55
|
this.variant = "";
|
|
57
56
|
}
|
|
58
57
|
static get styles() {
|
|
59
|
-
return [
|
|
60
|
-
...super.styles,
|
|
61
|
-
buttonStyles,
|
|
62
|
-
crossMediumStyles,
|
|
63
|
-
crossMediumOverrides
|
|
64
|
-
];
|
|
58
|
+
return [...super.styles, buttonStyles, crossMediumStyles];
|
|
65
59
|
}
|
|
66
60
|
get buttonContent() {
|
|
67
61
|
return [crossIcon[this.size]()];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ClearButton.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.dev.js'\nimport buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,kBAAkB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.dev.js'\nimport buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\n\nconst crossIcon: Record<string, () => TemplateResult> = {\n s: () => html`\n <sp-icon-cross75\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross75\"\n ></sp-icon-cross75>\n `,\n m: () => html`\n <sp-icon-cross100\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross100\"\n ></sp-icon-cross100>\n `,\n l: () => html`\n <sp-icon-cross200\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross200\"\n ></sp-icon-cross200>\n `,\n xl: () => html`\n <sp-icon-cross300\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross300\"\n ></sp-icon-cross300>\n `,\n};\n\n/**\n * @element sp-clear-button\n *\n * @slot - text label of the Clear Button\n * @slot icon - The icon to use for Clear Button\n */\nexport class ClearButton extends SizedMixin(StyledButton, {\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles, crossMediumStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\n public variant: 'overBackground' | '' = '';\n\n protected override get buttonContent(): TemplateResult[] {\n return [crossIcon[this.size]()];\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"fill\">${super.render()}</div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,kBAAkB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,uBAAuB;AAE9B,MAAM,YAAkD;AAAA,EACpD,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAMd;AAQO,aAAM,oBAAoB,WAAW,cAAc;AAAA,EACtD,eAAe;AACnB,CAAC,EAAE;AAAA,EAFI;AAAA;AAWH,SAAO,UAAiC;AAAA;AAAA,EARxC,WAA2B,SAAyB;AAChD,WAAO,CAAC,GAAG,MAAM,QAAQ,cAAc,iBAAiB;AAAA,EAC5D;AAAA,EAQA,IAAuB,gBAAkC;AACrD,WAAO,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;AAAA,EAClC;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA,gCACiB,MAAM,OAAO,CAAC;AAAA;AAAA,EAE1C;AACJ;AAXW;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAVlB,YAWF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/ClearButton.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=(e,o,c,t)=>{for(var s=t>1?void 0:t?m(o,c):o,i=e.length-1,n;i>=0;i--)(n=e[i])&&(s=(t?n(o,c,s):n(s))||s);return t&&s&&p(o,c,s),s};import{html as r,SizedMixin as u}from"@spectrum-web-components/base";import{property as a}from"@spectrum-web-components/base/src/decorators.js";import{StyledButton as d}from"./StyledButton.js";import I from"@spectrum-web-components/clear-button/src/clear-button.css.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js";import S from"@spectrum-web-components/icon/src/spectrum-icon-cross.css.js";const f={s:()=>r`
|
|
2
2
|
<sp-icon-cross75
|
|
3
3
|
slot="icon"
|
|
4
4
|
class="icon spectrum-UIIcon-Cross75"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
slot="icon"
|
|
19
19
|
class="icon spectrum-UIIcon-Cross300"
|
|
20
20
|
></sp-icon-cross300>
|
|
21
|
-
`};export class ClearButton extends u(d,{noDefaultSize:!0}){constructor(){super(...arguments);this.variant=""}static get styles(){return[...super.styles,
|
|
21
|
+
`};export class ClearButton extends u(d,{noDefaultSize:!0}){constructor(){super(...arguments);this.variant=""}static get styles(){return[...super.styles,I,S]}get buttonContent(){return[f[this.size]()]}render(){return r`
|
|
22
22
|
<div class="fill">${super.render()}</div>
|
|
23
|
-
`}}
|
|
23
|
+
`}}l([a({reflect:!0})],ClearButton.prototype,"variant",2);
|
|
24
24
|
//# sourceMappingURL=ClearButton.js.map
|
package/src/ClearButton.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["ClearButton.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,EACA,cAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,gBAAAC,MAAoB,oBAC7B,OAAOC,MAAkB,gEACzB,MAAO,6DACP,MAAO,8DACP,MAAO,8DACP,MAAO,8DACP,OAAOC,MAAuB,+
|
|
6
|
-
"names": ["html", "SizedMixin", "property", "StyledButton", "buttonStyles", "crossMediumStyles", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\n\nconst crossIcon: Record<string, () => TemplateResult> = {\n s: () => html`\n <sp-icon-cross75\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross75\"\n ></sp-icon-cross75>\n `,\n m: () => html`\n <sp-icon-cross100\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross100\"\n ></sp-icon-cross100>\n `,\n l: () => html`\n <sp-icon-cross200\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross200\"\n ></sp-icon-cross200>\n `,\n xl: () => html`\n <sp-icon-cross300\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross300\"\n ></sp-icon-cross300>\n `,\n};\n\n/**\n * @element sp-clear-button\n *\n * @slot - text label of the Clear Button\n * @slot icon - The icon to use for Clear Button\n */\nexport class ClearButton extends SizedMixin(StyledButton, {\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles, crossMediumStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\n public variant: 'overBackground' | '' = '';\n\n protected override get buttonContent(): TemplateResult[] {\n return [crossIcon[this.size]()];\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"fill\">${super.render()}</div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EACA,cAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,gBAAAC,MAAoB,oBAC7B,OAAOC,MAAkB,gEACzB,MAAO,6DACP,MAAO,8DACP,MAAO,8DACP,MAAO,8DACP,OAAOC,MAAuB,+DAE9B,MAAMC,EAAkD,CACpD,EAAG,IAAMN;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,EAAG,IAAMA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,EAAG,IAAMA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,GAAI,IAAMA;AAAA;AAAA;AAAA;AAAA;AAAA,KAMd,EAQO,aAAM,oBAAoBC,EAAWE,EAAc,CACtD,cAAe,EACnB,CAAC,CAAE,CAFI,kCAWH,KAAO,QAAiC,GARxC,WAA2B,QAAyB,CAChD,MAAO,CAAC,GAAG,MAAM,OAAQC,EAAcC,CAAiB,CAC5D,CAQA,IAAuB,eAAkC,CACrD,MAAO,CAACC,EAAU,KAAK,IAAI,EAAE,CAAC,CAClC,CAEmB,QAAyB,CACxC,OAAON;AAAA,gCACiB,MAAM,OAAO,CAAC;AAAA,SAE1C,CACJ,CAXWO,EAAA,CADNL,EAAS,CAAE,QAAS,EAAK,CAAC,GAVlB,YAWF",
|
|
6
|
+
"names": ["html", "SizedMixin", "property", "StyledButton", "buttonStyles", "crossMediumStyles", "crossIcon", "__decorateClass"]
|
|
7
7
|
}
|
package/src/CloseButton.dev.js
CHANGED
|
@@ -21,7 +21,6 @@ import "@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js";
|
|
|
21
21
|
import "@spectrum-web-components/icons-ui/icons/sp-icon-cross400.js";
|
|
22
22
|
import "@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js";
|
|
23
23
|
import crossMediumStyles from "@spectrum-web-components/icon/src/spectrum-icon-cross.css.js";
|
|
24
|
-
import crossMediumOverrides from "@spectrum-web-components/icon/src/icon-cross-overrides.css.js";
|
|
25
24
|
const crossIcon = {
|
|
26
25
|
s: () => html`
|
|
27
26
|
<sp-icon-cross200
|
|
@@ -56,12 +55,7 @@ export class CloseButton extends SizedMixin(StyledButton, {
|
|
|
56
55
|
this.variant = "";
|
|
57
56
|
}
|
|
58
57
|
static get styles() {
|
|
59
|
-
return [
|
|
60
|
-
...super.styles,
|
|
61
|
-
buttonStyles,
|
|
62
|
-
crossMediumStyles,
|
|
63
|
-
crossMediumOverrides
|
|
64
|
-
];
|
|
58
|
+
return [...super.styles, buttonStyles, crossMediumStyles];
|
|
65
59
|
}
|
|
66
60
|
get buttonContent() {
|
|
67
61
|
return [crossIcon[this.size]()];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["CloseButton.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.dev.js'\nimport buttonStyles from '@spectrum-web-components/close-button/src/close-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross400.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,kBAAkB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.dev.js'\nimport buttonStyles from '@spectrum-web-components/close-button/src/close-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross400.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\nimport type { ButtonStaticColors } from './Button.dev.js'\n\nconst crossIcon: Record<string, () => TemplateResult> = {\n s: () => html`\n <sp-icon-cross200\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross200\"\n ></sp-icon-cross200>\n `,\n m: () => html`\n <sp-icon-cross300\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross300\"\n ></sp-icon-cross300>\n `,\n l: () => html`\n <sp-icon-cross400\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross400\"\n ></sp-icon-cross400>\n `,\n xl: () => html`\n <sp-icon-cross500\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross500\"\n ></sp-icon-cross500>\n `,\n};\n\n/**\n * @element sp-close-button\n *\n * @slot - text label of the Close Button\n * @slot icon - The icon to use for Close Button\n */\nexport class CloseButton extends SizedMixin(StyledButton, {\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles, crossMediumStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\n public variant: ButtonStaticColors | '' = '';\n\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n protected override get buttonContent(): TemplateResult[] {\n return [crossIcon[this.size]()];\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,kBAAkB;AACzB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,uBAAuB;AAG9B,MAAM,YAAkD;AAAA,EACpD,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAMd;AAQO,aAAM,oBAAoB,WAAW,cAAc;AAAA,EACtD,eAAe;AACnB,CAAC,EAAE;AAAA,EAFI;AAAA;AAWH,SAAO,UAAmC;AAAA;AAAA,EAR1C,WAA2B,SAAyB;AAChD,WAAO,CAAC,GAAG,MAAM,QAAQ,cAAc,iBAAiB;AAAA,EAC5D;AAAA,EAWA,IAAuB,gBAAkC;AACrD,WAAO,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;AAAA,EAClC;AACJ;AARW;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAVlB,YAWF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,MAAM,WAAW,eAAe,CAAC;AAAA,GAb7C,YAcF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/CloseButton.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=(c,
|
|
1
|
+
"use strict";var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=(c,s,e,o)=>{for(var t=o>1?void 0:o?u(s,e):s,i=c.length-1,n;i>=0;i--)(n=c[i])&&(t=(o?n(s,e,t):n(t))||t);return o&&t&&m(s,e,t),t};import{html as r,SizedMixin as a}from"@spectrum-web-components/base";import{property as p}from"@spectrum-web-components/base/src/decorators.js";import{StyledButton as S}from"./StyledButton.js";import f from"@spectrum-web-components/close-button/src/close-button.css.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross400.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-cross500.js";import y from"@spectrum-web-components/icon/src/spectrum-icon-cross.css.js";const C={s:()=>r`
|
|
2
2
|
<sp-icon-cross200
|
|
3
3
|
slot="icon"
|
|
4
4
|
class="icon spectrum-UIIcon-Cross200"
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
slot="icon"
|
|
19
19
|
class="icon spectrum-UIIcon-Cross500"
|
|
20
20
|
></sp-icon-cross500>
|
|
21
|
-
`};export class CloseButton extends a(S,{noDefaultSize:!0}){constructor(){super(...arguments);this.variant=""}static get styles(){return[...super.styles,
|
|
21
|
+
`};export class CloseButton extends a(S,{noDefaultSize:!0}){constructor(){super(...arguments);this.variant=""}static get styles(){return[...super.styles,f,y]}get buttonContent(){return[C[this.size]()]}}l([p({reflect:!0})],CloseButton.prototype,"variant",2),l([p({reflect:!0,attribute:"static-color"})],CloseButton.prototype,"staticColor",2);
|
|
22
22
|
//# sourceMappingURL=CloseButton.js.map
|