@spectrum-web-components/button 0.17.5 → 0.18.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/package.json +9 -9
- package/src/Button.js.map +1 -1
- package/src/ButtonBase.js.map +1 -1
- package/src/ClearButton.js.map +1 -1
- package/src/CloseButton.js.map +1 -1
- package/src/StyledButton.js.map +1 -1
- package/stories/index.js +7 -1
- package/stories/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -48,21 +48,21 @@
|
|
|
48
48
|
"lit-html"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@spectrum-web-components/base": "^0.5.
|
|
52
|
-
"@spectrum-web-components/clear-button": "^0.1.
|
|
53
|
-
"@spectrum-web-components/close-button": "^0.1.
|
|
54
|
-
"@spectrum-web-components/icon": "^0.11.
|
|
55
|
-
"@spectrum-web-components/icons-ui": "^0.8.
|
|
56
|
-
"@spectrum-web-components/shared": "^0.14.
|
|
51
|
+
"@spectrum-web-components/base": "^0.5.8",
|
|
52
|
+
"@spectrum-web-components/clear-button": "^0.1.7",
|
|
53
|
+
"@spectrum-web-components/close-button": "^0.1.7",
|
|
54
|
+
"@spectrum-web-components/icon": "^0.11.11",
|
|
55
|
+
"@spectrum-web-components/icons-ui": "^0.8.11",
|
|
56
|
+
"@spectrum-web-components/shared": "^0.14.4",
|
|
57
57
|
"tslib": "^2.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@spectrum-css/button": "^6.0.
|
|
60
|
+
"@spectrum-css/button": "^6.0.13"
|
|
61
61
|
},
|
|
62
62
|
"types": "./src/index.d.ts",
|
|
63
63
|
"customElements": "custom-elements.json",
|
|
64
64
|
"sideEffects": [
|
|
65
65
|
"./sp-*.js"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "3be62133721efba844cd7032566a2c49ed6d9875"
|
|
68
68
|
}
|
package/src/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["Button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAGH,UAAU,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAW3C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,OAAO;IACP,OAAO;CACV,CAAC;AAIF;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU,CAAC,YAAY,CAAC;IAApD;;QAkCY,aAAQ,GAAmB,QAAQ,CAAC;QAE5C;;WAEG;QAEI,cAAS,GAAqB,MAAM,CAAC;IAgBhD,CAAC;IAvDU,MAAM,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["Button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAGH,UAAU,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAW3C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,OAAO;IACP,OAAO;CACV,CAAC;AAIF;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ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C,SAAS,CAAC,EAAE;YAC/B,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAC9C;IACL,CAAC;CACJ;AA/CG;IADC,QAAQ,EAAE;qCAGV;AA6BD;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACgB;AAM5C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mCAG3B","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 PropertyValues,\n SizedMixin,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from './button.css.js';\n\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\nexport type ButtonStatics = 'white' | 'black';\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStatics\n | DeprecatedButtonVariants;\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\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(StyledButton) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\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 break;\n case 'overBackground':\n this._variant = 'white';\n this.treatment = 'outline';\n break;\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 visual variant 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 protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n }\n}\n"]}
|
package/src/ButtonBase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["ButtonBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EACH,IAAI,GAGP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAC;AAC7E,OAAO,EACH,mBAAmB,EACnB,eAAe,GAClB,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU,CACtC,eAAe,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CACnE;IAyCG;QACI,KAAK,EAAE,CAAC;QApCL,WAAM,GAAG,KAAK,CAAC;QAGf,SAAI,GAAkC,QAAQ,CAAC;QAkClD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE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I,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;gBAC/D,IAAI,CAAC,mBAAmB,CACpB,cAAc,EACd,IAAI,CAAC,kBAAkB,CAC1B,CAAC;aACL;SACJ;QACD,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC9D,IAAI,CAAC,aAAa,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;SACpC;IACL,CAAC;CACJ;AAnNG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACrB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAC2B;AAOtD;IADC,KAAK,CAAC,SAAS,CAAC;iDACyB","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 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 {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\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 LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\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 protected get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @query('.anchor')\n private anchorElement!: HTMLButtonElement;\n\n public get focusElement(): HTMLElement {\n return this;\n }\n\n protected get buttonContent(): TemplateResult[] {\n const content = [\n html`\n <div id=\"label\" ?hidden=${!this.hasLabel}>\n <slot\n id=\"slot\"\n @slotchange=${this.manageTextObservedSlot}\n ></slot>\n </div>\n `,\n ];\n if (this.hasIcon) {\n content.unshift(html`\n <slot name=\"icon\" ?icon-only=${!this.hasLabel}></slot>\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 public click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\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\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n } else if (this.type !== 'button') {\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 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 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 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 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 handleRemoveActive(): void {\n this.active = false;\n }\n\n private handlePointerdown(): void {\n this.active = true;\n }\n\n private manageAnchor(): void {\n if (this.href && this.href.length > 0) {\n if (this.getAttribute('role') === 'button') {\n this.setAttribute('role', 'link');\n }\n this.removeEventListener('click', this.shouldProxyClick);\n } else {\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'link'\n ) {\n this.setAttribute('role', 'button');\n }\n this.addEventListener('click', this.shouldProxyClick);\n }\n }\n\n protected firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = 0;\n }\n this.manageAnchor();\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n this.addEventListener('pointerdown', this.handlePointerdown);\n }\n\n protected updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has('href')) {\n this.manageAnchor();\n }\n if (changed.has('label')) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (changed.has('active')) {\n if (this.active) {\n this.addEventListener('focusout', this.handleRemoveActive);\n this.addEventListener('pointerup', this.handleRemoveActive);\n this.addEventListener('pointerleave', this.handleRemoveActive);\n } else {\n this.removeEventListener('focusout', this.handleRemoveActive);\n this.removeEventListener('pointerup', this.handleRemoveActive);\n this.removeEventListener(\n 'pointerleave',\n this.handleRemoveActive\n );\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["ButtonBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EACH,IAAI,GAGP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAC;AAC7E,OAAO,EACH,mBAAmB,EACnB,eAAe,GAClB,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU,CACtC,eAAe,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CACnE;IAyCG;QACI,KAAK,EAAE,CAAC;QApCL,WAAM,GAAG,KAAK,CAAC;QAGf,SAAI,GAAkC,QAAQ,CAAC;QAkClD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE;YACpD,OAAO,EAAE,IAAI;SAChB,CAAC,CAAC;IACP,CAAC;IA/CD,IAAc,OAAO;QACjB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAQD,IAAc,QAAQ;QAClB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAKD,IAAoB,YAAY;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAc,aAAa;QACvB,MAAM,OAAO,GAAG;YACZ,IAAI,CAAA;0CAC0B,CAAC,IAAI,CAAC,QAAQ;;;sCAGlB,IAAI,CAAC,sBAAsB;;;aAGpD;SACJ,CAAC;QACF,IAAI,IAAI,CAAC,OAAO,EAA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EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAC2B;AAOtD;IADC,KAAK,CAAC,SAAS,CAAC;iDACyB","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 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 {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\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 LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\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 protected get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @query('.anchor')\n private anchorElement!: HTMLButtonElement;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get buttonContent(): TemplateResult[] {\n const content = [\n html`\n <div id=\"label\" ?hidden=${!this.hasLabel}>\n <slot\n id=\"slot\"\n @slotchange=${this.manageTextObservedSlot}\n ></slot>\n </div>\n `,\n ];\n if (this.hasIcon) {\n content.unshift(html`\n <slot name=\"icon\" ?icon-only=${!this.hasLabel}></slot>\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 public override click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\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\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n } else if (this.type !== 'button') {\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 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 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 handleRemoveActive(): void {\n this.active = false;\n }\n\n private handlePointerdown(): void {\n this.active = true;\n }\n\n private manageAnchor(): void {\n if (this.href && this.href.length > 0) {\n if (this.getAttribute('role') === 'button') {\n this.setAttribute('role', 'link');\n }\n this.removeEventListener('click', this.shouldProxyClick);\n } else {\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'link'\n ) {\n this.setAttribute('role', 'button');\n }\n this.addEventListener('click', this.shouldProxyClick);\n }\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = 0;\n }\n this.manageAnchor();\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n this.addEventListener('pointerdown', this.handlePointerdown);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has('href')) {\n this.manageAnchor();\n }\n if (changed.has('label')) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (changed.has('active')) {\n if (this.active) {\n this.addEventListener('focusout', this.handleRemoveActive);\n this.addEventListener('pointerup', this.handleRemoveActive);\n this.addEventListener('pointerleave', this.handleRemoveActive);\n } else {\n this.removeEventListener('focusout', this.handleRemoveActive);\n this.removeEventListener('pointerup', this.handleRemoveActive);\n this.removeEventListener(\n 'pointerleave',\n this.handleRemoveActive\n );\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n }\n}\n"]}
|
package/src/ClearButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearButton.js","sourceRoot":"","sources":["ClearButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,UAAU,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,+DAA+D,CAAC;AACzF,OAAO,4DAA4D,CAAC;AACpE,OAAO,6DAA6D,CAAC;AACrE,OAAO,6D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EF;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,YAAY,CAAC;IAAzD;;QAKI;;WAEG;QAEI,YAAO,GAA0B,EAAE,CAAC;IAW/C,CAAC;IAnBU,MAAM,KAAc,MAAM;QAC7B,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAQD,IAAuB,aAAa;QAChC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEkB,MAAM;QACrB,OAAO,IAAI,CAAA;gCACa,KAAK,CAAC,MAAM,EAAE;SACrC,CAAC;IACN,CAAC;CACJ;AAXG;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACe","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 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"]}
|
package/src/CloseButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseButton.js","sourceRoot":"","sources":["CloseButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,UAAU,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,+DAA+D,CAAC;AACzF,OAAO,4DAA4D,CAAC;AACpE,OAAO,6DAA6D,CAAC;AACrE,OAAO,6DAA6D,CAAC;AACrE,OAAO,6DAA6D,CAAC;AACrE,OAAO,iBAAiB,MAAM,8DAA8D,CAAC;AAG7F,MAAM,SA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YAAO,GAAuB,EAAE,CAAC;IAK5C,CAAC;IAbU,MAAM,KAAc,MAAM;QAC7B,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAQD,IAAuB,aAAa;QAChC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACJ;AALG;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACY","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/close-button/src/close-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';\nimport type { ButtonStatics } from './Button.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-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 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: ButtonStatics | '' = '';\n\n protected override get buttonContent(): TemplateResult[] {\n return [crossIcon[this.size]()];\n }\n}\n"]}
|
package/src/StyledButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledButton.js","sourceRoot":"","sources":["StyledButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAGF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAEhD,MAAM,OAAO,YAAa,SAAQ,UAAU;IACjC,MAAM,
|
|
1
|
+
{"version":3,"file":"StyledButton.js","sourceRoot":"","sources":["StyledButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAGF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAEhD,MAAM,OAAO,YAAa,SAAQ,UAAU;IACjC,MAAM,KAAc,MAAM;QAC7B,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;CACJ","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 { CSSResultArray } from '@spectrum-web-components/base';\nimport { ButtonBase } from './ButtonBase.js';\nimport buttonStyles from './button-base.css.js';\n\nexport class StyledButton extends ButtonBase {\n public static override get styles(): CSSResultArray {\n return [buttonStyles];\n }\n}\n"]}
|
package/stories/index.js
CHANGED
|
@@ -73,7 +73,13 @@ export const makeOverBackground = (variant) => (story) => {
|
|
|
73
73
|
: 'var(--spectrum-global-color-seafoam-600)';
|
|
74
74
|
return html `
|
|
75
75
|
<div
|
|
76
|
-
style="
|
|
76
|
+
style="
|
|
77
|
+
--mod-actionbutton-static-content-color: ${color};
|
|
78
|
+
background-color: ${color};
|
|
79
|
+
color: ${color};
|
|
80
|
+
padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250);
|
|
81
|
+
display: inline-block;
|
|
82
|
+
"
|
|
77
83
|
>
|
|
78
84
|
${story()}
|
|
79
85
|
</div>
|
package/stories/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,iBAAiB,CAAC;AACzB,OAAO,0CAA0C,CAAC;AAClD,OAAO,+DAA+D,CAAC;AAGvE,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,QAAQ,EAAE;QACN,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,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,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkB,EAAE;IAChE,OAAO,IAAI,CAAA;;;;;;;cAOD,eAAe,iCACV,KAAK,KACR,OAAO,EAAE,IAAI,CAAA;;;iBAGZ,IACH;;;cAGA,eAAe,iCACV,KAAK,KACR,OAAO,EAAE,IAAI,CAAA;sBACP,QAAQ;iBACb,IACH;;KAET,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAAuB,EACvB,SAA2B,EACb,EAAE;IAChB,OAAO,IAAI,CAAA;;;;sBAIO,OAAO;wBACL,SAAS;;;;;;;;;;KAU5B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAAkB,EAAE;IACtE,OAAO,IAAI,CAAA;;;;;;UAML,eAAe,CAAC,KAAK,CAAC;KAC3B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,kDAAkD,CAAC;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAC5D,eAAe,iCACR,KAAK,KACR,IAAI,IACN,CAAC;AAEP,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAAkB,EAAE,CACtE,eAAe,iCACR,KAAK,KACR,IAAI,EACJ,MAAM,EAAE,QAAQ,IAClB,CAAC","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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../sp-button.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\nimport { ButtonTreatments, ButtonVariants } from '../src/Button.js';\n\nexport const args = {\n disabled: false,\n variant: 'cta',\n};\n\nexport const argTypes = {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The visual variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'cta' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'cta',\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'overBackground',\n 'black',\n 'white',\n ],\n },\n },\n treatment: {\n name: 'treatment',\n type: { name: 'string', required: false },\n description: 'The visual treatment to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'fill' },\n },\n control: {\n type: 'inline-radio',\n options: ['fill', 'outline'],\n },\n },\n};\n\nexport interface Properties {\n variant?: ButtonVariants;\n treatment?: ButtonTreatments;\n quiet?: boolean;\n content?: TemplateResult;\n disabled?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n warning?: boolean;\n}\n\nexport const makeOverBackground =\n (variant?: 'white' | 'black') =>\n (story: () => TemplateResult): TemplateResult => {\n const color =\n variant === 'black'\n ? 'rgb(181, 209, 211)'\n : 'var(--spectrum-global-color-seafoam-600)';\n return html`\n <div\n style=\"background-color: ${color}; color: ${color}; padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250); display: inline-block;\"\n >\n ${story()}\n </div>\n `;\n };\n\nexport function renderButton(properties: Properties): TemplateResult {\n if (properties.variant) {\n return html`\n <sp-button\n variant=\"${properties.variant}\"\n treatment=\"${properties.treatment}\"\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size || 'm'}\n href=${ifDefined(properties.href)}\n target=${ifDefined(properties.target)}\n ?warning=${properties.warning}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n } else {\n return html`\n <sp-button\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n }\n}\n\nexport function renderButtonSet(properties: Properties): TemplateResult {\n const disabled = Object.assign({}, properties, { disabled: true });\n const icon = Object.assign({}, properties, {\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Click Me\n `,\n });\n return html`\n ${renderButton(properties)} ${renderButton(disabled)}\n ${renderButton(icon)}\n `;\n}\n\nexport const bellIcon = html`\n <svg slot=\"icon\" viewBox=\"0 0 36 36\" focusable=\"false\" aria-hidden=\"true\">\n <path\n d=\"M16 36a4.407 4.407 0 0 0 4-4h-8a4.407 4.407 0 0 0 4 4zm9.143-24.615c0-3.437-3.206-4.891-7.143-5.268V3a1.079 1.079 0 0 0-1.143-1h-1.714A1.079 1.079 0 0 0 14 3v3.117c-3.937.377-7.143 1.831-7.143 5.268C6.857 26.8 2 26.111 2 28.154V30h28v-1.846C30 26 25.143 26.8 25.143 11.385z\"\n ></path>\n </svg>\n`;\n\nexport const renderWithIcon = (props: Properties): TemplateResult => {\n return html`\n <style>\n .row {\n padding: 10px;\n }\n </style>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Help\n `,\n })}\n </div>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n ${bellIcon} Custom SVG\n `,\n })}\n </div>\n `;\n};\n\nexport const renderIconSizeOverridden = (\n variant: ButtonVariants,\n treatment: ButtonTreatments\n): TemplateResult => {\n return html`\n <sp-button\n label=\"Edit\"\n size=\"xl\"\n variant=${variant}\n treatment=${treatment}\n >\n <sp-icon-help slot=\"icon\" size=\"s\">Testing</sp-icon-help>\n </sp-button>\n <h1>For testing purposes only</h1>\n <p>\n This is a test to ensure that sizing the icon will still work when\n it's in the scope of a parent element. You shouldn't normally do\n this as it deviates from the Spectrum design specification.\n </p>\n `;\n};\n\nexport const renderMinWidthButton = (props: Properties): TemplateResult => {\n return html`\n <style>\n sp-button {\n min-width: 300px;\n }\n </style>\n ${renderButtonSet(props)}\n `;\n};\n\nconst href = 'https://github.com/adobe/spectrum-web-components';\n\nexport const renderLink = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n });\n\nexport const renderLinkWithTarget = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n target: '_blank',\n });\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,iBAAiB,CAAC;AACzB,OAAO,0CAA0C,CAAC;AAClD,OAAO,+DAA+D,CAAC;AAGvE,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,QAAQ,EAAE;QACN,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE;QAC1C,WAAW,EACP,4DAA4D;QAChE,KAAK,EAAE;YACH,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;YAC5B,YAAY,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SACnC;QACD,OAAO,EAAE;YACL,IAAI,EAAE,SAAS;SAClB;KACJ;IACD,OAAO,EAAE;QACL,IAAI,EAAE,SAAS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;;KAET,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAAuB,EACvB,SAA2B,EACb,EAAE;IAChB,OAAO,IAAI,CAAA;;;;sBAIO,OAAO;wBACL,SAAS;;;;;;;;;;KAU5B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAAkB,EAAE;IACtE,OAAO,IAAI,CAAA;;;;;;UAML,eAAe,CAAC,KAAK,CAAC;KAC3B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,kDAAkD,CAAC;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAC5D,eAAe,iCACR,KAAK,KACR,IAAI,IACN,CAAC;AAEP,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAAkB,EAAE,CACtE,eAAe,iCACR,KAAK,KACR,IAAI,EACJ,MAAM,EAAE,QAAQ,IAClB,CAAC","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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../sp-button.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\nimport { ButtonTreatments, ButtonVariants } from '../src/Button.js';\n\nexport const args = {\n disabled: false,\n variant: 'cta',\n};\n\nexport const argTypes = {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The visual variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'cta' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'cta',\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'overBackground',\n 'black',\n 'white',\n ],\n },\n },\n treatment: {\n name: 'treatment',\n type: { name: 'string', required: false },\n description: 'The visual treatment to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'fill' },\n },\n control: {\n type: 'inline-radio',\n options: ['fill', 'outline'],\n },\n },\n};\n\nexport interface Properties {\n variant?: ButtonVariants;\n treatment?: ButtonTreatments;\n quiet?: boolean;\n content?: TemplateResult;\n disabled?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n warning?: boolean;\n}\n\nexport const makeOverBackground =\n (variant?: 'white' | 'black') =>\n (story: () => TemplateResult): TemplateResult => {\n const color =\n variant === 'black'\n ? 'rgb(181, 209, 211)'\n : 'var(--spectrum-global-color-seafoam-600)';\n return html`\n <div\n style=\"\n --mod-actionbutton-static-content-color: ${color};\n background-color: ${color};\n color: ${color};\n padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250);\n display: inline-block;\n \"\n >\n ${story()}\n </div>\n `;\n };\n\nexport function renderButton(properties: Properties): TemplateResult {\n if (properties.variant) {\n return html`\n <sp-button\n variant=\"${properties.variant}\"\n treatment=\"${properties.treatment}\"\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size || 'm'}\n href=${ifDefined(properties.href)}\n target=${ifDefined(properties.target)}\n ?warning=${properties.warning}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n } else {\n return html`\n <sp-button\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n }\n}\n\nexport function renderButtonSet(properties: Properties): TemplateResult {\n const disabled = Object.assign({}, properties, { disabled: true });\n const icon = Object.assign({}, properties, {\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Click Me\n `,\n });\n return html`\n ${renderButton(properties)} ${renderButton(disabled)}\n ${renderButton(icon)}\n `;\n}\n\nexport const bellIcon = html`\n <svg slot=\"icon\" viewBox=\"0 0 36 36\" focusable=\"false\" aria-hidden=\"true\">\n <path\n d=\"M16 36a4.407 4.407 0 0 0 4-4h-8a4.407 4.407 0 0 0 4 4zm9.143-24.615c0-3.437-3.206-4.891-7.143-5.268V3a1.079 1.079 0 0 0-1.143-1h-1.714A1.079 1.079 0 0 0 14 3v3.117c-3.937.377-7.143 1.831-7.143 5.268C6.857 26.8 2 26.111 2 28.154V30h28v-1.846C30 26 25.143 26.8 25.143 11.385z\"\n ></path>\n </svg>\n`;\n\nexport const renderWithIcon = (props: Properties): TemplateResult => {\n return html`\n <style>\n .row {\n padding: 10px;\n }\n </style>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Help\n `,\n })}\n </div>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n ${bellIcon} Custom SVG\n `,\n })}\n </div>\n `;\n};\n\nexport const renderIconSizeOverridden = (\n variant: ButtonVariants,\n treatment: ButtonTreatments\n): TemplateResult => {\n return html`\n <sp-button\n label=\"Edit\"\n size=\"xl\"\n variant=${variant}\n treatment=${treatment}\n >\n <sp-icon-help slot=\"icon\" size=\"s\">Testing</sp-icon-help>\n </sp-button>\n <h1>For testing purposes only</h1>\n <p>\n This is a test to ensure that sizing the icon will still work when\n it's in the scope of a parent element. You shouldn't normally do\n this as it deviates from the Spectrum design specification.\n </p>\n `;\n};\n\nexport const renderMinWidthButton = (props: Properties): TemplateResult => {\n return html`\n <style>\n sp-button {\n min-width: 300px;\n }\n </style>\n ${renderButtonSet(props)}\n `;\n};\n\nconst href = 'https://github.com/adobe/spectrum-web-components';\n\nexport const renderLink = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n });\n\nexport const renderLinkWithTarget = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n target: '_blank',\n });\n"]}
|