@spectrum-web-components/action-button 0.9.2-devmode2.0 → 0.10.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.
Files changed (65) hide show
  1. package/custom-elements.json +25 -1
  2. package/package.json +7 -7
  3. package/sp-action-button.dev.js +1 -0
  4. package/sp-action-button.dev.js.map +1 -1
  5. package/sp-action-button.js +1 -2
  6. package/sp-action-button.js.map +2 -2
  7. package/src/ActionButton.d.ts +1 -0
  8. package/src/ActionButton.dev.js +32 -20
  9. package/src/ActionButton.dev.js.map +2 -2
  10. package/src/ActionButton.js +3 -169
  11. package/src/ActionButton.js.map +3 -3
  12. package/src/action-button.css.dev.js +1 -0
  13. package/src/action-button.css.dev.js.map +1 -1
  14. package/src/action-button.css.js +2 -4
  15. package/src/action-button.css.js.map +2 -2
  16. package/src/index.dev.js +1 -0
  17. package/src/index.dev.js.map +1 -1
  18. package/src/index.js +1 -1
  19. package/src/index.js.map +1 -1
  20. package/src/spectrum-action-button.css.dev.js +1 -0
  21. package/src/spectrum-action-button.css.dev.js.map +1 -1
  22. package/src/spectrum-action-button.css.js +2 -4
  23. package/src/spectrum-action-button.css.js.map +2 -2
  24. package/stories/action-button-black-quiet.stories.js +1 -0
  25. package/stories/action-button-black-quiet.stories.js.map +1 -1
  26. package/stories/action-button-black.stories.js +1 -0
  27. package/stories/action-button-black.stories.js.map +1 -1
  28. package/stories/action-button-emphasized-quiet.stories.js +1 -0
  29. package/stories/action-button-emphasized-quiet.stories.js.map +1 -1
  30. package/stories/action-button-emphasized.stories.js +1 -0
  31. package/stories/action-button-emphasized.stories.js.map +1 -1
  32. package/stories/action-button-quiet.stories.js +1 -0
  33. package/stories/action-button-quiet.stories.js.map +1 -1
  34. package/stories/action-button-standard.stories.js +1 -0
  35. package/stories/action-button-standard.stories.js.map +1 -1
  36. package/stories/action-button-white-quiet.stories.js +1 -0
  37. package/stories/action-button-white-quiet.stories.js.map +1 -1
  38. package/stories/action-button-white.stories.js +1 -0
  39. package/stories/action-button-white.stories.js.map +1 -1
  40. package/stories/action-button.stories.js +1 -0
  41. package/stories/action-button.stories.js.map +1 -1
  42. package/stories/index.js +1 -0
  43. package/stories/index.js.map +1 -1
  44. package/test/action-button-black-quiet.test-vrt.js +1 -0
  45. package/test/action-button-black-quiet.test-vrt.js.map +1 -1
  46. package/test/action-button-black.test-vrt.js +1 -0
  47. package/test/action-button-black.test-vrt.js.map +1 -1
  48. package/test/action-button-emphasized-quiet.test-vrt.js +1 -0
  49. package/test/action-button-emphasized-quiet.test-vrt.js.map +1 -1
  50. package/test/action-button-emphasized.test-vrt.js +1 -0
  51. package/test/action-button-emphasized.test-vrt.js.map +1 -1
  52. package/test/action-button-quiet.test-vrt.js +1 -0
  53. package/test/action-button-quiet.test-vrt.js.map +1 -1
  54. package/test/action-button-standard.test-vrt.js +1 -0
  55. package/test/action-button-standard.test-vrt.js.map +1 -1
  56. package/test/action-button-white-quiet.test-vrt.js +1 -0
  57. package/test/action-button-white-quiet.test-vrt.js.map +1 -1
  58. package/test/action-button-white.test-vrt.js +1 -0
  59. package/test/action-button-white.test-vrt.js.map +1 -1
  60. package/test/action-button.test-vrt.js +1 -0
  61. package/test/action-button.test-vrt.js.map +1 -1
  62. package/test/action-button.test.js +60 -18
  63. package/test/action-button.test.js.map +2 -2
  64. package/test/benchmark/basic-test.js +1 -0
  65. package/test/benchmark/basic-test.js.map +1 -1
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button.stories.ts"],
4
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*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport type { Properties } from './index.js';\nimport { renderButton } from './index.js';\n\nimport '@spectrum-web-components/action-button/sp-action-button.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button',\n};\n\nfunction renderButtonsSelected(args: Properties): TemplateResult {\n const disabled = Object.assign({}, args, { disabled: true });\n const selected = Object.assign({}, args, { selected: true });\n return html`\n <sp-action-group\n ?emphasized=\"${!!args.emphasized}\"\n ?quiet=\"${!!args.quiet}\"\n >\n ${renderButton(args)} ${renderButton(selected)}\n ${renderButton(disabled)}\n </sp-action-group>\n `;\n}\n\nexport const toggles = (args: Properties): TemplateResult =>\n renderButtonsSelected(args);\ntoggles.args = {\n toggles: true,\n icon: html`\n <sp-icon-edit hidden slot=\"icon\"></sp-icon-edit>\n `,\n};\n\nexport const iconSizeOverridden = (args: Properties): TemplateResult => {\n return html`\n ${renderButton(args)}\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};\niconSizeOverridden.args = {\n label: '',\n size: 'xl',\n icon: html`\n <sp-icon-edit slot=\"icon\" size=\"s\"></sp-icon-edit>\n `,\n};\n"],
5
- "mappings": "AAWA;AACA;AACA;AAEA;AAEA;AAEA,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AACX;AAEA,+BAA+B,MAAkC;AAC7D,QAAM,WAAW,OAAO,OAAO,CAAC,GAAG,MAAM,EAAE,UAAU,KAAK,CAAC;AAC3D,QAAM,WAAW,OAAO,OAAO,CAAC,GAAG,MAAM,EAAE,UAAU,KAAK,CAAC;AAC3D,SAAO;AAAA;AAAA,2BAEgB,CAAC,CAAC,KAAK;AAAA,sBACZ,CAAC,CAAC,KAAK;AAAA;AAAA,cAEf,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": []
7
7
  }
