@spectrum-web-components/button 0.15.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +10 -4
- package/package.json +7 -7
- package/src/Button.js +2 -1
- package/src/Button.js.map +1 -1
- package/src/ButtonBase.d.ts +1 -1
- package/src/ButtonBase.js +3 -2
- package/src/ButtonBase.js.map +1 -1
- package/src/ClearButton.d.ts +7 -1
- package/src/ClearButton.js +8 -2
- package/src/ClearButton.js.map +1 -1
- package/src/button.css.js +1 -1
- package/src/button.css.js.map +1 -1
- package/src/clear-button.css.js +165 -51
- package/src/clear-button.css.js.map +1 -1
- package/src/spectrum-button.css.js +1 -1
- package/src/spectrum-button.css.js.map +1 -1
- package/src/spectrum-clear-button.css.js +165 -51
- package/src/spectrum-clear-button.css.js.map +1 -1
- package/src/spectrum-config.js +27 -0
- package/stories/button-cta.stories.js +1 -1
- package/stories/button-cta.stories.js.map +1 -1
- package/stories/button-overBackground-sizes.stories.js +1 -1
- package/stories/button-overBackground-sizes.stories.js.map +1 -1
- package/stories/button-overBackground.stories.js +1 -1
- package/stories/button-overBackground.stories.js.map +1 -1
- package/stories/button-primary.stories.js +1 -1
- package/stories/button-primary.stories.js.map +1 -1
- package/stories/button-secondary.stories.js +1 -1
- package/stories/button-secondary.stories.js.map +1 -1
- package/stories/button-warning.stories.js +1 -1
- package/stories/button-warning.stories.js.map +1 -1
- package/stories/index.js +1 -1
- package/stories/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-warning.stories.js","sourceRoot":"","sources":["button-warning.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"button-warning.stories.js","sourceRoot":"","sources":["button-warning.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF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AC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAChE,eAAe,iCACR,KAAK,KACR,IAAI,EACJ,MAAM,EAAE,QAAQ,IAClB,CAAC;AACP,cAAc,CAAC,KAAK,GAAG;IACnB,IAAI,EAAE,2BAA2B;CACpC,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 { bellIcon, renderButtonSet } from './index.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Warning',\n args: {\n disabled: false,\n quiet: false,\n variant: 'negative',\n },\n 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 quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\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 'primary',\n 'secondary',\n 'negative',\n 'overBackground',\n ],\n },\n },\n },\n};\n\nconst variant = 'negative';\n\ninterface Properties {\n content?: TemplateResult;\n disabled?: boolean;\n quiet?: boolean;\n variant?: 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';\n}\n\nexport const Default = (props: Properties): TemplateResult =>\n renderButtonSet(props);\n\nexport const quiet = (props: Properties): TemplateResult =>\n renderButtonSet(props);\nquiet.args = {\n quiet: true,\n};\n\nexport const withIcon = (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 iconSizeOverridden = (): TemplateResult => {\n return html`\n <sp-button label=\"Edit\" size=\"xl\" variant=${variant}>\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 minWidthButton = (props: Properties): TemplateResult => {\n return html`\n <style>\n sp-button {\n min-width: 300px;\n }\n </style>\n ${renderButtonSet(props)}\n `;\n};\nminWidthButton.story = {\n name: 'min-width',\n};\n\nconst href = 'https://github.com/adobe/spectrum-web-components';\n\nexport const link = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n });\nlink.story = {\n name: 'href',\n};\n\nexport const linkWithTarget = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n target: '_blank',\n });\nlinkWithTarget.story = {\n name: 'href with target=\"_blank\"',\n};\n"]}
|
package/stories/index.js
CHANGED
|
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { html } from '@spectrum-web-components/base';
|
|
13
|
-
import { ifDefined } from '
|
|
13
|
+
import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
14
14
|
import '../sp-button.js';
|
|
15
15
|
import '@spectrum-web-components/icon/sp-icon.js';
|
|
16
16
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';
|
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,
|
|
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;AAavE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAC9B,KAA2B,EACb,EAAE,CAAC,IAAI,CAAA;;;;UAIf,KAAK,EAAE;;CAEhB,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,UAAsB;IAC/C,IAAI,UAAU,CAAC,OAAO,EAAE;QACpB,OAAO,IAAI,CAAA;;2BAEQ,UAAU,CAAC,OAAO;0BACnB,CAAC,CAAC,UAAU,CAAC,KAAK;4BAChB,CAAC,CAAC,UAAU,CAAC,QAAQ;uBAC1B,UAAU,CAAC,IAAI,IAAI,GAAG;uBACtB,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;yBACxB,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;2BAC1B,UAAU,CAAC,OAAO;;kBAE3B,UAAU,CAAC,OAAO,IAAI,UAAU;;SAEzC,CAAC;KACL;SAAM;QACH,OAAO,IAAI,CAAA;;0BAEO,CAAC,CAAC,UAAU,CAAC,KAAK;4BAChB,CAAC,CAAC,UAAU,CAAC,QAAQ;uBAC1B,UAAU,CAAC,IAAI;;kBAEpB,UAAU,CAAC,OAAO,IAAI,UAAU;;SAEzC,CAAC;KACL;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAsB;IAClD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE;QACvC,OAAO,EAAE,IAAI,CAAA;;;SAGZ;KACJ,CAAC,CAAC;IACH,OAAO,IAAI,CAAA;UACL,YAAY,CAAC,UAAU,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC;UAClD,YAAY,CAAC,IAAI,CAAC;KACvB,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAA;;;;;;CAM3B,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';\n\ninterface Properties {\n variant?: 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';\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 story: () => TemplateResult\n): TemplateResult => html`\n <div\n style=\"background-color: var(--spectrum-global-color-seafoam-600); color: var(--spectrum-global-color-seafoam-600); padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250); display: inline-block\"\n >\n ${story()}\n </div>\n`;\n\nexport function renderButton(properties: Properties): TemplateResult {\n if (properties.variant) {\n return html`\n <sp-button\n variant=\"${properties.variant}\"\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"]}
|