package/stories/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { html } from "@spectrum-web-components/base";
2
3
  import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
3
4
  import "@spectrum-web-components/action-group/sp-action-group.js";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\n\nimport '@spectrum-web-components/action-button/sp-action-button.js';\n\nexport interface Properties {\n active?: boolean;\n quiet?: boolean;\n disabled?: boolean;\n selected?: boolean;\n toggles?: boolean;\n emphasized?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n variant?: 'white' | 'black';\n holdAffordance?: boolean;\n icon?: TemplateResult;\n label?: string;\n [prop: string]: unknown;\n}\n\nexport function renderButton(properties: Properties): TemplateResult {\n return html`\n <sp-action-button\n ?quiet=\"${!!properties.quiet}\"\n ?emphasized=\"${!!properties.emphasized}\"\n variant=\"${ifDefined(properties.variant)}\"\n ?disabled=${!!properties.disabled}\n ?selected=${!!properties.selected}\n ?toggles=${!!properties.toggles}\n size=${properties.size || 'm'}\n ?hold-affordance=${!!properties.holdAffordance}\n ?active=${!!properties.active}\n >\n ${properties.icon}${properties.label}\n </sp-action-button>\n `;\n}\n\nfunction renderGroup(properties: Properties): TemplateResult {\n const label = 'Edit';\n const holdAffordance = true;\n const icon = html`\n <sp-icon-edit slot=\"icon\"></sp-icon-edit>\n `;\n return html`\n <sp-action-group\n ?quiet=\"${!!properties.quiet}\"\n ?emphasized=\"${!!properties.emphasized}\"\n >\n ${renderButton({\n ...properties,\n label,\n })}\n ${renderButton({\n ...properties,\n label,\n icon,\n })}\n ${renderButton({\n ...properties,\n icon,\n })}\n ${renderButton({\n ...properties,\n icon,\n holdAffordance,\n })}\n </sp-action-group>\n `;\n}\n\nexport function renderButtons(properties: Properties): TemplateResult {\n const selected = true;\n const disabled = true;\n return html`\n <div\n style=\"display: flex; flex-direction: column; gap: var(--spectrum-global-dimension-size-100);\"\n >\n ${renderGroup({\n ...properties,\n })}\n ${renderGroup({\n ...properties,\n selected,\n })}\n ${renderGroup({\n ...properties,\n disabled,\n })}\n ${renderGroup({\n ...properties,\n disabled,\n selected,\n })}\n </div>\n `;\n}\n"],
5
- "mappings": "AAYA;AACA;AACA;AACA;AACA;AAEA;AAiBO,6BAAsB,YAAwC;AACjE,SAAO;AAAA;AAAA,sBAEW,CAAC,CAAC,WAAW;AAAA,2BACR,CAAC,CAAC,WAAW;AAAA,uBACjB,UAAU,WAAW,OAAO;AAAA,wBAC3B,CAAC,CAAC,WAAW;AAAA,wBACb,CAAC,CAAC,WAAW;AAAA,uBACd,CAAC,CAAC,WAAW;AAAA,mBACjB,WAAW,QAAQ;AAAA,+BACP,CAAC,CAAC,WAAW;AAAA,sBACtB,CAAC,CAAC,WAAW;AAAA;AAAA,cAErB,WAAW,OAAO,WAAW;AAAA;AAAA;AAG3C;AAEA,qBAAqB,YAAwC;AACzD,QAAM,QAAQ;AACd,QAAM,iBAAiB;AACvB,QAAM,OAAO;AAAA;AAAA;AAGb,SAAO;AAAA;AAAA,sBAEW,CAAC,CAAC,WAAW;AAAA,2BACR,CAAC,CAAC,WAAW;AAAA;AAAA,cAE1B,aAAa;AAAA,OACR;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cAE1B,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACJ,CAAC;AAAA,cACC,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ,CAAC;AAAA,cACC,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACJ,CAAC;AAAA,cACC,aAAa;AAAA,IACX,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ,CAAC;AAAA;AAAA;AAGb;AAEO,gBAAS,cAAc,YAAwC;AAClE,QAAM,WAAW;AACjB,QAAM,WAAW;AACjB,SAAO;AAAA;AAAA;AAAA;AAAA,cAIG,YAAY;AAAA,IACV,GAAG;AAAA,EACP,CAAC;AAAA,cACC,YAAY;AAAA,IACV,GAAG;AAAA,IACH;AAAA,EACJ,CAAC;AAAA,cACC,YAAY;AAAA,IACV,GAAG;AAAA,IACH;AAAA,EACJ,CAAC;AAAA,cACC,YAAY;AAAA,IACV,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ,CAAC;AAAA;AAAA;AAGb;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-black-quiet.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonBlackQuietStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-black-quiet.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-black-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonBlackQuietStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,iCAAiC,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,iCAAiC,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-black.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonBlackStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-black.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-black.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonBlackStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,4BAA4B,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,4BAA4B,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-emphasized-quiet.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonEmphasizedQuietStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-emphasized-quiet.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-emphasized-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonEmphasizedQuietStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,sCAAsC,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,sCAAsC,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-emphasized.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonEmphasizedStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-emphasized.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-emphasized.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonEmphasizedStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,iCAAiC,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,iCAAiC,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-quiet.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonQuietStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-quiet.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonQuietStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,4BAA4B,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,4BAA4B,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-standard.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonStandardStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-standard.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-standard.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStandardStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,+BAA+B,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,+BAA+B,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-white-quiet.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonWhiteQuietStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-white-quiet.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-white-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteQuietStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,iCAAiC,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,iCAAiC,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button-white.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonWhiteStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button-white.test-vrt.ts"],
4
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 * as stories from '../stories/action-button-white.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,4BAA4B,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,4BAA4B,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/action-button.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("ActionButtonStories", stories);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["action-button.test-vrt.ts"],
4
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 * as stories from '../stories/action-button.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStories', stories);\n"],
5
- "mappings": "AAYA;AACA;AAEA,eAAe,uBAAuB,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,uBAAuB,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,10 @@
1
+ "use strict";
1
2
  import "@spectrum-web-components/action-button/sp-action-button.js";
2
3
  import {
4
+ LONGPRESS_DURATION
5
+ } from "@spectrum-web-components/action-button";
6
+ import {
7
+ aTimeout,
3
8
  elementUpdated,
4
9
  expect,
5
10
  fixture,
@@ -11,29 +16,39 @@ import { spy } from "sinon";
11
16
  import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
12
17
  import { m as BlackActionButton } from "../stories/action-button-black.stories.js";
13
18
  describe("ActionButton", () => {
14
- testForLitDevWarnings(async () => await fixture(BlackActionButton(BlackActionButton.args)));
19
+ testForLitDevWarnings(
20
+ async () => await fixture(
21
+ BlackActionButton(BlackActionButton.args)
22
+ )
23
+ );
15
24
  it("loads default", async () => {
16
- const el = await fixture(html`
25
+ const el = await fixture(
26
+ html`
17
27
  <sp-action-button>Button</sp-action-button>
18
- `);
28
+ `
29
+ );
19
30
  await elementUpdated(el);
20
31
  expect(el).to.not.be.undefined;
21
32
  expect(el.textContent).to.include("Button");
22
33
  await expect(el).to.be.accessible();
23
34
  });
24
35
  it("loads [hold-affordance]", async () => {
25
- const el = await fixture(html`
36
+ const el = await fixture(
37
+ html`
26
38
  <sp-action-button hold-affordance>Button</sp-action-button>
27
- `);
39
+ `
40
+ );
28
41
  await elementUpdated(el);
29
42
  expect(el).to.not.be.undefined;
30
43
  expect(el.textContent).to.include("Button");
31
44
  await expect(el).to.be.accessible();
32
45
  });
33
46
  it("maintains a `size` attribute", async () => {
34
- const el = await fixture(html`
47
+ const el = await fixture(
48
+ html`
35
49
  <sp-action-button>Button</sp-action-button>
36
- `);
50
+ `
51
+ );
37
52
  await elementUpdated(el);
38
53
  expect(el.size).to.equal("m");
39
54
  expect(el.getAttribute("size")).to.equal("m");
@@ -44,14 +59,16 @@ describe("ActionButton", () => {
44
59
  });
45
60
  it("dispatches `longpress` events when [hold-affordance]", async () => {
46
61
  const longpressSpy = spy();
47
- const el = await fixture(html`
62
+ const el = await fixture(
63
+ html`
48
64
  <sp-action-button
49
65
  hold-affordance
50
66
  @longpress=${() => longpressSpy()}
51
67
  >
52
68
  Button
53
69
  </sp-action-button>
54
- `);
70
+ `
71
+ );
55
72
  await elementUpdated(el);
56
73
  el.focus();
57
74
  await sendKeys({
@@ -62,15 +79,36 @@ describe("ActionButton", () => {
62
79
  press: "Alt+ArrowDown"
63
80
  });
64
81
  expect(longpressSpy.callCount).to.equal(2);
65
- el.dispatchEvent(new Event("pointerdown"));
66
- el.dispatchEvent(new Event("pointerup"));
67
- el.dispatchEvent(new Event("pointerdown"));
82
+ el.dispatchEvent(new PointerEvent("pointerdown", { button: 0 }));
83
+ el.dispatchEvent(new PointerEvent("pointerup"));
84
+ el.dispatchEvent(new PointerEvent("pointerdown", { button: 0 }));
68
85
  await waitUntil(() => longpressSpy.callCount === 3);
69
86
  });
87
+ it('does not dispatch `longpress` events when "right click"ed', async () => {
88
+ const longpressSpy = spy();
89
+ const el = await fixture(
90
+ html`
91
+ <sp-action-button
92
+ hold-affordance
93
+ @longpress=${() => longpressSpy()}
94
+ >
95
+ Button
96
+ </sp-action-button>
97
+ `
98
+ );
99
+ await elementUpdated(el);
100
+ expect(longpressSpy.callCount).to.equal(0);
101
+ el.focus();
102
+ el.dispatchEvent(new PointerEvent("pointerdown", { button: 1 }));
103
+ await aTimeout(2 * LONGPRESS_DURATION);
104
+ expect(longpressSpy.callCount).to.equal(0);
105
+ });
70
106
  it(":not([toggles])", async () => {
71
- const el = await fixture(html`
107
+ const el = await fixture(
108
+ html`
72
109
  <sp-action-button>Button</sp-action-button>
73
- `);
110
+ `
111
+ );
74
112
  await elementUpdated(el);
75
113
  const button = el.focusElement;
76
114
  expect(el.toggles).to.be.false;
@@ -83,9 +121,11 @@ describe("ActionButton", () => {
83
121
  expect(button.hasAttribute("aria-pressed")).to.be.false;
84
122
  });
85
123
  it("responds to [selected]", async () => {
86
- const el = await fixture(html`
124
+ const el = await fixture(
125
+ html`
87
126
  <sp-action-button>Button</sp-action-button>
88
- `);
127
+ `
128
+ );
89
129
  await elementUpdated(el);
90
130
  const button = el.focusElement;
91
131
  expect(el.toggles).to.be.false;
@@ -103,9 +143,11 @@ describe("ActionButton", () => {
103
143
  expect(button.hasAttribute("aria-pressed")).to.be.false;
104
144
  });
105
145
  it("toggles", async () => {
106
- const el = await fixture(html`
146
+ const el = await fixture(
147
+ html`
107
148
  <sp-action-button toggles>Button</sp-action-button>
108
- `);
149
+ `
150
+ );
109
151
  await elementUpdated(el);
110
152
  const button = el.focusElement;
111
153
  expect(el.toggles).to.be.true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["action-button.test.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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { m as BlackActionButton } from '../stories/action-button-black.stories.js';\n\ndescribe('ActionButton', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ActionButton>(\n BlackActionButton(BlackActionButton.args)\n )\n );\n it('loads default', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('loads [hold-affordance]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button hold-affordance>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('maintains a `size` attribute', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n el.removeAttribute('size');\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n });\n it('dispatches `longpress` events when [hold-affordance]', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `\n );\n\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(longpressSpy.callCount).to.equal(1);\n await sendKeys({\n press: 'Alt+ArrowDown',\n });\n\n expect(longpressSpy.callCount).to.equal(2);\n el.dispatchEvent(new Event('pointerdown'));\n el.dispatchEvent(new Event('pointerup'));\n el.dispatchEvent(new Event('pointerdown'));\n await waitUntil(() => longpressSpy.callCount === 3);\n });\n it(':not([toggles])', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('responds to [selected]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.selected = true;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.selected = false;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('toggles', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button toggles>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button.getAttribute('aria-pressed')).to.equal('false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n });\n});\n"],
5
- "mappings": "AAYA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AACA;AACA;AACA;AAEA,SAAS,gBAAgB,MAAM;AAC3B,wBACI,YACI,MAAM,QACF,kBAAkB,kBAAkB,IAAI,CAC5C,CACR;AACA,KAAG,iBAAiB,YAAY;AAC5B,UAAM,KAAK,MAAM,QACb;AAAA;AAAA,aAGJ;AAEA,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AACrB,WAAO,GAAG,WAAW,EAAE,GAAG,QAAQ,QAAQ;AAC1C,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WA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,SAAS,GAAG;AAElB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,OAAO;AAE5D,OAAG,MAAM;AACT,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,MAAM;AAE3D,OAAG,iBAAiB,UAAU,CAAC,UAAiB,MAAM,eAAe,CAAC;AACtE,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,MAAM;AAAA,EAC/D,CAAC;AACL,CAAC;",
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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport {\n ActionButton,\n LONGPRESS_DURATION,\n} from '@spectrum-web-components/action-button';\nimport {\n aTimeout,\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { m as BlackActionButton } from '../stories/action-button-black.stories.js';\n\ndescribe('ActionButton', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<ActionButton>(\n BlackActionButton(BlackActionButton.args)\n )\n );\n it('loads default', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('loads [hold-affordance]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button hold-affordance>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('maintains a `size` attribute', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n el.removeAttribute('size');\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n });\n it('dispatches `longpress` events when [hold-affordance]', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `\n );\n\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(longpressSpy.callCount).to.equal(1);\n await sendKeys({\n press: 'Alt+ArrowDown',\n });\n\n expect(longpressSpy.callCount).to.equal(2);\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 0 }));\n el.dispatchEvent(new PointerEvent('pointerup'));\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 0 }));\n await waitUntil(() => longpressSpy.callCount === 3);\n });\n it('does not dispatch `longpress` events when \"right click\"ed', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(longpressSpy.callCount).to.equal(0);\n\n el.focus();\n el.dispatchEvent(new PointerEvent('pointerdown', { button: 1 }));\n await aTimeout(2 * LONGPRESS_DURATION);\n expect(longpressSpy.callCount).to.equal(0);\n });\n it(':not([toggles])', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('responds to [selected]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.selected = true;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.selected = false;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('toggles', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button toggles>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button.getAttribute('aria-pressed')).to.equal('false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n });\n});\n"],
5
+ "mappings": ";AAYA,OAAO;AACP;AAAA,EAEI;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,6BAA6B;AACtC,SAAS,KAAK,yBAAyB;AAEvC,SAAS,gBAAgB,MAAM;AAC3B;AAAA,IACI,YACI,MAAM;AAAA,MACF,kBAAkB,kBAAkB,IAAI;AAAA,IAC5C;AAAA,EACR;AACA,KAAG,iBAAiB,YAAY;AAC5B,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AACrB,WAAO,GAAG,WAAW,EAAE,GAAG,QAAQ,QAAQ;AAC1C,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,2BAA2B,YAAY;AACtC,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AACrB,WAAO,GAAG,WAAW,EAAE,GAAG,QAAQ,QAAQ;AAC1C,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,gCAAgC,YAAY;AAC3C,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AACvB,WAAO,GAAG,IAAI,EAAE,GAAG,MAAM,GAAG;AAC5B,WAAO,GAAG,aAAa,MAAM,CAAC,EAAE,GAAG,MAAM,GAAG;AAC5C,OAAG,gBAAgB,MAAM;AACzB,UAAM,eAAe,EAAE;AACvB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O,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,OAAO;AAE5D,OAAG,MAAM;AACT,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,MAAM;AAE3D,OAAG,iBAAiB,UAAU,CAAC,UAAiB,MAAM,eAAe,CAAC;AACtE,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,MAAM;AAAA,EAC/D,CAAC;AACL,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import "@spectrum-web-components/action-button/sp-action-button.js";
2
3
  import { html } from "lit";
3
4
  import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["basic-test.ts"],
4
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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-button open></sp-action-button>\n`);\n"],
5
- "mappings": "AAYA;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA,CAEtB;",
5
+ "mappings": ";AAYA,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA,CAEtB;",
6
6
  "names": []
7
7
  }